Skip to content

Commit ca21101

Browse files
committed
PATLeptonTimeLifeInfoProducer: do not throw exception if fit fails
1 parent b20c7aa commit ca21101

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

PhysicsTools/PatAlgos/plugins/PATLeptonTimeLifeInfoProducer.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ class PATLeptonTimeLifeInfoProducer : public edm::stream::EDProducer<> {
5353
static bool fitVertex(const std::vector<reco::TransientTrack>& transTrk, TransientVertex& transVtx) {
5454
if (transTrk.size() < 2)
5555
return false;
56-
KalmanVertexFitter kvf(true);
57-
transVtx = kvf.vertex(transTrk);
58-
return transVtx.hasRefittedTracks() && transVtx.refittedTracks().size() == transTrk.size();
56+
try {
57+
KalmanVertexFitter kvf(true);
58+
transVtx = kvf.vertex(transTrk);
59+
return transVtx.hasRefittedTracks() && transVtx.refittedTracks().size() == transTrk.size();
60+
} catch (VertexException& e) {
61+
edm::LogWarning("PATLeptonTimeLifeInfoProducer") << " fitVertex failed: " << e.what();
62+
return false;
63+
}
5964
}
6065

6166
//--- configuration parameters

0 commit comments

Comments
 (0)