Belle II Software  release-08-01-10
RandomNumbers.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <string>
12 #include <framework/core/RandomGenerator.h>
13 
14 namespace Belle2 {
23  class RandomNumbers {
24 
25  public:
29  static void initialize();
30 
36  static void initialize(const std::string& seed);
37 
41  static bool isInitialized();
42 
47  static void initializeBeginRun();
48 
53  static void initializeEndRun();
54 
64  static void initializeEvent(bool force = false);
65 
70  static void useEventDependent();
71 
74 
78  static void barrier();
79 
85  static void setSeed(const std::string& seed);
86 
92  static std::string getSeed() {return s_initialSeed;};
93 
94  //--------------------------------------------------
95  // Python API
96  //--------------------------------------------------
97 
101  static void exposePythonAPI();
102 
103 
104  private:
111  static std::string s_initialSeed;
113  static int s_barrierOffset;
114  };
115 
117 } //end of namespace Belle2
Fast Random number Generator using on xorshift1024* [arXiv:1402.6246].
The class for handling the random number generation.
Definition: RandomNumbers.h:23
static int s_barrierOffset
barrier index offset to be used in begin/endRun.
static void initializeEndRun()
Initialize run independent random generator for end run.
static bool isInitialized()
Truth that the random number generator has been initialized.
static RandomGenerator * s_runRng
event independent random generator to be used for begin/end run processing
static void setSeed(const std::string &seed)
Sets the seed for the random number generator.
static void initializeBeginRun()
Initialize run independent random generator for begin run.
static std::string getSeed()
Get the random number generator seed.
Definition: RandomNumbers.h:92
static void initialize()
Initialize the random number generator with a unique random seed;.
static RandomGenerator & getEventRandomGenerator()
return reference to the event dependent random generator
Definition: RandomNumbers.h:73
static void useEventDependent()
Set Event dependent Random Generator as current one.
static std::string s_initialSeed
The random number generator seed set by the user.
static void exposePythonAPI()
Exposes methods of the RandomNumbers class to Python.
static RandomGenerator * s_evtRng
event dependent random generator to be used for event processing
static void barrier()
Increase random barrier.
static void initializeEvent(bool force=false)
Initialize event information.
Abstract base class for different kinds of events.