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

Container for managing multiple subsystems with common operations. More...

#include <QwSubsystemArray.h>

+ Inheritance diagram for QwSubsystemArray:
+ Collaboration diagram for QwSubsystemArray:

Public Types

typedef Bool_t(* CanContainFn) (VQwSubsystem *)
 

Public Member Functions

 QwSubsystemArray (QwOptions &options, CanContainFn myCanContain)
 Constructor with options.
 
 QwSubsystemArray (const QwSubsystemArray &source)
 Copy constructor by reference.
 
 ~QwSubsystemArray () override
 Virtual destructor.
 
QwSubsystemArrayoperator= (const QwSubsystemArray &value)
 Assignment operator.
 
void SetCodaRunNumber (UInt_t runnum)
 Set the internal record of the CODA run number.
 
void SetCodaSegmentNumber (UInt_t segnum)
 Set the internal record of the CODA segment number.
 
void SetCodaEventNumber (UInt_t evtnum)
 Set the internal record of the CODA event number.
 
void SetCodaEventType (UInt_t evttype)
 Set the internal record of the CODA event type.
 
UInt_t GetCodaRunNumber () const
 Get the internal record of the CODA run number.
 
UInt_t GetCodaSegmentNumber () const
 Get the internal record of the CODA segment number.
 
UInt_t GetCodaEventNumber () const
 Get the internal record of the CODA event number.
 
UInt_t GetCodaEventType () const
 Get the internal record of the CODA event type.
 
void SetEventTypeMask (const UInt_t mask)
 Set event type mask.
 
UInt_t GetEventTypeMask () const
 Get event type mask.
 
UInt_t UpdateEventTypeMask ()
 Update the event type mask from the subsystems.
 
void SetDataLoaded (const Bool_t flag)
 Set data loaded flag.
 
Bool_t HasDataLoaded () const
 Get data loaded flag.
 
void ProcessOptionsToplevel (QwOptions &options)
 Process configuration options for the subsystem array itself.
 
void ProcessOptionsSubsystems (QwOptions &options)
 Process configuration options for all subsystems in the array.
 
void ProcessOptions (QwOptions &options)
 Process configuration options (default behavior)
 
void LoadAllEventRanges (QwOptions &options)
 
void push_back (VQwSubsystem *subsys)
 Add the subsystem to this array.
 
virtual VQwSubsystemGetSubsystemByName (const TString &name)
 Get the subsystem with the specified name.
 
virtual std::vector< VQwSubsystem * > GetSubsystemByType (const std::string &type)
 Get the list of subsystems of the specified type.
 
void ClearEventData ()
 
Int_t ProcessConfigurationBuffer (const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words)
 Process the event buffer for configuration events.
 
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)
 Process the event buffer for events.
 
void GetROCIDList (std::vector< ROCID_t > &list)
 Get the ROCID list.
 
void ProcessEvent ()
 Process the decoded data in this event.
 
void AtEndOfEventLoop ()
 Perform actions at the end of the event loop.
 
void PrintParamFileList () const
 Print list of parameter files.
 
TList * GetParamFileNameList (TString name) const
 Get list of parameter files.
 
Object construction and maintenance
void ConstructObjects ()
 Construct the objects for this subsystem.
 
void ConstructObjects (TDirectory *folder)
 Construct the objects for this subsystem in a folder.
 
void ConstructObjects (TDirectory *folder, TString &prefix)
 Construct the objects for this subsystem in a folder with a prefix.
 
Histogram construction and maintenance
void ConstructHistograms ()
 Construct the histograms for this subsystem.
 
void ConstructHistograms (TDirectory *folder)
 Construct the histograms for this subsystem in a folder.
 
void ConstructHistograms (TDirectory *folder, TString &prefix)
 Construct the histograms for this subsystem in a folder with a prefix.
 
void FillHistograms ()
 Fill the histograms for this subsystem.
 
void ShareHistograms (const QwSubsystemArray &source)
 Share the histograms with another subsystem.
 
Tree and vector construction and maintenance
void ConstructBranchAndVector (TTree *tree, QwRootTreeBranchVector &values)
 Construct the tree and vector for this subsystem.
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
 Construct a branch and vector for this subsystem with a prefix.
 
void ConstructBranch (TTree *tree, TString &prefix)
 Construct a branch for this subsystem with a prefix.
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &trim_file)
 Construct a branch for this subsystem with a prefix after tree leave trimming.
 
void FillTreeVector (QwRootTreeBranchVector &values) const
 Fill the vector for this subsystem.
 
- Public Member Functions inherited from MQwPublishable< QwSubsystemArray, VQwSubsystem >
 MQwPublishable ()
 Default constructor Initializes empty variable publishing maps.
 
 MQwPublishable (const MQwPublishable &source)
 Copy constructor Creates a new container with cleared publishing maps (variables are not copied).
 
virtual ~MQwPublishable ()
 Virtual destructor.
 
Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve a variable value from external sources by copying Searches for the named variable in external subsystem arrays and copies its value into the provided data element.
 
const VQwHardwareChannelRequestExternalPointer (const TString &name) const
 Retrieve a direct pointer to an external variable Searches for the named variable in external subsystem arrays and returns a direct pointer to the data element.
 
virtual const VQwHardwareChannelReturnInternalValue (const TString &name) const
 Retrieve an internal variable by name (pointer version) Searches for the named variable among published internal variables and returns a direct pointer to the data element.
 
Bool_t ReturnInternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve an internal variable by name (copy version) Searches for the named variable among published internal variables and copies its value into the provided data element.
 
void ListPublishedValues () const
 List all published variables with descriptions Prints a summary of all currently published variables and their descriptions to the logging output for debugging and inspection purposes.
 
Bool_t PublishInternalValue (const TString name, const TString desc, const VQwSubsystem *subsys, const VQwHardwareChannel *element)
 Publish an internal variable from a subsystem Registers a variable from one of the contained subsystems in the publishing framework, making it available for external access by name.
 

Static Public Member Functions

static void DefineOptions (QwOptions &options)
 Define configuration options for global array.
 

Private Types

typedef std::vector< std::shared_ptr< VQwSubsystem > > SubsysPtrs
 

Private Member Functions

 QwSubsystemArray ()
 Private default constructor.
 

Tree construction and maintenance

These functions are not purely virtual, since not every subsystem is expected to implement them. They are intended for expert output to trees.

size_t fTreeArrayIndex
 
UInt_t fCodaRunNumber
 Index of this data element in root tree.
 
UInt_t fCodaSegmentNumber
 CODA segment number as provided by QwEventBuffer.
 
UInt_t fCodaEventNumber
 CODA event number as provided by QwEventBuffer.
 
UInt_t fCodaEventType
 CODA event type as provided by QwEventBuffer.
 
UInt_t fEventTypeMask
 Mask of event types.
 
Bool_t fHasDataLoaded
 Has this array gotten data to be processed?
 
CanContainFn fnCanContain
 Function to determine which subsystems we can accept.
 
std::vector< std::pair< UInt_t, UInt_t > > fBadEventRange
 
std::vector< VQwSubsystem * > fResolvedSelf
 
const QwSubsystemArrayfResolvedPeer = nullptr
 
std::vector< VQwSubsystem * > fResolvedPeerSlots
 
std::vector< Bool_t > fResolvedPairCompatible
 
double fWindowPeriod
 
std::string fSubsystemsMapFile
 Filename of the global detector map.
 
std::vector< std::string > fSubsystemsDisabledByName
 List of disabled types.
 
std::vector< std::string > fSubsystemsDisabledByType
 List of disabled names.
 
void ConstructTree ()
 Construct the tree for this subsystem.
 
void ConstructTree (TDirectory *folder)
 Construct the tree for this subsystem in a folder.
 
