Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JORCAReconstruction.cc File Reference

Program to perform reconstruction of muon trajectory and shower for ORCA detector. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to perform reconstruction of muon trajectory and shower for ORCA detector.

Author
mdejong

Definition in file JORCAReconstruction.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 48 of file JORCAReconstruction.cc.

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 JORCAReconstruction JReconstruction_t;
60 typedef JReconstruction_t::JEnergyCorrection_t JEnergyCorrection_t;
61 typedef JReconstruction_t::JParameters_t JParameters_t;
62 typedef JReconstruction_t::JStorage_t JStorage_t;
63
64 JSingleFileScanner_t inputFile;
66 JLimit_t& numberOfEvents = inputFile.getLimit();
67 string detectorFile;
68 JCalibration_t calibrationFile;
69 double Tmax_s;
70 JEnergyCorrection_t correct;
71 JParameters_t parameters;
72 JPMTParametersMap pmtParameters;
73 string pdfFile;
74 JK40Rates rates_Hz;
75 size_t threads; // number of parallel threads
76 int debug;
77
78 try {
79
80 JParser<> zap("Program to perform reconstruction of muon trajectory and shower for ORCA detector.");
81
82 zap['f'] = make_field(inputFile);
83 zap['o'] = make_field(outputFile) = "jpp.root";
84 zap['a'] = make_field(detectorFile);
85 zap['+'] = make_field(calibrationFile) = JPARSER::initialised();
86 zap['T'] = make_field(Tmax_s) = 100.0;
87 zap['n'] = make_field(numberOfEvents) = JLimit::max();
88 zap['F'] = make_field(pdfFile);
89 zap['P'] = make_field(pmtParameters, "PMT simulation data (or corresponding file name)") = JPARSER::initialised();
90 zap['E'] = make_field(correct .properties) = JPARSER::initialised(); // off
91 zap['@'] = make_field(parameters.properties) = JPARSER::initialised();
92 zap['B'] = make_field(rates_Hz) = KM3NET::getK40Rates();
93 zap['N'] = make_field(threads, "number of threads") = 0;
94 zap['d'] = make_field(debug) = 1;
95
96 zap(argc, argv);
97 }
98 catch(const exception& error) {
99 FATAL(error.what() << endl);
100 }
101
102
104
106
107 try {
108 load(detectorFile, detector);
109 }
110 catch(const JException& error) {
111 FATAL(error);
112 }
113
114 unique_ptr<JDynamics> dynamics;
115
116 if (!calibrationFile.empty()) {
117
118 try {
119
120 dynamics.reset(new JDynamics(detector, Tmax_s));
121
122 dynamics->load(calibrationFile);
123 }
124 catch(const exception& error) {
125 FATAL(error.what());
126 }
127 }
128
129 outputFile.open();
130 outputFile.put(JMeta(argc, argv));
131
132 JTreeScanner<JDAQEvent, JDAQEvaluator> in(inputFile, inputFile.getLimit());
133
134 {
135 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
136
137 JSummaryFileRouter summary(inputFile);
138
139 const JStorage_t storage(pdfFile, parameters);
140
141 JReconstruction_t fit(parameters, storage, rates_Hz, pmtParameters, correct, debug);
142
143 JMultiThreadedReconstruction<JReconstruction_t> fits(fit, outputFile, threads, 2 * threads);
144
145 while (in.hasNext()) {
146
147 STATUS("event: " << setw(10) << in.getCounter() << '\r'); DEBUG(endl);
148
149 const JDAQEvent* tev = in.next();
150
151 summary.update(*tev);
152
153 if (dynamics) {
154 dynamics->update(*tev);
155 }
156
157 auto input = fit.getInput(router, summary, *tev, dynamics ? dynamics->getCoverage() : coverage_type());
158
159 if (threads > 0)
160 fits.enqueue(input);
161 else
162 outputFile.put(fit(input));
163
164 outputFile.put(*tev);
165 }
166 STATUS(endl);
167 }
168
170
171 io >> outputFile;
172
173 outputFile.close();
174}
string outputFile
#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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
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
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.
Template definition for direct access of elements in ROOT TChain.
JTriggerCounter_t next()
Increment trigger counter.
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
const JK40Rates & getK40Rates()
Get K40 rates.
Definition KM3NeT.hh:38
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.