00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ROO_QUASI_RANDOM_GENERATOR
00017 #define ROO_QUASI_RANDOM_GENERATOR
00018
00019 #include "Rtypes.h"
00020
00021 class RooQuasiRandomGenerator {
00022 public:
00023 RooQuasiRandomGenerator();
00024 virtual ~RooQuasiRandomGenerator();
00025 void reset();
00026 Bool_t generate(UInt_t dimension, Double_t vector[]);
00027 enum { MaxDimension = 12 , NBits = 31 , MaxDegree = 50 , MaxPrimitiveDegree = 5 };
00028 protected:
00029 void calculateCoefs(UInt_t dimension);
00030 void calculateV(const int px[], int px_degree,
00031 int pb[], int * pb_degree, int v[], int maxv);
00032 void polyMultiply(const int pa[], int pa_degree, const int pb[],
00033 int pb_degree, int pc[], int * pc_degree);
00034
00035 inline Int_t add(Int_t x, Int_t y) const { return (x+y)%2; }
00036 inline Int_t mul(Int_t x, Int_t y) const { return (x*y)%2; }
00037 inline Int_t sub(Int_t x, Int_t y) const { return add(x,y); }
00038 private:
00039 Int_t *_nextq;
00040 Int_t _sequenceCount;
00041
00042 static Bool_t _coefsCalculated;
00043 static Int_t _cj[NBits][MaxDimension];
00044 static const Int_t _primitivePoly[MaxDimension+1][MaxPrimitiveDegree+1];
00045 static const Int_t _polyDegree[MaxDimension+1];
00046
00047 ClassDef(RooQuasiRandomGenerator,0)
00048 };
00049
00050 #endif
00051
00052