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
 
VQwSubsystem & operator= (VQwSubsystem *value) override
 Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value)
 
VQwSubsystem & operator+= (VQwSubsystem *value) override
 
VQwSubsystem & operator-= (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
 
VQwDataElement * GetElement (QwBeamDetectorID det_id)
 
VQwDataElement * GetElement (EQwBeamInstrumentType TypeID, TString name)
 
VQwDataElement * GetElement (EQwBeamInstrumentType TypeID, Int_t index)
 
const VQwDataElement * GetElement (EQwBeamInstrumentType TypeID, Int_t index) const
 
const VQwHardwareChannel * GetChannel (EQwBeamInstrumentType TypeID, Int_t index, TString device_prop) const
 
VQwBPM * GetBPMStripline (const TString name)
 
VQwBCM * GetBCM (const TString name)
 
VQwClock * GetClock (const TString name)
 
QwBPMCavity * GetBPMCavity (const TString name)
 
VQwBCM * GetCombinedBCM (const TString name)
 
VQwBPM * GetCombinedBPM (const TString name)
 
QwEnergyCalculator * GetEnergyCalculator (const TString name)
 
QwHaloMonitor * GetScalerChannel (const TString name)
 
const QwBPMCavity * GetBPMCavity (const TString name) const
 
const VQwBPM * GetBPMStripline (const TString name) const
 
const VQwBCM * GetBCM (const TString name) const
 
const VQwClock * GetClock (const TString name) const
 
const VQwBCM * GetCombinedBCM (const TString name) const
 
const VQwBPM * GetCombinedBPM (const TString name) const
 
const QwEnergyCalculator * GetEnergyCalculator (const TString name) const
 
const QwHaloMonitor * GetScalerChannel (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
 
VQwSubsystem * GetSibling (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_t > GetROCIds () 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.
 
QwSubsystemArray * GetParent () const
 Get the parent container for this child object.
 
- Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwBeamLine >
 ~MQwCloneable () override
 Virtual destructor.
 
VQwSubsystem * Clone () 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.
 
MQwHistograms & operator= (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 VQwHardwareChannel * RequestExternalPointer (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_ptr > fStripline
 
std::vector< VQwBPM_ptr > fBPMCombo
 
std::vector< VQwBCM_ptr > fBCM
 
std::vector< VQwBCM_ptr > fBCMCombo
 
std::vector< VQwClock_ptr > fClock
 
std::vector< QwQPD > fQPD
 
std::vector< QwLinearDiodeArray_ptr > fLinearArray
 
std::vector< QwBPMCavity > fCavity
 
std::vector< QwHaloMonitor > fHaloMonitor
 
std::vector< QwEnergyCalculator > fECalculator
 
std::vector< QwBeamDetectorID > fBeamDetectorID
 
- 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_t > fROC_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_ptr > fHistograms
 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 VQwSubsystem * Create (const std::string &name)
 Object creation.
 
static QwBeamLine * Cast (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),
58 fCavity(source.fCavity),
62 { this->CopyTemplatedDataElements(&source); }
void CopyTemplatedDataElements(const VQwSubsystem *source)
std::vector< QwEnergyCalculator > fECalculator
Definition QwBeamLine.h:202
std::vector< QwBeamDetectorID > fBeamDetectorID
Definition QwBeamLine.h:203
std::vector< QwBPMCavity > fCavity
Definition QwBeamLine.h:198
std::vector< QwQPD > fQPD
Definition QwBeamLine.h:196
std::vector< QwHaloMonitor > fHaloMonitor
Definition QwBeamLine.h:199

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

+ Here is the call graph for this function:

◆ ~QwBeamLine()

QwBeamLine::~QwBeamLine ( )
inlineoverride

Virtual destructor.

Definition at line 64 of file QwBeamLine.h.

64{ };

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 2364 of file QwBeamLine.cc.

2365{
2366 if (Compare(value1)) {
2367 QwBeamLine* value = dynamic_cast<QwBeamLine*>(value1);
2368
2369 for (size_t i = 0; i < fClock.size(); i++)
2370 fClock[i].get()->AccumulateRunningSum(*(value->fClock[i].get()), count, ErrorMask);
2371 for (size_t i = 0; i < fStripline.size(); i++)
2372 fStripline[i].get()->AccumulateRunningSum(*(value->fStripline[i].get()), count, ErrorMask);
2373 for (size_t i = 0; i < fCavity.size(); i++)
2374 fCavity[i].AccumulateRunningSum(value->fCavity[i], count, ErrorMask);
2375 for (size_t i = 0; i < fBCM.size(); i++)
2376 fBCM[i].get()->AccumulateRunningSum(*(value->fBCM[i].get()), count, ErrorMask);
2377 for (size_t i = 0; i < fBCMCombo.size(); i++)
2378 fBCMCombo[i].get()->AccumulateRunningSum(*(value->fBCMCombo[i].get()), count, ErrorMask);
2379 for (size_t i = 0; i < fBPMCombo.size(); i++)
2380 fBPMCombo[i].get()->AccumulateRunningSum(*(value->fBPMCombo[i].get()), count, ErrorMask);
2381 for (size_t i = 0; i < fECalculator.size(); i++)
2382 fECalculator[i].AccumulateRunningSum(value->fECalculator[i], count, ErrorMask);
2383 for (size_t i = 0; i < fQPD.size(); i++)
2384 fQPD[i].AccumulateRunningSum(value->fQPD[i], count, ErrorMask);
2385 for (size_t i = 0; i < fLinearArray.size(); i++)
2386 fLinearArray[i].get()->AccumulateRunningSum(*(value->fLinearArray[i].get()), count, ErrorMask);
2387 for (size_t i = 0; i <fHaloMonitor.size(); i++)
2388 fHaloMonitor[i].AccumulateRunningSum(value->fHaloMonitor[i], count, ErrorMask);
2389
2390 }
2391}
std::vector< VQwBCM_ptr > fBCM
Definition QwBeamLine.h:191
Bool_t Compare(VQwSubsystem *source)
std::vector< VQwBPM_ptr > fStripline
Definition QwBeamLine.h:188
QwBeamLine()
Private default constructor (not implemented, will throw linker error on use)
std::vector< QwLinearDiodeArray_ptr > fLinearArray
Definition QwBeamLine.h:197
std::vector< VQwBPM_ptr > fBPMCombo
Definition QwBeamLine.h:189
std::vector< VQwBCM_ptr > fBCMCombo
Definition QwBeamLine.h:192
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:194

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 99 of file QwBeamLine.cc.

101{
102 TT element(GetName(), detector_id.fdetectorname);
103 elementlist.push_back(element);
104 detector_id.fIndex = elementlist.size()-1;
105 return detector_id.fIndex;
106}
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 if (detector_id.fTypeID == kQwLinearArray){
87 VQwBPM_ptr element(
89 detector_id.fdetectorname,
90 detector_id.fmoduletype) );
91 elementlist.push_back(element);
92 }
93 detector_id.fIndex = elementlist.size()-1;
94 return detector_id.fIndex;
95}
@ kQwBPMStripline
Definition QwTypes.h:145
@ kQwLinearArray
Definition QwTypes.h:147
std::shared_ptr< VQwBPM > VQwBPM_ptr
Definition VQwBPM.h:356
static VQwBPM * CreateLinearDiodeArray(TString subsystemname, TString name, TString type)
Definition VQwBPM.cc:312
static VQwBPM * CreateStripline(TString subsystemname, TString name, TString type)
A fast way of creating a BPM stripline of specified type.
Definition VQwBPM.cc:268

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

+ 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 1297 of file QwBeamLine.cc.

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

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 803 of file QwBeamLine.cc.

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

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 2322 of file QwBeamLine.cc.

2323{
2324 for (size_t i = 0; i < fClock.size(); i++) fClock[i].get()->CalculateRunningAverage();
2325 for (size_t i = 0; i < fStripline.size(); i++) fStripline[i].get()->CalculateRunningAverage();
2326 for (size_t i = 0; i < fCavity.size(); i++) fCavity[i].CalculateRunningAverage();
2327 for (size_t i = 0; i < fQPD.size(); i++) fQPD[i].CalculateRunningAverage();
2328 for (size_t i = 0; i < fLinearArray.size(); i++) fLinearArray[i].get()->CalculateRunningAverage();
2329 for (size_t i = 0; i < fBCM.size(); i++) fBCM[i].get()->CalculateRunningAverage();
2330 for (size_t i = 0; i < fHaloMonitor.size(); i++) fHaloMonitor[i].CalculateRunningAverage();
2331 for (size_t i = 0; i < fBCMCombo.size(); i++) fBCMCombo[i].get()->CalculateRunningAverage();
2332 for (size_t i = 0; i < fBPMCombo.size(); i++) fBPMCombo[i].get()->CalculateRunningAverage();
2333 for (size_t i = 0; i < fECalculator.size(); i++) fECalculator[i].CalculateRunningAverage();
2334}
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 1373 of file QwBeamLine.cc.

1373 {
1374 Bool_t burpstatus = kFALSE;
1375 VQwSubsystem* tmp = const_cast<VQwSubsystem *>(subsys);
1376 if(Compare(tmp)) {
1377 const QwBeamLine* input = dynamic_cast<const QwBeamLine*>(subsys);
1378 for(size_t i=0;i<input->fClock.size();i++){
1379 //QwError << "************* test Clock *****************" << QwLog::endl;
1380 burpstatus |= (this->fClock[i].get())->CheckForBurpFail(input->fClock[i].get());
1381 }
1382 for(size_t i=0;i<input->fStripline.size();i++){
1383 //QwError << "************* test stripline *****************" << QwLog::endl;
1384 burpstatus |= (this->fStripline[i].get())->CheckForBurpFail(input->fStripline[i].get());
1385 }
1386 for(size_t i=0;i<input->fQPD.size();i++){
1387 //QwError << "************* test QPD *****************" << QwLog::endl;
1388 burpstatus |= (this->fQPD[i]).CheckForBurpFail(&(input->fQPD[i]));
1389 }
1390 for(size_t i=0;i<input->fLinearArray.size();i++){
1391 //QwError << "************* test Lin *****************" << QwLog::endl;
1392 burpstatus |= (this->fLinearArray[i].get())->CheckForBurpFail(input->fLinearArray[i].get());
1393 }
1394 for(size_t i=0;i<input->fCavity.size();i++){
1395 //QwError << "************* test Cavity *****************" << QwLog::endl;
1396 burpstatus |= (this->fCavity[i]).CheckForBurpFail(&(input->fCavity[i]));
1397 }
1398 for(size_t i=0;i<input->fBCM.size();i++){
1399 //QwError << "************* test BCM *****************" << QwLog::endl;
1400 burpstatus |= (this->fBCM[i].get())->CheckForBurpFail(input->fBCM[i].get());
1401 }
1402 for(size_t i=0;i<input->fBCMCombo.size();i++){
1403 //QwError << "************* test BCMC *****************" << QwLog::endl;
1404 burpstatus |= (this->fBCMCombo[i].get())->CheckForBurpFail(input->fBCMCombo[i].get());
1405 }
1406 for(size_t i=0;i<input->fBPMCombo.size();i++){
1407 //QwError << "************* test BPMC *****************" << QwLog::endl;
1408 burpstatus |= (this->fBPMCombo[i].get())->CheckForBurpFail(input->fBPMCombo[i].get());
1409 }
1410 for(size_t i=0;i<input->fECalculator.size();i++){
1411 //QwError << "************* test ECalc *****************" << QwLog::endl;
1412 burpstatus |= (this->fECalculator[i]).CheckForBurpFail(&(input->fECalculator[i]));
1413 }
1414 for(size_t i=0;i<input->fHaloMonitor.size();i++){
1415 //QwError << "************* test Halo *****************" << QwLog::endl;
1416 burpstatus |= (this->fHaloMonitor[i]).CheckForBurpFail(&(input->fHaloMonitor[i]));
1417 }
1418 }
1419 return burpstatus;
1420}
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 1788 of file QwBeamLine.cc.

1789{
1790 for(size_t i=0;i<fClock.size();i++)
1791 fClock[i].get()->ClearEventData();
1792 for(size_t i=0;i<fStripline.size();i++)
1793 fStripline[i].get()->ClearEventData();
1794 for(size_t i=0;i<fCavity.size();i++)
1796 for(size_t i=0;i<fBCM.size();i++)
1797 fBCM[i]->ClearEventData();
1798 for(size_t i=0;i<fQPD.size();i++)
1799 fQPD[i].ClearEventData();
1800 for(size_t i=0;i<fLinearArray.size();i++)
1801 fLinearArray[i].get()->ClearEventData();
1802 for(size_t i=0;i<fHaloMonitor.size();i++)
1804
1805 for(size_t i=0;i<fBCMCombo.size();i++)
1806 fBCMCombo[i].get()->ClearEventData();
1807 for(size_t i=0;i<fBPMCombo.size();i++)
1808 fBPMCombo[i].get()->ClearEventData();
1809 for(size_t i=0;i<fECalculator.size();i++)
1811 return;
1812}
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 2422 of file QwBeamLine.cc.

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

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 2567 of file QwBeamLine.cc.

2568{
2569 for(size_t i = 0; i < fClock.size(); i++)
2570 fClock[i].get()->ConstructBranch(tree, prefix);
2571 for(size_t i = 0; i < fStripline.size(); i++)
2572 fStripline[i].get()->ConstructBranch(tree, prefix);
2573 for(size_t i = 0; i < fQPD.size(); i++)
2574 fQPD[i].ConstructBranch(tree, prefix);
2575 for(size_t i = 0; i < fLinearArray.size(); i++)
2576 fLinearArray[i].get()->ConstructBranch(tree, prefix);
2577 for(size_t i = 0; i < fBCM.size(); i++)
2578 fBCM[i].get()->ConstructBranch(tree, prefix);
2579 for(size_t i = 0; i <fCavity.size(); i++)
2580 fStripline[i].get()->ConstructBranch(tree, prefix);
2581 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2582 fHaloMonitor[i].ConstructBranch(tree, prefix);
2583 for(size_t i = 0; i <fBCMCombo.size();i++)
2584 fBCMCombo[i].get()->ConstructBranch(tree, prefix);
2585 for(size_t i = 0; i <fBPMCombo.size();i++)
2586 fBPMCombo[i].get()->ConstructBranch(tree, prefix);
2587 for(size_t i = 0; i <fECalculator.size();i++)
2588 fECalculator[i].ConstructBranch(tree, prefix);
2589
2590
2591 return;
2592}
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 2595 of file QwBeamLine.cc.

2596{
2597 TString tmp,varname,varvalue;
2598 tmp="QwBCM";
2599 std::unique_ptr<QwParameterFile> nextmodule;
2600 trim_file.RewindToFileStart();
2601
2602
2603 tmp="QwBPMStripline";
2604 trim_file.RewindToFileStart();
2605 if (trim_file.FileHasModuleHeader(tmp)){
2606 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2607 for(size_t i = 0; i < fStripline.size(); i++)
2608 fStripline[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2609
2610 }
2611
2612 tmp="QwQPD";
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 < fQPD.size(); i++)
2617 fQPD[i].ConstructBranch(tree, prefix,*nextmodule);
2618 }
2619
2620 tmp="QwLinearDiodeArray";
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 < fLinearArray.size(); i++)
2625 fLinearArray[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2626 }
2627
2628 tmp="QwBPMCavity";
2629 trim_file.RewindToFileStart();
2630 if (trim_file.FileHasModuleHeader(tmp)){
2631 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2632 for(size_t i = 0; i < fCavity.size(); i++)
2633 fCavity[i].ConstructBranch(tree, prefix,*nextmodule);
2634
2635 }
2636
2637 tmp="QwBCM";
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 < fBCM.size(); i++)
2642 fBCM[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2643 }
2644
2645 tmp="QwClock";
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 < fClock.size(); i++)
2650 fClock[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2651 }
2652
2653 tmp="QwHaloMonitor";
2654 trim_file.RewindToFileStart();
2655 if (trim_file.FileHasModuleHeader(tmp)){
2656 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2657 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2658 fHaloMonitor[i].ConstructBranch(tree, prefix,*nextmodule);
2659 }
2660
2661
2662 tmp="QwCombinedBCM";
2663 trim_file.RewindToFileStart();
2664 if (trim_file.FileHasModuleHeader(tmp)){
2665 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2666 for(size_t i = 0; i <fBCMCombo.size();i++)
2667 fBCMCombo[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2668 }
2669
2670
2671 tmp="QwCombinedBPM";
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 <fBPMCombo.size();i++)
2676 fBPMCombo[i].get()->ConstructBranch(tree, prefix,*nextmodule);
2677 }
2678
2679 tmp="QwEnergyCalculator";
2680 trim_file.RewindToFileStart();
2681 if (trim_file.FileHasModuleHeader(tmp)){
2682 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
2683 for(size_t i = 0; i <fECalculator.size();i++)
2684 fECalculator[i].ConstructBranch(tree, prefix,*nextmodule);
2685 }
2686
2687 return;
2688}
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 2539 of file QwBeamLine.cc.

