TempHit.h
Go to the documentation of this file.
1 /*
2  * File: TempHit.h
3  * Author: wenzel
4  *
5  * Created on October 22, 2018, 2:35 PM
6  */
7 
8 #ifndef TEMPHIT_H
9 #define TEMPHIT_H
10 #include <vector>
11 #include <iostream>
12 
13 class TempHit {
14 private:
15  int ID; ///< Geant4 copy ID
16  int trackID; ///< Geant4 supplied track ID
17  int ParentID; // Geant4 supplied Parent track ID
18  bool isfirstinVolume; // Geant4 is first in Volume
19  bool islastinVolume; // Geant4 is last in Volume
20  float energyDeposited; ///< total energy deposited for this track ID and time
21  float entryX; ///< Entry position X of particle
22  float entryY; ///< Entry position Y of particle
23  float entryZ; ///< Entry position Z of particle
24  float entryT; ///< Entry time of particle
25  float exitX; ///< Exit position X of particle
26  float exitY; ///< Exit position Y of particle
27  float exitZ; ///< Exit position Z of particle
28  float exitT; ///< Exit time of particle
29  float exitMomentumX; ///< Exit X-Momentum of particle
30  float exitMomentumY; ///< Exit Y-Momentum of particle
31  float exitMomentumZ; ///< Exit Z-Momentum of particle
32 
33 public:
34  // Default constructor
35 
36  TempHit() {
37  }
38  bool operator<(const TempHit& other) const;
39  bool operator==(const TempHit& other) const;
40  // Hide the following from Root
41 #ifndef __GCCXML__
42 
43  TempHit(int iID,
44  int itrackID,
45  int iParentID, // Geant4 supplied Parent track ID
46  bool iisfirstinVolume, // Geant4 is first in Volume
47  bool iislastinVolume, // Geant4 is last in Volume
48  float ienergyDeposited,
49  float ientryX,
50  float ientryY,
51  float ientryZ,
52  float ientryT,
53  float iexitX,
54  float iexitY,
55  float iexitZ,
56  float iexitT,
57  float iexitMomentumX,
58  float iexitMomentumY,
59  float iexitMomentumZ) :
60  ID(iID),
61  trackID(itrackID),
62  ParentID(iParentID),
63  isfirstinVolume(iisfirstinVolume),
64  islastinVolume(iislastinVolume),
65  energyDeposited(ienergyDeposited),
66  entryX(ientryX),
67  entryY(ientryY),
68  entryZ(ientryZ),
69  entryT(ientryT),
70  exitX(iexitX),
71  exitY(iexitY),
72  exitZ(iexitZ),
73  exitT(iexitT),
74  exitMomentumX(iexitMomentumX),
75  exitMomentumY(iexitMomentumY),
76  exitMomentumZ(iexitMomentumZ) {
77  }
78 
79  void SetExitMomentumZ(float iexitMomentumZ) {
80  this->exitMomentumZ = iexitMomentumZ;
81  }
82 
83  float GetExitMomentumZ() const {
84  return exitMomentumZ;
85  }
86 
87  void SetExitMomentumY(float iexitMomentumY) {
88  this->exitMomentumY = iexitMomentumY;
89  }
90 
91  float GetExitMomentumY() const {
92  return exitMomentumY;
93  }
94 
95  void SetExitMomentumX(float iexitMomentumX) {
96  this->exitMomentumX = iexitMomentumX;
97  }
98 
99  float GetExitMomentumX() const {
100  return exitMomentumX;
101  }
102 
103  void SetExitT(float iexitT) {
104  this->exitT = iexitT;
105  }
106 
107  float GetExitT() const {
108  return exitT;
109  }
110 
111  void SetExitZ(float iexitZ) {
112  this->exitZ = iexitZ;
113  }
114 
115  float GetExitZ() const {
116  return exitZ;
117  }
118 
119  void SetExitY(float iexitY) {
120  this->exitY = iexitY;
121  }
122 
123  float GetExitY() const {
124  return exitY;
125  }
126 
127  void SetExitX(float iexitX) {
128  this->exitX = iexitX;
129  }
130 
131  float GetExitX() const {
132  return exitX;
133  }
134 
135  void SetEntryT(float ientryT) {
136  this->entryT = ientryT;
137  }
138 
139  float GetEntryT() const {
140  return entryT;
141  }
142 
143  void SetEntryZ(float ientryZ) {
144  this->entryZ = ientryZ;
145  }
146 
147  float GetEntryZ() const {
148  return entryZ;
149  }
150 
151  void SetEntryY(float ientryY) {
152  this->entryY = ientryY;
153  }
154 
155  float GetEntryY() const {
156  return entryY;
157  }
158 
159  void SetEntryX(float ientryX) {
160  this->entryX = ientryX;
161  }
162 
163  float GetEntryX() const {
164  return entryX;
165  }
166 
167  void SetEnergyDeposited(float ienergyDeposited) {
168  this->energyDeposited = ienergyDeposited;
169  }
170 
171  float GetEnergyDeposited() const {
172  return energyDeposited;
173  }
174 
175  void SetTrackID(int itrackID) {
176  this->trackID = itrackID;
177  }
178 
179  int GetTrackID() const {
180  return trackID;
181  }
182 
183  void SetID(int iID) {
184  this->ID = iID;
185  }
186 
187  int GetID() const {
188  return ID;
189  }
190 
191  void Print() {
192  std::cout << "TempHit: " << std::endl;
193  std::cout << "copy ID: " << ID << " track ID: " << trackID << " Total energy (MeV) deposited: " << energyDeposited << std::endl;
194  /*
195  int iParentID, // Geant4 supplied Parent track ID
196  bool iisfirstinVolume, // Geant4 is first in Volume
197  bool iislastinVolume, // Geant4 is last in Vol/home/wenzel/trajectory/lArTest/include/TempHit.hh:15:18: error: ‘ int TempHit::ID’ is privateume
198  */
199  std::cout << "Begin position x,y,z (cm) time (ns) of particle: " << entryX << " " << entryY << " " << entryZ << " " << entryT << std::endl;
200  std::cout << "end position x,y,z (cm) time (ns) of particle: " << exitX << " " << exitY << " " << exitZ << " " << exitT << std::endl;
201  std::cout << "end momentum px,py,pz (MeV) of particle: " << exitMomentumX << " " << exitMomentumY << " " << exitMomentumZ << std::endl;
202  }
203 
204  bool IsIslastinVolume() const {
205  return islastinVolume;
206  }
207 
208  bool IsIsfirstinVolume() const {
209  return isfirstinVolume;
210  }
211 
212  int GetParentID() const {
213  return ParentID;
214  }
215  /*
216  bool IsIslastinVolume() const;
217  bool IsIsfirstinVolume() const;
218  int GetParentID() const;
219  */
220 
221 #endif
222 };
223 /*class TempHitSortCriterion {
224 public:
225  bool operator () (const TempHit& th1, const TempHit& th2) const {
226  return th1.GetID()<th2.GetID()|| ((!(th2.GetID()<th1.GetID())) && (th1.GetTrackID()<th2.GetTrackID()));
227  }
228 };
229  */
230 typedef std::vector<TempHit> TempHitCollection;
231 
232 inline bool TempHit::operator<(const TempHit& other) const {
233  return ID < other.ID ||
234  (!(other.ID < ID) && trackID < other.trackID) ||
235  (!(other.ID < ID) && !(other.trackID < trackID) && exitT < other.exitT);
236 }
237 
238 inline bool TempHit::operator==(const TempHit& other) const {
239  return (other.trackID == trackID && other.ID == ID);
240 }
241 
242 #endif /* TEMPHIT_H */
243 
void SetEntryZ(float ientryZ)
Definition: TempHit.h:143
float GetEnergyDeposited() const
Definition: TempHit.h:171
TempHit(int iID, int itrackID, int iParentID, bool iisfirstinVolume, bool iislastinVolume, float ienergyDeposited, float ientryX, float ientryY, float ientryZ, float ientryT, float iexitX, float iexitY, float iexitZ, float iexitT, float iexitMomentumX, float iexitMomentumY, float iexitMomentumZ)
Definition: TempHit.h:43
int trackID
Geant4 supplied track ID.
Definition: TempHit.h:16
void SetExitMomentumX(float iexitMomentumX)
Definition: TempHit.h:95
int GetTrackID() const
Definition: TempHit.h:179
bool islastinVolume
Definition: TempHit.h:19
void SetExitX(float iexitX)
Definition: TempHit.h:127
float GetEntryZ() const
Definition: TempHit.h:147
float GetExitMomentumZ() const
Definition: TempHit.h:83
int ParentID
Definition: TempHit.h:17
void SetEntryT(float ientryT)
Definition: TempHit.h:135
bool operator==(const TempHit &other) const
Definition: TempHit.h:238
void SetExitT(float iexitT)
Definition: TempHit.h:103
float GetExitZ() const
Definition: TempHit.h:115
void SetEntryX(float ientryX)
Definition: TempHit.h:159
std::vector< TempHit > TempHitCollection
Definition: TempHit.h:230
float exitY
Exit position Y of particle.
Definition: TempHit.h:26
bool IsIslastinVolume() const
Definition: TempHit.h:204
float GetExitMomentumY() const
Definition: TempHit.h:91
float energyDeposited
total energy deposited for this track ID and time
Definition: TempHit.h:20
void Print()
Definition: TempHit.h:191
bool isfirstinVolume
Definition: TempHit.h:18
float exitMomentumX
Exit X-Momentum of particle.
Definition: TempHit.h:29
float entryY
Entry position Y of particle.
Definition: TempHit.h:22
float entryT
Entry time of particle.
Definition: TempHit.h:24
float exitMomentumZ
Exit Z-Momentum of particle.
Definition: TempHit.h:31
void SetExitY(float iexitY)
Definition: TempHit.h:119
void SetID(int iID)
Definition: TempHit.h:183
void SetExitMomentumZ(float iexitMomentumZ)
Definition: TempHit.h:79
int GetParentID() const
Definition: TempHit.h:212
float GetExitT() const
Definition: TempHit.h:107
void SetEntryY(float ientryY)
Definition: TempHit.h:151
float GetExitMomentumX() const
Definition: TempHit.h:99
float exitX
Exit position X of particle.
Definition: TempHit.h:25
float exitMomentumY
Exit Y-Momentum of particle.
Definition: TempHit.h:30
TempHit()
Definition: TempHit.h:36
int ID
Geant4 copy ID.
Definition: TempHit.h:15
float GetEntryY() const
Definition: TempHit.h:155
void SetTrackID(int itrackID)
Definition: TempHit.h:175
bool IsIsfirstinVolume() const
Definition: TempHit.h:208
void SetEnergyDeposited(float ienergyDeposited)
Definition: TempHit.h:167
bool operator<(const TempHit &other) const
Definition: TempHit.h:232
float GetExitX() const
Definition: TempHit.h:131
float GetExitY() const
Definition: TempHit.h:123
float entryX
Entry position X of particle.
Definition: TempHit.h:21
int GetID() const
Definition: TempHit.h:187
float exitZ
Exit position Z of particle.
Definition: TempHit.h:27
float entryZ
Entry position Z of particle.
Definition: TempHit.h:23
void SetExitZ(float iexitZ)
Definition: TempHit.h:111
float GetEntryT() const
Definition: TempHit.h:139
float GetEntryX() const
Definition: TempHit.h:163
QTextStream & endl(QTextStream &s)
void SetExitMomentumY(float iexitMomentumY)
Definition: TempHit.h:87
float exitT
Exit time of particle.
Definition: TempHit.h:28