16 #include <boost/tokenizer.hpp>
26 std::ifstream ifile(filename.c_str());
28 throw std::runtime_error(
"\nERROR: " + filename +
" does not exist. Make sure to specify a valid Higgs parameters configuration file.\n");
33 IsEOF = getline(ifile, line).eof();
34 if (line.compare(0, 11,
"MEASUREMENT") == 0) nrows++;
38 ss <<
"\nERROR: " << filename <<
" should contain at least 1 measurement.\n";
39 throw std::runtime_error(ss.str());
41 int implicit_tth = (
isnew ? 0 : -1);
42 channels.ResizeTo(nrows, thObsV.size() + 3 + implicit_tth);
44 ifile.seekg(0, ifile.beg);
46 IsEOF = getline(ifile, line).eof();
47 if (*line.rbegin() ==
'\r') line.erase(line.length() - 1);
48 if (line.compare(0, 11,
"MEASUREMENT") != 0)
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();
61 for (
int j = 0; j <
channels.GetNcols(); j++)
62 channels(i, j) = atof((*(++beg)).c_str());
68 ss <<
"\nERROR: " << filename <<
" should contain " << nrows <<
" measurements, but I have read " << i <<
" ones instead.\n";
69 throw std::runtime_error(ss.str());
82 for (
int i = 0; i <
channels.GetNrows(); i++) {
84 for (
unsigned int j = 0; j <
thobsvsize; j++) {
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++) {
101 mu += (1. - sum) *
thObsV.at(thobsvsize - 1)->computeThValue();
117 std::string type =
"HiggsObservable";
119 std::vector<ThObservable*> hthobs;
122 if (
distr.compare(
"parametric") == 0) {
126 if (
distr.compare(
"LHC7") == 0) {
131 }
else if (
distr.compare(
"LHC8") == 0) {
136 }
else if (
distr.compare(
"TeV196") == 0) {
137 hthobs.push_back(myObsFactory.
CreateThMethod(
"ggH196", *myModel));
138 hthobs.push_back(myObsFactory.
CreateThMethod(
"VBF196", *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());
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");
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();
160 while (beg2 != mytok.end()) {
161 std::string cat = *beg2;
167 if (hthobs.size() > 0)
170 if (rank == 0)
throw std::runtime_error(
"\nERROR: " +
getName() +
" does not provide at least one category\n");
174 if (rank == 0)
throw std::runtime_error(
"ERROR: wrong distribution flag " +
distr +
" in " +
getName());
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
void setIsnew(bool isnew)
A method to set the observable to the new parametric form.
A model class for the Standard Model.
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.
double LogSplitGaussian(double x, double ave, double errl, double errr)
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
std::string filename
The name of the file containing the experimental likelihood for the observable.
ThObservable * tho
A pointer of to the object of the ThObservables class.
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.
virtual double computeWeight()
A method to compute the weight associated with the observable.
std::vector< ThObservable * > thObsV
A vector of ThObservables.
void setObsType(std::string &obsType_s)
A set method to set the Observable type.
bool isnew
A boolean which is true if the parametrization is new.