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>
17#include <dqm/analysis/modules/DQMHistAnalysisSVDOnMiraBelle.h>
34 setDescription(
"DQM Analysis Module that extracts monitoring variables from SVD DQM histograms and provides input to MiraBelle.");
36 B2DEBUG(20,
"DQMHistAnalysisSVDOnMiraBelle: Constructor done.");
51 m_c_avgEfficiency =
new TCanvas(
"svd_avgEfficiency",
"matched clusters and found tracks", 0, 0, 800, 600);
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);
57 m_c_MeanSVDEventT0 =
new TCanvas(
"svd_MeanSVDEventT0",
"Mean Event T0 from SVD for all samples", 0, 0, 400, 400);
72 for (
VxdID& aVxdID : sensors) {
80 B2DEBUG(20,
"DQMHistAnalysisSVDOnMiraBelle: initialized.");
85 B2DEBUG(20,
"DQMHistAnalysisSVDOnMiraBelle: beginRun called.");
90 B2DEBUG(20,
"DQMHistAnalysisSVDOnMiraBelle: event called.");
95 float nan = numeric_limits<float>::quiet_NaN();
98 TH1F* h_zs5countsU = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_StripCountsU");
99 TH1F* h_zs5countsV = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_StripCountsV");
100 TH1F* h_events = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_nEvents");
106 if (h_zs5countsU) h_zs5countsU->Draw(
"colz");
108 if (h_zs5countsV) h_zs5countsV->Draw(
"colz");
110 if (h_events) h_events->Draw(
"colz");
113 if (h_events) nE = h_events->GetEntries();
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");
120 if (h_zs5countsV == NULL) {
121 B2INFO(
"Histograms needed for Average Offline Occupancy on V side are not found");
125 std::pair<float, float> avgOffOccL3UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3);
128 std::pair<float, float> avgOffOccL4UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4);
131 std::pair<float, float> avgOffOccL5UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5);
134 std::pair<float, float> avgOffOccL6UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6);
151 std::pair<float, float> avgOffOccL3X1UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, -1, 1);
154 std::pair<float, float> avgOffOccL3X2UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, -1, 2);
157 std::pair<float, float> avgOffOccL4X1UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, -1, 1);
160 std::pair<float, float> avgOffOccL4X2UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, -1, 2);
163 std::pair<float, float> avgOffOccL4X3UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, -1, 3);
166 std::pair<float, float> avgOffOccL5X1UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 1);
169 std::pair<float, float> avgOffOccL5X2UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 2);
172 std::pair<float, float> avgOffOccL5X3UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 3);
175 std::pair<float, float> avgOffOccL5X4UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, -1, 4);
178 std::pair<float, float> avgOffOccL6X1UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 1);
181 std::pair<float, float> avgOffOccL6X2UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 2);
184 std::pair<float, float> avgOffOccL6X3UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 3);
187 std::pair<float, float> avgOffOccL6X4UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 4);
190 std::pair<float, float> avgOffOccL6X5UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, -1, 5);
194 std::pair<float, float> avgOffOccL311UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 1, 1);
197 std::pair<float, float> avgOffOccL312UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 1, 2);
200 std::pair<float, float> avgOffOccL321UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 2, 1);
203 std::pair<float, float> avgOffOccL322UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 3, 2, 2);
206 std::pair<float, float> avgOffOccL461UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 6, 1);
209 std::pair<float, float> avgOffOccL462UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 6, 2);
212 std::pair<float, float> avgOffOccL581UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 8, 1);
215 std::pair<float, float> avgOffOccL582UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 8, 2);
218 std::pair<float, float> avgOffOccL6101UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 10, 1);
221 std::pair<float, float> avgOffOccL6102UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 10, 2);
227 std::pair<float, float> avgOffOccL411UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 1, 1);
230 std::pair<float, float> avgOffOccL4102UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 10, 2);
234 std::pair<float, float> avgOffOccL433UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 4, 3, 3);
237 std::pair<float, float> avgOffOccL513UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 1, 3);
240 std::pair<float, float> avgOffOccL514UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 1, 4);
243 std::pair<float, float> avgOffOccL592UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 9, 2);
246 std::pair<float, float> avgOffOccL594UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 5, 9, 4);
249 std::pair<float, float> avgOffOccL643UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 4, 3);
252 std::pair<float, float> avgOffOccL664UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 6, 4);
255 std::pair<float, float> avgOffOccL6103UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 10, 3);
258 std::pair<float, float> avgOffOccL6115UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 11, 5);
261 std::pair<float, float> avgOffOccL6124UV =
avgOccupancyUV(h_zs5countsU, h_zs5countsV, nE, 6, 12, 4);
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");
275 if (h_found_tracksU) h_found_tracksU->Draw(
"colz");
277 if (h_found_tracksV) h_found_tracksV->Draw(
"colz");
279 if (h_matched_clusU) h_matched_clusU->Draw(
"colz");
281 if (h_matched_clusV) h_matched_clusV->Draw(
"colz");
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");
288 if (h_matched_clusV == NULL) {
289 B2INFO(
"Histograms needed for Average Efficiency on V side are not found");
293 std::pair<float, float> avgEffL3 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3);
296 std::pair<float, float> avgEffL4 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4);
299 std::pair<float, float> avgEffL5 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5);
302 std::pair<float, float> avgEffL6 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6);
306 std::pair<float, float> avgEffL3456 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV);
310 std::pair<float, float> avgEffL3X1 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, -1, 1);
314 std::pair<float, float> avgEffL3X2 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, -1, 2);
318 std::pair<float, float> avgEffL4X1 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, -1, 1);
322 std::pair<float, float> avgEffL4X2 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, -1, 2);
326 std::pair<float, float> avgEffL4X3 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, -1, 3);
330 std::pair<float, float> avgEffL5X1 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 1);
334 std::pair<float, float> avgEffL5X2 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 2);
338 std::pair<float, float> avgEffL5X3 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 3);
342 std::pair<float, float> avgEffL5X4 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, -1, 4);
346 std::pair<float, float> avgEffL6X1 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 1);
350 std::pair<float, float> avgEffL6X2 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 2);
354 std::pair<float, float> avgEffL6X3 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 3);
358 std::pair<float, float> avgEffL6X4 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 4);
362 std::pair<float, float> avgEffL6X5 =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, -1, 5);
366 std::pair<float, float> avgEffL311UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 1,
370 std::pair<float, float> avgEffL312UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 1,
374 std::pair<float, float> avgEffL321UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 2,
378 std::pair<float, float> avgEffL322UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 3, 2,
382 std::pair<float, float> avgEffL461UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 6,
386 std::pair<float, float> avgEffL462UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 6,
390 std::pair<float, float> avgEffL581UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 8,
394 std::pair<float, float> avgEffL582UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 8,
398 std::pair<float, float> avgEffL6101UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 10,
402 std::pair<float, float> avgEffL6102UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 10,
409 std::pair<float, float> avgEffL411UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 1,
413 std::pair<float, float> avgEffL4102UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 10,
418 std::pair<float, float> avgEffL433UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 4, 3,
422 std::pair<float, float> avgEffL513UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 1,
426 std::pair<float, float> avgEffL514UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 1,
430 std::pair<float, float> avgEffL592UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 9,
434 std::pair<float, float> avgEffL594UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 5, 9,
438 std::pair<float, float> avgEffL643UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 4,
442 std::pair<float, float> avgEffL664UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 6,
446 std::pair<float, float> avgEffL6103UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 10,
450 std::pair<float, float> avgEffL6115UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 11,
454 std::pair<float, float> avgEffL6124UV =
avgEfficiencyUV(h_matched_clusU, h_matched_clusV, h_found_tracksU, h_found_tracksV, 6, 12,
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");
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();
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);
494 if (h_clusterCharge_L3U == NULL || h_clusterCharge_L456U == NULL) {
495 B2INFO(
"Histograms needed for MPV cluster charge on U side are not found");
501 if (h_clusterCharge_L3V == NULL || h_clusterCharge_L456V == NULL) {
502 B2INFO(
"Histograms needed for MPV cluster charge on V side are not found");
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");
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();
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);
543 if (h_clusterSNR_L3U == NULL || h_clusterSNR_L456U == NULL) {
544 B2INFO(
"Histograms needed for MPV cluster SNR on U side are not found");
550 if (h_clusterSNR_L3V == NULL || h_clusterSNR_L456V == NULL) {
551 B2INFO(
"Histograms needed for MPV cluster SNR on V side are not found");
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;
567 if (h_MeanSVD3EventT0)
568 h_MeanSVDEventT0 = (TH1F*)h_MeanSVD3EventT0->Clone();
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();
584 if (h_MeanSVD3EventT0) h_MeanSVD3EventT0->Draw();
586 if (h_MeanSVD6EventT0) h_MeanSVD6EventT0->Draw();
588 if (h_MeanSVDEventT0) {
589 if (h_MeanSVD6EventT0)
590 h_MeanSVDEventT0->Add(h_MeanSVD6EventT0);
591 h_MeanSVDEventT0->Draw();
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);
627 float MeanSVD3EventT0 = nan;
628 if (h_MeanSVD3EventT0)
629 if (h_MeanSVD3EventT0->GetEntries() != 0)
630 MeanSVD3EventT0 =
xForMaxY(h_MeanSVD3EventT0);
632 float MeanSVD6EventT0 = nan;
633 if (h_MeanSVD6EventT0)
634 if (h_MeanSVD6EventT0->GetEntries() != 0)
635 MeanSVD6EventT0 =
xForMaxY(h_MeanSVD6EventT0);
637 float MeanSVDEventT0 = nan;
638 if (h_MeanSVDEventT0)
639 if (h_MeanSVDEventT0->GetEntries() != 0)
640 MeanSVDEventT0 =
xForMaxY(h_MeanSVDEventT0);
642 if (h_clusterTime_L3U == NULL || h_clusterTime_L456U == NULL) {
643 B2INFO(
"Histograms needed for MPV cluster time on U side are not found");
651 if (h_clusterTime_L3V == NULL || h_clusterTime_L456V == NULL) {
652 B2INFO(
"Histograms needed for MPV cluster time on V side are not found");
660 if (h_MeanSVD3EventT0 == NULL) {
661 B2INFO(
"Histograms needed for SVD Event T0 (3 samples) not found");
666 if (h_MeanSVD6EventT0 == NULL) {
667 B2INFO(
"Histograms needed for SVD Event T0 (6 samples) not found");
672 if (h_MeanSVDEventT0 == NULL) {
673 B2INFO(
"Histograms needed for SVD Event T0 (all samples) not found");
679 TH1F* h_maxBinU = (TH1F*)
findHist(
"SVDClsTrk/SVDTRK_StripMaxBinUAll");
680 TH1F* h_maxBinV = (TH1F*)
findHist(
"SVDClsTrk/SVDTRK_StripMaxBinVAll");
685 if (h_maxBinU) h_maxBinU->Draw();
687 if (h_maxBinV) h_maxBinV->Draw();
689 if (h_maxBinU == NULL) {
690 B2INFO(
"Histogram needed for Average MaxBin on U side is not found");
692 float avgMaxBinU = h_maxBinU->GetMean();
696 if (h_maxBinV == NULL) {
697 B2INFO(
"Histogram needed for Average MaxBin on V side is not found");
699 float avgMaxBinV = h_maxBinV->GetMean();
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}
711 for (
const auto& it : ladderMap) {
712 std::pair<int, int> p = it.first;
714 int sensor = p.second;
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;
721 if (h_clusterCharge->GetEntries() != 0)
722 MPVClusterCharge =
xForMaxY(h_clusterCharge);
724 if (h_clusterCharge == NULL) {
725 B2INFO(
"Histograms needed for cluster charge not found");
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;
735 if (h_clusterSNR->GetEntries() != 0)
736 MPVClusterSNR =
xForMaxY(h_clusterSNR);
738 if (h_clusterSNR == NULL) {
739 B2INFO(
"Histograms needed for cluster SNR not found");
745 for (
int ladder = 1; ladder <= 2; ++ladder) {
746 for (
int sensor = 1; sensor <= 2; ++sensor) {
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());
753 if (h_clusterCharge->GetEntries() != 0)
754 MPVClusterCharge =
xForMaxY(h_clusterCharge);
756 if (h_clusterCharge == NULL) {
757 B2INFO(
"Histograms needed for cluster charge not found");
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;
767 if (h_clusterSNR->GetEntries() != 0)
768 MPVClusterSNR =
xForMaxY(h_clusterSNR);
770 if (h_clusterSNR == NULL) {
771 B2INFO(
"Histograms needed for cluster SNR not found");
778 B2INFO(
"DQMHistAnalysisSVDGeneral: endRun called");
784 B2INFO(
"DQMHistAnalysisSVDOnMiraBelle: terminate called");
788 int layer,
int ladder,
int sensor)
const
793 }
else if (layer >= 4 && layer <= 6) {
796 B2DEBUG(20,
"Layer out of range [3,6].");
798 std::pair<float, float> avgOffOccUV(0.0, 0.0);
804 if (ladder == 0) ladder = -1;
806 for (
int layerId = minLayer; layerId < maxLayer + 1; ++layerId) {
807 int minLadder = (ladder != -1) ? ladder : 1;
810 int minSensor = (sensor != -1) ? sensor : 1;
813 for (
int sensorId = minSensor; sensorId < maxSensor + 1; ++sensorId) {
815 for (
int ladderId = minLadder; ladderId < maxLadder + 1; ++ladderId) {
818 avgOffOccUV.first += hU->GetBinContent(bin) / 768 * 100;
819 avgOffOccUV.second += hV->GetBinContent(bin) / nStripsV * 100;
825 avgOffOccUV.first /= (sensorsN * nEvents);
826 avgOffOccUV.second /= (sensorsN * nEvents);
836 }
else if (iLayer >= 4 && iLayer <= 6) {
839 B2DEBUG(20,
"Layer out of range [3,6].");
842 Int_t nStripsU = 768;
844 std::vector<float> avgOffOccU;
845 std::vector<float> avgOffOccV;
847 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
852 TString tmpnameGrpId0U = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
853 TH1F* htmpU = (TH1F*)
findHist(tmpnameGrpId0U.Data());
855 B2INFO(
"Occupancy U histogram for group Id0 not found");
857 if (tmp_layer == iLayer)
858 avgOffOccU.push_back(htmpU->GetEntries() / nStripsU / nEvents * 100);
861 TString tmpnameGrpId0V = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
862 TH1F* htmpV = (TH1F*)
findHist(tmpnameGrpId0V.Data());
864 B2INFO(
"Occupancy V histogram for group Id0 not found");
866 if (tmp_layer == iLayer)
867 avgOffOccV.push_back(htmpV->GetEntries() / nStripsV / nEvents * 100);
871 std::pair<float, float> avgOffOccUV(0., 0.);
873 avgOffOccUV.first = accumulate(avgOffOccU.begin(), avgOffOccU.end(), 0.0);
874 avgOffOccUV.first /= float(avgOffOccU.size());
876 avgOffOccUV.second = accumulate(avgOffOccV.begin(), avgOffOccV.end(), 0.0);
877 avgOffOccUV.second /= float(avgOffOccV.size());
884 int ladder,
int sensor)
const
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);
894 if (ladder == 0) ladder = -1;
896 for (
int layerId = minLayer; layerId < maxLayer + 1; ++layerId) {
897 int minLadder = (ladder != -1) ? ladder : 1;
900 int minSensor = (sensor != -1) ? sensor : 1;
903 for (
int sensorId = minSensor; sensorId < maxSensor + 1; ++sensorId) {
905 for (
int ladderId = minLadder; ladderId < maxLadder + 1; ++ladderId) {
906 int binY =
findBinY(layerId, sensorId);
907 int binXY = hMCV->FindBin(ladderId, binY);
909 sumMatchedClustersUV.first += hMCU->GetBinContent(binXY);
910 sumMatchedClustersUV.second += hMCV->GetBinContent(binXY);
911 sumFoundTracksUV.first += hFTU->GetBinContent(binXY);
912 sumFoundTracksUV.second += hFTV->GetBinContent(binXY);
917 if (sumFoundTracksUV.first > 0) {
918 avgEffUV.first = sumMatchedClustersUV.first / sumFoundTracksUV.first * 100;
920 avgEffUV.first = nan;
923 if (sumFoundTracksUV.second > 0) {
924 avgEffUV.second = sumMatchedClustersUV.second / sumFoundTracksUV.second * 100;
926 avgEffUV.second = nan;
935 size_t pos = name.find(
"UV");
937 if (pos != string::npos)
938 name.replace(pos, 2,
"");
946 int maxY = h->GetMaximumBin();
947 float xMaxY = h->GetXaxis()->GetBinCenter(maxY);
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);
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).
DQMHistAnalysisSVDOnMiraBelleModule()
Constructor.
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
TCanvas * m_c_MeanSVDEventT0
Mean Event T0 from SVD.
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.
~DQMHistAnalysisSVDOnMiraBelleModule()
Destructor.
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.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
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...
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
const GeoTools * getGeoTools()
Return a raw pointer to a GeoTools object.
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
#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.
Abstract base class for different kinds of events.