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 friend std::ostream& operator<<(std::ostream& o, const SimParticle& d);
66
72 double getEnergy() const { return energy_; }
73
79 double getKineticEnergy() const { return energy_ - mass_; }
85 int getPdgID() const { return pdg_id_; }
86
94 int getGenStatus() const { return gen_status_; }
95
101 double getTime() const { return time_; }
102
113 std::vector<double> getVertex() const { return {vtx_x_, vtx_y_, vtx_z_}; }
114
122 std::string getVertexVolume() const { return vertex_volume_; }
123
131 std::string getInteractionMaterial() const { return interaction_material_; }
132
139 std::vector<double> getEndPoint() const { return {end_x_, end_y_, end_z_}; }
140
148 std::vector<double> getMomentum() const { return {px_, py_, pz_}; }
149
155 double getMass() const { return mass_; }
156
162 double getCharge() const { return charge_; }
163
170 std::vector<int> getDaughters() const { return daughters_; }
171
177 std::vector<int> getParents() const { return parents_; }
178
184 void setEnergy(const double& energy) { energy_ = energy; }
185
191 void setPdgID(const int& pdg_id) { pdg_id_ = pdg_id; }
192
198 void setGenStatus(const int& gen_status) { gen_status_ = gen_status; }
199
205 void setTime(const double& time) { time_ = time; }
206
214 void setVertex(const double& vtx_x, const double& vtx_y,
215 const double& vtx_z) {
216 vtx_x_ = vtx_x;
217 vtx_y_ = vtx_y;
218 vtx_z_ = vtx_z;
219 }
220
227 void setVertexVolume(const std::string& vertexVolume) {
228 vertex_volume_ = vertexVolume;
229 }
230
237 void setInteractionMaterial(const std::string& interaction_material) {
238 interaction_material_ = interaction_material;
239 }
240
248 void setEndPoint(const double& end_x, const double& end_y,
249 const double& end_z) {
250 end_x_ = end_x;
251 end_y_ = end_y;
252 end_z_ = end_z;
253 }
254
262 void setMomentum(const double& px, const double& py, const double& pz) {
263 px_ = px;
264 py_ = py;
265 pz_ = pz;
266 }
267
273 void setMass(const double& mass) { mass_ = mass; }
274
280 void setCharge(const double& charge) { charge_ = charge; }
281
290 void addDaughter(const int& daughter_track_id) {
291 daughters_.push_back(daughter_track_id);
292 }
293
299 void addParent(const int& parent_track_id) {
300 parents_.push_back(parent_track_id);
301 }
302
308 int getProcessType() const { return process_type_; }
309
315 void setProcessType(const int& process_type) { process_type_ = process_type; }
316
324 void setEndPointMomentum(const double& end_px, const double& end_py,
325 const double& end_pz) {
326 end_px_ = end_px;
327 end_py_ = end_py;
328 end_pz_ = end_pz;
329 }
330
336 std::vector<double> getEndPointMomentum() const {
337 return {end_px_, end_py_, end_pz_};
338 }
339
345 static ProcessType findProcessType(std::string processName);
346
347 private:
349
350 private:
352 double energy_{0};
353
355 int pdg_id_{0};
356
358 int gen_status_{-1};
359
361 double time_{0};
362
364 double vtx_x_{0};
365
367 double vtx_y_{0};
368
370 double vtx_z_{0};
371
373 double end_x_{0};
374
376 double end_y_{0};
377
379 double end_z_{0};
380
382 double px_{0};
383
385 double py_{0};
386
388 double pz_{0};
389
391 double end_px_{0};
392
394 double end_py_{0};
395
397 double end_pz_{0};
398
400 double mass_{0};
401
403 double charge_{0};
404
406 std::vector<int> daughters_;
407
409 std::vector<int> parents_;
410
413
415 std::string vertex_volume_{""};
416
418 std::string interaction_material_{""};
419
422
423 ClassDef(SimParticle, 8);
424
425}; // SimParticle
426} // namespace ldmx
427
428#endif // SIMCORE_EVENT_SIMPARTICLE_H
Class representing a simulated particle.
Definition SimParticle.h:23
double getCharge() const
Get the charge of this particle.
double end_py_
The y component of the end_point momentum.
double pz_
The z component of the momentum.
double getMass() const
Get the mass of this particle [GeV].
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.
void setPdgID(const int &pdg_id)
Set the PDG ID of this particle.
double getTime() const
Get the global time of this particle's creation [ns].
double getEnergy() const
Get the energy of this particle [MeV].
Definition SimParticle.h:72
void setEndPointMomentum(const double &end_px, const double &end_py, const double &end_pz)
Set the momentum at this particle's end point.
double py_
The y component of the momentum.
void addParent(const int &parent_track_id)
Add a reference to a parent particle by its track ID.
void setProcessType(const int &process_type)
Set the creator process type of this particle.
virtual ~SimParticle()=default
Destructor.
double vtx_x_
The x component of the vertex.
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.
static ProcessType findProcessType(std::string processName)
Get the process type enum from a G4VProcess name.
std::string getInteractionMaterial() const
Get the material name in which this particle was created in.
std::vector< int > daughters_
The list of daughter particle track IDs.
int process_type_
Encoding of Geant4 process type.
void setMomentum(const double &px, const double &py, const double &pz)
Set the momentum of this particle [MeV].
double end_x_
The x component of the end point.
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.
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
double end_pz_
The z component of the end_point momentum.
void setEnergy(const double &energy)
Set the energy of this particle [MeV].
int getGenStatus() const
Get the generator status of this particle.
Definition SimParticle.h:94
void setGenStatus(const int &gen_status)
Set the generator status of this particle.
std::vector< double > getEndPoint() const
Get the end_point of this particle where it was destroyed or left the world volume [mm].
double vtx_y_
The y component of the vertex.
double charge_
The particle's charge.
double end_y_
The y component of the end point.
double px_
The x component of the momentum.
std::map< std::string, ProcessType > ProcessTypeMap
Typedef for process map.
Definition SimParticle.h:53
std::vector< double > getMomentum() const
Get a vector containing the momentum of this particle [MeV].
double end_z_
The z component of the end point.
std::string interaction_material_
Volume the track was created in.
void setMass(const double &mass)
Set the mass of this particle [GeV].
void setVertex(const double &vtx_x, const double &vtx_y, const double &vtx_z)
Set the vertex of this particle [mm].
double mass_
The particle's mass.
std::vector< int > parents_
The list of parent particles track IDs.
void setEndPoint(const double &end_x, const double &end_y, const double &end_z)
Set the end point position of this particle [mm].
void setVertexVolume(const std::string &vertexVolume)
Set the name of the volume that this particle was created in.
double end_px_
The x component of the end_point momentum.
int getProcessType() const
Get the creator process type 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
double vtx_z_
The z component of the vertex.
static ProcessTypeMap createProcessTypeMap()
int pdg_id_
The PDG ID of this particle.
int gen_status_
The generator status.
friend std::ostream & operator<<(std::ostream &o, const SimParticle &d)
Print a string representation of this object.
void addDaughter(const int &daughter_track_id)
Add a reference to a daughter particle by its track ID.
static ProcessTypeMap process_map
Map containing the process types.
void clear()
Reset an instance of this class by clearing all of its data.
double time_
The global creation time.
std::string vertex_volume_
Volume the track was created in.
void setInteractionMaterial(const std::string &interaction_material)
Set the name of the material that this particle was created in.