Belle II Software  release-08-00-10
DQMHistAnalysisSVDOnMiraBelle.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 #include <dqm/analysis/modules/DQMHistAnalysisSVDOnMiraBelle.h>
10 
11 using namespace std;
12 using namespace Belle2;
13 
14 //-----------------------------------------------------------------
15 // Register the Module
16 //-----------------------------------------------------------------
17 REG_MODULE(DQMHistAnalysisSVDOnMiraBelle);
18 
19 //-----------------------------------------------------------------
20 // Implementation
21 //-----------------------------------------------------------------
22 
23 DQMHistAnalysisSVDOnMiraBelleModule::DQMHistAnalysisSVDOnMiraBelleModule()
25 {
26  setDescription("DQM Analysis Module that extracts monitoring variables from SVD DQM histograms and provides input to MiraBelle.");
28  B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: Constructor done.");
29 }
30 
32 
34 {
35  gROOT->cd();
36 
37  // add MonitoringObject
39 
40  // list of canvases to be added to MonitoringObject
41  m_c_avgEfficiency = new TCanvas("svd_avgEfficiency", "matched clusters and found tracks", 0, 0, 800, 600);
42  m_c_avgOffOccupancy = new TCanvas("svd_avgOffOccupancy", "strips", 0, 0, 800, 600);
43  m_c_MPVChargeClusterOnTrack = new TCanvas("svd_MPVChargeClusterOnTrack", "charge from Clusters on Track Charge", 0, 0, 400, 400);
44  m_c_MPVSNRClusterOnTrack = new TCanvas("svd_MPVSNRClusterOnTrack", "SNR from Clusters on Track Charge", 0, 0, 400, 400);
45  m_c_MPVTimeClusterOnTrack = new TCanvas("svd_MPVTimeClusterOnTrack", "time from Clusters on Track Charge", 0, 0, 400, 400);
46  m_c_avgMaxBinClusterOnTrack = new TCanvas("svd_avgMaxBin", "average MaxBin", 0, 0, 800, 600);
47  m_c_MeanSVDEventT0 = new TCanvas("svd_MeanSVDEventT0", "Mean Event T0 from SVD for all samples", 0, 0, 400, 400);
48 
49  // add canvases used to create monitoring variables to MonitoringObject
57 
58  B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: initialized.");
59 }
60 
62 {
63  B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: beginRun called.");
64 }
65 
67 {
68  B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: event called.");
69 }
70 
72 {
73  // offline occupancy - integrated number of ZS5 fired strips
74  TH1F* h_zs5countsU = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsU"); // made by SVDDQMExperssRecoModule
75  TH1F* h_zs5countsV = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsV");
76  TH1F* h_events = (TH1F*)findHist("SVDExpReco/SVDDQM_nEvents");
77 
78  // adding histograms to canvas
79  m_c_avgOffOccupancy->Clear();
80  m_c_avgOffOccupancy->Divide(2, 2);
81  m_c_avgOffOccupancy->cd(1);
82  if (h_zs5countsU) h_zs5countsU->Draw("colz");
83  m_c_avgOffOccupancy->cd(2);
84  if (h_zs5countsV) h_zs5countsV->Draw("colz");
85  m_c_avgOffOccupancy->cd(3);
86  if (h_events) h_events->Draw("colz");
87 
88  int nE = 0;
89  if (h_events) nE = h_events->GetEntries(); // number of events for all "clusters on track" histograms
90 
91  // setting monitoring variables
92  if (h_zs5countsU == NULL || h_zs5countsV == NULL || h_events == NULL) {
93  if (h_zs5countsU == NULL) {
94  B2INFO("Histograms needed for Average Offline Occupancy on U side are not found");
95  m_monObj->setVariable("avgOffOccL3U", -1);
96  m_monObj->setVariable("avgOffOccL4U", -1);
97  m_monObj->setVariable("avgOffOccL5U", -1);
98  m_monObj->setVariable("avgOffOccL6U", -1);
99  m_monObj->setVariable("avgOffOccL3X1U", -1);
100  m_monObj->setVariable("avgOffOccL3X2U", -1);
101  m_monObj->setVariable("avgOffOccL4X1U", -1);
102  m_monObj->setVariable("avgOffOccL4X2U", -1);
103  m_monObj->setVariable("avgOffOccL4X3U", -1);
104  m_monObj->setVariable("avgOffOccL5X1U", -1);
105  m_monObj->setVariable("avgOffOccL5X2U", -1);
106  m_monObj->setVariable("avgOffOccL5X3U", -1);
107  m_monObj->setVariable("avgOffOccL5X4U", -1);
108  m_monObj->setVariable("avgOffOccL6X1U", -1);
109  m_monObj->setVariable("avgOffOccL6X2U", -1);
110  m_monObj->setVariable("avgOffOccL6X3U", -1);
111  m_monObj->setVariable("avgOffOccL6X4U", -1);
112  m_monObj->setVariable("avgOffOccL6X5U", -1);
113  m_monObj->setVariable("avgOffOccL311U", -1);
114  m_monObj->setVariable("avgOffOccL312U", -1);
115  m_monObj->setVariable("avgOffOccL321U", -1);
116  m_monObj->setVariable("avgOffOccL322U", -1);
117  m_monObj->setVariable("avgOffOccL461U", -1);
118  m_monObj->setVariable("avgOffOccL462U", -1);
119  m_monObj->setVariable("avgOffOccL581U", -1);
120  m_monObj->setVariable("avgOffOccL582U", -1);
121  m_monObj->setVariable("avgOffOccL6101U", -1);
122  m_monObj->setVariable("avgOffOccL6102U", -1);
123  }
124  if (h_zs5countsV == NULL) {
125  B2INFO("Histograms needed for Average Offline Occupancy on V side are not found");
126  m_monObj->setVariable("avgOffOccL3V", -1);
127  m_monObj->setVariable("avgOffOccL4V", -1);
128  m_monObj->setVariable("avgOffOccL5V", -1);
129  m_monObj->setVariable("avgOffOccL6V", -1);
130  m_monObj->setVariable("avgOffOccL3X1V", -1);
131  m_monObj->setVariable("avgOffOccL3X2V", -1);
132  m_monObj->setVariable("avgOffOccL4X1V", -1);
133  m_monObj->setVariable("avgOffOccL4X2V", -1);
134  m_monObj->setVariable("avgOffOccL4X3V", -1);
135  m_monObj->setVariable("avgOffOccL5X1V", -1);
136  m_monObj->setVariable("avgOffOccL5X2V", -1);
137  m_monObj->setVariable("avgOffOccL5X3V", -1);
138  m_monObj->setVariable("avgOffOccL5X4V", -1);
139  m_monObj->setVariable("avgOffOccL6X1V", -1);
140  m_monObj->setVariable("avgOffOccL6X2V", -1);
141  m_monObj->setVariable("avgOffOccL6X3V", -1);
142  m_monObj->setVariable("avgOffOccL6X4V", -1);
143  m_monObj->setVariable("avgOffOccL6X5V", -1);
144  m_monObj->setVariable("avgOffOccL311V", -1);
145  m_monObj->setVariable("avgOffOccL312V", -1);
146  m_monObj->setVariable("avgOffOccL321V", -1);
147  m_monObj->setVariable("avgOffOccL322V", -1);
148  m_monObj->setVariable("avgOffOccL461V", -1);
149  m_monObj->setVariable("avgOffOccL462V", -1);
150  m_monObj->setVariable("avgOffOccL581V", -1);
151  m_monObj->setVariable("avgOffOccL582V", -1);
152  m_monObj->setVariable("avgOffOccL6101V", -1);
153  m_monObj->setVariable("avgOffOccL6102V", -1);
154  }
155  } else {
156  // average occupancy for each layer
157  std::vector<float> avgOffOccL3UV = avgOccupancyUV(3, h_zs5countsU, h_zs5countsV, 0, 14, 1, 1, nE);
158 
159  std::vector<float> avgOffOccL4UV = avgOccupancyUV(4, h_zs5countsU, h_zs5countsV, 0, 30, 15, 1, nE);
160 
161  std::vector<float> avgOffOccL5UV = avgOccupancyUV(5, h_zs5countsU, h_zs5countsV, 0, 48, 45, 1, nE);
162 
163  std::vector<float> avgOffOccL6UV = avgOccupancyUV(6, h_zs5countsU, h_zs5countsV, 0, 80, 93, 1, nE);
164 
165  // occupancy averaged over ladders
166  std::vector<float> avgOffOccL3X1UV = avgOccupancyUV(3, h_zs5countsU, h_zs5countsV, 0, 7, 0, 2, nE); // L3.X.1
167 
168  std::vector<float> avgOffOccL3X2UV = avgOccupancyUV(3, h_zs5countsU, h_zs5countsV, 0, 7, 1, 2, nE); // L3.X.2
169 
170  std::vector<float> avgOffOccL4X1UV = avgOccupancyUV(4, h_zs5countsU, h_zs5countsV, 0, 10, 15, 3, nE); // L4.X.1
171 
172  std::vector<float> avgOffOccL4X2UV = avgOccupancyUV(4, h_zs5countsU, h_zs5countsV, 0, 10, 16, 3, nE); // L4.X.2
173 
174  std::vector<float> avgOffOccL4X3UV = avgOccupancyUV(4, h_zs5countsU, h_zs5countsV, 0, 10, 17, 3, nE); // L4.X.3
175 
176  std::vector<float> avgOffOccL5X1UV = avgOccupancyUV(5, h_zs5countsU, h_zs5countsV, 0, 12, 35, 4, nE); // L5.X.1
177 
178  std::vector<float> avgOffOccL5X2UV = avgOccupancyUV(5, h_zs5countsU, h_zs5countsV, 0, 12, 36, 4, nE); // L5.X.2
179 
180  std::vector<float> avgOffOccL5X3UV = avgOccupancyUV(5, h_zs5countsU, h_zs5countsV, 0, 12, 37, 4, nE); // L5.X.3
181 
182  std::vector<float> avgOffOccL5X4UV = avgOccupancyUV(5, h_zs5countsU, h_zs5countsV, 0, 12, 38, 4, nE); // L5.X.4
183 
184  std::vector<float> avgOffOccL6X1UV = avgOccupancyUV(6, h_zs5countsU, h_zs5countsV, 0, 16, 93, 5, nE); // L6.X.1
185 
186  std::vector<float> avgOffOccL6X2UV = avgOccupancyUV(6, h_zs5countsU, h_zs5countsV, 0, 16, 94, 5, nE); // L6.X.2
187 
188  std::vector<float> avgOffOccL6X3UV = avgOccupancyUV(6, h_zs5countsU, h_zs5countsV, 0, 16, 95, 5, nE); // L6.X.3
189 
190  std::vector<float> avgOffOccL6X4UV = avgOccupancyUV(6, h_zs5countsU, h_zs5countsV, 0, 16, 96, 5, nE); // L6.X.4
191 
192  std::vector<float> avgOffOccL6X5UV = avgOccupancyUV(6, h_zs5countsU, h_zs5countsV, 0, 16, 97, 5, nE); // L6.X.5
193 
194  // average occupancy for high occupancy sensors
195  std::vector<float> avgOffOccL311UV = highOccupancySensor(3, h_zs5countsU, h_zs5countsV, 1, nE); // L3.1.1
196 
197  std::vector<float> avgOffOccL312UV = highOccupancySensor(3, h_zs5countsU, h_zs5countsV, 2, nE); // L3.1.2
198 
199  std::vector<float> avgOffOccL321UV = highOccupancySensor(3, h_zs5countsU, h_zs5countsV, 3, nE); // L3.2.1
200 
201  std::vector<float> avgOffOccL322UV = highOccupancySensor(3, h_zs5countsU, h_zs5countsV, 4, nE); // L3.2.2
202 
203  std::vector<float> avgOffOccL461UV = highOccupancySensor(4, h_zs5countsU, h_zs5countsV, 30, nE); // L4.6.1
204 
205  std::vector<float> avgOffOccL462UV = highOccupancySensor(4, h_zs5countsU, h_zs5countsV, 31, nE); // L4.6.2
206 
207  std::vector<float> avgOffOccL581UV = highOccupancySensor(5, h_zs5countsU, h_zs5countsV, 73, nE); // L5.8.1
208 
209  std::vector<float> avgOffOccL582UV = highOccupancySensor(5, h_zs5countsU, h_zs5countsV, 74, nE); // L5.8.2
210 
211  std::vector<float> avgOffOccL6101UV = highOccupancySensor(6, h_zs5countsU, h_zs5countsV, 138, nE); // L6.10.1
212 
213  std::vector<float> avgOffOccL6102UV = highOccupancySensor(6, h_zs5countsU, h_zs5countsV, 139, nE); // L6.10.2
214 
215  m_monObj->setVariable("avgOffOccL3U", avgOffOccL3UV[0]);
216  m_monObj->setVariable("avgOffOccL4U", avgOffOccL4UV[0]);
217  m_monObj->setVariable("avgOffOccL5U", avgOffOccL5UV[0]);
218  m_monObj->setVariable("avgOffOccL6U", avgOffOccL6UV[0]);
219  m_monObj->setVariable("avgOffOccL3X1U", avgOffOccL3X1UV[0]);
220  m_monObj->setVariable("avgOffOccL3X2U", avgOffOccL3X2UV[0]);
221  m_monObj->setVariable("avgOffOccL4X1U", avgOffOccL4X1UV[0]);
222  m_monObj->setVariable("avgOffOccL4X2U", avgOffOccL4X2UV[0]);
223  m_monObj->setVariable("avgOffOccL4X3U", avgOffOccL4X3UV[0]);
224  m_monObj->setVariable("avgOffOccL5X1U", avgOffOccL5X1UV[0]);
225  m_monObj->setVariable("avgOffOccL5X2U", avgOffOccL5X2UV[0]);
226  m_monObj->setVariable("avgOffOccL5X3U", avgOffOccL5X3UV[0]);
227  m_monObj->setVariable("avgOffOccL5X4U", avgOffOccL5X4UV[0]);
228  m_monObj->setVariable("avgOffOccL6X1U", avgOffOccL6X1UV[0]);
229  m_monObj->setVariable("avgOffOccL6X2U", avgOffOccL6X2UV[0]);
230  m_monObj->setVariable("avgOffOccL6X3U", avgOffOccL6X3UV[0]);
231  m_monObj->setVariable("avgOffOccL6X4U", avgOffOccL6X4UV[0]);
232  m_monObj->setVariable("avgOffOccL6X5U", avgOffOccL6X5UV[0]);
233  m_monObj->setVariable("avgOffOccL311U", avgOffOccL311UV[0]);
234  m_monObj->setVariable("avgOffOccL312U", avgOffOccL312UV[0]);
235  m_monObj->setVariable("avgOffOccL321U", avgOffOccL321UV[0]);
236  m_monObj->setVariable("avgOffOccL322U", avgOffOccL322UV[0]);
237  m_monObj->setVariable("avgOffOccL461U", avgOffOccL461UV[0]);
238  m_monObj->setVariable("avgOffOccL462U", avgOffOccL462UV[0]);
239  m_monObj->setVariable("avgOffOccL581U", avgOffOccL581UV[0]);
240  m_monObj->setVariable("avgOffOccL582U", avgOffOccL582UV[0]);
241  m_monObj->setVariable("avgOffOccL6101U", avgOffOccL6101UV[0]);
242  m_monObj->setVariable("avgOffOccL6102U", avgOffOccL6102UV[0]);
243 
244  m_monObj->setVariable("avgOffOccL3V", avgOffOccL3UV[1]);
245  m_monObj->setVariable("avgOffOccL4V", avgOffOccL4UV[1]);
246  m_monObj->setVariable("avgOffOccL5V", avgOffOccL5UV[1]);
247  m_monObj->setVariable("avgOffOccL6V", avgOffOccL6UV[1]);
248  m_monObj->setVariable("avgOffOccL3X1V", avgOffOccL3X1UV[1]);
249  m_monObj->setVariable("avgOffOccL3X2V", avgOffOccL3X2UV[1]);
250  m_monObj->setVariable("avgOffOccL4X1V", avgOffOccL4X1UV[1]);
251  m_monObj->setVariable("avgOffOccL4X2V", avgOffOccL4X2UV[1]);
252  m_monObj->setVariable("avgOffOccL4X3V", avgOffOccL4X3UV[1]);
253  m_monObj->setVariable("avgOffOccL5X1V", avgOffOccL5X1UV[1]);
254  m_monObj->setVariable("avgOffOccL5X2V", avgOffOccL5X2UV[1]);
255  m_monObj->setVariable("avgOffOccL5X3V", avgOffOccL5X3UV[1]);
256  m_monObj->setVariable("avgOffOccL5X4V", avgOffOccL5X4UV[1]);
257  m_monObj->setVariable("avgOffOccL6X1V", avgOffOccL6X1UV[1]);
258  m_monObj->setVariable("avgOffOccL6X2V", avgOffOccL6X2UV[1]);
259  m_monObj->setVariable("avgOffOccL6X3V", avgOffOccL6X3UV[1]);
260  m_monObj->setVariable("avgOffOccL6X4V", avgOffOccL6X4UV[1]);
261  m_monObj->setVariable("avgOffOccL6X5V", avgOffOccL6X5UV[1]);
262  m_monObj->setVariable("avgOffOccL311V", avgOffOccL311UV[1]);
263  m_monObj->setVariable("avgOffOccL312V", avgOffOccL312UV[1]);
264  m_monObj->setVariable("avgOffOccL321V", avgOffOccL321UV[1]);
265  m_monObj->setVariable("avgOffOccL322V", avgOffOccL322UV[1]);
266  m_monObj->setVariable("avgOffOccL461V", avgOffOccL461UV[1]);
267  m_monObj->setVariable("avgOffOccL462V", avgOffOccL462UV[1]);
268  m_monObj->setVariable("avgOffOccL581V", avgOffOccL581UV[1]);
269  m_monObj->setVariable("avgOffOccL582V", avgOffOccL582UV[1]);
270  m_monObj->setVariable("avgOffOccL6101V", avgOffOccL6101UV[1]);
271  m_monObj->setVariable("avgOffOccL6102V", avgOffOccL6102UV[1]);
272  }
273 
274 
275  // efficiency of cluster recontruction for U and V side
276  TH2F* h_found_tracksU = (TH2F*)findHist("SVDEfficiency/TrackHitsU");
277  TH2F* h_matched_clusU = (TH2F*)findHist("SVDEfficiency/MatchedHitsU");
278  TH2F* h_found_tracksV = (TH2F*)findHist("SVDEfficiency/TrackHitsV");
279  TH2F* h_matched_clusV = (TH2F*)findHist("SVDEfficiency/MatchedHitsV");
280 
281  m_c_avgEfficiency->Clear();
282  m_c_avgEfficiency->Divide(2, 2);
283  m_c_avgEfficiency->cd(1);
284  if (h_found_tracksU) h_found_tracksU->Draw("colz");
285  m_c_avgEfficiency->cd(2);
286  if (h_found_tracksV) h_found_tracksV->Draw("colz");
287  m_c_avgEfficiency->cd(3);
288  if (h_matched_clusU) h_matched_clusU->Draw("colz");
289  m_c_avgEfficiency->cd(4);
290  if (h_matched_clusV) h_matched_clusV->Draw("colz");
291 
292  // setting monitoring variables
293  if (h_matched_clusU == NULL || h_matched_clusV == NULL || h_found_tracksU == NULL) {
294  if (h_matched_clusU == NULL) {
295  B2INFO("Histograms needed for Average Efficiency on U side are not found");
296  m_monObj->setVariable("avgEffL3U", -1);
297  m_monObj->setVariable("avgEffL4U", -1);
298  m_monObj->setVariable("avgEffL5U", -1);
299  m_monObj->setVariable("avgEffL6U", -1);
300  m_monObj->setVariable("avgEffL3456U", -1);
301  m_monObj->setVariable("avgEffL3X1U", -1);
302  m_monObj->setVariable("avgEffL3X2U", -1);
303  m_monObj->setVariable("avgEffL4X1U", -1);
304  m_monObj->setVariable("avgEffL4X2U", -1);
305  m_monObj->setVariable("avgEffL4X3U", -1);
306  m_monObj->setVariable("avgEffL5X1U", -1);
307  m_monObj->setVariable("avgEffL5X2U", -1);
308  m_monObj->setVariable("avgEffL5X3U", -1);
309  m_monObj->setVariable("avgEffL5X4U", -1);
310  m_monObj->setVariable("avgEffL6X1U", -1);
311  m_monObj->setVariable("avgEffL6X2U", -1);
312  m_monObj->setVariable("avgEffL6X3U", -1);
313  m_monObj->setVariable("avgEffL6X4U", -1);
314  m_monObj->setVariable("avgEffL6X5U", -1);
315  m_monObj->setVariable("avgEffL311U", -1);
316  m_monObj->setVariable("avgEffL312U", -1);
317  m_monObj->setVariable("avgEffL321U", -1);
318  m_monObj->setVariable("avgEffL322U", -1);
319  m_monObj->setVariable("avgEffL461U", -1);
320  m_monObj->setVariable("avgEffL462U", -1);
321  m_monObj->setVariable("avgEffL581U", -1);
322  m_monObj->setVariable("avgEffL582U", -1);
323  m_monObj->setVariable("avgEffL6101U", -1);
324  m_monObj->setVariable("avgEffL6102U", -1);
325  }
326  if (h_matched_clusV == NULL) {
327  B2INFO("Histograms needed for Average Efficiency on V side are not found");
328  m_monObj->setVariable("avgEffL3V", -1);
329  m_monObj->setVariable("avgEffL4V", -1);
330  m_monObj->setVariable("avgEffL5V", -1);
331  m_monObj->setVariable("avgEffL6V", -1);
332  m_monObj->setVariable("avgEffL3456V", -1);
333  m_monObj->setVariable("avgEffL3X1V", -1);
334  m_monObj->setVariable("avgEffL3X2V", -1);
335  m_monObj->setVariable("avgEffL4X1V", -1);
336  m_monObj->setVariable("avgEffL4X2V", -1);
337  m_monObj->setVariable("avgEffL4X3V", -1);
338  m_monObj->setVariable("avgEffL5X1V", -1);
339  m_monObj->setVariable("avgEffL5X2V", -1);
340  m_monObj->setVariable("avgEffL5X3V", -1);
341  m_monObj->setVariable("avgEffL5X4V", -1);
342  m_monObj->setVariable("avgEffL6X1V", -1);
343  m_monObj->setVariable("avgEffL6X2V", -1);
344  m_monObj->setVariable("avgEffL6X3V", -1);
345  m_monObj->setVariable("avgEffL6X4V", -1);
346  m_monObj->setVariable("avgEffL6X5V", -1);
347  m_monObj->setVariable("avgEffL311V", -1);
348  m_monObj->setVariable("avgEffL312V", -1);
349  m_monObj->setVariable("avgEffL321V", -1);
350  m_monObj->setVariable("avgEffL322V", -1);
351  m_monObj->setVariable("avgEffL461V", -1);
352  m_monObj->setVariable("avgEffL462V", -1);
353  m_monObj->setVariable("avgEffL581V", -1);
354  m_monObj->setVariable("avgEffL582V", -1);
355  m_monObj->setVariable("avgEffL6101V", -1);
356  m_monObj->setVariable("avgEffL6102V", -1);
357  }
358  } else {
359  // average efficiency in each layer for both side (U, V)
360  std::vector<float> avgEffL3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 7, 2, 3);
361 
362  std::vector<float> avgEffL4 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 10, 5, 7);
363 
364  std::vector<float> avgEffL5 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 12, 9, 12);
365 
366  std::vector<float> avgEffL6 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 16, 14, 18);
367 
368  // average efficiency for all layers
369  std::vector<float> avgEffL3456 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 16, 2, 18);
370 
371  // average efficiency for mid plane: L3.X.1
372  std::vector<float> avgEffL3X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 7, 2, 2);
373 
374  // average efficiency for mid plane: L3.X.2
375  std::vector<float> avgEffL3X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 7, 3, 3);
376 
377  // average efficiency for mid plane: L4.X.1
378  std::vector<float> avgEffL4X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 10, 5, 5);
379 
380  // average efficiency for mid plane: L4.X.2
381  std::vector<float> avgEffL4X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 10, 6, 6);
382 
383  // average efficiency for mid plane: L4.X.3
384  std::vector<float> avgEffL4X3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 10, 7, 7);
385 
386  // average efficiency for mid plane: L5.X.1
387  std::vector<float> avgEffL5X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 12, 9, 9);
388 
389  // average efficiency for mid plane: L5.X.2
390  std::vector<float> avgEffL5X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 12, 10, 10);
391 
392  // average efficiency for mid plane: L5.X.3
393  std::vector<float> avgEffL5X3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 12, 11, 11);
394 
395  // average efficiency for mid plane: L5.X.4
396  std::vector<float> avgEffL5X4 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 12, 12, 12);
397 
398  // average efficiency for mid plane: L6.X.1
399  std::vector<float> avgEffL6X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 16, 14, 14);
400 
401  // average efficiency for mid plane: L6.X.2
402  std::vector<float> avgEffL6X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 16, 15, 15);
403 
404  // average efficiency for mid plane: L6.X.3
405  std::vector<float> avgEffL6X3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 16, 16, 16);
406 
407  // average efficiency for mid plane: L6.X.4
408  std::vector<float> avgEffL6X4 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 16, 17, 17);
409 
410  // average efficiency for mid plane: L6.X.5
411  std::vector<float> avgEffL6X5 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 16, 18, 18);
412 
413  // average efficiency for high occupancy sensors
414 
415  std::vector<float> avgEffL311UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 1, 2,
416  2); // L3.1.1
417 
418  std::vector<float> avgEffL312UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 1, 1, 3,
419  3); // L3.1.2
420 
421  std::vector<float> avgEffL321UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 2, 2, 2,
422  2); // L3.2.1
423 
424  std::vector<float> avgEffL322UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 2, 2, 3,
425  3); // L3.2.2
426 
427  std::vector<float> avgEffL461UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 6, 5,
428  5); // L4.6.1
429 
430  std::vector<float> avgEffL462UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 6, 6,
431  6); // L4.6.2
432 
433  std::vector<float> avgEffL581UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 8, 8, 9,
434  9); // L5.8.1
435 
436  std::vector<float> avgEffL582UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 8, 8, 10,
437  10); // L5.8.2
438 
439  std::vector<float> avgEffL6101UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 10, 10, 14,
440  14); // L6.10.1
441 
442  std::vector<float> avgEffL6102UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 10, 10, 15,
443  15); // L6.10.2
444 
445  m_monObj->setVariable("avgEffL3U", avgEffL3[0]);
446  m_monObj->setVariable("avgEffL4U", avgEffL4[0]);
447  m_monObj->setVariable("avgEffL5U", avgEffL5[0]);
448  m_monObj->setVariable("avgEffL6U", avgEffL6[0]);
449  m_monObj->setVariable("avgEffL3456U", avgEffL3456[0]);
450  m_monObj->setVariable("avgEffL3X1U", avgEffL3X1[0]);
451  m_monObj->setVariable("avgEffL3X2U", avgEffL3X2[0]);
452  m_monObj->setVariable("avgEffL4X1U", avgEffL4X1[0]);
453  m_monObj->setVariable("avgEffL4X2U", avgEffL4X2[0]);
454  m_monObj->setVariable("avgEffL4X3U", avgEffL4X3[0]);
455  m_monObj->setVariable("avgEffL5X1U", avgEffL5X1[0]);
456  m_monObj->setVariable("avgEffL5X2U", avgEffL5X2[0]);
457  m_monObj->setVariable("avgEffL5X3U", avgEffL5X3[0]);
458  m_monObj->setVariable("avgEffL5X4U", avgEffL5X4[0]);
459  m_monObj->setVariable("avgEffL6X1U", avgEffL6X1[0]);
460  m_monObj->setVariable("avgEffL6X2U", avgEffL6X2[0]);
461  m_monObj->setVariable("avgEffL6X3U", avgEffL6X3[0]);
462  m_monObj->setVariable("avgEffL6X4U", avgEffL6X4[0]);
463  m_monObj->setVariable("avgEffL6X5U", avgEffL6X5[0]);
464  m_monObj->setVariable("avgEffL311U", avgEffL311UV[0]);
465  m_monObj->setVariable("avgEffL312U", avgEffL312UV[0]);
466  m_monObj->setVariable("avgEffL321U", avgEffL321UV[0]);
467  m_monObj->setVariable("avgEffL322U", avgEffL322UV[0]);
468  m_monObj->setVariable("avgEffL461U", avgEffL461UV[0]);
469  m_monObj->setVariable("avgEffL462U", avgEffL462UV[0]);
470  m_monObj->setVariable("avgEffL581U", avgEffL581UV[0]);
471  m_monObj->setVariable("avgEffL582U", avgEffL582UV[0]);
472  m_monObj->setVariable("avgEffL6101U", avgEffL6101UV[0]);
473  m_monObj->setVariable("avgEffL6102U", avgEffL6102UV[0]);
474 
475  m_monObj->setVariable("avgEffL3V", avgEffL3[1]);
476  m_monObj->setVariable("avgEffL4V", avgEffL4[1]);
477  m_monObj->setVariable("avgEffL5V", avgEffL5[1]);
478  m_monObj->setVariable("avgEffL6V", avgEffL6[1]);
479  m_monObj->setVariable("avgEffL3456V", avgEffL3456[1]);
480  m_monObj->setVariable("avgEffL3X1V", avgEffL3X1[1]);
481  m_monObj->setVariable("avgEffL3X2V", avgEffL3X2[1]);
482  m_monObj->setVariable("avgEffL4X1V", avgEffL4X1[1]);
483  m_monObj->setVariable("avgEffL4X2V", avgEffL4X2[1]);
484  m_monObj->setVariable("avgEffL4X3V", avgEffL4X3[1]);
485  m_monObj->setVariable("avgEffL5X1V", avgEffL5X1[1]);
486  m_monObj->setVariable("avgEffL5X2V", avgEffL5X2[1]);
487  m_monObj->setVariable("avgEffL5X3V", avgEffL5X3[1]);
488  m_monObj->setVariable("avgEffL5X4V", avgEffL5X4[1]);
489  m_monObj->setVariable("avgEffL6X1V", avgEffL6X1[1]);
490  m_monObj->setVariable("avgEffL6X2V", avgEffL6X2[1]);
491  m_monObj->setVariable("avgEffL6X3V", avgEffL6X3[1]);
492  m_monObj->setVariable("avgEffL6X4V", avgEffL6X4[1]);
493  m_monObj->setVariable("avgEffL6X5V", avgEffL6X5[1]);
494  m_monObj->setVariable("avgEffL311V", avgEffL311UV[1]);
495  m_monObj->setVariable("avgEffL312V", avgEffL312UV[1]);
496  m_monObj->setVariable("avgEffL321V", avgEffL321UV[1]);
497  m_monObj->setVariable("avgEffL322V", avgEffL322UV[1]);
498  m_monObj->setVariable("avgEffL461V", avgEffL461UV[1]);
499  m_monObj->setVariable("avgEffL462V", avgEffL462UV[1]);
500  m_monObj->setVariable("avgEffL581V", avgEffL581UV[1]);
501  m_monObj->setVariable("avgEffL582V", avgEffL582UV[1]);
502  m_monObj->setVariable("avgEffL6101V", avgEffL6101UV[1]);
503  m_monObj->setVariable("avgEffL6102V", avgEffL6102UV[1]);
504  }
505 
506  // MPV cluster charge for clusters on track
507  TH1F* h_clusterCharge_L3U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeU3");
508  TH1F* h_clusterCharge_L3V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeV3");
509  TH1F* h_clusterCharge_L456U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeU456");
510  TH1F* h_clusterCharge_L456V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeV456");
511 
513  m_c_MPVChargeClusterOnTrack->Divide(2, 2);
515  if (h_clusterCharge_L3U) h_clusterCharge_L3U->Draw();
517  if (h_clusterCharge_L3V) h_clusterCharge_L3V->Draw();
519  if (h_clusterCharge_L456U) h_clusterCharge_L456U->Draw();
521  if (h_clusterCharge_L456U) h_clusterCharge_L456U->Draw();
522 
523  // find abscissa of max Y in histograms
524  float MPVClusterChargeL3U = -1;
525  if (h_clusterCharge_L3U) MPVClusterChargeL3U = xForMaxY(h_clusterCharge_L3U);
526  float MPVClusterChargeL3V = -1;
527  if (h_clusterCharge_L3V) MPVClusterChargeL3V = xForMaxY(h_clusterCharge_L3V);
528  float MPVClusterChargeL456U = -1;
529  if (h_clusterCharge_L456U) MPVClusterChargeL456U = xForMaxY(h_clusterCharge_L456U);
530  float MPVClusterChargeL456V = -1;
531  if (h_clusterCharge_L456V) MPVClusterChargeL456V = xForMaxY(h_clusterCharge_L456V);
532 
533  if (h_clusterCharge_L3U == NULL || h_clusterCharge_L456U == NULL) {
534  B2INFO("Histograms needed for MPV cluster charge on U side are not found");
535  m_monObj->setVariable("MPVClusterChargeL3U", -1);
536  m_monObj->setVariable("MPVClusterChargeL456U", -1);
537  } else {
538  m_monObj->setVariable("MPVClusterChargeL3U", MPVClusterChargeL3U);
539  m_monObj->setVariable("MPVClusterChargeL456U", MPVClusterChargeL456U);
540  }
541 
542  if (h_clusterCharge_L3V == NULL || h_clusterCharge_L456V == NULL) {
543  B2INFO("Histograms needed for MPV cluster charge on V side are not found");
544  m_monObj->setVariable("MPVClusterChargeL3V", -1);
545  m_monObj->setVariable("MPVClusterChargeL456V", -1);
546  } else {
547  m_monObj->setVariable("MPVClusterChargeL3V", MPVClusterChargeL3V);
548  m_monObj->setVariable("MPVClusterChargeL456V", MPVClusterChargeL456V);
549  }
550 
551 
552  // MPV SNR for the clusters on track
553  TH1F* h_clusterSNR_L3U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRU3");
554  TH1F* h_clusterSNR_L3V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRV3");
555  TH1F* h_clusterSNR_L456U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRU456");
556  TH1F* h_clusterSNR_L456V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRV456");
557 
558  m_c_MPVSNRClusterOnTrack->Clear();
559  m_c_MPVSNRClusterOnTrack->Divide(2, 2);
561  if (h_clusterSNR_L3U) h_clusterSNR_L3U->Draw();
563  if (h_clusterSNR_L3V) h_clusterSNR_L3V->Draw();
565  if (h_clusterSNR_L456U) h_clusterSNR_L456U->Draw();
567  if (h_clusterSNR_L456V) h_clusterSNR_L456V->Draw();
568 
569  float MPVClusterSNRL3U = -1;
570  if (h_clusterSNR_L3U) MPVClusterSNRL3U = xForMaxY(h_clusterSNR_L3U);
571  float MPVClusterSNRL3V = -1;
572  if (h_clusterSNR_L3V) MPVClusterSNRL3V = xForMaxY(h_clusterSNR_L3V);
573  float MPVClusterSNRL456U = -1;
574  if (h_clusterSNR_L456U) MPVClusterSNRL456U = xForMaxY(h_clusterSNR_L456U);
575  float MPVClusterSNRL456V = -1;
576  if (h_clusterSNR_L456V) MPVClusterSNRL456V = xForMaxY(h_clusterSNR_L456V);
577 
578  if (h_clusterSNR_L3U == NULL || h_clusterSNR_L456U == NULL) {
579  B2INFO("Histograms needed for MPV cluster SNR on U side are not found");
580  m_monObj->setVariable("MPVClusterSNRL3U", -1);
581  m_monObj->setVariable("MPVClusterSNRL456U", -1);
582  } else {
583  m_monObj->setVariable("MPVClusterSNRL3U", MPVClusterSNRL3U);
584  m_monObj->setVariable("MPVClusterSNRL456U", MPVClusterSNRL456U);
585  }
586 
587  if (h_clusterSNR_L3V == NULL || h_clusterSNR_L456V == NULL) {
588  B2INFO("Histograms needed for MPV cluster SNR on V side are not found");
589  m_monObj->setVariable("MPVClusterSNRL3V", -1);
590  m_monObj->setVariable("MPVClusterSNRL456V", -1);
591  } else {
592  m_monObj->setVariable("MPVClusterSNRL3V", MPVClusterSNRL3V);
593  m_monObj->setVariable("MPVClusterSNRL456V", MPVClusterSNRL456V);
594  }
595 
596 
597  // MPV SVD cluster time for the clusters on track
598  TH1F* h_clusterTime_L3U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeU3");
599  TH1F* h_clusterTime_L3V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeV3");
600  TH1F* h_clusterTime_L456U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeU456");
601  TH1F* h_clusterTime_L456V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeV456");
602  TH1F* h_MeanSVD3EventT0 = (TH1F*)findHist("SVDHitTime/SVD3EventT0");
603  TH1F* h_MeanSVD6EventT0 = (TH1F*)findHist("SVDHitTime/SVD6EventT0");
604  TH1F* h_MeanSVDEventT0 = 0x0;
605 
606  if (h_MeanSVD3EventT0)
607  h_MeanSVDEventT0 = (TH1F*)h_MeanSVD3EventT0->Clone();
608 
609  m_c_MPVTimeClusterOnTrack->Clear();
610  m_c_MPVTimeClusterOnTrack->Divide(2, 2);
612  if (h_clusterTime_L3U) h_clusterTime_L3U->Draw();
614  if (h_clusterTime_L3V) h_clusterTime_L3V->Draw();
616  if (h_clusterTime_L456U) h_clusterTime_L456U->Draw();
618  if (h_clusterTime_L456V) h_clusterTime_L456V->Draw();
619 
620  m_c_MeanSVDEventT0->Clear();
621  m_c_MeanSVDEventT0->Divide(2, 2);
622  m_c_MeanSVDEventT0->cd(1);
623  if (h_MeanSVD3EventT0) h_MeanSVD3EventT0->Draw();
624  m_c_MeanSVDEventT0->cd(2);
625  if (h_MeanSVD6EventT0) h_MeanSVD6EventT0->Draw();
626  m_c_MeanSVDEventT0->cd(3);
627  if (h_MeanSVDEventT0) {
628  if (h_MeanSVD6EventT0)
629  h_MeanSVDEventT0->Add(h_MeanSVD6EventT0);
630  h_MeanSVDEventT0->Draw();
631  }
632 
633  float MPVClusterTimeL3U = -1;
634  if (h_clusterTime_L3U) MPVClusterTimeL3U = xForMaxY(h_clusterTime_L3U);
635  float MPVClusterTimeL3V = -1;
636  if (h_clusterTime_L3V) MPVClusterTimeL3V = xForMaxY(h_clusterTime_L3V);
637  float MPVClusterTimeL456U = -1;
638  if (h_clusterTime_L456U) MPVClusterTimeL456U = xForMaxY(h_clusterTime_L456U);
639  float MPVClusterTimeL456V = -1;
640  if (h_clusterTime_L456V) MPVClusterTimeL456V = xForMaxY(h_clusterTime_L456V);
641  float FWHMClusterTimeL3U = -1;
642  if (h_clusterTime_L3U) FWHMClusterTimeL3U = histFWHM(h_clusterTime_L3U);
643  float FWHMClusterTimeL3V = -1;
644  if (h_clusterTime_L3V) FWHMClusterTimeL3V = histFWHM(h_clusterTime_L3V);
645  float FWHMClusterTimeL456U = -1;
646  if (h_clusterTime_L456U) FWHMClusterTimeL456U = histFWHM(h_clusterTime_L456U);
647  float FWHMClusterTimeL456V = -1;
648  if (h_clusterTime_L456V) FWHMClusterTimeL456V = histFWHM(h_clusterTime_L456V);
649 
650  float MeanSVD3EventT0 = -1;
651  if (h_MeanSVD3EventT0) MeanSVD3EventT0 = xForMaxY(h_MeanSVD3EventT0);
652 
653  float MeanSVD6EventT0 = -1;
654  if (h_MeanSVD6EventT0) MeanSVD6EventT0 = xForMaxY(h_MeanSVD6EventT0);
655 
656  float MeanSVDEventT0 = -1;
657  if (h_MeanSVDEventT0) MeanSVDEventT0 = xForMaxY(h_MeanSVDEventT0);
658 
659  if (h_clusterTime_L3U == NULL || h_clusterTime_L456U == NULL) {
660  B2INFO("Histograms needed for MPV cluster time on U side are not found");
661  m_monObj->setVariable("MPVClusterTimeL3U", -1);
662  m_monObj->setVariable("MPVClusterTimeL456U", -1);
663  m_monObj->setVariable("FWHMClusterTimeL3U", -1);
664  m_monObj->setVariable("FWHMClusterTimeL456U", -1);
665  } else {
666  m_monObj->setVariable("MPVClusterTimeL3U", MPVClusterTimeL3U);
667  m_monObj->setVariable("MPVClusterTimeL456U", MPVClusterTimeL456U);
668  m_monObj->setVariable("FWHMClusterTimeL3U", FWHMClusterTimeL3U);
669  m_monObj->setVariable("FWHMClusterTimeL456U", FWHMClusterTimeL456U);
670  }
671 
672  if (h_clusterTime_L3V == NULL || h_clusterTime_L456V == NULL) {
673  B2INFO("Histograms needed for MPV cluster time on V side are not found");
674  m_monObj->setVariable("MPVClusterTimeL3V", -1);
675  m_monObj->setVariable("MPVClusterTimeL456V", -1);
676  m_monObj->setVariable("FWHMClusterTimeL3V", -1);
677  m_monObj->setVariable("FWHMClusterTimeL456V", -1);
678  } else {
679  m_monObj->setVariable("MPVClusterTimeL3V", MPVClusterTimeL3V);
680  m_monObj->setVariable("MPVClusterTimeL456V", MPVClusterTimeL456V);
681  m_monObj->setVariable("FWHMClusterTimeL3V", FWHMClusterTimeL3V);
682  m_monObj->setVariable("FWHMClusterTimeL456V", FWHMClusterTimeL456V);
683  }
684 
685  if (h_MeanSVD3EventT0 == NULL) {
686  B2INFO("Histograms needed for SVD Event T0 (3 samples) not found");
687  m_monObj->setVariable("MeanSVD3EventT0", -1);
688  } else {
689  m_monObj->setVariable("MeanSVD3EventT0", MeanSVD3EventT0);
690  }
691 
692  if (h_MeanSVD6EventT0 == NULL) {
693  B2INFO("Histograms needed for SVD Event T0 (6 samples) not found");
694  m_monObj->setVariable("MeanSVD6EventT0", -1);
695  } else {
696  m_monObj->setVariable("MeanSVD6EventT0", MeanSVD6EventT0);
697  }
698 
699  if (h_MeanSVDEventT0 == NULL) {
700  B2INFO("Histograms needed for SVD Event T0 (all samples) not found");
701  m_monObj->setVariable("MeanSVDEventT0", -1);
702  } else {
703  m_monObj->setVariable("MeanSVDEventT0", MeanSVDEventT0);
704  }
705 
706  // average maxBin for clusters on track
707  TH1F* h_maxBinU = (TH1F*)findHist("SVDClsTrk/SVDTRK_StripMaxBinUAll");
708  TH1F* h_maxBinV = (TH1F*)findHist("SVDClsTrk/SVDTRK_StripMaxBinVAll");
709 
711  m_c_avgMaxBinClusterOnTrack->Divide(2, 1);
713  if (h_maxBinU) h_maxBinU->Draw();
715  if (h_maxBinV) h_maxBinV->Draw();
716 
717  if (h_maxBinU == NULL) {
718  B2INFO("Histogram needed for Average MaxBin on U side is not found");
719  m_monObj->setVariable("avgMaxBinU", -1);
720  } else {
721  float avgMaxBinU = h_maxBinU->GetMean();
722  m_monObj->setVariable("avgMaxBinU", avgMaxBinU);
723  }
724 
725  if (h_maxBinV == NULL) {
726  B2INFO("Histogram needed for Average MaxBin on V side is not found");
727  m_monObj->setVariable("avgMaxBinV", -1);
728  } else {
729  float avgMaxBinV = h_maxBinV->GetMean();
730  m_monObj->setVariable("avgMaxBinV", avgMaxBinV);
731  }
732 
733  std::map<std::pair<int, int>, int> ladderMap = {
734  {{3, 1}, 0}, {{3, 2}, 1},
735  {{4, 1}, 2}, {{4, 2}, 3}, {{4, 3}, 4},
736  {{5, 1}, 5}, {{5, 2}, 6}, {{5, 3}, 7}, {{5, 4}, 8},
737  {{6, 1}, 9}, {{6, 2}, 10}, {{6, 3}, 11}, {{6, 4}, 12}, {{6, 5}, 13}
738  };
739 
740 
741  for (const auto& it : ladderMap) {
742  std::pair<int, int> p = it.first;
743  int layer = p.first;
744  int sensor = p.second;
745 
746  TString name = Form("SVDClsTrk/SVDTRK_ClusterCharge_L%d.x.%d", layer, sensor);
747  TString title = Form("MPVClusterCharge_L%d.x.%d", layer, sensor);
748  TH1F* h_clusterCharge = (TH1F*)findHist(name.Data());
749  float MPVClusterCharge = -1;
750  if (h_clusterCharge) MPVClusterCharge = xForMaxY(h_clusterCharge);
751 
752  if (h_clusterCharge == NULL) {
753  B2INFO("Histograms needed for cluster charge not found");
754  m_monObj->setVariable(title.Data(), -1);
755  } else {
756  m_monObj->setVariable(title.Data(), MPVClusterCharge);
757  }
758 
759  name = Form("SVDClsTrk/SVDTRK_ClusterSNR_L%d.x.%d", layer, sensor);
760  title = Form("MPVClusterSNR_L%d.x.%d", layer, sensor);
761  TH1F* h_clusterSNR = (TH1F*)findHist(name.Data());
762  float MPVClusterSNR = -1;
763  if (h_clusterSNR) MPVClusterSNR = xForMaxY(h_clusterSNR);
764 
765  if (h_clusterSNR == NULL) {
766  B2INFO("Histograms needed for cluster SNR not found");
767  m_monObj->setVariable(title.Data(), -1);
768  } else {
769  m_monObj->setVariable(title.Data(), MPVClusterSNR);
770  }
771  }
772 
773  for (int ladder = 1; ladder <= 2; ++ladder) {
774  for (int sensor = 1; sensor <= 2; ++sensor) {
775 
776  TString name = Form("SVDClsTrk/SVDTRK_ClusterCharge_L3.%d.%d", ladder, sensor);
777  TString title = Form("MPVClusterCharge_L3.%d.%d", ladder, sensor);
778  float MPVClusterCharge = -1;
779  TH1F* h_clusterCharge = (TH1F*)findHist(name.Data());
780  if (h_clusterCharge) MPVClusterCharge = xForMaxY(h_clusterCharge);
781 
782  if (h_clusterCharge == NULL) {
783  B2INFO("Histograms needed for cluster charge not found");
784  m_monObj->setVariable(title.Data(), -1);
785  } else {
786  m_monObj->setVariable(title.Data(), MPVClusterCharge);
787  }
788 
789  name = Form("SVDClsTrk/SVDTRK_ClusterSNR_L3.%d.%d", ladder, sensor);
790  title = Form("MPVClusterSNR_L3.%d.%d", ladder, sensor);
791  TH1F* h_clusterSNR = (TH1F*)findHist(name.Data());
792  float MPVClusterSNR = -1;
793  if (h_clusterSNR) MPVClusterSNR = xForMaxY(h_clusterSNR);
794 
795  if (h_clusterSNR == NULL) {
796  B2INFO("Histograms needed for cluster SNR not found");
797  m_monObj->setVariable(title.Data(), -1);
798  } else {
799  m_monObj->setVariable(title.Data(), MPVClusterSNR);
800  }
801  }
802  }
803 
804  B2INFO("DQMHistAnalysisSVDGeneral: endRun called");
805 }
806 
807 
809 {
810  B2INFO("DQMHistAnalysisSVDOnMiraBelle: terminate called");
811 }
812 
813 
814 std::vector<float> DQMHistAnalysisSVDOnMiraBelleModule::highOccupancySensor(int iLayer, TH1F* hU, TH1F* hV, int iBin,
815  int nEvents) const
816 {
817  int nStripsV = -1;
818  if (iLayer == 3) {
819  nStripsV = 768;
820  } else if (iLayer >= 4 && iLayer <= 6) {
821  nStripsV = 512;
822  } else {
823  B2DEBUG(20, "Layer out of range [3,6].");
824  }
825  std::vector<float> avgOffOccUV(2, 0.0);
826  avgOffOccUV[0] = 0;
827  if (hU) avgOffOccUV[0] = hU->GetBinContent(iBin) * 1.0 / 768 / nEvents * 100;
828  avgOffOccUV[1] = 0;
829  if (hV) avgOffOccUV[1] = hV->GetBinContent(iBin) * 1.0 / nStripsV / nEvents * 100;
830  return avgOffOccUV;
831 }
832 
833 
834 std::vector<float> DQMHistAnalysisSVDOnMiraBelleModule::avgOccupancyUV(int iLayer, TH1F* hU, TH1F* hV, int min, int max, int offset,
835  int step, int nEvents) const
836 {
837  int nStripsV = -1;
838  if (iLayer == 3) {
839  nStripsV = 768;
840  } else if (iLayer >= 4 && iLayer <= 6) {
841  nStripsV = 512;
842  } else {
843  B2DEBUG(20, "Layer out of range [3,6].");
844  }
845  std::vector<float> avgOffOccUV(2, 0.0);
846  for (int bin = min; bin < max; bin++) {
847  avgOffOccUV[0] += hU->GetBinContent(offset + step * bin) / 768 * 100;
848  avgOffOccUV[1] += hV->GetBinContent(offset + step * bin) / nStripsV * 100;
849  }
850  avgOffOccUV[0] /= ((max - min) * nEvents);
851  avgOffOccUV[1] /= ((max - min) * nEvents);
852  return avgOffOccUV;
853 }
854 
855 
856 std::vector<float> DQMHistAnalysisSVDOnMiraBelleModule::avgEfficiencyUV(TH2F* hMCU, TH2F* hMCV, TH2F* hFTU, TH2F* hFTV, int minX,
857  int maxX, int minY, int maxY) const
858 {
859  std::vector<float> avgEffUV(2, 0.0);
860  std::vector<float> sumMatchedClustersUV(2, 0.0);
861  std::vector<float> sumFoundTracksUV(2, 0.0);
862  for (int binX = minX; binX < maxX + 1; binX++) {
863  for (int binY = minY; binY < maxY + 1; binY++) {
864  int binXY = hMCV->GetBin(binX, binY);
865  sumMatchedClustersUV[0] += hMCU->GetBinContent(binXY);
866  sumMatchedClustersUV[1] += hMCV->GetBinContent(binXY);
867  sumFoundTracksUV[0] += hFTU->GetBinContent(binXY);
868  sumFoundTracksUV[1] += hFTV->GetBinContent(binXY);
869  }
870  }
871  if (sumFoundTracksUV[0] > 0) {
872  avgEffUV[0] = sumMatchedClustersUV[0] / sumFoundTracksUV[0] * 100;
873  } else {
874  avgEffUV[0] = -1;
875  }
876  if (sumFoundTracksUV[1] > 0) {
877  avgEffUV[1] = sumMatchedClustersUV[1] / sumFoundTracksUV[1] * 100;
878  } else {
879  avgEffUV[1] = -1;
880  }
881  return avgEffUV;
882 }
883 
885 {
886  int maxY = h->GetMaximumBin();
887  float xMaxY = h->GetXaxis()->GetBinCenter(maxY);
888  return xMaxY;
889 }
890 
892 {
893  int bin1 = h->FindFirstBinAbove(h->GetMaximum() / 2);
894  int bin2 = h->FindLastBinAbove(h->GetMaximum() / 2);
895  float fwhm = h->GetBinCenter(bin2) - h->GetBinCenter(bin1);
896  return fwhm;
897 }
The base class for the histogram analysis module.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
void initialize() override final
Module function initialize.
float histFWHM(TH1F *h) const
Calculate full width at half maximum of histogram.
TCanvas * m_c_MPVTimeClusterOnTrack
time for clusters on track
std::vector< float > avgEfficiencyUV(TH2F *hMCU, TH2F *hMCV, TH2F *hFTU, TH2F *hFTV, int minX, int maxX, int minY, int maxY) const
Calculate avg efficiency for specified sensors.
std::vector< float > avgOccupancyUV(int iLayer, TH1F *hU, TH1F *hV, int min, int max, int offset, int step, int nEvents) const
Calculate avg offline occupancy for specified sensors.
TCanvas * m_c_MPVChargeClusterOnTrack
charge for clusters on track
MonitoringObject * m_monObj
Monitoring Object to be produced by this module, which contain defined canvases and monitoring variab...
TCanvas * m_c_avgEfficiency
List of canvases to be added to MonitoringObject.
void terminate() override final
Module function terminate.
void event() override final
Module function event.
TCanvas * m_c_MPVSNRClusterOnTrack
SNR for clusters on track.
void endRun() override final
Module function endRun.
float xForMaxY(TH1F *h) const
Calculate abscissa of max Y bin.
TCanvas * m_c_avgOffOccupancy
number of ZS5 fired strips
void beginRun() override final
Module function beginRun.
TCanvas * m_c_avgMaxBinClusterOnTrack
average number of the APV sample which corresponds to the maximum amplitude for clusters on track
std::vector< float > highOccupancySensor(int iLayer, TH1F *hU, TH1F *hV, int iBin, int nEvents) const
Calculate avg offline occupancy for one specific sensor, especially with high occupancy.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
void setVariable(const std::string &var, float val, float upErr=-1., float dwErr=-1)
set value to float variable (new variable is made if not yet existing)
void addCanvas(TCanvas *canv)
Add Canvas to monitoring object.
#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.