12 int main(
int argc,
char* argv[]) {
14 char *post_processor = NULL;
15 char *config_name = NULL;
16 std::string output_fname =
"";
19 unsigned procindex = 0;
20 unsigned n_workers = 1;
21 while ((c=getopt(argc, argv,
"m:c:o:w:")) != -1) {
24 n_workers = std::stoi(std::string(optarg));
27 if (post_processor != NULL) {
28 fprintf(stderr,
"Only specify one post-processor.\n");
31 post_processor = optarg;
34 if (config_name != NULL) {
35 fprintf(stderr,
"Only specify one post-processor configuration.\n");
41 output_fname = optarg;
44 if (optopt ==
'c' || optopt ==
'm' || optopt ==
'o')
45 fprintf(stderr,
"Option -%c requires an argument.\n", optopt);
46 else if (isprint(optopt))
47 fprintf(stderr,
"Unknown option `-%c'.\n", optopt);
49 fprintf(stderr,
"Unknown option character `\\x%x'.\n", optopt);
56 if (argc - optind < 1) {
57 std::cout <<
"Usage: " << argv[0] <<
" -m POSTPROCESSOR [-c CONFIG] "
58 <<
"INPUTDEF [...]" << std::endl;
63 std::string filedef = argv[optind];
64 std::string list_suffix =
".list";
65 std::vector<std::string> filenames;
67 if (
std::equal(list_suffix.rbegin(), list_suffix.rend(), filedef.rbegin())) {
69 std::ifstream infile(filedef);
71 while (infile >> filename) {
72 filenames.push_back(filename);
77 for (
int i=optind; i<argc; i++) {
78 filenames.push_back(argv[i]);
82 assert(!filenames.empty());
83 assert(post_processor != NULL);
87 ROOT::EnableThreadSafety();
91 std::cout <<
"Configuring... " << std::endl;
94 proc->
Initialize(config_name, output_fname, n_workers);
PostProcessorBase *(* create)(void)
BEGIN_PROLOG could also be dds filename
void Initialize(char *config=NULL, const std::string &output_fname="", unsigned n_workers=1)
export_table_postprocess * LoadPostProcessor(char *libname)
void Run(std::vector< std::string > filelist)
bool equal(double a, double b)
Comparison tolerance, in centimeters.
int main(int argc, char **argv)
A generic tree-reading event-by-event processor.
Struct containing (macro defined) creation/deletion operations.
BEGIN_PROLOG could also be cout