9#include <dqm/core/modules/DQMHistReferenceModule.h>
30 B2DEBUG(1,
"DQMHistReference: Constructor done.");
38 B2DEBUG(1,
"DQMHistReference: initialized.");
43 B2DEBUG(1,
"DQMHistReference: beginRun called.");
50 TH1::AddDirectory(
false);
52 B2DEBUG(1,
"DQMHistReference: reading references from input root file");
55 if (run_type ==
"") run_type =
"default";
57 B2INFO(
"DQMHistReference: run_type " << run_type);
61 if (refFile->IsZombie()) {
62 B2INFO(
"DQMHistReference: reference file " <<
m_referenceFileName <<
" does not exist. No references will be used!");
70 TIter nextRefDirKey(refFile->GetListOfKeys());
72 while ((refDirKey = (TKey*)nextRefDirKey())) {
73 if (refDirKey->IsFolder() &&
string(refDirKey->GetName()) ==
string(
"ref")) {
74 TDirectory* refDir = (TDirectory*)refDirKey->ReadObj();
75 TIter nextDetDirKey(refDir->GetListOfKeys());
78 while ((detDirKey = (TKey*)nextDetDirKey())) {
79 if (!detDirKey->IsFolder())
continue;
80 TDirectory* detDir = ((TDirectory*)detDirKey->ReadObj());
81 TIter nextRunTypeDirKey(detDir->GetListOfKeys());
83 TDirectory* runtypeDir =
nullptr;
85 while ((runtypeDirKey = (TKey*)nextRunTypeDirKey())) {
86 if (!runtypeDirKey->IsFolder())
continue;
87 if (
string(runtypeDirKey->GetName()) == run_type) {
88 if (runtypeDir)
delete runtypeDir;
89 runtypeDir = (TDirectory*)runtypeDirKey->ReadObj();
93 if (
string(runtypeDirKey->GetName()) ==
"default") runtypeDir = (TDirectory*)runtypeDirKey->ReadObj();
95 string detName = detDir->GetName();
97 B2INFO(
"No run type specific or default references available for " << detName);
99 B2INFO(
"Reading reference histograms for " << detName <<
" from run type folder: " << runtypeDirKey->GetName());
101 TIter nextHistkey(runtypeDir->GetListOfKeys());
104 while ((histKey = (TKey*)nextHistkey())) {
105 if (histKey->IsFolder())
continue;
106 if (gROOT->GetClass(histKey->GetClassName())->InheritsFrom(
"TH1")) {
107 addRefHist(detName, (TH1*)histKey->ReadObj());
118 B2INFO(
"DQMHistReference: read references done");
125 B2DEBUG(1,
"DQMHistReference: event called");
130 B2DEBUG(1,
"DQMHistReference: endRun called");
135 B2DEBUG(1,
"DQMHistReference: terminate called");
The base class for the histogram analysis module.
void addRefHist(const std::string &dirname, TH1 *hist)
Add reference histogram.
static const std::string & getRunType(void)
Get the list of the reference histograms.
void initialize() override final
Initializer.
~DQMHistReferenceModule()
Destructor.
void loadReferenceHistos()
Reads reference histograms from input root file.
DQMHistReferenceModule()
Constructor.
void terminate() override final
This method is called at the end of the event processing.
void event() override final
This method is called for each event.
void endRun() override final
This method is called if the current run ends.
void beginRun() override final
Called when entering a new run.
std::string m_referenceFileName
Reference Histogram Root file name.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.