Skip to content

Commit 89b413b

Browse files
authored
[PWGEM/Dilepton] fix TTCA weighting for global muons (#14853)
1 parent d41eb68 commit 89b413b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

PWGEM/Dilepton/Core/Dilepton.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,8 @@ struct Dilepton {
895895
if (cfgApplyWeightTTCA) {
896896
weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())];
897897
}
898+
// 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);
898899
}
899-
// 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);
900900

901901
ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), leptonM1);
902902
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), leptonM2);
@@ -1527,7 +1527,6 @@ struct Dilepton {
15271527
for (const auto& pairId : passed_pairIds) {
15281528
auto t1 = tracks.rawIteratorAt(std::get<0>(pairId));
15291529
auto t2 = tracks.rawIteratorAt(std::get<1>(pairId));
1530-
// 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());
15311530

15321531
float n = 1.f; // include myself.
15331532
for (const auto& ambId1 : t1.ambiguousElectronsIds()) {

PWGEM/Dilepton/Utils/EMTrackUtilities.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,21 @@ bool checkMFTHitMap(T const& track)
137137
template <bool is_wo_acc = false, typename TTrack, typename TCut, typename TTracks>
138138
bool isBestMatch(TTrack const& track, TCut const& cut, TTracks const& tracks)
139139
{
140-
// this is only for muon at forward rapidity
140+
// this is only for global muons at forward rapidity
141+
// Be careful! tracks are fwdtracks per DF.
141142
if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
142143
std::map<int64_t, float> map_chi2MCHMFT;
143144
map_chi2MCHMFT[track.globalIndex()] = track.chi2MatchMCHMFT(); // add myself
144145
for (const auto& glmuonId : track.globalMuonsWithSameMFTIds()) {
145146
const auto& candidate = tracks.rawIteratorAt(glmuonId);
146-
if (candidate.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
147-
if (cut.template IsSelectedTrack<is_wo_acc>(candidate)) {
148-
map_chi2MCHMFT[candidate.globalIndex()] = candidate.chi2MatchMCHMFT();
147+
if (track.mchtrackId() != candidate.mchtrackId() && track.mfttrackId() == candidate.mfttrackId()) {
148+
if (candidate.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
149+
if (cut.template IsSelectedTrack<is_wo_acc>(candidate)) {
150+
map_chi2MCHMFT[candidate.globalIndex()] = candidate.chi2MatchMCHMFT();
151+
}
149152
}
150153
}
151-
}
154+
} // end of glmuonId
152155

153156
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
154157

0 commit comments

Comments
 (0)