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

Subsystem for beam modulation studies and FFB handling. More...

#include <QwBeamMod.h>

+ Inheritance diagram for QwBeamMod:
+ Collaboration diagram for QwBeamMod:

Public Member Functions

 QwBeamMod (const TString &name)
 Constructor with name.
 
 QwBeamMod (const QwBeamMod &source)
 Copy constructor.
 
 ~QwBeamMod () override
 Virtual destructor.
 
void ProcessOptions (QwOptions &options) override
 Process the command line options.
 
void AccumulateRunningSum (VQwSubsystem *, 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
 
Int_t LoadChannelMap (TString mapfile) override
 Mandatory map file definition.
 
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 LoadGeometry (TString mapfile)
 
Int_t LoadInputParameters (TString pedestalfile) override
 Mandatory parameter file definition.
 
Bool_t ApplySingleEventCuts () override
 Apply the single event cuts.
 
void IncrementErrorCounters () override
 Increment the error counters.
 
void PrintErrorCounters () const override
 
UInt_t GetEventcutErrorFlag () override
 Return the error flag to the top level routines related to stability checks and ErrorFlag updates.
 
Bool_t CheckForBurpFail (const VQwSubsystem *subsys) override
 Report the number of events failed due to HW and event cut failures.
 
void UpdateErrorFlag (const VQwSubsystem *ev_error) override
 update the error flag in the subsystem level from the top level routines related to stability checks. This will uniquely update the errorflag at each channel based on the error flag in the corresponding channel in the ev_error subsystem
 
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
 TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.
 
void ClearEventData () override
 
void ProcessEvent () override
 
void ProcessEvent_2 () override
 Process the event data again, including data from other subsystems. Not all derived classes will require a second stage of event data processing.
 
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 CalculateRunningAverage () override
 Calculate the average for all good events.
 
void PrintModChannelID ()
 
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.
 
void WritePromptSummary (QwPromptSummary *ps, TString type) override
 
Bool_t Compare (VQwSubsystem *source)
 
void Print ()
 
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 UInt_t UpdateErrorFlag ()
 Uses the error flags of contained data elements to update Returns the error flag to the top level routines related to stability checks and ErrorFlag updates.
 
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 void PrintValue () const
 Print values of all channels.
 
virtual Bool_t CheckForEndOfBurst () const
 
virtual void LoadMockDataParameters (TString)
 
- 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 LoadGeometryDefinition (TString)
 Optional geometry definition.
 
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 AtEndOfEventLoop ()
 Perform actions at the end of the event loop.
 
virtual void RandomizeEventData (int=0, double=0.0)
 
virtual void EncodeEventData (std::vector< UInt_t > &)
 
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 PrintInfo () const
 Print some information about the 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, QwBeamMod >
 ~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

Int_t GetDetectorIndex (TString name)
 
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

Int_t fTreeArrayIndex
 
std::vector< VQwHardwareChannel * > fModChannel
 
std::vector< QwModChannelIDfModChannelID
 
std::vector< QwWordfWord
 
std::vector< std::pair< Int_t, Int_t > > fWordsPerSubbank
 
- 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

 QwBeamMod ()
 

Private Attributes

UInt_t fFFB_Index
 
UInt_t fFFB_holdoff
 
UInt_t fFFB_holdoff_Counter
 
UInt_t fFFB_ErrorFlag
 
Bool_t fFFB_Flag
 
Int_t fRampChannelIndex
 
Int_t fPatternWordIndex
 
UInt_t fBmwObj_Index
 
Int_t fBMWObj_LL
 
Int_t fBMWObj_UL
 
UInt_t fBmwObj_ErrorFlag
 

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, QwBeamMod >
static VQwSubsystemCreate (const std::string &name)
 Object creation.
 
static QwBeamModCast (QwBeamMod *type)
 Object dynamic cast.
 

Detailed Description

Subsystem for beam modulation studies and FFB handling.

Decodes modulation ramp and pattern words, maintains channels affected by modulation, and computes relevant summaries for regression.

Definition at line 94 of file QwBeamMod.h.

Constructor & Destructor Documentation

◆ QwBeamMod() [1/3]

QwBeamMod::QwBeamMod ( )
private

Referenced by CheckForBurpFail(), Compare(), operator+=(), operator-=(), operator=(), QwBeamMod(), Ratio(), and UpdateErrorFlag().

+ Here is the caller graph for this function:

◆ QwBeamMod() [2/3]

QwBeamMod::QwBeamMod ( const TString & name)
inline

Constructor with name.

Definition at line 102 of file QwBeamMod.h.

103 : VQwSubsystem(name),VQwSubsystemParity(name)
104 {
106 fFFB_Flag=kTRUE;
109 fBmwObj_Index = -1;
110
111 // Initialize the bmwobj cuts with UL < LL to disable the cut
112 fBMWObj_LL = +1;
113 fBMWObj_UL = -1;
114 };
Int_t fRampChannelIndex
Definition QwBeamMod.h:224
UInt_t fBmwObj_Index
Definition QwBeamMod.h:226
Int_t fBMWObj_UL
Definition QwBeamMod.h:228
Int_t fBMWObj_LL
Definition QwBeamMod.h:227
Int_t fPatternWordIndex
Definition QwBeamMod.h:225
UInt_t fFFB_holdoff_Counter
Definition QwBeamMod.h:219
Bool_t fFFB_Flag
Definition QwBeamMod.h:221
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)

References fBmwObj_Index, fBMWObj_LL, fBMWObj_UL, fFFB_Flag, fFFB_holdoff_Counter, fPatternWordIndex, fRampChannelIndex, VQwSubsystem::VQwSubsystem(), and VQwSubsystemParity::VQwSubsystemParity().

+ Here is the call graph for this function:

◆ QwBeamMod() [3/3]

QwBeamMod::QwBeamMod ( const QwBeamMod & source)
inline

Copy constructor.

Definition at line 116 of file QwBeamMod.h.

117 : VQwSubsystem(source),VQwSubsystemParity(source),
118 fWord(source.fWord)
119 {
120 // std::cout<< "Here in the copy constructor" << std::endl;
121 this->fModChannel.reserve(source.fModChannel.size());
122 for(size_t i=0;i< source.fModChannel.size();i++) {
123 this->fModChannel.push_back(source.fModChannel[i]->Clone());
124 *(this->fModChannel[i]) = *(source.fModChannel[i]);
125 //source.fModChannel[i]->PrintValue();
126 }
127 }
std::vector< VQwHardwareChannel * > fModChannel
Definition QwBeamMod.h:208
std::vector< QwWord > fWord
Definition QwBeamMod.h:210

