JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwBeamLine Class Reference

Subsystem aggregating beamline instruments (BPMs, BCMs, clocks, etc.) More...

#include <QwBeamLine.h>

+ Inheritance diagram for QwBeamLine:
+ Collaboration diagram for QwBeamLine:

Public Member Functions

 QwBeamLine (const TString &name)
 Constructor with name.
 
 QwBeamLine (const QwBeamLine &source)
 Copy constructor.
 
 ~QwBeamLine () override
 Virtual destructor.
 
void CopyTemplatedDataElements (const VQwSubsystem *source)
 
void ProcessOptions (QwOptions &options) override
 
Int_t LoadChannelMap (TString mapfile) override
 
Int_t LoadInputParameters (TString pedestalfile) override
 
void LoadEventCuts_Init () override
 
void LoadEventCuts_Line (QwParameterFile &mapstr, TString &varvalue, Int_t &eventcut_flag) override
 
void LoadEventCuts_Fin (Int_t &eventcut_flag) override
 
Int_t LoadGeometryDefinition (TString mapfile) override
 
void LoadMockDataParameters (TString mapfile) override
 
void AssignGeometry (QwParameterFile *mapstr, VQwBPM *bpm)
 
Bool_t ApplySingleEventCuts () override
 
void IncrementErrorCounters () override
 
Bool_t CheckForBurpFail (const VQwSubsystem *subsys) override
 
void PrintErrorCounters () const override
 
UInt_t GetEventcutErrorFlag () override
 
UInt_t UpdateErrorFlag () override
 
void UpdateErrorFlag (const VQwSubsystem *ev_error) override
 
Int_t ProcessConfigurationBuffer (const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
 
Int_t ProcessEvBuffer (const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
 Route raw ROC/bank buffer data to the correct devices and subelements.
 
void PrintDetectorID () const
 
void ClearEventData () override
 
void ProcessEvent () override
 
Bool_t PublishInternalValues () const override
 
Bool_t PublishByRequest (TString device_name) override
 
size_t GetNumberOfElements ()
 
void RandomizeEventData (int helicity=0, double time=0.0) override
 
void SetRandomEventAsymmetry (Double_t asymmetry)
 
void EncodeEventData (std::vector< UInt_t > &buffer) override
 
VQwSubsystemoperator= (VQwSubsystem *value) override
 Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value)
 
VQwSubsystemoperator+= (VQwSubsystem *value) override
 
VQwSubsystemoperator-= (VQwSubsystem *value) override
 
void Ratio (VQwSubsystem *numer, VQwSubsystem *denom) override
 
void Scale (Double_t factor) override
 
void AccumulateRunningSum (VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
 Update the running sums for devices.
 
void DeaccumulateRunningSum (VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
 remove one entry from the running sums for devices
 
void CalculateRunningAverage () override
 Calculate the average for all good events.
 
void ConstructHistograms (TDirectory *folder, TString &prefix) override
 Construct the histograms for this subsystem in a folder with a prefix.
 
void FillHistograms () override
 Fill the histograms for this subsystem.
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
 Construct the branch and tree vector.
 
void ConstructBranch (TTree *tree, TString &prefix) override
 Construct the branch and tree vector.
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &trim_file) override
 Construct the branch and tree vector based on the trim file.
 
void FillTreeVector (QwRootTreeBranchVector &values) const override
 Fill the tree vector.
 
Bool_t Compare (VQwSubsystem *source)
 
void PrintValue () const override
 Print values of all channels.
 
void PrintInfo () const override
 Print some information about the subsystem.
 
void WritePromptSummary (QwPromptSummary *ps, TString type) override
 
VQwDataElementGetElement (QwBeamDetectorID det_id)
 
VQwDataElementGetElement (EQwBeamInstrumentType TypeID, TString name)
 
VQwDataElementGetElement (EQwBeamInstrumentType TypeID, Int_t index)
 
const VQwDataElementGetElement (EQwBeamInstrumentType TypeID, Int_t index) const
 
const VQwHardwareChannelGetChannel (EQwBeamInstrumentType TypeID, Int_t index, TString device_prop) const
 
VQwBPMGetBPMStripline (const TString name)
 
VQwBCMGetBCM (const TString name)
 
VQwClockGetClock (const TString name)
 
QwBPMCavityGetBPMCavity (const TString name)
 
VQwBCMGetCombinedBCM (const TString name)
 
VQwBPMGetCombinedBPM (const TString name)
 
QwEnergyCalculatorGetEnergyCalculator (const TString name)
 
QwHaloMonitorGetScalerChannel (const TString name)
 
const QwBPMCavityGetBPMCavity (const TString name) const
 
const VQwBPMGetBPMStripline (const TString name) const
 
const VQwBCMGetBCM (const TString name) const
 
const VQwClockGetClock (const TString name) const
 
const VQwBCMGetCombinedBCM (const TString name) const
 
const VQwBPMGetCombinedBPM (const TString name) const
 
const QwEnergyCalculatorGetEnergyCalculator (const TString name) const
 
const QwHaloMonitorGetScalerChannel (const TString name) const
 
virtual void ConstructHistograms ()
 Construct the histograms for this subsystem.
 
virtual void ConstructHistograms (TDirectory *folder)
 Construct the histograms for this subsystem in a folder.
 
virtual void ConstructHistograms (TString &prefix)
 Construct the histograms for this subsystem with a prefix.
 
virtual void ConstructBranchAndVector (TTree *tree, QwRootTreeBranchVector &values)
 Construct the branch and tree vector.
 
- Public Member Functions inherited from VQwSubsystemParity
 VQwSubsystemParity (const TString &name)
 Constructor with name.
 
 VQwSubsystemParity (const VQwSubsystemParity &source)
 Copy constructor.
 
 ~VQwSubsystemParity () override
 Default destructor.
 
virtual void FillDB_MPS (QwParityDB *, TString)
 Fill the database with MPS-based variables Note that most subsystems don't need to do this.
 
virtual void FillDB (QwParityDB *, TString)
 Fill the database.
 
virtual void FillErrDB (QwParityDB *, TString)
 
virtual void Sum (VQwSubsystem *value1, VQwSubsystem *value2)
 
virtual void Difference (VQwSubsystem *value1, VQwSubsystem *value2)
 
Int_t LoadEventCuts (TString filename) override
 Load the event cuts file.
 
virtual void Blind (const QwBlinder *)
 Blind the asymmetry of this subsystem.
 
virtual void Blind (const QwBlinder *, const VQwSubsystemParity *)
 Blind the difference of this subsystem.
 
virtual Bool_t CheckForEndOfBurst () const
 
- Public Member Functions inherited from VQwSubsystem
 VQwSubsystem (const TString &name)
 Constructor with name.
 
 VQwSubsystem (const VQwSubsystem &orig)
 Copy constructor by object.
 
 ~VQwSubsystem () override
 Default destructor.
 
TString GetName () const
 
Bool_t HasDataLoaded () const
 
VQwSubsystemGetSibling (const std::string &name) const
 Get the sibling with specified name.
 
virtual std::vector< TString > GetParamFileNameList ()
 
virtual std::map< TString, TString > GetDetectorMaps ()
 
Bool_t PublishByRequest (TString) override
 Try to publish an internal variable matching the submitted name.
 
Bool_t PublishInternalValues () const override
 Publish all variables of the subsystem.
 
virtual Int_t LoadDetectorMaps (QwParameterFile &file)
 Parse parameter file to find the map files.
 
virtual Int_t LoadCrosstalkDefinition (TString)
 Optional crosstalk definition.
 
void SetEventTypeMask (const UInt_t mask)
 Set event type mask.
 
UInt_t GetEventTypeMask () const
 Get event type mask.
 
virtual Int_t ProcessEvBuffer (const UInt_t event_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words)
 
virtual void ExchangeProcessedData ()
 Request processed data from other subsystems for internal use in the second event processing stage. Not all derived classes will require data from other subsystems.
 
virtual void ProcessEvent_2 ()
 Process the event data again, including data from other subsystems. Not all derived classes will require a second stage of event data processing.
 
virtual void AtEndOfEventLoop ()
 Perform actions at the end of the event loop.
 
virtual void ConstructObjects ()
 Construct the objects for this subsystem.
 
virtual void ConstructObjects (TDirectory *folder)
 Construct the objects for this subsystem in a folder.
 
virtual void ConstructObjects (TString &prefix)
 Construct the objects for this subsystem with a prefix.
 
virtual void ConstructObjects (TDirectory *, TString &)
 Construct the objects for this subsystem in a folder with a prefix.
 
virtual void ConstructTree ()
 Construct the tree for this subsystem.
 
virtual void ConstructTree (TDirectory *folder)
 Construct the tree for this subsystem in a folder.
 
virtual void ConstructTree (TString &prefix)
 Construct the tree for this subsystem with a prefix.
 
virtual void ConstructTree (TDirectory *, TString &)
 Construct the tree for this subsystem in a folder with a prefix.
 
virtual void FillTree ()
 Fill the tree for this subsystem.
 
virtual void DeleteTree ()
 Delete the tree for this subsystem.
 
virtual void PrintDetectorMaps (Bool_t status) const
 
void GetMarkerWordList (const ROCID_t roc_id, const BankID_t bank_id, std::vector< UInt_t > &marker) const
 
std::vector< ROCID_tGetROCIds () const
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects.
 
- Public Member Functions inherited from MQwPublishable_child< QwSubsystemArray, VQwSubsystem >
 MQwPublishable_child ()
 Default constructor Initializes the child object and sets up self-reference for publishing.
 
 MQwPublishable_child (const MQwPublishable_child &source)
 Copy constructor.
 
virtual ~MQwPublishable_child ()
 Virtual destructor.
 
void SetParent (QwSubsystemArray *parent)
 Set the parent container for this child object.
 
QwSubsystemArrayGetParent () const
 Get the parent container for this child object.
 
- Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwBeamLine >
 ~MQwCloneable () override
 Virtual destructor.
 
VQwSubsystemClone () const override
 Concrete clone method.
 
const VQwFactory< VQwSubsystem > * Factory () const override
 Factory getter.
 
- Public Member Functions inherited from VQwCloneable< VQwSubsystem >
virtual ~VQwCloneable ()
 Virtual destructor.
 
std::string GetClassName () const
 Get demangled name of this class.
 

Protected Member Functions

template<typename TT>
Int_t AddToElementList (std::vector< TT > &elementlist, QwBeamDetectorID &detector_id)
 Adds a new element to a vector of data elements, and returns the index of that element within the array.
 
Int_t GetDetectorIndex (EQwBeamInstrumentType TypeID, TString name) const
 
template<>
Int_t AddToElementList (std::vector< VQwClock_ptr > &elementlist, QwBeamDetectorID &detector_id)
 
template<>
Int_t AddToElementList (std::vector< VQwBCM_ptr > &elementlist, QwBeamDetectorID &detector_id)
 
template<>
Int_t AddToElementList (std::vector< VQwBPM_ptr > &elementlist, QwBeamDetectorID &detector_id)
 
void ClearAllBankRegistrations ()
 Clear all registration of ROC and Bank IDs for this subsystem.
 
virtual Int_t RegisterROCNumber (const ROCID_t roc_id, const BankID_t bank_id=0)
 Tell the object that it will decode data from this ROC and sub-bank.
 
Int_t RegisterSubbank (const BankID_t bank_id)
 Tell the object that it will decode data from this sub-bank in the ROC currently open for registration.
 
Int_t RegisterMarkerWord (const UInt_t markerword)
 
void RegisterRocBankMarker (QwParameterFile &mapstr)
 
Int_t GetSubbankIndex () const
 
Int_t GetSubbankIndex (const ROCID_t roc_id, const BankID_t bank_id) const
 
void SetDataLoaded (Bool_t flag)
 
template<class T>
Int_t FindIndex (const std::vector< T > &myvec, const T value) const
 
Bool_t Compare (VQwSubsystem *source)
 
- Protected Member Functions inherited from MQwHistograms
 MQwHistograms ()
 Default constructor.
 
 MQwHistograms (const MQwHistograms &source)
 Copy constructor.
 
virtual ~MQwHistograms ()
 Virtual destructor.
 
MQwHistogramsoperator= (const MQwHistograms &value)
 
void Fill_Pointer (TH1_ptr hist_ptr, Double_t value)
 
void AddHistogram (TH1 *h)
 Register a histogram.
 
- Protected Member Functions inherited from MQwPublishable_child< QwSubsystemArray, VQwSubsystem >
Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from other subsystem arrays Get the value corresponding to some variable name from a different data array.
 
const VQwHardwareChannelRequestExternalPointer (const TString &name) const
 Retrieve a pointer to an external variable by name Requests a direct pointer to a variable from sibling subsystems via the parent container.
 
Bool_t PublishInternalValue (const TString name, const TString desc, const VQwHardwareChannel *element) const
 Publish a variable from this child into the parent container.
 

Protected Attributes

std::vector< VQwBPM_ptrfStripline
 
std::vector< VQwBPM_ptrfBPMCombo
 
std::vector< VQwBCM_ptrfBCM
 
std::vector< VQwBCM_ptrfBCMCombo
 
std::vector< VQwClock_ptrfClock
 
std::vector< QwQPDfQPD
 
std::vector< QwLinearDiodeArrayfLinearArray
 
std::vector< QwBPMCavityfCavity
 
std::vector< QwHaloMonitorfHaloMonitor
 
std::vector< QwEnergyCalculatorfECalculator
 
std::vector< QwBeamDetectorIDfBeamDetectorID
 
- Protected Attributes inherited from VQwSubsystem
std::vector< std::vector< TString > > fPublishList
 
TString fSystemName
 Name of this subsystem.
 
UInt_t fEventTypeMask
 Mask of event types.
 
Bool_t fIsDataLoaded
 Has this subsystem gotten data to be processed?
 
std::vector< TString > fDetectorMapsNames
 Names of loaded detector map files.
 
std::map< TString, TString > fDetectorMaps
 Map of file name to full path or content.
 
ROCID_t fCurrentROC_ID
 ROC ID that is currently being processed.
 
BankID_t fCurrentBank_ID
 Bank ID (and Marker word) that is currently being processed;.
 
std::vector< ROCID_tfROC_IDs
 Vector of ROC IDs associated with this subsystem.
 
std::vector< std::vector< BankID_t > > fBank_IDs
 Vector of Bank IDs per ROC ID associated with this subsystem.
 
std::vector< std::vector< std::vector< UInt_t > > > fMarkerWords
 Vector of marker words per ROC & subbank associated with this subsystem.
 
- Protected Attributes inherited from MQwHistograms
std::vector< TH1_ptrfHistograms
 Histograms associated with this data element.
 

Private Member Functions

 QwBeamLine ()
 Private default constructor (not implemented, will throw linker error on use)
 

Private Attributes

Int_t fQwBeamLineErrorCount
 

Static Private Attributes

static const Bool_t bDEBUG =kFALSE
 

Additional Inherited Members

- Static Public Member Functions inherited from VQwSubsystem
static void DefineOptions ()
 Define options function (note: no virtual static functions in C++)
 
- Static Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwBeamLine >
static VQwSubsystemCreate (const std::string &name)
 Object creation.
 
static QwBeamLineCast (QwBeamLine *type)
 Object dynamic cast.
 

Detailed Description

Subsystem aggregating beamline instruments (BPMs, BCMs, clocks, etc.)

QwBeamLine owns and orchestrates multiple beam monitoring devices and provides a unified subsystem interface for map loading, event decoding, event processing, cuts, error propagation, histogram/tree output, and publishing. It supports combinations (e.g., combined BPM/BCM), mock-data generation, and stability/burp checks at the subsystem level.

Definition at line 43 of file QwBeamLine.h.

Constructor & Destructor Documentation

◆ QwBeamLine() [1/3]

QwBeamLine::QwBeamLine ( )
private

Private default constructor (not implemented, will throw linker error on use)

Referenced by AccumulateRunningSum(), CheckForBurpFail(), Compare(), CopyTemplatedDataElements(), DeaccumulateRunningSum(), GetBCM(), GetBPMCavity(), GetBPMStripline(), GetClock(), GetCombinedBCM(), GetCombinedBPM(), GetElement(), GetEnergyCalculator(), GetScalerChannel(), operator+=(), operator-=(), operator=(), QwBeamLine(), Ratio(), and UpdateErrorFlag().

+ Here is the caller graph for this function:

◆ QwBeamLine() [2/3]

QwBeamLine::QwBeamLine ( const TString & name)
inline

Constructor with name.

Definition at line 51 of file QwBeamLine.h.

53 { };
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)

References VQwSubsystem::VQwSubsystem(), and VQwSubsystemParity::VQwSubsystemParity().

+ Here is the call graph for this function:

◆ QwBeamLine() [3/3]

QwBeamLine::QwBeamLine ( const QwBeamLine & source)
inline

Copy constructor.

Definition at line 55 of file QwBeamLine.h.

56 : VQwSubsystem(source),VQwSubsystemParity(source),
57 fQPD(source.fQPD),
59 fCavity(source.fCavity),
63 { this->CopyTemplatedDataElements(&source); }
void CopyTemplatedDataElements(const VQwSubsystem *source)
std::vector< QwLinearDiodeArray > fLinearArray
Definition QwBeamLine.h:198
std::vector< QwEnergyCalculator > fECalculator
Definition QwBeamLine.h:203
std::vector< QwBeamDetectorID > fBeamDetectorID
Definition QwBeamLine.h:204
std::vector< QwBPMCavity > fCavity
Definition QwBeamLine.h:199
std::vector< QwQPD > fQPD
Definition QwBeamLine.h:197
std::vector< QwHaloMonitor > fHaloMonitor
Definition QwBeamLine.h:200

References CopyTemplatedDataElements(), fBeamDetectorID, fCavity, fECalculator, fHaloMonitor, fLinearArray, fQPD, QwBeamLine(), VQwSubsystem::VQwSubsystem(), and VQwSubsystemParity::VQwSubsystemParity().

+ Here is the call graph for this function:

◆ ~QwBeamLine()

QwBeamLine::~QwBeamLine ( )
inlineoverride

Virtual destructor.

Definition at line 65 of file QwBeamLine.h.

65{ };

Member Function Documentation

◆ AccumulateRunningSum()

void QwBeamLine::AccumulateRunningSum ( VQwSubsystem * value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )
overridevirtual

Update the running sums for devices.

Implements VQwSubsystemParity.

Definition at line 2356 of file QwBeamLine.cc.

2357{
2358 if (Compare(value1)) {
2359 QwBeamLine* value = dynamic_cast<QwBeamLine*>(value1);
2360
2361 for (size_t i = 0; i < fClock.size(); i++)
2362 fClock[i].get()->AccumulateRunningSum(*(value->fClock[i].get()), count, ErrorMask);
2363 for (size_t i = 0; i < fStripline.size(); i++)
2364 fStripline[i].get()->AccumulateRunningSum(*(value->fStripline[i].get()), count, ErrorMask);
2365 for (size_t i = 0; i < fCavity.size(); i++)
2366 fCavity[i].AccumulateRunningSum(value->fCavity[i], count, ErrorMask);
2367 for (size_t i = 0; i < fBCM.size(); i++)
2368 fBCM[i].get()->AccumulateRunningSum(*(value->fBCM[i].get()), count, ErrorMask);
2369 for (size_t i = 0; i < fBCMCombo.size(); i++)
2370 fBCMCombo[i].get()->AccumulateRunningSum(*(value->fBCMCombo[i].get()), count, ErrorMask);
2371 for (size_t i = 0; i < fBPMCombo.size(); i++)
2372 fBPMCombo[i].get()->AccumulateRunningSum(*(value->fBPMCombo[i].get()), count, ErrorMask);
2373 for (size_t i = 0; i < fECalculator.size(); i++)
2374 fECalculator[i].AccumulateRunningSum(value->fECalculator[i], count, ErrorMask);
2375 for (size_t i = 0; i < fQPD.size(); i++)
2376 fQPD[i].AccumulateRunningSum(value->fQPD[i], count, ErrorMask);
2377 for (size_t i = 0; i < fLinearArray.size(); i++)
2378 fLinearArray[i].AccumulateRunningSum(value->fLinearArray[i], count, ErrorMask);
2379 for (size_t i = 0; i <fHaloMonitor.size(); i++)
2380 fHaloMonitor[i].AccumulateRunningSum(value->fHaloMonitor[i], count, ErrorMask);
2381
2382 }
2383}
std::vector< VQwBCM_ptr > fBCM
Definition QwBeamLine.h:192
Bool_t Compare(VQwSubsystem *source)
std::vector< VQwBPM_ptr > fStripline
Definition QwBeamLine.h:189
QwBeamLine()
Private default constructor (not implemented, will throw linker error on use)
std::vector< VQwBPM_ptr > fBPMCombo
Definition QwBeamLine.h:190
std::vector< VQwBCM_ptr > fBCMCombo
Definition QwBeamLine.h:193
void AccumulateRunningSum(VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
Update the running sums for devices.
std::vector< VQwClock_ptr > fClock
Definition QwBeamLine.h:195

References AccumulateRunningSum(), Compare(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

Referenced by AccumulateRunningSum().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToElementList() [1/4]

template<typename TT>
Int_t QwBeamLine::AddToElementList ( std::vector< TT > & elementlist,
QwBeamDetectorID & detector_id )
protected

Adds a new element to a vector of data elements, and returns the index of that element within the array.

Definition at line 92 of file QwBeamLine.cc.

94{
95 TT element(GetName(), detector_id.fdetectorname);
96 elementlist.push_back(element);
97 detector_id.fIndex = elementlist.size()-1;
98 return detector_id.fIndex;
99}
TString GetName() const

References QwBeamDetectorID::fdetectorname, QwBeamDetectorID::fIndex, and VQwSubsystem::GetName().

Referenced by LoadChannelMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToElementList() [2/4]

template<>
Int_t QwBeamLine::AddToElementList ( std::vector< VQwBCM_ptr > & elementlist,
QwBeamDetectorID & detector_id )
protected

Definition at line 61 of file QwBeamLine.cc.

63{
64 if (detector_id.fTypeID == kQwBCM){
65 VQwBCM_ptr element(
67 detector_id.fdetectorname,
68 detector_id.fmoduletype) );
69 elementlist.push_back(element);
70 }
71 detector_id.fIndex = elementlist.size()-1;
72 return detector_id.fIndex;
73}
@ kQwBCM
Definition QwTypes.h:148
std::shared_ptr< VQwBCM > VQwBCM_ptr
Definition VQwBCM.h:184
EQwBeamInstrumentType fTypeID
static VQwBCM * Create(TString subsystemname, TString type, TString name, TString clock="")
Factory method to create a concrete BCM instance for the requested module type.
Definition VQwBCM.cc:41

References VQwBCM::Create(), QwBeamDetectorID::fdetectorname, QwBeamDetectorID::fIndex, QwBeamDetectorID::fmoduletype, QwBeamDetectorID::fTypeID, VQwSubsystem::GetName(), and kQwBCM.

+ Here is the call graph for this function:

◆ AddToElementList() [3/4]

template<>
Int_t QwBeamLine::AddToElementList ( std::vector< VQwBPM_ptr > & elementlist,
QwBeamDetectorID & detector_id )
protected

Definition at line 76 of file QwBeamLine.cc.

78{
79 if (detector_id.fTypeID == kQwBPMStripline){
80 VQwBPM_ptr element(
82 detector_id.fdetectorname,
83 detector_id.fmoduletype) );
84 elementlist.push_back(element);
85 }
86 detector_id.fIndex = elementlist.size()-1;
87 return detector_id.fIndex;
88}
@ kQwBPMStripline
Definition QwTypes.h:145
std::shared_ptr< VQwBPM > VQwBPM_ptr
Definition VQwBPM.h:354
static VQwBPM * CreateStripline(TString subsystemname, TString type, TString name)
A fast way of creating a BPM stripline of specified type.
Definition VQwBPM.cc:267

References VQwBPM::CreateStripline(), QwBeamDetectorID::fdetectorname, QwBeamDetectorID::fIndex, QwBeamDetectorID::fmoduletype, QwBeamDetectorID::fTypeID, VQwSubsystem::GetName(), and kQwBPMStripline.

+ Here is the call graph for this function:

◆ AddToElementList() [4/4]

template<>
Int_t QwBeamLine::AddToElementList ( std::vector< VQwClock_ptr > & elementlist,
QwBeamDetectorID & detector_id )
protected

Definition at line 46 of file QwBeamLine.cc.

48{
49 if (detector_id.fTypeID == kQwClock){
50 VQwClock_ptr element(
52 detector_id.fdetectorname,
53 detector_id.fmoduletype) );
54 elementlist.push_back(element);
55 }
56 detector_id.fIndex = elementlist.size()-1;
57 return detector_id.fIndex;
58}
@ kQwClock
Definition QwTypes.h:154
std::shared_ptr< VQwClock > VQwClock_ptr
Definition VQwClock.h:121
static VQwClock * Create(TString subsystemname, TString type, TString name)
Definition VQwClock.cc:30

