CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/FastSimulation/Utilities/interface/SimpleHistogramGenerator.h

Go to the documentation of this file.
00001 #ifndef SimpleHistogramGenerator_H
00002 #define SimpleHistogramGenerator_H
00003 
00015 #include <vector>
00016 
00017 class RandomEngine;
00018 class TH1;
00019 class TAxis;
00020 
00021 class SimpleHistogramGenerator
00022 {
00023  public:
00024 
00028   SimpleHistogramGenerator(TH1 * histo, const RandomEngine* engine);
00029 
00031   virtual ~SimpleHistogramGenerator() {}
00032 
00034   double generate() const;
00035 
00036   int binarySearch(const int& n, 
00037                    const std::vector<double>& array, 
00038                    const double& value) const;
00039 
00040  private:
00041 
00042   const RandomEngine* random;
00043 
00045   TH1 * myHisto;
00046 
00048   TAxis * theXaxis;
00049 
00051   int nBins;
00052  
00053   // Limits of integration
00054   double xMin, xMax;
00055 
00056   // Bin width
00057   double binWidth;
00058 
00060   std::vector<double> integral;
00061 
00063   double nEntries;
00064 
00065 };
00066 #endif