5#ifndef ATRANLUXGENSVC_H
6#define ATRANLUXGENSVC_H
18#include "GaudiKernel/IIncidentListener.h"
20#include "Gaudi/Property.h"
22#include "CLHEP/Random/Ranlux64Engine.h"
54class AtRanluxGenSvc :
public extends<AthService, IAtRndmGenSvc, IIncidentListener>
59 virtual CLHEP::HepRandomEngine*
GetEngine(
const std::string& streamName)
override;
60 virtual void CreateStream(uint32_t seed1, uint32_t seed2,
61 const std::string& streamName)
override;
63 const std::string& streamName);
68 typedef std::map<std::string, CLHEP::Ranlux64Engine*>
engineMap;
79 virtual void print (
const std::string& streamName )
override;
80 virtual void print (
void )
override;
83 const std::string& streamName,
short luxLevel);
87 const std::string& streamName)
override;
90 const std::string& streamName)
override;
93 const std::string& streamName);
97 const std::string& streamName);
106 virtual StatusCode
finalize()
override;
110 virtual void handle(
const Incident&)
override;
118 "seeds for the engines, a string of the form ['SequenceName [LUXURY luxLevel (range 0:2 default 1)()] " \
119 "[OFFSET num] Seed1 Seed2', ...] where OFFSET is an optional integer that allows to change the " \
120 "sequence of randoms for a given run/event no and SequenceName combination. Notice that " \
121 "Seed1/Seed2 are dummy when EventReseeding is used",
122 "OrderedSet<std::string>"};
125 Gaudi::Property<bool>
m_read_from_file{
this,
"ReadFromFile",
false,
"set/restore the status of the engine from file"};
126 Gaudi::Property<std::string>
m_file_to_read{
this,
"FileToRead",this->name()+
".out",
127 "name of a ASCII file, usually produced by AtRanLuxGenSvc itself at the end of a job, " \
128 "containing the information to fully set/restore the status of Ranlux64"
130 Gaudi::Property<bool>
m_save_to_file{
this,
"SaveToFile",
true,
"save the status of the engine to file"};
132 "name of an ASCII file which will be produced on finalize, containing the information to fully set/restore the status"};
134 Gaudi::Property<bool>
m_eventReseed{
this,
"EventReseeding",
true,
"reseed every event using a hash of run and event numbers"};
135 StringArrayProperty
m_reseedStreamNames{
this,
"ReseedStreamNames",{},
"the streams we are going to set the seeds of (default: all streams)"};
uint32_t m_PYTHIA_default_seed2
uint32_t m_HERWIG_default_seed1
virtual void CreateStream(uint32_t seed1, uint32_t seed2, const std::string &streamName) override
void SetStreamSeeds(const std::string &streamName)
AtRanluxGenSvc(const std::string &name, ISvcLocator *svc)
Standard Gaudi Constructor.
unsigned int number_of_streams(void) const
engineConstIter end(void) const
std::map< std::string, uint32_t > m_reseedingOffsets
optional offsets to combine to run/evt no when reseeding.
short m_defaultLuxLevel
Ranlux luxury level to be used by default.
virtual ~AtRanluxGenSvc()
Standard Destructor.
Gaudi::Property< std::string > m_file_to_read
name of the file to read the engine status from
virtual bool setAllOnDefinedSeeds(uint32_t theSeed) override
seed all streams we manage, combining theSeed and the stream names
virtual StatusCode initialize() override
StringArrayProperty m_reseedStreamNames
streams to be reseeded for every event
void createStream(uint32_t seed1, uint32_t seed2, const std::string &streamName, short luxLevel)
allows to specify luxLevel
std::map< std::string, std::vector< uint32_t > > m_engines_copy
Random engine copy (for output to a file)
engineConstIter begin(void) const
engineMap::iterator engineIter
CLHEP::HepRandomEngine * oldSetOnDefinedSeeds(uint32_t theSeed, const std::string &streamName)
broken, temporarily keep for backward compatibility
virtual StatusCode finalize() override
StringArrayProperty m_streams_seeds
seeds for the engines, this is a vector of strings of the form "EnginName Seed1 Seed2"
virtual CLHEP::HepRandomEngine * setOnDefinedSeeds(uint32_t theSeed, const std::string &streamName) override
Gaudi::Property< bool > m_eventReseed
reseed for every event
Gaudi::Property< std::string > m_file_to_write
name of the file to save the engine status to.
engineMap::const_iterator engineConstIter
uint32_t m_HERWIG_default_seed2
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &streamName) override
engineMap::value_type engineValType
Gaudi::Property< bool > m_read_from_file
read engine status from file
virtual void print(void) override
Gaudi::Property< bool > m_save_to_file
should current engine status be saved to file ?
uint32_t m_PYTHIA_default_seed1
std::map< std::string, CLHEP::Ranlux64Engine * > engineMap
Gaudi::Property< bool > m_useOldBrokenSeeding
backward compatibility only, broken 32/64 bits
virtual void handle(const Incident &) override
IIncidentListener implementation. Handles EndEvent incident.