20 for(
const auto* su =
tool->m_selectedUncertainties; su; su = su->next())
22 auto unc = uncertainties.find(su->UID);
23 if(unc != uncertainties.end())
25 val += su->sigma * ((su->sigma>=0)? unc->second.up : unc->second.down);
31 FinalState::FinalState(
size_t h,
const unsigned nparticles,
const std::string& strSelection,
const std::string& strProc, std::string&
error) : m_hash(
h)
40 strProc.erase(std::remove_if(strProc.begin(), strProc.end(),
41 [](
char c){ return std::isspace(c); }), strProc.end());
42 std::stringstream
ss(strProc);
44 std::regex rx0(
"([<>]=?)([0-9])([FR])(?:\\[(L|!?T)\\])?");
50 while(std::getline(
ss,token,
','))
54 if(std::regex_match(token, sm, rx0))
56 bool strict = (sm[1].str()[1] !=
'=');
57 if(sm[1].
str()[0]==
'>') nmin = sm[2].
str()[0] -
'0' +
strict*1;
60 nmax = sm[2].str()[0] -
'0';
63 error =
"number of leptons constrained to be negative in the 'process' argument: \"" + strProc +
"\"";
68 else if(std::regex_match(token, sm,
rx1))
70 nmin = sm[1].str()[0] -
'0';
76 error =
"unable to understand the specified 'process' argument: \"" + strProc +
"\"";
81 unsigned char offset = ((sm[3]==
"F")? 15 : 0);
82 if(sm[4] ==
"!T")
offset += 5;
83 else if(sm[4] ==
"L")
offset += 10;
91 error =
"unexpected error (nmin>nmax) while parsing the specified 'process' argument: \"" + strProc +
"\"";
97 error =
"the 'process' argument is empty";
108 const unsigned nc = (1 << nparticles);
110 strSelection.erase(std::remove_if(strSelection.begin(), strSelection.end(),
111 [](
char c){ return std::isspace(c); }), strSelection.end());
112 std::stringstream
ss(strSelection);
116 if(std::regex_match(strSelection,
std::regex(word)))
118 while(std::getline(
ss, word,
'+'))
120 if(!word.length())
continue;
122 while((
pos=word.find(
"!T")) != std::string::npos) word.replace(
pos, 2, 1,
'A');
136 uint8_t maxT=15, maxL=15, minT=0, minL=0;
137 while(std::getline(
ss, word,
','))
140 if(std::regex_match(word, sm, rx0))
142 uint8_t o = (sm[1].length()<=1)? 1 : 0;
143 if(sm[1].
str()[0]==
'>') nmin = sm[2].
str()[0] -
'0' + o;
146 nmax = sm[2].str()[0] -
'0';
149 error =
"number of leptons constrained to be negative in the 'selection' argument: \"" + strSelection +
"\"";
156 else if(std::regex_match(word, sm,
rx1))
158 nmin = sm[1].str()[0] -
'0';
162 else if(std::regex_match(word, sm, rx2))
166 error =
"both OS and SS requirements were specifed in the 'selection' argument: \"" + strSelection +
"\"; this is not allowed";
176 error =
"unable to understand the specified 'selection' argument: \"" + strSelection +
"\"";
182 error =
"unexpected error (nmin>nmax) while parsing the specified 'selection' argument: \"" + strSelection +
"\"";
186 bool count_loose = sm[sm.size()-1] ==
"!T";
197 for(
unsigned i=0;
i<
nc;++
i)
200 if(count_loose)
n = nparticles -
n;
207 error =
"the 'selection' argument is empty";
220 error =
"the specified 'selection' and 'process' arguments are not consistent";