LDMX Software
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ldmx::SimParticle Class Reference

Class representing a simulated particle. More...

#include <SimParticle.h>

Public Types

enum  ProcessType {
  unknown = 0 , annihil = 1 , compt = 2 , conv = 3 ,
  electronNuclear = 4 , eBrem = 5 , eIoni = 6 , msc = 7 ,
  phot = 8 , photonNuclear = 9 , GammaToMuPair = 10 , eDarkBrem = 11 ,
  Decay = 12 , Primary = 13 , muonNuclear = 14 , neutronInelastic = 15 ,
  neutronCapture = 16 , kaonInelastic = 17 , pionInelastic = 18 , protonInelastic = 19
}
 Enum for interesting process types. More...
 
typedef std::map< std::string, ProcessTypeProcessTypeMap
 Typedef for process map.
 

Public Member Functions

 SimParticle ()=default
 Constructor.
 
virtual ~SimParticle ()=default
 Destructor.
 
void Clear ()
 Reset an instance of this class by clearing all of its data.
 
void Print () const
 Print a string representation of this object.
 
double getEnergy () const
 Get the energy of this particle [MeV].
 
double getKineticEnergy () const
 Get the kinetic energy of this particle [MeV].
 
int getPdgID () const
 Get the PDG ID of this particle.
 
int getGenStatus () const
 Get the generator status of this particle.
 
double getTime () const
 Get the global time of this particle's creation [ns].
 
std::vector< double > getVertex () const
 Get a vector containing the vertex of this particle in mm.
 
std::string getVertexVolume () const
 Get the volume name in which this particle was created in.
 
std::vector< double > getEndPoint () const
 Get the endpoint of this particle where it was destroyed or left the world volume [mm].
 
std::vector< double > getMomentum () const
 Get a vector containing the momentum of this particle [MeV].
 
double getMass () const
 Get the mass of this particle [GeV].
 
double getCharge () const
 Get the charge of this particle.
 
std::vector< int > getDaughters () const
 Get a vector containing the track IDs of all daughter particles.
 
std::vector< int > getParents () const
 Get a vector containing the track IDs of the parent particles.
 
void setEnergy (const double &energy)
 Set the energy of this particle [MeV].
 
void setPdgID (const int &pdgID)
 Set the PDG ID of this particle.
 
void setGenStatus (const int &genStatus)
 Set the generator status of this particle.
 
void setTime (const double &time)
 Set the global time of this particle's creation [ns].
 
void setVertex (const double &x, const double &y, const double &z)
 Set the vertex of this particle [mm].
 
void setVertexVolume (const std::string &vertexVolume)
 Set the name of the volume that this particle was created in.
 
void setEndPoint (const double &endX, const double &endY, const double &endZ)
 Set the end point position of this particle [mm].
 
void setMomentum (const double &px, const double &py, const double &pz)
 Set the momentum of this particle [MeV].
 
void setMass (const double &mass)
 Set the mass of this particle [GeV].
 
void setCharge (const double &charge)
 Set the charge of this particle.
 
void addDaughter (const int &daughterTrackID)
 Add a reference to a daughter particle by its track ID.
 
void addParent (const int &parentTrackID)
 Add a reference to a parent particle by its track ID.
 
int getProcessType () const
 Get the creator process type of this particle.
 
void setProcessType (const int &processType)
 Set the creator process type of this particle.
 
void setEndPointMomentum (const double &endpx, const double &endpy, const double &endpz)
 Set the momentum at this particle's end point.
 
std::vector< double > getEndPointMomentum () const
 Get the momentum at this particle's end point.
 

Static Public Member Functions

static ProcessType findProcessType (std::string processName)
 Get the process type enum from a G4VProcess name.
 

Private Member Functions

 ClassDef (SimParticle, 7)
 

Static Private Member Functions

static ProcessTypeMap createProcessTypeMap ()
 

Private Attributes

double energy_ {0}
 The energy of this particle.
 
int pdgID_ {0}
 The PDG ID of this particle.
 
int genStatus_ {-1}
 The generator status.
 
double time_ {0}
 The global creation time.
 
double x_ {0}
 The x component of the vertex.
 
double y_ {0}
 The y component of the vertex.
 
double z_ {0}
 The z component of the vertex.
 
double endX_ {0}
 The x component of the end point.
 
double endY_ {0}
 The y component of the end point.
 
double endZ_ {0}
 The z component of the end point.
 
double px_ {0}
 The x component of the momentum.
 
double py_ {0}
 The y component of the momentum.
 
double pz_ {0}
 The z component of the momentum.
 
