3 #include "boost/algorithm/string.hpp" 14 return "(" + spec +
")";
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>
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>
63 std::string const& event_spec) noexcept(
false)
try {
64 return safe_conversion<L>(field);
67 throw_configuration_exception(event_spec);
71 std::tuple<art::RunNumber_t, art::SubRunNumber_t, art::EventNumber_t>
75 auto const success = std::regex_match(event_spec, parts, re_event_id);
77 throw_configuration_exception(event_spec);
80 assert(parts.size() == 4ull);
93 auto const run = convert_or_throw<Level::Run>(parts[1], event_spec);
94 auto const subrun = convert_or_throw<Level::SubRun>(parts[2], event_spec);
95 auto const event = convert_or_throw<Level::Event>(parts[3], event_spec);
97 return std::make_tuple(run, subrun,
event);
static std::string trim(const std::string &str, const std::string &whitespace=" \t")
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.