Observable Class Reference

A class for observables. More...

#include <Observable.h>

Inheritance diagram for Observable:
[legend]
Collaboration diagram for Observable:
[legend]

Detailed Description

A class for observables.

Author
HEPfit Collaboration

The class for building an observable and storing its different parameters read from the SomeModel.conf file or specified by the user. The name (thname) of the observable has to correspond to the allowed name of observables listed in the ThFactory class.

Definition at line 28 of file Observable.h.

Public Member Functions

double computeTheoryValue ()
 A method to access the computed theory value of the observable. More...
 
virtual double computeWeight (double th)
 A method to compute the weight associated with the observable. More...
 
virtual double computeWeight (double th, double ave_i, double errg_i, double errf_i)
 A method to compute the weight associated with the observable. More...
 
virtual double computeWeight (double th1, double th2)
 A method to compute the weight associated with the observable. More...
 
virtual double computeWeight ()
 A method to compute the weight associated with the observable. More...
 
double getAve () const
 A get method to access the average value of the observable. More...
 
std::string getDistr () const
 A get method to access the name of the distribution of the observable. More...
 
double getErrf () const
 A get method to access the flat error of the observable. More...
 
double getErrg () const
 A get method to access the Gaussian error of the observble. More...
 
std::string getFilename () const
 A get method to access the filename of the observables experimental likelihood file. More...
 
std::string getHistoname () const
 A get method to access the name for the histogram of the observable. More...
 
std::string getLabel () const
 A get method to access the label for the observable. More...
 
double getMax () const
 A get method to access the maximum value of the observable. More...
 
double getMin () const
 A get method to access the minimum value of the observable. More...
 
std::string getName () const
 A get method to access the name of the observable. More...
 
virtual int getNChannels ()
 
virtual int getNTheoryValues ()
 
std::string getObsType () const
 A get method to get the Observable type. More...
 
virtual void getTheoryValues (std::vector< double > &theoryValues_i)
 
std::string getThname () const
 A get method to access the thname of the observable as defined in ThFactory class. More...
 
ThObservablegetTho () const
 A get method to access the pointer to the object of the ThObservable class. More...
 
virtual bool isNew ()
 
bool isTMCMC () const
 A method to check if the observable is listed for MCMC. More...
 
double LogGaussian (double x, double ave, double sigma)
 
double LogSplitGaussian (double x, double ave, double errl, double errr)
 
 Observable (const std::string name_i, const std::string thname_i, const std::string label_i, const bool tMCMC_i, const double min_i, const double max_i, ThObservable *tho_i)
 Constructor. More...
 
 Observable (const Observable &orig)
 The copy constructor. More...
 
 Observable ()
 The default constructor. More...
 
boost::tokenizer< boost::char_separator< char > >::iterator & ParseObservable (std::string &type, boost::tokenizer< boost::char_separator< char > > *tok, boost::tokenizer< boost::char_separator< char > >::iterator &beg, std::string &filepath, std::string &infilename, int rank)
 The parser for Observables. More...
 
void setAve (double ave)
 A set method to fix the average value of the observable. More...
 
void setDistr (std::string distr)
 A set method to fix the name of the distribution of the observable. More...
 
void setErrf (double errf)
 A set method to fix the flat error of the observable. More...
 
void setErrg (double errg)
 A set method to fix the gaussian error of the observable. More...
 
void setFilename (std::string filename_i)
 
void setHistoname (std::string histoname_i)
 A set method to set the name of the histogram containing the likelihood. More...
 
void setLabel (std::string label)
 A set method to fix the label for the observable. More...
 
virtual void setLikelihoodFromHisto (std::string filename, std::string histoname)
 A set method to set the likelihood from which the experimental likelihood of the observable will be read. More...
 
void setMax (double max)
 A set method to fix the maximum value for the observable. More...
 
void setMin (double min)
 A set method to fix the minimum value for the observable. More...
 
void setName (std::string name)
 A set method to fix the name for the observable. More...
 
void setObsType (std::string &obsType_s)
 A set method to set the Observable type. More...
 
virtual void setParametricLikelihood (std::string filename)
 A set method to set a parametric likelihood reading parameters from a file. More...
 
virtual void setParametricLikelihood (std::string filename, std::vector< ThObservable * > thObsV)
 
void setThname (std::string thname)
 A set method to fix the name of the observable as listed in ThFactory class. More...
 
void setTho (ThObservable *tho_i)
 A set method to fix the pointer to object of type ThObservable. More...
 
