Observable2D Class Reference

A class for analyzing observables pairwise. More...

#include <Observable2D.h>

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

Detailed Description

A class for analyzing observables pairwise.

Author
HEPfit Collaboration

The class for building a pair of observables and storing their different parameters read from the SomeModel.conf file or specified by the user. The names (thname) of the observables have to correspond to the allowed names of observables listed in the ThFactory class.

Definition at line 24 of file Observable2D.h.

Public Member Functions

double computeTheoryValue2 ()
 A method to access the computed theory value of the second 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 getAve2 () const
 A get method to access the average value of the second observable. More...
 
double getErrf2 () const
 A get method to access the flat error of the second observable. More...
 
double getErrg2 () const
 A get method to access the Gaussian error of the second observble. More...
 
std::string getLabel2 () const
 A get method to access the label for the second observable. More...
 
double getMax2 () const
 A get method to access the maximum value of the second observable. More...
 
double getMin2 () const
 A get method to access the minimum value of the second observable. More...
 
std::string getObsType2 () const
 
std::string getThname2 () const
 A get method to access the thname of the second observable as defined in ThFactory class. More...
 
ThObservablegetTho2 () const
 A get method to access the pointer to the object of the ThObservable class for the second observable. More...
 
bool isEOF ()
 A method to check if the end of file has been reached. More...
 
 Observable2D (const std::string name_i, const std::string thname_i, const std::string thname2_i, const std::string label_i, const std::string label2_i, const bool tMCMC_i, const double min_i, const double max_i, const double min2_i, const double max2_i, ThObservable *tho_i, ThObservable *tho2_i)
 Constructor. More...
 
 Observable2D ()
 The default constructor. More...
 
 Observable2D (const Observable &o1d)
 A conversion constructor. Constructs Observable2D with just one observable. More...
 
 Observable2D (const Observable2D &orig)
 The copy constructor. More...
 
int ParseObservable2D (std::string &type, boost::tokenizer< boost::char_separator< char > > *tok, boost::tokenizer< boost::char_separator< char > >::iterator &beg, std::string &infilename, std::ifstream &ifile, int lineNo, int rank)
 
void setAve2 (double ave2)
 A set method to fix the average value of the second observable. More...
 
void setErrf2 (double errf2)
 A set method to fix the flat error of the second observable. More...
 
void setErrg2 (double errg2)
 A set method to fix the gaussian error of the observable. More...
 
void setLabel2 (std::string label2)
 A set method to fix the label for the second 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 setMax2 (double max2)
 A set method to fix the maximum value for the second observable. More...
 
void setMin2 (double min2)
 A set method to fix the minimum value for the second observable. More...
 
void setObsType2 (std::string &obsType2_i)
 
void setThname2 (std::string thname2)
 A set method to fix the name of the second observable as listed in ThFactory class. More...
 
void setTho1Tho2 (ThObservable *tho1_i, ThObservable *tho2_i)
 A set method to fix the pointer to object of type ThObservable class for the second observable. More...
 
void setTho2 (ThObservable *tho2_i)
 A set method to fix the pointer to object of type ThObservable class for the second observable. More...
 
virtual ~Observable2D ()
 The default destructor. More...
 
- Public Member Functions inherited from Observable
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...
 
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...
 
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...
 

Private Attributes

double ave2
 The average value of the second observable. More...
 
std::vector< double > bin_max
 The maximum value of the bin. More...
 
std::vector< double > bin_min
 The minimum value of the bin. More...
 
double errf2
 the flat error of the second observable. More...
 
double errg2
 The gaussian error of the second observable. More...
 
std::string filepath
 The path to the file being parsed. More...
 
TH2D * inhisto2d
 2D Histogram containing the experimental likelihood for the observable. More...
 
bool IsEOF
 A bolean that is true if the end of file is reached. More...
 
int iterationNo2
 Counts the iteration to help with caching. More...
 
std::string label2
 A label for the second observable. More...
 
double max2
 The maximum valus of the second observable. More...
 
double min2
 The minimum value of the second observable. More...
 
std::string obsType2
 Type of the second Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable. More...
 
std::string thname2
 The name for the second oservable as fixed in the ThObservable() class. More...
 
ThObservabletho2
 A pointer to an object of the ThObservable class. More...
 
double thValue2
 The theory value of the second observable. More...
 

Additional Inherited Members

