]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRndm.h
Replacing array of objects by array of pointers
[u/mrichter/AliRoot.git] / STEER / AliRndm.h
1 #ifndef ALIRNDM_H
2 #define ALIRNDM_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 ///////////////////////////////////////////////////////////////////////////////
9 //                                                                           //
10 //   Random Number Interface                                                 //
11 //                                                                           //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include <TRandom.h>
15
16 class AliRndm 
17 {
18 public:
19   AliRndm();
20   AliRndm(const AliRndm &rn);
21   virtual ~AliRndm() {fRandom=0;}
22   AliRndm & operator=(const AliRndm& rn) 
23     {rn.Copy(*this); return (*this);}
24   
25   // Random number generator bit
26   virtual void SetRandom(TRandom *ran=0)
27   {if(ran) fRandom=ran;
28   else fRandom=gRandom;}
29
30   virtual TRandom* GetRandom() const {return fRandom;}
31   virtual void Rndm(Float_t* array, Int_t size) const; 
32 #ifdef CKNONE
33   virtual Float_t Rndm() const {return fRandom->Rndm();}
34 #else
35   virtual Float_t Rndm() const {
36     Float_t r;
37     do r=fRandom->Rndm(); while(0>=r || r>=1); return r;}
38 #endif
39   virtual void WriteRandom(const char *filename) const;
40   virtual void ReadRandom(const char *filename);
41
42 protected:
43   TRandom *fRandom;       // Pointer to the random number generator
44
45 private:
46   void Copy(AliRndm &rn) const;
47
48   ClassDef(AliRndm,1)  //Random Number generator wrapper
49 };
50
51 #endif 
52