k4SimGeant4
Loading...
Searching...
No Matches
SimG4SingleParticleGeneratorTool.h
Go to the documentation of this file.
1#ifndef SIMG4COMPONENTS_G4SINGLEPARTICLEGENERATORTOOL_H
2#define SIMG4COMPONENTS_G4SINGLEPARTICLEGENERATORTOOL_H
3
4// Gaudi
5#include "GaudiKernel/AlgTool.h"
6
7// FCCSW
8#include "k4FWCore/DataHandle.h"
10
11// Geant4
12#include "G4SystemOfUnits.hh"
13
14// Forward declarations
15// Geant4
16class G4Event;
17class G4PrimaryVertex;
18class G4PrimaryParticle;
19// datamodel
20namespace edm4hep {
21class MCParticleCollection;
22}
23
32class SimG4SingleParticleGeneratorTool : public AlgTool, virtual public ISimG4EventProviderTool {
33public:
35 SimG4SingleParticleGeneratorTool(const std::string& type, const std::string& name, const IInterface* parent);
36
37 virtual StatusCode initialize() final;
38
41
44 virtual G4Event* g4Event() final;
45
46private:
48 StatusCode saveToEdm(const G4PrimaryVertex*, const G4PrimaryParticle*);
50 Gaudi::Property<double> m_energyMin{this, "energyMin", 1 * CLHEP::GeV, "Minimum energy of generated particles"};
52 Gaudi::Property<double> m_energyMax{this, "energyMax", 1 * CLHEP::TeV, "Maximum energy of generated particles"};
54 Gaudi::Property<double> m_etaMin{this, "etaMin", -5., "Minimum eta of generated particles"};
56 Gaudi::Property<double> m_etaMax{this, "etaMax", 5, "Maximum eta of generated particles"};
58 Gaudi::Property<double> m_phiMin{this, "phiMin", 0., "Minimum phi of generated particles"};
60 Gaudi::Property<double> m_phiMax{this, "phiMax", 2 * M_PI, "Maximum phi of generated particles"};
62 Gaudi::Property<double> m_vertexX{this, "vertexX", 0};
64 Gaudi::Property<double> m_vertexY{this, "vertexY", 0};
66 Gaudi::Property<double> m_vertexZ{this, "vertexZ", 0};
68 Gaudi::Property<std::string> m_particleName{this, "particleName", "geantino", "Name of the generated particles"};
70 Gaudi::Property<bool> m_saveEdm{this, "saveEdm", false};
72 mutable DataHandle<edm4hep::MCParticleCollection> m_genParticlesHandle{"GenParticles", Gaudi::DataHandle::Writer, this};
73};
74
75#endif
Abstract interface to Geant4 Primary Generator classes.
Definition ISimG4EventProviderTool.h:17
Tool that generates single particles with parameters set via options file.
Definition SimG4SingleParticleGeneratorTool.h:32
Gaudi::Property< double > m_vertexZ
z position of the vertex associated with the particles generated, set with vertexZ
Definition SimG4SingleParticleGeneratorTool.h:66
DataHandle< edm4hep::MCParticleCollection > m_genParticlesHandle
Handle for the genparticles to be written.
Definition SimG4SingleParticleGeneratorTool.h:72
Gaudi::Property< double > m_etaMax
Maximum eta of the particles generated, set with etaMax.
Definition SimG4SingleParticleGeneratorTool.h:56
Gaudi::Property< double > m_energyMin
Minimum energy of the particles generated, set with energyMin.
Definition SimG4SingleParticleGeneratorTool.h:50
StatusCode saveToEdm(const G4PrimaryVertex *, const G4PrimaryParticle *)
Saves primary vertex and particle to FCC EDM (called if property saveEDM is set to true)
Definition SimG4SingleParticleGeneratorTool.cpp:100
SimG4SingleParticleGeneratorTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition SimG4SingleParticleGeneratorTool.cpp:24
Gaudi::Property< double > m_vertexX
x position of the vertex associated with the particles generated, set with vertexX
Definition SimG4SingleParticleGeneratorTool.h:62
virtual ~SimG4SingleParticleGeneratorTool()
Destructor.
Definition SimG4SingleParticleGeneratorTool.cpp:32
Gaudi::Property< double > m_phiMax
Maximum phi of the particles generated, set with phiMax.
Definition SimG4SingleParticleGeneratorTool.h:60
Gaudi::Property< std::string > m_particleName
Name of the generated particle, set with particleName.
Definition SimG4SingleParticleGeneratorTool.h:68
Gaudi::Property< double > m_etaMin
Minimum eta of the particles generated, set with etaMin.
Definition SimG4SingleParticleGeneratorTool.h:54
virtual StatusCode initialize() final
Definition SimG4SingleParticleGeneratorTool.cpp:34
virtual G4Event * g4Event() final
Generates primaries using the parameters set via options file, uses CLHEP:RandFlat random number gene...
Definition SimG4SingleParticleGeneratorTool.cpp:57
Gaudi::Property< double > m_vertexY
y position of the vertex associated with the particles generated, set with vertexY
Definition SimG4SingleParticleGeneratorTool.h:64
Gaudi::Property< bool > m_saveEdm
Flag whether to save primary particle to EDM, set with saveEdm.
Definition SimG4SingleParticleGeneratorTool.h:70
Gaudi::Property< double > m_energyMax
Maximum energy of the particles generated, set with energyMax.
Definition SimG4SingleParticleGeneratorTool.h:52
Gaudi::Property< double > m_phiMin
Minimum phi of the particles generated, set with phiMin.
Definition SimG4SingleParticleGeneratorTool.h:58
Definition EventInformation.h:10