ATLAS Offline Software
Loading...
Searching...
No Matches
AtRndmGenSvc Class Reference

A random number engine manager, based on Ranecu. More...

#include <AtRndmGenSvc.h>

Inheritance diagram for AtRndmGenSvc:
Collaboration diagram for AtRndmGenSvc:

Public Member Functions

Stream access
engineConstIter begin (void) const
engineConstIter end (void) const
unsigned int number_of_streams (void) const
virtual void print (const std::string &streamName) override
virtual void print (void) override
virtual CLHEP::HepRandomEngine * setOnDefinedSeeds (uint32_t theSeed, const std::string &streamName) override
virtual CLHEP::HepRandomEngine * setOnDefinedSeeds (uint32_t eventNumber, uint32_t runNumber, const std::string &streamName) override
CLHEP::HepRandomEngine * oldSetOnDefinedSeeds (uint32_t theSeed, const std::string &streamName)
 broken, temporarily keep for backward compatibility
CLHEP::HepRandomEngine * oldSetOnDefinedSeeds (uint32_t eventNumber, uint32_t runNumber, const std::string &streamName)
 broken, temporarily keep for backward compatibility
virtual bool setAllOnDefinedSeeds (uint32_t theSeed) override
 seed all streams we manage, combining theSeed and the stream names
virtual bool setAllOnDefinedSeeds (uint32_t eventNumber, uint32_t runNumber) override
 seed all streams, combining eventNumber, runNumber and the stream names
Gaudi Service Implementation
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual void handle (const Incident &) override
 IIncidentListener implementation. Handles EndEvent incident.

Private Attributes

Properties
Gaudi::Property< bool > m_useOldBrokenSeeding {this,"UseOldBrokenSeeding",false}
 backward compatibility only, broken 32/64 bits
StringArrayProperty m_streams_seeds
Gaudi::Property< bool > m_read_from_file {this,"ReadFromFile",false,"set/restore the status of the engine from file"}
 read engine status from file
Gaudi::Property< std::string > m_file_to_read
 name of the file to read the engine status from
Gaudi::Property< bool > m_save_to_file {this,"SaveToFile", true,"save the status of the engine to file"}
 should current engine status be saved to file ?
Gaudi::Property< std::string > m_file_to_write
 name of the file to save the engine status to.
Gaudi::Property< bool > m_eventReseed {this,"EventReseeding",true,"reseed every event using a hash of run and event numbers"}
 reseed for every event
StringArrayProperty m_reseedStreamNames {this,"ReseedStreamNames",{}, "the streams we are going to set the seeds of (default: all streams)"}
 streams to be reseeded for every event
std::map< std::string, uint32_t > m_reseedingOffsets
 optional offsets to combine to run/evt no when reseeding.
engineMap m_engines
std::map< std::string, std::vector< long int > > m_engines_copy
 Random engine copy (for output to a file)

Interface to the CLHEP engine

typedef std::map< std::string, CLHEP::RanecuEngine * > engineMap
 CLHEP engines typedefs:
typedef engineMap::iterator engineIter
typedef engineMap::const_iterator engineConstIter
typedef engineMap::value_type engineValType
virtual CLHEP::HepRandomEngine * GetEngine (const std::string &streamName) override
virtual void CreateStream (uint32_t seed1, uint32_t seed2, const std::string &streamName) override

Default seed values

long m_default_seed1
long m_default_seed2
long m_PYTHIA_default_seed1
long m_PYTHIA_default_seed2
long m_HERWIG_default_seed1
long m_HERWIG_default_seed2
 AtRndmGenSvc (const std::string &name, ISvcLocator *svc)
 Standard Constructor.
virtual ~AtRndmGenSvc ()
 Standard Destructor.
void SetStreamSeeds (const std::string &streamName)

Detailed Description

A random number engine manager, based on Ranecu.

Its usage is deprecated, at least when high quality sequences of randoms are required (Ranecu period has been shown to be too short, and sensitive to the quality of initial seeds).

this service mantains a number of named, independent random number sequences. Each sequence is initialized by an entry of the form "SequenceName Seed1 Seed2" in the Seeds property. For example

Seeds = [ "PYTHIA 4789899 989240512", "PYTHIA_INIT 820021 2347532",
"JIMMY 390020611 821000366", "JIMMY_INIT 820021 2347532",
"HERWIG 390020611 821000366", "HERWIG_INIT 820021 2347532" ]

At the end of the job in AtRndmGenSvc::finalize(), the status of the engine is dumped as an array of unsigned long to the ASCII file "AtRndmGenSvc.out". This file can be used to restore the status of the engine in another job by setting the properties

ReadFromFile = true
FileToRead = path_to_ascii_file

Definition at line 56 of file AtRndmGenSvc.h.

Member Typedef Documentation

◆ engineConstIter

typedef engineMap::const_iterator AtRndmGenSvc::engineConstIter

Definition at line 69 of file AtRndmGenSvc.h.

◆ engineIter

typedef engineMap::iterator AtRndmGenSvc::engineIter

Definition at line 68 of file AtRndmGenSvc.h.

◆ engineMap

typedef std::map<std::string, CLHEP::RanecuEngine*> AtRndmGenSvc::engineMap

CLHEP engines typedefs:

Definition at line 67 of file AtRndmGenSvc.h.

◆ engineValType

typedef engineMap::value_type AtRndmGenSvc::engineValType

Definition at line 70 of file AtRndmGenSvc.h.

Constructor & Destructor Documentation

◆ AtRndmGenSvc()

AtRndmGenSvc::AtRndmGenSvc ( const std::string & name,
ISvcLocator * svc )

Standard Constructor.

Definition at line 27 of file AtRndmGenSvc.cxx.

28 : base_class(name,svc),
31{
32 // Set Default values
33 m_default_seed1 = 3591;
34 m_default_seed2 = 2309736;
35 m_PYTHIA_default_seed1 = 93453591;
39}
long m_HERWIG_default_seed1
std::map< std::string, uint32_t > m_reseedingOffsets
optional offsets to combine to run/evt no when reseeding.
long m_HERWIG_default_seed2
long m_PYTHIA_default_seed1
engineMap m_engines
std::map< std::string, std::vector< long int > > m_engines_copy
Random engine copy (for output to a file)
long m_PYTHIA_default_seed2

◆ ~AtRndmGenSvc()

AtRndmGenSvc::~AtRndmGenSvc ( )
virtual

Standard Destructor.

Definition at line 43 of file AtRndmGenSvc.cxx.

44{
45 engineIter i(m_engines.begin()), e(m_engines.end());
46 while (i != e) delete (i++)->second;
47}
engineMap::iterator engineIter

Member Function Documentation

◆ begin()

AtRndmGenSvc::engineConstIter AtRndmGenSvc::begin ( void ) const
inline

Definition at line 165 of file AtRndmGenSvc.h.

166{ return m_engines.begin(); }

◆ CreateStream()

void AtRndmGenSvc::CreateStream ( uint32_t seed1,
uint32_t seed2,
const std::string & streamName )
overridevirtual

Definition at line 272 of file AtRndmGenSvc.cxx.

274{
275 engineConstIter citer = m_engines.find(streamName);
276 if (citer == m_engines.end())
277 m_engines.insert(engineValType(streamName, new CLHEP::RanecuEngine()));
278 engineIter iter = m_engines.find(streamName);
279 long seeds[3] = { (long)seed1, (long) seed2, 0 };
280 ((*iter).second)->setSeeds( seeds, -1 );
281}
engineMap::const_iterator engineConstIter
engineMap::value_type engineValType

◆ end()

AtRndmGenSvc::engineConstIter AtRndmGenSvc::end ( void ) const
inline

Definition at line 169 of file AtRndmGenSvc.h.

170{ return m_engines.end(); }

◆ finalize()

StatusCode AtRndmGenSvc::finalize ( )
overridevirtual

Definition at line 236 of file AtRndmGenSvc.cxx.

237{
238 ATH_MSG_INFO (" FINALISING ");
239
240 if (m_save_to_file) {
241 // Write the status of the Service into a file
242 std::ofstream outfile( m_file_to_write.value().c_str() );
243 if ( !outfile ) {
244 ATH_MSG_ERROR ("error: unable to open: " << m_file_to_write.value());
245 } else {
246 for (std::map<std::string, std::vector<long int> >::const_iterator i = m_engines_copy.begin();
247 i != m_engines_copy.end();
248 ++i) {
249 outfile << (*i).first << " " << (*i).second[0] << " " << (*i).second[1] << "\n";
250 }
251 ATH_MSG_DEBUG (" wrote seeds to " << m_file_to_write.value() );
252 }
253 }
254 return StatusCode::SUCCESS;
255}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Property< bool > m_save_to_file
should current engine status be saved to file ?
Gaudi::Property< std::string > m_file_to_write
name of the file to save the engine status to.

◆ GetEngine()

CLHEP::HepRandomEngine * AtRndmGenSvc::GetEngine ( const std::string & streamName)
overridevirtual

Definition at line 258 of file AtRndmGenSvc.cxx.

259{
260 engineConstIter citer = m_engines.find(streamName);
261 if ( citer == m_engines.end() )
262 {
263 m_engines.insert( engineValType( streamName, new CLHEP::RanecuEngine() ) );
264 SetStreamSeeds ( streamName );
265 }
266
267 engineIter iter = m_engines.find(streamName);
268 return (CLHEP::HepRandomEngine*)(*iter).second;
269}
void SetStreamSeeds(const std::string &streamName)

◆ handle()

void AtRndmGenSvc::handle ( const Incident & inc)
overridevirtual

IIncidentListener implementation. Handles EndEvent incident.

Definition at line 150 of file AtRndmGenSvc.cxx.

150 {
151
152 if ( inc.type() == "EndEvent" ||
153 inc.type() == "AfterReseedIncident" )
154 {
155 ATH_MSG_DEBUG (" Handle EndEvent ");
156 m_engines_copy.clear();
157 for (engineConstIter i = begin(); i != end(); ++i)
158 {
159 CLHEP::HepRandomEngine* engine = GetEngine((*i).first);
160 const long* s = engine->getSeeds();
161 std::vector<long int> tseeds;
162 tseeds.push_back(s[0]);
163 tseeds.push_back(s[1]);
164 m_engines_copy.insert(
165 std::map<std::string, std::vector<long int> >::value_type( (*i).first,
166 tseeds ) );
167 }
168 print();
169 } else if (inc.type() == "BeginEvent") {
170 ATH_MSG_DEBUG (" Handle BeginEvent ");
171 EventContext context = inc.context();
172 const EventIDBase& ei = context.eventID();
173 //clear static RandGauss cache (generates two numbers per call to shoot()
174 CLHEP::RandGauss::setFlag(false);
175 //loop over generator streams, combining the stream name to the hash
176 vector<string>::const_iterator i(m_reseedStreamNames.begin());
177 vector<string>::const_iterator e(m_reseedStreamNames.end());
178 //by default (when no streams are specified in streamNames, seed all
179 //streams
180 if (i == e) {
181 if (!(this->setAllOnDefinedSeeds(ei.event_number(),
182 ei.run_number())))
183 throw GaudiException("can not reseed all streams ", name(), StatusCode::FAILURE);
184 } else {
185 while (i != e) {
186 const string& strName(*i++);
187 if (0 == this->setOnDefinedSeeds(ei.event_number(),
188 ei.run_number(),
189 strName)) {
190 throw GaudiException(string("can not reseed stream ") + strName,
191 name(), StatusCode::FAILURE);
192 } else {
193 msg() << MSG::VERBOSE << "Reseeded stream " << strName
194 << " for random service " << endmsg;
195 }
196 }
197 }
198 }
199 else if (inc.type() == "ReseedIncident") {
200 typedef ContextIncident<std::pair<unsigned,unsigned> > Ctxt;
201 const Ctxt* incident = dynamic_cast<const Ctxt*>(&inc);
202 if (!incident) {
203 throw GaudiException(string("can not cast to ContextIncident "),
204 name(), StatusCode::FAILURE);
205 }
206 const std::pair<unsigned,unsigned>& data = incident->tag();
207 //clear static RandGauss cache (generates two numbers per call to shoot()
208 CLHEP::RandGauss::setFlag(false);
209 //loop over generator streams, combining the stream name to the hash
210 vector<string>::const_iterator i(m_reseedStreamNames.begin());
211 vector<string>::const_iterator e(m_reseedStreamNames.end());
212 //by default (when no streams are specified in streamNames, seed all
213 //streams
214 if (i == e) {
215 if (!(this->setAllOnDefinedSeeds(data.first,
216 data.second)))
217 throw GaudiException("can not reseed all streams ", name(), StatusCode::FAILURE);
218 } else {
219 while (i != e) {
220 const string& strName(*i++);
221 if (0 == this->setOnDefinedSeeds(data.first,
222 data.second,
223 strName)) {
224 throw GaudiException(string("can not reseed stream ") + strName,
225 name(), StatusCode::FAILURE);
226 } else {
227 msg() << MSG::VERBOSE << "Reseeded stream " << strName
228 << " for random service " << endmsg;
229 }
230 }
231 }
232 }
233}
#define endmsg
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
virtual bool setAllOnDefinedSeeds(uint32_t theSeed) override
seed all streams we manage, combining theSeed and the stream names
virtual void print(void) override
engineConstIter begin(void) const
StringArrayProperty m_reseedStreamNames
streams to be reseeded for every event
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &streamName) override
virtual CLHEP::HepRandomEngine * setOnDefinedSeeds(uint32_t theSeed, const std::string &streamName) override
engineConstIter end(void) const
MsgStream & msg
Definition testRead.cxx:32

◆ initialize()

StatusCode AtRndmGenSvc::initialize ( )
overridevirtual

Incident Service

Definition at line 51 of file AtRndmGenSvc.cxx.

