Jpp
Functions
JMuonGandalf.cc File Reference
#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

◆ main()

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 }
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition: JDAQEvent.hh:34
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
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
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
JSUPPORT::JLimit::getLimit
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
JLANG::JTypeList
Type list.
Definition: JTypeList.hh:22
STATUS
#define STATUS(A)
Definition: JMessage.hh:63
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
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37