Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pythiaEMCalAna.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pythiaEMCalAna.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef ISOCLUSTER_H
4 #define ISOCLUSTER_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <string>
9 #include <set>
10 #include <vector>
11 
12 #include <HepMC/GenParticle.h>
14 #include <g4main/PHG4Particle.h>
16 
17 class PHCompositeNode;
18 class TFile;
19 class TTree;
20 
21 class pythiaEMCalAna : public SubsysReco
22 {
23  public:
24 
25  pythiaEMCalAna(const std::string &name = "pythiaEMCalAna", const std::string &oname = "pythiaEMCalAnaTrees.root", bool isMC = true, bool hasPythia = true);
26 
27  ~pythiaEMCalAna() override;
28 
34  int Init(PHCompositeNode *topNode) override;
35 
41  int InitRun(PHCompositeNode *topNode) override;
42 
46  int process_event(PHCompositeNode *topNode) override;
47 
49  int ResetEvent(PHCompositeNode *topNode) override;
50 
52  int EndRun(const int runnumber) override;
53 
55  int End(PHCompositeNode *topNode) override;
56 
58  int Reset(PHCompositeNode * /*topNode*/) override;
59 
60  void Print(const std::string &what = "ALL") const override;
61 
62  void setGenEvent(int eventGet) {getEvent = eventGet;}
63 
64  private:
65 
68 
69  //stuff for towers and clusters
70  std::vector<float> m_tower_energy;
71  std::vector<float> m_eta_center;
72  std::vector<float> m_phi_center;
73  std::vector<float> m_cluster_ID;
74  std::vector<float> m_cluster_e;
75  std::vector<float> m_cluster_eta;
76  std::vector<float> m_cluster_phi;
77  std::vector<float> m_cluster_ecore;
78  std::vector<float> m_cluster_chi2;
79  std::vector<float> m_cluster_prob;
80  std::vector<float> m_cluster_nTowers;
81  std::vector<float> m_cluster_maxE_trackID;
82  std::vector<float> m_cluster_maxE_PID;
83  std::vector<std::vector<float>> m_cluster_all_trackIDs;
84 
85  //truth particle information
86  /* std::vector<std::pair<int, int>> m_truthBarcode; */
87  /* std::vector<std::pair<int, int>> m_truthParentBarcode; */
88  std::vector<float> m_truthIsPrimary;
89  std::vector<float> m_truthTrackID;
90  std::vector<float> m_truthPid;
91  std::vector<float> m_truthE;
92  std::vector<float> m_truthEta;
93  std::vector<float> m_truthPhi;
94  std::vector<float> m_truthPt;
95  std::vector<float> m_truthMass;
96  std::vector<float> m_truthEndVtx_x;
97  std::vector<float> m_truthEndVtx_y;
98  std::vector<float> m_truthEndVtx_z;
99  std::vector<float> m_truthEndVtx_t;
100  std::vector<float> m_truthEndVtx_r;
101  std::vector<std::vector<float>> m_truth_all_clusterIDs;
102 
103  TFile *fout;
105  int getEvent;
106  /* bool hasHIJING; // needed to handle HIJING embedded samples correctly */
107  bool isMonteCarlo; // if input is RD we obviously need to skip the truth info
108  bool hasPYTHIA; // used to determine if primary photons are truly direct photons
109  // counters for each primary particle type
110  long int n_primaries;
113  long int n_leptons;
121  /* long int n_direct_photons_in_acceptance; */
122  /* long int n_pythia_direct_photons; */
123  /* long int n_decay_photons; */
124  /* long int n_decay_photons_in_acceptance; */
125  /* long int n_pythia_decays; */
126  /* long int n_pythia_decays_in_acceptance; */
127  /* long int n_geant_decays; */
128  /* long int n_geant_decays_in_acceptance; */
129  /* long int n_primary_in_acceptance; */
130  /* long int n_pythia_decay_photons; */
131  /* long int n_pythia_decay_photons_in_acceptance; */
132  /* long int n_pythia_decayed_pi0s; */
133  /* long int n_pythia_decayed_pi0s_in_acceptance; */
134  /* long int n_pythia_nondecayed_hadrons; */
135  /* long int n_pythia_nondecayed_hadrons_in_acceptance; */
136  /* long int n_pythia_nondecayed_pi0s; */
137  /* long int n_pythia_nondecayed_pi0s_in_acceptance; */
138  /* long int n_geant_decay_photons; */
139  /* long int n_geant_decay_photons_in_acceptance; */
140  /* long int n_geant_primary_hadrons; */
141  /* long int n_geant_primary_hadrons_in_acceptance; */
142  /* long int n_geant_primary_pi0s; */
143  /* long int n_geant_primary_pi0s_in_acceptance; */
144  /* std::vector<std::pair<int,int>> pythia_primary_barcodes; */
145  std::set<int> allTrackIDs; // keep track of all truth particles that produced a shower
146  std::set<int> pythiaBarcodes; // keep track of all PYTHIA-decayed primaries
147 
148  /* std::vector<std::pair<int,int>> primaryBarcodes; */
149  /* std::vector<std::pair<int,int>> secondaryBarcodes; */
150  HepMC::GenParticle* getGenParticle(int barcode, HepMC::GenEvent* theEvent);
151  bool withinAcceptance(PHG4Particle* part);
152  bool withinAcceptance(HepMC::GenParticle* part);
153  PHG4VtxPoint* getG4EndVtx(int id, PHG4TruthInfoContainer* truthInfo);
154  bool isDirectPhoton(PHG4Particle* part, HepMC::GenEvent* theEvent);
155  void addPrimaryFromGeant(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo, CaloRawClusterEval* caloEval, HepMC::GenEvent* theEvent);
156  void addPrimaryFromPythia(HepMC::GenParticle* part);
157  /* bool vector_contains(std::pair<int,int> val, std::vector<std::pair<int,int>> vec); */
158  /* // case 1: primary that geant knows about, decay handled by geant */
159  /* void addPrimaryFromGeant(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo); */
160  /* // case 2: primary that geant doesn't know about, decay handled by pythia */
161  /* void addPrimaryFromPythia(HepMC::GenParticle* part); */
162  /* // case 3: secondary that geant knows about */
163  /* void addSecondary(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo); */
164  /* // edge case: geant knows about secondary, but not its parent */
165  /* void addSecondaryWithoutParent(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo, HepMC::GenParticle* genParent); */
166 
167  // case 1: pythia handles decay
168  /* void addPrimaryFromPythia(HepMC::GenParticle* part); */
169  /* void addSecondaryFromPythia(HepMC::GenParticle* part, HepMC::GenParticle* parent); */
170  /* void addPrimaryFromGeant(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo); */
171  /* void addSecondaryFromGeant(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo); */
172 
173 
174  /* bool isDirectPhoton(PHG4Particle* part, HepMC::GenEvent* theEvent); */
175  /* void addDirectPhoton(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo); */
176  /* void addDecayPhoton(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo, HepMC::GenEvent* theEvent); */
177  /* void addPrimaryHadronFromPythia(HepMC::GenParticle* part, int embedID); */
178  /* void addPrimaryHadronFromGeant(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo); */
179  /* void addPrimaryFromGeant(PHG4Particle* part, PHG4TruthInfoContainer* truthInfo, CaloRawClusterEval* caloEval, HepMC::GenEvent* theEvent); */
180 };
181 
182 #endif // ISOCLUSTER_H