HiggsObservable Class Reference

A class for Higgs experimental analyses. More...

#include <HiggsObservable.h>

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

Detailed Description

A class for Higgs experimental analyses.

Author
HEPfit Collaboration

The class for building observables encoding Higgs experimental analyses, storing the parameters read from a file specified in the SomeModel.conf file or by the user. The names (thnames) of the observables have to correspond to the allowed names of observables listed in the ThFactory class.

Definition at line 26 of file HiggsObservable.h.

Public Member Functions

virtual double computeWeight ()
 A method to compute the weight associated with the observable. More...
 
int getNChannels ()
 
int getNTheoryValues ()
 
void getTheoryValues (std::vector< double > &theoryValues_i)
 
 HiggsObservable (const Observable &Obs)
 
 HiggsObservable (const HiggsObservable &orig)
 
bool isNew ()
 A method to get the observable to the new parametric form. More...
 
boost::tokenizer< boost::char_separator< char > >::iterator & ParseHiggsObservable (boost::tokenizer< boost::char_separator< char > >::iterator &beg, ThObsFactory &myObsFactory, StandardModel *myModel, int rank)
 the parser for HiggsObservables More...
 
void setIsnew (bool isnew)
 A method to set the observable to the new parametric form. More...
 
virtual void setParametricLikelihood (std::string filename, std::vector< ThObservable * > thObsV)
 Set the parametric likelihood describing one Higgs decay channel from a config file. 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...
 
virtual double computeWeight (double th1, double th2)
 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...
 
std::string getObsType () const
 A get method to get the Observable type. More...
 
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...
 
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...
 
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

TMatrixD channels
 A matrix holding the information of all the channels. More...
 
double channelsize
 
bool isnew
 A boolean which is true if the parametrization is new. More...
 
std::vector< double > theoryValues
 
std::vector< ThObservable * > thObsV
 A vector of ThObservables. More...
 
double thobsvsize
 

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

HiggsObservable::HiggsObservable ( const Observable Obs)
inline

Definition at line 28 of file HiggsObservable.h.

28  :
29  Observable(Obs)
30  {
31  isnew = true;
32  };
Observable()
The default constructor.
Definition: Observable.cpp:64
bool isnew
A boolean which is true if the parametrization is new.
HiggsObservable::HiggsObservable ( const HiggsObservable orig)

Member Function Documentation

double HiggsObservable::computeWeight ( )
virtual

A method to compute the weight associated with the observable.

Reimplemented from Observable.

Definition at line 77 of file HiggsObservable.cpp.

78 {
79  double logprob = 0;
80 
81  if (isnew) {
82  for (int i = 0; i < channels.GetNrows(); i++) {
83  double mu = 0;
84  for (unsigned int j = 0; j < thobsvsize; j++) {
85  theoryValues.at(j) = thObsV.at(j)->computeThValue();
86  mu += channels(i, j) * theoryValues.at(j);
87  }
88  theoryValues.at(thobsvsize) = tho->computeThValue();
89  theoryValues.at(thobsvsize + i + 1) = mu * theoryValues.at(thobsvsize);
90  logprob += LogSplitGaussian(theoryValues.at(thobsvsize + i), channels(i, thobsvsize), channels(i, thobsvsize + 1), channels(i, thobsvsize + 2));
91  }
92 
93  } else {
94  for (int i = 0; i < channels.GetNrows(); i++) {
95  double mu = 0, sum = 0.;
96  for (unsigned int j = 0; j < thobsvsize - 1; j++) {
97  theoryValues.at(j) = thObsV.at(j)->computeThValue();
98  mu += channels(i, j) * theoryValues.at(j);
99  sum += channels(i, j);
100  }
101  mu += (1. - sum) * thObsV.at(thobsvsize - 1)->computeThValue();
102  theoryValues.at(thobsvsize) = tho->computeThValue();
103  theoryValues.at(thobsvsize + i + 1) = mu * theoryValues.at(thobsvsize);
104  logprob += LogSplitGaussian(theoryValues.at(thobsvsize + i), channels(i, 3), channels(i, 4), channels(i, 5));
105  }
106  }
107 
108  return (logprob);
109 }
virtual double computeThValue()=0
A member to be overloaded by the respective theory observable. class that calculates the value of the...
TMatrixD channels
A matrix holding the information of all the channels.
std::vector< double > theoryValues
double LogSplitGaussian(double x, double ave, double errl, double errr)
Definition: Observable.cpp:126
ThObservable * tho
A pointer of to the object of the ThObservables class.
Definition: Observable.h:439
std::vector< ThObservable * > thObsV
A vector of ThObservables.
bool isnew
A boolean which is true if the parametrization is new.
int HiggsObservable::getNChannels ( )
inlinevirtual

Reimplemented from Observable.

Definition at line 81 of file HiggsObservable.h.

82  {
83  return channelsize;
84  }
int HiggsObservable::getNTheoryValues ( )
inlinevirtual

Reimplemented from Observable.

Definition at line 76 of file HiggsObservable.h.

77  {
78  return thobsvsize;
79  }
void HiggsObservable::getTheoryValues ( std::vector< double > &  theoryValues_i)
inlinevirtual

Reimplemented from Observable.

Definition at line 71 of file HiggsObservable.h.

72  {
73  theoryValues_i = theoryValues;
74  }
std::vector< double > theoryValues
bool HiggsObservable::isNew ( )
inlinevirtual

A method to get the observable to the new parametric form.

Returns
a boolean which is true if the observable is in the new parametric form

Reimplemented from Observable.

Definition at line 66 of file HiggsObservable.h.

67  {
68  return isnew;
69  }
bool isnew
A boolean which is true if the parametrization is new.
boost::tokenizer< boost::char_separator< char > >::iterator & HiggsObservable::ParseHiggsObservable ( boost::tokenizer< boost::char_separator< char > >::iterator &  beg,
ThObsFactory myObsFactory,
StandardModel myModel,
int  rank 
)

the parser for HiggsObservables

Parameters
[in]begthe iterator that parses a line in the config file
[in]myObsFactorya reference to the Observables Factory
[in]myModela pointer to the model
[in]rankthe rank of the process that is using the parser
Returns
the iterator for the line being parsed

Definition at line 112 of file HiggsObservable.cpp.

116 {
117  std::string type = "HiggsObservable";
118  setObsType(type);
119  std::vector<ThObservable*> hthobs;
120  ++beg;
121  distr = *beg;
122  if (distr.compare("parametric") == 0) {
123  setIsnew(false);
124  ++beg;
125  distr = *beg;
126  if (distr.compare("LHC7") == 0) {
127  hthobs.push_back(myObsFactory.CreateThMethod("ggH7", *myModel));
128  hthobs.push_back(myObsFactory.CreateThMethod("VBF7", *myModel));
129  hthobs.push_back(myObsFactory.CreateThMethod("VH7", *myModel));
130  hthobs.push_back(myObsFactory.CreateThMethod("ttH7", *myModel));
131  } else if (distr.compare("LHC8") == 0) {
132  hthobs.push_back(myObsFactory.CreateThMethod("ggH8", *myModel));
133  hthobs.push_back(myObsFactory.CreateThMethod("VBF8", *myModel));
134  hthobs.push_back(myObsFactory.CreateThMethod("VH8", *myModel));
135  hthobs.push_back(myObsFactory.CreateThMethod("ttH8", *myModel));
136  } else if (distr.compare("TeV196") == 0) {
137  hthobs.push_back(myObsFactory.CreateThMethod("ggH196", *myModel));
138  hthobs.push_back(myObsFactory.CreateThMethod("VBF196", *myModel));
139  hthobs.push_back(myObsFactory.CreateThMethod("VH196", *myModel));
140  hthobs.push_back(myObsFactory.CreateThMethod("ttH196", *myModel));
141  } else if (rank == 0)
142  throw std::runtime_error("ERROR: wrong keyword " + distr + " in " + getName());
143  setParametricLikelihood(*(++beg), hthobs);
144  } else if (distr.compare("new_parametric") == 0) {
145  std::string filename_h = *(++beg);
146  std::ifstream ifile(filename_h.c_str());
147  if (!ifile.is_open()) {
148  if (rank == 0) throw std::runtime_error("\nERROR: " + filename_h + " does not exist. Make sure to specify a valid Higgs parameters configuration file.\n");
149  else sleep (2);
150  }
151  std::string line_h;
152  bool IsEOF_h;
153  do {
154  IsEOF_h = getline(ifile, line_h).eof();
155  if (line_h.compare(0, 10, "CATEGORIES") == 0) {
156  boost::char_separator<char> sep(" \t");
157  boost::tokenizer<boost::char_separator<char> > mytok(line_h, sep);
158  boost::tokenizer<boost::char_separator<char> >::iterator beg2 = mytok.begin();
159  beg2++;
160  while (beg2 != mytok.end()) {
161  std::string cat = *beg2;
162  hthobs.push_back(myObsFactory.CreateThMethod(cat, *myModel));
163  beg2++;
164  }
165  }
166  } while (!IsEOF_h);
167  if (hthobs.size() > 0)
168  setParametricLikelihood(filename_h, hthobs);
169  else {
170  if (rank == 0) throw std::runtime_error("\nERROR: " + getName() + " does not provide at least one category\n");
171  else sleep(2);
172  }
173  } else {
174  if (rank == 0) throw std::runtime_error("ERROR: wrong distribution flag " + distr + " in " + getName());
175  else sleep(2);
176  }
177 
178  return beg;
179 }
void setIsnew(bool isnew)
A method to set the observable to the new parametric form.
ThObservable * CreateThMethod(const std::string &name, const StandardModel &model) const
This method checks for the existence of an observable of a specific name in the map thobs and returns...
std::string getName() const
A get method to access the name of the observable.
Definition: Observable.h:304
virtual void setParametricLikelihood(std::string filename, std::vector< ThObservable * > thObsV)
Set the parametric likelihood describing one Higgs decay channel from a config file.
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
void HiggsObservable::setIsnew ( bool  isnew)
inline

A method to set the observable to the new parametric form.

Definition at line 57 of file HiggsObservable.h.

58  {
59  this->isnew = isnew;
60  }
bool isnew
A boolean which is true if the parametrization is new.
void HiggsObservable::setParametricLikelihood ( std::string  filename,
std::vector< ThObservable * >  thObsV 
)
virtual

Set the parametric likelihood describing one Higgs decay channel from a config file.

Parameters
filenamethe name of the config file
thObsVa vector of ThObservables containing the ratio of the production cross section for the specified categories in the model analyzed over the SM prediction

Reimplemented from Observable.

Definition at line 22 of file HiggsObservable.cpp.

23 {
24  this->filename = filename;
25  this->thObsV = thObsV;
26  std::ifstream ifile(filename.c_str());
27  if (!ifile.is_open())
28  throw std::runtime_error("\nERROR: " + filename + " does not exist. Make sure to specify a valid Higgs parameters configuration file.\n");
29  std::string line;
30  bool IsEOF;
31  int i = 0, nrows = 0;
32  do {
33  IsEOF = getline(ifile, line).eof();
34  if (line.compare(0, 11, "MEASUREMENT") == 0) nrows++;
35  } while (!IsEOF);
36  if (nrows == 0) {
37  std::stringstream ss;
38  ss << "\nERROR: " << filename << " should contain at least 1 measurement.\n";
39  throw std::runtime_error(ss.str());
40  }
41  int implicit_tth = (isnew ? 0 : -1);
42  channels.ResizeTo(nrows, thObsV.size() + 3 + implicit_tth);
43  ifile.clear();
44  ifile.seekg(0, ifile.beg);
45  do {
46  IsEOF = getline(ifile, line).eof();
47  if (*line.rbegin() == '\r') line.erase(line.length() - 1); // for CR+LF
48  if (line.compare(0, 11, "MEASUREMENT") != 0)
49  continue;
50  boost::char_separator<char> sep(" |");
51  boost::tokenizer<boost::char_separator<char> > tok(line, sep);
52  boost::tokenizer<boost::char_separator<char> >::iterator beg = tok.begin();
53  // Read the necessary information from the config file. Each row contains:
54  // ggH fraction
55  // VBF fraction
56  // VH fraction (ttH is computed as 1-ggH-VBF-VH)
57  // average value of mu
58  // left-side error
59  // right-side error
60  beg++; // skip label
61  for (int j = 0; j < channels.GetNcols(); j++)
62  channels(i, j) = atof((*(++beg)).c_str());
63  i++;
64 
65  } while (!IsEOF);
66  if (i != nrows) {
67  std::stringstream ss;
68  ss << "\nERROR: " << filename << " should contain " << nrows << " measurements, but I have read " << i << " ones instead.\n";
69  throw std::runtime_error(ss.str());
70  }
71 
72  thobsvsize = thObsV.size();
73  channelsize = channels.GetNrows();
74  theoryValues.resize(thobsvsize + 1 + channelsize);
75 }
TMatrixD channels
A matrix holding the information of all the channels.
std::vector< double > theoryValues
std::string filename
The name of the file containing the experimental likelihood for the observable.
Definition: Observable.h:444
std::vector< ThObservable * > thObsV
A vector of ThObservables.
bool isnew
A boolean which is true if the parametrization is new.

Member Data Documentation

TMatrixD HiggsObservable::channels
private

A matrix holding the information of all the channels.

Definition at line 101 of file HiggsObservable.h.

double HiggsObservable::channelsize
private

Definition at line 106 of file HiggsObservable.h.

bool HiggsObservable::isnew
private

A boolean which is true if the parametrization is new.

Definition at line 102 of file HiggsObservable.h.

std::vector<double> HiggsObservable::theoryValues
private

Definition at line 104 of file HiggsObservable.h.

std::vector<ThObservable*> HiggsObservable::thObsV
private

A vector of ThObservables.

Definition at line 103 of file HiggsObservable.h.

double HiggsObservable::thobsvsize
private

Definition at line 105 of file HiggsObservable.h.


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