Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JShowerPointSimplex.cc
Go to the documentation of this file.
1#include <string>
2#include <limits>
3
7
8#include "JDAQ/JDAQEventIO.hh"
11
13
17
19
21#include "JSupport/JSupport.hh"
23#include "JSupport/JMeta.hh"
25
26#include "Jeep/JParser.hh"
27#include "Jeep/JMessage.hh"
28
33
35
36
37/**
38 * \file
39 *
40 * Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data.
41 * The reconstruction is made at the PMT level.
42 * \author adomi, vcarretero
43 */
44
45int main(int argc, char** argv){
46
47 using namespace std;
48 using namespace JPP;
49 using namespace KM3NETDAQ;
50
52 typedef JParallelFileScanner< JTypeList<JDAQEvent, JFIT::JEvt> > JParallelFileScanner_t;
53 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
55 JACOUSTICS::JEvt>::typelist calibration_types;
56 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
57
58
59 JParallelFileScanner_t inputFile;
62 JLimit_t& numberOfEvents = inputFile.getLimit();
63 string detectorFile;
64 JCalibration_t calibrationFile;
65 double Tmax_s;
66 int debug;
67 size_t threads; // number of parallel threads
68
69 try {
70
71 JParser<> zap;
72
73 zap['f'] = make_field(inputFile) ;
74 zap['o'] = make_field(outputFile) = "JORCAShowerPointSimplex_Output.root";
75 zap['a'] = make_field(detectorFile) ;
76 zap['+'] = make_field(calibrationFile) = JPARSER::initialised();
77 zap['@'] = make_field(parameters) = JPARSER::initialised();
78 zap['T'] = make_field(Tmax_s) = 100.0;
79 zap['n'] = make_field(numberOfEvents) = JLimit::max();
80 zap['d'] = make_field(debug) = 2;
81 zap['N'] = make_field(threads) = 0;
82
83 zap(argc, argv);
84 }
85 catch(const exception& error) {
86 FATAL(error.what() << endl);
87 }
88
89
91
93
94 try {
95 load(detectorFile, detector);
96 }
97 catch(const JException& error) {
98 FATAL(error);
99 }
100
101 unique_ptr<JDynamics> dynamics;
102
103 if (!calibrationFile.empty()) {
104 try {
105
106 dynamics.reset(new JDynamics(detector, Tmax_s));
107
108 dynamics->load(calibrationFile);
109 }
110 catch(const exception& error) {
111 FATAL(error.what());
112 }
113 }
114
115 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
116
117 JShowerPointSimplex fit(parameters, debug);
118
119 outputFile.open();
120 outputFile.put(JMeta(argc, argv));
121
122 {
123
124 JMultiThreadedReconstruction<JShowerPointSimplex> fits(fit, outputFile, threads, 2 * threads);
125
126 while (inputFile.hasNext()) {
127
128 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
129
130 multi_pointer_type ps = inputFile.next();
131
132 const JDAQEvent* tev = ps;
133 const JFIT::JEvt* in = ps;
134
135 if (dynamics) {
136 dynamics->update(*tev);
137 }
138
139 auto input = fit.getInput(router, *tev, *in, dynamics ? dynamics->getCoverage() : coverage_type());
140
141 if (threads > 0)
142 fits.enqueue(input);
143 else
144 outputFile.put(fit(input));
145
146 }
147 STATUS(endl);
148 }
149
151
152 io >> outputFile;
153
154 outputFile.close();
155}
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
Utility class to parse command line options.
Definition JParser.hh:1698
Thread pool for event-by-event reconstruction.
class to handle the second position fit of the shower reconstruction, mainly dedicated for ORCA
input_type getInput(const JModuleRouter &router, const KM3NETDAQ::JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
Get input data.
void setSplitLevel(int value)
Set split level.
Object writing to file.
General purpose class for object reading from a list of file names.
General purpose class for parallel reading of objects from a single file or multiple files.
Object reading from a list of files.
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
Type list.
Definition JTypeList.hh:23
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
const JLimit & getLimit() const
Get limit.
Definition JLimit.hh:84
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