Fit function.
229 {
232
234
236
237
238
240
242
243 if (!in.empty()) {
245 }
246
247 for (JEvt::const_iterator track = in.begin(); track != in.end(); ++track) {
248
250
251
252
254
256
259 }
260
263
264 double zmin = numeric_limits<double>::lowest();
265
268 }
269
271
272 for (const auto& module : input.data) {
273
275
276 pos.transform(R, tz.getPosition());
277
279
280 const double z1 = pos.getZ() - pos.getX() /
getTanThetaC();
282
283 if (z1 >= zmin) {
284
285 for (size_t i = 0; i != module->size(); ++i) {
286
287 if (module.getStatus(i)) {
288
289 const struct {
290
292 {
293 return (hit.
getPMT() == pmt && T_ns(hit.
getT()));
294 }
295
297 const size_t pmt;
298
299 } match = { T_ns + t1, i };
300
302
304
305 const size_t ns = count_if(module.begin(), module.end(), match);
306 const double QE = wip.
QE;
308
309 JPMT pmt =
module->getPMT(i);
310
312
313 const JNPE npe = this->
getNPE(pmt, module.frame.getRate(i));
314
315 const JNPEHit hit(npe, ns, QE, ps);
316
317 DEBUG(
"hit: " << setw(8) << module->getID() <<
'.' <<
FILL(2,
'0') << i <<
' '
319 <<
FIXED(7,3) << module.frame.getRate(i) * 1.0e-3 <<
' '
324 << setw(2) << hit.
getN() <<
' '
325 <<
FIXED(6,3) << hit.getQE() <<
' '
326 <<
FIXED(6,3) << hit.getPS() << endl);
327
329 }
330 }
331 }
332 }
333 }
334
336
337 if (NDF >= 0) {
338
339
340
341 const int N = 5;
342
344
345 for (int i = 0; i != N; ++i) {
347 }
348
350
351 do {
352
354
355 for (int i = 0; i != N; ++i) {
356
358
360 const double chi2 = (*this)(
x,
data.begin(),
data.end());
361
363 buffer[chi2] =
x.getE();
364 }
365
368 }
369 }
370
371
372 for (int i = 0; i != N; ++i) {
374 }
376
377
378
380
381 case 0:
385 break;
386
387 case 1:
390 break;
391
392 case 2:
395 break;
396
397 case 3:
400 break;
401
402 case 4:
406 break;
407 }
408
411
413
414
416
419
420 }
421
422 const double chi2 =
result[2].chi2;
423 const double E =
result[2].x.getE();
424
425
426
427 double Emin = numeric_limits<double>::max();
428 double Emax = numeric_limits<double>::lowest();
429
431 if (i->second < Emin) { Emin = i->second; }
432 if (i->second > Emax) { Emax = i->second; }
433 }
434
435 const double mu_range =
gWater(E);
436
437 double noise_likelihood = 0.0;
438 int number_of_hits = 0;
439
440 for (vector<JNPEHit>::const_iterator i =
data.begin(); i !=
data.end(); ++i) {
441 noise_likelihood += log10(
getP(i->getY0(), i->getN()));
442 number_of_hits += i->getN();
443 }
444
445 fit.push_back(event());
446
447
448
450
451 out.push_back(fit);
452
453
454
465 }
466 }
467
468
469
471
472 copy(input.in.begin(), input.in.end(), back_inserter(out));
473
474 return out;
475 }
#define DEBUG(A)
Message macros.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for PMT parameters.
double QE
relative quantum efficiency
Data structure for PMT geometry, calibration and status.
Data structure for fit of energy.
Data structure for fit of straight line paralel to z-axis.
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
Data structure for position in three dimensions.
double getY() const
Get y position.
double getX() const
Get x position.
JEvt operator()(const input_type &input)
Fit function.
Reduced data structure for L0 hit.
JPMT_t getPMT() const
Get PMT.
int getN() const
Get count.
double getT() const
Get calibrated time of hit.
static const int JSTART_ZMAX_M
end position of track see JRECONSTRUCTION::JMuonStart
static const int JENERGY_NDF
number of degrees of freedom see JRECONSTRUCTION::JMuonEnergy
static const int JENERGY_ENERGY
uncorrected energy [GeV] see JRECONSTRUCTION::JMuonEnergy
static const int JENERGY_NOISE_LIKELIHOOD
log likelihood of every hit being K40 see JRECONSTRUCTION::JMuonEnergy
static const int JENERGY_CHI2
chi2 see JRECONSTRUCTION::JMuonEnergy
static const int JENERGY_MUON_RANGE_METRES
range of a muon with the reconstructed energy [m] see JRECONSTRUCTION::JMuonEnergy
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration of this event
static const int JENERGY_NUMBER_OF_HITS
number of hits see JRECONSTRUCTION::JMuonEnergy
static const int JSTART_LENGTH_METRES
distance between projected positions on the track of optical modules for which the response does not ...
static const int JSTART_ZMIN_M
start position of track see JRECONSTRUCTION::JMuonStart
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration of this event
static const int JENERGY_MINIMAL_ENERGY
minimal energy [GeV] see JRECONSTRUCTION::JMuonEnergy
static const int JENERGY_MAXIMAL_ENERGY
maximal energy [GeV] see JRECONSTRUCTION::JMuonEnergy
double getNPE(const Hit &hit)
Get true charge of hit.
double getP(const double E1, const double E2, const double ED, const int M_min, const int M_max)
Get coincidence probability of two PMTs within one module due to random background.
double getSurvivalProbability(const JPMTParameters ¶meters)
Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assu...
T pow(const T &x, const double y)
Power .
double getKappaC()
Get average R-dependence of arrival time of Cherenkov light (a.k.a.
const double getInverseSpeedOfLight()
Get inverse speed of light.
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
JPosition3D getPosition(const JFit &fit)
Get position.
void copy(const JFIT::JEvt::const_iterator __begin, const JFIT::JEvt::const_iterator __end, Evt &out)
Copy tracks.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
JDirection3D getDirection(const JFit &fit)
Get direction.
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
Auxiliary class to test history.
Auxiliary class for simultaneously handling light yields and response of PMT.
Auxiliary class for handling various light yields.
size_t numberOfPrefits
number of prefits
double resolution
energy resolution [log10(GeV)]
double EMin_log
minimal energy [log10(GeV)]
double ZMin_m
minimal z-position [m]
double EMax_log
maximal energy [log10(GeV)]
Auxiliary data structure for floating point format specification.