5 #include "cetlib/container_algorithms.h" 16 bpo::options_description& desc)
18 bpo::options_description source_options{
"Source options"};
19 auto options = source_options.add_options();
22 bpo::value<std::vector<std::string>>()->composing(),
23 "Source data file (multiple OK); precludes -S.");
26 bpo::value<std::string>(),
27 "file containing a list of source files to read, one per line; " 31 bpo::value<unsigned long>(),
32 "Event # of first event to process.");
34 options,
"nevts,n", bpo::value<int>(),
"Number of events to process.");
36 options,
"nskip", bpo::value<unsigned long>(),
"Number of events to skip.");
37 desc.add(source_options);
48 bpo::variables_map
const& vm,
51 std::vector<std::string> source_list;
52 if (vm.count(
"source")) {
53 cet::copy_all(vm[
"source"].as<std::vector<std::string>>(),
54 std::back_inserter(source_list));
58 if (source_list.size() > 0 || have_source_list_file) {
60 raw_config.
put(
"source.fileNames", source_list);
62 if (vm.count(
"nevts")) {
63 raw_config.
put(
"source.maxEvents", vm[
"nevts"].as<int>());
65 if (vm.count(
"estart")) {
66 raw_config.
put(
"source.firstEvent", vm[
"estart"].as<unsigned long>());
68 if (vm.count(
"nskip")) {
69 raw_config.
put(
"source.skipEvents", vm[
"nskip"].as<unsigned long>());
76 bpo::variables_map
const& vm,
77 std::vector<std::string>& source_list)
79 bool result = !!vm.count(
"source-list");
81 if (source_list.size()) {
83 <<
"--source-list (-S) and --source (-s) or non-option arguments are " 84 <<
"incompatible due to ordering ambiguities.\n";
86 std::ifstream flist(vm[
"source-list"].as<std::string>().c_str());
89 <<
"Specified source-list file \"" 90 << vm[
"source-list"].as<std::string>() <<
"\" cannot be read.\n";
void add_opt(T &t, Args &&...args)
void fillSourceList(std::istream &ifs, std::vector< std::string > &source_list)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::string value(boost::any const &)
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
bool processSourceListArg_(bpo::variables_map const &vm, std::vector< std::string > &source_list)