41 [](
char c){ return std::isspace(c); }), strProc.end());
42 std::stringstream
ss(strProc);
44 std::regex rx0(
"([<>]=?)([0-9])([FR])(?:\\[(L|!?T)\\])?");
45 std::regex rx1(
"=?([0-9])(-[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';
71 if(sm[2].
length())
nmax = sm[2].str()[1] -
'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);
114 std::string word =
"(?:!?T){" + std::to_string(nparticles) +
"}(\\+(?:!?T){" + std::to_string(nparticles) +
"})*";
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');
130 std::regex rx0(
"([<>]=?)([0-9])(!?T)");
131 std::regex rx1(
"=?([0-9])(-[0-9])?(!?T)");
132 std::regex rx2(
"(OS|SS)");
134 for(
unsigned i=0;i<nc;++i)
selection.set(i);
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';
159 if(sm[2].
length())
nmax = sm[2].str()[1] -
'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";
189 minL = std::max(minL, nmin);
190 maxL = std::min(maxL,
nmax);
194 minT = std::max(minT, nmin);
195 maxT = std::min(maxT,
nmax);
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";
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.