BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCParameter.cxx
1 /*
2  * Copyright (C) 2007-2014, 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 // ---------------------------------------------------------
10 #include "BCParameter.h"
11 #include "BCLog.h"
12 
13 #include <TString.h>
14 
15 #include <algorithm>
16 #include <fstream>
17 #include <iostream>
18 
19 // ---------------------------------------------------------
20 
22  fName("parameter"),
23  fLowerLimit(0),
24  fUpperLimit(1),
25  fFixed(false),
26  fFixedValue(-1.e+111),
27  fFillHistograms(true),
28  fNbins(100)
29 {
30 }
31 
32 // ---------------------------------------------------------
33 
34 BCParameter::BCParameter(const char * name, double lowerlimit, double upperlimit, const char * latexname) :
35  fName(name),
36  fLowerLimit(lowerlimit),
37  fUpperLimit(upperlimit),
38  fLatexName(latexname),
39  fFixed(false),
40  fFixedValue(-1.e+111),
41  fFillHistograms(true),
42  fNbins(100)
43 {
44 }
45 
46 // ---------------------------------------------------------
47 
49 {
50  BCLog::OutSummary("Parameter summary:");
51  BCLog::OutSummary(Form("Parameter : %s", fName.c_str()));
52  BCLog::OutSummary(Form("Lower limit : %f", fLowerLimit));
53  BCLog::OutSummary(Form("Upper limit : %f", fUpperLimit));
54 }
55 
56 // ---------------------------------------------------------
57 
58 bool BCParameter::IsAtLimit(double value) const
59 {
60  if (fLowerLimit == fUpperLimit)
61  return false;
62 
63  if ( ( (value-fLowerLimit)*(value-fLowerLimit)/fLowerLimit/fLowerLimit <= 1e-10) ||
64  ( (value-fUpperLimit)*(value-fUpperLimit)/fUpperLimit/fUpperLimit <= 1e-10))
65  return true;
66  else
67  return false;
68 }
69 
bool IsAtLimit(double value) const
Definition: BCParameter.cxx:58
void PrintSummary() const
Definition: BCParameter.cxx:48