Commit ac6c952e authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'GSFSmoother' into 'master'

GSFSmoother: remove a few dynamic_cast

See merge request !35095
parents d2250ce7 4ad242ef
......@@ -113,9 +113,15 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
* We can have single or Multi components here, so we choose what to clone
*/
const Trk::MultiComponentStateOnSurface*
smootherPredictionMultiStateOnSurface = nullptr;
// Check if we already have a MultiComponent state
if (smootherPredictionStateOnSurface->variety() ==
Trk::TrackStateOnSurface::MultiComponent) {
smootherPredictionMultiStateOnSurface =
dynamic_cast<const Trk::MultiComponentStateOnSurface*>(
static_cast<const Trk::MultiComponentStateOnSurface*>(
smootherPredictionStateOnSurface);
}
if (!smootherPredictionMultiStateOnSurface) {
ATH_MSG_DEBUG(
......@@ -250,7 +256,7 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
Trk::MultiComponentState extrapolatedState =
m_extrapolator->extrapolate(ctx,
extrapolatorCache,
extrapolatorCache,
updatedState,
measurement->associatedSurface(),
Trk::oppositeMomentum,
......@@ -301,8 +307,14 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
std::unique_ptr<Trk::MultiComponentState> forwardsMultiStateOwn;
const Trk::MultiComponentStateOnSurface* forwardsMultiStateOnSurface =
dynamic_cast<const Trk::MultiComponentStateOnSurface*>(
*trackStateOnSurface);
nullptr;
// Check if we already have a MultiComponent state on surface
if ((*trackStateOnSurface)->variety() ==
Trk::TrackStateOnSurface::MultiComponent) {
forwardsMultiStateOnSurface =
static_cast<const Trk::MultiComponentStateOnSurface*>(
*trackStateOnSurface);
}
if (!forwardsMultiStateOnSurface) {
// Create new multiComponentState from single state
......@@ -368,7 +380,7 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
if (ccot && trackStateOnSurface == secondLastTrackStateOnSurface) {
Trk::MultiComponentState ccotState =
addCCOT(ctx,updatedStateOnSurface, ccot, smoothedTrajectory.get());
addCCOT(ctx, updatedStateOnSurface, ccot, smoothedTrajectory.get());
if (!ccotState.empty()) {
updatedState = std::move(ccotState);
}
......@@ -482,8 +494,15 @@ Trk::GsfSmoother::addCCOT(const EventContext& ctx,
const Trk::CaloCluster_OnTrack* ccot,
Trk::SmoothedTrajectory* smoothedTrajectory) const
{
const Trk::MultiComponentStateOnSurface* currentMultiStateOS =
dynamic_cast<const Trk::MultiComponentStateOnSurface*>(currentState);
const Trk::MultiComponentStateOnSurface* currentMultiStateOS = nullptr;
// Check if we already have a MultiComponent state
if (currentState->variety() == Trk::TrackStateOnSurface::MultiComponent) {
currentMultiStateOS =
static_cast<const Trk::MultiComponentStateOnSurface*>(currentState);
}
if (!currentMultiStateOS || !ccot) {
return {};
}
......@@ -533,13 +552,12 @@ Trk::GsfSmoother::addCCOT(const EventContext& ctx,
fitQuality.release());
// Extrapolate back to the surface nearest the origin
extrapolatedState =
m_extrapolator->extrapolateDirectly(ctx,
updatedState,
*currentSurface,
Trk::oppositeMomentum,
false,
Trk::nonInteracting);
extrapolatedState = m_extrapolator->extrapolateDirectly(ctx,
updatedState,
*currentSurface,
Trk::oppositeMomentum,
false,
Trk::nonInteracting);
if (extrapolatedState.empty()) {
ATH_MSG_DEBUG("Extrapolation from CCOT to 1st measurement failed .. now "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment