ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FW::RandomNumbers Class Reference

< Mersenne Twister More...

#include <acts/blob/master/Examples/Framework/include/ACTFW/Framework/RandomNumbers.hpp>

+ Collaboration diagram for FW::RandomNumbers:

Classes

struct  Config
 

Public Member Functions

 RandomNumbers (const Config &cfg)
 
RandomEngine spawnGenerator (const AlgorithmContext &context) const
 
uint64_t generateSeed (const AlgorithmContext &context) const
 

Private Attributes

Config m_cfg
 

Detailed Description

< Mersenne Twister

Provide event and algorithm specific random number generator.s

This provides local random number generators, allowing for thread-safe, lock-free, and reproducible random number generation across single-threaded and multi-threaded test framework runs.

The role of the RandomNumbers is only to spawn local random number generators. It does not, in and of itself, accomodate requests for specific random number distributions (uniform, gaussian, etc). For this purpose, clients should spawn their own local distribution objects as needed, following the C++11 STL design.

Definition at line 40 of file RandomNumbers.hpp.

View newest version in sPHENIX GitHub at line 40 of file RandomNumbers.hpp

Constructor & Destructor Documentation

FW::RandomNumbers::RandomNumbers ( const Config cfg)

Definition at line 19 of file RandomNumbers.cpp.

View newest version in sPHENIX GitHub at line 19 of file RandomNumbers.cpp

Member Function Documentation

uint64_t FW::RandomNumbers::generateSeed ( const AlgorithmContext context) const

Generate a event and algorithm specific seed value.

This should only be used in special cases e.g. where a custom random engine is used and spawnGenerator can not be used.

Definition at line 26 of file RandomNumbers.cpp.

View newest version in sPHENIX GitHub at line 26 of file RandomNumbers.cpp

References FW::AlgorithmContext::algorithmNumber, FW::AlgorithmContext::eventNumber, k1, and k2.

FW::RandomEngine FW::RandomNumbers::spawnGenerator ( const AlgorithmContext context) const

Spawn an algorithm-local random number generator. To avoid inefficiencies and multiple uses of a given RNG seed, this should only be done once per Algorithm invocation, after what the generator object should be reused.

It calls generateSeed() for an event driven seed

Parameters
contextis the AlgorithmContext of the host algorithm

Definition at line 21 of file RandomNumbers.cpp.

View newest version in sPHENIX GitHub at line 21 of file RandomNumbers.cpp

Member Data Documentation

Config FW::RandomNumbers::m_cfg
private

Definition at line 64 of file RandomNumbers.hpp.

View newest version in sPHENIX GitHub at line 64 of file RandomNumbers.hpp


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