- Protected Attributes inherited from Observable
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...
 

Constructor & Destructor Documentation

Observable2D::Observable2D ( const std::string  name_i,
const std::string  thname_i,
const std::string  thname2_i,
const std::string  label_i,
const std::string  label2_i,
const bool  tMCMC_i,
const double  min_i,
const double  max_i,
const double  min2_i,
const double  max2_i,
ThObservable tho_i,
ThObservable tho2_i 
)

Constructor.

Parameters
[in]name_ia given name for the observable pair
[in]thname_ithe thname for the first observable fixed in ThFactory
[in]thname2_ithe thname for the second observable fixed in ThFactory
[in]label_ithe label assigned to the first observable
[in]label2_ithe label assigned to the second observable
[in]tMCMC_iboolean flag to indicate inclusion in MCMC
[in]min_iminimum value for the first observable
[in]max_imaximum value for the first observable
[in]min2_iminimum value for the second observable
[in]max2_imaximum value for the second observable
[in]tho_ia pointer to an object of type ThObservable for the first observable
[in]tho2_ia pointer to an object of type ThObservable for the second observable

Definition at line 14 of file Observable2D.cpp.

26 : Observable(name_i, thname_i, label_i, tMCMC_i, min_i, max_i, tho_i),
27  bin_min(2, 0.),
28  bin_max(2, 0.)
29 {
30  thname2 = thname2_i;
31  label2 = label2_i;
32  min2 = min2_i;
33  max2 = max2_i;
34  tho2 = tho2_i;
35  obsType2 = "";
36  filepath = "";
37  iterationNo2 = std::numeric_limits<int>::max();
38 }
std::string label2
A label for the second observable.
Definition: Observable2D.h:292
std::string obsType2
Type of the second Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable.
Definition: Observable2D.h:298
ThObservable * tho2
A pointer to an object of the ThObservable class.
Definition: Observable2D.h:299
double min2
The minimum value of the second observable.
Definition: Observable2D.h:293
std::vector< double > bin_min
The minimum value of the bin.
Definition: Observable2D.h:301
int iterationNo2
Counts the iteration to help with caching.
Definition: Observable2D.h:304
std::string thname2
The name for the second oservable as fixed in the ThObservable() class.
Definition: Observable2D.h:291
double max2
The maximum valus of the second observable.
Definition: Observable2D.h:294
Observable()
The default constructor.
Definition: Observable.cpp:64
std::vector< double > bin_max
The maximum value of the bin.
Definition: Observable2D.h:302
std::string filepath
The path to the file being parsed.
Definition: Observable2D.h:303
Observable2D::Observable2D ( )

The default constructor.

Definition at line 55 of file Observable2D.cpp.

56 : Observable(),
57  bin_min(2, 0.),
58  bin_max(2, 0.)
59 {
60  thname2 = "";
61  label2 = "";
62  min2 = 0.;
63  max2 = 0.;
64  tho2 = NULL;
65  obsType2 = "";
66  filepath = "";
67  iterationNo2 = std::numeric_limits<int>::max();
68 }
std::string label2
A label for the second observable.
Definition: Observable2D.h:292
std::string obsType2
Type of the second Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable.
Definition: Observable2D.h:298
ThObservable * tho2
A pointer to an object of the ThObservable class.
Definition: Observable2D.h:299
double min2
The minimum value of the second observable.
Definition: Observable2D.h:293
std::vector< double > bin_min
The minimum value of the bin.
Definition: Observable2D.h:301
int iterationNo2
Counts the iteration to help with caching.
Definition: Observable2D.h:304
std::string thname2
The name for the second oservable as fixed in the ThObservable() class.
Definition: Observable2D.h:291
double max2
The maximum valus of the second observable.
Definition: Observable2D.h:294
Observable()
The default constructor.
Definition: Observable.cpp:64
std::vector< double > bin_max
The maximum value of the bin.
Definition: Observable2D.h:302
std::string filepath
The path to the file being parsed.
Definition: Observable2D.h:303
Observable2D::Observable2D ( const Observable o1d)

A conversion constructor. Constructs Observable2D with just one observable.

Definition at line 40 of file Observable2D.cpp.