2540{
2541
2542 for(size_t i = 0; i < fClock.size(); i++)
2543 fClock[i].get()->ConstructBranchAndVector(tree, prefix, values);
2544 for(size_t i = 0; i < fStripline.size(); i++)
2545 fStripline[i].get()->ConstructBranchAndVector(tree, prefix, values);
2546 for(size_t i = 0; i < fQPD.size(); i++)
2547 fQPD[i].ConstructBranchAndVector(tree, prefix, values);
2548 for(size_t i = 0; i < fLinearArray.size(); i++)
2549 fLinearArray[i].get()->ConstructBranchAndVector(tree, prefix, values);
2550 for(size_t i = 0; i < fCavity.size(); i++)
2551 fCavity[i].ConstructBranchAndVector(tree, prefix, values);
2552 for(size_t i = 0; i < fBCM.size(); i++)
2553 fBCM[i].get()->ConstructBranchAndVector(tree, prefix, values);
2554 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2555 fHaloMonitor[i].ConstructBranchAndVector(tree, prefix, values);
2556 for(size_t i = 0; i <fBCMCombo.size();i++)
2557 fBCMCombo[i].get()->ConstructBranchAndVector(tree, prefix, values);
2558 for(size_t i = 0; i <fBPMCombo.size();i++)
2559 fBPMCombo[i].get()->ConstructBranchAndVector(tree, prefix, values);
2560 for(size_t i = 0; i <fECalculator.size();i++)
2561 fECalculator[i].ConstructBranchAndVector(tree, prefix, values);
2562
2563 return;
2564}

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 2474 of file QwBeamLine.cc.

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

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 2810 of file QwBeamLine.cc.

