ATLAS Offline Software
List of all members
AtRanluxGenSvc Class Reference

The default ATLAS random number engine manager, based on Ranlux64. More...

#include <AtRanluxGenSvc.h>

Inheritance diagram for AtRanluxGenSvc:
Collaboration diagram for AtRanluxGenSvc:

Public Types

CLHEP engines typedefs:
typedef std::map< std::string, CLHEP::Ranlux64Engine * > engineMap
 
typedef engineMap::iterator engineIter
 
typedef engineMap::const_iterator engineConstIter
 
typedef engineMap::value_type engineValType
 

Public Member Functions

Interface to the CLHEP engine
virtual CLHEP::HepRandomEngine * GetEngine (const std::string &streamName) override
 
virtual void CreateStream (uint32_t seed1, uint32_t seed2, const std::string &streamName) override
 
bool CreateStream (const std::vector< uint32_t > &seeds, const std::string &streamName)
 
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
 
void createStream (uint32_t seed1, uint32_t seed2, const std::string &streamName, short luxLevel)
 allows to specify luxLevel More...
 
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 More...
 
CLHEP::HepRandomEngine * oldSetOnDefinedSeeds (uint32_t eventNumber, uint32_t runNumber, const std::string &streamName)
 broken, temporarily keep for backward compatibility More...
 
virtual bool setAllOnDefinedSeeds (uint32_t theSeed) override
 seed all streams we manage, combining theSeed and the stream names More...
 
virtual bool setAllOnDefinedSeeds (uint32_t eventNumber, uint32_t runNumber) override
 seed all streams, combining eventNumber, runNumber and the stream names More...
 
Gaudi Service Implementation
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual void handle (const Incident &) override
 IIncidentListener implementation. Handles EndEvent incident. More...
 

Private Attributes

Properties
StringArrayProperty m_streams_seeds
 seeds for the engines, this is a vector of strings of the form "EnginName Seed1 Seed2"
More...
 
Gaudi::Property< bool > m_read_from_file {this,"ReadFromFile",false,"set/restore the status of the engine from file"}
 read engine status from file More...
 
Gaudi::Property< std::string > m_file_to_read
 name of the file to read the engine status from More...
 
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 ? More...
 
Gaudi::Property< std::string > m_file_to_write
 name of the file to save the engine status to. More...
 
Gaudi::Property< bool > m_eventReseed {this,"EventReseeding",true,"reseed every event using a hash of run and event numbers"}
 reseed for every event More...
 
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
More...
 
Gaudi::Property< bool > m_useOldBrokenSeeding {this,"UseOldBrokenSeeding",false}
 backward compatibility only, broken 32/64 bits More...
 
std::map< std::string, uint32_t > m_reseedingOffsets
 optional offsets to combine to run/evt no when reseeding. More...
 
engineMap m_engines
 
std::map< std::string, std::vector< uint32_t > > m_engines_copy
 Random engine copy (for output to a file) More...
 
short m_defaultLuxLevel
 Ranlux luxury level to be used by default. More...
 

Default seed values

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

Detailed Description

The default ATLAS random number engine manager, based on Ranlux64.

this service mantains a number of named, independent random number sequences. Each sequence is initialized by an entry of the form "SequenceName [LUXURY luxLevel (range 0:2 default 1) ] Seed1 Seed2" in the Seeds property. For example

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

At the end of the job in AtRanluxGenSvc::finalize(), the status of the engine is dumped as an array of uint32_t to the ASCII file "AtRanluxGenSvc.out":

PITHIA 4010409557 1071463497 2862960128 1068652744 145815808 1072305199 2363435712 1072215177 2274024032 1071848040 1607052768 1070928280 1688486400 1071840599 2068481888 1067315347 62450688 1072023539 312153120 1070857822 2535009472 1070427845 3698875904 1070616419 3726185024 0 0 11 1 202
PITHIA_INIT 4010409557 1057836705 3838836736 1072443439 2098440704 1066892778 3689119744 1072151794 3818888768 1071853913 3574320864 1071982408 3603063712 1071718264 2168786016 1072391676 2208235040 1072000044 3037871232 1072480358 3292613248 1071901297 579757952 1065720911 3788918784 0 0 11 1 202

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 54 of file AtRanluxGenSvc.h.

Member Typedef Documentation

◆ engineConstIter

typedef engineMap::const_iterator AtRanluxGenSvc::engineConstIter

Definition at line 70 of file AtRanluxGenSvc.h.

◆ engineIter

typedef engineMap::iterator AtRanluxGenSvc::engineIter

Definition at line 69 of file AtRanluxGenSvc.h.

◆ engineMap

typedef std::map<std::string, CLHEP::Ranlux64Engine*> AtRanluxGenSvc::engineMap

Definition at line 68 of file AtRanluxGenSvc.h.

◆ engineValType

typedef engineMap::value_type AtRanluxGenSvc::engineValType

Definition at line 71 of file AtRanluxGenSvc.h.

Constructor & Destructor Documentation

◆ AtRanluxGenSvc()

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

Standard Gaudi Constructor.

Standard Constructor.

Definition at line 29 of file AtRanluxGenSvc.cxx.

30  : base_class(name,svc),
34 {
35  // Set Default values
36  m_default_seed1 = 3591;
37  m_default_seed2 = 2309736;
38  m_PYTHIA_default_seed1 = 93453591;
39  m_PYTHIA_default_seed2 = 73436;
40  m_HERWIG_default_seed1 = 355391;
41  m_HERWIG_default_seed2 = 97336;
42 }

◆ ~AtRanluxGenSvc()

AtRanluxGenSvc::~AtRanluxGenSvc ( )
virtual

Standard Destructor.

Definition at line 46 of file AtRanluxGenSvc.cxx.

47 {
48  engineIter i(m_engines.begin()), e(m_engines.end());
49  while (i != e) delete (i++)->second;
50 }

Member Function Documentation

◆ begin()

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

Definition at line 173 of file AtRanluxGenSvc.h.

174 { return m_engines.begin(); }

◆ CreateStream() [1/2]

bool AtRanluxGenSvc::CreateStream ( const std::vector< uint32_t > &  seeds,
const std::string &  streamName 
)

Definition at line 322 of file AtRanluxGenSvc.cxx.

324 {
325  engineConstIter citer = m_engines.find(streamName);
326  if ( citer == m_engines.end() )
328  new CLHEP::Ranlux64Engine() ) );
329  engineIter iter = m_engines.find(streamName);
330  std::vector<unsigned long> longSeeds(seeds.size());
331  for (size_t i=0; i<seeds.size(); ++i) longSeeds[i]=seeds[i];
332  return (((*iter).second)->getState( longSeeds ));
333 }

◆ CreateStream() [2/2]

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

◆ createStream()

void AtRanluxGenSvc::createStream ( uint32_t  seed1,
uint32_t  seed2,
const std::string &  streamName,
short  luxLevel 
)

allows to specify luxLevel

Definition at line 308 of file AtRanluxGenSvc.cxx.

310 {
311  uint32_t seeds[2] = { seed1, seed2 };
312  const uint32_t* s = seeds;
313  engineConstIter citer = m_engines.find(streamName);
314  if ( citer == m_engines.end() )
316  new CLHEP::Ranlux64Engine(s[0], luxLevel)));
317  engineIter iter = m_engines.find(streamName);
318  ((*iter).second)->setSeed(s[0], luxLevel);
319 }

◆ end()

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

Definition at line 177 of file AtRanluxGenSvc.h.

178 { return m_engines.end(); }

◆ finalize()

StatusCode AtRanluxGenSvc::finalize ( )
overridevirtual

Definition at line 261 of file AtRanluxGenSvc.cxx.

262 {
263  ATH_MSG_INFO (" FINALISING ");
264 
265  if (m_save_to_file) {
266  // Write the status of the Service to file
267  std::ofstream outfile( m_file_to_write.value().c_str() );
268  if ( !outfile ) {
269  ATH_MSG_ERROR ("error: unable to open: " << m_file_to_write.value());
270  } else {
271  for (std::map<std::string, std::vector<uint32_t> >::const_iterator i = m_engines_copy.begin();
272  i != m_engines_copy.end();
273  ++i) {
274  outfile << (*i).first << " ";
275  for (std::vector<uint32_t>::const_iterator j = (*i).second.begin(); j !=(*i).second.end(); ++j){
276  outfile << (*j) << " ";
277  }
278  outfile << endl;
279  }
280  ATH_MSG_DEBUG (" wrote seeds to " << m_file_to_write.value() );
281 
282  }
283  }
284  return StatusCode::SUCCESS;
285 }

◆ GetEngine()

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

Definition at line 288 of file AtRanluxGenSvc.cxx.

289 {
290  engineConstIter citer = m_engines.find(StreamName);
291  if ( citer == m_engines.end() )
292  {
293  m_engines.insert( engineValType( StreamName, new CLHEP::Ranlux64Engine() ) );
295  }
296 
297  engineIter iter = m_engines.find(StreamName);
298  return (CLHEP::HepRandomEngine*)(*iter).second;
299 }

◆ handle()

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

IIncidentListener implementation. Handles EndEvent incident.

Definition at line 170 of file AtRanluxGenSvc.cxx.

170  {
171  ATH_MSG_DEBUG (" Handle EndEvent ");
172 
173  if ( inc.type() == "EndEvent" ||
174  inc.type() == "AfterReseedIncident" )
175  {
176 
177  m_engines_copy.clear();
178  engineConstIter iE(begin()), eE(end());
179  while(iE != eE) {
180  CLHEP::HepRandomEngine* engine = GetEngine(iE->first);
181  std::vector<unsigned long> v = engine->put();
182  std::vector<uint32_t> tseeds(v.size());
183  for (size_t i=0; i<v.size(); ++i) {
184  // The state returned is a set of 32-bit numbers.
185  // On 64-bit platforms, though, the vector holds 64-bit ints.
186  // For the first word, one gets garbage in the high 32 bits.
187  // (This is because the crc32 routine used in clhep
188  // to hash the engine names doesn't mask down to 32 bits.)
189  // Mask off the garbage to get consistent results
190  // across platforms.
191  tseeds[i] = (v[i] & 0xffffffffu);
192  }
193  m_engines_copy.insert(std::make_pair(iE->first, tseeds));
194  ++iE;
195  }
196 
197  print();
198  } else if (inc.type() == "BeginEvent") {
199  ATH_MSG_DEBUG (" Handle BeginEvent ");
200  EventContext context = inc.context();
201  const EventIDBase& ei = context.eventID();
202  //clear static RandGauss cache (generates two numbers per call to shoot()
204  //loop over generator streams, combining the stream name to the hash
205  vector<string>::const_iterator i(m_reseedStreamNames.begin());
206  vector<string>::const_iterator e(m_reseedStreamNames.end());
207  //by default (when no streams are specified in streamNames, seed all
208  //streams
209  if (i == e) {
210  if (!(this->setAllOnDefinedSeeds(ei.event_number(),
211  ei.run_number())))
212  throw GaudiException("can not reseed all streams ", name(), StatusCode::FAILURE);
213  } else {
214  while (i != e) {
215  const string& strName(*i++);
216  if (0 == this->setOnDefinedSeeds(ei.event_number(),
217  ei.run_number(),
218  strName)) {
219  throw GaudiException(string("can not reseed stream ") + strName,
220  name(), StatusCode::FAILURE);
221  } else {
222  msg() << MSG::VERBOSE << "Reseeded stream " << strName
223  << " for random service " << endmsg;
224  }
225  }
226  }
227  }
228  else if (inc.type() == "ReseedIncident") {
229  typedef ContextIncident<std::pair<unsigned,unsigned> > Ctxt;
230  const Ctxt* incident = dynamic_cast<const Ctxt*>(&inc);
231  const std::pair<unsigned,unsigned>& data = incident->tag();
232  //clear static RandGauss cache (generates two numbers per call to shoot()
234  //loop over generator streams, combining the stream name to the hash
235  vector<string>::const_iterator i(m_reseedStreamNames.begin());
236  vector<string>::const_iterator e(m_reseedStreamNames.end());
237  //by default (when no streams are specified in streamNames, seed all
238  //streams
239  if (i == e) {
240  if (!(this->setAllOnDefinedSeeds(data.first,
241  data.second)))
242  throw GaudiException("can not reseed all streams ", name(), StatusCode::FAILURE);
243  } else {
244  while (i != e) {
245  const string& strName(*i++);
246  if (0 == this->setOnDefinedSeeds(data.first,
247  data.second,
248  strName)) {
249  throw GaudiException(string("can not reseed stream ") + strName,
250  name(), StatusCode::FAILURE);
251  } else {
252  msg() << MSG::VERBOSE << "Reseeded stream " << strName
253  << " for random service " << endmsg;
254  }
255  }
256  }
257  }
258 }

