Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QAG4SimulationTruthDecay.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file QAG4SimulationTruthDecay.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef GEANTTESTER_H
4 #define GEANTTESTER_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <decayfinder/DecayFinderContainer_v1.h> // for DecayFinderContainer_v1
9 
10 #include <g4main/PHG4Particle.h>
12 #include <g4main/PHG4VtxPoint.h>
13 
14 #include <TBranch.h>
15 #include <TFile.h>
16 #include <TTree.h>
17 
18 #include <string>
19 
20 class PHCompositeNode;
22 class PHG4Particle;
23 class PHG4VtxPoint;
24 
26 {
27  public:
28  QAG4SimulationTruthDecay(const std::string &name = "QAG4SimulationTruthDecay");
29 
30  virtual ~QAG4SimulationTruthDecay();
31 
37  int Init(PHCompositeNode *topNode) override;
38 
42  int process_event(PHCompositeNode *topNode) override;
43 
45 
47  int End(PHCompositeNode *topNode) override;
48 
49  void setMotherPDG(int PDGID) { m_decay_pdg_id = PDGID; }
50 
51  void setMotherPDGRange(int min, int max)
52  {
54  m_mother_PDG_ID_max = max;
55  };
56  void setDaughterPDGRange(int min, int max)
57  {
60  };
61 
62  void setMinPT(float value) { m_pt_min = value; }
63 
64  void setEtaRange(float min, float max)
65  {
66  m_eta_min = min;
67  m_eta_max = max;
68  }
69 
70  void setNBinsMass(int nBins) { m_mass_nBins = nBins; }
71  void setMassRange(float min, float max)
72  {
73  m_mass_min = min;
74  m_mass_max = max;
75  }
76 
77  void setNBinsDecayLength(int nBins) { m_decayLength_nBins = nBins; }
78  void setDecayLengthRange(float min, float max)
79  {
81  m_decayLength_max = max;
82  }
83 
84  void setNBinsDecayTime(int nBins) { m_decayTime_nBins = nBins; }
85  void setDecayTimeRange(float min, float max)
86  {
88  m_decayTime_max = max;
89  }
90 
94 
95  private:
96  typedef std::vector<std::pair<std::pair<int, int>, int>> Decay;
97 
98  unsigned int m_nTracks;
99  float m_pt_min;
100  float m_eta_min;
101  float m_eta_max;
103 
108  TFile *m_outfile;
109  TTree *m_tree;
113 
114  void initializeBranches();
115  void getMotherPDG(PHCompositeNode *topNode);
116  std::vector<int> getDecayFinderMothers(PHCompositeNode *topNode);
117  bool isInRange(float min, float value, float max);
118  void resetValues();
119 
124 
125  int m_mass_nBins = 100;
126  float m_mass_min = 0;
127  float m_mass_max = 2;
128 
130  float m_decayLength_min = 0;
131  float m_decayLength_max = 1;
132 
133  int m_decayTime_nBins = 100;
134  float m_decayTime_min = 0;
135  float m_decayTime_max = 0.1;
136 
137  static const int max_tracks = 20;
138  unsigned int m_event_number = 0;
139  float m_mother_mass = -99;
141  float m_mother_decayLength = -99;
142  float m_mother_decayTime = -99;
143  int m_mother_pdg_id = -99;
144  float m_mother_px = 0;
145  float m_mother_py = 0;
146  float m_mother_pz = 0;
147  float m_mother_pE = 0;
148  float m_mother_pT = 0;
149  float m_mother_eta = 0;
150  int m_mother_barcode = -99;
152  float m_track_px[max_tracks] = {0};
153  float m_track_py[max_tracks] = {0};
154  float m_track_pz[max_tracks] = {0};
155  float m_track_pE[max_tracks] = {0};
156  float m_track_pT[max_tracks] = {0};
157  float m_track_eta[max_tracks] = {0};
158  float m_track_mass[max_tracks] = {0};
160  float m_delta_px = 0;
161  float m_delta_py = 0;
162  float m_delta_pz = 0;
163  float m_delta_pE = 0;
164  bool m_accept_px_1percent = false;
165  bool m_accept_py_1percent = false;
166  bool m_accept_pz_1percent = false;
167  bool m_accept_pE_1percent = false;
168  bool m_accept_px_5percent = false;
169  bool m_accept_py_5percent = false;
170  bool m_accept_pz_5percent = false;
171  bool m_accept_pE_5percent = false;
172  bool m_accept_px_15percent = false;
173  bool m_accept_py_15percent = false;
174  bool m_accept_pz_15percent = false;
175  bool m_accept_pE_15percent = false;
176  bool m_accept_eta = true;
177  bool m_accept_pT = true;
178 };
179 
180 #endif // GEANTTESTER_H