52{
54 ("Initializing " << name()
55 << "\n INITIALISING RANDOM NUMBER STREAMS. ");
56
57
59 ServiceHandle<IIncidentSvc> pIncSvc("IncidentSvc", name());
60
61 // set up the incident service:
62 ATH_CHECK( pIncSvc.retrieve() );
63
64 //start listening to "EndEvent"
65 static const int PRIORITY = 100;
66 pIncSvc->addListener(this, "EndEvent", PRIORITY);
67 pIncSvc->addListener(this, "AfterReseedIncident", PRIORITY);
68
69 //and to BeginEvent if we are reseeding
70 if (m_eventReseed) {
71 ATH_MSG_INFO ("will be reseeded for every event");
72 pIncSvc->addListener(this, "BeginEvent");
73 pIncSvc->addListener(this, "ReseedIncident", PRIORITY);
74 }
75 pIncSvc.release().ignore();
76
78 {
79 // Read from a file
80 ifstream infile( m_file_to_read.value().c_str() );
81 if ( !infile ) {
82 ATH_MSG_ERROR (" Unable to open: " << m_file_to_read.value());
83 return StatusCode::FAILURE;
84 } else {
85 std::string buffer;
86 while (std::getline(infile, buffer)) {
87 string stream;
89 if (interpretSeeds(buffer, stream, seed1, seed2)) {
91 (" INITIALISING " << stream << " stream with seeds "
92 << seed1 << " " << seed2
93 << " read from file " << m_file_to_read.value());
94 CreateStream(seed1, seed2, stream);
95 } else {
97 ("bad line\n" << buffer
98 << "\n in input file " << m_file_to_read.value());
99 return StatusCode::FAILURE;
100 }
101 }
102
103 }
104 }
105
106 // Create the various streams according to user's request
107 for (const auto& i : m_streams_seeds.value()) {
108 string stream;
110 short dummy;
111 if (interpretSeeds(i, stream, seed1, seed2, dummy, offset)) {
113 ("Seeds property: stream " << stream
114 << " seeds " << seed1 << ' ' << seed2
115 << ", reseeding offset " << offset);
116 } else {
117 ATH_MSG_ERROR ("bad Seeds property\n" << i);
118 return StatusCode::FAILURE;
119 }
120
121 // Check if stream already generated (e.g. from reading a file)
122 bool not_found = true;
123 if ( number_of_streams() != 0 ) {
125 do {
126 if ((*sf).first == stream) not_found = false;
127 ++sf;
128 } while (sf != end() && not_found);
129 }
130
131 if (not_found) {
133 (" INITIALISING " << stream << " stream with seeds "
134 << seed1 << " " << seed2);
135 CreateStream(seed1, seed2, stream);
136 if (m_eventReseed) {
137 m_reseedingOffsets.insert(std::make_pair(stream, offset));
138 // apply the offset we just inserted
139 ATH_MSG_DEBUG("Applying reseeding offset " << offset <<
140 " to stream " << stream);
141 this->setOnDefinedSeeds(seed1, seed2, stream);
142 }
143 }
144
145 }
146 return StatusCode::SUCCESS;
147}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< bool > m_read_from_file
read engine status from file
StringArrayProperty m_streams_seeds
Gaudi::Property< std::string > m_file_to_read
name of the file to read the engine status from
unsigned int number_of_streams(void) const
virtual void CreateStream(uint32_t seed1, uint32_t seed2, const std::string &streamName) override
Gaudi::Property< bool > m_eventReseed
reseed for every event
bool interpretSeeds(const std::string &buffer, std::string &stream, uint32_t &seed1, uint32_t &seed2, short &luxury, uint32_t &offset)
str infile
Definition run.py:13
setEventNumber uint32_t

◆ number_of_streams()

unsigned int AtRndmGenSvc::number_of_streams ( void ) const
inline

Definition at line 173 of file AtRndmGenSvc.h.

174{ return m_engines.size(); }

◆ oldSetOnDefinedSeeds() [1/2]

CLHEP::HepRandomEngine * AtRndmGenSvc::oldSetOnDefinedSeeds ( uint32_t eventNumber,
uint32_t runNumber,
const std::string & streamName )

broken, temporarily keep for backward compatibility

Definition at line 378 of file AtRndmGenSvc.cxx.

380{
381 engineConstIter citer = m_engines.find(streamName);
382 if ( citer == m_engines.end() )
383 m_engines.insert( engineValType(streamName, new CLHEP::RanecuEngine() ) );
384 engineIter iter = m_engines.find(streamName);
385 int hashedStream(SG::simpleStringHash(streamName));
386 long seeds[3] = { (long)(1000*runNumber + hashedStream),
387 (long)eventNumber, 0 };
388 assert( seeds[0] > 0 );
389 assert( seeds[1] > 0 );
390 const long* s = seeds;
391 ((*iter).second)->setSeeds( s, -1 );
392 return (CLHEP::HepRandomEngine*)(*iter).second;
393}
int simpleStringHash(const std::string &str, int maxInt=0xFFFF)
simple hash function derived from Sedgewick Algorithms in C++ 3rd ed

◆ oldSetOnDefinedSeeds() [2/2]

CLHEP::HepRandomEngine * AtRndmGenSvc::oldSetOnDefinedSeeds ( uint32_t theSeed,
const std::string & streamName )

broken, temporarily keep for backward compatibility

Definition at line 396 of file AtRndmGenSvc.cxx.

397 {
398 engineConstIter citer = m_engines.find(streamName);
399 if ( citer == m_engines.end() )
400 m_engines.insert( engineValType(streamName, new CLHEP::RanecuEngine() ) );
401 engineIter iter = m_engines.find(streamName);
402 int hashedStream(SG::simpleStringHash(streamName));
403 long seeds[3] = { (long)(hashedStream % (theSeed+13)), (long)theSeed, 0 };
404 assert( seeds[0] > 0 );
405 assert( seeds[1] > 0 );
406 const long* s = seeds;
407 ((*iter).second)->setSeeds( s, -1 );
408 return (CLHEP::HepRandomEngine*)(*iter).second;
409}

◆ print() [1/2]

void AtRndmGenSvc::print ( const std::string & streamName)
overridevirtual

Definition at line 314 of file AtRndmGenSvc.cxx.

315{
316 engineConstIter citer = m_engines.find(streamName);
317 if ( citer == m_engines.end() )
318 {
319 ATH_MSG_WARNING (" Stream = " << streamName << " NOT FOUND");
320 }
321 else
322 {
323 const long* s = ((*citer).second)->getSeeds();
324 ATH_MSG_INFO (" Stream = " << streamName << ", Seed1 = "
325 << s[0] << ", Seed2 = " << s[1]);
326 }
327}
#define ATH_MSG_WARNING(x)

◆ print() [2/2]

void AtRndmGenSvc::print ( void )
overridevirtual

Definition at line 330 of file AtRndmGenSvc.cxx.

331{
332 for (engineConstIter i = m_engines.begin(); i != m_engines.end(); ++i)
333 print( (*i).first );
334}

◆ setAllOnDefinedSeeds() [1/2]

bool AtRndmGenSvc::setAllOnDefinedSeeds ( uint32_t eventNumber,
uint32_t runNumber )
overridevirtual

seed all streams, combining eventNumber, runNumber and the stream names

Definition at line 412 of file AtRndmGenSvc.cxx.

413{
414 bool allOK(true);
415 engineIter i(m_engines.begin()), e(m_engines.end());
416 while (i!=e &&
417 (allOK=(0 != this->setOnDefinedSeeds(eventNumber,
418 runNumber,
419 (*i++).first)))) {
420 /*empty*/
421 }
422 return allOK;
423}

◆ setAllOnDefinedSeeds() [2/2]

bool AtRndmGenSvc::setAllOnDefinedSeeds ( uint32_t theSeed)
overridevirtual

seed all streams we manage, combining theSeed and the stream names

Definition at line 426 of file AtRndmGenSvc.cxx.

426 {
427 bool allOK(true);
428 engineIter i(m_engines.begin()), e(m_engines.end());
429 while (i!=e &&
430 (allOK=(0 != this->setOnDefinedSeeds(theSeed, (*i++).first)))) {
431 /* empty */
432 }
433 return allOK;
434}

◆ setOnDefinedSeeds() [1/2]

CLHEP::HepRandomEngine * AtRndmGenSvc::setOnDefinedSeeds ( uint32_t eventNumber,
uint32_t runNumber,
const std::string & streamName )
overridevirtual

Definition at line 337 of file AtRndmGenSvc.cxx.

339{
341 return oldSetOnDefinedSeeds(eventNumber, runNumber, streamName);
342 //do it properly
343 uint32_t theHash(eventNumber);
344 map<string, uint32_t>::const_iterator citer(m_reseedingOffsets.find(streamName));
345 bool hasOffset(citer != m_reseedingOffsets.end() && 0 != citer->second);
346 if (hasOffset) theHash=crc_combine(theHash, citer->second);
347
348 theHash=crc_combine(theHash, runNumber);
349 ATH_MSG_VERBOSE( "Reseeding stream " << streamName
350 << " with eventNumber " << eventNumber
351 << " runNumber " << runNumber);
352 if (hasOffset) ATH_MSG_VERBOSE("Applied offset " << citer->second);
353 return this->setOnDefinedSeeds(theHash, streamName);
354}
uint32_t crc_combine(uint32_t seed, uint32_t v)
using crc32 for architecture independence in combining the seeds
Gaudi::Property< bool > m_useOldBrokenSeeding
backward compatibility only, broken 32/64 bits
CLHEP::HepRandomEngine * oldSetOnDefinedSeeds(uint32_t theSeed, const std::string &streamName)
broken, temporarily keep for backward compatibility

◆ setOnDefinedSeeds() [2/2]

CLHEP::HepRandomEngine * AtRndmGenSvc::setOnDefinedSeeds ( uint32_t theSeed,
const std::string & streamName )
overridevirtual

create engine if not found. FIXME this may not be a good idea

Definition at line 357 of file AtRndmGenSvc.cxx.

358 {
360 return oldSetOnDefinedSeeds(theSeed, streamName);
361 //do it properly
362 engineConstIter citer = m_engines.find(streamName);
364 if ( citer == m_engines.end() )
365 m_engines.insert(engineValType(streamName,
366 new CLHEP::RanecuEngine() ) );
367 engineIter iter = m_engines.find(streamName);
368 theSeed=crc_combine(theSeed, streamName);
369 ATH_MSG_DEBUG("Reseeding stream " << streamName << " with " << theSeed);
370 //Ranecu takes a long as seed and makes a test on the sign of the seed
371 //so let's make sure that our seed is presented to Ranecu as a 32 bit
372 //signed int
373 ((*iter).second)->setSeed( (int32_t)theSeed, 0);
374 return (CLHEP::HepRandomEngine*)(*iter).second;
375}

◆ SetStreamSeeds()

void AtRndmGenSvc::SetStreamSeeds ( const std::string & streamName)
private

Definition at line 284 of file AtRndmGenSvc.cxx.

285{
286 long seed1;
287 long seed2;
288 if (streamName == "PYTHIA")
289 {
292 }
293 else if (streamName == "HERWIG")
294 {
297 }
298 else
299 {
302 }
304 (" INITIALISING " << streamName << " stream with DEFAULT seeds "
305 << seed1 << " " << seed2);
306
307 long seeds[3] = { seed1, seed2, 0 };
308 const long* s = seeds;
309 engineIter iter = m_engines.find(streamName);
310 ((*iter).second)->setSeeds( s, -1 );
311}

Member Data Documentation

◆ m_default_seed1

long AtRndmGenSvc::m_default_seed1
private

Definition at line 144 of file AtRndmGenSvc.h.

◆ m_default_seed2

long AtRndmGenSvc::m_default_seed2
private

Definition at line 145 of file AtRndmGenSvc.h.

◆ m_engines

engineMap AtRndmGenSvc::m_engines
private

Definition at line 137 of file AtRndmGenSvc.h.

◆ m_engines_copy

std::map<std::string, std::vector<long int> > AtRndmGenSvc::m_engines_copy
private

Random engine copy (for output to a file)

Definition at line 139 of file AtRndmGenSvc.h.

◆ m_eventReseed

Gaudi::Property<bool> AtRndmGenSvc::m_eventReseed {this,"EventReseeding",true,"reseed every event using a hash of run and event numbers"}
private

reseed for every event

Definition at line 128 of file AtRndmGenSvc.h.

128{this,"EventReseeding",true,"reseed every event using a hash of run and event numbers"};

◆ m_file_to_read

Gaudi::Property<std::string> AtRndmGenSvc::m_file_to_read
private
Initial value:
{this,"FileToRead",this->name()+".out",
"name of a ASCII file, usually produced by AtRndmGenSvc itself at the end of a job, "
"containing the information to fully set/restore the status of Ranecu",
}

name of the file to read the engine status from

Definition at line 120 of file AtRndmGenSvc.h.

120 {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",
123 };

◆ m_file_to_write

Gaudi::Property<std::string> AtRndmGenSvc::m_file_to_write
private
Initial value:
{this,"FileToWrite",this->name()+".out",
"name of an ASCII file which will be produced on finalize, containing the information to fully set/restore the status"}

name of the file to save the engine status to.

Definition at line 125 of file AtRndmGenSvc.h.

125 {this,"FileToWrite",this->name()+".out",
126 "name of an ASCII file which will be produced on finalize, containing the information to fully set/restore the status"};

◆ m_HERWIG_default_seed1

long AtRndmGenSvc::m_HERWIG_default_seed1
private

Definition at line 148 of file AtRndmGenSvc.h.

◆ m_HERWIG_default_seed2

long AtRndmGenSvc::m_HERWIG_default_seed2
private

Definition at line 149 of file AtRndmGenSvc.h.

◆ m_PYTHIA_default_seed1

long AtRndmGenSvc::m_PYTHIA_default_seed1
private

Definition at line 146 of file AtRndmGenSvc.h.

◆ m_PYTHIA_default_seed2

long AtRndmGenSvc::m_PYTHIA_default_seed2
private

Definition at line 147 of file AtRndmGenSvc.h.

◆ m_read_from_file

Gaudi::Property<bool> AtRndmGenSvc::m_read_from_file {this,"ReadFromFile",false,"set/restore the status of the engine from file"}
private

read engine status from file

Definition at line 119 of file AtRndmGenSvc.h.

119{this,"ReadFromFile",false,"set/restore the status of the engine from file"};

◆ m_reseedingOffsets

std::map<std::string, uint32_t> AtRndmGenSvc::m_reseedingOffsets
private

optional offsets to combine to run/evt no when reseeding.

Set using OFFSET keyword of the Seeds property

Definition at line 135 of file AtRndmGenSvc.h.

◆ m_reseedStreamNames

StringArrayProperty AtRndmGenSvc::m_reseedStreamNames {this,"ReseedStreamNames",{}, "the streams we are going to set the seeds of (default: all streams)"}
private

streams to be reseeded for every event

Definition at line 129 of file AtRndmGenSvc.h.

129{this,"ReseedStreamNames",{}, "the streams we are going to set the seeds of (default: all streams)"};

◆ m_save_to_file

Gaudi::Property<bool> AtRndmGenSvc::m_save_to_file {this,"SaveToFile", true,"save the status of the engine to file"}
private

should current engine status be saved to file ?

Definition at line 124 of file AtRndmGenSvc.h.

124{this,"SaveToFile", true,"save the status of the engine to file"};

◆ m_streams_seeds

StringArrayProperty AtRndmGenSvc::m_streams_seeds
private
Initial value:
{this,"Seeds",{},
"seeds for the engines, this is a vector of strings of the form ['SequenceName [OFFSET num] Seed1 Seed2', ...] "
"where OFFSET is an optional integer that allows to change the sequence of randoms for a given run/event no "
"and SequenceName combination. Notice that Seed1/Seed2 are dummy when EventReseeding is used",
"OrderedSet<std::string>"}

Definition at line 112 of file AtRndmGenSvc.h.

112 {this,"Seeds",{},
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>"};

◆ m_useOldBrokenSeeding

Gaudi::Property<bool> AtRndmGenSvc::m_useOldBrokenSeeding {this,"UseOldBrokenSeeding",false}
private

backward compatibility only, broken 32/64 bits

Definition at line 111 of file AtRndmGenSvc.h.

111{this,"UseOldBrokenSeeding",false};

The documentation for this class was generated from the following files: