DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4ParticleGenerator.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDG4_GEANT4PARTICLEGENERATOR_H
14 #define DDG4_GEANT4PARTICLEGENERATOR_H
15 
16 // Framework include files
18 #include <Math/Vector3D.h>
19 
20 // Forward declarations
21 class G4ParticleDefinition;
22 
24 namespace dd4hep {
25 
27  namespace sim {
28 
29  // Forward declarations
30  class Geant4PrimaryInteraction;
31 
33 
39  public:
40  protected:
42  ROOT::Math::XYZVector m_direction;
44  ROOT::Math::XYZVector m_position;
46  std::string m_particleName;
48  G4ParticleDefinition* m_particle;
50  double m_energy;
52  double m_momentumMin;
54  double m_momentumMax;
58  int m_mask;
59 
61  virtual void getParticleMultiplicity(int& multiplicity) const;
62 
64  virtual void getVertexPosition(ROOT::Math::XYZVector& position) const;
65 
67 
70  virtual void getParticleDirection(int num, ROOT::Math::XYZVector& direction, double& momentum) const;
72  void getParticleMomentumUniform(double& momentum) const;
73 
75  virtual void printInteraction(int mask) const;
77  virtual void printInteraction(Geant4PrimaryInteraction* inter) const;
78 
79 
80  public:
82  Geant4ParticleGenerator(Geant4Context* context, const std::string& name);
84  virtual ~Geant4ParticleGenerator();
86  virtual void operator()(G4Event* event) override;
87  };
88  } // End namespace sim
89 } // End namespace dd4hep
90 #endif // DDG4_GEANT4PARTICLEGENERATOR_H
dd4hep::sim::Geant4ParticleGenerator::m_multiplicity
int m_multiplicity
Property: Desired multiplicity of the particles to be shot.
Definition: Geant4ParticleGenerator.h:56
dd4hep::sim::Geant4ParticleGenerator::~Geant4ParticleGenerator
virtual ~Geant4ParticleGenerator()
Default destructor.
Definition: Geant4ParticleGenerator.cpp:51
dd4hep::sim::Geant4ParticleGenerator::m_mask
int m_mask
Property: User mask passed to all particles in the generated interaction.
Definition: Geant4ParticleGenerator.h:58
dd4hep::sim::Geant4ParticleGenerator::Geant4ParticleGenerator
Geant4ParticleGenerator(Geant4Context *context, const std::string &name)
Standard constructor.
Definition: Geant4ParticleGenerator.cpp:34
dd4hep::sim::Geant4PrimaryInteraction
Class modelling a single interaction with multiple primary vertices and particles.
Definition: Geant4Primary.h:95
dd4hep::sim::Geant4ParticleGenerator::m_momentumMin
double m_momentumMin
Property: Minimal momentum value.
Definition: Geant4ParticleGenerator.h:52
dd4hep::sim::Geant4ParticleGenerator::getParticleMultiplicity
virtual void getParticleMultiplicity(int &multiplicity) const
Particle modification. Caller presets defaults to: (multiplicity=m_multiplicity)
Definition: Geant4ParticleGenerator.cpp:76
dd4hep::sim::Geant4ParticleGenerator::m_energy
double m_energy
Property: Fixed momentum value, overwrites momentumMin and momentumMax if set.
Definition: Geant4ParticleGenerator.h:50
dd4hep::sim::Geant4ParticleGenerator::m_particle
G4ParticleDefinition * m_particle
Pointer to geant4 particle definition.
Definition: Geant4ParticleGenerator.h:48
dd4hep::sim::Geant4ParticleGenerator::m_direction
ROOT::Math::XYZVector m_direction
Property: Shooting direction of the gun.
Definition: Geant4ParticleGenerator.h:42
Geant4GeneratorAction.h
dd4hep::sim::Geant4ParticleGenerator::getVertexPosition
virtual void getVertexPosition(ROOT::Math::XYZVector &position) const
Particle's vertex modification. Caller presets defaults to: (multiplicity=m_multiplicity)
Definition: Geant4ParticleGenerator.cpp:80
dd4hep::sim::Geant4ParticleGenerator::getParticleMomentumUniform
void getParticleMomentumUniform(double &momentum) const
Uniform particle momentum.
Definition: Geant4ParticleGenerator.cpp:61
dd4hep::sim::Geant4ParticleGenerator::operator()
virtual void operator()(G4Event *event) override
Callback to generate primary particles.
Definition: Geant4ParticleGenerator.cpp:120
dd4hep::sim::Geant4ParticleGenerator::m_position
ROOT::Math::XYZVector m_position
Property: Position of the gun in space.
Definition: Geant4ParticleGenerator.h:44
dd4hep::sim::Geant4ParticleGenerator::m_momentumMax
double m_momentumMax
Property: Maximal momentum value.
Definition: Geant4ParticleGenerator.h:54
dd4hep::sim::Geant4GeneratorAction
Concrete implementation of the Geant4 generator action base class.
Definition: Geant4GeneratorAction.h:47
dd4hep::sim::Geant4Action::name
const std::string & name() const
Access name of the action.
Definition: Geant4Action.h:280
dd4hep::sim::Geant4ParticleGenerator
Generate particles isotrop in space around origine (0,0,0)
Definition: Geant4ParticleGenerator.h:38
dd4hep::sim::Geant4ParticleGenerator::m_particleName
std::string m_particleName
Property: Particle name.
Definition: Geant4ParticleGenerator.h:46
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4ParticleGenerator::getParticleDirection
virtual void getParticleDirection(int num, ROOT::Math::XYZVector &direction, double &momentum) const
Particle modification. Caller presets defaults to: ( direction = m_direction, momentum = m_energy)
Definition: Geant4ParticleGenerator.cpp:56
dd4hep::sim::Geant4ParticleGenerator::printInteraction
virtual void printInteraction(int mask) const
Print single particle interaction identified by its mask.
Definition: Geant4ParticleGenerator.cpp:84
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:270