3 #include <qa_modules/QAHistManagerDef.h>
12 #include <calobase/RawCluster.h>
13 #include <calobase/RawTower.h>
14 #include <calobase/RawTowerContainer.h>
15 #include <calobase/RawTowerGeomContainer.h>
44 :
SubsysReco(
"QAG4SimulationEicCalorimeterSum")
46 , m_TrackNodeName(
"TrackMap")
47 , _calo_name_cemc(
"CEMC")
48 , _calo_name_hcalin(
"HCALIN")
49 , _calo_name_hcalout(
"HCALOUT")
50 , _truth_container(nullptr)
61 cout <<
"QAG4SimulationEicCalorimeterSum::InitRun - Fatal Error - "
62 <<
"unable to find DST node "
63 <<
"G4TruthInfo" << endl;
109 h->GetXaxis()->SetBinLabel(i++,
"Event");
113 h->GetXaxis()->SetBinLabel(i++, (
_calo_name_cemc +
" Cluster").c_str());
116 h->GetXaxis()->SetBinLabel(i++,
"Track");
117 h->GetXaxis()->LabelsOption(
"v");
130 cout <<
"QAG4SimulationEicCalorimeterSum::Init - Process tower occupancies"
138 cout <<
"QAG4SimulationEicCalorimeterSum::Init - Process sampling fraction"
148 cout <<
"QAG4SimulationEicCalorimeterSum::process_event() entered" << endl;
186 TH1D *h_norm =
dynamic_cast<TH1D *
>(hm->
getHisto(
189 h_norm->Fill(
"Event", 1);
197 return "h_QAG4Sim_CalorimeterSum_";
207 assert(last_primary);
220 TString(
_calo_name_cemc.c_str()) +
" Tower Energy Distr. around Track Proj.;Polar distance / Tower width;Azimuthal distance / Tower width",
227 TString(
_calo_name_hcalin.c_str()) +
" Tower Energy Distr. around Track Proj.;Polar distance / Tower width;Azimuthal distance / Tower width",
234 TString(
_calo_name_hcalout.c_str()) +
" Tower Energy Distr. around Track Proj.;Polar distance / Tower width;Azimuthal distance / Tower width",
240 "Tower 3x3 sum /E_{Truth};#Sigma_{3x3}[E_{Tower}] / total truth energy",
245 "Tower 5x5 sum /E_{Truth};#Sigma_{5x5}[E_{Tower}] / total truth energy",
254 cout <<
"QAG4SimulationEicCalorimeterSum::process_event_TrackProj() entered"
269 TH1D *h_norm =
dynamic_cast<TH1D *
>(hm->
getHisto(
272 h_norm->Fill(
"Track", 1);
275 TH1F *hsum =
dynamic_cast<TH1F *
>(hm->
getHisto(
283 TH1F *hsum =
dynamic_cast<TH1F *
>(hm->
getHisto(
308 TH2F *h2_proj =
dynamic_cast<TH2F *
>(hm->
getHisto(
313 string towergeonodename =
"TOWERGEOM_" + detector;
315 topNode, towergeonodename.c_str());
323 string towernodename =
"TOWER_CALIB_" + detector;
325 towernodename.c_str());
330 cout << __PRETTY_FUNCTION__ <<
" - info - handling track track p = ("
332 << track->
get_pz() <<
"), v = (" << track->
get_x() <<
", "
333 << track->
get_z() <<
", " << track->
get_z() <<
")"
341 std::vector<double>
point;
342 point.assign(3, NAN);
348 if (std::isnan(point[0]) or std::isnan(point[1]) or std::isnan(point[2]))
356 assert(not std::isnan(point[0]));
357 assert(not std::isnan(point[1]));
358 assert(not std::isnan(point[2]));
364 double phi = atan2(y, x);
365 double eta = asinh(z / sqrt(x * x + y * y));
372 if (bineta > 1 and bineta < towergeo->get_etabins() - 1)
377 assert(etabin_width > 0);
378 assert(phibin_width > 0);
380 const double etabin_shift = (towergeo->
get_etacenter(bineta) -
eta) / etabin_width;
381 const double phibin_shift = (fmod(
387 cout << __PRETTY_FUNCTION__ <<
" - info - handling track proj. (" << x
388 <<
", " << y <<
", " << z <<
")"
389 <<
", eta " << eta <<
", phi" << phi
390 <<
", bineta " << bineta <<
" - ["
392 << towergeo->
get_etabounds(bineta).second <<
"], etabin_shift = "
393 << etabin_shift <<
", binphi " << binphi <<
" - ["
395 << towergeo->
get_phibounds(binphi).second <<
"], phibin_shift = "
396 << phibin_shift << endl;
398 const int bin_search_range = (
Max_N_Tower - 1) / 2;
399 for (
int iphi = binphi - bin_search_range; iphi <= binphi + bin_search_range;
402 for (
int ieta = bineta - bin_search_range;
403 ieta <= bineta + bin_search_range; ++ieta)
423 cout << __PRETTY_FUNCTION__ <<
" - info - processing tower"
424 <<
", bineta " << ieta <<
" - ["
428 << wrapphi <<
" - [" << towergeo->
get_phibounds(wrapphi).first
429 <<
", " << towergeo->
get_phibounds(wrapphi).second <<
"]" << endl;
436 cout << __PRETTY_FUNCTION__ <<
" - info - tower " << ieta <<
" "
437 << wrapphi <<
" energy = " << tower->
get_energy() << endl;
442 h2_proj->Fill(ieta - bineta + etabin_shift,
443 iphi - binphi + phibin_shift, energy);
481 70, 0, 70, 70, 0, 70));
487 70, 0, 70, 70, 0, 70));
491 "Total Cluster E_{Reco}/E_{Truth};Reco cluster energy sum / total truth energy",
510 cout <<
"QAG4SimulationEicCalorimeterSum::process_event_Cluster() entered"
527 const double cluster_cemc_e = cluster_cemc ? cluster_cemc->
get_energy() : 0;
528 const double cluster_hcalin_e =
529 cluster_hcalin ? cluster_hcalin->
get_energy() : 0;
530 const double cluster_hcalout_e =
531 cluster_hcalout ? cluster_hcalout->
get_energy() : 0;
533 if (cluster_cemc_e + cluster_hcalin_e > 0)
539 h2->Fill(cluster_cemc_e, cluster_hcalin_e);
541 TH1F *hr =
dynamic_cast<TH1F *
>(hm->
getHisto(
545 hr->Fill(cluster_cemc_e / (cluster_cemc_e + cluster_hcalin_e));
548 if (cluster_cemc_e + cluster_hcalin_e + cluster_hcalout_e > 0)
552 cout <<
"QAG4SimulationEicCalorimeterSum::process_event_Cluster - "
553 <<
" cluster_cemc_e = " << cluster_cemc_e
554 <<
" cluster_hcalin_e = " << cluster_hcalin_e
555 <<
" cluster_hcalout_e = " << cluster_hcalout_e <<
" hr = "
556 << (cluster_cemc_e + cluster_hcalin_e) / (cluster_cemc_e + cluster_hcalin_e + cluster_hcalout_e)
564 h2->Fill((cluster_cemc_e + cluster_hcalin_e), cluster_hcalout_e);
566 TH1F *hr =
dynamic_cast<TH1F *
>(hm->
getHisto(
571 (cluster_cemc_e + cluster_hcalin_e) / (cluster_cemc_e + cluster_hcalin_e + cluster_hcalout_e));
573 TH1F *hsum =
dynamic_cast<TH1F *
>(hm->
getHisto(
578 (cluster_cemc_e + cluster_hcalin_e + cluster_hcalout_e) / (primary->
get_e() + 1
e-9));