Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JORCAShowerFit.cc
Go to the documentation of this file.
1 #include <string>
2 
3 #include "evt/Head.hh"
4 #include "evt/Evt.hh"
5 
6 #include "JDAQ/JDAQEvent.hh"
7 #include "JDAQ/JDAQTimeslice.hh"
8 
11 
13 #include "JSupport/JSupport.hh"
15 #include "JSupport/JMeta.hh"
16 #include "JSupport/JTreeScanner.hh"
17 
18 #include "Jeep/JParser.hh"
19 #include "Jeep/JMessage.hh"
20 
21 #include "JFit/JEvt.hh"
24 #include "JFit/JORCAShowerFit.hh"
25 
26 #include "JLang/JSharedPointer.hh"
27 
28 
29 /**
30  * \file
31  *
32  * Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data.
33  * The reconstruction is made at the PMT level.
34  * \author adomi
35  */
36 
37 int main(int argc, char** argv){
38 
39  using namespace std;
40  using namespace JPP;
41  using namespace KM3NETDAQ;
42 
43  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
45 
46  JParallelFileScanner_t inputFile;
47  JFileRecorder<typelist> outputFile;
48  JShowerParameters showerParams;
49  JLimit_t& numberOfEvents = inputFile.getLimit();
50  string detectorFile;
51  string pdfFile;
52  int debug;
53 
54  try {
55 
56  JParser<> zap;
57 
58  zap['f'] = make_field(inputFile) ;
59  zap['o'] = make_field(outputFile) = "JORCAShowerFit_Output.root";
60  zap['a'] = make_field(detectorFile) ;
61  zap['F'] = make_field(pdfFile) ;
62  zap['@'] = make_field(showerParams) = JPARSER::initialised();
63  zap['n'] = make_field(numberOfEvents) = JLimit::max();
64  zap['d'] = make_field(debug) = 2;
65 
66  zap(argc, argv);
67  }
68  catch(const exception& error) {
69  FATAL(error.what() << endl);
70  }
71 
72  using namespace JTRIGGER;
73  using namespace JDETECTOR;
74  using namespace JGEOMETRY3D;
75  using namespace JTOOLS;
76 
77  JDetector detector;
78 
79  try {
80  load(detectorFile, detector);
81  }
82  catch(const JException& error) {
83  FATAL(error);
84  }
85 
86  outputFile.open();
87  outputFile.put(JMeta(argc, argv));
88 
89  const JSharedPointer<const JModuleRouter> moduleRouter(new JModuleRouter(detector));
90 
91  const JORCAShowerFit ShowerFit(moduleRouter, showerParams, pdfFile);
92 
93  while (inputFile.hasNext()) {
94 
95  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
96 
97  JParallelFileScanner_t::multi_pointer_type ps = inputFile.next();
98 
99  JDAQEvent* tev = ps;
100  JEvt* in = ps;
101 
102  JEvt out;
103 
104  const JDAQTimeslice timeSliceBuildL0(*tev, true);
105 
106  ShowerFit.getJEvt(timeSliceBuildL0, *in, out);
107 
108  outputFile.put(out);
109  }
110  STATUS(endl);
111 
112  JMultipleFileScanner<JRemove<typelist, JEvt>::typelist> io(inputFile);
113 
114  io >> outputFile;
115 
116  outputFile.close();
117 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:71
Utility class to parse command line options.
Definition: JParser.hh:1410
#define STATUS(A)
Definition: JMessage.hh:61
Detector data structure.
Definition: JDetector.hh:77
Recording of objects on file according a format that follows from the file name extension.
Router for direct addressing of module data in detector data structure.
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:64
string outputFile
JLimit JLimit_t
Type definition of limit.
Definition: JLimit.hh:214
Type list.
Definition: JTypeList.hh:22
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
ROOT I/O of application specific meta data.
Data time slice.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
int debug
debug level
Definition: JSirene.cc:59
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:65
Direct access to module in detector data structure.
Utility class to parse command line options.
ROOT TTree parameter settings.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:72
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:60
int main(int argc, char *argv[])
Definition: Main.cpp:15