6 #include "cetlib/container_algorithms.h" 13 bpo::options_description& desc)
15 bpo::options_description source_options{
"Source options"};
17 source_options.add_options()
19 bpo::value<std::vector<std::string>>()->composing(),
20 "Source data file (multiple OK); precludes -S.")
22 bpo::value<std::string>(),
23 "file containing a list of source files to read, one per line; " 26 bpo::value<std::string>(),
27 "EventID of first event to process (e.g. '1:2:4' starts event " 28 "processing at run 1, subrun2, event 4).")
29 (
"nevts,n", bpo::value<int>(),
"Number of events to process.")
30 (
"nskip", bpo::value<unsigned long>(),
"Number of events to skip.");
32 desc.add(source_options);
43 bpo::variables_map
const& vm,
46 std::vector<std::string> source_list;
47 if (vm.count(
"source")) {
48 source_list = vm[
"source"].as<std::vector<std::string>>();
52 if (source_list.size() > 0 || have_source_list_file) {
54 raw_config.
put(
"source.fileNames", source_list);
56 if (vm.count(
"nevts")) {
57 raw_config.
put(
"source.maxEvents", vm[
"nevts"].as<int>());
59 if (vm.count(
"estart")) {
60 auto const [run, subRun,
event] =
62 raw_config.
put(
"source.firstRun", run);
63 raw_config.
put(
"source.firstSubRun", subRun);
64 raw_config.
put(
"source.firstEvent",
event);
66 if (vm.count(
"nskip")) {
67 raw_config.
put(
"source.skipEvents", vm[
"nskip"].as<unsigned long>());
74 bpo::variables_map
const& vm,
75 std::vector<std::string>& source_list)
77 bool result = !!vm.count(
"source-list");
79 if (!source_list.empty()) {
81 <<
"--source-list (-S) and --source (-s) or non-option arguments are " 82 <<
"incompatible due to ordering ambiguities.\n";
84 auto const filename = vm[
"source-list"].as<std::string>();
85 std::ifstream flist{filename};
88 <<
"Specified source-list file \"" << filename
89 <<
"\" cannot be read.\n";
void fillSourceList(std::istream &ifs, std::vector< std::string > &source_list)
std::tuple< RunNumber_t, SubRunNumber_t, EventNumber_t > event_start(std::string const &str_num)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
BasicSourceOptionsHandler(bpo::options_description &desc)
int doProcessOptions(bpo::variables_map const &vm, fhicl::intermediate_table &raw_config) override
int doCheckOptions(bpo::variables_map const &vm) override
Event finding and building.
bool processSourceListArg_(bpo::variables_map const &vm, std::vector< std::string > &source_list)