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

Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data.

The reconstruction is made at the PMT level.

Author
adomi, vcarretero

Definition in file JShowerPointSimplex.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 44 of file JShowerPointSimplex.cc.

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