14#include <dqm/analysis/modules/DQMHistAnalysisTRG.h>
37 B2DEBUG(1,
"DQMHistAnalysisTRGModule: Constructor done.");
49 B2DEBUG(1,
"DQMHistAnalysisTRGModule: initialized.");
52 m_canvas =
new TCanvas(
"TRG/c_Test");
54 addDeltaPar(
"TRGGDL",
"hGDL_gdlL1TocomL1_all", HistDelta::c_Entries, 1000, 1);
58 addDeltaPar(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_ECLTRG", HistDelta::c_Entries, 1000, 1);
62 addDeltaPar(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_CDCTRG", HistDelta::c_Entries, 1000, 1);
66 addDeltaPar(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_TOPTRG", HistDelta::c_Entries, 1000, 1);
70 addDeltaPar(
"TRGGRL",
"h_ECLL1", HistDelta::c_Entries, 1000, 1);
75 addDeltaPar(
"TRGGRL",
"h_CDCL1", HistDelta::c_Entries, 1000, 1);
80 addDeltaPar(
"TRGGRL",
"h_CDCNNL1", HistDelta::c_Entries, 1000, 1);
84 addDeltaPar(
"TRGGRL",
"h_TSFL1", HistDelta::c_Entries, 1000, 1);
88 addDeltaPar(
"TRGGRL",
"h_KLML1", HistDelta::c_Entries, 1000, 1);
92 addDeltaPar(
"TRGGRL",
"h_TOPL1", HistDelta::c_Entries, 1000, 1);
96 addDeltaPar(
"TRGGRL",
"h_wirecnt_sum", HistDelta::c_Entries, 1000, 1);
100 addDeltaPar(
"TRGGRL",
"h_wirecnt_sum_clean", HistDelta::c_Entries, 1000, 1);
103 "CDCTRG_tailTSFHits_clean");
106 addDeltaPar(
"TRGGRL",
"h_wirecnt_sum_injHER", HistDelta::c_Entries, 1000, 1);
110 addDeltaPar(
"TRGGRL",
"h_wirecnt_sum_injLER", HistDelta::c_Entries, 1000, 1);
114 addDeltaPar(
"TRGGDL",
"hGDL_ns_cdcToecl_all", HistDelta::c_Entries, 1000, 1);
118 addDeltaPar(
"TRGGDL",
"hGDL_ns_topToecl_all", HistDelta::c_Entries, 1000, 1);
122 addDeltaPar(
"TRGGDL",
"hGDL_ns_topTocdc_all", HistDelta::c_Entries, 1000, 1);
126 addDeltaPar(
"TRGGDL",
"hGDL_eclTogdlL1_all", HistDelta::c_Entries, 1000, 1);
130 addDeltaPar(
"TRGGDL",
"hGDL_cdcTogdlL1_all", HistDelta::c_Entries, 1000, 1);
134 addDeltaPar(
"TRGGDL",
"hGDL_topTogdlL1_all", HistDelta::c_Entries, 1000, 1);
138 addDeltaPar(
"TRGGDL",
"hGDL_itd_klm_hit_rise_all", HistDelta::c_Entries, 1000, 1);
142 addDeltaPar(
"TRGGDL",
"hGDL_itd_eklm_hit_rise_all", HistDelta::c_Entries, 1000, 1);
146 addDeltaPar(
"softwaretrigger",
"skim", HistDelta::c_Entries, 1000000, 1);
150 addDeltaPar(
"softwaretrigger",
"skim", HistDelta::c_Entries, 1000000, 1);
154 addDeltaPar(
"softwaretrigger",
"skim", HistDelta::c_Entries, 1000000, 1);
158 addDeltaPar(
"TRG",
"h_TCId", HistDelta::c_Entries, 10000, 1);
162 addDeltaPar(
"TRG",
"h_n_TChit_event_clkgrp", HistDelta::c_Entries, 10000, 1);
166 addDeltaPar(
"TRG",
"h_n_TChit_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
171 addDeltaPar(
"TRG",
"h_n_TChit_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
175 addDeltaPar(
"TRG",
"h_n_TChit_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
179 addDeltaPar(
"TRG",
"h_n_TChit_FWD_event_clkgrp", HistDelta::c_Entries, 10000, 1);
183 addDeltaPar(
"TRG",
"h_n_TChit_FWD_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
185 "ECLTRG_meanTC_FWD_clean");
187 "ECLTRG_tailTC_FWD_clean");
190 addDeltaPar(
"TRG",
"h_n_TChit_FWD_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
194 addDeltaPar(
"TRG",
"h_n_TChit_FWD_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
198 addDeltaPar(
"TRG",
"h_n_TChit_BRL_event_clkgrp", HistDelta::c_Entries, 10000, 1);
202 addDeltaPar(
"TRG",
"h_n_TChit_BRL_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
204 "ECLTRG_meanTC_BRL_clean");
206 "ECLTRG_tailTC_BRL_clean");
209 addDeltaPar(
"TRG",
"h_n_TChit_BRL_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
213 addDeltaPar(
"TRG",
"h_n_TChit_BRL_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
217 addDeltaPar(
"TRG",
"h_n_TChit_BWD_event_clkgrp", HistDelta::c_Entries, 10000, 1);
221 addDeltaPar(
"TRG",
"h_n_TChit_BWD_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
223 "ECLTRG_meanTC_BWD_clean");
225 "ECLTRG_tailTC_BWD_clean");
228 addDeltaPar(
"TRG",
"h_n_TChit_BWD_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
232 addDeltaPar(
"TRG",
"h_n_TChit_BWD_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
237 addDeltaPar(
"TRGCDCTNN",
"NeuroHWInTSID", HistDelta::c_Entries, 100000, 1);
244 B2DEBUG(1,
"DQMHistAnalysisTRGModule: beginRun called.");
249 B2DEBUG(1,
"DQMHistAnalysisTRGModule: endRun called.");
254 B2DEBUG(1,
"DQMHistAnalysisTRGModule: event called.");
264 if (m_IsPhysicsRun ==
true) {
267 auto hist_comL1_GDLL1 =
getDelta(
"TRGGDL",
"hGDL_gdlL1TocomL1_all", 0,
true);
268 if (hist_comL1_GDLL1) {
269 double comL1_GDLL1_mean = 0.0;
270 hist_comL1_GDLL1->Draw();
271 comL1_GDLL1_mean = hist_comL1_GDLL1->GetMean();
272 B2DEBUG(1,
"comL1_GDLL1_mean:" << comL1_GDLL1_mean);
273 setEpicsPV(
"comL1_GDLL1_mean", comL1_GDLL1_mean);
277 auto hist =
getDelta(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_ECLTRG", 0,
true);
279 double ECLTRG_timing_mean = 0.0;
281 ECLTRG_timing_mean = hist->GetMean();
282 B2DEBUG(1,
"ECLTRG_timing_mean:" << ECLTRG_timing_mean);
283 setEpicsPV(
"ECLTRG_timing_mean", ECLTRG_timing_mean);
288 auto histCDCTRG =
getDelta(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_CDCTRG", 0,
true);
290 double CDCTRG_timing_mean = 0.0;
292 CDCTRG_timing_mean = histCDCTRG->GetMean();
293 B2DEBUG(1,
"CDCTRG_timing_mean:" << CDCTRG_timing_mean);
294 setEpicsPV(
"CDCTRG_timing_mean", CDCTRG_timing_mean);
298 auto histTOPTRG =
getDelta(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_TOPTRG", 0,
true);
300 double TOPTRG_timing_mean = 0.0;
302 TOPTRG_timing_mean = histTOPTRG->GetMean();
303 B2DEBUG(1,
"TOPTRG_timing_mean:" << TOPTRG_timing_mean);
304 setEpicsPV(
"TOPTRG_timing_mean", TOPTRG_timing_mean);
308 auto hist_ECLTRG_peak =
getDelta(
"TRGGRL",
"h_ECLL1", 0,
true);
309 if (hist_ECLTRG_peak) {
311 double ECLTRG_peak = 0.0;
312 hist_ECLTRG_peak->Draw();
315 ECLTRG_peak = hist_ECLTRG_peak->GetMean();
325 B2DEBUG(1,
"ECLTRG_peak:" << ECLTRG_peak);
331 auto hist_ECLTRG_deadch =
getDelta(
"TRG",
"h_TCId", 0,
true);
332 if (hist_ECLTRG_deadch) {
333 hist_ECLTRG_deadch->Draw();
334 int numberOfBins = hist_ECLTRG_deadch->GetNbinsX();
336 for (
int i = 80; i < 512; i++) {
337 average += hist_ECLTRG_deadch->GetBinContent(i);
339 average = 1.0 * average / (512 - 80);
340 int ECLTRG_deadch = 0;
344 for (
int i = 2; i <= numberOfBins - 1; i++) {
345 if (hist_ECLTRG_deadch->GetBinContent(i) <= 0.01 * average) { ECLTRG_deadch += 1; }
347 B2DEBUG(1,
"ECLTRG_deadch:" << ECLTRG_deadch);
352 auto hist_TOPTRG_deadch =
getDelta(
"TRGGRL",
"h_slot_TOP", 0,
true);
353 if (hist_TOPTRG_deadch) {
354 hist_TOPTRG_deadch->Draw();
355 int numberOfBins = hist_TOPTRG_deadch->GetNbinsX();
356 int TOPTRG_deadch = 0;
357 for (
int i = 2; i <= numberOfBins - 1; i++) {
358 if (hist_TOPTRG_deadch->GetBinContent(i) <= 0.01 * hist_TOPTRG_deadch->GetMaximum()) { TOPTRG_deadch += 1; }
360 B2DEBUG(1,
"TOPTRG_deadch:" << TOPTRG_deadch);
367 auto hist_CDCTRG_2D_peak =
getDelta(
"TRGGRL",
"h_CDCL1", 0,
true);
368 if (hist_CDCTRG_2D_peak) {
369 double CDCTRG_2D_peak = 0.0;
370 hist_CDCTRG_2D_peak->Draw();
371 int bin_CDCTRG_2D_peak = hist_CDCTRG_2D_peak->GetMaximumBin();
372 CDCTRG_2D_peak = hist_CDCTRG_2D_peak->GetXaxis()->GetBinCenter(bin_CDCTRG_2D_peak);
373 B2DEBUG(1,
"CDCTRG_2D_peak:" << CDCTRG_2D_peak);
379 auto hist_NN_peak =
getDelta(
"TRGGRL",
"h_CDCNNL1", 0,
true);
381 double NN_peak = 0.0;
382 hist_NN_peak->Draw();
383 int bin_NN_peak = hist_NN_peak->GetMaximumBin();
384 NN_peak = hist_NN_peak->GetXaxis()->GetBinCenter(bin_NN_peak);
385 B2DEBUG(1,
"NN_peak:" << NN_peak);
391 auto hist_CDCTRG_TSF_peak =
getDelta(
"TRGGRL",
"h_TSFL1", 0,
true);
392 if (hist_CDCTRG_TSF_peak) {
393 double CDCTRG_TSF_peak = 0.0;
394 hist_CDCTRG_TSF_peak->Draw();
395 int bin_CDCTRG_TSF_peak = hist_CDCTRG_TSF_peak->GetMaximumBin();
396 CDCTRG_TSF_peak = hist_CDCTRG_TSF_peak->GetXaxis()->GetBinCenter(bin_CDCTRG_TSF_peak);
397 B2DEBUG(1,
"CDCTRG_TSF_peak:" << CDCTRG_TSF_peak);
398 setEpicsPV(
"CDCTRG_TSF_peak", CDCTRG_TSF_peak);
403 auto hist_CDCTRG_deadch =
getDelta(
"TRGCDCTNN",
"NeuroHWInTSID", 0,
true);
404 if (hist_CDCTRG_deadch) {
405 hist_CDCTRG_deadch->Draw();
406 int numberOfBins = hist_CDCTRG_deadch->GetNbinsX();
408 int CDCTRG_deadch = 0;
409 for (
int i = 3; i <= numberOfBins; i++) {
410 if (hist_CDCTRG_deadch->GetBinContent(i) <= 0.01 * hist_CDCTRG_deadch->GetMaximum()) {CDCTRG_deadch += 1;}
413 B2DEBUG(1,
"CDCTRG_deadch:" << CDCTRG_deadch);
418 auto hist_KLMTRG_peak =
getDelta(
"TRGGRL",
"h_KLML1", 0,
true);
419 if (hist_KLMTRG_peak) {
420 double KLMTRG_peak = 0.0;
421 hist_KLMTRG_peak->Draw();
422 int bin_KLMTRG_peak = hist_KLMTRG_peak->GetMaximumBin();
423 KLMTRG_peak = hist_KLMTRG_peak->GetXaxis()->GetBinCenter(bin_KLMTRG_peak);
424 B2DEBUG(1,
"KLMTRG_peak:" << KLMTRG_peak);
430 auto hist_TOPTRG_peak =
getDelta(
"TRGGRL",
"h_TOPL1", 0,
true);
431 if (hist_TOPTRG_peak) {
432 double TOPTRG_peak = 0.0;
433 hist_TOPTRG_peak->Draw();
434 int bin_TOPTRG_peak = hist_TOPTRG_peak->GetMaximumBin();
435 TOPTRG_peak = hist_TOPTRG_peak->GetXaxis()->GetBinCenter(bin_TOPTRG_peak);
436 B2DEBUG(1,
"TOPTRG_peak:" << TOPTRG_peak);
442 auto hist_ecltiming_cdctiming =
getDelta(
"TRGGDL",
"hGDL_ns_cdcToecl_all", 0,
true);
443 if (hist_ecltiming_cdctiming) {
444 double ecltiming_cdctiming = 0.0;
445 hist_ecltiming_cdctiming->Draw();
446 int bin_ecltiming_cdctiming = hist_ecltiming_cdctiming->GetMaximumBin();
447 ecltiming_cdctiming = hist_ecltiming_cdctiming->GetXaxis()->GetBinCenter(bin_ecltiming_cdctiming);
448 B2DEBUG(1,
"ecltiming_cdctiming:" << ecltiming_cdctiming);
449 setEpicsPV(
"ecltiming_cdctiming", ecltiming_cdctiming);
453 auto hist_toptiming_ecltiming =
getDelta(
"TRGGDL",
"hGDL_ns_topToecl_all", 0,
true);
454 if (hist_toptiming_ecltiming) {
455 double toptiming_ecltiming = 0.0;
456 hist_toptiming_ecltiming->Draw();
457 int bin_toptiming_ecltiming = hist_toptiming_ecltiming->GetMaximumBin();
458 toptiming_ecltiming = hist_toptiming_ecltiming->GetXaxis()->GetBinCenter(bin_toptiming_ecltiming);
459 B2DEBUG(1,
"toptiming_ecltiming:" << toptiming_ecltiming);
460 setEpicsPV(
"toptiming_ecltiming", toptiming_ecltiming);
464 auto hist_toptiming_cdctiming =
getDelta(
"TRGGDL",
"hGDL_ns_topTocdc_all", 0,
true);
465 if (hist_toptiming_cdctiming) {
466 double toptiming_cdctiming = 0.0;
467 hist_toptiming_cdctiming->Draw();
468 int bin_toptiming_cdctiming = hist_toptiming_cdctiming->GetMaximumBin();
469 toptiming_cdctiming = hist_toptiming_cdctiming->GetXaxis()->GetBinCenter(bin_toptiming_cdctiming);
470 B2DEBUG(1,
"toptiming_cdctiming:" << toptiming_cdctiming);
471 setEpicsPV(
"toptiming_cdctiming", toptiming_cdctiming);
475 auto hist_gdll1_ecltiming =
getDelta(
"TRGGDL",
"hGDL_eclTogdlL1_all", 0,
true);
476 if (hist_gdll1_ecltiming) {
477 double gdll1_ecltiming = 0.0;
478 hist_gdll1_ecltiming->Draw();
479 int bin_gdll1_ecltiming = hist_gdll1_ecltiming->GetMaximumBin();
480 gdll1_ecltiming = hist_gdll1_ecltiming->GetXaxis()->GetBinCenter(bin_gdll1_ecltiming);
481 B2DEBUG(1,
"gdll1_ecltiming:" << gdll1_ecltiming);
482 setEpicsPV(
"gdll1_ecltiming", gdll1_ecltiming);
486 auto hist_gdll1_cdctiming =
getDelta(
"TRGGDL",
"hGDL_cdcTogdlL1_all", 0,
true);
487 if (hist_gdll1_cdctiming) {
488 double gdll1_cdctiming = 0.0;
489 hist_gdll1_cdctiming->Draw();
490 int bin_gdll1_cdctiming = hist_gdll1_cdctiming->GetMaximumBin();
491 gdll1_cdctiming = hist_gdll1_cdctiming->GetXaxis()->GetBinCenter(bin_gdll1_cdctiming);
492 B2DEBUG(1,
"gdll1_cdctiming:" << gdll1_cdctiming);
493 setEpicsPV(
"gdll1_cdctiming", gdll1_cdctiming);
497 auto hist_gdll1_toptiming =
getDelta(
"TRGGDL",
"hGDL_topTogdlL1_all", 0,
true);
498 if (hist_gdll1_toptiming) {
499 double gdll1_toptiming = 0.0;
500 hist_gdll1_toptiming->Draw();
501 int bin_gdll1_toptiming = hist_gdll1_toptiming->GetMaximumBin();
502 gdll1_toptiming = hist_gdll1_toptiming->GetXaxis()->GetBinCenter(bin_gdll1_toptiming);
503 B2DEBUG(1,
"gdll1_toptiming:" << gdll1_toptiming);
504 setEpicsPV(
"gdll1_toptiming", gdll1_toptiming);
508 auto hist_barrel_klm_latency =
getDelta(
"TRGGDL",
"hGDL_itd_klm_hit_rise_all", 0,
true);
509 if (hist_barrel_klm_latency) {
510 double barrel_klm_latency = 0.0;
511 hist_barrel_klm_latency->Draw();
512 int bin_barrel_klm_latency = hist_barrel_klm_latency->GetMaximumBin();
513 barrel_klm_latency = hist_barrel_klm_latency->GetXaxis()->GetBinCenter(bin_barrel_klm_latency);
514 B2DEBUG(1,
"barrel_klm_latency:" << barrel_klm_latency);
515 setEpicsPV(
"barrel_klm_latency", barrel_klm_latency);
519 auto hist_endcap_klm_latency =
getDelta(
"TRGGDL",
"hGDL_itd_eklm_hit_rise_all", 0,
true);
520 if (hist_endcap_klm_latency) {
521 double endcap_klm_latency = 0.0;
522 hist_endcap_klm_latency->Draw();
523 int bin_endcap_klm_latency = hist_endcap_klm_latency->GetMaximumBin();
524 endcap_klm_latency = hist_endcap_klm_latency->GetXaxis()->GetBinCenter(bin_endcap_klm_latency);
525 B2DEBUG(1,
"endcap_klm_latency:" << endcap_klm_latency);
526 setEpicsPV(
"endcap_klm_latency", endcap_klm_latency);
529 bool m_IsPhysicsRun_ratio = (
getRunType() ==
"physics");
530 if (m_IsPhysicsRun_ratio ==
true) {
534 auto hist_hadronb2_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
535 if (hist_hadronb2_over_bhabha_all) {
536 hist_hadronb2_over_bhabha_all->Draw();
537 if (hist_hadronb2_over_bhabha_all->GetBinContent(hist_hadronb2_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
538 double hadronb2_over_bhabha_all = 0.0;
539 hadronb2_over_bhabha_all = hist_hadronb2_over_bhabha_all->GetBinContent(
540 hist_hadronb2_over_bhabha_all->GetXaxis()->FindBin(
"accept_hadronb2")) / hist_hadronb2_over_bhabha_all->GetBinContent(
541 hist_hadronb2_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
543 B2DEBUG(1,
"hadronb2_over_bhabha_all:" << hadronb2_over_bhabha_all);
544 setEpicsPV(
"hadronb2_over_bhabha_all", hadronb2_over_bhabha_all);
549 auto hist_mumu2trk_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
550 if (hist_mumu2trk_over_bhabha_all) {
551 hist_mumu2trk_over_bhabha_all->Draw();
552 if (hist_mumu2trk_over_bhabha_all->GetBinContent(hist_mumu2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
553 double mumu2trk_over_bhabha_all = 0.0;
554 mumu2trk_over_bhabha_all = hist_mumu2trk_over_bhabha_all->GetBinContent(
555 hist_mumu2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_mumu_2trk")) / hist_mumu2trk_over_bhabha_all->GetBinContent(
556 hist_mumu2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
557 B2DEBUG(1,
"mumu2trk_over_bhabha_all:" << mumu2trk_over_bhabha_all);
558 setEpicsPV(
"mumu2trk_over_bhabha_all", mumu2trk_over_bhabha_all);
564 auto hist_hadronb2_over_mumu2trk =
getDelta(
"softwaretrigger",
"skim", 0,
true);
565 if (hist_hadronb2_over_mumu2trk) {
566 hist_hadronb2_over_mumu2trk->Draw();
567 if (hist_hadronb2_over_mumu2trk->GetBinContent(
568 hist_hadronb2_over_mumu2trk->GetXaxis()->FindBin(
"accept_mumu_2trk")) != 0) {
569 double hadronb2_over_mumu2trk = 0.0;
570 hadronb2_over_mumu2trk = hist_hadronb2_over_mumu2trk->GetBinContent(
571 hist_hadronb2_over_mumu2trk->GetXaxis()->FindBin(
"accept_hadronb2")) / hist_hadronb2_over_mumu2trk->GetBinContent(
572 hist_hadronb2_over_mumu2trk->GetXaxis()->FindBin(
"accept_mumu_2trk"));
573 B2DEBUG(1,
"hadronb2_over_mumu2trk:" << hadronb2_over_mumu2trk);
574 setEpicsPV(
"hadronb2_over_mumu2trk", hadronb2_over_mumu2trk);
582 auto hist_mumu_tight_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
583 if (hist_mumu_tight_over_bhabha_all) {
584 hist_mumu_tight_over_bhabha_all->Draw();
585 if (hist_mumu_tight_over_bhabha_all->GetBinContent(
586 hist_mumu_tight_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
587 double mumu_tight_over_bhabha_all = 0.0;
588 mumu_tight_over_bhabha_all = hist_mumu_tight_over_bhabha_all->GetBinContent(
589 hist_mumu_tight_over_bhabha_all->GetXaxis()->FindBin(
"accept_mumutight")) / hist_mumu_tight_over_bhabha_all->GetBinContent(
590 hist_mumu_tight_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
591 B2DEBUG(1,
"mumu_tight_over_bhabha_all:" << mumu_tight_over_bhabha_all);
592 setEpicsPV(
"mumu_tight_over_bhabha_all", mumu_tight_over_bhabha_all);
598 auto hist_gammagamma_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
599 if (hist_gammagamma_over_bhabha_all) {
600 hist_gammagamma_over_bhabha_all->Draw();
601 if (hist_gammagamma_over_bhabha_all->GetBinContent(
602 hist_gammagamma_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
603 double gammagamma_over_bhabha_all = 0.0;
604 gammagamma_over_bhabha_all = hist_gammagamma_over_bhabha_all->GetBinContent(
605 hist_gammagamma_over_bhabha_all->GetXaxis()->FindBin(
"accept_gamma_gamma")) / hist_gammagamma_over_bhabha_all->GetBinContent(
606 hist_gammagamma_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
607 B2DEBUG(1,
"gammagamma_over_bhabha_all:" << gammagamma_over_bhabha_all);
608 setEpicsPV(
"gammagamma_over_bhabha_all", gammagamma_over_bhabha_all);
614 auto hist_tautau2trk_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
615 if (hist_tautau2trk_over_bhabha_all) {
616 hist_tautau2trk_over_bhabha_all->Draw();
617 if (hist_tautau2trk_over_bhabha_all->GetBinContent(
618 hist_tautau2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
619 double tautau2trk_over_bhabha_all = 0.0;
620 tautau2trk_over_bhabha_all = hist_tautau2trk_over_bhabha_all->GetBinContent(
621 hist_tautau2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_tau_2trk")) / hist_tautau2trk_over_bhabha_all->GetBinContent(
622 hist_tautau2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
623 B2DEBUG(1,
"tautau2trk_over_bhabha_all:" << tautau2trk_over_bhabha_all);
624 setEpicsPV(
"tautau2trk_over_bhabha_all", tautau2trk_over_bhabha_all);
630 auto hist_hadron_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
631 if (hist_hadron_over_bhabha_all) {
632 hist_hadron_over_bhabha_all->Draw();
633 if (hist_hadron_over_bhabha_all->GetBinContent(
634 hist_hadron_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
635 double hadron_over_bhabha_all = 0.0;
636 hadron_over_bhabha_all = hist_hadron_over_bhabha_all->GetBinContent(
637 hist_hadron_over_bhabha_all->GetXaxis()->FindBin(
"accept_hadron")) / hist_hadron_over_bhabha_all->GetBinContent(
638 hist_hadron_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
639 B2DEBUG(1,
"hadron_over_bhabha_all:" << hadron_over_bhabha_all);
640 setEpicsPV(
"hadron_over_bhabha_all", hadron_over_bhabha_all);
647 auto hist_nTSFHits_total =
getDelta(
"TRGGRL",
"h_wirecnt_sum", 0,
true);
648 if (hist_nTSFHits_total) {
649 double mean = hist_nTSFHits_total->GetMean();
650 B2DEBUG(1,
"CDCTRG_meanTSFHits_total:" << mean);
654 auto hist_nTSFHits_clean =
getDelta(
"TRGGRL",
"h_wirecnt_sum_clean", 0,
true);
655 if (hist_nTSFHits_clean) {
656 double mean = hist_nTSFHits_clean->GetMean();
657 B2DEBUG(1,
"CDCTRG_meanTSFHits_clean:" << mean);
660 double tail =
getThreshold(hist_nTSFHits_clean, 0.5, 0.02);
661 B2DEBUG(1,
"CDCTRG_tailTSFHits_clean:" << tail);
665 auto hist_nTSFHits_injHER =
getDelta(
"TRGGRL",
"h_wirecnt_sum_injHER", 0,
true);
666 if (hist_nTSFHits_injHER) {
667 double mean = hist_nTSFHits_injHER->GetMean();
668 B2DEBUG(1,
"CDCTRG_meanTSFHits_injHER:" << mean);
669 setEpicsPV(
"CDCTRG_meanTSFHits_injHER", mean);
672 auto hist_nTSFHits_injLER =
getDelta(
"TRGGRL",
"h_wirecnt_sum_injLER", 0,
true);
673 if (hist_nTSFHits_injLER) {
674 double mean = hist_nTSFHits_injLER->GetMean();
675 B2DEBUG(1,
"CDCTRG_meanTSFHits_injLER:" << mean);
676 setEpicsPV(
"CDCTRG_meanTSFHits_injLER", mean);
679 auto hist_nTC_total =
getDelta(
"TRG",
"h_n_TChit_event_clkgrp", 0,
true);
680 if (hist_nTC_total) {
681 double mean = hist_nTC_total->GetMean();
682 B2DEBUG(1,
"ECLTRG_meanTC_total:" << mean);
686 auto hist_nTC_clean =
getDelta(
"TRG",
"h_n_TChit_clean_clkgrp", 0,
true);
687 if (hist_nTC_clean) {
688 double mean = hist_nTC_clean->GetMean();
689 B2DEBUG(1,
"ECLTRG_meanTC_clean:" << mean);
693 B2DEBUG(1,
"ECLTRG_tailTC_clean:" << tail);
697 auto hist_nTC_injHER =
getDelta(
"TRG",
"h_n_TChit_injHER_clkgrp", 0,
true);
698 if (hist_nTC_injHER) {
699 double mean = hist_nTC_injHER->GetMean();
700 B2DEBUG(1,
"ECLTRG_meanTC_injHER:" << mean);
704 auto hist_nTC_injLER =
getDelta(
"TRG",
"h_n_TChit_injLER_clkgrp", 0,
true);
705 if (hist_nTC_injLER) {
706 double mean = hist_nTC_injLER->GetMean();
707 B2DEBUG(1,
"ECLTRG_meanTC_injLER:" << mean);
711 auto hist_nTC_FWD_total =
getDelta(
"TRG",
"h_n_TChit_FWD_event_clkgrp", 0,
true);
712 if (hist_nTC_FWD_total) {
713 double mean = hist_nTC_FWD_total->GetMean();
714 B2DEBUG(1,
"ECLTRG_meanTC_FWD_total:" << mean);
718 auto hist_nTC_FWD_clean =
getDelta(
"TRG",
"h_n_TChit_FWD_clean_clkgrp", 0,
true);
719 if (hist_nTC_FWD_clean) {
720 double mean = hist_nTC_FWD_clean->GetMean();
721 B2DEBUG(1,
"ECLTRG_meanTC_FWD_clean:" << mean);
725 B2DEBUG(1,
"ECLTRG_tailTC_FWD_clean:" << tail);
729 auto hist_nTC_FWD_injHER =
getDelta(
"TRG",
"h_n_TChit_FWD_injHER_clkgrp", 0,
true);
730 if (hist_nTC_FWD_injHER) {
731 double mean = hist_nTC_FWD_injHER->GetMean();
732 B2DEBUG(1,
"ECLTRG_meanTC_FWD_injHER:" << mean);
736 auto hist_nTC_FWD_injLER =
getDelta(
"TRG",
"h_n_TChit_FWD_injLER_clkgrp", 0,
true);
737 if (hist_nTC_FWD_injLER) {
738 double mean = hist_nTC_FWD_injLER->GetMean();
739 B2DEBUG(1,
"ECLTRG_meanTC_FWD_injLER:" << mean);
743 auto hist_nTC_BRL_total =
getDelta(
"TRG",
"h_n_TChit_BRL_event_clkgrp", 0,
true);
744 if (hist_nTC_BRL_total) {
745 double mean = hist_nTC_BRL_total->GetMean();
746 B2DEBUG(1,
"ECLTRG_meanTC_BRL_total:" << mean);
750 auto hist_nTC_BRL_clean =
getDelta(
"TRG",
"h_n_TChit_BRL_clean_clkgrp", 0,
true);
751 if (hist_nTC_BRL_clean) {
752 double mean = hist_nTC_BRL_clean->GetMean();
753 B2DEBUG(1,
"ECLTRG_meanTC_BRL_clean:" << mean);
757 B2DEBUG(1,
"ECLTRG_tailTC_BRL_clean:" << tail);
761 auto hist_nTC_BRL_injHER =
getDelta(
"TRG",
"h_n_TChit_BRL_injHER_clkgrp", 0,
true);
762 if (hist_nTC_BRL_injHER) {
763 double mean = hist_nTC_BRL_injHER->GetMean();
764 B2DEBUG(1,
"ECLTRG_meanTC_BRL_injHER:" << mean);
768 auto hist_nTC_BRL_injLER =
getDelta(
"TRG",
"h_n_TChit_BRL_injLER_clkgrp", 0,
true);
769 if (hist_nTC_BRL_injLER) {
770 double mean = hist_nTC_BRL_injLER->GetMean();
771 B2DEBUG(1,
"ECLTRG_meanTC_BRL_injLER:" << mean);
775 auto hist_nTC_BWD_total =
getDelta(
"TRG",
"h_n_TChit_BWD_event_clkgrp", 0,
true);
776 if (hist_nTC_BWD_total) {
777 double mean = hist_nTC_BWD_total->GetMean();
778 B2DEBUG(1,
"ECLTRG_meanTC_BWD_total:" << mean);
782 auto hist_nTC_BWD_clean =
getDelta(
"TRG",
"h_n_TChit_BWD_clean_clkgrp", 0,
true);
783 if (hist_nTC_BWD_clean) {
784 double mean = hist_nTC_BWD_clean->GetMean();
785 B2DEBUG(1,
"ECLTRG_meanTC_BWD_clean:" << mean);
789 B2DEBUG(1,
"ECLTRG_tailTC_BWD_clean:" << tail);
793 auto hist_nTC_BWD_injHER =
getDelta(
"TRG",
"h_n_TChit_BWD_injHER_clkgrp", 0,
true);
794 if (hist_nTC_BWD_injHER) {
795 double mean = hist_nTC_BWD_injHER->GetMean();
796 B2DEBUG(1,
"ECLTRG_meanTC_BWD_injHER:" << mean);
800 auto hist_nTC_BWD_injLER =
getDelta(
"TRG",
"h_n_TChit_BWD_injLER_clkgrp", 0,
true);
801 if (hist_nTC_BWD_injLER) {
802 double mean = hist_nTC_BWD_injLER->GetMean();
803 B2DEBUG(1,
"ECLTRG_meanTC_BWD_injLER:" << mean);
819 B2DEBUG(1,
"DQMHistAnalysisTRGModule: terminate called");
825 if (hist ==
nullptr)
return 0.;
828 int nbins = hist->GetNbinsX();
829 int width = nbins * widthFraction;
832 if (width <= 1) width = 2;
834 int meanbin = hist->GetXaxis()->FindBin(hist->GetMean());
836 for (
int i = meanbin - 1; 1 <= i && i <= meanbin - width; i--) {
838 movsum += hist->GetBinContent(i);
841 for (
int i = meanbin; i < nbins; i++) {
845 movsum += hist->GetBinContent(binIdx);
848 movsum += hist->GetBinContent(binIdx);
849 movsum -= hist->GetBinContent(binIdx - width);
852 if (movsum / num < lower_bound) {
853 return hist->GetBinCenter(binIdx);
856 return hist->GetXaxis()->GetBinCenter(nbins);
The base class for the histogram analysis module.
void addDeltaPar(const std::string &dirname, const std::string &histname, HistDelta::EDeltaType t, int p, unsigned int a=1)
Add Delta histogram parameters.
static const std::string & getRunType(void)
Get the Run Type.
TH1 * getDelta(const std::string &fullname, int n=0, bool onlyIfUpdated=true)
Get Delta histogram.
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
void UpdateCanvas(std::string name, bool updated=true)
Mark canvas as updated (or not)
void terminate(void) override final
This method is called at the end of the event processing.
static double getThreshold(const TH1 *hist, const double lower_bound, const double widthFraction=0.01)
A utility function to find the location of the tail of histograms.
void initialize(void) override final
Initializer.
void endRun(void) override final
Called when run ends.
DQMHistAnalysisTRGModule()
Constructor.
std::string m_pvPrefix
prefix for EPICS PVs
TCanvas * m_canvas
Final Canvas.
void doHistAnalysis()
Do the actual processing.
~DQMHistAnalysisTRGModule()
Destructor.
void beginRun(void) override final
Called when entering a new run.
void event(void) override final
This method is called for each event.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.