FairRoot/PandaRoot
MvdOfflineTBAnalysis_Topix4/MQ/runFileSampler.cxx
Go to the documentation of this file.
1 
3 #include <PndMvdMQFileSampler.h>
4 #include <csignal>
5 
7 #include "FairMQLogger.h"
8 #include "runSimpleMQStateMachine.h"
9 
10 
11 // 9-PixelDetector example
12 
13 // ////////////////////////////////////////////////////////////////////////
14 
15 int main(int argc, char** argv)
16 {
17  try
18  {
19  std::vector<std::string> filename;
20  std::string branchname;
21  int64_t maxindex;
22 
23  namespace po = boost::program_options;
24  po::options_description sampler_options("Sampler options");
25  sampler_options.add_options()
26  ("file-name", po::value<std::vector<std::string>>(&filename) , "Path to the input file")
27  ("max-index", po::value<int64_t> (&maxindex) ->default_value(-1), "number of events to read")
28  ("branch-name", po::value<std::string> (&branchname) , "branch name");
29 
30 
31  FairMQProgOptions config;
32  config.AddToCmdLineOptions(sampler_options);
33 
34  config.ParseAll(argc, argv);
35 
36  PndMvdMQFileSampler sampler;
37 
38  for ( unsigned int ielem = 0 ; ielem < filename.size() ; ielem++ ) {
39  sampler.AddInputFileName(filename.at(ielem));
40  }
41 
42  sampler.SetMaxIndex(maxindex);
43 
44  sampler.AddInputBranchName(branchname);
45 
46  sampler.AddInputBranchName("EventHeader.");
47 
48  runStateMachine(sampler, config);
49 
50 
51  }
52  catch (std::exception& e)
53  {
54  LOG(ERROR) << "Unhandled Exception reached the top of main: "
55  << e.what() << ", application will now exit";
56  return 1;
57  }
58 
59  return 0;
60 }
void AddInputFileName(std::string tempString)
int main(int argc, char **argv)
std
const string filename