131 const std::string& punit,
132 const std::string& randomMomentumModel,
135 const std::string& thetaModel,
138 const std::string& aunit,
145 const std::string& vunit,
146 const std::string& randomVertexModel,
147 const std::shared_ptr<GLogger>& logger,
148 int generator_type = 1);
185 void shootParticle(G4ParticleGun* particleGun, G4Event* anEvent);
200 return std::make_shared<Gparticle>(
230 [[nodiscard]]
const std::string&
getName()
const {
return name; }
237 [[nodiscard]]
int getPid()
const {
return pid; }
258 [[nodiscard]]
double getTheta()
const {
return theta; }
265 [[nodiscard]]
double getPhi()
const {
return phi; }
272 [[nodiscard]]
const G4ThreeVector&
getVertex()
const {
return v; }
293 return runtimeRecords;
337 G4ThreeVector delta_v;
343 std::shared_ptr<GLogger> log;
346 std::vector<GparticleRuntimeRecord> runtimeRecords;
349 [[nodiscard]]
double get_mass()
const;
361 friend std::ostream&
operator<<(std::ostream& os,
const std::shared_ptr<Gparticle>& ptr) {
362 if (ptr)
return os << *ptr;
363 else return os <<
"<null Gparticle>";
374 [[nodiscard]]
double randomizeNumberFromSigmaWithModel(
double center,
379 double calculateMomentum();
386 double calculateKinEnergy(
double mass);
389 G4ThreeVector calculateBeamDirection(
double thetaRad,
double phiRad);
392 G4ThreeVector calculateVertex();
400 G4ThreeVector beamDirection;
401 G4ThreeVector vertex;
403 void setRunTimeQuantities(
double ke, G4ThreeVector bd, G4ThreeVector v) {
Lightweight particle specification and primary vertex shooter.
void shootParticle(G4ParticleGun *particleGun, G4Event *anEvent)
Shoots this particle configuration into a Geant4 event.
const std::string & getName() const
Returns the particle name stored in this generator definition.
int getPid() const
Returns the resolved PDG particle id.
int getMultiplicity() const
Returns how many copies are generated per event.
friend std::ostream & operator<<(std::ostream &os, const Gparticle &gp)
Stream insertion operator used for pretty-printing configuration summaries.
double getPhi() const
Returns the nominal azimuthal angle.
Gparticle(const Gparticle &)=delete
Copying is disabled.
double getMomentum() const
Returns the nominal momentum magnitude.
int getGeneratorType() const
Returns the generator source type.
double getTheta() const
Returns the nominal polar angle.
const std::vector< GparticleRuntimeRecord > & getRuntimeRecords() const
Returns the runtime records from the most recent shoot.
friend std::ostream & operator<<(std::ostream &os, const std::shared_ptr< Gparticle > &ptr)
Stream insertion operator overload for shared pointers.
static std::shared_ptr< Gparticle > create_default_gparticle(const std::shared_ptr< GLogger > &log)
Creates a minimal default particle configuration.
~Gparticle()
Destructor emits a debug-level lifecycle message.
const G4ThreeVector & getVertex() const
Returns the nominal vertex position.
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, int generator_type=1)
Constructs a particle configuration from user-facing parameters.
Gparticle & operator=(const Gparticle &)=delete
Copy assignment is disabled.
std::shared_ptr< Gparticle > GparticlePtr
Shared pointer type used for Gparticle instances.
Runtime values for one generated primary particle.