◆ initialize()

StatusCode AtRanluxGenSvc::initialize ( )
overridevirtual

Incident Service

Definition at line 54 of file AtRanluxGenSvc.cxx.

55 {
57  ("Initializing " << name()
58  << "\n INITIALISING RANDOM NUMBER STREAMS. ");
59 
61  ServiceHandle<IIncidentSvc> pIncSvc("IncidentSvc", name());
62 
63  // set up the incident service:
64  ATH_CHECK( pIncSvc.retrieve() );
65 
66  //start listening to "EndEvent"
67  static const int PRIORITY = 100;
68  pIncSvc->addListener(this, "EndEvent", PRIORITY);
69  pIncSvc->addListener(this, "AfterReseedIncident", PRIORITY);
70 
71  //and to BeginEvent if we are reseeding
72  if (m_eventReseed) {
73  ATH_MSG_INFO ("will be reseeded for every event");
74  pIncSvc->addListener(this, "BeginEvent", PRIORITY);
75  pIncSvc->addListener(this, "ReseedIncident", PRIORITY);
76  }
77  pIncSvc.release().ignore();
78 
79 
80  //3 is not valid for ranlux, but whatever, that's what we had before...
82 
83  if (m_read_from_file) {
84  // Read from a file
85  ifstream infile( m_file_to_read.value().c_str() );
86  if ( !infile ) {
87  ATH_MSG_ERROR (" Unable to open: " << m_file_to_read.value());
88  return StatusCode::FAILURE;
89  } else {
90  std::string buffer;
91  while (std::getline(infile, buffer)) {
92  string stream;
93  std::vector<uint32_t> seeds;
94  //split the space-separated string in 3 words:
95  if (interpretSeeds(buffer, stream, seeds)) {
96  msg (MSG::DEBUG)
97  << " INITIALISING " << stream << " stream with seeds ";
98  for (std::vector<uint32_t>::const_iterator i = seeds.begin(); i != seeds.end(); ++i){
99  // The state returned is a set of 32-bit numbers.
100  // On 64-bit platforms, though, the vector holds 64-bit ints.
101  // For the first word, one gets garbage in the high 32 bits.
102  // (This is because the crc32 routine used in clhep
103  // to hash the engine names doesn't mask down to 32 bits.)
104  // So mask off the garbage so that we get consistent results
105  // across platforms.
106  msg() << ((*i) & 0xffffffffu) << " ";
107  }
108  msg() << " read from file " << m_file_to_read.value() << endmsg;
109  if (CreateStream(seeds, stream)) {
110  msg(MSG::DEBUG)
111  << stream << " stream initialized succesfully" <<endmsg;
112  } else {
113  msg(MSG::ERROR)
114  << stream << " stream FAILED to initialize" <<endmsg;
115  return StatusCode::FAILURE;
116  }
117  } else {
118  msg(MSG::ERROR)
119  << "bad line\n" << buffer
120  << "\n in input file " << m_file_to_read.value() << endmsg;
121  return StatusCode::FAILURE;
122  }
123  }
124 
125  }
126  }
127  // Create the various streams according to user's request
128  //for (VStrings::const_iterator i = m_streams_seeds.begin(); i != m_streams_seeds.end(); ++i) {
129  for (const auto& i : m_streams_seeds) {
130  string stream;
131  uint32_t seed1, seed2, offset(0);
132  //parse the stream property string
133  short ll(m_defaultLuxLevel); // temp copy so we don't overwrite default
134  if (interpretSeeds(i, stream, seed1, seed2, ll, offset)) {
135  ATH_MSG_VERBOSE("Seeds property: stream " << stream
136  << " seeds " << seed1 << ' ' << seed2
137  << ", luxury level " << ll
138  << ", reseeding offset " << offset);
139  } else {
140  ATH_MSG_ERROR("bad Seeds property\n" << i);
141  return StatusCode::FAILURE;
142  }
143 
144  // Check if stream already generated (e.g. from reading a file)
145  bool not_found(true);
146  if ( number_of_streams() != 0 ) {
148  while (sf != end() && (not_found=((*sf).first != stream))) ++sf;
149  }
150 
151  if (not_found) {
153  (" INITIALISING " << stream << " stream with seeds "
154  << seed1 << " " << seed2);
156  if (m_eventReseed) {
157  m_reseedingOffsets.insert(std::make_pair(stream, offset));
158  // apply the offset we just inserted
159  ATH_MSG_DEBUG("Applying reseeding offset " << offset <<
160  " to stream " << stream);
161  this->setOnDefinedSeeds(seed1, seed2, stream);
162  }
163  }
164 
165  }
166  return StatusCode::SUCCESS;
167 }

◆ number_of_streams()

unsigned int AtRanluxGenSvc::number_of_streams ( void  ) const
inline

Definition at line 181 of file AtRanluxGenSvc.h.

182 { return m_engines.size(); }

◆ oldSetOnDefinedSeeds() [1/2]

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

broken, temporarily keep for backward compatibility

Definition at line 440 of file AtRanluxGenSvc.cxx.

442 {
443  engineConstIter citer = m_engines.find(streamName);
444  if ( citer == m_engines.end() )
445  m_engines.insert( engineValType(streamName, new CLHEP::Ranlux64Engine() ) );
446  engineIter iter = m_engines.find(streamName);
447  int hashedStream(SG::simpleStringHash(streamName));
448  long seeds[2] = { (long)(1000*runNumber + hashedStream),
449  (long)eventNumber };
450  assert( seeds[0] > 0 );
451  assert( seeds[1] > 0 );
452  const long* s = seeds;
453  ((*iter).second)->setSeed( s[0], m_defaultLuxLevel);
454  return (CLHEP::HepRandomEngine*)(*iter).second;
455 }

◆ oldSetOnDefinedSeeds() [2/2]

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

broken, temporarily keep for backward compatibility

Definition at line 458 of file AtRanluxGenSvc.cxx.

459  {
460  engineConstIter citer = m_engines.find(streamName);
461  if ( citer == m_engines.end() )
462  m_engines.insert( engineValType(streamName, new CLHEP::Ranlux64Engine() ) );
463  engineIter iter = m_engines.find(streamName);
464  int hashedStream(SG::simpleStringHash(streamName));
465  long seeds[2] = { (long)(hashedStream % (theSeed+13)),
466  (long)theSeed };
467  assert( seeds[0] > 0 );
468  assert( seeds[1] > 0 );
469  const long* s = seeds;
470  ((*iter).second)->setSeed( s[0], m_defaultLuxLevel );
471  return (CLHEP::HepRandomEngine*)(*iter).second;
472 }

◆ print() [1/2]

virtual void AtRanluxGenSvc::print ( const std::string &  streamName)
overridevirtual

◆ print() [2/2]

virtual void AtRanluxGenSvc::print ( void  )
overridevirtual

◆ setAllOnDefinedSeeds() [1/2]

virtual bool AtRanluxGenSvc::setAllOnDefinedSeeds ( uint32_t  eventNumber,
uint32_t  runNumber 
)
overridevirtual

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

◆ setAllOnDefinedSeeds() [2/2]

virtual bool AtRanluxGenSvc::setAllOnDefinedSeeds ( uint32_t  theSeed)
overridevirtual

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

◆ setOnDefinedSeeds() [1/2]

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

◆ setOnDefinedSeeds() [2/2]

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

◆ SetStreamSeeds()

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

Definition at line 336 of file AtRanluxGenSvc.cxx.

337 {
338  uint32_t seed1;
339  uint32_t seed2;
340  if (StreamName == "PYTHIA")
341  {
344  }
345  else if (StreamName == "HERWIG")
346  {
349  }
350  else
351  {
354  }
356  (" INITIALISING " << StreamName << " stream with DEFAULT seeds "
357  << seed1 << " " << seed2);
358 
359  uint32_t seeds[2] = { seed1, seed2 };
360  const uint32_t* s = seeds;
361  engineIter iter = m_engines.find(StreamName);
362  ((*iter).second)->setSeed(s[0]); //FIXME no need to set luxLevel?
363 }

Member Data Documentation

◆ m_default_seed1

uint32_t AtRanluxGenSvc::m_default_seed1
private

Definition at line 153 of file AtRanluxGenSvc.h.

◆ m_default_seed2

uint32_t AtRanluxGenSvc::m_default_seed2
private

Definition at line 154 of file AtRanluxGenSvc.h.

◆ m_defaultLuxLevel

short AtRanluxGenSvc::m_defaultLuxLevel
private

Ranlux luxury level to be used by default.

Definition at line 148 of file AtRanluxGenSvc.h.

◆ m_engines

engineMap AtRanluxGenSvc::m_engines
private

Definition at line 145 of file AtRanluxGenSvc.h.

◆ m_engines_copy

std::map<std::string, std::vector<uint32_t> > AtRanluxGenSvc::m_engines_copy
private

Random engine copy (for output to a file)

Definition at line 147 of file AtRanluxGenSvc.h.

◆ m_eventReseed

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

reseed for every event

Definition at line 134 of file AtRanluxGenSvc.h.

◆ m_file_to_read

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

name of the file to read the engine status from

Definition at line 126 of file AtRanluxGenSvc.h.

◆ m_file_to_write

Gaudi::Property<std::string> AtRanluxGenSvc::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 131 of file AtRanluxGenSvc.h.

◆ m_HERWIG_default_seed1

uint32_t AtRanluxGenSvc::m_HERWIG_default_seed1
private

Definition at line 157 of file AtRanluxGenSvc.h.

◆ m_HERWIG_default_seed2

uint32_t AtRanluxGenSvc::m_HERWIG_default_seed2
private

Definition at line 158 of file AtRanluxGenSvc.h.

◆ m_PYTHIA_default_seed1

uint32_t AtRanluxGenSvc::m_PYTHIA_default_seed1
private

Definition at line 155 of file AtRanluxGenSvc.h.

◆ m_PYTHIA_default_seed2

uint32_t AtRanluxGenSvc::m_PYTHIA_default_seed2
private

Definition at line 156 of file AtRanluxGenSvc.h.

◆ m_read_from_file

Gaudi::Property<bool> AtRanluxGenSvc::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 125 of file AtRanluxGenSvc.h.

◆ m_reseedingOffsets

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

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

Set using OFFSET keyword of the Seeds property

Definition at line 143 of file AtRanluxGenSvc.h.

◆ m_reseedStreamNames

StringArrayProperty AtRanluxGenSvc::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 135 of file AtRanluxGenSvc.h.

◆ m_save_to_file

Gaudi::Property<bool> AtRanluxGenSvc::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 130 of file AtRanluxGenSvc.h.

◆ m_streams_seeds

StringArrayProperty AtRanluxGenSvc::m_streams_seeds
private
Initial value:
{this,"Seeds",{},
"seeds for the engines, a string of the form ['SequenceName [LUXURY luxLevel (range 0:2 default 1)()] "
"[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>"}

seeds for the engines, this is a vector of strings of the form "EnginName Seed1 Seed2"

Definition at line 117 of file AtRanluxGenSvc.h.

◆ m_useOldBrokenSeeding

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

backward compatibility only, broken 32/64 bits

Definition at line 138 of file AtRanluxGenSvc.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
run.infile
string infile
Definition: run.py:13
AtRanluxGenSvc::m_HERWIG_default_seed1
uint32_t m_HERWIG_default_seed1
Definition: AtRanluxGenSvc.h:157
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AtRanluxGenSvc::SetStreamSeeds
void SetStreamSeeds(const std::string &streamName)
Definition: AtRanluxGenSvc.cxx:336
AtRanluxGenSvc::m_file_to_write
Gaudi::Property< std::string > m_file_to_write
name of the file to save the engine status to.
Definition: AtRanluxGenSvc.h:131
AtRanluxGenSvc::createStream
void createStream(uint32_t seed1, uint32_t seed2, const std::string &streamName, short luxLevel)
allows to specify luxLevel
Definition: AtRanluxGenSvc.cxx:308
AtRanluxGenSvc::print
virtual void print(void) override
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
AtRanluxGenSvc::engineConstIter
engineMap::const_iterator engineConstIter
Definition: AtRanluxGenSvc.h:70
AtRanluxGenSvc::end
engineConstIter end(void) const
Definition: AtRanluxGenSvc.h:177
genPbPbJobOpt.seed2
seed2
Definition: genPbPbJobOpt.py:57
AtRanluxGenSvc::m_engines
engineMap m_engines
Definition: AtRanluxGenSvc.h:145
AtRanluxGenSvc::CreateStream
virtual void CreateStream(uint32_t seed1, uint32_t seed2, const std::string &streamName) override
AtRanluxGenSvc::number_of_streams
unsigned int number_of_streams(void) const
Definition: AtRanluxGenSvc.h:181
AtRanluxGenSvc::m_PYTHIA_default_seed2
uint32_t m_PYTHIA_default_seed2
Definition: AtRanluxGenSvc.h:156
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EventInfoWrite.StreamName
string StreamName
Definition: EventInfoWrite.py:28
lumiFormat.i
int i
Definition: lumiFormat.py:92
AtRanluxGenSvc::m_HERWIG_default_seed2
uint32_t m_HERWIG_default_seed2
Definition: AtRanluxGenSvc.h:158
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
AtRanluxGenSvc::m_reseedingOffsets
std::map< std::string, uint32_t > m_reseedingOffsets
optional offsets to combine to run/evt no when reseeding.
Definition: AtRanluxGenSvc.h:143
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
interpretSeeds
bool interpretSeeds(const std::string &buffer, std::string &stream, uint32_t &seed1, uint32_t &seed2, short &luxury, uint32_t &offset)
Definition: interpretSeeds.cxx:28
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
HLT::setFlag
void setFlag(TrigPassFlags *flags, const T *obj, const CONTAINER *container, const std::vector< bool > &flag)
Set the flag at index position.
Definition: TrigPassFlags.h:121
AtRanluxGenSvc::setOnDefinedSeeds
virtual CLHEP::HepRandomEngine * setOnDefinedSeeds(uint32_t theSeed, const std::string &streamName) override
AtRanluxGenSvc::m_defaultLuxLevel
short m_defaultLuxLevel
Ranlux luxury level to be used by default.
Definition: AtRanluxGenSvc.h:148
AtRanluxGenSvc::m_PYTHIA_default_seed1
uint32_t m_PYTHIA_default_seed1
Definition: AtRanluxGenSvc.h:155
AtRanluxGenSvc::m_reseedStreamNames
StringArrayProperty m_reseedStreamNames
streams to be reseeded for every event
Definition: AtRanluxGenSvc.h:135
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AtRanluxGenSvc::m_read_from_file
Gaudi::Property< bool > m_read_from_file
read engine status from file
Definition: AtRanluxGenSvc.h:125
AtRanluxGenSvc::m_save_to_file
Gaudi::Property< bool > m_save_to_file
should current engine status be saved to file ?
Definition: AtRanluxGenSvc.h:130
AtRanluxGenSvc::m_default_seed2
uint32_t m_default_seed2
Definition: AtRanluxGenSvc.h:154
AtRanluxGenSvc::m_engines_copy
std::map< std::string, std::vector< uint32_t > > m_engines_copy
Random engine copy (for output to a file)
Definition: AtRanluxGenSvc.h:147
AtRanluxGenSvc::m_eventReseed
Gaudi::Property< bool > m_eventReseed
reseed for every event
Definition: AtRanluxGenSvc.h:134
AtRanluxGenSvc::setAllOnDefinedSeeds
virtual bool setAllOnDefinedSeeds(uint32_t theSeed) override
seed all streams we manage, combining theSeed and the stream names
python.PyAthena.v
v
Definition: PyAthena.py:157
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
AtRanluxGenSvc::m_default_seed1
uint32_t m_default_seed1
Definition: AtRanluxGenSvc.h:153
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
AtRanluxGenSvc::engineValType
engineMap::value_type engineValType
Definition: AtRanluxGenSvc.h:71
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AtRanluxGenSvc::m_useOldBrokenSeeding
Gaudi::Property< bool > m_useOldBrokenSeeding
backward compatibility only, broken 32/64 bits
Definition: AtRanluxGenSvc.h:138
DEBUG
#define DEBUG
Definition: page_access.h:11
TestSeedRunEvent.Seeds
Seeds
Definition: TestSeedRunEvent.py:12
genPbPbJobOpt.seed1
seed1
Definition: genPbPbJobOpt.py:56
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
AtRanluxGenSvc::m_file_to_read
Gaudi::Property< std::string > m_file_to_read
name of the file to read the engine status from
Definition: AtRanluxGenSvc.h:126
SG::simpleStringHash
int simpleStringHash(const std::string &str, int maxInt=0xFFFF)
simple hash function derived from Sedgewick Algorithms in C++ 3rd ed
Definition: hash_functions.h:16
AtRanluxGenSvc::m_streams_seeds
StringArrayProperty m_streams_seeds
seeds for the engines, this is a vector of strings of the form "EnginName Seed1 Seed2"
Definition: AtRanluxGenSvc.h:117
AtRanluxGenSvc::engineIter
engineMap::iterator engineIter
Definition: AtRanluxGenSvc.h:69
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
AtRanluxGenSvc::begin
engineConstIter begin(void) const
Definition: AtRanluxGenSvc.h:173
AtRanluxGenSvc::GetEngine
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &streamName) override
Definition: AtRanluxGenSvc.cxx:288
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
python.KeyStore.msg
msg
Definition: KeyStore.py:26
DiTauMassTools::TauTypes::ll
@ ll
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:49
ServiceHandle< IIncidentSvc >