41 : Observable(o1d),
42  bin_min(2, 0.),
43  bin_max(2, 0.)
44 {
45  thname2 = "";
46  label2 = "";
47  min2 = 0.;
48  max2 = 0.;
49  tho2 = NULL;
50  obsType2 = "";
51  filepath = "";
52  iterationNo2 = std::numeric_limits<int>::max();
53 }
std::string label2
A label for the second observable.
Definition: Observable2D.h:292
std::string obsType2
Type of the second Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable.
Definition: Observable2D.h:298
ThObservable * tho2
A pointer to an object of the ThObservable class.
Definition: Observable2D.h:299
double min2
The minimum value of the second observable.
Definition: Observable2D.h:293
std::vector< double > bin_min
The minimum value of the bin.
Definition: Observable2D.h:301
int iterationNo2
Counts the iteration to help with caching.
Definition: Observable2D.h:304
std::string thname2
The name for the second oservable as fixed in the ThObservable() class.
Definition: Observable2D.h:291
double max2
The maximum valus of the second observable.
Definition: Observable2D.h:294
Observable()
The default constructor.
Definition: Observable.cpp:64
std::vector< double > bin_max
The maximum value of the bin.
Definition: Observable2D.h:302
std::string filepath
The path to the file being parsed.
Definition: Observable2D.h:303
Observable2D::Observable2D ( const Observable2D orig)

The copy constructor.

Definition at line 70 of file Observable2D.cpp.

71 : Observable(orig.name, orig.thname, orig.label, orig.tMCMC, orig.min, orig.max, orig.tho),
72  bin_min(orig.bin_min),
73  bin_max(orig.bin_max)
74 {
75 
76  distr = orig.distr;
77  filename = orig.filename;
78  histoname = orig.histoname;
79  ave = orig.ave;
80  errg = orig.errg;
81  errf = orig.errf;
82 
83  thname2 = orig.thname2;
84  label2 = orig.label2;
85  min2 = orig.min2;
86  max2 = orig.max2;
87  tho2 = orig.tho2;
88  filepath = orig.filepath;
90 }
std::string label2
A label for the second observable.
Definition: Observable2D.h:292
ThObservable * tho2
A pointer to an object of the ThObservable class.
Definition: Observable2D.h:299
double min
The minimum value of the observable.
Definition: Observable.h:449
double max
The maximum valus of the observable.
Definition: Observable.h:450
double min2
The minimum value of the second observable.
Definition: Observable2D.h:293
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
std::vector< double > bin_min
The minimum value of the bin.
Definition: Observable2D.h:301
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errf
the flat error of the observable.
Definition: Observable.h:448
int iterationNo2
Counts the iteration to help with caching.
Definition: Observable2D.h:304
std::string label
A label for the observable.
Definition: Observable.h:442
std::string thname2
The name for the second oservable as fixed in the ThObservable() class.
Definition: Observable2D.h:291
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
double max2
The maximum valus of the second observable.
Definition: Observable2D.h:294
Observable()
The default constructor.
Definition: Observable.cpp:64
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::vector< double > bin_max
The maximum value of the bin.
Definition: Observable2D.h:302
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
std::string filepath
The path to the file being parsed.
Definition: Observable2D.h:303
Observable2D::~Observable2D ( )
virtual

The default destructor.

Definition at line 92 of file Observable2D.cpp.

93 {}

Member Function Documentation

double Observable2D::computeTheoryValue2 ( )

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

Definition at line 95 of file Observable2D.cpp.

96 {
98  return thValue2;
99  } else {
102  return thValue2;
103  }
104 }
virtual double computeThValue()=0
A member to be overloaded by the respective theory observable. class that calculates the value of the...
ThObservable * tho2
A pointer to an object of the ThObservable class.
Definition: Observable2D.h:299
int getIterationNo() const
double thValue2
The theory value of the second observable.
Definition: Observable2D.h:305
int iterationNo2
Counts the iteration to help with caching.
Definition: Observable2D.h:304
const StandardModel & getModel()
A get method to get the model.
Definition: ThObservable.h:97
double Observable2D::computeWeight ( double  th1,
double  th2 
)
virtual

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 from Observable.

Definition at line 127 of file Observable2D.cpp.

