Observable.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 HEPfit Collaboration
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
8 #ifndef OBSERVABLE_H
9 #define OBSERVABLE_H
10 
11 #include "ThObservable.h"
12 #include <string>
13 #include <iostream>
14 #include <TH1D.h>
15 #include <TMatrixD.h>
16 #include <boost/tokenizer.hpp>
17 
28 class Observable {
29 public:
40  Observable(const std::string name_i,
41  const std::string thname_i,
42  const std::string label_i,
43  const bool tMCMC_i,
44  const double min_i,
45  const double max_i,
46  ThObservable * tho_i);
47 
51  Observable(const Observable& orig);
52 
56  Observable();
57 
67  boost::tokenizer<boost::char_separator<char> >::iterator & ParseObservable(std::string& type,
68  boost::tokenizer<boost::char_separator<char> >* tok,
69  boost::tokenizer<boost::char_separator<char> >::iterator & beg,
70  std::string& filepath,
71  std::string& infilename,
72  int rank);
73 
77  virtual ~Observable();
78 
82  double computeTheoryValue();
83 
88  virtual double computeWeight(double th);
89 
97  virtual double computeWeight(double th, double ave_i, double errg_i, double errf_i);
98 
104  virtual double computeWeight(double th1, double th2)
105  {
106  return 0.0;
107  };
108 
112  virtual double computeWeight()
113  {
115  }
116 
121  double getAve() const
122  {
123  return ave;
124  }
125 
130  void setAve(double ave)
131  {
132  this->ave = ave;
133  }
134 
139  std::string getDistr() const
140  {
141  return distr;
142  }
143 
148  void setDistr(std::string distr)
149  {
150  this->distr = distr;
151  }
152 
157  double getErrf() const
158  {
159  return errf;
160  }
161 
166  void setErrf(double errf)
167  {
168  this->errf = errf;
169  }
170 
175  double getErrg() const
176  {
177  return errg;
178  }
179 
184  void setErrg(double errg)
185  {
186  this->errg = errg;
187  }
188 
193  std::string getFilename() const
194  {
195  return filename;
196  }
197 
198  void setFilename(std::string filename_i)
199  {
200  filename = filename_i;
201  }
202 
209  virtual void setLikelihoodFromHisto(std::string filename, std::string histoname);
210 
215  virtual void setParametricLikelihood(std::string filename)
216  {
217  this->filename=filename; //real implementation will be done in extension
218  }
219 
225  virtual void setParametricLikelihood(std::string filename, std::vector<ThObservable*> thObsV)
226  {};
227 
232  std::string getHistoname() const
233  {
234  return histoname;
235  }
236 
241  void setHistoname(std::string histoname_i)
242  {
243  histoname = histoname_i;
244  }
245 
250  std::string getLabel() const
251  {
252  return label;
253  }
254 
259  void setLabel(std::string label)
260  {
261  this->label = label;
262  }
263 
268  double getMax() const
269  {
270  return max;
271  }
272 
277  void setMax(double max)
278  {
279  this->max = max;
280  }
281 
286  double getMin() const
287  {
288  return min;
289  }
290 
295  void setMin(double min)
296  {
297  this->min = min;
298  }
299 
304  std::string getName() const
305  {
306  return name;
307  }
308 
313  void setName(std::string name)
314  {
315  this->name = name;
316  }
317 
322  bool isTMCMC() const
323  {
324  return tMCMC;
325  }
326 
331  void setTMCMC(bool tMCMC)
332  {
333  this->tMCMC = tMCMC;
334  }
335 
340  std::string getThname() const
341  {
342  return thname;
343  }
344 
349  void setThname(std::string thname)
350  {
351  this->thname = thname;
352  }
353 
359  {
360  return tho;
361  }
362 
367  void setObsType(std::string& obsType_s)
368  {
369  obsType = obsType_s;
370  }
371 
376  std::string getObsType() const
377  {
378  return obsType;
379  }
380 
385  void setTho(ThObservable* tho_i)
386  {
387  tho = tho_i;
390  }
391 
396  void setTho(ThObservable* tho_i, double bmin, double bmax)
397  {
398  tho = tho_i;
399  tho->setBinMin(bmin);
400  tho->setBinMax(bmax);
401  }
402 
411  double LogSplitGaussian(double x, double ave, double errl, double errr);
412 
420  double LogGaussian(double x, double ave, double sigma);
421 
422  virtual void getTheoryValues(std::vector<double>& theoryValues_i) {};
423 
424  virtual int getNTheoryValues() { return 0; };
425 
426  virtual int getNChannels() { return 0; };
427 
428  virtual bool isNew() { return false; };
429 
436  friend std::ostream& operator<<(std::ostream& output, const Observable& o);
437 
438 protected:
440  std::string name;
441  std::string thname;
442  std::string label;
443  std::string distr;
444  std::string filename;
445  std::string histoname;
446  double ave;
447  double errg;
448  double errf;
449  double min;
450  double max;
451  bool tMCMC;
452  TH1D * inhisto;
453  std::string obsType;
454  double bin_min;
455  double bin_max;
457  double thValue;
458 };
459 
460 
461 #endif /* OBSERVABLE_H */
462 
void setTho(ThObservable *tho_i, double bmin, double bmax)
A set method to fix the pointer to object of type ThObservable.
Definition: Observable.h:396
double bin_min
The minimum value of the observable bin.
Definition: Observable.h:454
void setErrf(double errf)
A set method to fix the flat error of the observable.
Definition: Observable.h:166
std::string getObsType() const
A get method to get the Observable type.
Definition: Observable.h:376
void setErrg(double errg)
A set method to fix the gaussian error of the observable.
Definition: Observable.h:184
std::string getLabel() const
A get method to access the label for the observable.
Definition: Observable.h:250
double getMin() const
A get method to access the minimum value of the observable.
Definition: Observable.h:286
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:453
virtual bool isNew()
Definition: Observable.h:428
double min
The minimum value of the observable.
Definition: Observable.h:449
virtual void setParametricLikelihood(std::string filename)
A set method to set a parametric likelihood reading parameters from a file.
Definition: Observable.h:215
double max
The maximum valus of the observable.
Definition: Observable.h:450
void setTho(ThObservable *tho_i)
A set method to fix the pointer to object of type ThObservable.
Definition: Observable.h:385
virtual double computeWeight()
A method to compute the weight associated with the observable.
Definition: Observable.h: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
std::string getDistr() const
A get method to access the name of the distribution of the observable.
Definition: Observable.h:139
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:451
std::string getHistoname() const
A get method to access the name for the histogram of the observable.
Definition: Observable.h:232
double getAve() const
A get method to access the average value of the observable.
Definition: Observable.h:121
A class for a model prediction of an observable.
Definition: ThObservable.h:22
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
bool isTMCMC() const
A method to check if the observable is listed for MCMC.
Definition: Observable.h:322
void setThname(std::string thname)
A set method to fix the name of the observable as listed in ThFactory class.
Definition: Observable.h:349
void setBinMin(double min)
A set method to set the minimum value of the bin.
Definition: ThObservable.h:61
std::string getThname() const
A get method to access the thname of the observable as defined in ThFactory class.
Definition: Observable.h:340
double errg
The gaussian error of the observable.
Definition: Observable.h:447
friend std::ostream & operator<<(std::ostream &output, const Observable &o)
Befriending of the std::ostream operator << to generate an output stream for printing the observables...
Definition: Observable.cpp:87
virtual void getTheoryValues(std::vector< double > &theoryValues_i)
Definition: Observable.h:422
virtual void setParametricLikelihood(std::string filename, std::vector< ThObservable * > thObsV)
Definition: Observable.h:225
void setAve(double ave)
A set method to fix the average value of the observable.
Definition: Observable.h:130
virtual ~Observable()
The default destructor.
Definition: Observable.cpp:85
std::string getName() const
A get method to access the name of the observable.
Definition: Observable.h:304
virtual int getNTheoryValues()
Definition: Observable.h:424
virtual double computeWeight(double th1, double th2)
A method to compute the weight associated with the observable.
Definition: Observable.h:104
A class for observables.
Definition: Observable.h:28
virtual int getNChannels()
Definition: Observable.h:426
double thValue
The theory value of the first observable.
Definition: Observable.h:457
double errf
the flat error of the observable.
Definition: Observable.h:448
void setBinMax(double max)
A set method to set the maximum value of the bin.
Definition: ThObservable.h:70
void setName(std::string name)
A set method to fix the name for the observable.
Definition: Observable.h:313
std::string getFilename() const
A get method to access the filename of the observables experimental likelihood file.
Definition: Observable.h:193
std::string label
A label for the observable.
Definition: Observable.h:442
double LogSplitGaussian(double x, double ave, double errl, double errr)
Definition: Observable.cpp:126
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
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
double LogGaussian(double x, double ave, double sigma)
Definition: Observable.cpp:132
double getErrf() const
A get method to access the flat error of the observable.
Definition: Observable.h:157
Observable()
The default constructor.
Definition: Observable.cpp:64
ThObservable * getTho() const
A get method to access the pointer to the object of the ThObservable class.
Definition: Observable.h:358
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
double getMax() const
A get method to access the maximum value of the observable.
Definition: Observable.h:268
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
void setLabel(std::string label)
A set method to fix the label for the observable.
Definition: Observable.h:259
double computeTheoryValue()
A method to access the computed theory value of the observable.
Definition: Observable.cpp:115
double getErrg() const
A get method to access the Gaussian error of the observble.
Definition: Observable.h:175
void setHistoname(std::string histoname_i)
A set method to set the name of the histogram containing the likelihood.
Definition: Observable.h:241
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
void setObsType(std::string &obsType_s)
A set method to set the Observable type.
Definition: Observable.h:367
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