3 #include <qautils/QAHistManagerDef.h>
38 , _truth_jet(truth_jet)
44 , _jet_match_dE_Ratio(.5)
66 assert(it_jetevalstack->second);
79 _jettrutheval->set_strict(
true);
80 _jettrutheval->set_verbosity(
Verbosity() + 1);
95 std::cout <<
"QAG4SimulationJet::Init - Process TruthSpectrum " <<
_truth_jet
107 std::cout <<
"QAG4SimulationJet::Init - Process Reco jet spectrum "
108 << reco_jet << std::endl;
120 std::cout <<
"QAG4SimulationJet::Init - Process Reco jet spectrum "
121 << reco_jet << std::endl;
134 std::cout <<
"QAG4SimulationJet::process_event() entered" << std::endl;
137 for (jetevalstacks_map::iterator it_jetevalstack =
_jetevalstacks.begin();
140 assert(it_jetevalstack->second);
141 it_jetevalstack->second->next_event(topNode);
152 std::cout <<
"QAG4SimulationJet::process_event - Process TruthSpectrum "
165 <<
"QAG4SimulationJet::process_event - Process Reco jet spectrum "
166 << reco_jet << std::endl;
179 <<
"QAG4SimulationJet::process_event - Process Reco jet spectrum "
180 << reco_jet << std::endl;
208 return TString(Form(
"%.1f < %s < %.1f",
eta_range.first, eta_name,
eta_range.second));
225 if (src_jet_name.length() > 0)
227 histo_prefix += src_jet_name;
230 if (reco_jet_name.length() > 0)
232 histo_prefix += reco_jet_name;
246 const int norm_size = 3;
248 TH1D* h_norm =
new TH1D(
250 " Normalization;Item;Count", norm_size, .5, norm_size + .5);
253 h_norm->GetXaxis()->SetBinLabel(i++,
"Event");
254 h_norm->GetXaxis()->SetBinLabel(i++,
"Inclusive Jets");
255 h_norm->GetXaxis()->SetBinLabel(i++,
"Leading Jets");
256 assert(norm_size >= i - 1);
257 h_norm->GetXaxis()->LabelsOption(
"v");
263 TString(jet_name) +
" leading jet Et, " +
get_eta_range_str() +
";E_{T} (GeV)", 100, 0, 100));
267 TString(jet_name) +
" leading jet #eta, " +
get_eta_range_str() +
";#eta", 50, -1, 1));
271 TString(jet_name) +
" leading jet #phi, " +
get_eta_range_str() +
";#phi", 50, -M_PI, M_PI));
273 TH1F* lcomp =
new TH1F(
275 TString(jet_name) +
" leading jet # of component, " +
get_eta_range_str() +
";Number of component;", 100, 1, 3000);
282 TString(jet_name) +
" leading jet mass, " +
get_eta_range_str() +
";Jet Mass (GeV);", 100, 0, 20));
286 TString(jet_name) +
" leading jet EMCal ratio, " +
get_eta_range_str() +
";Energy ratio CEMC/Total;", 100, 0, 1.01));
290 TString(jet_name) +
" leading jet EMCal+HCal_{IN} ratio, " +
get_eta_range_str() +
";Energy ratio (CEMC + HCALIN)/Total;",
298 TString(jet_name) +
" leading jet leakage ratio, " +
get_eta_range_str() +
";Energy ratio, Back leakage/Total;", 100,
303 TString(jet_name) +
" inclusive jet E, " +
get_eta_range_str() +
";Total jet energy (GeV)", 100, 1
e-3, 100);
309 TString(jet_name) +
" inclusive jet #eta, " +
get_eta_range_str() +
";#eta;Jet energy density", 50, -1, 1));
313 TString(jet_name) +
" inclusive jet #phi, " +
get_eta_range_str() +
";#phi;Jet energy density", 50, -M_PI, M_PI));
319 const std::string& jet_name,
const bool is_reco_jet)
321 JetContainer* jets = findNode::getClass<JetContainer>(topNode, jet_name.c_str());
325 <<
"QAG4SimulationJet::process_Spectrum - Error can not find DST JetContainer node "
326 << jet_name << std::endl;
335 h_norm->Fill(
"Event", 1);
336 h_norm->Fill(
"Inclusive Jets", jets->
size());
338 TH1F* ie =
dynamic_cast<TH1F*
>(hm->
getHisto(
342 TH1F* ieta =
dynamic_cast<TH1F*
>(hm->
getHisto(
346 TH1F* iphi =
dynamic_cast<TH1F*
>(hm->
getHisto(
351 Jet* leading_jet =
nullptr;
353 for (
auto jet : *jets)
362 if (jet->get_et() > max_et)
368 ie->Fill(jet->get_e());
369 ieta->Fill(jet->get_eta());
370 iphi->Fill(jet->get_phi());
378 <<
"QAG4SimulationJet::process_Spectrum - processing leading jet with # comp = "
379 << leading_jet->
size_comp() << std::endl;
383 h_norm->Fill(
"Leading Jets", 1);
385 TH1F* let =
dynamic_cast<TH1F*
>(hm->
getHisto(
389 TH1F* leta =
dynamic_cast<TH1F*
>(hm->
getHisto(
393 TH1F* lphi =
dynamic_cast<TH1F*
>(hm->
getHisto(
398 TH1F* lcomp =
dynamic_cast<TH1F*
>(hm->
getHisto(
402 TH1F* lmass =
dynamic_cast<TH1F*
>(hm->
getHisto(
406 TH1F* lcemcr =
dynamic_cast<TH1F*
>(hm->
getHisto(
410 TH1F* lemchcalr =
dynamic_cast<TH1F*
>(hm->
getHisto(
414 TH1F* lleak =
dynamic_cast<TH1F*
>(hm->
getHisto(
419 let->Fill(leading_jet->
get_et());
420 leta->Fill(leading_jet->
get_eta());
421 lphi->Fill(leading_jet->
get_phi());
423 lmass->Fill(leading_jet->
get_mass());
427 jetevalstacks_map::iterator it_stack =
_jetevalstacks.find(jet_name);
429 std::shared_ptr<JetEvalStack> eval_stack = it_stack->second;
431 JetRecoEval* recoeval = eval_stack->get_reco_eval();
436 std::cout << __PRETTY_FUNCTION__ <<
"Leading Jet " << jet_name <<
": ";
442 std::cout <<
"leading_jet->get_e() = " << leading_jet->
get_e() << std::endl;
451 leading_jet->
get_e());
465 leading_jet->
get_e());
477 std::set<PHG4Shower*> showers =
_jettrutheval->all_truth_showers(leading_jet);
479 for (
auto shower : showers)
483 std::cout << __PRETTY_FUNCTION__ <<
"Leading Truth Jet shower : ";
501 std::cout <<
"Shower cemc_e sum = "
510 std::cout <<
"Shower hcalin_e sum = "
517 std::cout <<
"Shower bh_e sum = "
531 std::cout <<
"cemc_e sum = " << cemc_e << std::endl;
532 std::cout <<
"hcalin_e sum = " << hcalin_e << std::endl;
533 std::cout <<
"leading_jet->get_e() = " << leading_jet->
get_e() << std::endl;
536 lcemcr->Fill(cemc_e / leading_jet->
get_e());
537 lemchcalr->Fill((cemc_e + hcalin_e) / leading_jet->
get_e());
538 lleak->Fill(bh_e / leading_jet->
get_e());
553 TString(reco_jet_name) +
" Matching Count, " +
get_eta_range_str() +
";E_{T, Truth} (GeV)", 20, 0, 100, 3, 0.5, 3.5);
554 h->GetYaxis()->SetBinLabel(1,
"Total");
555 h->GetYaxis()->SetBinLabel(2,
"Matched");
556 h->GetYaxis()->SetBinLabel(3,
"Unique Matched");
561 TString(reco_jet_name) +
" Matching Count, " +
get_eta_range_str() +
";E_{T, Reco} (GeV)", 20, 0, 100, 3, 0.5, 3.5);
562 h->GetYaxis()->SetBinLabel(1,
"Total");
563 h->GetYaxis()->SetBinLabel(2,
"Matched");
564 h->GetYaxis()->SetBinLabel(3,
"Unique Matched");
569 TString(reco_jet_name) +
" E_{T} difference, " +
get_eta_range_str() +
";E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}", 20, 0, 100, 100,
575 TString(reco_jet_name) +
" Jet Energy Difference, " +
get_eta_range_str() +
";E_{Truth} (GeV);E_{Reco} / E_{Truth}", 20, 0, 100, 100, 0, 2);
580 TString(reco_jet_name) +
" #eta difference, " +
get_eta_range_str() +
";E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}", 20, 0, 100, 200,
586 TString(reco_jet_name) +
" #phi difference, " +
get_eta_range_str() +
";E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)", 20, 0, 100,
603 TH2F* Matching_Count_Truth_Et =
dynamic_cast<TH2F*
>(hm->
getHisto(
606 assert(Matching_Count_Truth_Et);
607 TH2F* Matching_Count_Reco_Et =
dynamic_cast<TH2F*
>(hm->
getHisto(
610 assert(Matching_Count_Reco_Et);
611 TH2F* Matching_dEt =
dynamic_cast<TH2F*
>(hm->
getHisto(
615 TH2F* Matching_dE =
dynamic_cast<TH2F*
>(hm->
getHisto(
619 TH2F* Matching_dEta =
dynamic_cast<TH2F*
>(hm->
getHisto(
623 TH2F* Matching_dPhi =
dynamic_cast<TH2F*
>(hm->
getHisto(
628 jetevalstacks_map::iterator it_stack =
_jetevalstacks.find(reco_jet_name);
630 std::shared_ptr<JetEvalStack> eval_stack = it_stack->second;
632 JetRecoEval* recoeval = eval_stack->get_reco_eval();
640 <<
"QAG4SimulationJet::process_TruthMatching - Error can not find DST JetContainer node "
646 Jet* truthjet =
nullptr;
648 for (
auto jet : *truthjets)
657 if (jet->get_et() > max_et)
671 std::cout <<
"QAG4SimulationJet::process_TruthMatching - " <<
_truth_jet
672 <<
" process truth jet ";
677 Matching_Count_Truth_Et->Fill(truthjet->
get_et(),
"Total", 1);
683 std::cout <<
"QAG4SimulationJet::process_TruthMatching - " <<
_truth_jet
684 <<
" inclusively matched with best reco jet: ";
692 Matching_dPhi->Fill(truthjet->
get_et(), dPhi);
697 Matching_dEta->Fill(truthjet->
get_et(), dEta);
701 const double Et_r = recojet->
get_et() / (truthjet->
get_et() + 1
e-9);
702 const double E_r = recojet->
get_e() / (truthjet->
get_e() + 1
e-9);
703 Matching_dEt->Fill(truthjet->
get_et(), Et_r);
704 Matching_dE->Fill(truthjet->
get_et(), E_r);
710 Matching_Count_Truth_Et->Fill(truthjet->
get_et(),
727 std::cout <<
"QAG4SimulationJet::process_TruthMatching - " <<
_truth_jet
728 <<
" uniquely matched with reco jet: ";
740 const double E_r = recojet->
get_e() / (truthjet->
get_e() + 1
e-9);
745 Matching_Count_Truth_Et->Fill(truthjet->
get_et(),
746 "Unique Matched", 1);
759 JetContainer* recojets = findNode::getClass<JetContainer>(topNode, reco_jet_name);
763 <<
"QAG4SimulationJet::process_TruthMatching - Error can not find DST JetContainer node "
764 << reco_jet_name << std::endl;
769 Jet* recojet =
nullptr;
771 for (
auto jet : *recojets)
780 if (jet->get_et() > max_et)
792 std::cout <<
"QAG4SimulationJet::process_TruthMatching - " << reco_jet_name
793 <<
" process reco jet ";
797 Matching_Count_Reco_Et->Fill(recojet->
get_et(),
"Total", 1);
809 const double E_r = recojet->
get_e() / (truthjet1->
get_e() + 1
e-9);
815 Matching_Count_Reco_Et->Fill(recojet->
get_et(),
816 "Unique Matched", 1);
836 const double E_r = recojet->
get_e() / (truthjet2->
get_e() + 1
e-9);
842 Matching_Count_Reco_Et->Fill(recojet->
get_et(),