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_SVDOccupancyRPhiViewGroupId0U", "", 800, 800);
116 m_cOccupancyRPhiViewVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewGroupId0V", "", 800, 800);
117 }
118 }
119
120 TString hName = getHistoNameFromCanvas(m_cOccupancyU->GetName(), "@view");
121 m_hOccupancy = new SVDSummaryPlots(hName.Data(), "Average OFFLINE Sensor Occupancy (%), @view/@side Side");
123
124 hName = getHistoNameFromCanvas(m_cOnlineOccupancyU->GetName(), "@view");
125 m_hOnlineOccupancy = new SVDSummaryPlots(hName.Data(), "Average ONLINE Sensor Occupancy (%), @view/@side Side");
127
128 // change name by hand cos side index not at the end
129 hName = getHistoNameFromCanvas("SVDAnalysis/c_SVDOccupancyGroupId0U", "@view");
130 m_hOccupancyGroupId0 = new SVDSummaryPlots(hName.Data(),
131 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
133
134 if (m_3Samples) {
135 m_cOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancy3SamplesU");
136 m_cOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancy3SamplesV");
137
138 m_cOnlineOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancy3SamplesU");
139 m_cOnlineOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancy3SamplesV");
140
141 if (m_RPhiView) {
142 m_cOccupancyRPhiViewU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiView3SamplesU", "", 800, 800);
143 m_cOccupancyRPhiViewV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiView3SamplesV", "", 800, 800);
144
145 m_cOnlineOccupancyRPhiViewU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiView3SamplesU", "", 800, 800);
146 m_cOnlineOccupancyRPhiViewV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiView3SamplesV", "", 800, 800);
147 }
148
149 hName = getHistoNameFromCanvas(m_cOccupancyU3Samples->GetName(), "@view");
150 m_hOccupancy3Samples = new SVDSummaryPlots(hName.Data(), "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
152
153 hName = getHistoNameFromCanvas(m_cOnlineOccupancyU3Samples->GetName(), "@view");
155 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
157 }
158
159
160 //register limits for EPICS
161 registerEpicsPV(m_pvPrefix + "occupancyLimits", "occLimits");
162 registerEpicsPV(m_pvPrefix + "occupancyOnlineLimits", "occOnlineLimits");
163}
164
166{
167 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: beginRun called.");
168
169 m_cOccupancyChartChip->Clear();
170 for (int i = 0; i < m_sensors; i++) {
171 m_cStripOccupancyU[i]->Clear();
172 m_cStripOccupancyV[i]->Clear();
173 }
174
175 // histo
176 if (m_cOccupancyU)
177 m_cOccupancyU->Clear();
178 if (m_cOccupancyV)
179 m_cOccupancyV->Clear();
180
182 m_cOnlineOccupancyU->Clear();
184 m_cOnlineOccupancyV->Clear();
185
187 m_cOccupancyUGroupId0->Clear();
189 m_cOccupancyVGroupId0->Clear();
190
191 // RPhiView
192 if (m_RPhiView) {
194 m_cOccupancyRPhiViewU->Clear();
196 m_cOccupancyRPhiViewV->Clear();
197
202 if (m_RPhiViewId0) {
207 }
208 }
209 // 3 samples
210 if (m_3Samples) {
211 m_cOccupancyU3Samples->Clear();
212 m_cOccupancyV3Samples->Clear();
215
216 if (m_RPhiView) {
221 }
222 }
223
224 //Retrieve limits from EPICS
225 double oocErrorLoOff = 0.;
226 double oocErrorLoOn = 0.;
227 double occWarningOff = 0.;
228 double occWarningOn = 0.;
229
230 requestLimitsFromEpicsPVs("occLimits", oocErrorLoOff, occWarningOff, m_occWarning, m_occError);
231 requestLimitsFromEpicsPVs("occOnlineLimits", oocErrorLoOn, occWarningOn, m_onlineOccWarning, m_onlineOccError);
232
233 B2DEBUG(10, " SVD occupancy thresholds taken from EPICS configuration file:");
234 B2DEBUG(10, " ONLINE OCCUPANCY: empty < " << m_onlineOccEmpty << " normal < " << m_onlineOccWarning << " warning < " <<
236 " < error");
237 B2DEBUG(10, " OFFLINE OCCUPANCY: empty < " << m_occEmpty << " normal < " << m_occWarning << " warning < " << m_occError <<
238 " < error with minimum statistics of " << m_occEmpty);
239
240 // Create text panel
241 //OFFLINE occupancy plots legend
242 m_legProblem->Clear();
243 m_legProblem->AddText("ERROR!");
244 m_legProblem->AddText("at least one sensor with:");
245 m_legProblem->AddText(Form("occupancy > %1.1f%%", m_occError));
246
247 m_legWarning->Clear();
248 m_legWarning->AddText("WARNING!");
249 m_legWarning->AddText("at least one sensor with:");
250 m_legWarning->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occWarning, m_occError));
251
252 m_legNormal->Clear();
253 m_legNormal->AddText("OCCUPANCY WITHIN LIMITS");
254 m_legNormal->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occEmpty, m_occWarning));
255
256 m_legLowStat->Clear();
257 m_legLowStat->AddText("LOW STATISTICS");
258 m_legLowStat->AddText("from at least one sensor");
259
260 m_legEmpty->Clear();
261 m_legEmpty->AddText("at least one sensor is emtpy");
262
263 //ONLINE occupancy plots legend
264 m_legOnlineProblem->Clear();
265 m_legOnlineProblem->AddText("ERROR!");
266 m_legOnlineProblem->AddText("at least one sensor with:");
267 m_legOnlineProblem->AddText(Form("online occupancy > %1.1f%%", m_onlineOccError));
268
269 m_legOnlineWarning->Clear();
270 m_legOnlineWarning->AddText("WARNING!");
271 m_legOnlineWarning->AddText("at least one sensor with:");
272 m_legOnlineWarning->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccWarning, m_onlineOccError));
273
274 m_legOnlineNormal->Clear();
275 m_legOnlineNormal->AddText("OCCUPANCY WITHIN LIMITS");
276 m_legOnlineNormal->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccEmpty, m_onlineOccWarning));
277
280
283
286
289
292}
293
295{
296 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: event called.");
297
298 //find nEvents
299 TH1* hnEvnts = findHist("SVDExpReco/SVDDQM_nEvents", true);
300 if (hnEvnts == NULL) {
301 B2INFO("no events, nothing to do here");
302 return;
303 } else {
304 B2DEBUG(10, "SVDExpReco/SVDDQM_nEvents found");
305 }
306
307
308 TString tmp = hnEvnts->GetTitle();
309 Int_t pos = tmp.Last('~');
310 if (pos == -1) pos = 0;
311
312 TString runID = tmp(pos, tmp.Length() - pos);
313 B2INFO("DQMHistAnalysisSVDOccupancyModule::runID = " << runID);
314 Float_t nEvents = hnEvnts->GetEntries();
315
316 //occupancy chart
317 TH1F* hChart = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsChip");
318
319 if (hChart != NULL) {
320 m_hOccupancyChartChip.Clear();
321 hChart->Copy(m_hOccupancyChartChip);
322 m_hOccupancyChartChip.SetName("SVDOccupancyChart");
323 m_hOccupancyChartChip.SetTitle(Form("SVD OFFLINE Occupancy per chip %s", runID.Data()));
324 m_hOccupancyChartChip.Scale(1 / nEvents / 128);
326 // m_hOccupancyChartChip->SetStats(0);
328 }
329 m_cOccupancyChartChip->Modified();
330 m_cOccupancyChartChip->Update();
331
332 if (m_printCanvas)
333 m_cOccupancyChartChip->Print("c_OccupancyChartChip.pdf");
334
335
336 //check MODULE OCCUPANCY online & offline
337 //reset canvas color
338 //update titles with exp and run number
341
344
347
350
353
356 m_hOccupancy->setRunID(runID);
357
361
365
366 if (m_3Samples) {
370
374 }
375
376 //set dedicate gStyle
377 const Int_t colNum = 4;
378 Int_t palette[colNum] {kBlack, c_ColorGood, c_ColorWarning, c_ColorError};
379 gStyle->SetPalette(colNum, palette);
380 gStyle->SetOptStat(0);
381 gStyle->SetPaintTextFormat("2.3f");
382
383 TH1F* htmp = NULL;
384
385 for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
386 int tmp_layer = m_SVDModules[i].getLayerNumber();
387 int tmp_ladder = m_SVDModules[i].getLadderNumber();
388 int tmp_sensor = m_SVDModules[i].getSensorNumber();
389
390 //look for U histogram - OFFLINE ZS
391 TString tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
392
393 htmp = (TH1F*)findHist(tmpname.Data());
394 if (htmp == NULL) {
395 B2INFO("Occupancy U histogram not found");
397 } else {
398 Float_t occU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
399 m_hOccupancy->fill(m_SVDModules[i], 1, occU);
401
402 //produce the occupancy plot
403 if (m_additionalPlots) {
404 m_hStripOccupancyU[i].Clear();
405 htmp->Copy(m_hStripOccupancyU[i]);
406 m_hStripOccupancyU[i].Scale(1 / nEvents);
407 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
408 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
409 tmp_sensor, runID.Data()));
410 } else {
411 if (i == 0 || i == 1) {
412 m_hStripOccupancyU[i].Clear();
413 htmp->Copy(m_hStripOccupancyU[i]);
414 m_hStripOccupancyU[i].Scale(1 / nEvents);
415 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
416 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
417 tmp_sensor, runID.Data()));
418 }
419 }
420 }
421
422 if (m_3Samples) {
423 //look for U histogram - OFFLINE ZS for 3 samples
424 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
425
426 htmp = (TH1F*)findHist(tmpname.Data());
427 if (htmp == NULL) {
428 B2INFO("Occupancy U histogram not found for 3 samples");
430
431 } else {
432 Float_t occU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
435 }
436 }
437
438 // groupId0 side U
439 TString tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
440 htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
441 if (htmp == NULL) {
442 B2INFO("Occupancy U histogram for group Id0 not found");
444
445 } else {
446 Float_t occU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
449 }
450
451 //look for V histogram - OFFLINE ZS
452 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
453
454 htmp = (TH1F*)findHist(tmpname.Data());
455 if (htmp == NULL) {
456 B2INFO("Occupancy V histogram not found");
458
459 } else {
460 Float_t occV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
461 m_hOccupancy->fill(m_SVDModules[i], 0, occV);
463
464 //produce the occupancy plot
465 if (m_additionalPlots) {
466 m_hStripOccupancyV[i].Clear();
467 htmp->Copy(m_hStripOccupancyV[i]);
468 m_hStripOccupancyV[i].Scale(1 / nEvents);
469 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
470 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
471 tmp_sensor, runID.Data()));
472 } else {
473 if (i < (unsigned int)m_sensors) {
474 m_hStripOccupancyV[i].Clear();
475 htmp->Copy(m_hStripOccupancyV[i]);
476 m_hStripOccupancyV[i].Scale(1 / nEvents);
477 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
478 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
479 tmp_sensor, runID.Data()));
480 }
481 }
482 }
483
484 if (m_3Samples) {
485 //look for V histogram - OFFLINE ZS for 3 samples
486 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
487
488 htmp = (TH1F*)findHist(tmpname.Data());
489 if (htmp == NULL) {
490 B2INFO("Occupancy V histogram not found");
492
493 } else {
494 Float_t occV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
497 }
498 }
499
500 // groupId0 side V
501 tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
502
503 htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
504 if (htmp == NULL) {
505 B2INFO("Occupancy U histogram for group Id0 not found");
507
508 } else {
509 Float_t occV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
512 }
513
514 //look for V histogram - ONLINE ZS
515 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
516
517 htmp = (TH1F*)findHist(tmpname.Data());
518 if (htmp == NULL) {
519 B2INFO("OnlineOccupancy V histogram not found");
521
522 } else {
523 Float_t onlineOccV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
524 m_hOnlineOccupancy->fill(m_SVDModules[i], 0, onlineOccV);
525
526 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
527 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
528 }
529 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
530 setOccStatus(onlineOccV, m_onlineOccVstatus, true);
531 }
532
533 if (m_3Samples) {
534 //look for V histogram - ONLINE ZS for 3 samples
535 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
536
537 htmp = (TH1F*)findHist(tmpname.Data());
538 if (htmp == NULL) {
539 B2INFO("OnlineOccupancy3 V histogram not found");
541
542 } else {
543 Float_t onlineOccV = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents, true);
544 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 0, onlineOccV);
545
546 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
547 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
548 }
549 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
550 setOccStatus(onlineOccV, m_onlineOccV3Samples, true);
551 }
552 }
553
554 //look for U histogram - ONLINE ZS
555 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
556
557 htmp = (TH1F*)findHist(tmpname.Data());
558 if (htmp == NULL) {
559 B2INFO("OnlineOccupancy U histogram not found");
561
562 } else {
563 Float_t onlineOccU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
564 m_hOnlineOccupancy->fill(m_SVDModules[i], 1, onlineOccU);
565
566 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
567 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
568 }
569 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
570 setOccStatus(onlineOccU, m_onlineOccUstatus, true);
571 }
572
573 if (m_3Samples) {
574 //look for U histogram - ONLINE ZS for 3 samples
575 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
576
577 htmp = (TH1F*)findHist(tmpname.Data());
578 if (htmp == NULL) {
579 B2INFO("OnlineOccupancy3 U histogram not found");
581
582 } else {
583 Float_t onlineOccU = getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
584 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 1, onlineOccU);
585
586 for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
587 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
588 }
589 htmp->GetYaxis()->SetTitle("ZS3 occupancy (%)");
590 setOccStatus(onlineOccU, m_onlineOccU3Samples, true);
591 }
592 }
593
594 //update sensor occupancy canvas U and V
595 if (m_additionalPlots) {
596 m_cStripOccupancyU[i]->cd();
597 m_hStripOccupancyU[i].Draw("histo");
598 m_cStripOccupancyV[i]->cd();
599 m_hStripOccupancyV[i].Draw("histo");
600 } else {
601 if (i == 0 || i == 1) {
602 m_cStripOccupancyU[i]->cd();
603 m_hStripOccupancyU[i].Draw("histo");
604 m_cStripOccupancyV[i]->cd();
605 m_hStripOccupancyV[i].Draw("histo");
606 }
607 }
608 }
609
610 //update summary offline occupancy U canvas
612
613 //update summary offline occupancy V canvas
615
616 //update summary offline occupancy U canvas for groupId0
618
619 //update summary offline occupancy V canvas for groupId0
621
622 //update summary online occupancy U canvas
624
625 //update summary online occupancy V canvas
627
628 if (m_3Samples) {
629 //update summary offline occupancy U canvas for 3 samples
631
632 //update summary offline occupancy V canvas for 3 samples
634
635 //update summary online occupancy U canvas for 3 samples
637 true, true);
638
639 //update summary online occupancy V canvas for 3 samples
641 false, true);
642 }
643
644 if (m_printCanvas) {
645 m_cOccupancyU->Print("c_SVDOccupancyU.pdf");
646 m_cOccupancyV->Print("c_SVDOccupancyV.pdf");
647 m_cOnlineOccupancyU->Print("c_SVDOnlineOccupancyU.pdf");
648 m_cOnlineOccupancyV->Print("c_SVDOnlineOccupancyV.pdf");
649 }
650}
651
653{
654 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: endRun called");
655}
656
657
659{
660 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: terminate called");
661
662 delete m_hOccupancy;
663 delete m_hOnlineOccupancy;
667
669
670 delete m_cOccupancyU;
671 delete m_cOccupancyV;
672
673 delete m_cOnlineOccupancyU;
674 delete m_cOnlineOccupancyV;
675
678
681
684
685 if (m_RPhiView) {
688
691
694
697 if (m_RPhiViewId0) {
700 }
701 }
702
703 for (int module = 0; module < m_sensors; module++) {
704 delete m_cStripOccupancyU[module];
705 delete m_cStripOccupancyV[module];
706 }
707 delete m_cStripOccupancyU;
708 delete m_cStripOccupancyV;
709}
710
711Float_t DQMHistAnalysisSVDOccupancyModule::getOccupancy(float entries, int tmp_layer, int nEvents, bool sideV)
712{
713 Int_t nStrips = 768;
714 if (tmp_layer != 3 && sideV)
715 nStrips = 512;
716
717 return (entries / nStrips / nEvents * 100);
718}
719
720void DQMHistAnalysisSVDOccupancyModule::setOccStatus(float occupancy, svdStatus& occupancyStatus, bool online)
721{
722 if (online) {
723 if (occupancy < 0)
724 occupancyStatus = std::max(noStat, occupancyStatus);
725 else if (occupancy <= m_onlineOccEmpty) {
726 occupancyStatus = std::max(lowStat, occupancyStatus);
727 } else if (occupancy < m_onlineOccWarning && occupancy >= m_onlineOccEmpty) {
728 occupancyStatus = std::max(good, occupancyStatus);
729 } else if (occupancy > m_onlineOccWarning && occupancy < m_onlineOccError) {
730 occupancyStatus = std::max(warning, occupancyStatus);
731 } else if (occupancy >= m_onlineOccError) {
732 occupancyStatus = std::max(error, occupancyStatus);
733 }
734 } else {
735 if (occupancy < 0)
736 occupancyStatus = std::max(noStat, occupancyStatus);
737 else if (occupancy <= m_occEmpty) {
738 occupancyStatus = std::max(lowStat, occupancyStatus);
739 } else if (occupancy < m_occWarning && occupancy >= m_occEmpty) {
740 occupancyStatus = std::max(good, occupancyStatus);
741 } else if (occupancy > m_occWarning && occupancy < m_occError) {
742 occupancyStatus = std::max(warning, occupancyStatus);
743 } else if (occupancy >= m_occError) {
744 occupancyStatus = std::max(error, occupancyStatus);
745 }
746 }
747}
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
TString getHistoNameFromCanvas(TString cName, TString view="", TString cPrefix="c_", TString hPrefix="")
get histogram name from Canvas name
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 facilitate easy access to sensor information of the VXD like coordinate transformations or p...
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 reference 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: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.
STL namespace.