References fModChannel, fWord, QwBeamMod(), VQwSubsystem::VQwSubsystem(), and VQwSubsystemParity::VQwSubsystemParity().

+ Here is the call graph for this function:

◆ ~QwBeamMod()

QwBeamMod::~QwBeamMod ( )
inlineoverride

Virtual destructor.

Definition at line 129 of file QwBeamMod.h.

129{};

Member Function Documentation

◆ AccumulateRunningSum()

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

Update the running sums for devices.

Implements VQwSubsystemParity.

Definition at line 706 of file QwBeamMod.cc.

706{ }

References VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ ApplySingleEventCuts()

Bool_t QwBeamMod::ApplySingleEventCuts ( )
overridevirtual

Apply the single event cuts.

Implements VQwSubsystemParity.

Definition at line 450 of file QwBeamMod.cc.

450 {
451 //std::cout << "Here in ApplySingleEventCuts() " << std::endl;
452 // std::cout << "ErrorFlag: " << fFFB_ErrorFlag << std::endl;
453 Bool_t test_Mod=kTRUE;
454 Bool_t test_BCM1=kTRUE;
455
456 for(size_t i=0;i<fModChannel.size();i++){
457 //std::cout<<" BCM ["<<i<<"] "<<std::endl;
458 //fModChannel[i]->PrintValue();
459 //if(fModChannel[i]->GetEventcutErrorFlag() >0){
460 // fModChannel[i]->PrintValue();
461 // }
462 test_BCM1 = fModChannel[i]->ApplySingleEventCuts();
463 test_Mod &= test_BCM1;
464
465 // fModChannel[i]->PrintValue();
466 //std::cout << "ErrorFlag: "<< fModChannel[i]->GetEventcutErrorFlag()<< std::endl;
467
468 //if(fModChannel[i]->GetEventcutErrorFlag() >0){
469 // fModChannel[i]->PrintValue();
470 //}
471
472
473 if(!test_BCM1 && bDEBUG) std::cout<<"******* QwBeamMod::SingleEventCuts()->BCM[ "<<i<<" , "<<fModChannel[i]->GetElementName()<<" ] ******" << std::endl;
474 }
475
476
477 /* if (fWord[fFFB_Index].fValue==8 && fFFB_Flag && fFFB_holdoff_Counter==0){
478 fFFB_holdoff_Counter=fFFB_holdoff;
479 fFFB_Flag=kFALSE;
480
481 }
482 */
483 // std::cout << "Upper Limit: " << fBMWObj_UL << " , " << "Lower Limit: " << fBMWObj_LL << std::endl;
484 //copy for fBmwObj
485 if (fBMWObj_LL < fBMWObj_UL) {
486 //std::cout << "Upper Limit: " << fBMWObj_UL << " , " << "Lower Limit: " << fBMWObj_LL << std::endl;
487
488 // Cuts are valid
489 if (fWord[fBmwObj_Index].GetValue()>fBMWObj_UL
490 || fWord[fBmwObj_Index].GetValue()<fBMWObj_LL){
491 // Value is outside of cuts range.
492
493 //std::cout << "bmwobj value: "<< fWord[fBmwObj_Index].GetValue() << " , " << "ErrorFlag: "<< fFFB_ErrorFlag << std::endl;
495 //std::cout << "ErrorFlag: " << fFFB_ErrorFlag << std::endl;
496 }
497 }
498
499 /*if (!fFFB_Flag && (fFFB_holdoff_Counter>0 && fFFB_holdoff_Counter<=fFFB_holdoff) ){
500 fFFB_ErrorFlag = (kGlobalCut+kBModErrorFlag+kBModFFBErrorFlag+kEventCutMode3);
501 fFFB_holdoff_Counter--;
502 if(fFFB_holdoff_Counter==0)
503 fFFB_Flag=kTRUE;
504 }
505 else
506 fFFB_ErrorFlag=0;*/
507
508 //std::cout << "WordValue: " << fWord[fBmwObj_Index].GetValue() << std::endl;
509 //std::cout << "ErrorFlag: " << fFFB_ErrorFlag << std::endl;
510 return test_Mod;
511
512}
static const UInt_t kGlobalCut
Definition QwTypes.h:182
static const UInt_t kBModErrorFlag
Definition QwTypes.h:173
static const UInt_t kEventCutMode3
Definition QwTypes.h:174
static const UInt_t kBModFFBErrorFlag
Definition QwTypes.h:172
static const Bool_t bDEBUG
Definition QwBeamMod.h:222
UInt_t fFFB_ErrorFlag
Definition QwBeamMod.h:220

References bDEBUG, fBmwObj_Index, fBMWObj_LL, fBMWObj_UL, fFFB_ErrorFlag, fModChannel, fWord, kBModErrorFlag, kBModFFBErrorFlag, kEventCutMode3, and kGlobalCut.

◆ CalculateRunningAverage()

void QwBeamMod::CalculateRunningAverage ( )
overridevirtual

Calculate the average for all good events.

Implements VQwSubsystemParity.

Definition at line 704 of file QwBeamMod.cc.

704{ }

◆ CheckForBurpFail()

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

Report the number of events failed due to HW and event cut failures.

Implements VQwSubsystemParity.

Definition at line 325 of file QwBeamMod.cc.

325 {
326 Bool_t burpstatus = kFALSE;
327 VQwSubsystem* tmp = const_cast<VQwSubsystem *>(subsys);
328 if(Compare(tmp)) {
329 const QwBeamMod* input = dynamic_cast<const QwBeamMod*>(subsys);
330 for(size_t i=0;i<input->fModChannel.size();i++){
331 //QwError << "************* test Clock *****************" << QwLog::endl;
332 burpstatus |= (this->fModChannel[i])->CheckForBurpFail(input->fModChannel[i]);
333 }
334 }
335 return burpstatus;
336}
VQwSubsystem(const TString &name)
Constructor with name.
Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override
Report the number of events failed due to HW and event cut failures.
Definition QwBeamMod.cc:325
Bool_t Compare(VQwSubsystem *source)
Definition QwBeamMod.cc:708

References CheckForBurpFail(), Compare(), fModChannel, QwBeamMod(), and VQwSubsystem::VQwSubsystem().

Referenced by CheckForBurpFail().

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

◆ ClearEventData()

void QwBeamMod::ClearEventData ( )
overridevirtual

Implements VQwSubsystem.

Definition at line 579 of file QwBeamMod.cc.

579 {
580 // std::cout << "Here in ClearEventData " << std::endl;
581 for(size_t i=0;i<fModChannel.size();i++)
583
584 for (size_t i=0;i<fWord.size();i++)
586 //std::cout << "Error Flag: " << fFFB_ErrorFlag << std::endl;
588}
void ClearEventData() override
Definition QwBeamMod.cc:579

