Belle II Software development
DQMHistAnalysisSVDOccupancy.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// File : DQMHistAnalysisSVDOccupancy.cc
10// Description : module for DQM histogram analysis of SVD sensors occupancies
11//-
12
13
14#include <dqm/analysis/modules/DQMHistAnalysisSVDOccupancy.h>
15#include <vxd/geometry/GeoCache.h>
16
17#include <TROOT.h>
18#include <TStyle.h>
19#include <TString.h>
20#include <TAxis.h>
21
22#include <TMath.h>
23#include <iostream>
24
25using namespace std;
26using namespace Belle2;
27
28//-----------------------------------------------------------------
29// Register the Module
30//-----------------------------------------------------------------
31REG_MODULE(DQMHistAnalysisSVDOccupancy);
32
33//-----------------------------------------------------------------
34// Implementation
35//-----------------------------------------------------------------
36
39{
40 //Parameter definition
41 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: Constructor done.");
42
43 setDescription("DQM Analysis Module that produces colored canvas for a straightforward interpretation of the SVD Data Quality.");
44
45 addParam("occLevel_Error", m_occError, "Maximum Occupancy (%) allowed for safe operations (red)", double(5));
46 addParam("occLevel_Warning", m_occWarning, "Occupancy (%) at WARNING level (orange)", double(3));
47 addParam("occLevel_Empty", m_occEmpty, "Maximum Occupancy (%) for which the sensor is considered empty", double(0));
48 addParam("onlineOccLevel_Error", m_onlineOccError, "Maximum OnlineOccupancy (%) allowed for safe operations (red)", double(10));
49 addParam("onlineOccLevel_Warning", m_onlineOccWarning, "OnlineOccupancy (%) at WARNING level (orange)", double(5));
50 addParam("onlineOccLevel_Empty", m_onlineOccEmpty, "Maximum OnlineOccupancy (%) for which the sensor is considered empty",
51 double(0));
52 addParam("printCanvas", m_printCanvas, "if True prints pdf of the analysis canvas", bool(false));
53 addParam("additionalPlots", m_additionalPlots, "Flag to produce additional plots", bool(false));
54 addParam("samples3", m_3Samples, "if True 3 samples histograms analysis is performed", bool(false));
55 addParam("PVPrefix", m_pvPrefix, "PV Prefix", std::string("SVD:"));
56}
57
59
61{
62 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: initialized.");
63
65
66 //collect the list of all SVD Modules in the geometry here
67 std::vector<VxdID> sensors = geo.getListOfSensors();
68 for (VxdID& aVxdID : sensors) {
69 VXD::SensorInfoBase info = geo.getSensorInfo(aVxdID);
70 // B2INFO("VXD " << aVxdID);
71 if (info.getType() != VXD::SensorInfoBase::SVD) continue;
72 m_SVDModules.push_back(aVxdID); // reorder, sort would be better
73 }
74 std::sort(m_SVDModules.begin(), m_SVDModules.end()); // back to natural order
75
76 //occupancy chart chip
77 m_cOccupancyChartChip = new TCanvas("SVDOccupancy/c_OccupancyChartChip");
78
79 //strip occupancy per sensor
81 m_sensors = m_SVDModules.size();
82 else
83 m_sensors = 2;
84
85 m_cStripOccupancyU = new TCanvas*[m_sensors];
86 m_cStripOccupancyV = new TCanvas*[m_sensors];
87 for (int i = 0; i < m_sensors; i++) {
88 int tmp_layer = m_SVDModules[i].getLayerNumber();
89 int tmp_ladder = m_SVDModules[i].getLadderNumber();
90 int tmp_sensor = m_SVDModules[i].getSensorNumber();
91 m_cStripOccupancyU[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
92 m_cStripOccupancyV[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
93 }
94
95 gROOT->cd();
96 m_cOccupancyU = new TCanvas("SVDAnalysis/c_SVDOccupancyU");
97 m_cOccupancyV = new TCanvas("SVDAnalysis/c_SVDOccupancyV");
98
99 m_cOnlineOccupancyU = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU");
100 m_cOnlineOccupancyV = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV");
101
102
103 if (m_3Samples) {
104 m_cOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyU3Samples");
105 // m_cOccupancyU->SetGrid(1);
106 m_cOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyV3Samples");
107 // m_cOccupancyV->SetGrid(1);
108
109 m_cOnlineOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU3Samples");
110 // m_cOnlineOccupancyU->SetGrid(1);
111 m_cOnlineOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV3Samples");
112 // m_cOnlineOccupancyV->SetGrid(1);
113 }
114
115 m_cOccupancyUGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyUGroupId0");
116 m_cOccupancyVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyVGroupId0");
117
118 m_hOccupancy = new SVDSummaryPlots("hOccupancy@view", "Average OFFLINE Sensor Occupancy (%), @view/@side Side");
120
121 m_hOnlineOccupancy = new SVDSummaryPlots("hOnlineOccupancy@view", "Average ONLINE Sensor Occupancy (%), @view/@side Side");
123
124 m_hOccupancyGroupId0 = new SVDSummaryPlots("hOccupancyGroupId0@view",
125 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
127
128 if (m_3Samples) {
129 m_hOccupancy3Samples = new SVDSummaryPlots("hOccupancy3@view",
130 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
132
133 m_hOnlineOccupancy3Samples = new SVDSummaryPlots("hOnlineOccupancy3@view",
134 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
136 }
137
138 //register limits for EPICS
139 registerEpicsPV(m_pvPrefix + "occupancyLimits", "occLimits");
140 registerEpicsPV(m_pvPrefix + "occupancyOnlineLimits", "occOnlineLimits");
141}
142
143
145{
146 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: beginRun called.");
147 m_cOccupancyU->Clear();
148 m_cOccupancyV->Clear();
149
150 m_cOnlineOccupancyU->Clear();
151 m_cOnlineOccupancyV->Clear();
152 m_cOccupancyChartChip->Clear();
153 for (int i = 0; i < m_sensors; i++) {
154 m_cStripOccupancyU[i]->Clear();
155 m_cStripOccupancyV[i]->Clear();
156 }
157
158 if (m_3Samples) {
159 m_cOccupancyU3Samples->Clear();
160 m_cOccupancyV3Samples->Clear();
163 }
164 m_cOccupancyUGroupId0->Clear();
165 m_cOccupancyVGroupId0->Clear();
166
167 //Retrieve limits from EPICS
168 double oocErrorLoOff = 0.;
169 double oocErrorLoOn = 0.;
170 requestLimitsFromEpicsPVs("occLimits", oocErrorLoOff, m_occEmpty, m_occWarning, m_occError);
172
173 B2DEBUG(10, " SVD occupancy thresholds taken from EPICS configuration file:");
174 B2DEBUG(10, " ONLINE OCCUPANCY: empty < " << m_onlineOccEmpty << " normal < " << m_onlineOccWarning << " warning < " <<
176 " < error");
177 B2DEBUG(10, " OFFLINE OCCUPANCY: empty < " << m_occEmpty << " normal < " << m_occWarning << " warning < " << m_occError <<
178 " < error with minimum statistics of " << m_occEmpty);
179
180 // Create text panel
181 //OFFLINE occupancy plots legend
182 m_legProblem = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
183 m_legProblem->AddText("ERROR!");
184 m_legProblem->AddText("at least one sensor with:");
185 m_legProblem->AddText(Form("occupancy > %1.1f%%", m_occError));
186 m_legProblem->SetFillColor(c_ColorDefault);
187 m_legProblem->SetLineColor(kBlack);
188
189 m_legWarning = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
190 m_legWarning->AddText("WARNING!");
191 m_legWarning->AddText("at least one sensor with:");
192 m_legWarning->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occWarning, m_occError));
193 m_legWarning->SetFillColor(c_ColorDefault);
194 m_legWarning->SetLineColor(kBlack);
195
196 m_legNormal = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
197 m_legNormal->AddText("OCCUPANCY WITHIN LIMITS");
198 m_legNormal->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occEmpty, m_occWarning));
199 m_legNormal->SetFillColor(c_ColorDefault);
200 m_legNormal->SetLineColor(kBlack);
201
202 m_legEmpty = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
203 m_legEmpty->AddText("NO DATA RECEIVED");
204 m_legEmpty->AddText("from at least one sensor");
205 m_legEmpty->SetTextColor(c_ColorDefault);
206 m_legEmpty->SetLineColor(kBlack);
207
208 //ONLINE occupancy plots legend
209 m_legOnProblem = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
210 m_legOnProblem->AddText("ERROR!");
211 m_legOnProblem->AddText("at least one sensor with:");
212 m_legOnProblem->AddText(Form("online occupancy > %1.1f%%", m_onlineOccError));
213 m_legOnProblem->SetFillColor(c_ColorDefault);
214 m_legOnProblem->SetLineColor(kBlack);
215
216 m_legOnWarning = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
217 m_legOnWarning->AddText("WARNING!");
218 m_legOnWarning->AddText("at least one sensor with:");
219 m_legOnWarning->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccWarning, m_onlineOccError));
220 m_legOnWarning->SetFillColor(c_ColorDefault);
221 m_legOnWarning->SetLineColor(kBlack);
222
223 m_legOnNormal = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
224 m_legOnNormal->AddText("OCCUPANCY WITHIN LIMITS");
225 m_legOnNormal->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccEmpty, m_onlineOccWarning));
226 m_legOnNormal->SetFillColor(c_ColorDefault);
227 m_legOnNormal->SetLineColor(kBlack);
228
229 m_legOnEmpty = new TPaveText(0.62, 0.22, 0.88, 0.35, "brNDC");
230 m_legOnEmpty->AddText("NO DATA RECEIVED");
231 m_legOnEmpty->AddText("from at least one sensor");
232 m_legOnEmpty->SetFillColor(c_ColorDefault);
233 m_legOnEmpty->SetTextColor(kBlack);
234}
235
237{
238 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: event called.");
239
240 //find nEvents
241 TH1* hnEvnts = findHist("SVDExpReco/SVDDQM_nEvents", true);
242 if (hnEvnts == NULL) {
243 B2INFO("no events, nothing to do here");
244 return;
245 } else {
246 B2DEBUG(10, "SVDExpReco/SVDDQM_nEvents found");
247 }
248
249 TString tmp = hnEvnts->GetTitle();
250 Int_t pos = tmp.Last('~');
251 if (pos == -1) pos = 0;
252
253 TString runID = tmp(pos, tmp.Length() - pos);
254 B2INFO("DQMHistAnalysisSVDOccupancyModule::runID = " << runID);
255 Float_t nEvents = hnEvnts->GetEntries();
256
257 //occupancy chart
258 TH1F* hChart = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsChip");
259
260 if (hChart != NULL) {
261 m_hOccupancyChartChip.Clear();
262 hChart->Copy(m_hOccupancyChartChip);
263 m_hOccupancyChartChip.SetName("SVDOccupancyChart");
264 m_hOccupancyChartChip.SetTitle(Form("SVD OFFLINE Occupancy per chip %s", runID.Data()));
265 m_hOccupancyChartChip.Scale(1 / nEvents / 128);
267 // m_hOccupancyChartChip->SetStats(0);
269 }
270 m_cOccupancyChartChip->Modified();
271 m_cOccupancyChartChip->Update();
272
273 if (m_printCanvas)
274 m_cOccupancyChartChip->Print("c_OccupancyChartChip.pdf");
275
276
277 //check MODULE OCCUPANCY online & offline
278 //reset canvas color
279 m_occUstatus = 0;
280 m_occVstatus = 0;
283
286
287 m_occU3Samples = 0;
288 m_occV3Samples = 0;
289
290 //update titles with exp and run number
291
294 m_hOccupancy->setRunID(runID);
295
299
303
304 if (m_3Samples) {
308
312 }
313
314 //set dedicate gStyle
315 const Int_t colNum = 4;
316 Int_t palette[colNum] {kBlack, c_ColorGood, c_ColorWarning, c_ColorError};
317 gStyle->SetPalette(colNum, palette);
318 gStyle->SetOptStat(0);
319 gStyle->SetPaintTextFormat("2.3f");
320
321 TH1F* htmp = NULL;
322
323 for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
324 int tmp_layer = m_SVDModules[i].getLayerNumber();
325 int tmp_ladder = m_SVDModules[i].getLadderNumber();
326 int tmp_sensor = m_SVDModules[i].getSensorNumber();
327
328 //look for U histogram - OFFLINE ZS
329 TString tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
330
331 htmp = (TH1F*)findHist(tmpname.Data());
332 if (htmp == NULL) {
333 B2INFO("Occupancy U histogram not found");
334 m_cOccupancyU->Draw();
335 m_cOccupancyU->cd();
336 m_hOccupancy->getHistogram(1)->Draw("text");
338 } else {
339
340 Int_t nStrips = 768;
341
342 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
343 m_hOccupancy->fill(m_SVDModules[i], 1, occU);
344
345 if (occU <= m_occEmpty) {
346 if (m_occUstatus < 1) m_occUstatus = 1;
347 } else if (occU > m_occWarning) {
348 if (occU < m_occError) {
349 if (m_occUstatus < 2) m_occUstatus = 2;
350 } else {
351 if (m_occUstatus < 3) m_occUstatus = 3;
352 }
353 }
354
355 //produce the occupancy plot
356 if (m_additionalPlots) {
357 m_hStripOccupancyU[i].Clear();
358 htmp->Copy(m_hStripOccupancyU[i]);
359 m_hStripOccupancyU[i].Scale(1 / nEvents);
360 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
361 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
362 tmp_sensor, runID.Data()));
363 } else {
364 if (i == 0 || i == 1) {
365 m_hStripOccupancyU[i].Clear();
366 htmp->Copy(m_hStripOccupancyU[i]);
367 m_hStripOccupancyU[i].Scale(1 / nEvents);
368 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
369 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
370 tmp_sensor, runID.Data()));
371 }
372 }
373 }
374
375 if (m_3Samples) {
376 //look for U histogram - OFFLINE ZS for 3 samples
377 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
378
379 htmp = (TH1F*)findHist(tmpname.Data());
380 if (htmp == NULL) {
381 B2INFO("Occupancy U histogram not found for 3 samples");
382 m_cOccupancyU3Samples->Draw();
384 m_hOccupancy3Samples->getHistogram(1)->Draw("text");
386 } else {
387
388 Int_t nStrips = 768;
389
390 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
392
393
394 if (occU <= m_occEmpty) {
395 if (m_occU3Samples < 1) m_occU3Samples = 1;
396 } else if (occU > m_occWarning) {
397 if (occU < m_occError) {
398 if (m_occU3Samples < 2) m_occU3Samples = 2;
399 } else {
400 if (m_occU3Samples < 3) m_occU3Samples = 3;
401 }
402 }
403 }
404 }
405
406 // groupId0 side U
407 TString tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
408 htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
409 if (htmp == NULL) {
410 B2INFO("Occupancy U histogram for group Id0 not found");
411 m_cOccupancyUGroupId0->Draw();
413 m_hOccupancyGroupId0->getHistogram(1)->Draw("text");
415 } else {
416
417 Int_t nStrips = 768;
418
419 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
421
422 if (occU <= m_occEmpty) {
423 if (m_occUGroupId0 < 1) m_occUGroupId0 = 1;
424 } else if (occU > m_occWarning) {
425 if (occU < m_occError) {
426 if (m_occUGroupId0 < 2) m_occUGroupId0 = 2;
427 } else {
428 if (m_occUGroupId0 < 3) m_occUGroupId0 = 3;
429 }
430 }
431 }
432
433 //look for V histogram - OFFLINE ZS
434 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
435
436 htmp = (TH1F*)findHist(tmpname.Data());
437 if (htmp == NULL) {
438 B2INFO("Occupancy V histogram not found");
439 m_cOccupancyV->Draw();
440 m_cOccupancyV->cd();
441 m_hOccupancy->getHistogram(0)->Draw("text");
443 } else {
444
445 Int_t nStrips = 768;
446 if (tmp_layer != 3)
447 nStrips = 512;
448
449 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
450 m_hOccupancy->fill(m_SVDModules[i], 0, occV);
451
452 if (occV <= m_occEmpty) {
453 if (m_occVstatus < 1) m_occVstatus = 1;
454 } else if (occV > m_occWarning) {
455 if (occV < m_occError) {
456 if (m_occVstatus < 2) m_occVstatus = 2;
457 } else {
458 if (m_occVstatus < 3) m_occVstatus = 3;
459 }
460 }
461 //produce the occupancy plot
462 if (m_additionalPlots) {
463 m_hStripOccupancyV[i].Clear();
464 htmp->Copy(m_hStripOccupancyV[i]);
465 m_hStripOccupancyV[i].Scale(1 / nEvents);
466 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
467 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
468 tmp_sensor, runID.Data()));
469 } else {
470 if (i < (unsigned int)m_sensors) {
471 m_hStripOccupancyV[i].Clear();
472 htmp->Copy(m_hStripOccupancyV[i]);
473 m_hStripOccupancyV[i].Scale(1 / nEvents);
474 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
475 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
476 tmp_sensor, runID.Data()));
477 }
478 }
479 }
480
481 if (m_3Samples) {
482 //look for V histogram - OFFLINE ZS for 3 samples
483 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
484
485 htmp = (TH1F*)findHist(tmpname.Data());
486 if (htmp == NULL) {
487 B2INFO("Occupancy V histogram not found");
488 m_cOccupancyV3Samples->Draw();
490 m_hOccupancy3Samples->getHistogram(0)->Draw("text");
492 } else {
493
494 Int_t nStrips = 768;
495 if (tmp_layer != 3)
496 nStrips = 512;
497
498 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
500
501 if (occV <= m_occEmpty) {
502 if (m_occV3Samples < 1) m_occV3Samples = 1;
503 } else if (occV > m_occWarning) {
504 if (occV < m_occError) {
505 if (m_occV3Samples < 2) m_occV3Samples = 2;
506 } else {
507 if (m_occV3Samples < 3) m_occV3Samples = 3;
508 }
509 }
510 }
511 }
512
513 // groupId0 side V
514 tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
515
516 htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
517 if (htmp == NULL) {
518 B2INFO("Occupancy U histogram for group Id0 not found");
519 m_cOccupancyVGroupId0->Draw();
521 m_hOccupancyGroupId0->getHistogram(0)->Draw("text");
523 } else {
524
525 Int_t nStrips = 768;
526 if (tmp_layer != 3)
527 nStrips = 512;
528
529 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
531
532 if (occV <= m_occEmpty) {
533 if (m_occVGroupId0 < 1) m_occVGroupId0 = 1;
534 } else if (occV > m_occWarning) {
535 if (occV < m_occError) {
536 if (m_occVGroupId0 < 2) m_occVGroupId0 = 2;
537 } else {
538 if (m_occVGroupId0 < 3) m_occVGroupId0 = 3;
539 }
540 }
541 }
542
543 //look for V histogram - ONLINE ZS
544 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
545
546 htmp = (TH1F*)findHist(tmpname.Data());
547 if (htmp == NULL) {
548 B2INFO("OnlineOccupancy V histogram not found");
549 m_cOnlineOccupancyV->Draw();
551 m_hOnlineOccupancy->getHistogram(0)->Draw("text");
553 } else {
554
555 Int_t nStrips = 768;
556 if (tmp_layer != 3)
557 nStrips = 512;
558
559 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
560 m_hOnlineOccupancy->fill(m_SVDModules[i], 0, onlineOccV);
561
562
563 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
564 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
565 }
566 htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
567
568 if (onlineOccV <= m_onlineOccEmpty) {
570 } else if (onlineOccV > m_onlineOccWarning) {
571 if (onlineOccV < m_onlineOccError) {
573 } else {
575 }
576 }
577 }
578
579 if (m_3Samples) {
580 //look for V histogram - ONLINE ZS for 3 samples
581 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
582
583 htmp = (TH1F*)findHist(tmpname.Data());
584 if (htmp == NULL) {
585 B2INFO("OnlineOccupancy3 V histogram not found");
590 } else {
591
592 Int_t nStrips = 768;
593 if (tmp_layer != 3)
594 nStrips = 512;
595
596 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
597 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 0, onlineOccV);
598
599 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
600 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
601 }
602 htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
603
604 if (onlineOccV <= m_onlineOccEmpty) {
606 } else if (onlineOccV > m_onlineOccWarning) {
607 if (onlineOccV < m_onlineOccError) {
609 } else {
611 }
612 }
613 }
614 }
615
616 //look for U histogram - ONLINE ZS
617 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
618
619 htmp = (TH1F*)findHist(tmpname.Data());
620 if (htmp == NULL) {
621 B2INFO("OnlineOccupancy U histogram not found");
622 m_cOnlineOccupancyU->Draw();
624 m_hOnlineOccupancy->getHistogram(1)->Draw("text");
626 } else {
627
628 Int_t nStrips = 768;
629
630 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
631 m_hOnlineOccupancy->fill(m_SVDModules[i], 1, onlineOccU);
632
633 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
634 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
635 }
636 htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
637
638 if (onlineOccU <= m_onlineOccEmpty) {
640 } else if (onlineOccU > m_onlineOccWarning) {
641 if (onlineOccU < m_onlineOccError) {
643 } else {
645 }
646 }
647 }
648
649 if (m_3Samples) {
650 //look for U histogram - ONLINE ZS for 3 samples
651 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
652
653 htmp = (TH1F*)findHist(tmpname.Data());
654 if (htmp == NULL) {
655 B2INFO("OnlineOccupancy3 U histogram not found");
660 } else {
661
662 Int_t nStrips = 768;
663
664 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
665 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 1, onlineOccU);
666
667 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
668 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
669 }
670 htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
671
672 if (onlineOccU <= m_onlineOccEmpty) {
674 } else if (onlineOccU > m_onlineOccWarning) {
675 if (onlineOccU < m_onlineOccError) {
677 } else {
679 }
680 }
681 }
682 }
683
684 //update sensor occupancy canvas U and V
685 if (m_additionalPlots) {
686 m_cStripOccupancyU[i]->cd();
687 m_hStripOccupancyU[i].Draw("histo");
688 m_cStripOccupancyV[i]->cd();
689 m_hStripOccupancyV[i].Draw("histo");
690 } else {
691 if (i == 0 || i == 1) {
692 m_cStripOccupancyU[i]->cd();
693 m_hStripOccupancyU[i].Draw("histo");
694 m_cStripOccupancyV[i]->cd();
695 m_hStripOccupancyV[i].Draw("histo");
696 }
697 }
698 }
699
700 //update summary offline occupancy U canvas
701 m_cOccupancyU->Draw();
702 m_cOccupancyU->cd();
703 m_hOccupancy->getHistogram(1)->Draw("text");
704
705 if (m_occUstatus == 0) {
707 m_legNormal->Draw();
708 } else {
709 if (m_occUstatus == 3) {
711 m_legProblem->Draw();
712 }
713 if (m_occUstatus == 2) {
715 m_legWarning->Draw();
716 }
717 if (m_occUstatus == 1) {
719 m_legEmpty->Draw();
720 }
721 }
722 m_cOccupancyU->Update();
723 m_cOccupancyU->Modified();
724 m_cOccupancyU->Update();
725
726 if (m_3Samples) {
727 //update summary offline occupancy U canvas for 3 samples
728 m_cOccupancyU3Samples->Draw();
730 m_hOccupancy3Samples->getHistogram(1)->Draw("text");
731
732 if (m_occU3Samples == 0) {
734 m_legNormal->Draw();
735 } else {
736 if (m_occU3Samples == 3) {
738 m_legProblem->Draw();
739 }
740 if (m_occU3Samples == 2) {
742 m_legWarning->Draw();
743 }
744 if (m_occU3Samples == 1) {
746 m_legEmpty->Draw();
747 }
748 }
749 m_cOccupancyU3Samples->Update();
750 m_cOccupancyU3Samples->Modified();
751 m_cOccupancyU3Samples->Update();
752 }
753
754 //update summary offline occupancy U canvas for groupId0
755 m_cOccupancyUGroupId0->Draw();
757 m_hOccupancyGroupId0->getHistogram(1)->Draw("text");
758
759 if (m_occUGroupId0 == 0) {
761 m_legNormal->Draw();
762 } else {
763 if (m_occUGroupId0 == 3) {
765 m_legProblem->Draw();
766 }
767 if (m_occUGroupId0 == 2) {
769 m_legWarning->Draw();
770 }
771 if (m_occUGroupId0 == 1) {
773 m_legEmpty->Draw();
774 }
775 }
776 m_cOccupancyUGroupId0->Update();
777 m_cOccupancyUGroupId0->Modified();
778 m_cOccupancyUGroupId0->Update();
779
780 //update summary offline occupancy V canvas
781 m_cOccupancyV->Draw();
782 m_cOccupancyV->cd();
783 m_hOccupancy->getHistogram(0)->Draw("text");
784
785 if (m_occVstatus == 0) {
787 m_legNormal->Draw();
788 } else {
789 if (m_occVstatus == 3) {
791 m_legProblem->Draw();
792 }
793 if (m_occVstatus == 2) {
795 m_legWarning->Draw();
796 }
797 if (m_occVstatus == 1) {
799 m_legEmpty->Draw();
800 }
801 }
802
803 m_cOccupancyV->Update();
804 m_cOccupancyV->Modified();
805 m_cOccupancyV->Update();
806
807 if (m_3Samples) {
808 //update summary offline occupancy V canvas for 3 samples
809 m_cOccupancyV3Samples->Draw();
811 m_hOccupancy3Samples->getHistogram(0)->Draw("text");
812
813 if (m_occV3Samples == 0) {
815 m_legNormal->Draw();
816 } else {
817 if (m_occV3Samples == 3) {
819 m_legProblem->Draw();
820 }
821 if (m_occV3Samples == 2) {
823 m_legWarning->Draw();
824 }
825 if (m_occV3Samples == 1) {
827 m_legEmpty->Draw();
828 }
829 }
830
831 m_cOccupancyV3Samples->Update();
832 m_cOccupancyV3Samples->Modified();
833 m_cOccupancyV3Samples->Update();
834 }
835
836 //update summary offline occupancy V canvas for groupId0
837 m_cOccupancyVGroupId0->Draw();
839 m_hOccupancyGroupId0->getHistogram(0)->Draw("text");
840
841 if (m_occVGroupId0 == 0) {
843 m_legNormal->Draw();
844 } else {
845 if (m_occVGroupId0 == 3) {
847 m_legProblem->Draw();
848 }
849 if (m_occVGroupId0 == 2) {
851 m_legWarning->Draw();
852 }
853 if (m_occVGroupId0 == 1) {
855 m_legEmpty->Draw();
856 }
857 }
858 m_cOccupancyVGroupId0->Update();
859 m_cOccupancyVGroupId0->Modified();
860 m_cOccupancyVGroupId0->Update();
861
862 //update summary online occupancy U canvas
863 m_cOnlineOccupancyU->Draw();
865 m_hOnlineOccupancy->getHistogram(1)->Draw("text");
866
867 if (m_onlineOccUstatus == 0) {
869 m_legOnNormal->Draw();
870 } else {
871 if (m_onlineOccUstatus == 3) {
873 m_legOnProblem->Draw();
874 }
875 if (m_onlineOccUstatus == 2) {
877 m_legOnWarning->Draw();
878 }
879 if (m_onlineOccUstatus == 1) {
881 m_legOnEmpty->Draw();
882 }
883 }
884
885 m_cOnlineOccupancyU->Update();
886 m_cOnlineOccupancyU->Modified();
887 m_cOnlineOccupancyU->Update();
888
889 //update summary online occupancy V canvas
890 m_cOnlineOccupancyV->Draw();
892 m_hOnlineOccupancy->getHistogram(0)->Draw("text");
893
894 if (m_onlineOccVstatus == 0) {
896 m_legOnNormal->Draw();
897 } else {
898 if (m_onlineOccVstatus == 3) {
900 m_legOnProblem->Draw();
901 }
902 if (m_onlineOccVstatus == 2) {
904 m_legOnWarning->Draw();
905 }
906 if (m_onlineOccVstatus == 1) {
908 m_legOnEmpty->Draw();
909 }
910 }
911
912 m_cOnlineOccupancyV->Update();
913 m_cOnlineOccupancyV->Modified();
914 m_cOnlineOccupancyV->Update();
915
916 if (m_printCanvas) {
917 m_cOccupancyU->Print("c_SVDOccupancyU.pdf");
918 m_cOccupancyV->Print("c_SVDOccupancyV.pdf");
919 m_cOnlineOccupancyU->Print("c_SVDOnlineOccupancyU.pdf");
920 m_cOnlineOccupancyV->Print("c_SVDOnlineOccupancyV.pdf");
921 }
922
923 if (m_3Samples) {
924 //update summary online occupancy U canvas for 3 samples
928
929 if (m_onlineOccU3Samples == 0) {
931 m_legOnNormal->Draw();
932 } else {
933 if (m_onlineOccU3Samples == 3) {
935 m_legOnProblem->Draw();
936 }
937 if (m_onlineOccU3Samples == 2) {
939 m_legOnWarning->Draw();
940 }
941 if (m_onlineOccU3Samples == 1) {
943 m_legOnEmpty->Draw();
944 }
945 }
946
948 m_cOnlineOccupancyU3Samples->Modified();
950
951 //update summary online occupancy V canvas for 3 samples
955
956 if (m_onlineOccV3Samples == 0) {
958 m_legOnNormal->Draw();
959 } else {
960 if (m_onlineOccV3Samples == 3) {
962 m_legOnProblem->Draw();
963 }
964 if (m_onlineOccV3Samples == 2) {
966 m_legOnWarning->Draw();
967 }
968 if (m_onlineOccV3Samples == 1) {
970 m_legOnEmpty->Draw();
971 }
972 }
973
975 m_cOnlineOccupancyV3Samples->Modified();
977 }
978}
979
981{
982 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: endRun called");
983}
984
985
987{
988 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: terminate called");
989
990 delete m_legProblem;
991 delete m_legWarning;
992 delete m_legNormal;
993 delete m_legEmpty;
994 delete m_legError;
995 delete m_legOnProblem;
996 delete m_legOnWarning;
997 delete m_legOnNormal;
998 delete m_legOnEmpty;
999 delete m_legOnError;
1000
1001 delete m_cOccupancyU;
1002 delete m_cOccupancyV;
1003
1004 delete m_hOccupancy;
1005 delete m_hOnlineOccupancy;
1006 delete m_hOccupancyGroupId0;
1007 delete m_hOccupancy3Samples;
1009
1010 delete m_hOnlineOccupancyU;
1011 delete m_cOnlineOccupancyU;
1012 delete m_hOnlineOccupancyV;
1013 delete m_cOnlineOccupancyV;
1014
1015 delete m_cOccupancyChartChip;
1016
1017 for (int module = 0; module < m_sensors; module++) {
1018 delete m_cStripOccupancyU[module];
1019 delete m_cStripOccupancyV[module];
1020 }
1021 delete m_cStripOccupancyU;
1022 delete m_cStripOccupancyV;
1023}
1024
1025Int_t DQMHistAnalysisSVDOccupancyModule::findBinY(Int_t layer, Int_t sensor)
1026{
1027 if (layer == 3)
1028 return sensor; //2
1029 if (layer == 4)
1030 return 2 + 1 + sensor; //6
1031 if (layer == 5)
1032 return 6 + 1 + sensor; // 11
1033 if (layer == 6)
1034 return 11 + 1 + sensor; // 17
1035 else
1036 return -1;
1037}
1038
The base class for the histogram analysis module.
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).
@ c_ColorWarning
Analysis result: Warning, there may be minor issues.
@ c_ColorError
Analysis result: Severe issue found.
@ c_ColorGood
Analysis result: Good.
@ c_ColorDefault
default for non-coloring
@ c_StatusDefault
default for non-coloring
@ c_StatusTooFew
Not enough entries/event to judge.
@ c_StatusError
Analysis result: Severe issue found.
@ c_StatusWarning
Analysis result: Warning, there may be minor issues.
@ c_StatusGood
Analysis result: Good.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
TCanvas * m_cOnlineOccupancyU
online occupancy U histo canvas
Int_t m_onlineOccV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampes
TCanvas * m_cOccupancyV
occupancy V histo canvas
TPaveText * m_legOnProblem
onlineOccupancy plot legend, problem
TPaveText * m_legError
OfflineOccupancy plot legend, error.
TPaveText * m_legEmpty
OfflineOccupancy plot legend, empty.
Int_t findBinY(Int_t layer, Int_t sensor)
find Y bin corresponding to sensor, occupancy plot
TCanvas * m_cOccupancyU
occupancy U histo canvas
Int_t m_occUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
TCanvas ** m_cStripOccupancyV
u-side strip chart occupancy canvas
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
double m_onlineOccError
error level of the onlineOccupancy
TCanvas * m_cOccupancyVGroupId0
occupancy V histo canvas for cluster time group Id = 0
SVDSummaryPlots * m_hOccupancy3Samples
occupancy histos for 3 samples
Int_t m_onlineOccUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
Int_t m_onlineOccVstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
double m_onlineOccEmpty
empty level of the occupancy
TPaveText * m_legOnEmpty
onlineOccupancy plot legend, empty
SVDSummaryPlots * m_hOnlineOccupancy3Samples
online occupancy histos for 3 sampels
SVDSummaryPlots * m_hOccupancy
Parameters accesible from basf2 scripts.
std::string m_pvPrefix
string prefix for EPICS PVs
double m_occWarning
warning level of the occupancy
void terminate() override final
This method is called at the end of the event processing.
TCanvas * m_cOccupancyU3Samples
occupancy U histo canvas for 3 sampes
SVDSummaryPlots * m_hOccupancyGroupId0
occupancy histos for cluster time group id=0
TPaveText * m_legWarning
OfflineOccupancy plot legend, warning.
TCanvas * m_cOnlineOccupancyV3Samples
online Occupancy V histo canvas for 3 samples
TCanvas * m_cOccupancyChartChip
occupancy chart histo canvas
TPaveText * m_legOnError
onlineOccupancy plot legend, error
void event() override final
This method is called for each event.
bool m_printCanvas
if true print the pdf of the canvases
TCanvas ** m_cStripOccupancyU
u-side strip chart occupancy canvas
TH1F m_hStripOccupancyV[172]
u-side strip chart occupancy histos
Int_t m_occUGroupId0
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 samples
TPaveText * m_legOnNormal
onlineOccupancy plot legend, normal
bool m_3Samples
if true enable 3 samples histograms analysis
void endRun() override final
This method is called if the current run ends.
Int_t m_onlineOccU3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sample
void beginRun() override final
Called when entering a new run.
SVDSummaryPlots * m_hOnlineOccupancy
online occupancy histos
Int_t m_occVstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
TPaveText * m_legNormal
OfflineOccupancy plot legend, normal.
TPaveText * m_legOnWarning
onlineOccupancy plot legend, warning
double m_occEmpty
empty level of the occupancy
Int_t m_occV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampels
TCanvas * m_cOnlineOccupancyV
online Occupancy V histo canvas
TCanvas * m_cOccupancyUGroupId0
occupancy U histo canvas for cluster time group Id = 0
Int_t m_occU3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 samples
TCanvas * m_cOccupancyV3Samples
occupancy V histo canvas for 3 samples
double m_onlineOccWarning
warning level of the onlineOccupancy
TPaveText * m_legProblem
OfflineOccupancy plot legend, problem.
double m_occError
error level of the occupancy
TCanvas * m_cOnlineOccupancyU3Samples
online occupancy U histo canvas for 3 samples
Int_t m_occVGroupId0
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampels
TH1F m_hStripOccupancyU[172]
u-side strip chart occupancy histos
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
class to summarize SVD quantities per sensor and side
void setStats(bool stats=true)
set histograms stat
void fill(int layer, int ladder, int sensor, int view, float value)
fill the histogram for
TH2F * getHistogram(int view)
get a reference to the histogram for
void setRunID(const TString &runID)
set run ids in title
void reset()
Reset histograms.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:39
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
Definition: GeoCache.cc:59
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
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:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.
STL namespace.