29#ifndef ALICEO2_MATHUTILS_RANDOMRING_H_
30#define ALICEO2_MATHUTILS_RANDOMRING_H_
44template <
size_t N = 4 * 100000>
84 const float value = mRandomNumbers[mRingPosition];
86 if (mRingPosition >= mRandomNumbers.size()) {
97 template <
typename VcType>
105 if (mRingPosition + VcType::size() > mRandomNumbers.size()) {
108 const VcType
value = VcType(&mRandomNumbers[mRingPosition]);
109 mRingPosition += VcType::size();
110 if (mRingPosition >= mRandomNumbers.size()) {
130 std::array<float, N> mRandomNumbers;
131 size_t mRingPosition = 0;
138 : mRandomType(randomType),
158 TRandom* random = rng ? rng : gRandom;
159 for (
auto&
v : mRandomNumbers) {
161 switch (randomType) {
162 case RandomType::Gaus: {
163 v = random->Gaus(0, 1);
166 case RandomType::Flat: {
182 mRandomType = RandomType::CustomTF1;
183 for (
auto&
v : mRandomNumbers) {
184 v = function.GetRandom(rng);
192 mRandomType = RandomType::CustomLambda;
193 for (
auto&
v : mRandomNumbers) {
@ Gaus
Gaussian distribution.
@ CustomLambda
Initialized through external lambda.
@ CustomTF1
Custom TF1 function to be used.
RandomRing(const RandomType randomType=RandomType::Gaus, TRandom *rng=nullptr)
void initialize(TF1 &function, TRandom *rng=nullptr)
void initialize(const RandomType randomType=RandomType::Gaus, TRandom *rng=nullptr)
void initialize(std::function< float()> function)
RandomRing(TF1 &function)
unsigned int getRingPosition() const
void setRandomPosition(TRandom &rng)
GLsizei const GLfloat * value
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...