Belle II Software development
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 <numeric>
10#include <limits>
11#include <vxd/geometry/GeoCache.h>
12#include <vxd/dataobjects/VxdID.h>
13#include <svd/geometry/SensorInfo.h>
14#include <vxd/geometry/SensorInfoBase.h>
15#include <vxd/geometry/GeoTools.h>
16
17#include <dqm/analysis/modules/DQMHistAnalysisSVDOnMiraBelle.h>
18
19using namespace std;
20using namespace Belle2;
21
22//-----------------------------------------------------------------
23// Register the Module
24//-----------------------------------------------------------------
25REG_MODULE(DQMHistAnalysisSVDOnMiraBelle);
26
27//-----------------------------------------------------------------
28// Implementation
29//-----------------------------------------------------------------
30
33{
34 setDescription("DQM Analysis Module that extracts monitoring variables from SVD DQM histograms and provides input to MiraBelle.");
36 B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: Constructor done.");
37}
38
40
42{
43 gROOT->cd();
44
46
47 // add MonitoringObject
49
50 // list of canvases to be added to MonitoringObject
51 m_c_avgEfficiency = new TCanvas("svd_avgEfficiency", "matched clusters and found tracks", 0, 0, 800, 600);
52 m_c_avgOffOccupancy = new TCanvas("svd_avgOffOccupancy", "strips", 0, 0, 800, 600);
53 m_c_MPVChargeClusterOnTrack = new TCanvas("svd_MPVChargeClusterOnTrack", "charge from Clusters on Track Charge", 0, 0, 400, 400);
54 m_c_MPVSNRClusterOnTrack = new TCanvas("svd_MPVSNRClusterOnTrack", "SNR from Clusters on Track Charge", 0, 0, 400, 400);
55 m_c_MPVTimeClusterOnTrack = new TCanvas("svd_MPVTimeClusterOnTrack", "time from Clusters on Track Charge", 0, 0, 400, 400);
56 m_c_avgMaxBinClusterOnTrack = new TCanvas("svd_avgMaxBin", "average MaxBin", 0, 0, 800, 600);
57 m_c_MeanSVDEventT0 = new TCanvas("svd_MeanSVDEventT0", "Mean Event T0 from SVD for all samples", 0, 0, 400, 400);
58
59 // add canvases used to create monitoring variables to MonitoringObject
67
69
70 //collect the list of all SVD Modules in the geometry here
71 std::vector<VxdID> sensors = geo.getListOfSensors();
72 for (VxdID& aVxdID : sensors) {
73 VXD::SensorInfoBase info = geo.getSensorInfo(aVxdID);
74 // B2INFO("VXD " << aVxdID);
75 if (info.getType() != VXD::SensorInfoBase::SVD) continue;
76 m_SVDModules.push_back(aVxdID); // reorder, sort would be better
77 }
78 std::sort(m_SVDModules.begin(), m_SVDModules.end()); // back to natural order
79
80 B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: initialized.");
81}
82
84{
85 B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: beginRun called.");
86}
87
89{
90 B2DEBUG(20, "DQMHistAnalysisSVDOnMiraBelle: event called.");
91}
92
94{
95 float nan = numeric_limits<float>::quiet_NaN();
96
97 // offline occupancy - integrated number of ZS5 fired strips
98 TH1F* h_zs5countsU = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsU"); // made by SVDDQMExperssRecoModule
99 TH1F* h_zs5countsV = (TH1F*)findHist("SVDExpReco/SVDDQM_StripCountsV");
100 TH1F* h_events = (TH1F*)findHist("SVDExpReco/SVDDQM_nEvents");
101
102 // adding histograms to canvas
103 m_c_avgOffOccupancy->Clear();
104 m_c_avgOffOccupancy->Divide(2, 2);
105 m_c_avgOffOccupancy->cd(1);
106 if (h_zs5countsU) h_zs5countsU->Draw("colz");
107 m_c_avgOffOccupancy->cd(2);
108 if (h_zs5countsV) h_zs5countsV->Draw("colz");
109 m_c_avgOffOccupancy->cd(3);
110 if (h_events) h_events->Draw("colz");
111
112 int nE = 0;
113 if (h_events) nE = h_events->GetEntries(); // number of events for all "clusters on track" histograms
114
115 // setting monitoring variables
116 if (h_zs5countsU == NULL || h_zs5countsV == NULL || h_events == NULL) {
117 if (h_zs5countsU == NULL) {
118 B2INFO("Histograms needed for Average Offline Occupancy on U side are not found");
119 }
120 if (h_zs5countsV == NULL) {
121 B2INFO("Histograms needed for Average Offline Occupancy on V side are not found");
122 }
123 } else {
124 // average occupancy for each layer
125 std::pair<float, float> avgOffOccL3UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3);
126 SetVariable(avgOffOccL3UV);
127
128 std::pair<float, float> avgOffOccL4UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4);
129 SetVariable(avgOffOccL4UV);
130
131 std::pair<float, float> avgOffOccL5UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5);
132 SetVariable(avgOffOccL5UV);
133
134 std::pair<float, float> avgOffOccL6UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6);
135 SetVariable(avgOffOccL6UV);
136
137 // average occupancy for each layer
138 std::pair<float, float> avgOffGrpId0OccL3UV = avgOccupancyGrpId0UV(3, nE);
139 SetVariable(avgOffGrpId0OccL3UV);
140
141 std::pair<float, float> avgOffGrpId0OccL4UV = avgOccupancyGrpId0UV(4, nE);
142 SetVariable(avgOffGrpId0OccL4UV);
143
144 std::pair<float, float> avgOffGrpId0OccL5UV = avgOccupancyGrpId0UV(5, nE);
145 SetVariable(avgOffGrpId0OccL5UV);
146
147 std::pair<float, float> avgOffGrpId0OccL6UV = avgOccupancyGrpId0UV(6, nE);
148 SetVariable(avgOffGrpId0OccL6UV);
149
150 // occupancy averaged over ladders
151 std::pair<float, float> avgOffOccL3X1UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, -1, 1); // L3.X.1
152 SetVariable(avgOffOccL3X1UV);
153
154 std::pair<float, float> avgOffOccL3X2UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, -1, 2); // L3.X.2
155 SetVariable(avgOffOccL3X2UV);
156
157 std::pair<float, float> avgOffOccL4X1UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, -1, 1); // L4.X.1
158 SetVariable(avgOffOccL4X1UV);
159
160 std::pair<float, float> avgOffOccL4X2UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, -1, 2); // L4.X.2
161 SetVariable(avgOffOccL4X2UV);
162
163 std::pair<float, float> avgOffOccL4X3UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, -1, 3); // L4.X.3
164 SetVariable(avgOffOccL4X3UV);
165
166 std::pair<float, float> avgOffOccL5X1UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 1); // L5.X.1
167 SetVariable(avgOffOccL5X1UV);
168
169 std::pair<float, float> avgOffOccL5X2UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 2); // L5.X.2
170 SetVariable(avgOffOccL5X2UV);
171
172 std::pair<float, float> avgOffOccL5X3UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 3); // L5.X.3
173 SetVariable(avgOffOccL5X3UV);
174
175 std::pair<float, float> avgOffOccL5X4UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 4); // L5.X.4
176 SetVariable(avgOffOccL5X4UV);
177
178 std::pair<float, float> avgOffOccL6X1UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 1); // L6.X.1
179 SetVariable(avgOffOccL6X1UV);
180
181 std::pair<float, float> avgOffOccL6X2UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 2); // L6.X.2
182 SetVariable(avgOffOccL6X2UV);
183
184 std::pair<float, float> avgOffOccL6X3UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 3); // L6.X.3
185 SetVariable(avgOffOccL6X3UV);
186
187 std::pair<float, float> avgOffOccL6X4UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 4); // L6.X.4
188 SetVariable(avgOffOccL6X4UV);
189
190 std::pair<float, float> avgOffOccL6X5UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 5); // L6.X.5
191 SetVariable(avgOffOccL6X5UV);
192
193 // average occupancy for high occupancy sensors
194 std::pair<float, float> avgOffOccL311UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 1, 1); // L3.1.1
195 SetVariable(avgOffOccL311UV);
196
197 std::pair<float, float> avgOffOccL312UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 1, 2); // L3.1.2
198 SetVariable(avgOffOccL312UV);
199
200 std::pair<float, float> avgOffOccL321UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 2, 1); // L3.2.1
201 SetVariable(avgOffOccL321UV);
202
203 std::pair<float, float> avgOffOccL322UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 2, 2); // L3.2.2
204 SetVariable(avgOffOccL322UV);
205
206 std::pair<float, float> avgOffOccL461UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 6, 1); // L4.6.1
207 SetVariable(avgOffOccL461UV);
208
209 std::pair<float, float> avgOffOccL462UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 6, 2); // L4.6.2
210 SetVariable(avgOffOccL462UV);
211
212 std::pair<float, float> avgOffOccL581UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 8, 1); // L5.8.1
213 SetVariable(avgOffOccL581UV);
214
215 std::pair<float, float> avgOffOccL582UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 8, 2); // L5.8.2
216 SetVariable(avgOffOccL582UV);
217
218 std::pair<float, float> avgOffOccL6101UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 10, 1); // L6.10.1
219 SetVariable(avgOffOccL6101UV);
220
221 std::pair<float, float> avgOffOccL6102UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 10, 2); // L6.10.2
222 SetVariable(avgOffOccL6102UV);
223
224 // average occupancy for low DCDC
225 // L3.2.1 above
226 // L3.2.2 above
227 std::pair<float, float> avgOffOccL411UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 1, 1); // L4.1.1
228 SetVariable(avgOffOccL411UV);
229
230 std::pair<float, float> avgOffOccL4102UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 10, 2); // L4.10.2
231 SetVariable(avgOffOccL4102UV);
232
233 // average occupancy for peculiar sensors
234 std::pair<float, float> avgOffOccL433UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 3, 3); // L4.3.3
235 SetVariable(avgOffOccL433UV);
236
237 std::pair<float, float> avgOffOccL513UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 1, 3); // L5.1.3
238 SetVariable(avgOffOccL513UV);
239
240 std::pair<float, float> avgOffOccL514UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 1, 4); // L5.1.4
241 SetVariable(avgOffOccL514UV);
242
243 std::pair<float, float> avgOffOccL592UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 9, 2); // L5.9.2
244 SetVariable(avgOffOccL592UV);
245
246 std::pair<float, float> avgOffOccL594UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 9, 4); // L5.9.4
247 SetVariable(avgOffOccL594UV);
248
249 std::pair<float, float> avgOffOccL643UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 4, 3); // L6.4.3
250 SetVariable(avgOffOccL643UV);
251
252 std::pair<float, float> avgOffOccL664UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 6, 4); // L6.6.4
253 SetVariable(avgOffOccL664UV);
254
255 std::pair<float, float> avgOffOccL6103UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 10, 3); // L6.10.3
256 SetVariable(avgOffOccL6103UV);
257
258 std::pair<float, float> avgOffOccL6115UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 11, 5); // L6.11.5
259 SetVariable(avgOffOccL6115UV);
260
261 std::pair<float, float> avgOffOccL6124UV = avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 12, 4); // L6.12.4
262 SetVariable(avgOffOccL6124UV);
263 }
264
265
266 // efficiency of cluster reconstruction for U and V side
267 TH2F* h_found_tracksU = (TH2F*)findHist("SVDEfficiency/TrackHitsU");
268 TH2F* h_matched_clusU = (TH2F*)findHist("SVDEfficiency/MatchedHitsU");
269 TH2F* h_found_tracksV = (TH2F*)findHist("SVDEfficiency/TrackHitsV");
270 TH2F* h_matched_clusV = (TH2F*)findHist("SVDEfficiency/MatchedHitsV");
271
272 m_c_avgEfficiency->Clear();
273 m_c_avgEfficiency->Divide(2, 2);
274 m_c_avgEfficiency->cd(1);
275 if (h_found_tracksU) h_found_tracksU->Draw("colz");
276 m_c_avgEfficiency->cd(2);
277 if (h_found_tracksV) h_found_tracksV->Draw("colz");
278 m_c_avgEfficiency->cd(3);
279 if (h_matched_clusU) h_matched_clusU->Draw("colz");
280 m_c_avgEfficiency->cd(4);
281 if (h_matched_clusV) h_matched_clusV->Draw("colz");
282
283 // setting monitoring variables
284 if (h_matched_clusU == NULL || h_matched_clusV == NULL || h_found_tracksU == NULL) {
285 if (h_matched_clusU == NULL) {
286 B2INFO("Histograms needed for Average Efficiency on U side are not found");
287 }
288 if (h_matched_clusV == NULL) {
289 B2INFO("Histograms needed for Average Efficiency on V side are not found");
290 }
291 } else {
292 // average efficiency in each layer for both side (U, V)
293 std::pair<float, float> avgEffL3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3);
294 SetVariable(avgEffL3);
295
296 std::pair<float, float> avgEffL4 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4);
297 SetVariable(avgEffL4);
298
299 std::pair<float, float> avgEffL5 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5);
300 SetVariable(avgEffL5);
301
302 std::pair<float, float> avgEffL6 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6);
303 SetVariable(avgEffL6);
304
305 // average efficiency for all layers
306 std::pair<float, float> avgEffL3456 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV);
307 SetVariable(avgEffL3456);
308
309 // average efficiency for mid plane: L3.X.1
310 std::pair<float, float> avgEffL3X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, -1, 1);
311 SetVariable(avgEffL3X1);
312
313 // average efficiency for mid plane: L3.X.2
314 std::pair<float, float> avgEffL3X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, -1, 2);
315 SetVariable(avgEffL3X2);
316
317 // average efficiency for mid plane: L4.X.1
318 std::pair<float, float> avgEffL4X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, -1, 1);
319 SetVariable(avgEffL4X1);
320
321 // average efficiency for mid plane: L4.X.2
322 std::pair<float, float> avgEffL4X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, -1, 2);
323 SetVariable(avgEffL4X2);
324
325 // average efficiency for mid plane: L4.X.3
326 std::pair<float, float> avgEffL4X3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, -1, 3);
327 SetVariable(avgEffL4X3);
328
329 // average efficiency for mid plane: L5.X.1
330 std::pair<float, float> avgEffL5X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 1);
331 SetVariable(avgEffL5X1);
332
333 // average efficiency for mid plane: L5.X.2
334 std::pair<float, float> avgEffL5X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 2);
335 SetVariable(avgEffL5X2);
336
337 // average efficiency for mid plane: L5.X.3
338 std::pair<float, float> avgEffL5X3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 3);
339 SetVariable(avgEffL5X3);
340
341 // average efficiency for mid plane: L5.X.4
342 std::pair<float, float> avgEffL5X4 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 4);
343 SetVariable(avgEffL5X4);
344
345 // average efficiency for mid plane: L6.X.1
346 std::pair<float, float> avgEffL6X1 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 1);
347 SetVariable(avgEffL6X1);
348
349 // average efficiency for mid plane: L6.X.2
350 std::pair<float, float> avgEffL6X2 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 2);
351 SetVariable(avgEffL6X2);
352
353 // average efficiency for mid plane: L6.X.3
354 std::pair<float, float> avgEffL6X3 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 3);
355 SetVariable(avgEffL6X3);
356
357 // average efficiency for mid plane: L6.X.4
358 std::pair<float, float> avgEffL6X4 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 4);
359 SetVariable(avgEffL6X4);
360
361 // average efficiency for mid plane: L6.X.5
362 std::pair<float, float> avgEffL6X5 = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 5);
363 SetVariable(avgEffL6X5);
364
365 // average efficiency for high occupancy sensors
366 std::pair<float, float> avgEffL311UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 1,
367 1); // L3.1.1
368 SetVariable(avgEffL311UV);
369
370 std::pair<float, float> avgEffL312UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 1,
371 2); // L3.1.2
372 SetVariable(avgEffL312UV);
373
374 std::pair<float, float> avgEffL321UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 2,
375 1); // L3.2.1
376 SetVariable(avgEffL321UV);
377
378 std::pair<float, float> avgEffL322UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 2,
379 2); // L3.2.2
380 SetVariable(avgEffL322UV);
381
382 std::pair<float, float> avgEffL461UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 6,
383 1); // L4.6.1
384 SetVariable(avgEffL461UV);
385
386 std::pair<float, float> avgEffL462UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 6,
387 2); // L4.6.2
388 SetVariable(avgEffL462UV);
389
390 std::pair<float, float> avgEffL581UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 8,
391 1); // L5.8.1
392 SetVariable(avgEffL581UV);
393
394 std::pair<float, float> avgEffL582UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 8,
395 2); // L5.8.2
396 SetVariable(avgEffL582UV);
397
398 std::pair<float, float> avgEffL6101UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 10,
399 1); // L6.10.1
400 SetVariable(avgEffL6101UV);
401
402 std::pair<float, float> avgEffL6102UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 10,
403 2); // L6.10.2
404 SetVariable(avgEffL6102UV);
405
406 // average efficiency for low DCDC
407 // L3.2.1 above
408 // L3.2.2 above
409 std::pair<float, float> avgEffL411UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 1,
410 1); // L4.1.1
411 SetVariable(avgEffL411UV);
412
413 std::pair<float, float> avgEffL4102UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 10,
414 2); // L4.10.2
415 SetVariable(avgEffL4102UV);
416
417 // average efficiency for peculiar sensors
418 std::pair<float, float> avgEffL433UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 3,
419 3); // L4.3.3
420 SetVariable(avgEffL433UV);
421
422 std::pair<float, float> avgEffL513UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 1,
423 3); // L5.1.3
424 SetVariable(avgEffL513UV);
425
426 std::pair<float, float> avgEffL514UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 1,
427 4); // L5.1.4
428 SetVariable(avgEffL514UV);
429
430 std::pair<float, float> avgEffL592UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 9,
431 2); // L5.9.2
432 SetVariable(avgEffL592UV);
433
434 std::pair<float, float> avgEffL594UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 9,
435 4); // L5.9.4
436 SetVariable(avgEffL594UV);
437
438 std::pair<float, float> avgEffL643UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 4,
439 3); // L6.4.3
440 SetVariable(avgEffL643UV);
441
442 std::pair<float, float> avgEffL664UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 6,
443 4); // L6.6.4
444 SetVariable(avgEffL664UV);
445
446 std::pair<float, float> avgEffL6103UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 10,
447 3); // L6.10.3
448 SetVariable(avgEffL6103UV);
449
450 std::pair<float, float> avgEffL6115UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 11,
451 5); // L6.11.5
452 SetVariable(avgEffL6115UV);
453
454 std::pair<float, float> avgEffL6124UV = avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 12,
455 4); // L6.12.4
456 SetVariable(avgEffL6124UV);
457 }
458
459 // MPV cluster charge for clusters on track
460 TH1F* h_clusterCharge_L3U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeU3");
461 TH1F* h_clusterCharge_L3V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeV3");
462 TH1F* h_clusterCharge_L456U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeU456");
463 TH1F* h_clusterCharge_L456V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterChargeV456");
464
466 m_c_MPVChargeClusterOnTrack->Divide(2, 2);
468 if (h_clusterCharge_L3U) h_clusterCharge_L3U->Draw();
470 if (h_clusterCharge_L3V) h_clusterCharge_L3V->Draw();
472 if (h_clusterCharge_L456U) h_clusterCharge_L456U->Draw();
474 if (h_clusterCharge_L456U) h_clusterCharge_L456U->Draw();
475
476 // find abscissa of max Y in histograms
477 float MPVClusterChargeL3U = nan;
478 if (h_clusterCharge_L3U)
479 if (h_clusterCharge_L3U->GetEntries() != 0)
480 MPVClusterChargeL3U = xForMaxY(h_clusterCharge_L3U);
481 float MPVClusterChargeL3V = nan;
482 if (h_clusterCharge_L3V)
483 if (h_clusterCharge_L3V->GetEntries() != 0)
484 MPVClusterChargeL3V = xForMaxY(h_clusterCharge_L3V);
485 float MPVClusterChargeL456U = nan;
486 if (h_clusterCharge_L456U)
487 if (h_clusterCharge_L456U->GetEntries() != 0)
488 MPVClusterChargeL456U = xForMaxY(h_clusterCharge_L456U);
489 float MPVClusterChargeL456V = nan;
490 if (h_clusterCharge_L456V)
491 if (h_clusterCharge_L456V->GetEntries() != 0)
492 MPVClusterChargeL456V = xForMaxY(h_clusterCharge_L456V);
493
494 if (h_clusterCharge_L3U == NULL || h_clusterCharge_L456U == NULL) {
495 B2INFO("Histograms needed for MPV cluster charge on U side are not found");
496 } else {
497 m_monObj->setVariable("MPVClusterChargeL3U", MPVClusterChargeL3U);
498 m_monObj->setVariable("MPVClusterChargeL456U", MPVClusterChargeL456U);
499 }
500
501 if (h_clusterCharge_L3V == NULL || h_clusterCharge_L456V == NULL) {
502 B2INFO("Histograms needed for MPV cluster charge on V side are not found");
503 } else {
504 m_monObj->setVariable("MPVClusterChargeL3V", MPVClusterChargeL3V);
505 m_monObj->setVariable("MPVClusterChargeL456V", MPVClusterChargeL456V);
506 }
507
508
509 // MPV SNR for the clusters on track
510 TH1F* h_clusterSNR_L3U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRU3");
511 TH1F* h_clusterSNR_L3V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRV3");
512 TH1F* h_clusterSNR_L456U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRU456");
513 TH1F* h_clusterSNR_L456V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterSNRV456");
514
516 m_c_MPVSNRClusterOnTrack->Divide(2, 2);
518 if (h_clusterSNR_L3U) h_clusterSNR_L3U->Draw();
520 if (h_clusterSNR_L3V) h_clusterSNR_L3V->Draw();
522 if (h_clusterSNR_L456U) h_clusterSNR_L456U->Draw();
524 if (h_clusterSNR_L456V) h_clusterSNR_L456V->Draw();
525
526 float MPVClusterSNRL3U = nan;
527 if (h_clusterSNR_L3U)
528 if (h_clusterSNR_L3U->GetEntries() != 0)
529 MPVClusterSNRL3U = xForMaxY(h_clusterSNR_L3U);
530 float MPVClusterSNRL3V = nan;
531 if (h_clusterSNR_L3V)
532 if (h_clusterSNR_L3V->GetEntries() != 0)
533 MPVClusterSNRL3V = xForMaxY(h_clusterSNR_L3V);
534 float MPVClusterSNRL456U = nan;
535 if (h_clusterSNR_L456U)
536 if (h_clusterSNR_L456U->GetEntries() != 0)
537 MPVClusterSNRL456U = xForMaxY(h_clusterSNR_L456U);
538 float MPVClusterSNRL456V = nan;
539 if (h_clusterSNR_L456V)
540 if (h_clusterSNR_L456V->GetEntries() != 0)
541 MPVClusterSNRL456V = xForMaxY(h_clusterSNR_L456V);
542
543 if (h_clusterSNR_L3U == NULL || h_clusterSNR_L456U == NULL) {
544 B2INFO("Histograms needed for MPV cluster SNR on U side are not found");
545 } else {
546 m_monObj->setVariable("MPVClusterSNRL3U", MPVClusterSNRL3U);
547 m_monObj->setVariable("MPVClusterSNRL456U", MPVClusterSNRL456U);
548 }
549
550 if (h_clusterSNR_L3V == NULL || h_clusterSNR_L456V == NULL) {
551 B2INFO("Histograms needed for MPV cluster SNR on V side are not found");
552 } else {
553 m_monObj->setVariable("MPVClusterSNRL3V", MPVClusterSNRL3V);
554 m_monObj->setVariable("MPVClusterSNRL456V", MPVClusterSNRL456V);
555 }
556
557
558 // MPV SVD cluster time for the clusters on track
559 TH1F* h_clusterTime_L3U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeU3");
560 TH1F* h_clusterTime_L3V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeV3");
561 TH1F* h_clusterTime_L456U = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeU456");
562 TH1F* h_clusterTime_L456V = (TH1F*)findHist("SVDClsTrk/SVDTRK_ClusterTimeV456");
563 TH1F* h_MeanSVD3EventT0 = (TH1F*)findHist("SVDHitTime/SVD3EventT0");
564 TH1F* h_MeanSVD6EventT0 = (TH1F*)findHist("SVDHitTime/SVD6EventT0");
565 TH1F* h_MeanSVDEventT0 = 0x0;
566
567 if (h_MeanSVD3EventT0)
568 h_MeanSVDEventT0 = (TH1F*)h_MeanSVD3EventT0->Clone();
569
571 m_c_MPVTimeClusterOnTrack->Divide(2, 2);
573 if (h_clusterTime_L3U) h_clusterTime_L3U->Draw();
575 if (h_clusterTime_L3V) h_clusterTime_L3V->Draw();
577 if (h_clusterTime_L456U) h_clusterTime_L456U->Draw();
579 if (h_clusterTime_L456V) h_clusterTime_L456V->Draw();
580
581 m_c_MeanSVDEventT0->Clear();
582 m_c_MeanSVDEventT0->Divide(2, 2);
583 m_c_MeanSVDEventT0->cd(1);
584 if (h_MeanSVD3EventT0) h_MeanSVD3EventT0->Draw();
585 m_c_MeanSVDEventT0->cd(2);
586 if (h_MeanSVD6EventT0) h_MeanSVD6EventT0->Draw();
587 m_c_MeanSVDEventT0->cd(3);
588 if (h_MeanSVDEventT0) {
589 if (h_MeanSVD6EventT0)
590 h_MeanSVDEventT0->Add(h_MeanSVD6EventT0);
591 h_MeanSVDEventT0->Draw();
592 }
593
594 float MPVClusterTimeL3U = nan;
595 if (h_clusterTime_L3U)
596 if (h_clusterTime_L3U->GetEntries() != 0)
597 MPVClusterTimeL3U = xForMaxY(h_clusterTime_L3U);
598 float MPVClusterTimeL3V = nan;
599 if (h_clusterTime_L3V)
600 if (h_clusterTime_L3V->GetEntries() != 0)
601 MPVClusterTimeL3V = xForMaxY(h_clusterTime_L3V);
602 float MPVClusterTimeL456U = nan;
603 if (h_clusterTime_L456U)
604 if (h_clusterTime_L456U->GetEntries() != 0)
605 MPVClusterTimeL456U = xForMaxY(h_clusterTime_L456U);
606 float MPVClusterTimeL456V = nan;
607 if (h_clusterTime_L456V)
608 if (h_clusterTime_L456V->GetEntries() != 0)
609 MPVClusterTimeL456V = xForMaxY(h_clusterTime_L456V);
610 float FWHMClusterTimeL3U = nan;
611 if (h_clusterTime_L3U)
612 if (h_clusterTime_L3U->GetEntries() != 0)
613 FWHMClusterTimeL3U = histFWHM(h_clusterTime_L3U);
614 float FWHMClusterTimeL3V = nan;
615 if (h_clusterTime_L3V)
616 if (h_clusterTime_L3V->GetEntries() != 0)
617 FWHMClusterTimeL3V = histFWHM(h_clusterTime_L3V);
618 float FWHMClusterTimeL456U = nan;
619 if (h_clusterTime_L456U)
620 if (h_clusterTime_L456U->GetEntries() != 0)
621 FWHMClusterTimeL456U = histFWHM(h_clusterTime_L456U);
622 float FWHMClusterTimeL456V = nan;
623 if (h_clusterTime_L456V)
624 if (h_clusterTime_L456V->GetEntries() != 0)
625 FWHMClusterTimeL456V = histFWHM(h_clusterTime_L456V);
626
627 float MeanSVD3EventT0 = nan;
628 if (h_MeanSVD3EventT0)
629 if (h_MeanSVD3EventT0->GetEntries() != 0)
630 MeanSVD3EventT0 = xForMaxY(h_MeanSVD3EventT0);
631
632 float MeanSVD6EventT0 = nan;
633 if (h_MeanSVD6EventT0)
634 if (h_MeanSVD6EventT0->GetEntries() != 0)
635 MeanSVD6EventT0 = xForMaxY(h_MeanSVD6EventT0);
636
637 float MeanSVDEventT0 = nan;
638 if (h_MeanSVDEventT0)
639 if (h_MeanSVDEventT0->GetEntries() != 0)
640 MeanSVDEventT0 = xForMaxY(h_MeanSVDEventT0);
641
642 if (h_clusterTime_L3U == NULL || h_clusterTime_L456U == NULL) {
643 B2INFO("Histograms needed for MPV cluster time on U side are not found");
644 } else {
645 m_monObj->setVariable("MPVClusterTimeL3U", MPVClusterTimeL3U);
646 m_monObj->setVariable("MPVClusterTimeL456U", MPVClusterTimeL456U);
647 m_monObj->setVariable("FWHMClusterTimeL3U", FWHMClusterTimeL3U);
648 m_monObj->setVariable("FWHMClusterTimeL456U", FWHMClusterTimeL456U);
649 }
650
651 if (h_clusterTime_L3V == NULL || h_clusterTime_L456V == NULL) {
652 B2INFO("Histograms needed for MPV cluster time on V side are not found");
653 } else {
654 m_monObj->setVariable("MPVClusterTimeL3V", MPVClusterTimeL3V);
655 m_monObj->setVariable("MPVClusterTimeL456V", MPVClusterTimeL456V);
656 m_monObj->setVariable("FWHMClusterTimeL3V", FWHMClusterTimeL3V);
657 m_monObj->setVariable("FWHMClusterTimeL456V", FWHMClusterTimeL456V);
658 }
659
660 if (h_MeanSVD3EventT0 == NULL) {
661 B2INFO("Histograms needed for SVD Event T0 (3 samples) not found");
662 } else {
663 m_monObj->setVariable("MeanSVD3EventT0", MeanSVD3EventT0);
664 }
665
666 if (h_MeanSVD6EventT0 == NULL) {
667 B2INFO("Histograms needed for SVD Event T0 (6 samples) not found");
668 } else {
669 m_monObj->setVariable("MeanSVD6EventT0", MeanSVD6EventT0);
670 }
671
672 if (h_MeanSVDEventT0 == NULL) {
673 B2INFO("Histograms needed for SVD Event T0 (all samples) not found");
674 } else {
675 m_monObj->setVariable("MeanSVDEventT0", MeanSVDEventT0);
676 }
677
678 // average maxBin for clusters on track
679 TH1F* h_maxBinU = (TH1F*)findHist("SVDClsTrk/SVDTRK_StripMaxBinUAll");
680 TH1F* h_maxBinV = (TH1F*)findHist("SVDClsTrk/SVDTRK_StripMaxBinVAll");
681
683 m_c_avgMaxBinClusterOnTrack->Divide(2, 1);
685 if (h_maxBinU) h_maxBinU->Draw();
687 if (h_maxBinV) h_maxBinV->Draw();
688
689 if (h_maxBinU == NULL) {
690 B2INFO("Histogram needed for Average MaxBin on U side is not found");
691 } else {
692 float avgMaxBinU = h_maxBinU->GetMean();
693 m_monObj->setVariable("avgMaxBinU", avgMaxBinU);
694 }
695
696 if (h_maxBinV == NULL) {
697 B2INFO("Histogram needed for Average MaxBin on V side is not found");
698 } else {
699 float avgMaxBinV = h_maxBinV->GetMean();
700 m_monObj->setVariable("avgMaxBinV", avgMaxBinV);
701 }
702
703 std::map<std::pair<int, int>, int> ladderMap = {
704 {{3, 1}, 0}, {{3, 2}, 1},
705 {{4, 1}, 2}, {{4, 2}, 3}, {{4, 3}, 4},
706 {{5, 1}, 5}, {{5, 2}, 6}, {{5, 3}, 7}, {{5, 4}, 8},
707 {{6, 1}, 9}, {{6, 2}, 10}, {{6, 3}, 11}, {{6, 4}, 12}, {{6, 5}, 13}
708 };
709
710
711 for (const auto& it : ladderMap) {
712 std::pair<int, int> p = it.first;
713 int layer = p.first;
714 int sensor = p.second;
715
716 TString name = Form("SVDClsTrk/SVDTRK_ClusterCharge_L%d.x.%d", layer, sensor);
717 TString title = Form("MPVClusterCharge_L%d.x.%d", layer, sensor);
718 TH1F* h_clusterCharge = (TH1F*)findHist(name.Data());
719 float MPVClusterCharge = nan;
720 if (h_clusterCharge)
721 if (h_clusterCharge->GetEntries() != 0)
722 MPVClusterCharge = xForMaxY(h_clusterCharge);
723
724 if (h_clusterCharge == NULL) {
725 B2INFO("Histograms needed for cluster charge not found");
726 } else {
727 m_monObj->setVariable(title.Data(), MPVClusterCharge);
728 }
729
730 name = Form("SVDClsTrk/SVDTRK_ClusterSNR_L%d.x.%d", layer, sensor);
731 title = Form("MPVClusterSNR_L%d.x.%d", layer, sensor);
732 TH1F* h_clusterSNR = (TH1F*)findHist(name.Data());
733 float MPVClusterSNR = nan;
734 if (h_clusterSNR)
735 if (h_clusterSNR->GetEntries() != 0)
736 MPVClusterSNR = xForMaxY(h_clusterSNR);
737
738 if (h_clusterSNR == NULL) {
739 B2INFO("Histograms needed for cluster SNR not found");
740 } else {
741 m_monObj->setVariable(title.Data(), MPVClusterSNR);
742 }
743 }
744
745 for (int ladder = 1; ladder <= 2; ++ladder) {
746 for (int sensor = 1; sensor <= 2; ++sensor) {
747
748 TString name = Form("SVDClsTrk/SVDTRK_ClusterCharge_L3.%d.%d", ladder, sensor);
749 TString title = Form("MPVClusterCharge_L3.%d.%d", ladder, sensor);
750 float MPVClusterCharge = nan;
751 TH1F* h_clusterCharge = (TH1F*)findHist(name.Data());
752 if (h_clusterCharge)
753 if (h_clusterCharge->GetEntries() != 0)
754 MPVClusterCharge = xForMaxY(h_clusterCharge);
755
756 if (h_clusterCharge == NULL) {
757 B2INFO("Histograms needed for cluster charge not found");
758 } else {
759 m_monObj->setVariable(title.Data(), MPVClusterCharge);
760 }
761
762 name = Form("SVDClsTrk/SVDTRK_ClusterSNR_L3.%d.%d", ladder, sensor);
763 title = Form("MPVClusterSNR_L3.%d.%d", ladder, sensor);
764 TH1F* h_clusterSNR = (TH1F*)findHist(name.Data());
765 float MPVClusterSNR = nan;
766 if (h_clusterSNR)
767 if (h_clusterSNR->GetEntries() != 0)
768 MPVClusterSNR = xForMaxY(h_clusterSNR);
769
770 if (h_clusterSNR == NULL) {
771 B2INFO("Histograms needed for cluster SNR not found");
772 } else {
773 m_monObj->setVariable(title.Data(), MPVClusterSNR);
774 }
775 }
776 }
777
778 B2INFO("DQMHistAnalysisSVDGeneral: endRun called");
779}
780
781
783{
784 B2INFO("DQMHistAnalysisSVDOnMiraBelle: terminate called");
785}
786
787std::pair<float, float> DQMHistAnalysisSVDOnMiraBelleModule::avgOccupancyUV(TH1F* hU, TH1F* hV, int nEvents,
788 int layer, int ladder, int sensor) const
789{
790 int nStripsV = -1;
791 if (layer == 3) {
792 nStripsV = 768;
793 } else if (layer >= 4 && layer <= 6) {
794 nStripsV = 512;
795 } else {
796 B2DEBUG(20, "Layer out of range [3,6].");
797 }
798 std::pair<float, float> avgOffOccUV(0.0, 0.0);
799
800 int minLayer = (layer != -1) ? layer : m_gTools->getFirstSVDLayer();
801 int maxLayer = (layer != -1) ? layer : m_gTools->getLastSVDLayer();
802 int sensorsN = 0;
803
804 if (ladder == 0) ladder = -1;
805
806 for (int layerId = minLayer; layerId < maxLayer + 1; ++layerId) {
807 int minLadder = (ladder != -1) ? ladder : 1;
808 int maxLadder = (ladder != -1) ? ladder : getNumberOfLadders(layerId);
809
810 int minSensor = (sensor != -1) ? sensor : 1;
811 int maxSensor = (sensor != -1) ? sensor : getNumberOfSensors(layerId);
812
813 for (int sensorId = minSensor; sensorId < maxSensor + 1; ++sensorId) {
814
815 for (int ladderId = minLadder; ladderId < maxLadder + 1; ++ladderId) {
816 int bin = m_gTools->getSVDSensorIndex(layerId, ladderId, sensorId) + 1;
817
818 avgOffOccUV.first += hU->GetBinContent(bin) / 768 * 100;
819 avgOffOccUV.second += hV->GetBinContent(bin) / nStripsV * 100;
820 sensorsN++;
821 }
822 }
823 }
824
825 avgOffOccUV.first /= (sensorsN * nEvents);
826 avgOffOccUV.second /= (sensorsN * nEvents);
827
828 return avgOffOccUV;
829}
830
831std::pair<float, float> DQMHistAnalysisSVDOnMiraBelleModule::avgOccupancyGrpId0UV(int iLayer, int nEvents) const
832{
833 int nStripsV = -1;
834 if (iLayer == 3) {
835 nStripsV = 768;
836 } else if (iLayer >= 4 && iLayer <= 6) {
837 nStripsV = 512;
838 } else {
839 B2DEBUG(20, "Layer out of range [3,6].");
840 }
841
842 Int_t nStripsU = 768;
843
844 std::vector<float> avgOffOccU;
845 std::vector<float> avgOffOccV;
846
847 for (unsigned int i = 0; i < m_SVDModules.size(); i++) {
848 int tmp_layer = m_SVDModules[i].getLayerNumber();
849 int tmp_ladder = m_SVDModules[i].getLadderNumber();
850 int tmp_sensor = m_SVDModules[i].getSensorNumber();
851
852 TString tmpnameGrpId0U = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
853 TH1F* htmpU = (TH1F*)findHist(tmpnameGrpId0U.Data());
854 if (htmpU == NULL) {
855 B2INFO("Occupancy U histogram for group Id0 not found");
856 } else {
857 if (tmp_layer == iLayer)
858 avgOffOccU.push_back(htmpU->GetEntries() / nStripsU / nEvents * 100);
859 }
860
861 TString tmpnameGrpId0V = Form("SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
862 TH1F* htmpV = (TH1F*)findHist(tmpnameGrpId0V.Data());
863 if (htmpV == NULL) {
864 B2INFO("Occupancy V histogram for group Id0 not found");
865 } else {
866 if (tmp_layer == iLayer)
867 avgOffOccV.push_back(htmpV->GetEntries() / nStripsV / nEvents * 100);
868 }
869 }
870
871 std::pair<float, float> avgOffOccUV(0., 0.);
872
873 avgOffOccUV.first = accumulate(avgOffOccU.begin(), avgOffOccU.end(), 0.0);
874 avgOffOccUV.first /= float(avgOffOccU.size());
875
876 avgOffOccUV.second = accumulate(avgOffOccV.begin(), avgOffOccV.end(), 0.0);
877 avgOffOccUV.second /= float(avgOffOccV.size());
878
879 return avgOffOccUV;
880}
881
882std::pair<float, float> DQMHistAnalysisSVDOnMiraBelleModule::avgEfficiencyUV(TH2F* hMCU, TH2F* hMCV, TH2F* hFTU, TH2F* hFTV,
883 int layer,
884 int ladder, int sensor) const
885{
886 float nan = numeric_limits<float>::quiet_NaN();
887 std::pair<float, float> avgEffUV(0.0, 0.0);
888 std::pair<float, float> sumMatchedClustersUV(0.0, 0.0);
889 std::pair<float, float> sumFoundTracksUV(0.0, 0.0);
890
891 int minLayer = (layer != -1) ? layer : m_gTools->getFirstSVDLayer();
892 int maxLayer = (layer != -1) ? layer : m_gTools->getLastSVDLayer();
893
894 if (ladder == 0) ladder = -1;
895
896 for (int layerId = minLayer; layerId < maxLayer + 1; ++layerId) {
897 int minLadder = (ladder != -1) ? ladder : 1;
898 int maxLadder = (ladder != -1) ? ladder : getNumberOfLadders(layerId);
899
900 int minSensor = (sensor != -1) ? sensor : 1;
901 int maxSensor = (sensor != -1) ? sensor : getNumberOfSensors(layerId);
902
903 for (int sensorId = minSensor; sensorId < maxSensor + 1; ++sensorId) {
904
905 for (int ladderId = minLadder; ladderId < maxLadder + 1; ++ladderId) {
906 int binY = findBinY(layerId, sensorId);
907 int binXY = hMCV->FindBin(ladderId, binY);
908
909 sumMatchedClustersUV.first += hMCU->GetBinContent(binXY);
910 sumMatchedClustersUV.second += hMCV->GetBinContent(binXY);
911 sumFoundTracksUV.first += hFTU->GetBinContent(binXY);
912 sumFoundTracksUV.second += hFTV->GetBinContent(binXY);
913 }
914 }
915 }
916
917 if (sumFoundTracksUV.first > 0) {
918 avgEffUV.first = sumMatchedClustersUV.first / sumFoundTracksUV.first * 100;
919 } else {
920 avgEffUV.first = nan;
921 }
922
923 if (sumFoundTracksUV.second > 0) {
924 avgEffUV.second = sumMatchedClustersUV.second / sumFoundTracksUV.second * 100;
925 } else {
926 avgEffUV.second = nan;
927 }
928
929 return avgEffUV;
930}
931
932
933void DQMHistAnalysisSVDOnMiraBelleModule::addVariable(string name, pair<float, float>& varUV)
934{
935 size_t pos = name.find("UV");
936
937 if (pos != string::npos)
938 name.replace(pos, 2, "");
939
940 m_monObj->setVariable(Form("%sU", name.c_str()), varUV.first);
941 m_monObj->setVariable(Form("%sV", name.c_str()), varUV.second);
942}
943
945{
946 int maxY = h->GetMaximumBin();
947 float xMaxY = h->GetXaxis()->GetBinCenter(maxY);
948 return xMaxY;
949}
950
952{
953 int bin1 = h->FindFirstBinAbove(h->GetMaximum() / 2);
954 int bin2 = h->FindLastBinAbove(h->GetMaximum() / 2);
955 float fwhm = h->GetBinCenter(bin2) - h->GetBinCenter(bin1);
956 return fwhm;
957}
The base class for the histogram analysis module.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
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< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
const VXD::GeoTools * m_gTools
geometrical tool pointer
void addVariable(std::string name, std::pair< float, float > &varUV)
Add variable to object monitoring.
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.
Int_t findBinY(Int_t layer, Int_t sensor) const
find the Y bin given the layer and sensor number
void event() override final
Module function event.
std::pair< float, float > avgOccupancyGrpId0UV(int iLayer, int nEvents) const
Calculate avg offline occupancy for specified layer for time group id = 0.
std::pair< float, float > avgOccupancyUV(TH1F *hU, TH1F *hV, int nEvents, int layer=-1, int ladder=-1, int sensor=-1) const
Calculate avg offline occupancy for one specific sensor, especially.
std::pair< float, float > avgEfficiencyUV(TH2F *hMCU, TH2F *hMCV, TH2F *hFTU, TH2F *hFTV, int layer=-1, int ladder=-1, int sensor=-1) const
Calculate avg efficiency for specified sensors.
TCanvas * m_c_MPVSNRClusterOnTrack
SNR for clusters on track.
Int_t getNumberOfLadders(Int_t layer) const
get number of ladders per layer
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
Int_t getNumberOfSensors(Int_t layer) const
get number of sensors per layer
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.
Class to facilitate easy access to sensor information of the VXD like coordinate transformations or p...
Definition: GeoCache.h:39
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
Definition: GeoCache.cc:59
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
const GeoTools * getGeoTools()
Return a raw pointer to a GeoTools object.
Definition: GeoCache.h:142
short getLastSVDLayer() const
Get last (outermost) SVD layer number.
Definition: GeoTools.h:120
short getFirstSVDLayer() const
Get first (innermost) SVD layer number.
Definition: GeoTools.h:112
int getSVDSensorIndex(VxdID sensorID) const
Return index of SVD sensor in plots.
Definition: GeoTools.h:318
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
#define SetVariable(x)
set variable to mirabelle for a given member
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:649
Abstract base class for different kinds of events.
STL namespace.