Skip to content

Commit 51c1aad

Browse files
authored
[PWGEM/Dilepton] fix isBestMatch for global muons (#14527)
1 parent 64d78fd commit 51c1aad

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,11 @@ struct associateSameMFT {
12551255
if (global_muon.globalIndex() == muon.globalIndex()) { // don't store myself.
12561256
continue;
12571257
}
1258-
if (global_muon.collisionId() == muon.collisionId()) {
1259-
self_Ids.emplace_back(global_muon.globalIndex());
1260-
}
1258+
self_Ids.emplace_back(global_muon.globalIndex());
1259+
1260+
// if (global_muon.collisionId() == muon.collisionId()) {
1261+
// self_Ids.emplace_back(global_muon.globalIndex());
1262+
// }
12611263
}
12621264
em_same_mft_ids(self_Ids);
12631265
self_Ids.clear();

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)