Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IsolatedTrackAnalysis.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file IsolatedTrackAnalysis.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef ISOLATEDTRACKANALYSIS_H
4 #define ISOLATEDTRACKANALYSIS_H
5 
6 
7 #include <fun4all/SubsysReco.h>
9 
10 #include <string>
11 #include <vector>
12 
13 class TFile;
14 class TTree;
15 class PHCompositeNode;
17 class RawCluster;
18 class RawTowerContainer;
19 class RawTower;
20 class SvtxTrackMap;
21 class SvtxTrack;
22 class SvtxTrackState;
23 class SvtxVertexMap;
24 class SvtxEvalStack;
25 class PHHepMCGenEventMap;
26 class PHHepMCGenEvent;
27 class P4G4TruthInfoContainer;
28 class P4G4TruthInfo;
29 class CentralityInfo;
30 class TrkrCluster;
31 class PHG4HitContainer;
32 
34 {
35  public:
36  IsolatedTrackAnalysis(const std::string &name = "IsolatedTrackAnalysis",
37  const std::string &fname = "IsolatedTrackAnalysis.root");
38  ~IsolatedTrackAnalysis() override;
39 
40  int Init(PHCompositeNode *topNode) override;
41  int InitRun(PHCompositeNode *topNode) override;
42  int process_event(PHCompositeNode *topNode) override;
43  int ResetEvent(PHCompositeNode *topNode) override;
44  int End(PHCompositeNode *topNode) override;
45 
46  void setMinEMClusterEnergy(float minEMClusterEnergy) { m_minEMClusterEnergy = minEMClusterEnergy; }
47  void setMinIHClusterEnergy(float minIHClusterEnergy) { m_minIHClusterEnergy = minIHClusterEnergy; }
48  void setMinOHClusterEnergy(float minOHClusterEnergy) { m_minOHClusterEnergy = minOHClusterEnergy; }
49  void setMinCemcTowerEnergy(float minCemcTowerEnergy) { m_minCemcTowerEnergy = minCemcTowerEnergy; }
50  void setMinHcalTowerEnergy(float minHcalTowerEnergy) { m_minHcalTowerEnergy = minHcalTowerEnergy; }
51  void setMinSimTowerEnergy(float minSimTowerEnergy) { m_minSimTowerEnergy = minSimTowerEnergy; }
52 
53  void analyzeTracks(bool doAnalyzeTracks) { m_analyzeTracks = doAnalyzeTracks; }
54  void analyzeClusters(bool doAnalyzeClusters) { m_analyzeClusters = doAnalyzeClusters; }
55  void analyzeTowers(bool doAnalyzeTowers) { m_analyzeTowers = doAnalyzeTowers; }
56  void analyzeSimTowers(bool doAnalyzeSimTowers) { m_analyzeSimTowers = doAnalyzeSimTowers; }
57  void analyzeHepMCTruth(bool doAnalyzeHepMCTruth) { m_analyzeHepMCTruth = doAnalyzeHepMCTruth; }
58  void analyzeG4Truth(bool doAnalyzeG4Truth) { m_analyzeG4Truth = doAnalyzeG4Truth; }
59  void analyzeCentrality(bool doAnalyzeCentrality) { m_analyzeCentrality = doAnalyzeCentrality; }
60  void analyzeAddTruth(bool doAnalyzeAddTruth) { m_analyzeAddTruth = doAnalyzeAddTruth; }
61 
62  private:
65 
68 
71 
74 
77 
80 
83 
86 
89 
92 
95 
98 
101 
104 
108 
110  TFile *m_outputFile;
111  TTree *m_tracktree;
113  TTree *m_towertree;
115  TTree *m_hepmctree;
116  TTree *m_g4tree;
119 
122 
124  int counter;
125 
127  void getTracks(PHCompositeNode *topNode);
128  void getClusters(PHCompositeNode *topNode);
129  void getTowers(PHCompositeNode *topNode);
130  void getSimTowers(PHCompositeNode *topNode);
131  void getHepMCTruth(PHCompositeNode *topNode);
132  void getG4Truth(PHCompositeNode *topNode);
133  void getCentrality(PHCompositeNode *topNode);
134  void getAddTruth(PHCompositeNode *topNode);
135 
136  void initializeTrees();
137  void initializeVariables();
138 
139  // Track helper functions
140  float calculateProjectionEta(SvtxTrackState *projectedState);
141  float calculateProjectionPhi(SvtxTrackState *projectedState);
142  void calculateDCA(SvtxTrack* track, SvtxVertexMap* vertexmap, float& dca3dxy, float& dca3dz, float& dca3dxysigma, float& dca3dzsigma);
143 
144  // Calorimeter radii
148 
149  // Multiplicities
161  int m_g4;
162  int m_hepmc;
163 
164  // Basic track properties
165  float m_tr_p[2000];
166  float m_tr_pt[2000];
167  float m_tr_eta[2000];
168  float m_tr_phi[2000];
169  int m_tr_charge[2000];
170  float m_tr_chisq[2000];
171  int m_tr_ndf[2000];
172  int m_tr_silicon_hits[2000];
173 
174  // Distance of closest approach
175  float m_tr_dca_xy[2000];
176  float m_tr_dca_xy_error[2000];
177  float m_tr_dca_z[2000];
178  float m_tr_dca_z_error[2000];
179 
180  // Initial point of track
181  float m_tr_x[2000];
182  float m_tr_y[2000];
183  float m_tr_z[2000];
184 
185  // Vertex id of track
186  int m_tr_vertex_id[2000];
187 
188  // Vertex ids and positions, also stored on track tree
189  int m_vertex_id[100];
190  float m_vx[100];
191  float m_vy[100];
192  float m_vz[100];
193 
194  // Projection of track to calorimeters
195  // CEMC
196  float m_tr_cemc_eta[2000];
197  float m_tr_cemc_phi[2000];
198  // Inner HCAL
199  float m_tr_ihcal_eta[2000];
200  float m_tr_ihcal_phi[2000];
202  float m_tr_ohcal_eta[2000];
203  float m_tr_ohcal_phi[2000];
204 
205  // Matched truth track
207  int m_tr_truth_pid[2000];
208  float m_tr_truth_e[2000];
209  float m_tr_truth_pt[2000];
210  float m_tr_truth_eta[2000];
211  float m_tr_truth_phi[2000];
213 
215  // Centrality variables //
217 
218  // Event Centrality
219  float centrality;
220 
222  // Cluster variables //
224 
225  // CEMC clusters
226  float m_cl_cemc_e[5000];
227  float m_cl_cemc_eta[5000];
228  float m_cl_cemc_phi[5000];
229  float m_cl_cemc_r[5000];
230  float m_cl_cemc_z[5000];
231 
232  // Inner HCAL clusters
233  float m_cl_ihcal_e[1000];
234  float m_cl_ihcal_eta[1000];
235  float m_cl_ihcal_phi[1000];
236  float m_cl_ihcal_r[1000];
237  float m_cl_ihcal_z[1000];
238 
239  // Outer HCAL clusters
240  float m_cl_ohcal_e[1000];
241  float m_cl_ohcal_eta[1000];
242  float m_cl_ohcal_phi[1000];
243  float m_cl_ohcal_r[1000];
244  float m_cl_ohcal_z[1000];
245 
247  // Tower variables //
249 
250  float m_twr_cemc_e[25000];
251  float m_twr_cemc_eta[25000];
252  float m_twr_cemc_phi[25000];
253  int m_twr_cemc_ieta[25000];
254  int m_twr_cemc_iphi[25000];
255 
256  float m_twr_ihcal_e[2000];
257  float m_twr_ihcal_eta[2000];
258  float m_twr_ihcal_phi[2000];
259  int m_twr_ihcal_ieta[2000];
260  int m_twr_ihcal_iphi[2000];
261 
262  float m_twr_ohcal_e[2000];
263  float m_twr_ohcal_eta[2000];
264  float m_twr_ohcal_phi[2000];
265  int m_twr_ohcal_ieta[2000];
266  int m_twr_ohcal_iphi[2000];
267 
269  // Sim tower variables //
271 
272  float m_simtwr_cemc_e[25000];
273  float m_simtwr_cemc_eta[25000];
274  float m_simtwr_cemc_phi[25000];
275  int m_simtwr_cemc_ieta[25000];
276  int m_simtwr_cemc_iphi[25000];
277 
278  float m_simtwr_ihcal_e[2000];
279  float m_simtwr_ihcal_eta[2000];
280  float m_simtwr_ihcal_phi[2000];
283 
284  float m_simtwr_ohcal_e[2000];
285  float m_simtwr_ohcal_eta[2000];
286  float m_simtwr_ohcal_phi[2000];
289 
291  // HepMC particle tree //
293 
294  int m_hepmc_pid[20000];
295  float m_hepmc_e[20000];
296  float m_hepmc_pt[20000];
297  float m_hepmc_eta[20000];
298  float m_hepmc_phi[20000];
299 
301  // G4 particle tree //
303 
304  int m_g4_pid[20000];
305  float m_g4_e[20000];
306  float m_g4_pt[20000];
307  float m_g4_eta[20000];
308  float m_g4_phi[20000];
309  int m_g4_track_id[20000];
310  int m_g4_parent_id[20000];
311 
313  // Additional truth info //
315 
316  // Secondary truth particles
317 
318  int n_child = 0;
319  int child_pid[100000];
320  int child_parent_id[100000];
321  int child_vertex_id[100000];
322  float child_px[100000];
323  float child_py[100000];
324  float child_pz[100000];
325  float child_energy[100000];
326 
327  // Truth particle vertices
328 
329  int n_vertex = 0;
330  int vertex_id[100000];
331  float vertex_x[100000];
332  float vertex_y[100000];
333  float vertex_z[100000];
334 
335  // BH particles
336 
337  int _nBH = 0;
338  float _BH_e[20000];
339  float _BH_px[20000];
340  float _BH_py[20000];
341  float _BH_pz[20000];
342  int _BH_track_id[20000];
343 
344 };
345 
346 #endif // ISOLATEDTRACKANALYSIS_H