128 {
129  double logprob;
130  if (distr.compare("file") == 0) {
131  int i = inhisto2d->FindBin(th1, th2);
132  if (inhisto2d->IsBinOverflow(i) || inhisto2d->IsBinUnderflow(i))
133  logprob = log(0.);
134  else
135  logprob = log(inhisto2d->GetBinContent(i));
136  //logprob = log(h->GetBinContent(h->GetXaxis()->FindBin(th1),h->GetYaxis()->FindBin(th2)));
137  } else if (distr.compare("weight") == 0) {
139  } else
140  throw std::runtime_error("ERROR: 2D MonteCarloEngine::Weight() called without file for "
141  + name);
142  return (logprob);
143 }
double ave2
The average value of the second observable.
Definition: Observable2D.h:295
virtual double computeWeight()
A method to compute the weight associated with the observable.
Definition: Observable.h:112
double errf2
the flat error of the second observable.
Definition: Observable2D.h:297
double errg2
The gaussian error of the second observable.
Definition: Observable2D.h:296
complex log(const complex &z)
std::string name
A name for the observable.
Definition: Observable.h:440
TH2D * inhisto2d
2D Histogram containing the experimental likelihood for the observable.
Definition: Observable2D.h:300
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
virtual double Observable2D::computeWeight ( )
inlinevirtual

A method to compute the weight associated with the observable.

Reimplemented from Observable.

Definition at line 212 of file Observable2D.h.

213  {
215  }
virtual double computeWeight()
A method to compute the weight associated with the observable.
Definition: Observable2D.h:212
double computeTheoryValue2()
A method to access the computed theory value of the second observable.
double computeTheoryValue()
A method to access the computed theory value of the observable.
Definition: Observable.cpp:115
double Observable2D::getAve2 ( ) const
inline

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

Returns
the average value of the observable

Definition at line 231 of file Observable2D.h.

232  {
233  return ave2;
234  }
double ave2
The average value of the second observable.
Definition: Observable2D.h:295
double Observable2D::getErrf2 ( ) const
inline

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

Returns
the flat error of the observable

Definition at line 249 of file Observable2D.h.

250  {
251  return errf2;
252  }
double errf2
the flat error of the second observable.
Definition: Observable2D.h:297
double Observable2D::getErrg2 ( ) const
inline

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

Returns
the Gauissian error of the observable

Definition at line 267 of file Observable2D.h.

268  {
269  return errg2;
270  }
double errg2
The gaussian error of the second observable.
Definition: Observable2D.h:296
std::string Observable2D::getLabel2 ( ) const
inline

A get method to access the label for the second observable.

Returns
the label for the second observable

Definition at line 101 of file Observable2D.h.

102  {
103  return label2;
104  }
std::string label2
A label for the second observable.
Definition: Observable2D.h:292
double Observable2D::getMax2 ( ) const
inline

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

Returns
the maximum value of the second observable

Definition at line 119 of file Observable2D.h.

120  {
121  return max2;
122  }
double max2
The maximum valus of the second observable.
Definition: Observable2D.h:294
double Observable2D::getMin2 ( ) const
inline

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

Returns
the minimum value of the second observable

Definition at line 137 of file Observable2D.h.

138  {
139  return min2;
140  }
double min2
The minimum value of the second observable.
Definition: Observable2D.h:293
std::string Observable2D::getObsType2 ( ) const
inline

Definition at line 222 of file Observable2D.h.

223  {
224  return obsType2;
225  }
std::string obsType2
Type of the second Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable.
Definition: Observable2D.h:298
std::string Observable2D::getThname2 ( ) const
inline

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

Returns
thname the name of the second observable as listed in ThFactory() class

Definition at line 155 of file Observable2D.h.

156  {
157  return thname2;
158  }
std::string thname2
The name for the second oservable as fixed in the ThObservable() class.
Definition: Observable2D.h:291
ThObservable* Observable2D::getTho2 ( ) const
inline

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

Returns
pointer to the object of type ThObservable() for the second observable

Definition at line 174 of file Observable2D.h.

175  {
176  return tho2;
177  }
ThObservable * tho2
A pointer to an object of the ThObservable class.
Definition: Observable2D.h:299
bool Observable2D::isEOF ( )
inline

A method to check if the end of file has been reached.

Returns
a boolean which is true if the end of file has been reached

Definition at line 285 of file Observable2D.h.

286  {
287  return IsEOF;
288  }
bool IsEOF
A bolean that is true if the end of file is reached.
Definition: Observable2D.h:306
int Observable2D::ParseObservable2D ( std::string &  type,
boost::tokenizer< boost::char_separator< char > > *  tok,
boost::tokenizer< boost::char_separator< char > >::iterator &  beg,
std::string &  infilename,
std::ifstream &  ifile,
int  lineNo,
int  rank 
)

