a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
Observable.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 HEPfit Collaboration
3 *
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 <boost/tokenizer.hpp>
15
16class TH1D;
17
29public:
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
68 boost::tokenizer<boost::char_separator<char> >::iterator & ParseObservable(std::string& type,
69 boost::tokenizer<boost::char_separator<char> >* tok,
70 boost::tokenizer<boost::char_separator<char> >::iterator & beg,
71 std::string& filepath,
72 std::string& infilename,
73 int rank);
74
78 virtual ~Observable();
79
83 double computeTheoryValue();
84
89 virtual double computeWeight(double th);
90
98 virtual double computeWeight(double th, double ave_i, double errg_i, double errf_i);
99
105 virtual double computeWeight(double th1, double th2)
106 {
107 return 0.0;
108 };
109
113 virtual double computeWeight()
114 {
116 }
117
122 double getAve() const
123 {
124 return ave;
125 }
126
131 void setAve(double ave)
132 {
133 this->ave = ave;
134 }
135
140 std::string getDistr() const
141 {
142 return distr;
143 }
144
149 void setDistr(std::string distr)
150 {
151 this->distr = distr;
152 }
153
158 double getErrf() const
159 {
160 return errf;
161 }
162
167 void setErrf(double errf)
168 {
169 this->errf = errf;
170 }
171
176 double getErrg() const
177 {
178 return errg;
179 }
180
185 void setErrg(double errg)
186 {
187 this->errg = errg;
188 }
189
194 void setErrgl(double errgl)
195 {
196 this->errgl = errgl;
197 }
198
203 void setErrgr(double errgr)
204 {
205 this->errgr = errgr;
206 }
207
212 std::string getFilename() const
213 {
214 return filename;
215 }
216
217 void setFilename(std::string filename_i)
218 {
219 filename = filename_i;
220 }
221
228 virtual void setLikelihoodFromHisto(std::string filename, std::string histoname);
229
234 virtual void setParametricLikelihood(std::string filename)
235 {
236 this->filename=filename; //real implementation will be done in extension
237 }
238
244 virtual void setParametricLikelihood(std::string filename, std::vector<ThObservable*> thObsV)
245 {};
246
251 std::string getHistoname() const
252 {
253 return histoname;
254 }
255
260 void setHistoname(std::string histoname_i)
261 {
262 histoname = histoname_i;
263 }
264
269 std::string getLabel() const
270 {
271 return label;
272 }
273
278 void setLabel(std::string label)
279 {
280 this->label = label;
281 }
282
287 double getMax() const
288 {
289 return max;
290 }
291
296 void setMax(double max)
297 {
298 this->max = max;
299 }
300
305 double getMin() const
306 {
307 return min;
308 }
309
314 void setMin(double min)
315 {
316 this->min = min;
317 }
318
323 std::string getName() const
324 {
325 return name;
326 }
327
332 void setName(std::string name)
333 {
334 this->name = name;
335 }
336
341 bool isTMCMC() const
342 {
343 return tMCMC;
344 }
345
350 bool isWriteChain() const
351 {
352 return writeChain;
353 }
354
359 void setTMCMC(bool tMCMC)
360 {
361 this->tMCMC = tMCMC;
362 }
363
368 std::string getThname() const
369 {
370 return thname;
371 }
372
377 void setThname(std::string thname)
378 {
379 this->thname = thname;
380 }
381
387 {
388 return tho;
389 }
390
395 void setObsType(std::string& obsType_s)
396 {
397 obsType = obsType_s;
398 }
399
404 std::string getObsType() const
405 {
406 return obsType;
407 }
408
413 void setTho(ThObservable* tho_i)
414 {
415 tho = tho_i;
418 }
419
426 void setTho(ThObservable* tho_i, double bmin, double bmax)
427 {
428 tho = tho_i;
429 tho->setBinMin(bmin);
430 tho->setBinMax(bmax);
431 }
432
441 double LogSplitGaussian(double x, double ave, double errl, double errr);
442
450 double LogGaussian(double x, double ave, double sigma);
451
452 virtual void getTheoryValues(std::vector<double>& theoryValues_i) {};
453
454 virtual int getNTheoryValues() { return 0; };
455
456 virtual int getNChannels() { return 0; };
457
458 virtual bool isNew() { return false; };
459
465 {
466 this->hasInverseCovariance = hasInverseCovariance;
467 }
468
475 friend std::ostream& operator<<(std::ostream& output, const Observable& o);
476
477protected:
479 std::string name;
480 std::string thname;
481 std::string label;
482 std::string distr;
483 std::string filename;
484 std::string histoname;
485 double ave;
486 double errg;
487 double errf;
488 double errgl;
489 double errgr;
490 double min;
491 double max;
492 bool tMCMC;
494 TH1D * inhisto;
495 std::string obsType;
496 double bin_min;
497 double bin_max;
499 double thValue;
501};
502
503
504#endif /* OBSERVABLE_H */
505
A class for observables.
Definition: Observable.h:28
ThObservable * getTho() const
A get method to access the pointer to the object of the ThObservable class.
Definition: Observable.h:386
bool tMCMC
The flag to include or exclude the observable from the MCMC run.
Definition: Observable.h:492
int iterationNo
A counter for the interation that helps with the observable caching.
Definition: Observable.h:498
std::string thname
The name for the observable as fixed in the ThObservable class.
Definition: Observable.h:480
bool isTMCMC() const
A method to check if the observable is listed for MCMC.
Definition: Observable.h:341
void setErrgl(double errgl)
A set method to fix the left Gaussian error of the observable.
Definition: Observable.h:194
double getMin() const
A get method to access the minimum value of the observable.
Definition: Observable.h:305
std::string distr
The name of the distribution of the the observable.
Definition: Observable.h:482
virtual int getNTheoryValues()
Definition: Observable.h:454
bool isWriteChain() const
A method to check if the observable is listed for writing chains.
Definition: Observable.h:350
double LogGaussian(double x, double ave, double sigma)
Definition: Observable.cpp:147
double getMax() const
A get method to access the maximum value of the observable.
Definition: Observable.h:287
void setErrgr(double errgr)
A set method to fix the right Gaussian error of the observable.
Definition: Observable.h:203
std::string getObsType() const
A get method to get the Observable type.
Definition: Observable.h:404
void setHasInverseCovariance(bool hasInverseCovariance)
A set method to state that the Observable is a part of ObservablesWithInverseCovariance.
Definition: Observable.h:464
TH1D * inhisto
1D Histogram containing the experimental likelihood for the observable
Definition: Observable.h:494
std::string getHistoname() const
A get method to access the name for the histogram of the observable.
Definition: Observable.h:251
double errf
The flat error of the observable.
Definition: Observable.h:487
void setName(std::string name)
A set method to fix the name for the observable.
Definition: Observable.h:332
void setFilename(std::string filename_i)
Definition: Observable.h:217
void setAve(double ave)
A set method to fix the average value of the observable.
Definition: Observable.h:131
void setTho(ThObservable *tho_i, double bmin, double bmax)
A set method to fix the pointer to object of type ThObservable.
Definition: Observable.h:426
double max
The maximum valus of the observable.
Definition: Observable.h:491
std::string obsType
Type of the Observable. 0: Observable, 1: HiggsObservable, 2: BinnedObservable, 3: FunctionObservable...
Definition: Observable.h:495
virtual void setParametricLikelihood(std::string filename, std::vector< ThObservable * > thObsV)
Definition: Observable.h:244
bool writeChain
The flag to write the chain for the observable from the MCMC run.
Definition: Observable.h:493
double ave
The average value of the observable.
Definition: Observable.h:485
double bin_min
The minimum value of the observable bin.
Definition: Observable.h:496
virtual double computeWeight()
A method to compute the weight associated with the observable.
Definition: Observable.h:113
double getErrg() const
A get method to access the Gaussian error of the observble.
Definition: Observable.h:176
double getErrf() const
A get method to access the flat error of the observable.
Definition: Observable.h:158
bool hasInverseCovariance
Definition: Observable.h:500
std::string label
A label for the observable.
Definition: Observable.h:481
double min
The minimum value of the observable.
Definition: Observable.h:490
virtual ~Observable()
The default destructor.
Definition: Observable.cpp:100
std::string getFilename() const
A get method to access the filename of the observables experimental likelihood file.
Definition: Observable.h:212
void setTho(ThObservable *tho_i)
A set method to fix the pointer to object of type ThObservable.
Definition: Observable.h:413
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:102
void setTMCMC(bool tMCMC)
A set method to fix the observable's inclusion in the MCMC listing.
Definition: Observable.h:359
double thValue
The theory value of the first observable.
Definition: Observable.h:499
std::string getThname() const
A get method to access the thname of the observable as defined in ThFactory class.
Definition: Observable.h:368
void setMax(double max)
A set method to fix the maximum value for the observable.
Definition: Observable.h:296
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:202
double LogSplitGaussian(double x, double ave, double errl, double errr)
Definition: Observable.cpp:141
void setThname(std::string thname)
A set method to fix the name of the observable as listed in ThFactory class.
Definition: Observable.h:377
double errgr
The upper gaussian error of the observable.
Definition: Observable.h:489
void setLabel(std::string label)
A set method to fix the label for the observable.
Definition: Observable.h:278
std::string getDistr() const
A get method to access the name of the distribution of the observable.
Definition: Observable.h:140
void setErrg(double errg)
A set method to fix the gaussian error of the observable.
Definition: Observable.h:185
void setDistr(std::string distr)
A set method to fix the name of the distribution of the observable.
Definition: Observable.h:149
double errg
The gaussian error of the observable.
Definition: Observable.h:486
std::string getLabel() const
A get method to access the label for the observable.
Definition: Observable.h:269
std::string histoname
The name of the histogram for the observable.
Definition: Observable.h:484
std::string getName() const
A get method to access the name of the observable.
Definition: Observable.h:323
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:483
virtual bool isNew()
Definition: Observable.h:458
void setObsType(std::string &obsType_s)
A set method to set the Observable type.
Definition: Observable.h:395
void setHistoname(std::string histoname_i)
A set method to set the name of the histogram containing the likelihood.
Definition: Observable.h:260
virtual void setParametricLikelihood(std::string filename)
A set method to set a parametric likelihood reading parameters from a file.
Definition: Observable.h:234
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:478
virtual void getTheoryValues(std::vector< double > &theoryValues_i)
Definition: Observable.h:452
double errgl
The lower gaussian error of the observable.
Definition: Observable.h:488
double getAve() const
A get method to access the average value of the observable.
Definition: Observable.h:122
std::string name
A name for the observable.
Definition: Observable.h:479
void setErrf(double errf)
A set method to fix the flat error of the observable.
Definition: Observable.h:167
double computeTheoryValue()
A method to access the computed theory value of the observable.
Definition: Observable.cpp:130
virtual int getNChannels()
Definition: Observable.h:456
virtual double computeWeight(double th1, double th2)
A method to compute the weight associated with the observable.
Definition: Observable.h:105
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:111
double bin_max
The maximum valus of the observable bin.
Definition: Observable.h:497
Observable()
The default constructor.
Definition: Observable.cpp:75
void setMin(double min)
A set method to fix the minimum value for the observable.
Definition: Observable.h:314
A class for a model prediction of an observable.
Definition: ThObservable.h:25
void setBinMax(double max)
A set method to set the maximum value of the bin.
Definition: ThObservable.h:73
void setBinMin(double min)
A set method to set the minimum value of the bin.
Definition: ThObservable.h:64