ATLAS Offline Software
Loading...
Searching...
No Matches
SortTracksByHitNumber.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef SORTTRACKSBYHITNUMBER_H
6#define SORTTRACKSBYHITNUMBER_H
7
8#include <functional>
9
11#include "TrkTrack/Track.h"
12
13namespace Muon {
14
16 public:
17 bool operator()(const Trk::Track* tr1, const Trk::Track* tr2) { return this->operator()(*tr1, *tr2); }
18
19 bool operator()(const Trk::Track& tr1, const Trk::Track& tr2) {
20 // prefer tracks with fit quality (always expected)
21 const Trk::FitQuality* fq1 = tr1.fitQuality();
22 const Trk::FitQuality* fq2 = tr2.fitQuality();
23 if (!fq1 && fq2) return false;
24 if (fq1 && !fq2) return true;
25 if (!fq1 && !fq2) return false;
26
27 if (fq1->numberDoF() > fq2->numberDoF()) return true;
28 if (fq1->numberDoF() < fq2->numberDoF()) return false;
29
30 // select candidate with smallest chi2
31 double chi2Ndof1 = fq1->chiSquared() / fq1->numberDoF();
32 double chi2Ndof2 = fq2->chiSquared() / fq2->numberDoF();
33 return chi2Ndof1 < chi2Ndof2;
34 }
35 };
36
38 public:
39 bool operator()(const Trk::Track* tr1, const Trk::Track* tr2) { return this->operator()(*tr1, *tr2); }
40
41 bool operator()(const Trk::Track& tr1, const Trk::Track& tr2) {
42 // prefer tracks with fit quality (always expected)
43 const Trk::FitQuality* fq1 = tr1.fitQuality();
44 const Trk::FitQuality* fq2 = tr2.fitQuality();
45 if (!fq1 && fq2) return false;
46 if (fq1 && !fq2) return true;
47 if (!fq1 && !fq2) return false;
48
49 // select candidate with smallest chi2
50 double chi2Ndof1 = fq1->chiSquared() / fq1->numberDoF();
51 double chi2Ndof2 = fq2->chiSquared() / fq2->numberDoF();
52 return chi2Ndof1 < chi2Ndof2;
53 }
54 };
55} // namespace Muon
56
57#endif
bool operator()(const Trk::Track &tr1, const Trk::Track &tr2)
bool operator()(const Trk::Track *tr1, const Trk::Track *tr2)
bool operator()(const Trk::Track &tr1, const Trk::Track &tr2)
bool operator()(const Trk::Track *tr1, const Trk::Track *tr2)
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition FitQuality.h:97
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.