Jpp
JMuonGandalf.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 
15 #include "JSupport/JSupport.hh"
16 #include "JSupport/JMeta.hh"
17 
18 #include "Jeep/JParser.hh"
19 #include "Jeep/JMessage.hh"
20 
21 #include "JFit/JEvt.hh"
22 #include "JFit/JMuonGandalf.hh"
23 #include "JFit/JMuonParameters.hh"
25 
26 #include "JLang/JSharedPointer.hh"
27 
28 
29 /**
30  * \file
31  *
32  * Program to perform JFIT::JRegressor<JLine3Z,JGandalf> fit with I/O of JFIT::JEvt data.
33  * \author gmaggi
34  */
35 int main(int argc, char **argv)
36 {
37  using namespace std;
38  using namespace JPP;
39  using namespace KM3NETDAQ;
40 
42  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
43 
44  JParallelFileScanner_t inputFile;
45  JFileRecorder<typelist> outputFile;
46  JLimit_t& numberOfEvents = inputFile.getLimit();
47  string detectorFile;
48  string pdfFile;
49  JMuonParameters muonParams;
50  int debug;
51 
52 
53  try {
54 
55  JParser<> zap("Program to perform PDF fit of muon trajectory to data.");
56 
57  zap['f'] = make_field(inputFile);
58  zap['o'] = make_field(outputFile) = "gandalf.root";
59  zap['a'] = make_field(detectorFile);
60  zap['n'] = make_field(numberOfEvents) = JLimit::max();
61  zap['P'] = make_field(pdfFile);
62  zap['@'] = make_field(muonParams) = JPARSER::initialised();
63  zap['d'] = make_field(debug) = 1;
64 
65  zap(argc, argv);
66  }
67  catch(const exception& error) {
68  FATAL(error.what() << endl);
69  }
70 
71  cout.tie(&cerr);
72 
73  JDetector detector;
74 
75  try {
76  load(detectorFile, detector);
77  }
78  catch(const JException& error) {
79  FATAL(error);
80  }
81 
82  const JSharedPointer<const JModuleRouter> moduleRouter(new JModuleRouter(detector));
83 
84  outputFile.open();
85  outputFile.put(JMeta(argc, argv));
86 
87  const JMuonGandalf muonGandalf(moduleRouter, muonParams, pdfFile);
88 
89  while (inputFile.hasNext()) {
90 
91  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
92 
93  JParallelFileScanner_t::multi_pointer_type ps = inputFile.next();
94 
95  const JDAQEvent* tev = ps;
96  JEvt* in = ps;
97 
98  const JDAQTimeslice timeSlice(*tev, true);
99 
100  JEvt out;
101 
102  muonGandalf.getJEvt(timeSlice, *in, out);
103 
104  outputFile.put(out);
105  }
106  STATUS(endl);
107 
108  JSingleFileScanner<JRemove<typelist, JEvt>::typelist> io(inputFile);
109 
110  io >> outputFile;
111 
112  outputFile.close();
113 }
114 
JMeta.hh
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition: JDAQEvent.hh:34
JFileRecorder.hh
JMessage.hh
JMuonGandalf.hh
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
JDETECTOR::load
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Definition: JDetectorToolkit.hh:456
JSharedPointer.hh
JSUPPORT::JLimit_t
JLimit JLimit_t
Type definition of limit.
Definition: JLimit.hh:215
KM3NETDAQ::JDAQTimeslice
Data time slice.
Definition: JDAQTimeslice.hh:36
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JDAQTimeslice.hh
JSupport.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JEvt.hh
main
int main(int argc, char **argv)
Definition: JMuonGandalf.cc:35
debug
int debug
debug level
Definition: JSirene.cc:59
JSUPPORT::JLimit::getLimit
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
JModuleRouter.hh
JParallelFileScanner.hh
JMultipleFileScanner.hh
JLANG::JTypeList
Type list.
Definition: JTypeList.hh:22
STATUS
#define STATUS(A)
Definition: JMessage.hh:63
JParser.hh
JDetectorToolkit.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JSUPPORT::JMeta
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:71
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
KM3NETDAQ
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
JMuonParameters.hh
JDAQEvent.hh
JMuonGandalfParameters_t.hh
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37