From 9f1e6f88602df120f42a70116105320a16bc4958 Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Wed, 4 Sep 2024 12:43:27 +0200 Subject: [PATCH] Patch for VertexException --- .../MuonBeamspotConstraintValueMapProducer.cc | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc b/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc index 74459f475cb0c..f7983cc516938 100644 --- a/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc +++ b/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc @@ -66,14 +66,19 @@ class MuonBeamspotConstraintValueMapProducer : public edm::global::EDProducer<> // SingleTrackVertexConstraint uses the width for the constraint, // not the error) if ((BeamWidthXError / BeamWidthX < 0.3) && (BeamWidthYError / BeamWidthY < 0.3)) { - SingleTrackVertexConstraint::BTFtuple btft = - stvc.constrain(ttkb->build(muon.muonBestTrack()), *beamSpotHandle); - if (std::get<0>(btft)) { - const reco::Track& trkBS = std::get<1>(btft).track(); - pts.push_back(trkBS.pt()); - ptErrs.push_back(trkBS.ptError()); - chi2s.push_back(std::get<2>(btft)); - tbd = false; + try { + SingleTrackVertexConstraint::BTFtuple btft = + stvc.constrain(ttkb->build(muon.muonBestTrack()), *beamSpotHandle); + + if (std::get<0>(btft)) { + const reco::Track& trkBS = std::get<1>(btft).track(); + pts.push_back(trkBS.pt()); + ptErrs.push_back(trkBS.ptError()); + chi2s.push_back(std::get<2>(btft)); + tbd = false; + } + } catch (const VertexException& exc) { + // Update failed; give up. } } }