void setTho (ThObservable *tho_i, double bmin, double bmax)
 A set method to fix the pointer to object of type ThObservable. More...
 
void setTMCMC (bool tMCMC)
 A set method to fix the observable's inclusion in the MCMC listing. More...
 
virtual ~Observable ()
 The default destructor. More...
 

Protected Attributes

double ave
 The average value of the observable. More...
 
double bin_max
 The maximum valus of the observable bin. More...
 
double bin_min
 The minimum value of the observable bin. More...
 
std::string distr
 The name of the distribution of the the observable. More...
 
double errf
 the flat error of the observable. More...
 
double errg
 The gaussian error of the observable. More...
 
std::string filename
 The name of the file containing the experimental likelihood for the observable. More...
 
std::string histoname
 The name of the histogram for the observable. More...
 
TH1D * inhisto
 1D Histogram containing the experimental likelihood for the observable More...
 
int iterationNo
 A counter for the interation that helps with the observable caching. More...
 
std::string label
 A label for the observable. More...
 
double max
 The maximum valus of the observable. More...
 
double min
 The minimum value of the observable. More...
 
std::string name
 A name for the observable. More...
 
std::string obsType
 Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable. More...
 
std::string thname
 The name for the oservable as fixed in the ThObservable class. More...
 
ThObservabletho
 A pointer of to the object of the ThObservables class. More...
 
double thValue
 The theory value of the first observable. More...
 
bool tMCMC
 The flag to include or exclude the observable from the MCMC run. More...
 

Friends

std::ostream & operator<< (std::ostream &output, const Observable &o)
 Befriending of the std::ostream operator << to generate an output stream for printing the observables details. More...
 

Constructor & Destructor Documentation

Observable::Observable ( const std::string  name_i,
const std::string  thname_i,
const std::string  label_i,
const bool  tMCMC_i,
const double  min_i,
const double  max_i,
ThObservable tho_i 
)

Constructor.

Parameters
[in]name_ia given name for the observable
[in]thname_ithe thname for the observable fixed in ThFactory()
[in]label_ithe label assigned to the observable
[in]tMCMC_iboolean flag to indicate inclusion in MCMC
[in]min_iminimum value for the observable
[in]max_imaximum value for the observable
[in]tho_ia pointer to an object of type ThObservable

Definition at line 16 of file Observable.cpp.

23 {
24  name = name_i;
25  thname = thname_i;
26  label = label_i;
27  min = min_i;
28  max = max_i;
29  tMCMC = tMCMC_i;
30  tho = tho_i;
31  distr = "";
32  filename = "";
33  histoname = "";
34  ave = 0.;
35  errg = 0.;
36  errf = 0.;
37  obsType = "";
38  bin_min = 0.;
39  bin_max = 0.;
40  iterationNo = std::numeric_limits<int>::max();
41 }
double bin_min
The minimum value of the observable bin.
Definition: Observable.h:454
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:453
double min
The minimum value of the observable.
Definition: Observable.h:449
double max
The maximum valus of the observable.
Definition: Observable.h:450
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451
double ave
The average value of the observable.
Definition: Observable.h:446
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errf
the flat error of the observable.
Definition: Observable.h:448
std::string label
A label for the observable.
Definition: Observable.h:442
int iterationNo
A counter for the interation that helps with the observable caching.
Definition: Observable.h:456
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
std::string name
A name for the observable.
Definition: Observable.h:440
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
double bin_max
The maximum valus of the observable bin.
Definition: Observable.h:455
Observable::Observable ( const Observable orig)

The copy constructor.

Definition at line 43 of file Observable.cpp.

44 {
45  name = orig.name;
46  thname = orig.thname;
47  label = orig.label;
48  min = orig.min;
49  max = orig.max;
50  tMCMC = orig.tMCMC;
51  tho = orig.tho;
52  distr = orig.distr;
53  filename = orig.filename;
54  histoname = orig.histoname;
55  ave = orig.ave;
56  errg = orig.errg;
57  errf = orig.errf;
58  obsType = orig.obsType;
59  bin_min = orig.bin_min;
60  bin_min = orig.bin_max;
61  iterationNo = orig.iterationNo;
62 }
double bin_min
The minimum value of the observable bin.
Definition: Observable.h:454
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:453
double min
The minimum value of the observable.
Definition: Observable.h:449
double max
The maximum valus of the observable.
Definition: Observable.h:450
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451
double ave
The average value of the observable.
Definition: Observable.h:446
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errf
the flat error of the observable.
Definition: Observable.h:448
std::string label
A label for the observable.
Definition: Observable.h:442
int iterationNo
A counter for the interation that helps with the observable caching.
Definition: Observable.h:456
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
std::string name
A name for the observable.
Definition: Observable.h:440
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
double bin_max
The maximum valus of the observable bin.
Definition: Observable.h:455
Observable::Observable ( )

