58 for (const_iterator handler = source.begin(); handler != source.end(); ++handler) {
59 this->push_back(handler->get()->Clone());
95 std::unique_ptr<QwParameterFile> preamble;
100 if (preamble) preamble.reset();
102 std::unique_ptr<QwParameterFile> section;
103 std::string section_name;
111 std::string handler_type = section_name;
112 std::string handler_name;
113 std::string handler_scope;
114 if (! section->FileHasVariablePair(
"=",
"name",handler_name)) {
115 QwError <<
"No name defined in section for handler " << handler_type <<
"." <<
QwLog::endl;
118 if (section->FileHasVariablePair(
"=",
"scope",handler_scope)) {
127 bool disabled_by_type =
false;
130 disabled_by_type =
true;
131 if (disabled_by_type) {
137 bool disabled_by_name =
false;
140 disabled_by_name =
true;
141 if (disabled_by_name) {
147 QwMessage <<
"Creating handler of type " << handler_type <<
" "
148 <<
"with name " << handler_name <<
"." <<
QwLog::endl;
153 VQwDataHandlerFactory::Create(handler_type, handler_name);
165 QwMessage <<
"DataHandler " << handler_name <<
" cannot be stored in this "
168 delete handler; handler = 0;
201 if (handler == NULL) {
202 QwError <<
"QwDataHandlerArray::push_back(): NULL handler"
209 QwError <<
"QwDataHandlerArray::push_back(): handler " << handler->
GetName()
214 QwError <<
"QwDataHandlerArray::push_back(): handler " << handler->
GetName()
215 <<
" is not supported by this handler array" <<
QwLog::endl;
218 std::shared_ptr<VQwDataHandler> handler_tmp(handler);
219 HandlerPtrs::push_back(handler_tmp);
234 po::value<std::string>(),
235 "map file with datahandlers to include");
238#if BOOST_VERSION < 103900
239 options.
AddOptions()(
"DataHandler.disable-by-type",
240 po::value<std::vector <std::string> >(),
241 "handler types to disable");
242 options.
AddOptions()(
"DataHandler.disable-by-name",
243 po::value<std::vector <std::string> >(),
244 "handler names to disable");
246 options.
AddOptions()(
"DataHandler.disable-by-type",
247 po::value<std::vector <std::string> >()->multitoken(),
248 "handler types to disable");
249 options.
AddOptions()(
"DataHandler.disable-by-name",
250 po::value<std::vector <std::string> >()->multitoken(),
251 "handler names to disable");
264 if (options.
HasValue(
"datahandlers")){
285 for (const_iterator handler = begin(); handler != end(); ++handler) {
288 if ((*handler)->GetName() == name) {
289 tmp = (*handler).get();
308 std::vector<VQwDataHandler*> handler_list;
314 for (const_iterator handler = begin(); handler != end(); ++handler) {
317 if (VQwDataHandlerFactory::InheritsFrom((*handler).get(),type)) {
318 handler_list.push_back((*handler).get());
331 std::for_each(begin(), end(),
347 const std::string& treeprefix,
348 const std::string& branchprefix)
351 for (iterator handler = begin(); handler != end(); ++handler) {
352 handler->get()->ConstructTreeBranches(treerootfile, treeprefix, branchprefix);
360 for (iterator handler = begin(); handler != end(); ++handler) {
361 handler->get()->FillTreeBranches(treerootfile);
368 const std::string& treeprefix,
369 const std::string& branchprefix)
372 for (iterator handler = begin(); handler != end(); ++handler) {
373 handler->get()->ConstructNTupleFields(treerootfile, treeprefix, branchprefix);
381 for (iterator handler = begin(); handler != end(); ++handler) {
382 handler->get()->FillNTupleFields(treerootfile);
394 for (iterator handler = begin(); handler != end(); ++handler) {
404 for (const_iterator handler = begin(); handler != end(); ++handler) {
416 for (iterator subsys = begin(); subsys != end(); ++subsys){
417 (*subsys)->ConstructHistograms(folder,prefix);
431#ifdef __USE_DATABASE__
434 for (iterator handler = begin(); handler != end(); ++handler) {
436 handler_parity->FillDB(db, type);
454 for (const_iterator handler = begin(); handler != end(); ++handler) {
471 Bool_t localdebug=kFALSE;
472 if(localdebug) std::cout<<
"QwDataHandlerArray::operator= \n";
473 if (!source.empty()){
474 if (this->size() == source.size()){
475 for(
size_t i=0;i<source.size();i++){
476 if (source.at(i)==NULL || this->at(i)==NULL){
483 if (
typeid(*ptr1)==
typeid(*ptr2)){
484 if(localdebug) std::cout<<
" here in QwDataHandlerArray::operator= types mach \n";
485 *(ptr1) = *(source.at(i).get());
489 QwError <<
" typeid(*ptr1)=" <<
typeid(*ptr1).name()
490 <<
" but typeid(*ptr2)=" <<
typeid(*ptr2).name()
520 for (const_iterator handler = begin(); handler != end(); ++handler) {
535 for (iterator handler = begin(); handler != end(); ++handler) {
545 if (!value.empty()) {
546 if (this->size() == value.size()) {
547 for (
size_t i = 0; i < value.size(); i++) {
548 if (value.at(i)==NULL || this->at(i)==NULL) {
555 if (
typeid(*ptr1) ==
typeid(*ptr2)) {
558 QwError <<
"QwDataHandlerArray::AccumulateRunningSum here where types don't match" <<
QwLog::endl;
559 QwError <<
" typeid(ptr1)=" <<
typeid(ptr1).name()
560 <<
" but typeid(value.at(i)))=" <<
typeid(value.at(i)).name()
578 if (!value.empty()) {
579 if (this->size() == value.size()) {
580 for (
size_t i = 0; i < value.size(); i++) {
581 if (value.at(i)==NULL || this->at(i)==NULL) {
588 if (
typeid(*ptr1) ==
typeid(*ptr2)) {
591 QwError <<
"QwDataHandlerArray::AccumulateRunningSum here where types don't match" <<
QwLog::endl;
592 QwError <<
" typeid(ptr1)=" <<
typeid(ptr1).name()
593 <<
" but typeid(value.at(i)))=" <<
typeid(value.at(i)).name()
630 if (handler.get() == NULL) {
631 QwError <<
"QwDataHandlerArray::push_back(): NULL handler"
638 QwError <<
"QwDataHandlerArray::push_back(): handler " << handler->GetName()
643 QwError <<
"QwDataHandlerArray::push_back(): handler " << handler->GetName()
644 <<
" is not supported by this handler array" <<
QwLog::endl;
647 std::shared_ptr<VQwDataHandler> handler_tmp(handler);
648 HandlerPtrs::push_back(handler_tmp);
708 for(iterator handler = begin(); handler != end(); ++handler){
709 (*handler)->ProcessData();
710 (*handler)->AccumulateRunningSum();
718 for(iterator handler = begin(); handler != end(); ++handler){
719 (*handler)->FinishDataHandler();
#define QwVerbose
Predefined log drain for verbose messages.
#define QwError
Predefined log drain for errors.
#define QwWarning
Predefined log drain for warnings.
#define QwMessage
Predefined log drain for regular messages.
Parameter file parsing and management.
Virtual base class for data handlers accessing multiple subsystems.
Array container for managing multiple data handlers.
Helicity pattern analysis and management.
void SetParent(U *parent)
Set the parent container for this child object.
static std::ostream & endl(std::ostream &)
End of the line.
Command-line and configuration file options processor.
std::vector< T > GetValueVector(const std::string &key)
Get a list of templated values.
T GetValue(const std::string &key)
Get a templated value.
bool HasValue(const std::string &key)
Has this key been defined.
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Configuration file parser with flexible tokenization and search capabilities.
std::unique_ptr< QwParameterFile > ReadSectionPreamble()
Rewinds to the start and read until it finds next section header.
std::unique_ptr< QwParameterFile > ReadNextSection(std::string &secname, const bool keep_header=false)
A helper class to manage a vector of branch entries for ROOT trees.
A wrapper class for a ROOT file or memory mapped file.
void push_back(VQwDataHandler *handler)
Add the datahandler to this array.
static void DefineOptions(QwOptions &options)
Define configuration options for global array.
void FillNTupleFields(QwRootFile *treerootfile)
void CalculateRunningAverage()
Calculate the average for all good events.
void ConstructHistograms()
Construct the histograms for this subsystem.
void ProcessDataHandlerEntry()
void FillTreeBranches(QwRootFile *treerootfile)
VQwDataHandler * GetDataHandlerByName(const TString &name)
Get the handler with the specified name.
void FillDB(QwParityDB *db, TString type)
Fill the database.
void SetPointer(QwHelicityPattern &helicitypattern)
Bool_t ScopeMismatch(TString name)
std::vector< std::string > fDataHandlersDisabledByType
List of disabled names.
void ConstructTreeBranches(QwRootFile *treerootfile, const std::string &treeprefix="", const std::string &branchprefix="")
void PrintValue() const
Print value of all channels.
QwSubsystemArrayParity * fSubsystemArray
void AccumulateAllRunningSum(const QwDataHandlerArray &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
Update the running sums for devices check only the error flags at the channel level....
QwHelicityPattern * fHelicityPattern
Pointer for the original data source.
~QwDataHandlerArray() override
Default destructor.
QwDataHandlerArray()
Private default constructor.
void FillTreeVector(QwRootTreeBranchVector &values) const
Fill the vector for this handler.
void WritePromptSummary(QwPromptSummary *ps, TString type)
void ConstructNTupleFields(QwRootFile *treerootfile, const std::string &treeprefix="", const std::string &branchprefix="")
RNTuple methods.
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
Construct a branch and vector for this handler with a prefix.
static Bool_t CanContain(VQwDataHandler *handler)
Test whether this handler array can contain a particular handler.
std::string fDataHandlersMapFile
Filename of the global detector map.
std::vector< VQwDataHandler * > GetDataHandlerByType(const std::string &type)
void ProcessOptions(QwOptions &options)
Process configuration options for the datahandler array itself.
QwDataHandlerArray & operator=(const QwDataHandlerArray &value)
Assignment operator.
void AccumulateRunningSum()
Update the running sums for devices accumulated for the global error non-zero events/patterns.
void FillHistograms()
Fill the histograms.
EDataHandlerArrayScope fArrayScope
std::vector< std::string > fDataHandlersDisabledByName
List of disabled types.
void LoadDataHandlersFromParameterFile(QwParameterFile &mapfile, T &detectors, const TString &run)
Load data handlers from a parameter file.
Manages yields/differences/asymmetries for helicity patterns.
Subsystem array container specialized for parity analysis with asymmetry calculations.
Abstract base for handlers that consume multiple subsystems and produce derived outputs.
virtual void FillHistograms()
Fill the histograms.
virtual void ProcessData()
void FillTreeVector(QwRootTreeBranchVector &values) const
void AccumulateRunningSum()
void WritePromptSummary(QwPromptSummary *ps, TString type)
virtual void ParseConfigFile(QwParameterFile &file)
virtual void ClearEventData()
void CalculateRunningAverage()
void SetRunLabel(TString x)
void SetPointer(QwHelicityPattern *ptr)
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values)
virtual Int_t ConnectChannels(QwSubsystemArrayParity &, QwSubsystemArrayParity &asym, QwSubsystemArrayParity &diff)