10 #include <dqm/analysis/modules/DQMHistAnalysisHLTMonObj.h>
13 #include <hlt/utilities/Units.h>
27 DQMHistAnalysisHLTMonObjModule::DQMHistAnalysisHLTMonObjModule()
30 setDescription(
"Produces MonitoringObject for the HLT from the available DQM histograms");
45 m_c_filter =
new TCanvas(
"Filter",
"filter", 750, 400);
46 m_c_skim =
new TCanvas(
"Skim" ,
"skim", 400, 400);
47 m_c_hardware =
new TCanvas(
"Hardware",
"hardware", 1000, 1000);
48 m_c_l1 =
new TCanvas(
"L1",
"l1", 750, 400);
72 TH1* h_hlt =
findHist(
"softwaretrigger/total_result");
73 TH1* h_skim =
findHist(
"softwaretrigger/skim");
74 TH1* h_budget =
findHist(
"timing_statistics/fullTimeHistogram");
75 TH1* h_processing =
findHist(
"timing_statistics/processingTimeHistogram");
76 TH1* h_meantime =
findHist(
"timing_statistics/meanTimeHistogram");
77 TH1* h_budg_unit =
findHist(
"timing_statistics/fullTimeMeanPerUnitHistogram");
78 TH1* h_proc_unit =
findHist(
"timing_statistics/processingTimeMeanPerUnitHistogram");
79 TH1* h_procs =
findHist(
"timing_statistics/processesPerUnitHistogram");
80 TH1* h_l1 =
findHist(
"softwaretrigger_before_filter/hlt_unit_number");
81 TH1* h_err_flag =
findHist(
"softwaretrigger_before_filter/error_flag");
82 TH1* h_hlt_triggers =
findHist(
"softwaretrigger/filter");
83 TH1* h_l1_triggers =
findHist(
"TRGGDL/hGDL_psn_all");
84 TH1* h_l1_triggers_filt =
findHist(
"softwaretrigger/l1_total_result");
85 TH1* h_l1_cat_w_overlap =
findHist(
"TRGGDL/hGDL_psn_raw_rate_all");
86 TH1* h_l1_cat_wo_overlap =
findHist(
"TRGGDL/hGDL_psn_effect_to_l1_all");
87 TH1* h_full_mem =
findHist(
"timing_statistics/fullMemoryHistogram");
93 if (h_hlt) h_hlt->Draw();
95 if (h_hlt_triggers) h_hlt_triggers->Draw();
97 if (h_err_flag) h_err_flag->Draw();
102 if (h_skim) h_skim->Draw();
108 if (h_l1) h_l1->Draw();
110 if (h_budget) h_budget->Draw();
112 if (h_processing) h_processing->Draw();
114 if (h_budg_unit) h_budg_unit->Draw();
116 if (h_proc_unit) h_proc_unit->Draw();
118 if (h_meantime) h_meantime->Draw();
120 if (h_procs) h_procs->Draw();
122 if (h_full_mem) h_full_mem->Draw();
128 if (h_l1_triggers) h_l1_triggers->Draw();
130 if (h_l1_triggers_filt) h_l1_triggers_filt->Draw();
132 if (h_l1_cat_w_overlap) h_l1_cat_w_overlap->Draw();
134 if (h_l1_cat_wo_overlap) h_l1_cat_wo_overlap->Draw();
137 if (h_hlt) n_hlt = (double)h_hlt->GetBinContent((h_hlt->GetXaxis())->FindFixBin(
"total_result"));
140 if (h_l1) n_l1 = h_l1->GetEntries();
143 if (h_procs) n_procs = h_procs->GetEntries();
148 for (
int ibin = 1; ibin < h_skim->GetXaxis()->GetNbins() + 1; ibin++) {
149 double nentr = (double)h_skim->GetBinContent(ibin);
150 std::string bin_name(h_skim->GetXaxis()->GetBinLabel(ibin));
157 for (
int ibin = 1; ibin < h_l1_triggers->GetXaxis()->GetNbins() + 1; ibin++) {
158 double nentr = (double)h_l1_triggers->GetBinContent(ibin);
159 std::string bin_name(h_l1_triggers->GetXaxis()->GetBinLabel(ibin));
160 if (bin_name ==
"")
continue;
165 if (h_l1_triggers_filt) {
167 for (
int ibin = 1; ibin < h_l1_triggers_filt->GetXaxis()->GetNbins() + 1; ibin++) {
168 double nentr = (double)h_l1_triggers_filt->GetBinContent(ibin);
169 std::string bin_name(h_l1_triggers_filt->GetXaxis()->GetBinLabel(ibin));
170 if (bin_name ==
"")
continue;
175 if (h_hlt_triggers) {
177 for (
int ibin = 1; ibin < h_hlt_triggers->GetXaxis()->GetNbins() + 1; ibin++) {
178 double nentr = (double)h_hlt_triggers->GetBinContent(ibin);
179 std::string bin_name(h_hlt_triggers->GetXaxis()->GetBinLabel(ibin));
180 bin_name = std::regex_replace(bin_name, std::regex(
"=="),
"_eq_");
181 bin_name = std::regex_replace(bin_name, std::regex(
"\\."),
"_");
188 for (
int ibin = 1; ibin < h_meantime->GetXaxis()->GetNbins() + 1; ibin++) {
189 double nentr = (double)h_meantime->GetBinContent(ibin);
190 std::string bin_name(h_meantime->GetXaxis()->GetBinLabel(ibin));
197 for (
int ibin = 1; ibin < h_err_flag->GetXaxis()->GetNbins() + 1; ibin++) {
198 double nentr = (double)h_err_flag->GetBinContent(ibin);
199 std::string bin_name(h_err_flag->GetXaxis()->GetBinLabel(ibin));
204 if (h_l1_cat_w_overlap) {
206 for (
int ibin = 1; ibin < h_l1_cat_w_overlap->GetXaxis()->GetNbins() + 1; ibin++) {
207 double nentr = (double)h_l1_cat_w_overlap->GetBinContent(ibin);
208 std::string bin_name(h_l1_cat_w_overlap->GetXaxis()->GetBinLabel(ibin));
213 if (h_l1_cat_wo_overlap) {
215 for (
int ibin = 1; ibin < h_l1_cat_wo_overlap->GetXaxis()->GetNbins() + 1; ibin++) {
216 double nentr = (double)h_l1_cat_wo_overlap->GetBinContent(ibin);
217 std::string bin_name(h_l1_cat_wo_overlap->GetXaxis()->GetBinLabel(ibin));
223 if (h_budget) bgt = h_budget->GetMean();
228 double procTime = 0.;
229 if (h_processing) procTime = h_processing->GetMean();
232 double fullMemory = 0.;
233 if (h_full_mem) fullMemory = h_full_mem->GetBinLowEdge(h_full_mem->FindLastBinAbove(0) + 1);
236 TH1* h_budgetUnit =
nullptr;
237 TH1* h_memoryUnit =
nullptr;
239 for (
unsigned int index = 1; index <= HLTUnits::max_hlt_units; index++) {
241 h_budgetUnit =
findHist((
"timing_statistics/fullTimePerUnitHistogram_HLT" + std::to_string(index)).c_str());
243 if (h_budgetUnit) bgunit = h_budgetUnit->GetMean();
246 h_budgetUnit =
findHist((
"timing_statistics/processingTimePerUnitHistogram_HLT" + std::to_string(index)).c_str());
247 if (h_budgetUnit) bgunit = h_budgetUnit->GetMean();
251 h_memoryUnit =
findHist((
"timing_statistics/fullMemoryPerUnitHistogram_HLT" + std::to_string(index)).c_str());
253 if (h_memoryUnit && bgunit > 0) memunit = h_memoryUnit->GetBinLowEdge(h_memoryUnit->FindLastBinAbove(0.) + 1);
257 B2DEBUG(20,
"DQMHistAnalysisHLTMonObj : endRun called");
262 B2DEBUG(20,
"terminate called");
TCanvas * m_c_skim
Canvas with histograms related to HLT skims.
TCanvas * m_c_l1
Canvas with histograms related to L1.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
virtual void terminate() override
Termination action.
MonitoringObject * m_monObj
MonitoringObject to be produced by this module.
virtual void beginRun() override
Begin run function.
TCanvas * m_c_filter
Canvas with histograms related to HLT filter.
virtual ~DQMHistAnalysisHLTMonObjModule()
Destructor.
TCanvas * m_c_hardware
Canvas with histograms related to HLT hardware.
The base class for the histogram analysis module.
static TH1 * findHist(const std::string &histname)
Find histogram.
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
void setVariable(const std::string &var, float val, float upErr=-1., float dwErr=-1)
set value to float variable (new variable is made if not yet existing)
void addCanvas(TCanvas *canv)
Add Canvas to monitoring object.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.