Skip to content

Commit

Permalink
Merge pull request #39183 from slava77/CMSSW_12_5_0_pre4/kinStateProp…
Browse files Browse the repository at this point in the history
…agator

return invalid planeCrossing to reference points with zero B-field in TrackKinematicStatePropagator
  • Loading branch information
cmsbuild authored Aug 29, 2022
2 parents 4951742 + 6ef3ff4 commit 3cac6aa
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ namespace {
GlobalPoint inPos = state.position();
GlobalVector inMom = state.momentum();
double kappa = state.transverseCurvature();
double fac = state.charge() / state.parameters().magneticFieldInInverseGeV(point).z();
auto bz = state.parameters().magneticFieldInInverseGeV(point).z();
if (std::abs(bz) < 1e-6) {
LogDebug("RecoVertex/TrackKinematicStatePropagator") << "planeCrossing is not possible";
return {HelixBarrelPlaneCrossingByCircle(inPos, inMom, kappa), BoundPlane::BoundPlanePointer()};
}
double fac = state.charge() / bz;

GlobalVectorDouble xOrig2Centre(fac * inMom.y(), -fac * inMom.x(), 0.);
GlobalVectorDouble xOrigProj(inPos.x(), inPos.y(), 0.);
Expand Down Expand Up @@ -58,6 +63,8 @@ bool TrackKinematicStatePropagator::willPropagateToTheTransversePCA(const Kinema
// copied from below...
FreeTrajectoryState const& fState = state.freeTrajectoryState();
std::pair<HelixBarrelPlaneCrossingByCircle, BoundPlane::BoundPlanePointer> cros = planeCrossing(fState, point);
if (cros.second == nullptr)
return false;

HelixBarrelPlaneCrossingByCircle planeCrossing = cros.first;
BoundPlane::BoundPlanePointer plane = cros.second;
Expand All @@ -78,6 +85,8 @@ KinematicState TrackKinematicStatePropagator::propagateToTheTransversePCACharged
FreeTrajectoryState const& fState = state.freeTrajectoryState();
const GlobalPoint& iP = referencePoint;
std::pair<HelixBarrelPlaneCrossingByCircle, BoundPlane::BoundPlanePointer> cros = planeCrossing(fState, iP);
if (cros.second == nullptr)
return KinematicState();

HelixBarrelPlaneCrossingByCircle planeCrossing = cros.first;
BoundPlane::BoundPlanePointer plane = cros.second;
Expand Down

0 comments on commit 3cac6aa

Please sign in to comment.