Belle II Software  release-08-01-10
DQMHistAnalysisSVDGeneral.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 : DQMHistAnalysisSVDGeneral.cc
10 // Description : module for DQM histogram analysis of SVD sensors occupancies
11 //-
12 
13 
14 #include <dqm/analysis/modules/DQMHistAnalysisSVDGeneral.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 
25 using namespace std;
26 using namespace Belle2;
27 
28 //-----------------------------------------------------------------
29 // Register the Module
30 //-----------------------------------------------------------------
31 REG_MODULE(DQMHistAnalysisSVDGeneral);
32 
33 //-----------------------------------------------------------------
34 // Implementation
35 //-----------------------------------------------------------------
36 
37 DQMHistAnalysisSVDGeneralModule::DQMHistAnalysisSVDGeneralModule()
39 {
40  //Parameter definition
41  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: Constructor done.");
42 
43  setDescription("DQM Analysis Module that produces colored canvas for a straightforward interpretation of the SVD Data Quality.");
44 
45  addParam("RefHistoFile", m_refFileName, "Reference histrogram file name", std::string("SVDrefHisto.root"));
46  addParam("unpackerErrorLevel", m_unpackError, "Maximum bin_content/ # events allowed before throwing ERROR", double(0.00001));
47  addParam("occLevel_Error", m_occError, "Maximum Occupancy (%) allowed for safe operations (red)", double(5));
48  addParam("occLevel_Warning", m_occWarning, "Occupancy (%) at WARNING level (orange)", double(3));
49  addParam("occLevel_Empty", m_occEmpty, "Maximum Occupancy (%) for which the sensor is considered empty", double(0));
50  addParam("onlineOccLevel_Error", m_onlineOccError, "Maximum OnlineOccupancy (%) allowed for safe operations (red)", double(10));
51  addParam("onlineOccLevel_Warning", m_onlineOccWarning, "OnlineOccupancy (%) at WARNING level (orange)", double(5));
52  addParam("onlineOccLevel_Empty", m_onlineOccEmpty, "Maximum OnlineOccupancy (%) for which the sensor is considered empty",
53  double(0));
54  addParam("printCanvas", m_printCanvas, "if True prints pdf of the analysis canvas", bool(false));
55  addParam("statThreshold", m_statThreshold, "Minimal number of events to compare histograms", double(10000.));
56  addParam("timeThreshold", m_timeThreshold, "Acceptable difference between mean of central peak for present and reference run",
57  double(6)); // 6 ns
58  addParam("refMCTP", m_refMeanP, "Mean of the signal time peak from Physics reference run", float(0.0)); // Approximate, from exp 20
59  addParam("refMCTC", m_refMeanC, "Mean of the signal time peak from Cosmic reference run", float(0.0)); //
60  addParam("additionalPlots", m_additionalPlots, "Flag to produce additional plots", bool(false));
61  addParam("samples3", m_3Samples, "if True 3 samples histograms analysis is performed", bool(false));
62  addParam("PVPrefix", m_pvPrefix, "PV Prefix", std::string("SVD:"));
63 }
64 
66 
68 {
69  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: initialized.");
70 
71  m_legError = new TPaveText(-1, 54, 3, 57.5);
72  m_legError->AddText("ERROR!!");
73  m_legError->SetFillColor(c_ColorDefault);
74  m_legError->SetTextColor(c_ColorDefault);
75 
77 
78  //collect the list of all SVD Modules in the geometry here
79  std::vector<VxdID> sensors = geo.getListOfSensors();
80  for (VxdID& aVxdID : sensors) {
81  VXD::SensorInfoBase info = geo.getSensorInfo(aVxdID);
82  // B2INFO("VXD " << aVxdID);
83  if (info.getType() != VXD::SensorInfoBase::SVD) continue;
84  m_SVDModules.push_back(aVxdID); // reorder, sort would be better
85  }
86  std::sort(m_SVDModules.begin(), m_SVDModules.end()); // back to natural order
87 
88  //occupancy chart chip
89  m_cOccupancyChartChip = new TCanvas("SVDOccupancy/c_OccupancyChartChip");
90 
91  //strip occupancy per sensor
93  m_sensors = m_SVDModules.size();
94  else
95  m_sensors = 2;
96 
97  m_cStripOccupancyU = new TCanvas*[m_sensors];
98  m_cStripOccupancyV = new TCanvas*[m_sensors];
99  for (int i = 0; i < m_sensors; i++) {
100  int tmp_layer = m_SVDModules[i].getLayerNumber();
101  int tmp_ladder = m_SVDModules[i].getLadderNumber();
102  int tmp_sensor = m_SVDModules[i].getSensorNumber();
103  m_cStripOccupancyU[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
104  m_cStripOccupancyV[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
105  }
106 
107  gROOT->cd();
108  m_cUnpacker = new TCanvas("SVDAnalysis/c_SVDDataFormat");
109  m_cUnpacker->SetGrid(1);
110  m_cOccupancyU = new TCanvas("SVDAnalysis/c_SVDOccupancyU");
111  m_cOccupancyV = new TCanvas("SVDAnalysis/c_SVDOccupancyV");
112 
113  m_cOnlineOccupancyU = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU");
114  m_cOnlineOccupancyV = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV");
115 
116  m_cClusterOnTrackTime_L456V = new TCanvas("SVDAnalysis/c_ClusterOnTrackTime_L456V");
117 
118  if (m_3Samples) {
119  m_cOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyU3Samples");
120  // m_cOccupancyU->SetGrid(1);
121  m_cOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyV3Samples");
122  // m_cOccupancyV->SetGrid(1);
123 
124  m_cOnlineOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU3Samples");
125  // m_cOnlineOccupancyU->SetGrid(1);
126  m_cOnlineOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV3Samples");
127  // m_cOnlineOccupancyV->SetGrid(1);
128  m_cClusterOnTrackTimeL456V3Samples = new TCanvas("SVDAnalysis/c_ClusterOnTrackTime_L456V3Samples");
129  }
130 
131  m_cOccupancyUGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyUGroupId0");
132  m_cOccupancyVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyVGroupId0");
133 
134  m_hOccupancy = new SVDSummaryPlots("hOccupancy@view", "Average OFFLINE Sensor Occupancy (%), @view/@side Side");
136 
137  m_hOnlineOccupancy = new SVDSummaryPlots("hOnlineOccupancy@view", "Average ONLINE Sensor Occupancy (%), @view/@side Side");
139 
140  m_hOccupancyGroupId0 = new SVDSummaryPlots("hOccupancyGroupId0@view",
141  "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
143 
144  if (m_3Samples) {
145  m_hOccupancy3Samples = new SVDSummaryPlots("hOccupancy3@view",
146  "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
148 
149  m_hOnlineOccupancy3Samples = new SVDSummaryPlots("hOnlineOccupancy3@view",
150  "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
152  }
153 
154 
155  //register limits for EPICS
156  registerEpicsPV(m_pvPrefix + "ratio3_6", "ratio3_6");
157  registerEpicsPV(m_pvPrefix + "UnpackError", "UnpackError");
158  registerEpicsPV(m_pvPrefix + "occupancyLimits", "occLimits");
159  registerEpicsPV(m_pvPrefix + "occupancyOnlineLimits", "occOnlineLimits");
160  registerEpicsPV(m_pvPrefix + "clusterTimeOnTrackLimits", "clusTimeOnTrkLimits");
161 }
162 
163 
165 {
166  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: beginRun called.");
167  m_cUnpacker->Clear();
168  m_cOccupancyU->Clear();
169  m_cOccupancyV->Clear();
170 
171  m_cOnlineOccupancyU->Clear();
172  m_cOnlineOccupancyV->Clear();
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 
180 
181  if (m_3Samples) {
182  m_cOccupancyU3Samples->Clear();
183  m_cOccupancyV3Samples->Clear();
187  }
188  m_cOccupancyUGroupId0->Clear();
189  m_cOccupancyVGroupId0->Clear();
190 
191  //Retrieve limits from EPICS
192  double oocErrorLoOff = 0.;
193  double oocErrorLoOn = 0.;
194  requestLimitsFromEpicsPVs("occLimits", oocErrorLoOff, m_occEmpty, m_occWarning, m_occError);
196 
197  B2DEBUG(10, " SVD occupancy thresholds taken from EPICS configuration file:");
198  B2DEBUG(10, " ONLINE OCCUPANCY: empty < " << m_onlineOccEmpty << " normal < " << m_onlineOccWarning << " warning < " <<
200  " < error");
201  B2DEBUG(10, " OFFLINE OCCUPANCY: empty < " << m_occEmpty << " normal < " << m_occWarning << " warning < " << m_occError <<
202  " < error with minimum statistics of " << m_occEmpty);
203 
204  double timeWarnUp = 0.;
205  double timeErrorLo = 0.;
206  double timeWarnLo = 0.;
207  requestLimitsFromEpicsPVs("clusTimeOnTrkLimits", timeErrorLo, timeWarnLo, timeWarnUp, m_timeThreshold);
208  B2DEBUG(10, " SVD cluster time on track threshold taken from EPICS configuration file:");
209  B2DEBUG(10, " CLUSTER TIME ON TRACK: error > " << m_timeThreshold << " ns with minimum statistics of " << m_statThreshold);
210 
211  double unpackWarnLo = 0.;
212  double unpackWarnUp = 0.;
213  double unpackErrorLo = 0.;
214  requestLimitsFromEpicsPVs("UnpackError", unpackErrorLo, unpackWarnLo, unpackWarnUp, m_unpackError);
215  B2DEBUG(10, " SVD unpack error threshold taken from EPICS configuration file:");
216  B2DEBUG(10, " DATA UNPACK: error > " << m_unpackError);
217 
218  // Create text panel
219  //OFFLINE occupancy plots legend
220  m_legProblem = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
221  m_legProblem->AddText("ERROR!");
222  m_legProblem->AddText("at least one sensor with:");
223  m_legProblem->AddText(Form("occupancy > %1.1f%%", m_occError));
224  m_legProblem->SetFillColor(c_ColorDefault);
225  m_legProblem->SetLineColor(kBlack);
226 
227  m_legWarning = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
228  m_legWarning->AddText("WARNING!");
229  m_legWarning->AddText("at least one sensor with:");
230  m_legWarning->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occWarning, m_occError));
231  m_legWarning->SetFillColor(c_ColorDefault);
232  m_legWarning->SetLineColor(kBlack);
233 
234  m_legNormal = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
235  m_legNormal->AddText("OCCUPANCY WITHIN LIMITS");
236  m_legNormal->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occEmpty, m_occWarning));
237  m_legNormal->SetFillColor(c_ColorDefault);
238  m_legNormal->SetLineColor(kBlack);
239 
240  m_legEmpty = new TPaveText(11, findBinY(4, 3) - 2, 16, findBinY(4, 3));
241  m_legEmpty->AddText("NO DATA RECEIVED");
242  m_legEmpty->AddText("from at least one sensor");
243  m_legEmpty->SetTextColor(c_ColorDefault);
244  m_legEmpty->SetLineColor(kBlack);
245 
246  //ONLINE occupancy plots legend
247  m_legOnProblem = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
248  m_legOnProblem->AddText("ERROR!");
249  m_legOnProblem->AddText("at least one sensor with:");
250  m_legOnProblem->AddText(Form("online occupancy > %1.1f%%", m_onlineOccError));
251  m_legOnProblem->SetFillColor(c_ColorDefault);
252  m_legOnProblem->SetLineColor(kBlack);
253 
254  m_legOnWarning = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
255  m_legOnWarning->AddText("WARNING!");
256  m_legOnWarning->AddText("at least one sensor with:");
257  m_legOnWarning->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccWarning, m_onlineOccError));
258  m_legOnWarning->SetFillColor(c_ColorDefault);
259  m_legOnWarning->SetLineColor(kBlack);
260 
261  m_legOnNormal = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
262  m_legOnNormal->AddText("OCCUPANCY WITHIN LIMITS");
263  m_legOnNormal->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccEmpty, m_onlineOccWarning));
264  m_legOnNormal->SetFillColor(c_ColorDefault);
265  m_legOnNormal->SetLineColor(kBlack);
266 
267  m_legOnEmpty = new TPaveText(11, findBinY(4, 3) - 2, 16, findBinY(4, 3));
268  m_legOnEmpty->AddText("NO DATA RECEIVED");
269  m_legOnEmpty->AddText("from at least one sensor");
270  m_legOnEmpty->SetFillColor(c_ColorDefault);
271  m_legOnEmpty->SetLineColor(kBlack);
272 
273 
274  // cluster time on tracks legend
275  m_legTiProblem = new TPaveText(0.15, 0.65, 0.35, 0.80, "NDC");
276  m_legTiProblem->AddText("ERROR!");
277  m_legTiProblem->AddText(Form("abs(Mean) > %3.1f ns", m_timeThreshold));
278  m_legTiProblem->SetFillColor(c_ColorDefault);
279  m_legTiProblem->SetLineColor(kBlack);
280 
281  m_legTiNormal = new TPaveText(0.15, 0.65, 0.35, 0.80, "NDC");
282  m_legTiNormal->AddText("TIME SHIFT UNDER LIMIT");
283  m_legTiNormal->AddText(Form("abs(Mean) < %3.1f ns", m_timeThreshold));
284  m_legTiNormal->SetFillColor(c_ColorDefault);
285  m_legTiNormal->SetLineColor(kBlack);
286 
287  m_legTiEmpty = new TPaveText(0.15, 0.65, 0.35, 0.80, "NDC");
288  m_legTiEmpty->AddText("Not enough statistics");
289  m_legTiEmpty->SetFillColor(c_ColorDefault);
290  m_legTiEmpty->SetLineColor(kBlack);
291 
292  m_legTi3Problem = new TPaveText(0.15, 0.65, 0.35, 0.80, "NDC");
293  m_legTi3Problem->AddText("ERROR!");
294  m_legTi3Problem->AddText(Form("abs(Mean) > %3.1f ns", m_timeThreshold));
295  m_legTi3Problem->SetFillColor(c_ColorDefault);
296  m_legTi3Problem->SetLineColor(kBlack);
297 
298  m_legTi3Normal = new TPaveText(0.15, 0.65, 0.35, 0.80, "NDC");
299  m_legTi3Normal->AddText("TIME SHIFT UNDER LIMIT");
300  m_legTi3Normal->AddText(Form("abs(Mean) < %3.1f ns", m_timeThreshold));
301  m_legTi3Normal->SetFillColor(c_ColorDefault);
302  m_legTi3Normal->SetLineColor(kBlack);
303 
304  m_legTi3Empty = new TPaveText(0.15, 0.65, 0.35, 0.80, "NDC");
305  m_legTi3Empty->AddText("Not enough statistics");
306  m_legTi3Empty->SetFillColor(kBlack);
307  m_legTi3Empty->SetLineColor(kBlack);
308 }
309 
311 {
312  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: event called.");
313 
314  //find nEvents
315  TH1* hnEvnts = findHist("SVDExpReco/SVDDQM_nEvents", true);
316  if (hnEvnts == NULL) {
317  B2INFO("no events, nothing to do here");
318  return;
319  } else {
320  B2DEBUG(10, "SVDExpReco/SVDDQM_nEvents found");
321  }
322 
323  TH1* rtype = findHist("DQMInfo/rtype");
324  if (rtype)
325  B2DEBUG(10, "DQMInfo/rtype found");
326 
327  m_runtype = rtype ? rtype->GetTitle() : "physics"; // per default
328 
329  TString tmp = hnEvnts->GetTitle();
330  Int_t pos = tmp.Last('~');
331  if (pos == -1) pos = 0;
332 
333  TString runID = tmp(pos, tmp.Length() - pos);
334  B2INFO("DQMHistAnalysisSVDGeneralModule::runID = " << runID);
335  Float_t nEvents = hnEvnts->GetEntries();
336 
337  //check DATA FORMAT
338  TH1* h = findHist("SVDUnpacker/DQMUnpackerHisto");
339 
340  //test ERROR:
341  // h->SetBinContent(100,0.01);
342 
343  if (h != NULL) {
344  h->SetTitle(Form("SVD Data Format Monitor %s", runID.Data()));
345  //check if number of errors is above the allowed limit
346  bool hasError = false;
347  for (int un = 0; un < h->GetNcells(); un++)
348  if (h->GetBinContent(un) / nEvents > m_unpackError)
349  hasError = true;
350  if (! hasError) {
351  m_cUnpacker->cd();
352  h->Draw("colztext");
353  h->SetStats(0);
355  } else {
356  m_cUnpacker->cd();
357  h->Draw("colztext");
358  h->SetStats(0);
359  m_legError->Draw();
361  }
362  if (nEvents > 0)
363  setEpicsPV("UnpackError", h->GetEntries() / nEvents);
364  } else {
365  B2INFO("Histogram SVDUnpacker/DQMUnpackerHisto from SVDUnpackerDQM not found!");
366  m_cUnpacker->cd(1);
368  }
369 
370  m_cUnpacker->Modified();
371  m_cUnpacker->Update();
372 
373  if (m_printCanvas)
374  m_cUnpacker->Print("c_SVDDataFormat.pdf");
375 
376  //occupancy chart
377  TH1F* hChart = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsChip");
378 
379  if (hChart != NULL) {
380  m_hOccupancyChartChip.Clear();
381  hChart->Copy(m_hOccupancyChartChip);
382  m_hOccupancyChartChip.SetName("SVDOccupancyChart");
383  m_hOccupancyChartChip.SetTitle(Form("SVD OFFLINE Occupancy per chip %s", runID.Data()));
384  m_hOccupancyChartChip.Scale(1 / nEvents / 128);
385  m_cOccupancyChartChip->cd();
386  // m_hOccupancyChartChip->SetStats(0);
387  m_hOccupancyChartChip.Draw();
388  }
389  m_cOccupancyChartChip->Modified();
390  m_cOccupancyChartChip->Update();
391 
392  if (m_printCanvas)
393  m_cOccupancyChartChip->Print("c_OccupancyChartChip.pdf");
394 
395  // cluster time for clusters of track
396  double ratio3_6 = 0.;
397  TH1* m_h = findHist("SVDClsTrk/SVDTRK_ClusterTimeV456");
398  bool hasError = false;
399  bool lowStat = false;
400 
401  if (m_h != NULL) {
403  m_h->Copy(m_hClusterOnTrackTime_L456V);
404  m_hClusterOnTrackTime_L456V.GetXaxis()->SetRange(110, 190); // [-40 ns,40 ns]
405  Float_t mean_PeakInCenter = m_hClusterOnTrackTime_L456V.GetMean(); //
406  m_hClusterOnTrackTime_L456V.GetXaxis()->SetRange(); // back to [-150 ns,150 ns]
407  m_hClusterOnTrackTime_L456V.SetTitle(Form("ClusterOnTrack Time L456V %s", runID.Data()));
408 
409  if (nEvents > m_statThreshold) {
410  if (m_runtype == "physics") {
411  Float_t difference_physics = fabs(mean_PeakInCenter - m_refMeanP);
412  if (difference_physics > m_timeThreshold) {
413  hasError = true;
414  }
415  } else if (m_runtype == "cosmic") {
416  Float_t difference_cosmic = fabs(mean_PeakInCenter - m_refMeanC);
417  if (difference_cosmic > m_timeThreshold) {
418  hasError = true;
419  }
420  } else { // taking cosmic limits
421  B2WARNING("Run type:" << m_runtype << "taken cosmics criteria");
422  Float_t difference_cosmic = fabs(mean_PeakInCenter - m_refMeanC);
423  if (difference_cosmic > m_timeThreshold)
424  hasError = true;
425  }
426  } else {
427  lowStat = true;
428  }
429 
430  if (! hasError) {
434  } else {
438  }
439 
440  if (lowStat) {
444  }
445 
446  } else {
447  B2INFO("Histogram SVDClsTrk/c_SVDTRK_ClusterTimeV456 from SVDDQMClustersOnTrack module not found!");
451  }
452 
453  if (hasError)
454  m_legTiProblem->Draw();
455  else if (lowStat)
456  m_legTiEmpty->Draw();
457  else
458  m_legTiNormal->Draw();
459 
460 
461  m_cClusterOnTrackTime_L456V->Modified();
462  m_cClusterOnTrackTime_L456V->Update();
463 
464  if (m_printCanvas)
465  m_cClusterOnTrackTime_L456V->Print("c_SVDClusterOnTrackTime_L456V.pdf");
466 
467 
468  // cluster time for clusters of track for 3 samples
469  if (m_3Samples) {
470  m_h = findHist("SVDClsTrk/SVDTRK_Cluster3TimeV456");
471  bool hasError3 = false;
472  bool lowStat3 = false;
473 
474  if (m_h != NULL) {
477  m_hClusterOnTrackTimeL456V3Samples.GetXaxis()->SetRange(110, 190); // [-40 ns,40 ns]
478  Float_t mean_PeakInCenter = m_hClusterOnTrackTimeL456V3Samples.GetMean(); //
479  m_hClusterOnTrackTimeL456V3Samples.GetXaxis()->SetRange(); // back to [-150 ns,150 ns]
480  m_hClusterOnTrackTimeL456V3Samples.SetTitle(Form("ClusterOnTrack Time L456V 3 samples %s", runID.Data()));
481 
482  if (nEvents > m_statThreshold) {
483  if (m_runtype == "physics") {
484  Float_t difference_physics = fabs(mean_PeakInCenter - m_refMeanP);
485  if (difference_physics > m_timeThreshold) {
486  hasError3 = true;
487  }
488  } else if (m_runtype == "cosmic") {
489  Float_t difference_cosmic = fabs(mean_PeakInCenter - m_refMeanC);
490  if (difference_cosmic > m_timeThreshold) {
491  hasError3 = true;
492  }
493  } else {
494  B2WARNING("Run type:" << m_runtype);
495  }
496  } else {
497  lowStat3 = true;
498  }
499  if (! hasError3) {
503  } else {
507  }
508 
509  if (lowStat3) {
513  }
514 
515  } else {
516  B2INFO("Histogram SVDClsTrk/c_SVDTRK_Cluster3TimeV456 from SVDDQMClustersOnTrack module not found!");
520  }
521 
522  if (hasError3)
523  m_legTi3Problem->Draw();
524  else if (lowStat3)
525  m_legTi3Empty->Draw();
526  else
527  m_legTi3Normal->Draw();
528 
531 
532  if (m_printCanvas)
533  m_cClusterOnTrackTimeL456V3Samples->Print("c_SVDClusterOnTrack3Time_L456V.pdf");
534 
535  ratio3_6 = m_hClusterOnTrackTimeL456V3Samples.GetEntries() / m_hClusterOnTrackTime_L456V.GetEntries();
536  }
537 
538  setEpicsPV("ratio3_6", ratio3_6);
539 
540  //check MODULE OCCUPANCY online & offline
541  //reset canvas color
542  m_occUstatus = 0;
543  m_occVstatus = 0;
544  m_onlineOccUstatus = 0;
545  m_onlineOccVstatus = 0;
546  m_occUGroupId0 = 0;
547  m_occVGroupId0 = 0;
548 
551 
552  m_occU3Samples = 0;
553  m_occV3Samples = 0;
554 
555  //update titles with exp and run number
556 
557  m_hOccupancy->reset();
559  m_hOccupancy->setRunID(runID);
560 
564 
568 
569  if (m_3Samples) {
573 
577  }
578 
579  //set dedicate gStyle
580  const Int_t colNum = 4;
581  Int_t palette[colNum] {kBlack, c_ColorGood, c_ColorWarning, c_ColorError};
582  gStyle->SetPalette(colNum, palette);
583  gStyle->SetOptStat(0);
584  gStyle->SetPaintTextFormat("2.3f");
585 
586  TH1F* htmp = NULL;
587 
588  for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
589  int tmp_layer = m_SVDModules[i].getLayerNumber();
590  int tmp_ladder = m_SVDModules[i].getLadderNumber();
591  int tmp_sensor = m_SVDModules[i].getSensorNumber();
592 
593  //look for U histogram - OFFLINE ZS
594  TString tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
595 
596  htmp = (TH1F*)findHist(tmpname.Data());
597  if (htmp == NULL) {
598  B2INFO("Occupancy U histogram not found");
599  m_cOccupancyU->Draw();
600  m_cOccupancyU->cd();
601  m_hOccupancy->getHistogram(1)->Draw("text");
603  } else {
604 
605  Int_t nStrips = 768;
606 
607  Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
608  m_hOccupancy->fill(m_SVDModules[i], 1, occU);
609 
610  if (occU <= m_occEmpty) {
611  if (m_occUstatus < 1) m_occUstatus = 1;
612  } else if (occU > m_occWarning) {
613  if (occU < m_occError) {
614  if (m_occUstatus < 2) m_occUstatus = 2;
615  } else {
616  if (m_occUstatus < 3) m_occUstatus = 3;
617  }
618  }
619 
620  //produce the occupancy plot
621  if (m_additionalPlots) {
622  m_hStripOccupancyU[i].Clear();
623  htmp->Copy(m_hStripOccupancyU[i]);
624  m_hStripOccupancyU[i].Scale(1 / nEvents);
625  m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
626  m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
627  tmp_sensor, runID.Data()));
628  } else {
629  if (i == 0 || i == 1) {
630  m_hStripOccupancyU[i].Clear();
631  htmp->Copy(m_hStripOccupancyU[i]);
632  m_hStripOccupancyU[i].Scale(1 / nEvents);
633  m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
634  m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
635  tmp_sensor, runID.Data()));
636  }
637  }
638  }
639 
640  if (m_3Samples) {
641  //look for U histogram - OFFLINE ZS for 3 samples
642  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
643 
644  htmp = (TH1F*)findHist(tmpname.Data());
645  if (htmp == NULL) {
646  B2INFO("Occupancy U histogram not found for 3 samples");
647  m_cOccupancyU3Samples->Draw();
648  m_cOccupancyU3Samples->cd();
649  m_hOccupancy3Samples->getHistogram(1)->Draw("text");
651  } else {
652 
653  Int_t nStrips = 768;
654 
655  Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
656  m_hOccupancy3Samples->fill(m_SVDModules[i], 1, occU);
657 
658 
659  if (occU <= m_occEmpty) {
660  if (m_occU3Samples < 1) m_occU3Samples = 1;
661  } else if (occU > m_occWarning) {
662  if (occU < m_occError) {
663  if (m_occU3Samples < 2) m_occU3Samples = 2;
664  } else {
665  if (m_occU3Samples < 3) m_occU3Samples = 3;
666  }
667  }
668  }
669  }
670 
671  // groupId0 side U
672  TString tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
673  htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
674  if (htmp == NULL) {
675  B2INFO("Occupancy U histogram for group Id0 not found");
676  m_cOccupancyUGroupId0->Draw();
677  m_cOccupancyUGroupId0->cd();
678  m_hOccupancyGroupId0->getHistogram(1)->Draw("text");
680  } else {
681 
682  Int_t nStrips = 768;
683 
684  Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
685  m_hOccupancyGroupId0->fill(m_SVDModules[i], 1, occU);
686 
687  if (occU <= m_occEmpty) {
688  if (m_occUGroupId0 < 1) m_occUGroupId0 = 1;
689  } else if (occU > m_occWarning) {
690  if (occU < m_occError) {
691  if (m_occUGroupId0 < 2) m_occUGroupId0 = 2;
692  } else {
693  if (m_occUGroupId0 < 3) m_occUGroupId0 = 3;
694  }
695  }
696  }
697 
698  //look for V histogram - OFFLINE ZS
699  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
700 
701  htmp = (TH1F*)findHist(tmpname.Data());
702  if (htmp == NULL) {
703  B2INFO("Occupancy V histogram not found");
704  m_cOccupancyV->Draw();
705  m_cOccupancyV->cd();
706  m_hOccupancy->getHistogram(0)->Draw("text");
708  } else {
709 
710  Int_t nStrips = 768;
711  if (tmp_layer != 3)
712  nStrips = 512;
713 
714  Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
715  m_hOccupancy->fill(m_SVDModules[i], 0, occV);
716 
717  if (occV <= m_occEmpty) {
718  if (m_occVstatus < 1) m_occVstatus = 1;
719  } else if (occV > m_occWarning) {
720  if (occV < m_occError) {
721  if (m_occVstatus < 2) m_occVstatus = 2;
722  } else {
723  if (m_occVstatus < 3) m_occVstatus = 3;
724  }
725  }
726  //produce the occupancy plot
727  if (m_additionalPlots) {
728  m_hStripOccupancyV[i].Clear();
729  htmp->Copy(m_hStripOccupancyV[i]);
730  m_hStripOccupancyV[i].Scale(1 / nEvents);
731  m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
732  m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
733  tmp_sensor, runID.Data()));
734  } else {
735  if (i == 0 || i == 1) {
736  m_hStripOccupancyV[i].Clear();
737  htmp->Copy(m_hStripOccupancyV[i]);
738  m_hStripOccupancyV[i].Scale(1 / nEvents);
739  m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
740  m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
741  tmp_sensor, runID.Data()));
742  }
743  }
744  }
745 
746  if (m_3Samples) {
747  //look for V histogram - OFFLINE ZS for 3 samples
748  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
749 
750  htmp = (TH1F*)findHist(tmpname.Data());
751  if (htmp == NULL) {
752  B2INFO("Occupancy V histogram not found");
753  m_cOccupancyV3Samples->Draw();
754  m_cOccupancyV3Samples->cd();
755  m_hOccupancy3Samples->getHistogram(0)->Draw("text");
757  } else {
758 
759  Int_t nStrips = 768;
760  if (tmp_layer != 3)
761  nStrips = 512;
762 
763  Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
764  m_hOccupancy3Samples->fill(m_SVDModules[i], 0, occV);
765 
766  if (occV <= m_occEmpty) {
767  if (m_occV3Samples < 1) m_occV3Samples = 1;
768  } else if (occV > m_occWarning) {
769  if (occV < m_occError) {
770  if (m_occV3Samples < 2) m_occV3Samples = 2;
771  } else {
772  if (m_occV3Samples < 3) m_occV3Samples = 3;
773  }
774  }
775  }
776  }
777 
778  // groupId0 side V
779  tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
780 
781  htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
782  if (htmp == NULL) {
783  B2INFO("Occupancy U histogram for group Id0 not found");
784  m_cOccupancyVGroupId0->Draw();
785  m_cOccupancyVGroupId0->cd();
786  m_hOccupancyGroupId0->getHistogram(0)->Draw("text");
788  } else {
789 
790  Int_t nStrips = 768;
791  if (tmp_layer != 3)
792  nStrips = 512;
793 
794  Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
795  m_hOccupancyGroupId0->fill(m_SVDModules[i], 0, occV);
796 
797  if (occV <= m_occEmpty) {
798  if (m_occVGroupId0 < 1) m_occVGroupId0 = 1;
799  } else if (occV > m_occWarning) {
800  if (occV < m_occError) {
801  if (m_occVGroupId0 < 2) m_occVGroupId0 = 2;
802  } else {
803  if (m_occVGroupId0 < 3) m_occVGroupId0 = 3;
804  }
805  }
806  }
807 
808  //look for V histogram - ONLINE ZS
809  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
810 
811  htmp = (TH1F*)findHist(tmpname.Data());
812  if (htmp == NULL) {
813  B2INFO("OnlineOccupancy V histogram not found");
814  m_cOnlineOccupancyV->Draw();
815  m_cOnlineOccupancyV->cd();
816  m_hOnlineOccupancy->getHistogram(0)->Draw("text");
818  } else {
819 
820  Int_t nStrips = 768;
821  if (tmp_layer != 3)
822  nStrips = 512;
823 
824  Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
825  m_hOnlineOccupancy->fill(m_SVDModules[i], 0, onlineOccV);
826 
827 
828  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
829  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
830  }
831  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
832 
833  if (onlineOccV <= m_onlineOccEmpty) {
835  } else if (onlineOccV > m_onlineOccWarning) {
836  if (onlineOccV < m_onlineOccError) {
838  } else {
840  }
841  }
842  }
843 
844  if (m_3Samples) {
845  //look for V histogram - ONLINE ZS for 3 samples
846  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
847 
848  htmp = (TH1F*)findHist(tmpname.Data());
849  if (htmp == NULL) {
850  B2INFO("OnlineOccupancy3 V histogram not found");
853  m_hOnlineOccupancy3Samples->getHistogram(0)->Draw("text");
855  } else {
856 
857  Int_t nStrips = 768;
858  if (tmp_layer != 3)
859  nStrips = 512;
860 
861  Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
862  m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 0, onlineOccV);
863 
864  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
865  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
866  }
867  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
868 
869  if (onlineOccV <= m_onlineOccEmpty) {
871  } else if (onlineOccV > m_onlineOccWarning) {
872  if (onlineOccV < m_onlineOccError) {
874  } else {
876  }
877  }
878  }
879  }
880 
881 
882  //look for U histogram - ONLINE ZS
883  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
884 
885  htmp = (TH1F*)findHist(tmpname.Data());
886  if (htmp == NULL) {
887  B2INFO("OnlineOccupancy U histogram not found");
888  m_cOnlineOccupancyU->Draw();
889  m_cOnlineOccupancyU->cd();
890  m_hOnlineOccupancy->getHistogram(1)->Draw("text");
892  } else {
893 
894  Int_t nStrips = 768;
895 
896  Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
897  m_hOnlineOccupancy->fill(m_SVDModules[i], 1, onlineOccU);
898 
899  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
900  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
901  }
902  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
903 
904  if (onlineOccU <= m_onlineOccEmpty) {
906  } else if (onlineOccU > m_onlineOccWarning) {
907  if (onlineOccU < m_onlineOccError) {
909  } else {
911  }
912  }
913  }
914 
915  if (m_3Samples) {
916  //look for U histogram - ONLINE ZS for 3 samples
917  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
918 
919  htmp = (TH1F*)findHist(tmpname.Data());
920  if (htmp == NULL) {
921  B2INFO("OnlineOccupancy3 U histogram not found");
924  m_hOnlineOccupancy3Samples->getHistogram(1)->Draw("text");
926  } else {
927 
928  Int_t nStrips = 768;
929 
930  Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
931  m_hOnlineOccupancy3Samples->fill(m_SVDModules[i], 1, onlineOccU);
932 
933  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
934  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
935  }
936  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
937 
938  if (onlineOccU <= m_onlineOccEmpty) {
940  } else if (onlineOccU > m_onlineOccWarning) {
941  if (onlineOccU < m_onlineOccError) {
943  } else {
945  }
946  }
947  }
948  }
949 
950  //update sensor occupancy canvas U and V
951  if (m_additionalPlots) {
952  m_cStripOccupancyU[i]->cd();
953  m_hStripOccupancyU[i].Draw("histo");
954  m_cStripOccupancyV[i]->cd();
955  m_hStripOccupancyV[i].Draw("histo");
956  } else {
957  if (i == 0 || i == 1) {
958  m_cStripOccupancyU[i]->cd();
959  m_hStripOccupancyU[i].Draw("histo");
960  m_cStripOccupancyV[i]->cd();
961  m_hStripOccupancyV[i].Draw("histo");
962  }
963  }
964  }
965 
966  //update summary offline occupancy U canvas
967  m_cOccupancyU->Draw();
968  m_cOccupancyU->cd();
969  m_hOccupancy->getHistogram(1)->Draw("text");
970 
971  if (m_occUstatus == 0) {
973  m_legNormal->Draw();
974  } else {
975  if (m_occUstatus == 3) {
977  m_legProblem->Draw();
978  }
979  if (m_occUstatus == 2) {
981  m_legWarning->Draw();
982  }
983  if (m_occUstatus == 1) {
985  m_legEmpty->Draw();
986  }
987  }
988  m_cOccupancyU->Update();
989  m_cOccupancyU->Modified();
990  m_cOccupancyU->Update();
991 
992  if (m_3Samples) {
993  //update summary offline occupancy U canvas for 3 samples
994  m_cOccupancyU3Samples->Draw();
995  m_cOccupancyU3Samples->cd();
996  m_hOccupancy3Samples->getHistogram(1)->Draw("text");
997 
998  if (m_occU3Samples == 0) {
1000  m_legNormal->Draw();
1001  } else {
1002  if (m_occU3Samples == 3) {
1004  m_legProblem->Draw();
1005  }
1006  if (m_occU3Samples == 2) {
1008  m_legWarning->Draw();
1009  }
1010  if (m_occU3Samples == 1) {
1012  m_legEmpty->Draw();
1013  }
1014  }
1015  m_cOccupancyU3Samples->Update();
1016  m_cOccupancyU3Samples->Modified();
1017  m_cOccupancyU3Samples->Update();
1018  }
1019 
1020  //update summary offline occupancy U canvas for groupId0
1021  m_cOccupancyUGroupId0->Draw();
1022  m_cOccupancyUGroupId0->cd();
1023  m_hOccupancyGroupId0->getHistogram(1)->Draw("text");
1024 
1025  if (m_occUGroupId0 == 0) {
1027  m_legNormal->Draw();
1028  } else {
1029  if (m_occUGroupId0 == 3) {
1031  m_legProblem->Draw();
1032  }
1033  if (m_occUGroupId0 == 2) {
1035  m_legWarning->Draw();
1036  }
1037  if (m_occUGroupId0 == 1) {
1039  m_legEmpty->Draw();
1040  }
1041  }
1042  m_cOccupancyUGroupId0->Update();
1043  m_cOccupancyUGroupId0->Modified();
1044  m_cOccupancyUGroupId0->Update();
1045 
1046  //update summary offline occupancy V canvas
1047  m_cOccupancyV->Draw();
1048  m_cOccupancyV->cd();
1049  m_hOccupancy->getHistogram(0)->Draw("text");
1050 
1051  if (m_occVstatus == 0) {
1053  m_legNormal->Draw();
1054  } else {
1055  if (m_occVstatus == 3) {
1057  m_legProblem->Draw();
1058  }
1059  if (m_occVstatus == 2) {
1061  m_legWarning->Draw();
1062  }
1063  if (m_occVstatus == 1) {
1065  m_legEmpty->Draw();
1066  }
1067  }
1068 
1069  m_cOccupancyV->Update();
1070  m_cOccupancyV->Modified();
1071  m_cOccupancyV->Update();
1072 
1073  if (m_3Samples) {
1074  //update summary offline occupancy V canvas for 3 samples
1075  m_cOccupancyV3Samples->Draw();
1076  m_cOccupancyV3Samples->cd();
1077  m_hOccupancy3Samples->getHistogram(0)->Draw("text");
1078 
1079  if (m_occV3Samples == 0) {
1081  m_legNormal->Draw();
1082  } else {
1083  if (m_occV3Samples == 3) {
1085  m_legProblem->Draw();
1086  }
1087  if (m_occV3Samples == 2) {
1089  m_legWarning->Draw();
1090  }
1091  if (m_occV3Samples == 1) {
1093  m_legEmpty->Draw();
1094  }
1095  }
1096 
1097  m_cOccupancyV3Samples->Update();
1098  m_cOccupancyV3Samples->Modified();
1099  m_cOccupancyV3Samples->Update();
1100  }
1101 
1102  //update summary offline occupancy V canvas for groupId0
1103  m_cOccupancyVGroupId0->Draw();
1104  m_cOccupancyVGroupId0->cd();
1105  m_hOccupancyGroupId0->getHistogram(0)->Draw("text");
1106 
1107  if (m_occVGroupId0 == 0) {
1109  m_legNormal->Draw();
1110  } else {
1111  if (m_occVGroupId0 == 3) {
1113  m_legProblem->Draw();
1114  }
1115  if (m_occVGroupId0 == 2) {
1117  m_legWarning->Draw();
1118  }
1119  if (m_occVGroupId0 == 1) {
1121  m_legEmpty->Draw();
1122  }
1123  }
1124  m_cOccupancyVGroupId0->Update();
1125  m_cOccupancyVGroupId0->Modified();
1126  m_cOccupancyVGroupId0->Update();
1127 
1128  //update summary online occupancy U canvas
1129  m_cOnlineOccupancyU->Draw();
1130  m_cOnlineOccupancyU->cd();
1131  m_hOnlineOccupancy->getHistogram(1)->Draw("text");
1132 
1133  if (m_onlineOccUstatus == 0) {
1135  m_legOnNormal->Draw();
1136  } else {
1137  if (m_onlineOccUstatus == 3) {
1139  m_legOnProblem->Draw();
1140  }
1141  if (m_onlineOccUstatus == 2) {
1143  m_legOnWarning->Draw();
1144  }
1145  if (m_onlineOccUstatus == 1) {
1147  m_legOnEmpty->Draw();
1148  }
1149  }
1150 
1151  m_cOnlineOccupancyU->Update();
1152  m_cOnlineOccupancyU->Modified();
1153  m_cOnlineOccupancyU->Update();
1154 
1155  //update summary online occupancy V canvas
1156  m_cOnlineOccupancyV->Draw();
1157  m_cOnlineOccupancyV->cd();
1158  m_hOnlineOccupancy->getHistogram(0)->Draw("text");
1159 
1160  if (m_onlineOccVstatus == 0) {
1162  m_legOnNormal->Draw();
1163  } else {
1164  if (m_onlineOccVstatus == 3) {
1166  m_legOnProblem->Draw();
1167  }
1168  if (m_onlineOccVstatus == 2) {
1170  m_legOnWarning->Draw();
1171  }
1172  if (m_onlineOccVstatus == 1) {
1174  m_legOnEmpty->Draw();
1175  }
1176  }
1177 
1178  m_cOnlineOccupancyV->Update();
1179  m_cOnlineOccupancyV->Modified();
1180  m_cOnlineOccupancyV->Update();
1181 
1182  if (m_printCanvas) {
1183  m_cOccupancyU->Print("c_SVDOccupancyU.pdf");
1184  m_cOccupancyV->Print("c_SVDOccupancyV.pdf");
1185  m_cOnlineOccupancyU->Print("c_SVDOnlineOccupancyU.pdf");
1186  m_cOnlineOccupancyV->Print("c_SVDOnlineOccupancyV.pdf");
1187  }
1188 
1189  if (m_3Samples) {
1190  //update summary online occupancy U canvas for 3 samples
1193  m_hOnlineOccupancy3Samples->getHistogram(1)->Draw("text");
1194 
1195  if (m_onlineOccU3Samples == 0) {
1197  m_legOnNormal->Draw();
1198  } else {
1199  if (m_onlineOccU3Samples == 3) {
1201  m_legOnProblem->Draw();
1202  }
1203  if (m_onlineOccU3Samples == 2) {
1205  m_legOnWarning->Draw();
1206  }
1207  if (m_onlineOccU3Samples == 1) {
1209  m_legOnEmpty->Draw();
1210  }
1211  }
1212 
1213  m_cOnlineOccupancyU3Samples->Update();
1214  m_cOnlineOccupancyU3Samples->Modified();
1215  m_cOnlineOccupancyU3Samples->Update();
1216 
1217  //update summary online occupancy V canvas for 3 samples
1220  m_hOnlineOccupancy3Samples->getHistogram(0)->Draw("text");
1221 
1222  if (m_onlineOccV3Samples == 0) {
1224  m_legOnNormal->Draw();
1225  } else {
1226  if (m_onlineOccV3Samples == 3) {
1228  m_legOnProblem->Draw();
1229  }
1230  if (m_onlineOccV3Samples == 2) {
1232  m_legOnWarning->Draw();
1233  }
1234  if (m_onlineOccV3Samples == 1) {
1236  m_legOnEmpty->Draw();
1237  }
1238  }
1239 
1240  m_cOnlineOccupancyV3Samples->Update();
1241  m_cOnlineOccupancyV3Samples->Modified();
1242  m_cOnlineOccupancyV3Samples->Update();
1243  }
1244 }
1245 
1247 {
1248  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: endRun called");
1249 }
1250 
1251 
1253 {
1254  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: terminate called");
1255 
1256  delete m_refFile;
1257  delete m_legProblem;
1258  delete m_legWarning;
1259  delete m_legNormal;
1260  delete m_legEmpty;
1261  delete m_legError;
1262  delete m_legOnProblem;
1263  delete m_legOnWarning;
1264  delete m_legOnNormal;
1265  delete m_legOnEmpty;
1266  delete m_legOnError;
1267 
1268  delete m_cUnpacker;
1269 
1270  delete m_cOccupancyU;
1271  delete m_cOccupancyV;
1272 
1273  delete m_hOccupancy;
1274  delete m_hOnlineOccupancy;
1275  delete m_hOccupancyGroupId0;
1276  delete m_hOccupancy3Samples;
1278 
1279  delete m_cOnlineOccupancyU;
1280  delete m_cOnlineOccupancyV;
1281 
1282  delete m_cOccupancyChartChip;
1283 
1284  for (int module = 0; module < m_sensors; module++) {
1285  delete m_cStripOccupancyU[module];
1286  delete m_cStripOccupancyV[module];
1287  }
1288  delete m_cStripOccupancyU;
1289  delete m_cStripOccupancyV;
1290 
1292 }
1293 
1294 Int_t DQMHistAnalysisSVDGeneralModule::findBinY(Int_t layer, Int_t sensor)
1295 {
1296  if (layer == 3)
1297  return sensor; //2
1298  if (layer == 4)
1299  return 2 + 1 + sensor; //6
1300  if (layer == 5)
1301  return 6 + 1 + sensor; // 11
1302  if (layer == 6)
1303  return 11 + 1 + sensor; // 17
1304  else
1305  return -1;
1306 }
1307 
The base class for the histogram analysis module.
int registerEpicsPV(std::string pvname, std::string keyname="", bool update_pvs=true)
EPICS related Functions.
void colorizeCanvas(TCanvas *canvas, EStatus status)
Helper function for Canvas colorization.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
@ c_ColorWarning
Analysis result: Warning, there may be minor issues.
@ c_ColorError
Analysis result: Severe issue found.
@ c_ColorGood
Analysis result: Good.
@ c_ColorDefault
default for non-coloring
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
@ c_StatusDefault
default for non-coloring
@ c_StatusTooFew
Not enough entries/event to judge.
@ c_StatusError
Analysis result: Severe issue found.
@ c_StatusWarning
Analysis result: Warning, there may be minor issues.
@ c_StatusGood
Analysis result: Good.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
TPaveText * m_legTiEmpty
cluster time on tracks plot legend, empty
TCanvas * m_cClusterOnTrackTimeL456V3Samples
time for clusters on Track for L456V canvas for 3 sampples
TCanvas * m_cOnlineOccupancyU
online occupancy U histo canvas
std::string m_refFileName
Parameters accesible from basf2 scripts.
Int_t m_onlineOccV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampes
TCanvas * m_cOccupancyV
occupancy V histo canvas
void initialize() override final
Initializer.
TPaveText * m_legOnProblem
onlineOccupancy plot legend, problem
TPaveText * m_legError
OfflineOccupancy plot legend, error.
TPaveText * m_legEmpty
OfflineOccupancy plot legend, empty.
double m_statThreshold
minimal number of events to compare histograms
Int_t findBinY(Int_t layer, Int_t sensor)
find Y bin corresponding to sensor, occupancy plot
TCanvas * m_cOccupancyU
occupancy U histo canvas
double m_timeThreshold
difference between mean of cluster time for present and reference run
TPaveText * m_legTi3Normal
cluster time on tracks for 3 samples plot legend, normal
TString m_runtype
string with runtype: physics or cosmic
Int_t m_occUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
TPaveText * m_legTiProblem
cluster time on tracks plot legend, problem
int m_sensors
number of sensors to considired
TCanvas ** m_cStripOccupancyV
u-side strip chart occupancy canvas
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
double m_onlineOccError
error level of the onlineOccupancy
float m_refMeanC
mean of the signal time peak from Cosmic reference run
TCanvas * m_cOccupancyVGroupId0
occupancy V histo canvas for cluster time group Id = 0
SVDSummaryPlots * m_hOccupancy3Samples
occupancy histos for 3 samples
Int_t m_onlineOccUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
Int_t m_onlineOccVstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
double m_onlineOccEmpty
empty level of the occupancy
TPaveText * m_legOnEmpty
onlineOccupancy plot legend, empty
SVDSummaryPlots * m_hOnlineOccupancy3Samples
online occupancy histos for 3 sampels
SVDSummaryPlots * m_hOccupancy
occupancy histos
std::string m_pvPrefix
string prefix for EPICS PVs
double m_occWarning
warning level of the occupancy
void terminate() override final
This method is called at the end of the event processing.
TCanvas * m_cOccupancyU3Samples
occupancy U histo canvas for 3 sampes
SVDSummaryPlots * m_hOccupancyGroupId0
occupancy histos for cluster time group id=0
TPaveText * m_legWarning
OfflineOccupancy plot legend, warning.
TCanvas * m_cOnlineOccupancyV3Samples
online Occupancy V histo canvas for 3 samples
TCanvas * m_cOccupancyChartChip
occupancy chart histo canvas
TPaveText * m_legOnError
onlineOccupancy plot legend, error
void event() override final
This method is called for each event.
bool m_printCanvas
if true print the pdf of the canvases
TCanvas ** m_cStripOccupancyU
u-side strip chart occupancy canvas
TH1F m_hStripOccupancyV[172]
u-side strip chart occupancy histos
Int_t m_occUGroupId0
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 samples
TPaveText * m_legOnNormal
onlineOccupancy plot legend, normal
bool m_3Samples
if true enable 3 samples histograms analysis
TH1F m_hClusterOnTrackTime_L456V
time for clusters on Track for L456V histo
TPaveText * m_legTi3Empty
cluster time on tracks for 3 samples plot legend, empty
void endRun() override final
This method is called if the current run ends.
TCanvas * m_cClusterOnTrackTime_L456V
time for clusters on Track for L456V canvas
Int_t m_onlineOccU3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sample
void beginRun() override final
Called when entering a new run.
Double_t m_unpackError
Maximum bin_content/ # events allowed before throwing ERROR.
SVDSummaryPlots * m_hOnlineOccupancy
online occupancy histos
Int_t m_occVstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
TPaveText * m_legNormal
OfflineOccupancy plot legend, normal.
TPaveText * m_legOnWarning
onlineOccupancy plot legend, warning
double m_occEmpty
empty level of the occupancy
Int_t m_occV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampels
TCanvas * m_cOnlineOccupancyV
online Occupancy V histo canvas
TCanvas * m_cOccupancyUGroupId0
occupancy U histo canvas for cluster time group Id = 0
Int_t m_occU3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 samples
TCanvas * m_cOccupancyV3Samples
occupancy V histo canvas for 3 samples
double m_onlineOccWarning
warning level of the onlineOccupancy
TPaveText * m_legProblem
OfflineOccupancy plot legend, problem.
TPaveText * m_legTiNormal
cluster time on tracks plot legend, normal
double m_occError
error level of the occupancy
float m_refMeanP
mean of the signal time peak from Physics reference run
TH1F m_hClusterOnTrackTimeL456V3Samples
time for clusters on Track for L456V histo for 3 samples
TPaveText * m_legTi3Problem
cluster time on tracks for 3 samples plot legend, problem
TCanvas * m_cOnlineOccupancyU3Samples
online occupancy U histo canvas for 3 samples
Int_t m_occVGroupId0
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampels
TH1F m_hStripOccupancyU[172]
u-side strip chart occupancy histos
TFile * m_refFile
The pointer to the reference file.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
class to summarize SVD quantities per sensor and side
void setStats(bool stats=true)
set histograms stat
void fill(int layer, int ladder, int sensor, int view, float value)
fill the histogram for
TH2F * getHistogram(int view)
get a reference to the histogram for
void setRunID(const TString &runID)
set run ids in title
void reset()
Reset histograms.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:39
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
Definition: GeoCache.cc:59
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.