Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JARCAMuonReconstruction.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#include "JDAQ/JDAQEvaluator.hh"
14
16
21
23
24#include "JSupport/JSupport.hh"
29#include "JSupport/JMeta.hh"
30
33
34#include "JPhysics/JK40Rates.hh"
35#include "JPhysics/KM3NeT.hh"
36
37#include "Jeep/JProperties.hh"
38#include "Jeep/JParser.hh"
39#include "Jeep/JMessage.hh"
40
41
42/**
43 * \file
44 * Program to perform reconstruction of muon trajectory for ARCA detector.
45 *
46 * \author mdejong
47 */
48int main(int argc, char **argv)
49{
50 using namespace std;
51 using namespace JPP;
52 using namespace KM3NETDAQ;
53
57 JACOUSTICS::JEvt>::typelist calibration_types;
58 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
59 typedef JARCAMuonReconstruction JReconstruction_t;
60 typedef JReconstruction_t::JParameters_t JParameters_t;
61 typedef JReconstruction_t::JStorage_t JStorage_t;
62
63 JSingleFileScanner_t inputFile;
65 JLimit_t& numberOfEvents = inputFile.getLimit();
66 string detectorFile;
67 JCalibration_t calibrationFile;
68 double Tmax_s;
69 JEnergyCorrection correct;
70 JParameters_t parameters;
71 JPMTParametersMap pmtParameters;
72 string pdfFile;
73 JK40Rates rates_Hz;
74 size_t threads; // number of parallel threads
75 int debug;
76
77 try {
78
79 JParser<> zap("Program to perform reconstruction of muon trajectory for ARCA detector.");
80
81 zap['f'] = make_field(inputFile);
82 zap['o'] = make_field(outputFile) = "jmuon.root";
83 zap['a'] = make_field(detectorFile);
84 zap['+'] = make_field(calibrationFile) = JPARSER::initialised();
85 zap['T'] = make_field(Tmax_s) = 100.0;
86 zap['n'] = make_field(numberOfEvents) = JLimit::max();
87 zap['F'] = make_field(pdfFile);
88 zap['P'] = make_field(pmtParameters, "PMT simulation data (or corresponding file name)") = JPARSER::initialised();
89 zap['E'] = make_field(correct) = JEnergyCorrection(); // off
90 zap['@'] = make_field(parameters.properties) = JPARSER::initialised();
91 zap['B'] = make_field(rates_Hz) = KM3NET::getK40Rates();
92 zap['N'] = make_field(threads, "number of threads") = 0;
93 zap['d'] = make_field(debug) = 1;
94
95 zap(argc, argv);
96 }
97 catch(const exception& error) {
98 FATAL(error.what() << endl);
99 }
100
101
103
105
106 try {
107 load(detectorFile, detector);
108 }
109 catch(const JException& error) {
110 FATAL(error);
111 }
112
113 unique_ptr<JDynamics> dynamics;
114
115 if (!calibrationFile.empty()) {
116
117 try {
118
119 dynamics.reset(new JDynamics(detector, Tmax_s));
120
121 dynamics->load(calibrationFile);
122 }
123 catch(const exception& error) {
124 FATAL(error.what());
125 }
126 }
127
128 outputFile.open();
129 outputFile.put(JMeta(argc, argv));
130
131 JTreeScanner<JDAQEvent, JDAQEvaluator> in(inputFile, inputFile.getLimit());
132
133 {
134 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
135
136 JSummaryFileRouter summary(inputFile);
137
138 const JStorage_t storage(pdfFile, parameters);
139
140 JReconstruction_t fit(parameters, storage, rates_Hz, pmtParameters, correct, debug);
141
142 JMultiThreadedReconstruction<JReconstruction_t> fits(fit, outputFile, threads, 2 * threads);
143
144 while (in.hasNext()) {
145
146 STATUS("event: " << setw(10) << in.getCounter() << '\r'); DEBUG(endl);
147
148 const JDAQEvent* tev = in.next();
149
150 summary.update(*tev);
151
152 if (dynamics) {
153 dynamics->update(*tev);
154 }
155
156 auto input = fit.getInput(router, summary, *tev, dynamics ? dynamics->getCoverage() : coverage_type());
157
158 if (threads > 0)
159 fits.enqueue(input);
160 else
161 outputFile.put(fit(input));
162
163 outputFile.put(*tev);
164 }
165 STATUS(endl);
166 }
167
169
170 io >> outputFile;
171
172 outputFile.close();
173}
int main(int argc, char **argv)
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.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse parameter values.
Scanning of objects from a single file according a format that follows from the extension of each fil...
ROOT TTree parameter settings of various packages.
Properties of KM3NeT PMT and deep-sea water.
Detector data structure.
Definition JDetector.hh:96
Router for direct addressing of module data in detector data structure.
Auxiliary class for map of PMT parameters.
Data structure for set of track fit results.
General exception.
Definition JException.hh:24
Utility class to parse command line options.
Definition JParser.hh:1698
Auxiliary class for correction of energy determined by JEnergy.cc.
Thread pool for event-by-event reconstruction.
void setSplitLevel(int value)
Set split level.
Object writing to file.
General purpose class for object reading from a list of file names.
Object reading from a list of files.
File router for fast addressing of summary data.
void update(const JDAQHeader &header)
Update router.
Template definition for direct access of elements in ROOT TChain.
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).
JTreeParameters & getTreeParameters()
Template definition for method returning TTree parameters.
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
Auxiliary class for K40 rates.
Definition JK40Rates.hh:41
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
Auxiliary base class for file name.