The default constructor.

Definition at line 64 of file Observable.cpp.

65 {
66  name = "";
67  thname = "";
68  label = "";
69  min = 0.;
70  max = 0.;
71  tMCMC = false;
72  tho = NULL;
73  distr = "";
74  filename = "";
75  histoname = "";
76  ave = 0.;
77  errg = 0.;
78  errf = 0.;
79  obsType = "";
80  bin_min = 0.;
81  bin_max = 0.;
82  iterationNo = std::numeric_limits<int>::max();
83 }
double bin_min
The minimum value of the observable bin.
Definition: Observable.h:454
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:453
double min
The minimum value of the observable.
Definition: Observable.h:449
double max
The maximum valus of the observable.
Definition: Observable.h:450
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451
double ave
The average value of the observable.
Definition: Observable.h:446
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errf
the flat error of the observable.
Definition: Observable.h:448
std::string label
A label for the observable.
Definition: Observable.h:442
int iterationNo
A counter for the interation that helps with the observable caching.
Definition: Observable.h:456
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
std::string name
A name for the observable.
Definition: Observable.h:440
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
double bin_max
The maximum valus of the observable bin.
Definition: Observable.h:455
Observable::~Observable ( )
virtual

The default destructor.

Definition at line 85 of file Observable.cpp.

85 {}

Member Function Documentation

double Observable::computeTheoryValue ( )

A method to access the computed theory value of the observable.

Definition at line 115 of file Observable.cpp.

116 {
117  if (tho->getModel().getIterationNo() == iterationNo) {
118  return thValue;
119  } else {
122  return thValue;
123  }
124 }
virtual double computeThValue()=0
A member to be overloaded by the respective theory observable. class that calculates the value of the...
int getIterationNo() const
double thValue
The theory value of the first observable.
Definition: Observable.h:457
int iterationNo
A counter for the interation that helps with the observable caching.
Definition: Observable.h:456
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
const StandardModel & getModel()
A get method to get the model.
Definition: ThObservable.h:97
double Observable::computeWeight ( double  th)
virtual

A method to compute the weight associated with the observable.

Parameters
[in]ththe theoretical value of the observable

Definition at line 137 of file Observable.cpp.

138 {
139  double logprob;
140  if (distr.compare("weight") == 0) {
141  if (errf == 0.)
142  logprob = LogGaussian(th, ave, errg);
143  else if (errg == 0.) {
144  if (th < ave + errf && th > ave - errf)
145  logprob = 1.;
146  else
147  logprob = log(0.);
148  } else
149  logprob = log(TMath::Erf((th - ave + errf) / sqrt(2.) / errg)
150  - TMath::Erf((th - ave - errf) / sqrt(2.) / errg));
151  } else if (distr.compare("file") == 0) {
152  int i = inhisto->FindBin(th);
153  if (inhisto->IsBinOverflow(i) || inhisto->IsBinUnderflow(i))
154  logprob = log(0.);
155  else
156  logprob = log(inhisto->GetBinContent(i));
157  //logprob = log(h->GetBinContent(h->FindBin(th)));
158  } else
159  throw std::runtime_error("ERROR: MonteCarloEngine::Weight() called without weight for "
160  + name);
161  return (logprob);
162 }
double ave
The average value of the observable.
Definition: Observable.h:446
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errf
the flat error of the observable.
Definition: Observable.h:448
double LogGaussian(double x, double ave, double sigma)
Definition: Observable.cpp:132
complex log(const complex &z)
std::string name
A name for the observable.
Definition: Observable.h:440
TH1D * inhisto
1D Histogram containing the experimental likelihood for the observable
Definition: Observable.h:452
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
complex sqrt(const complex &z)
double Observable::computeWeight ( double  th,
double  ave_i,
double  errg_i,
double  errf_i 
)
virtual

A method to compute the weight associated with the observable.

Parameters
[in]ththe theoretical value of the observable
[in]ave_ithe average value of the observable
[in]errg_ithe Gaussian error of the observable
[in]errf_ithe flat error of the observable

Definition at line 164 of file Observable.cpp.