References ClearEventData(), fFFB_ErrorFlag, fModChannel, and fWord.

Referenced by ClearEventData().

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

◆ Compare()

Bool_t QwBeamMod::Compare ( VQwSubsystem * source)

Definition at line 708 of file QwBeamMod.cc.

709{
710 Bool_t res = kTRUE;
711 if(typeid(*value)!=typeid(*this))
712 {
713 res=kFALSE;
714 // std::cout<<" types are not ok \n";
715 // std::cout<<" this is bypassed just for now but should be fixed eventually \n";
716 }
717 else
718 {
719 QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
720
721 if(input->fModChannel.size()!=fModChannel.size())
722 {
723 res=kFALSE;
724 // std::cout<<" not the same number of bcms \n";
725 }
726 }
727 return res;
728}

References fModChannel, QwBeamMod(), and VQwSubsystem::VQwSubsystem().

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

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

◆ ConstructBranch() [1/2]

void QwBeamMod::ConstructBranch ( TTree * tree,
TString & prefix )
inlineoverridevirtual

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 185 of file QwBeamMod.h.

185{ };

◆ ConstructBranch() [2/2]

void QwBeamMod::ConstructBranch ( TTree * tree,
TString & prefix,
QwParameterFile & trim_file )
inlineoverridevirtual

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 186 of file QwBeamMod.h.

186{ };

◆ 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.
Definition QwBeamMod.cc:797

◆ ConstructBranchAndVector() [2/2]

void QwBeamMod::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 797 of file QwBeamMod.cc.

798{
799 TString basename;
800
801 for(size_t i = 0; i < fModChannel.size(); i++){
802 fModChannel[i]->ConstructBranchAndVector(tree, prefix, values);
803 }
804 // for (size_t i=0;i<fWord.size();i++)
805 // fWord[i].ConstructBranchAndVector(tree, prefix, values);
806 fTreeArrayIndex = values.size();
807 for (size_t i=0; i<fWord.size(); i++) {
808 // basename = fWord[i].fWordName;
809 basename = prefix(0, (prefix.First("|") >= 0)? prefix.First("|"): prefix.Length());
810 basename += fWord[i].fWordName;
811 values.push_back(basename.Data(), 'D');
812 tree->Branch(basename, &(values[fTreeArrayIndex + i]), values.LeafList(fTreeArrayIndex + i).c_str());
813 }
814}
size_type size() const noexcept
Definition QwRootFile.h:81
std::string LeafList(size_type start_index=0) const
Definition QwRootFile.h:228
void push_back(const std::string &name, const char type='D')
Definition QwRootFile.h:195
Int_t fTreeArrayIndex
Definition QwBeamMod.h:206

References fModChannel, fTreeArrayIndex, fWord, QwRootTreeBranchVector::LeafList(), QwRootTreeBranchVector::push_back(), and QwRootTreeBranchVector::size().

+ Here is the call 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.

◆ 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 QwBeamMod::ConstructHistograms ( TDirectory * folder,
TString & prefix )
overridevirtual

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

Implements VQwSubsystem.

Definition at line 733 of file QwBeamMod.cc.

734{
735 // Go to the specified folder
736 if (folder != NULL) folder->cd();
737
738 // No histogram creation for asym, yield, diff, etc
739 if (prefix != "") return;
740
741 // Beam modulation channels
742 //for (size_t i = 0; i < fModChannel.size(); i++)
743 // fModChannel[i]->ConstructHistograms(folder,prefix);
744}

◆ 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 };

◆ DeaccumulateRunningSum()

void QwBeamMod::DeaccumulateRunningSum ( VQwSubsystem * value,
Int_t ErrorMask = 0xFFFFFFF )
inlineoverridevirtual

remove one entry from the running sums for devices

Implements VQwSubsystemParity.

Definition at line 137 of file QwBeamMod.h.

137 {
138 };

References VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ FillHistograms()

void QwBeamMod::FillHistograms ( )
overridevirtual

Fill the histograms for this subsystem.

Implements VQwSubsystem.

Definition at line 746 of file QwBeamMod.cc.

747{
748 // No data loaded
749 if (! HasDataLoaded()) return;
750
751 // No histograms defined
752 if (fHistograms.size() == 0) return;
753
754 // Beam modulation channels
755 //for (size_t i = 0; i < fModChannel.size(); i++)
756 // fModChannel[i]->FillHistograms();
757
758 // Do we have a ramp channel?
760
761 // Do we have a pattern word?
762 if (fPatternWordIndex < 0 || fPatternWordIndex > Int_t(fWord.size())) return;
763
764 // Determine the ramp/phase
765 Double_t ramp = fModChannel[fRampChannelIndex]->GetValue();
766 if (ramp < 0) return;
767
768 // Determine the pattern number -- the pattern number for single coil is
769 // between [0, 4] so we need to check for this.
770 Int_t pattern = -1;
771
772 if(fWord[fPatternWordIndex].fValue < 11 && fWord[fPatternWordIndex].fValue > 0)
773 pattern = fWord[fPatternWordIndex].fValue;
774 else
775 pattern = fWord[fPatternWordIndex].fValue - 11;
776
777 if (pattern < 0 || pattern > 4) return;
778
779 // Fill histograms for all BPMs and each of the modulation patterns
780 //
781 // Due to the the way the ADC averages the ramp signal we want to filter
782 // out events at the edged of the signal.
783 //
784 // Separated the ramp cut here because it is ridiculously long...
785 //
786
787 [[maybe_unused]]
788 Double_t ramp_block_41 = fModChannel[fRampChannelIndex]->GetValue(4) + fModChannel[fRampChannelIndex]->GetValue(1);
789 [[maybe_unused]]
790 Double_t ramp_block_32 = fModChannel[fRampChannelIndex]->GetValue(3) + fModChannel[fRampChannelIndex]->GetValue(2);
791 [[maybe_unused]]
792 Double_t ramp_block = ramp_block_41 - ramp_block_32;
793
794}
std::vector< TH1_ptr > fHistograms
Histograms associated with this data element.
Bool_t HasDataLoaded() const

References MQwHistograms::fHistograms, fModChannel, fPatternWordIndex, fRampChannelIndex, fWord, and VQwSubsystem::HasDataLoaded().

Referenced by ProcessEvent_2().

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

◆ FillTreeVector()

void QwBeamMod::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 816 of file QwBeamMod.cc.

