Fit function.
226 {
229
231
233
234
235
237
239
240 if (!in.empty()) {
242 }
243
244 for (JEvt::const_iterator track = in.begin(); track != in.end(); ++track) {
245
248
249 double zmin = numeric_limits<double>::lowest();
250
253 }
254
256
257 for (const auto& module : input.data) {
258
260
261 pos.transform(R, tz.getPosition());
262
264
265 const double z1 = pos.getZ() - pos.getX() /
getTanThetaC();
267
268 if (z1 >= zmin) {
269
270 for (size_t i = 0; i != module->size(); ++i) {
271
272 if (module.getStatus(i)) {
273
274 const struct {
275
277 {
278 return (hit.
getPMT() == pmt && T_ns(hit.
getT()));
279 }
280
282 const size_t pmt;
283
284 } match = { JRegressor_t::T_ns + t1, i };
285
286 JPMT pmt =
module->getPMT(i);
287
289
290 const JNPEHit hit(this->
getNPE(pmt, module.frame.getRate(i)), count_if(module.begin(), module.end(), match));
291
292 DEBUG(
"hit: " << setw(8) << module->getID() <<
'.' <<
FILL(2,
'0') << i <<
' '
294 <<
FIXED(7,3) << module.frame.getRate(i) * 1.0e-3 <<
' '
299 << setw(2) << hit.
getN() << endl);
300
302 }
303 }
304 }
305 }
306 }
307
309
310 if (NDF >= 0) {
311
312
313
314 const int N = 5;
315
317
318 for (int i = 0; i != N; ++i) {
320 }
321
323
324 do {
325
327
328 for (int i = 0; i != N; ++i) {
329
331
333 const double chi2 = (*this)(
x,
data.begin(),
data.end());
334
336 buffer[chi2] =
x.getE();
337 }
338
341 }
342 }
343
344
345 for (int i = 0; i != N; ++i) {
347 }
349
350
351
353
354 case 0:
358 break;
359
360 case 1:
363 break;
364
365 case 2:
368 break;
369
370 case 3:
373 break;
374
375 case 4:
379 break;
380 }
381
384
386
387
389
392
393 }
394
395 const double chi2 =
result[2].chi2;
396 const double E =
result[2].x.getE();
397
398
399
400 double Emin = numeric_limits<double>::max();
401 double Emax = numeric_limits<double>::lowest();
402
404 if (i->second < Emin) { Emin = i->second; }
405 if (i->second > Emax) { Emax = i->second; }
406 }
407
408 const double mu_range =
gWater(E);
409
410 double noise_likelihood = 0.0;
411 int number_of_hits = 0;
412
413 for (vector<JNPEHit>::const_iterator i =
data.begin(); i !=
data.end(); ++i) {
414 noise_likelihood += log10(
getP(i->getY0(), i->getN()));
415 number_of_hits += i->getN();
416 }
417
419
420 fit.push_back(event());
421
422
423
425
426 out.push_back(fit);
427
428
429
430 out.rbegin()->setW(track->getW());
441 }
442 }
443
444
445
447
448 copy(input.in.begin(), input.in.end(), back_inserter(out));
449
450 return out;
451 }
#define DEBUG(A)
Message macros.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
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.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
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 JMUONENERGY
static const int JENERGY_NDF
number of degrees of freedom from JEnergy.cc
static const int JENERGY_ENERGY
uncorrected energy [GeV] from JEnergy.cc
static const int JENERGY_NOISE_LIKELIHOOD
log likelihood of every hit being K40 from JEnergy.cc
static const int JENERGY_CHI2
chi2 from JEnergy.cc
static const int JENERGY_MUON_RANGE_METRES
range of a muon with the reconstructed energy [m] from JEnergy.cc
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JENERGY_NUMBER_OF_HITS
number of hits from JEnergy.cc
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 JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
static const int JENERGY_MINIMAL_ENERGY
minimal energy [GeV] from JEnergy.cc
static const int JENERGY_MAXIMAL_ENERGY
maximal energy [GeV] from JEnergy.cc
void copy(const Head &from, JHead &to)
Copy header from from to to.
double getNPE(const Hit &hit)
Get true charge of hit.
double getP(const double expval, bool hit)
Get Poisson probability to observe a hit or not for given expectation value for the number of hits.
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.
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.
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.