Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
JMuonFeatures.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4#include <memory>
5
9
10#include "JDAQ/JDAQEventIO.hh"
13
15
19
21
22#include "JSupport/JSupport.hh"
26#include "JSupport/JMeta.hh"
27
33
34#include "Jeep/JParser.hh"
35#include "Jeep/JMessage.hh"
36
37
38/**
39 * \file
40 *
41 * Program to add data to muon tracks.
42 *
43 * \author eleguirriec, mdejong
44 */
45int main(int argc, char **argv)
46{
47 using namespace std;
48 using namespace JPP;
49 using namespace KM3NETDAQ;
50
53 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
56 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
57
58 JParallelFileScanner_t inputFile;
60 JLimit_t& numberOfEvents = inputFile.getLimit();
61 string detectorFile;
62 JCalibration_t calibrationFile;
63 double Tmax_s;
64 string pdfFile;
65 JMuonGandalfParameters_t parameters;
66 size_t threads;
67 int debug;
68
69 try {
70
71 JParser<> zap("Program to add data to muon tracks.");
72
73 zap['f'] = make_field(inputFile);
74 zap['o'] = make_field(outputFile) = "gandalf.root";
77 zap['T'] = make_field(Tmax_s) = 100.0;
78 zap['n'] = make_field(numberOfEvents) = JLimit::max();
79 zap['F'] = make_field(pdfFile);
80 zap['@'] = make_field(parameters) = JPARSER::initialised();
81 zap['N'] = make_field(threads, "number of threads") = 0;
82 zap['d'] = make_field(debug) = 1;
83
84 zap(argc, argv);
85 }
86 catch(const exception& error) {
87 FATAL(error.what() << endl);
88 }
89
90
91 getTreeParameters<Evt>().setSplitLevel(0);
92
94
95 try {
97 }
98 catch(const JException& error) {
99 FATAL(error);
100 }
101
103
104 if (!calibrationFile.empty()) {
105
106 try {
107
108 dynamics.reset(new JDynamics(detector, Tmax_s));
109
111 }
112 catch(const exception& error) {
113 FATAL(error.what());
114 }
115 }
116
117 outputFile.open();
118 outputFile.put(JMeta(argc, argv));
119
120 {
121
122 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
123
124 JSummaryFileRouter summary(inputFile);
125
126 const JMuonGandalf::storage_type storage(pdfFile, JTimeRange(parameters.TMin_ns, parameters.TMax_ns), parameters.TTS_ns);
127
128 JMuonFeatures fit(parameters, storage, debug);
129
130 JMultiThreadedReconstruction<JMuonFeatures> fits(fit, outputFile, threads, 2 * threads);
131
132 while (inputFile.hasNext()) {
133
134 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
135
136 multi_pointer_type ps = inputFile.next();
137
138 const JDAQEvent* tev = ps;
139 const JFIT::JEvt* in = ps;
140
141 summary.update(*tev);
142
143 if (dynamics) {
144 dynamics->update(*tev);
145 }
146
147 auto input = fit.getInput(router, summary, *tev, *in, dynamics ? dynamics->getCoverage() : coverage_type());
148
149 if (threads > 0)
150 fits.enqueue(input);
151 else
152 outputFile.put(fit(input));
153 }
154 STATUS(endl);
155 }
156
158
159 io >> outputFile;
160
161 outputFile.close();
162}
163
string outputFile
Data structure for detector geometry and calibration.
Dynamic detector calibration.
Recording of objects on file according a format that follows from the file name extension.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
ROOT I/O of application specific meta data.
Direct access to module in detector data structure.
int main(int argc, char **argv)
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
ROOT TTree parameter settings of various packages.
Detector data structure.
Definition JDetector.hh:96
Router for direct addressing of module data in detector data structure.
Data structure for set of track fit results.
General exception.
Definition JException.hh:24
Template definition of a multi-dimensional oscillation probability interpolation table.
void load()
Load oscillation probability table.
File router for fast addressing of summary data.
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
Detector file.
Definition JHead.hh:227
Acoustic event fit.
Orientation of module.
Dynamic detector calibration.
Definition JDynamics.hh:86
Data structure for coverage of detector by dynamical calibrations.
Definition JCoverage.hh:19
Auxiliary class for recursive type list generation.
Definition JTypeList.hh:351
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Wrapper class to add features after the final fit of muon trajectory.
input_type getInput(const JModuleRouter &router, const JSummaryRouter &summary, const JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
Get input data.
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72