Definition at line 145 of file Observable2D.cpp.

152 {
153  if (infilename.find("\\/") == std::string::npos) filepath = infilename.substr(0, infilename.find_last_of("\\/") + 1);
154  if (std::distance(tok->begin(), tok->end()) < 12) {
155  setName(*beg);
156  ++beg;
157  if (std::distance(tok->begin(), tok->end()) < 4) {
158  if(rank == 0) throw std::runtime_error("ERROR: lack of information on " + name + " in " + infilename + " at line number" + boost::lexical_cast<std::string>(lineNo));
159  else sleep (2);
160  }
161  std::string toMCMC = *beg;
162  if (toMCMC.compare("MCMC") == 0)
163  setTMCMC(true);
164  else if (toMCMC.compare("noMCMC") == 0)
165  setTMCMC(false);
166  else {
167  if (rank == 0) throw std::runtime_error("ERROR: wrong MCMC flag in Observable2D" + name + " at line number:" + boost::lexical_cast<std::string>(lineNo) + " of file " + infilename + ".\n");
168  else sleep(2);
169  }
170 
171  ++beg;
172  setDistr(*beg);
173  if (distr.compare("file") == 0) {
174  if (std::distance(tok->begin(), tok->end()) < 6) {
175  if(rank == 0) throw std::runtime_error("ERROR: lack of information on "+ *beg + " in " + infilename);
176  else sleep (2);
177  }
178  setFilename(filepath + *(++beg));
179  setHistoname(*(++beg));
180  }
181 
182  std::vector<double> min(2, 0.);
183  std::vector<double> max(2, 0.);
184  std::vector<double> ave(2, 0.);
185  std::vector<double> errg(2, 0.);
186  std::vector<double> errf(2, 0.);
187  std::vector<std::string> thname(2, "");
188  std::vector<std::string> label(2, "");
189  std::vector<std::string> type2D(2, "");
190  std::string line;
191  size_t pos = 0;
192  boost::char_separator<char> sep(" \t");
193  for (int i = 0; i < 2; i++) {
194  IsEOF = getline(ifile, line).eof();
195  if (line.empty() || line.at(0) == '#') {
196  if (rank == 0) throw std::runtime_error("ERROR: no comments or empty lines in Observable2D please! In file " + infilename + " at line number:" + boost::lexical_cast<std::string>(lineNo) + ".\n");
197  else sleep(2);
198  }
199  lineNo++;
200  boost::tokenizer<boost::char_separator<char> > mytok(line, sep);
201  beg = mytok.begin();
202  type2D[i] = *beg;
203  if (type2D[i].compare("Observable") != 0 && type2D[i].compare("BinnedObservable") != 0 && type2D[i].compare("FunctionObservable") != 0) {
204  if (rank == 0) throw std::runtime_error("ERROR: in line no." + boost::lexical_cast<std::string>(lineNo) + " of file " + infilename + ", expecting an Observable or BinnedObservable or FunctionObservable type here...\n");
205  else sleep(2);
206  }
207  ++beg;
208  thname[i] = *beg;
209  ++beg;
210  label[i] = *beg;
211  while ((pos = label[i].find("~", pos)) != std::string::npos)
212  label[i].replace(pos++, 1, " ");
213  ++beg;
214  min[i] = atof((*beg).c_str());
215  ++beg;
216  max[i] = atof((*beg).c_str());
217  if (distr.compare("weight") == 0) {
218  ++beg;
219  ave[i] = atof((*beg).c_str());
220  ++beg;
221  errg[i] = atof((*beg).c_str());
222  ++beg;
223  errf[i] = atof((*beg).c_str());
224  if (errg[i] == 0. && errg[i] == 0.) {
225  if (rank == 0) throw std::runtime_error("ERROR: The Gaussian and flat error in weight for " + name + " cannot both be 0. in the " + infilename + " file, line number:" + boost::lexical_cast<std::string>(lineNo) + ".\n");
226  else sleep(2);
227  }
228  } else if (distr.compare("noweight") == 0 || distr.compare("file") == 0) {
229  if (type2D[i].compare("BinnedObservable") == 0 || type2D[i].compare("FunctionObservable") == 0) {
230  ++beg;
231  ++beg;
232  ++beg;
233  }
234  } else {
235  if (rank == 0) throw std::runtime_error("ERROR: wrong distribution flag in " + name + " in file " + infilename + ".\n");
236  else sleep(2);
237  }
238  if (type2D[i].compare("BinnedObservable") == 0) {
239  ++beg;
240  bin_min[i] = atof((*beg).c_str());
241  ++beg;
242  bin_max[i] = atof((*beg).c_str());
243  } else if (type2D[i].compare("FunctionObservable") == 0) {
244  ++beg;
245  bin_min[i] = atof((*beg).c_str());
246  ++beg;
247  }
248  }
249  setObsType(type2D[0]);
250  obsType2 = type2D[1];
251  setThname(thname[0]);
252  thname2 = thname[1];
253  setLabel(label[0]);
254  label2 = label[1];
255  setMin(min[0]);
256  min2 = min[1];
257  setMax(max[0]);
258  max2= max[1];
259  setAve(ave[0]);
260  ave2 = ave[1];
261  setErrg(errg[0]);
262  errg2 = errg[1];
263  setErrf(errf[0]);
264  errf2 = errf[1];
265  if (distr.compare("file") == 0) {
267  if (rank == 0) std::cout << "added input histogram " << filename << "/" << histoname << std::endl;
268  }
269  return lineNo;
270  } else {
271  beg = ParseObservable(type, tok, beg, filepath, filename, rank);
272  ++beg;
273  std::string distr = *beg;
274  if (distr.compare("file") == 0) {
275  if (std::distance(tok->begin(), tok->end()) < 14) {
276  if (rank == 0) throw std::runtime_error("ERROR: lack of information on " + *beg + " in " + infilename + ".\n");
277  else sleep(2);
278  }
279  setFilename(filepath + *(++beg));
280  setHistoname(*(++beg));
282  if (rank == 0) std::cout << "added input histogram " << filename << "/" << histoname << std::endl;
283  } else if (distr.compare("noweight") == 0) {
284  } else {
285  if (rank == 0) throw std::runtime_error("ERROR: wrong distribution flag in " + name);
286  else sleep(2);
287  }
288  setDistr(distr);
289  ++beg;
290  thname2 = *beg;
291  ++beg;
292  std::string label = *beg;
293  size_t pos = 0;
294  while ((pos = label.find("~", pos)) != std::string::npos)
295  label.replace(pos, 1, " ");
296  label2 = label;
297  ++beg;
298  min2 = atof((*beg).c_str());
299  ++beg;
300  max2 = atof((*beg).c_str());
301  ++beg;
302  if (beg != tok->end())
303  if (rank == 0) std::cout << "WARNING: unread information in observable2D " << name << std::endl;
304  return lineNo;
305  }
306 }
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...
std::string label2
A label for the second observable.
Definition: Observable2D.h:292
void setErrf(double errf)
A set method to fix the flat error of the observable.
Definition: Observable.h:166
void setErrg(double errg)
A set method to fix the gaussian error of the observable.
Definition: Observable.h:184
double ave2
The average value of the second observable.
Definition: Observable2D.h:295
std::string obsType2
Type of the second Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable.
Definition: Observable2D.h:298
double min
The minimum value of the observable.
Definition: Observable.h:449
double max
The maximum valus of the observable.
Definition: Observable.h:450
double min2
The minimum value of the second observable.
Definition: Observable2D.h:293
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
double errf2
the flat error of the second observable.
Definition: Observable2D.h:297
double ave
The average value of the observable.
Definition: Observable.h:446
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.
Definition: Observable.cpp:184
std::vector< double > bin_min
The minimum value of the bin.
Definition: Observable2D.h:301
void setThname(std::string thname)
A set method to fix the name of the observable as listed in ThFactory class.
Definition: Observable.h:349
double errg
The gaussian error of the observable.
Definition: Observable.h:447
double errg2
The gaussian error of the second observable.
Definition: Observable2D.h:296
void setAve(double ave)
A set method to fix the average value of the observable.
Definition: Observable.h:130
double errf
the flat error of the observable.
Definition: Observable.h:448
void setName(std::string name)
A set method to fix the name for the observable.
Definition: Observable.h:313
std::string label
A label for the observable.
Definition: Observable.h:442
std::string thname2
The name for the second oservable as fixed in the ThObservable() class.
Definition: Observable2D.h:291
std::string thname
The name for the oservable as fixed in the ThObservable class.
Definition: Observable.h:441
void setFilename(std::string filename_i)
Definition: Observable.h:198
void setDistr(std::string distr)
A set method to fix the name of the distribution of the observable.
Definition: Observable.h:148
bool IsEOF
A bolean that is true if the end of file is reached.
Definition: Observable2D.h:306
double max2
The maximum valus of the second observable.
Definition: Observable2D.h:294
void setMax(double max)
A set method to fix the maximum value for the observable.
Definition: Observable.h:277
void setTMCMC(bool tMCMC)
A set method to fix the observable's inclusion in the MCMC listing.
Definition: Observable.h:331
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
void setLabel(std::string label)
A set method to fix the label for the observable.
Definition: Observable.h:259
std::vector< double > bin_max
The maximum value of the bin.
Definition: Observable2D.h:302
void setHistoname(std::string histoname_i)
A set method to set the name of the histogram containing the likelihood.
Definition: Observable.h:241
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:443
void setObsType(std::string &obsType_s)
A set method to set the Observable type.
Definition: Observable.h:367
std::string filepath
The path to the file being parsed.
Definition: Observable2D.h:303
void Observable2D::setAve2 ( double  ave2)
inline

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

Parameters
[in]avethe average value of the observable

Definition at line 240 of file Observable2D.h.

241  {
242  this->ave2 = ave2;
243  }
double ave2
The average value of the second observable.
Definition: Observable2D.h:295
void Observable2D::setErrf2 ( double  errf2)
inline

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

Parameters
[in]errfthe flat error of the observable

Definition at line 258 of file Observable2D.h.

259  {
260  this->errf2 = errf2;
261  }
double errf2
the flat error of the second observable.
Definition: Observable2D.h:297
void Observable2D::setErrg2 ( double  errg2)
inline

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

Parameters
[in]errgthe Gaussian error of the observable

Definition at line 276 of file Observable2D.h.

277  {
278  this->errg2 = errg2;
279  }
double errg2
The gaussian error of the second observable.
Definition: Observable2D.h:296
void Observable2D::setLabel2 ( std::string  label2)
inline

A set method to fix the label for the second observable.

Parameters
[in]label2the label for the second observable

Definition at line 110 of file Observable2D.h.

111  {
112  this->label2 = label2;
113  }
std::string label2
A label for the second observable.
Definition: Observable2D.h:292
void Observable2D::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 from Observable.

Definition at line 106 of file Observable2D.cpp.

107 {
108  this->filename = filename;
109  this->histoname = histoname;
110  TFile *lik2 = new TFile((filename + ".root").c_str(), "read");
111  TH2D *htmp2 = (TH2D*) (lik2->Get(histoname.c_str()));
112  if (htmp2 == NULL)
113  throw std::runtime_error("ERROR: nonexistent histogram called "
114  + histoname
115  + " in " + filename + ".root");
116  inhisto2d = (TH2D *) htmp2->Clone((filename + "/" + histoname).c_str());
117  inhisto2d->SetDirectory(gROOT);
118  std::cout << "added 2D input histogram " << name << std::endl;
119  setMin(inhisto2d->GetXaxis()->GetXmin());
120  setMax(inhisto2d->GetXaxis()->GetXmax());
121  setMin2(inhisto2d->GetYaxis()->GetXmin());
122  setMax2(inhisto2d->GetYaxis()->GetXmax());
123  lik2->Close();
124  delete lik2;
125 }
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 setMax2(double max2)
A set method to fix the maximum value for the second observable.
Definition: Observable2D.h:128
void setMin2(double min2)
A set method to fix the minimum value for the second observable.
Definition: Observable2D.h:146
void setMax(double max)
A set method to fix the maximum value for the observable.
Definition: Observable.h:277
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
TH2D * inhisto2d
2D Histogram containing the experimental likelihood for the observable.
Definition: Observable2D.h:300
void Observable2D::setMax2 ( double  max2)
inline

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

