19 unsigned int numberOfMatchedMeasurements;
20 bool isSelected{
true};
22 link(link_),
key(key_), numberOfMatchedMeasurements(numberOfMatchedMeasurements_) {}
30 declareInterface<IMuonTrackToSegmentAssociationTool>(
this);
37 return StatusCode::SUCCESS;
41 std::vector<const Muon::MuonSegment*>& assoc_segments)
const {
46 if (segments->
empty()) {
50 std::vector<MatchResult> matched_segs;
59 if (!muonSegment)
continue;
63 MatchResult matchResult(muonSegment, segmentKeys, compareKeys.intersectionSize);
64 matched_segs.push_back(matchResult);
65 ATH_MSG_DEBUG(
"numberOfMatchedMeasurements = " << matchResult.numberOfMatchedMeasurements);
67 ATH_MSG_DEBUG(
"Number of matched space-time points = " << matched_segs.size());
70 for (
unsigned int i = 0;
i < matched_segs.size();
i++) {
72 if (!result_i.isSelected)
continue;
75 int nMatched_i = result_i.numberOfMatchedMeasurements;
78 for (
unsigned int j =
i + 1; j < matched_segs.size(); j++) {
80 if (!result_j.isSelected)
continue;
83 int nMatched_j = result_j.numberOfMatchedMeasurements;
91 if (nMatched_j > nMatched_i) {
92 result_i.isSelected =
false;
93 }
else if (nMatched_j < nMatched_i) {
94 result_j.isSelected =
false;
96 if (chi2PerDof_j < chi2PerDof_i)
97 result_i.isSelected =
false;
99 result_j.isSelected =
false;
102 ATH_MSG_VERBOSE(
"Segments " <<
i <<
" and " << j <<
" have " << compareKeys.intersectionSize <<
"hit(s) in common.");
103 if (result_i.isSelected)
111 if (matches.isSelected) { assoc_segments.push_back(matches.link); }
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);
126 std::stringstream sstr;
131 ATH_MSG_DEBUG(
"Selected segments " << assoc_segments.size() <<
" " << sstr.str());