Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JORCAShowerPositionFit.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"
25 
26 #include "JLang/JSharedPointer.hh"
27 
28 int main(int argc, char **argv){
29 
30  using namespace std;
31  using namespace JPP;
32  using namespace KM3NETDAQ;
33 
34  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
36 
37  JParallelFileScanner_t inputFile;
38  JFileRecorder<typelist> outputFile;
39  JLimit_t& numberOfEvents = inputFile.getLimit();
40  string detectorFile;
41  string pdfFile;
42  JShowerParameters showerParams;
43  int debug;
44 
45  try{
46  JParser<> zap;
47 
48  zap['f'] = make_field(inputFile);
49  zap['o'] = make_field(outputFile) = "PositionFit.root";
50  zap['a'] = make_field(detectorFile);
51  zap['F'] = make_field(pdfFile) = "PDF_ShowerPositionFit.root";
52  zap['n'] = make_field(numberOfEvents) = JLimit::max();
53  zap['@'] = make_field(showerParams) = JPARSER::initialised();
54  zap['d'] = make_field(debug) = 2;
55 
56  if (zap.read(argc, argv) != 0) return 1;
57  }
58  catch(const exception& error){
59  FATAL(error.what() << endl);
60  }
61 
62  using namespace JTRIGGER;
63  using namespace JDETECTOR;
64  using namespace JGEOMETRY3D;
65  using namespace JTOOLS;
66 
67  JDetector detector;
68 
69  try {
70  load(detectorFile, detector);
71  }
72  catch(const JException& error) {
73  FATAL(error);
74  }
75 
76  outputFile.open();
77  outputFile.put(JMeta(argc, argv));
78 
79  const JSharedPointer<const JModuleRouter> moduleRouter(new JModuleRouter(detector));
80 
81  const JORCAShowerPositionFit ShowerPosFit(moduleRouter, showerParams, pdfFile);
82 
83  while (inputFile.hasNext()) {
84 
85  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
86 
87  JParallelFileScanner_t::multi_pointer_type ps = inputFile.next();
88 
89  JDAQEvent* tev = ps;
90  JEvt* in = ps;
91 
92  JEvt out;
93 
94  const JDAQTimeslice timeSliceBuildL0(*tev, true);
95  const JDAQTimeslice timeSliceBuildL2(*tev, false);
96 
97  ShowerPosFit.getJEvt(timeSliceBuildL0, timeSliceBuildL2, *in, out);
98 
99  outputFile.put(out);
100  }
101  STATUS(endl);
102 
103  JMultipleFileScanner<JRemove<typelist, JEvt>::typelist> io(inputFile);
104 
105  io >> outputFile;
106 
107  outputFile.close();
108 }
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.
int read(const int argc, const char *const argv[])
Parse the program&#39;s command line options.
Definition: JParser.hh:1673
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