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

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

#include <QwBeamLine.h>

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

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

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

Private Attributes

Int_t fQwBeamLineErrorCount
 

Static Private Attributes

static const Bool_t bDEBUG =kFALSE
 

Additional Inherited Members

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

Detailed Description

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

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

Definition at line 43 of file QwBeamLine.h.

Constructor & Destructor Documentation

◆ QwBeamLine() [1/3]

QwBeamLine::QwBeamLine ( )
private

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

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

+ Here is the caller graph for this function:

◆ QwBeamLine() [2/3]

QwBeamLine::QwBeamLine ( const TString & name)
inline

Constructor with name.

Definition at line 51 of file QwBeamLine.h.

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

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

+ Here is the call graph for this function:

◆ QwBeamLine() [3/3]

QwBeamLine::QwBeamLine ( const QwBeamLine & source)
inline

Copy constructor.

Definition at line 55 of file QwBeamLine.h.

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

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

+ Here is the call graph for this function:

◆ ~QwBeamLine()

QwBeamLine::~QwBeamLine ( )
inlineoverride

Virtual destructor.

Definition at line 65 of file QwBeamLine.h.

65{ };

Member Function Documentation

◆ AccumulateRunningSum()

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

Update the running sums for devices.

Implements VQwSubsystemParity.

Definition at line 2358 of file QwBeamLine.cc.

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

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

Referenced by AccumulateRunningSum().

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

◆ AddToElementList() [1/4]

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

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

Definition at line 95 of file QwBeamLine.cc.

97{
98 TT element(GetName(), detector_id.fdetectorname);
99 elementlist.push_back(element);
100 detector_id.fIndex = elementlist.size()-1;
101 return detector_id.fIndex;
102}
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 64 of file QwBeamLine.cc.

66{
67 if (detector_id.fTypeID == kQwBCM){
68 VQwBCM_ptr element(
70 detector_id.fdetectorname,
71 detector_id.fmoduletype) );
72 elementlist.push_back(element);
73 }
74 detector_id.fIndex = elementlist.size()-1;
75 return detector_id.fIndex;
76}
@ 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 79 of file QwBeamLine.cc.

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

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

+ Here is the call graph for this function:

◆ AddToElementList() [4/4]

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

Definition at line 49 of file QwBeamLine.cc.

51{
52 if (detector_id.fTypeID == kQwClock){
53 VQwClock_ptr element(
55 detector_id.fdetectorname,
56 detector_id.fmoduletype) );
57 elementlist.push_back(element);
58 }
59 detector_id.fIndex = elementlist.size()-1;
60 return detector_id.fIndex;
61}
@ 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 1293 of file QwBeamLine.cc.

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

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

◆ AssignGeometry()

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

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

Definition at line 799 of file QwBeamLine.cc.

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

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

Referenced by LoadGeometryDefinition().

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

◆ CalculateRunningAverage()

void QwBeamLine::CalculateRunningAverage ( )
overridevirtual

Calculate the average for all good events.

Implements VQwSubsystemParity.

Definition at line 2316 of file QwBeamLine.cc.

2317{
2318 for (size_t i = 0; i < fClock.size(); i++) fClock[i].get()->CalculateRunningAverage();
2319 for (size_t i = 0; i < fStripline.size(); i++) fStripline[i].get()->CalculateRunningAverage();
2320 for (size_t i = 0; i < fCavity.size(); i++) fCavity[i].CalculateRunningAverage();
2321 for (size_t i = 0; i < fQPD.size(); i++) fQPD[i].CalculateRunningAverage();
2322 for (size_t i = 0; i < fLinearArray.size(); i++) fLinearArray[i].CalculateRunningAverage();
2323 for (size_t i = 0; i < fBCM.size(); i++) fBCM[i].get()->CalculateRunningAverage();
2324 for (size_t i = 0; i < fHaloMonitor.size(); i++) fHaloMonitor[i].CalculateRunningAverage();
2325 for (size_t i = 0; i < fBCMCombo.size(); i++) fBCMCombo[i].get()->CalculateRunningAverage();
2326 for (size_t i = 0; i < fBPMCombo.size(); i++) fBPMCombo[i].get()->CalculateRunningAverage();
2327 for (size_t i = 0; i < fECalculator.size(); i++) fECalculator[i].CalculateRunningAverage();
2328}
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 1369 of file QwBeamLine.cc.

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

1785{
1786 for(size_t i=0;i<fClock.size();i++)
1787 fClock[i].get()->ClearEventData();
1788 for(size_t i=0;i<fStripline.size();i++)
1789 fStripline[i].get()->ClearEventData();
1790 for(size_t i=0;i<fCavity.size();i++)
1792 for(size_t i=0;i<fBCM.size();i++)
1793 fBCM[i]->ClearEventData();
1794 for(size_t i=0;i<fQPD.size();i++)
1795 fQPD[i].ClearEventData();
1796 for(size_t i=0;i<fLinearArray.size();i++)
1798 for(size_t i=0;i<fHaloMonitor.size();i++)
1800
1801 for(size_t i=0;i<fBCMCombo.size();i++)
1802 fBCMCombo[i].get()->ClearEventData();
1803 for(size_t i=0;i<fBPMCombo.size();i++)
1804 fBPMCombo[i].get()->ClearEventData();
1805 for(size_t i=0;i<fECalculator.size();i++)
1807 return;
1808}
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 2416 of file QwBeamLine.cc.

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

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

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

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

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

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

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

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

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

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

Referenced by QwBeamLine().

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

◆ DeaccumulateRunningSum()

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

remove one entry from the running sums for devices

Implements VQwSubsystemParity.