2811{
2812 const QwBeamLine* input = dynamic_cast<const QwBeamLine*>(source);
2813
2814 this->fClock.reserve(input->fClock.size());
2815 for(size_t i=0;i<input->fClock.size();i++) {
2816 this->fClock.push_back(VQwClock_ptr(VQwClock::Create(*(input->fClock[i].get()))));
2817 }
2818
2819 this->fStripline.reserve(input->fStripline.size());
2820 for(size_t i=0;i<input->fStripline.size();i++) {
2821 this->fStripline.push_back(VQwBPM_ptr(
2822 VQwBPM::CreateStripline(*(input->fStripline[i].get()))));
2823 }
2824
2825 this->fBCM.reserve(input->fBCM.size());
2826 for(size_t i=0;i<input->fBCM.size();i++) {
2827 this->fBCM.push_back(VQwBCM_ptr(
2828 VQwBCM::Create(*(input->fBCM[i].get()))));
2829 }
2830
2831 this->fBCMCombo.reserve(input->fBCMCombo.size());
2832 for(size_t i=0;i<input->fBCMCombo.size();i++) {
2833 this->fBCMCombo.push_back(VQwBCM_ptr(
2835 input->fBCMCombo[i].get()))));
2836 }
2837
2838 this->fBPMCombo.reserve(input->fBPMCombo.size());
2839 for(size_t i=0;i<input->fBPMCombo.size();i++){
2840 this->fBPMCombo.push_back(VQwBPM_ptr(
2841 VQwBPM::CreateCombo(*(input->fBPMCombo[i].get()))));
2842 }
2843
2844 this->fLinearArray.reserve(input->fLinearArray.size());
2845 for(size_t i=0;i<input->fLinearArray.size();i++){
2846 this->fLinearArray.push_back(VQwBPM_ptr(
2847 VQwBPM::CreateLinearDiodeArray(*(input->fLinearArray[i].get()))));
2848 }
2849
2850}
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 name, TString type)
A fast way of creating a BPM stripline of specified type.
Definition VQwBPM.cc:344

