LDMX Software
SimParticle.h
1#ifndef SIMCORE_EVENT_SIMPARTICLE_H
2#define SIMCORE_EVENT_SIMPARTICLE_H
3
4/*~~~~~~~~~~*/
5/* ROOT */
6/*~~~~~~~~~~*/
7#include "TObject.h"
8
9/*~~~~~~~~~~~~~~~~*/
10/* C++ StdLib */
11/*~~~~~~~~~~~~~~~~*/
12#include <map>
13#include <string>
14#include <vector>
15
16namespace ldmx {
17
24 public:
29 unknown = 0,
30 annihil = 1,
31 compt = 2,
32 conv = 3,
33 electronNuclear = 4,
34 eBrem = 5,
35 eIoni = 6,
36 msc = 7,
37 phot = 8,
38 photonNuclear = 9,
39 GammaToMuPair = 10,
40 eDarkBrem = 11,
41 Decay = 12,
42 Primary = 13,
43 muonNuclear = 14,
44 neutronInelastic = 15,
45 neutronCapture = 16,
46 kaonInelastic = 17,
47 pionInelastic = 18,
48 protonInelastic = 19,
49 // Only add additional processes to the end of this list!
50 };
51
53 typedef std::map<std::string, ProcessType> ProcessTypeMap;
54
56 SimParticle() = default;
57
59 virtual ~SimParticle() = default;
60
62 void Clear();
63
65 void Print() const;
66
72 double getEnergy() const { return energy_; }
73
79 double getKineticEnergy() const { return energy_ - mass_; }
85 int getPdgID() const { return pdgID_; }
86
94 int getGenStatus() const { return genStatus_; }
95
101 double getTime() const { return time_; }
102
113 std::vector<double> getVertex() const { return {x_, y_, z_}; }
114
122 std::string getVertexVolume() const { return vertexVolume_; }
123
130 std::vector<double> getEndPoint() const { return {endX_, endY_, endZ_}; }
131
139 std::vector<double> getMomentum() const { return {px_, py_, pz_}; }
140
146 double getMass() const { return mass_; }
147
153 double getCharge() const { return charge_; }
154
161 std::vector<int> getDaughters() const { return daughters_; }
162
168 std::vector<int> getParents() const { return parents_; }
169
175 void setEnergy(const double& energy) { energy_ = energy; }
176
182 void setPdgID(const int& pdgID) { pdgID_ = pdgID; }
183
189 void setGenStatus(const int& genStatus) { genStatus_ = genStatus; }
190
196 void setTime(const double& time) { time_ = time; }
197
205 void setVertex(const double& x, const double& y, const double& z) {
206 x_ = x;
207 y_ = y;
208 z_ = z;
209 }
210
217 void setVertexVolume(const std::string& vertexVolume) {
218 vertexVolume_ = vertexVolume;
219 }
220
228 void setEndPoint(const double& endX, const double& endY, const double& endZ) {
229 endX_ = endX;
230 endY_ = endY;
231 endZ_ = endZ;
232 }
233
241 void setMomentum(const double& px, const double& py, const double& pz) {
242 px_ = px;
243 py_ = py;
244 pz_ = pz;
245 }
246
252 void setMass(const double& mass) { mass_ = mass; }
253
259 void setCharge(const double& charge) { charge_ = charge; }
260
269 void addDaughter(const int& daughterTrackID) {
270 daughters_.push_back(daughterTrackID);
271 }
272
278 void addParent(const int& parentTrackID) {
279 parents_.push_back(parentTrackID);
280 }
281
287 int getProcessType() const { return processType_; }
288
294 void setProcessType(const int& processType) { processType_ = processType; }
295
303 void setEndPointMomentum(const double& endpx, const double& endpy,
304 const double& endpz) {
305 endpx_ = endpx;
306 endpy_ = endpy;
307 endpz_ = endpz;
308 }
309
315 std::vector<double> getEndPointMomentum() const {
316 return {endpx_, endpy_, endpz_};
317 }
318
324 static ProcessType findProcessType(std::string processName);
325
326 private:
327 static ProcessTypeMap createProcessTypeMap();
328
329 private:
331 double energy_{0};
332
334 int pdgID_{0};
335
337 int genStatus_{-1};
338
340 double time_{0};
341
343 double x_{0};
344
346 double y_{0};
347
349 double z_{0};
350
352 double endX_{0};
353
355 double endY_{0};
356
358 double endZ_{0};
359
361 double px_{0};
362
364 double py_{0};
365
367 double pz_{0};
368
370 double endpx_{0};
371
373 double endpy_{0};
374
376 double endpz_{0};
377
379 double mass_{0};
380
382 double charge_{0};
383
385 std::vector<int> daughters_;
386
388 std::vector<int> parents_;
389
392
394 std::string vertexVolume_{""};
395
398
399 ClassDef(SimParticle, 7);
400
401}; // SimParticle
402} // namespace ldmx
403
404#endif // SIMCORE_EVENT_SIMPARTICLE_H
Class representing a simulated particle.
Definition SimParticle.h:23
double getCharge() const
Get the charge of this particle.
double pz_
The z component of the momentum.
double getMass() const
Get the mass of this particle [GeV].
double endpz_
The z component of the endpoint momentum.
ProcessType
Enum for interesting process types.
Definition SimParticle.h:28
std::string getVertexVolume() const
Get the volume name in which this particle was created in.
double getTime() const
Get the global time of this particle's creation [ns].
int processType_
Encoding of Geant4 process type.
double getEnergy() const
Get the energy of this particle [MeV].
Definition SimParticle.h:72
void setGenStatus(const int &genStatus)
Set the generator status of this particle.
double x_
The x component of the vertex.
void setVertex(const double &x, const double &y, const double &z)
Set the vertex of this particle [mm].
double py_
The y component of the momentum.
virtual ~SimParticle()=default
Destructor.
std::vector< int > getParents() const
Get a vector containing the track IDs of the parent particles.
std::vector< double > getVertex() const
Get a vector containing the vertex of this particle in mm.
double endX_
The x component of the end point.
void setProcessType(const int &processType)
Set the creator process type of this particle.
double y_
The y component of the vertex.
std::vector< int > daughters_
The list of daughter particle track IDs.
int genStatus_
The generator status.
double endY_
The y component of the end point.
void setMomentum(const double &px, const double &py, const double &pz)
Set the momentum of this particle [MeV].
std::vector< double > getEndPointMomentum() const
Get the momentum at this particle's end point.
double energy_
The energy of this particle.
std::vector< int > getDaughters() const
Get a vector containing the track IDs of all daughter particles.
SimParticle()=default
Constructor.
std::string vertexVolume_
Volume the track was created in.
std::map< std::string, ProcessType > ProcessTypeMap
Typedef for process map.
Definition SimParticle.h:53
void setCharge(const double &charge)
Set the charge of this particle.
int getPdgID() const
Get the PDG ID of this particle.
Definition SimParticle.h:85
void setEnergy(const double &energy)
Set the energy of this particle [MeV].
static ProcessType findProcessType(std::string processName)
Get the process type enum from a G4VProcess name.
int getGenStatus() const
Get the generator status of this particle.
Definition SimParticle.h:94
void setEndPointMomentum(const double &endpx, const double &endpy, const double &endpz)
Set the momentum at this particle's end point.
double endpx_
The x component of the endpoint momentum.
std::vector< double > getEndPoint() const
Get the endpoint of this particle where it was destroyed or left the world volume [mm].
double charge_
The particle's charge.
void addDaughter(const int &daughterTrackID)
Add a reference to a daughter particle by its track ID.
double px_
The x component of the momentum.
std::vector< double > getMomentum() const
Get a vector containing the momentum of this particle [MeV].
void Clear()
Reset an instance of this class by clearing all of its data.
void Print() const
Print a string representation of this object.
static ProcessTypeMap PROCESS_MAP
Map containing the process types.
void addParent(const int &parentTrackID)
Add a reference to a parent particle by its track ID.
double endZ_
The z component of the end point.
double z_
The z component of the vertex.
void setMass(const double &mass)
Set the mass of this particle [GeV].
double mass_
The particle's mass.
int pdgID_
The PDG ID of this particle.
std::vector< int > parents_
The list of parent particles track IDs.
void setVertexVolume(const std::string &vertexVolume)
Set the name of the volume that this particle was created in.
double endpy_
The y component of the endpoint momentum.
int getProcessType() const
Get the creator process type of this particle.
void setPdgID(const int &pdgID)
Set the PDG ID of this particle.
void setTime(const double &time)
Set the global time of this particle's creation [ns].
double getKineticEnergy() const
Get the kinetic energy of this particle [MeV].
Definition SimParticle.h:79
void setEndPoint(const double &endX, const double &endY, const double &endZ)
Set the end point position of this particle [mm].
double time_
The global creation time.