Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AnaTutorial.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AnaTutorial.cc
1 #include "AnaTutorial.h"
2 
4 #include <calobase/RawCluster.h>
5 #include <calobase/RawClusterContainer.h>
6 #include <calobase/RawClusterUtility.h>
7 #include <calobase/RawTower.h>
8 #include <calobase/RawTowerContainer.h>
9 #include <calobase/RawTowerGeom.h>
10 #include <calobase/RawTowerGeomContainer.h>
11 #include <calotrigger/CaloTriggerInfo.h>
12 
14 #include <jetbase/Jet.h>
15 #include <jetbase/JetMap.h>
16 
24 
26 #include <g4eval/JetEvalStack.h>
27 #include <g4eval/SvtxEvalStack.h>
28 
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
35 
38 
42 #include <g4main/PHG4Hit.h>
43 #include <g4main/PHG4Particle.h>
45 #include <phool/PHCompositeNode.h>
46 #include <phool/getClass.h>
47 
49 #include <TFile.h>
50 #include <TH1.h>
51 #include <TH2.h>
52 #include <TNtuple.h>
53 #include <TTree.h>
54 
56 #include <cassert>
57 #include <cmath>
58 #include <sstream>
59 #include <string>
60 
72  : SubsysReco(name)
73  , m_outfilename(filename)
74  , m_hm(nullptr)
75  , m_minjetpt(5.0)
76  , m_mincluspt(0.25)
77  , m_analyzeTracks(true)
78  , m_analyzeClusters(true)
79  , m_analyzeJets(true)
80  , m_analyzeTruth(false)
81 {
86 }
87 
92 {
93  delete m_hm;
94  delete m_hepmctree;
95  delete m_truthjettree;
96  delete m_recojettree;
97  delete m_tracktree;
98 }
99 
104 {
105  if (Verbosity() > 5)
106  {
107  std::cout << "Beginning Init in AnaTutorial" << std::endl;
108  }
109 
110  m_outfile = new TFile(m_outfilename.c_str(), "RECREATE");
111 
112  m_phi_h = new TH1D("phi_h", ";Counts;#phi [rad]", 50, -6, 6);
113  m_eta_phi_h = new TH2F("phi_eta_h", ";#eta;#phi [rad]", 10, -1, 1, 50, -6, 6);
114 
115  return 0;
116 }
117 
123 {
124  if (Verbosity() > 5)
125  {
126  std::cout << "Beginning process_event in AnaTutorial" << std::endl;
127  }
129  if (m_analyzeTruth)
130  {
131  getHEPMCTruth(topNode);
132  getPHG4Truth(topNode);
133  }
134 
136  if (m_analyzeTracks)
137  {
138  getTracks(topNode);
139  }
141  if (m_analyzeJets)
142  {
143  getTruthJets(topNode);
144  getReconstructedJets(topNode);
145  }
146 
148  if (m_analyzeClusters)
149  {
150  getEMCalClusters(topNode);
151  }
152 
154 }
155 
161 {
162  if (Verbosity() > 1)
163  {
164  std::cout << "Ending AnaTutorial analysis package" << std::endl;
165  }
166 
168  m_outfile->cd();
169 
171  if (m_analyzeTracks)
172  {
173  m_tracktree->Write();
174  }
175 
177  if (m_analyzeJets)
178  {
179  m_truthjettree->Write();
180  m_recojettree->Write();
181  }
182 
184  if (m_analyzeTruth)
185  {
186  m_hepmctree->Write();
187  m_truthtree->Write();
188  }
189 
191  if (m_analyzeClusters)
192  {
193  m_clustertree->Write();
194  }
195 
197  m_phi_h->Write();
198  m_eta_phi_h->Write();
199 
201  m_outfile->Write();
202  m_outfile->Close();
203 
205  delete m_outfile;
206 
207  if (Verbosity() > 1)
208  {
209  std::cout << "Finished AnaTutorial analysis package" << std::endl;
210  }
211 
212  return 0;
213 }
214 
222 {
224  PHHepMCGenEventMap *hepmceventmap = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap");
225 
227  if (!hepmceventmap)
228  {
229  std::cout << PHWHERE
230  << "HEPMC event map node is missing, can't collected HEPMC truth particles"
231  << std::endl;
232  return;
233  }
234 
236  if (Verbosity() > 1)
237  {
238  std::cout << "Getting HEPMC truth particles " << std::endl;
239  }
240 
243  for (PHHepMCGenEventMap::ConstIter eventIter = hepmceventmap->begin();
244  eventIter != hepmceventmap->end();
245  ++eventIter)
246  {
248  PHHepMCGenEvent *hepmcevent = eventIter->second;
249 
250  if (hepmcevent)
251  {
253  HepMC::GenEvent *truthevent = hepmcevent->getEvent();
254  if (!truthevent)
255  {
256  std::cout << PHWHERE
257  << "no evt pointer under phhepmvgeneventmap found "
258  << std::endl;
259  return;
260  }
261 
263  HepMC::PdfInfo *pdfinfo = truthevent->pdf_info();
264 
266  m_partid1 = pdfinfo->id1();
267  m_partid2 = pdfinfo->id2();
268  m_x1 = pdfinfo->x1();
269  m_x2 = pdfinfo->x2();
270 
272  m_mpi = truthevent->mpi();
273 
275  m_process_id = truthevent->signal_process_id();
276 
277  if (Verbosity() > 2)
278  {
279  std::cout << " Iterating over an event" << std::endl;
280  }
282  for (HepMC::GenEvent::particle_const_iterator iter = truthevent->particles_begin();
283  iter != truthevent->particles_end();
284  ++iter)
285  {
287  m_truthenergy = (*iter)->momentum().e();
288  m_truthpid = (*iter)->pdg_id();
289 
290  m_trutheta = (*iter)->momentum().pseudoRapidity();
291  m_truthphi = (*iter)->momentum().phi();
292  m_truthpx = (*iter)->momentum().px();
293  m_truthpy = (*iter)->momentum().py();
294  m_truthpz = (*iter)->momentum().pz();
296 
298  m_hepmctree->Fill();
300  }
301  }
302  }
303 }
304 
312 {
314  PHG4TruthInfoContainer *truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode, "G4TruthInfo");
315 
316  if (!truthinfo)
317  {
318  std::cout << PHWHERE
319  << "PHG4TruthInfoContainer node is missing, can't collect G4 truth particles"
320  << std::endl;
321  return;
322  }
323 
326 
328  for (PHG4TruthInfoContainer::ConstIterator iter = range.first;
329  iter != range.second;
330  ++iter)
331  {
333  const PHG4Particle *truth = iter->second;
334 
336  m_truthpx = truth->get_px();
337  m_truthpy = truth->get_py();
338  m_truthpz = truth->get_pz();
340  m_truthenergy = truth->get_e();
341 
343 
344  m_truthphi = atan(m_truthpy / m_truthpx);
345 
346  m_trutheta = atanh(m_truthpz / m_truthenergy);
348  if (!std::isfinite(m_trutheta))
349  {
350  m_trutheta = -99;
351  }
352  m_truthpid = truth->get_pid();
353 
355  m_truthtree->Fill();
356  }
357 }
358 
365 {
367  SvtxTrackMap *trackmap = findNode::getClass<SvtxTrackMap>(topNode, "SvtxTrackMap");
368 
369  if (!trackmap)
370  {
371  std::cout << PHWHERE
372  << "SvtxTrackMap node is missing, can't collect tracks"
373  << std::endl;
374  return;
375  }
376 
378  if (!m_svtxEvalStack)
379  {
380  m_svtxEvalStack = new SvtxEvalStack(topNode);
382  }
383 
384  m_svtxEvalStack->next_event(topNode);
385 
388 
390  PHG4TruthInfoContainer *truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode, "G4TruthInfo");
391 
392  if (Verbosity() > 1)
393  {
394  std::cout << "Get the SVTX tracks" << std::endl;
395  }
396  for (auto &iter : *trackmap)
397  {
398  SvtxTrack *track = iter.second;
399 
401  m_tr_px = track->get_px();
402  m_tr_py = track->get_py();
403  m_tr_pz = track->get_pz();
404  m_tr_p = sqrt(m_tr_px * m_tr_px + m_tr_py * m_tr_py + m_tr_pz * m_tr_pz);
405 
406  m_tr_pt = sqrt(m_tr_px * m_tr_px + m_tr_py * m_tr_py);
407 
408  // Make some cuts on the track to clean up sample
409  if (m_tr_pt < 0.5)
410  {
411  continue;
412  }
413  m_tr_phi = track->get_phi();
414  m_tr_eta = track->get_eta();
415 
416  m_charge = track->get_charge();
417  m_chisq = track->get_chisq();
418  m_ndf = track->get_ndf();
419  m_dca = track->get_dca();
420  m_tr_x = track->get_x();
421  m_tr_y = track->get_y();
422  m_tr_z = track->get_z();
423 
425  PHG4Particle *truthtrack = trackeval->max_truth_particle_by_nclusters(track);
426  m_truth_is_primary = truthinfo->is_primary(truthtrack);
427 
428  m_truthtrackpx = truthtrack->get_px();
429  m_truthtrackpy = truthtrack->get_py();
430  m_truthtrackpz = truthtrack->get_pz();
432 
433  m_truthtracke = truthtrack->get_e();
434 
436  m_truthtrackphi = atan(m_truthtrackpy / m_truthtrackpx);
437  m_truthtracketa = atanh(m_truthtrackpz / m_truthtrackp);
438  m_truthtrackpid = truthtrack->get_pid();
439 
440  m_tracktree->Fill();
441  }
442 }
443 
448 {
449  if (Verbosity() > 1)
450  {
451  std::cout << "get the truth jets" << std::endl;
452  }
453 
455  JetMap *truth_jets = findNode::getClass<JetMap>(topNode, "AntiKt_Truth_r04");
456 
458  JetMap *reco_jets = findNode::getClass<JetMap>(topNode, "AntiKt_Tower_r04");
459  if (!m_jetEvalStack)
460  {
461  m_jetEvalStack = new JetEvalStack(topNode, "AntiKt_Tower_r04",
462  "AntiKt_Truth_r04");
463  }
464  m_jetEvalStack->next_event(topNode);
466 
467  if (!truth_jets)
468  {
469  std::cout << PHWHERE
470  << "Truth jet node is missing, can't collect truth jets"
471  << std::endl;
472  return;
473  }
474 
476  for (JetMap::Iter iter = truth_jets->begin();
477  iter != truth_jets->end();
478  ++iter)
479  {
480  Jet *truthJet = iter->second;
481 
482  m_truthjetpt = truthJet->get_pt();
483 
484  std::set<PHG4Particle *> truthjetcomp =
485  trutheval->all_truth_particles(truthJet);
486  int ntruthconstituents = 0;
487  // loop over the constituents of the truth jet
488  for (auto truthpart : truthjetcomp)
489  {
490  // get the particle of the truthjet
491  if (!truthpart)
492  {
493  std::cout << "no truth particles in the jet??" << std::endl;
494  break;
495  }
496 
497  ntruthconstituents++;
498  }
499 
500  if (ntruthconstituents < 3)
501  {
502  continue;
503  }
505  if (m_truthjetpt < m_minjetpt)
506  {
507  continue;
508  }
509 
510  m_truthjeteta = truthJet->get_eta();
511  m_truthjetpx = truthJet->get_px();
512  m_truthjetpy = truthJet->get_py();
513  m_truthjetpz = truthJet->get_pz();
514  m_truthjetphi = truthJet->get_phi();
515  m_truthjetp = truthJet->get_p();
516  m_truthjetenergy = truthJet->get_e();
517 
518  m_recojetpt = 0;
519  m_recojetid = 0;
520  m_recojetpx = 0;
521  m_recojetpy = 0;
522  m_recojetpz = 0;
523  m_recojetphi = 0;
524  m_recojetp = 0;
525  m_recojetenergy = 0;
526  m_dR = -99;
527  float closestjet = 9999;
529  for (auto &reco_jet : *reco_jets)
530  {
531  const Jet *recoJet = reco_jet.second;
532  m_recojetpt = recoJet->get_pt();
533  if (m_recojetpt < m_minjetpt - m_minjetpt * 0.4)
534  {
535  continue;
536  }
537 
538  m_recojeteta = recoJet->get_eta();
539  m_recojetphi = recoJet->get_phi();
540 
541  if (Verbosity() > 1)
542  {
543  std::cout << "matching by distance jet" << std::endl;
544  }
545 
546  float dphi = m_recojetphi - m_truthjetphi;
547  if (dphi > M_PI)
548  {
549  dphi -= M_PI * 2.;
550  }
551  if (dphi < -1 * M_PI)
552  {
553  dphi += M_PI * 2.;
554  }
555 
556  float deta = m_recojeteta - m_truthjeteta;
559  m_dR = std::sqrt(pow(dphi, 2.) + pow(deta, 2.));
560 
563  if (m_dR < truth_jets->get_par() && m_dR < closestjet)
564  {
565  // Get reco jet characteristics
566  m_recojetid = recoJet->get_id();
567  m_recojetpx = recoJet->get_px();
568  m_recojetpy = recoJet->get_py();
569  m_recojetpz = recoJet->get_pz();
570  m_recojetphi = recoJet->get_phi();
571  m_recojetp = recoJet->get_p();
572  m_recojetenergy = recoJet->get_e();
573  }
574  }
575 
577  m_truthjettree->Fill();
578  }
579 }
580 
585 {
587  JetMap *reco_jets = findNode::getClass<JetMap>(topNode, "AntiKt_Tower_r04");
589  JetMap *truth_jets = findNode::getClass<JetMap>(topNode, "AntiKt_Truth_r04");
590 
591  if (!m_jetEvalStack)
592  {
593  m_jetEvalStack = new JetEvalStack(topNode, "AntiKt_Tower_r04",
594  "AntiKt_Truth_r04");
595  }
596  m_jetEvalStack->next_event(topNode);
598  if (!reco_jets)
599  {
600  std::cout << PHWHERE
601  << "Reconstructed jet node is missing, can't collect reconstructed jets"
602  << std::endl;
603  return;
604  }
605 
606  if (Verbosity() > 1)
607  {
608  std::cout << "Get all Reco Jets" << std::endl;
609  }
610 
612  for (JetMap::Iter recoIter = reco_jets->begin();
613  recoIter != reco_jets->end();
614  ++recoIter)
615  {
616  Jet *recoJet = recoIter->second;
617  m_recojetpt = recoJet->get_pt();
618  if (m_recojetpt < m_minjetpt)
619  {
620  continue;
621  }
622 
623  m_recojeteta = recoJet->get_eta();
624 
625  // Get reco jet characteristics
626  m_recojetid = recoJet->get_id();
627  m_recojetpx = recoJet->get_px();
628  m_recojetpy = recoJet->get_py();
629  m_recojetpz = recoJet->get_pz();
630  m_recojetphi = recoJet->get_phi();
631  m_recojetp = recoJet->get_p();
632  m_recojetenergy = recoJet->get_e();
633 
634  if (Verbosity() > 1)
635  {
636  std::cout << "matching by distance jet" << std::endl;
637  }
638 
640  m_truthjetid = 0;
641  m_truthjetp = 0;
642  m_truthjetphi = 0;
643  m_truthjeteta = 0;
644  m_truthjetpt = 0;
645  m_truthjetenergy = 0;
646  m_truthjetpx = 0;
647  m_truthjetpy = 0;
648  m_truthjetpz = 0;
649 
650  Jet *truthjet = recoeval->max_truth_jet_by_energy(recoJet);
651  if (truthjet)
652  {
653  m_truthjetid = truthjet->get_id();
654  m_truthjetp = truthjet->get_p();
655  m_truthjetpx = truthjet->get_px();
656  m_truthjetpy = truthjet->get_py();
657  m_truthjetpz = truthjet->get_pz();
658  m_truthjeteta = truthjet->get_eta();
659  m_truthjetphi = truthjet->get_phi();
660  m_truthjetenergy = truthjet->get_e();
662  }
663 
665  else if (truth_jets)
666  {
669  float closestjet = 9999;
670  for (auto &truth_jet : *truth_jets)
671  {
672  const Jet *truthJet = truth_jet.second;
673 
674  float thisjetpt = truthJet->get_pt();
675  if (thisjetpt < m_minjetpt)
676  {
677  continue;
678  }
679 
680  float thisjeteta = truthJet->get_eta();
681  float thisjetphi = truthJet->get_phi();
682 
683  float dphi = m_recojetphi - thisjetphi;
684  if (dphi > M_PI)
685  {
686  dphi -= M_PI * 2.;
687  }
688  if (dphi < -1. * M_PI)
689  {
690  dphi += M_PI * 2.;
691  }
692 
693  float deta = m_recojeteta - thisjeteta;
696  m_dR = sqrt(pow(dphi, 2.) + pow(deta, 2.));
697 
700  if (m_dR < reco_jets->get_par() && m_dR < closestjet)
701  {
702  m_truthjetid = -9999;
703  m_truthjetp = truthJet->get_p();
704  m_truthjetphi = truthJet->get_phi();
705  m_truthjeteta = truthJet->get_eta();
706  m_truthjetpt = truthJet->get_pt();
707  m_truthjetenergy = truthJet->get_e();
708  m_truthjetpx = truthJet->get_px();
709  m_truthjetpy = truthJet->get_py();
710  m_truthjetpz = truthJet->get_pz();
711  closestjet = m_dR;
712  }
713  }
714  }
715  m_recojettree->Fill();
716  }
717 }
718 
726 {
730  RawClusterContainer *clusters = findNode::getClass<RawClusterContainer>(topNode, "CLUSTER_CEMC");
731 
732  if (!clusters)
733  {
734  std::cout << PHWHERE
735  << "EMCal cluster node is missing, can't collect EMCal clusters"
736  << std::endl;
737  return;
738  }
739 
741  GlobalVertexMap *vertexmap = findNode::getClass<GlobalVertexMap>(topNode, "GlobalVertexMap");
742  if (!vertexmap)
743  {
744  std::cout << "AnaTutorial::getEmcalClusters - Fatal Error - GlobalVertexMap node is missing. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << std::endl;
745  assert(vertexmap); // force quit
746 
747  return;
748  }
749 
750  if (vertexmap->empty())
751  {
752  std::cout << "AnaTutorial::getEmcalClusters - Fatal Error - GlobalVertexMap node is empty. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << std::endl;
753  return;
754  }
755 
757  GlobalVertex *vtx = nullptr;
758  for(auto iter = vertexmap->begin(); iter!= vertexmap->end(); ++iter)
759  {
760  GlobalVertex* vertex = iter->second;
761  if(vertex->find_vtxids(GlobalVertex::MBD) != vertex->end_vtxids())
762  {
763  vtx = vertex;
764  }
765  }
766  if (vtx == nullptr)
767  {
768  return;
769  }
770 
772  CaloTriggerInfo *trigger = findNode::getClass<CaloTriggerInfo>(topNode, "CaloTriggerInfo");
773 
775  if (trigger)
776  {
777  m_E_4x4 = trigger->get_best_EMCal_4x4_E();
778  }
779  RawClusterContainer::ConstRange begin_end = clusters->getClusters();
781 
783  for (clusIter = begin_end.first;
784  clusIter != begin_end.second;
785  ++clusIter)
786  {
788  const RawCluster *cluster = clusIter->second;
789 
794  CLHEP::Hep3Vector vertex(vtx->get_x(), vtx->get_y(), vtx->get_z());
795  CLHEP::Hep3Vector E_vec_cluster = RawClusterUtility::GetECoreVec(*cluster, vertex);
796  m_clusenergy = E_vec_cluster.mag();
797  m_cluseta = E_vec_cluster.pseudoRapidity();
798  m_clustheta = E_vec_cluster.getTheta();
799  m_cluspt = E_vec_cluster.perp();
800  m_clusphi = E_vec_cluster.getPhi();
801 
802  if (m_cluspt < m_mincluspt)
803  {
804  continue;
805  }
806 
807  m_cluspx = m_cluspt * cos(m_clusphi);
808  m_cluspy = m_cluspt * sin(m_clusphi);
810 
811  // fill the cluster tree with all emcal clusters
812  m_clustertree->Fill();
813  }
814 }
815 
821 {
822  m_recojettree = new TTree("jettree", "A tree with reconstructed jets");
823  m_recojettree->Branch("m_recojetpt", &m_recojetpt, "m_recojetpt/D");
824  m_recojettree->Branch("m_recojetid", &m_recojetid, "m_recojetid/I");
825  m_recojettree->Branch("m_recojetpx", &m_recojetpx, "m_recojetpx/D");
826  m_recojettree->Branch("m_recojetpy", &m_recojetpy, "m_recojetpy/D");
827  m_recojettree->Branch("m_recojetpz", &m_recojetpz, "m_recojetpz/D");
828  m_recojettree->Branch("m_recojetphi", &m_recojetphi, "m_recojetphi/D");
829  m_recojettree->Branch("m_recojeteta", &m_recojeteta, "m_recojeteta/D");
830  m_recojettree->Branch("m_recojetenergy", &m_recojetenergy, "m_recojetenergy/D");
831  m_recojettree->Branch("m_truthjetid", &m_truthjetid, "m_truthjetid/I");
832  m_recojettree->Branch("m_truthjetp", &m_truthjetp, "m_truthjetp/D");
833  m_recojettree->Branch("m_truthjetphi", &m_truthjetphi, "m_truthjetphi/D");
834  m_recojettree->Branch("m_truthjeteta", &m_truthjeteta, "m_truthjeteta/D");
835  m_recojettree->Branch("m_truthjetpt", &m_truthjetpt, "m_truthjetpt/D");
836  m_recojettree->Branch("m_truthjetenergy", &m_truthjetenergy, "m_truthjetenergy/D");
837  m_recojettree->Branch("m_truthjetpx", &m_truthjetpx, "m_truthjetpx/D");
838  m_recojettree->Branch("m_truthjetpy", &m_truthjetpy, "m_truthjyetpy/D");
839  m_recojettree->Branch("m_truthjetpz", &m_truthjetpz, "m_truthjetpz/D");
840  m_recojettree->Branch("m_dR", &m_dR, "m_dR/D");
841 
842  m_truthjettree = new TTree("truthjettree", "A tree with truth jets");
843  m_truthjettree->Branch("m_truthjetid", &m_truthjetid, "m_truthjetid/I");
844  m_truthjettree->Branch("m_truthjetp", &m_truthjetp, "m_truthjetp/D");
845  m_truthjettree->Branch("m_truthjetphi", &m_truthjetphi, "m_truthjetphi/D");
846  m_truthjettree->Branch("m_truthjeteta", &m_truthjeteta, "m_truthjeteta/D");
847  m_truthjettree->Branch("m_truthjetpt", &m_truthjetpt, "m_truthjetpt/D");
848  m_truthjettree->Branch("m_truthjetenergy", &m_truthjetenergy, "m_truthjetenergy/D");
849  m_truthjettree->Branch("m_truthjetpx", &m_truthjetpx, "m_truthjetpx/D");
850  m_truthjettree->Branch("m_truthjetpy", &m_truthjetpy, "m_truthjetpy/D");
851  m_truthjettree->Branch("m_truthjetpz", &m_truthjetpz, "m_truthjetpz/D");
852  m_truthjettree->Branch("m_dR", &m_dR, "m_dR/D");
853  m_truthjettree->Branch("m_recojetpt", &m_recojetpt, "m_recojetpt/D");
854  m_truthjettree->Branch("m_recojetid", &m_recojetid, "m_recojetid/I");
855  m_truthjettree->Branch("m_recojetpx", &m_recojetpx, "m_recojetpx/D");
856  m_truthjettree->Branch("m_recojetpy", &m_recojetpy, "m_recojetpy/D");
857  m_truthjettree->Branch("m_recojetpz", &m_recojetpz, "m_recojetpz/D");
858  m_truthjettree->Branch("m_recojetphi", &m_recojetphi, "m_recojetphi/D");
859  m_truthjettree->Branch("m_recojeteta", &m_recojeteta, "m_recojeteta/D");
860  m_truthjettree->Branch("m_recojetenergy", &m_recojetenergy, "m_recojetenergy/D");
861  m_tracktree = new TTree("tracktree", "A tree with svtx tracks");
862  m_tracktree->Branch("m_tr_px", &m_tr_px, "m_tr_px/D");
863  m_tracktree->Branch("m_tr_py", &m_tr_py, "m_tr_py/D");
864  m_tracktree->Branch("m_tr_pz", &m_tr_pz, "m_tr_pz/D");
865  m_tracktree->Branch("m_tr_p", &m_tr_p, "m_tr_p/D");
866  m_tracktree->Branch("m_tr_pt", &m_tr_pt, "m_tr_pt/D");
867  m_tracktree->Branch("m_tr_phi", &m_tr_phi, "m_tr_phi/D");
868  m_tracktree->Branch("m_tr_eta", &m_tr_eta, "m_tr_eta/D");
869  m_tracktree->Branch("m_charge", &m_charge, "m_charge/I");
870  m_tracktree->Branch("m_chisq", &m_chisq, "m_chisq/D");
871  m_tracktree->Branch("m_ndf", &m_ndf, "m_ndf/I");
872  m_tracktree->Branch("m_dca", &m_dca, "m_dca/D");
873  m_tracktree->Branch("m_tr_x", &m_tr_x, "m_tr_x/D");
874  m_tracktree->Branch("m_tr_y", &m_tr_y, "m_tr_y/D");
875  m_tracktree->Branch("m_tr_z", &m_tr_z, "m_tr_z/D");
876  m_tracktree->Branch("m_truth_is_primary", &m_truth_is_primary, "m_truth_is_primary/I");
877  m_tracktree->Branch("m_truthtrackpx", &m_truthtrackpx, "m_truthtrackpx/D");
878  m_tracktree->Branch("m_truthtrackpy", &m_truthtrackpy, "m_truthtrackpy/D");
879  m_tracktree->Branch("m_truthtrackpz", &m_truthtrackpz, "m_truthtrackpz/D");
880  m_tracktree->Branch("m_truthtrackp", &m_truthtrackp, "m_truthtrackp/D");
881  m_tracktree->Branch("m_truthtracke", &m_truthtracke, "m_truthtracke/D");
882  m_tracktree->Branch("m_truthtrackpt", &m_truthtrackpt, "m_truthtrackpt/D");
883  m_tracktree->Branch("m_truthtrackphi", &m_truthtrackphi, "m_truthtrackphi/D");
884  m_tracktree->Branch("m_truthtracketa", &m_truthtracketa, "m_truthtracketa/D");
885  m_tracktree->Branch("m_truthtrackpid", &m_truthtrackpid, "m_truthtrackpid/I");
886 
887  m_hepmctree = new TTree("hepmctree", "A tree with hepmc truth particles");
888  m_hepmctree->Branch("m_partid1", &m_partid1, "m_partid1/I");
889  m_hepmctree->Branch("m_partid2", &m_partid2, "m_partid2/I");
890  m_hepmctree->Branch("m_x1", &m_x1, "m_x1/D");
891  m_hepmctree->Branch("m_x2", &m_x2, "m_x2/D");
892  m_hepmctree->Branch("m_mpi", &m_mpi, "m_mpi/I");
893  m_hepmctree->Branch("m_process_id", &m_process_id, "m_process_id/I");
894  m_hepmctree->Branch("m_truthenergy", &m_truthenergy, "m_truthenergy/D");
895  m_hepmctree->Branch("m_trutheta", &m_trutheta, "m_trutheta/D");
896  m_hepmctree->Branch("m_truthphi", &m_truthphi, "m_truthphi/D");
897  m_hepmctree->Branch("m_truthpx", &m_truthpx, "m_truthpx/D");
898  m_hepmctree->Branch("m_truthpy", &m_truthpy, "m_truthpy/D");
899  m_hepmctree->Branch("m_truthpz", &m_truthpz, "m_truthpz/D");
900  m_hepmctree->Branch("m_truthpt", &m_truthpt, "m_truthpt/D");
901  m_hepmctree->Branch("m_numparticlesinevent", &m_numparticlesinevent, "m_numparticlesinevent/I");
902  m_hepmctree->Branch("m_truthpid", &m_truthpid, "m_truthpid/I");
903 
904  m_truthtree = new TTree("truthg4tree", "A tree with truth g4 particles");
905  m_truthtree->Branch("m_truthenergy", &m_truthenergy, "m_truthenergy/D");
906  m_truthtree->Branch("m_truthp", &m_truthp, "m_truthp/D");
907  m_truthtree->Branch("m_truthpx", &m_truthpx, "m_truthpx/D");
908  m_truthtree->Branch("m_truthpy", &m_truthpy, "m_truthpy/D");
909  m_truthtree->Branch("m_truthpz", &m_truthpz, "m_truthpz/D");
910  m_truthtree->Branch("m_truthpt", &m_truthpt, "m_truthpt/D");
911  m_truthtree->Branch("m_truthphi", &m_truthphi, "m_truthphi/D");
912  m_truthtree->Branch("m_trutheta", &m_trutheta, "m_trutheta/D");
913  m_truthtree->Branch("m_truthpid", &m_truthpid, "m_truthpid/I");
914 
915  m_clustertree = new TTree("clustertree", "A tree with emcal clusters");
916  m_clustertree->Branch("m_clusenergy", &m_clusenergy, "m_clusenergy/D");
917  m_clustertree->Branch("m_cluseta", &m_cluseta, "m_cluseta/D");
918  m_clustertree->Branch("m_clustheta", &m_clustheta, "m_clustheta/D");
919  m_clustertree->Branch("m_cluspt", &m_cluspt, "m_cluspt/D");
920  m_clustertree->Branch("m_clusphi", &m_clusphi, "m_clusphi/D");
921  m_clustertree->Branch("m_cluspx", &m_cluspx, "m_cluspx/D");
922  m_clustertree->Branch("m_cluspy", &m_cluspy, "m_cluspy/D");
923  m_clustertree->Branch("m_cluspz", &m_cluspz, "m_cluspz/D");
924  m_clustertree->Branch("m_E_4x4", &m_E_4x4, "m_E_4x4/D");
925 }
926 
933 {
934  m_outfile = new TFile();
935  m_phi_h = new TH1F();
936  m_eta_phi_h = new TH2F();
937 
938  m_partid1 = -99;
939  m_partid2 = -99;
940  m_x1 = -99;
941  m_x2 = -99;
942  m_mpi = -99;
943  m_process_id = -99;
944  m_truthenergy = -99;
945  m_trutheta = -99;
946  m_truthphi = -99;
947  m_truthp = -99;
948  m_truthpx = -99;
949  m_truthpy = -99;
950  m_truthpz = -99;
951  m_truthpt = -99;
952  m_numparticlesinevent = -99;
953  m_truthpid = -99;
954 
955  m_tr_px = -99;
956  m_tr_py = -99;
957  m_tr_pz = -99;
958  m_tr_p = -99;
959  m_tr_pt = -99;
960  m_tr_phi = -99;
961  m_tr_eta = -99;
962  m_charge = -99;
963  m_chisq = -99;
964  m_ndf = -99;
965  m_dca = -99;
966  m_tr_x = -99;
967  m_tr_y = -99;
968  m_tr_z = -99;
969  m_truth_is_primary = -99;
970  m_truthtrackpx = -99;
971  m_truthtrackpy = -99;
972  m_truthtrackpz = -99;
973  m_truthtrackp = -99;
974  m_truthtracke = -99;
975  m_truthtrackpt = -99;
976  m_truthtrackphi = -99;
977  m_truthtracketa = -99;
978  m_truthtrackpid = -99;
979 
980  m_recojetpt = -99;
981  m_recojetid = -99;
982  m_recojetpx = -99;
983  m_recojetpy = -99;
984  m_recojetpz = -99;
985  m_recojetphi = -99;
986  m_recojetp = -99;
987  m_recojetenergy = -99;
988  m_recojeteta = -99;
989  m_truthjetid = -99;
990  m_truthjetp = -99;
991  m_truthjetphi = -99;
992  m_truthjeteta = -99;
993  m_truthjetpt = -99;
994  m_truthjetenergy = -99;
995  m_truthjetpx = -99;
996  m_truthjetpy = -99;
997  m_truthjetpz = -99;
998  m_dR = -99;
999 }