41 {
42 if (!segments) {
44 return false;
45 }
46 if (segments->
empty()) {
48 return false;
49 }
50 std::vector<MatchResult> matched_segs;
52
53 Muon::MuonSegmentKey trackKeys(
track.measurementsOnTrack()->stdcont());
54
55 Muon::CompareMuonSegmentKeys compareKeys{};
56
57 for (const Trk::Segment* trk_seg : *segments) {
58 const Muon::MuonSegment* muonSegment = dynamic_cast<const Muon::MuonSegment*>(trk_seg);
59 if (!muonSegment) continue;
60 Muon::MuonSegmentKey segmentKeys(*muonSegment);
64 matched_segs.push_back(matchResult);
65 ATH_MSG_DEBUG(
"numberOfMatchedMeasurements = " << matchResult.numberOfMatchedMeasurements);
66 }
67 ATH_MSG_DEBUG(
"Number of matched space-time points = " << matched_segs.size());
68
69
70 for (
unsigned int i = 0;
i < matched_segs.size();
i++) {
72 if (!result_i.isSelected) continue;
73
74 const Muon::MuonSegment* seg_i = result_i.link;
75 int nMatched_i = result_i.numberOfMatchedMeasurements;
77
78 for (unsigned int j = i + 1; j < matched_segs.size(); j++) {
80 if (!result_j.isSelected) continue;
81
82 const Muon::MuonSegment* seg_j = result_j.link;
83 int nMatched_j = result_j.numberOfMatchedMeasurements;
85
86
87
88
91 if (nMatched_j > nMatched_i) {
92 result_i.isSelected = false;
93 } else if (nMatched_j < nMatched_i) {
94 result_j.isSelected = false;
95 } else {
96 if (chi2PerDof_j < chi2PerDof_i)
97 result_i.isSelected = false;
98 else
99 result_j.isSelected = false;
100 }
101
103 if (result_i.isSelected)
105 else
107 }
108 }
109
110 for (MatchResult& matches : matched_segs) {
111 if (matches.isSelected) { assoc_segments.push_back(matches.link); }
112 }
113 std::sort(assoc_segments.begin(), assoc_segments.end(), [
this](
const Muon::MuonSegment*
a,
const Muon::MuonSegment* b) ->
bool {
114 using chamIdx = Muon::MuonStationIndex::ChIndex;
115 chamIdx ch_a = m_idHelperSvc->chamberIndex(m_edmHelperSvc->chamberId(*a));
116 chamIdx ch_b = m_idHelperSvc->chamberIndex(m_edmHelperSvc->chamberId(*b));
117 Muon::MuonStationIndex::StIndex st_a = Muon::MuonStationIndex::toStationIndex(ch_a);
118 Muon::MuonStationIndex::StIndex st_b = Muon::MuonStationIndex::toStationIndex(ch_b);
119 if (st_a != st_b) return st_a < st_b;
121 if (ch_a == chamIdx::CSL || ch_a == chamIdx::CSS || ch_b == chamIdx::CSS || ch_b == chamIdx::CSL)
122 return (ch_a == chamIdx::CSL) + 2 * (ch_a == chamIdx::CSS) > (ch_b == chamIdx::CSL) + 2 * (ch_b == chamIdx::CSS);
123 return ch_a < ch_b;
124 });
125 if (msgLevel(MSG::DEBUG)) {
126 std::stringstream sstr;
127 for (const Muon::MuonSegment*& seg : assoc_segments) {
130 }
131 ATH_MSG_DEBUG(
"Selected segments " << assoc_segments.size() <<
" " << sstr.str());
132 }
133 return true;
134 }
#define ATH_MSG_VERBOSE(x)
bool empty() const noexcept
Returns true if the collection is empty.
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
double chiSquared() const
returns the of the overall track fit
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
const std::string & chName(ChIndex index)
convert ChIndex into a string
std::pair< DCOnTrackVec, DCVec > MatchResult
counts the number of hits shared by the two segments
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
unsigned int intersectionSize
OverlapResult
enum for the overlap result