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
269
270 buffer_type::iterator p = __end;
271 buffer_type::iterator q =
copy(dataL0.begin(), dataL0.end(), p);
272
273 for (buffer_type::iterator i = p; i != q; ++i) {
274
276
277 i->rotate(R);
278
279 if (match1D.count(*i,
data.begin(), __end) != 0) {
280 *p = *i;
281 ++p;
282 }
283 }
284 }
285
287 }
288
289
290 if (
distance(
data.begin(), __end) <= NUMBER_OF_PARAMETERS) {
291 continue;
292 }
293
294
295
296
298 double chi2 = numeric_limits<double>::max();
299 int NDF =
distance(
data.begin(), __end) - NUMBER_OF_PARAMETERS;
301
302 try {
303
305
306 (*this)(
data.begin(), __end);
307
310
312
313 tz = *this;
315 }
316 catch(const exception& error) {
317 continue;
318 }
319
320
321
322
324
326
327 if (number_of_outliers > NDF - 1) {
328 number_of_outliers = NDF - 1;
329 }
330
332
334
336
337 buffer_type::iterator __end1 = prev(__end,
n);
338
339 do {
340
341 try {
342
343 (*this)(
data.begin(), __end1);
344
347
349
351
353
354 WARNING(endl <<
"JMuonPrefit: invalid chi2 " << y << endl);
355
356 } else {
357
358 if (y < 0.0) {
360 }
361
362 if (y < ymin) {
364 tz = *this;
365 chi2 = ymin;
366 NDF =
distance(
data.begin(), __end1) - NUMBER_OF_PARAMETERS;
368 }
369 }
370 }
371 catch(const exception& error) {}
372
374 }
375
376 } else {
377
378 const int number_of_outliers = NDF - 1;
379
380 for (
int n = 1;
n <= number_of_outliers; ++
n) {
381
382 double ymax = 0.0;
383 int k = -1;
384
385 for (
size_t i = 0; i !=
Y.size(); ++i) {
386
388
389 if (y > ymax) {
391 k = i;
392 }
393 }
394
396 break;
397 }
398
399 try {
400
402
403 this->update(
data.begin(), __end,
V);
404
406
407 tz = *this;
409 NDF -= 1;
411 }
412 catch(const exception& error) {
413 break;
414 }
415 }
416 }
417
419
421
422
423
426 }
427
428
430
431 JEvt::iterator __end = out.end();
432
434
435 __end = out.begin();
436
438
439 JEvt::iterator p2 =
p1;
440
441 for (JEvt::iterator i =
p1; i != out.end(); ++i) {
443 p2 = i;
444 }
445 }
446
448
450
452
453 sort(
p1, out.end(), pointing);
454
455 for (double Q = p2->getQ();
460 }
461
462 swap(*(__end++), *p2);
463 }
464
465 } else {
466
468
470 }
471
473
475 }
476
477 out.erase(__end, out.end());
478
479 } else {
480
482 }
483
484 return out;
485 }
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 from any Jpp application
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
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