27 : fEventTypeMask(0x0),fnCanContain(myCanContain)
40 : fTreeArrayIndex(source.fTreeArrayIndex),
41 fCodaRunNumber(source.fCodaRunNumber),
42 fCodaSegmentNumber(source.fCodaSegmentNumber),
43 fCodaEventNumber(source.fCodaEventNumber),
44 fCodaEventType(source.fCodaEventType),
45 fEventTypeMask(source.fEventTypeMask),
46 fHasDataLoaded(source.fHasDataLoaded),
47 fnCanContain(source.fnCanContain),
48 fSubsystemsMapFile(source.fSubsystemsMapFile),
49 fSubsystemsDisabledByName(source.fSubsystemsDisabledByName),
50 fSubsystemsDisabledByType(source.fSubsystemsDisabledByType)
57 for (const_iterator subsys = source.begin(); subsys != source.end(); ++subsys) {
60 if (this->back()->PublishInternalValues() == kFALSE) {
61 QwError <<
"Not all variables for " << this->back()->GetSubsystemName()
80 if (preamble)
delete preamble;
83 std::string section_name;
91 std::string subsys_type = section_name;
92 std::string subsys_name;
94 QwError <<
"No name defined in section for subsystem " << subsys_type <<
"." <<
QwLog::endl;
95 delete section; section = 0;
100 bool disabled_by_type =
false;
103 disabled_by_type =
true;
104 if (disabled_by_type) {
106 delete section; section = 0;
111 bool disabled_by_name =
false;
114 disabled_by_name =
true;
115 if (disabled_by_name) {
117 delete section; section = 0;
122 QwMessage <<
"Creating subsystem of type " << subsys_type <<
" "
123 <<
"with name " << subsys_name <<
"." <<
QwLog::endl;
127 VQwSubsystemFactory::Create(subsys_type, subsys_name);
134 delete section; section = 0;
140 QwMessage <<
"Subsystem " << subsys_name <<
" cannot be stored in this "
143 delete section; section = 0;
144 delete subsys; subsys = 0;
160 delete section; section = 0;
173 if (subsys == NULL) {
174 QwError <<
"QwSubsystemArray::push_back(): NULL subsys"
187 <<
" is not supported by this subsystem array" <<
QwLog::endl;
190 boost::shared_ptr<VQwSubsystem> subsys_tmp(subsys);
191 SubsysPtrs::push_back(subsys_tmp);
194 subsys_tmp->SetParent(
this);
211 po::value<std::string>()->default_value(
"detectors.map"),
212 "map file with detectors to include");
215 #if BOOST_VERSION < 103900
217 po::value<std::vector <std::string> >(),
218 "subsystem types to disable");
220 po::value<std::vector <std::string> >(),
221 "subsystem names to disable");
222 #else // BOOST_VERSION >= 103900
224 po::value<std::vector <std::string> >()->multitoken(),
225 "subsystem types to disable");
227 po::value<std::vector <std::string> >()->multitoken(),
228 "subsystem names to disable");
229 #endif // BOOST_VERSION
254 for (iterator subsys_iter = begin(); subsys_iter != end(); ++subsys_iter) {
271 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
274 if ((*subsys)->GetSubsystemName() == name) {
275 tmp = (*subsys).get();
294 std::vector<VQwSubsystem*> subsys_list;
300 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
303 if (VQwSubsystemFactory::InheritsFrom((*subsys).get(),type)) {
304 subsys_list.push_back((*subsys).get());
321 std::for_each(begin(), end(),
328 const UInt_t bank_id,
333 for (iterator subsys = begin(); subsys != end(); ++subsys){
334 (*subsys)->ProcessConfigurationBuffer(roc_id, bank_id, buffer, num_words);
340 const UInt_t event_type,
342 const UInt_t bank_id,
348 for (iterator subsys = begin(); subsys != end(); ++subsys){
349 (*subsys)->ProcessEvBuffer(event_type, roc_id, bank_id, buffer, num_words);
376 for (iterator subsys = begin(); subsys != end(); ++subsys) {
377 (*subsys)->RandomizeEventData(helicity, time);
385 for (iterator subsys = begin(); subsys != end(); ++subsys) {
386 (*subsys)->EncodeEventData(buffer);
395 for (iterator subsys = begin(); subsys != end(); ++subsys){
396 (*subsys)->ConstructHistograms(folder,prefix);
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());
427 for (iterator subsys = begin(); subsys != end(); ++subsys){
428 (*subsys)->ConstructTree(folder, prefix);
456 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
457 (*subsys)->PrintInfo();
473 std::vector<Double_t>& values)
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");
493 for (iterator subsys = begin(); subsys != end(); ++subsys) {
509 if (prefix ==
"" || prefix ==
"yield_") {
514 for (iterator subsys = begin(); subsys != end(); ++subsys) {
542 if (prefix ==
"" || prefix ==
"yield_") {
547 for (iterator subsys = begin(); subsys != end(); ++subsys) {
580 for (const_iterator subsys = begin(); subsys != end(); ++subsys) {
609 std::map<TString, const VQwHardwareChannel*>::const_iterator iter1 =
612 return iter1->second;
615 std::map<TString, const VQwSubsystem*>::const_iterator iter2 =
618 return (iter2->second)->ReturnInternalValue(name);
624 return iter1->second;
626 QwError <<
"PublishByRequest succeeded, but can't find the record for "
644 Bool_t foundit = kFALSE;
648 QwWarning <<
"QwSubsystemArray::ReturnInternalValue requires that "
649 <<
"'value' be a non-null pointer to a VQwHardwareChannel."
654 if (value && internal_value &&
typeid(value) ==
typeid(internal_value)) {
661 QwWarning <<
"QwSubsystemArray::ReturnInternalValue: name \""
662 << name <<
"\" not found in array." <<
QwLog::endl;
698 Bool_t status = kFALSE;
700 QwError <<
"QwSubsystemArray::PublishByRequest: Channel "
701 << device_name <<
" has already been published."
705 }
else if (not empty()) {
706 for (iterator subsys = begin(); subsys != end(); ++subsys)
708 status = (*subsys)->PublishByRequest(device_name);
713 QwError <<
"QwSubsystemArray::PublishByRequest: Failed to publish channel name: "
727 std::map<TString,TString>::const_iterator iter;
782 for (const_iterator subsys = begin(); subsys != end(); ++subsys)
784 (*subsys)->PrintDetectorMaps(
true);
793 TList* return_maps_TList =
new TList;
794 return_maps_TList->SetName(name);
796 std::map<TString, TString> mapfiles_subsystem;
798 for (const_iterator subsys = begin(); subsys != end(); ++subsys)
800 mapfiles_subsystem = (*subsys)->GetDetectorMaps();
801 for( std::map<TString, TString>::iterator ii= mapfiles_subsystem.begin(); ii!= mapfiles_subsystem.end(); ++ii)
803 TList *test =
new TList;
804 test->SetName((*ii).first);
805 test->AddLast(
new TObjString((*ii).second));
806 return_maps_TList -> AddLast(test);
810 return return_maps_TList;
827 if (subsys.get() == NULL) {
828 QwError <<
"QwSubsystemArray::push_back(): NULL subsys"
835 QwError <<
"QwSubsystemArray::push_back(): subsys " << subsys->GetSubsystemName()
840 QwError <<
"QwSubsystemArray::push_back(): subsys " << subsys->GetSubsystemName()
841 <<
" is not supported by this subsystem array" <<
QwLog::endl;
844 boost::shared_ptr<VQwSubsystem> subsys_tmp(subsys);
845 SubsysPtrs::push_back(subsys_tmp);
848 subsys_tmp->SetParent(
this);
855 if (subsys_tmp->PublishInternalValues() == kFALSE) {
856 QwError <<
"Not all variables for " << subsys_tmp->GetSubsystemName()
#define QwMessage
Predefined log drain for regular messages.
virtual void ConstructBranch(TTree *tree, TString &prefix)=0
Construct the branch and tree vector.
std::map< TString, const VQwSubsystem * > fPublishedValuesSubsystem
std::map< TString, TString > fPublishedValuesDescription
const VQwHardwareChannel * ReturnInternalValue(const TString &name) const
Retrieve the variable name from subsystems in this subsystem array.
#define QwOut
Predefined log drain for explicit output.
virtual void FillTreeVector(std::vector< Double_t > &values) const =0
Fill the tree vector.
void ConstructHistograms()
Construct the histograms for this subsystem.
virtual VQwSubsystem * GetSubsystemByName(const TString &name)
Get the subsystem with the specified name.
virtual void ProcessOptions(QwOptions &options)
Process the command line options.
TList * GetParamFileNameList(TString name) const
Get list of parameter files.
QwSubsystemArray()
Private default constructor.
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.
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.
Bool_t FileHasSectionHeader(const std::string &secname)
void push_back(VQwSubsystem *subsys)
Add the subsystem to this array.
void SetCodaEventNumber(UInt_t evtnum)
Set the internal record of the CODA event number.
UInt_t GetCodaEventType() const
Get the internal record of the CODA event type.
UInt_t fCodaEventNumber
CODA event number as provided by QwEventBuffer.
std::vector< T > GetValueVector(const std::string &key)
Get a list of templated values.
Bool_t RequestExternalValue(const TString &name, VQwHardwareChannel *value) const
Retrieve the variable name from other subsystem arrays.
virtual void ProcessEvent_2()
Process the event data again, including data from other subsystems. Not all derived classes will requ...
void PrintParamFileList() const
Print list of parameter files.
#define QwVerbose
Predefined log drain for verbose messages.
virtual Int_t LoadDetectorMaps(QwParameterFile &file)
Parse parameter file to find the map files.
void PrintInfo() const
Print some information about the subsystem.
void EncodeEventData(std::vector< UInt_t > &buffer)
Encode the data in this event.
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
QwParameterFile * ReadNextSection(std::string &secname, const bool keep_header=false)
std::map< TString, const VQwHardwareChannel * > fPublishedValuesDataElement
Published values.
T GetValue(const std::string &key)
Get a templated value.
void SetDataLoaded(const Bool_t flag)
Set data loaded flag.
std::string fSubsystemsMapFile
Filename of the global detector map.
void ConstructTree()
Construct the tree for this subsystem.
#define QwDebug
Predefined log drain for debugging output.
A logfile class, based on an identical class in the Hermes analyzer.
UInt_t fCodaEventType
CODA event type as provided by QwEventBuffer.
QwParameterFile * ReadUntilNextSection(const bool add_current_line=false)
virtual void FillHistograms()=0
Fill the histograms for this subsystem.
virtual void DeleteTree()
Delete the tree for this subsystem.
void AtEndOfEventLoop()
Perform actions at the end of the event loop.
void ProcessOptionsToplevel(QwOptions &options)
Process configuration options for the subsystem array itself.
void ListPublishedValues() const
List the published values and description in this subsystem array.
void ConstructBranchAndVector(TTree *tree, std::vector< Double_t > &values)
Construct the tree and vector for this subsystem.
void ConstructBranch(TTree *tree, TString &prefix)
Construct a branch for this subsystem with a prefix.
void FillHistograms()
Fill the histograms for this subsystem.
virtual void ProcessEvent()=0
The pure virtual base class of all subsystems.
static void DefineOptions(QwOptions &options)
Define configuration options for global array.
Bool_t FileHasVariablePair(const std::string &separatorchars, const std::string &varname, std::string &varvalue)
void AssignValueFrom(const VQwDataElement *valueptr)=0
UInt_t GetCodaEventNumber() const
Get the internal record of the CODA event number.
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.
void FillTree()
Fill the tree for this subsystem.
void ShareHistograms(const QwSubsystemArray &source)
Share the histograms with another subsystem.
QwParameterFile * ReadSectionPreamble()
Rewinds to the start and read until it finds next section header.
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)=0
Construct the branch and tree vector.
CanContainFn fnCanContain
Function to determine which subsystems we can accept.
static std::ostream & endl(std::ostream &)
End of the line.
void ProcessOptionsSubsystems(QwOptions &options)
Process configuration options for all subsystems in the array.
Double_t fCleanParameter[3]
Bool_t HasDataLoaded() const
Get data loaded flag.
void ProcessEvent()
Process the decoded data in this event.
Bool_t PublishByRequest(TString device_name)
Try to publish an internal variable matching the submitted name.
std::vector< std::string > fSubsystemsDisabledByType
List of disabled names.
void LoadSubsystemsFromParameterFile(QwParameterFile &detectors)
virtual void FillTree()
Fill the tree for this subsystem.
std::vector< std::string > fSubsystemsDisabledByName
List of disabled types.
void SetCodaEventType(UInt_t evttype)
Set the internal record of the CODA event type.
VQwHardwareChannel * ReturnInternalValueForFriends(const TString &name) const
Retrieve the variable name from subsystems in this subsystem array.
UInt_t fEventTypeMask
Mask of event types.
#define QwWarning
Predefined log drain for warnings.
virtual std::vector< VQwSubsystem * > GetSubsystemByType(const std::string &type)
Get the list of subsystems of the specified type.
virtual void ExchangeProcessedData()
Request processed data from other subsystems for internal use in the second event processing stage...
void DeleteTree()
Delete the tree for this subsystem.
void RandomizeEventData(int helicity=0, double time=0.0)
Randomize the data in this event.
virtual Bool_t PublishInternalValues() const
Publish all variables of the subsystem.
#define QwError
Predefined log drain for errors.
TString GetSubsystemName() const
void FillTreeVector(std::vector< Double_t > &values) const
Fill the vector for this subsystem.
virtual void ClearEventData()=0
virtual void AtEndOfEventLoop()
Perform actions at the end of the event loop.