References VQwBCM::Create(), VQwClock::Create(), VQwBCM::CreateCombo(), VQwBPM::CreateCombo(), VQwBPM::CreateLinearDiodeArray(), VQwBPM::CreateStripline(), fBCM, fBCMCombo, fBPMCombo, fClock, fLinearArray, 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 2394 of file QwBeamLine.cc.

2394 {
2395 if (Compare(value1)) {
2396 QwBeamLine* value = dynamic_cast<QwBeamLine*>(value1);
2397 for (size_t i = 0; i < fClock.size(); i++)
2398 fClock[i].get()->DeaccumulateRunningSum(*(value->fClock[i].get()), ErrorMask);
2399 for (size_t i = 0; i < fStripline.size(); i++)
2400 fStripline[i].get()->DeaccumulateRunningSum(*(value->fStripline[i].get()), ErrorMask);
2401 for (size_t i = 0; i < fCavity.size(); i++)
2402 fCavity[i].DeaccumulateRunningSum(value->fCavity[i], ErrorMask);
2403 for (size_t i = 0; i < fBCM.size(); i++)
2404 fBCM[i].get()->DeaccumulateRunningSum(*(value->fBCM[i].get()), ErrorMask);
2405 for (size_t i = 0; i < fBCMCombo.size(); i++)
2406 fBCMCombo[i].get()->DeaccumulateRunningSum(*(value->fBCMCombo[i].get()), ErrorMask);
2407 for (size_t i = 0; i < fBPMCombo.size(); i++)
2408 fBPMCombo[i].get()->DeaccumulateRunningSum(*(value->fBPMCombo[i].get()), ErrorMask);
2409 for (size_t i = 0; i < fQPD.size(); i++)
2410 fQPD[i].DeaccumulateRunningSum(value->fQPD[i], ErrorMask);
2411 for (size_t i = 0; i < fLinearArray.size(); i++)
2412 fLinearArray[i].get()->DeaccumulateRunningSum(*(value->fLinearArray[i].get()), ErrorMask);
2413 for (size_t i = 0; i < fECalculator.size(); i++)
2414 fECalculator[i].DeaccumulateRunningSum(value->fECalculator[i], ErrorMask);
2415 for (size_t i = 0; i <fHaloMonitor.size(); i++)
2416 fHaloMonitor[i].DeaccumulateRunningSum(value->fHaloMonitor[i], ErrorMask);
2417
2418 }
2419};
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 1080 of file QwBeamLine.cc.

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

