QwAnalysis
QwSubsystemArray Class Reference

#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. More...
 
 QwSubsystemArray (const QwSubsystemArray &source)
 Copy constructor by reference. More...
 
virtual ~QwSubsystemArray ()
 Virtual destructor. More...
 
void SetCodaRunNumber (UInt_t runnum)
 Set the internal record of the CODA run number. More...
 
void SetCodaSegmentNumber (UInt_t segnum)
 Set the internal record of the CODA segment number. More...
 
void SetCodaEventNumber (UInt_t evtnum)
 Set the internal record of the CODA event number. More...
 
void SetCodaEventType (UInt_t evttype)
 Set the internal record of the CODA event type. More...
 
UInt_t GetCodaRunNumber () const
 Get the internal record of the CODA run number. More...
 
UInt_t GetCodaSegmentNumber () const
 Get the internal record of the CODA segment number. More...
 
UInt_t GetCodaEventNumber () const
 Get the internal record of the CODA event number. More...
 
UInt_t GetCodaEventType () const
 Get the internal record of the CODA event type. More...
 
void SetCleanParameters (Double_t cleanparameter[3])
 Set the internal record of the CODA event number. More...
 
void SetEventTypeMask (const UInt_t mask)
 Set event type mask. More...
 
UInt_t GetEventTypeMask () const
 Get event type mask. More...
 
UInt_t UpdateEventTypeMask ()
 Update the event type mask from the subsystems. More...
 
void SetDataLoaded (const Bool_t flag)
 Set data loaded flag. More...
 
Bool_t HasDataLoaded () const
 Get data loaded flag. More...
 
void ProcessOptionsToplevel (QwOptions &options)
 Process configuration options for the subsystem array itself. More...
 
void ProcessOptionsSubsystems (QwOptions &options)
 Process configuration options for all subsystems in the array. More...
 
void ProcessOptions (QwOptions &options)
 Process configuration options (default behavior) More...
 
void push_back (VQwSubsystem *subsys)
 Add the subsystem to this array. More...
 
virtual VQwSubsystemGetSubsystemByName (const TString &name)
 Get the subsystem with the specified name. More...
 
virtual std::vector
< VQwSubsystem * > 
GetSubsystemByType (const std::string &type)
 Get the list of subsystems of the specified type. More...
 
void ClearEventData ()
 
Int_t ProcessConfigurationBuffer (const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
 Process the event buffer for configuration events. More...
 
Int_t ProcessEvBuffer (const UInt_t event_type, const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
 Process the event buffer for events. More...
 
void RandomizeEventData (int helicity=0, double time=0.0)
 Randomize the data in this event. More...
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 Encode the data in this event. More...
 
void ProcessEvent ()
 Process the decoded data in this event. More...
 
void AtEndOfEventLoop ()
 Perform actions at the end of the event loop. More...
 
Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from other subsystem arrays. More...
 
const VQwHardwareChannelReturnInternalValue (const TString &name) const
 Retrieve the variable name from subsystems in this subsystem array. More...
 
Bool_t ReturnInternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from subsystems in this subsystem array. More...
 
Bool_t PublishInternalValue (const TString name, const TString desc, const VQwSubsystem *subsys, const VQwHardwareChannel *element)
 Publish the value name with description from a subsystem in this array. More...
 
void ListPublishedValues () const
 List the published values and description in this subsystem array. More...
 
void PrintParamFileList () const
 Print list of parameter files. More...
 
TList * GetParamFileNameList (TString name) const
 Get list of parameter files. More...
 
void PrintInfo () const
 Print some information about the subsystem. More...
 
void push_back (boost::shared_ptr< VQwSubsystem > subsys)
 
Histogram construction and maintenance
void ConstructHistograms ()
 Construct the histograms for this subsystem. More...
 
void ConstructHistograms (TDirectory *folder)
 Construct the histograms for this subsystem in a folder. More...
 
void ConstructHistograms (TDirectory *folder, TString &prefix)
 Construct the histograms for this subsystem in a folder with a prefix. More...
 
void FillHistograms ()
 Fill the histograms for this subsystem. More...
 
void ShareHistograms (const QwSubsystemArray &source)
 Share the histograms with another subsystem. More...
 
Tree and vector construction and maintenance
void ConstructBranchAndVector (TTree *tree, std::vector< Double_t > &values)
 Construct the tree and vector for this subsystem. More...
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 Construct a branch and vector for this subsystem with a prefix. More...
 
void ConstructBranch (TTree *tree, TString &prefix)
 Construct a branch for this subsystem with a prefix. More...
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &trim_file)
 Construct a branch for this subsystem with a prefix after tree leave trimming. More...
 
void FillTreeVector (std::vector< Double_t > &values) const
 Fill the vector for this subsystem. More...
 
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.

void ConstructTree ()
 Construct the tree for this subsystem. More...
 
void ConstructTree (TDirectory *folder)
 Construct the tree for this subsystem in a folder. More...
 
void ConstructTree (TDirectory *folder, TString &prefix)
 Construct the tree for this subsystem in a folder with a prefix. More...
 
void FillTree ()
 Fill the tree for this subsystem. More...
 
void DeleteTree ()
 Delete the tree for this subsystem. More...
 

Static Public Member Functions

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

Protected Member Functions

void LoadSubsystemsFromParameterFile (QwParameterFile &detectors)
 

Static Protected Member Functions

static Bool_t CanContain (VQwSubsystem *subsys)
 Test whether this subsystem array can contain a particular subsystem. More...
 

Protected Attributes

size_t fTreeArrayIndex
 
UInt_t fCodaRunNumber
 Index of this data element in root tree. More...
 
UInt_t fCodaSegmentNumber
 CODA segment number as provided by QwEventBuffer. More...
 
UInt_t fCodaEventNumber
 CODA event number as provided by QwEventBuffer. More...
 
UInt_t fCodaEventType
 CODA event type as provided by QwEventBuffer. More...
 
Double_t fCleanParameter [3]
 
UInt_t fEventTypeMask
 Mask of event types. More...
 
Bool_t fHasDataLoaded
 Has this array gotten data to be processed? More...
 
CanContainFn fnCanContain
 Function to determine which subsystems we can accept. More...
 

Private Types

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

Private Member Functions

 QwSubsystemArray ()
 Private default constructor. More...
 
Bool_t PublishByRequest (TString device_name)
 Try to publish an internal variable matching the submitted name. More...
 
VQwHardwareChannelReturnInternalValueForFriends (const TString &name) const
 Retrieve the variable name from subsystems in this subsystem array. More...
 

Private Attributes

std::map< TString, const
VQwHardwareChannel * > 
fPublishedValuesDataElement
 Published values. More...
 
std::map< TString, const
VQwSubsystem * > 
fPublishedValuesSubsystem
 
std::map< TString, TString > fPublishedValuesDescription
 
std::string fSubsystemsMapFile
 Filename of the global detector map. More...
 
std::vector< std::string > fSubsystemsDisabledByName
 List of disabled types. More...
 
std::vector< std::string > fSubsystemsDisabledByType
 List of disabled names. More...
 

Friends

class QwRegression
 Friend with regression class who needs write access to data. More...
 

Additional Inherited Members

- Data Fields inherited from std::vector< T >
elements
 STL member. More...
 

Detailed Description

Definition at line 32 of file QwSubsystemArray.h.

Member Typedef Documentation

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

Definition at line 43 of file QwSubsystemArray.h.

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

Definition at line 34 of file QwSubsystemArray.h.

Constructor & Destructor Documentation

QwSubsystemArray::QwSubsystemArray ( )
private

Private default constructor.

QwSubsystemArray::QwSubsystemArray ( QwOptions options,
CanContainFn  myCanContain 
)

Constructor with options.

Todo:
TODO (wdc) QwVQWK_Channel necessary due to explicit cast in ReturnInternalValue (yuck)

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

Definition at line 26 of file QwSubsystemArray.cc.

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

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

+ Here is the call graph for this function:

QwSubsystemArray::QwSubsystemArray ( const QwSubsystemArray source)

Copy constructor by reference.

Copy constructor by reference

Parameters
sourceSource subsystem array

Definition at line 39 of file QwSubsystemArray.cc.

References QwLog::endl(), fPublishedValuesDataElement, fPublishedValuesDescription, fPublishedValuesSubsystem, push_back(), and QwError.

47  fnCanContain(source.fnCanContain),
51 {
55 
56  // Make copies of all subsystems rather than copying just the pointers
57  for (const_iterator subsys = source.begin(); subsys != source.end(); ++subsys) {
58  this->push_back(subsys->get()->Clone());
59  // Instruct the subsystem to publish variables
60  if (this->back()->PublishInternalValues() == kFALSE) {
61  QwError << "Not all variables for " << this->back()->GetSubsystemName()
62  << " could be published!" << QwLog::endl;
63  }
64  }
65 }
std::map< TString, const VQwSubsystem * > fPublishedValuesSubsystem
UInt_t fCodaRunNumber
Index of this data element in root tree.
std::map< TString, TString > fPublishedValuesDescription
void push_back(VQwSubsystem *subsys)
Add the subsystem to this array.
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.
UInt_t fCodaSegmentNumber
CODA segment number as provided by QwEventBuffer.
std::map< TString, const VQwHardwareChannel * > fPublishedValuesDataElement
Published values.
std::string fSubsystemsMapFile
Filename of the global detector map.
UInt_t fCodaEventType
CODA event type as provided by QwEventBuffer.
Bool_t fHasDataLoaded
Has this array gotten data to be processed?
CanContainFn fnCanContain
Function to determine which subsystems we can accept.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
std::vector< std::string > fSubsystemsDisabledByType
List of disabled names.
std::vector< std::string > fSubsystemsDisabledByName
List of disabled types.
UInt_t fEventTypeMask
Mask of event types.
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

virtual QwSubsystemArray::~QwSubsystemArray ( )
inlinevirtual

Virtual destructor.

Definition at line 57 of file QwSubsystemArray.h.

57 { };

Member Function Documentation

void QwSubsystemArray::AtEndOfEventLoop ( )

Perform actions at the end of the event loop.

Definition at line 364 of file QwSubsystemArray.cc.

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

Referenced by main().

365 {
366  QwDebug << "QwSubsystemArray at end of event loop" << QwLog::endl;
367  if (!empty()) {
368  std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::AtEndOfEventLoop));
369  }
370 }
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
virtual void AtEndOfEventLoop()
Perform actions at the end of the event loop.
Definition: VQwSubsystem.h:198

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Bool_t QwSubsystemArray::CanContain ( VQwSubsystem subsys)
inlinestaticprotected

Test whether this subsystem array can contain a particular subsystem.

Definition at line 280 of file QwSubsystemArray.h.

References QwLog::endl(), and QwError.

280  {
281  if (subsys == 0) {
282  QwError << "Zero pointer passed!" << QwLog::endl;
283  }
284  // should never occur
285  return kFALSE;
286  };
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

void QwSubsystemArray::ClearEventData ( )

Definition at line 315 of file QwSubsystemArray.cc.

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

Referenced by QwHelicityPattern::CalculateAsymmetry(), QwHelicityPattern::ClearBurstSum(), QwHelicityPattern::ClearEventData(), QwHelicityPattern::ClearRunningSum(), QwEventBuffer::FillSubsystemData(), and main().

316 {
317  if (!empty()) {
318  SetDataLoaded(kFALSE);
320  SetCodaEventType(0);
321  std::for_each(begin(), end(),
322  boost::mem_fn(&VQwSubsystem::ClearEventData));
323  }
324 }
void SetCodaEventNumber(UInt_t evtnum)
Set the internal record of the CODA event number.
void SetDataLoaded(const Bool_t flag)
Set data loaded flag.
void SetCodaEventType(UInt_t evttype)
Set the internal record of the CODA event type.
virtual void ClearEventData()=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 506 of file QwSubsystemArray.cc.

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

Referenced by QwHelicityPattern::ConstructBranch().

507 {
508  // Only MPS tree should contain event number and type
509  if (prefix == "" || prefix == "yield_") {
510  tree->Branch("CodaEventNumber",&fCodaEventNumber,"CodaEventNumber/I");
511  tree->Branch("CodaEventType",&fCodaEventType,"CodaEventType/I");
512  }
513 
514  for (iterator subsys = begin(); subsys != end(); ++subsys) {
515  VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
516  subsys_ptr->ConstructBranch(tree, prefix);
517  }
518 }
virtual void ConstructBranch(TTree *tree, TString &prefix)=0
Construct the branch and tree vector.
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.
UInt_t fCodaEventType
CODA event type as provided by QwEventBuffer.
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 527 of file QwSubsystemArray.cc.

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

531 {
532  QwMessage << " QwSubsystemArray::ConstructBranch " << QwLog::endl;
533 
534  QwParameterFile* preamble;
535  QwParameterFile* nextsection;
536  preamble = trim_file.ReadSectionPreamble();
537 
538  // Process preamble
539  QwVerbose << "QwSubsystemArrayTracking::ConstructBranch Preamble:" << QwLog::endl;
540  QwVerbose << *preamble << QwLog::endl;
541 
542  if (prefix == "" || prefix == "yield_") {
543  tree->Branch("CodaEventNumber",&fCodaEventNumber,"CodaEventNumber/I");
544  tree->Branch("CodaEventType",&fCodaEventType,"CodaEventType/I");
545  }
546 
547  for (iterator subsys = begin(); subsys != end(); ++subsys) {
548  VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
549 
550  TString subsysname = subsys_ptr->GetSubsystemName();
551  //QwMessage << "Tree leaves created for " << subsysname << QwLog::endl;
552 
553  if (trim_file.FileHasSectionHeader(subsysname)) {
554  // This section contains modules and their channels to be included in the tree
555  nextsection = trim_file.ReadUntilNextSection();
556  subsys_ptr->ConstructBranch(tree, prefix, *nextsection);
557  QwMessage << "Tree leaves created for " << subsysname << QwLog::endl;
558  } else
559  QwMessage << "No tree leaves created for " << subsysname << QwLog::endl;
560  }
561 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
virtual void ConstructBranch(TTree *tree, TString &prefix)=0
Construct the branch and tree vector.
Bool_t FileHasSectionHeader(const std::string &secname)
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.
#define QwVerbose
Predefined log drain for verbose messages.
Definition: QwLog.h:55
UInt_t fCodaEventType
CODA event type as provided by QwEventBuffer.
QwParameterFile * ReadUntilNextSection(const bool add_current_line=false)
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
QwParameterFile * ReadSectionPreamble()
Rewinds to the start and read until it finds next section header.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

void QwSubsystemArray::ConstructBranchAndVector ( TTree *  tree,
std::vector< Double_t > &  values 
)
inline

Construct the tree and vector for this subsystem.

Definition at line 215 of file QwSubsystemArray.h.

Referenced by QwSubsystemArrayParity::ConstructBranchAndVector().

215  {
216  TString tmpstr("");
217  ConstructBranchAndVector(tree,tmpstr,values);
218  };
void ConstructBranchAndVector(TTree *tree, std::vector< Double_t > &values)
Construct the tree and vector for this subsystem.

+ Here is the caller graph for this function:

void QwSubsystemArray::ConstructBranchAndVector ( TTree *  tree,
TString &  prefix,
std::vector< Double_t > &  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 470 of file QwSubsystemArray.cc.

References VQwSubsystem::ConstructBranchAndVector(), and fTreeArrayIndex.

474 {
475  fTreeArrayIndex = values.size();
476 
477  // Each tree should only contain event number and type once, but will
478  // still reserve space in the values vector, so we don't need to modify
479  // FillTreeVector().
480  values.push_back(0.0);
481  values.push_back(0.0);
482  values.push_back(0.0);
483  values.push_back(0.0);
484  values.push_back(0.0);
485  if (prefix == "" || prefix == "yield_") {
486  tree->Branch("CodaEventNumber",&(values[fTreeArrayIndex]),"CodaEventNumber/D");
487  tree->Branch("CodaEventType",&(values[fTreeArrayIndex+1]),"CodaEventType/D");
488  tree->Branch("Coda_CleanData",&(values[fTreeArrayIndex+2]),"Coda_CleanData/D");
489  tree->Branch("Coda_ScanData1",&(values[fTreeArrayIndex+3]),"Coda_ScanData1/D");
490  tree->Branch("Coda_ScanData2",&(values[fTreeArrayIndex+4]),"Coda_ScanData2/D");
491  }
492 
493  for (iterator subsys = begin(); subsys != end(); ++subsys) {
494  VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
495  subsys_ptr->ConstructBranchAndVector(tree, prefix, values);
496  }
497 
498 }
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)=0
Construct the branch and tree vector.

+ Here is the call graph for this function:

void QwSubsystemArray::ConstructHistograms ( )
inline

Construct the histograms for this subsystem.

Definition at line 195 of file QwSubsystemArray.h.

Referenced by QwHelicityPattern::ConstructHistograms(), ConstructHistograms(), and main().

195  {
196  ConstructHistograms((TDirectory*) NULL);
197  };
void ConstructHistograms()
Construct the histograms for this subsystem.

+ Here is the caller graph for this function:

void QwSubsystemArray::ConstructHistograms ( TDirectory *  folder)
inline

Construct the histograms for this subsystem in a folder.

Definition at line 199 of file QwSubsystemArray.h.

References ConstructHistograms().

199  {
200  TString prefix = "";
201  ConstructHistograms(folder, prefix);
202  };
void ConstructHistograms()
Construct the histograms for this subsystem.

+ Here is the call graph for this function:

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

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

Definition at line 392 of file QwSubsystemArray.cc.

393 {
394  if (!empty()) {
395  for (iterator subsys = begin(); subsys != end(); ++subsys){
396  (*subsys)->ConstructHistograms(folder,prefix);
397  }
398  }
399 }
void QwSubsystemArray::ConstructTree ( )
inline

Construct the tree for this subsystem.

Definition at line 236 of file QwSubsystemArray.h.

Referenced by ConstructTree(), and main().

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

+ Here is the caller graph for this function:

void QwSubsystemArray::ConstructTree ( TDirectory *  folder)
inline

Construct the tree for this subsystem in a folder.

Definition at line 240 of file QwSubsystemArray.h.

References ConstructTree().

240  {
241  TString prefix = "";
242  ConstructTree(folder, prefix);
243  };
void ConstructTree()
Construct the tree for this subsystem.

+ Here is the call graph for this function:

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 424 of file QwSubsystemArray.cc.

425 {
426  if (!empty()) {
427  for (iterator subsys = begin(); subsys != end(); ++subsys){
428  (*subsys)->ConstructTree(folder, prefix);
429  }
430  }
431 }
void QwSubsystemArray::DefineOptions ( QwOptions options)
static

Define configuration options for global array.

Define configuration options for global array

Parameters
optionsOptions

Definition at line 208 of file QwSubsystemArray.cc.

References QwOptions::AddOptions().

Referenced by QwOptions::DefineOptions().

209 {
210  options.AddOptions()("detectors",
211  po::value<std::string>()->default_value("detectors.map"),
212  "map file with detectors to include");
213 
214  // Versions of boost::program_options below 1.39.0 have a bug in multitoken processing
215 #if BOOST_VERSION < 103900
216  options.AddOptions()("disable-by-type",
217  po::value<std::vector <std::string> >(),
218  "subsystem types to disable");
219  options.AddOptions()("disable-by-name",
220  po::value<std::vector <std::string> >(),
221  "subsystem names to disable");
222 #else // BOOST_VERSION >= 103900
223  options.AddOptions()("disable-by-type",
224  po::value<std::vector <std::string> >()->multitoken(),
225  "subsystem types to disable");
226  options.AddOptions()("disable-by-name",
227  po::value<std::vector <std::string> >()->multitoken(),
228  "subsystem names to disable");
229 #endif // BOOST_VERSION
230 }
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:164

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::DeleteTree ( )

Delete the tree for this subsystem.

Delete the tree for this subsystem

Definition at line 445 of file QwSubsystemArray.cc.

References VQwSubsystem::DeleteTree().

446 {
447  if (!empty())
448  std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::DeleteTree));
449 }
virtual void DeleteTree()
Delete the tree for this subsystem.
Definition: VQwSubsystem.h:275

+ Here is the call graph for this function:

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

Encode the data in this event.

Definition at line 382 of file QwSubsystemArray.cc.

Referenced by QwEventBuffer::EncodeSubsystemData().

383 {
384  if (!empty())
385  for (iterator subsys = begin(); subsys != end(); ++subsys) {
386  (*subsys)->EncodeEventData(buffer);
387  }
388 }

+ Here is the caller graph for this function:

void QwSubsystemArray::FillHistograms ( )

Fill the histograms for this subsystem.

Definition at line 401 of file QwSubsystemArray.cc.

References VQwSubsystem::FillHistograms().

Referenced by QwSubsystemArrayParity::FillHistograms().

402 {
403  if (!empty())
404  std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::FillHistograms));
405 }
virtual void FillHistograms()=0
Fill the histograms for this subsystem.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::FillTree ( )

Fill the tree for this subsystem.

Fill the tree for this subsystem

Definition at line 436 of file QwSubsystemArray.cc.

References VQwSubsystem::FillTree().

Referenced by main().

437 {
438  if (!empty())
439  std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::FillTree));
440 }
virtual void FillTree()
Fill the tree for this subsystem.
Definition: VQwSubsystem.h:273

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::FillTreeVector ( std::vector< Double_t > &  values) const

Fill the vector for this subsystem.

Fill the tree vector

Parameters
valuesVector of values

Definition at line 568 of file QwSubsystemArray.cc.

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

Referenced by QwSubsystemArrayParity::FillTreeVector().

569 {
570  // Fill the event number and event type
571  size_t index = fTreeArrayIndex;
572  values[index++] = this->GetCodaEventNumber();
573  values[index++] = this->GetCodaEventType();
574  values[index++] = this->fCleanParameter[0];
575  values[index++] = this->fCleanParameter[1];
576  values[index++] = this->fCleanParameter[2];
577 
578 
579  // Fill the subsystem data
580  for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
581  VQwSubsystem* subsys_ptr = dynamic_cast<VQwSubsystem*>(subsys->get());
582  subsys_ptr->FillTreeVector(values);
583  }
584 }
virtual void FillTreeVector(std::vector< Double_t > &values) const =0
Fill the tree vector.
UInt_t GetCodaEventType() const
Get the internal record of the CODA event type.
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
UInt_t GetCodaEventNumber() const
Get the internal record of the CODA event number.
Double_t fCleanParameter[3]

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt_t QwSubsystemArray::GetCodaEventNumber ( ) const
inline

Get the internal record of the CODA event number.

Definition at line 72 of file QwSubsystemArray.h.

References fCodaEventNumber.

Referenced by QwMainDetector::AddSoftwareMeantimeToHits(), QwTriggerScintillator::AddSoftwareMeantimeToHits(), and FillTreeVector().

72 { return fCodaEventNumber; };
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.

+ Here is the caller graph for this function:

UInt_t QwSubsystemArray::GetCodaEventType ( ) const
inline

Get the internal record of the CODA event type.

Definition at line 74 of file QwSubsystemArray.h.

References fCodaEventType.

Referenced by FillTreeVector().

74 { return fCodaEventType; };
UInt_t fCodaEventType
CODA event type as provided by QwEventBuffer.

+ Here is the caller graph for this function:

UInt_t QwSubsystemArray::GetCodaRunNumber ( ) const
inline

Get the internal record of the CODA run number.

Definition at line 68 of file QwSubsystemArray.h.

References fCodaRunNumber.

68 { return fCodaRunNumber; };
UInt_t fCodaRunNumber
Index of this data element in root tree.
UInt_t QwSubsystemArray::GetCodaSegmentNumber ( ) const
inline

Get the internal record of the CODA segment number.

Definition at line 70 of file QwSubsystemArray.h.

References fCodaSegmentNumber.

70 { return fCodaSegmentNumber; };
UInt_t fCodaSegmentNumber
CODA segment number as provided by QwEventBuffer.
UInt_t QwSubsystemArray::GetEventTypeMask ( ) const
inline

Get event type mask.

Definition at line 87 of file QwSubsystemArray.h.

References fEventTypeMask.

Referenced by QwEventBuffer::FillSubsystemData().

87 { return fEventTypeMask; };
UInt_t fEventTypeMask
Mask of event types.

+ Here is the caller graph for this function:

TList * QwSubsystemArray::GetParamFileNameList ( TString  name) const

Get list of parameter files.

Definition at line 789 of file QwSubsystemArray.cc.

Referenced by QwParityDB::FillParameterFiles().

790 {
791  if (not empty()) {
792 
793  TList* return_maps_TList = new TList;
794  return_maps_TList->SetName(name);
795 
796  std::map<TString, TString> mapfiles_subsystem;
797 
798  for (const_iterator subsys = begin(); subsys != end(); ++subsys)
799  {
800  mapfiles_subsystem = (*subsys)->GetDetectorMaps();
801  for( std::map<TString, TString>::iterator ii= mapfiles_subsystem.begin(); ii!= mapfiles_subsystem.end(); ++ii)
802  {
803  TList *test = new TList;
804  test->SetName((*ii).first);
805  test->AddLast(new TObjString((*ii).second));
806  return_maps_TList -> AddLast(test);
807  }
808  }
809 
810  return return_maps_TList;
811  }
812  else {
813  return NULL;
814  }
815 };

+ Here is the caller graph for this function:

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

Get the subsystem with the specified name.

Get the subsystem in this array with the spcified name

Parameters
nameName of the subsystem
Returns
Pointer to the subsystem

Reimplemented in QwSubsystemArrayParity, and QwSubsystemArrayTracking.

Definition at line 266 of file QwSubsystemArray.cc.

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

267 {
268  VQwSubsystem* tmp = NULL;
269  if (!empty()) {
270  // Loop over the subsystems
271  for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
272  // Check the name of this subsystem
273  // std::cout<<"QwSubsystemArray::GetSubsystemByName available name=="<<(*subsys)->GetSubsystemName()<<"== to be compared to =="<<name<<"==\n";
274  if ((*subsys)->GetSubsystemName() == name) {
275  tmp = (*subsys).get();
276  //std::cout<<"QwSubsystemArray::GetSubsystemByName found a matching name \n";
277  } else {
278  // nothing
279  }
280  }
281  }
282  return tmp;
283 }
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59

+ Here is the caller graph for this function:

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 291 of file QwSubsystemArray.cc.

292 {
293  // Vector of subsystem pointers
294  std::vector<VQwSubsystem*> subsys_list;
295 
296  // If this array is not empty
297  if (!empty()) {
298 
299  // Loop over the subsystems
300  for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
301 
302  // Test to see if the subsystem inherits from the required type
303  if (VQwSubsystemFactory::InheritsFrom((*subsys).get(),type)) {
304  subsys_list.push_back((*subsys).get());
305  }
306 
307  } // end of loop over subsystems
308 
309  } // end of if !empty()
310 
311  return subsys_list;
312 }
Bool_t QwSubsystemArray::HasDataLoaded ( ) const
inline

Get data loaded flag.

Definition at line 101 of file QwSubsystemArray.h.

References fHasDataLoaded.

Referenced by ProcessEvent().

101 { return fHasDataLoaded; };
Bool_t fHasDataLoaded
Has this array gotten data to be processed?

+ Here is the caller graph for this function:

void QwSubsystemArray::ListPublishedValues ( ) const

List the published values and description in this subsystem array.

List the published values and description in this subsystem array

Definition at line 724 of file QwSubsystemArray.cc.

References QwLog::endl(), fPublishedValuesDescription, and QwOut.

Referenced by main(), PublishByRequest(), and PublishInternalValue().

725 {
726  QwOut << "List of published values:" << QwLog::endl;
727  std::map<TString,TString>::const_iterator iter;
728  for (iter = fPublishedValuesDescription.begin();
729  iter != fPublishedValuesDescription.end(); iter++) {
730  QwOut << iter->first << ": " << iter->second << QwLog::endl;
731  }
732 }
std::map< TString, TString > fPublishedValuesDescription
#define QwOut
Predefined log drain for explicit output.
Definition: QwLog.h:35
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::LoadSubsystemsFromParameterFile ( QwParameterFile detectors)
protected

Fill the subsystem array with the contents of a map file

Parameters
detectorsMap file

Definition at line 72 of file QwSubsystemArray.cc.

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

Referenced by QwSubsystemArray().

73 {
74  // This is how this should work
75  QwParameterFile* preamble;
76  preamble = detectors.ReadSectionPreamble();
77  // Process preamble
78  QwVerbose << "Preamble:" << QwLog::endl;
79  QwVerbose << *preamble << QwLog::endl;
80  if (preamble) delete preamble;
81 
82  QwParameterFile* section;
83  std::string section_name;
84  while ((section = detectors.ReadNextSection(section_name))) {
85 
86  // Debugging output of configuration section
87  QwVerbose << "[" << section_name << "]" << QwLog::endl;
88  QwVerbose << *section << QwLog::endl;
89 
90  // Determine type and name of subsystem
91  std::string subsys_type = section_name;
92  std::string subsys_name;
93  if (! section->FileHasVariablePair("=","name",subsys_name)) {
94  QwError << "No name defined in section for subsystem " << subsys_type << "." << QwLog::endl;
95  delete section; section = 0;
96  continue;
97  }
98 
99  // If subsystem type is explicitly disabled
100  bool disabled_by_type = false;
101  for (size_t i = 0; i < fSubsystemsDisabledByType.size(); i++)
102  if (subsys_type == fSubsystemsDisabledByType.at(i))
103  disabled_by_type = true;
104  if (disabled_by_type) {
105  QwWarning << "Subsystem of type " << subsys_type << " disabled." << QwLog::endl;
106  delete section; section = 0;
107  continue;
108  }
109 
110  // If subsystem name is explicitly disabled
111  bool disabled_by_name = false;
112  for (size_t i = 0; i < fSubsystemsDisabledByName.size(); i++)
113  if (subsys_name == fSubsystemsDisabledByName.at(i))
114  disabled_by_name = true;
115  if (disabled_by_name) {
116  QwWarning << "Subsystem with name " << subsys_name << " disabled." << QwLog::endl;
117  delete section; section = 0;
118  continue;
119  }
120 
121  // Create subsystem
122  QwMessage << "Creating subsystem of type " << subsys_type << " "
123  << "with name " << subsys_name << "." << QwLog::endl;
124  VQwSubsystem* subsys = 0;
125  try {
126  subsys =
127  VQwSubsystemFactory::Create(subsys_type, subsys_name);
128  } catch (QwException_TypeUnknown&) {
129  QwError << "No support for subsystems of type " << subsys_type << "." << QwLog::endl;
130  // Fall-through to next error for more the psychological effect of many warnings
131  }
132  if (! subsys) {
133  QwError << "Could not create subsystem " << subsys_type << "." << QwLog::endl;
134  delete section; section = 0;
135  continue;
136  }
137 
138  // If this subsystem cannot be stored in this array
139  if (! fnCanContain(subsys)) {
140  QwMessage << "Subsystem " << subsys_name << " cannot be stored in this "
141  << "subsystem array." << QwLog::endl;
142  QwMessage << "Deleting subsystem " << subsys_name << " again" << QwLog::endl;
143  delete section; section = 0;
144  delete subsys; subsys = 0;
145  continue;
146  }
147 
148  // Pass detector maps
149  subsys->LoadDetectorMaps(*section);
150  // Add to array
151  this->push_back(subsys);
152 
153  // Instruct the subsystem to publish variables
154  if (subsys->PublishInternalValues() == kFALSE) {
155  QwError << "Not all variables for " << subsys->GetSubsystemName()
156  << " could be published!" << QwLog::endl;
157  }
158 
159  // Delete parameter file section
160  delete section; section = 0;
161  }
162 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void push_back(VQwSubsystem *subsys)
Add the subsystem to this array.
#define QwVerbose
Predefined log drain for verbose messages.
Definition: QwLog.h:55
virtual Int_t LoadDetectorMaps(QwParameterFile &file)
Parse parameter file to find the map files.
Definition: VQwSubsystem.cc:37
QwParameterFile * ReadNextSection(std::string &secname, const bool keep_header=false)
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
Bool_t FileHasVariablePair(const std::string &separatorchars, const std::string &varname, std::string &varvalue)
QwParameterFile * ReadSectionPreamble()
Rewinds to the start and read until it finds next section header.
CanContainFn fnCanContain
Function to determine which subsystems we can accept.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
std::vector< std::string > fSubsystemsDisabledByType
List of disabled names.
std::vector< std::string > fSubsystemsDisabledByName
List of disabled types.
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
virtual Bool_t PublishInternalValues() const
Publish all variables of the subsystem.
Definition: VQwSubsystem.h:109
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::PrintInfo ( ) const

Print some information about the subsystem.

Definition at line 453 of file QwSubsystemArray.cc.

454 {
455  if (!empty()) {
456  for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
457  (*subsys)->PrintInfo();
458  }
459  }
460 }
void QwSubsystemArray::PrintParamFileList ( ) const

Print list of parameter files.

Definition at line 779 of file QwSubsystemArray.cc.

Referenced by main().

780 {
781  if (not empty()) {
782  for (const_iterator subsys = begin(); subsys != end(); ++subsys)
783  {
784  (*subsys)->PrintDetectorMaps(true);
785  }
786  }
787 }

+ Here is the caller graph for this function:

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

Process the event buffer for configuration events.

Definition at line 326 of file QwSubsystemArray.cc.

Referenced by QwEventBuffer::FillSubsystemConfigurationData().

331 {
332  if (!empty())
333  for (iterator subsys = begin(); subsys != end(); ++subsys){
334  (*subsys)->ProcessConfigurationBuffer(roc_id, bank_id, buffer, num_words);
335  }
336  return 0;
337 }

+ Here is the caller graph for this function:

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

Process the event buffer for events.

Definition at line 339 of file QwSubsystemArray.cc.

References SetDataLoaded().

Referenced by QwEventBuffer::FillSubsystemData().

345 {
346  if (!empty())
347  SetDataLoaded(kTRUE);
348  for (iterator subsys = begin(); subsys != end(); ++subsys){
349  (*subsys)->ProcessEvBuffer(event_type, roc_id, bank_id, buffer, num_words);
350  }
351  return 0;
352 }
void SetDataLoaded(const Bool_t flag)
Set data loaded flag.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::ProcessEvent ( )

Process the decoded data in this event.

Definition at line 355 of file QwSubsystemArray.cc.

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

Referenced by main().

356 {
357  if (!empty() && HasDataLoaded()) {
358  std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::ProcessEvent));
359  std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::ExchangeProcessedData));
360  std::for_each(begin(), end(), boost::mem_fn(&VQwSubsystem::ProcessEvent_2));
361  }
362 }
virtual void ProcessEvent_2()
Process the event data again, including data from other subsystems. Not all derived classes will requ...
Definition: VQwSubsystem.h:194
virtual void ProcessEvent()=0
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...
Definition: VQwSubsystem.h:189

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::ProcessOptions ( QwOptions options)
inline

Process configuration options (default behavior)

Definition at line 110 of file QwSubsystemArray.h.

References ProcessOptionsSubsystems().

Referenced by main().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 252 of file QwSubsystemArray.cc.

References VQwSubsystem::ProcessOptions().

Referenced by ProcessOptions().

253 {
254  for (iterator subsys_iter = begin(); subsys_iter != end(); ++subsys_iter) {
255  VQwSubsystem* subsys = dynamic_cast<VQwSubsystem*>(subsys_iter->get());
256  subsys->ProcessOptions(options);
257  }
258 }
virtual void ProcessOptions(QwOptions &options)
Process the command line options.
Definition: VQwSubsystem.h:90
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 237 of file QwSubsystemArray.cc.

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

Referenced by QwSubsystemArray().

238 {
239  // Filename to use for subsystem creation (single filename could be expanded
240  // to a list)
241  fSubsystemsMapFile = options.GetValue<std::string>("detectors");
242  // Subsystems to disable
243  fSubsystemsDisabledByName = options.GetValueVector<std::string>("disable-by-name");
244  fSubsystemsDisabledByType = options.GetValueVector<std::string>("disable-by-type");
245 }
std::vector< T > GetValueVector(const std::string &key)
Get a list of templated values.
Definition: QwOptions.h:253
T GetValue(const std::string &key)
Get a templated value.
Definition: QwOptions.h:240
std::string fSubsystemsMapFile
Filename of the global detector map.
std::vector< std::string > fSubsystemsDisabledByType
List of disabled names.
std::vector< std::string > fSubsystemsDisabledByName
List of disabled types.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwSubsystemArray::PublishByRequest ( TString  device_name)
private

Try to publish an internal variable matching the submitted name.

Try to publish an internal variable matching the submitted name

Parameters
device_nameName of the desired published variable
Returns
True if the variable could be published, false if not published

Definition at line 697 of file QwSubsystemArray.cc.

References QwLog::endl(), fPublishedValuesSubsystem, ListPublishedValues(), and QwError.

Referenced by ReturnInternalValue().

697  {
698  Bool_t status = kFALSE;
699  if (fPublishedValuesSubsystem.count(device_name) > 0) {
700  QwError << "QwSubsystemArray::PublishByRequest: Channel "
701  << device_name << " has already been published."
702  << QwLog::endl;
704  status = kTRUE;
705  } else if (not empty()) {
706  for (iterator subsys = begin(); subsys != end(); ++subsys)
707  {
708  status = (*subsys)->PublishByRequest(device_name);
709  if (status) break;
710  }
711  // Report failure to publish
712  if (! status) {
713  QwError << "QwSubsystemArray::PublishByRequest: Failed to publish channel name: "
714  << device_name << QwLog::endl;
715  }
716  }
717  return status;
718 }
std::map< TString, const VQwSubsystem * > fPublishedValuesSubsystem
void ListPublishedValues() const
List the published values and description in this subsystem array.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwSubsystemArray::PublishInternalValue ( const TString  name,
const TString  desc,
const VQwSubsystem subsys,
const VQwHardwareChannel element 
)

Publish the value name with description from a subsystem in this array.

Publish the value name with description from a subsystem in this array

Parameters
nameName of the variable
descDescription of the variable
subsysSubsystem that contains the variable
elementData element that contains the variable
Returns
True if the variable could be published, false if not published

Definition at line 675 of file QwSubsystemArray.cc.

References QwLog::endl(), fPublishedValuesDataElement, fPublishedValuesDescription, fPublishedValuesSubsystem, ListPublishedValues(), and QwError.

Referenced by VQwSubsystem::PublishInternalValue().

680 {
681  if (fPublishedValuesSubsystem.count(name) > 0) {
682  QwError << "Attempting to publish existing variable key!" << QwLog::endl;
684  return kFALSE;
685  }
686  fPublishedValuesSubsystem[name] = subsys;
687  fPublishedValuesDescription[name] = desc;
688  fPublishedValuesDataElement[name] = element;
689  return kTRUE;
690 }
std::map< TString, const VQwSubsystem * > fPublishedValuesSubsystem
std::map< TString, TString > fPublishedValuesDescription
std::map< TString, const VQwHardwareChannel * > fPublishedValuesDataElement
Published values.
void ListPublishedValues() const
List the published values and description in this subsystem array.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 171 of file QwSubsystemArray.cc.

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

Referenced by LoadSubsystemsFromParameterFile(), and QwSubsystemArray().

172 {
173  if (subsys == NULL) {
174  QwError << "QwSubsystemArray::push_back(): NULL subsys"
175  << QwLog::endl;
176  // This is an empty subsystem...
177  // Do nothing for now.
178 
179  } else if (!this->empty() && GetSubsystemByName(subsys->GetSubsystemName())){
180  // There is already a subsystem with this name!
181  QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetSubsystemName()
182  << " already exists" << QwLog::endl;
183 
184  } else if (!fnCanContain(subsys)) {
185  // There is no support for this type of subsystem
186  QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetSubsystemName()
187  << " is not supported by this subsystem array" << QwLog::endl;
188 
189  } else {
190  boost::shared_ptr<VQwSubsystem> subsys_tmp(subsys);
191  SubsysPtrs::push_back(subsys_tmp);
192 
193  // Set the parent of the subsystem to this array
194  subsys_tmp->SetParent(this);
195 
196  // Update the event type mask
197  // Note: Active bits in the mask indicate event types that are accepted
198  fEventTypeMask |= subsys_tmp->GetEventTypeMask();
199  }
200 }
virtual VQwSubsystem * GetSubsystemByName(const TString &name)
Get the subsystem with the specified name.
CanContainFn fnCanContain
Function to determine which subsystems we can accept.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
UInt_t fEventTypeMask
Mask of event types.
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwSubsystemArray::push_back ( boost::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 824 of file QwSubsystemArray.cc.

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

825 {
826 
827  if (subsys.get() == NULL) {
828  QwError << "QwSubsystemArray::push_back(): NULL subsys"
829  << QwLog::endl;
830  // This is an empty subsystem...
831  // Do nothing for now.
832 
833  } else if (!this->empty() && GetSubsystemByName(subsys->GetSubsystemName())){
834  // There is already a subsystem with this name!
835  QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetSubsystemName()
836  << " already exists" << QwLog::endl;
837 
838  } else if (!fnCanContain(subsys.get())) {
839  // There is no support for this type of subsystem
840  QwError << "QwSubsystemArray::push_back(): subsys " << subsys->GetSubsystemName()
841  << " is not supported by this subsystem array" << QwLog::endl;
842 
843  } else {
844  boost::shared_ptr<VQwSubsystem> subsys_tmp(subsys);
845  SubsysPtrs::push_back(subsys_tmp);
846 
847  // Set the parent of the subsystem to this array
848  subsys_tmp->SetParent(this);
849 
850  // Update the event type mask
851  // Note: Active bits in the mask indicate event types that are accepted
852  fEventTypeMask |= subsys_tmp->GetEventTypeMask();
853 
854  // Instruct the subsystem to publish variables
855  if (subsys_tmp->PublishInternalValues() == kFALSE) {
856  QwError << "Not all variables for " << subsys_tmp->GetSubsystemName()
857  << " could be published!" << QwLog::endl;
858  }
859  }
860 }
virtual VQwSubsystem * GetSubsystemByName(const TString &name)
Get the subsystem with the specified name.
CanContainFn fnCanContain
Function to determine which subsystems we can accept.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
UInt_t fEventTypeMask
Mask of event types.
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

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

Randomize the data in this event.

Definition at line 373 of file QwSubsystemArray.cc.

Referenced by main().

374 {
375  if (!empty())
376  for (iterator subsys = begin(); subsys != end(); ++subsys) {
377  (*subsys)->RandomizeEventData(helicity, time);
378  }
379 }

+ Here is the caller graph for this function:

Bool_t QwSubsystemArray::RequestExternalValue ( const TString &  name,
VQwHardwareChannel value 
) const

Retrieve the variable name from other subsystem arrays.

Retrieve the variable name from other subsystem arrays

Parameters
nameVariable name to be retrieved
value(return) Data element with the variable name
Returns
True if the variable is found, false if not found

Definition at line 594 of file QwSubsystemArray.cc.

References ReturnInternalValue().

Referenced by VQwSubsystem::RequestExternalValue().

595 {
596  // If this has a parent, we should escalate the call to that object,
597  // but so far we don't have that capability.
598  return ReturnInternalValue(name, value);
599 }
const VQwHardwareChannel * ReturnInternalValue(const TString &name) const
Retrieve the variable name from subsystems in this subsystem array.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const VQwHardwareChannel * QwSubsystemArray::ReturnInternalValue ( const TString &  name) const

Retrieve the variable name from subsystems in this subsystem array.

Retrieve the variable name from subsystems in this subsystem array

Parameters
nameVariable name to be retrieved
Returns
Data element with the variable name, null if not found

Definition at line 606 of file QwSubsystemArray.cc.

References QwLog::endl(), fPublishedValuesDataElement, fPublishedValuesSubsystem, PublishByRequest(), and QwError.

Referenced by QwRegression::ConnectChannels(), RequestExternalValue(), ReturnInternalValue(), ReturnInternalValueForFriends(), and QwBlinder::Update().

607 {
608  // First try to find the value in the list of published values.
609  std::map<TString, const VQwHardwareChannel*>::const_iterator iter1 =
610  fPublishedValuesDataElement.find(name);
611  if (iter1 != fPublishedValuesDataElement.end()) {
612  return iter1->second;
613  }
614  // Second, ask the subsystem that has claimed the value
615  std::map<TString, const VQwSubsystem*>::const_iterator iter2 =
616  fPublishedValuesSubsystem.find(name);
617  if (iter2 != fPublishedValuesSubsystem.end()) {
618  return (iter2->second)->ReturnInternalValue(name);
619  }
620  // If the value is not yet published, try requesting it.
621  if (const_cast<QwSubsystemArray*>(this)->PublishByRequest(name)){
622  iter1 = fPublishedValuesDataElement.find(name);
623  if (iter1 != fPublishedValuesDataElement.end()) {
624  return iter1->second;
625  }
626  QwError << "PublishByRequest succeeded, but can't find the record for "
627  << name << QwLog::endl;
628 
629  } else {
630  QwError << "PublishByRequest failed for " << name << QwLog::endl;
631  }
632  // Not found
633  return 0;
634 }
std::map< TString, const VQwSubsystem * > fPublishedValuesSubsystem
std::map< TString, const VQwHardwareChannel * > fPublishedValuesDataElement
Published values.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
Bool_t PublishByRequest(TString device_name)
Try to publish an internal variable matching the submitted name.
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwSubsystemArray::ReturnInternalValue ( const TString &  name,
VQwHardwareChannel value 
) const

Retrieve the variable name from subsystems in this subsystem array.

Retrieve the variable name from subsystems in this subsystem array

Parameters
nameVariable name to be retrieved
value(return) Data element with the variable name
Returns
True if the variable was found, false if not found
Todo:
TODO (wdc) Remove this ugly statement by redefining QwVQWK_Channel::operator= to accept any VQwHardwareChannel.

Definition at line 642 of file QwSubsystemArray.cc.

References VQwHardwareChannel::AssignValueFrom(), QwLog::endl(), QwWarning, and ReturnInternalValue().

643 {
644  Bool_t foundit = kFALSE;
645 
646  // Check for null pointer
647  if (! value)
648  QwWarning << "QwSubsystemArray::ReturnInternalValue requires that "
649  << "'value' be a non-null pointer to a VQwHardwareChannel."
650  << QwLog::endl;
651 
652  // Get a const pointer to the internal value
653  VQwHardwareChannel* internal_value = const_cast<VQwHardwareChannel*>(ReturnInternalValue(name));
654  if (value && internal_value && typeid(value) == typeid(internal_value)) {
655  /// \todo TODO (wdc) Remove this ugly statement by redefining
656  /// QwVQWK_Channel::operator= to accept any VQwHardwareChannel.
657  //*(dynamic_cast<QwVQWK_Channel*>(value)) = *(dynamic_cast<QwVQWK_Channel*>(internal_value));
658  value->AssignValueFrom(internal_value);
659  foundit = kTRUE;
660  } else
661  QwWarning << "QwSubsystemArray::ReturnInternalValue: name \""
662  << name << "\" not found in array." << QwLog::endl;
663 
664  return foundit;
665 }
const VQwHardwareChannel * ReturnInternalValue(const TString &name) const
Retrieve the variable name from subsystems in this subsystem array.
void AssignValueFrom(const VQwDataElement *valueptr)=0
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45

+ Here is the call graph for this function:

VQwHardwareChannel * QwSubsystemArray::ReturnInternalValueForFriends ( const TString &  name) const
private

Retrieve the variable name from subsystems in this subsystem array.

Retrieve the variable name from subsystems in this subsystem array

Parameters
nameVariable name to be retrieved
Returns
Data element with the variable name

Definition at line 739 of file QwSubsystemArray.cc.

References ReturnInternalValue().

740 {
741  return const_cast<VQwHardwareChannel*>(ReturnInternalValue(name));
742 }
const VQwHardwareChannel * ReturnInternalValue(const TString &name) const
Retrieve the variable name from subsystems in this subsystem array.

+ Here is the call graph for this function:

void QwSubsystemArray::SetCleanParameters ( Double_t  cleanparameter[3])
inline

Set the internal record of the CODA event number.

Definition at line 77 of file QwSubsystemArray.h.

References fCleanParameter.

Referenced by QwEventBuffer::FillSubsystemData().

78  {
79  fCleanParameter[0] = cleanparameter[0];
80  fCleanParameter[1] = cleanparameter[1];
81  fCleanParameter[2] = cleanparameter[2];
82  };
Double_t fCleanParameter[3]

+ Here is the caller graph for this function:

void QwSubsystemArray::SetCodaEventNumber ( UInt_t  evtnum)
inline

Set the internal record of the CODA event number.

Definition at line 64 of file QwSubsystemArray.h.

References fCodaEventNumber.

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

64 { fCodaEventNumber = evtnum; };
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.

+ Here is the caller graph for this function:

void QwSubsystemArray::SetCodaEventType ( UInt_t  evttype)
inline

Set the internal record of the CODA event type.

Definition at line 66 of file QwSubsystemArray.h.

References fCodaEventType.

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

66 { fCodaEventType = evttype; };
UInt_t fCodaEventType
CODA event type as provided by QwEventBuffer.

+ Here is the caller graph for this function:

void QwSubsystemArray::SetCodaRunNumber ( UInt_t  runnum)
inline

Set the internal record of the CODA run number.

Definition at line 60 of file QwSubsystemArray.h.

References fCodaRunNumber.

Referenced by QwEventBuffer::FillSubsystemData().

60 { fCodaRunNumber = runnum; };
UInt_t fCodaRunNumber
Index of this data element in root tree.

+ Here is the caller graph for this function:

void QwSubsystemArray::SetCodaSegmentNumber ( UInt_t  segnum)
inline

Set the internal record of the CODA segment number.

Definition at line 62 of file QwSubsystemArray.h.

References fCodaSegmentNumber.

Referenced by QwEventBuffer::FillSubsystemData().

62 { fCodaSegmentNumber = segnum; };
UInt_t fCodaSegmentNumber
CODA segment number as provided by QwEventBuffer.

+ Here is the caller graph for this function:

void QwSubsystemArray::SetDataLoaded ( const Bool_t  flag)
inline

Set data loaded flag.

Definition at line 99 of file QwSubsystemArray.h.

References fHasDataLoaded.

Referenced by ClearEventData(), and ProcessEvBuffer().

99 { fHasDataLoaded = flag; };
Bool_t fHasDataLoaded
Has this array gotten data to be processed?

+ Here is the caller graph for this function:

void QwSubsystemArray::SetEventTypeMask ( const UInt_t  mask)
inline

Set event type mask.

Definition at line 85 of file QwSubsystemArray.h.

References fEventTypeMask.

85 { fEventTypeMask = mask; };
UInt_t fEventTypeMask
Mask of event types.
void QwSubsystemArray::ShareHistograms ( const QwSubsystemArray source)

Share the histograms with another subsystem.

Definition at line 407 of file QwSubsystemArray.cc.

Referenced by main().

408 {
409  if (!empty() && !source.empty()) {
410  if (this->size() == source.size()) {
411  for (size_t i = 0; i < source.size(); ++i) {
412  this->at(i)->ShareHistograms(source.at(i).get());
413  }
414  }
415  }
416 }

+ Here is the caller graph for this function:

UInt_t QwSubsystemArray::UpdateEventTypeMask ( )
inline

Update the event type mask from the subsystems.

Definition at line 89 of file QwSubsystemArray.h.

References fEventTypeMask, and VQwSubsystem::GetEventTypeMask().

Referenced by main().

89  {
90  for (iterator subsys_iter = begin(); subsys_iter != end(); ++subsys_iter) {
91  VQwSubsystem* subsys = dynamic_cast<VQwSubsystem*>(subsys_iter->get());
92  fEventTypeMask |= subsys->GetEventTypeMask();
93  }
94  return fEventTypeMask;
95  };
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
UInt_t fEventTypeMask
Mask of event types.
UInt_t GetEventTypeMask() const
Get event type mask.
Definition: VQwSubsystem.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class QwRegression
friend

Friend with regression class who needs write access to data.

Definition at line 182 of file QwSubsystemArray.h.

Field Documentation

Double_t QwSubsystemArray::fCleanParameter[3]
protected

Definition at line 271 of file QwSubsystemArray.h.

Referenced by FillTreeVector(), and SetCleanParameters().

UInt_t QwSubsystemArray::fCodaEventNumber
protected

CODA event number as provided by QwEventBuffer.

Definition at line 268 of file QwSubsystemArray.h.

Referenced by ConstructBranch(), GetCodaEventNumber(), QwSubsystemArrayParity::operator=(), and SetCodaEventNumber().

UInt_t QwSubsystemArray::fCodaEventType
protected

CODA event type as provided by QwEventBuffer.

Definition at line 269 of file QwSubsystemArray.h.

Referenced by ConstructBranch(), GetCodaEventType(), and SetCodaEventType().

UInt_t QwSubsystemArray::fCodaRunNumber
protected

Index of this data element in root tree.

CODA run number as provided by QwEventBuffer

Definition at line 266 of file QwSubsystemArray.h.

Referenced by GetCodaRunNumber(), and SetCodaRunNumber().

UInt_t QwSubsystemArray::fCodaSegmentNumber
protected

CODA segment number as provided by QwEventBuffer.

Definition at line 267 of file QwSubsystemArray.h.

Referenced by GetCodaSegmentNumber(), and SetCodaSegmentNumber().

UInt_t QwSubsystemArray::fEventTypeMask
protected

Mask of event types.

Definition at line 272 of file QwSubsystemArray.h.

Referenced by GetEventTypeMask(), push_back(), SetEventTypeMask(), and UpdateEventTypeMask().

Bool_t QwSubsystemArray::fHasDataLoaded
protected

Has this array gotten data to be processed?

Definition at line 273 of file QwSubsystemArray.h.

Referenced by HasDataLoaded(), and SetDataLoaded().

CanContainFn QwSubsystemArray::fnCanContain
protected

Function to determine which subsystems we can accept.

Definition at line 277 of file QwSubsystemArray.h.

Referenced by LoadSubsystemsFromParameterFile(), and push_back().

std::map<TString, const VQwHardwareChannel*> QwSubsystemArray::fPublishedValuesDataElement
private

Published values.

Definition at line 185 of file QwSubsystemArray.h.

Referenced by PublishInternalValue(), QwSubsystemArray(), and ReturnInternalValue().

std::map<TString, TString> QwSubsystemArray::fPublishedValuesDescription
private

Definition at line 187 of file QwSubsystemArray.h.

Referenced by ListPublishedValues(), PublishInternalValue(), and QwSubsystemArray().

std::map<TString, const VQwSubsystem*> QwSubsystemArray::fPublishedValuesSubsystem
private
std::vector<std::string> QwSubsystemArray::fSubsystemsDisabledByName
private

List of disabled types.

Definition at line 291 of file QwSubsystemArray.h.

Referenced by LoadSubsystemsFromParameterFile(), and ProcessOptionsToplevel().

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

List of disabled names.

Definition at line 292 of file QwSubsystemArray.h.

Referenced by LoadSubsystemsFromParameterFile(), and ProcessOptionsToplevel().

std::string QwSubsystemArray::fSubsystemsMapFile
private

Filename of the global detector map.

Definition at line 286 of file QwSubsystemArray.h.

Referenced by ProcessOptionsToplevel(), and QwSubsystemArray().

size_t QwSubsystemArray::fTreeArrayIndex
protected

Definition at line 263 of file QwSubsystemArray.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().


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