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 704 of file QwBeamMod.cc.

704{ }

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 447 of file QwBeamMod.cc.

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

702{ }

◆ 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 322 of file QwBeamMod.cc.

322 {
323 Bool_t burpstatus = kFALSE;
324 VQwSubsystem* tmp = const_cast<VQwSubsystem *>(subsys);
325 if(Compare(tmp)) {
326 const QwBeamMod* input = dynamic_cast<const QwBeamMod*>(subsys);
327 for(size_t i=0;i<input->fModChannel.size();i++){
328 //QwError << "************* test Clock *****************" << QwLog::endl;
329 burpstatus |= (this->fModChannel[i])->CheckForBurpFail(input->fModChannel[i]);
330 }
331 }
332 return burpstatus;
333}
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:322
Bool_t Compare(VQwSubsystem *source)
Definition QwBeamMod.cc:706

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 576 of file QwBeamMod.cc.

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

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 706 of file QwBeamMod.cc.

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

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:795

◆ 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 795 of file QwBeamMod.cc.

796{
797 TString basename;
798
799 for(size_t i = 0; i < fModChannel.size(); i++){
800 fModChannel[i]->ConstructBranchAndVector(tree, prefix, values);
801 }
802 // for (size_t i=0;i<fWord.size();i++)
803 // fWord[i].ConstructBranchAndVector(tree, prefix, values);
804 fTreeArrayIndex = values.size();
805 for (size_t i=0; i<fWord.size(); i++) {
806 // basename = fWord[i].fWordName;
807 basename = prefix(0, (prefix.First("|") >= 0)? prefix.First("|"): prefix.Length());
808 basename += fWord[i].fWordName;
809 values.push_back(basename.Data(), 'D');
810 tree->Branch(basename, &(values[fTreeArrayIndex + i]), values.LeafList(fTreeArrayIndex + i).c_str());
811 }
812}
size_type size() const noexcept
Definition QwRootFile.h:83
std::string LeafList(size_type start_index=0) const
Definition QwRootFile.h:230
void push_back(const std::string &name, const char type='D')
Definition QwRootFile.h:197
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 731 of file QwBeamMod.cc.

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

◆ 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 744 of file QwBeamMod.cc.

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

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

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 588 of file QwBeamMod.cc.

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

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

References fFFB_ErrorFlag, and fModChannel.

◆ IncrementErrorCounters()

void QwBeamMod::IncrementErrorCounters ( )
overridevirtual

Increment the error counters.

Implements VQwSubsystemParity.

Definition at line 511 of file QwBeamMod.cc.

512{
513 for(size_t i=0;i<fModChannel.size();i++){
514 fModChannel[i]->IncrementErrorCounters();
515 }
516}

References fModChannel.

◆ LoadChannelMap()

Int_t QwBeamMod::LoadChannelMap ( TString mapfile)
overridevirtual

Mandatory map file definition.

Implements VQwSubsystem.

Definition at line 43 of file QwBeamMod.cc.

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

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

References fModChannel.

◆ LoadEventCuts_Init()

void QwBeamMod::LoadEventCuts_Init ( )
overridevirtual

Reimplemented from VQwSubsystemParity.

Definition at line 278 of file QwBeamMod.cc.

278 {
279 fFFB_holdoff=0;//Default holdoff for the FFB pause
280}
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 282 of file QwBeamMod.cc.

282 {
283 TString device_type = mapstr.GetTypedNextToken<TString>();
284 device_type.ToUpper();
285 TString device_name = mapstr.GetTypedNextToken<TString>();
286 device_name.ToUpper();
287
288 if (device_type == "VQWK"||device_type=="SCALER" ||device_type=="SIS3801D24" ||device_type=="SIS3801D32"){
289 device_name.ToLower();
290 Double_t LLX = mapstr.GetTypedNextToken<Double_t>(); //lower limit for BCM value
291 Double_t ULX = mapstr.GetTypedNextToken<Double_t>(); //upper limit for BCM value
292 varvalue = mapstr.GetTypedNextToken<TString>();//global/local
293 Double_t burplevel = mapstr.GetTypedNextToken<Double_t>();
294 varvalue.ToLower();
295 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
296 QwMessage<<"QwBeamMod Error Code "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
297 Int_t det_index=GetDetectorIndex(device_name);
298 QwMessage << "*****************************" << QwLog::endl;
299 QwMessage << " Type " << device_type << " Name " << device_name << " Index [" << det_index << "] "
300 << " device flag " << eventcut_flag << QwLog::endl;
301 fModChannel[det_index]->SetSingleEventCuts((GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)|kBModErrorFlag),LLX,ULX,stabilitycut,burplevel);
302 QwMessage << "*****************************" << QwLog::endl;
303
304 } else if (device_type == "WORD" && device_name== "FFB_STATUS"){
305 fFFB_holdoff=mapstr.GetTypedNextToken<UInt_t>();//Read the FFB OFF interval
306 } else if (device_type == "WORD" && device_name== "BMWOBJ"){
307 fBMWObj_LL=mapstr.GetTypedNextToken<Int_t>();
308 fBMWObj_UL=mapstr.GetTypedNextToken<Int_t>();
309 QwMessage << "bmwobj error cuts"
310 << "LowerLimit=" << fBMWObj_LL
311 << "UpperLimit=" << fBMWObj_UL <<QwLog::endl;
312 }
313}
#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:588

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 336 of file QwBeamMod.cc.

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

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 644 of file QwBeamMod.cc.

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

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 661 of file QwBeamMod.cc.

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

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 622 of file QwBeamMod.cc.

623{
624
625 if(Compare(value))
626 {
627
629 QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
630
631 for(size_t i=0;i<input->fModChannel.size();i++){
632 //input->fModChannel[i]->PrintValue();
633 this->fModChannel[i]->AssignValueFrom(input->fModChannel[i]);
634 //fModChannel[i]->PrintValue();
635 }
636 for(size_t i=0;i<input->fWord.size();i++)
637 this->fWord[i].fValue=input->fWord[i].fValue;
638 this->fFFB_ErrorFlag=input->fFFB_ErrorFlag;
639
640 }
641 return *this;
642}
virtual VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...

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

+ Here is the call graph for this function:

◆ Print()

void QwBeamMod::Print ( )

Definition at line 867 of file QwBeamMod.cc.

868{
869 QwMessage << "Name of the subsystem =" << fSystemName << QwLog::endl;
870
871 QwMessage << "there are " << fModChannel.size() << " mods" << QwLog::endl;
872
873 QwMessage << " Printing Running AVG and other channel info for fModChannel" << QwLog::endl;
874 for(size_t i=0;i<fModChannel.size();i++)
876 for(size_t i=0;i<fWord.size();i++)
877 fWord[i].Print();
878}
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 518 of file QwBeamMod.cc.

518 {//inherited from the VQwSubsystemParity; this will display the error summary
519
520 std::cout<<"*********QwBeamMod Error Summary****************"<<std::endl;
522 for(size_t i=0;i<fModChannel.size();i++){
523 fModChannel[i]->PrintErrorCounters();
524 }
526}
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 880 of file QwBeamMod.cc.

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

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 569 of file QwBeamMod.cc.

570{
571 return 0;
572}

◆ 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 381 of file QwBeamMod.cc.

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

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

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 563 of file QwBeamMod.cc.

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

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 39 of file QwBeamMod.cc.

39 {
40 //Handle command line options
41}

◆ Ratio()

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

Implements VQwSubsystemParity.

Definition at line 678 of file QwBeamMod.cc.

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

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 696 of file QwBeamMod.cc.

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

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 528 of file QwBeamMod.cc.

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

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 974 of file QwBeamMod.cc.

975{
976 return;
977};

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: