9#include <dqm/analysis/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 nextkey(refFile->GetListOfKeys());
72 while ((key = (TKey*)nextkey())) {
73 if (key->IsFolder() &&
string(key->GetName()) ==
string(
"ref")) {
74 TDirectory* refdir = (TDirectory*)key->ReadObj();
75 TIter nextDetDir(refdir->GetListOfKeys());
78 while ((detDir = (TKey*)nextDetDir())) {
79 if (!detDir->IsFolder())
continue;
80 TIter nextTypeDir(((TDirectory*)detDir->ReadObj())->GetListOfKeys());
82 TDirectory* foundDir = NULL;
84 while ((typeDir = (TKey*)nextTypeDir())) {
85 if (!typeDir->IsFolder())
continue;
86 if (
string(typeDir->GetName()) == run_type) {
87 foundDir = (TDirectory*)typeDir->ReadObj();
90 if (
string(typeDir->GetName()) ==
"default") foundDir = (TDirectory*)typeDir->ReadObj();
92 string dirname = detDir->GetName();
94 B2INFO(
"No run type specific or default references available for " << dirname);
96 B2INFO(
"Reading reference histograms for " << dirname <<
" from run type folder: " << foundDir->GetName());
98 TIter next(foundDir->GetListOfKeys());
101 while ((hh = (TKey*)next())) {
102 if (hh->IsFolder())
continue;
103 if (gROOT->GetClass(key->GetClassName())->InheritsFrom(
"TH1")) {
115 B2INFO(
"DQMHistReference: read references done");
122 B2DEBUG(1,
"DQMHistReference: event called");
127 B2DEBUG(1,
"DQMHistReference: endRun called");
132 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.