14 #include <dqm/analysis/modules/DQMHistAnalysisTRG.h>
30 DQMHistAnalysisTRGModule::DQMHistAnalysisTRGModule()
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, 10000, 1);
150 addDeltaPar(
"softwaretrigger",
"skim", HistDelta::c_Entries, 10000, 1);
154 addDeltaPar(
"softwaretrigger",
"skim", HistDelta::c_Entries, 10000, 1);
159 addDeltaPar(
"TRG",
"h_TCId", HistDelta::c_Entries, 1000, 1);
163 addDeltaPar(
"TRG",
"h_n_TChit_event_clkgrp", HistDelta::c_Entries, 10000, 1);
167 addDeltaPar(
"TRG",
"h_n_TChit_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
172 addDeltaPar(
"TRG",
"h_n_TChit_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
176 addDeltaPar(
"TRG",
"h_n_TChit_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
180 addDeltaPar(
"TRG",
"h_n_TChit_FWD_event_clkgrp", HistDelta::c_Entries, 10000, 1);
184 addDeltaPar(
"TRG",
"h_n_TChit_FWD_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
186 "ECLTRG_meanTC_FWD_clean");
188 "ECLTRG_tailTC_FWD_clean");
191 addDeltaPar(
"TRG",
"h_n_TChit_FWD_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
195 addDeltaPar(
"TRG",
"h_n_TChit_FWD_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
199 addDeltaPar(
"TRG",
"h_n_TChit_BRL_event_clkgrp", HistDelta::c_Entries, 10000, 1);
203 addDeltaPar(
"TRG",
"h_n_TChit_BRL_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
205 "ECLTRG_meanTC_BRL_clean");
207 "ECLTRG_tailTC_BRL_clean");
210 addDeltaPar(
"TRG",
"h_n_TChit_BRL_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
214 addDeltaPar(
"TRG",
"h_n_TChit_BRL_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
218 addDeltaPar(
"TRG",
"h_n_TChit_BWD_event_clkgrp", HistDelta::c_Entries, 10000, 1);
222 addDeltaPar(
"TRG",
"h_n_TChit_BWD_clean_clkgrp", HistDelta::c_Entries, 10000, 1);
224 "ECLTRG_meanTC_BWD_clean");
226 "ECLTRG_tailTC_BWD_clean");
229 addDeltaPar(
"TRG",
"h_n_TChit_BWD_injHER_clkgrp", HistDelta::c_Entries, 10000, 1);
233 addDeltaPar(
"TRG",
"h_n_TChit_BWD_injLER_clkgrp", HistDelta::c_Entries, 10000, 1);
238 addDeltaPar(
"TRGCDCTNN",
"NeuroHWInTSID", HistDelta::c_Entries, 159778, 1);
248 B2DEBUG(1,
"DQMHistAnalysisTRGModule: beginRun called.");
253 B2DEBUG(1,
"DQMHistAnalysisTRGModule: endRun called.");
258 B2DEBUG(1,
"DQMHistAnalysisTRGModule: event called.");
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);
279 auto hist =
getDelta(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_ECLTRG", 0,
true);
281 double ECLTRG_timing_mean = 0.0;
283 ECLTRG_timing_mean = hist->GetMean();
284 B2DEBUG(1,
"ECLTRG_timing_mean:" << ECLTRG_timing_mean);
285 setEpicsPV(
"ECLTRG_timing_mean", ECLTRG_timing_mean);
290 auto histCDCTRG =
getDelta(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_CDCTRG", 0,
true);
292 double CDCTRG_timing_mean = 0.0;
294 CDCTRG_timing_mean = histCDCTRG->GetMean();
295 B2DEBUG(1,
"CDCTRG_timing_mean:" << CDCTRG_timing_mean);
296 setEpicsPV(
"CDCTRG_timing_mean", CDCTRG_timing_mean);
300 auto histTOPTRG =
getDelta(
"EventT0DQMdir",
"m_histEventT0_TOP_hadron_L1_TOPTRG", 0,
true);
302 double TOPTRG_timing_mean = 0.0;
304 TOPTRG_timing_mean = histTOPTRG->GetMean();
305 B2DEBUG(1,
"TOPTRG_timing_mean:" << TOPTRG_timing_mean);
306 setEpicsPV(
"TOPTRG_timing_mean", TOPTRG_timing_mean);
310 auto hist_ECLTRG_peak =
getDelta(
"TRGGRL",
"h_ECLL1", 0,
true);
311 if (hist_ECLTRG_peak) {
312 double ECLTRG_peak = 0.0;
313 hist_ECLTRG_peak->Draw();
314 int bin_ECLTRG_peak = hist_ECLTRG_peak->GetMaximumBin();
315 ECLTRG_peak = hist_ECLTRG_peak->GetXaxis()->GetBinCenter(bin_ECLTRG_peak);
316 B2DEBUG(1,
"ECLTRG_peak:" << ECLTRG_peak);
322 auto hist_ECLTRG_deadch =
getDelta(
"TRG",
"h_TCId", 0,
true);
323 if (hist_ECLTRG_deadch) {
324 hist_ECLTRG_deadch->Draw();
325 int numberOfBins = hist_ECLTRG_deadch->GetNbinsX();
327 int ECLTRG_deadch = 0;
328 for (
int i = 2; i <= numberOfBins; i++) {
329 if (hist_ECLTRG_deadch->GetBinContent(i) <= 0) { ECLTRG_deadch += 1; }
331 B2DEBUG(1,
"ECLTRG_deadch:" << ECLTRG_deadch);
337 auto hist_CDCTRG_2D_peak =
getDelta(
"TRGGRL",
"h_CDCL1", 0,
true);
338 if (hist_CDCTRG_2D_peak) {
339 double CDCTRG_2D_peak = 0.0;
340 hist_CDCTRG_2D_peak->Draw();
341 int bin_CDCTRG_2D_peak = hist_CDCTRG_2D_peak->GetMaximumBin();
342 CDCTRG_2D_peak = hist_CDCTRG_2D_peak->GetXaxis()->GetBinCenter(bin_CDCTRG_2D_peak);
343 B2DEBUG(1,
"CDCTRG_2D_peak:" << CDCTRG_2D_peak);
349 auto hist_NN_peak =
getDelta(
"TRGGRL",
"h_CDCNNL1", 0,
true);
351 double NN_peak = 0.0;
352 hist_NN_peak->Draw();
353 int bin_NN_peak = hist_NN_peak->GetMaximumBin();
354 NN_peak = hist_NN_peak->GetXaxis()->GetBinCenter(bin_NN_peak);
355 B2DEBUG(1,
"NN_peak:" << NN_peak);
361 auto hist_CDCTRG_TSF_peak =
getDelta(
"TRGGRL",
"h_TSFL1", 0,
true);
362 if (hist_CDCTRG_TSF_peak) {
363 double CDCTRG_TSF_peak = 0.0;
364 hist_CDCTRG_TSF_peak->Draw();
365 int bin_CDCTRG_TSF_peak = hist_CDCTRG_TSF_peak->GetMaximumBin();
366 CDCTRG_TSF_peak = hist_CDCTRG_TSF_peak->GetXaxis()->GetBinCenter(bin_CDCTRG_TSF_peak);
367 B2DEBUG(1,
"CDCTRG_TSF_peak:" << CDCTRG_TSF_peak);
368 setEpicsPV(
"CDCTRG_TSF_peak", CDCTRG_TSF_peak);
373 auto hist_CDCTRG_deadch =
getDelta(
"TRGCDCTNN",
"NeuroHWInTSID", 0,
true);
374 if (hist_CDCTRG_deadch) {
375 hist_CDCTRG_deadch->Draw();
376 int numberOfBins = hist_CDCTRG_deadch->GetNbinsX();
378 int CDCTRG_deadch = 0;
379 for (
int i = 3; i <= numberOfBins; i++) {
380 if (hist_CDCTRG_deadch->GetBinContent(i) <= 0) {CDCTRG_deadch += 1; }
382 B2DEBUG(1,
"CDCTRG_deadch:" << CDCTRG_deadch);
387 auto hist_KLMTRG_peak =
getDelta(
"TRGGRL",
"h_KLML1", 0,
true);
388 if (hist_KLMTRG_peak) {
389 double KLMTRG_peak = 0.0;
390 hist_KLMTRG_peak->Draw();
391 int bin_KLMTRG_peak = hist_KLMTRG_peak->GetMaximumBin();
392 KLMTRG_peak = hist_KLMTRG_peak->GetXaxis()->GetBinCenter(bin_KLMTRG_peak);
393 B2DEBUG(1,
"KLMTRG_peak:" << KLMTRG_peak);
399 auto hist_TOPTRG_peak =
getDelta(
"TRGGRL",
"h_TOPL1", 0,
true);
400 if (hist_TOPTRG_peak) {
401 double TOPTRG_peak = 0.0;
402 hist_TOPTRG_peak->Draw();
403 int bin_TOPTRG_peak = hist_TOPTRG_peak->GetMaximumBin();
404 TOPTRG_peak = hist_TOPTRG_peak->GetXaxis()->GetBinCenter(bin_TOPTRG_peak);
405 B2DEBUG(1,
"TOPTRG_peak:" << TOPTRG_peak);
411 auto hist_ecltiming_cdctiming =
getDelta(
"TRGGDL",
"hGDL_ns_cdcToecl_all", 0,
true);
412 if (hist_ecltiming_cdctiming) {
413 double ecltiming_cdctiming = 0.0;
414 hist_ecltiming_cdctiming->Draw();
415 int bin_ecltiming_cdctiming = hist_ecltiming_cdctiming->GetMaximumBin();
416 ecltiming_cdctiming = hist_ecltiming_cdctiming->GetXaxis()->GetBinCenter(bin_ecltiming_cdctiming);
417 B2DEBUG(1,
"ecltiming_cdctiming:" << ecltiming_cdctiming);
418 setEpicsPV(
"ecltiming_cdctiming", ecltiming_cdctiming);
422 auto hist_toptiming_ecltiming =
getDelta(
"TRGGDL",
"hGDL_ns_topToecl_all", 0,
true);
423 if (hist_toptiming_ecltiming) {
424 double toptiming_ecltiming = 0.0;
425 hist_toptiming_ecltiming->Draw();
426 int bin_toptiming_ecltiming = hist_toptiming_ecltiming->GetMaximumBin();
427 toptiming_ecltiming = hist_toptiming_ecltiming->GetXaxis()->GetBinCenter(bin_toptiming_ecltiming);
428 B2DEBUG(1,
"toptiming_ecltiming:" << toptiming_ecltiming);
429 setEpicsPV(
"toptiming_ecltiming", toptiming_ecltiming);
433 auto hist_toptiming_cdctiming =
getDelta(
"TRGGDL",
"hGDL_ns_topTocdc_all", 0,
true);
434 if (hist_toptiming_cdctiming) {
435 double toptiming_cdctiming = 0.0;
436 hist_toptiming_cdctiming->Draw();
437 int bin_toptiming_cdctiming = hist_toptiming_cdctiming->GetMaximumBin();
438 toptiming_cdctiming = hist_toptiming_cdctiming->GetXaxis()->GetBinCenter(bin_toptiming_cdctiming);
439 B2DEBUG(1,
"toptiming_cdctiming:" << toptiming_cdctiming);
440 setEpicsPV(
"toptiming_cdctiming", toptiming_cdctiming);
444 auto hist_gdll1_ecltiming =
getDelta(
"TRGGDL",
"hGDL_eclTogdlL1_all", 0,
true);
445 if (hist_gdll1_ecltiming) {
446 double gdll1_ecltiming = 0.0;
447 hist_gdll1_ecltiming->Draw();
448 int bin_gdll1_ecltiming = hist_gdll1_ecltiming->GetMaximumBin();
449 gdll1_ecltiming = hist_gdll1_ecltiming->GetXaxis()->GetBinCenter(bin_gdll1_ecltiming);
450 B2DEBUG(1,
"gdll1_ecltiming:" << gdll1_ecltiming);
451 setEpicsPV(
"gdll1_ecltiming", gdll1_ecltiming);
455 auto hist_gdll1_cdctiming =
getDelta(
"TRGGDL",
"hGDL_cdcTogdlL1_all", 0,
true);
456 if (hist_gdll1_cdctiming) {
457 double gdll1_cdctiming = 0.0;
458 hist_gdll1_cdctiming->Draw();
459 int bin_gdll1_cdctiming = hist_gdll1_cdctiming->GetMaximumBin();
460 gdll1_cdctiming = hist_gdll1_cdctiming->GetXaxis()->GetBinCenter(bin_gdll1_cdctiming);
461 B2DEBUG(1,
"gdll1_cdctiming:" << gdll1_cdctiming);
462 setEpicsPV(
"gdll1_cdctiming", gdll1_cdctiming);
466 auto hist_gdll1_toptiming =
getDelta(
"TRGGDL",
"hGDL_topTogdlL1_all", 0,
true);
467 if (hist_gdll1_toptiming) {
468 double gdll1_toptiming = 0.0;
469 hist_gdll1_toptiming->Draw();
470 int bin_gdll1_toptiming = hist_gdll1_toptiming->GetMaximumBin();
471 gdll1_toptiming = hist_gdll1_toptiming->GetXaxis()->GetBinCenter(bin_gdll1_toptiming);
472 B2DEBUG(1,
"gdll1_toptiming:" << gdll1_toptiming);
473 setEpicsPV(
"gdll1_toptiming", gdll1_toptiming);
477 auto hist_barrel_klm_latency =
getDelta(
"TRGGDL",
"hGDL_itd_klm_hit_rise_all", 0,
true);
478 if (hist_barrel_klm_latency) {
479 double barrel_klm_latency = 0.0;
480 hist_barrel_klm_latency->Draw();
481 int bin_barrel_klm_latency = hist_barrel_klm_latency->GetMaximumBin();
482 barrel_klm_latency = hist_barrel_klm_latency->GetXaxis()->GetBinCenter(bin_barrel_klm_latency);
483 B2DEBUG(1,
"barrel_klm_latency:" << barrel_klm_latency);
484 setEpicsPV(
"barrel_klm_latency", barrel_klm_latency);
488 auto hist_endcap_klm_latency =
getDelta(
"TRGGDL",
"hGDL_itd_eklm_hit_rise_all", 0,
true);
489 if (hist_endcap_klm_latency) {
490 double endcap_klm_latency = 0.0;
491 hist_endcap_klm_latency->Draw();
492 int bin_endcap_klm_latency = hist_endcap_klm_latency->GetMaximumBin();
493 endcap_klm_latency = hist_endcap_klm_latency->GetXaxis()->GetBinCenter(bin_endcap_klm_latency);
494 B2DEBUG(1,
"endcap_klm_latency:" << endcap_klm_latency);
495 setEpicsPV(
"endcap_klm_latency", endcap_klm_latency);
499 auto hist_hadronb2_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
500 if (hist_hadronb2_over_bhabha_all) {
501 hist_hadronb2_over_bhabha_all->Draw();
502 if (hist_hadronb2_over_bhabha_all->GetBinContent(hist_hadronb2_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
503 double hadronb2_over_bhabha_all = 0.0;
504 hadronb2_over_bhabha_all = hist_hadronb2_over_bhabha_all->GetBinContent(
505 hist_hadronb2_over_bhabha_all->GetXaxis()->FindBin(
"accept_hadronb2")) / hist_hadronb2_over_bhabha_all->GetBinContent(
506 hist_hadronb2_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
508 B2DEBUG(1,
"hadronb2_over_bhabha_all:" << hadronb2_over_bhabha_all);
509 setEpicsPV(
"hadronb2_over_bhabha_all", hadronb2_over_bhabha_all);
514 auto hist_mumu2trk_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
515 if (hist_mumu2trk_over_bhabha_all) {
516 hist_mumu2trk_over_bhabha_all->Draw();
517 if (hist_mumu2trk_over_bhabha_all->GetBinContent(hist_mumu2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
518 double mumu2trk_over_bhabha_all = 0.0;
519 mumu2trk_over_bhabha_all = hist_mumu2trk_over_bhabha_all->GetBinContent(
520 hist_mumu2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_mumu_2trk")) / hist_mumu2trk_over_bhabha_all->GetBinContent(
521 hist_mumu2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
522 B2DEBUG(1,
"mumu2trk_over_bhabha_all:" << mumu2trk_over_bhabha_all);
523 setEpicsPV(
"mumu2trk_over_bhabha_all", mumu2trk_over_bhabha_all);
529 auto hist_hadronb2_over_mumu2trk =
getDelta(
"softwaretrigger",
"skim", 0,
true);
530 if (hist_hadronb2_over_mumu2trk) {
531 hist_hadronb2_over_mumu2trk->Draw();
532 if (hist_hadronb2_over_mumu2trk->GetBinContent(
533 hist_hadronb2_over_mumu2trk->GetXaxis()->FindBin(
"accept_mumu_2trk")) != 0) {
534 double hadronb2_over_mumu2trk = 0.0;
535 hadronb2_over_mumu2trk = hist_hadronb2_over_mumu2trk->GetBinContent(
536 hist_hadronb2_over_mumu2trk->GetXaxis()->FindBin(
"accept_hadronb2")) / hist_hadronb2_over_mumu2trk->GetBinContent(
537 hist_hadronb2_over_mumu2trk->GetXaxis()->FindBin(
"accept_mumu_2trk"));
538 B2DEBUG(1,
"hadronb2_over_mumu2trk:" << hadronb2_over_mumu2trk);
539 setEpicsPV(
"hadronb2_over_mumu2trk", hadronb2_over_mumu2trk);
547 auto hist_mumu_tight_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
548 if (hist_mumu_tight_over_bhabha_all) {
549 hist_mumu_tight_over_bhabha_all->Draw();
550 if (hist_mumu_tight_over_bhabha_all->GetBinContent(
551 hist_mumu_tight_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
552 double mumu_tight_over_bhabha_all = 0.0;
553 mumu_tight_over_bhabha_all = hist_mumu_tight_over_bhabha_all->GetBinContent(
554 hist_mumu_tight_over_bhabha_all->GetXaxis()->FindBin(
"accept_mumutight")) / hist_mumu_tight_over_bhabha_all->GetBinContent(
555 hist_mumu_tight_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
556 B2DEBUG(1,
"mumu_tight_over_bhabha_all:" << mumu_tight_over_bhabha_all);
557 setEpicsPV(
"mumu_tight_over_bhabha_all", mumu_tight_over_bhabha_all);
563 auto hist_gammagamma_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
564 if (hist_gammagamma_over_bhabha_all) {
565 hist_gammagamma_over_bhabha_all->Draw();
566 if (hist_gammagamma_over_bhabha_all->GetBinContent(
567 hist_gammagamma_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
568 double gammagamma_over_bhabha_all = 0.0;
569 gammagamma_over_bhabha_all = hist_gammagamma_over_bhabha_all->GetBinContent(
570 hist_gammagamma_over_bhabha_all->GetXaxis()->FindBin(
"accept_gamma_gamma")) / hist_gammagamma_over_bhabha_all->GetBinContent(
571 hist_gammagamma_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
572 B2DEBUG(1,
"gammagamma_over_bhabha_all:" << gammagamma_over_bhabha_all);
573 setEpicsPV(
"gammagamma_over_bhabha_all", gammagamma_over_bhabha_all);
579 auto hist_tautau2trk_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
580 if (hist_tautau2trk_over_bhabha_all) {
581 hist_tautau2trk_over_bhabha_all->Draw();
582 if (hist_tautau2trk_over_bhabha_all->GetBinContent(
583 hist_tautau2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
584 double tautau2trk_over_bhabha_all = 0.0;
585 tautau2trk_over_bhabha_all = hist_tautau2trk_over_bhabha_all->GetBinContent(
586 hist_tautau2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_tau_2trk")) / hist_tautau2trk_over_bhabha_all->GetBinContent(
587 hist_tautau2trk_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
588 B2DEBUG(1,
"tautau2trk_over_bhabha_all:" << tautau2trk_over_bhabha_all);
589 setEpicsPV(
"tautau2trk_over_bhabha_all", tautau2trk_over_bhabha_all);
595 auto hist_hadron_over_bhabha_all =
getDelta(
"softwaretrigger",
"skim", 0,
true);
596 if (hist_hadron_over_bhabha_all) {
597 hist_hadron_over_bhabha_all->Draw();
598 if (hist_hadron_over_bhabha_all->GetBinContent(
599 hist_hadron_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all")) != 0) {
600 double hadron_over_bhabha_all = 0.0;
601 hadron_over_bhabha_all = hist_hadron_over_bhabha_all->GetBinContent(
602 hist_hadron_over_bhabha_all->GetXaxis()->FindBin(
"accept_hadron")) / hist_hadron_over_bhabha_all->GetBinContent(
603 hist_hadron_over_bhabha_all->GetXaxis()->FindBin(
"accept_bhabha_all"));
604 B2DEBUG(1,
"hadron_over_bhabha_all:" << hadron_over_bhabha_all);
605 setEpicsPV(
"hadron_over_bhabha_all", hadron_over_bhabha_all);
610 auto hist_nTSFHits_total =
getDelta(
"TRGGRL",
"h_wirecnt_sum", 0,
true);
611 if (hist_nTSFHits_total) {
612 double mean = hist_nTSFHits_total->GetMean();
613 B2DEBUG(1,
"CDCTRG_meanTSFHits_total:" << mean);
617 auto hist_nTSFHits_clean =
getDelta(
"TRGGRL",
"h_wirecnt_sum_clean", 0,
true);
618 if (hist_nTSFHits_clean) {
619 double mean = hist_nTSFHits_clean->GetMean();
620 B2DEBUG(1,
"CDCTRG_meanTSFHits_clean:" << mean);
623 double tail =
getThreshold(hist_nTSFHits_clean, 0.5, 0.02);
624 B2DEBUG(1,
"CDCTRG_tailTSFHits_clean:" << tail);
628 auto hist_nTSFHits_injHER =
getDelta(
"TRGGRL",
"h_wirecnt_sum_injHER", 0,
true);
629 if (hist_nTSFHits_injHER) {
630 double mean = hist_nTSFHits_injHER->GetMean();
631 B2DEBUG(1,
"CDCTRG_meanTSFHits_injHER:" << mean);
632 setEpicsPV(
"CDCTRG_meanTSFHits_injHER", mean);
635 auto hist_nTSFHits_injLER =
getDelta(
"TRGGRL",
"h_wirecnt_sum_injLER", 0,
true);
636 if (hist_nTSFHits_injLER) {
637 double mean = hist_nTSFHits_injLER->GetMean();
638 B2DEBUG(1,
"CDCTRG_meanTSFHits_injLER:" << mean);
639 setEpicsPV(
"CDCTRG_meanTSFHits_injLER", mean);
642 auto hist_nTC_total =
getDelta(
"TRG",
"h_n_TChit_event_clkgrp", 0,
true);
643 if (hist_nTC_total) {
644 double mean = hist_nTC_total->GetMean();
645 B2DEBUG(1,
"ECLTRG_meanTC_total:" << mean);
649 auto hist_nTC_clean =
getDelta(
"TRG",
"h_n_TChit_clean_clkgrp", 0,
true);
650 if (hist_nTC_clean) {
651 double mean = hist_nTC_clean->GetMean();
652 B2DEBUG(1,
"ECLTRG_meanTC_clean:" << mean);
656 B2DEBUG(1,
"ECLTRG_tailTC_clean:" << tail);
660 auto hist_nTC_injHER =
getDelta(
"TRG",
"h_n_TChit_injHER_clkgrp", 0,
true);
661 if (hist_nTC_injHER) {
662 double mean = hist_nTC_injHER->GetMean();
663 B2DEBUG(1,
"ECLTRG_meanTC_injHER:" << mean);
667 auto hist_nTC_injLER =
getDelta(
"TRG",
"h_n_TChit_injLER_clkgrp", 0,
true);
668 if (hist_nTC_injLER) {
669 double mean = hist_nTC_injLER->GetMean();
670 B2DEBUG(1,
"ECLTRG_meanTC_injLER:" << mean);
674 auto hist_nTC_FWD_total =
getDelta(
"TRG",
"h_n_TChit_FWD_event_clkgrp", 0,
true);
675 if (hist_nTC_FWD_total) {
676 double mean = hist_nTC_FWD_total->GetMean();
677 B2DEBUG(1,
"ECLTRG_meanTC_FWD_total:" << mean);
681 auto hist_nTC_FWD_clean =
getDelta(
"TRG",
"h_n_TChit_FWD_clean_clkgrp", 0,
true);
682 if (hist_nTC_FWD_clean) {
683 double mean = hist_nTC_FWD_clean->GetMean();
684 B2DEBUG(1,
"ECLTRG_meanTC_FWD_clean:" << mean);
688 B2DEBUG(1,
"ECLTRG_tailTC_FWD_clean:" << tail);
692 auto hist_nTC_FWD_injHER =
getDelta(
"TRG",
"h_n_TChit_FWD_injHER_clkgrp", 0,
true);
693 if (hist_nTC_FWD_injHER) {
694 double mean = hist_nTC_FWD_injHER->GetMean();
695 B2DEBUG(1,
"ECLTRG_meanTC_FWD_injHER:" << mean);
699 auto hist_nTC_FWD_injLER =
getDelta(
"TRG",
"h_n_TChit_FWD_injLER_clkgrp", 0,
true);
700 if (hist_nTC_FWD_injLER) {
701 double mean = hist_nTC_FWD_injLER->GetMean();
702 B2DEBUG(1,
"ECLTRG_meanTC_FWD_injLER:" << mean);
706 auto hist_nTC_BRL_total =
getDelta(
"TRG",
"h_n_TChit_BRL_event_clkgrp", 0,
true);
707 if (hist_nTC_BRL_total) {
708 double mean = hist_nTC_BRL_total->GetMean();
709 B2DEBUG(1,
"ECLTRG_meanTC_BRL_total:" << mean);
713 auto hist_nTC_BRL_clean =
getDelta(
"TRG",
"h_n_TChit_BRL_clean_clkgrp", 0,
true);
714 if (hist_nTC_BRL_clean) {
715 double mean = hist_nTC_BRL_clean->GetMean();
716 B2DEBUG(1,
"ECLTRG_meanTC_BRL_clean:" << mean);
720 B2DEBUG(1,
"ECLTRG_tailTC_BRL_clean:" << tail);
724 auto hist_nTC_BRL_injHER =
getDelta(
"TRG",
"h_n_TChit_BRL_injHER_clkgrp", 0,
true);
725 if (hist_nTC_BRL_injHER) {
726 double mean = hist_nTC_BRL_injHER->GetMean();
727 B2DEBUG(1,
"ECLTRG_meanTC_BRL_injHER:" << mean);
731 auto hist_nTC_BRL_injLER =
getDelta(
"TRG",
"h_n_TChit_BRL_injLER_clkgrp", 0,
true);
732 if (hist_nTC_BRL_injLER) {
733 double mean = hist_nTC_BRL_injLER->GetMean();
734 B2DEBUG(1,
"ECLTRG_meanTC_BRL_injLER:" << mean);
738 auto hist_nTC_BWD_total =
getDelta(
"TRG",
"h_n_TChit_BWD_event_clkgrp", 0,
true);
739 if (hist_nTC_BWD_total) {
740 double mean = hist_nTC_BWD_total->GetMean();
741 B2DEBUG(1,
"ECLTRG_meanTC_BWD_total:" << mean);
745 auto hist_nTC_BWD_clean =
getDelta(
"TRG",
"h_n_TChit_BWD_clean_clkgrp", 0,
true);
746 if (hist_nTC_BWD_clean) {
747 double mean = hist_nTC_BWD_clean->GetMean();
748 B2DEBUG(1,
"ECLTRG_meanTC_BWD_clean:" << mean);
752 B2DEBUG(1,
"ECLTRG_tailTC_BWD_clean:" << tail);
756 auto hist_nTC_BWD_injHER =
getDelta(
"TRG",
"h_n_TChit_BWD_injHER_clkgrp", 0,
true);
757 if (hist_nTC_BWD_injHER) {
758 double mean = hist_nTC_BWD_injHER->GetMean();
759 B2DEBUG(1,
"ECLTRG_meanTC_BWD_injHER:" << mean);
763 auto hist_nTC_BWD_injLER =
getDelta(
"TRG",
"h_n_TChit_BWD_injLER_clkgrp", 0,
true);
764 if (hist_nTC_BWD_injLER) {
765 double mean = hist_nTC_BWD_injLER->GetMean();
766 B2DEBUG(1,
"ECLTRG_meanTC_BWD_injLER:" << mean);
781 B2DEBUG(1,
"DQMHistAnalysisTRGModule: terminate called");
787 if (hist ==
nullptr)
return 0.;
790 int nbins = hist->GetNbinsX();
791 int width = nbins * widthFraction;
794 if (width <= 1) width = 2;
796 int meanbin = hist->GetXaxis()->FindBin(hist->GetMean());
798 for (
int i = meanbin - 1; 1 <= i && i <= meanbin - width; i--) {
800 movsum += hist->GetBinContent(i);
803 for (
int i = meanbin; i < nbins; i++) {
807 movsum += hist->GetBinContent(binIdx);
810 movsum += hist->GetBinContent(binIdx);
811 movsum -= hist->GetBinContent(binIdx - width);
814 if (movsum / num < lower_bound) {
815 return hist->GetBinCenter(binIdx);
818 return hist->GetXaxis()->GetBinCenter(nbins);
The base class for the histogram analysis module.
int registerEpicsPV(std::string pvname, std::string keyname="", bool update_pvs=true)
EPICS related Functions.
void addDeltaPar(const std::string &dirname, const std::string &histname, HistDelta::EDeltaType t, int p, unsigned int a=1)
Add Delta histogram parameters.
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.
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.
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.