Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JMuonPrefit.cc File Reference

Program to perform linear fits JFIT::JEstimator<JFIT::JLine1Z> covering the solid angle producing JFIT::JEvt data. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to perform linear fits JFIT::JEstimator<JFIT::JLine1Z> covering the solid angle producing JFIT::JEvt data.

Author
mdejong, gmaggi, azegarelli

Definition in file JMuonPrefit.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 47 of file JMuonPrefit.cc.

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