Skip to content

Commit

Permalink
Merge pull request #31585 from cms-tau-pog/CMSSW_10_6_X_tau-pog_PVref…
Browse files Browse the repository at this point in the history
…itFixForTauRecoAtMini

Protect against ill-defined track momenta and reffited tau vertices for tauReco@mini (10_6_X)
  • Loading branch information
cmsbuild authored Oct 6, 2020
2 parents c921c44 + 405d79f commit 038bee1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ void PFTauMiniAODPrimaryVertexProducer::nonTauTracksInPVFromPackedCands(const si

//Find candidates/tracks associated to thePV
for(const auto& cand: cands){
//MB: Skip candidates with ill-defined momentum as they return ill-defined tracks (why it happens?)
if (!std::isfinite(cand.pt())) continue; //MB: it is enough to check just pt (?)
if(cand.vertexRef().isNull()) continue;
int quality = cand.pvAssociationQuality();
if(cand.vertexRef().key()!=thePVkey ||
Expand Down
7 changes: 7 additions & 0 deletions RecoTauTag/RecoTau/src/PFTauPrimaryVertexProducerBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ void PFTauPrimaryVertexProducerBase::produce(edm::Event& iEvent,const edm::Event
} else {
transVtx = avf.vertex(transTracks, *beamSpot);
}
if (!transVtx.isValid()) {
fitOK = false;
} else {
//MB: protect against rare cases when transVtx is valid but its position is ill-defined
if (!std::isfinite(transVtx.position().z())) //MB: it is enough to check one coordinate (?)
fitOK = false;
}
} else fitOK = false;
if ( fitOK ) thePV = transVtx;
}
Expand Down

0 comments on commit 038bee1

Please sign in to comment.