npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
EquidistantSampler1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_EQUIDISTANTSAMPLER1D_HH_
2 #define NPSTAT_EQUIDISTANTSAMPLER1D_HH_
3 
4 /*!
5 // \file EquidistantSampler1D.hh
6 //
7 // \brief Make equidistant points in a manner that conforms
8 // to the AbsRandomGenerator interface
9 //
10 // Author: I. Volobouev
11 //
12 // April 2011
13 */
14 
16 
17 namespace npstat {
18  /**
19  // Simple equidistant sampler of the unit interval conforming to
20  // the AbsRandomGenerator interface. Imagine that the interval [0,1]
21  // is split into bins, like in a histogram. The samples will be taken
22  // in the middle of those bins -- either from left to right of from
23  // right to left, depending on the value of "increasingOrder" costructor
24  // parameter.
25  */
27  {
28  public:
29  explicit EquidistantSampler1D(unsigned long long nIntervals,
30  bool increasingOrder=true);
31 
32  inline virtual ~EquidistantSampler1D() {}
33 
34  inline unsigned dim() const {return 1U;}
35  inline unsigned long long nCalls() const {return nCalls_;}
36  inline unsigned long long maxPoints() const {return nIntervals_;}
37 
38  // The following operator will result in a run-time error
39  // if the number of calls has already reached "maxPoints()"
40  double operator()();
41 
42  // Reset to the initial state
43  void reset();
44 
45  private:
47 
48  long double intervalWidth_;
49  unsigned long long nIntervals_;
50  unsigned long long nCalls_;
51  bool increasing_;
52  };
53 }
54 
55 #endif // NPSTAT_EQUIDISTANTSAMPLER1D_HH_
Interface definition for pseudo- and quasi-random number generators.
Definition: EquidistantSampler1D.hh:27
unsigned dim() const
Definition: EquidistantSampler1D.hh:34
unsigned long long maxPoints() const
Definition: EquidistantSampler1D.hh:36
Definition: AbsArrayProjector.hh:14
Definition: AbsRandomGenerator.hh:27