This repository was archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserTrackInformation.h
More file actions
171 lines (146 loc) · 4.72 KB
/
Copy pathUserTrackInformation.h
File metadata and controls
171 lines (146 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndef SIMCORE_USERTRACKINFORMATION_H
#define SIMCORE_USERTRACKINFORMATION_H
#include "G4ThreeVector.hh"
#include "G4Track.hh"
#include "G4VUserTrackInformation.hh"
namespace simcore {
/**
* Provides user defined information to associate with a Geant4 track.
*
* This is helpful for keeping track of information we care about
* that Geant4 doesn't persist by default.
*/
class UserTrackInformation : public G4VUserTrackInformation {
public:
/// Constructor
UserTrackInformation() = default;
virtual ~UserTrackInformation() = default;
/**
* get
*
* A static helper function for getting the track information
* from the passed G4Track. If the track doesn't have an
* information attached, a new one is created.
*
* @note The return value of this pointer is never NULL.
*
* @param[in] track G4Track to get information from
*/
static UserTrackInformation* get(const G4Track* track);
/**
* Initialize the track information with the passed track.
*
* We assume the passed track is newly created
* so we can copy its "current" kinematics and define
* those kinematics to be the "vertex" kinematics.
*
* Even though we are "initializing" the track,
* we only change the kinematic values. The boolean
* flags may have been edited prior to the track reaching
* its own processing phase (where it is initialized),
* so those flags should (and are) not changed here.
*/
void initialize(const G4Track* track);
/// Print the information associated with the track.
void Print() const final override;
/**
* Get the flag which indicates whether this track should be saved
* as a Trajectory.
*
* @return The save flag.
*/
bool getSaveFlag() const { return saveFlag_; }
/**
* Set the save flag so the associated track will be persisted
* as a Trajectory.
*
* @param[in] saveFlag True to save the associated track.
*/
void setSaveFlag(bool saveFlag) { saveFlag_ = saveFlag; }
/**
* Check whether this track is a brem candidate.
*
* @return True if this track is a brem candidate, false otherwise.
*/
bool isBremCandidate() const { return isBremCandidate_; }
/**
* Tag this track as a brem candidate by the biasing filters.
*
* @param[in] isBremCandidate flag indicating whether this track is
* a candidate or not.
*/
void tagBremCandidate(bool isBremCandidate = true) {
isBremCandidate_ = isBremCandidate;
}
/**
* Check whether this track is a recoil electron.
*
* @return true if this track is a recoil electron, false otherwise.
*/
bool isRecoilElectron() const { return isRecoilElectron_; }
/**
* Tag this track as a recoil electron by the biasing filters.
*
* @param[in] isRecoilElectron flag indicating whether this track is
* a recoil electron or not.
*/
void tagRecoilElectron(bool isRecoilElectron = true) {
isRecoilElectron_ = isRecoilElectron;
}
/**
* Check whether this track is a photon that has undergone a
* photo-nuclear reaction.
*
* @return True if this track is a photon that has undergone a
* photo-nuclear reaction, false otherwise.
*/
bool isPNGamma() const { return isPNGamma_; }
/**
* Tag this track as a photon that has undergone a photo-nuclear
* reaction.
*
* @param[in] isPNGamma flag indicating whether this track has
* undergone a photo-nuclear reaction or not.
*/
void tagPNGamma(bool isPNGamma = true) { isPNGamma_ = isPNGamma; }
/**
* Get the initial momentum 3-vector of the track [MeV].
*
* @return The initial momentum of the track.
*/
const G4ThreeVector& getInitialMomentum() const { return initialMomentum_; }
/**
* Get the name of the volume that this track was created in.
*/
std::string getVertexVolume() const { return vertexVolume_; }
/**
* Get the global time at which this track was created.
*/
double getVertexTime() const { return vertex_time_; }
private:
/**
* Flag for saving the track as a Trajectory.
*
* Default value is false because we want to save space
* in the output file. We assume everywhere else that
* the save flag is false unless some other part changes it.
*/
bool saveFlag_{false};
/// Flag indicating whether this track is a brem candidate
bool isBremCandidate_{false};
/// Flag indicating whether this track is a recoil electron
bool isRecoilElectron_{false};
/**
* Flag indicating whether this track has undergone a photo-nuclear
* reaction.
*/
bool isPNGamma_{false};
/// Volume the track was created in.
std::string vertexVolume_{""};
/// Global Time of Creation
double vertex_time_{0.};
/// The initial momentum of the track.
G4ThreeVector initialMomentum_;
};
} // namespace simcore
#endif