CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/FastSimulation/Utilities/interface/BaseNumericalRandomGenerator.h

Go to the documentation of this file.
00001 #ifndef BaseNumericalRandomGenerator_H
00002 #define BaseNumericalRandomGenerator_H
00003 
00023 #include <vector>
00024 
00025 class RandomEngine;
00026 
00027 class BaseNumericalRandomGenerator
00028 {
00029  public:
00030 
00034   BaseNumericalRandomGenerator(const RandomEngine* engine,
00035                                double xmin=0., 
00036                                double xmax=1., 
00037                                int n=1000, 
00038                                int iter=6);
00039 
00041   virtual ~BaseNumericalRandomGenerator() {}
00042 
00044   void initialize();
00045 
00047   double generate() const;
00048 
00051   double generateExp() const;
00052 
00055   double generateLin() const;
00056 
00057   // The probability density function, to be implemented in the real class
00058   virtual double function(double x)=0;
00059 
00061   bool setSubInterval(double x1,double x2);
00062 
00063  protected:
00064 
00065   const RandomEngine* random;
00066 
00067   std::vector<double> sampling;
00068   std::vector<double> f;
00069   double xmin, xmax;
00070   int n, iter;
00071   double rmin, deltar;
00072   
00073  private:
00074 
00075   int m;
00076 
00077 };
00078 #endif