165 {
166  double logprob;
167  if (distr.compare("weight") == 0) {
168  if (errf_i == 0.)
169  logprob = LogGaussian(th, ave_i, errg_i);
170  else if (errg_i == 0.) {
171  if (th < ave_i + errf_i && th > ave_i - errf_i)
172  logprob = 1.;
173  else
174  logprob = log(0.);
175  } else
176  logprob = log(TMath::Erf((th - ave_i + errf_i) / sqrt(2.) / errg_i)
177  - TMath::Erf((th - ave_i - errf_i) / sqrt(2.) / errg_i));
178  } else
179  throw std::runtime_error("ERROR: MonteCarloEngine::Weight() called without weight for "
180  + name);
181  return (logprob);
182 }
double LogGaussian(double x, double ave, double sigma)
Definition: Observable.cpp:132
complex log(const complex &z)
std::string name
A name for the observable.
Definition: Observable.h:440
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
complex sqrt(const complex &z)
virtual double Observable::computeWeight ( double  th1,
double  th2 
)
inlinevirtual

A method to compute the weight associated with the observable.

Parameters
[in]th1the theoretical value of the first observable
[in]th2the theoretical value of the second observable

Reimplemented in Observable2D.

Definition at line 104 of file Observable.h.

105  {
106  return 0.0;
107  };
virtual double Observable::computeWeight ( )
inlinevirtual

A method to compute the weight associated with the observable.

Reimplemented in Observable2D, and HiggsObservable.

Definition at line 112 of file Observable.h.

113  {
115  }
virtual double computeWeight()
A method to compute the weight associated with the observable.
Definition: Observable.h:112
double computeTheoryValue()
A method to access the computed theory value of the observable.
Definition: Observable.cpp:115
double Observable::getAve ( ) const
inline

A get method to access the average value of the observable.

Returns
the average value of the observable

Definition at line 121 of file Observable.h.

122  {
123  return ave;
124  }
double ave
The average value of the observable.
Definition: Observable.h:446
std::string Observable::getDistr ( ) const
inline

A get method to access the name of the distribution of the observable.

Returns
the name of the distribution of the observable

Definition at line 139 of file Observable.h.

140  {
141  return distr;
142  }
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
double Observable::getErrf ( ) const
inline

A get method to access the flat error of the observable.

Returns
the flat error of the observable

Definition at line 157 of file Observable.h.

158  {
159  return errf;
160  }
double errf
the flat error of the observable.
Definition: Observable.h:448
double Observable::getErrg ( ) const
inline

A get method to access the Gaussian error of the observble.

Returns
the Gauissian error of the observable

Definition at line 175 of file Observable.h.

176  {
177  return errg;
178  }
double errg
The gaussian error of the observable.
Definition: Observable.h:447
std::string Observable::getFilename ( ) const
inline

A get method to access the filename of the observables experimental likelihood file.

Returns
the name of the file

Definition at line 193 of file Observable.h.

194  {
195  return filename;
196  }
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
std::string Observable::getHistoname ( ) const
inline

A get method to access the name for the histogram of the observable.

Returns
the name of the histogram for the observable

Definition at line 232 of file Observable.h.

233  {
234  return histoname;
235  }
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
std::string Observable::getLabel ( ) const
inline

A get method to access the label for the observable.

Returns
the label for the observable

Definition at line 250 of file Observable.h.

251  {
252  return label;
253  }
std::string label
A label for the observable.
Definition: Observable.h:442
double Observable::getMax ( ) const
inline

A get method to access the maximum value of the observable.

Returns
the maximum value of the observable

Definition at line 268 of file Observable.h.

269  {
270  return max;
271  }
double max
The maximum valus of the observable.
Definition: Observable.h:450
double Observable::getMin ( ) const
inline

A get method to access the minimum value of the observable.

Returns
the minimum value of the observable

Definition at line 286 of file Observable.h.

287  {
288  return min;
289  }
double min
The minimum value of the observable.
Definition: Observable.h:449
std::string Observable::getName ( ) const
inline

A get method to access the name of the observable.

Returns
the name of the observable

Definition at line 304 of file Observable.h.

305  {
306  return name;
307  }
std::string name
A name for the observable.
Definition: Observable.h:440
virtual int Observable::getNChannels ( )
inlinevirtual

Reimplemented in HiggsObservable.

Definition at line 426 of file Observable.h.

426 { return 0; };
virtual int Observable::getNTheoryValues ( )
inlinevirtual

Reimplemented in HiggsObservable.

Definition at line 424 of file Observable.h.

424 { return 0; };
std::string Observable::getObsType ( ) const
inline

A get method to get the Observable type.

Returns
a string containing the observable type

Definition at line 376 of file Observable.h.

377  {
378  return obsType;
379  }
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:453
virtual void Observable::getTheoryValues ( std::vector< double > &  theoryValues_i)
inlinevirtual

Reimplemented in HiggsObservable.

Definition at line 422 of file Observable.h.

422 {};
std::string Observable::getThname ( ) const
inline

A get method to access the thname of the observable as defined in ThFactory class.

Returns
thname the name of the observable as listed in ThFactory class

Definition at line 340 of file Observable.h.

341  {
342  return thname;
343  }
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
ThObservable* Observable::getTho ( ) const
inline

A get method to access the pointer to the object of the ThObservable class.

Returns
pointer to the object of type ThObservable

Definition at line 358 of file Observable.h.

359  {
360  return tho;
361  }
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
virtual bool Observable::isNew ( )
inlinevirtual

Reimplemented in HiggsObservable.

Definition at line 428 of file Observable.h.

428 { return false; };
bool Observable::isTMCMC ( ) const
inline

A method to check if the observable is listed for MCMC.

Returns
true or false

Definition at line 322 of file Observable.h.

323  {
324  return tMCMC;
325  }
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451
double Observable::LogGaussian ( double  x,
double  ave,
double  sigma 
)

A method to compute the log of a Gaussian likelihood

Parameters
xthe value of the Gaussian distributed variable
avethe average value
sigmathe error
Returns
the log likelihood at point x

Definition at line 132 of file Observable.cpp.

133 {
134  return -0.5 * (x-ave) * (x-ave) / sigma / sigma;
135 }
double ave
The average value of the observable.
Definition: Observable.h:446
double Observable::LogSplitGaussian ( double  x,
double  ave,
double  errl,
double  errr 
)

A method to compute the log of a split Gaussian likelihood

Parameters
xthe value of the split-Gaussian distributed variable
avethe average value
errlthe left-side error
errrthe right-side error
Returns
the log likelihood at point x

Definition at line 126 of file Observable.cpp.

127 {
128  double sigma = (x > ave ? errr : errl);
129  return -0.5 * (x-ave) * (x-ave) / sigma / sigma;
130 }
double ave
The average value of the observable.
Definition: Observable.h:446
boost::tokenizer< boost::char_separator< char > >::iterator & Observable::ParseObservable ( std::string &  type,
boost::tokenizer< boost::char_separator< char > > *  tok,
boost::tokenizer< boost::char_separator< char > >::iterator &  beg,
std::string &  filepath,
std::string &  infilename,
int  rank 
)

The parser for Observables.

Parameters
[in]typethe string specifying the type of the observable
[in]tokthe tokenizer containing the line being parsed
[in]begthe iterator that parses a line in the config file
[in]filepaththe path to the config file being parsed
[in]filenamethe name of the config file being parsed
Returns
the line number (integer) after the parsing is done

Definition at line 184 of file Observable.cpp.