References VQwClock::Create(), QwBeamDetectorID::fdetectorname, QwBeamDetectorID::fIndex, QwBeamDetectorID::fmoduletype, QwBeamDetectorID::fTypeID, VQwSubsystem::GetName(), and kQwClock.

+ Here is the call graph for this function:

◆ ApplySingleEventCuts()

Bool_t QwBeamLine::ApplySingleEventCuts ( )
overridevirtual

Apply single-event cuts to all devices and count failures.

Implements VQwSubsystemParity.

Definition at line 1290 of file QwBeamLine.cc.

1290 {
1291
1292 Bool_t status=kTRUE;
1293
1294 for(size_t i=0;i<fBCM.size();i++){
1295 status &= fBCM[i].get()->ApplySingleEventCuts();
1296 if(!status && bDEBUG) std::cout<<"******* QwBeamLine::SingleEventCuts()->BCM[ "<<i
1297 <<" , "<<fBCM[i].get()->GetElementName()<<" ] ******\n";
1298 }
1299
1300 for(size_t i=0;i<fClock.size();i++){
1301 status &= fClock[i].get()->ApplySingleEventCuts();
1302 if(!status && bDEBUG) std::cout<<"******* QwBeamLine::SingleEventCuts()->Clock[ "<<i
1303 <<" , "<<fClock[i].get()->GetElementName()<<" ] ******\n";
1304 }
1305
1306 for(size_t i=0;i<fHaloMonitor.size();i++){
1307 status &= fHaloMonitor[i].ApplySingleEventCuts();
1308 if(!status && bDEBUG) std::cout<<"******* QwBeamLine::SingleEventCuts()->HaloMonitor[ "<<i
1309 <<" , "<<fHaloMonitor[i].GetElementName()<<" ] ******\n";
1310 }
1311
1312 for(size_t i=0;i<fStripline.size();i++){
1313 status &= fStripline[i].get()->ApplySingleEventCuts();
1314 if(!status && bDEBUG) std::cout<<"******** QwBeamLine::SingleEventCuts()->BPMStripline[ "<<i
1315 <<" , "<<fStripline[i].get()->GetElementName()<<" ] *****\n";
1316
1317 }
1318
1319 for(size_t i=0;i<fQPD.size();i++){
1320 status &= fQPD[i].ApplySingleEventCuts();
1321 if(!status && bDEBUG) std::cout<<"******** QwBeamLine::SingleEventCuts()->QPD[ "<<i
1322 <<" , "<<fQPD[i].GetElementName()<<" ] *****\n";
1323 }
1324 for(size_t i=0;i<fLinearArray.size();i++){
1325 status &= fLinearArray[i].ApplySingleEventCuts();
1326 if(!status && bDEBUG) std::cout<<"******** QwBeamLine::SingleEventCuts()->LinearArray[ "<<i
1327 <<" , "<<fLinearArray[i].GetElementName()<<" ] *****\n";
1328 }
1329
1330 for(size_t i=0;i<fCavity.size();i++){
1331 status &= fCavity[i].ApplySingleEventCuts();
1332 if(!status && bDEBUG) std::cout<<"******** QwBeamLine::SingleEventCuts()->BPMCavity[ "<<i
1333 <<" , "<<fCavity[i].GetElementName()<<" ] *****\n";
1334 }
1335
1336 for(size_t i=0;i<fBCMCombo.size();i++){
1337 status &= fBCMCombo[i].get()->ApplySingleEventCuts();
1338 if(!status && bDEBUG) std::cout<<"******* QwBeamLine::SingleEventCuts()->CombinedBCM[ "<<i
1339 <<" , "<<fBCMCombo[i].get()->GetElementName()<<" ] ******\n";
1340 }
1341
1342 for(size_t i=0;i<fBPMCombo.size();i++){
1343 status &= fBPMCombo[i].get()->ApplySingleEventCuts();
1344 if(!status && bDEBUG) std::cout<<"******* QwBeamLine::SingleEventCuts()->CombinedBPM[ "<<i
1345 <<" , "<<fBPMCombo[i].get()->GetElementName()<<" ] ******\n";
1346
1347 }
1348 for(size_t i=0;i<fECalculator.size();i++){
1349 status &= fECalculator[i].ApplySingleEventCuts();
1350 if(!status && bDEBUG) std::cout<<"******* QwBeamLine::SingleEventCuts()->EnergyCalculator[ "<<i
1351 <<" , "<<fECalculator[i].GetElementName()<<" ] ******\n";
1352
1353 }
1354
1355
1356 //If at least one of the devices failed event cuts, increment error counter for QwBeamLine
1357 if (!status)
1359
1360
1361 return status;
1362
1363}
Int_t fQwBeamLineErrorCount
Definition QwBeamLine.h:211
static const Bool_t bDEBUG
Definition QwBeamLine.h:214

References bDEBUG, fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fQwBeamLineErrorCount, and fStripline.

◆ AssignGeometry()

void QwBeamLine::AssignGeometry ( QwParameterFile * mapstr,
VQwBPM * bpm )

Parse rotation and gain tokens for a BPM and apply to the instance.

Definition at line 796 of file QwBeamLine.cc.

797{
798
799 Bool_t ldebug = kFALSE;
800
801 TString token = "0";
802 TString angle,xgain,ygain;
803 Double_t rotation_angle = 0;
804
805 while(token!=""){
806 token= mapstr->GetTypedNextToken<TString>();
807 token.Remove(TString::kBoth,'\0');
808
809 if(token.Contains("unrotated")){
810 if(ldebug) std::cout<<" unrotated "<<std::endl;
811 bpm->SetRotationOff();
812 }
813 else if(token.Contains("rotation")){
814 // If the status is 'rotated'
815
816 // If a specific rotation angle is given read that
817 if(token.Contains("=")){
818 angle = token.Remove(0,9);
819 rotation_angle = atof(angle);
820 if(ldebug) std::cout<<"Rotation angle = "<<rotation_angle<<std::endl;
821 bpm->SetRotation(rotation_angle);
822 }
823 }
824 // If nothing is specified for rotation, a default rotation of 45 degrees is implied.
825
826 if(token.Contains("xgain")){
827 xgain = token.Remove(0,6);
828 if(ldebug) std::cout<<" xgain ="<<xgain<<std::endl;
829 bpm->SetGains("X", atof(xgain));
830 }
831
832 if(token.Contains("ygain")){
833 ygain = token.Remove(0,6);
834 if(ldebug) std::cout<<" ygain ="<<ygain<<std::endl;
835 bpm->SetGains("Y", atof(ygain));
836 }
837 }
838}
T GetTypedNextToken()
Get next token into specific type.
void SetRotation(Double_t)
Set detector rotation angle and update cached trigonometric values.
Definition VQwBPM.cc:108
void SetRotationOff()
Definition VQwBPM.cc:126
void SetGains(TString pos, Double_t value)
Definition VQwBPM.cc:134

References QwParameterFile::GetTypedNextToken(), VQwBPM::SetGains(), VQwBPM::SetRotation(), and VQwBPM::SetRotationOff().

Referenced by LoadGeometryDefinition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateRunningAverage()

void QwBeamLine::CalculateRunningAverage ( )
overridevirtual

Calculate the average for all good events.

Implements VQwSubsystemParity.

Definition at line 2314 of file QwBeamLine.cc.

2315{
2316 for (size_t i = 0; i < fClock.size(); i++) fClock[i].get()->CalculateRunningAverage();
2317 for (size_t i = 0; i < fStripline.size(); i++) fStripline[i].get()->CalculateRunningAverage();
2318 for (size_t i = 0; i < fCavity.size(); i++) fCavity[i].CalculateRunningAverage();
2319 for (size_t i = 0; i < fQPD.size(); i++) fQPD[i].CalculateRunningAverage();
2320 for (size_t i = 0; i < fLinearArray.size(); i++) fLinearArray[i].CalculateRunningAverage();
2321 for (size_t i = 0; i < fBCM.size(); i++) fBCM[i].get()->CalculateRunningAverage();
2322 for (size_t i = 0; i < fHaloMonitor.size(); i++) fHaloMonitor[i].CalculateRunningAverage();
2323 for (size_t i = 0; i < fBCMCombo.size(); i++) fBCMCombo[i].get()->CalculateRunningAverage();
2324 for (size_t i = 0; i < fBPMCombo.size(); i++) fBPMCombo[i].get()->CalculateRunningAverage();
2325 for (size_t i = 0; i < fECalculator.size(); i++) fECalculator[i].CalculateRunningAverage();
2326}
void CalculateRunningAverage() override
Calculate the average for all good events.

