Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HFTrackEfficiency.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file HFTrackEfficiency.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef HFTRACKEFFICIENCY_H
4 #define HFTRACKEFFICIENCY_H
5 
6 #include <decayfinder/DecayFinderContainer_v1.h> // for DecayFinderContainer_v1
8 #include <fun4all/SubsysReco.h>
9 #include <g4main/PHG4Particle.h>
11 #include <g4main/PHG4VtxPoint.h>
14 #include <phool/PHCompositeNode.h>
15 #include <phool/PHNodeIterator.h>
16 #include <phool/getClass.h>
21 
22 #include <CLHEP/Vector/LorentzVector.h>
23 #include <CLHEP/Vector/ThreeVector.h>
24 
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
27 #include <HepMC/GenEvent.h>
28 #include <HepMC/GenVertex.h> // for GenVertex::particle_iterator
29 #pragma GCC diagnostic pop
30 
31 #include <HepMC/GenParticle.h>
32 #include <HepMC/IteratorRange.h>
33 #include <HepMC/SimpleVector.h>
34 
35 #include <TBranch.h>
36 #include <TDatabasePDG.h>
37 #include <TFile.h>
38 #include <TTree.h>
39 
40 #include <string>
41 
42 class PHCompositeNode;
44 class PHG4Particle;
45 class PHHepMCGenEvent;
46 class PHHepMCGenEventMap;
47 
48 namespace CLHEP
49 {
50  class HepLorentzVector;
51 }
52 
53 namespace HepMC
54 {
55  class GenParticle;
56 }
57 
59 {
60  public:
61  explicit HFTrackEfficiency(const std::string &name = "HFTrackEfficiency");
62 
63  ~HFTrackEfficiency() override;
64 
65  int Init(PHCompositeNode *topNode) override;
66 
67  int process_event(PHCompositeNode *topNode) override;
68 
69  int End(PHCompositeNode *topNode) override;
70 
71  void PrintEff();
72 
78  void setOutputFileName(const std::string &what) { m_outfile_name = what; }
79  void triggerOnDecay(bool trigger) { m_triggerOnDecay = trigger; }
81 
82  private:
83  using Decay = std::vector<std::pair<std::pair<int, int>, int>>;
84 
86 
90 
92 
95 
98  SvtxTrack *m_dst_track = nullptr;
103 
105  TFile *m_outfile;
106  TTree *m_tree;
108 
109  unsigned int m_counter_allDecays = 0;
110  unsigned int m_counter_acceptedDecays = 0;
112 
113  unsigned int m_nDaughters;
115 
116  bool findTracks(PHCompositeNode *topNode, Decay decay);
117  void initializeBranches();
118  void resetBranches();
119  void getDecayDescriptor();
120  void getNDaughters();
121  std::string getParticleName(const int PDGID);
122  float getParticleMass(const int PDGID);
123 
124  static const int m_maxTracks = 5;
126  float m_true_mother_mass = std::numeric_limits<float>::quiet_NaN();
127  float m_reco_mother_mass = std::numeric_limits<float>::quiet_NaN();
128  float m_true_mother_pT = std::numeric_limits<float>::quiet_NaN();
129  float m_true_mother_p = std::numeric_limits<float>::quiet_NaN();
130  float m_true_mother_eta = std::numeric_limits<float>::quiet_NaN();
131  float m_min_true_track_pT = std::numeric_limits<float>::max();
132  float m_min_reco_track_pT = std::numeric_limits<float>::max();
133  float m_max_true_track_pT = -1. * std::numeric_limits<float>::max(); // Apparently min() is still a +ve value
134  float m_max_reco_track_pT = -1. * std::numeric_limits<float>::max();
137  float m_true_track_pT[m_maxTracks] = {std::numeric_limits<float>::quiet_NaN()};
138  float m_reco_track_pT[m_maxTracks] = {std::numeric_limits<float>::quiet_NaN()};
139  float m_true_track_eta[m_maxTracks] = {std::numeric_limits<float>::quiet_NaN()};
140  float m_reco_track_eta[m_maxTracks] = {std::numeric_limits<float>::quiet_NaN()};
141  float m_true_track_PID[m_maxTracks] = {std::numeric_limits<float>::quiet_NaN()};
142  float m_reco_track_chi2nDoF[m_maxTracks] = {std::numeric_limits<float>::quiet_NaN()};
145  float m_primary_vtx_x = std::numeric_limits<float>::quiet_NaN();
146  float m_primary_vtx_y = std::numeric_limits<float>::quiet_NaN();
147  float m_primary_vtx_z = std::numeric_limits<float>::quiet_NaN();
148  float m_secondary_vtx_x = std::numeric_limits<float>::quiet_NaN();
149  float m_secondary_vtx_y = std::numeric_limits<float>::quiet_NaN();
150  float m_secondary_vtx_z = std::numeric_limits<float>::quiet_NaN();
151 };
152 
153 #endif // HFTRACKEFFICIENCY_H