Skip to content

Commit

Permalink
Merge pull request #45394 from kandrosov/PATLeptonTimeLifeInfoProduce…
Browse files Browse the repository at this point in the history
…r-fix_14_X

[14_0_X] Catch VertexException in PATLeptonTimeLifeInfoProducer when fitVertex fails
  • Loading branch information
cmsbuild authored Jul 9, 2024
2 parents a0f8f37 + 317d8e2 commit dfbad95
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions PhysicsTools/PatAlgos/plugins/PATLeptonTimeLifeInfoProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ class PATLeptonTimeLifeInfoProducer : public edm::stream::EDProducer<> {
static bool fitVertex(const std::vector<reco::TransientTrack>& transTrk, TransientVertex& transVtx) {
if (transTrk.size() < 2)
return false;
KalmanVertexFitter kvf(true);
transVtx = kvf.vertex(transTrk);
return transVtx.hasRefittedTracks() && transVtx.refittedTracks().size() == transTrk.size();
try {
KalmanVertexFitter kvf(true);
transVtx = kvf.vertex(transTrk);
return transVtx.hasRefittedTracks() && transVtx.refittedTracks().size() == transTrk.size();
} catch (VertexException& e) {
edm::LogWarning("PATLeptonTimeLifeInfoProducer") << " fitVertex failed: " << e.what();
return false;
}
}

//--- configuration parameters
Expand Down

0 comments on commit dfbad95

Please sign in to comment.