14#include <framework/core/ModuleParam.templateDetails.h>
15#include <dqm/analysis/modules/DQMHistDeltaHisto.h>
36 B2DEBUG(20,
"DQMHistDeltaHisto: Constructor done.");
42 B2DEBUG(20,
"DQMHistDeltaHisto: initialized.");
53 B2DEBUG(20,
"DQMHistDeltaHisto: beginRun called.");
74 B2DEBUG(20,
"DQMHistDeltaHisto: event called.");
76 B2ERROR(
"No valid EventMetaData.");
82 auto hh =
findHist(histoname.c_str());
83 if (hh ==
nullptr)
continue;
84 if (hh->GetDimension() != 1)
continue;
88 n->histo = (TH1*)hh->Clone();
89 n->diff_histo = (TH1*)hh->Clone();
90 n->time_modified = cur_mtime;
95 if ((cur_mtime - nn->time_modified <
m_interval) || (hq.size() == 1)) {
96 if (hq.back()->time_modified == cur_mtime) {
100 n->histo = (TH1*)hh->Clone();
101 n->diff_histo = (TH1*)hh->Clone();
102 n->diff_histo->Add(nn->histo, -1);
103 n->time_modified = cur_mtime;
114 auto dirname = s.at(0);
115 auto hname = s.at(1);
116 std::string canvas_name = dirname +
"/c_" + hname;
118 if (c ==
nullptr)
continue;
119 TH1* h_diff = hq.back()->diff_histo;
120 h_diff->SetName((histoname +
"_diff").data());
121 if (h_diff->Integral() != 0) h_diff->Scale(hh->Integral() / h_diff->Integral());
123 h_diff->SetLineColor(kRed);
124 h_diff->SetLineStyle(kDotted);
125 h_diff->SetStats(kFALSE);
126 h_diff->Draw(
"hist,same");
135 B2DEBUG(20,
"DQMHistDeltaHisto: endRun called");
141 B2DEBUG(20,
"DQMHistDeltaHisto: terminate called");
static TCanvas * findCanvas(TString cname)
Find canvas by name.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
static std::vector< std::string > StringSplit(const std::string &s, const char delim)
Helper function for string token split.
DQMHistAnalysisModule()
Constructor / Destructor.
void initialize() override final
Initializer.
StoreObjPtr< EventMetaData > m_evtMetaDataPtr
The metadata for each event.
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 clear_node(SSNODE *n)
Clear content of SSNODE.
void endRun() override final
This method is called if the current run ends.
int m_interval
Interval between checks in second.
DQMHistDeltaHistoModule()
Constructor.
std::map< std::string, std::queue< SSNODE * > > m_histosQueues
Map of histogram names to queues of monitoring objects.
void beginRun() override final
Called when entering a new run.
std::vector< std::string > m_monitoredHistos
Names of the histograms that should be monitored.
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.
The struct for the snapshots.