LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 <iostream>
11 #include <vector>
12 
13 class TempHit {
14 private:
15  int ID;
16  int trackID;
17  int ParentID; // Geant4 supplied Parent track ID
18  bool isfirstinVolume; // Geant4 is first in Volume
19  bool islastinVolume; // Geant4 is last in Volume
21  float entryX;
22  float entryY;
23  float entryZ;
24  float entryT;
25  float exitX;
26  float exitY;
27  float exitZ;
28  float exitT;
29  float exitMomentumX;
30  float exitMomentumY;
31  float exitMomentumZ;
32 
33 public:
34  // Default constructor
35 
36  TempHit() {}
37  bool operator<(const TempHit& other) const;
38  bool operator==(const TempHit& other) const;
39  // Hide the following from Root
40 #ifndef __GCCXML__
41 
42  TempHit(int iID,
43  int itrackID,
44  int iParentID, // Geant4 supplied Parent track ID
45  bool iisfirstinVolume, // Geant4 is first in Volume
46  bool iislastinVolume, // Geant4 is last in Volume
47  float ienergyDeposited,
48  float ientryX,
49  float ientryY,
50  float ientryZ,
51  float ientryT,
52  float iexitX,
53  float iexitY,
54  float iexitZ,
55  float iexitT,
56  float iexitMomentumX,
57  float iexitMomentumY,
58  float iexitMomentumZ)
59  : ID(iID)
60  , trackID(itrackID)
61  , ParentID(iParentID)
62  , isfirstinVolume(iisfirstinVolume)
63  , islastinVolume(iislastinVolume)
64  , energyDeposited(ienergyDeposited)
65  , entryX(ientryX)
66  , entryY(ientryY)
67  , entryZ(ientryZ)
68  , entryT(ientryT)
69  , exitX(iexitX)
70  , exitY(iexitY)
71  , exitZ(iexitZ)
72  , exitT(iexitT)
73  , exitMomentumX(iexitMomentumX)
74  , exitMomentumY(iexitMomentumY)
75  , exitMomentumZ(iexitMomentumZ)
76  {}
77 
78  void SetExitMomentumZ(float iexitMomentumZ) { this->exitMomentumZ = iexitMomentumZ; }
79 
80  float GetExitMomentumZ() const { return exitMomentumZ; }
81 
82  void SetExitMomentumY(float iexitMomentumY) { this->exitMomentumY = iexitMomentumY; }
83 
84  float GetExitMomentumY() const { return exitMomentumY; }
85 
86  void SetExitMomentumX(float iexitMomentumX) { this->exitMomentumX = iexitMomentumX; }
87 
88  float GetExitMomentumX() const { return exitMomentumX; }
89 
90  void SetExitT(float iexitT) { this->exitT = iexitT; }
91 
92  float GetExitT() const { return exitT; }
93 
94  void SetExitZ(float iexitZ) { this->exitZ = iexitZ; }
95 
96  float GetExitZ() const { return exitZ; }
97 
98  void SetExitY(float iexitY) { this->exitY = iexitY; }
99 
100  float GetExitY() const { return exitY; }
101 
102  void SetExitX(float iexitX) { this->exitX = iexitX; }
103 
104  float GetExitX() const { return exitX; }
105 
106  void SetEntryT(float ientryT) { this->entryT = ientryT; }
107 
108  float GetEntryT() const { return entryT; }
109 
110  void SetEntryZ(float ientryZ) { this->entryZ = ientryZ; }
111 
112  float GetEntryZ() const { return entryZ; }
113 
114  void SetEntryY(float ientryY) { this->entryY = ientryY; }
115 
116  float GetEntryY() const { return entryY; }
117 
118  void SetEntryX(float ientryX) { this->entryX = ientryX; }
119 
120  float GetEntryX() const { return entryX; }
121 
122  void SetEnergyDeposited(float ienergyDeposited) { this->energyDeposited = ienergyDeposited; }
123 
124  float GetEnergyDeposited() const { return energyDeposited; }
125 
126  void SetTrackID(int itrackID) { this->trackID = itrackID; }
127 
128  int GetTrackID() const { return trackID; }
129 
130  void SetID(int iID) { this->ID = iID; }
131 
132  int GetID() const { return ID; }
133 
134  void Print()
135  {
136  std::cout << "TempHit: " << std::endl;
137  std::cout << "copy ID: " << ID << " track ID: " << trackID
138  << " Total energy (MeV) deposited: " << energyDeposited << std::endl;
139  /*
140  int iParentID, // Geant4 supplied Parent track ID
141  bool iisfirstinVolume, // Geant4 is first in Volume
142  bool iislastinVolume, // Geant4 is last in Vol/home/wenzel/trajectory/lArTest/include/TempHit.hh:15:18: error: ‘ int TempHit::ID’ is privateume
143  */
144  std::cout << "Begin position x,y,z (cm) time (ns) of particle: " << entryX << " " << entryY
145  << " " << entryZ << " " << entryT << std::endl;
146  std::cout << "end position x,y,z (cm) time (ns) of particle: " << exitX << " " << exitY << " "
147  << exitZ << " " << exitT << std::endl;
148  std::cout << "end momentum px,py,pz (MeV) of particle: " << exitMomentumX << " "
149  << exitMomentumY << " " << exitMomentumZ << std::endl;
150  }
151 
152  bool IsIslastinVolume() const { return islastinVolume; }
153 
154  bool IsIsfirstinVolume() const { return isfirstinVolume; }
155 
156  int GetParentID() const { return ParentID; }
157  /*
158  bool IsIslastinVolume() const;
159  bool IsIsfirstinVolume() const;
160  int GetParentID() const;
161  */
162 
163 #endif
164 };
165 /*class TempHitSortCriterion {
166 public:
167  bool operator () (const TempHit& th1, const TempHit& th2) const {
168  return th1.GetID()<th2.GetID()|| ((!(th2.GetID()<th1.GetID())) && (th1.GetTrackID()<th2.GetTrackID()));
169  }
170 };
171  */
172 typedef std::vector<TempHit> TempHitCollection;
173 
174 inline bool TempHit::operator<(const TempHit& other) const
175 {
176  return ID < other.ID || (!(other.ID < ID) && trackID < other.trackID) ||
177  (!(other.ID < ID) && !(other.trackID < trackID) && exitT < other.exitT);
178 }
179 
180 inline bool TempHit::operator==(const TempHit& other) const
181 {
182  return (other.trackID == trackID && other.ID == ID);
183 }
184 
185 #endif /* TEMPHIT_H */
void SetEntryZ(float ientryZ)
Definition: TempHit.h:110
float GetEnergyDeposited() const
Definition: TempHit.h:124
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:42
int trackID
Geant4 supplied track ID.
Definition: TempHit.h:16
void SetExitMomentumX(float iexitMomentumX)
Definition: TempHit.h:86
int GetTrackID() const
Definition: TempHit.h:128
bool islastinVolume
Definition: TempHit.h:19
void SetExitX(float iexitX)
Definition: TempHit.h:102
float GetEntryZ() const
Definition: TempHit.h:112
float GetExitMomentumZ() const
Definition: TempHit.h:80
int ParentID
Definition: TempHit.h:17
void SetEntryT(float ientryT)
Definition: TempHit.h:106
bool operator==(const TempHit &other) const
Definition: TempHit.h:180
void SetExitT(float iexitT)
Definition: TempHit.h:90
float GetExitZ() const
Definition: TempHit.h:96
void SetEntryX(float ientryX)
Definition: TempHit.h:118
std::vector< TempHit > TempHitCollection
Definition: TempHit.h:172
float exitY
Exit position Y of particle.
Definition: TempHit.h:26
bool IsIslastinVolume() const
Definition: TempHit.h:152
float GetExitMomentumY() const
Definition: TempHit.h:84
float energyDeposited
total energy deposited for this track ID and time
Definition: TempHit.h:20
void Print()
Definition: TempHit.h:134
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:98
void SetID(int iID)
Definition: TempHit.h:130
void SetExitMomentumZ(float iexitMomentumZ)
Definition: TempHit.h:78
int GetParentID() const
Definition: TempHit.h:156
float GetExitT() const
Definition: TempHit.h:92
void SetEntryY(float ientryY)
Definition: TempHit.h:114
float GetExitMomentumX() const
Definition: TempHit.h:88
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:116
void SetTrackID(int itrackID)
Definition: TempHit.h:126
bool IsIsfirstinVolume() const
Definition: TempHit.h:154
void SetEnergyDeposited(float ienergyDeposited)
Definition: TempHit.h:122
bool operator<(const TempHit &other) const
Definition: TempHit.h:174
float GetExitX() const
Definition: TempHit.h:104
float GetExitY() const
Definition: TempHit.h:100
float entryX
Entry position X of particle.
Definition: TempHit.h:21
int GetID() const
Definition: TempHit.h:132
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:94
float GetEntryT() const
Definition: TempHit.h:108
float GetEntryX() const
Definition: TempHit.h:120
void SetExitMomentumY(float iexitMomentumY)
Definition: TempHit.h:82
float exitT
Exit time of particle.
Definition: TempHit.h:28