References CalculateRunningAverage(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, and fStripline.

Referenced by CalculateRunningAverage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckForBurpFail()

Bool_t QwBeamLine::CheckForBurpFail ( const VQwSubsystem * subsys)
overridevirtual

Polymorphic per-device burp/burst check vs. a reference subsystem.

Implements VQwSubsystemParity.

Definition at line 1366 of file QwBeamLine.cc.

1366 {
1367 Bool_t burpstatus = kFALSE;
1368 VQwSubsystem* tmp = const_cast<VQwSubsystem *>(subsys);
1369 if(Compare(tmp)) {
1370 const QwBeamLine* input = dynamic_cast<const QwBeamLine*>(subsys);
1371 for(size_t i=0;i<input->fClock.size();i++){
1372 //QwError << "************* test Clock *****************" << QwLog::endl;
1373 burpstatus |= (this->fClock[i].get())->CheckForBurpFail(input->fClock[i].get());
1374 }
1375 for(size_t i=0;i<input->fStripline.size();i++){
1376 //QwError << "************* test stripline *****************" << QwLog::endl;
1377 burpstatus |= (this->fStripline[i].get())->CheckForBurpFail(input->fStripline[i].get());
1378 }
1379 for(size_t i=0;i<input->fQPD.size();i++){
1380 //QwError << "************* test QPD *****************" << QwLog::endl;
1381 burpstatus |= (this->fQPD[i]).CheckForBurpFail(&(input->fQPD[i]));
1382 }
1383 for(size_t i=0;i<input->fLinearArray.size();i++){
1384 //QwError << "************* test Lin *****************" << QwLog::endl;
1385 burpstatus |= (this->fLinearArray[i]).CheckForBurpFail(&(input->fLinearArray[i]));
1386 }
1387 for(size_t i=0;i<input->fCavity.size();i++){
1388 //QwError << "************* test Cavity *****************" << QwLog::endl;
1389 burpstatus |= (this->fCavity[i]).CheckForBurpFail(&(input->fCavity[i]));
1390 }
1391 for(size_t i=0;i<input->fBCM.size();i++){
1392 //QwError << "************* test BCM *****************" << QwLog::endl;
1393 burpstatus |= (this->fBCM[i].get())->CheckForBurpFail(input->fBCM[i].get());
1394 }
1395 for(size_t i=0;i<input->fBCMCombo.size();i++){
1396 //QwError << "************* test BCMC *****************" << QwLog::endl;
1397 burpstatus |= (this->fBCMCombo[i].get())->CheckForBurpFail(input->fBCMCombo[i].get());
1398 }
1399 for(size_t i=0;i<input->fBPMCombo.size();i++){
1400 //QwError << "************* test BPMC *****************" << QwLog::endl;
1401 burpstatus |= (this->fBPMCombo[i].get())->CheckForBurpFail(input->fBPMCombo[i].get());
1402 }
1403 for(size_t i=0;i<input->fECalculator.size();i++){
1404 //QwError << "************* test ECalc *****************" << QwLog::endl;
1405 burpstatus |= (this->fECalculator[i]).CheckForBurpFail(&(input->fECalculator[i]));
1406 }
1407 for(size_t i=0;i<input->fHaloMonitor.size();i++){
1408 //QwError << "************* test Halo *****************" << QwLog::endl;
1409 burpstatus |= (this->fHaloMonitor[i]).CheckForBurpFail(&(input->fHaloMonitor[i]));
1410 }
1411 }
1412 return burpstatus;
1413}
VQwSubsystem(const TString &name)
Constructor with name.
Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override

References CheckForBurpFail(), Compare(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

Referenced by CheckForBurpFail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearEventData()

void QwBeamLine::ClearEventData ( )
overridevirtual

Clear current-event state for all managed devices.

Implements VQwSubsystem.

Definition at line 1781 of file QwBeamLine.cc.

1782{
1783 for(size_t i=0;i<fClock.size();i++)
1784 fClock[i].get()->ClearEventData();
1785 for(size_t i=0;i<fStripline.size();i++)
1786 fStripline[i].get()->ClearEventData();
1787 for(size_t i=0;i<fCavity.size();i++)
1789 for(size_t i=0;i<fBCM.size();i++)
1790 fBCM[i]->ClearEventData();
1791 for(size_t i=0;i<fQPD.size();i++)
1792 fQPD[i].ClearEventData();
1793 for(size_t i=0;i<fLinearArray.size();i++)
1795 for(size_t i=0;i<fHaloMonitor.size();i++)
1797
1798 for(size_t i=0;i<fBCMCombo.size();i++)
1799 fBCMCombo[i].get()->ClearEventData();
1800 for(size_t i=0;i<fBPMCombo.size();i++)
1801 fBPMCombo[i].get()->ClearEventData();
1802 for(size_t i=0;i<fECalculator.size();i++)
1804 return;
1805}
void ClearEventData() override

References ClearEventData(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, and fStripline.

Referenced by ClearEventData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Compare()

Bool_t QwBeamLine::Compare ( VQwSubsystem * source)

Definition at line 2414 of file QwBeamLine.cc.

2415{
2416 // std::cout<<" Here in QwBeamLine::Compare \n";
2417
2418 Bool_t res=kTRUE;
2419 if(typeid(*value)!=typeid(*this))
2420 {
2421 res=kFALSE;
2422 // std::cout<<" types are not ok \n";
2423 // std::cout<<" this is bypassed just for now but should be fixed eventually \n";
2424 }
2425 else
2426 {
2427 QwBeamLine* input = dynamic_cast<QwBeamLine*>(value);
2428 if(input->fStripline.size()!=fStripline.size())
2429 {
2430 // std::cout<<" not the same number of striplines \n";
2431 res=kFALSE;
2432 }
2433 else if(input->fBCM.size()!=fBCM.size())
2434 {
2435 res=kFALSE;
2436 // std::cout<<" not the same number of bcms \n";
2437 }
2438 else if(input->fHaloMonitor.size()!=fHaloMonitor.size())
2439 {
2440 res=kFALSE;
2441 // std::cout<<" not the same number of halomonitors \n";
2442 }
2443 else if(input->fClock.size()!=fClock.size()){
2444 res=kFALSE;
2445 // std::cout<<" not the same number of halomonitors \n";
2446 }else if(input->fBCMCombo.size()!=fBCMCombo.size()){
2447 res=kFALSE;
2448 }else if(input->fBPMCombo.size()!=fBPMCombo.size()){
2449 res=kFALSE;
2450 }else if(input->fLinearArray.size()!=fLinearArray.size()){
2451 res=kFALSE;
2452 }else if(input->fECalculator.size()!=fECalculator.size()){
2453 res=kFALSE;
2454 }else if(input->fCavity.size()!=fCavity.size()){
2455 res=kFALSE;
2456 }else if(input->fQPD.size()!=fQPD.size()){
2457 res=kFALSE;
2458 }
2459
2460 }
2461 return res;
2462}

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

Referenced by AccumulateRunningSum(), CheckForBurpFail(), DeaccumulateRunningSum(), operator+=(), operator-=(), operator=(), Ratio(), and UpdateErrorFlag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructBranch() [1/2]

void QwBeamLine::ConstructBranch ( TTree * tree,
TString & prefix )
overridevirtual

Construct the branch and tree vector.

Construct the branches for this subsystem.

Parameters
treeOutput ROOT tree.
prefixName prefix for all branch names.

Implements VQwSubsystem.

Definition at line 2559 of file QwBeamLine.cc.

2560{
2561 for(size_t i = 0; i < fClock.size(); i++)
2562 fClock[i].get()->ConstructBranch(tree, prefix);
2563 for(size_t i = 0; i < fStripline.size(); i++)
2564 fStripline[i].get()->ConstructBranch(tree, prefix);
2565 for(size_t i = 0; i < fQPD.size(); i++)
2566 fQPD[i].ConstructBranch(tree, prefix);
2567 for(size_t i = 0; i < fLinearArray.size(); i++)
2568 fLinearArray[i].ConstructBranch(tree, prefix);
2569 for(size_t i = 0; i < fBCM.size(); i++)
2570 fBCM[i].get()->ConstructBranch(tree, prefix);
2571 for(size_t i = 0; i <fCavity.size(); i++)
2572 fStripline[i].get()->ConstructBranch(tree, prefix);
2573 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2574 fHaloMonitor[i].ConstructBranch(tree, prefix);
2575 for(size_t i = 0; i <fBCMCombo.size();i++)
2576 fBCMCombo[i].get()->ConstructBranch(tree, prefix);
2577 for(size_t i = 0; i <fBPMCombo.size();i++)
2578 fBPMCombo[i].get()->ConstructBranch(tree, prefix);
2579 for(size_t i = 0; i <fECalculator.size();i++)
2580 fECalculator[i].ConstructBranch(tree, prefix);
2581
2582
2583 return;
2584}
void ConstructBranch(TTree *tree, TString &prefix) override
Construct the branch and tree vector.

References ConstructBranch(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, and fStripline.

Referenced by ConstructBranch(), and ConstructBranch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructBranch() [2/2]

void QwBeamLine::ConstructBranch ( TTree * tree,
TString & prefix,
QwParameterFile & trim_file )
overridevirtual

Construct the branch and tree vector based on the trim file.

Construct the branches for this subsystem using a trim file.

Parameters
treeOutput ROOT tree.
prefixName prefix for all branch names.
trim_fileTrim file describing which branches to construct.

Implements VQwSubsystem.

Definition at line 2587 of file QwBeamLine.cc.

2588{
2589 TString tmp,varname,varvalue;
2590 tmp="QwBCM";
2591 std::unique_ptr<QwParameterFile> nextmodule;
2592 trim_file.RewindToFileStart();
2593
2594
2595 tmp="QwBPMStripline";
2596 trim_file.RewindToFileStart();
2597 if (trim_file.FileHasModuleHeader(tmp)){
2598 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2599 for(size_t i = 0; i < fStripline.size(); i++)
2600 fStripline[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2601
2602 }
2603
2604 tmp="QwQPD";
2605 trim_file.RewindToFileStart();
2606 if (trim_file.FileHasModuleHeader(tmp)){
2607 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2608 for(size_t i = 0; i < fQPD.size(); i++)
2609 fQPD[i].ConstructBranch(tree, prefix,*nextmodule);
2610 }
2611
2612 tmp="QwLinearDiodeArray";
2613 trim_file.RewindToFileStart();
2614 if (trim_file.FileHasModuleHeader(tmp)){
2615 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2616 for(size_t i = 0; i < fLinearArray.size(); i++)
2617 fLinearArray[i].ConstructBranch(tree, prefix,*nextmodule);
2618 }
2619
2620 tmp="QwBPMCavity";
2621 trim_file.RewindToFileStart();
2622 if (trim_file.FileHasModuleHeader(tmp)){
2623 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2624 for(size_t i = 0; i < fCavity.size(); i++)
2625 fCavity[i].ConstructBranch(tree, prefix,*nextmodule);
2626
2627 }
2628
2629 tmp="QwBCM";
2630 trim_file.RewindToFileStart();
2631 if (trim_file.FileHasModuleHeader(tmp)){
2632 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2633 for(size_t i = 0; i < fBCM.size(); i++)
2634 fBCM[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2635 }
2636
2637 tmp="QwClock";
2638 trim_file.RewindToFileStart();
2639 if (trim_file.FileHasModuleHeader(tmp)){
2640 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2641 for(size_t i = 0; i < fClock.size(); i++)
2642 fClock[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2643 }
2644
2645 tmp="QwHaloMonitor";
2646 trim_file.RewindToFileStart();
2647 if (trim_file.FileHasModuleHeader(tmp)){
2648 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2649 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2650 fHaloMonitor[i].ConstructBranch(tree, prefix,*nextmodule);
2651 }
2652
2653
2654 tmp="QwCombinedBCM";
2655 trim_file.RewindToFileStart();
2656 if (trim_file.FileHasModuleHeader(tmp)){
2657 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2658 for(size_t i = 0; i <fBCMCombo.size();i++)
2659 fBCMCombo[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2660 }
2661
2662
2663 tmp="QwCombinedBPM";
2664 trim_file.RewindToFileStart();
2665 if (trim_file.FileHasModuleHeader(tmp)){
2666 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2667 for(size_t i = 0; i <fBPMCombo.size();i++)
2668 fBPMCombo[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2669 }
2670
2671 tmp="QwEnergyCalculator";
2672 trim_file.RewindToFileStart();
2673 if (trim_file.FileHasModuleHeader(tmp)){
2674 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2675 for(size_t i = 0; i <fECalculator.size();i++)
2676 fECalculator[i].ConstructBranch(tree, prefix,*nextmodule);
2677 }
2678
2679 return;
2680}
std::unique_ptr< QwParameterFile > ReadUntilNextModule(const bool add_current_line=false)
Bool_t FileHasModuleHeader(const std::string &secname)

References ConstructBranch(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, QwParameterFile::FileHasModuleHeader(), fLinearArray, fQPD, fStripline, QwParameterFile::ReadUntilNextModule(), and QwParameterFile::RewindToFileStart().

+ Here is the call graph for this function:

◆ ConstructBranchAndVector() [1/2]

virtual void VQwSubsystem::ConstructBranchAndVector ( TTree * tree,
QwRootTreeBranchVector & values )
inlinevirtual

Construct the branch and tree vector.

Reimplemented from VQwSubsystem.

Definition at line 303 of file VQwSubsystem.h.

303 {
304 TString tmpstr("");
305 ConstructBranchAndVector(tree,tmpstr,values);
306 };
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
Construct the branch and tree vector.

◆ ConstructBranchAndVector() [2/2]

void QwBeamLine::ConstructBranchAndVector ( TTree * tree,
TString & prefix,
QwRootTreeBranchVector & values )
overridevirtual

Construct the branch and tree vector.

Construct the branch and fill the provided values vector.

Parameters
treeOutput ROOT tree to which branches are added.
prefixName prefix for all branch names.
valuesVector that will be filled by FillTreeVector.

Implements VQwSubsystem.

Definition at line 2531 of file QwBeamLine.cc.

2532{
2533
2534 for(size_t i = 0; i < fClock.size(); i++)
2535 fClock[i].get()->ConstructBranchAndVector(tree, prefix, values);
2536 for(size_t i = 0; i < fStripline.size(); i++)
2537 fStripline[i].get()->ConstructBranchAndVector(tree, prefix, values);
2538 for(size_t i = 0; i < fQPD.size(); i++)
2539 fQPD[i].ConstructBranchAndVector(tree, prefix, values);
2540 for(size_t i = 0; i < fLinearArray.size(); i++)
2541 fLinearArray[i].ConstructBranchAndVector(tree, prefix, values);
2542 for(size_t i = 0; i < fCavity.size(); i++)
2543 fCavity[i].ConstructBranchAndVector(tree, prefix, values);
2544 for(size_t i = 0; i < fBCM.size(); i++)
2545 fBCM[i].get()->ConstructBranchAndVector(tree, prefix, values);
2546 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2547 fHaloMonitor[i].ConstructBranchAndVector(tree, prefix, values);
2548 for(size_t i = 0; i <fBCMCombo.size();i++)
2549 fBCMCombo[i].get()->ConstructBranchAndVector(tree, prefix, values);
2550 for(size_t i = 0; i <fBPMCombo.size();i++)
2551 fBPMCombo[i].get()->ConstructBranchAndVector(tree, prefix, values);
2552 for(size_t i = 0; i <fECalculator.size();i++)
2553 fECalculator[i].ConstructBranchAndVector(tree, prefix, values);
2554
2555 return;
2556}

References ConstructBranchAndVector(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, and fStripline.

Referenced by ConstructBranchAndVector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConstructHistograms() [1/4]

virtual void VQwSubsystem::ConstructHistograms ( )
inlinevirtual

Construct the histograms for this subsystem.

Reimplemented from VQwSubsystem.

Definition at line 270 of file VQwSubsystem.h.

270 {
271 TString tmpstr("");
272 ConstructHistograms((TDirectory*) NULL, tmpstr);
273 };
virtual void ConstructHistograms()
Construct the histograms for this subsystem.

Referenced by ConstructHistograms().

+ Here is the caller graph for this function:

◆ ConstructHistograms() [2/4]

virtual void VQwSubsystem::ConstructHistograms ( TDirectory * folder)
inlinevirtual

Construct the histograms for this subsystem in a folder.

Reimplemented from VQwSubsystem.

Definition at line 275 of file VQwSubsystem.h.

275 {
276 TString tmpstr("");
277 ConstructHistograms(folder, tmpstr);
278 };

◆ ConstructHistograms() [3/4]

void QwBeamLine::ConstructHistograms ( TDirectory * folder,
TString & prefix )
overridevirtual

Construct the histograms for this subsystem in a folder with a prefix.

Implements VQwSubsystem.

Definition at line 2466 of file QwBeamLine.cc.

2467{
2468
2469 // std::cout<<" here is QwBeamLine::ConstructHistogram with prefix ="<<prefix<<"\n";
2470 for(size_t i=0;i<fClock.size();i++)
2471 fClock[i].get()->ConstructHistograms(folder,prefix);
2472
2473 for(size_t i=0;i<fStripline.size();i++)
2474 fStripline[i].get()->ConstructHistograms(folder,prefix);
2475
2476 for(size_t i=0;i<fQPD.size();i++)
2477 fQPD[i].ConstructHistograms(folder,prefix);
2478
2479 for(size_t i=0;i<fLinearArray.size();i++)
2480 fLinearArray[i].ConstructHistograms(folder,prefix);
2481
2482 for(size_t i=0;i<fCavity.size();i++)
2483 fCavity[i].ConstructHistograms(folder,prefix);
2484
2485 for(size_t i=0;i<fBCM.size();i++)
2486 fBCM[i].get()->ConstructHistograms(folder,prefix);
2487
2488 for(size_t i=0;i<fHaloMonitor.size();i++)
2489 fHaloMonitor[i].ConstructHistograms(folder,prefix);
2490
2491 for(size_t i=0;i<fBCMCombo.size();i++)
2492 fBCMCombo[i].get()->ConstructHistograms(folder,prefix);
2493
2494 for(size_t i=0;i<fBPMCombo.size();i++)
2495 fBPMCombo[i].get()->ConstructHistograms(folder,prefix);
2496
2497 for(size_t i=0;i<fECalculator.size();i++)
2498 fECalculator[i].ConstructHistograms(folder,prefix);
2499 return;
2500}

References ConstructHistograms(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, and fStripline.

+ Here is the call graph for this function:

◆ ConstructHistograms() [4/4]

virtual void VQwSubsystem::ConstructHistograms ( TString & prefix)
inlinevirtual

Construct the histograms for this subsystem with a prefix.

Reimplemented from VQwSubsystem.

Definition at line 280 of file VQwSubsystem.h.

280 {
281 ConstructHistograms((TDirectory*) NULL, prefix);
282 };

◆ CopyTemplatedDataElements()

void QwBeamLine::CopyTemplatedDataElements ( const VQwSubsystem * source)

Definition at line 2802 of file QwBeamLine.cc.

2803{
2804 const QwBeamLine* input = dynamic_cast<const QwBeamLine*>(source);
2805
2806 this->fClock.reserve(input->fClock.size());
2807 for(size_t i=0;i<input->fClock.size();i++) {
2808 this->fClock.push_back(VQwClock_ptr(VQwClock::Create(*(input->fClock[i].get()))));
2809 }
2810
2811 this->fStripline.reserve(input->fStripline.size());
2812 for(size_t i=0;i<input->fStripline.size();i++) {
2813 this->fStripline.push_back(VQwBPM_ptr(
2814 VQwBPM::CreateStripline(*(input->fStripline[i].get()))));
2815 }
2816
2817 this->fBCM.reserve(input->fBCM.size());
2818 for(size_t i=0;i<input->fBCM.size();i++) {
2819 this->fBCM.push_back(VQwBCM_ptr(
2820 VQwBCM::Create(*(input->fBCM[i].get()))));
2821 }
2822
2823 this->fBCMCombo.reserve(input->fBCMCombo.size());
2824 for(size_t i=0;i<input->fBCMCombo.size();i++) {
2825 this->fBCMCombo.push_back(VQwBCM_ptr(
2827 input->fBCMCombo[i].get()))));
2828 }
2829
2830 this->fBPMCombo.reserve(input->fBPMCombo.size());
2831 for(size_t i=0;i<input->fBPMCombo.size();i++){
2832 this->fBPMCombo.push_back(VQwBPM_ptr(
2833 VQwBPM::CreateCombo(*(input->fBPMCombo[i].get()))));
2834 }
2835}
static VQwBCM * CreateCombo(TString subsystemname, TString type, TString name)
Factory method to create a concrete Combined BCM for the requested module type.
Definition VQwBCM.cc:101
static VQwBPM * CreateCombo(TString subsystemname, TString type, TString name)
A fast way of creating a BPM stripline of specified type.
Definition VQwBPM.cc:314

References VQwBCM::Create(), VQwClock::Create(), VQwBCM::CreateCombo(), VQwBPM::CreateCombo(), VQwBPM::CreateStripline(), fBCM, fBCMCombo, fBPMCombo, fClock, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

Referenced by QwBeamLine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeaccumulateRunningSum()

void QwBeamLine::DeaccumulateRunningSum ( VQwSubsystem * value,
Int_t ErrorMask = 0xFFFFFFF )
overridevirtual

remove one entry from the running sums for devices

Implements VQwSubsystemParity.

Definition at line 2386 of file QwBeamLine.cc.

2386 {
2387 if (Compare(value1)) {
2388 QwBeamLine* value = dynamic_cast<QwBeamLine*>(value1);
2389 for (size_t i = 0; i < fClock.size(); i++)
2390 fClock[i].get()->DeaccumulateRunningSum(*(value->fClock[i].get()), ErrorMask);
2391 for (size_t i = 0; i < fStripline.size(); i++)
2392 fStripline[i].get()->DeaccumulateRunningSum(*(value->fStripline[i].get()), ErrorMask);
2393 for (size_t i = 0; i < fCavity.size(); i++)
2394 fCavity[i].DeaccumulateRunningSum(value->fCavity[i], ErrorMask);
2395 for (size_t i = 0; i < fBCM.size(); i++)
2396 fBCM[i].get()->DeaccumulateRunningSum(*(value->fBCM[i].get()), ErrorMask);
2397 for (size_t i = 0; i < fBCMCombo.size(); i++)
2398 fBCMCombo[i].get()->DeaccumulateRunningSum(*(value->fBCMCombo[i].get()), ErrorMask);
2399 for (size_t i = 0; i < fBPMCombo.size(); i++)
2400 fBPMCombo[i].get()->DeaccumulateRunningSum(*(value->fBPMCombo[i].get()), ErrorMask);
2401 for (size_t i = 0; i < fQPD.size(); i++)
2402 fQPD[i].DeaccumulateRunningSum(value->fQPD[i], ErrorMask);
2403 for (size_t i = 0; i < fLinearArray.size(); i++)
2404 fLinearArray[i].DeaccumulateRunningSum(value->fLinearArray[i], ErrorMask);
2405 for (size_t i = 0; i < fECalculator.size(); i++)
2406 fECalculator[i].DeaccumulateRunningSum(value->fECalculator[i], ErrorMask);
2407 for (size_t i = 0; i <fHaloMonitor.size(); i++)
2408 fHaloMonitor[i].DeaccumulateRunningSum(value->fHaloMonitor[i], ErrorMask);
2409
2410 }
2411};
void DeaccumulateRunningSum(VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
remove one entry from the running sums for devices

References Compare(), DeaccumulateRunningSum(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

Referenced by DeaccumulateRunningSum().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EncodeEventData()

void QwBeamLine::EncodeEventData ( std::vector< UInt_t > & buffer)
overridevirtual

Serialize active element buffers into a CODA-style bank/subbank layout and append to the provided buffer.

Reimplemented from VQwSubsystem.

Definition at line 1073 of file QwBeamLine.cc.

1074{
1075 std::vector<UInt_t> elements;
1076 elements.clear();
1077
1078 // Get all buffers in the order they are defined in the map file
1079 for (size_t i = 0; i < fBeamDetectorID.size(); i++) {
1080 // This is a QwBCM
1081 if (fBeamDetectorID.at(i).fTypeID == kQwBCM){
1082 fBCM[fBeamDetectorID.at(i).fIndex].get()->EncodeEventData(elements);
1083 //std::cout << "" << fBCM[fBeamDetectorID.at(i).fIndex].get()->GetElementName() << std::endl;
1084 }
1085 // This is a QwBPMStripline (which has 4 entries, only process the first one)
1086 if (fBeamDetectorID.at(i).fTypeID == kQwBPMStripline
1087 && fBeamDetectorID.at(i).fSubelement == 0){
1088 fStripline[fBeamDetectorID.at(i).fIndex].get()->EncodeEventData(elements);
1089 // Print the HWsum absolute position values for the BPM
1090 //fStripline[fBeamDetectorID.at(i).fIndex].get()->PrintValue();
1091 }
1092
1093 // If this is a combined BPM, let's try to print the position and angle HWsum values
1094 }
1095
1096 // If there is element data, generate the subbank header
1097 std::vector<UInt_t> subbankheader;
1098 std::vector<UInt_t> rocheader;
1099 if (elements.size() > 0) {
1100
1101 // Form CODA subbank header
1102 subbankheader.clear();
1103 subbankheader.push_back(elements.size() + 1); // subbank size
1104 subbankheader.push_back((fCurrentBank_ID << 16) | (0x01 << 8) | (1 & 0xff));
1105 // subbank tag | subbank type | event number
1106
1107 // Form CODA bank/roc header
1108 rocheader.clear();
1109 rocheader.push_back(subbankheader.size() + elements.size() + 1); // bank/roc size
1110 rocheader.push_back((fCurrentROC_ID << 16) | (0x10 << 8) | (1 & 0xff));
1111 // bank tag == ROC | bank type | event number
1112
1113 // Add bank header, subbank header and element data to output buffer
1114 buffer.insert(buffer.end(), rocheader.begin(), rocheader.end());
1115 buffer.insert(buffer.end(), subbankheader.begin(), subbankheader.end());
1116 buffer.insert(buffer.end(), elements.begin(), elements.end());
1117 }
1118}
BankID_t fCurrentBank_ID
Bank ID (and Marker word) that is currently being processed;.
ROCID_t fCurrentROC_ID
ROC ID that is currently being processed.

References fBCM, fBeamDetectorID, VQwSubsystem::fCurrentBank_ID, VQwSubsystem::fCurrentROC_ID, fStripline, kQwBCM, and kQwBPMStripline.

◆ FillHistograms()

void QwBeamLine::FillHistograms ( )
overridevirtual

Fill the histograms for this subsystem.

Implements VQwSubsystem.

Definition at line 2503 of file QwBeamLine.cc.

2504{
2505 for(size_t i=0;i<fClock.size();i++)
2506 fClock[i].get()->FillHistograms();
2507 for(size_t i=0;i<fStripline.size();i++)
2508 fStripline[i].get()->FillHistograms();
2509 for(size_t i=0;i<fQPD.size();i++)
2510 fQPD[i].FillHistograms();
2511 for(size_t i=0;i<fLinearArray.size();i++)
2513 for(size_t i=0;i<fCavity.size();i++)
2515 for(size_t i=0;i<fBCM.size();i++)
2516 fBCM[i].get()->FillHistograms();
2517 for(size_t i=0;i<fHaloMonitor.size();i++)
2519 for(size_t i=0;i<fBCMCombo.size();i++)
2520 fBCMCombo[i].get()->FillHistograms();
2521 for(size_t i=0;i<fBPMCombo.size();i++)
2522 fBPMCombo[i].get()->FillHistograms();
2523 for(size_t i=0;i<fECalculator.size();i++)
2525
2526 return;
2527}
void FillHistograms() override
Fill the histograms for this subsystem.

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, FillHistograms(), fLinearArray, fQPD, and fStripline.

Referenced by FillHistograms().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FillTreeVector()

void QwBeamLine::FillTreeVector ( QwRootTreeBranchVector & values) const
overridevirtual

Fill the tree vector.

Fill the tree export vector with the current event values.

Parameters
valuesOutput vector to be filled.

Implements VQwSubsystem.

Definition at line 2683 of file QwBeamLine.cc.

2684{
2685 for(size_t i = 0; i < fClock.size(); i++)
2686 fClock[i].get()->FillTreeVector(values);
2687 for(size_t i = 0; i < fStripline.size(); i++)
2688 fStripline[i].get()->FillTreeVector(values);
2689 for(size_t i = 0; i < fQPD.size(); i++)
2690 fQPD[i].FillTreeVector(values);
2691 for(size_t i = 0; i < fLinearArray.size(); i++)
2692 fLinearArray[i].FillTreeVector(values);
2693 for(size_t i = 0; i < fCavity.size(); i++)
2694 fCavity[i].FillTreeVector(values);
2695 for(size_t i = 0; i < fBCM.size(); i++)
2696 fBCM[i].get()->FillTreeVector(values);
2697 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2698 fHaloMonitor[i].FillTreeVector(values);
2699 for(size_t i = 0; i < fBCMCombo.size(); i++)
2700 fBCMCombo[i].get()->FillTreeVector(values);
2701 for(size_t i = 0; i < fBPMCombo.size(); i++)
2702 fBPMCombo[i].get()->FillTreeVector(values);
2703 for(size_t i = 0; i < fECalculator.size(); i++){
2704 fECalculator[i].FillTreeVector(values);}
2705 return;
2706}
void FillTreeVector(QwRootTreeBranchVector &values) const override
Fill the tree vector.

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, FillTreeVector(), fLinearArray, fQPD, and fStripline.

Referenced by FillTreeVector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBCM() [1/2]

VQwBCM * QwBeamLine::GetBCM ( const TString name)

Find a BCM by name.

Definition at line 1976 of file QwBeamLine.cc.

1977{
1978 //QwWarning << "QwBeamLine::GetBCM" << QwLog::endl;
1979 if (! fBCM.empty()) {
1980 for (std::vector<VQwBCM_ptr >::iterator bcm = fBCM.begin(); bcm != fBCM.end(); ++bcm) {
1981 if ((*bcm).get()->GetElementName() == name) {
1982 return (*bcm).get();
1983 }
1984 }
1985
1986 //QwWarning << "BCM Found" << QwLog::endl;
1987 return 0;
1988 }
1989 return 0;
1990}

References fBCM.

Referenced by GetBCM(), and RandomizeEventData().

+ Here is the caller graph for this function:

◆ GetBCM() [2/2]

const VQwBCM * QwBeamLine::GetBCM ( const TString name) const

Definition at line 2091 of file QwBeamLine.cc.

2092{
2093 return const_cast<QwBeamLine*>(this)->GetBCM(name);
2094}
VQwBCM * GetBCM(const TString name)

References GetBCM(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetBPMCavity() [1/2]

QwBPMCavity * QwBeamLine::GetBPMCavity ( const TString name)

Find a BPM Cavity by name.

Definition at line 1961 of file QwBeamLine.cc.

1962{
1963 if (! fCavity.empty()) {
1964 for (std::vector<QwBPMCavity>::iterator cavity = fCavity.begin(); cavity != fCavity.end(); ++cavity) {
1965 if (cavity->GetElementName() == name) {
1966 return &(*cavity);
1967 }
1968 }
1969 }
1970 return 0;
1971}

References fCavity.

Referenced by GetBPMCavity().

+ Here is the caller graph for this function:

◆ GetBPMCavity() [2/2]

const QwBPMCavity * QwBeamLine::GetBPMCavity ( const TString name) const

Definition at line 2085 of file QwBeamLine.cc.

2086{
2087 return const_cast<QwBeamLine*>(this)->GetBPMCavity(name);
2088}
QwBPMCavity * GetBPMCavity(const TString name)

References GetBPMCavity(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetBPMStripline() [1/2]

VQwBPM * QwBeamLine::GetBPMStripline ( const TString name)

Find a BPMStripline by name.

Definition at line 1946 of file QwBeamLine.cc.

1947{
1948 if (! fStripline.empty()) {
1949 for (std::vector<VQwBPM_ptr >::iterator stripline = fStripline.begin(); stripline != fStripline.end(); ++stripline) {
1950 if ((*stripline).get()->GetElementName() == name) {
1951 return (*stripline).get();
1952 }
1953 }
1954 }
1955 return 0;
1956}

References fStripline.

Referenced by GetBPMStripline(), and RandomizeEventData().

+ Here is the caller graph for this function:

◆ GetBPMStripline() [2/2]

const VQwBPM * QwBeamLine::GetBPMStripline ( const TString name) const

Const overload: find a BPMStripline by name.

Definition at line 2065 of file QwBeamLine.cc.

2066{
2067 return const_cast<QwBeamLine*>(this)->GetBPMStripline(name);
2068}
VQwBPM * GetBPMStripline(const TString name)

References GetBPMStripline(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetChannel()

const VQwHardwareChannel * QwBeamLine::GetChannel ( EQwBeamInstrumentType TypeID,
Int_t index,
TString device_prop ) const

Retrieve a hardware channel (value/x/y/ef/xp/yp) from a specific device.

TODO: QwBeamLine::GetChannel How do we access linear array channel outputs?

Definition at line 1899 of file QwBeamLine.cc.

1900{
1901 const VQwHardwareChannel* tmp_channel = 0;
1902
1903 if (TypeID==kQwBPMStripline || TypeID==kQwBPMCavity || TypeID==kQwQPD){
1904 const VQwBPM* tmp_ptr = dynamic_cast<const VQwBPM*>(GetElement(TypeID, index));
1905 if (device_prop == "x")
1906 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kXAxis);
1907 else if (device_prop == "y")
1908 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kYAxis);
1909 else if (device_prop == "ef")
1910 tmp_channel = tmp_ptr->GetEffectiveCharge();
1911 } else if (TypeID==kQwCombinedBPM){
1912 const VQwBPM* tmp_ptr = dynamic_cast<const VQwBPM*>(GetElement(TypeID, index));
1913 if (device_prop == "x")
1914 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kXAxis);
1915 else if (device_prop == "y")
1916 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kYAxis);
1917 else if (device_prop == "ef")
1918 tmp_channel = fBPMCombo.at(index)->GetEffectiveCharge();
1919 else if (device_prop == "xp")
1920 tmp_channel = fBPMCombo.at(index)->GetAngleX();
1921 else if (device_prop == "yp")
1922 tmp_channel = fBPMCombo.at(index)->GetAngleY();
1923 } else if (TypeID==kQwLinearArray){
1924 /// TODO: QwBeamLine::GetChannel
1925 /// How do we access linear array channel outputs?
1926 } else if (TypeID==kQwBCM || TypeID==kQwCombinedBCM){
1927 tmp_channel = dynamic_cast<const VQwBCM*>(GetElement(TypeID,index))->GetCharge();
1928 } else if (TypeID==kQwEnergyCalculator){
1929 tmp_channel = fECalculator.at(index).GetEnergy();
1930 } else if (TypeID==kQwHaloMonitor){
1931 tmp_channel = fHaloMonitor.at(index).GetScaler();
1932 } else if (TypeID==kQwClock){
1933 tmp_channel = fClock.at(index)->GetTime();
1934 } else {
1935 TString loc="QwBeamLine::GetChannel called by "
1936 +this->GetName()+" with invalid arguments: "
1937 +GetQwBeamInstrumentTypeName(TypeID)+" "
1938 +Form("%d",index);
1939 throw std::invalid_argument(loc.Data());
1940 }
1941 return tmp_channel;
1942}
@ kQwEnergyCalculator
Definition QwTypes.h:151
@ kQwHaloMonitor
Definition QwTypes.h:152
@ kQwCombinedBPM
Definition QwTypes.h:150
@ kQwLinearArray
Definition QwTypes.h:147
@ kQwCombinedBCM
Definition QwTypes.h:149
@ kQwQPD
Definition QwTypes.h:146
@ kQwBPMCavity
Definition QwTypes.h:153
TString GetQwBeamInstrumentTypeName(EQwBeamInstrumentType type)
Definition QwTypes.cc:100
VQwDataElement * GetElement(QwBeamDetectorID det_id)
@ kXAxis
Definition VQwBPM.h:72
@ kYAxis
Definition VQwBPM.h:72
virtual const VQwHardwareChannel * GetEffectiveCharge() const =0
virtual const VQwHardwareChannel * GetPosition(EBeamPositionMonitorAxis axis) const
Definition VQwBPM.h:140

References fBPMCombo, fClock, fECalculator, fHaloMonitor, VQwBPM::GetEffectiveCharge(), GetElement(), VQwSubsystem::GetName(), VQwBPM::GetPosition(), GetQwBeamInstrumentTypeName(), kQwBCM, kQwBPMCavity, kQwBPMStripline, kQwClock, kQwCombinedBCM, kQwCombinedBPM, kQwEnergyCalculator, kQwHaloMonitor, kQwLinearArray, kQwQPD, VQwBPM::kXAxis, and VQwBPM::kYAxis.

Referenced by PublishByRequest(), PublishInternalValues(), and WritePromptSummary().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetClock() [1/2]

VQwClock * QwBeamLine::GetClock ( const TString name)

Find a Clock by name.

Definition at line 1995 of file QwBeamLine.cc.

1996{
1997 //QwWarning << "QwBeamLine::GetClock" << QwLog::endl;
1998 if (! fClock.empty()) {
1999 for (std::vector<VQwClock_ptr >::iterator clock = fClock.begin(); clock != fClock.end(); ++clock) {
2000 if ((*clock).get()->GetElementName() == name) {
2001 return (*clock).get();
2002 }
2003 }
2004
2005 //QwWarning << "Clock Found" << QwLog::endl;
2006 return 0;
2007 }
2008 return 0;
2009}

References fClock.

Referenced by GetClock().

+ Here is the caller graph for this function:

◆ GetClock() [2/2]

const VQwClock * QwBeamLine::GetClock ( const TString name) const

Definition at line 2097 of file QwBeamLine.cc.

2098{
2099 return const_cast<QwBeamLine*>(this)->GetClock(name);
2100}
VQwClock * GetClock(const TString name)

References GetClock(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetCombinedBCM() [1/2]

VQwBCM * QwBeamLine::GetCombinedBCM ( const TString name)

Find a CombinedBCM by name.

Definition at line 2013 of file QwBeamLine.cc.

2014{
2015 //QwWarning << "QwBeamLine::GetCombinedBCM" << QwLog::endl;
2016 if (! fBCMCombo.empty()) {
2017
2018 for (std::vector<VQwBCM_ptr>::iterator cbcm = fBCMCombo.begin(); cbcm != fBCMCombo.end(); ++cbcm) {
2019 if ((*cbcm).get()->GetElementName() == name) {
2020 return (*cbcm).get();
2021 }
2022 }
2023
2024
2025 }
2026 return 0;
2027}

References fBCMCombo.

Referenced by GetCombinedBCM().

+ Here is the caller graph for this function:

◆ GetCombinedBCM() [2/2]

const VQwBCM * QwBeamLine::GetCombinedBCM ( const TString name) const

Definition at line 2103 of file QwBeamLine.cc.

2103 {
2104 return const_cast<QwBeamLine*>(this)->GetCombinedBCM(name);
2105}
VQwBCM * GetCombinedBCM(const TString name)

References GetCombinedBCM(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetCombinedBPM() [1/2]

VQwBPM * QwBeamLine::GetCombinedBPM ( const TString name)

Find a CombinedBPM by name.

Definition at line 2031 of file QwBeamLine.cc.

2032{
2033 //QwWarning << "QwBeamLine::GetCombinedBPM" << QwLog::endl;
2034 if (! fBPMCombo.empty()) {
2035
2036 for (std::vector<VQwBPM_ptr>::iterator cbpm = fBPMCombo.begin(); cbpm != fBPMCombo.end(); ++cbpm) {
2037 if ((*cbpm).get()->GetElementName() == name) {
2038 return (*cbpm).get();
2039 }
2040 }
2041
2042
2043 }
2044 return 0;
2045}

References fBPMCombo.

Referenced by GetCombinedBPM().

+ Here is the caller graph for this function:

◆ GetCombinedBPM() [2/2]

const VQwBPM * QwBeamLine::GetCombinedBPM ( const TString name) const

Definition at line 2108 of file QwBeamLine.cc.

2108 {
2109 return const_cast<QwBeamLine*>(this)->GetCombinedBPM(name);
2110}
VQwBPM * GetCombinedBPM(const TString name)

References GetCombinedBPM(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetDetectorIndex()

Int_t QwBeamLine::GetDetectorIndex ( EQwBeamInstrumentType type_id,
TString name ) const
protected

Lookup the element index for a given device type and name.

Definition at line 1809 of file QwBeamLine.cc.

1810{
1811 Bool_t ldebug=kFALSE;
1812 Int_t result=-1;
1813 if(ldebug) {
1814 std::cout<<"QwBeamLine::GetDetectorIndex\n";
1815 std::cout<<"type_id=="<<type_id<<" name="<<name<<"\n";
1816 std::cout<<fBeamDetectorID.size()<<" already registered detector\n";
1817 }
1818 for(size_t i=0;i<fBeamDetectorID.size();i++) {
1819 if(ldebug){
1820 std::cout<<"testing against ("<<fBeamDetectorID[i].fTypeID
1821 <<","<<fBeamDetectorID[i].fdetectorname<<")=>"<<result<<"\n";
1822 }
1823 if(fBeamDetectorID[i].fTypeID==type_id
1824 && fBeamDetectorID[i].fdetectorname==name){
1825 result=fBeamDetectorID[i].fIndex;
1826 break;
1827 }
1828 }
1829 return result;
1830}

References fBeamDetectorID.

Referenced by GetElement(), LoadChannelMap(), LoadEventCuts_Line(), LoadGeometryDefinition(), LoadMockDataParameters(), and PublishInternalValues().

+ Here is the caller graph for this function:

◆ GetElement() [1/4]

VQwDataElement * QwBeamLine::GetElement ( EQwBeamInstrumentType TypeID,
Int_t index )

Retrieve a data element pointer by type and index with dispatch.

Definition at line 1846 of file QwBeamLine.cc.

1847{
1848 VQwDataElement* tmp_ptr;
1849 switch (TypeID){
1850 case kQwBPMStripline:
1851 tmp_ptr = fStripline.at(index).get();
1852 break;
1853 case kQwQPD:
1854 tmp_ptr = &(fQPD.at(index));
1855 break;
1856 case kQwLinearArray:
1857 tmp_ptr = &(fLinearArray.at(index));
1858 break;
1859 case kQwBCM:
1860 tmp_ptr = fBCM.at(index).get();
1861 break;
1862 case kQwCombinedBCM:
1863 tmp_ptr = fBCMCombo.at(index).get();
1864 break;
1865 case kQwCombinedBPM:
1866 tmp_ptr = fBPMCombo.at(index).get();
1867 break;
1869 tmp_ptr = &(fECalculator.at(index));
1870 break;
1871 case kQwHaloMonitor:
1872 tmp_ptr = &(fHaloMonitor.at(index));
1873 break;
1874 case kQwBPMCavity:
1875 tmp_ptr = &(fCavity.at(index));
1876 break;
1877 case kQwClock:
1878 tmp_ptr = fClock.at(index).get();
1879 break;
1880 default:
1881 TString loc="QwBeamLine::GetElement called by "
1882 +this->GetName()+" with invalid arguments: "
1883 +GetQwBeamInstrumentTypeName(TypeID)+" "
1884 +Form("%d",index);
1885 throw std::invalid_argument(loc.Data());
1886 }
1887 return tmp_ptr;
1888};

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, VQwSubsystem::GetName(), GetQwBeamInstrumentTypeName(), kQwBCM, kQwBPMCavity, kQwBPMStripline, kQwClock, kQwCombinedBCM, kQwCombinedBPM, kQwEnergyCalculator, kQwHaloMonitor, kQwLinearArray, and kQwQPD.

+ Here is the call graph for this function:

◆ GetElement() [2/4]

const VQwDataElement * QwBeamLine::GetElement ( EQwBeamInstrumentType TypeID,
Int_t index ) const

Const overload: retrieve a data element by type and index.

Definition at line 1891 of file QwBeamLine.cc.

1892{
1893 return const_cast<QwBeamLine*>(this)->GetElement(TypeID,index);
1894}

References GetElement(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetElement() [3/4]

VQwDataElement * QwBeamLine::GetElement ( EQwBeamInstrumentType TypeID,
TString name )

Overload: retrieve a data element by type and name.

Definition at line 1839 of file QwBeamLine.cc.

1840{
1841 Int_t index = GetDetectorIndex(TypeID,name);
1842 return GetElement(TypeID,index);
1843};
Int_t GetDetectorIndex(EQwBeamInstrumentType TypeID, TString name) const

References GetDetectorIndex(), and GetElement().

+ Here is the call graph for this function:

◆ GetElement() [4/4]

VQwDataElement * QwBeamLine::GetElement ( QwBeamDetectorID det_id)

Overload: retrieve a data element by detector ID.

Definition at line 1833 of file QwBeamLine.cc.

1834{
1835 return GetElement(det_id.fTypeID, det_id.fIndex);
1836};

References QwBeamDetectorID::fIndex, QwBeamDetectorID::fTypeID, and GetElement().

Referenced by GetChannel(), GetElement(), GetElement(), GetElement(), LoadChannelMap(), and LoadMockDataParameters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEnergyCalculator() [1/2]

QwEnergyCalculator * QwBeamLine::GetEnergyCalculator ( const TString name)

Find an EnergyCalculator by name.

Definition at line 2049 of file QwBeamLine.cc.

2049 {
2050 if (! fECalculator.empty()) {
2051
2052 for (std::vector<QwEnergyCalculator>::iterator ecal = fECalculator.begin(); ecal != fECalculator.end(); ++ecal) {
2053 if (ecal->GetElementName() == name) {
2054 return &(*ecal);
2055 }
2056 }
2057
2058
2059 }
2060 return 0;
2061}

References fECalculator.

Referenced by GetEnergyCalculator().

+ Here is the caller graph for this function:

◆ GetEnergyCalculator() [2/2]

const QwEnergyCalculator * QwBeamLine::GetEnergyCalculator ( const TString name) const

Definition at line 2113 of file QwBeamLine.cc.

2113 {
2114 return const_cast<QwBeamLine*>(this)->GetEnergyCalculator(name);
2115}
QwEnergyCalculator * GetEnergyCalculator(const TString name)

References GetEnergyCalculator(), and QwBeamLine().

+ Here is the call graph for this function:

◆ GetEventcutErrorFlag()

UInt_t QwBeamLine::GetEventcutErrorFlag ( )
overridevirtual

Return the OR of per-device event-cut error flags.

Implements VQwSubsystemParity.

Definition at line 1504 of file QwBeamLine.cc.

1504 {//return the error flag
1505 UInt_t ErrorFlag;
1506 UInt_t ErrorFlagtmp;
1507 ErrorFlag=0;
1508 for(size_t i=0;i<fBCM.size();i++){
1509 ErrorFlagtmp = fBCM[i].get()->GetEventcutErrorFlag();
1510 ErrorFlag |=ErrorFlagtmp;
1511 }
1512 for(size_t i=0;i<fStripline.size();i++){
1513 ErrorFlag |= fStripline[i].get()->GetEventcutErrorFlag();
1514 }
1515 for(size_t i=0;i<fQPD.size();i++){
1516 ErrorFlag |= fQPD[i].GetEventcutErrorFlag();
1517 }
1518 for(size_t i=0;i<fLinearArray.size();i++){
1519 ErrorFlag |= fLinearArray[i].GetEventcutErrorFlag();
1520 }
1521 for(size_t i=0;i<fCavity.size();i++){
1522 ErrorFlag |= fCavity[i].GetEventcutErrorFlag();
1523 }
1524 for(size_t i=0;i<fBCMCombo.size();i++){
1525 ErrorFlag |= fBCMCombo[i].get()->GetEventcutErrorFlag();
1526 }
1527 for(size_t i=0;i<fBPMCombo.size();i++){
1528 ErrorFlag |= fBPMCombo[i].get()->GetEventcutErrorFlag();
1529 }
1530 for(size_t i=0;i<fECalculator.size();i++){
1531 ErrorFlag |= fECalculator[i].GetEventcutErrorFlag();
1532 }
1533
1534 return ErrorFlag;
1535
1536}

References fBCM, fBCMCombo, fBPMCombo, fCavity, fECalculator, fLinearArray, fQPD, and fStripline.

◆ GetNumberOfElements()

size_t QwBeamLine::GetNumberOfElements ( )

Referenced by RandomizeEventData().

+ Here is the caller graph for this function:

◆ GetScalerChannel() [1/2]

QwHaloMonitor * QwBeamLine::GetScalerChannel ( const TString name)

Definition at line 2070 of file QwBeamLine.cc.

2070 {
2071 if (! fHaloMonitor.empty()) {
2072
2073 for (std::vector<QwHaloMonitor>::iterator halo = fHaloMonitor.begin(); halo != fHaloMonitor.end(); ++halo) {
2074 if (halo->GetElementName() == name) {
2075 return &(*halo);
2076 }
2077 }
2078
2079
2080 }
2081 return 0;
2082};

References fHaloMonitor.

Referenced by GetScalerChannel().

+ Here is the caller graph for this function:

◆ GetScalerChannel() [2/2]

const QwHaloMonitor * QwBeamLine::GetScalerChannel ( const TString name) const

Definition at line 2118 of file QwBeamLine.cc.

2118 {
2119 return const_cast<QwBeamLine*>(this)->GetScalerChannel(name);
2120};
QwHaloMonitor * GetScalerChannel(const TString name)

References GetScalerChannel(), and QwBeamLine().

+ Here is the call graph for this function:

◆ IncrementErrorCounters()

void QwBeamLine::IncrementErrorCounters ( )
overridevirtual

Increment error counters across all managed devices.

Implements VQwSubsystemParity.

Definition at line 1468 of file QwBeamLine.cc.

1469{
1470 for(size_t i=0;i<fClock.size();i++){
1471 fClock[i].get()->IncrementErrorCounters();
1472 }
1473 for(size_t i=0;i<fBCM.size();i++){
1474 fBCM[i].get()->IncrementErrorCounters();
1475 }
1476 for(size_t i=0;i<fHaloMonitor.size();i++){
1477 fHaloMonitor[i].IncrementErrorCounters();
1478 }
1479 for(size_t i=0;i<fStripline.size();i++){
1480 fStripline[i].get()->IncrementErrorCounters();
1481 }
1482 for(size_t i=0;i<fQPD.size();i++){
1483 fQPD[i].IncrementErrorCounters();
1484 }
1485 for(size_t i=0;i<fLinearArray.size();i++){
1486 fLinearArray[i].IncrementErrorCounters();
1487 }
1488 for(size_t i=0;i<fCavity.size();i++){
1489 fCavity[i].IncrementErrorCounters();
1490 }
1491 for(size_t i=0;i<fBCMCombo.size();i++){
1492 fBCMCombo[i].get()->IncrementErrorCounters();
1493 }
1494 for(size_t i=0;i<fBPMCombo.size();i++){
1495 fBPMCombo[i].get()->IncrementErrorCounters();
1496 }
1497 for(size_t i=0;i<fECalculator.size();i++){
1498 fECalculator[i].IncrementErrorCounters();
1499 }
1500}

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, and fStripline.

◆ LoadChannelMap()

Int_t QwBeamLine::LoadChannelMap ( TString mapfile)
overridevirtual

Load and decode the beamline channel map, creating physical and combined devices, recording detector IDs, and wiring publish lists and clocks.

Parameters
mapfilePath to the map file.
Returns
0 on success.

Implements VQwSubsystem.

Definition at line 111 of file QwBeamLine.cc.

112{
113 Bool_t ldebug=kFALSE;
114
115 TString varname, varvalue;
116
117 TString combotype, comboname, dev_name;
118
119 Int_t index = 0;
120 Bool_t combolistdecoded;
121 Bool_t deviceok;
122
123 std::vector<TString> fDeviceName;
124 std::vector<TString> fProperty;
125 std::vector<TString> fType;
126 std::vector<Double_t> fQWeight;
127 std::vector<Double_t> fXWeight;
128 std::vector<Double_t> fYWeight;
129 Double_t sumQweights = 0.0;
130
131 std::vector<QwBeamDetectorID> clock_needed_list;
132
133 QwParameterFile mapstr(mapfile.Data()); //Open the file
134 fDetectorMaps.insert(mapstr.GetParamFileNameContents());
135 mapstr.EnableGreediness();
136 mapstr.SetCommentChars("!");
137 mapstr.AddBreakpointKeyword("begin");
138 mapstr.AddBreakpointKeyword("end");
139
140 Int_t buffer_offset = 0; /* Allow some extra words at the start of a bank.
141 * The buffer_offset value will be reset at the
142 * start of each ROC or bank declaration, so should
143 * be relisted for each bank.
144 */
145 while (mapstr.ReadNextLine() && mapstr.SkipSection("PUBLISH")) {
146 RegisterRocBankMarker(mapstr);
147 // Remove the "vqwk_buffer_offset" and "scaler_buffer_offset"
148 // keywords from the parameter file's listing
149 if (mapstr.ReturnValue("vqwk_buffer_offset",buffer_offset)) {
150 QwDebug << "QwBeamLine::LoadChannelMap: "
151 << "ROC " << fCurrentROC_ID
152 << ", Bank " << fCurrentBank_ID
153 << "; vqwk_buffer_offset: " << buffer_offset << QwLog::endl;
154 }
155
156 if (mapstr.HasVariablePair("=",varname,varvalue)){ // This is a declaration line. Decode it.
157 varname.ToLower();
158
159 if (varname=="begin"){
160
161 // Start to decode derived beamline devices combined+energy
162 deviceok = kTRUE;
163 combotype = varvalue;
164 combolistdecoded = kFALSE;
165
166 TString dettype;
167
168 while(mapstr.ReadNextLine()&&!combolistdecoded) {
169 if (mapstr.HasVariablePair("=",varname,varvalue)) {
170 varname.ToLower();
171 if (varname=="end"){
172 // calculate the total weights of the charge
173 sumQweights = 0.0;
174 for(size_t i=0;i<fDeviceName.size();i++)
175 sumQweights+=fabs(fQWeight[i]);
176 combolistdecoded = kTRUE;
177 break;
178 }
179 }
180
181 if (mapstr.PopValue("name",varvalue)) {
182 comboname = varvalue;
183 }
184
185 dev_name = mapstr.GetTypedNextToken<TString>();
186 dev_name.ToLower();
187 dettype = mapstr.GetTypedNextToken<TString>();
188 dettype.ToLower();
189
190 // Check to see if the device being read is a valid physical device.
191 // If not, discard the combination.
192 index=GetDetectorIndex(GetQwBeamInstrumentType(dettype),dev_name);
193
194 if (index == -1) {
195 QwError << "QwBeamLine::LoadChannelMap: Unknown device: "
196 << dev_name <<" used in "<< comboname
197 <<". This combination will not be decoded!"
198 << QwLog::endl;
199 deviceok = kFALSE;
200 combolistdecoded = kTRUE;
201 }else{
202 // Found the device
203 // Add to the array of names
204 fDeviceName.push_back(dev_name);
205
206 // Read in the weights.
207 // For combined bpms and combined bcms these are charge weights.
208 // For the energy calculator these are the ratios of the transport matrix elements.
209 fQWeight.push_back(mapstr.GetTypedNextToken<Double_t>());
210
211 // For combined BPMs,in addition, there are weights for the X & Y positions.
212 if(combotype == "combinedbpm"){
213 fXWeight.push_back(mapstr.GetTypedNextToken<Double_t>());
214 fYWeight.push_back(mapstr.GetTypedNextToken<Double_t>());
215 }
216
217 // For the enrgy calculator there are device type and the specified beam parameters.
218 if(combotype == "energycalculator"){
219 fType.push_back(dettype);
220 fProperty.push_back(mapstr.GetTypedNextToken<TString>());
221 }
222 }
223 }
224
225 // Now create the combined device
226 QwBeamDetectorID localComboID(-1, -1, comboname, combotype,
227 fBeamDetectorID.at(index).fmoduletype );
228
229 localComboID.fdetectorname=comboname(0,comboname.Sizeof()-1);
230 localComboID.fIndex = GetDetectorIndex(localComboID.fTypeID,localComboID.fdetectorname);
231
232 if(localComboID.fTypeID==kQwUnknownDeviceType){
233 QwError << "QwBeamLine::LoadChannelMap: Unknown detector type: "
234 << combotype <<", the detector "<<comboname<<" will not be decoded "
235 << QwLog::endl;
236 deviceok = kFALSE;
237 continue;
238 }
239
240 if((localComboID.fIndex==-1) && deviceok) {
241
242 // Decoding combined BCM array
243 if (localComboID.fTypeID == kQwCombinedBCM){
244
245 VQwBCM_ptr localbcmcombo(
247 localComboID.fdetectorname,localComboID.fmoduletype));
248 fBCMCombo.push_back(localbcmcombo);
249
250 for(size_t i=0;i<fDeviceName.size();i++){
251 index=GetDetectorIndex(GetQwBeamInstrumentType(dettype),fDeviceName[i]);
252 fBCMCombo[fBCMCombo.size()-1].get()->SetBCMForCombo(fBCM.at(index).get(),
253 fQWeight[i],sumQweights );
254 }
255 fDeviceName.clear();
256 fQWeight.clear();
257 localComboID.fIndex=fBCMCombo.size()-1;
258 }
259
260 // Decoding combined BPM array.
261 if(localComboID.fTypeID== kQwCombinedBPM){
262 VQwBPM_ptr localbpmcombo(
264 localComboID.fdetectorname,localComboID.fmoduletype));
265 fBPMCombo.push_back(localbpmcombo);
266
267 for(size_t i=0;i<fDeviceName.size();i++){
268 index=GetDetectorIndex(GetQwBeamInstrumentType(dettype),fDeviceName[i]);
269 fBPMCombo[fBPMCombo.size()-1].get()->SetBPMForCombo(
270 fStripline.at(index).get(), fQWeight[i],fXWeight[i],
271 fYWeight[i],sumQweights );
272
273 }
274 fDeviceName.clear();
275 fQWeight.clear();
276 fXWeight.clear();
277 fYWeight.clear();
278 localComboID.fIndex=fBPMCombo.size()-1;
279 }
280
281 // Decoding energy calculator.
282 if(localComboID.fTypeID== kQwEnergyCalculator){
283
284 QwEnergyCalculator localecalculator(GetName(), localComboID.fdetectorname);
285 fECalculator.push_back(localecalculator);
286
287 for(size_t i=0;i<fDeviceName.size();i++){
288 index=GetDetectorIndex(GetQwBeamInstrumentType(fType[i]),fDeviceName[i]);
289
291 fECalculator[fECalculator.size()-1].Set(fStripline.at(index).get(),fType[i],fProperty[i],fQWeight[i]);
292
293 if ( GetQwBeamInstrumentType(fType[i]) == kQwCombinedBPM)
294 fECalculator[fECalculator.size()-1].Set(fBPMCombo.at(index).get(),fType[i],fProperty[i],fQWeight[i]);
295
296 }
297
298 fDeviceName.clear();
299 fQWeight.clear();
300
301 fProperty.clear();
302 fType.clear();
303 localComboID.fIndex=fECalculator.size()-1;
304 }
305 }
306 // Use only the combinations that are of known type and has known physical devices.
307 if(deviceok)
308 fBeamDetectorID.push_back(localComboID);
309 }
310
311 QwDebug << "At end of processing the combined device " << QwLog::endl;
312
313 } else{
314 // Start to decode the physical beamline devices
315 QwBeamDetectorID localBeamDetectorID(GetSubbankIndex(), mapstr);
316 Bool_t lineok = localBeamDetectorID.ReportInitErrors();
317 if (! lineok) continue;
318
319 localBeamDetectorID.fIndex=
320 GetDetectorIndex(localBeamDetectorID.fTypeID,
321 localBeamDetectorID.fdetectorname);
322
323 if(localBeamDetectorID.fIndex==-1){
324 Int_t index;
325 VQwDataElement* local_element = NULL;
326
327 if(localBeamDetectorID.fTypeID == kQwHaloMonitor){
328 index = AddToElementList(fHaloMonitor, localBeamDetectorID);
329 local_element = &(fHaloMonitor.at(index));
330 }
331 if(localBeamDetectorID.fTypeID==kQwBPMCavity){
332 index = AddToElementList(fCavity, localBeamDetectorID);
333 local_element = &(fCavity.at(index));
334 }
335 if(localBeamDetectorID.fTypeID== kQwBPMStripline){
336 index = AddToElementList(fStripline, localBeamDetectorID);
337 local_element = fStripline.at(index).get();
338 }
339 if(localBeamDetectorID.fTypeID== kQwBCM){
340 index = AddToElementList(fBCM, localBeamDetectorID);
341 local_element = fBCM.at(index).get();
342 }
343 if(localBeamDetectorID.fTypeID== kQwClock ) {
344 index = AddToElementList(fClock, localBeamDetectorID);
345 local_element = fClock.at(index).get();
346 }
347 if(localBeamDetectorID.fTypeID== kQwQPD){
348 index = AddToElementList(fQPD, localBeamDetectorID);
349 local_element = &(fQPD.at(index));
350 }
351 if(localBeamDetectorID.fTypeID== kQwLinearArray){
352 index = AddToElementList(fLinearArray, localBeamDetectorID);
353 local_element = &(fLinearArray.at(index));
354 }
355
356 local_element->LoadChannelParameters(mapstr);
357 if (local_element->NeedsExternalClock()){
358 QwDebug << "Try to push device "
359 << local_element->GetElementName()
360 << " (address=" << std::hex << local_element << std::dec
361 << ") onto the clock_needed_list"
362 << QwLog::endl;
363 clock_needed_list.push_back(localBeamDetectorID);
364 }
365 }
366
367
368
369 fBeamDetectorID.push_back(localBeamDetectorID);
370 }
371 }
372
373 // Now load the variables to publish
374 mapstr.RewindToFileStart();
375 std::unique_ptr<QwParameterFile> section;
376 std::vector<TString> publishinfo;
377 while ((section=mapstr.ReadNextSection(varvalue))) {
378 if (varvalue == "PUBLISH") {
379 fPublishList.clear();
380 while (section->ReadNextLine()) {
381 section->TrimComment(); // Remove everything after a comment character
382 section->TrimWhitespace(); // Get rid of leading and trailing spaces
383 for (int ii = 0; ii < 4; ii++) {
384 varvalue = section->GetTypedNextToken<TString>();
385 if (varvalue.Length()) {
386 publishinfo.push_back(varvalue);
387 }
388 }
389 if (publishinfo.size() == 4)
390 fPublishList.push_back(publishinfo);
391 publishinfo.clear();
392 }
393 }
394 }
395 // Print list of variables to publish
396 if (fPublishList.size()>0){
397 QwMessage << "Variables to publish:" << QwLog::endl;
398 for (size_t jj = 0; jj < fPublishList.size(); jj++)
399 QwMessage << fPublishList.at(jj).at(0) << " " << fPublishList.at(jj).at(1) << " "
400 << fPublishList.at(jj).at(2) << " " << fPublishList.at(jj).at(3) << QwLog::endl;
401 }
402
403 if(ldebug){
404 std::cout<<"QwBeamLine::Done with Load map channel \n";
405 for(size_t i=0;i<fBeamDetectorID.size();i++)
406 fBeamDetectorID[i].Print();
407 }
408
409 // Now propagate clock pointers to those channels that need it
410 index = 0;
411 VQwDataElement* local_element;
412 std::string clockname;
413 for (size_t i=0; i<clock_needed_list.size();i++ ) {
414 local_element = GetElement(clock_needed_list[i]);
415 clockname = local_element->GetExternalClockName();
416 if (clockname.empty()){
417 QwWarning << "QwBeamLine::LoadChannelMap "
418 << "Device, " << local_element->GetElementName()
419 << " needs a reference clock, but the reference clock name is empty"
420 << QwLog::endl;
421 } else {
422 index = GetDetectorIndex(kQwClock,clockname);
423 if( index >= 0 ){
424 QwMessage << "QwBeamLine::LoadChannelMap "
425 << "Setting " << fClock.at(index).get()->GetElementName()
426 << " as the reference clock for channel "
427 << local_element->GetElementName()
428 << QwLog::endl;
429 local_element->SetExternalClockPtr(fClock.at(index).get()->GetTime());
430 } else {
431 QwWarning << "QwBeamLine::LoadChannelMap "
432 << "Cannot find clock, " << local_element->GetExternalClockName()
433 << ", needed by device, " << local_element->GetElementName()
434 << QwLog::endl;
435 }
436 }
437 }
438 ldebug=kFALSE;
439
440 mapstr.Close(); // Close the file (ifstream)
441 return 0;
442}
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
EQwBeamInstrumentType GetQwBeamInstrumentType(TString name)
Definition QwTypes.cc:34
@ kQwUnknownDeviceType
Definition QwTypes.h:144
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
virtual void SetExternalClockPtr(const VQwHardwareChannel *)
virtual void LoadChannelParameters(QwParameterFile &)
virtual const TString & GetElementName() const
Get the name of this element.
virtual Bool_t NeedsExternalClock()
virtual std::string GetExternalClockName()
std::vector< std::vector< TString > > fPublishList
Int_t GetSubbankIndex() const
void RegisterRocBankMarker(QwParameterFile &mapstr)
std::map< TString, TString > fDetectorMaps
Map of file name to full path or content.
Int_t AddToElementList(std::vector< TT > &elementlist, QwBeamDetectorID &detector_id)
Adds a new element to a vector of data elements, and returns the index of that element within the arr...
Definition QwBeamLine.cc:92

References QwParameterFile::AddBreakpointKeyword(), AddToElementList(), QwParameterFile::Close(), VQwBCM::CreateCombo(), VQwBPM::CreateCombo(), QwParameterFile::EnableGreediness(), QwLog::endl(), fBCM, fBCMCombo, fBeamDetectorID, fBPMCombo, fCavity, fClock, VQwSubsystem::fCurrentBank_ID, VQwSubsystem::fCurrentROC_ID, VQwSubsystem::fDetectorMaps, QwBeamDetectorID::fdetectorname, fECalculator, fHaloMonitor, QwBeamDetectorID::fIndex, fLinearArray, QwBeamDetectorID::fmoduletype, VQwSubsystem::fPublishList, fQPD, fStripline, QwBeamDetectorID::fTypeID, GetDetectorIndex(), GetElement(), VQwDataElement::GetElementName(), VQwDataElement::GetExternalClockName(), VQwSubsystem::GetName(), QwParameterFile::GetParamFileNameContents(), GetQwBeamInstrumentType(), VQwSubsystem::GetSubbankIndex(), QwParameterFile::GetTypedNextToken(), QwParameterFile::HasVariablePair(), kQwBCM, kQwBPMCavity, kQwBPMStripline, kQwClock, kQwCombinedBCM, kQwCombinedBPM, kQwEnergyCalculator, kQwHaloMonitor, kQwLinearArray, kQwQPD, kQwUnknownDeviceType, VQwDataElement::LoadChannelParameters(), VQwDataElement::NeedsExternalClock(), QwParameterFile::PopValue(), QwDebug, QwError, QwMessage, QwWarning, QwParameterFile::ReadNextLine(), QwParameterFile::ReadNextSection(), VQwSubsystem::RegisterRocBankMarker(), QwBeamDetectorID::ReportInitErrors(), QwParameterFile::ReturnValue(), QwParameterFile::RewindToFileStart(), QwParameterFile::SetCommentChars(), VQwDataElement::SetExternalClockPtr(), and QwParameterFile::SkipSection().

+ Here is the call graph for this function:

◆ LoadEventCuts_Fin()

void QwBeamLine::LoadEventCuts_Fin ( Int_t & eventcut_flag)
overridevirtual

Apply the event-cut mode bitmask to all managed devices.

Reimplemented from VQwSubsystemParity.

Definition at line 527 of file QwBeamLine.cc.

527 {
528 for (size_t i=0;i<fStripline.size();i++)
529 fStripline[i].get()->SetEventCutMode(eventcut_flag);
530
531 for (size_t i=0;i<fQPD.size();i++)
532 fQPD[i].SetEventCutMode(eventcut_flag);
533
534 for (size_t i=0;i<fLinearArray.size();i++)
535 fLinearArray[i].SetEventCutMode(eventcut_flag);
536
537 for (size_t i=0;i<fCavity.size();i++)
538 fCavity[i].SetEventCutMode(eventcut_flag);
539
540 for (size_t i=0;i<fBCM.size();i++)
541 fBCM[i].get()->SetEventCutMode(eventcut_flag);
542
543 for (size_t i=0;i<fClock.size();i++)
544 fClock[i].get()->SetEventCutMode(eventcut_flag);
545
546 for (size_t i=0;i<fHaloMonitor.size();i++)
547 fHaloMonitor[i].SetEventCutMode(eventcut_flag);
548
549 for (size_t i=0;i<fBCMCombo.size();i++)
550 fBCMCombo[i].get()->SetEventCutMode(eventcut_flag);
551
552 for (size_t i=0;i<fBPMCombo.size();i++)
553 fBPMCombo[i].get()->SetEventCutMode(eventcut_flag);
554
555 for (size_t i=0;i<fECalculator.size();i++)
556 fECalculator[i].SetEventCutMode(eventcut_flag);
557
558 fQwBeamLineErrorCount=0; //set the error counter to zero
559}

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fQwBeamLineErrorCount, and fStripline.

◆ LoadEventCuts_Init()

void QwBeamLine::LoadEventCuts_Init ( )
inlineoverridevirtual

Reimplemented from VQwSubsystemParity.

Definition at line 74 of file QwBeamLine.h.

74{};

◆ LoadEventCuts_Line()

void QwBeamLine::LoadEventCuts_Line ( QwParameterFile & mapstr,
TString & varvalue,
Int_t & eventcut_flag )
overridevirtual

Decode a single event-cuts line for devices and subchannels, routing the resulting thresholds and error flags to the proper element.

Reimplemented from VQwSubsystemParity.

Definition at line 450 of file QwBeamLine.cc.

450 {
451 TString device_type = mapstr.GetTypedNextToken<TString>();
452 device_type.ToLower();
453 TString device_name = mapstr.GetTypedNextToken<TString>();
454 device_name.ToLower();
455
456 Int_t det_index = GetDetectorIndex(GetQwBeamInstrumentType(device_type),device_name);
457 if (det_index == -1) {
458 QwWarning << " Device not found " << device_name << " of type " << device_type << QwLog::endl;
459 //continue;
460 }
461
462 TString channel_name;
463
464 if(device_type == GetQwBeamInstrumentTypeName(kQwBPMStripline) ||
465 device_type == GetQwBeamInstrumentTypeName(kQwQPD) ||
469
470 channel_name = mapstr.GetTypedNextToken<TString>();
471 channel_name.ToLower();
472 }
473
474 Double_t LLX = mapstr.GetTypedNextToken<Double_t>(); //lower limit for BCM value
475 Double_t ULX = mapstr.GetTypedNextToken<Double_t>(); //upper limit for BCM value
476 varvalue = mapstr.GetTypedNextToken<TString>();//global/local
477 varvalue.ToLower();
478
479 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
480 Double_t burplevel = mapstr.GetTypedNextToken<Double_t>();
481
482
483 if (device_type == GetQwBeamInstrumentTypeName(kQwBCM)){
484 QwMessage<<"QwBeamLine Error Code passing to QwBCM "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<", burp = "<<burplevel<<QwLog::endl;
485 fBCM[det_index].get()->SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut,burplevel);//(fBCMEventCuts);
486
487 } else if (device_type == GetQwBeamInstrumentTypeName(kQwHaloMonitor)){
488 QwMessage<<"QwBeamLine Error Code passing to QwHaloMonitor "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
489 fHaloMonitor[det_index].SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut,burplevel);//(fBCMEventCuts);
490
491 } else if (device_type == GetQwBeamInstrumentTypeName(kQwEnergyCalculator)){
492 QwMessage<<"QwBeamLine Error Code passing to QwEnergyCalculator "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
493 fECalculator[det_index].SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut,burplevel);//(fEnergyEventCuts);
494
495 } else if (device_type == GetQwBeamInstrumentTypeName(kQwBPMStripline)){
496 QwMessage<<"QwBeamLine:QwBPMStripline "<<channel_name<<" "<<varvalue<<" "<<stabilitycut<<QwLog::endl;
497 //QwMessage<<"QwBeamLine Error Code passing to QwBPMStripline "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<" stability "<<stabilitycut <<QwLog::endl;
498 fStripline[det_index].get()->SetSingleEventCuts(channel_name, GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut, burplevel);
499
500 } else if (device_type == GetQwBeamInstrumentTypeName(kQwQPD)){
501 QwMessage<<"QwBeamLine Error Code passing to QwQPD "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
502 fQPD[det_index].SetSingleEventCuts(channel_name, GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut, burplevel);
503
504 } else if (device_type == GetQwBeamInstrumentTypeName(kQwLinearArray)){
505 QwMessage<<"QwBeamLine Error Code passing to QwLinearArray "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
506 fLinearArray[det_index].SetSingleEventCuts(channel_name, GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut, burplevel);
507
508 } else if (device_type == GetQwBeamInstrumentTypeName(kQwBPMCavity)){
509 varvalue.ToLower();
510 QwMessage<<"QwBeamLine Error Code passing to QwBPMCavity "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<" "<<det_index<<QwLog::endl;
511 fCavity[det_index].SetSingleEventCuts(channel_name, GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut, burplevel);
512
513 } else if (device_type == GetQwBeamInstrumentTypeName(kQwCombinedBCM)){
514 varvalue.ToLower();
515 QwMessage<<"QwBeamLine Error Code passing to QwCombinedBCM "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
516 fBCMCombo[det_index].get()->PrintInfo();
517 fBCMCombo[det_index].get()->SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut, burplevel);
518
519 } else if (device_type == GetQwBeamInstrumentTypeName(kQwCombinedBPM)){
520 varvalue.ToLower();
521 QwMessage<<"QwBeamLine Error Code passing to QwCombinedBPM "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
522 fBPMCombo[det_index].get()->SetSingleEventCuts(channel_name, GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut, burplevel);
523 }
524}
UInt_t GetGlobalErrorFlag(TString evtype, Int_t evMode, Double_t stabilitycut)
Definition QwTypes.cc:132

References QwLog::endl(), fBCM, fBCMCombo, fBPMCombo, fCavity, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, GetDetectorIndex(), GetGlobalErrorFlag(), GetQwBeamInstrumentType(), GetQwBeamInstrumentTypeName(), QwParameterFile::GetTypedNextToken(), kQwBCM, kQwBPMCavity, kQwBPMStripline, kQwCombinedBCM, kQwCombinedBPM, kQwEnergyCalculator, kQwHaloMonitor, kQwLinearArray, kQwQPD, QwMessage, and QwWarning.

+ Here is the call graph for this function:

◆ LoadGeometryDefinition()

Int_t QwBeamLine::LoadGeometryDefinition ( TString mapfile)
overridevirtual

Load geometry and electronics calibration parameters from a map file and apply them to the proper devices (offsets, rotation, gains).

Reimplemented from VQwSubsystem.

Definition at line 566 of file QwBeamLine.cc.

566 {
567 Bool_t ldebug=kFALSE;
568 TString varname, varvalue;
569 Int_t lineread=1;
570 Int_t index = 0;
571 TString devname,devtype;
572 TString melement;
573 Double_t devOffsetX = 0,devOffsetY = 0, devOffsetZ = 0;
574 Double_t devSENfactor = 0, devAlphaX = 0, devAlphaY = 0;
575 TString rotation_stat;
576 VQwBPM * bpm = NULL;
577
578 if(ldebug)std::cout<<"QwBeamLine::LoadGeometryParameters("<< mapfile<<")\n";
579
580 QwParameterFile mapstr(mapfile.Data()); //Open the file
581 fDetectorMaps.insert(mapstr.GetParamFileNameContents());
582 while (mapstr.ReadNextLine()){
583 lineread+=1;
584 if(ldebug)std::cout<<" line read so far ="<<lineread<<"\n";
585 mapstr.TrimComment('!');
586 mapstr.TrimWhitespace();
587
588 if (mapstr.LineIsEmpty()) continue;
589
590 Bool_t notfound=kTRUE;
591
592 devtype = mapstr.GetTypedNextToken<TString>();
593 devtype.ToLower();
594 devtype.Remove(TString::kBoth,' ');
595 devname = mapstr.GetTypedNextToken<TString>();
596 devname.ToLower();
597 devname.Remove(TString::kBoth,' ');
598
600 QwError << "Error! Unknown detector type '"<<devtype
601 << "' in Geometry file!"<<QwLog::endl;
602 /*If the device type is unknown there is no point in going through the rest of the specs for that device*/
603 continue;
604 }
605
606 index=GetDetectorIndex(GetQwBeamInstrumentType(devtype),devname);
607 if( index<0 ) {
608 /*Detector name isn't recognized. Ignore it!*/
609 QwWarning << "Unrecognized detector name '" << devname
610 << "' in Geometry file. This may not be a problem, "
611 << "if we're using a reduced channel map."
612 << QwLog::endl;
613 }
614 else {
615 devOffsetX = mapstr.GetTypedNextToken<Double_t>(); // X offset
616 devOffsetY = mapstr.GetTypedNextToken<Double_t>(); // Y offset
617 devOffsetZ = mapstr.GetTypedNextToken<Double_t>(); // Z offset
618 devSENfactor = mapstr.GetTypedNextToken<Double_t>(); // sensitivity scaling factor
619 devAlphaX = mapstr.GetTypedNextToken<Double_t>(); // alpha X
620 devAlphaY = mapstr.GetTypedNextToken<Double_t>(); // alpha Y
621
622
623 /*If the device is a bpm stripline, assign the rotations and gains*/
625 bpm = fStripline.at(index).get();
626 AssignGeometry(&mapstr,bpm);
627 }
628
629
630 if(ldebug==1){
631 std::cout<<"####################\n";
632 std::cout<<"! device type, device_name, Xoffset, Yoffset, Zoffset, BSEN scaling factor, AlpaX, AlpaY\n"<<std::endl;
633 std::cout<<GetQwBeamInstrumentType(devtype)<<" / "
634 <<devname <<" / "
635 <<devOffsetX <<" / "
636 <<devOffsetY <<" / "
637 <<devOffsetZ <<" / "
638 <<devSENfactor <<" / "
639 <<devAlphaX <<" / "
640 <<devAlphaY <<" / "
641 <<std::endl;
642 }
643
644
645 while(notfound){
647 //Load bpm offsets
648 if(index == -1){
649 QwWarning << "QwBeamLine::LoadGeometryDefinition: Unknown bpm in qweak_beamline_geometry.map: "
650 <<devname
651 <<QwLog::endl;
652 notfound=kFALSE;
653 continue;
654 }
655
656 TString localname = fStripline.at(index).get()->GetElementName();
657 localname.ToLower();
658 if(ldebug) std::cout<<"element name =="<<localname
659 <<"== to be compared to =="<<devname<<"== \n";
660
661 if(localname==devname){
662 if(ldebug) std::cout<<" I found the bpm !\n";
663 bpm->GetSurveyOffsets(devOffsetX,devOffsetY,devOffsetZ);
664 bpm->GetElectronicFactors(devSENfactor,devAlphaX, devAlphaY);
665
666 // If nothing is specified, a default rotation of 45 degrees is implied.
667 notfound=kFALSE;
668 }
669 }
670 else if (GetQwBeamInstrumentType(devtype)==kQwCombinedBPM){
671 //Load combined bpm offsets which are, ofcourse, target position in the beamline
672 if(index == -1){
673 QwError << "QwBeamLine::LoadGeometryDefinition: Unknown combined bpm in qweak_beamline_geometry.map: "
674 <<devname<<" Check the combined bpm names!\n "
675 << QwLog::endl;
676 notfound=kFALSE;
677 continue;
678 }
679
680 TString localname = fBPMCombo.at(index).get()->GetElementName();
681 localname.ToLower();
682 if(ldebug)
683 std::cout<<"element name =="<<localname<<"== to be compared to =="<<devname<<"== \n";
684
685 if(localname==devname){
686 if(ldebug) std::cout<<" I found the combinedbpm !\n";
687 fBPMCombo.at(index).get()->GetSurveyOffsets(devOffsetX,devOffsetY,devOffsetZ);
688 notfound=kFALSE;
689 }
690 }
691 else if(GetQwBeamInstrumentType(devtype)==kQwBPMCavity){
692 //Load cavity bpm offsets
693 if(index == -1){
694 QwError << "QwBeamLine::LoadGeometryDefinition: Unknown bpm : "
695 <<devname<<" will not be assigned with geometry parameters. \n"
696 <<QwLog::endl;
697 notfound=kFALSE;
698 continue;
699 }
700 TString localname = fCavity.at(index).GetElementName();
701 localname.ToLower();
702 if(ldebug) std::cout<<"element name =="<<localname
703 <<"== to be compared to =="<<devname<<"== \n";
704
705 if(localname==devname){
706 if(ldebug) std::cout<<" I found the cavity bpm !\n";
707 fCavity.at(index).GetSurveyOffsets(devOffsetX,devOffsetY,devOffsetZ);
708 notfound=kFALSE;
709 }
710 }
711 else if(GetQwBeamInstrumentType(devtype)==kQwQPD){
712 //Load QPD calibration factors
713 if(index == -1){
714 QwError << "QwBeamLine::LoadGeometryDefinition: Unknown QPD : "
715 <<devname<<" will not be assigned with calibration factors. \n"
716 <<QwLog::endl;
717 notfound=kFALSE;
718 continue;
719 }
720 TString localname = fQPD.at(index).GetElementName();
721 localname.ToLower();
722 if(ldebug) std::cout<<"element name =="<<localname
723 <<"== to be compared to =="<<devname<<"== \n";
724
725 if(localname==devname){
726 if(ldebug) std::cout<<"I found the QPD !\n";
727 fQPD.at(index).GetCalibrationFactors(devAlphaX, devAlphaY);
728 notfound=kFALSE;
729 }
730 }
731 else QwError << "QwBeamLine::LoadGeometryDefinition: Unknown device type : "<< devtype <<
732 ". Are you sure we have this in the beamline? I am skipping this."<< QwLog::endl;
733 }
734 }
735 }
736
737 if(ldebug) std::cout << "line read in the geometry file = " << lineread<< " \n";
738
739 ldebug=kFALSE;
740 mapstr.Close(); // Close the file (ifstream)
741 return 0;
742
743}
void AssignGeometry(QwParameterFile *mapstr, VQwBPM *bpm)
void GetSurveyOffsets(Double_t Xoffset, Double_t Yoffset, Double_t Zoffset)
Store geometry/survey offsets for absolute position calibration.
Definition VQwBPM.cc:56
void GetElectronicFactors(Double_t BSENfactor, Double_t AlphaX, Double_t AlphaY)
Apply per-detector electronic calibration and relative gains.
Definition VQwBPM.cc:77

References AssignGeometry(), QwParameterFile::Close(), QwLog::endl(), fBPMCombo, fCavity, VQwSubsystem::fDetectorMaps, fQPD, fStripline, GetDetectorIndex(), VQwBPM::GetElectronicFactors(), QwParameterFile::GetParamFileNameContents(), GetQwBeamInstrumentType(), VQwBPM::GetSurveyOffsets(), QwParameterFile::GetTypedNextToken(), kQwBPMCavity, kQwBPMStripline, kQwCombinedBPM, kQwQPD, kQwUnknownDeviceType, QwParameterFile::LineIsEmpty(), QwError, QwWarning, QwParameterFile::ReadNextLine(), QwParameterFile::TrimComment(), and QwParameterFile::TrimWhitespace().

+ Here is the call graph for this function:

◆ LoadInputParameters()

Int_t QwBeamLine::LoadInputParameters ( TString pedestalfile)
overridevirtual

Load pedestals and calibration factors per subelement/device.

Parameters
pedestalfilePath to the input parameter file.
Returns
0 on success.

Implements VQwSubsystem.

Definition at line 847 of file QwBeamLine.cc.

848{
849 Bool_t ldebug=kFALSE;
850
851 Int_t lineread=1;
852
853 if(ldebug)std::cout<<"QwBeamLine::LoadInputParameters("<< pedestalfile<<")\n";
854
855 QwParameterFile mapstr(pedestalfile.Data()); //Open the file
856 fDetectorMaps.insert(mapstr.GetParamFileNameContents());
857
858 while (mapstr.ReadNextLine())
859 {
860 lineread+=1;
861 if(ldebug)std::cout<<" line read so far ="<<lineread<<"\n";
862 mapstr.TrimComment('!'); // Remove everything after a '!' character.
863 mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
864 if (mapstr.LineIsEmpty()) continue;
865 else
866 {
867 TString varname = mapstr.GetTypedNextToken<TString>(); //name of the channel
868 varname.ToLower();
869 varname.Remove(TString::kBoth,' ');
870 Double_t varped = mapstr.GetTypedNextToken<Double_t>(); // value of the pedestal
871 Double_t varcal = mapstr.GetTypedNextToken<Double_t>(); // value of the calibration factor
872 /*Double_t varweight = */ mapstr.GetTypedNextToken<Double_t>(); // value of the statistical weight
873
874 //if(ldebug) std::cout<<"inputs for channel "<<varname
875 // <<": ped="<<varped<<": cal="<<varcal<<": weight="<<varweight<<"\n";
876 Bool_t notfound=kTRUE;
877
878 if(notfound) {
879 for(size_t i=0;i<fStripline.size();i++)
880 {
881 for(int j=0;j<4;j++)
882 {
883 TString localname = fStripline[i].get()->GetSubElementName(j);
884 localname.ToLower();
885 if(ldebug) std::cout<<"Stripline element name =="<<localname
886 <<"== to be compared to =="<<varname<<"== \n";
887 if(localname==varname)
888 {
889 if(ldebug) std::cout<<" I found it !\n";
890 fStripline[i].get()->SetSubElementPedestal(j,varped);
891 fStripline[i].get()->SetSubElementCalibrationFactor(j,varcal);
892 notfound=kFALSE;
893 j=5;
894 i=fStripline.size()+1;
895 }
896 }
897 }
898 for(size_t i=0;i<fQPD.size();i++)
899 {
900 for(int j=0;j<4;j++)
901 {
902 TString localname = fQPD[i].GetSubElementName(j);
903 localname.ToLower();
904 if(ldebug) std::cout<<"QPD element name =="<<localname
905 <<"== to be compared to =="<<varname<<"== \n";
906 if(localname==varname)
907 {
908 if(ldebug) std::cout<<" I found it !\n";
909 fQPD[i].SetSubElementPedestal(j,varped);
910 fQPD[i].SetSubElementCalibrationFactor(j,varcal);
911 notfound=kFALSE;
912 j=5;
913 i=fQPD.size()+1;
914 }
915 }
916 }
917 for(size_t i=0;i<fLinearArray.size();i++)
918 {
919 for(int j=0;j<8;j++)
920 {
921 TString localname = fLinearArray[i].GetSubElementName(j);
922 localname.ToLower();
923 if(ldebug) std::cout<<"LinearArray element name =="<<localname
924 <<"== to be compared to =="<<varname<<"== \n";
925 if(localname==varname)
926 {
927 if(ldebug) std::cout<<" I found it !\n";
928 fLinearArray[i].SetSubElementPedestal(j,varped);
929 fLinearArray[i].SetSubElementCalibrationFactor(j,varcal);
930 notfound=kFALSE;
931 j=9;
932 i=fLinearArray.size()+1;
933 }
934 }
935 }
936 for(size_t i=0;i<fCavity.size();i++)
937 {
938 for(size_t j=0;j<QwBPMCavity::kNumElements;j++)
939 {
940 TString localname = fCavity[i].GetSubElementName(j);
941 localname.ToLower();
942 if(ldebug) std::cout<<"Cavity element name =="<<localname
943 <<"== to be compared to =="<<varname<<"== \n";
944 if(localname==varname)
945 {
946 if(ldebug) std::cout<<" I found it !\n";
947 fCavity[i].SetSubElementPedestal(j,varped);
948 fCavity[i].SetSubElementCalibrationFactor(j,varcal);
949 notfound=kFALSE;
950 j=3;
951 i=fCavity.size()+1;
952 }
953 }
954 }
955 for(size_t i=0;i<fBCM.size();i++) {
956 if(fBCM[i].get()->GetElementName()==varname)
957 {
958 fBCM[i].get()->SetPedestal(varped);
959 fBCM[i].get()->SetCalibrationFactor(varcal);
960 i=fBCM.size()+1;
961 notfound=kFALSE;
962 i=fBCM.size()+1;
963 }
964 }
965 for(size_t i=0;i<fClock.size();i++) {
966 if(fClock[i].get()->GetElementName()==varname)
967 {
968 fClock[i].get()->SetPedestal(varped);
969 fClock[i].get()->SetCalibrationFactor(varcal);
970 i=fClock.size()+1;
971 notfound=kFALSE;
972 i=fClock.size()+1;
973 }
974 }
975 for(size_t i=0;i<fHaloMonitor.size();i++) {
976 if(fHaloMonitor[i].GetElementName()==varname)
977 {
978 std::cout<<varname<<" I found it ! "<<varcal<<" ped. "<<varped<<"\n";
979 fHaloMonitor[i].SetPedestal(varped);
980 fHaloMonitor[i].SetCalibrationFactor(varcal);
981 i=fHaloMonitor.size()+1;
982 notfound=kFALSE;
983 i=fHaloMonitor.size()+1;
984 }
985 }
986 }
987 }
988 }
989 if(ldebug) std::cout<<" line read in the pedestal + cal file ="<<lineread<<" \n";
990
991 ldebug=kFALSE;
992 mapstr.Close(); // Close the file (ifstream)
993 return 0;
994}

References QwParameterFile::Close(), fBCM, fCavity, fClock, VQwSubsystem::fDetectorMaps, fHaloMonitor, fLinearArray, fQPD, fStripline, QwParameterFile::GetParamFileNameContents(), QwParameterFile::GetTypedNextToken(), QwBPMCavity::kNumElements, QwParameterFile::LineIsEmpty(), QwParameterFile::ReadNextLine(), QwParameterFile::TrimComment(), and QwParameterFile::TrimWhitespace().

+ Here is the call graph for this function:

◆ LoadMockDataParameters()

void QwBeamLine::LoadMockDataParameters ( TString mapfile)
overridevirtual

Load per-device mock-data generation parameters from a file.

Reimplemented from VQwSubsystemParity.

Definition at line 747 of file QwBeamLine.cc.

747 {
748
749 Bool_t ldebug=kFALSE;
750 TString varname, varvalue;
751 Int_t lineread=1;
752 Int_t index = 0;
753 TString devname, devtype;
754 TString melement;
755
756 if(ldebug) std::cout << "QwBeamLine::LoadMockDataParameters(" << mapfile << ") \n" << std::endl;
757
758 QwParameterFile mapstr(mapfile.Data()); //Open the file
759 fDetectorMaps.insert(mapstr.GetParamFileNameContents());
760
761 while (mapstr.ReadNextLine()) {
762 lineread+=1;
763 // std::cerr << "Line: " << mapstr.GetLine() << std::endl;
764 if(ldebug) std::cout << "Line read so far = " << lineread << "\n" << std::endl;
765 mapstr.TrimComment('!');
766 mapstr.TrimWhitespace();
767
768 if(mapstr.LineIsEmpty()) continue;
769
770 devtype = mapstr.GetTypedNextToken<TString>();
771 devtype.ToLower();
772 devtype.Remove(TString::kBoth,' ');
773 devname = mapstr.GetTypedNextToken<TString>();
774 devname.ToLower();
775 devname.Remove(TString::kBoth,' ');
776
778 /*If the device type is unknown there is no point in going through the rest of the specs for that device*/
779 QwError << "Error! Unknown detector type '" << devtype << "' in MockDataParameters file!" << QwLog::endl;
780 continue;
781 }
782 index = GetDetectorIndex(GetQwBeamInstrumentType(devtype),devname);
783 if (index<0) {
784 /*Detector name isn't recognized. Ignore it!*/
785 QwWarning << "Unrecognized detector name '" << devname << "' in MockDataParameters file." << QwLog::endl;
786 continue;
787 }
788 // The device should process the reminder of this line.
790 }
791}
virtual void LoadMockDataParameters(QwParameterFile &)

References QwLog::endl(), VQwSubsystem::fDetectorMaps, GetDetectorIndex(), GetElement(), QwParameterFile::GetParamFileNameContents(), GetQwBeamInstrumentType(), QwParameterFile::GetTypedNextToken(), kQwUnknownDeviceType, QwParameterFile::LineIsEmpty(), VQwDataElement::LoadMockDataParameters(), QwError, QwWarning, QwParameterFile::ReadNextLine(), QwParameterFile::TrimComment(), and QwParameterFile::TrimWhitespace().

+ Here is the call graph for this function:

◆ operator+=()

VQwSubsystem & QwBeamLine::operator+= ( VQwSubsystem * value)
overridevirtual

Implements VQwSubsystemParity.

Definition at line 2170 of file QwBeamLine.cc.

2171{
2172 if(Compare(value))
2173 {
2174 //QwBeamLine* input= (QwBeamLine*)value ;
2175 QwBeamLine* input = dynamic_cast<QwBeamLine*>(value);
2176
2177 for(size_t i=0;i<input->fClock.size();i++)
2178 *(this->fClock[i].get())+=*(input->fClock[i].get());
2179 for(size_t i=0;i<input->fStripline.size();i++)
2180 *(this->fStripline[i].get())+=*(input->fStripline[i].get());
2181 for(size_t i=0;i<input->fCavity.size();i++)
2182 this->fCavity[i]+=input->fCavity[i];
2183 for(size_t i=0;i<input->fQPD.size();i++)
2184 this->fQPD[i]+=input->fQPD[i];
2185 for(size_t i=0;i<input->fLinearArray.size();i++)
2186 this->fLinearArray[i]+=input->fLinearArray[i];
2187 for(size_t i=0;i<input->fBCM.size();i++)
2188 *(this->fBCM[i].get())+=*(input->fBCM[i].get());
2189 for(size_t i=0;i<input->fHaloMonitor.size();i++)
2190 this->fHaloMonitor[i]+=input->fHaloMonitor[i];
2191 for(size_t i=0;i<input->fBCMCombo.size();i++)
2192 *(this->fBCMCombo[i].get())+=*(input->fBCMCombo[i].get());
2193 for(size_t i=0;i<input->fBPMCombo.size();i++)
2194 *(this->fBPMCombo[i].get())+=*(input->fBPMCombo[i].get());
2195 for(size_t i=0;i<input->fECalculator.size();i++)
2196 this->fECalculator[i]+=input->fECalculator[i];
2197
2198 if (input->fPublishList.size()>0){
2199 this->fPublishList.resize(input->fPublishList.size());
2200 for(size_t i=0;i<input->fPublishList.size();i++){
2201 this->fPublishList.at(i).resize(input->fPublishList.at(i).size());
2202 for(size_t j=0;j<input->fPublishList.at(i).size();j++){
2203 this->fPublishList.at(i).at(j)=input->fPublishList.at(i).at(j);
2204 }
2205 }
2206 }
2207
2208 }
2209 return *this;
2210}

References Compare(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, VQwSubsystem::fPublishList, fQPD, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ operator-=()

VQwSubsystem & QwBeamLine::operator-= ( VQwSubsystem * value)
overridevirtual

Implements VQwSubsystemParity.

Definition at line 2213 of file QwBeamLine.cc.

2214{
2215
2216 if(Compare(value))
2217 {
2218 QwBeamLine* input = dynamic_cast<QwBeamLine*>(value);
2219
2220 for(size_t i=0;i<input->fClock.size();i++)
2221 *(this->fClock[i].get())-=*(input->fClock[i].get());
2222 for(size_t i=0;i<input->fStripline.size();i++)
2223 *(this->fStripline[i].get())-=*(input->fStripline[i].get());
2224 for(size_t i=0;i<input->fCavity.size();i++)
2225 this->fCavity[i]-=input->fCavity[i];
2226 for(size_t i=0;i<input->fQPD.size();i++)
2227 this->fQPD[i]-=input->fQPD[i];
2228 for(size_t i=0;i<input->fLinearArray.size();i++)
2229 this->fLinearArray[i]-=input->fLinearArray[i];
2230 for(size_t i=0;i<input->fBCM.size();i++)
2231 *(this->fBCM[i].get())-=*(input->fBCM[i].get());
2232 for(size_t i=0;i<input->fHaloMonitor.size();i++)
2233 this->fHaloMonitor[i]-=input->fHaloMonitor[i];
2234 for(size_t i=0;i<input->fBCMCombo.size();i++)
2235 *(this->fBCMCombo[i].get())-=*(input->fBCMCombo[i].get());
2236 for(size_t i=0;i<input->fBPMCombo.size();i++)
2237 *(this->fBPMCombo[i].get())-=*(input->fBPMCombo[i].get());
2238 for(size_t i=0;i<input->fECalculator.size();i++)
2239 this->fECalculator[i]-=input->fECalculator[i];
2240
2241 if (input->fPublishList.size()>0){
2242 this->fPublishList.resize(input->fPublishList.size());
2243 for(size_t i=0;i<input->fPublishList.size();i++){
2244 this->fPublishList.at(i).resize(input->fPublishList.at(i).size());
2245 for(size_t j=0;j<input->fPublishList.at(i).size();j++){
2246 this->fPublishList.at(i).at(j)=input->fPublishList.at(i).at(j);
2247 }
2248 }
2249 }
2250
2251 }
2252 return *this;
2253}

References Compare(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, VQwSubsystem::fPublishList, fQPD, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ operator=()

VQwSubsystem & QwBeamLine::operator= ( VQwSubsystem * value)
overridevirtual

Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value)

Implements VQwSubsystemParity.

Definition at line 2124 of file QwBeamLine.cc.

2125{
2126 // std::cout<<" here in QwBeamLine::operator= \n";
2127 if(Compare(value))
2128 {
2129
2131 QwBeamLine* input = dynamic_cast<QwBeamLine*>(value);
2132
2133 for(size_t i=0;i<input->fClock.size();i++)
2134 *(this->fClock[i].get())=*(input->fClock[i].get());
2135 for(size_t i=0;i<input->fStripline.size();i++)
2136 *(this->fStripline[i].get())=*(input->fStripline[i].get());
2137 for(size_t i=0;i<input->fQPD.size();i++)
2138 this->fQPD[i]=input->fQPD[i];
2139 for(size_t i=0;i<input->fLinearArray.size();i++)
2140 this->fLinearArray[i]=input->fLinearArray[i];
2141 for(size_t i=0;i<input->fCavity.size();i++)
2142 this->fCavity[i]=input->fCavity[i];
2143 for(size_t i=0;i<input->fBCM.size();i++)
2144 *(this->fBCM[i].get())=*(input->fBCM[i].get());
2145 for(size_t i=0;i<input->fHaloMonitor.size();i++)
2146 this->fHaloMonitor[i]=input->fHaloMonitor[i];
2147 for(size_t i=0;i<input->fBCMCombo.size();i++)
2148 *(this->fBCMCombo[i].get())=*(input->fBCMCombo[i].get());
2149 for(size_t i=0;i<input->fBPMCombo.size();i++)
2150 *(this->fBPMCombo[i].get())=*(input->fBPMCombo[i].get());
2151 for(size_t i=0;i<input->fECalculator.size();i++)
2152 this->fECalculator[i]=input->fECalculator[i];
2153
2154 if (input->fPublishList.size()>0){
2155 this->fPublishList.resize(input->fPublishList.size());
2156 for(size_t i=0;i<input->fPublishList.size();i++){
2157 this->fPublishList.at(i).resize(input->fPublishList.at(i).size());
2158 for(size_t j=0;j<input->fPublishList.at(i).size();j++){
2159 this->fPublishList.at(i).at(j)=input->fPublishList.at(i).at(j);
2160 }
2161 }
2162 }
2163
2164 }
2165 return *this;
2166}
virtual VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...

References Compare(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, VQwSubsystem::fPublishList, fQPD, fStripline, VQwSubsystem::operator=(), QwBeamLine(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ PrintDetectorID()

void QwBeamLine::PrintDetectorID ( ) const

Definition at line 2788 of file QwBeamLine.cc.

2789{
2790 for (size_t i=0;i<fBeamDetectorID.size();i++)
2791 {
2792 std::cout<<"============================="<<std::endl;
2793 std::cout<<" Detector ID="<<i<<std::endl;
2794 fBeamDetectorID[i].Print();
2795 }
2796 return;
2797}

References fBeamDetectorID.

◆ PrintErrorCounters()

void QwBeamLine::PrintErrorCounters ( ) const
overridevirtual

Print a beamline-wide summary of persistent error counters.

Implements VQwSubsystemParity.

Definition at line 1419 of file QwBeamLine.cc.

1419 {//inherited from the VQwSubsystemParity; this will display the error summary
1420
1421 QwMessage<<"*********QwBeamLine Error Summary****************"<<QwLog::endl;
1423
1424 for(size_t i=0;i<fClock.size();i++){
1425 fClock[i].get()->PrintErrorCounters();
1426 }
1427 printf("\n");
1428 for(size_t i=0;i<fBCM.size();i++){
1429 fBCM[i].get()->PrintErrorCounters();
1430 }
1431 printf("\n");
1432 for(size_t i=0;i<fHaloMonitor.size();i++){
1433 fHaloMonitor[i].PrintErrorCounters();
1434 }
1435 printf("\n");
1436 for(size_t i=0;i<fStripline.size();i++){
1437 fStripline[i].get()->PrintErrorCounters();
1438 printf("\n");
1439 }
1440 for(size_t i=0;i<fQPD.size();i++){
1441 fQPD[i].PrintErrorCounters();
1442 }
1443 printf("\n");
1444 for(size_t i=0;i<fLinearArray.size();i++){
1445 fLinearArray[i].PrintErrorCounters();
1446 }
1447 printf("\n");
1448 for(size_t i=0;i<fCavity.size();i++){
1449 fCavity[i].PrintErrorCounters();
1450 }
1451 printf("\n");
1452 for(size_t i=0;i<fBCMCombo.size();i++){
1453 fBCMCombo[i].get()->PrintErrorCounters();
1454 }
1455 printf("\n");
1456 for(size_t i=0;i<fBPMCombo.size();i++){
1457 fBPMCombo[i].get()->PrintErrorCounters();
1458 }
1459 printf("\n");
1460 for(size_t i=0;i<fECalculator.size();i++){
1461 fECalculator[i].PrintErrorCounters();
1462 }
1464}
static void PrintErrorCounterTail()
static void PrintErrorCounterHead()

References QwLog::endl(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, QwVQWK_Channel::PrintErrorCounterHead(), QwVQWK_Channel::PrintErrorCounterTail(), and QwMessage.

+ Here is the call graph for this function:

◆ PrintInfo()

void QwBeamLine::PrintInfo ( ) const
overridevirtual

Print some information about the subsystem.

Print some information about the subsystem (name, ROCs/banks, parent).

Reimplemented from VQwSubsystem.

Definition at line 2765 of file QwBeamLine.cc.

2766{
2767 std::cout<<"Name of the subsystem ="<<fSystemName<<"\n";
2768 std::cout<<"there are "<<fClock.size()<<" clock \n";
2769 std::cout<<"there are "<<fStripline.size()<<" striplines \n";
2770 std::cout<<"there are "<<fQPD.size()<<" QPDs \n";
2771 std::cout<<"there are "<<fLinearArray.size()<<" LinearArrays \n";
2772 std::cout<<"there are "<<fCavity.size()<<" cavities \n";
2773 std::cout<<"there are "<<fBCM.size()<<" bcm \n";
2774 std::cout<<"there are "<<fHaloMonitor.size()<<" halomonitors \n";
2775 std::cout<<"there are "<<fBCMCombo.size()<<" combined bcms \n";
2776 std::cout<<"there are "<<fBPMCombo.size()<<" combined bpms \n";
2777 std::cout<<"there are "<<fECalculator.size()<<" energy calculators \n";
2778 std::cout<<" Printing Running AVG and other channel info for BCMs"<<std::endl;
2779 for(size_t i=0;i<fBCM.size();i++)
2780 fBCM[i].get()->PrintInfo();
2781 for(size_t i=0;i<fHaloMonitor.size();i++)
2783 return;
2784}
TString fSystemName
Name of this subsystem.
void PrintInfo() const override
Print some information about the subsystem.

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, VQwSubsystem::fSystemName, and PrintInfo().

Referenced by PrintInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrintValue()

void QwBeamLine::PrintValue ( ) const
overridevirtual

Print values of all channels.

Reimplemented from VQwSubsystemParity.

Definition at line 2329 of file QwBeamLine.cc.

2330{
2331 QwMessage << "=== QwBeamLine: " << GetName() << " ===" << QwLog::endl;
2332 QwMessage << "Clock" << QwLog::endl;
2333 for (size_t i = 0; i < fClock.size(); i++) fClock[i].get()->PrintValue();
2334 QwMessage << "BPM stripline" << QwLog::endl;
2335 for (size_t i = 0; i < fStripline.size(); i++) fStripline[i].get()->PrintValue();
2336 QwMessage << "QPD" << QwLog::endl;
2337 for (size_t i = 0; i < fQPD.size(); i++) fQPD[i].PrintValue();
2338 QwMessage << "LinearArray" << QwLog::endl;
2339 for (size_t i = 0; i < fLinearArray.size(); i++) fLinearArray[i].PrintValue();
2340 QwMessage << "BPM cavity" << QwLog::endl;
2341 for (size_t i = 0; i < fCavity.size(); i++) fCavity[i].PrintValue();
2342 QwMessage << "BCM" << QwLog::endl;
2343 for (size_t i = 0; i < fBCM.size(); i++) fBCM[i].get()->PrintValue();
2344 QwMessage << "HaloMonitor" << QwLog::endl;
2345 for (size_t i = 0; i < fHaloMonitor.size(); i++) fHaloMonitor[i].PrintValue();
2346 QwMessage << "BCM combo" << QwLog::endl;
2347 for (size_t i = 0; i < fBCMCombo.size(); i++) fBCMCombo[i].get()->PrintValue();
2348 QwMessage << "BPM combo" << QwLog::endl;
2349 for (size_t i = 0; i < fBPMCombo.size(); i++) fBPMCombo[i].get()->PrintValue();
2350 QwMessage << "Energy " << QwLog::endl;
2351 for (size_t i = 0; i < fECalculator.size(); i++) fECalculator[i].PrintValue();
2352
2353}
void PrintValue() const override
Print values of all channels.

References QwLog::endl(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, VQwSubsystem::GetName(), PrintValue(), and QwMessage.

Referenced by PrintValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessConfigurationBuffer()

Int_t QwBeamLine::ProcessConfigurationBuffer ( const ROCID_t roc_id,
const BankID_t bank_id,
UInt_t * buffer,
UInt_t num_words )
overridevirtual

Handle configuration banks if present. Placeholder for future use.

Implements VQwSubsystem.

Definition at line 1662 of file QwBeamLine.cc.

1663{
1664
1665 return 0;
1666}

◆ ProcessEvBuffer()

Int_t QwBeamLine::ProcessEvBuffer ( const ROCID_t roc_id,
const BankID_t bank_id,
UInt_t * buffer,
UInt_t num_words )
overridevirtual

Route raw ROC/bank buffer data to the correct devices and subelements.

Route a raw ROC/bank buffer to the correct devices and subelements.

Returns
0 on success.
Parameters
roc_idReadOut Controller identifier.
bank_idData bank identifier within the ROC.
bufferPointer to raw data buffer from DAQ.
num_wordsNumber of 32-bit words in the buffer.
Returns
0 on success.

This is a critical event processing function (~130 lines) that routes raw data from the data acquisition system to the appropriate beam line devices. It:

  • Maps ROC/bank combinations to internal subbank indices using GetSubbankIndex()
  • Handles data alignment by skipping padding words (0xf0f0f0f0) at buffer start
  • Iterates through all registered beam detector IDs to find matching devices
  • Routes data to device-specific ProcessEvBuffer() methods based on device type:
    • kQwBPMStripline: 4-channel stripline beam position monitors
    • kQwQPD: Quad photodiode detectors
    • kQwLinearArray: Linear diode arrays
    • kQwBPMCavity: Cavity-type beam position monitors
    • kQwBCM: Beam current monitors (various ADC/scaler types)
    • kQwClock: Timing reference channels

Each device receives a pointer to its specific data section within the buffer, calculated using the device's fWordInSubbank offset. The remaining word count is passed to prevent buffer overruns during device-specific decoding.

Buffer Layout Handling:

  • Accounts for variable-length device data (e.g., 6 words for VQWK, 1 for scalers)
  • Manages subelement indexing for multi-channel devices
  • Handles both integrating ADCs and scaler-based measurements

Error Conditions:

  • Invalid ROC/bank combinations are silently ignored (index < 0)
  • Empty buffers (num_words == 0) are skipped
  • Buffer alignment issues are detected and corrected automatically
Warning
This function must be called after LoadChannelMap() to ensure proper device registration and buffer offset calculations.

Implements VQwSubsystem.

Definition at line 1165 of file QwBeamLine.cc.

1166{
1167 Bool_t lkDEBUG=kFALSE;
1168
1169 Int_t index = GetSubbankIndex(roc_id,bank_id);
1170 if (index>=0 && num_words>0){
1171 // We want to process this ROC. Begin looping through the data.
1172 if (lkDEBUG)
1173 std::cout << "QwBeamLine::ProcessEvBuffer: "
1174 << "Begin processing ROC" << roc_id
1175 << " and subbank "<<bank_id
1176 << " number of words="<<num_words<<std::endl;
1177 if (buffer[0]==0xf0f0f0f0 && num_words%2==1){
1178 buffer++;
1179 if (lkDEBUG)
1180 std::cout << "QwBeamLine::ProcessEvBuffer: "
1181 << "Skipped padding word 0xf0f0f0f0 at beginning of buffer."
1182 << std::endl;
1183 }
1184
1185 for(size_t i=0;i<fBeamDetectorID.size();i++)
1186 {
1187 if(fBeamDetectorID[i].fSubbankIndex==index)
1188 {
1189
1190 if(fBeamDetectorID[i].fTypeID==kQwBPMStripline)
1191 {
1192 if (lkDEBUG)
1193 {
1194 std::cout<<"found stripline data for "<<fBeamDetectorID[i].fdetectorname<<std::endl;
1195 std::cout<<"word left to read in this buffer:"<<num_words-fBeamDetectorID[i].fWordInSubbank<<std::endl;
1196 }
1197 fStripline[fBeamDetectorID[i].fIndex].get()->
1198 ProcessEvBuffer(&(buffer[fBeamDetectorID[i].fWordInSubbank]),
1199 num_words-fBeamDetectorID[i].fWordInSubbank,
1200 fBeamDetectorID[i].fSubelement);
1201 }
1202
1203 if(fBeamDetectorID[i].fTypeID==kQwQPD)
1204 {
1205 if (lkDEBUG)
1206 {
1207 std::cout<<"found qpd data for "<<fBeamDetectorID[i].fdetectorname<<std::endl;
1208 std::cout<<"word left to read in this buffer:"<<num_words-fBeamDetectorID[i].fWordInSubbank<<std::endl;
1209 }
1210 fQPD[fBeamDetectorID[i].fIndex].
1211 ProcessEvBuffer(&(buffer[fBeamDetectorID[i].fWordInSubbank]),
1212 num_words-fBeamDetectorID[i].fWordInSubbank,
1213 fBeamDetectorID[i].fSubelement);
1214 }
1215
1216 if(fBeamDetectorID[i].fTypeID==kQwLinearArray)
1217 {
1218 if (lkDEBUG)
1219 {
1220 std::cout<<"found linear array data for "<<fBeamDetectorID[i].fdetectorname<<fBeamDetectorID[i].fIndex<<std::endl;
1221 std::cout<<"word left to read in this buffer:"<<num_words-fBeamDetectorID[i].fWordInSubbank<<std::endl;
1222 }
1223 fLinearArray[fBeamDetectorID[i].fIndex].
1224 ProcessEvBuffer(&(buffer[fBeamDetectorID[i].fWordInSubbank]),
1225 num_words-fBeamDetectorID[i].fWordInSubbank,
1226 fBeamDetectorID[i].fSubelement);
1227
1228 }
1229
1230 if(fBeamDetectorID[i].fTypeID==kQwBPMCavity)
1231 {
1232 if (lkDEBUG)
1233 {
1234 std::cout<<"found stripline data for "<<fBeamDetectorID[i].fdetectorname<<std::endl;
1235 std::cout<<"word left to read in this buffer:"<<num_words-fBeamDetectorID[i].fWordInSubbank<<std::endl;
1236 }
1237 fCavity[fBeamDetectorID[i].fIndex].
1238 ProcessEvBuffer(&(buffer[fBeamDetectorID[i].fWordInSubbank]),
1239 num_words-fBeamDetectorID[i].fWordInSubbank,
1240 fBeamDetectorID[i].fSubelement);
1241 }
1242
1243 if(fBeamDetectorID[i].fTypeID==kQwBCM)
1244 {
1245 if (lkDEBUG)
1246 {
1247 std::cout<<"found bcm data for "<<fBeamDetectorID[i].fdetectorname<<std::endl;
1248 std::cout<<"word left to read in this buffer:"<<num_words-fBeamDetectorID[i].fWordInSubbank<<std::endl;
1249 }
1250 fBCM[fBeamDetectorID[i].fIndex].get()->
1251 ProcessEvBuffer(&(buffer[fBeamDetectorID[i].fWordInSubbank]),
1252 num_words-fBeamDetectorID[i].fWordInSubbank);
1253 }
1254
1255 if(fBeamDetectorID[i].fTypeID==kQwClock)
1256 {
1257 if (lkDEBUG)
1258 {
1259 std::cout<<"found clock data for "<<fBeamDetectorID[i].fdetectorname<<std::endl;
1260 std::cout<<"word left to read in this buffer:"<<num_words-fBeamDetectorID[i].fWordInSubbank<<std::endl;
1261 }
1262 fClock[fBeamDetectorID[i].fIndex].get()->
1263 ProcessEvBuffer(&(buffer[fBeamDetectorID[i].fWordInSubbank]),
1264 num_words-fBeamDetectorID[i].fWordInSubbank);
1265 }
1266
1267 if(fBeamDetectorID[i].fTypeID==kQwHaloMonitor)
1268 {
1269 if (lkDEBUG)
1270 {
1271 std::cout<<"found halo monitor data for "<<fBeamDetectorID[i].fdetectorname<<std::endl;
1272 std::cout<<"word left to read in this buffer:"<<num_words-fBeamDetectorID[i].fWordInSubbank<<std::endl;
1273 }
1274 fHaloMonitor[fBeamDetectorID[i].fIndex].
1275 ProcessEvBuffer(&(buffer[fBeamDetectorID[i].fWordInSubbank]),
1276 num_words-fBeamDetectorID[i].fWordInSubbank);
1277 }
1278
1279 }
1280 }
1281 }
1282
1283 return 0;
1284}
Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
Route raw ROC/bank buffer data to the correct devices and subelements.

References fBCM, fBeamDetectorID, fCavity, fClock, fHaloMonitor, fLinearArray, fQPD, fStripline, VQwSubsystem::GetSubbankIndex(), kQwBCM, kQwBPMCavity, kQwBPMStripline, kQwClock, kQwHaloMonitor, kQwLinearArray, kQwQPD, and ProcessEvBuffer().

Referenced by ProcessEvBuffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEvent()

void QwBeamLine::ProcessEvent ( )
overridevirtual

Process one physics event: clocks first, then all devices.

Implements VQwSubsystem.

Definition at line 1615 of file QwBeamLine.cc.

1616{
1617 // Make sure this one comes first! The clocks are needed by
1618 // other elements.
1619 for(size_t i=0;i<fClock.size();i++)
1620 fClock[i].get()->ProcessEvent();
1621
1622 for(size_t i=0;i<fStripline.size();i++){
1623 fStripline[i].get()->ProcessEvent();
1624 // fStripline[i].get()->PrintInfo();
1625 }
1626 for(size_t i=0;i<fCavity.size();i++)
1627 fCavity[i].ProcessEvent();
1628
1629 for(size_t i=0;i<fBCM.size();i++){
1630 fBCM[i].get()->ProcessEvent();
1631 // fBCM[i].get()->PrintInfo();
1632 }
1633 for(size_t i=0;i<fQPD.size();i++)
1634 fQPD[i].ProcessEvent();
1635
1636 for(size_t i=0;i<fLinearArray.size();i++)
1638
1639 for(size_t i=0;i<fHaloMonitor.size();i++){
1640 fHaloMonitor[i].ProcessEvent();
1641 }
1642
1643 for(size_t i=0;i<fBCMCombo.size();i++){
1644 fBCMCombo[i].get()->ProcessEvent();
1645 // fBCMCombo[i].get()->PrintInfo();
1646 }
1647 for(size_t i=0;i<fBPMCombo.size();i++){
1648 fBPMCombo[i].get()->ProcessEvent();
1649 // fBPMCombo[i].get()->PrintInfo();
1650 }
1651 for(size_t i=0;i<fECalculator.size();i++){
1652 fECalculator[i].ProcessEvent();
1653 }
1654 return;
1655}
void ProcessEvent() override

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, and ProcessEvent().

Referenced by ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessOptions()

void QwBeamLine::ProcessOptions ( QwOptions & options)
overridevirtual

Parse and handle beamline-specific command-line options.

Reimplemented from VQwSubsystem.

Definition at line 40 of file QwBeamLine.cc.

40 {
41 //Handle command line options
42}

◆ PublishByRequest()

Bool_t QwBeamLine::PublishByRequest ( TString device_name)
overridevirtual

Publish a device channel on-demand by inferred property suffix.

Implements MQwPublishable_child< QwSubsystemArray, VQwSubsystem >.

Definition at line 1722 of file QwBeamLine.cc.

1723{
1724 Bool_t status = kFALSE;
1725 const VQwHardwareChannel* tmp_channel = 0;
1726
1727 std::vector<TString> publishinfo(4,TString(""));
1728 publishinfo.at(0) = device_name;
1729
1730 EQwBeamInstrumentType type_id;
1731 Int_t index=-1;
1732
1733 TString name = device_name;
1734 TString device_prop = "value";
1735 if (device_name.EndsWith("WS")){
1736 name = device_name(0,device_name.Length()-2);
1737 device_prop = "ef";
1738 } else if (device_name.EndsWith("Q")){
1739 name = device_name(0,device_name.Length()-1);
1740 device_prop = "ef";
1741 } else if (device_name.EndsWith("XSlope")){
1742 name = device_name(0,device_name.Length()-6);
1743 device_prop = "xp";
1744 } else if (device_name.EndsWith("YSlope")){
1745 name = device_name(0,device_name.Length()-6);
1746 device_prop = "yp";
1747 } else if (device_name.EndsWith("X")){
1748 name = device_name(0,device_name.Length()-1);
1749 device_prop = "x";
1750 } else if (device_name.EndsWith("Y")){
1751 name = device_name(0,device_name.Length()-1);
1752 device_prop = "y";
1753 }
1754
1755 for(size_t i=0;i<fBeamDetectorID.size();i++) {
1756 if(fBeamDetectorID[i].fdetectorname==name
1757 || fBeamDetectorID[i].fdetectorname==device_name){
1758 index = fBeamDetectorID[i].fIndex;
1759 type_id = fBeamDetectorID[i].fTypeID;
1760
1761 publishinfo.at(1) = GetQwBeamInstrumentTypeName(type_id);
1762 publishinfo.at(2) = fBeamDetectorID[i].fdetectorname;
1763 publishinfo.at(3) = device_prop;
1764 break;
1765 }
1766 }
1767
1768 if (index != -1){
1769 tmp_channel = GetChannel(type_id,index,publishinfo.at(3));
1770 fPublishList.push_back(publishinfo);
1771 status = PublishInternalValue(publishinfo.at(0), "published-by-request",
1772 tmp_channel);
1773 }
1774
1775 return status;
1776}
EQwBeamInstrumentType
Definition QwTypes.h:143
Bool_t PublishInternalValue(const TString name, const TString desc, const VQwHardwareChannel *element) const
const VQwHardwareChannel * GetChannel(EQwBeamInstrumentType TypeID, Int_t index, TString device_prop) const

References fBeamDetectorID, VQwSubsystem::fPublishList, GetChannel(), GetQwBeamInstrumentTypeName(), and MQwPublishable_child< QwSubsystemArray, VQwSubsystem >::PublishInternalValue().

+ Here is the call graph for this function:

◆ PublishInternalValues()

Bool_t QwBeamLine::PublishInternalValues ( ) const
overridevirtual

Publish selected device channels according to the map file.

Implements MQwPublishable_child< QwSubsystemArray, VQwSubsystem >.

Definition at line 1670 of file QwBeamLine.cc.

1671{
1672 // Publish variables
1673 Bool_t status = kTRUE;
1674
1675 // Publish variables through map file
1676 // This should work with bcm, bpmstripline, bpmcavity, combo bpm and combo bcm
1677 for (size_t pp = 0; pp < fPublishList.size(); pp++) {
1678 TString publish_name = fPublishList.at(pp).at(0);
1679 TString device_type = fPublishList.at(pp).at(1);
1680 TString device_name = fPublishList.at(pp).at(2);
1681 TString device_prop = fPublishList.at(pp).at(3);
1682 device_type.ToLower();
1683 device_prop.ToLower();
1684
1685 const VQwHardwareChannel* tmp_channel = 0;
1686
1687 EQwBeamInstrumentType type_id;
1688 if (device_type == "combobpm")
1689 type_id = kQwCombinedBPM;
1690 else if (device_type == "combobcm")
1691 type_id = kQwCombinedBCM;
1692 else if (device_type == "comboenergy")
1693 type_id = kQwEnergyCalculator;
1694 else if (device_type == "scaler")
1695 type_id = kQwHaloMonitor;
1696 else
1697 type_id = GetQwBeamInstrumentType(device_type);
1698
1699 Int_t index = GetDetectorIndex(type_id,device_name);
1700
1701 if (type_id != kQwUnknownDeviceType
1702 && index != -1){
1703 tmp_channel = GetChannel(type_id,index,device_prop);
1704 } else
1705 QwError << "QwBeamLine::PublishInternalValues() error "<< QwLog::endl;
1706
1707 if (tmp_channel == NULL) {
1708 QwError << "QwBeamLine::PublishInternalValues(): " << publish_name << " not found" << QwLog::endl;
1709 status = kFALSE;
1710 } else {
1711 QwDebug << "QwBeamLine::PublishInternalValues(): " << publish_name << " found" << QwLog::endl;
1712
1713 status = PublishInternalValue(publish_name, "published-value", tmp_channel);
1714 }
1715 }
1716
1717 return status;
1718}

References QwLog::endl(), VQwSubsystem::fPublishList, GetChannel(), GetDetectorIndex(), GetQwBeamInstrumentType(), kQwCombinedBCM, kQwCombinedBPM, kQwEnergyCalculator, kQwHaloMonitor, kQwUnknownDeviceType, MQwPublishable_child< QwSubsystemArray, VQwSubsystem >::PublishInternalValue(), QwDebug, and QwError.

+ Here is the call graph for this function:

◆ RandomizeEventData()

void QwBeamLine::RandomizeEventData ( int helicity = 0,
double time = 0.0 )
overridevirtual

Randomize event data for all managed devices for mock runs.

Reimplemented from VQwSubsystem.

Definition at line 999 of file QwBeamLine.cc.

1000{
1001 // Randomize all QwBPMStripline buffers
1002 for (size_t i = 0; i < fStripline.size(); i++)
1003 {
1004 fStripline[i].get()->RandomizeEventData(helicity, time);
1005 // fStripline[i].get()->PrintInfo();
1006 }
1007
1008 for (size_t i = 0; i < fCavity.size(); i++)
1009 fCavity[i].RandomizeEventData(helicity, time);
1010
1011 // Randomize all QwBCM buffers
1012 for (size_t i = 0; i < fBCM.size(); i++)
1013 {
1014 fBCM[i].get()->RandomizeEventData(helicity, time);
1015 // fBCM[i].get()->PrintInfo();
1016 }
1017
1018 // Randomize all QwHaloMonitor buffers
1019 //for (size_t i = 0; i < fHaloMonitor.size(); i++)
1020 //fHaloMonitor[i].RandomizeEventData(helicity, time);
1021
1022//-------------------------------------------------------------------------------------------
1023 for(size_t i=0;i<fBCMCombo.size();i++){
1024 fBCMCombo[i].get()->RandomizeEventData(helicity, time);
1025 for (size_t j=0; j<fBCMCombo[i].get()->GetNumberOfElements(); j++){
1026 VQwBCM * bcm = GetBCM(fBCMCombo[i].get()->GetSubElementName(j));
1027 if (bcm){
1028 fBCMCombo[i].get()->GetProjectedCharge(bcm);
1029 }
1030 }
1031 }
1032//-------------------------------------------------------------------------------------------
1033 for (size_t i=0; i<fBPMCombo.size(); i++){
1034 fBPMCombo[i].get()->RandomizeEventData(helicity, time);
1035 //fBPMCombo[i].get()->PrintValue();
1036 for (size_t j=0; j<fBPMCombo[i].get()->GetNumberOfElements(); j++){
1037 VQwBPM * bpm = GetBPMStripline(fBPMCombo[i].get()->GetSubElementName(j));
1038 if (bpm){
1039 fBPMCombo[i].get()->GetProjectedPosition(bpm);
1040// print the bpm device name, and get the x and y and z? values and print them
1041// std::cout << "bpm " << bpm->GetElementName() << std::endl;
1042// std::cout << "xpos= " << bpm->GetPosition(VQwBPM::kXAxis) << std::endl;
1043// std::cout << "ypos= " << bpm->GetPosition(VQwBPM::kYAxis) << std::endl;
1044// std::cout << "zpos= " << bpm->GetPosition(VQwBPM::kZAxsi) << std::endl;
1045// bpm->PrintInfo();
1046 // Call the new function in stripline class to fill all internal variables from the fAbsPos for the bpm object
1047 }
1048 }
1049 }
1050//-------------------------------------------------------------------------------------------
1051 for (size_t i=0;i<fECalculator.size();i++)
1052 {
1053 fECalculator[i].RandomizeEventData(helicity, time);
1054 //fECalculator[i].PrintValue();
1055 for (size_t j=0; j<fECalculator[i].GetNumberOfElements(); j++)
1056 {
1057 // std::cout << "In loop over ec subelements; device name = " << fECalculator[i].GetSubElementName(j) << std::endl;
1058 VQwBPM * bpm = GetBPMStripline(fECalculator[i].GetSubElementName(j));
1059 if (bpm)
1060 {
1061 fECalculator[i].GetProjectedPosition(bpm);
1062 }
1063 }
1064 }
1065}
size_t GetNumberOfElements()
void RandomizeEventData(int helicity=0, double time=0.0) override

References fBCM, fBCMCombo, fBPMCombo, fCavity, fECalculator, fStripline, GetBCM(), GetBPMStripline(), GetNumberOfElements(), and RandomizeEventData().

Referenced by RandomizeEventData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Ratio()

void QwBeamLine::Ratio ( VQwSubsystem * numer,
VQwSubsystem * denom )
overridevirtual

Implements VQwSubsystemParity.

Definition at line 2256 of file QwBeamLine.cc.

2257{
2258 if(Compare(numer)&&Compare(denom))
2259 {
2260 QwBeamLine* innumer = dynamic_cast<QwBeamLine*>(numer);
2261 QwBeamLine* indenom = dynamic_cast<QwBeamLine*>(denom);
2262
2263 for(size_t i=0;i<innumer->fClock.size();i++)
2264 this->fClock[i].get()->Ratio(*(innumer->fClock[i].get()),
2265 *(indenom->fClock[i].get()));
2266 for(size_t i=0;i<innumer->fStripline.size();i++)
2267 this->fStripline[i].get()->Ratio(*(innumer->fStripline[i].get()),
2268 *(indenom->fStripline[i].get()));
2269 for(size_t i=0;i<innumer->fCavity.size();i++)
2270 this->fCavity[i].Ratio(innumer->fCavity[i],indenom->fCavity[i]);
2271 for(size_t i=0;i<innumer->fQPD.size();i++)
2272 this->fQPD[i].Ratio(innumer->fQPD[i],indenom->fQPD[i]);
2273 for(size_t i=0;i<innumer->fLinearArray.size();i++)
2274 this->fLinearArray[i].Ratio(innumer->fLinearArray[i],indenom->fLinearArray[i]);
2275 for(size_t i=0;i<innumer->fBCM.size();i++)
2276 this->fBCM[i].get()->Ratio(*(innumer->fBCM[i].get()),
2277 *(indenom->fBCM[i].get()));
2278 for(size_t i=0;i<innumer->fHaloMonitor.size();i++)
2279 this->fHaloMonitor[i].Ratio(innumer->fHaloMonitor[i],indenom->fHaloMonitor[i]);
2280 for(size_t i=0;i<innumer->fBCMCombo.size();i++)
2281 this->fBCMCombo[i].get()->Ratio(*(innumer->fBCMCombo[i].get()),
2282 *(indenom->fBCMCombo[i]));
2283 for(size_t i=0;i<innumer->fBPMCombo.size();i++)
2284 this->fBPMCombo[i].get()->Ratio(*(innumer->fBPMCombo[i].get()),
2285 *(indenom->fBPMCombo[i].get()));
2286 for(size_t i=0;i<innumer->fECalculator.size();i++)
2287 this->fECalculator[i].Ratio(innumer->fECalculator[i],indenom->fECalculator[i]);
2288
2289 // For the combined bcm, maybe we might want to think about getting
2290 // the asymmetry using the asymmetries of the individual bcms with a
2291 // weight. But right now it is unclear if really need to have that
2292 // option.
2293 }
2294 return;
2295}
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom) override

References Compare(), fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, QwBeamLine(), Ratio(), and VQwSubsystem::VQwSubsystem().

Referenced by Ratio().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Scale()

void QwBeamLine::Scale ( Double_t factor)
overridevirtual

Implements VQwSubsystemParity.

Definition at line 2298 of file QwBeamLine.cc.

2299{
2300 for(size_t i=0;i<fClock.size();i++) fClock[i].get()->Scale(factor);
2301 for(size_t i=0;i<fStripline.size();i++) fStripline[i].get()->Scale(factor);
2302 for(size_t i=0;i<fCavity.size();i++) fCavity[i].Scale(factor);
2303 for(size_t i=0;i<fQPD.size();i++) fQPD[i].Scale(factor);
2304 for(size_t i=0;i<fLinearArray.size();i++) fLinearArray[i].Scale(factor);
2305 for(size_t i=0;i<fBCM.size();i++) fBCM[i].get()->Scale(factor);
2306 for(size_t i=0;i<fHaloMonitor.size();i++) fHaloMonitor[i].Scale(factor);
2307 for(size_t i=0;i<fBCMCombo.size();i++) fBCMCombo[i].get()->Scale(factor);
2308 for(size_t i=0;i<fBPMCombo.size();i++) fBPMCombo[i].get()->Scale(factor);
2309 for(size_t i=0;i<fECalculator.size();i++) fECalculator[i].Scale(factor);
2310 return;
2311}
void Scale(Double_t factor) override

References fBCM, fBCMCombo, fBPMCombo, fCavity, fClock, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, and Scale().

Referenced by Scale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetRandomEventAsymmetry()

void QwBeamLine::SetRandomEventAsymmetry ( Double_t asymmetry)

References VQwSubsystem::ConstructBranchAndVector(), VQwSubsystem::ConstructHistograms(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ UpdateErrorFlag() [1/2]

UInt_t QwBeamLine::UpdateErrorFlag ( )
overridevirtual

Update and return the OR of per-device event-cut error flags.

Reimplemented from VQwSubsystemParity.

Definition at line 1540 of file QwBeamLine.cc.

1540 {//return the error flag
1541 UInt_t ErrorFlag;
1542 UInt_t ErrorFlagtmp;
1543 ErrorFlag=0;
1544 for(size_t i=0;i<fBCM.size();i++){
1545 ErrorFlagtmp = fBCM[i].get()->UpdateErrorFlag();
1546 ErrorFlag |=ErrorFlagtmp;
1547 }
1548 for(size_t i=0;i<fStripline.size();i++){
1549 ErrorFlag |= fStripline[i].get()->UpdateErrorFlag();
1550 }
1551 for(size_t i=0;i<fQPD.size();i++){
1552 ErrorFlag |= fQPD[i].UpdateErrorFlag();
1553 }
1554 for(size_t i=0;i<fLinearArray.size();i++){
1555 ErrorFlag |= fLinearArray[i].UpdateErrorFlag();
1556 }
1557 for(size_t i=0;i<fCavity.size();i++){
1558 ErrorFlag |= fCavity[i].UpdateErrorFlag();
1559 }
1560 for(size_t i=0;i<fBCMCombo.size();i++){
1561 ErrorFlag |= fBCMCombo[i].get()->UpdateErrorFlag();
1562 }
1563 for(size_t i=0;i<fBPMCombo.size();i++){
1564 ErrorFlag |= fBPMCombo[i].get()->UpdateErrorFlag();
1565 }
1566 for(size_t i=0;i<fECalculator.size();i++){
1567 ErrorFlag |= fECalculator[i].UpdateErrorFlag();
1568 }
1569
1570 return ErrorFlag;
1571
1572}

References fBCM, fBCMCombo, fBPMCombo, fCavity, fECalculator, fLinearArray, fQPD, and fStripline.

◆ UpdateErrorFlag() [2/2]

void QwBeamLine::UpdateErrorFlag ( const VQwSubsystem * ev_error)
overridevirtual

Copy error flags from a reference beamline into this instance.

Implements VQwSubsystemParity.

Definition at line 1576 of file QwBeamLine.cc.

1576 {
1577 VQwSubsystem* tmp = const_cast<VQwSubsystem*>(ev_error);
1578 if(Compare(tmp))
1579 {
1580
1581 const QwBeamLine* input = dynamic_cast<const QwBeamLine*>(ev_error);
1582
1583 /*
1584 for(size_t i=0;i<input->fClock.size();i++)
1585 *(this->fClock[i].get())=*(input->fClock[i].get());
1586 */
1587 for(size_t i=0;i<input->fStripline.size();i++)
1588 (this->fStripline[i].get())->UpdateErrorFlag(input->fStripline[i].get());
1589 for(size_t i=0;i<input->fQPD.size();i++)
1590 (this->fQPD[i]).UpdateErrorFlag(&(input->fQPD[i]));
1591 for(size_t i=0;i<input->fLinearArray.size();i++)
1592 (this->fLinearArray[i]).UpdateErrorFlag(&(input->fLinearArray[i]));
1593 for(size_t i=0;i<input->fCavity.size();i++)
1594 (this->fCavity[i]).UpdateErrorFlag(&(input->fCavity[i]));
1595 for(size_t i=0;i<input->fBCM.size();i++){
1596 (this->fBCM[i].get())->UpdateErrorFlag(input->fBCM[i].get());
1597 }
1598 for(size_t i=0;i<input->fBCMCombo.size();i++)
1599 (this->fBCMCombo[i].get())->UpdateErrorFlag(input->fBCMCombo[i].get()); //*(this->fBCMCombo[i].get())=*(input->fBCMCombo[i].get());
1600 for(size_t i=0;i<input->fBPMCombo.size();i++)
1601 (this->fBPMCombo[i].get())->UpdateErrorFlag(input->fBPMCombo[i].get()); //=*(input->fBPMCombo[i].get());
1602 for(size_t i=0;i<input->fECalculator.size();i++)
1603 (this->fECalculator[i]).UpdateErrorFlag(&(input->fECalculator[i]));
1604 for(size_t i=0;i<input->fHaloMonitor.size();i++)
1605 (this->fHaloMonitor[i]).UpdateErrorFlag(&(input->fHaloMonitor[i]));
1606
1607
1608
1609 }
1610}

References Compare(), fBCM, fBCMCombo, fBPMCombo, fCavity, fECalculator, fHaloMonitor, fLinearArray, fQPD, fStripline, QwBeamLine(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ WritePromptSummary()

void QwBeamLine::WritePromptSummary ( QwPromptSummary * ps,
TString type )
overridevirtual

Reimplemented from VQwSubsystemParity.

Definition at line 3223 of file QwBeamLine.cc.

3224{
3225 Bool_t local_print_flag = false;
3226 Bool_t local_add_element= type.Contains("yield");
3227
3228
3229
3230 if(local_print_flag) {
3231 printf("---------------------------------------------------------------\n");
3232 printf("QwBeamLine::WritePromptSummary() Type : %12s\n", type.Data());
3233 printf("---------------------------------------------------------------\n");
3234 }
3235
3236 const VQwHardwareChannel* tmp_channel = 0;
3237 TString element_name = "";
3238 Double_t element_value = 0.0;
3239 Double_t element_value_err = 0.0;
3240 Double_t element_value_width = 0.0;
3241
3242 PromptSummaryElement *local_ps_element = NULL;
3243 Bool_t local_add_these_elements= false;
3244
3245 // Add BCMs
3246 for (size_t i = 0; i < fBCM.size(); i++)
3247 {
3248 tmp_channel=GetChannel(kQwBCM, i,"");
3249 element_name = tmp_channel->GetElementName();
3250 element_value = 0.0;
3251 element_value_err = 0.0;
3252 element_value_width = 0.0;
3253
3254 local_add_these_elements = element_name.EqualTo("bcm_an_us")||element_name.EqualTo("bcm_an_ds")||element_name.EqualTo("bcm_an_ds3")|| (element_name.Contains("cav4") ); // Need to change this to add other BCMs in summary
3255
3256 if(local_add_these_elements && local_add_element){
3257 ps->AddElement(new PromptSummaryElement(element_name));
3258 }
3259
3260
3261 local_ps_element=ps->GetElementByName(element_name);
3262
3263
3264 if(local_ps_element) {
3265 element_value = tmp_channel->GetValue();
3266 element_value_err = tmp_channel->GetValueError();
3267 element_value_width = tmp_channel->GetValueWidth();
3268
3269 local_ps_element->Set(type, element_value, element_value_err, element_value_width);
3270 }
3271
3272 if( local_print_flag && local_ps_element) {
3273 printf("Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n",
3274 type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
3275 }
3276 }
3277
3278 // Add combined BCMs
3279 for (size_t i = 0; i < fBCMCombo.size(); i++) {
3280 tmp_channel = GetChannel(kQwCombinedBCM, i,"");
3281 // Need to change this to add other BCMs in summary
3282 static const TString kTargetBCMName = "bcm_target";
3283 local_add_these_elements = element_name.EqualTo(kTargetBCMName);
3284 element_value_err = 0.0;
3285 element_value_width = 0.0;
3286
3287 // Need to change this to add other BCMs in summary
3288 local_add_these_elements = element_name.EqualTo("bcm_target");
3289
3290 if(local_add_these_elements && local_add_element){
3291 ps->AddElement(new PromptSummaryElement(element_name));
3292 }
3293
3294
3295 local_ps_element=ps->GetElementByName(element_name);
3296
3297
3298 if(local_ps_element) {
3299 element_value = tmp_channel->GetValue();
3300 element_value_err = tmp_channel->GetValueError();
3301 element_value_width = tmp_channel->GetValueWidth();
3302
3303 local_ps_element->Set(type, element_value, element_value_err, element_value_width);
3304 }
3305
3306 if( local_print_flag && local_ps_element) {
3307 printf("Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n",
3308 type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
3309 }
3310 }
3311
3312 // Add BPM Cavity
3313 for (size_t i = 0; i < fCavity.size(); i++)
3314 {
3315 tmp_channel=GetChannel(kQwBPMCavity, i,"ef");
3316 element_name = tmp_channel->GetElementName();
3317 element_value = 0.0;
3318 element_value_err = 0.0;
3319 element_value_width = 0.0;
3320
3321 local_add_these_elements = (element_name.EqualTo("cav4bQ")||element_name.EqualTo("cav4cQ")|| element_name.EqualTo("cav4dQ") ); // Need to change this to add other cavities in summary
3322
3323 if(local_add_these_elements && local_add_element){
3324 ps->AddElement(new PromptSummaryElement(element_name));
3325 }
3326
3327
3328 local_ps_element=ps->GetElementByName(element_name);
3329
3330
3331 if(local_ps_element) {
3332 element_value = tmp_channel->GetValue();
3333 element_value_err = tmp_channel->GetValueError();
3334 element_value_width = tmp_channel->GetValueWidth();
3335
3336 local_ps_element->Set(type, element_value, element_value_err, element_value_width);
3337 }
3338
3339 if( local_print_flag && local_ps_element) {
3340 printf("Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n",
3341 type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
3342 }
3343 }
3344
3345//////
3346
3347
3348
3349 char property[2][6]={"x","y"};
3350
3351 local_ps_element=NULL;
3352 local_add_these_elements=false;
3353
3354 // Add BPM striplines
3355 for(size_t i=0; i< fStripline.size(); i++)
3356 {
3357 for (Int_t j=0;j<2;j++){
3358 tmp_channel= GetChannel(kQwBPMStripline, i,property[j]);
3359 element_name= tmp_channel->GetElementName();
3360 element_value = 0.0;
3361 element_value_err = 0.0;
3362 element_value_width = 0.0;
3363
3364 // List of BPM names to include in the summary (move to config if needed)
3365 static const std::vector<TString> kSummaryBPMNames = {
3366 "bpm4", "bpm18", "bpm14", "bpm12"
3367 };
3368 local_add_these_elements = false;
3369 for (const auto& bpm_name : kSummaryBPMNames) {
3370 if (element_name.Contains(bpm_name)) {
3371 local_add_these_elements = true;
3372 break;
3373 }
3374 }
3375
3376 if( local_add_these_elements && local_add_element){
3377 ps->AddElement(new PromptSummaryElement(element_name));
3378 }
3379
3380 local_ps_element=ps->GetElementByName(element_name);
3381
3382
3383
3384 if(local_ps_element) {
3385 element_value = tmp_channel->GetValue();
3386 element_value_err = tmp_channel->GetValueError();
3387 element_value_width = tmp_channel->GetValueWidth();
3388 local_ps_element->Set(type, element_value, element_value_err, element_value_width);
3389 }
3390
3391 if( local_print_flag && local_ps_element) {
3392 printf("Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n",
3393 type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
3394 }
3395
3396 }
3397 }
3398
3399 // Add combined BPM striplines
3400 for(size_t i=0; i< fBPMCombo.size(); i++)
3401 {
3402 for (Int_t j=0;j<2;j++){
3403 tmp_channel= GetChannel(kQwCombinedBPM, i, property[j]);
3404 element_name= tmp_channel->GetElementName();
3405 element_value = 0.0;
3406 element_value_err = 0.0;
3407 element_value_width = 0.0;
3408
3409 local_add_these_elements=element_name.Contains("bpm4")||element_name.Contains("bpm18")||element_name.Contains("bpm14")||element_name.Contains("bpm12"); //Need to change this to add other stripline BPMs in summary
3410
3411 if( local_add_these_elements && local_add_element){
3412 ps->AddElement(new PromptSummaryElement(element_name));
3413 }
3414
3415 local_ps_element=ps->GetElementByName(element_name);
3416
3417
3418
3419 if(local_ps_element) {
3420 element_value = tmp_channel->GetValue();
3421 element_value_err = tmp_channel->GetValueError();
3422 element_value_width = tmp_channel->GetValueWidth();
3423 local_ps_element->Set(type, element_value, element_value_err, element_value_width);
3424 }
3425
3426 if( local_print_flag && local_ps_element) {
3427 printf("Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n",
3428 type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
3429 }
3430
3431 }
3432 }
3433
3434};
void Set(TString type, const Double_t a, const Double_t a_err, const Double_t a_width)
void AddElement(PromptSummaryElement *in)
PromptSummaryElement * GetElementByName(TString name)
Double_t GetValueError() const
Double_t GetValueWidth() const
Double_t GetValue() const

References QwPromptSummary::AddElement(), fBCM, fBCMCombo, fBPMCombo, fCavity, fStripline, GetChannel(), QwPromptSummary::GetElementByName(), VQwDataElement::GetElementName(), VQwHardwareChannel::GetValue(), VQwHardwareChannel::GetValueError(), VQwHardwareChannel::GetValueWidth(), kQwBCM, kQwBPMCavity, kQwBPMStripline, kQwCombinedBCM, kQwCombinedBPM, and PromptSummaryElement::Set().

+ Here is the call graph for this function:

Field Documentation

◆ bDEBUG

const Bool_t QwBeamLine::bDEBUG =kFALSE
staticprivate

Definition at line 214 of file QwBeamLine.h.

Referenced by ApplySingleEventCuts().

◆ fBCM

◆ fBCMCombo

◆ fBeamDetectorID

std::vector<QwBeamDetectorID> QwBeamLine::fBeamDetectorID
protected

◆ fBPMCombo

◆ fCavity

◆ fClock

◆ fECalculator

◆ fHaloMonitor

◆ fLinearArray

◆ fQPD

◆ fQwBeamLineErrorCount

Int_t QwBeamLine::fQwBeamLineErrorCount
private

Definition at line 211 of file QwBeamLine.h.

Referenced by ApplySingleEventCuts(), and LoadEventCuts_Fin().

◆ fStripline


The documentation for this class was generated from the following files: