|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef ATHENAKERNEL_RNGWRAPPER_H
6 #define ATHENAKERNEL_RNGWRAPPER_H
13 #include "GaudiKernel/EventContext.h"
14 #include "GaudiKernel/ThreadLocalContext.h"
17 class HepRandomEngine;
58 typedef std::function<CLHEP::HepRandomEngine*(void)>
factoryFunc;
69 inline void setSeed(
const std::string&
algName,
const EventContext& ctx);
74 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
81 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
86 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
91 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
109 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
116 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
119 void setSeed(
size_t slot,
size_t seed,
120 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
123 void setSeeds(
size_t slot,
const long * seeds,
124 EventContext::ContextEvt_t
evt = EventContext::INVALID_CONTEXT_EVT);
129 operator CLHEP::HepRandomEngine*()
const {
130 return m_engines[Gaudi::Hive::currentContext().slot()];
134 CLHEP::HepRandomEngine*
getEngine(
const EventContext &ctx)
const {
141 return m_evtSeeded[Gaudi::Hive::currentContext().slot()];
145 EventContext::ContextEvt_t
evtSeeded(
const EventContext &ctx)
const
164 EventContext::ContextEvt_t
evt )
172 ctx.eventID().event_number(),
173 ctx.eventID().run_number(),
178 EventContext::ContextEvt_t
evt )
180 setSeedLegacy(
algName, ctx.slot(),
181 ctx.eventID().event_number(),
182 ctx.eventID().run_number(),
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
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.
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.
EventContext::ContextEvt_t evtSeeded(const EventContext &ctx) const
Return the event count at which the current slot of CTX was last seeded.
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.
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.
A wrapper class for event-slot-local random engines.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
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
long calculateSeedsPython(const std::string &algName, uint64_t ev, uint64_t run, uint64_t offset=0)
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.
EventContext::ContextEvt_t evtSeeded() const
Return the event count at which the current slot was last seeded.
static constexpr std::initializer_list< SeedingOptionType > all_SeedingOptions