|
||||
File indexing completed on 2024-04-06 12:11:26
0001 #ifndef SimpleHistogramGenerator_H 0002 #define SimpleHistogramGenerator_H 0003 0004 /** 0005 * This class is a simpler version (less memory demanding but slightly 0006 * slower) of HistogramGenerator. provides a C++ version of the REMT package from 0007 * Ronald Kleiss. 0008 * 0009 * The method generate() generates random number according to the 0010 * histogram bin content. 0011 * 0012 * \author Patrick Janot 0013 * $Date: 16 July 2009 14:20 */ 0014 0015 #include <vector> 0016 0017 class RandomEngineAndDistribution; 0018 class TH1; 0019 class TAxis; 0020 0021 class SimpleHistogramGenerator { 0022 public: 0023 /// Constructor that perform the necessary integration and inversion steps 0024 /// xmin and xmax are the generation bounds, n is the internal table size 0025 /// and iter is the number of iterations for the numerical part. 0026 SimpleHistogramGenerator(TH1* histo); 0027 0028 /// Default destructor 0029 virtual ~SimpleHistogramGenerator() {} 0030 0031 /// The random generation 0032 double generate(RandomEngineAndDistribution const*) const; 0033 0034 int binarySearch(const int& n, const std::vector<float>& array, const double& value) const; 0035 0036 private: 0037 /// Pointer to the histogram 0038 //TH1 * myHisto; 0039 0040 /// the axis 0041 //TAxis * theXaxis; 0042 0043 /// Number of bins 0044 int nBins; 0045 0046 // Limits of integration 0047 double xMin, xMax; 0048 0049 // Bin width 0050 double binWidth; 0051 0052 /// Integral 0053 std::vector<float> integral; 0054 0055 /// Number of entries 0056 double nEntries; 0057 }; 0058 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |