ATLAS Offline Software
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
CP::BootstrapGenerator Class Reference

a class to generate random numbers with a unique seed More...

#include <BootstrapGeneratorAlg.h>

Collaboration diagram for CP::BootstrapGenerator:

Public Member Functions

 BootstrapGenerator ()
 the standard constructor More...
 
std::uint64_t fnv1a_64 (const void *buffer, size_t size, std::uint64_t offset_basis)
 implementation of the hash function from https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function More...
 
void setSeed (std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber)
 set the seed of the random number generator based on event properties More...
 
std::uint64_t generateSeed (std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber)
 generate a unique seed based on event identifiers More...
 
std::uint8_t getBootstrap ()
 get the next bootstrap weight More...
 

Private Attributes

TRandomRanluxpp m_rng
 the random number generator (Ranlux++) More...
 

Static Private Attributes

static constexpr std::uint64_t m_offset = 14695981039346656037u
 constants for seed generation More...
 
static constexpr std::uint64_t m_prime = 1099511628211u
 

Detailed Description

a class to generate random numbers with a unique seed

Definition at line 21 of file BootstrapGeneratorAlg.h.

Constructor & Destructor Documentation

◆ BootstrapGenerator()

CP::BootstrapGenerator::BootstrapGenerator ( )
inline

the standard constructor

Definition at line 25 of file BootstrapGeneratorAlg.h.

25 {};

Member Function Documentation

◆ fnv1a_64()

std::uint64_t CP::BootstrapGenerator::fnv1a_64 ( const void *  buffer,
size_t  size,
std::uint64_t  offset_basis 
)

implementation of the hash function from https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function

Definition at line 15 of file BootstrapGeneratorAlg.cxx.

15  {
16  std::uint64_t h = offset_basis;
17  const unsigned char *p = static_cast<const unsigned char *>(buffer);
18  for (size_t i = 0; i < size; i++) {
19  h ^= p[i];
20  h *= m_prime;
21  }
22  return h;
23 }

◆ generateSeed()

std::uint64_t CP::BootstrapGenerator::generateSeed ( std::uint64_t  eventNumber,
std::uint32_t  runNumber,
std::uint32_t  mcChannelNumber 
)

generate a unique seed based on event identifiers

Definition at line 25 of file BootstrapGeneratorAlg.cxx.

26 {
30  return hash;
31 }

◆ getBootstrap()

std::uint8_t CP::BootstrapGenerator::getBootstrap ( )
inline

get the next bootstrap weight

Definition at line 41 of file BootstrapGeneratorAlg.h.

41 { return m_rng.Poisson(1); };

◆ setSeed()

void CP::BootstrapGenerator::setSeed ( std::uint64_t  eventNumber,
std::uint32_t  runNumber,
std::uint32_t  mcChannelNumber 
)

set the seed of the random number generator based on event properties

Definition at line 33 of file BootstrapGeneratorAlg.cxx.

34 {
36  m_rng.SetSeed(seed);
37 }

Member Data Documentation

◆ m_offset

constexpr std::uint64_t CP::BootstrapGenerator::m_offset = 14695981039346656037u
staticconstexprprivate

constants for seed generation

Definition at line 45 of file BootstrapGeneratorAlg.h.

◆ m_prime

constexpr std::uint64_t CP::BootstrapGenerator::m_prime = 1099511628211u
staticconstexprprivate

Definition at line 46 of file BootstrapGeneratorAlg.h.

◆ m_rng

TRandomRanluxpp CP::BootstrapGenerator::m_rng
private

the random number generator (Ranlux++)

Definition at line 50 of file BootstrapGeneratorAlg.h.


The documentation for this class was generated from the following files:
xAOD::mcChannelNumber
mcChannelNumber
Definition: EventInfo_v1.cxx:197
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
lumiFormat.i
int i
Definition: lumiFormat.py:85
CP::BootstrapGenerator::m_offset
static constexpr std::uint64_t m_offset
constants for seed generation
Definition: BootstrapGeneratorAlg.h:45
extractSporadic.h
list h
Definition: extractSporadic.py:97
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
CP::BootstrapGenerator::m_prime
static constexpr std::uint64_t m_prime
Definition: BootstrapGeneratorAlg.h:46
CP::BootstrapGenerator::m_rng
TRandomRanluxpp m_rng
the random number generator (Ranlux++)
Definition: BootstrapGeneratorAlg.h:50
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
h
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CP::BootstrapGenerator::generateSeed
std::uint64_t generateSeed(std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber)
generate a unique seed based on event identifiers
Definition: BootstrapGeneratorAlg.cxx:25
CP::BootstrapGenerator::fnv1a_64
std::uint64_t fnv1a_64(const void *buffer, size_t size, std::uint64_t offset_basis)
implementation of the hash function from https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo...
Definition: BootstrapGeneratorAlg.cxx:15