2512{
2513 for(size_t i=0;i<fClock.size();i++)
2514 fClock[i].get()->FillHistograms();
2515 for(size_t i=0;i<fStripline.size();i++)
2516 fStripline[i].get()->FillHistograms();
2517 for(size_t i=0;i<fQPD.size();i++)
2518 fQPD[i].FillHistograms();
2519 for(size_t i=0;i<fLinearArray.size();i++)
2520 fLinearArray[i].get()->FillHistograms();
2521 for(size_t i=0;i<fCavity.size();i++)
2523 for(size_t i=0;i<fBCM.size();i++)
2524 fBCM[i].get()->FillHistograms();
2525 for(size_t i=0;i<fHaloMonitor.size();i++)
2527 for(size_t i=0;i<fBCMCombo.size();i++)
2528 fBCMCombo[i].get()->FillHistograms();
2529 for(size_t i=0;i<fBPMCombo.size();i++)
2530 fBPMCombo[i].get()->FillHistograms();
2531 for(size_t i=0;i<fECalculator.size();i++)
2533
2534 return;
2535}
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 2691 of file QwBeamLine.cc.

2692{
2693 for(size_t i = 0; i < fClock.size(); i++)
2694 fClock[i].get()->FillTreeVector(values);
2695 for(size_t i = 0; i < fStripline.size(); i++)
2696 fStripline[i].get()->FillTreeVector(values);
2697 for(size_t i = 0; i < fQPD.size(); i++)
2698 fQPD[i].FillTreeVector(values);
2699 for(size_t i = 0; i < fLinearArray.size(); i++)
2700 fLinearArray[i].get()->FillTreeVector(values);
2701 for(size_t i = 0; i < fCavity.size(); i++)
2702 fCavity[i].FillTreeVector(values);
2703 for(size_t i = 0; i < fBCM.size(); i++)
2704 fBCM[i].get()->FillTreeVector(values);
2705 for(size_t i = 0; i < fHaloMonitor.size(); i++)
2706 fHaloMonitor[i].FillTreeVector(values);
2707 for(size_t i = 0; i < fBCMCombo.size(); i++)
2708 fBCMCombo[i].get()->FillTreeVector(values);
2709 for(size_t i = 0; i < fBPMCombo.size(); i++)
2710 fBPMCombo[i].get()->FillTreeVector(values);
2711 for(size_t i = 0; i < fECalculator.size(); i++){
2712 fECalculator[i].FillTreeVector(values);}
2713 return;
2714}
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 1983 of file QwBeamLine.cc.

1984{
1985 //QwWarning << "QwBeamLine::GetBCM" << QwLog::endl;
1986 if (! fBCM.empty()) {
1987 for (std::vector<VQwBCM_ptr >::iterator bcm = fBCM.begin(); bcm != fBCM.end(); ++bcm) {
1988 if ((*bcm).get()->GetElementName() == name) {
1989 return (*bcm).get();
1990 }
1991 }
1992
1993 //QwWarning << "BCM Found" << QwLog::endl;
1994 return 0;
1995 }
1996 return 0;
1997}

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 2098 of file QwBeamLine.cc.

2099{
2100 return const_cast<QwBeamLine*>(this)->GetBCM(name);
2101}
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 1968 of file QwBeamLine.cc.

1969{
1970 if (! fCavity.empty()) {
1971 for (std::vector<QwBPMCavity>::iterator cavity = fCavity.begin(); cavity != fCavity.end(); ++cavity) {
1972 if (cavity->GetElementName() == name) {
1973 return &(*cavity);
1974 }
1975 }
1976 }
1977 return 0;
1978}

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 2092 of file QwBeamLine.cc.

2093{
2094 return const_cast<QwBeamLine*>(this)->GetBPMCavity(name);
2095}
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 1953 of file QwBeamLine.cc.

1954{
1955 if (! fStripline.empty()) {
1956 for (std::vector<VQwBPM_ptr >::iterator stripline = fStripline.begin(); stripline != fStripline.end(); ++stripline) {
1957 if ((*stripline).get()->GetElementName() == name) {
1958 return (*stripline).get();
1959 }
1960 }
1961 }
1962 return 0;
1963}

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 2072 of file QwBeamLine.cc.

2073{
2074 return const_cast<QwBeamLine*>(this)->GetBPMStripline(name);
2075}
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 1906 of file QwBeamLine.cc.

1907{
1908 const VQwHardwareChannel* tmp_channel = 0;
1909
1910 if (TypeID==kQwBPMStripline || TypeID==kQwBPMCavity || TypeID==kQwQPD){
1911 const VQwBPM* tmp_ptr = dynamic_cast<const VQwBPM*>(GetElement(TypeID, index));
1912 if (device_prop == "x")
1913 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kXAxis);
1914 else if (device_prop == "y")
1915 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kYAxis);
1916 else if (device_prop == "ef")
1917 tmp_channel = tmp_ptr->GetEffectiveCharge();
1918 } else if (TypeID==kQwCombinedBPM){
1919 const VQwBPM* tmp_ptr = dynamic_cast<const VQwBPM*>(GetElement(TypeID, index));
1920 if (device_prop == "x")
1921 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kXAxis);
1922 else if (device_prop == "y")
1923 tmp_channel = tmp_ptr->GetPosition(VQwBPM::kYAxis);
1924 else if (device_prop == "ef")
1925 tmp_channel = fBPMCombo.at(index)->GetEffectiveCharge();
1926 else if (device_prop == "xp")
1927 tmp_channel = fBPMCombo.at(index)->GetAngleX();
1928 else if (device_prop == "yp")
1929 tmp_channel = fBPMCombo.at(index)->GetAngleY();
1930 } else if (TypeID==kQwLinearArray){
1931 /// TODO: QwBeamLine::GetChannel
1932 /// How do we access linear array channel outputs?
1933 } else if (TypeID==kQwBCM || TypeID==kQwCombinedBCM){
1934 tmp_channel = dynamic_cast<const VQwBCM*>(GetElement(TypeID,index))->GetCharge();
1935 } else if (TypeID==kQwEnergyCalculator){
1936 tmp_channel = fECalculator.at(index).GetEnergy();
1937 } else if (TypeID==kQwHaloMonitor){
1938 tmp_channel = fHaloMonitor.at(index).GetScaler();
1939 } else if (TypeID==kQwClock){
1940 tmp_channel = fClock.at(index)->GetTime();
1941 } else {
1942 TString loc="QwBeamLine::GetChannel called by "
1943 +this->GetName()+" with invalid arguments: "
1944 +GetQwBeamInstrumentTypeName(TypeID)+" "
1945 +Form("%d",index);
1946 throw std::invalid_argument(loc.Data());
1947 }
1948 return tmp_channel;
1949}
@ kQwEnergyCalculator
Definition QwTypes.h:151
@ kQwHaloMonitor
Definition QwTypes.h:152
@ kQwCombinedBPM
Definition QwTypes.h:150
@ 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 2002 of file QwBeamLine.cc.

