9 #include <boost/algorithm/string/classification.hpp> 10 #include <boost/algorithm/string/split.hpp> 11 #include <boost/algorithm/string/trim.hpp> 18 struct AlpgenParTokens {
20 std::vector<double>
values;
21 std::vector<std::string> comments;
29 if (
pos == std::string::npos)
33 boost::split(comments,
tmp, boost::algorithm::is_space(), boost::token_compress_on);
37 unsigned int i = 0,
n = comments.size();
39 std::istringstream
ss(comments[
i++]);
41 if (
ss.bad() ||
ss.peek() != std::istringstream::traits_type::eof())
47 std::istringstream
ss(comments[
i++]);
50 if (
ss.bad() ||
ss.peek() != std::istringstream::traits_type::eof())
57 boost::split(comments,
tmp, boost::algorithm::is_space(), boost::token_compress_on);
63 const std::vector<std::string>::const_iterator &
end) {
64 std::vector<std::string>::const_iterator
line = begin;
68 if ((
line++)->
find(
"****") != std::string::npos)
71 AlpgenParTokens tokens;
74 if (
line ==
end || !tokens.parse(*
line++,
true) || !tokens.values.empty())
79 if (
line ==
end || !tokens.parse(*
line++,
false) || tokens.values.size() < 6)
86 while (
line !=
end &&
line->find(
"****") == std::string::npos) {
87 if (!tokens.parse(*
line++,
true) || tokens.values.size() != 1)
97 if (
line ==
end || !tokens.parse(*
line++,
false) || tokens.values.size() != 2)
100 xsec = tokens.values[0];
104 if (
line ==
end || !tokens.parse(*
line++,
true) || tokens.values.size() != 1)
108 lumi = tokens.values[0];
115 #define DEFINE_ALPGEN_PARAMETER(x) \ 116 { AlpgenHeader::x, #x } 119 struct AlpgenParameterName {
126 const alpgenParameterNames[] = {
144 static const unsigned int size =
sizeof alpgenParameterNames /
sizeof alpgenParameterNames[0];
146 const AlpgenParameterName *
pos =
std::find(alpgenParameterNames, alpgenParameterNames +
size,
index);
148 if (
pos != alpgenParameterNames +
size)
151 std::ostringstream
ss;
vector< string > parse(string line, const string &delimiter)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
def split(sequence, size)