Skip to content

Commit

Permalink
Merge pull request #45243 from namapane/MBS_fix_141X
Browse files Browse the repository at this point in the history
Add protection for pathologic cases in MuonBeamspotConstraintValueMapProducer
  • Loading branch information
cmsbuild authored Jun 29, 2024
2 parents 68816ef + 988554b commit b605a4d
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
#include "RecoVertex/KalmanVertexFit/interface/SingleTrackVertexConstraint.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "RecoVertex/VertexPrimitives/interface/VertexException.h"

class MuonBeamspotConstraintValueMapProducer : public edm::global::EDProducer<> {
public:
Expand Down Expand Up @@ -86,13 +87,17 @@ class MuonBeamspotConstraintValueMapProducer : public edm::global::EDProducer<>
auto pv = pvHandle->at(0);
VertexState pvs = VertexState(GlobalPoint(Basic3DVector<float>(pv.position())), GlobalError(pv.covariance()));

SingleTrackVertexConstraint::BTFtuple btft = stvc.constrain(ttkb->build(muon.muonBestTrack()), pvs);
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()), pvs);
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.
}
}
}
Expand Down

0 comments on commit b605a4d

Please sign in to comment.