2003{
2004 //QwWarning << "QwBeamLine::GetClock" << QwLog::endl;
2005 if (! fClock.empty()) {
2006 for (std::vector<VQwClock_ptr >::iterator clock = fClock.begin(); clock != fClock.end(); ++clock) {
2007 if ((*clock).get()->GetElementName() == name) {
2008 return (*clock).get();
2009 }
2010 }
2011
2012 //QwWarning << "Clock Found" << QwLog::endl;
2013 return 0;
2014 }
2015 return 0;
2016}

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 2104 of file QwBeamLine.cc.

2105{
2106 return const_cast<QwBeamLine*>(this)->GetClock(name);
2107}
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 2020 of file QwBeamLine.cc.

2021{
2022 //QwWarning << "QwBeamLine::GetCombinedBCM" << QwLog::endl;
2023 if (! fBCMCombo.empty()) {
2024
2025 for (std::vector<VQwBCM_ptr>::iterator cbcm = fBCMCombo.begin(); cbcm != fBCMCombo.end(); ++cbcm) {
2026 if ((*cbcm).get()->GetElementName() == name) {
2027 return (*cbcm).get();
2028 }
2029 }
2030
2031
2032 }
2033 return 0;
2034}

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 2110 of file QwBeamLine.cc.

2110 {
2111 return const_cast<QwBeamLine*>(this)->GetCombinedBCM(name);
2112}
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 2038 of file QwBeamLine.cc.

2039{
2040 //QwWarning << "QwBeamLine::GetCombinedBPM" << QwLog::endl;
2041 if (! fBPMCombo.empty()) {
2042
2043 for (std::vector<VQwBPM_ptr>::iterator cbpm = fBPMCombo.begin(); cbpm != fBPMCombo.end(); ++cbpm) {
2044 if ((*cbpm).get()->GetElementName() == name) {
2045 return (*cbpm).get();
2046 }
2047 }
2048
2049
2050 }
2051 return 0;
2052}

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 2115 of file QwBeamLine.cc.

2115 {
2116 return const_cast<QwBeamLine*>(this)->GetCombinedBPM(name);
2117}
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 1816 of file QwBeamLine.cc.

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

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 1853 of file QwBeamLine.cc.

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

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 1898 of file QwBeamLine.cc.

1899{
1900 return const_cast<QwBeamLine*>(this)->GetElement(TypeID,index);
1901}

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 1846 of file QwBeamLine.cc.

1847{
1848 Int_t index = GetDetectorIndex(TypeID,name);
1849 return GetElement(TypeID,index);
1850};
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 1840 of file QwBeamLine.cc.

1841{
1842 return GetElement(det_id.fTypeID, det_id.fIndex);
1843};

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 2056 of file QwBeamLine.cc.

2056 {
2057 if (! fECalculator.empty()) {
2058
2059 for (std::vector<QwEnergyCalculator>::iterator ecal = fECalculator.begin(); ecal != fECalculator.end(); ++ecal) {
2060 if (ecal->GetElementName() == name) {
2061 return &(*ecal);
2062 }
2063 }
2064
2065
2066 }
2067 return 0;
2068}

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 2120 of file QwBeamLine.cc.

2120 {
2121 return const_cast<QwBeamLine*>(this)->GetEnergyCalculator(name);
2122}
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 1511 of file QwBeamLine.cc.

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

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 2077 of file QwBeamLine.cc.

2077 {
2078 if (! fHaloMonitor.empty()) {
2079
2080 for (std::vector<QwHaloMonitor>::iterator halo = fHaloMonitor.begin(); halo != fHaloMonitor.end(); ++halo) {
2081 if (halo->GetElementName() == name) {
2082 return &(*halo);
2083 }
2084 }
2085
2086
2087 }
2088 return 0;
2089};

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 2125 of file QwBeamLine.cc.

2125 {
2126 return const_cast<QwBeamLine*>(this)->GetScalerChannel(name);
2127};
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 1475 of file QwBeamLine.cc.

1476{
1477 for(size_t i=0;i<fClock.size();i++){
1478 fClock[i].get()->IncrementErrorCounters();
1479 }
1480 for(size_t i=0;i<fBCM.size();i++){
1481 fBCM[i].get()->IncrementErrorCounters();
1482 }
1483 for(size_t i=0;i<fHaloMonitor.size();i++){
1484 fHaloMonitor[i].IncrementErrorCounters();
1485 }
1486 for(size_t i=0;i<fStripline.size();i++){
1487 fStripline[i].get()->IncrementErrorCounters();
1488 }
1489 for(size_t i=0;i<fQPD.size();i++){
1490 fQPD[i].IncrementErrorCounters();
1491 }
1492 for(size_t i=0;i<fLinearArray.size();i++){
1493 fLinearArray[i].get()->IncrementErrorCounters();
1494 }
1495 for(size_t i=0;i<fCavity.size();i++){
1496 fCavity[i].IncrementErrorCounters();
1497 }
1498 for(size_t i=0;i<fBCMCombo.size();i++){
1499 fBCMCombo[i].get()->IncrementErrorCounters();
1500 }
1501 for(size_t i=0;i<fBPMCombo.size();i++){
1502 fBPMCombo[i].get()->IncrementErrorCounters();
1503 }
1504 for(size_t i=0;i<fECalculator.size();i++){
1505 fECalculator[i].IncrementErrorCounters();
1506 }
1507}

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 118 of file QwBeamLine.cc.

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

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 534 of file QwBeamLine.cc.

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

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 73 of file QwBeamLine.h.