double endpx_ {0}
 The x component of the endpoint momentum.
 
double endpy_ {0}
 The y component of the endpoint momentum.
 
double endpz_ {0}
 The z component of the endpoint momentum.
 
double mass_ {0}
 The particle's mass.
 
double charge_ {0}
 The particle's charge.
 
std::vector< int > daughters_
 The list of daughter particle track IDs.
 
std::vector< int > parents_
 The list of parent particles track IDs.
 
int processType_ {-1}
 Encoding of Geant4 process type.
 
std::string vertexVolume_ {""}
 Volume the track was created in.
 

Static Private Attributes

static ProcessTypeMap PROCESS_MAP
 Map containing the process types.
 

Detailed Description

Class representing a simulated particle.

The particles are created from the tracks produced by simulation.

Definition at line 23 of file SimParticle.h.

Member Typedef Documentation

◆ ProcessTypeMap

typedef std::map<std::string, ProcessType> ldmx::SimParticle::ProcessTypeMap

Typedef for process map.

Definition at line 53 of file SimParticle.h.

Member Enumeration Documentation

◆ ProcessType

Enum for interesting process types.

Definition at line 28 of file SimParticle.h.

28 {
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 };

Member Function Documentation

◆ addDaughter()

void ldmx::SimParticle::addDaughter ( const int &  daughterTrackID)
inline

Add a reference to a daughter particle by its track ID.

This adds the track ID of the daughter particle to the vector of daughter particle IDs.

Parameters
[in]daughterTrackIDThe daughter particle track ID.

Definition at line 269 of file SimParticle.h.

269 {
270 daughters_.push_back(daughterTrackID);
271 }
std::vector< int > daughters_
The list of daughter particle track IDs.

References daughters_.

◆ addParent()

void ldmx::SimParticle::addParent ( const int &  parentTrackID)
inline

Add a reference to a parent particle by its track ID.

Parameters
[in]parentTrackIDThe track ID of the parent particle.

Definition at line 278 of file SimParticle.h.

278 {
279 parents_.push_back(parentTrackID);
280 }
std::vector< int > parents_
The list of parent particles track IDs.

References parents_.

◆ findProcessType()

static ProcessType ldmx::SimParticle::findProcessType ( std::string  processName)
static

Get the process type enum from a G4VProcess name.

Returns
The process type from the string.

Referenced by simcore::TrackMap::save().

◆ getCharge()

double ldmx::SimParticle::getCharge ( ) const
inline

Get the charge of this particle.

Returns
The charge of this particle.

Definition at line 153 of file SimParticle.h.

153{ return charge_; }
double charge_
The particle's charge.

References charge_.

Referenced by tracking::reco::TruthSeedProcessor::createTruthTrack(), and tracking::reco::TruthSeedProcessor::createTruthTrack().

◆ getDaughters()

std::vector< int > ldmx::SimParticle::getDaughters ( ) const
inline

Get a vector containing the track IDs of all daughter particles.

Returns
A vector containing the track IDs of all daughter particles.

Definition at line 161 of file SimParticle.h.

161{ return daughters_; }

References daughters_.

Referenced by dqm::SampleValidation::analyze(), Analysis::doesParticleHavePNDaughters(), dqm::PhotoNuclearDQM::findDaughters(), and Analysis::getPNGamma().

◆ getEndPoint()

std::vector< double > ldmx::SimParticle::getEndPoint ( ) const
inline

Get the endpoint of this particle where it was destroyed or left the world volume [mm].

Returns
The endpoint of this particle

Definition at line 130 of file SimParticle.h.

130{ return {endX_, endY_, endZ_}; }
double endX_
The x component of the end point.
double endY_
The y component of the end point.
double endZ_
The z component of the end point.

References endX_, endY_, and endZ_.

Referenced by dqm::SampleValidation::analyze().

◆ getEndPointMomentum()

std::vector< double > ldmx::SimParticle::getEndPointMomentum ( ) const
inline

Get the momentum at this particle's end point.

Returns
The momentum at this particle's end point as a vector.

Definition at line 315 of file SimParticle.h.

315 {
316 return {endpx_, endpy_, endpz_};
317 }
double endpz_
The z component of the endpoint momentum.
double endpx_
The x component of the endpoint momentum.
double endpy_
The y component of the endpoint momentum.

References endpx_, endpy_, and endpz_.

◆ getEnergy()

double ldmx::SimParticle::getEnergy ( ) const
inline

Get the energy of this particle [MeV].

Returns
The energy of this particle.

Definition at line 72 of file SimParticle.h.

72{ return energy_; }
double energy_
The energy of this particle.

References energy_.

Referenced by dqm::SampleValidation::analyze(), dqm::PhotoNuclearDQM::classifyCompactEvent(), and dqm::PhotoNuclearDQM::findSubleadingKinematics().

◆ getGenStatus()

int ldmx::SimParticle::getGenStatus ( ) const
inline

Get the generator status of this particle.

A non-zero status indicates that this particle originates from an external generator (e.g. LHE).

Returns
The generator status.

Definition at line 94 of file SimParticle.h.

94{ return genStatus_; }
int genStatus_
The generator status.

References genStatus_.

◆ getKineticEnergy()

double ldmx::SimParticle::getKineticEnergy ( ) const
inline

Get the kinetic energy of this particle [MeV].

Returns
The kinetic energy of this particle.

Definition at line 79 of file SimParticle.h.

79{ return energy_ - mass_; }
double mass_
The particle's mass.

References energy_, and mass_.

◆ getMass()

double ldmx::SimParticle::getMass ( ) const
inline

Get the mass of this particle [GeV].

Returns
The mass of this particle in GeV.

Definition at line 146 of file SimParticle.h.

146{ return mass_; }

References mass_.

◆ getMomentum()

std::vector< double > ldmx::SimParticle::getMomentum ( ) const
inline

Get a vector containing the momentum of this particle [MeV].

The momentum of this particle is set at the time of its creation.

Returns
The momentum of this particle.

Definition at line 139 of file SimParticle.h.

139{ return {px_, py_, pz_}; }
double pz_
The z component of the momentum.
double py_
The y component of the momentum.
double px_
The x component of the momentum.

References px_, py_, and pz_.

Referenced by dqm::SimObjects::analyze(), and tracking::reco::TruthSeedProcessor::createTruthTrack().

◆ getParents()

std::vector< int > ldmx::SimParticle::getParents ( ) const
inline

Get a vector containing the track IDs of the parent particles.

Returns
A vector containing the track IDs the parent particles.

Definition at line 168 of file SimParticle.h.

168{ return parents_; }

References parents_.

Referenced by dqm::SampleValidation::analyze().

◆ getPdgID()

int ldmx::SimParticle::getPdgID ( ) const
inline

Get the PDG ID of this particle.

Returns
The PDG ID of this particle.

Definition at line 85 of file SimParticle.h.

85{ return pdgID_; }
int pdgID_
The PDG ID of this particle.

References pdgID_.

Referenced by dqm::SampleValidation::analyze(), and tracking::reco::TruthSeedProcessor::createTruthTrack().

◆ getProcessType()

int ldmx::SimParticle::getProcessType ( ) const
inline

Get the creator process type of this particle.

Returns
The creator process type of this particle.

Definition at line 287 of file SimParticle.h.

287{ return processType_; }
int processType_
Encoding of Geant4 process type.

References processType_.

◆ getTime()

double ldmx::SimParticle::getTime ( ) const
inline

Get the global time of this particle's creation [ns].

Returns
The global time of this particle's creation.

Definition at line 101 of file SimParticle.h.

101{ return time_; }
double time_
The global creation time.

References time_.

◆ getVertex()

std::vector< double > ldmx::SimParticle::getVertex ( ) const
inline

Get a vector containing the vertex of this particle in mm.

In this case, the vertex refers to the position where the particle is first created in the simulation. For a particle with generator status equal to 1, this will equal the position from which this particle is fired from.

Returns
The vertex of this particle.

Definition at line 113 of file SimParticle.h.

113{ return {x_, y_, z_}; }
double x_
The x component of the vertex.
double y_
The y component of the vertex.
double z_
The z component of the vertex.

References x_, y_, and z_.

Referenced by dqm::SampleValidation::analyze(), tracking::reco::TruthSeedProcessor::createTruthTrack(), and dqm::PhotoNuclearDQM::findRecoilProperties().

◆ getVertexVolume()

std::string ldmx::SimParticle::getVertexVolume ( ) const
inline

Get the volume name in which this particle was created in.

The volumes names are set in the GDML detector description.

Returns
The volume name in which this particle was created in.

Definition at line 122 of file SimParticle.h.

122{ return vertexVolume_; }
std::string vertexVolume_
Volume the track was created in.

References vertexVolume_.

◆ setCharge()

void ldmx::SimParticle::setCharge ( const double &  charge)
inline

Set the charge of this particle.

Parameters
[in]chargeThe charge of this particle.

Definition at line 259 of file SimParticle.h.

259{ charge_ = charge; }

References charge_.

◆ setEndPoint()

