BCTF1LogPrior.h
1 #ifndef __BCFORMULALOGPRIOR__H
2 #define __BCFORMULALOGPRIOR__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 #include <TF1.h>
29 
30 // ---------------------------------------------------------
31 
32 class BCTF1LogPrior : public BCPrior
33 {
34 public:
39  BCTF1LogPrior(TF1& f);
40 
42  BCTF1LogPrior(const std::string& formula, double xmin, double xmax);
43 
45  virtual ~BCTF1LogPrior();
46 
54  virtual BCPrior* Clone() const
55  { return new BCTF1LogPrior(*this); }
56 
59  virtual bool IsValid() const
60  { return true; }
61 
63  virtual void SetFunctionRange(double xmin, double xmax);
64 
69  virtual double GetLogPrior(double x)
70  { return fLogPriorFunction.Eval(x); }
71 
77  virtual double GetMode(double xmin = -std::numeric_limits<double>::infinity(), double xmax = std::numeric_limits<double>::infinity());
78 
84  TF1& GetLogFunction()
85  { return fLogPriorFunction; }
86 
87  const TF1& GetLogFunction() const
88  { return fLogPriorFunction; }
89 
92 protected:
95 };
96 
97 #endif
A class to represent the prior of a parameter.
Definition: BCPrior.h:49
virtual double GetLogPrior(double x)
Get log of prior.
Definition: BCTF1LogPrior.h:69
virtual void SetFunctionRange(double xmin, double xmax)
Set ROOT function range.
A class to represent the log of a prior of a parameter by a formula through a TF1.
Definition: BCTF1LogPrior.h:32
virtual ~BCTF1LogPrior()
Destructor.
virtual BCPrior * Clone() const
Clone function.
Definition: BCTF1LogPrior.h:54
virtual double GetMode(double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
Return mode of prior (in range).
BCTF1LogPrior(TF1 &f)
Constructor taking a TF1.
virtual bool IsValid() const
Definition: BCTF1LogPrior.h:59