Skip to content

Commit 881c5a4

Browse files
committed
PWGEM/Dilepton: fix isBestMatch for global muons
1 parent 32e844a commit 881c5a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

PWGEM/Dilepton/Utils/EMTrackUtilities.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ bool isBestMatch(TTrack const& track, TCut const& cut, TTracks const& tracks)
138138
}
139139
}
140140
}
141-
if (map_chi2MCHMFT.begin()->first == track.globalIndex()) { // search for minimum matching-chi2
141+
142+
auto it = std::min_element(map_chi2MCHMFT.begin(), map_chi2MCHMFT.end(), [](decltype(map_chi2MCHMFT)::value_type& l, decltype(map_chi2MCHMFT)::value_type& r) -> bool { return l.second < r.second; }); // search for minimum matching-chi2
143+
144+
if (it->first == track.globalIndex()) {
142145
map_chi2MCHMFT.clear();
143146
return true;
144147
} else {

0 commit comments

Comments
 (0)