14#include <framework/core/ModuleParam.templateDetails.h>
15#include <dqm/analysis/modules/DQMHistDeltaHisto.h>
36 B2DEBUG(20,
"DQMHistDeltaHisto: Constructor done.");
45 B2DEBUG(20,
"DQMHistDeltaHisto: initialized.");
56 B2DEBUG(20,
"DQMHistDeltaHisto: beginRun called.");
77 B2DEBUG(20,
"DQMHistDeltaHisto: event called.");
79 B2ERROR(
"No valid EventMetaData.");
85 TH1* hh =
findHist(histoname.c_str());
86 if (hh ==
nullptr)
continue;
87 if (hh->GetDimension() != 1)
continue;
91 n->histo = (TH1*)hh->Clone();
92 n->diff_histo = (TH1*)hh->Clone();
93 n->time_modified = cur_mtime;
99 if (hq.back()->time_modified == cur_mtime) {
103 n->histo = (TH1*)hh->Clone();
104 n->diff_histo = (TH1*)hh->Clone();
105 n->diff_histo->Add(nn->
histo, -1);
106 n->time_modified = cur_mtime;
117 auto dirname = s.at(0);
118 auto hname = s.at(1);
119 std::string canvas_name = dirname +
"/c_" + hname;
121 if (c ==
nullptr)
continue;
122 TH1* h_diff = hq.back()->diff_histo;
123 h_diff->SetName((histoname +
"_diff").data());
124 if (h_diff->Integral() != 0) h_diff->Scale(hh->Integral() / h_diff->Integral());
126 h_diff->SetLineColor(kRed);
127 h_diff->SetLineStyle(kDotted);
128 h_diff->SetStats(kFALSE);
129 h_diff->Draw(
"hist,same");
138 B2DEBUG(20,
"DQMHistDeltaHisto: endRun called");
144 B2DEBUG(20,
"DQMHistDeltaHisto: terminate called");
The base class for the histogram analysis module.
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).
std::vector< std::string > StringSplit(const std::string &s, const char delim)
Helper function for string token split.
void initialize() override final
Initializer.
~DQMHistDeltaHistoModule()
Destructor.
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.
TH1 * histo
The histogram for snapshot.
time_t time_modified
Whether the histogram is not updated for a long time.