Belle II Software development
DQMHistAnalysisTrackingAbort.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <dqm/analysis/modules/DQMHistAnalysisTrackingAbort.h>
10
11#include <TROOT.h>
12#include <TString.h>
13#include <TH1F.h>
14#include <TH2F.h>
15
16#include <TMath.h>
17#include <iostream>
18
19using namespace Belle2;
20
21//-----------------------------------------------------------------
22// Register the Module
23//-----------------------------------------------------------------
24REG_MODULE(DQMHistAnalysisTrackingAbort);
25
26//-----------------------------------------------------------------
27// Implementation
28//-----------------------------------------------------------------
29
32{
33
34 setDescription("DQM Analysis Module of the Tracking HLT Plots.");
35
36 addParam("failureRateThreshold", m_failureRateThreshold,
37 "Maximum Fraction of Events in which Tracking Aborts before turning Canvas to Red. Will be taken from Epics by default, \
38 this value is only taken if Epics is not available!", double(m_failureRateThreshold));
39 addParam("minNoEvents", m_statThreshold,
40 "Minimum Number of Events before scaring CR shifters. Will be taken from Epics by default, \
41 this value is only taken if Epics is not available!", int(m_statThreshold));
42 addParam("printCanvas", m_printCanvas, "if True prints pdf of the analysis canvas", bool(m_printCanvas));
43
44}
45
46
48{
49 // get the abort rate and statThreshold from epics
50 double buffThreshold(NAN);
51 double buffMinEvents(NAN);
52 double dummyLowerAlarm, dummyLowerWarn, dummyUpperWarn, dummyUpperAlarm;
53
54 // read thresholds from EPICS
55 requestLimitsFromEpicsPVs("abortRate", dummyLowerAlarm, dummyLowerWarn, dummyUpperWarn, buffThreshold);
56 requestLimitsFromEpicsPVs("minNoEvents", dummyLowerAlarm, buffMinEvents, dummyUpperWarn, dummyUpperAlarm);
57
58 if (!std::isnan(buffThreshold)) {
59 B2INFO(getName() << ": Setting failure rate threshold from EPICS. New failureRateThreshold " << buffThreshold);
60 m_failureRateThreshold = buffThreshold;
61 }
62 if (!std::isnan(buffMinEvents)) {
63 B2INFO(getName() << ": Setting min number of events threshold from EPICS. New minNoEvents " << buffMinEvents);
64 m_statThreshold = buffMinEvents;
65 }
66
67}
68
69
71{
72
73 gROOT->cd();
74 m_cAbortRate = new TCanvas("TrackingAnalysis/c_TrackingAbort");
75 m_cAbortRate_BF = new TCanvas("TrackingAnalysis/c_TrackingAbort_BF");
76
77 m_cAbortRateIN = new TCanvas("TrackingAnalysis/c_TrackingAbortIN");
78 m_cAbortRateOUT = new TCanvas("TrackingAnalysis/c_TrackingAbortOUT");
79 m_cAbortRateIN_BF = new TCanvas("TrackingAnalysis/c_TrackingAbortIN_BF");
80 m_cAbortRateOUT_BF = new TCanvas("TrackingAnalysis/c_TrackingAbortOUT_BF");
81
82 // add MonitoringObject
83 m_monObj = getMonitoringObject("trackingHLT");
84
85 // register the PVs for setting thresholds
86 registerEpicsPV("TRACKING:minNoEvents", "minNoEvents");
87
88 // variables to be monitored via EPICS
89 //abort rates
90 registerEpicsPV("trackingHLT:abortRate", "abortRate");
91 registerEpicsPV("trackingHLT:abortRate_inActiveVeto", "abortRate_inActiveVeto");
92 registerEpicsPV("trackingHLT:abortRate_outActiveVeto", "abortRate_outActiveVeto");
93 registerEpicsPV("trackingHLT:abortRateBeforeFilter", "abortRateBeforeFilter");
94 registerEpicsPV("trackingHLT:abortRateBeforeFilter_inActiveVeto", "abortRateBeforeFilter_inActiveVeto");
95 registerEpicsPV("trackingHLT:abortRateBeforeFilter_outActiveVeto", "abortRateBeforeFilter_outActiveVeto");
96
97
98 //abort rate AFTER the Filter:
99 //must have THE SAME binning as mEventsWithAborts from TrackingAbortDQM
100 std::string histoName = "EventsWithAborts";
101 std::string histoTitle = "Fraction of Events With at Least one Abort [After Filter]";
102 m_hAbort = new TH1F(TString::Format("%s", histoName.c_str()),
103 TString::Format("%s", histoTitle.c_str()),
104 2, -0.5, 1.5);
105 m_hAbort->GetYaxis()->SetTitle("Number of Events");
106 m_hAbort->GetXaxis()->SetBinLabel(1, "No Abort");
107 m_hAbort->GetXaxis()->SetBinLabel(2, "At Least One Abort");
108 m_hAbort->SetMinimum(0.1);
109
110 //abort rate BEFORE the Filter:
111 //must have THE SAME binning as mEventsWithAborts from TrackingAbortDQM
112 histoName = "EventsWithAborts_beforeFilter";
113 histoTitle = "Fraction of Events With at Least one Abort [Before Filter]";
114 m_hAbort_BF = new TH1F(TString::Format("%s", histoName.c_str()),
115 TString::Format("%s", histoTitle.c_str()),
116 2, -0.5, 1.5);
117 m_hAbort_BF->GetYaxis()->SetTitle("Number of Events");
118 m_hAbort_BF->GetXaxis()->SetBinLabel(1, "No Abort");
119 m_hAbort_BF->GetXaxis()->SetBinLabel(2, "At Least One Abort");
120 m_hAbort_BF->SetMinimum(0.1);
121
122}
123
125{
126
127 //check Tracking Abort Rate AFTER the filter
128 TH1* hAbortIn = findHist("TrackingAbort/EventsWithAborts_IN");
129 TH1* hAbortOut = findHist("TrackingAbort/EventsWithAborts_OUT");
130
131 int nEventsIN = 0;
132 int nEventsOUT = 0;
133
134 if (hAbortIn != nullptr && hAbortOut != nullptr) {
135
136 nEventsIN = hAbortIn->GetEntries();
137 m_monObj->setVariable("nEvents_inActiveVeto", nEventsIN);
138 nEventsOUT = hAbortOut->GetEntries();
139 m_monObj->setVariable("nEvents_outActiveVeto", nEventsOUT);
140 const int nEvents = nEventsIN + nEventsOUT;
141
142 m_hAbort->SetBinContent(1, hAbortIn->GetBinContent(1) + hAbortOut->GetBinContent(1));
143 m_hAbort->SetBinContent(2, hAbortIn->GetBinContent(2) + hAbortOut->GetBinContent(2));
144
145 const double abortRate = (double)m_hAbort->GetBinContent(2) / (m_hAbort->GetBinContent(1) + m_hAbort->GetBinContent(2));
146 m_hAbort->SetTitle(Form("[After Filter] Fraction of Events in which Tracking Aborts = %.2f %%", abortRate * 100));
147
148 if (nEvents >= m_statThreshold) {
149 m_monObj->setVariable("abortRate", abortRate);
150 setEpicsPV("abortRate", abortRate);
151
152 const double abortRate_in = hAbortIn->GetMean();
153 m_monObj->setVariable("abortRate_inActiveVeto", abortRate_in);
154 setEpicsPV("abortRate_inActiveVeto", abortRate_in);
155
156 const double abortRate_out = hAbortOut->GetMean();
157 m_monObj->setVariable("abortRate_outActiveVeto", abortRate_out);
158 setEpicsPV("abortRate_outActiveVeto", abortRate_out);
159
160 }
161
162 //check if number of errors is above the allowed limit
163 const bool hasError = abortRate > m_failureRateThreshold;
164
165 m_cAbortRateIN->cd();
166 hAbortIn->Draw();
167
168 m_cAbortRateOUT->cd();
169 hAbortOut->Draw();
170
171 m_cAbortRate->cd();
172 m_hAbort->Draw();
173
174
175 auto state = makeStatus(nEvents >= m_statThreshold, false, hasError);
177
178 } else { // histograms not found
180 }
181
182 m_cAbortRate->Modified();
183 m_cAbortRate->Update();
184
185 //check Tracking Abort Rate BEFORE the filter
186
187 TH1* hAbortIn_BF = findHist("TrackingAbort_before_filter/EventsWithAborts_IN");
188 TH1* hAbortOut_BF = findHist("TrackingAbort_before_filter/EventsWithAborts_OUT");
189
190 int nEventsINbf = 0;
191 int nEventsOUTbf = 0;
192
193 if (hAbortIn_BF != nullptr && hAbortOut_BF != nullptr) {
194
195 nEventsINbf = hAbortIn_BF->GetEntries();
196 m_monObj->setVariable("nEventsBeforeFilter_inActiveVeto", nEventsINbf);
197 nEventsOUTbf = hAbortOut_BF->GetEntries();
198 m_monObj->setVariable("nEventsBeforeFilter_outActiveVeto", nEventsOUTbf);
199 const int nEvents_BF = nEventsINbf + nEventsOUTbf;
200
201 m_hAbort_BF->SetBinContent(1, hAbortIn_BF->GetBinContent(1) + hAbortOut_BF->GetBinContent(1));
202 m_hAbort_BF->SetBinContent(2, hAbortIn_BF->GetBinContent(2) + hAbortOut_BF->GetBinContent(2));
203
204 const double abortRate_BF = (double)m_hAbort_BF->GetBinContent(2) / (m_hAbort_BF->GetBinContent(1) + m_hAbort_BF->GetBinContent(2));
205 m_hAbort_BF->SetTitle(Form("[Before Filter] Fraction of Events in which Tracking Aborts = %.2f %%", abortRate_BF * 100));
206
207 if (nEvents_BF >= m_statThreshold) {
208 m_monObj->setVariable("abortRateBeforeFilter", abortRate_BF);
209 setEpicsPV("abortRateBeforeFilter", abortRate_BF);
210
211 const double abortRate_in = hAbortIn_BF->GetMean();
212 m_monObj->setVariable("abortRateBeforeFilter_inActiveVeto", abortRate_in);
213 setEpicsPV("abortRateBeforeFilter_inActiveVeto", abortRate_in);
214 const double abortRate_out = hAbortOut_BF->GetMean();
215 m_monObj->setVariable("abortRateBeforeFilter_outActiveVeto", abortRate_out);
216 setEpicsPV("abortRateBeforeFilter_outActiveVeto", abortRate_out);
217 }
218
219 m_cAbortRateIN_BF->cd();
220 hAbortIn_BF->Draw();
221
222 m_cAbortRateOUT_BF->cd();
223 hAbortOut_BF->Draw();
224
225 m_cAbortRate_BF->cd();
226 m_hAbort_BF->Draw();
227
228 }
229
230 //scale tracking abort reason histograms
231
232 if (auto* hAbortReason_in = findHist("TrackingAbort/TrkAbortReason_IN");
233 hAbortReason_in != nullptr) scaleAndSendToMirabelle(hAbortReason_in, nEventsIN, "_inActiveVeto");
234 if (auto* hAbortReason_out = findHist("TrackingAbort/TrkAbortReason_OUT");
235 hAbortReason_out != nullptr) scaleAndSendToMirabelle(hAbortReason_out, nEventsOUT, "_outActiveVeto");
236 if (auto* hAbortReason_in_BF = findHist("TrackingAbort_before_filter/TrkAbortReason_IN");
237 hAbortReason_in_BF != nullptr) scaleAndSendToMirabelle(hAbortReason_in_BF, nEventsIN, "BeforeFilter_inActiveVeto");
238 if (auto* hAbortReason_out_BF = findHist("TrackingAbort_before_filter/TrkAbortReason_OUT");
239 hAbortReason_out_BF != nullptr) scaleAndSendToMirabelle(hAbortReason_out_BF, nEventsOUT, "BeforeFilter_outActiveVeto");
240
241
242 //scale average histograms
243
244 if (auto* hAverage_in = findHist("TrackingAbort/averages_IN");
245 hAverage_in != nullptr) scaleAndSendToMirabelle(hAverage_in, nEventsIN, "_inActiveVeto");
246 if (auto* hAverage_out = findHist("TrackingAbort/averages_OUT");
247 hAverage_out != nullptr) scaleAndSendToMirabelle(hAverage_out, nEventsOUT, "_outActiveVeto");
248 if (auto* hAverage_in_BF = findHist("TrackingAbort_before_filter/averages_IN");
249 hAverage_in_BF != nullptr) scaleAndSendToMirabelle(hAverage_in_BF, nEventsINbf, "BeforeFilter_inActiveVeto");
250 if (auto* hAverage_out_BF = findHist("TrackingAbort_before_filter/averages_OUT");
251 hAverage_out_BF != nullptr) scaleAndSendToMirabelle(hAverage_out_BF, nEventsOUTbf, "BeforeFilter_outActiveVeto");
252
253 // average SVD L3U Occupancy to Mirabelle
254 if (auto* hL3UOccIn = findHist("TrackingAbort/SVDL3UOcc_IN");
255 hL3UOccIn != nullptr) m_monObj->setVariable("svdL3UOcc_inActiveVeto", hL3UOccIn->GetMean());
256 if (auto* hL3UOccOut = findHist("TrackingAbort/SVDL3UOcc_OUT");
257 hL3UOccOut != nullptr) m_monObj->setVariable("svdL3UOcc_outActiveVeto", hL3UOccOut->GetMean());
258 if (auto* hL3UOccIn_BF = findHist("TrackingAbort_before_filter/SVDL3UOcc_IN");
259 hL3UOccIn_BF != nullptr) m_monObj->setVariable("svdL3UOccBeforeFilter_inActiveVeto", hL3UOccIn_BF->GetMean());
260 if (auto* hL3UOccOut_BF = findHist("TrackingAbort_before_filter/SVDL3UOcc_OUT");
261 hL3UOccOut_BF != nullptr) m_monObj->setVariable("svdL3UOccBeforeFilter_outActiveVeto", hL3UOccOut_BF->GetMean());
262
263
264 // average n CDC extra hits to Mirabelle
265
266 if (auto* hCDCExtraHitsIn = findHist("TrackingAbort/nCDCExtraHits_IN");
267 hCDCExtraHitsIn != nullptr) m_monObj->setVariable("nCDCExtraHits_inActiveVeto", hCDCExtraHitsIn->GetMean());
268
269 if (auto* hCDCExtraHitsOut = findHist("TrackingAbort/nCDCExtraHits_OUT"); hCDCExtraHitsOut != nullptr) {
270 m_monObj->setVariable("nCDCExtraHits_outActiveVeto", hCDCExtraHitsOut->GetMean());
271 m_monObj->setVariable("nCDCExtraHitsRMS_outActiveVeto", hCDCExtraHitsOut->GetRMS());
272
273 // count fraction of events with nExtraCDCHits > 2700 (outside Active Veto)
274 int from_bin = hCDCExtraHitsOut->FindBin(2700);
275 int to_bin = hCDCExtraHitsOut->GetNbinsX() + 1;
276 double integral = hCDCExtraHitsOut->Integral(from_bin, to_bin);
277 if (hCDCExtraHitsOut->GetEntries() > 0) {
278 m_monObj->setVariable("fEventsWithCDCExtraHitsAbove2700_outActiveVeto", integral / hCDCExtraHitsOut->GetEntries());
279 }
280 }
281
282
283 if (auto* hCDCExtraHitsIn_BF = findHist("TrackingAbort_before_filter/nCDCExtraHits_IN");
284 hCDCExtraHitsIn_BF != nullptr) m_monObj->setVariable("nCDCExtraHitsBeforeFilter_inActiveVeto", hCDCExtraHitsIn_BF->GetMean());
285 if (auto* hCDCExtraHitsOut_BF = findHist("TrackingAbort_before_filter/nCDCExtraHits_OUT");
286 hCDCExtraHitsOut_BF != nullptr) m_monObj->setVariable("nCDCExtraHitsBeforeFilter_outActiveVeto", hCDCExtraHitsOut_BF->GetMean());
287
288 // nCDCExtraHits & nCDCHits in SLs
289 TH1* noCDCHitsInSLIn_BF = findHist("TrackingAbort_before_filter/noCDCHitsInSL_IN");
290 if ((noCDCHitsInSLIn_BF != nullptr) && (nEventsINbf > 0)) {
291 noCDCHitsInSLIn_BF->Scale(1. / nEventsINbf);
292 noCDCHitsInSLIn_BF->GetYaxis()->SetTitle("Fraction of Events");
293 }
294 TH1* noCDCHitsInSLOut_BF = findHist("TrackingAbort_before_filter/noCDCHitsInSL_OUT");
295 if ((noCDCHitsInSLOut_BF != nullptr) && (nEventsOUTbf > 0)) {
296 noCDCHitsInSLOut_BF->Scale(1. / nEventsOUTbf);
297 noCDCHitsInSLOut_BF->GetYaxis()->SetTitle("Fraction of Events");
298 }
299 TH1* noCDCHitsInSLIn = findHist("TrackingAbort/noCDCHitsInSL_IN");
300 if ((noCDCHitsInSLIn != nullptr) && (nEventsIN > 0)) {
301 noCDCHitsInSLIn->Scale(1. / nEventsIN);
302 noCDCHitsInSLIn->GetYaxis()->SetTitle("Fraction of Events");
303 }
304 TH1* noCDCHitsInSLOut = findHist("TrackingAbort/noCDCHitsInSL_OUT");
305 if ((noCDCHitsInSLOut != nullptr) && (nEventsOUT > 0)) {
306 noCDCHitsInSLOut->Scale(1. / nEventsOUT);
307 noCDCHitsInSLOut->GetYaxis()->SetTitle("Fraction of Events");
308 }
309 for (int sl = 0; sl < 9; sl++) {
310 //before filter IN & OUT
311 // nCDCExtraHits
312 if (TH1* hCDCExtraHitsSLIn_BF = findHist(Form("TrackingAbort_before_filter/nCDCExtraHitsSL%d_IN", sl));
313 hCDCExtraHitsSLIn_BF != nullptr) m_monObj->setVariable(Form("nCDCExtraHitsSL%dBeforeFilter_inActiveVeto", sl),
314 hCDCExtraHitsSLIn_BF->GetMean());
315 if (TH1* hCDCExtraHitsSLOut_BF = findHist(Form("TrackingAbort_before_filter/nCDCExtraHitsSL%d_OUT", sl));
316 hCDCExtraHitsSLOut_BF != nullptr) m_monObj->setVariable(Form("nCDCExtraHitsSL%dBeforeFilter_outActiveVeto", sl),
317 hCDCExtraHitsSLOut_BF->GetMean());
318 // signal CDC hits
319 if (TH1* hCDCHitsSLIn_BF = findHist(Form("TrackingAbort_before_filter/nCDCHitsSL%d_IN", sl));
320 hCDCHitsSLIn_BF != nullptr) m_monObj->setVariable(Form("nCDCHitsSL%dBeforeFilter_inActiveVeto", sl),
321 hCDCHitsSLIn_BF->GetMean());
322 if (TH1* hCDCHitsSLOut_BF = findHist(Form("TrackingAbort_before_filter/nCDCHitsSL%d_OUT", sl));
323 hCDCHitsSLOut_BF != nullptr) m_monObj->setVariable(Form("nCDCHitsSL%dBeforeFilter_outActiveVeto", sl),
324 hCDCHitsSLOut_BF->GetMean());
325 // fraction of CDCExtraHits post cleaning
326 if (TH1* hfCDCExtraHitsPCSLIn_BF = findHist(Form("TrackingAbort_before_filter/fCDCExtraHitsPostCleanSL%d_IN", sl));
327 hfCDCExtraHitsPCSLIn_BF != nullptr) m_monObj->setVariable(Form("fCDCExtraHitsPostCleanSL%dBeforeFilter_inActiveVeto", sl),
328 hfCDCExtraHitsPCSLIn_BF->GetMean());
329 if (TH1* hfCDCExtraHitsPCSLOut_BF = findHist(Form("TrackingAbort_before_filter/fCDCExtraHitsPostCleanSL%d_OUT", sl));
330 hfCDCExtraHitsPCSLOut_BF != nullptr) m_monObj->setVariable(Form("fCDCExtraHitsPostCleanSL%dBeforeFilter_outActiveVeto", sl),
331 hfCDCExtraHitsPCSLOut_BF->GetMean());
332 //after filter IN & OUT
333 // nCDCExtraHits
334 if (TH1* hCDCExtraHitsSLIn = findHist(Form("TrackingAbort/nCDCExtraHitsSL%d_IN", sl));
335 hCDCExtraHitsSLIn != nullptr) m_monObj->setVariable(Form("nCDCExtraHitsSL%d_inActiveVeto", sl),
336 hCDCExtraHitsSLIn->GetMean());
337 if (TH1* hCDCExtraHitsSLOut = findHist(Form("TrackingAbort/nCDCExtraHitsSL%d_OUT", sl));
338 hCDCExtraHitsSLOut != nullptr) m_monObj->setVariable(Form("nCDCExtraHitsSL%d_outActiveVeto", sl),
339 hCDCExtraHitsSLOut->GetMean());
340 // signal CDC hits
341 if (TH1* hCDCHitsSLIn = findHist(Form("TrackingAbort/nCDCHitsSL%d_IN", sl));
342 hCDCHitsSLIn != nullptr) m_monObj->setVariable(Form("nCDCHitsSL%d_inActiveVeto", sl),
343 hCDCHitsSLIn->GetMean());
344 if (TH1* hCDCHitsSLOut = findHist(Form("TrackingAbort/nCDCHitsSL%d_OUT", sl));
345 hCDCHitsSLOut != nullptr) m_monObj->setVariable(Form("nCDCHitsSL%d_outActiveVeto", sl),
346 hCDCHitsSLOut->GetMean());
347 // fraction of CDCExtraHits post cleaning
348 if (TH1* hfCDCExtraHitsPCSLIn = findHist(Form("TrackingAbort/fCDCExtraHitsPostCleanSL%d_IN", sl));
349 hfCDCExtraHitsPCSLIn != nullptr) m_monObj->setVariable(Form("fCDCExtraHitsPostCleanSL%dBeforeFilter_inActiveVeto", sl),
350 hfCDCExtraHitsPCSLIn->GetMean());
351 if (TH1* hfCDCExtraHitsPCSLOut = findHist(Form("TrackingAbort/fCDCExtraHitsPostCleanSL%d_OUT", sl));
352 hfCDCExtraHitsPCSLOut != nullptr) m_monObj->setVariable(Form("fCDCExtraHitsPostCleanSL%dBeforeFilter_outActiveVeto", sl),
353 hfCDCExtraHitsPCSLOut->GetMean());
354
355 //events with no signal hits in each SL after filter and outside active veto
356 if (noCDCHitsInSLIn_BF != nullptr) m_monObj->setVariable(Form("noCDCHitsSL%dBeforeFilter_inActiveVeto", sl),
357 noCDCHitsInSLIn_BF->GetBinContent(sl + 1));
358 if (noCDCHitsInSLOut_BF != nullptr) m_monObj->setVariable(Form("noCDCHitsSL%dBeforeFilter_outActiveVeto", sl),
359 noCDCHitsInSLOut_BF->GetBinContent(sl + 1));
360 if (noCDCHitsInSLIn != nullptr) m_monObj->setVariable(Form("noCDCHitsSL%d_inActiveVeto", sl),
361 noCDCHitsInSLIn->GetBinContent(sl + 1));
362 if (noCDCHitsInSLOut != nullptr) m_monObj->setVariable(Form("noCDCHitsSL%d_outActiveVeto", sl),
363 noCDCHitsInSLOut->GetBinContent(sl + 1));
364 }
365
366
367 //print
368 if (m_printCanvas) {
369 m_cAbortRate->Print("c_TrackingAbort.pdf[");
370 m_cAbortRate->Print("c_TrackingAbort.pdf");
371 m_cAbortRateIN->Print("c_TrackingAbort.pdf");
372 m_cAbortRateOUT->Print("c_TrackingAbort.pdf");
373 m_cAbortRateIN_BF->Print("c_TrackingAbort.pdf");
374 m_cAbortRateOUT_BF->Print("c_TrackingAbort.pdf");
375 m_cAbortRateOUT_BF->Print("c_TrackingAbort.pdf]");
376 }
377
378
379}
380
382{
383 delete m_hAbort;
384 delete m_hAbort_BF;
385 delete m_cAbortRate;
386 delete m_cAbortRate_BF;
387 delete m_cAbortRateIN;
388 delete m_cAbortRateIN_BF;
389 delete m_cAbortRateOUT;
390 delete m_cAbortRateOUT_BF;
391
392}
393
394void DQMHistAnalysisTrackingAbortModule::scaleAndSendToMirabelle(TH1* hAverage, const int nEvents, const TString& tag)
395{
396
397 //scale the histogram to the number of events
398 if (nEvents != 0) hAverage->Scale(1. / nEvents);
399
400 const int nBins = hAverage->GetNbinsX();
401 for (int bin = 1; bin < nBins + 1; bin++) {
402 const TString binLabel = hAverage->GetXaxis()->GetBinLabel(bin);
403 const TString varName = TString::Format("%s%s", binLabel.Data(), tag.Data());
404 const float varValue = hAverage->GetBinContent(bin);
405 m_monObj->setVariable(varName.Data(), varValue);
406 }
407
408
409}
410
411
412
413
int registerEpicsPV(const std::string &pvname, const std::string &keyname="")
EPICS related Functions.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
static void colorizeCanvas(TCanvas *canvas, EStatus status)
Helper function for Canvas colorization.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
DQMHistAnalysisModule()
Constructor / Destructor.
@ c_StatusTooFew
Not enough entries/event to judge.
static EStatus makeStatus(bool enough, bool warn_flag, bool error_flag)
Helper function to judge the status for coloring and EPICS.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
void setEpicsPV(const std::string &keyname, double value)
Write value to a EPICS PV.
void initialize() override final
Module function initialize.
int m_statThreshold
minimal number of events to judge
TH1F * m_hAbort_BF
totla abort (inside + outside) active veto region BEFORE FILTER
double m_failureRateThreshold
above this rate, there is maybe a problem?
TCanvas * m_cAbortRateIN
canvas for the abort rate inside the active veto region
MonitoringObject * m_monObj
Monitoring Object to be produced by this module, which contain defined canvases and monitoring variab...
void terminate() override final
Module function needed to delete pointer.
TCanvas * m_cAbortRate_BF
canvas for the abort rate plot BEFORE FILTER
TCanvas * m_cAbortRate
canvas for the abort rate plot
TH1F * m_hAbort
totla abort (inside + outside) active veto region
TCanvas * m_cAbortRateOUT
canvas for the abort rate outside the active veto region
void event() override final
Module function event.
void scaleAndSendToMirabelle(TH1 *hAverage, const int nEvents, const TString &tag)
scale hAverage and send bin contents to Mirabelle
bool m_printCanvas
if true print the pdf of the canvases
TCanvas * m_cAbortRateIN_BF
canvas for the abort rate inside the active veto region BEFORE FILTER
TCanvas * m_cAbortRateOUT_BF
canvas for the abort rate outside the active veto region BEFORE FILTER
void beginRun() override final
Module function doing stuff at beginning of a run.
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
const std::string & getName() const
Returns the name of the module.
Definition Module.h:186
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.