Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
JShowerPositionFit.cc
Go to the documentation of this file.
1#include <string>
2#include <limits>
3
7
8#include "JDAQ/JDAQEventIO.hh"
11
14
16
18#include "JSupport/JSupport.hh"
20#include "JSupport/JMeta.hh"
23
24#include "Jeep/JParser.hh"
25#include "Jeep/JMessage.hh"
26
31
33
34
35/**
36 * \file
37 *
38 * Program to perform EM Shower Second Position Fit for ORCA with I/O of JFIT::JEvt data.
39 * The reconstruction is made at the HIT level.
40 * \author adomi
41 */
42
43int main(int argc, char** argv){
44
45 using namespace std;
46 using namespace JPP;
47
50 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
53 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
54
55
56 JParallelFileScanner_t inputFile;
59 JLimit_t& numberOfEvents = inputFile.getLimit();
60 string detectorFile;
61 string pdfFile;
62 JCalibration_t calibrationFile;
63 double Tmax_s;
64 int debug;
65 size_t threads; // number of parallel threads
66 try {
67
69
70 zap['f'] = make_field(inputFile) ;
71 zap['o'] = make_field(outputFile) = "JShowerPositionFit.root";
74 zap['T'] = make_field(Tmax_s) = 100.0;
75 zap['F'] = make_field(pdfFile) ;
76 zap['@'] = make_field(parameters) = JPARSER::initialised();
77 zap['n'] = make_field(numberOfEvents) = JLimit::max();
78 zap['d'] = make_field(debug) = 2;
79 zap['N'] = make_field(threads) = 0;
80
81 zap(argc, argv);
82 }
83 catch(const exception& error) {
84 FATAL(error.what() << endl);
85 }
86
87
88 getTreeParameters<Evt>().setSplitLevel(0);
89
91
92 try {
94 }
95 catch(const JException& error) {
96 FATAL(error);
97 }
98
100
101 if (!calibrationFile.empty()) {
102 try {
103
104 dynamics.reset(new JDynamics(detector, Tmax_s));
105
107 }
108 catch(const exception& error) {
109 FATAL(error.what());
110 }
111 }
112
113 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
114
115 outputFile.open();
116 outputFile.put(JMeta(argc, argv));
117
118 JSummaryFileRouter summary(inputFile);
119
120 {
121 const JShowerPositionFit::storage_type storage(pdfFile, JTimeRange(parameters.TMin_ns, parameters.TMax_ns), parameters.TTS_ns);
122 JShowerPositionFit fit(parameters, storage, debug);
123 JMultiThreadedReconstruction<JShowerPositionFit> fits(fit, outputFile, threads, 2 * threads);
124
125 while (inputFile.hasNext()) {
126
127 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
128
129 multi_pointer_type ps = inputFile.next();
130
131 JDAQEvent* tev = ps;
132 JFIT::JEvt* in = ps;
133
134 summary.update(*tev);
135
136 if (dynamics) {
137 dynamics->update(*tev);
138 }
139
140 auto input = fit.getInput(router, summary, *tev, *in, dynamics ? dynamics->getCoverage() : coverage_type());
141
142 if (threads > 0)
143 fits.enqueue(input);
144 else
145 outputFile.put(fit(input));
146
147 }
148 STATUS(endl);
149 }
150
152
153 io >> outputFile;
154
155 outputFile.close();
156}
string outputFile
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.
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
int main(int argc, char **argv)
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.
class to handle the second position fit of the shower reconstruction, mainly dedicated for ORCA
input_type getInput(const JModuleRouter &router, const JSummaryRouter &summary, const JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
Get input data.
File router for fast addressing of summary data.
void update(const JDAQHeader &header)
Update router.
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).
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
double TMin_ns
minimum time for local coincidences [ns]
double TMax_ns
maximum time for local coincidences [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