73{};

◆ 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 457 of file QwBeamLine.cc.

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

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

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 854 of file QwBeamLine.cc.

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

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 754 of file QwBeamLine.cc.

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

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

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 2220 of file QwBeamLine.cc.

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

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 2131 of file QwBeamLine.cc.

2132{
2133 // std::cout<<" here in QwBeamLine::operator= \n";
2134 if(Compare(value))
2135 {
2136
2138 QwBeamLine* input = dynamic_cast<QwBeamLine*>(value);
2139
2140 for(size_t i=0;i<input->fClock.size();i++)
2141 *(this->fClock[i].get())=*(input->fClock[i].get());
2142 for(size_t i=0;i<input->fStripline.size();i++)
2143 *(this->fStripline[i].get())=*(input->fStripline[i].get());
2144 for(size_t i=0;i<input->fQPD.size();i++)
2145 this->fQPD[i]=input->fQPD[i];
2146 for(size_t i=0;i<input->fLinearArray.size();i++)
2147 *(this->fLinearArray[i].get())=*(input->fLinearArray[i].get());
2148 for(size_t i=0;i<input->fCavity.size();i++)
2149 this->fCavity[i]=input->fCavity[i];
2150 for(size_t i=0;i<input->fBCM.size();i++)
2151 *(this->fBCM[i].get())=*(input->fBCM[i].get());
2152 for(size_t i=0;i<input->fHaloMonitor.size();i++)
2153 this->fHaloMonitor[i]=input->fHaloMonitor[i];
2154 for(size_t i=0;i<input->fBCMCombo.size();i++)
2155 *(this->fBCMCombo[i].get())=*(input->fBCMCombo[i].get());
2156 for(size_t i=0;i<input->fBPMCombo.size();i++)
2157 *(this->fBPMCombo[i].get())=*(input->fBPMCombo[i].get());
2158 for(size_t i=0;i<input->fECalculator.size();i++)
2159 this->fECalculator[i]=input->fECalculator[i];
2160
2161 if (input->fPublishList.size()>0){
2162 this->fPublishList.resize(input->fPublishList.size());
2163 for(size_t i=0;i<input->fPublishList.size();i++){
2164 this->fPublishList.at(i).resize(input->fPublishList.at(i).size());
2165 for(size_t j=0;j<input->fPublishList.at(i).size();j++){
2166 this->fPublishList.at(i).at(j)=input->fPublishList.at(i).at(j);
2167 }
2168 }
2169 }
2170
2171 }
2172 return *this;
2173}
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 2796 of file QwBeamLine.cc.

2797{
2798 for (size_t i=0;i<fBeamDetectorID.size();i++)
2799 {
2800 std::cout<<"============================="<<std::endl;
2801 std::cout<<" Detector ID="<<i<<std::endl;
2802 fBeamDetectorID[i].Print();
2803 }
2804 return;
2805}

References fBeamDetectorID.

◆ PrintErrorCounters()

void QwBeamLine::PrintErrorCounters ( ) const
overridevirtual

Print a beamline-wide summary of persistent error counters.

Implements VQwSubsystemParity.

Definition at line 1426 of file QwBeamLine.cc.

1426 {//inherited from the VQwSubsystemParity; this will display the error summary
1427
1428 QwMessage<<"*********QwBeamLine Error Summary****************"<<QwLog::endl;
1430
1431 for(size_t i=0;i<fClock.size();i++){
1432 fClock[i].get()->PrintErrorCounters();
1433 }
1434 printf("\n");
1435 for(size_t i=0;i<fBCM.size();i++){
1436 fBCM[i].get()->PrintErrorCounters();
1437 }
1438 printf("\n");
1439 for(size_t i=0;i<fHaloMonitor.size();i++){
1440 fHaloMonitor[i].PrintErrorCounters();
1441 }
1442 printf("\n");
1443 for(size_t i=0;i<fStripline.size();i++){
1444 fStripline[i].get()->PrintErrorCounters();
1445 printf("\n");
1446 }
1447 for(size_t i=0;i<fQPD.size();i++){
1448 fQPD[i].PrintErrorCounters();
1449 }
1450 printf("\n");
1451 for(size_t i=0;i<fLinearArray.size();i++){
1452 fLinearArray[i].get()->PrintErrorCounters();
1453 }
1454 printf("\n");
1455 for(size_t i=0;i<fCavity.size();i++){
1456 fCavity[i].PrintErrorCounters();
1457 }
1458 printf("\n");
1459 for(size_t i=0;i<fBCMCombo.size();i++){
1460 fBCMCombo[i].get()->PrintErrorCounters();
1461 }
1462 printf("\n");
1463 for(size_t i=0;i<fBPMCombo.size();i++){
1464 fBPMCombo[i].get()->PrintErrorCounters();
1465 }
1466 printf("\n");
1467 for(size_t i=0;i<fECalculator.size();i++){
1468 fECalculator[i].PrintErrorCounters();
1469 }
1471}
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 2773 of file QwBeamLine.cc.

