Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JShowerPrefit.cc
Go to the documentation of this file.
1#include <limits>
2
7
8#include "JDAQ/JDAQEventIO.hh"
11#include "JDAQ/JDAQEvaluator.hh"
12
14
18
20
21#include "JSupport/JSupport.hh"
25#include "JSupport/JMeta.hh"
26
27#include "Jeep/JParser.hh"
28#include "Jeep/JMessage.hh"
29
34
36
37/**
38 * \author adomi, vcarretero
39 */
40
41int main(int argc, char **argv)
42{
43 using namespace std;
44 using namespace JPP;
45 using namespace KM3NETDAQ;
46
49 JACOUSTICS::JEvt>::typelist calibration_types;
50 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
51
54 JLimit_t& numberOfEvents = inputFile.getLimit();
55 string detectorFile;
56 JCalibration_t calibrationFile;
57 double Tmax_s;
59 int debug;
60 size_t threads; // number of parallel threads
61
62 try {
63
64 JParser<> zap("Program to perform position pre-fit of shower to data.");
65
66 zap['f'] = make_field(inputFile);
67 zap['o'] = make_field(outputFile) = "ShowerPrefit.root";
68 zap['a'] = make_field(detectorFile);
69 zap['+'] = make_field(calibrationFile) = JPARSER::initialised();
70 zap['T'] = make_field(Tmax_s) = 100.0;
71 zap['@'] = make_field(parameters) = JPARSER::initialised();
72 zap['n'] = make_field(numberOfEvents) = JLimit::max();
73 zap['d'] = make_field(debug) = 2;
74 zap['N'] = make_field(threads) = 0;
75
76 zap(argc, argv);
77 }
78 catch(const exception& error) {
79 FATAL(error.what() << endl);
80 }
81
82
84
86
87 try {
88 load(detectorFile, detector);
89 }
90 catch(const JException& error) {
91 FATAL(error);
92 }
93
94 unique_ptr<JDynamics> dynamics;
95
96 if (!calibrationFile.empty()) {
97 try {
98
99 dynamics.reset(new JDynamics(detector, Tmax_s));
100
101 dynamics->load(calibrationFile);
102 }
103 catch(const exception& error) {
104 FATAL(error.what());
105 }
106 }
107
108 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
109
110 JShowerPrefit fit(parameters, debug);
111
112 outputFile.open();
113 outputFile.put(JMeta(argc, argv));
114
115 JTreeScanner<JDAQEvent, JDAQEvaluator> in (inputFile, inputFile.getLimit());
116
117 {
118
119 JMultiThreadedReconstruction<JShowerPrefit> fits(fit, outputFile, threads, 2 * threads);
120
121 while (in.hasNext()) {
122
123 STATUS("event: " << setw(10) << in.getCounter() << '\r'); DEBUG(endl);
124
125 const JDAQEvent* tev = in.next();
126
127 if (dynamics) {
128
129 dynamics->update(*tev);
130
131 }
132
133 auto input = fit.getInput(router, *tev, dynamics ? dynamics->getCoverage() : coverage_type());
134
135 if (threads > 0)
136 fits.enqueue(input);
137 else
138 outputFile.put(fit(input));
139
140 outputFile.put(*tev);
141 }
142 STATUS(endl);
143 }
144
146
147 io >> outputFile;
148
149 outputFile.close();
150}
151
152
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.
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)
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.
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 first step of the shower reconstruction in ORCA: it reconstructs the shower vertex,...
input_type getInput(const JModuleRouter &router, const KM3NETDAQ::JDAQEvent &event, 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.
Object reading from a list of files.
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 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