Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BuildResonanceJetTaggingTree.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BuildResonanceJetTaggingTree.cc
2 
3 #include <resonancejettagging/ResonanceJetTagging.h>
4 
5 #include <phool/phool.h>
6 
8 #include <jetbase/Jet.h>
10 #include <jetbase/Jetv2.h>
11 
16 
17 #include <g4eval/SvtxEvalStack.h> // for SvtxEvalStack
18 #include <g4eval/SvtxTrackEval.h> // for SvtxTrackEval
19 
21 #pragma GCC diagnostic push
22 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
23 #include <HepMC/GenEvent.h>
24 #include <HepMC/GenVertex.h>
25 #pragma GCC diagnostic pop
26 
29 #include <phhepmc/PHGenIntegral.h>
30 
33 
34 #include <phool/PHCompositeNode.h>
35 #include <phool/getClass.h>
36 
37 #include <g4main/PHG4Particle.h> // for PHG4Particle
38 #include <g4main/PHG4TruthInfoContainer.h> // for PHG4TruthInfoContainer
39 #include <g4main/PHG4VtxPoint.h> // for PHG4VtxPoint
40 
41 #include <kfparticle_sphenix/KFParticle_truthAndDetTools.h>
42 
43 #include <KFParticle.h>
44 #include <kfparticle_sphenix/KFParticle_Container.h>
45 
47 #include <TFile.h>
48 #include <TTree.h>
49 #include <TH1I.h>
50 
52 #include <cassert>
53 #include <sstream>
54 #include <string>
55 
67  : SubsysReco(name)
68  , m_outfilename(filename)
69  , m_tagcontainer_name("")
70  , m_jetcontainer_name("")
71  , m_truth_jetcontainer_name("")
72  , m_dorec(true)
73  , m_dotruth(false)
74  , m_nDaughters(0)
75  , m_svtx_evalstack(nullptr)
76  , m_trackeval(nullptr)
77  , m_tag_particle(tag)
78  , m_tag_pdg(0)
79  , m_outfile(nullptr)
80  , m_eventcount_h(nullptr)
81  , m_taggedjettree(nullptr)
82 {
87 
88  switch (m_tag_particle) {
89  case ResonanceJetTagging::TAG::D0:
90  m_tag_pdg = 421;
91  m_nDaughters = 2;
92  break;
93  case ResonanceJetTagging::TAG::D0TOK3PI:
94  m_tag_pdg = 421;
95  m_nDaughters = 4;
96  break;
97  case ResonanceJetTagging::TAG::DPLUS:
98  m_tag_pdg = 411;
99  m_nDaughters = 3;
100  break;
101  case ResonanceJetTagging::TAG::DSTAR:
102  m_tag_pdg = 413;
103  m_nDaughters = 0;
104  break;
105  case ResonanceJetTagging::TAG::JPSY:
106  m_tag_pdg = 433;
107  m_nDaughters = 0;
108  break;
109  case ResonanceJetTagging::TAG::K0:
110  m_tag_pdg = 311;
111  m_nDaughters = 0;
112  break;
113  case ResonanceJetTagging::TAG::GAMMA:
114  m_tag_pdg = 22;
115  m_nDaughters = 0;
116  break;
117  case ResonanceJetTagging::TAG::ELECTRON:
118  m_tag_pdg = 11;
119  m_nDaughters = 0;
120  break;
121  case ResonanceJetTagging::TAG::LAMBDAC:
122  m_tag_pdg = 4122;
123  m_nDaughters = 3;
124  break;
125  }
126 }
127 
132 {
133 
134 }
135 
140 {
141  if (Verbosity() > 5)
142  {
143  std::cout << "Beginning Init in BuildResonanceJetTaggingTree" << std::endl;
144  }
145 
146  return 0;
147 }
148 
154 {
155  if (Verbosity() > 5)
156  {
157  std::cout << "Beginning process_event in BuildResonanceJetTaggingTree" << std::endl;
158  }
159 
160  if(m_nDaughters == 0)
161  {
162  std::cout<<"ERROR: Number of Decay Daughters Not Set, ABORTING!";
164  }
165 
166  m_eventcount_h->Fill(0);
167 
168  switch (m_tag_particle) {
169  case ResonanceJetTagging::TAG::D0:
170  [[fallthrough]];
171  case ResonanceJetTagging::TAG::D0TOK3PI:
172  [[fallthrough]];
173  case ResonanceJetTagging::TAG::DPLUS:
174  [[fallthrough]];
175  case ResonanceJetTagging::TAG::LAMBDAC:
176  return loopHFHadronic(topNode);
177  break;
178  default:
179  std::cout<<"ERROR: Fill Tree Function Not Set, ABORTING!";
181  break;
182  }
183 
185 }
186 
192 {
193  if (Verbosity() > 1)
194  {
195  std::cout << "Ending BuildResonanceJetTaggingTree analysis package" << std::endl;
196  }
197 
199  m_outfile->cd();
200 
201  if(m_dotruth) {
202  PHGenIntegral *phgen = findNode::getClass<PHGenIntegral>(topNode, "PHGenIntegral");
203  if(phgen)
204  {
205  m_intlumi = phgen->get_Integrated_Lumi();
210  m_runinfo->Fill();
211  }
212  m_runinfo->Write();
213  }
214 
215  m_taggedjettree->Write();
216  m_eventcount_h->Write();
217 
218  m_outfile->Close();
219 
220  delete m_outfile;
221 
222  if (Verbosity() > 1)
223  {
224  std::cout << "Finished BuildResonanceJetTaggingTree analysis package" << std::endl;
225  }
226 
227  return 0;
228 }
229 
231 {
232  KFParticle_Container* kfContainer = nullptr;
233 
234  if(m_dorec)
235  {
238 
239  kfContainer = getKFParticleContainerFromNode(topNode, m_tagcontainer_name);
240  if(!kfContainer) return Fun4AllReturnCodes::ABORTEVENT;
241  }
242 
243  HepMC::GenEvent *hepMCGenEvent = nullptr;
244 
245  if(m_dotruth)
246  {
249 
250  hepMCGenEvent = getGenEventFromNode(topNode, "PHHepMCGenEventMap");
251  if(!hepMCGenEvent) return Fun4AllReturnCodes::ABORTEVENT;
252 
253  if (!m_svtx_evalstack)
254  {
255  m_svtx_evalstack = new SvtxEvalStack(topNode);
256 
258  }
259  else
260  {
261  m_svtx_evalstack->next_event(topNode);
262  }
263 
264  }
265 
266  m_eventcount_h->Fill(1);
267 
268  Jet *recTagJet = nullptr;
269  Jet *genTagJet = nullptr;
270 
271  KFParticle *recTag = nullptr;
272  HepMC::GenParticle *genTag = nullptr;
273 
274  std::vector<int> recDaughtersID(m_nDaughters);
275  std::vector<int> recJetIndex;
276 
277  if(m_dorec)
278  {
279  for(auto recJet : *m_taggedJetContainer)
280  {
281  recTagJet = recJet;
282 
283  if(!recTagJet) continue;
284 
285  int tagID = -1;
286 
287  for(auto comp : recTagJet->get_comp_vec())
288  {
289  if(comp.first == Jet::SRC::VOID)
290  {
291  recTag = kfContainer->get(comp.second);
292  tagID = comp.second;
293  }
294  }
295 
296  if(!recTag)
297  {
298  continue;
299  }
300 
301  for (int iDaughter = 0; iDaughter < m_nDaughters; iDaughter++)
302  {
303  recDaughtersID[iDaughter] = (kfContainer->get(tagID + iDaughter +1))->Id();
304  }
305 
307 
308  m_reco_tag_px = recTag->Px();
309  m_reco_tag_py = recTag->Py();
310  m_reco_tag_pz = recTag->Pz();
311  m_reco_tag_pt = recTag->GetPt();
312  m_reco_tag_eta = recTag->GetEta();
313  m_reco_tag_phi = recTag->GetPhi();
314  m_reco_tag_m = recTag->GetMass();
315  m_reco_tag_e = recTag->E();
316 
317  m_reco_jet_px = recTagJet->get_px();
318  m_reco_jet_py = recTagJet->get_py();
319  m_reco_jet_pz = recTagJet->get_pz();
320  m_reco_jet_pt = recTagJet->get_pt();
321  m_reco_jet_eta = recTagJet->get_eta();
322  m_reco_jet_phi = recTagJet->get_phi();
323  m_reco_jet_m = recTagJet->get_mass();
324  m_reco_jet_e = recTagJet->get_e();
325 
326  genTagJet = nullptr;
327  genTag = nullptr;
328 
329  if(m_dotruth)
330  {
331  findMatchedTruthD0(topNode, genTagJet, genTag, recDaughtersID);
332 
333  if((genTagJet) && (genTag))
334  {
335  recJetIndex.push_back(genTagJet->get_id());
336 
337  m_truth_tag_px = genTag->momentum().px();
338  m_truth_tag_py = genTag->momentum().py();
339  m_truth_tag_pz = genTag->momentum().pz();
341  m_truth_tag_eta = genTag->momentum().pseudoRapidity();
342  m_truth_tag_phi = atan2(m_truth_tag_py, m_truth_tag_px);
343  m_truth_tag_m = genTag->momentum().m();
344  m_truth_tag_e = genTag->momentum().e();
345 
346  m_truth_jet_px = genTagJet->get_px();
347  m_truth_jet_py = genTagJet->get_py();
348  m_truth_jet_pz = genTagJet->get_pz();
349  m_truth_jet_pt = genTagJet->get_pt();
350  m_truth_jet_eta = genTagJet->get_eta();
351  m_truth_jet_phi = genTagJet->get_phi();
352  m_truth_jet_m = genTagJet->get_mass();
353  m_truth_jet_e = genTagJet->get_e();
354 
355  }
356  }
357 
358  m_taggedjettree->Fill();
359  }
360  }
361 
362  if(m_dotruth)
363  {
365 
366  for(auto mcJet : *m_truth_taggedJetContainer)
367  {
368  genTagJet = mcJet;
369 
370  if(!genTagJet) continue;
371 
372  //Check if truth was matched to reconstructed
373  if(m_dorec)
374  {
375  if(isReconstructed(genTagJet->get_id(), recJetIndex))
376  {
377  continue;
378  }
379  }
380 
381  for(auto comp : genTagJet->get_comp_vec())
382  {
383  if(comp.first == Jet::SRC::VOID)
384  {
385  genTag = hepMCGenEvent->barcode_to_particle(comp.second);
386  }
387  }
388 
389  if(!genTag)
390  {
391  continue;
392  }
393 
394  m_truth_tag_px = genTag->momentum().px();
395  m_truth_tag_py = genTag->momentum().py();
396  m_truth_tag_pz = genTag->momentum().pz();
398  m_truth_tag_eta = genTag->momentum().pseudoRapidity();
399  m_truth_tag_phi = atan2(m_truth_tag_py, m_truth_tag_px);
400  m_truth_tag_m = genTag->momentum().m();
401  m_truth_tag_e = genTag->momentum().e();
402 
403  m_truth_jet_px = genTagJet->get_px();
404  m_truth_jet_py = genTagJet->get_py();
405  m_truth_jet_pz = genTagJet->get_pz();
406  m_truth_jet_pt = genTagJet->get_pt();
407  m_truth_jet_eta = genTagJet->get_eta();
408  m_truth_jet_phi = genTagJet->get_phi();
409  m_truth_jet_m = genTagJet->get_mass();
410  m_truth_jet_e = genTagJet->get_e();
411 
413  for(auto comp : genTagJet->get_comp_vec())
414  {
415  HepMC::GenParticle* constituent = hepMCGenEvent->barcode_to_particle(comp.second);
417  if(constituent == genTag)
418  {
419  continue;
420  }
421 
422  m_truthjet_const_px.push_back(constituent->momentum().px());
423  m_truthjet_const_py.push_back(constituent->momentum().py());
424  m_truthjet_const_pz.push_back(constituent->momentum().pz());
425  m_truthjet_const_e.push_back(constituent->momentum().e());
426  }
427 
428  m_taggedjettree->Fill();
429  }
430  }
431 
433 }
434 
435 void BuildResonanceJetTaggingTree::findMatchedTruthD0(PHCompositeNode *topNode, Jet *&mcTagJet, HepMC::GenParticle *&mcTag, std::vector<int> decays)
436 {
438  if(!m_truth_taggedJetContainer) return;
439 
440  HepMC::GenEvent *hepMCGenEvent = getGenEventFromNode(topNode, "PHHepMCGenEventMap");
441  if(!hepMCGenEvent) return;
442 
443  PHG4Particle *g4particle = nullptr;
444  PHG4Particle *g4parent = nullptr;
445  std::vector<HepMC::GenParticle*> mcTags(m_nDaughters);
446 
447  PHG4TruthInfoContainer *truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode, "G4TruthInfo");
448 
449  // Truth map
450  SvtxPHG4ParticleMap_v1 *dst_reco_truth_map = findNode::getClass<SvtxPHG4ParticleMap_v1>(topNode, "SvtxPHG4ParticleMap");
451 
452  if (dst_reco_truth_map)
453  {
454  for (int idecay = 0; idecay < m_nDaughters; idecay++)
455  {
456  std::map<float, std::set<int>> truth_set = dst_reco_truth_map->get(decays[idecay]);
457  const auto &best_weight = truth_set.rbegin();
458  int best_truth_id = *best_weight->second.rbegin();
459  g4particle = truthinfo->GetParticle(best_truth_id);
460  mcTags[idecay] = getMother(topNode, g4particle);
461  if (mcTags[idecay] == nullptr)
462  {
463  return;
464  }
465  }
466  }
467  else
468  {
469  SvtxTrackMap *trackmap = findNode::getClass<SvtxTrackMap>(topNode, "SvtxTrackMap");
470  if(!trackmap) return;
471 
472  for (int idecay = 0; idecay < m_nDaughters; idecay++)
473  {
474  SvtxTrack *track = trackmap->get(decays[idecay]);
475  if(!track) return;
476  g4particle = m_trackeval->max_truth_particle_by_nclusters(track);
477 
478  if(!g4particle)
479  {
480  return;
481  }
482 
483  g4parent = truthinfo->GetParticle(g4particle->get_primary_id());
484 
485  if(g4parent == nullptr)
486  {
487  return;
488  }
489 
490  mcTags[idecay] = hepMCGenEvent->barcode_to_particle(g4parent->get_barcode());
491  if(mcTags[idecay] == nullptr)
492  {
493  return;
494  }
495  }
496  }
497 
498  // check is decays are from the same mother, otherwise it is background
499  for (int idecay = 1; idecay < m_nDaughters; idecay++)
500  {
501  if (mcTags[idecay]->barcode() != mcTags[idecay - 1]->barcode())
502  {
503  return;
504  }
505  }
506 
507  mcTag = mcTags[0];
508 
509  for(auto mcJet : *m_truth_taggedJetContainer)
510  {
511  for(auto comp : mcJet->get_comp_vec())
512  {
513  if(comp.first == Jet::SRC::VOID && int(comp.second) == mcTag->barcode())
514  {
515  mcTagJet = mcJet;
516  }
517  }
518 
519  if(mcTagJet)
520  {
521  break;
522  }
523  }
524  return;
525 }
526 
527 HepMC::GenParticle *BuildResonanceJetTaggingTree::getMother(PHCompositeNode *topNode, PHG4Particle *g4daughter)
528 {
529  PHHepMCGenEventMap *hepmceventmap = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap");
530 
532  if (!hepmceventmap)
533  {
534  std::cout << PHWHERE
535  << "HEPMC event map node is missing, can't collected HEPMC truth particles"
536  << std::endl;
537  return nullptr;
538  }
539 
540  PHHepMCGenEvent *hepmcevent = hepmceventmap->get(1);
541  if (!hepmcevent)
542  {
543  std::cout << "no hepmcevent!!!" << std::endl;
544  return nullptr;
545  }
546 
547  HepMC::GenEvent *hepMCGenEvent = hepmcevent->getEvent();
548  if (!hepMCGenEvent)
549  {
550  return nullptr;
551  }
552 
553  HepMC::GenParticle *mcDaughter = nullptr;
554 
555  if (g4daughter->get_barcode() > 0)
556  {
557  mcDaughter = hepMCGenEvent->barcode_to_particle(g4daughter->get_barcode());
558  }
559  if (!mcDaughter)
560  {
561  return nullptr;
562  }
563 
564  HepMC::GenVertex *TagVertex = mcDaughter->production_vertex();
565  for (HepMC::GenVertex::particle_iterator it = TagVertex->particles_begin(HepMC::ancestors); it != TagVertex->particles_end(HepMC::ancestors); ++it)
566  {
567  if (std::abs((*it)->pdg_id()) == m_tag_pdg)
568  {
569  return (*it);
570  }
571  }
572 
573  return nullptr;
574 }
575 
576 bool BuildResonanceJetTaggingTree::isReconstructed(int index, std::vector<int> indexRecVector)
577 {
578  for(auto indexRec : indexRecVector)
579  {
580  if(index == indexRec) return true;
581  }
582  return false;
583 }
584 
586 {
587  delete m_runinfo;
588  m_runinfo = new TTree("m_runinfo","A tree with the run information");
589  m_runinfo->Branch("m_intlumi",&m_intlumi, "m_intlumi/F");
590  m_runinfo->Branch("m_nprocessedevents", &m_nprocessedevents, "m_nprocessedevents/F");
591  m_runinfo->Branch("m_nacceptedevents", &m_nacceptedevents, "m_nacceptedevents/F");
592  m_runinfo->Branch("m_xsecprocessedevents", &m_xsecprocessedevents, "m_xsecprocessedevents/F");
593  m_runinfo->Branch("m_xsecacceptedevents", &m_xsecacceptedevents, "m_xsecacceptedevents/F");
594 
595  delete m_taggedjettree;
596  m_taggedjettree = new TTree("m_taggedjettree", "A tree with Tagged-Jet info");
597  m_taggedjettree->Branch("m_reco_tag_px", &m_reco_tag_px, "m_reco_tag_px/F");
598  m_taggedjettree->Branch("m_reco_tag_py", &m_reco_tag_py, "m_reco_tag_py/F");
599  m_taggedjettree->Branch("m_reco_tag_pz", &m_reco_tag_pz, "m_reco_tag_pz/F");
600  m_taggedjettree->Branch("m_reco_tag_pt", &m_reco_tag_pt, "m_reco_tag_pt/F");
601  m_taggedjettree->Branch("m_reco_tag_eta", &m_reco_tag_eta, "m_reco_tag_eta/F");
602  m_taggedjettree->Branch("m_reco_tag_phi", &m_reco_tag_phi, "m_reco_tag_phi/F");
603  m_taggedjettree->Branch("m_reco_tag_m", &m_reco_tag_m, "m_reco_tag_m/F");
604  m_taggedjettree->Branch("m_reco_tag_e", &m_reco_tag_e, "m_reco_tag_e/F");
605  m_taggedjettree->Branch("m_reco_jet_px", &m_reco_jet_px, "m_reco_jet_px/F");
606  m_taggedjettree->Branch("m_reco_jet_py", &m_reco_jet_py, "m_reco_jet_py/F");
607  m_taggedjettree->Branch("m_reco_jet_pz", &m_reco_jet_pz, "m_reco_jet_pz/F");
608  m_taggedjettree->Branch("m_reco_jet_pt", &m_reco_jet_pt, "m_reco_jet_pt/F");
609  m_taggedjettree->Branch("m_reco_jet_eta", &m_reco_jet_eta, "m_reco_jet_eta/F");
610  m_taggedjettree->Branch("m_reco_jet_phi", &m_reco_jet_phi, "m_reco_jet_phi/F");
611  m_taggedjettree->Branch("m_reco_jet_m", &m_reco_jet_m, "m_reco_jet_m/F");
612  m_taggedjettree->Branch("m_reco_jet_e", &m_reco_jet_e, "m_reco_jet_e/F");
613 
614  m_taggedjettree->Branch("m_truth_tag_px", &m_truth_tag_px, "m_truth_tag_px/F");
615  m_taggedjettree->Branch("m_truth_tag_py", &m_truth_tag_py, "m_truth_tag_py/F");
616  m_taggedjettree->Branch("m_truth_tag_pz", &m_truth_tag_pz, "m_truth_tag_pz/F");
617  m_taggedjettree->Branch("m_truth_tag_pt", &m_truth_tag_pt, "m_truth_tag_pt/F");
618  m_taggedjettree->Branch("m_truth_tag_eta", &m_truth_tag_eta, "m_truth_tag_eta/F");
619  m_taggedjettree->Branch("m_truth_tag_phi", &m_truth_tag_phi, "m_truth_tag_phi/F");
620  m_taggedjettree->Branch("m_truth_tag_m", &m_truth_tag_m, "m_truth_tag_m/F");
621  m_taggedjettree->Branch("m_truth_tag_e", &m_truth_tag_e, "m_truth_tag_e/F");
622  m_taggedjettree->Branch("m_truth_jet_px", &m_truth_jet_px, "m_truth_jet_px/F");
623  m_taggedjettree->Branch("m_truth_jet_py", &m_truth_jet_py, "m_truth_jet_py/F");
624  m_taggedjettree->Branch("m_truth_jet_pz", &m_truth_jet_pz, "m_truth_jet_pz/F");
625  m_taggedjettree->Branch("m_truth_jet_pt", &m_truth_jet_pt, "m_truth_jet_pt/F");
626  m_taggedjettree->Branch("m_truth_jet_eta", &m_truth_jet_eta, "m_truth_jet_eta/F");
627  m_taggedjettree->Branch("m_truth_jet_phi", &m_truth_jet_phi, "m_truth_jet_phi/F");
628  m_taggedjettree->Branch("m_truth_jet_m", &m_truth_jet_m, "m_truth_jet_m/F");
629  m_taggedjettree->Branch("m_truth_jet_e", &m_truth_jet_e, "m_truth_jet_e/F");
630  m_taggedjettree->Branch("m_truthjet_const_px", &m_truthjet_const_px);
631  m_taggedjettree->Branch("m_truthjet_const_py", &m_truthjet_const_py);
632  m_taggedjettree->Branch("m_truthjet_const_pz", &m_truthjet_const_pz);
633  m_taggedjettree->Branch("m_truthjet_const_e", &m_truthjet_const_e);
634 
635 }
637 {
638  delete m_outfile;
639  m_outfile = new TFile(m_outfilename.c_str(), "RECREATE");
640 
641  delete m_eventcount_h;
642  m_eventcount_h = new TH1I("eventcount_h", "Event Count", 2, -0.5, 1.5);
643  m_eventcount_h->GetXaxis()->SetBinLabel(1,"N raw ev anal");
644  m_eventcount_h->GetXaxis()->SetBinLabel(2,"N ev anal");
645 }
646 
648 {
649  // Tagged-Jet reconstructed variables
650  m_reco_tag_px = NAN;
651  m_reco_tag_py = NAN;
652  m_reco_tag_pz = NAN;
653  m_reco_tag_pt = NAN;
654  m_reco_tag_eta = NAN;
655  m_reco_tag_phi = NAN;
656  m_reco_tag_m = NAN;
657  m_reco_tag_e = NAN;
658  m_reco_jet_px = NAN;
659  m_reco_jet_py = NAN;
660  m_reco_jet_pz = NAN;
661  m_reco_jet_pt = NAN;
662  m_reco_jet_eta = NAN;
663  m_reco_jet_phi = NAN;
664  m_reco_jet_m = NAN;
665  m_reco_jet_e = NAN;
666  //Truth info
667  m_truth_tag_px = NAN;
668  m_truth_tag_py = NAN;
669  m_truth_tag_pz = NAN;
670  m_truth_tag_pt = NAN;
671  m_truth_tag_eta = NAN;
672  m_truth_tag_phi = NAN;
673  m_truth_tag_m = NAN;
674  m_truth_tag_e = NAN;
675  m_truth_jet_px = NAN;
676  m_truth_jet_py = NAN;
677  m_truth_jet_pz = NAN;
678  m_truth_jet_pt = NAN;
679  m_truth_jet_eta = NAN;
680  m_truth_jet_phi = NAN;
681  m_truth_jet_m = NAN;
682  m_truth_jet_e = NAN;
683 
684  m_truthjet_const_px.clear();
685  m_truthjet_const_py.clear();
686  m_truthjet_const_pz.clear();
687  m_truthjet_const_e.clear();
688 }
689 
691 {
692  JetContainerv1 *jetcont = findNode::getClass<JetContainerv1>(topNode, name);
693 
694  if (!jetcont)
695  {
696  std::cout << PHWHERE
697  << "JetContainerv1 node is missing, can't collect jets"
698  << std::endl;
699  return 0;
700  }
701 
702  return jetcont;
703 }
705 {
706  KFParticle_Container *cont = findNode::getClass<KFParticle_Container>(topNode, name);
707 
708  if (!cont)
709  {
710  std::cout << PHWHERE
711  << "KFParticle_Container node is missing, can't collect HF particles"
712  << std::endl;
713  return 0;
714  }
715 
716  return cont;
717 }
719 {
720  PHHepMCGenEventMap *hepmceventmap = findNode::getClass<PHHepMCGenEventMap>(topNode, name);
721 
723  if (!hepmceventmap)
724  {
725  std::cout << PHWHERE
726  << "HEPMC event map node is missing, can't collected HEPMC truth particles"
727  << std::endl;
728  return 0;
729  }
730 
731  PHHepMCGenEvent *hepmcevent = hepmceventmap->get(1);
732 
733  if (!hepmcevent)
734  {
735  std::cout << PHWHERE
736  << "PHHepMCGenEvent node is missing, can't collected HEPMC truth particles"
737  << std::endl;
738  return 0;
739  }
740 
741  HepMC::GenEvent *hepMCGenEvent = hepmcevent->getEvent();
742 
743  if (!hepmceventmap)
744  {
745  std::cout << PHWHERE
746  << "HepMC::GenEvent node is missing, can't collected HEPMC truth particles"
747  << std::endl;
748  return 0;
749  }
750 
751  return hepMCGenEvent;
752 
753 }