LDMX Software
SimParticle.cxx
1#include "SimCore/Event/SimParticle.h"
2
3/*~~~~~~~~~~~~~~~~*/
4/* C++ StdLib */
5/*~~~~~~~~~~~~~~~~*/
6#include <iostream>
7
8ClassImp(ldmx::SimParticle)
9
10 namespace ldmx {
11 SimParticle::ProcessTypeMap SimParticle::createProcessTypeMap() {
12 ProcessTypeMap procMap;
15 procMap["eBrem"] = ProcessType::eBrem;
17 procMap["conv"] = ProcessType::conv;
19 procMap["annihil"] = ProcessType::annihil;
21 procMap["compt"] = ProcessType::compt;
23 procMap["phot"] = ProcessType::phot;
25 procMap["eIoni"] = ProcessType::eIoni;
27 procMap["msc"] = ProcessType::msc;
29 procMap["photonNuclear"] = ProcessType::photonNuclear;
31 procMap["muonNuclear"] = ProcessType::muonNuclear;
33 procMap["electronNuclear"] = ProcessType::electronNuclear;
35 procMap["GammaToMuPair"] = ProcessType::GammaToMuPair;
37 procMap["DarkBrem"] = ProcessType::eDarkBrem;
38
39 // Inelastic interactions
41 procMap["neutronInelastic"] = ProcessType::neutronInelastic;
43 procMap["neutronCapture"] = ProcessType::neutronCapture;
45 procMap["kaon-Inelastic"] = ProcessType::kaonInelastic;
46 procMap["kaon+Inelastic"] = ProcessType::kaonInelastic;
47 procMap["kaon0LInelastic"] = ProcessType::kaonInelastic;
48 procMap["kaon0SInelastic"] = ProcessType::kaonInelastic;
50 procMap["pi-Inelastic"] = ProcessType::pionInelastic;
51 procMap["pi+Inelastic"] = ProcessType::pionInelastic;
53 procMap["protonInelastic"] = ProcessType::protonInelastic;
54
57 procMap["Primary"] = ProcessType::Primary;
58 // Decay
59 procMap["Decay"] = ProcessType::Decay;
60 return procMap;
61 }
62
64 SimParticle::createProcessTypeMap();
65
66 void SimParticle::Clear() {
67 daughters_.clear();
68 parents_.clear();
69
70 energy_ = 0;
71 pdgID_ = 0;
72 genStatus_ = -1;
73 time_ = 0;
74 x_ = 0;
75 y_ = 0;
76 z_ = 0;
77 endX_ = 0;
78 endY_ = 0;
79 endZ_ = 0;
80 px_ = 0;
81 py_ = 0;
82 pz_ = 0;
83 endpx_ = 0;
84 endpy_ = 0;
85 endpz_ = 0;
86 mass_ = 0;
87 charge_ = 0;
88 processType_ = ProcessType::unknown;
89 vertexVolume_ = "";
90 }
91
92 void SimParticle::Print() const {
93 std::cout << "SimParticle { "
94 << "energy: " << energy_ << ", "
95 << "PDG ID: " << pdgID_ << ", "
96 << "genStatus: " << genStatus_ << ", "
97 << "time: " << time_ << ", "
98 << "vertex: ( " << x_ << ", " << y_ << ", " << z_ << " ), "
99 << "endPoint: ( " << endX_ << ", " << endY_ << ", " << endZ_
100 << " ), "
101 << "momentum: ( " << px_ << ", " << py_ << ", " << pz_ << " ), "
102 << "endPointMomentum: ( " << endpx_ << ", " << endpy_ << ", "
103 << endpz_ << " ), "
104 << "mass: " << mass_ << ", "
105 << "nDaughters: " << daughters_.size() << ", "
106 << "nParents: " << parents_.size() << ", "
107 << "processType: " << processType_ << ", "
108 << "vertex volume: " << vertexVolume_ << " }" << std::endl;
109 }
110
112 std::string processName) {
113 if (processName.find("biasWrapper") != std::string::npos) {
114 std::size_t pos = processName.find_first_of("(") + 1;
115 processName = processName.substr(pos, processName.size() - pos - 1);
116 }
117
118 if (PROCESS_MAP.find(processName) != PROCESS_MAP.end()) {
119 return PROCESS_MAP[processName];
120 } else {
121 return ProcessType::unknown;
122 }
123 }
124} // namespace ldmx
Class representing a simulated particle.
Definition SimParticle.h:23
double pz_
The z component of the momentum.
double endpz_
The z component of the endpoint momentum.
ProcessType
Enum for interesting process types.
Definition SimParticle.h:28
int processType_
Encoding of Geant4 process type.
double x_
The x component of the vertex.
double py_
The y component of the momentum.
double endX_
The x component of the end point.
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.
double energy_
The energy of this particle.
std::string vertexVolume_
Volume the track was created in.
std::map< std::string, ProcessType > ProcessTypeMap
Typedef for process map.
Definition SimParticle.h:53
static ProcessType findProcessType(std::string processName)
Get the process type enum from a G4VProcess name.
double endpx_
The x component of the endpoint momentum.
double charge_
The particle's charge.
double px_
The x component of the momentum.
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.
double endZ_
The z component of the end point.
double z_
The z component of the vertex.
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.
double endpy_
The y component of the endpoint momentum.
double time_
The global creation time.