Sampler.h
Go to the documentation of this file.
1 #ifndef SAMPLER__H
2 #define SAMPLER__H
3 
4 // ROOT includes
5 #include "TH1.h"
6 
7 namespace genie {
8  namespace supernova {
9 
10  class RandomSampler {
11  public:
12  RandomSampler();
14 
15  void Init(TH1* hist);
16  double GenerateNext();
17 
18  protected:
19  TH1* fHist;
20  };
21 
23  public:
25  ~OrderedSampler();
26 
27  void Init(TH1* hist, bool integral=false);
28  bool End();
29  double GenerateNext();
30  int GetBin();
31  void Reload();
32  void SetProbScale(double scale);
33 
34  // Access to bin contents
35  const size_t Nbins();
36  const double* GetBinEdges();
37  const double GetBinValue(size_t n);
38 
39  protected:
40  double BinStart();
41  double BinEnd();
42 
43  void Step();
44  void StartNextBin();
45 
46  size_t fBin;
47  double fPos;
48  std::vector<double> fBinEdges;
49  std::vector<double> fBinValues;
50 
51  double fFreqCurrent;
52 
53  // Probability scale: including biasing and distance correction
54  double fProbScale;
55  };
56 
57  } // end of namespace supernova
58 } // end of namespace genie
59 
60 
61 #endif
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
double GetBinValue(TFile *f, std::string name, int i, int j)
Definition: DrawSurface.C:31
Double_t scale
Definition: plot.C:25
std::vector< double > fBinValues
Definition: Sampler.h:49
std::vector< double > fBinEdges
Definition: Sampler.h:48
void End(void)
Definition: gXSecComp.cxx:210
An ART module for generating supernova events via GENIE.