|
gparticle
|
Lightweight particle specification and primary vertex shooter. More...
#include <gparticle.h>
Public Member Functions | |
| Gparticle (const std::string &name, int multiplicity, double p, double delta_p, const std::string &punit, const std::string &randomMomentumModel, double theta, double delta_theta, const std::string &thetaModel, double phi, double delta_phi, const std::string &aunit, double avx, double avy, double avz, double adelta_vx, double adelta_vy, double adelta_vz, const std::string &vunit, const std::string &randomVertexModel, const std::shared_ptr< GLogger > &logger) | |
| Constructs a particle configuration from user-facing parameters. | |
| Gparticle (const Gparticle &)=delete | |
| Copying is disabled. | |
| Gparticle & | operator= (const Gparticle &)=delete |
| Copy assignment is disabled. | |
| ~Gparticle () | |
| Destructor emits a debug-level lifecycle message. | |
| void | shootParticle (G4ParticleGun *particleGun, G4Event *anEvent) |
| Shoots this particle configuration into a Geant4 event. | |
Static Public Member Functions | |
| static std::shared_ptr< Gparticle > | create_default_gparticle (const std::shared_ptr< GLogger > &log) |
| Creates a minimal default particle configuration. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Gparticle &gp) |
| Stream insertion operator used for pretty-printing configuration summaries. | |
| std::ostream & | operator<< (std::ostream &os, const std::shared_ptr< Gparticle > &ptr) |
| Stream insertion operator overload for shared pointers. | |
A Gparticle instance represents a generator-level particle configuration that can be used to produce primary vertices in a G4Event through a G4ParticleGun.
The class stores:
Configuration is typically created by option parsing utilities and then used during event generation by calling shootParticle().
Logging:
Definition at line 70 of file gparticle.h.
| Gparticle::Gparticle | ( | const std::string & | name, |
| int | multiplicity, | ||
| double | p, | ||
| double | delta_p, | ||
| const std::string & | punit, | ||
| const std::string & | randomMomentumModel, | ||
| double | theta, | ||
| double | delta_theta, | ||
| const std::string & | thetaModel, | ||
| double | phi, | ||
| double | delta_phi, | ||
| const std::string & | aunit, | ||
| double | avx, | ||
| double | avy, | ||
| double | avz, | ||
| double | adelta_vx, | ||
| double | adelta_vy, | ||
| double | adelta_vz, | ||
| const std::string & | vunit, | ||
| const std::string & | randomVertexModel, | ||
| const std::shared_ptr< GLogger > & | logger ) |
This constructor converts user-facing numeric values paired with unit strings into internal numeric values (in the unit system returned by gutilities helpers), and converts randomization model strings into gutilities::randomModel values.
The particle PDG id is resolved at construction time by consulting the G4ParticleTable using the provided particle name.
| name | Particle name as understood by G4ParticleTable (e.g. "e-"). |
| multiplicity | Number of particles to shoot per event. |
| p | Nominal momentum magnitude (interpreted together with punit). |
| delta_p | Spread parameter for momentum randomization (interpreted with punit). |
| punit | Unit string used to interpret p and delta_p (e.g. "MeV", "GeV"). |
| randomMomentumModel | Random model name for momentum (e.g. "uniform", "gaussian"). |
| theta | Nominal polar angle (interpreted together with aunit). |
| delta_theta | Spread parameter for theta (interpreted with aunit). |
| thetaModel | Random model name for theta (e.g. "uniform", "cosine", "gaussian"). |
| phi | Nominal azimuthal angle (interpreted together with aunit). |
| delta_phi | Spread parameter for phi (interpreted with aunit). |
| aunit | Unit string used to interpret angles (typically "deg" or "rad"). |
| avx | Nominal vertex x component (interpreted together with vunit). |
| avy | Nominal vertex y component (interpreted together with vunit). |
| avz | Nominal vertex z component (interpreted together with vunit). |
| adelta_vx | Spread parameter for vertex x (interpreted with vunit). |
| adelta_vy | Spread parameter for vertex y (interpreted with vunit). |
| adelta_vz | Spread parameter for vertex z (interpreted with vunit). |
| vunit | Unit string used to interpret vertex components (e.g. "cm", "mm"). |
| randomVertexModel | Random model name for vertex (e.g. "uniform", "gaussian", "sphere"). |
| logger | Logger used for diagnostics and error reporting. |
Definition at line 23 of file gparticle.cc.
|
delete |
The class is intended to be managed through std::shared_ptr and not copied.
|
inline |
Definition at line 142 of file gparticle.h.
|
inlinestatic |
This helper returns an electron with:
| log | Logger to associate with the constructed particle. |
Definition at line 176 of file gparticle.h.
| void Gparticle::shootParticle | ( | G4ParticleGun * | particleGun, |
| G4Event * | anEvent ) |
The method resolves the particle definition from the G4ParticleTable (using the stored particle name) and then, for each copy defined by the configured multiplicity:
GeneratePrimaryVertex on the provided G4ParticleGun Error handling:
G4ParticleTable is unavailable, an error is logged.| particleGun | The G4ParticleGun used to generate the primary vertices. |
| anEvent | The G4Event that receives the generated primary vertices. |
Definition at line 79 of file gparticle.cc.
|
friend |
Definition at line 231 of file gparticle.cc.
|
friend |
| os | Output stream. |
| ptr | Pointer to a Gparticle; prints "<null Gparticle>" if null. |
Definition at line 261 of file gparticle.h.