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

Program to perform reconstruction of muon trajectory for ARCA detector. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to perform reconstruction of muon trajectory for ARCA detector.

Author
mdejong

Definition in file JARCAMuonReconstruction.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 49 of file JARCAMuonReconstruction.cc.

50{
51 using namespace std;
52 using namespace JPP;
53 using namespace KM3NETDAQ;
54
57 typedef JMultipleFileScanner<calibration_types> JCalibration_t;
58 typedef JARCAMuonReconstruction JReconstruction_t;
59 typedef JReconstruction_t::JParameters_t JParameters_t;
60 typedef JReconstruction_t::JStorage_t JStorage_t;
61
62 JSingleFileScanner_t inputFile;
64 JLimit_t& numberOfEvents = inputFile.getLimit();
65 string detectorFile;
66 JCalibration_t calibrationFile;
67 double Tmax_s;
68 string pdfFile;
69 JParameters_t parameters;
70 JPMTParametersMap pmtParameters;
71 JEnergyCorrection correct;
72 JK40Rates rates_Hz;
73 size_t threads;
74 int debug;
75
76 try {
77
78 JParser<> zap("Program to perform reconstruction of muon trajectory for ARCA detector.");
79
80 zap['f'] = make_field(inputFile);
81 zap['o'] = make_field(outputFile);
82 zap['n'] = make_field(numberOfEvents) = JLimit::max();
83 zap['a'] = make_field(detectorFile);
84 zap['+'] = make_field(calibrationFile, "dynamical calibration data") = JPARSER::initialised();
85 zap['T'] = make_field(Tmax_s, "dynamical update time [s]") = 100.0;
86 zap['F'] = make_field(pdfFile, "PDFs");
87 zap['@'] = make_field(parameters.properties, "fit parameters") = JPARSER::initialised();
88 zap['P'] = make_field(pmtParameters, "PMT parameters") = JPARSER::initialised();
89 zap['E'] = make_field(correct, "energy correction") = JEnergyCorrection();
90 zap['B'] = make_field(rates_Hz, "coincidence rates [Hz]") = KM3NET::getK40Rates();
91 zap['N'] = make_field(threads, "number of threads") = 0;
92 zap['d'] = make_field(debug) = 1;
93
94 zap(argc, argv);
95 }
96 catch(const exception& error) {
97 FATAL(error.what() << endl);
98 }
99
100
102
104
105 try {
106 load(detectorFile, detector);
107 }
108 catch(const JException& error) {
109 FATAL(error);
110 }
111
112 unique_ptr<JDynamics> dynamics;
113
114 if (!calibrationFile.empty()) {
115
116 try {
117
118 dynamics.reset(new JDynamics(detector, Tmax_s));
119
120 dynamics->load(calibrationFile);
121 }
122 catch(const exception& error) {
123 FATAL(error.what());
124 }
125 }
126
127 outputFile.open();
128 outputFile.put(JMeta(argc, argv));
129
130 JTreeScanner<JDAQEvent, JDAQEvaluator> in(inputFile, inputFile.getLimit());
131
132 {
133 const JModuleRouter router(dynamics ? dynamics->getDetector() : detector);
134
135 JSummaryFileRouter summary(inputFile);
136
137 const JStorage_t storage(pdfFile, parameters);
138
139 JReconstruction_t fit(parameters, storage, rates_Hz, pmtParameters, correct, debug);
140
141 JMultiThreadedReconstruction<JReconstruction_t> fits(fit, outputFile, threads, 2 * threads);
142
143 while (in.hasNext()) {
144
145 STATUS("event: " << setw(10) << in.getCounter() << '\r'); DEBUG(endl);
146
147 const JDAQEvent* tev = in.next();
148
149 summary.update(*tev);
150
151 if (dynamics) {
152 dynamics->update(*tev);
153 }
154
155 auto input = fit.getInput(router, summary, *tev, dynamics ? dynamics->getCoverage() : coverage_type());
156
157 if (threads > 0)
158 fits.enqueue(input);
159 else
160 outputFile.put(fit(input));
161
162 outputFile.put(*tev);
163 }
164 STATUS(endl);
165 }
166
168
169 io >> outputFile;
170
171 outputFile.close();
172}
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.
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.
File router for fast addressing of summary data.
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
const JK40Rates & getK40Rates()
Get K40 rates.
Definition KM3NeT.hh: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 K40 rates.
Definition JK40Rates.hh:41
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
Auxiliary base class for file name.