LDMX Software
SimParticle.cxx
1#include "SimCore/Event/SimParticle.h"
2
3/*~~~~~~~~~~~~~~~~*/
4/* C++ StdLib */
5/*~~~~~~~~~~~~~~~~*/
6#include <iostream>
7
8ClassImp(ldmx::SimParticle);
9
10namespace ldmx {
12 ProcessTypeMap proc_map;
15 proc_map["eBrem"] = ProcessType::eBrem;
17 proc_map["conv"] = ProcessType::conv;
19 proc_map["annihil"] = ProcessType::annihil;
21 proc_map["compt"] = ProcessType::compt;
23 proc_map["phot"] = ProcessType::phot;
25 proc_map["eIoni"] = ProcessType::eIoni;
27 proc_map["msc"] = ProcessType::msc;
29 proc_map["photonNuclear"] = ProcessType::photonNuclear;
31 proc_map["muonNuclear"] = ProcessType::muonNuclear;
33 proc_map["electronNuclear"] = ProcessType::electronNuclear;
35 proc_map["GammaToMuPair"] = ProcessType::GammaToMuPair;
37 proc_map["DarkBrem"] = ProcessType::eDarkBrem;
38
39 // Inelastic interactions
41 proc_map["neutronInelastic"] = ProcessType::neutronInelastic;
43 proc_map["neutronCapture"] = ProcessType::neutronCapture;
45 proc_map["kaon-Inelastic"] = ProcessType::kaonInelastic;
46 proc_map["kaon+Inelastic"] = ProcessType::kaonInelastic;
47 proc_map["kaon0LInelastic"] = ProcessType::kaonInelastic;
48 proc_map["kaon0SInelastic"] = ProcessType::kaonInelastic;
50 proc_map["pi-Inelastic"] = ProcessType::pionInelastic;
51 proc_map["pi+Inelastic"] = ProcessType::pionInelastic;
53 proc_map["protonInelastic"] = ProcessType::protonInelastic;
54
57 proc_map["Primary"] = ProcessType::Primary;
58 // Decay
59 proc_map["Decay"] = ProcessType::Decay;
60 return proc_map;
61}
62
65
67 daughters_.clear();
68 parents_.clear();
69
70 energy_ = 0;
71 pdg_id_ = 0;
72 gen_status_ = -1;
73 time_ = 0;
74 vtx_x_ = 0;
75 vtx_y_ = 0;
76 vtx_z_ = 0;
77 end_x_ = 0;
78 end_y_ = 0;
79 end_z_ = 0;
80 px_ = 0;
81 py_ = 0;
82 pz_ = 0;
83 end_px_ = 0;
84 end_py_ = 0;
85 end_pz_ = 0;
86 mass_ = 0;
87 charge_ = 0;
88 process_type_ = ProcessType::unknown;
89 vertex_volume_ = "";
90}
91
92std::ostream& operator<<(std::ostream& o, const SimParticle& sp) {
93 return o << "SimParticle { " << "energy: " << sp.energy_ << ", "
94 << "pdg_id: " << sp.pdg_id_ << ", "
95 << "gen_status: " << sp.gen_status_ << ", " << "time: " << sp.time_
96 << ", " << "vertex: ( " << sp.vtx_x_ << ", " << sp.vtx_y_ << ", "
97 << sp.vtx_z_ << " ), " << "end_point: ( " << sp.end_x_ << ", "
98 << sp.end_y_ << ", " << sp.end_z_ << " ), " << "momentum: ( "
99 << sp.px_ << ", " << sp.py_ << ", " << sp.pz_ << " ), "
100 << "end_point_momentum: ( " << sp.end_px_ << ", " << sp.end_py_
101 << ", " << sp.end_pz_ << " ), " << "mass: " << sp.mass_ << ", "
102 << "n_daughters: " << sp.daughters_.size() << ", "
103 << "n_parents: " << sp.parents_.size() << ", "
104 << "process_type: " << sp.process_type_ << ", "
105 << "vertex_volume: " << sp.vertex_volume_ << " }";
106}
107
109 std::string process_name) {
110 if (process_name.find("biasWrapper") != std::string::npos) {
111 std::size_t pos = process_name.find_first_of("(") + 1;
112 process_name = process_name.substr(pos, process_name.size() - pos - 1);
113 }
114
115 if (process_map.find(process_name) != process_map.end()) {
116 return process_map[process_name];
117 } else {
118 return ProcessType::unknown;
119 }
120}
121} // namespace ldmx
Class representing a simulated particle.
Definition SimParticle.h:23
double end_py_
The y component of the end_point momentum.
double pz_
The z component of the momentum.
ProcessType
Enum for interesting process types.
Definition SimParticle.h:28
double py_
The y component of the momentum.
double vtx_x_
The x component of the vertex.
static ProcessType findProcessType(std::string processName)
Get the process type enum from a G4VProcess name.
std::vector< int > daughters_
The list of daughter particle track IDs.
int process_type_
Encoding of Geant4 process type.
double end_x_
The x component of the end point.
double energy_
The energy of this particle.
double end_pz_
The z component of the end_point momentum.
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
double end_z_
The z component of the end point.
double mass_
The particle's mass.
std::vector< int > parents_
The list of parent particles track IDs.
double end_px_
The x component of the end_point momentum.
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.
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.