Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
JRunAnalyzer.cc File Reference
#include <iostream>
#include <iomanip>
#include "JDetector/JDetector.hh"
#include "JDetector/JModuleRouter.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JMeta.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JTreeScanner.hh"
#include "TROOT.h"
#include "Jeep/JParser.hh"
#include "JDAQ/JDAQ.hh"
#include "JDAQ/JDAQTimeslice.hh"
#include "JDAQ/JDAQSummaryslice.hh"
#include "JLang/JObjectReader.hh"
#include "JROOT/JRootFileReader.hh"
#include "RunAnalyzer.hh"
#include "JRunHistograms.hh"

Go to the source code of this file.

Classes

struct  IO
 Structure to store the different command line arguments for JRunAnalyzer. More...
 

Functions

int read_user_options (IO &options, int argc, char **argv)
 Parses the command line options and fills an IO structure with them. More...
 
int main (int argc, char **argv)
 

Function Documentation

int read_user_options ( IO options,
int  argc,
char **  argv 
)
inline

Parses the command line options and fills an IO structure with them.

Parameters
optionsan option structure
argcthe number of command line arguments
argvthe command line arguments
Returns
1 if works 2 if it doesn't work

Definition at line 59 of file JRunAnalyzer.cc.

59  {
60 
61  int a = 0;
62 
63  try {
64 
65  JParser<string> zap;
66 
67  zap["o"] = make_field(options.ofname) = "out.root" ;
68 
69  zap["f"] = make_field(options.ifname) ;
70 
71  zap["a"] = make_field(options.detector_file) ;
72 
73  if (zap.read(argc, argv) != 0)
74 
75  a = 1;
76 
77  }
78 
79  catch(const exception &error) {
80 
81  ERROR(error.what() << endl);
82 
83  a = 2;
84 
85  }
86 
87  return a;
88 
89 }
Utility class to parse command line options.
Definition: JParser.hh:1410
string ofname
Definition: JRunAnalyzer.cc:44
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
#define ERROR(A)
Definition: JMessage.hh:64
string ifname
Definition: JRunAnalyzer.cc:42
int read(const int argc, const char *const argv[])
Parse the program&#39;s command line options.
Definition: JParser.hh:1673
string detector_file
Definition: JRunAnalyzer.cc:46
int main ( int  argc,
char **  argv 
)

Definition at line 92 of file JRunAnalyzer.cc.

92  {
93 
94  IO options ;
95 
96  read_user_options(options, argc , argv) ;
97 
98  RunAnalyzer Analyzer ( options.ifname , options.detector_file) ;
99 
100  Analyzer.read_daqevents_from_file() ;
101 
102  Analyzer.read_summaryslices_from_file () ;
103 
104  Analyzer.read_timeslices_from_file<JDAQTimeslice>() ;
105 
106  Analyzer.read_timeslices_from_file<JDAQTimesliceL0>() ;
107 
108  Analyzer.read_timeslices_from_file<JDAQTimesliceL1>() ;
109 
110  Analyzer.read_timeslices_from_file<JDAQTimesliceL2>() ;
111 
112  Analyzer.read_timeslices_from_file<JDAQTimesliceSN>() ;
113 
114  JRA_Histograms run_histograms = Analyzer.getHistograms();
115 
116  TFile outfile(options.ofname.c_str() , "recreate") ;
117 
118  putObject(&outfile , JMeta(argc, argv));
119 
120  JMeta::copy(options.ifname.c_str(), outfile);
121 
122  run_histograms.Write_to_file (outfile) ;
123 
124  outfile.Close() ;
125 
126  cout << "Done! " << endl ;
127 
128 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:71
Structure to store the different command line arguments for JRunAnalyzer.
Definition: JRunAnalyzer.cc:40
string ofname
Definition: JRunAnalyzer.cc:44
Timeslice data structure for L1 data.
Class dedicated to the analysis of KM3NeT runs.
Definition: RunAnalyzer.hh:37
Timeslice data structure for L2 data.
Data time slice.
string ifname
Definition: JRunAnalyzer.cc:42
Timeslice data structure for SN data.
string detector_file
Definition: JRunAnalyzer.cc:46
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:40
int read_user_options(IO &options, int argc, char **argv)
Parses the command line options and fills an IO structure with them.
Definition: JRunAnalyzer.cc:59
Timeslice data structure for L0 data.
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.