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