ATLAS Offline Software
Loading...
Searching...
No Matches
GenModule.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef GENERATORMODULES_GENMODULE_H
6#define GENERATORMODULES_GENMODULE_H
7
10#include "CLHEP/Random/RandomEngine.h"
11#include "CLHEP/Random/RandPoisson.h"
12#include <memory>
13#include "AtlasHepMC/GenEvent.h"
14
15
39class GenModule : public GenBase {
40public:
41
43
44
45 GenModule(const std::string& name, ISvcLocator* pSvcLocator);
47 virtual ~GenModule() { }
49
50
52
53 StatusCode initialize();
54 StatusCode execute();
55 StatusCode finalize() { return genFinalize(); }
57
58
60
61
62 virtual StatusCode genInitialize() { return StatusCode::SUCCESS; }
64 virtual StatusCode genuserInitialize() { return StatusCode::SUCCESS; }
66 virtual StatusCode callGenerator() { return StatusCode::SUCCESS; }
68 virtual StatusCode fillEvt(HepMC::GenEvent* evt) = 0;
70 virtual StatusCode genFinalize() { return StatusCode::SUCCESS; }
72
73
74protected:
75
77
78 CLHEP::HepRandomEngine* getRandomEngine(const std::string& streamName, const EventContext& ctx) const;
79 CLHEP::HepRandomEngine* getRandomEngine(const std::string& streamName, unsigned long int randomSeedOffset, const EventContext& ctx) const;
80 CLHEP::HepRandomEngine* getRandomEngineDuringInitialize(const std::string& streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const;
82
84 IntegerProperty m_randomSeed{this, "RandomSeed", 1234567, "Random seed for the built-in random engine"}; // FIXME make this into an unsigned long int?
85
87 BooleanProperty m_isAfterburner{this, "IsAfterburner", false, "Set true if generator modifies existing events rather than creating new ones"};
88
89#ifdef HEPMC3
91 std::shared_ptr<HepMC3::GenRunInfo> m_runinfo{};
92#endif
93
94private:
95
97
98 // Random number service
99 ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc"};
101 ServiceHandle<IIncidentSvc> m_incidentSvc{this, "IncidentSvc", "IncidentSvc"};
103
104};
105
106
107#endif
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenBase.cxx:11
ServiceHandle< IIncidentSvc > m_incidentSvc
Handle on the incident service.
Definition GenModule.h:101
StatusCode finalize()
Definition GenModule.h:55
virtual StatusCode callGenerator()
For calling the generator on each iteration of the event loop.
Definition GenModule.h:66
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenModule.cxx:14
virtual StatusCode fillEvt(HepMC::GenEvent *evt)=0
For filling the HepMC event object.
StatusCode initialize()
Definition GenModule.cxx:21
ServiceHandle< IAthRNGSvc > m_rndmSvc
Data members.
Definition GenModule.h:99
virtual ~GenModule()
Virtual destructor.
Definition GenModule.h:47
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
Definition GenModule.cxx:34
StatusCode execute()
Definition GenModule.cxx:70
CLHEP::HepRandomEngine * getRandomEngineDuringInitialize(const std::string &streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const
Definition GenModule.cxx:53
virtual StatusCode genFinalize()
For finalising the generator, if required.
Definition GenModule.h:70
virtual StatusCode genuserInitialize()
For initialization of user code, if required. Called after genInitialize.
Definition GenModule.h:64
virtual StatusCode genInitialize()
For initializing the generator, if required.
Definition GenModule.h:62
BooleanProperty m_isAfterburner
Flag for normal vs. afterburner generators.
Definition GenModule.h:87
IntegerProperty m_randomSeed
Seed for random number engine.
Definition GenModule.h:84