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
38 : DQMHistAnalysisSVDModule(false, true)
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(2));
46 addParam("occLevel_Warning", m_occWarning, "Occupancy (%) at WARNING level (orange)", double(1.5));
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("RPhiView", m_RPhiView, "Flag to produce RPhi view plots", bool(true));
55 addParam("RPhiViewId0", m_RPhiViewId0, "Flag to produce RPhi view plots for Id0 group", bool(false));
56 addParam("samples3", m_3Samples, "if True 3 samples histograms analysis is performed", bool(false));
57 addParam("PVPrefix", m_pvPrefix, "PV Prefix", std::string("SVD:"));
58}
59
61
63{
64 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: initialized.");
65
67
68 //collect the list of all SVD Modules in the geometry here
69 std::vector<VxdID> sensors = geo.getListOfSensors();
70 for (VxdID& aVxdID : sensors) {
71 VXD::SensorInfoBase info = geo.getSensorInfo(aVxdID);
72 // B2INFO("VXD " << aVxdID);
73 if (info.getType() != VXD::SensorInfoBase::SVD) continue;
74 m_SVDModules.push_back(aVxdID); // reorder, sort would be better
75 }
76 std::sort(m_SVDModules.begin(), m_SVDModules.end()); // back to natural order
77
78 //occupancy chart chip
79 m_cOccupancyChartChip = new TCanvas("SVDOccupancy/c_OccupancyChartChip");
80
81 //strip occupancy per sensor
83 m_sensors = m_SVDModules.size();
84 else
85 m_sensors = 2;
86
87 m_cStripOccupancyU = new TCanvas*[m_sensors];
88 m_cStripOccupancyV = new TCanvas*[m_sensors];
89 for (int i = 0; i < m_sensors; i++) {
90 int tmp_layer = m_SVDModules[i].getLayerNumber();
91 int tmp_ladder = m_SVDModules[i].getLadderNumber();
92 int tmp_sensor = m_SVDModules[i].getSensorNumber();
93 m_cStripOccupancyU[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
94 m_cStripOccupancyV[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
95 }
96
97 gROOT->cd();
98 m_cOccupancyU = new TCanvas("SVDAnalysis/c_SVDOccupancyU");
99 m_cOccupancyV = new TCanvas("SVDAnalysis/c_SVDOccupancyV");
100
101 m_cOnlineOccupancyU = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU");
102 m_cOnlineOccupancyV = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV");
103
104 m_cOccupancyUGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyUGroupId0");
105 m_cOccupancyVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyVGroupId0");
106
107 if (m_RPhiView) {
108 m_cOccupancyRPhiViewU = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewU", "", 800, 800);
109 m_cOccupancyRPhiViewV = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewV", "", 800, 800);
110
111 m_cOnlineOccupancyRPhiViewU = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiViewU", "", 800, 800);
112 m_cOnlineOccupancyRPhiViewV = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiViewV", "", 800, 800);
113
114 if (m_RPhiViewId0) {
115 m_cOccupancyRPhiViewUGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewUGroupId0", "", 800, 800);
116 m_cOccupancyRPhiViewVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewVGroupId0", "", 800, 800);
117 }
118 }
119
120 if (m_3Samples) {
121 m_cOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyU3Samples");
122 m_cOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyV3Samples");
123
124 m_cOnlineOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU3Samples");
125 m_cOnlineOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV3Samples");
126
127 if (m_RPhiView) {
128 m_cOccupancyRPhiViewU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewU3Samples", "", 800, 800);
129 m_cOccupancyRPhiViewV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewV3Samples", "", 800, 800);
130
131 m_cOnlineOccupancyRPhiViewU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiViewU3Samples", "", 800, 800);
132 m_cOnlineOccupancyRPhiViewV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiViewV3Samples", "", 800, 800);
133 }
134 }
135
136 m_hOccupancy = new SVDSummaryPlots("hOccupancy@view", "Average OFFLINE Sensor Occupancy (%), @view/@side Side");
138
139 m_hOnlineOccupancy = new SVDSummaryPlots("hOnlineOccupancy@view", "Average ONLINE Sensor Occupancy (%), @view/@side Side");
141
142 m_hOccupancyGroupId0 = new SVDSummaryPlots("hOccupancyGroupId0@view",
143 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
145
146 if (m_3Samples) {
147 m_hOccupancy3Samples = new SVDSummaryPlots("hOccupancy3@view",
148 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
150
151 m_hOnlineOccupancy3Samples = new SVDSummaryPlots("hOnlineOccupancy3@view",
152 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
154 }
155
156 //register limits for EPICS
157 registerEpicsPV(m_pvPrefix + "occupancyLimits", "occLimits");
158 registerEpicsPV(m_pvPrefix + "occupancyOnlineLimits", "occOnlineLimits");
159}
160
162{
163 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: beginRun called.");
164
165 m_cOccupancyChartChip->Clear();
166 for (int i = 0; i < m_sensors; i++) {
167 m_cStripOccupancyU[i]->Clear();
168 m_cStripOccupancyV[i]->Clear();
169 }
170
171 // histo
172 if (m_cOccupancyU)
173 m_cOccupancyU->Clear();
174 if (m_cOccupancyV)
175 m_cOccupancyV->Clear();
176
178 m_cOnlineOccupancyU->Clear();
180 m_cOnlineOccupancyV->Clear();
181
183 m_cOccupancyUGroupId0->Clear();
185 m_cOccupancyVGroupId0->Clear();
186
187 // RPhiView
188 if (m_RPhiView) {
190 m_cOccupancyRPhiViewU->Clear();
192 m_cOccupancyRPhiViewV->Clear();
193
198 if (m_RPhiViewId0) {
203 }
204 }
205 // 3 samples
206 if (m_3Samples) {
207 m_cOccupancyU3Samples->Clear();
208 m_cOccupancyV3Samples->Clear();
211
212 if (m_RPhiView) {
217 }
218 }
219
220 //Retrieve limits from EPICS
221 double oocErrorLoOff = 0.;
222 double oocErrorLoOn = 0.;
223 double occWarningOff = 0.;
224 double occWarningOn = 0.;
225
226 requestLimitsFromEpicsPVs("occLimits", oocErrorLoOff, occWarningOff, m_occWarning, m_occError);
227 requestLimitsFromEpicsPVs("occOnlineLimits", oocErrorLoOn, occWarningOn, m_onlineOccWarning, m_onlineOccError);
228
229 B2DEBUG(10, " SVD occupancy thresholds taken from EPICS configuration file:");
230 B2DEBUG(10, " ONLINE OCCUPANCY: empty < " << m_onlineOccEmpty << " normal < " << m_onlineOccWarning << " warning < " <<
232 " < error");
233 B2DEBUG(10, " OFFLINE OCCUPANCY: empty < " << m_occEmpty << " normal < " << m_occWarning << " warning < " << m_occError <<
234 " < error with minimum statistics of " << m_occEmpty);
235
236 // Create text panel
237 //OFFLINE occupancy plots legend
238 m_legProblem->Clear();
239 m_legProblem->AddText("ERROR!");
240 m_legProblem->AddText("at least one sensor with:");
241 m_legProblem->AddText(Form("occupancy > %1.1f%%", m_occError));
242
243 m_legWarning->Clear();
244 m_legWarning->AddText("WARNING!");
245 m_legWarning->AddText("at least one sensor with:");
246 m_legWarning->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occWarning, m_occError));
247
248 m_legNormal->Clear();
249 m_legNormal->AddText("OCCUPANCY WITHIN LIMITS");
250 m_legNormal->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occEmpty, m_occWarning));
251
252 m_legLowStat->Clear();
253 m_legLowStat->AddText("LOW STATISTICS");
254 m_legLowStat->AddText("from at least one sensor");
255
256 m_legEmpty->Clear();
257 m_legEmpty->AddText("at least one sensor is emtpy");
258
259 //ONLINE occupancy plots legend
260 m_legOnlineProblem->Clear();
261 m_legOnlineProblem->AddText("ERROR!");
262 m_legOnlineProblem->AddText("at least one sensor with:");
263 m_legOnlineProblem->AddText(Form("online occupancy > %1.1f%%", m_onlineOccError));
264
265 m_legOnlineWarning->Clear();
266 m_legOnlineWarning->AddText("WARNING!");
267 m_legOnlineWarning->AddText("at least one sensor with:");
268 m_legOnlineWarning->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccWarning, m_onlineOccError));
269
270 m_legOnlineNormal->Clear();
271 m_legOnlineNormal->AddText("OCCUPANCY WITHIN LIMITS");
272 m_legOnlineNormal->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccEmpty, m_onlineOccWarning));
273
276
279
282
285
288}
289
291{
292 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: event called.");
293
294 //find nEvents
295 TH1* hnEvnts = findHist("SVDExpReco/SVDDQM_nEvents", true);
296 if (hnEvnts == NULL) {
297 B2INFO("no events, nothing to do here");
298 return;
299 } else {
300 B2DEBUG(10, "SVDExpReco/SVDDQM_nEvents found");
301 }
302
303
304 TString tmp = hnEvnts->GetTitle();
305 Int_t pos = tmp.Last('~');
306 if (pos == -1) pos = 0;
307
308 TString runID = tmp(pos, tmp.Length() - pos);
309 B2INFO("DQMHistAnalysisSVDOccupancyModule::runID = " << runID);
310 Float_t nEvents = hnEvnts->GetEntries();
311
312 //occupancy chart
313 TH1F* hChart = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsChip");
314
315 if (hChart != NULL) {
316 m_hOccupancyChartChip.Clear();
317 hChart->Copy(m_hOccupancyChartChip);
318 m_hOccupancyChartChip.SetName("SVDOccupancyChart");
319 m_hOccupancyChartChip.SetTitle(Form("SVD OFFLINE Occupancy per chip %s", runID.Data()));
320 m_hOccupancyChartChip.Scale(1 / nEvents / 128);
322 // m_hOccupancyChartChip->SetStats(0);
324 }
325 m_cOccupancyChartChip->Modified();
326 m_cOccupancyChartChip->Update();
327
328 if (m_printCanvas)
329 m_cOccupancyChartChip->Print("c_OccupancyChartChip.pdf");
330
331
332 //check MODULE OCCUPANCY online & offline
333 //reset canvas color
334 //update titles with exp and run number
337
340
343
346
349
352 m_hOccupancy->setRunID(runID);
353
357
361
362 if (m_3Samples) {
366
370 }
371
372 //set dedicate gStyle
373 const Int_t colNum = 4;
374 Int_t palette[colNum] {kBlack, c_ColorGood, c_ColorWarning, c_ColorError};
375 gStyle->SetPalette(colNum, palette);
376 gStyle->SetOptStat(0);
377 gStyle->SetPaintTextFormat("2.3f");
378
379 TH1F* htmp = NULL;
380
381 for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
382 int tmp_layer = m_SVDModules[i].getLayerNumber();
383 int tmp_ladder = m_SVDModules[i].getLadderNumber();
384 int tmp_sensor = m_SVDModules[i].getSensorNumber();
385
386 //look for U histogram - OFFLINE ZS
387 TString tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
388
389 htmp = (TH1F*)findHist(tmpname.Data());
390 if (htmp == NULL) {
391 B2INFO("Occupancy U histogram not found");
393 } else {
394 Float_t occU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
395 m_hOccupancy->fill(m_SVDModules[i], 1, occU);
397
398 //produce the occupancy plot
399 if (m_additionalPlots) {
400 m_hStripOccupancyU[i].Clear();
401 htmp->Copy(m_hStripOccupancyU[i]);
402 m_hStripOccupancyU[i].Scale(1 / nEvents);
403 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
404 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
405 tmp_sensor, runID.Data()));
406 } else {
407 if (i == 0 || i == 1) {
408 m_hStripOccupancyU[i].Clear();
409 htmp->Copy(m_hStripOccupancyU[i]);
410 m_hStripOccupancyU[i].Scale(1 / nEvents);
411 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
412 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
413 tmp_sensor, runID.Data()));
414 }
415 }
416 }
417
418 if (m_3Samples) {
419 //look for U histogram - OFFLINE ZS for 3 samples
420 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
421
422 htmp = (TH1F*)findHist(tmpname.Data());
423 if (htmp == NULL) {
424 B2INFO("Occupancy U histogram not found for 3 samples");
426
427 } else {
428 Float_t occU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
431 }
432 }
433
434 // groupId0 side U
435 TString tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
436 htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
437 if (htmp == NULL) {
438 B2INFO("Occupancy U histogram for group Id0 not found");
440
441 } else {
442 Float_t occU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
445 }
446
447 //look for V histogram - OFFLINE ZS
448 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
449
450 htmp = (TH1F*)findHist(tmpname.Data());
451 if (htmp == NULL) {
452 B2INFO("Occupancy V histogram not found");
454
455 } else {
456 Float_t occV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
457 m_hOccupancy->fill(m_SVDModules[i], 0, occV);
459
460 //produce the occupancy plot
461 if (m_additionalPlots) {
462 m_hStripOccupancyV[i].Clear();
463 htmp->Copy(m_hStripOccupancyV[i]);
464 m_hStripOccupancyV[i].Scale(1 / nEvents);
465 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
466 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
467 tmp_sensor, runID.Data()));
468 } else {
469 if (i < (unsigned int)m_sensors) {
470 m_hStripOccupancyV[i].Clear();
471 htmp->Copy(m_hStripOccupancyV[i]);
472 m_hStripOccupancyV[i].Scale(1 / nEvents);
473 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
474 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
475 tmp_sensor, runID.Data()));
476 }
477 }
478 }
479
480 if (m_3Samples) {
481 //look for V histogram - OFFLINE ZS for 3 samples
482 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
483
484 htmp = (TH1F*)findHist(tmpname.Data());
485 if (htmp == NULL) {
486 B2INFO("Occupancy V histogram not found");
488
489 } else {
490 Float_t occV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
493 }
494 }
495
496 // groupId0 side V
497 tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
498
499 htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
500 if (htmp == NULL) {
501 B2INFO("Occupancy U histogram for group Id0 not found");
503
504 } else {
505 Float_t occV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
508 }
509
510 //look for V histogram - ONLINE ZS
511 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
512
513 htmp = (TH1F*)findHist(tmpname.Data());
514 if (htmp == NULL) {
515 B2INFO("OnlineOccupancy V histogram not found");
517
518 } else {
519 Float_t onlineOccV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
520 m_hOnlineOccupancy->fill(m_SVDModules[i], 0, onlineOccV);
521
522 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
523 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
524 }
525 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
526 setOccStatus(onlineOccV, m_onlineOccVstatus, true);
527 }
528
529 if (m_3Samples) {
530 //look for V histogram - ONLINE ZS for 3 samples
531 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
532
533 htmp = (TH1F*)findHist(tmpname.Data());
534 if (htmp == NULL) {
535 B2INFO("OnlineOccupancy3 V histogram not found");
537
538 } else {
539 Float_t onlineOccV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
540 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 0, onlineOccV);
541
542 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
543 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
544 }
545 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
546 setOccStatus(onlineOccV, m_onlineOccV3Samples, true);
547 }
548 }
549
550 //look for U histogram - ONLINE ZS
551 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
552
553 htmp = (TH1F*)findHist(tmpname.Data());
554 if (htmp == NULL) {
555 B2INFO("OnlineOccupancy U histogram not found");
557
558 } else {
559 Float_t onlineOccU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
560 m_hOnlineOccupancy->fill(m_SVDModules[i], 1, onlineOccU);
561
562 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
563 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
564 }
565 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
566 setOccStatus(onlineOccU, m_onlineOccUstatus, true);
567 }
568
569 if (m_3Samples) {
570 //look for U histogram - ONLINE ZS for 3 samples
571 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
572
573 htmp = (TH1F*)findHist(tmpname.Data());
574 if (htmp == NULL) {
575 B2INFO("OnlineOccupancy3 U histogram not found");
577
578 } else {
579 Float_t onlineOccU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
580 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 1, onlineOccU);
581
582 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
583 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
584 }
585 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
586 setOccStatus(onlineOccU, m_onlineOccU3Samples, true);
587 }
588 }
589
590 //update sensor occupancy canvas U and V
591 if (m_additionalPlots) {
592 m_cStripOccupancyU[i]->cd();
593 m_hStripOccupancyU[i].Draw("histo");
594 m_cStripOccupancyV[i]->cd();
595 m_hStripOccupancyV[i].Draw("histo");
596 } else {
597 if (i == 0 || i == 1) {
598 m_cStripOccupancyU[i]->cd();
599 m_hStripOccupancyU[i].Draw("histo");
600 m_cStripOccupancyV[i]->cd();
601 m_hStripOccupancyV[i].Draw("histo");
602 }
603 }
604 }
605
606 //update summary offline occupancy U canvas
608
609 //update summary offline occupancy V canvas
611
612 //update summary offline occupancy U canvas for groupId0
614
615 //update summary offline occupancy V canvas for groupId0
617
618 //update summary online occupancy U canvas
620
621 //update summary online occupancy V canvas
623
624 if (m_3Samples) {
625 //update summary offline occupancy U canvas for 3 samples
627
628 //update summary offline occupancy V canvas for 3 samples
630
631 //update summary online occupancy U canvas for 3 samples
633 true, true);
634
635 //update summary online occupancy V canvas for 3 samples
637 false, true);
638 }
639
640 if (m_printCanvas) {
641 m_cOccupancyU->Print("c_SVDOccupancyU.pdf");
642 m_cOccupancyV->Print("c_SVDOccupancyV.pdf");
643 m_cOnlineOccupancyU->Print("c_SVDOnlineOccupancyU.pdf");
644 m_cOnlineOccupancyV->Print("c_SVDOnlineOccupancyV.pdf");
645 }
646}
647
649{
650 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: endRun called");
651}
652
653
655{
656 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: terminate called");
657
658 delete m_hOccupancy;
659 delete m_hOnlineOccupancy;
663
665
666 delete m_cOccupancyU;
667 delete m_cOccupancyV;
668
669 delete m_cOnlineOccupancyU;
670 delete m_cOnlineOccupancyV;
671
674
677
680
681 if (m_RPhiView) {
684
687
690
693 if (m_RPhiViewId0) {
696 }
697 }
698
699 for (int module = 0; module < m_sensors; module++) {
700 delete m_cStripOccupancyU[module];
701 delete m_cStripOccupancyV[module];
702 }
703 delete m_cStripOccupancyU;
704 delete m_cStripOccupancyV;
705}
706
707Float_t DQMHistAnalysisSVDOccupancyModule::getOccupancy(float entries, int tmp_layer, int nEvents, bool sideV)
708{
709 Int_t nStrips = 768;
710 if (tmp_layer != 3 && sideV)
711 nStrips = 512;
712
713 return (entries / nStrips / nEvents * 100);
714}
715
716void DQMHistAnalysisSVDOccupancyModule::setOccStatus(float occupancy, svdStatus& occupancyStatus, bool online)
717{
718 if (online) {
719 if (occupancy < 0)
720 occupancyStatus = std::max(noStat, occupancyStatus);
721 else if (occupancy <= m_onlineOccEmpty) {
722 occupancyStatus = std::max(lowStat, occupancyStatus);
723 } else if (occupancy < m_onlineOccWarning && occupancy >= m_onlineOccEmpty) {
724 occupancyStatus = std::max(good, occupancyStatus);
725 } else if (occupancy > m_onlineOccWarning && occupancy < m_onlineOccError) {
726 occupancyStatus = std::max(warning, occupancyStatus);
727 } else if (occupancy >= m_onlineOccError) {
728 occupancyStatus = std::max(error, occupancyStatus);
729 }
730 } else {
731 if (occupancy < 0)
732 occupancyStatus = std::max(noStat, occupancyStatus);
733 else if (occupancy <= m_occEmpty) {
734 occupancyStatus = std::max(lowStat, occupancyStatus);
735 } else if (occupancy < m_occWarning && occupancy >= m_occEmpty) {
736 occupancyStatus = std::max(good, occupancyStatus);
737 } else if (occupancy > m_occWarning && occupancy < m_occError) {
738 occupancyStatus = std::max(warning, occupancyStatus);
739 } else if (occupancy >= m_occError) {
740 occupancyStatus = std::max(error, occupancyStatus);
741 }
742 }
743}
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.
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.
Class definition for common method.
TPaveText * m_legOnlineNormal
onlineOccupancy plot legend, normal
TPaveText * m_legEmpty
plot legend, empty
TPaveText * m_legLowStat
plot legend, low stats
TPaveText * m_legWarning
plot legend, warning
TPaveText * m_legNormal
plot legend, normal
TPaveText * m_legProblem
plot legend, problem
TPaveText * m_legOnlineProblem
onlineOccupancy plot legend, problem
TPaveText * m_legOnlineWarning
onlineOccupancy plot legend, warning
void updateCanvases(SVDSummaryPlots *histo, TCanvas *canvas, TCanvas *canvasRPhi, svdStatus status, bool isU, bool online=false)
update canvases
TCanvas * m_cOnlineOccupancyU
online occupancy U histo canvas
TCanvas * m_cOccupancyV
occupancy V histo canvas
svdStatus m_onlineOccV3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sampes
svdStatus m_occVstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
TCanvas * m_cOccupancyU
occupancy U histo canvas
TCanvas * m_cOccupancyRPhiViewVGroupId0
occupancy V histo canvas for cluster time group Id = 0
TCanvas * m_cOccupancyRPhiViewV3Samples
occupancy V plot canvas for 3 samples
TCanvas * m_cOnlineOccupancyRPhiViewU3Samples
occupancy U plot canvas for 3 samples
TCanvas ** m_cStripOccupancyV
u-side strip chart occupancy canvas
svdStatus m_occVGroupId0
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sampels
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
double m_onlineOccError
error level of the onlineOccupancy
TCanvas * m_cOccupancyRPhiViewUGroupId0
occupancy U histo canvas for cluster time group Id = 0
TCanvas * m_cOccupancyVGroupId0
occupancy V histo canvas for cluster time group Id = 0
SVDSummaryPlots * m_hOccupancy3Samples
occupancy histos for 3 samples
svdStatus m_occU3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 samples
double m_onlineOccEmpty
empty level of the occupancy
svdStatus m_onlineOccUstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
SVDSummaryPlots * m_hOnlineOccupancy3Samples
online occupancy histos for 3 sampels
SVDSummaryPlots * m_hOccupancy
occupancy histos
std::string m_pvPrefix
string prefix for EPICS PVs
TCanvas * m_cOnlineOccupancyRPhiViewV
online occupancy V plot canvas
double m_occWarning
warning level of the occupancy
svdStatus m_occUGroupId0
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 samples
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
TCanvas * m_cOnlineOccupancyV3Samples
online Occupancy V histo canvas for 3 samples
TCanvas * m_cOccupancyChartChip
occupancy chart histo canvas
void event() override final
This method is called for each event.
bool m_printCanvas
Parameters accesible from basf2 scripts.
TCanvas * m_cOnlineOccupancyRPhiViewV3Samples
occupancy V plot canvas for 3 samples
TCanvas ** m_cStripOccupancyU
u-side strip chart occupancy canvas
TH1F m_hStripOccupancyV[172]
u-side strip chart occupancy histos
Float_t getOccupancy(float entries, int tmp_layer, int nEvents, bool sideV=false)
get occupancy value
svdStatus m_occV3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sampels
bool m_3Samples
if true enable 3 samples histograms analysis
svdStatus m_onlineOccVstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
svdStatus m_onlineOccU3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sample
void endRun() override final
This method is called if the current run ends.
void setOccStatus(float occ, svdStatus &occupancyStatus, bool online=false)
set occupancy status
TCanvas * m_cOccupancyRPhiViewU3Samples
occupancy U plot canvas for 3 samples
void beginRun() override final
Called when entering a new run.
SVDSummaryPlots * m_hOnlineOccupancy
online occupancy histos
TCanvas * m_cOccupancyRPhiViewU
occupancy U plot canvas
TCanvas * m_cOnlineOccupancyRPhiViewU
online occupancy U plot canvas
double m_occEmpty
empty level of the occupancy
TCanvas * m_cOnlineOccupancyV
online Occupancy V histo canvas
TCanvas * m_cOccupancyUGroupId0
occupancy U histo canvas for cluster time group Id = 0
TCanvas * m_cOccupancyV3Samples
occupancy V histo canvas for 3 samples
double m_onlineOccWarning
warning level of the onlineOccupancy
double m_occError
error level of the occupancy
TCanvas * m_cOnlineOccupancyU3Samples
online occupancy U histo canvas for 3 samples
svdStatus m_occUstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
TCanvas * m_cOccupancyRPhiViewV
occupancy V plot canvas
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
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.