22 #include "CLHEP/Units/SystemOfUnits.h"
28 using namespace DD4hep::Simulation;
31 Geant4ParticleGun::Geant4ParticleGun(
Geant4Context* ctxt,
const string& nam)
59 double r =
m_direction.R(), eps = numeric_limits<float>::epsilon();
69 print(
"Shoot [%d] %.3f GeV %s pos:(%.3f %.3f %.3f)[mm] dir:(%6.3f %6.3f %6.3f)",
Generate particles isotrop in space around origine (0,0,0)
ROOT::Math::XYZVector m_direction
Property: Shooting direction of the gun.
ROOT::Math::XYZVector m_position
Property: Position of the gun in space.
bool m_standalone
Property: Standalone mode: includes interaction merging and primary generation.
bool m_print
Property: Enable printout.
static void decrement(T *)
Decrement count according to type information.
bool m_isotrop
Property: Isotrope particles?
int m_shotNo
Shot number in sequence.
virtual void operator()(G4Event *event)
Callback to generate primary particles.
Geant4Context * context() const
Access the context.
void print(const char *fmt,...) const
Support for messages with variable output level using output level.
virtual void printInteraction(int mask) const
Print single particle interaction identified by its mask.
int m_multiplicity
Property: Desired multiplicity of the particles to be shot.
virtual void operator()(G4Event *event)
Callback to generate primary particles.
virtual void getParticleDirection(int num, ROOT::Math::XYZVector &direction, double &momentum) const
Particle modification. Caller presets defaults to: ( direction = m_direction, momentum = m_energy) ...
int m_mask
Property: User mask passed to all particles in the generated interaction.
int mergeInteractions(const Geant4Action *caller, const Geant4Context *context)
Merge all interactions present in the context.
int generatePrimaries(const Geant4Action *caller, const Geant4Context *context, G4Event *event)
Generate all primary vertices corresponding to the merged interaction.
bool m_needsControl
Default property: Flag to create control instance.
std::string m_particleName
Property: Particle name.
static void increment(T *)
Increment count according to type information.
double m_energy
Property: Particle energy.
Generic context to extend user, run and event information.
virtual ~Geant4ParticleGun()
Default destructor.
Geant4Action & declareProperty(const std::string &nam, T &val)
Declare property.
int generationInitialization(const Geant4Action *caller, const Geant4Context *context)
Initialize the generation of one event.