|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "CLHEP/Random/RandomEngine.h"
27 auto algHash = std::hash<std::string>{}(
algName);
28 auto evHash = std::hash<uint64_t>{}(
ev);
29 auto runHash = std::hash<uint64_t>{}(
run);
30 auto hsh = evHash ^ (runHash + (evHash << 6) + (evHash >> 2));
31 hsh = hsh ^ (algHash + (hsh << 6) + (hsh >> 2));
46 seeds[iseed]=(long)theHash;
47 if(seeds[iseed]!=0) ++iseed;
48 seeds[iseed]=(long)
ev;
49 if(seeds[iseed]!=0) ++iseed;
50 seeds[iseed]=(long)(
ev >> 32);
51 if(seeds[iseed]!=0) ++iseed;
52 seeds[iseed]=(long)
run;
53 if(seeds[iseed]!=0) ++iseed;
55 seeds[iseed]=(long)algHash;
56 if(seeds[iseed]!=0) ++iseed;
58 if(seeds[iseed]!=0) ++iseed;
73 for(
size_t t = 0;
t < nSlots;
t++){
76 m_evtSeeded.resize (nSlots, EventContext::INVALID_CONTEXT_EVT);
82 for(
auto engPtr : m_engines) {
89 EventContext::ContextEvt_t
evt )
92 setSeed(slot, hsh,
evt);
97 EventContext::ContextEvt_t
evt )
101 setSeeds(slot, seeds,
evt);
106 EventContext::ContextEvt_t
evt )
108 if(seeding==MC16Seeding) {
113 if(seeding==MC20Seeding) {
123 EventContext::ContextEvt_t
evt )
126 setSeed(slot, theHash,
evt);
130 EventContext::ContextEvt_t
evt )
132 m_engines[slot]->setSeed(seed, 0);
133 if (
evt == EventContext::INVALID_CONTEXT_EVT) {
134 evt = Gaudi::Hive::currentContext().evt();
136 m_evtSeeded[slot] =
evt;
140 EventContext::ContextEvt_t
evt )
142 m_engines[slot]->setSeeds(seeds, 0);
143 if (
evt == EventContext::INVALID_CONTEXT_EVT) {
144 evt = Gaudi::Hive::currentContext().evt();
146 m_evtSeeded[slot] =
evt;
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
uint64_t MurmurHash64A(const void *key, int len, uint64_t seed)
SeedingOptionType
Options for seeding option=0 is setSeed as in MC20 option=1 is setSeedLegacy as in MC16 option=2 is s...
void setSeedLegacy(const std::string &algName, size_t slot, uint64_t ev, uint64_t run, uint64_t offset, SeedingOptionType seeding, EventContext::ContextEvt_t evt=EventContext::INVALID_CONTEXT_EVT)
Set the random seed using a string (e.g.
const std::string & algName(ID id)
Converts a JetAlgorithmType::ID into a string.
void setSeedMC21(const std::string &algName, size_t slot, uint64_t ev, uint64_t run, uint64_t offset=0, EventContext::ContextEvt_t evt=EventContext::INVALID_CONTEXT_EVT)
Set the random seed using a string (e.g.
int run(int argc, char *argv[])
RNGWrapper(const factoryFunc &genFact, size_t nSlots)
Constructor takes a factory function which can instantiate a CLHEP::HepRandomEngine and the number of...
void setSeeds(size_t slot, const long *seeds, EventContext::ContextEvt_t evt=EventContext::INVALID_CONTEXT_EVT)
Set the seed value(s) directly for a specified slot.
uint32_t crc_combine(uint32_t seed, uint32_t v)
using crc32 for architecture independence in combining the seeds
std::vector< CLHEP::HepRandomEngine * > m_engines
Vector of random engines, ordered by slot number.
size_t calculateSeedMC16(const std::string &algName, uint64_t ev, uint64_t run, uint32_t offset=0)
Helper methods.
uint64_t crc64addint(uint64_t crc, uint64_t x)
Extend a previously-calculated CRC to include an int.
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
void setSeedMC20(const std::string &algName, size_t slot, uint64_t ev, uint64_t run, EventContext::ContextEvt_t evt=EventContext::INVALID_CONTEXT_EVT)
Set the random seed using a string (e.g.
size_t calculateSeedMC20(const std::string &algName, uint64_t ev, uint64_t run)
Set the random seed using a string (e.g.
std::vector< EventContext::ContextEvt_t > m_evtSeeded
Event counter when the engine was last seeded.
void calculateSeedsMC21(long *seeds, const std::string &algName, uint64_t ev, uint64_t run, uint64_t offset=0)
Set the random seed using a string (e.g.
std::function< CLHEP::HepRandomEngine *(void)> factoryFunc
A crc-64 implementation, using pclmul where possible.
long calculateSeedsPython(const std::string &algName, uint64_t ev, uint64_t run, uint64_t offset=0)
Implementation of MurmurHash2.
void setSeedMC16(const std::string &algName, size_t slot, uint64_t ev, uint64_t run, uint32_t offset=0, EventContext::ContextEvt_t evt=EventContext::INVALID_CONTEXT_EVT)
Set the random seed using a string (e.g.