]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEER/AliRndm.h
Setting of aliases to rawReader done only once. Base decision on cosmic or calib...
[u/mrichter/AliRoot.git] / STEER / STEER / AliRndm.h
CommitLineData
65fb704d 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
65fb704d 16class AliRndm
17{
18public:
e2afb3b6 19 AliRndm();
af7ba10c 20 AliRndm(const AliRndm &rn);
7cdba479 21 virtual ~AliRndm() {fRandom=0;}
e2afb3b6 22 AliRndm & operator=(const AliRndm& rn)
23 {rn.Copy(*this); return (*this);}
65fb704d 24
25 // Random number generator bit
3e54283a 26 virtual void SetRandom(TRandom *ran=0)
7cdba479 27 {if(ran) fRandom=ran;
28 else fRandom=gRandom;}
3e54283a 29
65fb704d 30 virtual TRandom* GetRandom() const {return fRandom;}
d0f1ee3b 31 virtual void Rndm(Float_t* array, Int_t size) const;
65fb704d 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
e2afb3b6 42protected:
c2af2dde 43 TRandom *fRandom; //! Pointer to the random number generator
65fb704d 44
e2afb3b6 45private:
46 void Copy(AliRndm &rn) const;
65fb704d 47
c2af2dde 48 ClassDef(AliRndm,2) //Random Number generator wrapper
65fb704d 49};
50
51#endif
52