Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JMuonGandalf.cc File Reference

Program to perform JFIT::JRegressor<JLine3Z,JGandalf> fit with I/O of JFIT::JEvt data. More...

#include <string>
#include "evt/Head.hh"
#include "evt/Evt.hh"
#include "JDAQ/JDAQEvent.hh"
#include "JDAQ/JDAQTimeslice.hh"
#include "JDetector/JModuleRouter.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JParallelFileScanner.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JFit/JEvt.hh"
#include "JFit/JMuonGandalf.hh"
#include "JFit/JMuonParameters.hh"
#include "JFit/JMuonGandalfParameters_t.hh"
#include "JLang/JSharedPointer.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to perform JFIT::JRegressor<JLine3Z,JGandalf> fit with I/O of JFIT::JEvt data.

Author
gmaggi

Definition in file JMuonGandalf.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 35 of file JMuonGandalf.cc.

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 }
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
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
Data time slice.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
int debug
debug level
Definition: JSirene.cc:59
#define FATAL(A)
Definition: JMessage.hh:65
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:72
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:60