Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JORCAShowerPrefit.cc
Go to the documentation of this file.
1 #include "evt/Head.hh"
2 #include "evt/Evt.hh"
3 
5 #include "JDetector/JDetectorToolkit.hh"// <- to enable: load
6 
7 #include "JSupport/JSupport.hh"
10 #include "JSupport/JMeta.hh"
11 
12 #include "Jeep/JParser.hh"
13 #include "Jeep/JMessage.hh"
14 
15 #include "JTools/JPermutation.hh"
16 #include "JTools/JRange.hh"
17 
20 
21 /**
22  * \author adomi
23  */
24 
25 int main(int argc, char **argv)
26 {
27  using namespace std;
28  using namespace JPP;
29  using namespace KM3NETDAQ;
30 
32 
33  JSingleFileScanner<JDAQEvent> inputFile;
34  JFileRecorder <typelist> outputFile;
35  JLimit_t& numberOfEvents = inputFile.getLimit();
36  string detectorFile;
37  JShowerParameters showerParams;
38  int debug;
39 
40  try {
41 
42  JParser<> zap("Program to perform position pre-fit of shower to data.");
43 
44  zap['f'] = make_field(inputFile);
45  zap['o'] = make_field(outputFile) = "ShowerPrefit.root";
46  zap['a'] = make_field(detectorFile);
47  zap['@'] = make_field(showerParams) = JPARSER::initialised();
48  zap['n'] = make_field(numberOfEvents) = JLimit::max();
49  zap['d'] = make_field(debug) = 1;
50 
51  zap(argc, argv);
52  }
53  catch(const exception& error) {
54  FATAL(error.what() << endl);
55  }
56 
57  cout.tie(&cerr);
58 
59  JDetector detector;
60 
61  try {
62  load(detectorFile, detector);
63  }
64  catch(const JException& error) {
65  FATAL(error);
66  }
67 
68  const JSharedPointer<const JModuleRouter> moduleRouter(new JModuleRouter(detector));
69 
70  outputFile.open();
71  outputFile.put(JMeta(argc, argv));
72 
73  const JORCAShowerPrefit ShowerPrefit(moduleRouter, showerParams);
74 
75  while (inputFile.hasNext()) {
76 
77  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
78 
79  const JDAQEvent* tev = inputFile.next();
80 
81  const JDAQTimeslice timeSliceBuildL0(*tev, true);
82  const JDAQTimeslice timeSliceBuildL2(*tev, !showerParams.prefit.useL0);
83 
84  JEvt out;
85 
86  ShowerPrefit.getJEvt(timeSliceBuildL0, timeSliceBuildL2, out);
87 
88  outputFile.put(out);
89  }
90 
91  STATUS(endl);
92 
93  JSingleFileScanner<JRemove<typelist, JEvt>::typelist> io(inputFile);
94 
95  io >> outputFile;
96 
97  outputFile.close();
98 }
99 
100 
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
Recording of objects on file according a format that follows from the file name extension.
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
Scanning of objects from a single file according a format that follows from the extension of each fil...
Auxiliary class for recursive type list generation.
Definition: JTypeList.hh:377
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
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.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
ROOT TTree parameter settings.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:72
JTriggerCounter_t next()
Increment trigger counter.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:60
int main(int argc, char *argv[])
Definition: Main.cpp:15