BCConstantPrior.h
1 #ifndef __BCCONSTANTPRIOR__H
2 #define __BCCONSTANTPRIOR__H
3 
14 /*
15  * Copyright (C) 2007-2018, the BAT core developer team
16  * All rights reserved.
17  *
18  * For the licensing terms see doc/COPYING.
19  * For documentation see http://mpp.mpg.de/bat
20  */
21 
22 // ---------------------------------------------------------
23 
24 #include "BCPrior.h"
25 
26 #include <limits>
27 
28 class TF1;
29 class TRandom;
30 
31 // ---------------------------------------------------------
32 
33 class BCConstantPrior : public BCPrior
34 {
35 public:
36 
42 
44  BCConstantPrior(double range_width);
45 
47  BCConstantPrior(double xmin, double xmax);
48 
50  virtual ~BCConstantPrior() {};
51 
55  virtual BCPrior* Clone() const
56  { return new BCConstantPrior(*this); }
57 
59  virtual double GetLogPrior(double /*x*/)
60  { return -fLogRangeWidth; }
61 
64  virtual bool IsValid() const
65  { return std::isfinite(fLogRangeWidth); }
66 
72  virtual double GetMode(double xmin = -std::numeric_limits<double>::infinity(), double xmax = std::numeric_limits<double>::infinity());
73 
75  virtual double GetRawMoment(unsigned n, double xmin = -std::numeric_limits<double>::infinity(), double xmax = std::numeric_limits<double>::infinity());
76 
78  virtual double GetIntegral(double xmin = -std::numeric_limits<double>::infinity(), double xmax = std::numeric_limits<double>::infinity())
79  { (void)xmin; (void)xmax; return 1; }
80 
87  virtual double GetRandomValue(double xmin, double xmax, TRandom* const R = NULL);
88 
89 protected:
92 
93 };
94 
95 #endif
virtual double GetLogPrior(double)
A class to represent the prior of a parameter.
Definition: BCPrior.h:49
virtual bool IsValid() const
virtual double GetIntegral(double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
BCConstantPrior()
Constructor for constant unit prior.
virtual double GetRandomValue(double xmin, double xmax, TRandom *const R=NULL)
virtual double GetRawMoment(unsigned n, double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
A class to represent a constant prior of a parameter.
virtual double GetMode(double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
Return mode of prior (in range) — center of interval for constant prior.
virtual BCPrior * Clone() const
Clone function.
virtual ~BCConstantPrior()
Destructor.
double fLogRangeWidth
log of the width of the parameter range