Parameters
[in]max2the maximum value for the second observable

Definition at line 128 of file Observable2D.h.

129  {
130  this->max2 = max2;
131  }
double max2
The maximum valus of the second observable.
Definition: Observable2D.h:294
void Observable2D::setMin2 ( double  min2)
inline

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

Parameters
[in]min2the minimum value for the second observable

Definition at line 146 of file Observable2D.h.

147  {
148  this->min2 = min2;
149  }
double min2
The minimum value of the second observable.
Definition: Observable2D.h:293
void Observable2D::setObsType2 ( std::string &  obsType2_i)
inline

Definition at line 217 of file Observable2D.h.

218  {
219  obsType2 = obsType2_i;
220  }
std::string obsType2
Type of the second Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable.
Definition: Observable2D.h:298
void Observable2D::setThname2 ( std::string  thname2)
inline

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

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

Definition at line 164 of file Observable2D.h.

165  {
166  this->thname2 = thname2;
167  }
std::string thname2
The name for the second oservable as fixed in the ThObservable() class.
Definition: Observable2D.h:291
void Observable2D::setTho1Tho2 ( ThObservable tho1_i,
ThObservable tho2_i 
)
inline

A set method to fix the pointer to object of type ThObservable class for the second observable.

Parameters
[in]tho2pointer to the object of type ThObservable() for the second observable

