Jpp
JMuonGandalf.cc
Go to the documentation of this file.
1 #include <string>
2 
5 
6 #include "JDAQ/JDAQEventIO.hh"
9 
12 
16 #include "JSupport/JSupport.hh"
17 #include "JSupport/JMeta.hh"
18 
19 #include "Jeep/JParser.hh"
20 #include "Jeep/JMessage.hh"
21 
22 #include "JFit/JEvt.hh"
23 #include "JFit/JMuonGandalf.hh"
24 #include "JFit/JMuonParameters.hh"
26 
27 #include "JLang/JSharedPointer.hh"
28 
29 
30 /**
31  * \file
32  *
33  * Program to perform JFIT::JRegressor<JLine3Z,JGandalf> fit with I/O of JFIT::JEvt data.
34  * \author gmaggi
35  */
36 int main(int argc, char **argv)
37 {
38  using namespace std;
39  using namespace JPP;
40  using namespace KM3NETDAQ;
41 
43  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
44 
45  JParallelFileScanner_t inputFile;
47  JLimit_t& numberOfEvents = inputFile.getLimit();
48  string detectorFile;
49  string pdfFile;
50  JMuonParameters muonParams;
51  int debug;
52 
53 
54  try {
55 
56  JParser<> zap("Program to perform PDF fit of muon trajectory to data.");
57 
58  zap['f'] = make_field(inputFile);
59  zap['o'] = make_field(outputFile) = "gandalf.root";
60  zap['a'] = make_field(detectorFile);
61  zap['n'] = make_field(numberOfEvents) = JLimit::max();
62  zap['P'] = make_field(pdfFile);
63  zap['@'] = make_field(muonParams) = JPARSER::initialised();
64  zap['d'] = make_field(debug) = 1;
65 
66  zap(argc, argv);
67  }
68  catch(const exception& error) {
69  FATAL(error.what() << endl);
70  }
71 
72  cout.tie(&cerr);
73 
75 
76  try {
77  load(detectorFile, detector);
78  }
79  catch(const JException& error) {
80  FATAL(error);
81  }
82 
84 
85  outputFile.open();
86  outputFile.put(JMeta(argc, argv));
87 
88  const JMuonGandalf muonGandalf(moduleRouter, muonParams, pdfFile);
89 
90  while (inputFile.hasNext()) {
91 
92  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
93 
94  JParallelFileScanner_t::multi_pointer_type ps = inputFile.next();
95 
96  const JDAQEvent* tev = ps;
97  JEvt* in = ps;
98 
99  const JDAQTimeslice timeSlice(*tev, true);
100 
101  JEvt out;
102 
103  muonGandalf.getJEvt(timeSlice, *in, out);
104 
105  outputFile.put(out);
106  }
107  STATUS(endl);
108 
110 
111  io >> outputFile;
112 
113  outputFile.close();
114 }
115 
JMeta.hh
Head.hh
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition: JDAQEvent.hh:30
JFileRecorder.hh
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
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:476
JFIT::JMuonParameters
Definition: JMuonParameters.hh:20
JSharedPointer.hh
Evt.hh
KM3NETDAQ::JDAQTimeslice
Data time slice.
Definition: JDAQTimeslice.hh:30
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JFIT::JEvt
Data structure for set of track fit results.
Definition: JEvt.hh:293
JSupport.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JEvt.hh
JDAQEventIO.hh
main
int main(int argc, char **argv)
Definition: JMuonGandalf.cc:36
JDAQTimesliceIO.hh
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
JFIT::JMuonGandalf
class to handle Muon Gandalf reconstruction first, two other angular reconstructionS should be ran : ...
Definition: JMuonGandalf.hh:47
JDETECTOR::JModuleRouter
Router for direct addressing of module data in detector data structure.
Definition: JModuleRouter.hh:34
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JSUPPORT::JParallelFileScanner
General purpose class for parallel reading of objects from a single file or multiple files.
Definition: JParallelFileScanner.hh:31
JDETECTOR::JDetector
Detector data structure.
Definition: JDetector.hh:80
JAANET::detector
Detector file.
Definition: JHead.hh:130
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
JDAQSummarysliceIO.hh
JMuonGandalfParameters_t.hh
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37
JSUPPORT::JFileRecorder
Object writing to file.
Definition: JFileRecorder.hh:41
JLANG::JException
General exception.
Definition: JException.hh:23
JSUPPORT::JSingleFileScanner
Object reading from a list of files.
Definition: JSingleFileScanner.hh:75
JLANG::JSharedPointer
The template JSharedPointer class can be used to share a pointer to an object.
Definition: JSharedPointer.hh:28
JFIT::JMuonGandalf::getJEvt
void getJEvt(const KM3NETDAQ::JDAQTimeslice &timeSlice, JFIT::JEvt &InPreFits, JFIT::JEvt &OutFits) const
Declaration of Member function that actually performs the reconstruction.
Definition: JMuonGandalf.hh:133