Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JShowerFit.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 JShowerFit.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 45 of file JShowerFit.cc.

45 {
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;
54 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
55
56
57 JParallelFileScanner_t inputFile;
59 JShowerFitParameters_t parameters;
60 JLimit_t& numberOfEvents = inputFile.getLimit();
61 string detectorFile;
62 JCalibration_t calibrationFile;
63 double Tmax_s;
64 string pdfFile;
65 JEnergyCorrection correct;
66 JPMTParametersMap pmtParameters;
67 size_t threads; // number of parallel threads
68 int debug;
69
70 try {
71
72 JParser<> zap;
73
74 zap['f'] = make_field(inputFile) ;
75 zap['o'] = make_field(outputFile) = "JORCAShowerFit_Output.root";
76 zap['a'] = make_field(detectorFile) ;
77 zap['+'] = make_field(calibrationFile) = JPARSER::initialised();
78 zap['T'] = make_field(Tmax_s) = 100.0;
79 zap['F'] = make_field(pdfFile) ;
80 zap['P'] = make_field(pmtParameters, "PMT simulation data (or corresponding file name)") = JPARSER::initialised();
81 zap['E'] = make_field(correct) = JEnergyCorrection();
82 zap['@'] = make_field(parameters) = JPARSER::initialised();
83 zap['n'] = make_field(numberOfEvents) = JLimit::max();
84 zap['N'] = make_field(threads) = 0;
85 zap['d'] = make_field(debug) = 2;
86
87 zap(argc, argv);
88 }
89 catch(const exception& error) {
90 FATAL(error.what() << endl);
91 }
92
93
95
97
98 try {
99 load(detectorFile, detector);
100 }
101 catch(const JException& error) {
102 FATAL(error);
103 }
104
105 unique_ptr<JDynamics> dynamics;
106
107 if (!calibrationFile.empty()) {
108
109 try {
110
111 dynamics.reset(new JDynamics(detector, Tmax_s));
112
113 dynamics->load(calibrationFile);
114 }
115 catch(const exception& error) {
116 FATAL(error.what());
117 }
118 }
119
120 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
121
122 JSummaryFileRouter summary(inputFile);
123
124 outputFile.open();
125 outputFile.put(JMeta(argc, argv));
126
127 {
128
129 const JShowerFit::storage_type storage(pdfFile, JTimeRange(parameters.TMin_ns, parameters.TMax_ns));
130 JShowerFit fit(parameters, storage, pmtParameters, correct, debug);
131
132 JMultiThreadedReconstruction<JShowerFit> fits(fit, outputFile, threads, 2 * threads);
133
134 while (inputFile.hasNext()) {
135
136 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
137
138 multi_pointer_type ps = inputFile.next();
139
140 JDAQEvent* tev = ps;
141 JFIT::JEvt* in = ps;
142
143 summary.update(*tev);
144
145 if (dynamics) {
146 dynamics->update(*tev);
147 }
148
149 auto input = fit.getInput(router, summary, *tev, *in, dynamics ? dynamics->getCoverage() : coverage_type());
150
151 if (threads > 0)
152 fits.enqueue(input);
153 else
154 outputFile.put(fit(input));
155 }
156 STATUS(endl);
157 }
158
160
161 io >> outputFile;
162
163 outputFile.close();
164}
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.
Auxiliary class for map of PMT parameters.
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
Auxiliary class for correction of energy determined by JEnergy.cc.
Thread pool for event-by-event reconstruction.
class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA
Definition JShowerFit.hh:65
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.
File router for fast addressing of summary data.
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).
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
Data structure for fit parameters.
double TMax_ns
maximum time for local coincidences [ns]
double TMin_ns
minimum time for local coincidences [ns]
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