Definition at line 196 of file Observable2D.h.

197  {
198  setTho(tho1_i, bin_min[0], bin_max[0]);
199  setTho2(tho2_i);
200  }
void setTho(ThObservable *tho_i)
A set method to fix the pointer to object of type ThObservable.
Definition: Observable.h:385
std::vector< double > bin_min
The minimum value of the bin.
Definition: Observable2D.h:301
void setTho2(ThObservable *tho2_i)
A set method to fix the pointer to object of type ThObservable class for the second observable...
Definition: Observable2D.h:184
std::vector< double > bin_max
The maximum value of the bin.
Definition: Observable2D.h:302
void Observable2D::setTho2 ( ThObservable tho2_i)
inline

A set method to fix the pointer to object of type ThObservable class for the second observable.

Parameters
[in]tho2pointer to the object of type ThObservable() for the second observable

Definition at line 184 of file Observable2D.h.

185  {
186  tho2 = tho2_i;
187  tho2->setBinMin(bin_min[1]);
188  tho2->setBinMax(bin_max[1]);
189  }
ThObservable * tho2
A pointer to an object of the ThObservable class.
Definition: Observable2D.h:299
std::vector< double > bin_min
The minimum value of the bin.
Definition: Observable2D.h:301
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
std::vector< double > bin_max
The maximum value of the bin.
Definition: Observable2D.h:302

Member Data Documentation

double Observable2D::ave2
private

The average value of the second observable.

Definition at line 295 of file Observable2D.h.

std::vector<double> Observable2D::bin_max
private

The maximum value of the bin.

Definition at line 302 of file Observable2D.h.

std::vector<double> Observable2D::bin_min
private

The minimum value of the bin.

Definition at line 301 of file Observable2D.h.

double Observable2D::errf2
private

the flat error of the second observable.

Definition at line 297 of file Observable2D.h.

double Observable2D::errg2
private

The gaussian error of the second observable.

Definition at line 296 of file Observable2D.h.

std::string Observable2D::filepath
private

The path to the file being parsed.

Definition at line 303 of file Observable2D.h.

TH2D* Observable2D::inhisto2d
private

2D Histogram containing the experimental likelihood for the observable.

Definition at line 300 of file Observable2D.h.

bool Observable2D::IsEOF
private

A bolean that is true if the end of file is reached.

Definition at line 306 of file Observable2D.h.

int Observable2D::iterationNo2
private

Counts the iteration to help with caching.

Definition at line 304 of file Observable2D.h.

std::string Observable2D::label2
private

A label for the second observable.

Definition at line 292 of file Observable2D.h.

double Observable2D::max2
private

The maximum valus of the second observable.

Definition at line 294 of file Observable2D.h.

double Observable2D::min2
private

The minimum value of the second observable.

Definition at line 293 of file Observable2D.h.

std::string Observable2D::obsType2
private

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

Definition at line 298 of file Observable2D.h.

std::string Observable2D::thname2
private

The name for the second oservable as fixed in the ThObservable() class.

Definition at line 291 of file Observable2D.h.

ThObservable* Observable2D::tho2
private

A pointer to an object of the ThObservable class.

Definition at line 299 of file Observable2D.h.

double Observable2D::thValue2
private

The theory value of the second observable.

Definition at line 305 of file Observable2D.h.


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