14 #include <framework/core/ModuleParam.templateDetails.h>
15 #include <dqm/analysis/modules/DQMHistSnapshots.h>
16 #include <daq/slc/base/StringUtil.h>
37 addParam(
"CheckInterval", m_check_interval,
"Interval between two checks [s]", 180);
38 B2DEBUG(1,
"DQMHistSnapshots: Constructor done.");
42 DQMHistSnapshotsModule::~DQMHistSnapshotsModule() { }
44 void DQMHistSnapshotsModule::initialize()
47 B2DEBUG(20,
"DQMHistSnapshots: initialized.");
51 void DQMHistSnapshotsModule::beginRun()
54 B2DEBUG(20,
"DQMHistSnapshots: beginRun called.");
59 for (
auto& it : m_ssnode) {
60 if (it->histo->GetName() == a)
67 void DQMHistSnapshotsModule::event()
70 time_t cur_time = time(NULL);
72 if ((m_last_check == 0) || (cur_time - m_last_check > m_check_interval)) {
74 m_last_check = cur_time;
77 const HistList& hlist = getHistList();
79 for (HistList::const_iterator it = hlist.begin(); it != hlist.end(); ++it) {
80 TString a = it->first;
82 SSNODE* n = find_snapshot(a);
85 n->histo = (TH1*) it->second->Clone();
87 StringList s = StringUtil::split(a.Data(),
'/');
88 std::string dirname = s[0];
89 std::string hname = s[1];
90 std::string canvas_name = dirname +
"/c_" + hname;
91 n->canvas = findCanvas(canvas_name);
94 m_ssnode.push_back(n);
98 if (h->GetEntries() > n->histo->GetEntries()) {
100 n->histo = (TH1*)h->Clone();
106 if (n->stale == 1 && n->canvas != NULL) {
107 h->SetTitle((h->GetTitle() +
string(
" [STALLED]")).c_str());
114 void DQMHistSnapshotsModule::endRun()
116 B2DEBUG(20,
"DQMHistSnapshots: endRun called");
120 void DQMHistSnapshotsModule::terminate()
122 B2DEBUG(20,
"DQMHistSnapshots: terminate called");
The base class for the histogram analysis module.
std::map< std::string, TH1 * > HistList
The type of list of histograms.
Class for generating snapshots for histograms.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.
The struct for the snapshots.