Definition at line 2388 of file QwBeamLine.cc.

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

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

2506{
2507 for(size_t i=0;i<fClock.size();i++)
2508 fClock[i].get()->FillHistograms();
2509 for(size_t i=0;i<fStripline.size();i++)
2510 fStripline[i].get()->FillHistograms();
2511 for(size_t i=0;i<fQPD.size();i++)
2512 fQPD[i].FillHistograms();
2513 for(size_t i=0;i<fLinearArray.size();i++)
2515 for(size_t i=0;i<fCavity.size();i++)
2517 for(size_t i=0;i<fBCM.size();i++)
2518 fBCM[i].get()->FillHistograms();
2519 for(size_t i=0;i<fHaloMonitor.size();i++)
2521 for(size_t i=0;i<fBCMCombo.size();i++)
2522 fBCMCombo[i].get()->FillHistograms();
2523 for(size_t i=0;i<fBPMCombo.size();i++)
2524 fBPMCombo[i].get()->FillHistograms();
2525 for(size_t i=0;i<fECalculator.size();i++)
2527
2528 return;
2529}
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 2685 of file QwBeamLine.cc.

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

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

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

2095{
2096 return const_cast<QwBeamLine*>(this)->GetBCM(name);
2097}
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 1964 of file QwBeamLine.cc.

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

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

2089{
2090 return const_cast<QwBeamLine*>(this)->GetBPMCavity(name);
2091}
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 1949 of file QwBeamLine.cc.

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

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

2069{
2070 return const_cast<QwBeamLine*>(this)->GetBPMStripline(name);
2071}
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 1902 of file QwBeamLine.cc.

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

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

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

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

◆ GetClock() [1/2]

VQwClock * QwBeamLine::GetClock ( const TString name)

Find a Clock by name.

Definition at line 1998 of file QwBeamLine.cc.

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

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

2101{
2102 return const_cast<QwBeamLine*>(this)->GetClock(name);
2103}
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 2016 of file QwBeamLine.cc.

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

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

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

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

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

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

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

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

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

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

1895{
1896 return const_cast<QwBeamLine*>(this)->GetElement(TypeID,index);
1897}

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

1843{
1844 Int_t index = GetDetectorIndex(TypeID,name);
1845 return GetElement(TypeID,index);
1846};
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 1836 of file QwBeamLine.cc.

1837{
1838 return GetElement(det_id.fTypeID, det_id.fIndex);
1839};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

◆ LoadEventCuts_Init()

void QwBeamLine::LoadEventCuts_Init ( )
inlineoverridevirtual

Reimplemented from VQwSubsystemParity.

Definition at line 74 of file QwBeamLine.h.

74{};

◆ LoadEventCuts_Line()

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

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

Reimplemented from VQwSubsystemParity.

Definition at line 453 of file QwBeamLine.cc.

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

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

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

+ Here is the call graph for this function:

◆ LoadInputParameters()

Int_t QwBeamLine::LoadInputParameters ( TString pedestalfile)
overridevirtual

Load pedestals and calibration factors per subelement/device.

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

Implements VQwSubsystem.

Definition at line 850 of file QwBeamLine.cc.

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

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

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

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

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

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

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

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

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:

◆ PrintDetectorID()

void QwBeamLine::PrintDetectorID ( ) const

Definition at line 2790 of file QwBeamLine.cc.

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

References fBeamDetectorID.

◆ PrintErrorCounters()

void QwBeamLine::PrintErrorCounters ( ) const
overridevirtual

Print a beamline-wide summary of persistent error counters.

Implements VQwSubsystemParity.

Definition at line 1422 of file QwBeamLine.cc.

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

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

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

1666{
1667
1668 return 0;
1669}

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

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

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

43 {
44 //Handle command line options
45}

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

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

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

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

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

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

2301{
2302 for(size_t i=0;i<fClock.size();i++) fClock[i].get()->Scale(factor);
2303 for(size_t i=0;i<fStripline.size();i++) fStripline[i].get()->Scale(factor);
2304 for(size_t i=0;i<fCavity.size();i++) fCavity[i].Scale(factor);
2305 for(size_t i=0;i<fQPD.size();i++) fQPD[i].Scale(factor);
2306 for(size_t i=0;i<fLinearArray.size();i++) fLinearArray[i].Scale(factor);
2307 for(size_t i=0;i<fBCM.size();i++) fBCM[i].get()->Scale(factor);
2308 for(size_t i=0;i<fHaloMonitor.size();i++) fHaloMonitor[i].Scale(factor);
2309 for(size_t i=0;i<fBCMCombo.size();i++) fBCMCombo[i].get()->Scale(factor);
2310 for(size_t i=0;i<fBPMCombo.size();i++) fBPMCombo[i].get()->Scale(factor);
2311 for(size_t i=0;i<fECalculator.size();i++) fECalculator[i].Scale(factor);
2312 return;
2313}
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 1543 of file QwBeamLine.cc.

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

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

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

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ bDEBUG

const Bool_t QwBeamLine::bDEBUG =kFALSE
staticprivate

Definition at line 214 of file QwBeamLine.h.

Referenced by ApplySingleEventCuts().

◆ fBCM

◆ fBCMCombo

◆ fBeamDetectorID

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

◆ fBPMCombo

◆ fCavity

◆ fClock

◆ fECalculator

◆ fHaloMonitor

◆ fLinearArray

◆ fQPD

◆ fQwBeamLineErrorCount

Int_t QwBeamLine::fQwBeamLineErrorCount
private

Definition at line 211 of file QwBeamLine.h.

Referenced by ApplySingleEventCuts(), and LoadEventCuts_Fin().

◆ fStripline


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