817{
818 //std::cout << "inside FillTreeVector"<< std::endl;
819 //std::cout << "fTreeArrayIndex: " << fTreeArrayIndex << std::endl;
820 size_t index = fTreeArrayIndex;
821
822 for (size_t i = 0; i < fModChannel.size(); i++){
823 fModChannel[i]->FillTreeVector(values);
824 // fModChannel[i]->PrintValue();
825 }
826 for (size_t i = 0; i < fWord.size(); i++){
827 values.SetValue(index++, fWord[i].fValue);
828 }
829 //for (size_t i=0; i<values.size(); i++){
830 // std::cout << values[i] << " ";
831 // if ((i+1)%8==0) std::cout << std::endl;
832 // }
833
834}
void SetValue(size_type index, Double_t val)
Definition QwRootFile.h:108

References fModChannel, fTreeArrayIndex, fWord, and QwRootTreeBranchVector::SetValue().

+ Here is the call graph for this function:

◆ GetDetectorIndex()

Int_t QwBeamMod::GetDetectorIndex ( TString name)
protected

Definition at line 591 of file QwBeamMod.cc.

592{
593 Bool_t ldebug=kFALSE;
594 if(ldebug)
595 {
596 std::cout<<"QwBeamMod::GetDetectorIndex\n";
597 std::cout<<fModChannelID.size()<<" already registered detector\n";
598 }
599
600 Int_t result=-1;
601 for(size_t i=0;i<fModChannelID.size();i++)
602 {
603
604 if(fModChannelID[i].fmodulename==name){
605 result=fModChannelID[i].fIndex;
606 }
607
608 if(ldebug)
609 {
610 std::cout<<"testing against ("<<fModChannelID[i].fTypeID
611 <<","<<fModChannelID[i].fmodulename<<")=>"<<result<<"\n";
612 }
613 }
614 //do it over the words, fWords
615 for(size_t i=0;i<fWord.size();i++) {
616
617 if(fWord[i].fWordName==name){
618 result=i;
619 }
620 }
621
622 return result;
623}
std::vector< QwModChannelID > fModChannelID
Definition QwBeamMod.h:209

References fModChannelID, and fWord.

Referenced by LoadEventCuts_Line().

+ Here is the caller graph for this function:

◆ GetEventcutErrorFlag()

UInt_t QwBeamMod::GetEventcutErrorFlag ( )
overridevirtual

Return the error flag to the top level routines related to stability checks and ErrorFlag updates.

Implements VQwSubsystemParity.

Definition at line 542 of file QwBeamMod.cc.

542 {//return the error flag
543 UInt_t ErrorFlag;
544 ErrorFlag=0;
545 for(size_t i=0;i<fModChannel.size();i++){
546 ErrorFlag |= fModChannel[i]->GetEventcutErrorFlag();
547 }
548 ErrorFlag |= fFFB_ErrorFlag;
549
550 return ErrorFlag;
551}

References fFFB_ErrorFlag, and fModChannel.

◆ IncrementErrorCounters()

void QwBeamMod::IncrementErrorCounters ( )
overridevirtual

Increment the error counters.

Implements VQwSubsystemParity.

Definition at line 514 of file QwBeamMod.cc.

515{
516 for(size_t i=0;i<fModChannel.size();i++){
517 fModChannel[i]->IncrementErrorCounters();
518 }
519}

References fModChannel.

◆ LoadChannelMap()

Int_t QwBeamMod::LoadChannelMap ( TString mapfile)
overridevirtual

Mandatory map file definition.

Implements VQwSubsystem.

Definition at line 46 of file QwBeamMod.cc.

