63{
67
69 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
71
72 JParallelFileScanner_t inputFile;
75 string detectorFile;
76 string pdfFile;
77 double roadWidth_m;
78 double QE;
79 double R_Hz;
80 size_t numberOfPrefits;
81 double TTS_ns;
82 double E_GeV;
84
85 try {
86
87 JParser<> zap(
"Program to perform fit of muon path to data.");
88
94 zap[
'R'] =
make_field(roadWidth_m) = numeric_limits<double>::max();
101
102 zap(argc, argv);
103 }
104 catch(const exception& error) {
105 FATAL(error.what() << endl);
106 }
107
108
110
111 try {
113 }
116 }
117
119
120
123
124
126
128
129 JRegressor_t::debug =
debug;
130 JRegressor_t::Vmax_npe = 10.0;
131 JRegressor_t::MAXIMUM_ITERATIONS = 10000;
132
134
135 fit.transform(JRegressor_t::transformer_type::getDefaultTransformer());
136
138
139 fit.parameters.resize(4);
140
145
146 if (fit.getRmax() < roadWidth_m) {
147
148 roadWidth_m = fit.getRmax();
149
150 WARNING(
"Set road width to [m] " << roadWidth_m << endl);
151 }
152
153 const double Rmax_m = 100.0;
154 const double Tmax_ns = 10.0;
155
156
158
160
161 while (inputFile.hasNext()) {
162
163 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
164
165 multi_pointer_type ps = inputFile.next();
166
169
172
174
175
176 JDataL0_t dataL0;
177
178 buildL0(*tev, router, true, back_inserter(dataL0));
179
180
181 for (JEvt::const_iterator track = cp.begin(); track != cp.end(); ++track) {
182
186
187
188
190
192
193 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
194
195 JHitW0 hit(*i, 0, QE, R_Hz);
196
197 hit.rotate(R);
198
199 if (match(hit)) {
200
201 top.insert(hit.getPMTIdentifier());
202
203 const double t1 = hit.getT() - tz.getT(hit);
204
205 if (tz.getDistance(hit) <= Rmax_m && t1 >= -Tmax_ns && t1 <= +Tmax_ns) {
206 Z.
include(hit.getZ() - tz.getDistance(hit) / getTanThetaC());
207 }
208 }
209 }
210
211
213
214 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
215
217
218 pos.rotate(R);
219
220 if (tz.getDistance(pos) <= roadWidth_m && Z(pos.getZ() - tz.getDistance(pos) / getTanThetaC())) {
221
222 for (unsigned int i = 0; i != module->size(); ++i) {
223
225
226 JPMT pmt(module->getPMT(i));
227
228 pmt.rotate(R);
229
230 buffer.push_back(
JPMTW0(pmt, QE, R_Hz, top.count(
id)));
231 }
232 }
233 }
234
235
236 const int NDF = buffer.size() - fit.parameters.size();
237
238 if (NDF >= 0) {
239
240
241
242 if (track->getE() > 0.1)
243 fit.E_GeV = track->getE();
244 else
245 fit.E_GeV = E_GeV;
246
247 const double chi2 = fit(
JLine3Z(tz), buffer.begin(), buffer.end());
248
250
251 tb.rotate_back(R);
252
254
255 out.rbegin()->setW(track->getW());
256 }
257 }
258
259
260
262
264 }
266
268
270
272}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Router for direct addressing of module data in detector data structure.
Data structure for PMT geometry, calibration and status.
Data structure for fit of straight line paralel to z-axis.
static parameter_type pY()
static parameter_type pX()
Data structure for fit of straight line in positive z-direction.
static parameter_type pDY()
static parameter_type pDX()
Data structure for position in three dimensions.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Utility class to parse command line options.
Auxiliary class for a hit with background rate value.
General purpose class for parallel reading of objects from a single file or multiple files.
Object reading from a list of files.
JDirection3D getDirection(const Vec &dir)
Get direction.
JPosition3D getPosition(const Vec &pos)
Get position.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
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).
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
JFIT::JRegressor< JFIT::JLine3Z, JFIT::JGandalf > JRegressor_t
KM3NeT DAQ data structures and auxiliaries.
Model for fit to acoustics data.
Auxiliary class for handling PMT geometry, rate and response.
Template definition of a data regressor of given model.
Auxiliary class for defining the range of iterations of objects.
const JLimit & getLimit() const
Get limit.
static counter_type max()
Get maximum counter value.