17 const Muon::MuonSegment* link{
nullptr};
18 Muon::MuonSegmentKey key;
19 unsigned int numberOfMatchedMeasurements;
20 bool isSelected{
true};
21 MatchResult(
const Muon::MuonSegment* link_,
const Muon::MuonSegmentKey& key_,
unsigned int numberOfMatchedMeasurements_) :
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++) {
71 MatchResult& result_i = matched_segs[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++) {
79 MatchResult& result_j = matched_segs[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;
103 if (result_i.isSelected)
110 for (MatchResult& matches : matched_segs) {
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);
125 if (msgLevel(MSG::DEBUG)) {
126 std::stringstream sstr;
131 ATH_MSG_DEBUG(
"Selected segments " << assoc_segments.size() <<
" " << sstr.str());
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
bool empty() const noexcept
Returns true if the collection is empty.
Class to cache the identifiers on a segment in sets that can later be used to perform an overlap remo...
This is the common class for 3D segments used in the muon spectrometer.
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
Base class for all TrackSegment implementations, extends the common MeasurementBase.
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
The MuonTagToSegMap is an auxillary construct that links the MuonSegments associated with a combined ...
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
DataVector< Trk::Segment > SegmentCollection
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