46 {
47 // std::cout <<"Here in LoadChannelMap" << std::endl;
48 Bool_t ldebug=kFALSE;
49
50 Int_t wordsofar=0;
51 Int_t bankindex=-1;
52
53
54 TString varname, varvalue;
55
56 // Open the file
57 QwParameterFile mapstr(mapfile.Data());
58 fDetectorMaps.insert(mapstr.GetParamFileNameContents());
59 mapstr.EnableGreediness();
60 mapstr.SetCommentChars("!");
61 while (mapstr.ReadNextLine()) {
63
66 if ((bankindex+1)>0){
67 UInt_t numbanks = UInt_t(bankindex+1);
68 if (fWordsPerSubbank.size()<numbanks){
69 fWordsPerSubbank.resize(numbanks,
70 std::pair<Int_t, Int_t>(fWord.size(),fWord.size()));
71 }
72 }
73 wordsofar=0;
74 }
75 mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
76 if (mapstr.LineIsEmpty()) continue;
77
78
79 if (mapstr.HasVariablePair("=",varname,varvalue))
80 {
81 // This is a declaration line. Decode it.
82 varname.ToLower();
83 QwWarning << "QwBeamMod::LoadChannelMap: Unrecognized declaration "
84 << varname << " = " << varvalue << QwLog::endl;
85
86 } else {
87 Bool_t lineok=kTRUE;
88 // QwModChannelID localModChannelID(bankindex, wordsofar,namech, modtype, this);
89 QwModChannelID localModChannelID(bankindex, mapstr);
90 TString namech = localModChannelID.fmodulename;
91 if(localModChannelID.fmoduletype=="VQWK") {
92 wordsofar+=6;
93
94 if (lineok){
95 VQwHardwareChannel* localchan1 = new QwVQWK_Channel();
96
97 localchan1->InitializeChannel(GetName(),"QwBeamMod",localModChannelID.fmodulename,"raw");
98 fModChannel.push_back(localchan1);
99 fModChannel[fModChannel.size()-1]->LoadChannelParameters(mapstr);
100 localModChannelID.fIndex=fModChannel.size()-1;
101 fModChannelID.push_back(localModChannelID);
102 /* localchan1->PrintInfo();
103 localchan1->PrintValue();
104 localchan1->PrintErrorCounters();*/
105 // Store reference to ramp channel
106 if (localModChannelID.fmodulename == "ramp") {
107 fRampChannelIndex = fModChannel.size() - 1;
108 }
109
110 }
111
112 if(ldebug)
113 {
114 localModChannelID.Print();
115 std::cout<<"line ok=";
116 if(lineok) std::cout<<"TRUE"<<std::endl;
117 else std::cout<<"FALSE"<<std::endl;
118 }
119 }
120
121 if(localModChannelID.fmoduletype=="SCALER" || localModChannelID.fmoduletype == "SIS3801D24") {
122 wordsofar+=1;
123
124 if (lineok){
125 VQwHardwareChannel* localchan2 = new QwSIS3801D24_Channel();
126
127 localchan2->InitializeChannel(GetName(),"QwBeamMod",localModChannelID.fmodulename,"raw");
128 fModChannel.push_back(localchan2);
129 fModChannel[fModChannel.size()-1]->LoadChannelParameters(mapstr);
130 localModChannelID.fIndex=fModChannel.size()-1;
131 fModChannelID.push_back(localModChannelID);
132 /* localchan2->PrintInfo();
133 localchan2->PrintValue();
134 localchan2->PrintErrorCounters();*/
135 // Store reference to ramp channel
136 if (localModChannelID.fmodulename == "ramp") {
137 fRampChannelIndex = fModChannel.size() - 1;
138 }
139 }
140
141 if(ldebug)
142 {
143 localModChannelID.Print();
144 std::cout<<"line ok=";
145 if(lineok) std::cout<<"TRUE"<<std::endl;
146 else std::cout<<"FALSE"<<std::endl;
147 }
148
149 }
150
151 if (localModChannelID.fmoduletype == "SIS3801D32") {
152 wordsofar+=1;
153
154 if (lineok){
155 VQwHardwareChannel* localchan3 = new QwSIS3801D32_Channel();
156
157 localchan3->InitializeChannel(GetName(),"QwBeamMod",localModChannelID.fmodulename,"raw");
158 fModChannel.push_back(localchan3);
159 fModChannel[fModChannel.size()-1]->LoadChannelParameters(mapstr);
160 localModChannelID.fIndex=fModChannel.size()-1;
161 fModChannelID.push_back(localModChannelID);
162 /* localchan3->PrintInfo();
163 localchan3->PrintValue();
164 localchan3->PrintErrorCounters();*/
165 // Store reference to ramp channel
166 if (localModChannelID.fmodulename == "ramp") {
167 fRampChannelIndex = fModChannel.size() - 1;
168 }
169 }
170
171 if(ldebug)
172 {
173 localModChannelID.Print();
174 std::cout<<"line ok=";
175 if(lineok) std::cout<<"TRUE"<<std::endl;
176 else std::cout<<"FALSE"<<std::endl;
177 }
178 }
179
180 if(localModChannelID.fmoduletype=="SKIP"){
181 if (localModChannelID.modnum<=0) wordsofar+=1;
182 else wordsofar+= localModChannelID.modnum;
183
184 }
185
186 if(localModChannelID.fmoduletype == "WORD") {
187 // std::cout << "Decoding QwWord :: " << namech << std::endl;
188 QwWord localword;
189 localword.fSubbankIndex=bankindex;
190 localword.fWordInSubbank=wordsofar;
191 wordsofar+=1;
192 // I assume that one data = one word here. But it is not always the case, for
193 // example the triumf adc gives 6 words per channel
194 localword.fModuleType=localModChannelID.fmoduletype;
195 localword.fWordName=namech;
196 //localword.fWordType=dettype; // FIXME dettype is undefined so commented this out
197 fWord.push_back(localword);
198
199 // Store reference to pattern number
200 if (localword.fWordName == "bm_pattern_number") {
201 fPatternWordIndex = fWord.size() - 1;
202 }
203
204 if(namech=="ffb_status")//save the location of this word to access this later
205 fFFB_Index=fWord.size()-1;
206 //store reference to bmwobj
207 if(namech == "bmwobj"){
208 fBmwObj_Index = fWord.size() - 1;
209 }
210
211 fWordsPerSubbank[bankindex].second = fWord.size();
212 QwDebug << "--" << namech << "--" << fWord.size()-1 << QwLog::endl;
213 }
214
215 }
216 }
217
218 if(ldebug)
219 {
220 std::cout<<"Done with Load map channel \n";
221 for(size_t i=0;i<fModChannelID.size();i++)
222 fModChannelID[i].Print();
223
224 for(size_t i=0;i<fWord.size();i++)
225 fWord[i].PrintID();
226 }
227 return 0;
228}
class QwScaler_Channel< 0x00ffffff, 0 > QwSIS3801D24_Channel
class QwScaler_Channel< 0xffffffff, 0 > QwSIS3801D32_Channel
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Int_t fWordInSubbank
Definition QwWord.h:38
Int_t fSubbankIndex
Definition QwWord.h:37
TString fModuleType
Definition QwWord.h:39
TString fWordName
Definition QwWord.h:40
void InitializeChannel(TString name)
Initialize the fields in this object.
BankID_t fCurrentBank_ID
Bank ID (and Marker word) that is currently being processed;.
Int_t GetSubbankIndex() const
void RegisterRocBankMarker(QwParameterFile &mapstr)
TString GetName() const
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.
void Print()
Definition QwBeamMod.cc:869
UInt_t fFFB_Index
Definition QwBeamMod.h:217
std::vector< std::pair< Int_t, Int_t > > fWordsPerSubbank
Definition QwBeamMod.h:211

References QwParameterFile::EnableGreediness(), QwLog::endl(), fBmwObj_Index, VQwSubsystem::fCurrentBank_ID, VQwSubsystem::fCurrentROC_ID, VQwSubsystem::fDetectorMaps, fFFB_Index, QwModChannelID::fIndex, fModChannel, fModChannelID, QwModChannelID::fmodulename, QwWord::fModuleType, QwModChannelID::fmoduletype, fPatternWordIndex, fRampChannelIndex, QwWord::fSubbankIndex, fWord, QwWord::fWordInSubbank, QwWord::fWordName, fWordsPerSubbank, VQwSubsystem::GetName(), QwParameterFile::GetParamFileNameContents(), VQwSubsystem::GetSubbankIndex(), QwParameterFile::HasVariablePair(), VQwHardwareChannel::InitializeChannel(), QwParameterFile::LineIsEmpty(), QwModChannelID::modnum, Print(), QwModChannelID::Print(), QwDebug, QwWarning, QwParameterFile::ReadNextLine(), VQwSubsystem::RegisterRocBankMarker(), QwParameterFile::SetCommentChars(), and QwParameterFile::TrimWhitespace().

+ Here is the call graph for this function:

◆ LoadEventCuts_Fin()

void QwBeamMod::LoadEventCuts_Fin ( Int_t & eventcut_flag)
overridevirtual

Reimplemented from VQwSubsystemParity.

Definition at line 318 of file QwBeamMod.cc.

318 {
319 //update the event cut ON/OFF for all the devices
320 for (size_t i=0;i<fModChannel.size();i++)
321 fModChannel[i]->SetEventCutMode(eventcut_flag);
322}

References fModChannel.

◆ LoadEventCuts_Init()

void QwBeamMod::LoadEventCuts_Init ( )
overridevirtual

Reimplemented from VQwSubsystemParity.

Definition at line 281 of file QwBeamMod.cc.

281 {
282 fFFB_holdoff=0;//Default holdoff for the FFB pause
283}
UInt_t fFFB_holdoff
Definition QwBeamMod.h:218