void ConstructTree (TDirectory *folder, TString &prefix)
 Construct the tree for this subsystem in a folder with a prefix.
 
void FillTree ()
 Fill the tree for this subsystem.
 
void DeleteTree ()
 Delete the tree for this subsystem.
 
void PrintInfo () const
 Print some information about the subsystem.
 
void push_back (std::shared_ptr< VQwSubsystem > subsys)
 
void GetMarkerWordList (const ROCID_t roc_id, const BankID_t bank_id, std::vector< UInt_t > &marker) const
 
void RandomizeEventData (int helicity=0, double time=0.0)
 Randomize the data in this event.
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 Encode the data in this event.
 
double GetWindowPeriod ()
 
void LoadSubsystemsFromParameterFile (QwParameterFile &detectors)
 
void InvalidateResolvedDispatchCache ()
 
void BuildResolvedSelf () const
 
void ResolvePairing (const QwSubsystemArray &source, const char *context) const
 
static Bool_t CanContain (VQwSubsystem *subsys)
 Test whether this subsystem array can contain a particular subsystem.
 

Additional Inherited Members

- Data Fields inherited from MQwPublishable< QwSubsystemArray, VQwSubsystem >
std::vector< std::vector< TString > > fPublishList
 

Detailed Description

Container for managing multiple subsystems with common operations.

Extends std::vector to provide subsystem-level operations such as event processing, accumulation, tree/histogram construction, and publishing. Uses container-delegation pattern to forward arithmetic operations to individual subsystems while maintaining type safety.

Definition at line 42 of file QwSubsystemArray.h.

Member Typedef Documentation

◆ CanContainFn

typedef Bool_t(* QwSubsystemArray::CanContainFn) (VQwSubsystem *)

Definition at line 56 of file QwSubsystemArray.h.

◆ SubsysPtrs

typedef std::vector<std::shared_ptr<VQwSubsystem> > QwSubsystemArray::SubsysPtrs
private

Definition at line 47 of file QwSubsystemArray.h.

Constructor & Destructor Documentation

◆ QwSubsystemArray() [1/3]

QwSubsystemArray::QwSubsystemArray ( )
private

Private default constructor.

References QwSubsystemArray().

Referenced by operator=(), QwSubsystemArray(), QwSubsystemArray(), QwSubsystemArrayParity::QwSubsystemArrayParity(), QwSubsystemArrayParity::QwSubsystemArrayParity(), ResolvePairing(), and ShareHistograms().

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

◆ QwSubsystemArray() [2/3]

QwSubsystemArray::QwSubsystemArray ( QwOptions & options,
CanContainFn myCanContain )

Constructor with options.

Create a subsystem array based on the configuration option 'detectors'

Definition at line 22 of file QwSubsystemArray.cc.

23: fEventTypeMask(0x0),fnCanContain(myCanContain)
24{
26 QwParameterFile detectors(fSubsystemsMapFile.c_str());
27 QwMessage << "Loading subsystems from " << fSubsystemsMapFile << "." << QwLog::endl;
29}
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
CanContainFn fnCanContain
Function to determine which subsystems we can accept.
std::string fSubsystemsMapFile
Filename of the global detector map.
void ProcessOptionsToplevel(QwOptions &options)
Process configuration options for the subsystem array itself.
UInt_t fEventTypeMask
Mask of event types.
void LoadSubsystemsFromParameterFile(QwParameterFile &detectors)

References QwLog::endl(), fEventTypeMask, fnCanContain, fSubsystemsMapFile, LoadSubsystemsFromParameterFile(), ProcessOptionsToplevel(), and QwMessage.

+ Here is the call graph for this function:

◆ QwSubsystemArray() [3/3]

QwSubsystemArray::QwSubsystemArray ( const QwSubsystemArray & source)

Copy constructor by reference.

Copy constructor by reference

Parameters
sourceSource subsystem array

Definition at line 35 of file QwSubsystemArray.cc.

36: std::vector<std::shared_ptr<VQwSubsystem>>(),
37 MQwPublishable(source),
49{
50
51 // Make copies of all subsystems rather than copying just the pointers
52 for (const_iterator subsys = source.begin(); subsys != source.end(); ++subsys) {
53 this->push_back(subsys->get()->Clone());
54 // Instruct the subsystem to publish variables
55 if (this->back()->PublishInternalValues() == kFALSE) {
56 QwError << "Not all variables for " << this->back()->GetName()
57 << " could be published!" << QwLog::endl;
58 }
59 }
60}
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
void push_back(VQwSubsystem *subsys)
Add the subsystem to this array.
UInt_t fCodaEventType
CODA event type as provided by QwEventBuffer.
std::vector< std::string > fSubsystemsDisabledByName
List of disabled types.
UInt_t fCodaRunNumber
Index of this data element in root tree.
UInt_t fCodaSegmentNumber
CODA segment number as provided by QwEventBuffer.
std::vector< std::string > fSubsystemsDisabledByType
List of disabled names.
Bool_t fHasDataLoaded
Has this array gotten data to be processed?
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.

References fCodaEventNumber, fCodaEventType, fCodaRunNumber, fCodaSegmentNumber, fEventTypeMask, fHasDataLoaded, fnCanContain, fSubsystemsDisabledByName, fSubsystemsDisabledByType, fSubsystemsMapFile, fTreeArrayIndex, MQwPublishable< QwSubsystemArray, VQwSubsystem >::MQwPublishable(), and QwSubsystemArray().

+ Here is the call graph for this function:

◆ ~QwSubsystemArray()

QwSubsystemArray::~QwSubsystemArray ( )
inlineoverride

Virtual destructor.

Definition at line 70 of file QwSubsystemArray.h.

70{ };

Member Function Documentation

◆ AtEndOfEventLoop()

void QwSubsystemArray::AtEndOfEventLoop ( )

Perform actions at the end of the event loop.

Definition at line 463 of file QwSubsystemArray.cc.

464{
465 QwDebug << "QwSubsystemArray at end of event loop" << QwLog::endl;
466 if (!empty()) {
467 std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::AtEndOfEventLoop));
468 }
469}
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
virtual void AtEndOfEventLoop()
Perform actions at the end of the event loop.

References VQwSubsystem::AtEndOfEventLoop(), QwLog::endl(), and QwDebug.

Referenced by main().

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

◆ BuildResolvedSelf()

void QwSubsystemArray::BuildResolvedSelf ( ) const
protected

Definition at line 70 of file QwSubsystemArray.cc.

71{
72 if (fResolvedSelf.size() == this->size()) return;
73 // Self layout changed: any peer cache built against the old layout is stale.
74 fResolvedPeer = nullptr;
75 fResolvedPeerSlots.clear();
77 fResolvedSelf.assign(this->size(), nullptr);
78 for (size_t i = 0; i < this->size(); ++i) {
79 if (this->at(i) != nullptr) {
80 fResolvedSelf[i] = this->at(i).get();
81 }
82 }
83}
std::vector< Bool_t > fResolvedPairCompatible
const QwSubsystemArray * fResolvedPeer
std::vector< VQwSubsystem * > fResolvedSelf
std::vector< VQwSubsystem * > fResolvedPeerSlots

References fResolvedPairCompatible, fResolvedPeer, fResolvedPeerSlots, and fResolvedSelf.

Referenced by ResolvePairing().

+ Here is the caller graph for this function:

◆ CanContain()

static Bool_t QwSubsystemArray::CanContain ( VQwSubsystem * subsys)
inlinestaticprotected

Test whether this subsystem array can contain a particular subsystem.

Definition at line 281 of file QwSubsystemArray.h.

281 {
282 if (subsys == 0) {
283 QwError << "Zero pointer passed!" << QwLog::endl;
284 }
285 // should never occur
286 return kFALSE;
287 };

References QwLog::endl(), and QwError.

+ Here is the call graph for this function:

◆ ClearEventData()

void QwSubsystemArray::ClearEventData ( )

Definition at line 397 of file QwSubsystemArray.cc.

398{
399 if (!empty()) {
400 SetDataLoaded(kFALSE);
403 std::for_each(begin(), end(),
404 std::mem_fn(&VQwSubsystem::ClearEventData));
405 }
406}
void SetDataLoaded(const Bool_t flag)
Set data loaded flag.
void SetCodaEventNumber(UInt_t evtnum)
Set the internal record of the CODA event number.
void SetCodaEventType(UInt_t evttype)
Set the internal record of the CODA event type.
virtual void ClearEventData()=0

References VQwSubsystem::ClearEventData(), SetCodaEventNumber(), SetCodaEventType(), and SetDataLoaded().

Referenced by QwEventBuffer::FillSubsystemData(), main(), and main().

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

◆ ConstructBranch() [1/2]

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

Construct a branch for this subsystem with a prefix.

Construct the branch for the flat tree

Parameters
treeTree
prefixPrefix

Definition at line 621 of file QwSubsystemArray.cc.

622{
623 // Only MPS tree should contain event number and type
624 if (prefix == "" || prefix == "yield_") {
625 tree->Branch("CodaEventNumber",&fCodaEventNumber,"CodaEventNumber/i");
626 tree->Branch("CodaEventType",&fCodaEventType,"CodaEventType/i");
627 }
628
629 for (iterator subsys = begin(); subsys != end(); ++subsys) {
630 VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
631 subsys_ptr->ConstructBranch(tree, prefix);
632 }
633}
virtual void ConstructBranch(TTree *tree, TString &prefix)=0
Construct the branch and tree vector.

References VQwSubsystem::ConstructBranch(), fCodaEventNumber, and fCodaEventType.

+ Here is the call graph for this function:

◆ ConstructBranch() [2/2]

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

Construct a branch for this subsystem with a prefix after tree leave trimming.

Construct the branch for the flat tree with tree trim files accepted

Parameters
treeTree
prefixPrefix
trim_fileTrim file

Definition at line 642 of file QwSubsystemArray.cc.

646{
647 QwMessage << " QwSubsystemArray::ConstructBranch " << QwLog::endl;
648
649 std::unique_ptr<QwParameterFile> preamble;
650 std::unique_ptr<QwParameterFile> nextsection;
651 preamble = trim_file.ReadSectionPreamble();
652
653 // Process preamble
654 QwVerbose << "QwSubsystemArrayTracking::ConstructBranch Preamble:" << QwLog::endl;
655 QwVerbose << *preamble << QwLog::endl;
656
657 if (prefix == "" || prefix == "yield_") {
658 tree->Branch("CodaEventNumber",&fCodaEventNumber,"CodaEventNumber/i");
659 tree->Branch("CodaEventType",&fCodaEventType,"CodaEventType/i");
660 }
661
662 for (iterator subsys = begin(); subsys != end(); ++subsys) {
663 VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
664
665 TString subsysname = subsys_ptr->GetName();
666 //QwMessage << "Tree leaves created for " << subsysname << QwLog::endl;
667
668 if (trim_file.FileHasSectionHeader(subsysname)) {
669 // This section contains modules and their channels to be included in the tree
670 nextsection = trim_file.ReadUntilNextSection();
671 subsys_ptr->ConstructBranch(tree, prefix, *nextsection);
672 QwMessage << "Tree leaves created for " << subsysname << QwLog::endl;
673 } else
674 QwMessage << "No tree leaves created for " << subsysname << QwLog::endl;
675 }
676}
#define QwVerbose
Predefined log drain for verbose messages.
Definition QwLog.h:54
Bool_t FileHasSectionHeader(const std::string &secname)
std::unique_ptr< QwParameterFile > ReadUntilNextSection(const bool add_current_line=false)
std::unique_ptr< QwParameterFile > ReadSectionPreamble()
Rewinds to the start and read until it finds next section header.
TString GetName() const

References VQwSubsystem::ConstructBranch(), QwLog::endl(), fCodaEventNumber, fCodaEventType, QwParameterFile::FileHasSectionHeader(), VQwSubsystem::GetName(), QwMessage, QwVerbose, QwParameterFile::ReadSectionPreamble(), and QwParameterFile::ReadUntilNextSection().

+ Here is the call graph for this function:

◆ ConstructBranchAndVector() [1/2]

void QwSubsystemArray::ConstructBranchAndVector ( TTree * tree,
QwRootTreeBranchVector & values )
inline

Construct the tree and vector for this subsystem.

Definition at line 202 of file QwSubsystemArray.h.

202 {
203 TString tmpstr("");
204 ConstructBranchAndVector(tree,tmpstr,values);
205 };
void ConstructBranchAndVector(TTree *tree, QwRootTreeBranchVector &values)
Construct the tree and vector for this subsystem.

References ConstructBranchAndVector().

Referenced by ConstructBranchAndVector(), and QwSubsystemArrayParity::ConstructBranchAndVector().

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

◆ ConstructBranchAndVector() [2/2]

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

Construct a branch and vector for this subsystem with a prefix.

Construct the branch and tree vector

Parameters
treeTree
prefixPrefix
valuesVector of values

Definition at line 592 of file QwSubsystemArray.cc.

596{
597 fTreeArrayIndex = values.size();
598
599 // Each tree should only contain event number and type once, but will
600 // still reserve space in the values vector, so we don't need to modify
601 // FillTreeVector().
602 values.push_back("CodaEventNumber", 'i');
603 values.push_back("CodaEventType", 'i');
604 if (prefix == "" || prefix.Index("yield_") == 0) {
605 tree->Branch("CodaEventNumber",&(values[fTreeArrayIndex]),"CodaEventNumber/i");
606 tree->Branch("CodaEventType",&(values[fTreeArrayIndex+1]),"CodaEventType/i");
607 }
608 for (iterator subsys = begin(); subsys != end(); ++subsys) {
609 VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
610 subsys_ptr->ConstructBranchAndVector(tree, prefix, values);
611 }
612
613}
size_type size() const noexcept
Definition QwRootFile.h:83
void push_back(const std::string &name, const char type='D')
Definition QwRootFile.h:197
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)=0
Construct the branch and tree vector.

References VQwSubsystem::ConstructBranchAndVector(), fTreeArrayIndex, QwRootTreeBranchVector::push_back(), and QwRootTreeBranchVector::size().

+ Here is the call graph for this function:

◆ ConstructHistograms() [1/3]

void QwSubsystemArray::ConstructHistograms ( )
inline

Construct the histograms for this subsystem.

Definition at line 182 of file QwSubsystemArray.h.

182 {
183 ConstructHistograms((TDirectory*) NULL);
184 };
void ConstructHistograms()
Construct the histograms for this subsystem.

References ConstructHistograms().

Referenced by ConstructHistograms(), and ConstructHistograms().

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

◆ ConstructHistograms() [2/3]

void QwSubsystemArray::ConstructHistograms ( TDirectory * folder)
inline

Construct the histograms for this subsystem in a folder.

Definition at line 186 of file QwSubsystemArray.h.

186 {
187 TString prefix = "";
188 ConstructHistograms(folder, prefix);
189 };

References ConstructHistograms().

+ Here is the call graph for this function:

◆ ConstructHistograms() [3/3]

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

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

Definition at line 514 of file QwSubsystemArray.cc.

515{
516 if (!empty()) {
517 for (iterator subsys = begin(); subsys != end(); ++subsys){
518 (*subsys)->ConstructHistograms(folder,prefix);
519 }
520 }
521}

◆ ConstructObjects() [1/3]

void QwSubsystemArray::ConstructObjects ( )
inline

