Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JShowerPrefit.cc File Reference

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc,
char ** argv )
Author
adomi, vcarretero

Definition at line 41 of file JShowerPrefit.cc.

42{
43 using namespace std;
44 using namespace JPP;
45 using namespace KM3NETDAQ;
46
48 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
49
52 JLimit_t& numberOfEvents = inputFile.getLimit();
53 string detectorFile;
54 JCalibration_t calibrationFile;
55 double Tmax_s;
57 size_t threads;
58 int debug;
59
60 try {
61
62 JParser<> zap("Program to perform position pre-fit of shower to data.");
63
64 zap['f'] = make_field(inputFile);
65 zap['o'] = make_field(outputFile);
66 zap['n'] = make_field(numberOfEvents) = JLimit::max();
67 zap['a'] = make_field(detectorFile);
68 zap['+'] = make_field(calibrationFile, "dynamical calibration data") = JPARSER::initialised();
69 zap['T'] = make_field(Tmax_s, "dynamical update time [s]") = 100.0;
70 zap['@'] = make_field(parameters, "fit parameters") = JPARSER::initialised();
71 zap['N'] = make_field(threads, "number of threads") = 0;
72 zap['d'] = make_field(debug) = 1;
73
74 zap(argc, argv);
75 }
76 catch(const exception& error) {
77 FATAL(error.what() << endl);
78 }
79
80
82
84
85 try {
86 load(detectorFile, detector);
87 }
88 catch(const JException& error) {
89 FATAL(error);
90 }
91
92 unique_ptr<JDynamics> dynamics;
93
94 if (!calibrationFile.empty()) {
95 try {
96
97 dynamics.reset(new JDynamics(detector, Tmax_s));
98
99 dynamics->load(calibrationFile);
100 }
101 catch(const exception& error) {
102 FATAL(error.what());
103 }
104 }
105
106 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
107
108 JShowerPrefit fit(parameters, debug);
109
110 outputFile.open();
111 outputFile.put(JMeta(argc, argv));
112
113 JTreeScanner<JDAQEvent, JDAQEvaluator> in (inputFile, inputFile.getLimit());
114
115 {
116
117 JMultiThreadedReconstruction<JShowerPrefit> fits(fit, outputFile, threads, 2 * threads);
118
119 while (in.hasNext()) {
120
121 STATUS("event: " << setw(10) << in.getCounter() << '\r'); DEBUG(endl);
122
123 const JDAQEvent* tev = in.next();
124
125 if (dynamics) {
126
127 dynamics->update(*tev);
128
129 }
130
131 auto input = fit.getInput(router, *tev, dynamics ? dynamics->getCoverage() : coverage_type());
132
133 if (threads > 0)
134 fits.enqueue(input);
135 else
136 outputFile.put(fit(input));
137
138 outputFile.put(*tev);
139 }
140 STATUS(endl);
141 }
142
144
145 io >> outputFile;
146
147 outputFile.close();
148}
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:74
#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.
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,...
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.
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
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