RooQuasiRandomGenerator.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooQuasiRandomGenerator.h,v 1.7 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
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   // Z_2 field operations
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) // Quasi-random number generator
00048 };
00049 
00050 #endif
00051 
00052 

Generated on Tue Jul 5 14:26:19 2011 for ROOT_528-00b_version by  doxygen 1.5.1