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, 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(3));
46 addParam("occLevel_Warning", m_occWarning, "Occupancy (%) at WARNING level (orange)", double(2.5));
47 addParam("occGroupIDsLevel_Error", m_groupIDsOccError, "Maximum group IDs Occupancy (%) allowed for safe operations (red)",
48 double(2));
49 addParam("occGroupIDsLevel_Warning", m_groupIDsOccWarning, "Group IDs Occupancy (%) at WARNING level (orange)", double(1.5));
50 addParam("occLevel_Empty", m_occEmpty, "Maximum Occupancy (%) for which the sensor is considered empty", double(0));
51 addParam("onlineOccLevel_Error", m_onlineOccError, "Maximum OnlineOccupancy (%) allowed for safe operations (red)", double(10));
52 addParam("onlineOccLevel_Warning", m_onlineOccWarning, "OnlineOccupancy (%) at WARNING level (orange)", double(5));
53 addParam("onlineOccLevel_Empty", m_onlineOccEmpty, "Maximum OnlineOccupancy (%) for which the sensor is considered empty",
54 double(0));
55 addParam("printCanvas", m_printCanvas, "if True prints pdf of the analysis canvas", bool(false));
56 addParam("additionalPlots", m_additionalPlots, "Flag to produce additional plots", bool(false));
57 addParam("RPhiView", m_RPhiView, "Flag to produce RPhi view plots", bool(true));
58 addParam("RPhiViewId0", m_RPhiViewId0, "Flag to produce RPhi view plots for Id0 group", bool(false));
59 addParam("samples3", m_3Samples, "if True 3 samples histograms analysis is performed", bool(false));
60 addParam("PVPrefix", m_pvPrefix, "PV Prefix", std::string("SVD:"));
61}
62
64
66{
67 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: initialized.");
68
70
71 //collect the list of all SVD Modules in the geometry here
72 std::vector<VxdID> sensors = geo.getListOfSensors();
73 for (const auto& aVxdID : sensors) {
74 VXD::SensorInfoBase info = geo.getSensorInfo(aVxdID);
75 // B2INFO("VXD " << aVxdID);
76 if (info.getType() != VXD::SensorInfoBase::SVD) continue;
77 m_SVDModules.push_back(aVxdID); // reorder, sort would be better
78 }
79 std::sort(m_SVDModules.begin(), m_SVDModules.end()); // back to natural order
80
81 //occupancy chart chip
82 m_cOccupancyChartChip = new TCanvas("SVDOccupancy/c_OccupancyChartChip");
83
84 //strip occupancy per sensor
86 m_sensors = m_SVDModules.size();
87 else
88 m_sensors = 2;
89
90 m_cStripOccupancyU = new TCanvas*[m_sensors];
91 m_cStripOccupancyV = new TCanvas*[m_sensors];
92 for (int i = 0; i < m_sensors; i++) {
93 int tmp_layer = m_SVDModules[i].getLayerNumber();
94 int tmp_ladder = m_SVDModules[i].getLadderNumber();
95 int tmp_sensor = m_SVDModules[i].getSensorNumber();
96 m_cStripOccupancyU[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
97 m_cStripOccupancyV[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
98 }
99
100 gROOT->cd();
101 m_cOccupancyU = new TCanvas("SVDAnalysis/c_SVDOccupancyU");
102 m_cOccupancyV = new TCanvas("SVDAnalysis/c_SVDOccupancyV");
103
104 m_cOnlineOccupancyU = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU");
105 m_cOnlineOccupancyV = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV");
106
107 m_cOccupancyUGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyUGroupId0");
108 m_cOccupancyVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyVGroupId0");
109
110 if (m_RPhiView) {
111 m_cOccupancyRPhiViewU = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewU", "", 800, 800);
112 m_cOccupancyRPhiViewV = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewV", "", 800, 800);
113
114 m_cOnlineOccupancyRPhiViewU = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiViewU", "", 800, 800);
115 m_cOnlineOccupancyRPhiViewV = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiViewV", "", 800, 800);
116
117 if (m_RPhiViewId0) {
118 m_cOccupancyRPhiViewUGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewGroupId0U", "", 800, 800);
119 m_cOccupancyRPhiViewVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiViewGroupId0V", "", 800, 800);
120 }
121 }
122
123 TString hName = getHistoNameFromCanvas(m_cOccupancyU->GetName(), "@view");
124 m_hOccupancy = new SVDSummaryPlots(hName.Data(), "Average OFFLINE Sensor Occupancy (%), @view/@side Side");
125 m_hOccupancy->setStats(0);
126
127 hName = getHistoNameFromCanvas(m_cOnlineOccupancyU->GetName(), "@view");
128 m_hOnlineOccupancy = new SVDSummaryPlots(hName.Data(), "Average ONLINE Sensor Occupancy (%), @view/@side Side");
129 m_hOnlineOccupancy->setStats(0);
130
131 // change name by hand cos side index not at the end
132 hName = getHistoNameFromCanvas("SVDAnalysis/c_SVDOccupancyGroupId0U", "@view");
133 m_hOccupancyGroupId0 = new SVDSummaryPlots(hName.Data(),
134 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0, 1, 2 & 3");
135 m_hOccupancyGroupId0->setStats(0);
136
137 if (m_3Samples) {
138 m_cOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancy3SamplesU");
139 m_cOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancy3SamplesV");
140
141 m_cOnlineOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancy3SamplesU");
142 m_cOnlineOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancy3SamplesV");
143
144 if (m_RPhiView) {
145 m_cOccupancyRPhiViewU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiView3SamplesU", "", 800, 800);
146 m_cOccupancyRPhiViewV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyRPhiView3SamplesV", "", 800, 800);
147
148 m_cOnlineOccupancyRPhiViewU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiView3SamplesU", "", 800, 800);
149 m_cOnlineOccupancyRPhiViewV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyRPhiView3SamplesV", "", 800, 800);
150 }
151
152 hName = getHistoNameFromCanvas(m_cOccupancyU3Samples->GetName(), "@view");
153 m_hOccupancy3Samples = new SVDSummaryPlots(hName.Data(), "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
154 m_hOnlineOccupancy->setStats(0);
155
156 hName = getHistoNameFromCanvas(m_cOnlineOccupancyU3Samples->GetName(), "@view");
158 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
159 m_hOnlineOccupancy3Samples->setStats(0);
160 }
161
162
163 //register limits for EPICS
164 registerEpicsPV(m_pvPrefix + "occupancyLimits", "occLimits");
165 registerEpicsPV(m_pvPrefix + "occupancyOnlineLimits", "occOnlineLimits");
166 registerEpicsPV(m_pvPrefix + "occupancyGoupIDsLimits", "occGroupIDsLimits");
167}
168
170{
171 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: beginRun called.");
172
173 m_cOccupancyChartChip->Clear();
174 for (int i = 0; i < m_sensors; i++) {
175 m_cStripOccupancyU[i]->Clear();
176 m_cStripOccupancyV[i]->Clear();
177 }
178
179 // histo
180 if (m_cOccupancyU)
181 m_cOccupancyU->Clear();
182 if (m_cOccupancyV)
183 m_cOccupancyV->Clear();
184
186 m_cOnlineOccupancyU->Clear();
188 m_cOnlineOccupancyV->Clear();
189
191 m_cOccupancyUGroupId0->Clear();
193 m_cOccupancyVGroupId0->Clear();
194
195 // RPhiView
196 if (m_RPhiView) {
198 m_cOccupancyRPhiViewU->Clear();
200 m_cOccupancyRPhiViewV->Clear();
201
206 if (m_RPhiViewId0) {
211 }
212 }
213 // 3 samples
214 if (m_3Samples) {
215 m_cOccupancyU3Samples->Clear();
216 m_cOccupancyV3Samples->Clear();
219
220 if (m_RPhiView) {
225 }
226 }
227
228 //Retrieve limits from EPICS
229 double oocErrorLoOff = 0.;
230 double oocErrorLoOn = 0.;
231 double oocErrorLoIDs = 0.;
232
233 double occWarningOff = 0.;
234 double occWarningOn = 0.;
235 double occWarningIDs = 0.;
236
237 requestLimitsFromEpicsPVs("occLimits", oocErrorLoOff, occWarningOff, m_occWarning, m_occError);
238 requestLimitsFromEpicsPVs("occOnlineLimits", oocErrorLoOn, occWarningOn, m_onlineOccWarning, m_onlineOccError);
239 requestLimitsFromEpicsPVs("occGroupIDsLimits", oocErrorLoIDs, occWarningIDs, m_groupIDsOccWarning, m_groupIDsOccError);
240
241 B2DEBUG(10, " SVD occupancy thresholds taken from EPICS configuration file:");
242 B2DEBUG(10, " ONLINE OCCUPANCY: empty < " << m_onlineOccEmpty << " normal < " << m_onlineOccWarning << " warning < " <<
244 " < error");
245 B2DEBUG(10, " OFFLINE OCCUPANCY: empty < " << m_occEmpty << " normal < " << m_occWarning << " warning < " << m_occError <<
246 " < error with minimum statistics of " << m_occEmpty);
247
248 B2DEBUG(10, " Group IDs OCCUPANCY: empty < " << m_occEmpty << " normal < " << m_groupIDsOccWarning << " warning < " <<
250 " < error with minimum statistics of " << m_occEmpty);
251
252 // Create text panel
253 //OFFLINE occupancy plots legend
254 m_legProblem->Clear();
255 m_legProblem->AddText("ERROR!");
256 m_legProblem->AddText("at least one sensor with:");
257 m_legProblem->AddText(Form("occupancy > %1.1f%%", m_occError));
258
259 m_legWarning->Clear();
260 m_legWarning->AddText("WARNING!");
261 m_legWarning->AddText("at least one sensor with:");
262 m_legWarning->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occWarning, m_occError));
263
264 m_legNormal->Clear();
265 m_legNormal->AddText("OCCUPANCY WITHIN LIMITS");
266 m_legNormal->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occEmpty, m_occWarning));
267
268 m_legLowStat->Clear();
269 m_legLowStat->AddText("LOW STATISTICS");
270 m_legLowStat->AddText("from at least one sensor");
271
272 m_legEmpty->Clear();
273 m_legEmpty->AddText("at least one sensor is emtpy");
274
275 //ONLINE occupancy plots legend
276 m_legOnlineProblem->Clear();
277 m_legOnlineProblem->AddText("ERROR!");
278 m_legOnlineProblem->AddText("at least one sensor with:");
279 m_legOnlineProblem->AddText(Form("online occupancy > %1.1f%%", m_onlineOccError));
280
281 m_legOnlineWarning->Clear();
282 m_legOnlineWarning->AddText("WARNING!");
283 m_legOnlineWarning->AddText("at least one sensor with:");
284 m_legOnlineWarning->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccWarning, m_onlineOccError));
285
286 m_legOnlineNormal->Clear();
287 m_legOnlineNormal->AddText("OCCUPANCY WITHIN LIMITS");
288 m_legOnlineNormal->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccEmpty, m_onlineOccWarning));
289
290 //Group IDs occupancy plots legend
291 m_legGroupIDsProblem->Clear();
292 m_legGroupIDsProblem->AddText("ERROR!");
293 m_legGroupIDsProblem->AddText("at least one sensor with:");
294 m_legGroupIDsProblem->AddText(Form("group IDs occupancy > %1.1f%%", m_groupIDsOccError));
295
296 m_legGroupIDsWarning->Clear();
297 m_legGroupIDsWarning->AddText("WARNING!");
298 m_legGroupIDsWarning->AddText("at least one sensor with:");
299 m_legGroupIDsWarning->AddText(Form("%1.1f%% < group IDs occupancy < %1.1f%%", m_groupIDsOccWarning, m_groupIDsOccError));
300
301 m_legGroupIDsNormal->Clear();
302 m_legGroupIDsNormal->AddText("OCCUPANCY WITHIN LIMITS");
303 m_legGroupIDsNormal->AddText(Form("%1.1f%% < group IDs occupancy < %1.1f%%", m_groupIDsOccEmpty, m_groupIDsOccWarning));
304
305
308
311
314
317
320}
321
323{
324 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: event called.");
325
326 //find nEvents
327 TH1* hnEvnts = findHist("SVDExpReco/SVDDQM_nEvents", true);
328 if (hnEvnts == NULL) {
329 B2INFO("no events, nothing to do here");
330 return;
331 } else {
332 B2DEBUG(10, "SVDExpReco/SVDDQM_nEvents found");
333 }
334
335
336 TString tmp = hnEvnts->GetTitle();
337 Int_t pos = tmp.Last('~');
338 if (pos == -1) pos = 0;
339
340 TString runID = tmp(pos, tmp.Length() - pos);
341 B2INFO("DQMHistAnalysisSVDOccupancyModule::runID = " << runID);
342 Float_t nEvents = hnEvnts->GetEntries();
343
344 //occupancy chart
345 auto hChart = findHist("SVDExpReco/SVDDQM_StripCountsChip");
346
347 if (hChart != NULL) {
348 m_hOccupancyChartChip.Clear();
349 hChart->Copy(m_hOccupancyChartChip);
350 m_hOccupancyChartChip.SetName("SVDOccupancyChart");
351 m_hOccupancyChartChip.SetTitle(Form("SVD OFFLINE Occupancy per chip %s", runID.Data()));
352 m_hOccupancyChartChip.Scale(1 / nEvents / 128);
354 // m_hOccupancyChartChip->SetStats(0);
356 }
357 m_cOccupancyChartChip->Modified();
358 m_cOccupancyChartChip->Update();
359
360 if (m_printCanvas)
361 m_cOccupancyChartChip->Print("c_OccupancyChartChip.pdf");
362
363
364 //check MODULE OCCUPANCY online & offline
365 //reset canvas color
366 //update titles with exp and run number
369
372
375
378
381
382 m_hOccupancy->reset();
383 m_hOccupancy->setStats(0);
384 m_hOccupancy->setRunID(runID);
385
386 m_hOnlineOccupancy->reset();
387 m_hOnlineOccupancy->setStats(0);
388 m_hOnlineOccupancy->setRunID(runID);
389
390 m_hOccupancyGroupId0->reset();
391 m_hOccupancyGroupId0->setStats(0);
392 m_hOccupancyGroupId0->setRunID(runID);
393
394 if (m_3Samples) {
395 m_hOccupancy3Samples->reset();
396 m_hOccupancy3Samples->setStats(0);
397 m_hOccupancy3Samples->setRunID(runID);
398
400 m_hOnlineOccupancy3Samples->setStats(0);
401 m_hOnlineOccupancy3Samples->setRunID(runID);
402 }
403
404 //set dedicate gStyle
405 gStyle->SetOptStat(0);
406 gStyle->SetPaintTextFormat("2.3f");
407
408
409 for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
410 int tmp_layer = m_SVDModules[i].getLayerNumber();
411 int tmp_ladder = m_SVDModules[i].getLadderNumber();
412 int tmp_sensor = m_SVDModules[i].getSensorNumber();
413
414 //look for U histogram - OFFLINE ZS
415 TString tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
416
417 auto hStripCountU = findHist(tmpname.Data());
418 if (hStripCountU == NULL) {
419 B2INFO("Occupancy U histogram not found");
421 } else {
422 Float_t occU = getOccupancy(hStripCountU->GetEntries(), tmp_layer, nEvents);
423 m_hOccupancy->fill(m_SVDModules[i], 1, occU);
425
426 //produce the occupancy plot
427 if (m_additionalPlots) {
428 m_hStripOccupancyU[i].Clear();
429 hStripCountU->Copy(m_hStripOccupancyU[i]);
430 m_hStripOccupancyU[i].Scale(1 / nEvents);
431 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
432 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
433 tmp_sensor, runID.Data()));
434 } else {
435 if (i == 0 || i == 1) {
436 m_hStripOccupancyU[i].Clear();
437 hStripCountU->Copy(m_hStripOccupancyU[i]);
438 m_hStripOccupancyU[i].Scale(1 / nEvents);
439 m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
440 m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
441 tmp_sensor, runID.Data()));
442 }
443 }
444 }
445
446 if (m_3Samples) {
447 //look for U histogram - OFFLINE ZS for 3 samples
448 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
449
450 auto hStrip3CountU = findHist(tmpname.Data());
451 if (hStrip3CountU == NULL) {
452 B2INFO("Occupancy U histogram not found for 3 samples");
454
455 } else {
456 Float_t occU = getOccupancy(hStrip3CountU->GetEntries(), tmp_layer, nEvents);
457 m_hOccupancy3Samples->fill(m_SVDModules[i], 1, occU);
459 }
460 }
461
462 // groupId0 side U
463 TString tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountSignalGroupIDsU", tmp_layer, tmp_ladder, tmp_sensor);
464 auto hStripCountGroupIDsU = findHist(tmpnameGrpId0.Data());
465 if (hStripCountGroupIDsU == NULL) {
466 B2INFO("Occupancy U histogram for group Id0 not found");
467 setOccStatus(-1, m_occUGroupId0, kGroupIDs);
468
469 } else {
470 Float_t occU = getOccupancy(hStripCountGroupIDsU->GetEntries(), tmp_layer, nEvents);
471 m_hOccupancyGroupId0->fill(m_SVDModules[i], 1, occU);
472 setOccStatus(occU, m_occUGroupId0, kGroupIDs);
473 }
474
475 //look for V histogram - OFFLINE ZS
476 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
477
478 auto hStripCountV = findHist(tmpname.Data());
479 if (hStripCountV == NULL) {
480 B2INFO("Occupancy V histogram not found");
482
483 } else {
484 Float_t occV = getOccupancy(hStripCountV->GetEntries(), tmp_layer, nEvents, true);
485 m_hOccupancy->fill(m_SVDModules[i], 0, occV);
487
488 //produce the occupancy plot
489 if (m_additionalPlots) {
490 m_hStripOccupancyV[i].Clear();
491 hStripCountV->Copy(m_hStripOccupancyV[i]);
492 m_hStripOccupancyV[i].Scale(1 / nEvents);
493 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
494 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
495 tmp_sensor, runID.Data()));
496 } else {
497 if (i < (unsigned int)m_sensors) {
498 m_hStripOccupancyV[i].Clear();
499 hStripCountV->Copy(m_hStripOccupancyV[i]);
500 m_hStripOccupancyV[i].Scale(1 / nEvents);
501 m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
502 m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
503 tmp_sensor, runID.Data()));
504 }
505 }
506 }
507
508 if (m_3Samples) {
509 //look for V histogram - OFFLINE ZS for 3 samples
510 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
511
512 auto hStrip3CountV = findHist(tmpname.Data());
513 if (hStrip3CountV == NULL) {
514 B2INFO("Occupancy V histogram not found");
516
517 } else {
518 Float_t occV = getOccupancy(hStrip3CountV->GetEntries(), tmp_layer, nEvents, true);
519 m_hOccupancy3Samples->fill(m_SVDModules[i], 0, occV);
521 }
522 }
523
524 // groupId0 side V
525 tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountSignalGroupIDsV", tmp_layer, tmp_ladder, tmp_sensor);
526
527 auto hStripCountGroupIDsV = findHist(tmpnameGrpId0.Data());
528 if (hStripCountGroupIDsV == NULL) {
529 B2INFO("Occupancy U histogram for group Id0 not found");
530 setOccStatus(-1, m_occVGroupId0, kGroupIDs);
531
532 } else {
533 Float_t occV = getOccupancy(hStripCountGroupIDsV->GetEntries(), tmp_layer, nEvents, true);
534 m_hOccupancyGroupId0->fill(m_SVDModules[i], 0, occV);
535 setOccStatus(occV, m_occVGroupId0, kGroupIDs);
536 }
537
538 //look for V histogram - ONLINE ZS
539 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
540
541 auto hOnlineStripCountV = findHist(tmpname.Data());
542 if (hOnlineStripCountV == NULL) {
543 B2INFO("OnlineOccupancy V histogram not found");
544 setOccStatus(-1, m_onlineOccVstatus, kOnline);
545
546 } else {
547 Float_t onlineOccV = getOccupancy(hOnlineStripCountV->GetEntries(), tmp_layer, nEvents, true);
548 m_hOnlineOccupancy->fill(m_SVDModules[i], 0, onlineOccV);
549
550 for (int b = 1; b < hOnlineStripCountV->GetNbinsX() + 1; b++) {
551 hOnlineStripCountV->SetBinContent(b, hOnlineStripCountV->GetBinContent(b) / nEvents * 100);
552 }
553 hOnlineStripCountV->GetYaxis()->SetTitle("ZS3 occupancy (%)");
554 setOccStatus(onlineOccV, m_onlineOccVstatus, kOnline);
555 }
556
557 if (m_3Samples) {
558 //look for V histogram - ONLINE ZS for 3 samples
559 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
560
561 auto hOnlineStrip3CountV = findHist(tmpname.Data());
562 if (hOnlineStrip3CountV == NULL) {
563 B2INFO("OnlineOccupancy3 V histogram not found");
565
566 } else {
567 Float_t onlineOccV = getOccupancy(hOnlineStrip3CountV->GetEntries(), tmp_layer, nEvents, true);
568 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 0, onlineOccV);
569
570 for (int b = 1; b < hOnlineStrip3CountV->GetNbinsX() + 1; b++) {
571 hOnlineStrip3CountV->SetBinContent(b, hOnlineStrip3CountV->GetBinContent(b) / nEvents * 100);
572 }
573 hOnlineStrip3CountV->GetYaxis()->SetTitle("ZS3 occupancy (%)");
574 setOccStatus(onlineOccV, m_onlineOccV3Samples, kOnline);
575 }
576 }
577
578 //look for U histogram - ONLINE ZS
579 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
580
581 auto hOnlineStripCountU = findHist(tmpname.Data());
582 if (hOnlineStripCountU == NULL) {
583 B2INFO("OnlineOccupancy U histogram not found");
585
586 } else {
587 Float_t onlineOccU = getOccupancy(hOnlineStripCountU->GetEntries(), tmp_layer, nEvents);
588 m_hOnlineOccupancy->fill(m_SVDModules[i], 1, onlineOccU);
589
590 for (int b = 1; b < hOnlineStripCountU->GetNbinsX() + 1; b++) {
591 hOnlineStripCountU->SetBinContent(b, hOnlineStripCountU->GetBinContent(b) / nEvents * 100);
592 }
593 hOnlineStripCountU->GetYaxis()->SetTitle("ZS3 occupancy (%)");
594 setOccStatus(onlineOccU, m_onlineOccUstatus, kOnline);
595 }
596
597 if (m_3Samples) {
598 //look for U histogram - ONLINE ZS for 3 samples
599 tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
600
601 auto hOnlineStrip3CountU = findHist(tmpname.Data());
602 if (hOnlineStrip3CountU == NULL) {
603 B2INFO("OnlineOccupancy3 U histogram not found");
605
606 } else {
607 Float_t onlineOccU = getOccupancy(hOnlineStrip3CountU->GetEntries(), tmp_layer, nEvents);
608 m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 1, onlineOccU);
609
610 for (int b = 1; b < hOnlineStrip3CountU->GetNbinsX() + 1; b++) {
611 hOnlineStrip3CountU->SetBinContent(b, hOnlineStrip3CountU->GetBinContent(b) / nEvents * 100);
612 }
613 hOnlineStrip3CountU->GetYaxis()->SetTitle("ZS3 occupancy (%)");
614 setOccStatus(onlineOccU, m_onlineOccU3Samples, kOnline);
615 }
616 }
617
618 //update sensor occupancy canvas U and V
619 if (m_additionalPlots) {
620 m_cStripOccupancyU[i]->cd();
621 m_hStripOccupancyU[i].Draw("histo");
622 m_cStripOccupancyV[i]->cd();
623 m_hStripOccupancyV[i].Draw("histo");
624 } else {
625 if (i == 0 || i == 1) {
626 m_cStripOccupancyU[i]->cd();
627 m_hStripOccupancyU[i].Draw("histo");
628 m_cStripOccupancyV[i]->cd();
629 m_hStripOccupancyV[i].Draw("histo");
630 }
631 }
632 }
633
634 //update summary offline occupancy U canvas
636
637 //update summary offline occupancy V canvas
639
640 //update summary offline occupancy U canvas for groupId0
642
643 //update summary offline occupancy V canvas for groupId0
645
646 //update summary online occupancy U canvas
648
649 //update summary online occupancy V canvas
651
652 if (m_3Samples) {
653 //update summary offline occupancy U canvas for 3 samples
655
656 //update summary offline occupancy V canvas for 3 samples
658
659 //update summary online occupancy U canvas for 3 samples
661 true, kOnline);
662
663 //update summary online occupancy V canvas for 3 samples
665 false, kOnline);
666 }
667
668 if (m_printCanvas) {
669 m_cOccupancyU->Print("c_SVDOccupancyU.pdf");
670 m_cOccupancyV->Print("c_SVDOccupancyV.pdf");
671 m_cOnlineOccupancyU->Print("c_SVDOnlineOccupancyU.pdf");
672 m_cOnlineOccupancyV->Print("c_SVDOnlineOccupancyV.pdf");
673 }
674}
675
677{
678 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: endRun called");
679}
680
681
683{
684 B2DEBUG(10, "DQMHistAnalysisSVDOccupancy: terminate called");
685
686 delete m_hOccupancy;
687 delete m_hOnlineOccupancy;
691
693
694 delete m_cOccupancyU;
695 delete m_cOccupancyV;
696
697 delete m_cOnlineOccupancyU;
698 delete m_cOnlineOccupancyV;
699
702
705
708
709 if (m_RPhiView) {
712
715
718
721 if (m_RPhiViewId0) {
724 }
725 }
726
727 for (int module = 0; module < m_sensors; module++) {
728 delete m_cStripOccupancyU[module];
729 delete m_cStripOccupancyV[module];
730 }
731 delete m_cStripOccupancyU;
732 delete m_cStripOccupancyV;
733}
734
735Float_t DQMHistAnalysisSVDOccupancyModule::getOccupancy(float entries, int tmp_layer, int nEvents, bool sideV)
736{
737 Int_t nStrips = 768;
738 if (tmp_layer != 3 && sideV)
739 nStrips = 512;
740
741 return (entries / nStrips / nEvents * 100);
742}
743
744void DQMHistAnalysisSVDOccupancyModule::setOccStatus(float occupancy, svdStatus& occupancyStatus, int histoType)
745{
746 if (histoType == kOnline) {
747 if (occupancy < 0)
748 occupancyStatus = std::max(noStat, occupancyStatus);
749 else if (occupancy <= m_onlineOccEmpty) {
750 occupancyStatus = std::max(lowStat, occupancyStatus);
751 } else if (occupancy < m_onlineOccWarning && occupancy >= m_onlineOccEmpty) {
752 occupancyStatus = std::max(good, occupancyStatus);
753 } else if (occupancy > m_onlineOccWarning && occupancy < m_onlineOccError) {
754 occupancyStatus = std::max(warning, occupancyStatus);
755 } else if (occupancy >= m_onlineOccError) {
756 occupancyStatus = std::max(error, occupancyStatus);
757 }
758 } else if (histoType == kOffline) {
759 if (occupancy < 0)
760 occupancyStatus = std::max(noStat, occupancyStatus);
761 else if (occupancy <= m_occEmpty) {
762 occupancyStatus = std::max(lowStat, occupancyStatus);
763 } else if (occupancy < m_occWarning && occupancy >= m_occEmpty) {
764 occupancyStatus = std::max(good, occupancyStatus);
765 } else if (occupancy > m_occWarning && occupancy < m_occError) {
766 occupancyStatus = std::max(warning, occupancyStatus);
767 } else if (occupancy >= m_occError) {
768 occupancyStatus = std::max(error, occupancyStatus);
769 }
770 } else if (histoType == kGroupIDs) {
771 if (occupancy < 0)
772 occupancyStatus = std::max(noStat, occupancyStatus);
773 else if (occupancy <= m_groupIDsOccEmpty) {
774 occupancyStatus = std::max(lowStat, occupancyStatus);
775 } else if (occupancy < m_groupIDsOccWarning && occupancy >= m_groupIDsOccEmpty) {
776 occupancyStatus = std::max(good, occupancyStatus);
777 } else if (occupancy > m_groupIDsOccWarning && occupancy < m_groupIDsOccError) {
778 occupancyStatus = std::max(warning, occupancyStatus);
779 } else if (occupancy >= m_groupIDsOccError) {
780 occupancyStatus = std::max(error, occupancyStatus);
781 }
782 }
783}
int registerEpicsPV(const std::string &pvname, const std::string &keyname="")
EPICS related Functions.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
TPaveText * m_legOnlineNormal
onlineOccupancy plot legend, normal
static 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_legGroupIDsProblem
Group IDs Occupancy plot legend, problem.
void updateCanvases(SVDSummaryPlots *histo, TCanvas *canvas, TCanvas *canvasRPhi, svdStatus status, bool isU, int histoType=kOffline)
update canvases
TPaveText * m_legLowStat
plot legend, low stats
TPaveText * m_legWarning
plot legend, warning
TPaveText * m_legGroupIDsWarning
Group IDs Occupancy 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
DQMHistAnalysisSVDModule(bool panelTop=false, bool online=false, bool groupIDs=false)
Constructor.
TPaveText * m_legGroupIDsNormal
Group IDs Occupancy plot legend, normal.
TCanvas * m_cOnlineOccupancyU
online occupancy U histo canvas
svdStatus m_onlineOccV3Samples
0 = good, 4 = empty, 1 = warning, 2 = error for 3 sampes
svdStatus m_occVstatus
0 = good, 4 = empty, 1 = warning, 2 = error
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 = good, 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 = good, 4 = empty, 1 = warning, 2 = error for 3 samples
double m_onlineOccEmpty
empty level of the occupancy
svdStatus m_onlineOccUstatus
0 = good, 4 = empty, 1 = warning, 2 = error
SVDSummaryPlots * m_hOnlineOccupancy3Samples
online occupancy histos for 3 sampels
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 = good, 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
double m_groupIDsOccError
error level of the group IDs occupancy
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
static Float_t getOccupancy(float entries, int tmp_layer, int nEvents, bool sideV=false)
get occupancy value
svdStatus m_occV3Samples
0 = good, 4 = empty, 1 = warning, 2 = error for 3 sampels
double m_groupIDsOccWarning
warning level of the group IDs occupancy
bool m_3Samples
if true enable 3 samples histograms analysis
svdStatus m_onlineOccVstatus
0 = good, 4 = empty, 1 = warning, 2 = error
svdStatus m_onlineOccU3Samples
0 = good, 4 = empty, 1 = warning, 2 = error for 3 sample
void endRun() override final
This method is called if the current run ends.
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
double m_groupIDsOccEmpty
empty level of the IDs occupancy
TCanvas * m_cOnlineOccupancyRPhiViewU
online occupancy U plot canvas
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
TCanvas * m_cOnlineOccupancyU3Samples
online occupancy U histo canvas for 3 samples
svdStatus m_occUstatus
0 = good, 4 = empty, 1 = warning, 2 = error
TCanvas * m_cOccupancyRPhiViewV
occupancy V plot canvas
TH1F m_hStripOccupancyU[172]
u-side strip chart occupancy histos
void setOccStatus(float occ, svdStatus &occupancyStatus, int histoType=kOffline)
set occupancy status
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
Class to facilitate easy access to sensor information of the VXD like coordinate transformations or p...
Definition GeoCache.h:38
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.
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.