ATLAS Offline Software
Loading...
Searching...
No Matches
SortSegmentsByNumberOfHits.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 SORTSEGMENTSBYNUMBEROFHITS_H
6#define SORTSEGMENTSBYNUMBEROFHITS_H
7
10
11namespace Muon {
12
14 public:
15 bool operator()(const std::unique_ptr<MuonSegment>& seg1, const std::unique_ptr<MuonSegment>& seg2) {
16 unsigned int nhits1 = seg1->containedMeasurements().size();
17 unsigned int nhits2 = seg2->containedMeasurements().size();
18 if (nhits1 > nhits2) return true;
19 if (nhits1 < nhits2) return false;
20
21 // prefer segments with fit quality (always expected)
22 const Trk::FitQuality* fq1 = seg1->fitQuality();
23 const Trk::FitQuality* fq2 = seg2->fitQuality();
24 if (!fq1 && fq2) return false;
25 if (fq1 && !fq2) return true;
26 if (!fq1 && !fq2) { return true; }
27
28 if (fq1->numberDoF() > fq2->numberDoF()) return true;
29 if (fq1->numberDoF() < fq2->numberDoF()) return false;
30
31 // select candidate with smallest chi2
32 double chi2Ndof1 = fq1->chiSquared() / fq1->numberDoF();
33 double chi2Ndof2 = fq2->chiSquared() / fq2->numberDoF();
34 return chi2Ndof1 < chi2Ndof2;
35 }
36 };
37
38} // namespace Muon
39
40#endif
bool operator()(const std::unique_ptr< MuonSegment > &seg1, const std::unique_ptr< MuonSegment > &seg2)
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
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.