diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 4f8aac33a70..14fdc3b7e2c 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -895,8 +895,8 @@ struct Dilepton { if (cfgApplyWeightTTCA) { weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())]; } + // LOGF(info, "ev_id = %d, t1.sign() = %d, t2.sign() = %d, map_weight[std::make_pair(%d, %d)] = %f", ev_id, t1.sign(), t2.sign(), t1.globalIndex(), t2.globalIndex(), weight); } - // LOGF(info, "ev_id = %d, t1.sign() = %d, t2.sign() = %d, map_weight[std::make_pair(%d, %d)] = %f", ev_id, t1.sign(), t2.sign(), t1.globalIndex(), t2.globalIndex(), weight); ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), leptonM1); ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), leptonM2); @@ -1527,7 +1527,6 @@ struct Dilepton { for (const auto& pairId : passed_pairIds) { auto t1 = tracks.rawIteratorAt(std::get<0>(pairId)); auto t2 = tracks.rawIteratorAt(std::get<1>(pairId)); - // LOGF(info, "std::get<0>(pairId) = %d, std::get<1>(pairId) = %d, t1.globalIndex() = %d, t2.globalIndex() = %d", std::get<0>(pairId), std::get<1>(pairId), t1.globalIndex(), t2.globalIndex()); float n = 1.f; // include myself. for (const auto& ambId1 : t1.ambiguousElectronsIds()) { diff --git a/PWGEM/Dilepton/Utils/EMTrackUtilities.h b/PWGEM/Dilepton/Utils/EMTrackUtilities.h index ddd0a09e52c..0d73276d15d 100644 --- a/PWGEM/Dilepton/Utils/EMTrackUtilities.h +++ b/PWGEM/Dilepton/Utils/EMTrackUtilities.h @@ -137,18 +137,21 @@ bool checkMFTHitMap(T const& track) template bool isBestMatch(TTrack const& track, TCut const& cut, TTracks const& tracks) { - // this is only for muon at forward rapidity + // this is only for global muons at forward rapidity + // Be careful! tracks are fwdtracks per DF. if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { std::map map_chi2MCHMFT; map_chi2MCHMFT[track.globalIndex()] = track.chi2MatchMCHMFT(); // add myself for (const auto& glmuonId : track.globalMuonsWithSameMFTIds()) { const auto& candidate = tracks.rawIteratorAt(glmuonId); - if (candidate.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { - if (cut.template IsSelectedTrack(candidate)) { - map_chi2MCHMFT[candidate.globalIndex()] = candidate.chi2MatchMCHMFT(); + if (track.mchtrackId() != candidate.mchtrackId() && track.mfttrackId() == candidate.mfttrackId()) { + if (candidate.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + if (cut.template IsSelectedTrack(candidate)) { + map_chi2MCHMFT[candidate.globalIndex()] = candidate.chi2MatchMCHMFT(); + } } } - } + } // end of glmuonId 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