2774{
2775 std::cout<<"Name of the subsystem ="<<fSystemName<<"\n";
2776 std::cout<<"there are "<<fClock.size()<<" clock \n";
2777 std::cout<<"there are "<<fStripline.size()<<" striplines \n";
2778 std::cout<<"there are "<<fQPD.size()<<" QPDs \n";
2779 std::cout<<"there are "<<fLinearArray.size()<<" LinearArrays \n";
2780 std::cout<<"there are "<<fCavity.size()<<" cavities \n";
2781 std::cout<<"there are "<<fBCM.size()<<" bcm \n";
2782 std::cout<<"there are "<<fHaloMonitor.size()<<" halomonitors \n";
2783 std::cout<<"there are "<<fBCMCombo.size()<<" combined bcms \n";
2784 std::cout<<"there are "<<fBPMCombo.size()<<" combined bpms \n";
2785 std::cout<<"there are "<<fECalculator.size()<<" energy calculators \n";
2786 std::cout<<" Printing Running AVG and other channel info for BCMs"<<std::endl;
2787 for(size_t i=0;i<fBCM.size();i++)
2788 fBCM[i].get()->PrintInfo();
2789 for(size_t i=0;i<fHaloMonitor.size();i++)
2791 return;
2792}
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 2337 of file QwBeamLine.cc.

2338{
2339 QwMessage << "=== QwBeamLine: " << GetName() << " ===" << QwLog::endl;
2340 QwMessage << "Clock" << QwLog::endl;
2341 for (size_t i = 0; i < fClock.size(); i++) fClock[i].get()->PrintValue();
2342 QwMessage << "BPM stripline" << QwLog::endl;
2343 for (size_t i = 0; i < fStripline.size(); i++) fStripline[i].get()->PrintValue();
2344 QwMessage << "QPD" << QwLog::endl;
2345 for (size_t i = 0; i < fQPD.size(); i++) fQPD[i].PrintValue();
2346 QwMessage << "LinearArray" << QwLog::endl;
2347 for (size_t i = 0; i < fLinearArray.size(); i++) fLinearArray[i].get()->PrintValue();
2348 QwMessage << "BPM cavity" << QwLog::endl;
2349 for (size_t i = 0; i < fCavity.size(); i++) fCavity[i].PrintValue();
2350 QwMessage << "BCM" << QwLog::endl;
2351 for (size_t i = 0; i < fBCM.size(); i++) fBCM[i].get()->PrintValue();
2352 QwMessage << "HaloMonitor" << QwLog::endl;
2353 for (size_t i = 0; i < fHaloMonitor.size(); i++) fHaloMonitor[i].PrintValue();
2354 QwMessage << "BCM combo" << QwLog::endl;
2355 for (size_t i = 0; i < fBCMCombo.size(); i++) fBCMCombo[i].get()->PrintValue();
2356 QwMessage << "BPM combo" << QwLog::endl;
2357 for (size_t i = 0; i < fBPMCombo.size(); i++) fBPMCombo[i].get()->PrintValue();
2358 QwMessage << "Energy " << QwLog::endl;
2359 for (size_t i = 0; i < fECalculator.size(); i++) fECalculator[i].PrintValue();
2360
2361}
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 1669 of file QwBeamLine.cc.

1670{
1671
1672 return 0;
1673}

◆ 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 1172 of file QwBeamLine.cc.

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

1623{
1624 // Make sure this one comes first! The clocks are needed by
1625 // other elements.
1626 for(size_t i=0;i<fClock.size();i++)
1627 fClock[i].get()->ProcessEvent();
1628
1629 for(size_t i=0;i<fStripline.size();i++){
1630 fStripline[i].get()->ProcessEvent();
1631 // fStripline[i].get()->PrintInfo();
1632 }
1633 for(size_t i=0;i<fCavity.size();i++)
1634 fCavity[i].ProcessEvent();
1635
1636 for(size_t i=0;i<fBCM.size();i++){
1637 fBCM[i].get()->ProcessEvent();
1638 // fBCM[i].get()->PrintInfo();
1639 }
1640 for(size_t i=0;i<fQPD.size();i++)
1641 fQPD[i].ProcessEvent();
1642
1643 for(size_t i=0;i<fLinearArray.size();i++)
1644 fLinearArray[i].get()->ProcessEvent();
1645
1646 for(size_t i=0;i<fHaloMonitor.size();i++){
1647 fHaloMonitor[i].ProcessEvent();
1648 }
1649
1650 for(size_t i=0;i<fBCMCombo.size();i++){
1651 fBCMCombo[i].get()->ProcessEvent();
1652 // fBCMCombo[i].get()->PrintInfo();
1653 }
1654 for(size_t i=0;i<fBPMCombo.size();i++){
1655 fBPMCombo[i].get()->ProcessEvent();
1656 // fBPMCombo[i].get()->PrintInfo();
1657 }
1658 for(size_t i=0;i<fECalculator.size();i++){
1659 fECalculator[i].ProcessEvent();
1660 }
1661 return;
1662}
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 1729 of file QwBeamLine.cc.

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

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

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 1006 of file QwBeamLine.cc.

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

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

2307{
2308 for(size_t i=0;i<fClock.size();i++) fClock[i].get()->Scale(factor);
2309 for(size_t i=0;i<fStripline.size();i++) fStripline[i].get()->Scale(factor);
2310 for(size_t i=0;i<fCavity.size();i++) fCavity[i].Scale(factor);
2311 for(size_t i=0;i<fQPD.size();i++) fQPD[i].Scale(factor);
2312 for(size_t i=0;i<fLinearArray.size();i++) fLinearArray[i].get()->Scale(factor);
2313 for(size_t i=0;i<fBCM.size();i++) fBCM[i].get()->Scale(factor);
2314 for(size_t i=0;i<fHaloMonitor.size();i++) fHaloMonitor[i].Scale(factor);
2315 for(size_t i=0;i<fBCMCombo.size();i++) fBCMCombo[i].get()->Scale(factor);
2316 for(size_t i=0;i<fBPMCombo.size();i++) fBPMCombo[i].get()->Scale(factor);
2317 for(size_t i=0;i<fECalculator.size();i++) fECalculator[i].Scale(factor);
2318 return;
2319}
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 1547 of file QwBeamLine.cc.

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

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 1583 of file QwBeamLine.cc.

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

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 3238 of file QwBeamLine.cc.

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

Referenced by ApplySingleEventCuts(), and LoadEventCuts_Fin().

◆ fStripline


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