void ldmx::SimParticle::setEndPoint ( const double &  endX,
const double &  endY,
const double &  endZ 
)
inline

Set the end point position of this particle [mm].

Parameters
[in]endXThe x position of the end point.
[in]endYThe y position of the end point.
[in]endZThe z position of the end point.

Definition at line 228 of file SimParticle.h.

228 {
229 endX_ = endX;
230 endY_ = endY;
231 endZ_ = endZ;
232 }

References endX_, endY_, and endZ_.

◆ setEndPointMomentum()

void ldmx::SimParticle::setEndPointMomentum ( const double &  endpx,
const double &  endpy,
const double &  endpz 
)
inline

Set the momentum at this particle's end point.

Parameters
[in]endpxThe x component of the momentum.
[in]endpyThe y component of the momentum.
[in]endpzThe z component of the momentum.

Definition at line 303 of file SimParticle.h.

304 {
305 endpx_ = endpx;
306 endpy_ = endpy;
307 endpz_ = endpz;
308 }

References endpx_, endpy_, and endpz_.

◆ setEnergy()

void ldmx::SimParticle::setEnergy ( const double &  energy)
inline

Set the energy of this particle [MeV].

Parameters
[in]energythe energy of this particle.

Definition at line 175 of file SimParticle.h.

175{ energy_ = energy; }

References energy_.

◆ setGenStatus()

void ldmx::SimParticle::setGenStatus ( const int &  genStatus)
inline

Set the generator status of this particle.

Parameters
[in]genStatusthe generator status of the hit.

Definition at line 189 of file SimParticle.h.

189{ genStatus_ = genStatus; }

References genStatus_.

Referenced by simcore::TrackMap::save().

◆ setMass()

void ldmx::SimParticle::setMass ( const double &  mass)
inline

Set the mass of this particle [GeV].

Parameters
[in]massThe mass of this particle.

Definition at line 252 of file SimParticle.h.

252{ mass_ = mass; }

References mass_.

◆ setMomentum()

void ldmx::SimParticle::setMomentum ( const double &  px,
const double &  py,
const double &  pz 
)
inline

Set the momentum of this particle [MeV].

Parameters
[in]pxThe x momentum component.
[in]pyThe y momentum component.
[in]pzThe z momentum component.

Definition at line 241 of file SimParticle.h.

241 {
242 px_ = px;
243 py_ = py;
244 pz_ = pz;
245 }

References px_, py_, and pz_.

◆ setPdgID()

void ldmx::SimParticle::setPdgID ( const int &  pdgID)
inline

Set the PDG ID of this particle.

Parameters
[in]pdgIDthe PDG ID of the hit.

Definition at line 182 of file SimParticle.h.

182{ pdgID_ = pdgID; }

References pdgID_.

◆ setProcessType()

void ldmx::SimParticle::setProcessType ( const int &  processType)
inline

Set the creator process type of this particle.

Parameters
[in]processTypethe creator process type of this particle.

Definition at line 294 of file SimParticle.h.

294{ processType_ = processType; }

References processType_.

◆ setTime()

void ldmx::SimParticle::setTime ( const double &  time)
inline

Set the global time of this particle's creation [ns].

Parameters
[in]timeThe global time of this particle's creation.

Definition at line 196 of file SimParticle.h.

196{ time_ = time; }

References time_.

◆ setVertex()

void ldmx::SimParticle::setVertex ( const double &  x,
const double &  y,
const double &  z 
)
inline

Set the vertex of this particle [mm].

Parameters
[in]xThe vertex x position.
[in]yThe vertex y position.
[in]zThe vertex z position.

Definition at line 205 of file SimParticle.h.

205 {
206 x_ = x;
207 y_ = y;
208 z_ = z;
209 }

References x_, y_, and z_.

◆ setVertexVolume()

void ldmx::SimParticle::setVertexVolume ( const std::string &  vertexVolume)
inline

Set the name of the volume that this particle was created in.

Parameters
[in]vertexVolumevolume name that this particle was created in.

Definition at line 217 of file SimParticle.h.

217 {
218 vertexVolume_ = vertexVolume;
219 }

References vertexVolume_.

Member Data Documentation

◆ charge_

double ldmx::SimParticle::charge_ {0}
private

The particle's charge.

Definition at line 382 of file SimParticle.h.

382{0};

Referenced by getCharge(), and setCharge().

◆ daughters_

std::vector<int> ldmx::SimParticle::daughters_
private

The list of daughter particle track IDs.

Definition at line 385 of file SimParticle.h.

Referenced by addDaughter(), and getDaughters().