References fFFB_holdoff.

◆ LoadEventCuts_Line()

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

Reimplemented from VQwSubsystemParity.

Definition at line 285 of file QwBeamMod.cc.

285 {
286 TString device_type = mapstr.GetTypedNextToken<TString>();
287 device_type.ToUpper();
288 TString device_name = mapstr.GetTypedNextToken<TString>();
289 device_name.ToUpper();
290
291 if (device_type == "VQWK"||device_type=="SCALER" ||device_type=="SIS3801D24" ||device_type=="SIS3801D32"){
292 device_name.ToLower();
293 Double_t LLX = mapstr.GetTypedNextToken<Double_t>(); //lower limit for BCM value
294 Double_t ULX = mapstr.GetTypedNextToken<Double_t>(); //upper limit for BCM value
295 varvalue = mapstr.GetTypedNextToken<TString>();//global/local
296 Double_t burplevel = mapstr.GetTypedNextToken<Double_t>();
297 varvalue.ToLower();
298 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
299 QwMessage<<"QwBeamMod Error Code "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
300 Int_t det_index=GetDetectorIndex(device_name);
301 QwMessage << "*****************************" << QwLog::endl;
302 QwMessage << " Type " << device_type << " Name " << device_name << " Index [" << det_index << "] "
303 << " device flag " << eventcut_flag << QwLog::endl;
304 fModChannel[det_index]->SetSingleEventCuts((GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)|kBModErrorFlag),LLX,ULX,stabilitycut,burplevel);
305 QwMessage << "*****************************" << QwLog::endl;
306
307 } else if (device_type == "WORD" && device_name== "FFB_STATUS"){
308 fFFB_holdoff=mapstr.GetTypedNextToken<UInt_t>();//Read the FFB OFF interval
309 } else if (device_type == "WORD" && device_name== "BMWOBJ"){
310 fBMWObj_LL=mapstr.GetTypedNextToken<Int_t>();
311 fBMWObj_UL=mapstr.GetTypedNextToken<Int_t>();
312 QwMessage << "bmwobj error cuts"
313 << "LowerLimit=" << fBMWObj_LL
314 << "UpperLimit=" << fBMWObj_UL <<QwLog::endl;
315 }
316}
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
UInt_t GetGlobalErrorFlag(TString evtype, Int_t evMode, Double_t stabilitycut)
Definition QwTypes.cc:132
T GetTypedNextToken()
Get next token into specific type.
Int_t GetDetectorIndex(TString name)
Definition QwBeamMod.cc:591

References QwLog::endl(), fBMWObj_LL, fBMWObj_UL, fFFB_holdoff, fModChannel, GetDetectorIndex(), GetGlobalErrorFlag(), QwParameterFile::GetTypedNextToken(), kBModErrorFlag, and QwMessage.

+ Here is the call graph for this function:

◆ LoadGeometry()

Int_t QwBeamMod::LoadGeometry ( TString mapfile)

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

+ Here is the call graph for this function:

◆ LoadInputParameters()

Int_t QwBeamMod::LoadInputParameters ( TString mapfile)
overridevirtual

Mandatory parameter file definition.

Implements VQwSubsystem.

Definition at line 339 of file QwBeamMod.cc.

340{
341 Bool_t ldebug=kFALSE;
342 TString varname;
343
344 Int_t lineread=1;
345
346 if(ldebug)std::cout<<"QwBeamMod::LoadInputParameters("<< pedestalfile<<")\n";
347
348 QwParameterFile mapstr(pedestalfile.Data()); //Open the file
349 while (mapstr.ReadNextLine())
350 {
351 lineread+=1;
352 if(ldebug)std::cout<<" line read so far ="<<lineread<<"\n";
353 mapstr.TrimComment('!'); // Remove everything after a '!' character.
354 mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
355 if (mapstr.LineIsEmpty()) continue;
356 else
357 {
358 TString varname = mapstr.GetTypedNextToken<TString>(); //name of the channel
359 varname.ToLower();
360 varname.Remove(TString::kBoth,' ');
361 Double_t varped = mapstr.GetTypedNextToken<Double_t>(); // value of the pedestal
362 Double_t varcal = mapstr.GetTypedNextToken<Double_t>(); // value of the calibration factor
363 /* Double_t varweight = */ mapstr.GetTypedNextToken<Double_t>(); // value of the statistical weight
364
365 //if(ldebug) std::cout<<"inputs for channel "<<varname
366 // <<": ped="<<varped<<": cal="<<varcal<<": weight="<<varweight<<"\n";
367 for(size_t i=0;i<fModChannel.size();i++)
368 if(fModChannel[i]->GetElementName()==varname)
369 {
370 fModChannel[i]->SetPedestal(varped);
371 fModChannel[i]->SetCalibrationFactor(varcal);
372 break;
373 }
374 }
375
376 }
377 if(ldebug) std::cout<<" line read in the pedestal + cal file ="<<lineread<<" \n";
378
379 ldebug=kFALSE;
380 return 0;
381}

References fModChannel, QwParameterFile::GetTypedNextToken(), QwParameterFile::LineIsEmpty(), QwParameterFile::ReadNextLine(), QwParameterFile::TrimComment(), and QwParameterFile::TrimWhitespace().

+ Here is the call graph for this function:

◆ operator+=()

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

Implements VQwSubsystemParity.

Definition at line 646 of file QwBeamMod.cc.

647{
648 if(Compare(value)){
649 // std::cout << "Here in operator+= " << std::endl;
650 //QwBeamMod* input= (QwBeamMod*)value ;
651 QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
652
653 for(size_t i=0;i<input->fModChannel.size();i++)
654 *(this->fModChannel[i]) += *(input->fModChannel[i]);
655// for(size_t i=0;i<input->fWord.size();i++)
656// this->fWord[i]+=input->fWord[i];
657 this->fFFB_ErrorFlag |= input->fFFB_ErrorFlag;
658 // std::cout <<"Error Flag: " << this->fFFB_ErrorFlag <<std::endl;
659 }
660 return *this;
661}

