21#include "GaudiKernel/IIncidentListener.h"
24#include "CLHEP/Random/RandomEngine.h"
25#include "CLHEP/Random/RanecuEngine.h"
56class AtRndmGenSvc :
public extends<AthService, IAtRndmGenSvc, IIncidentListener>
61 virtual CLHEP::HepRandomEngine*
GetEngine (
const std::string& streamName )
override;
62 virtual void CreateStream ( uint32_t seed1, uint32_t seed2,
63 const std::string& streamName )
override;
67 typedef std::map<std::string, CLHEP::RanecuEngine*>
engineMap;
77 virtual void print (
const std::string& streamName )
override;
78 virtual void print (
void )
override;
82 const std::string& streamName)
override;
85 const std::string& streamName)
override;
88 const std::string& streamName);
92 const std::string& streamName);
100 virtual StatusCode
finalize()
override;
104 virtual void handle(
const Incident&)
override;
113 "seeds for the engines, this is a vector of strings of the form ['SequenceName [OFFSET num] Seed1 Seed2', ...] "\
114 "where OFFSET is an optional integer that allows to change the sequence of randoms for a given run/event no " \
115 "and SequenceName combination. Notice that Seed1/Seed2 are dummy when EventReseeding is used",
116 "OrderedSet<std::string>"};
119 Gaudi::Property<bool>
m_read_from_file{
this,
"ReadFromFile",
false,
"set/restore the status of the engine from file"};
120 Gaudi::Property<std::string>
m_file_to_read{
this,
"FileToRead",this->name()+
".out",
121 "name of a ASCII file, usually produced by AtRndmGenSvc itself at the end of a job, "\
122 "containing the information to fully set/restore the status of Ranecu",
124 Gaudi::Property<bool>
m_save_to_file{
this,
"SaveToFile",
true,
"save the status of the engine to file"};
126 "name of an ASCII file which will be produced on finalize, containing the information to fully set/restore the status"};
128 Gaudi::Property<bool>
m_eventReseed{
this,
"EventReseeding",
true,
"reseed every event using a hash of run and event numbers"};
129 StringArrayProperty
m_reseedStreamNames{
this,
"ReseedStreamNames",{},
"the streams we are going to set the seeds of (default: all streams)"};
157 AtRndmGenSvc(
const std::string& name, ISvcLocator* svc);
long m_HERWIG_default_seed1
Gaudi::Property< bool > m_read_from_file
read engine status from file
std::map< std::string, CLHEP::RanecuEngine * > engineMap
CLHEP engines typedefs:
AtRndmGenSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
std::map< std::string, uint32_t > m_reseedingOffsets
optional offsets to combine to run/evt no when reseeding.
virtual bool setAllOnDefinedSeeds(uint32_t theSeed) override
seed all streams we manage, combining theSeed and the stream names
StringArrayProperty m_streams_seeds
Gaudi::Property< bool > m_save_to_file
should current engine status be saved to file ?
long m_HERWIG_default_seed2
Gaudi::Property< std::string > m_file_to_read
name of the file to read the engine status from
engineMap::const_iterator engineConstIter
long m_PYTHIA_default_seed1
virtual void handle(const Incident &) override
IIncidentListener implementation. Handles EndEvent incident.
virtual StatusCode finalize() override
unsigned int number_of_streams(void) const
virtual void print(void) override
engineConstIter begin(void) const
StringArrayProperty m_reseedStreamNames
streams to be reseeded for every event
engineMap::iterator engineIter
void SetStreamSeeds(const std::string &streamName)
Gaudi::Property< std::string > m_file_to_write
name of the file to save the engine status to.
virtual void CreateStream(uint32_t seed1, uint32_t seed2, const std::string &streamName) override
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &streamName) override
virtual CLHEP::HepRandomEngine * setOnDefinedSeeds(uint32_t theSeed, const std::string &streamName) override
virtual StatusCode initialize() override
Gaudi::Property< bool > m_useOldBrokenSeeding
backward compatibility only, broken 32/64 bits
virtual ~AtRndmGenSvc()
Standard Destructor.
engineMap::value_type engineValType
CLHEP::HepRandomEngine * oldSetOnDefinedSeeds(uint32_t theSeed, const std::string &streamName)
broken, temporarily keep for backward compatibility
std::map< std::string, std::vector< long int > > m_engines_copy
Random engine copy (for output to a file)
long m_PYTHIA_default_seed2
engineConstIter end(void) const
Gaudi::Property< bool > m_eventReseed
reseed for every event