Skip to content

Commit

Permalink
Merge pull request cms-sw#78 from steggema/CMSSW_10_1_X_TauRecoMiniAO…
Browse files Browse the repository at this point in the history
…DReview

Cmssw 10 1 x tau reco mini aod review
  • Loading branch information
steggema committed May 3, 2018
2 parents 4285c06 + cd2db40 commit 3715377
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
8 changes: 4 additions & 4 deletions RecoTauTag/RecoTau/interface/PFRecoTauClusterVariables.h
Expand Up @@ -23,17 +23,17 @@ class TauIdMVAAuxiliaries {
/// return chi2 of the leading track ==> deprecated? <==
float tau_leadTrackChi2(const reco::PFTau& tau) const {
float LeadingTracknormalizedChi2 = 0;
const reco::CandidatePtr& leadingPFCharged = tau.leadChargedHadrCand();
if (leadingPFCharged.isNonnull()) {
const reco::PFCandidate* pfcand = dynamic_cast<const reco::PFCandidate*>(leadingPFCharged.get());
const reco::CandidatePtr& leadingCharged = tau.leadChargedHadrCand();
if (leadingCharged.isNonnull()) {
const reco::PFCandidate* pfcand = dynamic_cast<const reco::PFCandidate*>(leadingCharged.get());
if (pfcand != nullptr) {
reco::TrackRef tref = pfcand->trackRef();
if (tref.isNonnull()) {
LeadingTracknormalizedChi2 = tref->normalizedChi2();
}
}
else {
const pat::PackedCandidate* patcand = dynamic_cast<const pat::PackedCandidate*>(leadingPFCharged.get());
const pat::PackedCandidate* patcand = dynamic_cast<const pat::PackedCandidate*>(leadingCharged.get());
if (patcand != nullptr && patcand->hasTrackDetails()) {
LeadingTracknormalizedChi2 = patcand->pseudoTrack().normalizedChi2();
}
Expand Down
2 changes: 1 addition & 1 deletion RecoTauTag/RecoTau/interface/RecoTauIsolationMasking.h
Expand Up @@ -38,7 +38,7 @@ class RecoTauIsolationMasking {
// Get the energy resoltuion of a gamma or h0 candidate
double resolution(const reco::Candidate& cand) const;
// Check if the candidate is in the correct cone
bool inCone(const reco::Candidate& track,
bool inCone(const reco::PFCandidate& track,
const reco::Candidate& cand) const;

double ecalCone_;
Expand Down
7 changes: 2 additions & 5 deletions RecoTauTag/RecoTau/src/RecoTauIsolationMasking.cc
Expand Up @@ -160,12 +160,9 @@ double RecoTauIsolationMasking::resolution(
return -1;
}

bool RecoTauIsolationMasking::inCone(const reco::Candidate& track,
bool RecoTauIsolationMasking::inCone(const reco::PFCandidate& track,
const reco::Candidate& cand) const {
const reco::PFCandidate* pf_track = dynamic_cast<const reco::PFCandidate*>(&track);
if (pf_track == nullptr)
throw cms::Exception("Type Mismatch") << "The PFTau was not made from PFCandidates, and this outdated algorithm was not updated to cope with PFTaus made from other Candidates.\n";
double openingDR = reco::deltaR(pf_track->positionAtECALEntrance(), cand.p4());
double openingDR = reco::deltaR(track.positionAtECALEntrance(), cand.p4());
if (cand.pdgId() == 130) {
return (openingDR < hcalCone_);
} else if (cand.pdgId() == 22 ||
Expand Down
18 changes: 6 additions & 12 deletions RecoTauTag/TauTagTools/src/TauTagTools.cc
@@ -1,5 +1,4 @@
#include "RecoTauTag/TauTagTools/interface/TauTagTools.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"

using namespace reco;
using std::string;
Expand Down Expand Up @@ -122,18 +121,15 @@ void replaceSubStr(string& s,const string& oldSubStr,const string& newSubStr){
for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=theInitialPFCands.begin();iPFCand!=theInitialPFCands.end();iPFCand++){
if (std::abs((*iPFCand)->pdgId()) == 211 || std::abs((*iPFCand)->pdgId()) == 13 || std::abs((*iPFCand)->pdgId()) == 11){
// *** Whether the charged hadron candidate will be selected or not depends on its rec. tk properties.
const reco::PFCandidate* pfcand = dynamic_cast<const reco::PFCandidate*>(iPFCand->get());
if (pfcand != nullptr) {
TrackRef PFChargedHadrCand_rectk = pfcand->trackRef();

if (!PFChargedHadrCand_rectk)continue;
const reco::Track* PFChargedHadrCand_rectk = (*iPFCand)->bestTrack();
if (PFChargedHadrCand_rectk != nullptr) {
if ((*PFChargedHadrCand_rectk).pt()>=ChargedHadrCand_tkminPt &&
(*PFChargedHadrCand_rectk).normalizedChi2()<=ChargedHadrCand_tkmaxChi2 &&
fabs((*PFChargedHadrCand_rectk).dxy(pv.position()))<=ChargedHadrCand_tkmaxipt &&
(*PFChargedHadrCand_rectk).numberOfValidHits()>=ChargedHadrCand_tkminTrackerHitsn &&
(*PFChargedHadrCand_rectk).hitPattern().numberOfValidPixelHits()>=ChargedHadrCand_tkminPixelHitsn)
filteredPFChargedHadrCands.push_back(*iPFCand);
} else throw cms::Exception("Type Mismatch") << "The PFTau was not made from PFCandidates, and this outdated algorithm was not updated to cope with PFTaus made from other Candidates.\n";
}
}
}
return filteredPFChargedHadrCands;
Expand All @@ -144,18 +140,16 @@ void replaceSubStr(string& s,const string& oldSubStr,const string& newSubStr){
for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=theInitialPFCands.begin();iPFCand!=theInitialPFCands.end();iPFCand++){
if (std::abs((*iPFCand)->pdgId()) == 211 || std::abs((*iPFCand)->pdgId()) == 13 || std::abs((*iPFCand)->pdgId()) == 11){
// *** Whether the charged hadron candidate will be selected or not depends on its rec. tk properties.
const reco::PFCandidate* pfcand = dynamic_cast<const reco::PFCandidate*>(iPFCand->get());
if (pfcand != nullptr) {
TrackRef PFChargedHadrCand_rectk = pfcand->trackRef();
if (!PFChargedHadrCand_rectk)continue;
const reco::Track* PFChargedHadrCand_rectk = (*iPFCand)->bestTrack();
if (PFChargedHadrCand_rectk != nullptr) {
if ((*PFChargedHadrCand_rectk).pt()>=ChargedHadrCand_tkminPt &&
(*PFChargedHadrCand_rectk).normalizedChi2()<=ChargedHadrCand_tkmaxChi2 &&
fabs((*PFChargedHadrCand_rectk).dxy(pv.position()))<=ChargedHadrCand_tkmaxipt &&
(*PFChargedHadrCand_rectk).numberOfValidHits()>=ChargedHadrCand_tkminTrackerHitsn &&
(*PFChargedHadrCand_rectk).hitPattern().numberOfValidPixelHits()>=ChargedHadrCand_tkminPixelHitsn &&
fabs((*PFChargedHadrCand_rectk).dz(pv.position()))<=ChargedHadrCand_tktorefpointmaxDZ)
filteredPFChargedHadrCands.push_back(*iPFCand);
} else throw cms::Exception("Type Mismatch") << "The PFTau was not made from PFCandidates, and this outdated algorithm was not updated to cope with PFTaus made from other Candidates.\n";
}
}
}
return filteredPFChargedHadrCands;
Expand Down

0 comments on commit 3715377

Please sign in to comment.