References Compare(), fFFB_ErrorFlag, fModChannel, QwBeamMod(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ operator-=()

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

Implements VQwSubsystemParity.

Definition at line 663 of file QwBeamMod.cc.

663 {
664
665 if(Compare(value))
666 {
667 //QwBeamMod* input= (QwBeamMod*)value;
668 QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
669
670 for(size_t i=0;i<input->fModChannel.size();i++)
671 *(this->fModChannel[i]) -= *(input->fModChannel[i]);
672// for(size_t i=0;i<input->fWord.size();i++)
673// this->fWord[i]-=input->fWord[i];
674 this->fFFB_ErrorFlag |= input->fFFB_ErrorFlag;
675
676 }
677 return *this;
678}

References Compare(), fFFB_ErrorFlag, fModChannel, QwBeamMod(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ operator=()

VQwSubsystem & QwBeamMod::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 625 of file QwBeamMod.cc.

626{
627
628 if(Compare(value))
629 {
630
631 QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
632
633 for(size_t i=0;i<input->fModChannel.size();i++){
634 //input->fModChannel[i]->PrintValue();
635 this->fModChannel[i]->AssignValueFrom(input->fModChannel[i]);
636 //fModChannel[i]->PrintValue();
637 }
638 for(size_t i=0;i<input->fWord.size();i++)
639 this->fWord[i].fValue=input->fWord[i].fValue;
640 this->fFFB_ErrorFlag=input->fFFB_ErrorFlag;
641
642 }
643 return *this;
644}

References Compare(), fFFB_ErrorFlag, fModChannel, fWord, QwBeamMod(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ Print()

void QwBeamMod::Print ( )

Definition at line 869 of file QwBeamMod.cc.

870{
871 QwMessage << "Name of the subsystem =" << fSystemName << QwLog::endl;
872
873 QwMessage << "there are " << fModChannel.size() << " mods" << QwLog::endl;
874
875 QwMessage << " Printing Running AVG and other channel info for fModChannel" << QwLog::endl;
876 for(size_t i=0;i<fModChannel.size();i++)
878 for(size_t i=0;i<fWord.size();i++)
879 fWord[i].Print();
880}
TString fSystemName
Name of this subsystem.
virtual void PrintValue() const
Print values of all channels.

References QwLog::endl(), fModChannel, VQwSubsystem::fSystemName, fWord, Print(), VQwSubsystemParity::PrintValue(), and QwMessage.

Referenced by LoadChannelMap(), and Print().

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

◆ PrintErrorCounters()

void QwBeamMod::PrintErrorCounters ( ) const
overridevirtual

Implements VQwSubsystemParity.

Definition at line 521 of file QwBeamMod.cc.

521 {//inherited from the VQwSubsystemParity; this will display the error summary
522
523 std::cout<<"*********QwBeamMod Error Summary****************"<<std::endl;
525 for(size_t i=0;i<fModChannel.size();i++){
526 fModChannel[i]->PrintErrorCounters();
527 }
529}
static void PrintErrorCounterTail()
static void PrintErrorCounterHead()

References fModChannel, QwVQWK_Channel::PrintErrorCounterHead(), and QwVQWK_Channel::PrintErrorCounterTail().

+ Here is the call graph for this function:

◆ PrintModChannelID()

void QwBeamMod::PrintModChannelID ( )

Definition at line 882 of file QwBeamMod.cc.

883{
884 for (size_t i=0;i<fModChannelID.size();i++)
885 {
886 std::cout<<"============================="<<std::endl;
887 std::cout<<" Detector ID="<<i<<std::endl;
888 fModChannelID[i].Print();
889 }
890}

References fModChannelID.

◆ ProcessConfigurationBuffer()

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

Implements VQwSubsystem.

Definition at line 572 of file QwBeamMod.cc.

573{
574 return 0;
575}

◆ ProcessEvBuffer()

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

TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.

Implements VQwSubsystem.

Definition at line 384 of file QwBeamMod.cc.

385{
386
387
388 Bool_t lkDEBUG=kFALSE;
389
390 Int_t index = GetSubbankIndex(roc_id,bank_id);
391
392
393 if (index>=0 && num_words>0){
394 // We want to process this ROC. Begin looping through the data.
395 if (lkDEBUG)
396 QwMessage << "QwBeamMod::ProcessEvBuffer: "
397 << "Begin processing ROC" << roc_id
398 << " and subbank "<<bank_id
399 << " number of words="<<num_words<<QwLog::endl;
400 if (buffer[0]==0xf0f0f0f0 && num_words%2==1){
401 buffer++;
402
403 if (lkDEBUG)
404 QwMessage << "QwBeamMod::ProcessEvBuffer: "
405 << "Skipped padding word 0xf0f0f0f0 at beginning of buffer."
406 << QwLog::endl;
407 }
408
409 for(size_t i=0;i<fModChannelID.size();i++) {
410 if(fModChannelID[i].fSubbankIndex==index) {
411 if (lkDEBUG) {
412 std::cout<<"found modulation data for "<<fModChannelID[i].fmodulename<<std::endl;
413 std::cout<<"word left to read in this buffer:"<<num_words-fModChannelID[i].fWordInSubbank<<std::endl;
414 }
415 fModChannel[fModChannelID[i].fIndex]->ProcessEvBuffer(&(buffer[fModChannelID[i].fWordInSubbank]),
416 num_words-fModChannelID[i].fWordInSubbank);
417 //fModChannel[fModChannelID[i].fIndex]->PrintInfo();
418 //fModChannel[fModChannelID[i].fIndex]->PrintValue();
419 //fModChannel[fModChannelID[i].fIndex]->PrintErrorCounters();
420 }
421 }
422
423 for(Int_t i=fWordsPerSubbank[index].first; i<fWordsPerSubbank[index].second; i++) {
424 if(fWord[i].fWordInSubbank+1<= (Int_t) num_words) {
425 fWord[i].fValue=buffer[fWord[i].fWordInSubbank];
426 //fWord[i].Print();
427 } else {
428 QwWarning << "QwBeamMod::ProcessEvBuffer: There is not enough word in the buffer to read data for "
429 << fWord[i].fWordName << QwLog::endl;
430 QwWarning << "QwBeamMod::ProcessEvBuffer: Words in this buffer:" << num_words
431 << " trying to read word number =" << fWord[i].fWordInSubbank << QwLog::endl;
432 }
433 }
434 if(lkDEBUG) {
435 QwDebug << "QwBeamMod::ProcessEvBuffer: Done with Processing this event" << QwLog::endl;
436 for(size_t i=0;i<fWord.size();i++) {
437 std::cout << " word number = " << i << " ";
438 fWord[i].Print();
439 }
440 }
441
442 }
443 lkDEBUG=kFALSE;
444
445 SetDataLoaded(kTRUE);
446
447 return 0;
448}
void SetDataLoaded(Bool_t flag)

References QwLog::endl(), fModChannel, fModChannelID, fWord, fWordsPerSubbank, VQwSubsystem::GetSubbankIndex(), QwDebug, QwMessage, QwWarning, and VQwSubsystem::SetDataLoaded().

+ Here is the call graph for this function:

◆ ProcessEvent()

void QwBeamMod::ProcessEvent ( )
overridevirtual

Implements VQwSubsystem.

Definition at line 556 of file QwBeamMod.cc.

556 {
557 //std::cout << "Here in ProcessEvent() " << std::endl;
558 for (size_t i = 0; i < fModChannel.size(); i++) {
559 // First apply HW checks and update HW error flags.
560 fModChannel[i]->ApplyHWChecks();
561 fModChannel[i]->ProcessEvent();
562 //fModChannel[i]->PrintValue();
563 }
564}

References fModChannel.

◆ ProcessEvent_2()

void QwBeamMod::ProcessEvent_2 ( )
overridevirtual

Process the event data again, including data from other subsystems. Not all derived classes will require a second stage of event data processing.

Reimplemented from VQwSubsystem.

Definition at line 566 of file QwBeamMod.cc.

567{
568 // Fill histograms here to bypass event cuts
570}
void FillHistograms() override
Fill the histograms for this subsystem.
Definition QwBeamMod.cc:746

References FillHistograms().

+ Here is the call graph for this function:

◆ ProcessOptions()

void QwBeamMod::ProcessOptions ( QwOptions & )
overridevirtual

Process the command line options.

Reimplemented from VQwSubsystem.

Definition at line 42 of file QwBeamMod.cc.

42 {
43 //Handle command line options
44}

◆ Ratio()

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

Implements VQwSubsystemParity.

Definition at line 680 of file QwBeamMod.cc.

681{
682 if(Compare(numer)&&Compare(denom))
683 {
684 //QwBeamMod* innumer= (QwBeamMod*)numer ;
685 QwBeamMod* innumer = dynamic_cast<QwBeamMod*>(numer);
686 //QwBeamMod* indenom= (QwBeamMod*)denom ;
687 QwBeamMod* indenom = dynamic_cast<QwBeamMod*>(denom);
688
689 for(size_t i=0;i<innumer->fModChannel.size();i++)
690 this->fModChannel[i]->Ratio(innumer->fModChannel[i],indenom->fModChannel[i]);
691 for(size_t i=0;i<innumer->fWord.size();i++)
692 this->fWord[i].fValue=innumer->fWord[i].fValue;
693
694 }
695}
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom) override
Definition QwBeamMod.cc:680

References Compare(), fModChannel, fWord, QwBeamMod(), 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 QwBeamMod::Scale ( Double_t factor)
overridevirtual

Implements VQwSubsystemParity.

Definition at line 698 of file QwBeamMod.cc.

699{
700 for(size_t i=0;i<fModChannel.size();i++)
701 fModChannel[i]->Scale(factor);
702}
void Scale(Double_t factor) override
Definition QwBeamMod.cc:698

References fModChannel, and Scale().

Referenced by Scale().

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

◆ UpdateErrorFlag()

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

update the error flag in the subsystem level from the top level routines related to stability checks. This will uniquely update the errorflag at each channel based on the error flag in the corresponding channel in the ev_error subsystem

Implements VQwSubsystemParity.

Definition at line 531 of file QwBeamMod.cc.

532{
533 const QwBeamMod* input = dynamic_cast<const QwBeamMod*> (ev_error);
534
535 for(size_t i=0;i<fModChannel.size();i++){
536 fModChannel[i]->UpdateErrorFlag(input->fModChannel[i]->GetEventcutErrorFlag());
537 }
538 // fFFB_ErrorFlag = input->fFFB_ErrorFlag;
539
540}

References fModChannel, QwBeamMod(), and VQwSubsystem::VQwSubsystem().

+ Here is the call graph for this function:

◆ WritePromptSummary()

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

Reimplemented from VQwSubsystemParity.

Definition at line 976 of file QwBeamMod.cc.

977{
978 return;
979};

Field Documentation

◆ bDEBUG

const Bool_t QwBeamMod::bDEBUG =kFALSE
staticprivate

Definition at line 222 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts().

◆ fBmwObj_ErrorFlag

UInt_t QwBeamMod::fBmwObj_ErrorFlag
private

Definition at line 229 of file QwBeamMod.h.

◆ fBmwObj_Index

UInt_t QwBeamMod::fBmwObj_Index
private

Definition at line 226 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts(), LoadChannelMap(), and QwBeamMod().

◆ fBMWObj_LL

Int_t QwBeamMod::fBMWObj_LL
private

Definition at line 227 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts(), LoadEventCuts_Line(), and QwBeamMod().

◆ fBMWObj_UL

Int_t QwBeamMod::fBMWObj_UL
private

Definition at line 228 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts(), LoadEventCuts_Line(), and QwBeamMod().

◆ fFFB_ErrorFlag

UInt_t QwBeamMod::fFFB_ErrorFlag
private

◆ fFFB_Flag

Bool_t QwBeamMod::fFFB_Flag
private

Definition at line 221 of file QwBeamMod.h.

Referenced by QwBeamMod().

◆ fFFB_holdoff

UInt_t QwBeamMod::fFFB_holdoff
private

Definition at line 218 of file QwBeamMod.h.

Referenced by LoadEventCuts_Init(), and LoadEventCuts_Line().

◆ fFFB_holdoff_Counter

UInt_t QwBeamMod::fFFB_holdoff_Counter
private

Definition at line 219 of file QwBeamMod.h.

Referenced by QwBeamMod().

◆ fFFB_Index

UInt_t QwBeamMod::fFFB_Index
private

Definition at line 217 of file QwBeamMod.h.

Referenced by LoadChannelMap().

◆ fModChannel

◆ fModChannelID

std::vector<QwModChannelID> QwBeamMod::fModChannelID
protected

Definition at line 209 of file QwBeamMod.h.

Referenced by GetDetectorIndex(), LoadChannelMap(), PrintModChannelID(), and ProcessEvBuffer().

◆ fPatternWordIndex

Int_t QwBeamMod::fPatternWordIndex
private

Definition at line 225 of file QwBeamMod.h.

Referenced by FillHistograms(), LoadChannelMap(), and QwBeamMod().

◆ fRampChannelIndex

Int_t QwBeamMod::fRampChannelIndex
private

Definition at line 224 of file QwBeamMod.h.

Referenced by FillHistograms(), LoadChannelMap(), and QwBeamMod().

◆ fTreeArrayIndex

Int_t QwBeamMod::fTreeArrayIndex
protected

Definition at line 206 of file QwBeamMod.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ fWord

◆ fWordsPerSubbank

std::vector< std::pair<Int_t, Int_t> > QwBeamMod::fWordsPerSubbank
protected

Definition at line 211 of file QwBeamMod.h.

Referenced by LoadChannelMap(), and ProcessEvBuffer().


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