5 #include <kfparticle_sphenix/KFParticle_Container.h>
6 #include <kfparticle_sphenix/KFParticle_Tools.h>
7 #include <kfparticle_sphenix/KFParticle_particleList.h>
29 #include <KFParticle.h>
31 #include <HepMC/GenEvent.h>
32 #include <HepMC/GenParticle.h>
33 #include <HepMC/GenVertex.h>
34 #include <HepMC/IteratorRange.h>
72 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error : missing " <<
m_trackMapName << std::endl;
76 m_truthInfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
79 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error : missing G4TruthInfo" << std::endl;
102 ";Decay Time [ps];Entries", 100, 0, 1.5);
106 ";pT [GeV/c];Entries", 100, 0, 10);
110 ";#chi^{2}/NDF ;Entries", 100, 0, 5);
114 ";y;Entries", 100, -2, 2);
118 ";DCA [cm];Entries", 100, -0.05, 0.05);
122 ";pT [GeV/c];Entries", 100, 0, 10);
125 ";pT [GeV/c];Entries", 100, 0, 10);
128 ";pT [GeV/c];Entries", 100, 0, 10);
131 ";pT [GeV/c];Entries", 100, 0, 10);
135 ";DCA [cm];Entries", 100, -0.05, 0.05);
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);
153 std::cout <<
"QAG4SimulationKFParticle::process_event() entered" << std::endl;
175 assert(h_Mother_DCA_XY);
177 assert(h_Daughter1_pT);
178 TH1F *h_Daughter1_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter1_DCA_XY_Mother"));
179 assert(h_Daughter1_DCA_XY_Mother);
181 assert(h_Daughter2_pT);
182 TH1F *h_Daughter2_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter2_DCA_XY_Mother"));
183 assert(h_Daughter2_DCA_XY_Mother);
185 assert(h_Daughter3_pT);
186 TH1F *h_Daughter3_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter3_DCA_XY_Mother"));
187 assert(h_Daughter3_DCA_XY_Mother);
189 assert(h_Daughter4_pT);
190 TH1F *h_Daughter4_DCA_XY_Mother =
dynamic_cast<TH1F *
>(hm->
getHisto(
get_histo_prefix() +
"Daughter4_DCA_XY_Mother"));
191 assert(h_Daughter4_DCA_XY_Mother);
196 std::vector<CLHEP::HepLorentzVector> daughters;
201 if (theVector) daughters.push_back(*theVector);
205 if (daughters.size() >= 2)
213 h_mass->Fill(mother.
m());
217 float m_calculated_mother_decaytime = -1;
218 float m_calculated_mother_decaytime_err = -1;
219 const float speedOfLight = 2.99792458e-1;
222 std::vector<int> d_id;
230 if (d_id.size() == 0)
232 d_id.push_back(
abs(iter->second->GetPDG()));
236 for (
unsigned int j = 0; j < d_id.size(); ++j)
238 if (
abs(iter->second->GetPDG()) == d_id[j])
242 else if (j == d_id.size() - 1)
244 d_id.push_back(
abs(iter->second->GetPDG()));
256 h_mass_KFP->Fill(iter->second->GetMass());
258 h_pT->Fill(iter->second->GetPt());
259 h_Chi2_NDF->Fill(iter->second->Chi2() / iter->second->NDF());
260 h_Rapidity->Fill(iter->second->GetRapidity());
262 int bestCombinationIndex = 0;
263 if (vertex_vec.size() > 0)
265 for (
unsigned int i = 1; i < vertex_vec.size(); ++i)
267 if (iter->second->GetDeviationFromVertex(vertex_vec[i]) <
268 iter->second->GetDeviationFromVertex(vertex_vec[bestCombinationIndex]))
270 bestCombinationIndex = i;
273 h_Mother_DCA_XY->Fill(iter->second->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
275 iter->second->SetProductionVertex(vertex_vec[bestCombinationIndex]);
276 iter->second->GetLifeTime(m_calculated_mother_decaytime, m_calculated_mother_decaytime_err);
278 m_calculated_mother_decaytime /= speedOfLight;
281 h_DecayTime->Fill(m_calculated_mother_decaytime);
283 for (
unsigned int i = 0; i < d_id.size(); ++i)
286 for (
auto &[key,
part] : D_Map)
290 h_Daughter1_pT->Fill(
part->GetPt());
291 h_Daughter1_DCA_XY_Mother->Fill(
part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
295 h_Daughter2_pT->Fill(
part->GetPt());
296 h_Daughter2_DCA_XY_Mother->Fill(
part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
300 h_Daughter3_pT->Fill(
part->GetPt());
301 h_Daughter3_DCA_XY_Mother->Fill(
part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
305 h_Daughter4_pT->Fill(
part->GetPt());
306 h_Daughter4_DCA_XY_Mother->Fill(
part->GetDistanceFromVertexXY(vertex_vec[bestCombinationIndex]));
321 iter != trackmap->
end();
324 if (iter->first == track_id) matched_track = iter->second;
327 return matched_track;
349 PHHepMCGenEventMap *m_geneventmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
352 std::cout <<
"Missing node PHHepMCGenEventMap" << std::endl;
353 std::cout <<
"You will have no mother information" << std::endl;
360 std::cout <<
"Missing node PHHepMCGenEvent" << std::endl;
361 std::cout <<
"You will have no mother information" << std::endl;
365 HepMC::GenEvent *theEvent = m_genevt->
getEvent();
367 bool breakOut =
false;
368 for (HepMC::GenEvent::particle_const_iterator
p = theEvent->particles_begin();
p != theEvent->particles_end(); ++
p)
373 for (HepMC::GenVertex::particle_iterator mother = (*p)->production_vertex()->particles_begin(HepMC::parents);
374 mother != (*p)->production_vertex()->particles_end(HepMC::parents); ++mother)
381 if (
it->second.first ==
abs((*p)->pdg_id()))
383 mass =
it->second.second;
404 m_truthContainer = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
407 std::cout <<
"QAG4SimulationTracking::load_nodes - Fatal Error - "
408 <<
"unable to find DST node "
409 <<
"G4TruthInfo" << std::endl;
415 std::cout <<
m_mother_name.c_str() <<
"_KFParticle_Container - Fatal Error - "
416 <<
"unable to find DST node "
417 <<
"G4_QA" << std::endl;
425 return std::string(
"h_") +
Name() + std::string(
"_") +
m_trackMapName + std::string(
"_");