Fit function.
220 {
223
225
227
230
231 data.reserve(dataL0.size() +
232 dataL1.size());
233
235
237
238 for (JOmega3D_t::const_iterator dir =
omega.begin(); dir !=
omega.end(); ++dir) {
239
241
242
243 buffer_type::iterator __end =
copy(dataL1.begin(), dataL1.end(),
data.begin());
244
245 for (buffer_type::iterator i =
data.begin(); i != __end; ++i) {
246 i->rotate(R);
247 }
248
249
250
251
253
254 buffer_type::iterator __p =
data.begin();
255
257
258 partial_sort(
data.begin(), __p, __end,
cmz);
259
260 __end = __p;
261 }
262
263
264
265
267
271
272 buffer_type::iterator p = __end;
273 buffer_type::iterator q =
copy(dataL0.begin(), dataL0.end(), p);
274
275 for (buffer_type::iterator i = p; i != q; ++i) {
276
278
279 i->rotate(R);
280
281 if (match1D.count(*i,
data.begin(), __end) != 0) {
282 *p = *i;
283 ++p;
284 }
285 }
286 }
287
289 }
290
291
292 if (
distance(
data.begin(), __end) <= NUMBER_OF_PARAMETERS) {
293 continue;
294 }
295
296
297
298
300 double chi2 = numeric_limits<double>::max();
301 int NDF =
distance(
data.begin(), __end) - NUMBER_OF_PARAMETERS;
303
304 try {
305
307
308 (*this)(
data.begin(), __end);
309
312
314
315 tz = *this;
317 }
318 catch(const exception& error) {
319 continue;
320 }
321
322
323
324
326
328
329 if (number_of_outliers > NDF - 1) {
330 number_of_outliers = NDF - 1;
331 }
332
334
336
338
339 buffer_type::iterator __end1 = prev(__end,
n);
340
341 do {
342
343 try {
344
345 (*this)(
data.begin(), __end1);
346
349
351
353
355
356 WARNING(endl <<
"JMuonPrefit: invalid chi2 " << y << endl);
357
358 } else {
359
360 if (y < 0.0) {
362 }
363
364 if (y < ymin) {
366 tz = *this;
367 chi2 = ymin;
368 NDF =
distance(
data.begin(), __end1) - NUMBER_OF_PARAMETERS;
370 }
371 }
372 }
373 catch(const exception& error) {}
374
376 }
377
378 } else {
379
380 const int number_of_outliers = NDF - 1;
381
382 for (
int n = 1;
n <= number_of_outliers; ++
n) {
383
384 double ymax = 0.0;
385 int k = -1;
386
387 for (
size_t i = 0; i !=
Y.size(); ++i) {
388
390
391 if (y > ymax) {
393 k = i;
394 }
395 }
396
398 break;
399 }
400
401 try {
402
404
405 this->update(
data.begin(), __end,
V);
406
408
409 tz = *this;
411 NDF -= 1;
413 }
414 catch(const exception& error) {
415 break;
416 }
417 }
418 }
419
421
423
424
425
428 }
429
430
432
433 JEvt::iterator __end = out.end();
434
436
437 __end = out.begin();
438
440
441 JEvt::iterator p2 =
p1;
442
443 for (JEvt::iterator i =
p1; i != out.end(); ++i) {
445 p2 = i;
446 }
447 }
448
450
452
454
455 sort(
p1, out.end(), pointing);
456
457 for (double Q = p2->getQ();
462 }
463
464 swap(*(__end++), *p2);
465 }
466
467 } else {
468
470
472 }
473
475
477 }
478
479 out.erase(__end, out.end());
480
481 } else {
482
484 }
485
486 return out;
487 }
Data structure for fit of straight line paralel to z-axis.
void set(const JVector3D &pos, T __begin, T __end, const double alpha, const double sigma)
Set co-variance matrix.
void set(const JLine1Z &track, T __begin, T __end)
Set time residual vector.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Auxiliary class to compare fit results with respect to a reference direction (e.g....
int getModuleID() const
Get module identifier.
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration of this event
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration of this event
double getChi2(const double P)
Get chi2 corresponding to given probability.
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
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.
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=SINGLE_STAGE)
Get fit.
JEvt::iterator gridify(JEvt::iterator __begin, JEvt::iterator __end, const int N)
Gridify set of fits.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
JHitIterator_t clusterize(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match, const int Nmin=1)
Partition data according given binary match operator.
void update(const size_t k, const double value)
Update inverted matrix at given diagonal element.
void invert()
Invert matrix according LDU decomposition.
size_t numberOfPostfits
number of postfits
size_t numberOfPrefits
number of prefits
int numberOfOutliers
maximum number of outliers
double Qwatershed
minimal quality step
int factoryLimit
factory limit for combinatorics
int NMaxHits
maximal number of hits
double sigma_ns
time resolution [ns]
static constexpr double STANDARD_DEVIATIONS
number of standard deviations for outlier removal [unit]
static const struct JRECONSTRUCTION::JMuonPrefit::cmz cmz