◆ endpx_

double ldmx::SimParticle::endpx_ {0}
private

The x component of the endpoint momentum.

Definition at line 370 of file SimParticle.h.

370{0};

Referenced by getEndPointMomentum(), and setEndPointMomentum().

◆ endpy_

double ldmx::SimParticle::endpy_ {0}
private

The y component of the endpoint momentum.

Definition at line 373 of file SimParticle.h.

373{0};

Referenced by getEndPointMomentum(), and setEndPointMomentum().

◆ endpz_

double ldmx::SimParticle::endpz_ {0}
private

The z component of the endpoint momentum.

Definition at line 376 of file SimParticle.h.

376{0};

Referenced by getEndPointMomentum(), and setEndPointMomentum().

◆ endX_

double ldmx::SimParticle::endX_ {0}
private

The x component of the end point.

Definition at line 352 of file SimParticle.h.

352{0};

Referenced by getEndPoint(), and setEndPoint().

◆ endY_

double ldmx::SimParticle::endY_ {0}
private

The y component of the end point.

Definition at line 355 of file SimParticle.h.

355{0};

Referenced by getEndPoint(), and setEndPoint().

◆ endZ_

double ldmx::SimParticle::endZ_ {0}
private

The z component of the end point.

Definition at line 358 of file SimParticle.h.

358{0};

Referenced by getEndPoint(), and setEndPoint().

◆ energy_

double ldmx::SimParticle::energy_ {0}
private

The energy of this particle.

Definition at line 331 of file SimParticle.h.

331{0};

Referenced by getEnergy(), getKineticEnergy(), and setEnergy().

◆ genStatus_

int ldmx::SimParticle::genStatus_ {-1}
private

The generator status.

Definition at line 337 of file SimParticle.h.

337{-1};

Referenced by getGenStatus(), and setGenStatus().

◆ mass_

double ldmx::SimParticle::mass_ {0}
private

The particle's mass.

Definition at line 379 of file SimParticle.h.

379{0};

Referenced by getKineticEnergy(), getMass(), and setMass().

◆ parents_

std::vector<int> ldmx::SimParticle::parents_
private

The list of parent particles track IDs.

Definition at line 388 of file SimParticle.h.

Referenced by addParent(), and getParents().

◆ pdgID_

int ldmx::SimParticle::pdgID_ {0}
private

The PDG ID of this particle.

Definition at line 334 of file SimParticle.h.

334{0};

Referenced by getPdgID(), and setPdgID().

◆ PROCESS_MAP

ProcessTypeMap ldmx::SimParticle::PROCESS_MAP
staticprivate

Map containing the process types.

Definition at line 397 of file SimParticle.h.

◆ processType_

int ldmx::SimParticle::processType_ {-1}
private

Encoding of Geant4 process type.

Definition at line 391 of file SimParticle.h.

391{-1};

Referenced by getProcessType(), and setProcessType().

◆ px_

double ldmx::SimParticle::px_ {0}
private

The x component of the momentum.

Definition at line 361 of file SimParticle.h.

361{0};

Referenced by getMomentum(), and setMomentum().

◆ py_

double ldmx::SimParticle::py_ {0}
private

The y component of the momentum.

Definition at line 364 of file SimParticle.h.

364{0};

Referenced by getMomentum(), and setMomentum().

◆ pz_

double ldmx::SimParticle::pz_ {0}
private

The z component of the momentum.

Definition at line 367 of file SimParticle.h.

367{0};

Referenced by getMomentum(), and setMomentum().

◆ time_

double ldmx::SimParticle::time_ {0}
private

The global creation time.

Definition at line 340 of file SimParticle.h.

340{0};

Referenced by getTime(), and setTime().

◆ vertexVolume_

std::string ldmx::SimParticle::vertexVolume_ {""}
private

Volume the track was created in.

Definition at line 394 of file SimParticle.h.

394{""};

Referenced by getVertexVolume(), and setVertexVolume().

◆ x_

double ldmx::SimParticle::x_ {0}
private

The x component of the vertex.

Definition at line 343 of file SimParticle.h.

343{0};

Referenced by getVertex(), and setVertex().

◆ y_

double ldmx::SimParticle::y_ {0}
private

The y component of the vertex.

Definition at line 346 of file SimParticle.h.

346{0};

Referenced by getVertex(), and setVertex().

◆ z_

double ldmx::SimParticle::z_ {0}
private

The z component of the vertex.

Definition at line 349 of file SimParticle.h.

349{0};

Referenced by getVertex(), and setVertex().


The documentation for this class was generated from the following file: