MarlinMT  0.1.0
marlinmt::RandomSeedManager Class Reference

RandomSeedManager class. More...

#include <RandomSeedManager.h>

Public Types

typedef unsigned int SeedType
 
typedef std::hash< const void * > HashFunction
 
typedef const void * HashArgument
 
typedef std::size_t HashResult
 
typedef std::unordered_set< HashResultEntryList
 
typedef std::map< HashResult, SeedTypeRandomSeedMap
 
typedef std::mt19937 RandomGenerator
 
typedef std::uniform_int_distribution< SeedTypeRandomDistribution
 

Public Member Functions

 RandomSeedManager (const RandomSeedManager &)=delete
 
RandomSeedManageroperator= (const RandomSeedManager &)=delete
 
 ~RandomSeedManager ()=default
 
 RandomSeedManager (SeedType globalSeed=static_cast< unsigned int >(time(nullptr)))
 Constructor with global seed. More...
 
void addEntry (HashResult entry)
 Add an entry to the random seed manager. More...
 
void addEntry (HashArgument arg)
 Add an entry to the random seed manager. More...
 
std::unique_ptr< RandomSeedMapgenerateRandomSeeds (const EventStore *const evt)
 Generate a random seed map. More...
 

Static Public Attributes

static const SeedType MinSeed = 0
 
static const SeedType MaxSeed = std::numeric_limits<SeedType>::max()
 

Private Member Functions

SeedType getRandom ()
 Get a new random number from the internal generator. More...
 

Private Attributes

SeedType _globalSeed {0}
 The global random seed, if set. More...
 
EntryList _entryList {}
 The entry list. More...
 
RandomGenerator _generator {_globalSeed}
 The random generator engine. More...
 
RandomDistribution _rdmDistribution {MinSeed, MaxSeed}
 The random number distribution. More...
 

Detailed Description

RandomSeedManager class.

Definition at line 18 of file RandomSeedManager.h.

Member Typedef Documentation

◆ EntryList

Definition at line 30 of file RandomSeedManager.h.

◆ HashArgument

Definition at line 28 of file RandomSeedManager.h.

◆ HashFunction

typedef std::hash<const void*> marlinmt::RandomSeedManager::HashFunction

Definition at line 27 of file RandomSeedManager.h.

◆ HashResult

Definition at line 29 of file RandomSeedManager.h.

◆ RandomDistribution

typedef std::uniform_int_distribution<SeedType> marlinmt::RandomSeedManager::RandomDistribution

Definition at line 33 of file RandomSeedManager.h.

◆ RandomGenerator

Definition at line 32 of file RandomSeedManager.h.

◆ RandomSeedMap

◆ SeedType

Definition at line 26 of file RandomSeedManager.h.

Constructor & Destructor Documentation

◆ RandomSeedManager() [1/2]

marlinmt::RandomSeedManager::RandomSeedManager ( const RandomSeedManager )
delete

◆ ~RandomSeedManager()

marlinmt::RandomSeedManager::~RandomSeedManager ( )
default

◆ RandomSeedManager() [2/2]

marlinmt::RandomSeedManager::RandomSeedManager ( SeedType  globalSeed = static_cast<unsigned int>(time(nullptr)))

Constructor with global seed.

Parameters
globalSeedthe global seed

Definition at line 11 of file RandomSeedManager.cc.

Member Function Documentation

◆ addEntry() [1/2]

void marlinmt::RandomSeedManager::addEntry ( HashResult  entry)

Add an entry to the random seed manager.

Parameters
entrya hash ideintifying the entry

Definition at line 19 of file RandomSeedManager.cc.

References _entryList.

Referenced by addEntry(), and marlinmt::ProcessorApi::registerForRandomSeeds().

◆ addEntry() [2/2]

void marlinmt::RandomSeedManager::addEntry ( HashArgument  arg)

Add an entry to the random seed manager.

Parameters
entrya hash ideintifying the entry

Definition at line 28 of file RandomSeedManager.cc.

References addEntry().

◆ generateRandomSeeds()

std::unique_ptr< RandomSeedManager::RandomSeedMap > marlinmt::RandomSeedManager::generateRandomSeeds ( const EventStore *const  evt)

Generate a random seed map.

Mainly used by the whiteboard to get random seeds which are local for a given event context

Parameters
evtthe event source

Definition at line 36 of file RandomSeedManager.cc.

References _entryList, _generator, _globalSeed, getRandom(), jenkins_hash(), and marlinmt::EventStore::uid().

◆ getRandom()

RandomSeedManager::SeedType marlinmt::RandomSeedManager::getRandom ( )
private

Get a new random number from the internal generator.

Definition at line 60 of file RandomSeedManager.cc.

References _generator, and _rdmDistribution.

Referenced by generateRandomSeeds().

◆ operator=()

RandomSeedManager& marlinmt::RandomSeedManager::operator= ( const RandomSeedManager )
delete

Member Data Documentation

◆ _entryList

EntryList marlinmt::RandomSeedManager::_entryList {}
private

The entry list.

Definition at line 79 of file RandomSeedManager.h.

Referenced by addEntry(), and generateRandomSeeds().

◆ _generator

RandomGenerator marlinmt::RandomSeedManager::_generator {_globalSeed}
private

The random generator engine.

Definition at line 81 of file RandomSeedManager.h.

Referenced by generateRandomSeeds(), and getRandom().

◆ _globalSeed

SeedType marlinmt::RandomSeedManager::_globalSeed {0}
private

The global random seed, if set.

Definition at line 77 of file RandomSeedManager.h.

Referenced by generateRandomSeeds().

◆ _rdmDistribution

RandomDistribution marlinmt::RandomSeedManager::_rdmDistribution {MinSeed, MaxSeed}
private

The random number distribution.

Definition at line 83 of file RandomSeedManager.h.

Referenced by getRandom().

◆ MaxSeed

const SeedType marlinmt::RandomSeedManager::MaxSeed = std::numeric_limits<SeedType>::max()
static

Definition at line 36 of file RandomSeedManager.h.

◆ MinSeed

const SeedType marlinmt::RandomSeedManager::MinSeed = 0
static

Definition at line 35 of file RandomSeedManager.h.


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