BCTF1LogPrior.cxx
1 /*
2  * Copyright (C) 2007-2018, the BAT core developer team
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  * For documentation see http://mpp.mpg.de/bat
7  */
8 
9 #include "BCTF1LogPrior.h"
10 #include "BCAux.h"
11 
12 #include <cmath>
13 
14 // ---------------------------------------------------------
16  : BCPrior(),
17  fLogPriorFunction(f)
18 {
19 }
20 
21 // ---------------------------------------------------------
22 BCTF1LogPrior::BCTF1LogPrior(const std::string& formula, double xmin, double xmax)
23  : BCPrior(),
24  fLogPriorFunction("f1_logprior", formula.c_str(), xmin, xmax)
25 {
26 }
27 
28 // ---------------------------------------------------------
30 {
31 }
32 
33 // ---------------------------------------------------------
34 void BCTF1LogPrior::SetFunctionRange(double xmin, double xmax)
35 {
36  BCPrior::SetFunctionRange(xmin, xmax);
37  fLogPriorFunction.SetRange(xmin, xmax);
38 }
39 
40 // ---------------------------------------------------------
41 double BCTF1LogPrior::GetMode(double xmin, double xmax)
42 {
43  BCAux::MakeFinite(xmin, xmax);
44  return fLogPriorFunction.GetMaximumX(xmin, xmax);
45 }
A class to represent the prior of a parameter.
Definition: BCPrior.h:49
void MakeFinite(double &xmin, double &xmax)
Make an infinite range finite by setting inf values to max.
Definition: BCAux.cxx:102
virtual void SetFunctionRange(double xmin, double xmax)
Set range of ROOT TF1 function.
Definition: BCPrior.cxx:133
virtual void SetFunctionRange(double xmin, double xmax)
Set ROOT function range.
virtual ~BCTF1LogPrior()
Destructor.
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.