Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JORCAShowerReconstruction.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"
30#include "JSupport/JMeta.hh"
31
34
35#include "JPhysics/JK40Rates.hh"
36#include "JPhysics/KM3NeT.hh"
37
38#include "Jeep/JProperties.hh"
39#include "Jeep/JParser.hh"
40#include "Jeep/JMessage.hh"
41
42
43/**
44 * \file
45 * Program to perform reconstruction of shower for ORCA detector.
46 *
47 * \author mdejong
48 */
49int main(int argc, char **argv)
50{
51 using namespace std;
52 using namespace JPP;
53 using namespace KM3NETDAQ;
54
57 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
58 typedef JORCAShowerReconstruction JReconstruction_t;
59 typedef JReconstruction_t::JParameters_t JParameters_t;
60 typedef JReconstruction_t::JStorage_t JStorage_t;
61
62 JSingleFileScanner_t inputFile;
64 JLimit_t& numberOfEvents = inputFile.getLimit();
65 string detectorFile;
66 JCalibration_t calibrationFile;
67 double Tmax_s;
68 string pdfFile;
69 JParameters_t parameters;
70 JPMTParametersMap pmtParameters;
71 JEnergyCorrection correct;
72 size_t threads;
73 int debug;
74
75 try {
76
77 JParser<> zap("Program to perform reconstruction of shower for ORCA detector.");
78
79 zap['f'] = make_field(inputFile);
80 zap['o'] = make_field(outputFile);
81 zap['n'] = make_field(numberOfEvents) = JLimit::max();
82 zap['a'] = make_field(detectorFile);
83 zap['+'] = make_field(calibrationFile, "dynamical calibration data") = JPARSER::initialised();
84 zap['T'] = make_field(Tmax_s, "dynamical update time [s]") = 100.0;
85 zap['F'] = make_field(pdfFile, "PDFs");
86 zap['@'] = make_field(parameters.properties, "fit parameters") = JPARSER::initialised();
87 zap['P'] = make_field(pmtParameters, "PMT parameters") = JPARSER::initialised();
88 zap['E'] = make_field(correct, "energy correction") = JEnergyCorrection();
89 zap['N'] = make_field(threads, "number of threads") = 0;
90 zap['d'] = make_field(debug) = 1;
91
92 zap(argc, argv);
93 }
94 catch(const exception& error) {
95 FATAL(error.what() << endl);
96 }
97
98
100
102
103 try {
104 load(detectorFile, detector);
105 }
106 catch(const JException& error) {
107 FATAL(error);
108 }
109
110 unique_ptr<JDynamics> dynamics;
111
112 if (!calibrationFile.empty()) {
113
114 try {
115
116 dynamics.reset(new JDynamics(detector, Tmax_s));
117
118 dynamics->load(calibrationFile);
119 }
120 catch(const exception& error) {
121 FATAL(error.what());
122 }
123 }
124
125 outputFile.open();
126 outputFile.put(JMeta(argc, argv));
127
128 JTreeScanner<JDAQEvent, JDAQEvaluator> in(inputFile, inputFile.getLimit());
129
130 {
131 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
132
133 JSummaryFileRouter summary(inputFile);
134
135 const JStorage_t storage(pdfFile, parameters);
136
137 JReconstruction_t fit(parameters, storage, pmtParameters, correct, debug);
138
139 JMultiThreadedReconstruction<JReconstruction_t> fits(fit, outputFile, threads, 2 * threads);
140
141 while (in.hasNext()) {
142
143 STATUS("event: " << setw(10) << in.getCounter() << '\r'); DEBUG(endl);
144
145 const JDAQEvent* tev = in.next();
146
147 summary.update(*tev);
148
149 if (dynamics) {
150 dynamics->update(*tev);
151 }
152
153 auto input = fit.getInput(router, summary, *tev, dynamics ? dynamics->getCoverage() : coverage_type());
154
155 if (threads > 0)
156 fits.enqueue(input);
157 else
158 outputFile.put(fit(input));
159
160 outputFile.put(*tev);
161 }
162 STATUS(endl);
163 }
164
166
167 io >> outputFile;
168
169 outputFile.close();
170}
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:74
ROOT I/O of application specific meta data.
Direct access to module in detector data structure.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
int main(int argc, char **argv)
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
Dynamic detector calibration.
Definition JDynamics.hh:81
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 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.