Skip to content

Commit

Permalink
Merge pull request #45396 from namapane/MBS_fix_140X
Browse files Browse the repository at this point in the history
[14.0.X] Add a protection for pathologic cases in MuonBeamspotConstraintValueMapProducer
  • Loading branch information
cmsbuild authored Jul 8, 2024
2 parents 9331e90 + b3542f0 commit 42a4efd
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 42a4efd

Please sign in to comment.