24#ifndef RandGaussZiggurat_h
25#define RandGaussZiggurat_h 1
28#include "CLHEP/Random/defs.h"
29#include "CLHEP/Random/RandGauss.h"
30#include "CLHEP/Utility/thread_local.h"
51 static inline float shoot(
float mean,
float stdDev ) {
return shoot()*stdDev + mean;};
53 static void shootArray (
const int size,
float* vect,
float mean=0.0,
float stdDev=1.0 );
54 static void shootArray (
const int size,
double* vect,
double mean=0.0,
double stdDev=1.0 );
63 static void shootArray (
HepRandomEngine* anotherEngine,
const int size,
double* vect,
double mean=0.0,
double stdDev=1.0 );
72 void fireArray (
const int size,
float* vect);
73 void fireArray (
const int size,
double* vect);
74 void fireArray (
const int size,
float* vect,
float mean,
float stdDev );
75 void fireArray (
const int size,
double* vect,
double mean,
double stdDev );
78 virtual double operator()(
double mean,
double stdDev );
82 std::ostream &
put ( std::ostream & os )
const;
83 std::istream &
get ( std::istream & is );
85 std::string
name()
const;
109 static CLHEP_THREAD_LOCAL
unsigned long kn[128],
ke[256];
110 static CLHEP_THREAD_LOCAL
float wn[128],
fn[128],
we[256],
fe[256];
119 unsigned long iz=hz&127;
120 return ((
unsigned long)std::abs(hz)<
kn[iz]) ? hz*
wn[iz] :
ziggurat_nfix(hz,anEngine);
136#ifdef ENABLE_BACKWARDS_COMPATIBILITY
138using namespace CLHEP;
static HepRandomEngine * getTheEngine()
static void shootArray(const int size, float *vect, float mean=0.0, float stdDev=1.0)
static CLHEP_THREAD_LOCAL unsigned long ke[256]
static float shoot(float mean, float stdDev)
std::istream & get(std::istream &is)
static bool ziggurat_init()
void fireArray(const int size, float *vect)
static float ziggurat_nfix(long hz, HepRandomEngine *anEngine)
static float ziggurat_UNI(HepRandomEngine *anEngine)
static CLHEP_THREAD_LOCAL float fn[128]
std::ostream & put(std::ostream &os) const
static float ziggurat_RNOR(HepRandomEngine *anEngine)
virtual double operator()()
static CLHEP_THREAD_LOCAL unsigned long kn[128]
float fire(float mean, float stdDev)
static CLHEP_THREAD_LOCAL float fe[256]
HepRandomEngine & engine()
static float shoot(HepRandomEngine *anotherEngine, float mean, float stdDev)
RandGaussZiggurat(HepRandomEngine &anEngine, double mean=0.0, double stdDev=1.0)
static CLHEP_THREAD_LOCAL float we[256]
static float shoot(HepRandomEngine *anotherEngine)
virtual ~RandGaussZiggurat()
static unsigned long ziggurat_SHR3(HepRandomEngine *anEngine)
static CLHEP_THREAD_LOCAL float wn[128]
static CLHEP_THREAD_LOCAL bool ziggurat_is_init
static std::string distributionName()
std::shared_ptr< HepRandomEngine > localEngine