]>
Commit | Line | Data |
---|---|---|
d88f97cc | 1 | #ifndef ALIRANDOM_H |
2 | #define ALIRANDOM_H | |
3da30618 | 3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
f531a546 | 6 | // $Id$ |
3da30618 | 7 | |
d88f97cc | 8 | #include <math.h> |
9 | ||
10 | #include "TObject.h" | |
11 | ||
12 | class AliRandom : public TObject | |
13 | { | |
14 | public: | |
15 | AliRandom(); // Constructor with default sequence | |
16 | AliRandom(Int_t seed); // Constructor with user defined seed | |
17 | AliRandom(Int_t seed,Int_t cnt1,Int_t cnt2); // User defined starting point | |
1c01b4f8 | 18 | virtual ~AliRandom(); // Destructor |
261c0caf | 19 | Int_t GetSeed() const; // Provide current seed value |
20 | Int_t GetCnt1() const; // Provide current counter value cnt1 | |
21 | Int_t GetCnt2() const; // Provide current counter value cnt2 | |
22 | void Data() const; // Print current seed, cnt1 and cnt2 | |
d88f97cc | 23 | Float_t Uniform(); // Uniform dist. within <0,1> |
24 | Float_t Uniform(Float_t a,Float_t b); // Uniform dist. within <a,b> | |
25 | void Uniform(Float_t* vec,Int_t n); // n uniform randoms in <0,1> | |
26 | void Uniform(Float_t* vec,Int_t n,Float_t a,Float_t b); // see above | |
27 | Float_t Gauss(); // Gaussian dist. with mean=0 sigma=1 | |
28 | Float_t Gauss(Float_t mean,Float_t sigma); // Gaussian dist. with mean and sigma | |
29 | void Gauss(Float_t* vec,Int_t n); // n Gaussian randoms mean=0 sigma=1 | |
30 | void Gauss(Float_t* vec,Int_t n,Float_t mean,Float_t sigma); // see above | |
31 | Float_t Poisson(Float_t mean); // Poisson dist. with certain mean | |
32 | void Poisson(Float_t* vec,Int_t n,Float_t mean); // n Poisson randoms with mean | |
33 | void SetUser(Float_t a,Float_t b,Int_t n,Float_t (*f)(Float_t)); // User dist. f(x) | |
34 | void SetUser(Float_t* x,Float_t* y,Int_t n); // User dist. arrays | |
35 | Float_t User(); // Provide random in [a,b] according to user distribution | |
36 | void User(Float_t* vec,Int_t n); // n randoms in [a,b] from user dist. | |
37 | ||
38 | private: | |
39 | Int_t fI,fJ,fSeed,fCnt1,fCnt2,fClip; // Indices, seed and counters | |
40 | Float_t fU[97],fC,fCd,fCm; // The Fibonacci parameters | |
41 | void Start(Int_t seed,Int_t cnt1,Int_t cnt2); // Start at certain point | |
42 | void Unpack(Int_t seed,Int_t& i,Int_t& j,Int_t& k,Int_t& l); // Unpack the seed | |
43 | void Uniform(Int_t n); // n uniform randoms for quick skipping | |
44 | Int_t fNa; //! The number of bins of the area function | |
45 | Float_t* fXa; //! The binned x values of the area function | |
46 | Float_t* fYa; //! The corresponding y values of the area function | |
47 | Float_t fYamin,fYamax; //! The min. and max. y values of the area function | |
48 | Int_t* fIbins; //! The bin numbers of the random x candidates | |
49 | ||
261c0caf | 50 | ClassDef(AliRandom,3) // Generate universal random numbers on all common machines. |
d88f97cc | 51 | }; |
52 | #endif |