All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
concat_cafs.cc File Reference
#include "sbnana/CAFAna/Core/FileReducer.h"
#include <iostream>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 8 of file concat_cafs.cc.

9 {
10  if(argc < 3){
11  std::cout << "usage: concat_cafs INFILES OUTFILE\n"
12  << " concat_cafs INFILES... OUTFILE\n"
13  << " concat_cafs 'WILDCARD' OUTFILE\n"
14  << " concat_cafs SAMDEF OUTFILE\n"
15  << "Warning: this argument order is different to hadd"
16  << std::endl;
17  exit(1);
18  }
19 
20  std::vector<std::string> infiles;
21  for(int i = 1; i < argc-1; ++i) infiles.push_back(argv[i]);
22  const std::string outfile = argv[argc-1];
23 
24  FileReducer* reducer = 0;
25  if(infiles.size() == 1){
26  // Could be an (escaped) wildcard, or SAM definition
27  reducer = new FileReducer(infiles[0], outfile);
28  }
29  else{
30  reducer = new FileReducer(infiles, outfile);
31  }
32 
33  reducer->SetMetadata("data_tier", "concat_caf");
34  reducer->SetMetadata("file_format", "concat_caf");
35 
36  reducer->Go();
37 
38  delete reducer;
39 
40  std::cout << "Created " << outfile << std::endl;
41 }
void SetMetadata(const std::string &key, const std::string &val)
Override any metadata key in the output file.
Definition: FileReducer.h:45
virtual void Go() override
Load all the registered spectra.
Definition: FileReducer.cxx:95
Create smaller CAFs.
Definition: FileReducer.h:19
BEGIN_PROLOG could also be cout