3 #include "boost/algorithm/string.hpp" 12 group(std::string
const& spec)
14 return "(" + spec +
")";
17 std::string
const number{R
"(\s*\d+\s*)"}; 18 std::regex const re_event_id{group(number) +
":" + group(number) +
":" +
20 std::string
const context{
"An error was encountered while processing the " 21 "-e|--estart program option.\n"};
23 template <art::Level L>
25 safe_conversion(std::string str_num)
28 auto const num = std::stoull(str_num);
39 template <art::Level L>
43 std::stringstream oss;
44 oss << '[' << art::IDNumber<L>::first() <<
", " 50 throw_configuration_exception(std::string
const& spec) noexcept(
false)
53 <<
"The specification '" << spec <<
"' is not a valid EventID.\n" 54 <<
"Please specify a value of the form '<run>:<subrun>:<event>' where:\n" 55 <<
" <run> is in the range " << range<art::Level::Run>() <<
'\n' 56 <<
" <subrun> is in the range " << range<art::Level::SubRun>() <<
'\n' 57 <<
" <event> is in the range " << range<art::Level::Event>() <<
'\n';
60 template <art::Level L>
62 convert_or_throw(std::string
const& field,
63 std::string
const& event_spec) noexcept(
false)
65 return safe_conversion<L>(field);
68 throw_configuration_exception(event_spec);
72 std::tuple<art::RunNumber_t, art::SubRunNumber_t, art::EventNumber_t>
76 auto const success = std::regex_match(event_spec, parts, re_event_id);
78 throw_configuration_exception(event_spec);
81 assert(parts.size() == 4ull);
94 auto const run = convert_or_throw<Level::Run>(parts[1], event_spec);
95 auto const subrun = convert_or_throw<Level::SubRun>(parts[2], event_spec);
96 auto const event = convert_or_throw<Level::Event>(parts[3], event_spec);
98 return std::make_tuple(run, subrun,
event);
std::tuple< RunNumber_t, SubRunNumber_t, EventNumber_t > event_start(std::string const &str_num)
typename IDNumber< L >::type IDNumber_t
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Event finding and building.