Construct the objects for this subsystem.

Definition at line 166 of file QwSubsystemArray.h.

166 {
167 ConstructObjects((TDirectory*) NULL);
168 };
void ConstructObjects()
Construct the objects for this subsystem.

References ConstructObjects().

Referenced by ConstructObjects(), and ConstructObjects().

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

◆ ConstructObjects() [2/3]

void QwSubsystemArray::ConstructObjects ( TDirectory * folder)
inline

Construct the objects for this subsystem in a folder.

Definition at line 170 of file QwSubsystemArray.h.

170 {
171 TString prefix = "";
172 ConstructObjects(folder, prefix);
173 };

References ConstructObjects().

+ Here is the call graph for this function:

◆ ConstructObjects() [3/3]

void QwSubsystemArray::ConstructObjects ( TDirectory * folder,
TString & prefix )

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

Definition at line 504 of file QwSubsystemArray.cc.

505{
506 if (!empty()) {
507 for (iterator subsys = begin(); subsys != end(); ++subsys){
508 (*subsys)->ConstructObjects(folder,prefix);
509 }
510 }
511}

◆ ConstructTree() [1/3]

void QwSubsystemArray::ConstructTree ( )
inline

Construct the tree for this subsystem.

Definition at line 235 of file QwSubsystemArray.h.

235 {
236 ConstructTree((TDirectory*) NULL);
237 };
void ConstructTree()
Construct the tree for this subsystem.

References ConstructTree().

Referenced by ConstructTree(), and ConstructTree().

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

◆ ConstructTree() [2/3]

void QwSubsystemArray::ConstructTree ( TDirectory * folder)
inline

Construct the tree for this subsystem in a folder.

Definition at line 239 of file QwSubsystemArray.h.

239 {
240 TString prefix = "";
241 ConstructTree(folder, prefix);
242 };

References ConstructTree().

+ Here is the call graph for this function:

◆ ConstructTree() [3/3]

void QwSubsystemArray::ConstructTree ( TDirectory * folder,
TString & prefix )

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

Construct the tree for this subsystem

Parameters
folderDirectory where to construct the tree
prefixPrefix for the name of the tree

Definition at line 546 of file QwSubsystemArray.cc.

547{
548 if (!empty()) {
549 for (iterator subsys = begin(); subsys != end(); ++subsys){
550 (*subsys)->ConstructTree(folder, prefix);
551 }
552 }
553}

◆ DefineOptions()

void QwSubsystemArray::DefineOptions ( QwOptions & options)
static

Define configuration options for global array.

Define configuration options for global array

Parameters
optionsOptions

Definition at line 275 of file QwSubsystemArray.cc.

276{
277 options.AddOptions()("detectors",
278 po::value<std::string>()->default_value("detectors.map"),
279 "map file with detectors to include");
280
281 options.AddOptions()("bad-event-list",
282 po::value<std::string>()->default_value(""),
283 "map file with bad event ranges");
284
285 // Versions of boost::program_options below 1.39.0 have a bug in multitoken processing
286 options.AddOptions()("disable-by-type",
287 po::value<std::vector <std::string> >()->multitoken(),
288 "subsystem types to disable");
289 options.AddOptions()("disable-by-name",
290 po::value<std::vector <std::string> >()->multitoken(),
291 "subsystem names to disable");
292}
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Definition QwOptions.h:170

References QwOptions::AddOptions().

Referenced by QwOptions::DefineOptions().

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

◆ DeleteTree()

void QwSubsystemArray::DeleteTree ( )

Delete the tree for this subsystem.

Delete the tree for this subsystem

Definition at line 567 of file QwSubsystemArray.cc.

568{
569 if (!empty())
570 std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::DeleteTree));
571}
virtual void DeleteTree()
Delete the tree for this subsystem.

References VQwSubsystem::DeleteTree().

+ Here is the call graph for this function:

◆ EncodeEventData()

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

Encode the data in this event.

Definition at line 481 of file QwSubsystemArray.cc.

482{
483 if (!empty())
484 for (iterator subsys = begin(); subsys != end(); ++subsys) {
485 (*subsys)->EncodeEventData(buffer);
486 }
487}

Referenced by QwEventBuffer::EncodeSubsystemData().

+ Here is the caller graph for this function:

◆ FillHistograms()

void QwSubsystemArray::FillHistograms ( )

Fill the histograms for this subsystem.

Definition at line 523 of file QwSubsystemArray.cc.

524{
525 if (!empty())
526 std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::FillHistograms));
527}
virtual void FillHistograms()=0
Fill the histograms for this subsystem.

References VQwSubsystem::FillHistograms().

Referenced by QwSubsystemArrayParity::FillHistograms().

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

◆ FillTree()

void QwSubsystemArray::FillTree ( )

Fill the tree for this subsystem.

Fill the tree for this subsystem

Definition at line 558 of file QwSubsystemArray.cc.

559{
560 if (!empty())
561 std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::FillTree));
562}
virtual void FillTree()
Fill the tree for this subsystem.

References VQwSubsystem::FillTree().

+ Here is the call graph for this function:

◆ FillTreeVector()

void QwSubsystemArray::FillTreeVector ( QwRootTreeBranchVector & values) const

Fill the vector for this subsystem.

Fill the tree vector

Parameters
valuesVector of values

Definition at line 683 of file QwSubsystemArray.cc.

684{
685 // Fill the event number and event type
686 size_t index = fTreeArrayIndex;
687 values.SetValue(index++, this->GetCodaEventNumber());
688 values.SetValue(index++, this->GetCodaEventType());
689
690 // Fill the subsystem data
691 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
692 VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
693 subsys_ptr->FillTreeVector(values);
694 }
695}
void SetValue(size_type index, Double_t val)
Definition QwRootFile.h:110
UInt_t GetCodaEventNumber() const
Get the internal record of the CODA event number.
UInt_t GetCodaEventType() const
Get the internal record of the CODA event type.
virtual void FillTreeVector(QwRootTreeBranchVector &values) const =0
Fill the tree vector.

References VQwSubsystem::FillTreeVector(), fTreeArrayIndex, GetCodaEventNumber(), GetCodaEventType(), and QwRootTreeBranchVector::SetValue().

Referenced by QwSubsystemArrayParity::FillTreeVector().

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

◆ GetCodaEventNumber()

UInt_t QwSubsystemArray::GetCodaEventNumber ( ) const
inline

Get the internal record of the CODA event number.

Definition at line 88 of file QwSubsystemArray.h.

88{ return fCodaEventNumber; };

References fCodaEventNumber.

Referenced by FillTreeVector().

+ Here is the caller graph for this function:

◆ GetCodaEventType()

UInt_t QwSubsystemArray::GetCodaEventType ( ) const
inline

Get the internal record of the CODA event type.

Definition at line 90 of file QwSubsystemArray.h.

90{ return fCodaEventType; };

References fCodaEventType.

Referenced by FillTreeVector().

+ Here is the caller graph for this function:

◆ GetCodaRunNumber()

UInt_t QwSubsystemArray::GetCodaRunNumber ( ) const
inline

Get the internal record of the CODA run number.

Definition at line 84 of file QwSubsystemArray.h.

84{ return fCodaRunNumber; };

References fCodaRunNumber.

◆ GetCodaSegmentNumber()

UInt_t QwSubsystemArray::GetCodaSegmentNumber ( ) const
inline

Get the internal record of the CODA segment number.

Definition at line 86 of file QwSubsystemArray.h.

86{ return fCodaSegmentNumber; };

References fCodaSegmentNumber.

◆ GetEventTypeMask()

UInt_t QwSubsystemArray::GetEventTypeMask ( ) const
inline

Get event type mask.

Definition at line 95 of file QwSubsystemArray.h.

95{ return fEventTypeMask; };

References fEventTypeMask.

Referenced by QwEventBuffer::FillSubsystemData().

+ Here is the caller graph for this function:

◆ GetMarkerWordList()

void QwSubsystemArray::GetMarkerWordList ( const ROCID_t roc_id,
const BankID_t bank_id,
std::vector< UInt_t > & marker ) const

QwSubsystemArray::GetMarkerWordList should be called once by QwEventBuffer to build the marker word list as each roc_id and bank_id are reached in the decoding.

Definition at line 424 of file QwSubsystemArray.cc.

428{
429 if (!empty()){
430 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
431 (*subsys)->GetMarkerWordList(roc_id, bank_id, marker);
432 }
433 }
434}

Referenced by QwEventBuffer::CheckForMarkerWords().

+ Here is the caller graph for this function:

◆ GetParamFileNameList()

TList * QwSubsystemArray::GetParamFileNameList ( TString name) const

Get list of parameter files.

Definition at line 807 of file QwSubsystemArray.cc.

808{
809 if (not empty()) {
810
811 TList* return_maps_TList = new TList;
812 return_maps_TList->SetName(name);
813
814 std::map<TString, TString> mapfiles_subsystem;
815
816 for (const_iterator subsys = begin(); subsys != end(); ++subsys)
817 {
818 mapfiles_subsystem = (*subsys)->GetDetectorMaps();
819 for( std::map<TString, TString>::iterator ii= mapfiles_subsystem.begin(); ii!= mapfiles_subsystem.end(); ++ii)
820 {
821 TList *test = new TList;
822 test->SetName((*ii).first);
823 test->AddLast(new TObjString((*ii).second));
824 return_maps_TList -> AddLast(test);
825 }
826 }
827
828 return return_maps_TList;
829 }
830 else {
831 return NULL;
832 }
833};

◆ GetROCIDList()

void QwSubsystemArray::GetROCIDList ( std::vector< ROCID_t > & list)

Get the ROCID list.

Definition at line 489 of file QwSubsystemArray.cc.

490{
491 if (!empty()){
492 std::vector<ROCID_t> tmp;
493 for (iterator subsys = begin(); subsys != end(); ++subsys) {
494 tmp = (*subsys)->GetROCIds();
495 for(auto it = tmp.begin(); it!=tmp.end();it++){
496 if(std::find(list.begin(), list.end(), *it) == list.end() )
497 list.push_back(*it);
498 }
499 }
500 }
501}

Referenced by QwEventBuffer::EncodeSubsystemData().

+ Here is the caller graph for this function:

◆ GetSubsystemByName()

VQwSubsystem * QwSubsystemArray::GetSubsystemByName ( const TString & name)
virtual

Get the subsystem with the specified name.

Get the subsystem in this array with the specified name

Parameters
nameName of the subsystem
Returns
Pointer to the subsystem

Reimplemented in QwSubsystemArrayParity.

Definition at line 348 of file QwSubsystemArray.cc.

349{
350 VQwSubsystem* tmp = NULL;
351 if (!empty()) {
352 // Loop over the subsystems
353 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
354 // Check the name of this subsystem
355 // std::cout<<"QwSubsystemArray::GetSubsystemByName available name=="<<(*subsys)->GetName()<<"== to be compared to =="<<name<<"==\n";
356 if ((*subsys)->GetName() == name) {
357 tmp = (*subsys).get();
358 //std::cout<<"QwSubsystemArray::GetSubsystemByName found a matching name \n";
359 } else {
360 // nothing
361 }
362 }
363 }
364 return tmp;
365}

Referenced by VQwSubsystem::GetSibling(), QwSubsystemArrayParity::GetSubsystemByName(), push_back(), and push_back().

+ Here is the caller graph for this function:

◆ GetSubsystemByType()

std::vector< VQwSubsystem * > QwSubsystemArray::GetSubsystemByType ( const std::string & type)
virtual

Get the list of subsystems of the specified type.

Get the list of subsystems in this array of the specified type

Parameters
typeType of the subsystem
Returns
Vector of subsystems

Definition at line 373 of file QwSubsystemArray.cc.

374{
375 // Vector of subsystem pointers
376 std::vector<VQwSubsystem*> subsys_list;
377
378 // If this array is not empty
379 if (!empty()) {
380
381 // Loop over the subsystems
382 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
383
384 // Test to see if the subsystem inherits from the required type
385 if (VQwSubsystemFactory::InheritsFrom((*subsys).get(),type)) {
386 subsys_list.push_back((*subsys).get());
387 }
388
389 } // end of loop over subsystems
390
391 } // end of if !empty()
392
393 return subsys_list;
394}

Referenced by main().

+ Here is the caller graph for this function:

◆ GetWindowPeriod()

double QwSubsystemArray::GetWindowPeriod ( )
inline

Definition at line 316 of file QwSubsystemArray.h.

316{return fWindowPeriod;};

References fWindowPeriod.

Referenced by main().

+ Here is the caller graph for this function:

◆ HasDataLoaded()

Bool_t QwSubsystemArray::HasDataLoaded ( ) const
inline

Get data loaded flag.

Definition at line 109 of file QwSubsystemArray.h.

109{ return fHasDataLoaded; };

References fHasDataLoaded.

Referenced by ProcessEvent().

+ Here is the caller graph for this function:

◆ InvalidateResolvedDispatchCache()

void QwSubsystemArray::InvalidateResolvedDispatchCache ( )
protected

Definition at line 62 of file QwSubsystemArray.cc.

63{
64 fResolvedSelf.clear();
65 fResolvedPeer = nullptr;
66 fResolvedPeerSlots.clear();
68}

References fResolvedPairCompatible, fResolvedPeer, fResolvedPeerSlots, and fResolvedSelf.

Referenced by push_back(), and push_back().

+ Here is the caller graph for this function:

◆ LoadAllEventRanges()

void QwSubsystemArray::LoadAllEventRanges ( QwOptions & options)

Definition at line 324 of file QwSubsystemArray.cc.

324 {
325
326 std::string fBadEventListFileName = options.GetValue<std::string>("bad-event-list");
327 if (fBadEventListFileName.size() > 0) {
328 QwParameterFile fBadEventListFile(fBadEventListFileName);
329 // If there is an event list, open the next section
330 std::string bad_event_range;
331 while (fBadEventListFile.ReadNextLine(bad_event_range)){
332 // Find next non-whitespace, non-comment, non-empty line, before EOF
333 fBadEventListFile.TrimWhitespace();
334 fBadEventListFile.TrimComment('#');
335 if (fBadEventListFile.LineIsEmpty()) continue;
336 std::pair<UInt_t,UInt_t> aBadEventRange = QwParameterFile::ParseIntRange(":",bad_event_range);
337 fBadEventRange.push_back(aBadEventRange);
338 QwMessage << "Next Bad event range is " << bad_event_range << QwLog::endl;
339 } // end of loop of reading lines.
340 }
341}
T GetValue(const std::string &key)
Get a templated value.
Definition QwOptions.h:236
static std::pair< int, int > ParseIntRange(const std::string &separatorchars, const std::string &range)
Parse a range of integers as #:# where either can be missing.
std::vector< std::pair< UInt_t, UInt_t > > fBadEventRange

References QwLog::endl(), fBadEventRange, QwOptions::GetValue(), QwParameterFile::LineIsEmpty(), QwParameterFile::ParseIntRange(), QwMessage, QwParameterFile::ReadNextLine(), QwParameterFile::TrimComment(), and QwParameterFile::TrimWhitespace().

Referenced by ProcessOptionsSubsystems().

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

◆ LoadSubsystemsFromParameterFile()

void QwSubsystemArray::LoadSubsystemsFromParameterFile ( QwParameterFile & detectors)
protected

Fill the subsystem array with the contents of a map file

Parameters
detectorsMap file

Definition at line 146 of file QwSubsystemArray.cc.

147{
148 // This is how this should work
149 std::unique_ptr<QwParameterFile> preamble;
150 preamble = detectors.ReadSectionPreamble();
151 // Process preamble
152 QwVerbose << "Preamble:" << QwLog::endl;
153 QwVerbose << *preamble << QwLog::endl;
154 if (preamble) preamble.reset();
155
156 std::unique_ptr<QwParameterFile> section;
157 std::string section_name;
158 while ((section = detectors.ReadNextSection(section_name))) {
159
160 // Debugging output of configuration section
161 QwVerbose << "[" << section_name << "]" << QwLog::endl;
162 QwVerbose << *section << QwLog::endl;
163
164 // Determine type and name of subsystem
165 std::string subsys_type = section_name;
166 std::string subsys_name;
167 if (! section->FileHasVariablePair("=","name",subsys_name)) {
168 QwError << "No name defined in section for subsystem " << subsys_type << "." << QwLog::endl;
169 continue;
170 }
171
172 // If subsystem type is explicitly disabled
173 bool disabled_by_type = false;
174 for (size_t i = 0; i < fSubsystemsDisabledByType.size(); i++)
175 if (subsys_type == fSubsystemsDisabledByType.at(i))
176 disabled_by_type = true;
177 if (disabled_by_type) {
178 QwWarning << "Subsystem of type " << subsys_type << " disabled." << QwLog::endl;
179 continue;
180 }
181
182 // If subsystem name is explicitly disabled
183 bool disabled_by_name = false;
184 for (size_t i = 0; i < fSubsystemsDisabledByName.size(); i++)
185 if (subsys_name == fSubsystemsDisabledByName.at(i))
186 disabled_by_name = true;
187 if (disabled_by_name) {
188 QwWarning << "Subsystem with name " << subsys_name << " disabled." << QwLog::endl;
189 continue;
190 }
191
192 // Create subsystem
193 QwMessage << "Creating subsystem of type " << subsys_type << " "
194 << "with name " << subsys_name << "." << QwLog::endl;
195 VQwSubsystem* subsys = 0;
196 try {
197 subsys =
198 VQwSubsystemFactory::Create(subsys_type, subsys_name);
199 } catch (QwException_TypeUnknown&) {
200 QwError << "No support for subsystems of type " << subsys_type << "." << QwLog::endl;
201 // Fall-through to next error for more the psychological effect of many warnings
202 }
203 if (! subsys) {
204 QwError << "Could not create subsystem " << subsys_type << "." << QwLog::endl;
205 continue;
206 }
207
208 // If this subsystem cannot be stored in this array
209 if (! fnCanContain(subsys)) {
210 QwMessage << "Subsystem " << subsys_name << " cannot be stored in this "
211 << "subsystem array." << QwLog::endl;
212 QwMessage << "Deleting subsystem " << subsys_name << " again" << QwLog::endl;
213 delete subsys; subsys = 0;
214 continue;
215 }
216
217 // Pass detector maps
218 subsys->LoadDetectorMaps(*section);
219 // Add to array
220 this->push_back(subsys);
221
222 // Instruct the subsystem to publish variables
223 if (subsys->PublishInternalValues() == kFALSE) {
224 QwError << "Not all variables for " << subsys->GetName()
225 << " could be published!" << QwLog::endl;
226 }
227 }
228}
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
std::unique_ptr< QwParameterFile > ReadNextSection(std::string &secname, const bool keep_header=false)
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.

References QwLog::endl(), fnCanContain, fSubsystemsDisabledByName, fSubsystemsDisabledByType, VQwSubsystem::GetName(), VQwSubsystem::LoadDetectorMaps(), VQwSubsystem::PublishInternalValues(), push_back(), QwError, QwMessage, QwVerbose, QwWarning, QwParameterFile::ReadNextSection(), and QwParameterFile::ReadSectionPreamble().

Referenced by QwSubsystemArray().

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

◆ operator=()

QwSubsystemArray & QwSubsystemArray::operator= ( const QwSubsystemArray & source)

Assignment operator.

Assignment operator

Parameters
sourceSubsystem array to assign to this array
Returns
This subsystem array after assignment

Definition at line 122 of file QwSubsystemArray.cc.

123{
124 this->fCodaEventNumber = source.fCodaEventNumber;
125 this->fCodaEventType = source.fCodaEventType;
126 if (!source.empty()){
127 if (this->size() == source.size()){
128 ResolvePairing(source, "QwSubsystemArray::operator=");
129 for(size_t i=0;i<source.size();i++){
130 if (!fResolvedPairCompatible[i]) continue;
132 }
133 } else {
134 // Array sizes don't match
135 }
136 } else {
137 // The source is empty
138 }
139 return *this;
140}
void ResolvePairing(const QwSubsystemArray &source, const char *context) const

References fCodaEventNumber, fCodaEventType, fResolvedPairCompatible, fResolvedPeerSlots, fResolvedSelf, QwSubsystemArray(), and ResolvePairing().

Referenced by QwSubsystemArrayParity::operator=().

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

◆ PrintInfo()

void QwSubsystemArray::PrintInfo ( ) const

Print some information about the subsystem.

Definition at line 575 of file QwSubsystemArray.cc.

576{
577 if (!empty()) {
578 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
579 (*subsys)->PrintInfo();
580 }
581 }
582}

◆ PrintParamFileList()

void QwSubsystemArray::PrintParamFileList ( ) const

Print list of parameter files.

Definition at line 797 of file QwSubsystemArray.cc.

798{
799 if (not empty()) {
800 for (const_iterator subsys = begin(); subsys != end(); ++subsys)
801 {
802 (*subsys)->PrintDetectorMaps(true);
803 }
804 }
805}

Referenced by main().

+ Here is the caller graph for this function:

◆ ProcessConfigurationBuffer()

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

Process the event buffer for configuration events.

Definition at line 408 of file QwSubsystemArray.cc.

413{
414 if (!empty())
415 for (iterator subsys = begin(); subsys != end(); ++subsys){
416 (*subsys)->ProcessConfigurationBuffer(roc_id, bank_id, buffer, num_words);
417 }
418 return 0;
419}

Referenced by QwEventBuffer::FillSubsystemConfigurationData().

+ Here is the caller graph for this function:

◆ ProcessEvBuffer()

Int_t QwSubsystemArray::ProcessEvBuffer ( const UInt_t event_type,
const ROCID_t roc_id,
const BankID_t bank_id,
UInt_t * buffer,
UInt_t num_words )

Process the event buffer for events.

Definition at line 437 of file QwSubsystemArray.cc.

443{
444 if (!empty()) {
445 SetDataLoaded(kTRUE);
446 for (iterator subsys = begin(); subsys != end(); ++subsys) {
447 (*subsys)->ProcessEvBuffer(event_type, roc_id, bank_id, buffer, num_words);
448 }
449 }
450 return 0;
451}

References SetDataLoaded().

Referenced by QwEventBuffer::FillSubsystemData().

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

◆ ProcessEvent()

void QwSubsystemArray::ProcessEvent ( )

Process the decoded data in this event.

Definition at line 454 of file QwSubsystemArray.cc.

455{
456 if (!empty() && HasDataLoaded()) {
457 std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::ProcessEvent));
458 std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::ExchangeProcessedData));
459 std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::ProcessEvent_2));
460 }
461}
Bool_t HasDataLoaded() const
Get data loaded flag.
virtual void ExchangeProcessedData()
Request processed data from other subsystems for internal use in the second event processing stage....
virtual void ProcessEvent_2()
Process the event data again, including data from other subsystems. Not all derived classes will requ...
virtual void ProcessEvent()=0

References VQwSubsystem::ExchangeProcessedData(), HasDataLoaded(), VQwSubsystem::ProcessEvent(), and VQwSubsystem::ProcessEvent_2().

Referenced by main().

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

◆ ProcessOptions()

void QwSubsystemArray::ProcessOptions ( QwOptions & options)
inline

Process configuration options (default behavior)

Definition at line 118 of file QwSubsystemArray.h.

118{ ProcessOptionsSubsystems(options); };
void ProcessOptionsSubsystems(QwOptions &options)
Process configuration options for all subsystems in the array.

References ProcessOptionsSubsystems().

Referenced by main(), and main().

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

◆ ProcessOptionsSubsystems()

void QwSubsystemArray::ProcessOptionsSubsystems ( QwOptions & options)

Process configuration options for all subsystems in the array.

Handle configuration options for all subsystems in the array

Parameters
optionsOptions

Definition at line 314 of file QwSubsystemArray.cc.

315{
316 LoadAllEventRanges(options);
317
318 for (iterator subsys_iter = begin(); subsys_iter != end(); ++subsys_iter) {
319 VQwSubsystem* subsys = dynamic_cast<VQwSubsystem*>(subsys_iter->get());
320 subsys->ProcessOptions(options);
321 }
322}
void LoadAllEventRanges(QwOptions &options)
virtual void ProcessOptions(QwOptions &)
Process the command line options.

References LoadAllEventRanges(), and VQwSubsystem::ProcessOptions().

Referenced by ProcessOptions().

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

◆ ProcessOptionsToplevel()

void QwSubsystemArray::ProcessOptionsToplevel ( QwOptions & options)

Process configuration options for the subsystem array itself.

Handle configuration options for the subsystem array itself

Parameters
optionsOptions

Definition at line 299 of file QwSubsystemArray.cc.

300{
301 // Filename to use for subsystem creation (single filename could be expanded
302 // to a list)
303 fSubsystemsMapFile = options.GetValue<std::string>("detectors");
304 // Subsystems to disable
305 fSubsystemsDisabledByName = options.GetValueVector<std::string>("disable-by-name");
306 fSubsystemsDisabledByType = options.GetValueVector<std::string>("disable-by-type");
307}
std::vector< T > GetValueVector(const std::string &key)
Get a list of templated values.
Definition QwOptions.h:249

References fSubsystemsDisabledByName, fSubsystemsDisabledByType, fSubsystemsMapFile, QwOptions::GetValue(), and QwOptions::GetValueVector().

Referenced by QwSubsystemArray().

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

◆ push_back() [1/2]

void QwSubsystemArray::push_back ( std::shared_ptr< VQwSubsystem > subsys)

Add the subsystem to this array. Do nothing if the subsystem is null or if there is already a subsystem with that name in the array.

Parameters
subsysSubsystem to add to the array

Definition at line 842 of file QwSubsystemArray.cc.

843{
844
845 if (subsys.get() == NULL) {
846 QwError << "QwSubsystemArray::push_back(): NULL subsys"
847 << QwLog::endl;
848 // This is an empty subsystem...
849 // Do nothing for now.
850
851 } else if (!this->empty() && GetSubsystemByName(subsys->GetName())){
852 // There is already a subsystem with this name!
853 QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetName()
854 << " already exists" << QwLog::endl;
855
856 } else if (!fnCanContain(subsys.get())) {
857 // There is no support for this type of subsystem
858 QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetName()
859 << " is not supported by this subsystem array" << QwLog::endl;
860
861 } else {
862 std::shared_ptr<VQwSubsystem> subsys_tmp(subsys);
863 SubsysPtrs::push_back(subsys_tmp);
865
866 // Set the parent of the subsystem to this array
867 subsys_tmp->SetParent(this);
868
869 // Update the event type mask
870 // Note: Active bits in the mask indicate event types that are accepted
871 fEventTypeMask |= subsys_tmp->GetEventTypeMask();
872
873 // Instruct the subsystem to publish variables
874 if (subsys_tmp->PublishInternalValues() == kFALSE) {
875 QwError << "Not all variables for " << subsys_tmp->GetName()
876 << " could be published!" << QwLog::endl;
877 }
878 }
879}
virtual VQwSubsystem * GetSubsystemByName(const TString &name)
Get the subsystem with the specified name.
void InvalidateResolvedDispatchCache()

References QwLog::endl(), fEventTypeMask, fnCanContain, GetSubsystemByName(), InvalidateResolvedDispatchCache(), and QwError.

+ Here is the call graph for this function:

◆ push_back() [2/2]

void QwSubsystemArray::push_back ( VQwSubsystem * subsys)

Add the subsystem to this array.

Add the subsystem to this array. Do nothing if the subsystem is null or if there is already a subsystem with that name in the array.

Parameters
subsysSubsystem to add to the array

Definition at line 237 of file QwSubsystemArray.cc.

238{
239 if (subsys == NULL) {
240 QwError << "QwSubsystemArray::push_back(): NULL subsys"
241 << QwLog::endl;
242 // This is an empty subsystem...
243 // Do nothing for now.
244
245 } else if (!this->empty() && GetSubsystemByName(subsys->GetName())){
246 // There is already a subsystem with this name!
247 QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetName()
248 << " already exists" << QwLog::endl;
249
250 } else if (!fnCanContain(subsys)) {
251 // There is no support for this type of subsystem
252 QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetName()
253 << " is not supported by this subsystem array" << QwLog::endl;
254
255 } else {
256 std::shared_ptr<VQwSubsystem> subsys_tmp(subsys);
257 SubsysPtrs::push_back(subsys_tmp);
259
260 // Set the parent of the subsystem to this array
261 subsys_tmp->SetParent(this);
262
263 // Update the event type mask
264 // Note: Active bits in the mask indicate event types that are accepted
265 fEventTypeMask |= subsys_tmp->GetEventTypeMask();
266 }
267}

References QwLog::endl(), fEventTypeMask, fnCanContain, VQwSubsystem::GetName(), GetSubsystemByName(), InvalidateResolvedDispatchCache(), and QwError.

Referenced by LoadSubsystemsFromParameterFile().

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

◆ RandomizeEventData()

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

Randomize the data in this event.

Definition at line 472 of file QwSubsystemArray.cc.

473{
474 if (!empty())
475 for (iterator subsys = begin(); subsys != end(); ++subsys) {
476 (*subsys)->RandomizeEventData(helicity, time);
477 }
478}

Referenced by main().

+ Here is the caller graph for this function:

◆ ResolvePairing()

void QwSubsystemArray::ResolvePairing ( const QwSubsystemArray & source,
const char * context ) const
protected

Definition at line 85 of file QwSubsystemArray.cc.

86{
88 const Bool_t cache_valid =
89 (fResolvedPeer == &source)
90 && (fResolvedPeerSlots.size() == source.size())
91 && (fResolvedPairCompatible.size() == source.size());
92 if (cache_valid) return;
93
94 fResolvedPeer = &source;
95 fResolvedPeerSlots.assign(source.size(), nullptr);
96 fResolvedPairCompatible.assign(source.size(), kFALSE);
97 if (this->size() != source.size()) return;
98
99 for (size_t i = 0; i < source.size(); ++i) {
100 VQwSubsystem* ptr1 = fResolvedSelf[i];
101 VQwSubsystem* ptr2 = source.at(i).get();
102 fResolvedPeerSlots[i] = ptr2;
103 if (ptr1 == nullptr || ptr2 == nullptr) continue;
104
105 if (typeid(*ptr1) == typeid(*ptr2)) {
106 fResolvedPairCompatible[i] = kTRUE;
107 } else {
108 QwError << context << " types do not match at slot " << i << QwLog::endl;
109 QwError << " typeid(*ptr1)=" << typeid(*ptr1).name()
110 << " but typeid(*ptr2)=" << typeid(*ptr2).name()
111 << QwLog::endl;
112 }
113 }
114}
void BuildResolvedSelf() const

References BuildResolvedSelf(), QwLog::endl(), fResolvedPairCompatible, fResolvedPeer, fResolvedPeerSlots, fResolvedSelf, QwError, and QwSubsystemArray().

Referenced by operator=().

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

◆ SetCodaEventNumber()

void QwSubsystemArray::SetCodaEventNumber ( UInt_t evtnum)
inline

Set the internal record of the CODA event number.

Definition at line 80 of file QwSubsystemArray.h.

80{ fCodaEventNumber = evtnum; };

References fCodaEventNumber.

Referenced by ClearEventData(), and QwEventBuffer::FillSubsystemData().

+ Here is the caller graph for this function:

◆ SetCodaEventType()

void QwSubsystemArray::SetCodaEventType ( UInt_t evttype)
inline

Set the internal record of the CODA event type.

Definition at line 82 of file QwSubsystemArray.h.

82{ fCodaEventType = evttype; };

References fCodaEventType.

Referenced by ClearEventData(), and QwEventBuffer::FillSubsystemData().

+ Here is the caller graph for this function:

◆ SetCodaRunNumber()

void QwSubsystemArray::SetCodaRunNumber ( UInt_t runnum)
inline

Set the internal record of the CODA run number.

Definition at line 76 of file QwSubsystemArray.h.

76{ fCodaRunNumber = runnum; };

References fCodaRunNumber.

Referenced by QwEventBuffer::FillSubsystemData().

+ Here is the caller graph for this function:

◆ SetCodaSegmentNumber()

void QwSubsystemArray::SetCodaSegmentNumber ( UInt_t segnum)
inline

Set the internal record of the CODA segment number.

Definition at line 78 of file QwSubsystemArray.h.

78{ fCodaSegmentNumber = segnum; };

References fCodaSegmentNumber.

Referenced by QwEventBuffer::FillSubsystemData().

+ Here is the caller graph for this function:

◆ SetDataLoaded()

void QwSubsystemArray::SetDataLoaded ( const Bool_t flag)
inline

Set data loaded flag.

Definition at line 107 of file QwSubsystemArray.h.

107{ fHasDataLoaded = flag; };

References fHasDataLoaded.

Referenced by ClearEventData(), and ProcessEvBuffer().

+ Here is the caller graph for this function:

◆ SetEventTypeMask()

void QwSubsystemArray::SetEventTypeMask ( const UInt_t mask)
inline

Set event type mask.

Definition at line 93 of file QwSubsystemArray.h.

93{ fEventTypeMask = mask; };

References fEventTypeMask.

◆ ShareHistograms()

void QwSubsystemArray::ShareHistograms ( const QwSubsystemArray & source)

Share the histograms with another subsystem.

Definition at line 529 of file QwSubsystemArray.cc.

530{
531 if (!empty() && !source.empty()) {
532 if (this->size() == source.size()) {
533 for (size_t i = 0; i < source.size(); ++i) {
534 this->at(i)->ShareHistograms(source.at(i).get());
535 }
536 }
537 }
538}

References QwSubsystemArray().

Referenced by main().

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

◆ UpdateEventTypeMask()

UInt_t QwSubsystemArray::UpdateEventTypeMask ( )
inline

Update the event type mask from the subsystems.

Definition at line 97 of file QwSubsystemArray.h.

97 {
98 for (iterator subsys_iter = begin(); subsys_iter != end(); ++subsys_iter) {
99 VQwSubsystem* subsys = dynamic_cast<VQwSubsystem*>(subsys_iter->get());
100 fEventTypeMask |= subsys->GetEventTypeMask();
101 }
102 return fEventTypeMask;
103 };
UInt_t GetEventTypeMask() const
Get event type mask.

References fEventTypeMask, and VQwSubsystem::GetEventTypeMask().

+ Here is the call graph for this function:

Field Documentation

◆ fBadEventRange

std::vector< std::pair<UInt_t,UInt_t> > QwSubsystemArray::fBadEventRange
protected

◆ fCodaEventNumber

◆ fCodaEventType

UInt_t QwSubsystemArray::fCodaEventType
protected

CODA event type as provided by QwEventBuffer.

Definition at line 271 of file QwSubsystemArray.h.

Referenced by ConstructBranch(), ConstructBranch(), GetCodaEventType(), operator=(), QwSubsystemArray(), and SetCodaEventType().

◆ fCodaRunNumber

UInt_t QwSubsystemArray::fCodaRunNumber
protected

Index of this data element in root tree.

CODA run number as provided by QwEventBuffer

Definition at line 268 of file QwSubsystemArray.h.

Referenced by GetCodaRunNumber(), QwSubsystemArray(), and SetCodaRunNumber().

◆ fCodaSegmentNumber

UInt_t QwSubsystemArray::fCodaSegmentNumber
protected

CODA segment number as provided by QwEventBuffer.

Definition at line 269 of file QwSubsystemArray.h.

Referenced by GetCodaSegmentNumber(), QwSubsystemArray(), and SetCodaSegmentNumber().

◆ fEventTypeMask

UInt_t QwSubsystemArray::fEventTypeMask
protected

◆ fHasDataLoaded

Bool_t QwSubsystemArray::fHasDataLoaded
protected

Has this array gotten data to be processed?

Definition at line 274 of file QwSubsystemArray.h.

Referenced by HasDataLoaded(), QwSubsystemArray(), and SetDataLoaded().

◆ fnCanContain

CanContainFn QwSubsystemArray::fnCanContain
protected

Function to determine which subsystems we can accept.

Definition at line 278 of file QwSubsystemArray.h.

Referenced by LoadSubsystemsFromParameterFile(), push_back(), push_back(), QwSubsystemArray(), and QwSubsystemArray().

◆ fResolvedPairCompatible

std::vector<Bool_t> QwSubsystemArray::fResolvedPairCompatible
mutableprotected

◆ fResolvedPeer

const QwSubsystemArray* QwSubsystemArray::fResolvedPeer = nullptr
mutableprotected

◆ fResolvedPeerSlots

std::vector<VQwSubsystem*> QwSubsystemArray::fResolvedPeerSlots
mutableprotected

◆ fResolvedSelf

std::vector<VQwSubsystem*> QwSubsystemArray::fResolvedSelf
mutableprotected

◆ fSubsystemsDisabledByName

std::vector<std::string> QwSubsystemArray::fSubsystemsDisabledByName
private

List of disabled types.

Definition at line 305 of file QwSubsystemArray.h.

Referenced by LoadSubsystemsFromParameterFile(), ProcessOptionsToplevel(), and QwSubsystemArray().

◆ fSubsystemsDisabledByType

std::vector<std::string> QwSubsystemArray::fSubsystemsDisabledByType
private

List of disabled names.

Definition at line 306 of file QwSubsystemArray.h.

Referenced by LoadSubsystemsFromParameterFile(), ProcessOptionsToplevel(), and QwSubsystemArray().

◆ fSubsystemsMapFile

std::string QwSubsystemArray::fSubsystemsMapFile
private

Filename of the global detector map.

Definition at line 304 of file QwSubsystemArray.h.

Referenced by ProcessOptionsToplevel(), QwSubsystemArray(), and QwSubsystemArray().

◆ fTreeArrayIndex

size_t QwSubsystemArray::fTreeArrayIndex
protected

Definition at line 265 of file QwSubsystemArray.h.

Referenced by ConstructBranchAndVector(), FillTreeVector(), and QwSubsystemArray().

◆ fWindowPeriod

double QwSubsystemArray::fWindowPeriod
protected

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