190 {
191  if ((type.compare("Observable") == 0 || type.compare("HiggsObservable")) && std::distance(tok->begin(), tok->end()) < 8) {
192  if(rank == 0) throw std::runtime_error("ERROR: lack of information on " + *beg + " in " + infilename);
193  else sleep (2);
194  } else if (type.compare("BinnedObservable") == 0 && std::distance(tok->begin(), tok->end()) < 10) {
195  if(rank == 0) throw std::runtime_error("ERROR: lack of information on " + *beg + " in " + infilename);
196  else sleep (2);
197  } else if (type.compare("FunctionObservable") == 0 && std::distance(tok->begin(), tok->end()) < 9) {
198  if(rank == 0) throw std::runtime_error("ERROR: lack of information on " + *beg + " in " + infilename);
199  else sleep (2);
200  } else {
201  obsType = type;
202  name = *beg;
203  ++beg;
204  thname = *beg;
205  ++beg;
206  label = *beg;
207  size_t pos = 0;
208  while ((pos = label.find("~", pos)) != std::string::npos)
209  label.replace(pos++, 1, " ");
210  ++beg;
211  min = atof((*beg).c_str());
212  ++beg;
213  max = atof((*beg).c_str());
214  ++beg;
215  std::string toMCMC = *beg;
216  if (toMCMC.compare("MCMC") == 0)
217  tMCMC = true;
218  else if (toMCMC.compare("noMCMC") == 0)
219  tMCMC = false;
220  else {
221  if (rank == 0) throw std::runtime_error("ERROR: wrong MCMC flag in " + name + ".\n");
222  else sleep (2);
223  }
224 
225  if (obsType.compare("Observable") == 0 || obsType.compare("BinnedObservable") == 0 || obsType.compare("FunctionObservable") == 0) {
226  ++beg;
227  distr = *beg;
228  if (distr.compare("file") == 0) {
229  if (std::distance(tok->begin(), tok->end()) < 10) {
230  if (rank == 0) throw std::runtime_error("ERROR: lack of information on " + *beg + " in " + infilename + ".\n");
231  else sleep(2);
232  } else {
233  filename = filepath + *(++beg);
234  histoname = *(++beg);
235  setLikelihoodFromHisto(filename, histoname);
236  if (rank == 0) std::cout << "added input histogram " << filename << "/" << histoname << std::endl;
237  }
238  } else if (distr.compare("weight") == 0) {
239  if (std::distance(tok->begin(), tok->end()) < 11) {
240  if(rank == 0) throw std::runtime_error("ERROR: lack of information on " + *beg + " in " + infilename + ".\n");
241  else sleep (2);
242  }
243  ++beg;
244  ave = atof((*beg).c_str());
245  ++beg;
246  errg = atof((*beg).c_str());
247  ++beg;
248  errf = atof((*beg).c_str());
249  if (errf == 0. && errg == 0.) {
250  if (rank == 0) throw std::runtime_error("ERROR: The Gaussian and flat error in weight for " + name + " cannot both be 0. in the " + infilename + " .\n");
251  else sleep(2);
252  }
253  } else if (distr.compare("noweight") == 0) {
254  if (obsType.compare("BinnedObservable") == 0 || obsType.compare("FunctionObservable") == 0) {
255  ++beg;
256  ++beg;
257  ++beg;
258  }
259  } else {
260  if (rank == 0) throw std::runtime_error("ERROR: wrong distribution flag in " + name + " in file " + infilename + ".\n");
261  else sleep(2);
262  }
263  ++beg;
264  if (obsType.compare("BinnedObservable") == 0) {
265  bin_min = atof((*beg).c_str());
266  ++beg;
267  bin_max = atof((*beg).c_str());
268  ++beg;
269  } else if (obsType.compare("FunctionObservable") == 0) {
270  bin_min = atof((*beg).c_str());
271  ++beg;
272  ++beg;
273  }
274  if (beg != tok->end() && rank == 0) std::cout << "WARNING: unread information in observable " << name << std::endl;
275  }
276  }
277  return beg;
278 }
double bin_min
The minimum value of the observable bin.
Definition: Observable.h:454
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:453
double min
The minimum value of the observable.
Definition: Observable.h:449
double max
The maximum valus of the observable.
Definition: Observable.h:450
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451
double ave
The average value of the observable.
Definition: Observable.h:446
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errf
the flat error of the observable.
Definition: Observable.h:448
std::string label
A label for the observable.
Definition: Observable.h:442
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
std::string name
A name for the observable.
Definition: Observable.h:440
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
double bin_max
The maximum valus of the observable bin.
Definition: Observable.h:455
virtual void setLikelihoodFromHisto(std::string filename, std::string histoname)
A set method to set the likelihood from which the experimental likelihood of the observable will be r...
Definition: Observable.cpp:96
void Observable::setAve ( double  ave)
inline

A set method to fix the average value of the observable.

Parameters
[in]avethe average value of the observable

Definition at line 130 of file Observable.h.

131  {
132  this->ave = ave;
133  }
double ave
The average value of the observable.
Definition: Observable.h:446
void Observable::setDistr ( std::string  distr)
inline

A set method to fix the name of the distribution of the observable.

Parameters
[in]distrthe name of the distribution of the observable

Definition at line 148 of file Observable.h.

149  {
150  this->distr = distr;
151  }
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
void Observable::setErrf ( double  errf)
inline

A set method to fix the flat error of the observable.

Parameters
[in]errfthe flat error of the observable

Definition at line 166 of file Observable.h.

167  {
168  this->errf = errf;
169  }
double errf
the flat error of the observable.
Definition: Observable.h:448
void Observable::setErrg ( double  errg)
inline

A set method to fix the gaussian error of the observable.

Parameters
[in]errgthe Gaussian error of the observable

Definition at line 184 of file Observable.h.

185  {
186  this->errg = errg;
187  }
double errg
The gaussian error of the observable.
Definition: Observable.h:447
void Observable::setFilename ( std::string  filename_i)
inline

Definition at line 198 of file Observable.h.

199  {
200  filename = filename_i;
201  }
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
void Observable::setHistoname ( std::string  histoname_i)
inline

A set method to set the name of the histogram containing the likelihood.

Parameters
[in]histoname_ia string that contains the name of the histogram

Definition at line 241 of file Observable.h.

242  {
243  histoname = histoname_i;
244  }
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
void Observable::setLabel ( std::string  label)
inline

A set method to fix the label for the observable.

Parameters
[in]labelthe label for the observable

Definition at line 259 of file Observable.h.

260  {
261  this->label = label;
262  }
std::string label
A label for the observable.
Definition: Observable.h:442
void Observable::setLikelihoodFromHisto ( std::string  filename,
std::string  histoname 
)
virtual

A set method to set the likelihood from which the experimental likelihood of the observable will be read.

Parameters
filenamethe name of the file
histonamethe name of the histogram

Reimplemented in Observable2D.

Definition at line 96 of file Observable.cpp.

97  {
98  this->filename = filename;
99  this->histoname = histoname;
100  TFile *lik = new TFile((filename + ".root").c_str(), "read");
101  TH1D *htmp = (TH1D*) (lik->Get(histoname.c_str()));
102  if (htmp == NULL)
103  throw std::runtime_error("ERROR: nonexistent histogram called "
104  + histoname + " in "
105  + filename + ".root");
106  inhisto = (TH1D *) htmp->Clone((filename + "/" + histoname).c_str());
107  inhisto->SetDirectory(gROOT);
108  setMin(inhisto->GetXaxis()->GetXmin());
109  setMax(inhisto->GetXaxis()->GetXmax());
110  lik->Close();
111  delete lik;
112  }
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
void setMin(double min)
A set method to fix the minimum value for the observable.
Definition: Observable.h:295
void setMax(double max)
A set method to fix the maximum value for the observable.
Definition: Observable.h:277
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
TH1D * inhisto
1D Histogram containing the experimental likelihood for the observable
Definition: Observable.h:452
void Observable::setMax ( double  max)
inline

A set method to fix the maximum value for the observable.

Parameters
[in]maxthe maximum value for the observable

Definition at line 277 of file Observable.h.

278  {
279  this->max = max;
280  }
double max
The maximum valus of the observable.
Definition: Observable.h:450
void Observable::setMin ( double  min)
inline

A set method to fix the minimum value for the observable.

Parameters
[in]minthe minimum value for the observable

Definition at line 295 of file Observable.h.

296  {
297  this->min = min;
298  }
double min
The minimum value of the observable.
Definition: Observable.h:449
void Observable::setName ( std::string  name)
inline

A set method to fix the name for the observable.

Parameters
namefor the observable

Definition at line 313 of file Observable.h.

314  {
315  this->name = name;
316  }
std::string name
A name for the observable.
Definition: Observable.h:440
void Observable::setObsType ( std::string &  obsType_s)
inline

A set method to set the Observable type.

Parameters
[in]obsType_sa string that contains the parameter name

Definition at line 367 of file Observable.h.

368  {
369  obsType = obsType_s;
370  }
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:453
virtual void Observable::setParametricLikelihood ( std::string  filename)
inlinevirtual

A set method to set a parametric likelihood reading parameters from a file.

Parameters
filenamethe name of the file

Definition at line 215 of file Observable.h.

216  {
217  this->filename=filename; //real implementation will be done in extension
218  }
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
virtual void Observable::setParametricLikelihood ( std::string  filename,
std::vector< ThObservable * >  thObsV 
)
inlinevirtual

Set the parametric likelihood to be overloaded by HiggsObservable.

Parameters
filenamethe name of the config file
thObsVa vector of ThObservables

Reimplemented in HiggsObservable.

Definition at line 225 of file Observable.h.

226  {};
void Observable::setThname ( std::string  thname)
inline

A set method to fix the name of the observable as listed in ThFactory class.

Parameters
[in]thnamethe name of the observable as listed in ThFactory class

Definition at line 349 of file Observable.h.

350  {
351  this->thname = thname;
352  }
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
void Observable::setTho ( ThObservable tho_i)
inline

A set method to fix the pointer to object of type ThObservable.

Parameters
[in]thopointer to the object of type ThObservable

Definition at line 385 of file Observable.h.

386  {
387  tho = tho_i;
390  }
double bin_min
The minimum value of the observable bin.
Definition: Observable.h:454
void setBinMin(double min)
A set method to set the minimum value of the bin.
Definition: ThObservable.h:61
void setBinMax(double max)
A set method to set the maximum value of the bin.
Definition: ThObservable.h:70
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
double bin_max
The maximum valus of the observable bin.
Definition: Observable.h:455
void Observable::setTho ( ThObservable tho_i,
double  bmin,
double  bmax 
)
inline

A set method to fix the pointer to object of type ThObservable.

Parameters
[in]thopointer to the object of type ThObservable

Definition at line 396 of file Observable.h.

397  {
398  tho = tho_i;
399  tho->setBinMin(bmin);
400  tho->setBinMax(bmax);
401  }
void setBinMin(double min)
A set method to set the minimum value of the bin.
Definition: ThObservable.h:61
void setBinMax(double max)
A set method to set the maximum value of the bin.
Definition: ThObservable.h:70
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
void Observable::setTMCMC ( bool  tMCMC)
inline

A set method to fix the observable's inclusion in the MCMC listing.

Parameters
[in]tMCMCtrue or false

Definition at line 331 of file Observable.h.

332  {
333  this->tMCMC = tMCMC;
334  }
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const Observable o 
)
friend

Befriending of the std::ostream operator << to generate an output stream for printing the observables details.

Parameters
[out]outputthe formatted output stream to print the model parameters
[in]oa reference to an object of type Observable()

Definition at line 87 of file Observable.cpp.

88 {
89  output << "Observable name, tMCMC, min, max, distribution, distribution parameters" << std::endl;
90  output << o.name << " " << o.tMCMC << " " << o.min << " " << o.max << " "
91  << o.distr << " " << o.filename << " " << o.histoname << " " << o.ave
92  << " " << o.errg << " " << o.errf << std::endl;
93  return output;
94 }
double min
The minimum value of the observable.
Definition: Observable.h:449
double max
The maximum valus of the observable.
Definition: Observable.h:450
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:445
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451
double ave
The average value of the observable.
Definition: Observable.h:446
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errf
the flat error of the observable.
Definition: Observable.h:448
std::string name
A name for the observable.
Definition: Observable.h:440
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443

Member Data Documentation

double Observable::ave
protected

The average value of the observable.

Definition at line 446 of file Observable.h.

double Observable::bin_max
protected

The maximum valus of the observable bin.

Definition at line 455 of file Observable.h.

double Observable::bin_min
protected

The minimum value of the observable bin.

Definition at line 454 of file Observable.h.

std::string Observable::distr
protected

The name of the distribution of the the observable.

Definition at line 443 of file Observable.h.

double Observable::errf
protected

the flat error of the observable.

Definition at line 448 of file Observable.h.

double Observable::errg
protected

The gaussian error of the observable.

Definition at line 447 of file Observable.h.

std::string Observable::filename
protected

The name of the file containing the experimental likelihood for the observable.

Definition at line 444 of file Observable.h.

std::string Observable::histoname
protected

The name of the histogram for the observable.

Definition at line 445 of file Observable.h.

TH1D* Observable::inhisto
protected

1D Histogram containing the experimental likelihood for the observable

Definition at line 452 of file Observable.h.

int Observable::iterationNo
protected

A counter for the interation that helps with the observable caching.

Definition at line 456 of file Observable.h.

std::string Observable::label
protected

A label for the observable.

Definition at line 442 of file Observable.h.

double Observable::max
protected

The maximum valus of the observable.

Definition at line 450 of file Observable.h.

double Observable::min
protected

The minimum value of the observable.

Definition at line 449 of file Observable.h.

std::string Observable::name
protected

A name for the observable.

Definition at line 440 of file Observable.h.

std::string Observable::obsType
protected

Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable.

Definition at line 453 of file Observable.h.

std::string Observable::thname
protected

The name for the oservable as fixed in the ThObservable class.

Definition at line 441 of file Observable.h.

ThObservable* Observable::tho
protected

A pointer of to the object of the ThObservables class.

Definition at line 439 of file Observable.h.

double Observable::thValue
protected

The theory value of the first observable.

Definition at line 457 of file Observable.h.

bool Observable::tMCMC
protected

The flag to include or exclude the observable from the MCMC run.

Definition at line 451 of file Observable.h.


The documentation for this class was generated from the following files: