14 #include <CLHEP/Vector/LorentzVector.h>
22 #include <TDatabasePDG.h>
33 , m_write_nTuple(
true)
35 , m_truth_info(nullptr)
36 , m_g4particle(nullptr)
37 , m_df_module_name(
"myFinder")
41 , m_write_QAHists(
true)
57 ";Mother PDG ID;Entries", 1000, -500, 500);
60 ";Mother Mass [GeV/c^{2}];Entries", 100, 0, 3);
63 ";Daughter Sum Mass [GeV/c^{2}];Entries", 100, 0, 3);
66 ";Mother Decay Length [cm];Entries", 50, 0, 1);
69 ";Mother Decay Time [s];Entries", 50, 0, 0.1);
72 ";Mother p_{x} [GeV/c];Entries", 100, 0, 10);
75 ";Mother p_{y} [GeV/c];Entries", 100, 0, 10);
78 ";Mother p_{z} [GeV/c];Entries", 100, 0, 10);
81 ";Mother p_{E} [GeV];Entries", 100, 0, 10);
84 ";Mother p_{T} [GeV/c];Entries", 100, 0, 10);
87 ";Mother #eta;Entries", 100, -3, 3);
90 for (
unsigned int i = 0;
i < 4; ++
i)
94 h =
new TH1F(TString(
get_histo_prefix()) + TString(track_number) +
"_PDG_ID",
95 ";Track PDG ID;Entries", 1000, -500, 500);
116 ";Track pT [GeV/c];Entries", 50, 0, 5);
119 ";Track Eta;Entries", 100, -3, 3);
122 ";Track Mass [GeV/c^{2}];Entries", 100, 0, 3);
127 ";#delta p_{x} [GeV/c];Entries", 100, 0, 10);
130 ";#delta p_{y} [GeV/c];Entries", 100, 0, 10);
133 ";#delta p_{z} [GeV/c];Entries", 100, 0, 10);
136 ";#delta p_{E} [GeV];Entries", 100, 0, 10);
140 ";Accept p_{x} 1pcnt;Entries", 2, 0, 1);
143 ";Accept p_{y} 1pcnt;Entries", 2, 0, 1);
146 ";Accept p_{z} 1pcnt;Entries", 2, 0, 1);
149 ";Accept p_{E} 1pcnt;Entries", 2, 0, 1);
153 ";Accept p_{x} 5pcnt;Entries", 2, 0, 1);
156 ";Accept p_{y} 5pcnt;Entries", 2, 0, 1);
159 ";Accept p_{z} 5pcnt;Entries", 2, 0, 1);
162 ";Accept p_{E} 5pcnt;Entries", 2, 0, 1);
166 ";Accept p_{x} 15pcnt;Entries", 2, 0, 1);
169 ";Accept p_{y} 15pcnt;Entries", 2, 0, 1);
172 ";Accept p_{z} 15pcnt;Entries", 2, 0, 1);
175 ";Accept p_{E} 15pcnt;Entries", 2, 0, 1);
179 ";Accept p_{T};Entries", 2, 0, 1);
182 ";Accept #eta;Entries", 2, 0, 1);
193 CLHEP::HepLorentzVector daughterSumLV;
203 assert(h_daughter_sum_mass);
205 assert(h_mother_decayLength);
207 assert(h_mother_decayTime);
230 assert(h_accept_px_1percent);
232 assert(h_accept_py_1percent);
234 assert(h_accept_pz_1percent);
236 assert(h_accept_pE_1percent);
238 assert(h_accept_px_5percent);
240 assert(h_accept_py_5percent);
242 assert(h_accept_pz_5percent);
244 assert(h_accept_pE_5percent);
246 assert(h_accept_px_15percent);
248 assert(h_accept_py_15percent);
250 assert(h_accept_pz_15percent);
252 assert(h_accept_pE_15percent);
338 if (motherBarcodes.size() == 1)
340 m_truth_info = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
343 std::cout <<
"truthDecayTester: Missing node G4TruthInfo" << std::endl;
347 unsigned int trackCounter = 0;
351 float daughter_x = 0;
352 float daughter_y = 0;
353 float daughter_z = 0;
357 iter != range.second; ++iter)
381 mother_x = mother_vtx->
get_x();
382 mother_y = mother_vtx->
get_y();
383 mother_z = mother_vtx->
get_z();
402 daughterSumLV += daughterLV;
404 m_track_eta[trackCounter] = daughterLV.pseudoRapidity();
413 daughter_x = daughter_vtx->
get_x();
414 daughter_y = daughter_vtx->
get_y();
415 daughter_z = daughter_vtx->
get_z();
448 m_mother_decayLength = sqrt(pow(daughter_x - mother_x, 2) + pow(daughter_y - mother_y, 2) + pow(daughter_z - mother_z, 2));
461 std::cout << h_mother_PDG_ID->Integral(h_mother_PDG_ID->FindFixBin(-500.), h_mother_PDG_ID->FindFixBin(500.) - 1) << std::endl;
543 std::cout <<
"You have more than one good decay in this event, this processing is not yet supported" << std::endl;
569 m_tree =
new TTree(
"truthDecayTester",
"truthDecayTester");
570 m_tree->OptimizeBaskets();
571 m_tree->SetAutoSave(-5e6);
575 m_tree->Branch(
"mother_mass", &
m_mother_mass,
"mother_mass/F");
579 m_tree->Branch(
"mother_px", &
m_mother_px,
"mother_px/F");
580 m_tree->Branch(
"mother_py", &
m_mother_py,
"mother_py/F");
581 m_tree->Branch(
"mother_pz", &
m_mother_pz,
"mother_pz/F");
582 m_tree->Branch(
"mother_pE", &
m_mother_pE,
"mother_pE/F");
583 m_tree->Branch(
"mother_pT", &
m_mother_pT,
"mother_pT/F");
584 m_tree->Branch(
"mother_eta", &
m_mother_eta,
"mother_eta/F");
591 m_tree->Branch(TString(track_number) +
"_PDG_ID", &
m_track_pdg_id[
i], TString(track_number) +
"_PDG_ID/I");
592 m_tree->Branch(TString(track_number) +
"_px", &
m_track_px[i], TString(track_number) +
"_px/F");
593 m_tree->Branch(TString(track_number) +
"_py", &
m_track_py[i], TString(track_number) +
"_py/F");
594 m_tree->Branch(TString(track_number) +
"_pz", &
m_track_pz[i], TString(track_number) +
"_pz/F");
595 m_tree->Branch(TString(track_number) +
"_pE", &
m_track_pE[i], TString(track_number) +
"_pE/F");
596 m_tree->Branch(TString(track_number) +
"_pT", &
m_track_pT[i], TString(track_number) +
"_pT/F");
597 m_tree->Branch(TString(track_number) +
"_eta", &
m_track_eta[i], TString(track_number) +
"_eta/F");
598 m_tree->Branch(TString(track_number) +
"_mass", &
m_track_mass[i], TString(track_number) +
"_mass/F");
599 m_tree->Branch(TString(track_number) +
"_mother_barcode", &
m_track_mother_barcode[i], TString(track_number) +
"_mother_barcode/I");
602 m_tree->Branch(
"delta_px", &
m_delta_px,
"delta_px/F");
603 m_tree->Branch(
"delta_py", &
m_delta_py,
"delta_py/F");
604 m_tree->Branch(
"delta_pz", &
m_delta_pz,
"delta_pz/F");
605 m_tree->Branch(
"delta_pE", &
m_delta_pE,
"delta_pE/F");
622 m_tree->Branch(
"accept_pT", &
m_accept_pT,
"accept_pT/O");
623 m_tree->Branch(
"accept_eta", &
m_accept_eta,
"accept_eta/O");
635 m_decayMap = findNode::getClass<DecayFinderContainer_v1>(topNode, node_name.c_str());
647 std::vector<int> m_motherBarcodes;
653 m_decayMap = findNode::getClass<DecayFinderContainer_v1>(topNode, node_name.c_str());
657 std::vector<std::pair<int, int>> decay = iter->second;
659 for (
unsigned int i = 0;
i < decay.size(); ++
i)
661 if (abs(decay[
i].second) == abs(
m_decay_pdg_id)) m_motherBarcodes.push_back(decay[
i].first);
665 return m_motherBarcodes;
670 return min <= value && value <= max;