From c0aec63ff9813f1a91dda5e68cd62aea11cf259d Mon Sep 17 00:00:00 2001 From: Slava Krutelyov Date: Sat, 4 Dec 2021 15:05:11 +0100 Subject: [PATCH] check both algo and originalAlgo in electron track isolation calculators --- RecoEgamma/EgammaIsolationAlgos/src/EleTkIsolFromCands.cc | 6 +++++- RecoEgamma/EgammaIsolationAlgos/src/ElectronTkIsolation.cc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EleTkIsolFromCands.cc b/RecoEgamma/EgammaIsolationAlgos/src/EleTkIsolFromCands.cc index d75ac224c5e23..96d1e7f2fc38c 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EleTkIsolFromCands.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EleTkIsolFromCands.cc @@ -180,7 +180,11 @@ bool EleTkIsolFromCands::passQual(const reco::TrackBase& trk, const std::vector< bool EleTkIsolFromCands::passAlgo(const reco::TrackBase& trk, const std::vector& algosToRej) { - return algosToRej.empty() || !std::binary_search(algosToRej.begin(), algosToRej.end(), trk.algo()); + return algosToRej.empty() || + //check also the originalAlgo in case the track is reconstructed by more than one + //reject only if both algo and originalAlgo are not acceptable + !(std::binary_search(algosToRej.begin(), algosToRej.end(), trk.algo()) && + std::binary_search(algosToRej.begin(), algosToRej.end(), trk.originalAlgo())); } EleTkIsolFromCands::TrackTable const& EleTkIsolFromCands::getPreselectedTracks(bool isBarrel) { diff --git a/RecoEgamma/EgammaIsolationAlgos/src/ElectronTkIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/ElectronTkIsolation.cc index 9c30257b53e2c..83603acd1a847 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/ElectronTkIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/ElectronTkIsolation.cc @@ -107,7 +107,11 @@ double ElectronTkIsolation::getPtTracks(const reco::GsfElectron* electron) const bool ElectronTkIsolation::passAlgo(const reco::TrackBase& trk) const { int algo = trk.algo(); bool rejAlgo = std::binary_search(algosToReject_.begin(), algosToReject_.end(), algo); - return rejAlgo == false; + //check also the originalAlgo in case the track is reconstructed by more than one + algo = trk.originalAlgo(); + //reject only if both algo and originalAlgo are not acceptable + rejAlgo &= std::binary_search(algosToReject_.begin(), algosToReject_.end(), algo); + return !rejAlgo; } void ElectronTkIsolation::setAlgosToReject() {