CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SimpleHistogramGenerator.h
Go to the documentation of this file.
1 #ifndef SimpleHistogramGenerator_H
2 #define SimpleHistogramGenerator_H
3 
15 #include <vector>
16 
17 class RandomEngine;
18 class TH1;
19 class TAxis;
20 
22 {
23  public:
24 
28  SimpleHistogramGenerator(TH1 * histo, const RandomEngine* engine);
29 
32 
34  double generate() const;
35 
36  int binarySearch(const int& n,
37  const std::vector<double>& array,
38  const double& value) const;
39 
40  private:
41 
43 
45  TH1 * myHisto;
46 
48  TAxis * theXaxis;
49 
51  int nBins;
52 
53  // Limits of integration
54  double xMin, xMax;
55 
56  // Bin width
57  double binWidth;
58 
60  std::vector<double> integral;
61 
63  double nEntries;
64 
65 };
66 #endif
double generate() const
The random generation.
double nEntries
Number of entries.
TH1 * myHisto
Pointer to the histogram.
std::vector< double > integral
Integral.
SimpleHistogramGenerator(TH1 *histo, const RandomEngine *engine)
int binarySearch(const int &n, const std::vector< double > &array, const double &value) const
virtual ~SimpleHistogramGenerator()
Default destructor.