Belle II Software  release-08-00-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(kRed);
74  m_legError->SetTextColor(kWhite);
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
92  if (m_additionalPlots) {
93  m_cStripOccupancyU = new TCanvas*[nSensors];
94  m_cStripOccupancyV = new TCanvas*[nSensors];
95  for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
96  int tmp_layer = m_SVDModules[i].getLayerNumber();
97  int tmp_ladder = m_SVDModules[i].getLadderNumber();
98  int tmp_sensor = m_SVDModules[i].getSensorNumber();
99  m_cStripOccupancyU[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
100  m_cStripOccupancyV[i] = new TCanvas(Form("SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
101  }
102  }
103 
104  //occupancy plot Y axis title
105  m_yTitle = new TText(-0.75, 13, "layer.ladder.sensor");
106  m_yTitle->SetTextAngle(90);
107  m_yTitle->SetTextSize(0.03);
108  m_yTitle->SetTextFont(42);
109 
110  gROOT->cd();
111  m_cUnpacker = new TCanvas("SVDAnalysis/c_SVDDataFormat");
112  m_cUnpacker->SetGrid(1);
113  m_cOccupancyU = new TCanvas("SVDAnalysis/c_SVDOccupancyU");
114  m_cOccupancyV = new TCanvas("SVDAnalysis/c_SVDOccupancyV");
115 
116  m_cOnlineOccupancyU = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU");
117  m_cOnlineOccupancyV = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV");
118 
119  m_cClusterOnTrackTime_L456V = new TCanvas("SVDAnalysis/c_ClusterOnTrackTime_L456V");
120 
121  if (m_3Samples) {
122  m_cOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyU3Samples");
123  // m_cOccupancyU->SetGrid(1);
124  m_cOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOccupancyV3Samples");
125  // m_cOccupancyV->SetGrid(1);
126 
127  m_cOnlineOccupancyU3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyU3Samples");
128  // m_cOnlineOccupancyU->SetGrid(1);
129  m_cOnlineOccupancyV3Samples = new TCanvas("SVDAnalysis/c_SVDOnlineOccupancyV3Samples");
130  // m_cOnlineOccupancyV->SetGrid(1);
131  m_cClusterOnTrackTimeL456V3Samples = new TCanvas("SVDAnalysis/c_ClusterOnTrackTime_L456V3Samples");
132  }
133 
134  m_cOccupancyUGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyUGroupId0");
135  m_cOccupancyVGroupId0 = new TCanvas("SVDAnalysis/c_SVDOccupancyVGroupId0");
136 
137  const int nY = 19;
138  TString Ylabels[nY] = {"", "L3.x.1", "L3.x.2",
139  "", "L4.x.1", "L4.x.2", "L4.x.3",
140  "", "L5.x.1", "L5.x.2", "L5.x.3", "L5.x.4",
141  "", "L6.x.1", "L6.x.2", "L6.x.3", "L6.x.4", "L6.x.5", ""
142  };
143 
144 
145  m_hOccupancyV = new TH2F("hOccupancyV", "Average OFFLINE Sensor Occupancy (%), V side ", 16, 0.5, 16.5, 19, 0, 19);
146  m_hOccupancyV->SetMarkerSize(1.1);
147  m_hOccupancyV->GetXaxis()->SetTitle("ladder number");
148  m_hOccupancyV->GetXaxis()->SetLabelSize(0.04);
149  for (unsigned short i = 0; i < nY; i++) m_hOccupancyV->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
150 
151  m_hOccupancyU = new TH2F("hOccupancyU", "Average OFFLINE Sensor Occupancy (%), U side ", 16, 0.5, 16.5, 19, 0, 19);
152  m_hOccupancyU->SetMarkerSize(1.1);
153  m_hOccupancyU->GetXaxis()->SetTitle("ladder number");
154  m_hOccupancyU->GetXaxis()->SetLabelSize(0.04);
155  for (unsigned short i = 0; i < nY; i++) m_hOccupancyU->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
156 
157  m_hOnlineOccupancyV = new TH2F("hOnlineOccupancyV", "Average ONLINE Sensor Occupancy (%), V side ", 16, 0.5, 16.5, 19, 0, 19);
158  m_hOnlineOccupancyV->SetMarkerSize(1.1);
159  m_hOnlineOccupancyV->GetXaxis()->SetTitle("ladder number");
160  m_hOnlineOccupancyV->GetXaxis()->SetLabelSize(0.04);
161  for (unsigned short i = 0; i < nY; i++) m_hOnlineOccupancyV->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
162 
163  m_hOnlineOccupancyU = new TH2F("hOnlineOccupancyU", "Average ONLINE Sensor Occupancy (%), U side ", 16, 0.5, 16.5, 19, 0, 19);
164  m_hOnlineOccupancyU->SetMarkerSize(1.1);
165  m_hOnlineOccupancyU->GetXaxis()->SetTitle("ladder number");
166  m_hOnlineOccupancyU->GetXaxis()->SetLabelSize(0.04);
167  for (unsigned short i = 0; i < nY; i++) m_hOnlineOccupancyU->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
168 
169  // 3 samples occupancy
170  m_hOccupancyV3Samples = new TH2F("hOccupancy3V", "Average OFFLINE Sensor Occupancy (%), V side for 3 samples", 16, 0.5, 16.5, 19,
171  0, 19);
172  m_hOccupancyV3Samples->SetMarkerSize(1.1);
173  m_hOccupancyV3Samples->GetXaxis()->SetTitle("ladder number");
174  m_hOccupancyV3Samples->GetXaxis()->SetLabelSize(0.04);
175  for (unsigned short i = 0; i < nY; i++) m_hOccupancyV3Samples->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
176 
177  if (m_3Samples) {
178  m_hOccupancyU3Samples = new TH2F("hOccupancy3U", "Average OFFLINE Sensor Occupancy (%), U side for 3 samples", 16, 0.5, 16.5, 19,
179  0, 19);
180  m_hOccupancyU3Samples->SetMarkerSize(1.1);
181  m_hOccupancyU3Samples->GetXaxis()->SetTitle("ladder number");
182  m_hOccupancyU3Samples->GetXaxis()->SetLabelSize(0.04);
183  for (unsigned short i = 0; i < nY; i++) m_hOccupancyU3Samples->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
184 
185  m_hOnlineOccupancyV3Samples = new TH2F("hOnlineOccupancy3V", "Average ONLINE Sensor Occupancy (%), V side for 3 samples", 16, 0.5,
186  16.5, 19, 0, 19);
187  m_hOnlineOccupancyV3Samples->SetMarkerSize(1.1);
188  m_hOnlineOccupancyV3Samples->GetXaxis()->SetTitle("ladder number");
189  m_hOnlineOccupancyV3Samples->GetXaxis()->SetLabelSize(0.04);
190  for (unsigned short i = 0; i < nY; i++) m_hOnlineOccupancyV3Samples->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
191 
192  m_hOnlineOccupancyU3Samples = new TH2F("hOnlineOccupancy3U", "Average ONLINE Sensor Occupancy (%), U side for 3 samples", 16, 0.5,
193  16.5, 19, 0, 19);
194  m_hOnlineOccupancyU3Samples->SetMarkerSize(1.1);
195  m_hOnlineOccupancyU3Samples->GetXaxis()->SetTitle("ladder number");
196  m_hOnlineOccupancyU3Samples->GetXaxis()->SetLabelSize(0.04);
197  for (unsigned short i = 0; i < nY; i++) m_hOnlineOccupancyU3Samples->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
198  }
199 
200  m_hOccupancyVGroupId0 = new TH2F("hOccupancyVGroupId0",
201  "Average OFFLINE Sensor Occupancy (%), V side for cluster time group Id = 0", 16, 0.5, 16.5, 19, 0, 19);
202  m_hOccupancyVGroupId0->SetMarkerSize(1.1);
203  m_hOccupancyVGroupId0->GetXaxis()->SetTitle("ladder number");
204  m_hOccupancyVGroupId0->GetXaxis()->SetLabelSize(0.04);
205  for (unsigned short i = 0; i < nY; i++) m_hOccupancyVGroupId0->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
206 
207  m_hOccupancyUGroupId0 = new TH2F("hOccupancyUGroupId0",
208  "Average OFFLINE Sensor Occupancy (%), U side for cluster time group Id = 0", 16, 0.5, 16.5, 19, 0, 19);
209  m_hOccupancyUGroupId0->SetMarkerSize(1.1);
210  m_hOccupancyUGroupId0->GetXaxis()->SetTitle("ladder number");
211  m_hOccupancyUGroupId0->GetXaxis()->SetLabelSize(0.04);
212  for (unsigned short i = 0; i < nY; i++) m_hOccupancyUGroupId0->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
213 
214  rtype = findHist("DQMInfo/rtype");
215  if (rtype)
216  B2DEBUG(10, "DQMInfo/rtype found");
217 
218  runtype = rtype ? rtype->GetTitle() : "physics"; // per default
219  // runtype = "physics";
220 
221  //register limits for EPICS
222  registerEpicsPV(m_pvPrefix + "ratio3_6", "ratio3_6");
223  registerEpicsPV(m_pvPrefix + "UnpackError", "UnpackError");
224  registerEpicsPV(m_pvPrefix + "occupancyLimits", "occLimits");
225  registerEpicsPV(m_pvPrefix + "occupancyOnlineLimits", "occOnlineLimits");
226  registerEpicsPV(m_pvPrefix + "clusterTimeOnTrackLimits", "clusTimeOnTrkLimits");
227 }
228 
229 
231 {
232  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: beginRun called.");
233  m_cUnpacker->Clear();
234  m_cOccupancyU->Clear();
235  m_cOccupancyV->Clear();
236 
237  m_cOnlineOccupancyU->Clear();
238  m_cOnlineOccupancyV->Clear();
239  m_cOccupancyChartChip->Clear();
240  if (m_additionalPlots) {
241  for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
242  m_cStripOccupancyU[i]->Clear();
243  m_cStripOccupancyV[i]->Clear();
244  }
245  }
247 
248  if (m_3Samples) {
249  m_cOccupancyU3Samples->Clear();
250  m_cOccupancyV3Samples->Clear();
254  }
255  m_cOccupancyUGroupId0->Clear();
256  m_cOccupancyVGroupId0->Clear();
257 
258  //Retrieve limits from EPICS
259  double oocErrorLoOff = 0.;
260  double oocErrorLoOn = 0.;
261  requestLimitsFromEpicsPVs("occLimits", oocErrorLoOff, m_occEmpty, m_occWarning, m_occError);
263 
264  B2DEBUG(10, " SVD occupancy thresholds taken from EPICS configuration file:");
265  B2DEBUG(10, " ONLINE OCCUPANCY: empty < " << m_onlineOccEmpty << " normal < " << m_onlineOccWarning << " warning < " <<
267  " < error");
268  B2DEBUG(10, " OFFLINE OCCUPANCY: empty < " << m_occEmpty << " normal < " << m_occWarning << " warning < " << m_occError <<
269  " < error with minimum statistics of " << m_occEmpty);
270 
271  double timeWarnUp = 0.;
272  double timeErrorLo = 0.;
273  requestLimitsFromEpicsPVs("clusTimeOnTrkLimits", timeErrorLo, m_statThreshold, timeWarnUp, m_timeThreshold);
274  B2DEBUG(10, " SVD cluster time on track threshold taken from EPICS configuration file:");
275  B2DEBUG(10, " CLUSTER TIME ON TRACK: error > " << m_timeThreshold << " ns with minimum statistics of " << m_statThreshold);
276 
277  double unpackWarnLo = 0.;
278  double unpackWarnUp = 0.;
279  double unpackErrorLo = 0.;
280  requestLimitsFromEpicsPVs("UnpackError", unpackErrorLo, unpackWarnLo, unpackWarnUp, m_unpackError);
281  B2DEBUG(10, " SVD unpack error threshold taken from EPICS configuration file:");
282  B2DEBUG(10, " DATA UNPACK: error > " << m_unpackError);
283 
284  // Create text panel
285  //OFFLINE occupancy plots legend
286  m_legProblem = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
287  m_legProblem->AddText("ERROR!");
288  m_legProblem->AddText("at least one sensor with:");
289  m_legProblem->AddText(Form("occupancy > %1.1f%%", m_occError));
290  m_legProblem->SetFillColor(kRed);
291  m_legWarning = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
292  m_legWarning->AddText("WARNING!");
293  m_legWarning->AddText("at least one sensor with:");
294  m_legWarning->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occWarning, m_occError));
295  m_legWarning->SetFillColor(kYellow);
296  m_legNormal = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
297  m_legNormal->AddText("OCCUPANCY WITHIN LIMITS");
298  m_legNormal->AddText(Form("%1.1f%% < occupancy < %1.1f%%", m_occEmpty, m_occWarning));
299  m_legNormal->SetFillColor(kGreen);
300  m_legNormal->SetBorderSize(0.);
301  m_legNormal->SetLineColor(kBlack);
302  m_legEmpty = new TPaveText(11, findBinY(4, 3) - 2, 16, findBinY(4, 3));
303  m_legEmpty->AddText("NO DATA RECEIVED");
304  m_legEmpty->AddText("from at least one sensor");
305  m_legEmpty->SetFillColor(kBlack);
306  m_legEmpty->SetTextColor(kWhite);
307  m_legEmpty->SetBorderSize(0.);
308  m_legEmpty->SetLineColor(kBlack);
309 
310  //ONLINE occupancy plots legend
311  m_legOnProblem = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
312  m_legOnProblem->AddText("ERROR!");
313  m_legOnProblem->AddText("at least one sensor with:");
314  m_legOnProblem->AddText(Form("online occupancy > %1.1f%%", m_onlineOccError));
315  m_legOnProblem->SetFillColor(kRed);
316  m_legOnWarning = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
317  m_legOnWarning->AddText("WARNING!");
318  m_legOnWarning->AddText("at least one sensor with:");
319  m_legOnWarning->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccWarning, m_onlineOccError));
320  m_legOnWarning->SetFillColor(kYellow);
321  m_legOnNormal = new TPaveText(11, findBinY(4, 3) - 3, 16, findBinY(4, 3));
322  m_legOnNormal->AddText("OCCUPANCY WITHIN LIMITS");
323  m_legOnNormal->AddText(Form("%1.1f%% < online occupancy < %1.1f%%", m_onlineOccEmpty, m_onlineOccWarning));
324  m_legOnNormal->SetFillColor(kGreen);
325  m_legOnNormal->SetBorderSize(0.);
326  m_legOnNormal->SetLineColor(kBlack);
327  m_legOnEmpty = new TPaveText(11, findBinY(4, 3) - 2, 16, findBinY(4, 3));
328  m_legOnEmpty->AddText("NO DATA RECEIVED");
329  m_legOnEmpty->AddText("from at least one sensor");
330  m_legOnEmpty->SetFillColor(kBlack);
331  m_legOnEmpty->SetTextColor(kWhite);
332 }
333 
335 {
336  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: event called.");
337 
338  //find nEvents
339  TH1* hnEvnts = findHist("SVDExpReco/SVDDQM_nEvents", true);
340  if (hnEvnts == NULL) {
341  B2INFO("no events, nothing to do here");
342  return;
343  } else {
344  B2DEBUG(10, "SVDExpReco/SVDDQM_nEvents found");
345  }
346 
347  TString runID = TString((hnEvnts->GetTitle())).Remove(0, 21);
348  B2INFO("runID = " << runID);
349  Float_t nEvents = hnEvnts->GetEntries();
350 
351  //check DATA FORMAT
352  TH1* h = findHist("SVDUnpacker/DQMUnpackerHisto");
353 
354  //test ERROR:
355  // h->SetBinContent(100,0.01);
356 
357  if (h != NULL) {
358  h->SetTitle("SVD Data Format Monitor " + runID);
359  //check if number of errors is above the allowed limit
360  bool hasError = false;
361  for (int un = 0; un < h->GetNcells(); un++)
362  if (h->GetBinContent(un) / nEvents > m_unpackError)
363  hasError = true;
364  if (! hasError) {
365  m_cUnpacker->SetFillColor(kGreen);
366  m_cUnpacker->SetFrameFillColor(10);
367  } else {
368  m_legError->Draw("same");
369  m_cUnpacker->SetFillColor(kRed);
370  m_cUnpacker->SetFrameFillColor(10);
371  }
372  setEpicsPV("UnpackError", h->GetEntries() / nEvents);
373 
374  m_cUnpacker->cd();
375  h->Draw("colztext");
376  h->SetStats(0);
377  } else {
378  B2INFO("Histogram SVDUnpacker/DQMUnpackerHisto from SVDUnpackerDQM not found!");
379  m_cUnpacker->SetFillColor(kRed);
380  }
381 
382  m_cUnpacker->Modified();
383  m_cUnpacker->Update();
384 
385  if (m_printCanvas)
386  m_cUnpacker->Print("c_SVDDataFormat.pdf");
387 
388  //occupancy chart
389  TH1F* hChart = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsChip");
390 
391  if (hChart != NULL) {
392  m_hOccupancyChartChip.Clear();
393  hChart->Copy(m_hOccupancyChartChip);
394  m_hOccupancyChartChip.SetName("SVDOccupancyChart");
395  m_hOccupancyChartChip.SetTitle("SVD OFFLINE Occupancy per chip " + runID);
396  m_hOccupancyChartChip.Scale(1 / nEvents / 128);
397  m_cOccupancyChartChip->cd();
398  // m_hOccupancyChartChip->SetStats(0);
399  m_hOccupancyChartChip.Draw();
400  }
401  m_cOccupancyChartChip->Modified();
402  m_cOccupancyChartChip->Update();
403 
404  if (m_printCanvas)
405  m_cOccupancyChartChip->Print("c_OccupancyChartChip.pdf");
406 
407  // cluster time for clusters of track
408  double ratio3_6 = 0.;
409  TH1* m_h = findHist("SVDClsTrk/SVDTRK_ClusterTimeV456");
410  if (m_h != NULL) {
412  m_h->Copy(m_hClusterOnTrackTime_L456V);
413  m_hClusterOnTrackTime_L456V.GetXaxis()->SetRange(110, 190); // [-40 ns,40 ns]
414  Float_t mean_PeakInCenter = m_hClusterOnTrackTime_L456V.GetMean(); //
415  m_hClusterOnTrackTime_L456V.GetXaxis()->SetRange(); // back to [-150 ns,150 ns]
416  m_hClusterOnTrackTime_L456V.SetTitle("ClusterOnTrack Time L456V " + runID);
417  bool hasError = false;
418  bool lowStat = false;
419 
420  if (nEvents > m_statThreshold) {
421  if (runtype == "physics") {
422  Float_t difference_physics = fabs(mean_PeakInCenter - m_refMeanP);
423  if (difference_physics > m_timeThreshold) {
424  hasError = true;
425  }
426  } else if (runtype == "cosmic") {
427  Float_t difference_cosmic = fabs(mean_PeakInCenter - m_refMeanC);
428  if (difference_cosmic > m_timeThreshold) {
429  hasError = true;
430  }
431  } else {
432  B2WARNING("Run type:" << runtype);
433  }
434  } else {
435  lowStat = true;
436  }
437 
438  if (! hasError) {
439  m_cClusterOnTrackTime_L456V->SetFillColor(kGreen);
440  m_cClusterOnTrackTime_L456V->SetFrameFillColor(10);
441  } else {
442  m_legError->Draw("same");
443  m_cClusterOnTrackTime_L456V->SetFillColor(kRed);
444  m_cClusterOnTrackTime_L456V->SetFrameFillColor(10);
445  }
446 
447  if (lowStat) {
448  m_cClusterOnTrackTime_L456V->SetFillColor(kGray);
449  m_cClusterOnTrackTime_L456V->SetFrameFillColor(10);
450  }
451 
452  } else {
453  B2INFO("Histogram SVDClsTrk/c_SVDTRK_ClusterTimeV456 from SVDDQMClustersOnTrack module not found!");
454  m_cClusterOnTrackTime_L456V->SetFillColor(kRed);
455  }
456 
459 
460  m_cClusterOnTrackTime_L456V->Modified();
461  m_cClusterOnTrackTime_L456V->Update();
462 
463  if (m_printCanvas)
464  m_cClusterOnTrackTime_L456V->Print("c_SVDClusterOnTrackTime_L456V.pdf");
465 
466 
467  // cluster time for clusters of track for 3 samples
468  if (m_3Samples) {
469  m_h = findHist("SVDClsTrk/SVDTRK_Cluster3TimeV456");
470  if (m_h != NULL) {
473  m_hClusterOnTrackTimeL456V3Samples.GetXaxis()->SetRange(110, 190); // [-40 ns,40 ns]
474  Float_t mean_PeakInCenter = m_hClusterOnTrackTimeL456V3Samples.GetMean(); //
475  m_hClusterOnTrackTimeL456V3Samples.GetXaxis()->SetRange(); // back to [-150 ns,150 ns]
476  m_hClusterOnTrackTimeL456V3Samples.SetTitle("ClusterOnTrack Time L456V 3 samples " + runID);
477  bool hasError = false;
478  bool lowStat = false;
479 
480  if (nEvents > m_statThreshold) {
481  if (runtype == "physics") {
482  Float_t difference_physics = fabs(mean_PeakInCenter - m_refMeanP);
483  if (difference_physics > m_timeThreshold) {
484  hasError = true;
485  }
486  } else if (runtype == "cosmic") {
487  Float_t difference_cosmic = fabs(mean_PeakInCenter - m_refMeanC);
488  if (difference_cosmic > m_timeThreshold) {
489  hasError = true;
490  }
491  } else {
492  B2WARNING("Run type:" << runtype);
493  }
494  } else {
495  lowStat = true;
496  }
497  if (! hasError) {
498  m_cClusterOnTrackTimeL456V3Samples->SetFillColor(kGreen);
499  m_cClusterOnTrackTimeL456V3Samples->SetFrameFillColor(10);
500  } else {
501  m_legError->Draw("same");
502  m_cClusterOnTrackTimeL456V3Samples->SetFillColor(kRed);
503  m_cClusterOnTrackTimeL456V3Samples->SetFrameFillColor(10);
504  }
505 
506  if (lowStat) {
507  m_cClusterOnTrackTimeL456V3Samples->SetFillColor(kGray);
508  m_cClusterOnTrackTimeL456V3Samples->SetFrameFillColor(10);
509  }
510 
511  } else {
512  B2INFO("Histogram SVDClsTrk/c_SVDTRK_Cluster3TimeV456 from SVDDQMClustersOnTrack module not found!");
513  m_cClusterOnTrackTimeL456V3Samples->SetFillColor(kRed);
514  }
515 
518 
521 
522  if (m_printCanvas)
523  m_cClusterOnTrackTimeL456V3Samples->Print("c_SVDClusterOnTrack3Time_L456V.pdf");
524 
525  ratio3_6 = m_hClusterOnTrackTimeL456V3Samples.GetEntries() / m_hClusterOnTrackTime_L456V.GetEntries();
526  }
527 
528  setEpicsPV("ratio3_6", ratio3_6);
529 
530  //check MODULE OCCUPANCY online & offline
531  //reset canvas color
532  m_occUstatus = 0;
533  m_occVstatus = 0;
534  m_onlineOccUstatus = 0;
535  m_onlineOccVstatus = 0;
536 
539 
540  m_occU3Samples = 0;
541  m_occV3Samples = 0;
542 
543  //update titles with exp and run number
544  m_hOccupancyU->SetTitle("Average OFFLINE Sensor Occupancy (%), U side " + runID);
545  m_hOccupancyU->SetStats(0);
546  m_hOccupancyV->SetTitle("Average OFFLINE Sensor Occupancy (%), V side " + runID);
547  m_hOccupancyV->SetStats(0);
548 
549  m_hOnlineOccupancyU->SetTitle("Average ONLINE Sensor Occupancy (%), U side " + runID);
550  m_hOnlineOccupancyU->SetStats(0);
551  m_hOnlineOccupancyV->SetTitle("Average ONLINE Sensor Occupancy (%), V side " + runID);
552  m_hOnlineOccupancyV->SetStats(0);
553 
554  if (m_3Samples) {
555  //update titles with exp and run number for 3 samples
556  m_hOccupancyU3Samples->SetTitle("Average OFFLINE Sensor Occupancy (%), U side for 3 samples" + runID);
557  m_hOccupancyU3Samples->SetStats(0);
558  m_hOccupancyV3Samples->SetTitle("Average OFFLINE Sensor Occupancy (%), V side for 3 samples" + runID);
559  m_hOccupancyV3Samples->SetStats(0);
560 
561  m_hOnlineOccupancyU3Samples->SetTitle("Average ONLINE Sensor Occupancy (%), U side for 3 samples" + runID);
562  m_hOnlineOccupancyU3Samples->SetStats(0);
563  m_hOnlineOccupancyV3Samples->SetTitle("Average ONLINE Sensor Occupancy (%), V side for 3 samples" + runID);
564  m_hOnlineOccupancyV3Samples->SetStats(0);
565  }
566 
567  //set dedicate gStyle
568  const Int_t colNum = 4;
569  Int_t palette[colNum] {kBlack, kGreen, kYellow, kRed};
570  gStyle->SetPalette(colNum, palette);
571  gStyle->SetOptStat(0);
572  gStyle->SetPaintTextFormat("2.3f");
573 
574  TH1F* htmp = NULL;
575 
576  for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
577  int tmp_layer = m_SVDModules[i].getLayerNumber();
578  int tmp_ladder = m_SVDModules[i].getLadderNumber();
579  int tmp_sensor = m_SVDModules[i].getSensorNumber();
580 
581 
582  Int_t bin = m_hOccupancyU->FindBin(tmp_ladder, findBinY(tmp_layer, tmp_sensor));
583 
584  //look for U histogram - OFFLINE ZS
585  TString tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
586 
587  htmp = (TH1F*)findHist(tmpname.Data());
588  if (htmp == NULL) {
589  B2INFO("Occupancy U histogram not found");
590  m_cOccupancyU->SetFillColor(kRed);
591  } else {
592 
593  Int_t nStrips = 768;
594 
595  Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
596  m_hOccupancyU->SetBinContent(bin, occU);
597 
598  if (occU <= m_occEmpty) {
599  if (m_occUstatus < 1) m_occUstatus = 1;
600  } else if (occU > m_occWarning) {
601  if (occU < m_occError) {
602  if (m_occUstatus < 2) m_occUstatus = 2;
603  } else {
604  if (m_occUstatus < 3) m_occUstatus = 3;
605  }
606  }
607 
608  //produce the occupancy plot
609  if (m_additionalPlots) {
610  m_hStripOccupancyU[i].Clear();
611  htmp->Copy(m_hStripOccupancyU[i]);
612  m_hStripOccupancyU[i].Scale(1 / nEvents);
613  m_hStripOccupancyU[i].SetName(Form("%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
614  m_hStripOccupancyU[i].SetTitle(Form("SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number", tmp_layer, tmp_ladder,
615  tmp_sensor));
616  }
617  }
618 
619  if (m_3Samples) {
620  //look for U histogram - OFFLINE ZS for 3 samples
621  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
622 
623  htmp = (TH1F*)findHist(tmpname.Data());
624  if (htmp == NULL) {
625  B2INFO("Occupancy U histogram not found for 3 samples");
626  m_cOccupancyU3Samples->SetFillColor(kRed);
627  } else {
628 
629  Int_t nStrips = 768;
630 
631  Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
632  m_hOccupancyU3Samples->SetBinContent(bin, occU);
633 
634 
635  if (occU <= m_occEmpty) {
636  if (m_occU3Samples < 1) m_occU3Samples = 1;
637  } else if (occU > m_occWarning) {
638  if (occU < m_occError) {
639  if (m_occU3Samples < 2) m_occU3Samples = 2;
640  } else {
641  if (m_occU3Samples < 3) m_occU3Samples = 3;
642  }
643  }
644  }
645  }
646 
647  // groupId0 side U
648  TString tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
649 
650  htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
651  if (htmp == NULL) {
652  B2INFO("Occupancy U histogram for group Id0 not found");
653  m_cOccupancyUGroupId0->SetFillColor(kRed);
654  } else {
655 
656  Int_t nStrips = 768;
657 
658  Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
659  m_hOccupancyUGroupId0->SetBinContent(bin, occU);
660 
661  if (occU <= m_occEmpty) {
662  if (m_occUGroupId0 < 1) m_occUGroupId0 = 1;
663  } else if (occU > m_occWarning) {
664  if (occU < m_occError) {
665  if (m_occUGroupId0 < 2) m_occUGroupId0 = 2;
666  } else {
667  if (m_occUGroupId0 < 3) m_occUGroupId0 = 3;
668  }
669  }
670  }
671 
672  //look for V histogram - OFFLINE ZS
673  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
674 
675  htmp = (TH1F*)findHist(tmpname.Data());
676  if (htmp == NULL) {
677  B2INFO("Occupancy V histogram not found");
678  m_cOccupancyV->SetFillColor(kRed);
679  } else {
680 
681  Int_t nStrips = 768;
682  if (tmp_layer != 3)
683  nStrips = 512;
684 
685  Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
686  m_hOccupancyV->SetBinContent(bin, occV);
687 
688  if (occV <= m_occEmpty) {
689  if (m_occVstatus < 1) m_occVstatus = 1;
690  } else if (occV > m_occWarning) {
691  if (occV < m_occError) {
692  if (m_occVstatus < 2) m_occVstatus = 2;
693  } else {
694  if (m_occVstatus < 3) m_occVstatus = 3;
695  }
696  }
697  //produce the occupancy plot
698  if (m_additionalPlots) {
699  m_hStripOccupancyV[i].Clear();
700  htmp->Copy(m_hStripOccupancyV[i]);
701  m_hStripOccupancyV[i].Scale(1 / nEvents);
702  m_hStripOccupancyV[i].SetName(Form("%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
703  m_hStripOccupancyV[i].SetTitle(Form("SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number", tmp_layer, tmp_ladder,
704  tmp_sensor));
705  }
706 
707  }
708 
709  if (m_3Samples) {
710  //look for V histogram - OFFLINE ZS for 3 samples
711  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
712 
713  htmp = (TH1F*)findHist(tmpname.Data());
714  if (htmp == NULL) {
715  B2INFO("Occupancy V histogram not found");
716  m_cOccupancyV3Samples->SetFillColor(kRed);
717  } else {
718 
719  Int_t nStrips = 768;
720  if (tmp_layer != 3)
721  nStrips = 512;
722 
723  Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
724  m_hOccupancyV3Samples->SetBinContent(bin, occV);
725 
726  if (occV <= m_occEmpty) {
727  if (m_occV3Samples < 1) m_occV3Samples = 1;
728  } else if (occV > m_occWarning) {
729  if (occV < m_occError) {
730  if (m_occV3Samples < 2) m_occV3Samples = 2;
731  } else {
732  if (m_occV3Samples < 3) m_occV3Samples = 3;
733  }
734  }
735  }
736  }
737 
738  // groupId0 side V
739  tmpnameGrpId0 = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
740 
741  htmp = (TH1F*)findHist(tmpnameGrpId0.Data());
742  if (htmp == NULL) {
743  B2INFO("Occupancy U histogram for group Id0 not found");
744  m_cOccupancyVGroupId0->SetFillColor(kRed);
745  } else {
746 
747  Int_t nStrips = 768;
748 
749  Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
750  m_hOccupancyVGroupId0->SetBinContent(bin, occU);
751 
752  if (occU <= m_occEmpty) {
753  if (m_occVGroupId0 < 1) m_occVGroupId0 = 1;
754  } else if (occU > m_occWarning) {
755  if (occU < m_occError) {
756  if (m_occVGroupId0 < 2) m_occVGroupId0 = 2;
757  } else {
758  if (m_occVGroupId0 < 3) m_occVGroupId0 = 3;
759  }
760  }
761  }
762 
763  //look for V histogram - ONLINE ZS
764  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
765 
766  htmp = (TH1F*)findHist(tmpname.Data());
767  if (htmp == NULL) {
768  B2INFO("OnlineOccupancy V histogram not found");
769  m_cOnlineOccupancyV->SetFillColor(kRed);
770  } else {
771 
772  Int_t nStrips = 768;
773  if (tmp_layer != 3)
774  nStrips = 512;
775 
776  Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
777  m_hOnlineOccupancyV->SetBinContent(bin, onlineOccV);
778 
779  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
780  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
781  }
782  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
783 
784  if (onlineOccV <= m_onlineOccEmpty) {
786  } else if (onlineOccV > m_onlineOccWarning) {
787  if (onlineOccV < m_onlineOccError) {
789  } else {
791  }
792  }
793  }
794 
795  if (m_3Samples) {
796  //look for V histogram - ONLINE ZS for 3 samples
797  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
798 
799  htmp = (TH1F*)findHist(tmpname.Data());
800  if (htmp == NULL) {
801  B2INFO("OnlineOccupancy3 V histogram not found");
802  m_cOnlineOccupancyV3Samples->SetFillColor(kRed);
803  } else {
804 
805  Int_t nStrips = 768;
806  if (tmp_layer != 3)
807  nStrips = 512;
808 
809  Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
810  m_hOnlineOccupancyV3Samples->SetBinContent(bin, onlineOccV);
811 
812  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
813  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
814  }
815  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
816 
817  if (onlineOccV <= m_onlineOccEmpty) {
819  } else if (onlineOccV > m_onlineOccWarning) {
820  if (onlineOccV < m_onlineOccError) {
822  } else {
824  }
825  }
826  }
827  }
828 
829 
830  //look for U histogram - ONLINE ZS
831  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
832 
833  htmp = (TH1F*)findHist(tmpname.Data());
834  if (htmp == NULL) {
835  B2INFO("OnlineOccupancy U histogram not found");
836  m_cOnlineOccupancyU->SetFillColor(kRed);
837  } else {
838 
839  Int_t nStrips = 768;
840 
841  Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
842  m_hOnlineOccupancyU->SetBinContent(bin, onlineOccU);
843 
844  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
845  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
846  }
847  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
848 
849  if (onlineOccU <= m_onlineOccEmpty) {
851  } else if (onlineOccU > m_onlineOccWarning) {
852  if (onlineOccU < m_onlineOccError) {
854  } else {
856  }
857  }
858  }
859 
860  if (m_3Samples) {
861  //look for U histogram - ONLINE ZS for 3 samples
862  tmpname = Form("SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
863 
864  htmp = (TH1F*)findHist(tmpname.Data());
865  if (htmp == NULL) {
866  B2INFO("OnlineOccupancy3 U histogram not found");
867  m_cOnlineOccupancyU3Samples->SetFillColor(kRed);
868  } else {
869 
870  Int_t nStrips = 768;
871 
872  Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
873  m_hOnlineOccupancyU3Samples->SetBinContent(bin, onlineOccU);
874 
875  for (int b = 1; b < htmp->GetNbinsX() + 1; b++) {
876  htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
877  }
878  htmp->GetYaxis()->SetTitle("ZS3 ccupancy (%)");
879 
880  if (onlineOccU <= m_onlineOccEmpty) {
882  } else if (onlineOccU > m_onlineOccWarning) {
883  if (onlineOccU < m_onlineOccError) {
885  } else {
887  }
888  }
889  }
890  }
891 
892  //update sensor occupancy canvas U and V
893  if (m_additionalPlots) {
894  m_cStripOccupancyU[i]->cd();
895  m_hStripOccupancyU[i].Draw("histo");
896  m_cStripOccupancyV[i]->cd();
897  m_hStripOccupancyV[i].Draw("histo");
898  }
899  }
900 
901  //update summary offline occupancy U canvas
902  m_cOccupancyU->cd();
903  m_hOccupancyU->Draw("text");
904  m_yTitle->Draw("same");
905 
906  if (m_occUstatus == 0) {
907  m_cOccupancyU->SetFillColor(kGreen);
908  m_cOccupancyU->SetFrameFillColor(10);
909  m_legNormal->Draw("same");
910  } else {
911  if (m_occUstatus == 3) {
912  m_cOccupancyU->SetFillColor(kRed);
913  m_cOccupancyU->SetFrameFillColor(10);
914  m_legProblem->Draw("same");
915  }
916  if (m_occUstatus == 2) {
917  m_cOccupancyU->SetFillColor(kYellow);
918  m_cOccupancyU->SetFrameFillColor(10);
919  m_legWarning->Draw("same");
920  }
921  if (m_occUstatus == 1) {
922  m_cOccupancyU->SetFillColor(kGray);
923  m_cOccupancyU->SetFrameFillColor(10);
924  m_legEmpty->Draw("same");
925  }
926  }
927  m_cOccupancyU->Draw();
928  m_cOccupancyU->Update();
929  m_cOccupancyU->Modified();
930  m_cOccupancyU->Update();
931 
932  if (m_3Samples) {
933  //update summary offline occupancy U canvas for 3 samples
934  m_cOccupancyU3Samples->cd();
935  m_hOccupancyU3Samples->Draw("text");
936  m_yTitle->Draw("same");
937 
938  if (m_occU3Samples == 0) {
939  m_cOccupancyU3Samples->SetFillColor(kGreen);
940  m_cOccupancyU3Samples->SetFrameFillColor(10);
941  m_legNormal->Draw("same");
942  } else {
943  if (m_occU3Samples == 3) {
944  m_cOccupancyU3Samples->SetFillColor(kRed);
945  m_cOccupancyU3Samples->SetFrameFillColor(10);
946  m_legProblem->Draw("same");
947  }
948  if (m_occU3Samples == 2) {
949  m_cOccupancyU3Samples->SetFillColor(kYellow);
950  m_cOccupancyU3Samples->SetFrameFillColor(10);
951  m_legWarning->Draw("same");
952  }
953  if (m_occU3Samples == 1) {
954  m_cOccupancyU3Samples->SetFillColor(kGray);
955  m_cOccupancyU3Samples->SetFrameFillColor(10);
956  m_legEmpty->Draw("same");
957  }
958  }
959  m_cOccupancyU3Samples->Draw();
960  m_cOccupancyU3Samples->Update();
961  m_cOccupancyU3Samples->Modified();
962  m_cOccupancyU3Samples->Update();
963  }
964 
965  //update summary offline occupancy U canvas for groupId0
966  m_cOccupancyUGroupId0->cd();
967  m_hOccupancyUGroupId0->Draw("text");
968  m_yTitle->Draw("same");
969 
970  if (m_occUGroupId0 == 0) {
971  m_cOccupancyUGroupId0->SetFillColor(kGreen);
972  m_cOccupancyUGroupId0->SetFrameFillColor(10);
973  m_legNormal->Draw("same");
974  } else {
975  if (m_occUGroupId0 == 3) {
976  m_cOccupancyUGroupId0->SetFillColor(kRed);
977  m_cOccupancyUGroupId0->SetFrameFillColor(10);
978  m_legProblem->Draw("same");
979  }
980  if (m_occUGroupId0 == 2) {
981  m_cOccupancyUGroupId0->SetFillColor(kYellow);
982  m_cOccupancyUGroupId0->SetFrameFillColor(10);
983  m_legWarning->Draw("same");
984  }
985  if (m_occUGroupId0 == 1) {
986  m_cOccupancyUGroupId0->SetFillColor(kGray);
987  m_cOccupancyUGroupId0->SetFrameFillColor(10);
988  m_legEmpty->Draw("same");
989  }
990  }
991  m_cOccupancyUGroupId0->Draw();
992  m_cOccupancyUGroupId0->Update();
993  m_cOccupancyUGroupId0->Modified();
994  m_cOccupancyUGroupId0->Update();
995 
996  //update summary offline occupancy V canvas
997  m_cOccupancyV->cd();
998  m_hOccupancyV->Draw("text");
999  m_yTitle->Draw("same");
1000 
1001  if (m_occVstatus == 0) {
1002  m_cOccupancyV->SetFillColor(kGreen);
1003  m_cOccupancyV->SetFrameFillColor(10);
1004  m_legNormal->Draw("same");
1005  } else {
1006  if (m_occVstatus == 3) {
1007  m_cOccupancyV->SetFillColor(kRed);
1008  m_cOccupancyV->SetFrameFillColor(10);
1009  m_legProblem->Draw("same");
1010  }
1011  if (m_occVstatus == 2) {
1012  m_cOccupancyV->SetFillColor(kYellow);
1013  m_cOccupancyV->SetFrameFillColor(10);
1014  m_legWarning->Draw("same");
1015  }
1016  if (m_occVstatus == 1) {
1017  m_cOccupancyV->SetFillColor(kGray);
1018  m_cOccupancyV->SetFrameFillColor(10);
1019  m_legEmpty->Draw("same");
1020  }
1021  }
1022 
1023  m_cOccupancyV->Draw();
1024  m_cOccupancyV->Update();
1025  m_cOccupancyV->Modified();
1026  m_cOccupancyV->Update();
1027 
1028  if (m_3Samples) {
1029  //update summary offline occupancy V canvas for 3 samples
1030  m_cOccupancyV3Samples->cd();
1031  m_hOccupancyV3Samples->Draw("text");
1032  m_yTitle->Draw("same");
1033 
1034  if (m_occV3Samples == 0) {
1035  m_cOccupancyV3Samples->SetFillColor(kGreen);
1036  m_cOccupancyV3Samples->SetFrameFillColor(10);
1037  m_legNormal->Draw("same");
1038  } else {
1039  if (m_occV3Samples == 3) {
1040  m_cOccupancyV3Samples->SetFillColor(kRed);
1041  m_cOccupancyV3Samples->SetFrameFillColor(10);
1042  m_legProblem->Draw("same");
1043  }
1044  if (m_occV3Samples == 2) {
1045  m_cOccupancyV3Samples->SetFillColor(kYellow);
1046  m_cOccupancyV3Samples->SetFrameFillColor(10);
1047  m_legWarning->Draw("same");
1048  }
1049  if (m_occV3Samples == 1) {
1050  m_cOccupancyV3Samples->SetFillColor(kGray);
1051  m_cOccupancyV3Samples->SetFrameFillColor(10);
1052  m_legEmpty->Draw("same");
1053  }
1054  }
1055 
1056  m_cOccupancyV3Samples->Draw();
1057  m_cOccupancyV3Samples->Update();
1058  m_cOccupancyV3Samples->Modified();
1059  m_cOccupancyV3Samples->Update();
1060  }
1061 
1062  //update summary offline occupancy V canvas for groupId0
1063  m_cOccupancyVGroupId0->cd();
1064  m_hOccupancyVGroupId0->Draw("text");
1065  m_yTitle->Draw("same");
1066 
1067  if (m_occVGroupId0 == 0) {
1068  m_cOccupancyVGroupId0->SetFillColor(kGreen);
1069  m_cOccupancyVGroupId0->SetFrameFillColor(10);
1070  m_legNormal->Draw("same");
1071  } else {
1072  if (m_occVGroupId0 == 3) {
1073  m_cOccupancyVGroupId0->SetFillColor(kRed);
1074  m_cOccupancyVGroupId0->SetFrameFillColor(10);
1075  m_legProblem->Draw("same");
1076  }
1077  if (m_occVGroupId0 == 2) {
1078  m_cOccupancyVGroupId0->SetFillColor(kYellow);
1079  m_cOccupancyVGroupId0->SetFrameFillColor(10);
1080  m_legWarning->Draw("same");
1081  }
1082  if (m_occVGroupId0 == 1) {
1083  m_cOccupancyVGroupId0->SetFillColor(kGray);
1084  m_cOccupancyVGroupId0->SetFrameFillColor(10);
1085  m_legEmpty->Draw("same");
1086  }
1087  }
1088  m_cOccupancyVGroupId0->Draw();
1089  m_cOccupancyVGroupId0->Update();
1090  m_cOccupancyVGroupId0->Modified();
1091  m_cOccupancyVGroupId0->Update();
1092 
1093  //update summary online occupancy U canvas
1094  m_cOnlineOccupancyU->cd();
1095  m_hOnlineOccupancyU->Draw("text");
1096  m_yTitle->Draw("same");
1097 
1098  if (m_onlineOccUstatus == 0) {
1099  m_cOnlineOccupancyU->SetFillColor(kGreen);
1100  m_cOnlineOccupancyU->SetFrameFillColor(10);
1101  m_legOnNormal->Draw("same");
1102  } else {
1103  if (m_onlineOccUstatus == 3) {
1104  m_cOnlineOccupancyU->SetFillColor(kRed);
1105  m_cOnlineOccupancyU->SetFrameFillColor(10);
1106  m_legOnProblem->Draw("same");
1107  }
1108  if (m_onlineOccUstatus == 2) {
1109  m_cOnlineOccupancyU->SetFillColor(kYellow);
1110  m_cOnlineOccupancyU->SetFrameFillColor(10);
1111  m_legOnWarning->Draw("same");
1112  }
1113  if (m_onlineOccUstatus == 1) {
1114  m_cOnlineOccupancyU->SetFillColor(kGray);
1115  m_cOnlineOccupancyU->SetFrameFillColor(10);
1116  m_legOnEmpty->Draw("same");
1117  }
1118  }
1119 
1120  m_cOnlineOccupancyU->Draw();
1121  m_cOnlineOccupancyU->Update();
1122  m_cOnlineOccupancyU->Modified();
1123  m_cOnlineOccupancyU->Update();
1124 
1125  //update summary online occupancy V canvas
1126  m_cOnlineOccupancyV->cd();
1127  m_hOnlineOccupancyV->Draw("text");
1128  m_yTitle->Draw("same");
1129 
1130  if (m_onlineOccVstatus == 0) {
1131  m_cOnlineOccupancyV->SetFillColor(kGreen);
1132  m_cOnlineOccupancyV->SetFrameFillColor(10);
1133  m_legOnNormal->Draw("same");
1134  } else {
1135  if (m_onlineOccVstatus == 3) {
1136  m_cOnlineOccupancyV->SetFillColor(kRed);
1137  m_cOnlineOccupancyV->SetFrameFillColor(10);
1138  m_legOnProblem->Draw("same");
1139  }
1140  if (m_onlineOccVstatus == 2) {
1141  m_cOnlineOccupancyV->SetFillColor(kYellow);
1142  m_cOnlineOccupancyV->SetFrameFillColor(10);
1143  m_legOnWarning->Draw("same");
1144  }
1145  if (m_onlineOccVstatus == 1) {
1146  m_cOnlineOccupancyV->SetFillColor(kGray);
1147  m_cOnlineOccupancyV->SetFrameFillColor(10);
1148  m_legOnEmpty->Draw("same");
1149  }
1150  }
1151 
1152  m_cOnlineOccupancyV->Draw();
1153  m_cOnlineOccupancyV->Update();
1154  m_cOnlineOccupancyV->Modified();
1155  m_cOnlineOccupancyV->Update();
1156 
1157  if (m_printCanvas) {
1158  m_cOccupancyU->Print("c_SVDOccupancyU.pdf");
1159  m_cOccupancyV->Print("c_SVDOccupancyV.pdf");
1160  m_cOnlineOccupancyU->Print("c_SVDOnlineOccupancyU.pdf");
1161  m_cOnlineOccupancyV->Print("c_SVDOnlineOccupancyV.pdf");
1162  }
1163 
1164  if (m_3Samples) {
1165  //update summary online occupancy U canvas for 3 samples
1167  m_hOnlineOccupancyU3Samples->Draw("text");
1168  m_yTitle->Draw("same");
1169 
1170  if (m_onlineOccU3Samples == 0) {
1171  m_cOnlineOccupancyU3Samples->SetFillColor(kGreen);
1172  m_cOnlineOccupancyU3Samples->SetFrameFillColor(10);
1173  m_legOnNormal->Draw("same");
1174  } else {
1175  if (m_onlineOccU3Samples == 3) {
1176  m_cOnlineOccupancyU3Samples->SetFillColor(kRed);
1177  m_cOnlineOccupancyU3Samples->SetFrameFillColor(10);
1178  m_legOnProblem->Draw("same");
1179  }
1180  if (m_onlineOccU3Samples == 2) {
1181  m_cOnlineOccupancyU3Samples->SetFillColor(kYellow);
1182  m_cOnlineOccupancyU3Samples->SetFrameFillColor(10);
1183  m_legOnWarning->Draw("same");
1184  }
1185  if (m_onlineOccU3Samples == 1) {
1186  m_cOnlineOccupancyU3Samples->SetFillColor(kGray);
1187  m_cOnlineOccupancyU3Samples->SetFrameFillColor(10);
1188  m_legOnEmpty->Draw("same");
1189  }
1190  }
1191 
1193  m_cOnlineOccupancyU3Samples->Update();
1194  m_cOnlineOccupancyU3Samples->Modified();
1195  m_cOnlineOccupancyU3Samples->Update();
1196 
1197  //update summary online occupancy V canvas for 3 samples
1199  m_hOnlineOccupancyV3Samples->Draw("text");
1200  m_yTitle->Draw("same");
1201 
1202  if (m_onlineOccV3Samples == 0) {
1203  m_cOnlineOccupancyV3Samples->SetFillColor(kGreen);
1204  m_cOnlineOccupancyV3Samples->SetFrameFillColor(10);
1205  m_legOnNormal->Draw("same");
1206  } else {
1207  if (m_onlineOccV3Samples == 3) {
1208  m_cOnlineOccupancyV3Samples->SetFillColor(kRed);
1209  m_cOnlineOccupancyV3Samples->SetFrameFillColor(10);
1210  m_legOnProblem->Draw("same");
1211  }
1212  if (m_onlineOccV3Samples == 2) {
1213  m_cOnlineOccupancyV3Samples->SetFillColor(kYellow);
1214  m_cOnlineOccupancyV3Samples->SetFrameFillColor(10);
1215  m_legOnWarning->Draw("same");
1216  }
1217  if (m_onlineOccV3Samples == 1) {
1218  m_cOnlineOccupancyV3Samples->SetFillColor(kGray);
1219  m_cOnlineOccupancyV3Samples->SetFrameFillColor(10);
1220  m_legOnEmpty->Draw("same");
1221  }
1222  }
1223 
1225  m_cOnlineOccupancyV3Samples->Update();
1226  m_cOnlineOccupancyV3Samples->Modified();
1227  m_cOnlineOccupancyV3Samples->Update();
1228  }
1229 }
1230 
1232 {
1233  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: endRun called");
1234 }
1235 
1236 
1238 {
1239  B2DEBUG(10, "DQMHistAnalysisSVDGeneral: terminate called");
1240 
1241  delete m_refFile;
1242  delete m_legProblem;
1243  delete m_legWarning;
1244  delete m_legNormal;
1245  delete m_legEmpty;
1246  delete m_legError;
1247  delete m_legOnProblem;
1248  delete m_legOnWarning;
1249  delete m_legOnNormal;
1250  delete m_legOnEmpty;
1251  delete m_legOnError;
1252  delete m_yTitle;
1253 
1254  delete m_cUnpacker;
1255 
1256  delete m_hOccupancyU;
1257  delete m_cOccupancyU;
1258  delete m_hOccupancyV;
1259  delete m_cOccupancyV;
1260 
1261  delete m_hOnlineOccupancyU;
1262  delete m_cOnlineOccupancyU;
1263  delete m_hOnlineOccupancyV;
1264  delete m_cOnlineOccupancyV;
1265 
1266  delete m_cOccupancyChartChip;
1267 
1268  if (m_additionalPlots) {
1269  for (int module = 0; module < nSensors; module++) {
1270  delete m_cStripOccupancyU[module];
1271  delete m_cStripOccupancyV[module];
1272  }
1273  delete m_cStripOccupancyU;
1274  delete m_cStripOccupancyV;
1275  }
1277 }
1278 
1279 Int_t DQMHistAnalysisSVDGeneralModule::findBinY(Int_t layer, Int_t sensor)
1280 {
1281  if (layer == 3)
1282  return sensor; //2
1283  if (layer == 4)
1284  return 2 + 1 + sensor; //6
1285  if (layer == 5)
1286  return 6 + 1 + sensor; // 11
1287  if (layer == 6)
1288  return 11 + 1 + sensor; // 17
1289  else
1290  return -1;
1291 }
1292 
The base class for the histogram analysis module.
int registerEpicsPV(std::string pvname, std::string keyname="", bool update_pvs=true)
EPICS related Functions.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
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
TH2F * m_hOccupancyUGroupId0
occupancy U histo for cluster time group Id = 0
void initialize() override final
Initializer.
TPaveText * m_legOnProblem
onlineOccupancy plot legend, problem
TPaveText * m_legError
OfflineOccupancy plot legend, error.
TH2F * m_hOccupancyV3Samples
occupancy V histo for 3 samples
TPaveText * m_legEmpty
OfflineOccupancy plot legend, empty.
double m_statThreshold
minimal number of events to compare histograms
TH2F * m_hOnlineOccupancyV3Samples
online Occupancy V histo for 3 sample
TH2F * m_hOccupancyU3Samples
occupancy U histo for 3 samples
Int_t findBinY(Int_t layer, Int_t sensor)
find Y bin corresponding to sensor, occupancy plot
TCanvas * m_cOccupancyU
occupancy U histo canvas
TH1 * rtype
histogram from DQMInfo with runtype
double m_timeThreshold
difference between mean of cluster time for present and reference run
Int_t m_occUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
TCanvas ** m_cStripOccupancyV
u-side strip chart occupancy canvas
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
double m_onlineOccError
error level of the onlineOccupancy
float m_refMeanC
mean of the signal time peak from Cosmic reference run
TH2F * m_hOccupancyVGroupId0
occupancy V histo for cluster time group Id = 0
TCanvas * m_cOccupancyVGroupId0
occupancy V histo canvas for cluster time group Id = 0
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
std::string m_pvPrefix
string prefix for EPICS PVs
TH2F * m_hOnlineOccupancyV
online Occupancy V histo
TString runtype
string with runtype: physics or cosmic
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
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
TH2F * m_hOnlineOccupancyU
online occupancy U histo
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
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.
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
TH2F * m_hOnlineOccupancyU3Samples
online occupancy U histo for 3 sample
double m_onlineOccWarning
warning level of the onlineOccupancy
TPaveText * m_legProblem
OfflineOccupancy plot legend, problem.
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
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 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.