3 #include <qautils/QAHistManagerDef.h>
5 #include <kfparticle_sphenix/KFParticle_Container.h>
6 #include <kfparticle_sphenix/KFParticle_Tools.h>
30 #pragma GCC diagnostic push
31 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
32 #include <HepMC/GenEvent.h>
33 #include <HepMC/GenVertex.h>
34 #pragma GCC diagnostic pop
36 #include <HepMC/GenParticle.h>
37 #include <HepMC/IteratorRange.h>
42 #include <CLHEP/Vector/LorentzVector.h>
43 #include <CLHEP/Vector/ThreeVector.h>
75 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error : missing " <<
m_trackMapName << std::endl;
79 m_truthInfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
82 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error : missing G4TruthInfo" << std::endl;
105 ";Decay Time [ps];Entries", 100, 0, 1.5);
109 ";pT [GeV/c];Entries", 100, 0, 10);
113 ";#chi^{2}/NDF ;Entries", 100, 0, 5);
117 ";y;Entries", 100, -2, 2);
121 ";DCA [cm];Entries", 100, -0.05, 0.05);
125 ";pT [GeV/c];Entries", 100, 0, 10);
128 ";pT [GeV/c];Entries", 100, 0, 10);
131 ";pT [GeV/c];Entries", 100, 0, 10);
134 ";pT [GeV/c];Entries", 100, 0, 10);
138 ";DCA [cm];Entries", 100, -0.05, 0.05);
141 ";DCA [cm];Entries", 100, -0.05, 0.05);
144 ";DCA [cm];Entries", 100, -0.05, 0.05);
147 ";DCA [cm];Entries", 100, -0.05, 0.05);
156 std::cout <<
"QAG4SimulationKFParticle::process_event() entered" << std::endl;
181 TH1F *h_Daughter1_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter1_DCA_XY_Mother"));
182 assert(h_Daughter1_DCA_XY_Mother);
185 TH1F *h_Daughter2_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter2_DCA_XY_Mother"));
186 assert(h_Daughter2_DCA_XY_Mother);
189 TH1F *h_Daughter3_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter3_DCA_XY_Mother"));
190 assert(h_Daughter3_DCA_XY_Mother);
193 TH1F *h_Daughter4_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter4_DCA_XY_Mother"));
194 assert(h_Daughter4_DCA_XY_Mother);
199 std::vector<CLHEP::HepLorentzVector> daughters;
203 CLHEP::HepLorentzVector *theVector =
makeHepLV(topNode, thisTrack->
get_id());
204 if (theVector) daughters.push_back(*theVector);
207 CLHEP::HepLorentzVector mother;
208 if (daughters.size() >= 2)
210 for (CLHEP::HepLorentzVector daughter : daughters)
216 h_mass->Fill(mother.m());
220 float m_calculated_mother_decaytime = -1;
221 float m_calculated_mother_decaytime_err = -1;
222 const float speedOfLight = 2.99792458e-1;
225 std::vector<int> d_id;
232 if (d_id.size() == 0)
234 d_id.push_back(abs(iter->second->GetPDG()));
238 for (
unsigned int j = 0;
j < d_id.size(); ++
j)
240 if (abs(iter->second->GetPDG()) == d_id[
j])
244 else if (j == d_id.size() - 1)
246 d_id.push_back(abs(iter->second->GetPDG()));
258 h_mass_KFP->Fill(iter->second->GetMass());
260 h_pT->Fill(iter->second->GetPt());
261 h_Chi2_NDF->Fill(iter->second->Chi2() / iter->second->NDF());
262 h_Rapidity->Fill(iter->second->GetRapidity());
264 int bestCombinationIndex = 0;
265 if (vertex_vec.size() > 0)
267 for (
unsigned int i = 1;
i < vertex_vec.size(); ++
i)
269 if (iter->second->GetDeviationFromVertex(vertex_vec[
i]) <
270 iter->second->GetDeviationFromVertex(vertex_vec[bestCombinationIndex]))
272 bestCombinationIndex =
i;
275 h_Mother_DCA_XY->Fill(iter->second->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
277 iter->second->SetProductionVertex(vertex_vec[bestCombinationIndex]);
278 iter->second->GetLifeTime(m_calculated_mother_decaytime, m_calculated_mother_decaytime_err);
280 m_calculated_mother_decaytime /= speedOfLight;
283 h_DecayTime->Fill(m_calculated_mother_decaytime);
285 for (
unsigned int i = 0;
i < d_id.size(); ++
i)
288 for (
auto &[key, part] : D_Map)
292 h_Daughter1_pT->Fill(part->GetPt());
293 h_Daughter1_DCA_XY_Mother->Fill(part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
297 h_Daughter2_pT->Fill(part->GetPt());
298 h_Daughter2_DCA_XY_Mother->Fill(part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
302 h_Daughter3_pT->Fill(part->GetPt());
303 h_Daughter3_DCA_XY_Mother->Fill(part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
307 h_Daughter4_pT->Fill(part->GetPt());
308 h_Daughter4_DCA_XY_Mother->Fill(part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
323 iter != trackmap->
end();
326 if (iter->first == track_id) matched_track = iter->second;
329 return matched_track;
349 CLHEP::HepLorentzVector *lvParticle = NULL;
351 PHHepMCGenEventMap *m_geneventmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
354 std::cout <<
"Missing node PHHepMCGenEventMap" << std::endl;
355 std::cout <<
"You will have no mother information" << std::endl;
362 std::cout <<
"Missing node PHHepMCGenEvent" << std::endl;
363 std::cout <<
"You will have no mother information" << std::endl;
367 HepMC::GenEvent *theEvent = m_genevt->
getEvent();
369 bool breakOut =
false;
370 for (HepMC::GenEvent::particle_const_iterator
p = theEvent->particles_begin();
p != theEvent->particles_end(); ++
p)
375 for (HepMC::GenVertex::particle_iterator mother = (*p)->production_vertex()->particles_begin(HepMC::parents);
376 mother != (*p)->production_vertex()->particles_end(HepMC::parents); ++mother)
380 lvParticle =
new CLHEP::HepLorentzVector();
397 m_truthContainer = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
400 std::cout <<
"QAG4SimulationTracking::load_nodes - Fatal Error - "
401 <<
"unable to find DST node "
402 <<
"G4TruthInfo" << std::endl;
408 std::cout <<
m_mother_name.c_str() <<
"_KFParticle_Container - Fatal Error - "
409 <<
"unable to find DST node "
410 <<
"G4_QA" << std::endl;