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 atlas/athena!35095
parents d2250ce7 4ad242ef
...@@ -113,9 +113,15 @@ Trk::GsfSmoother::fit(const EventContext& ctx, ...@@ -113,9 +113,15 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
* We can have single or Multi components here, so we choose what to clone * We can have single or Multi components here, so we choose what to clone
*/ */
const Trk::MultiComponentStateOnSurface* const Trk::MultiComponentStateOnSurface*
smootherPredictionMultiStateOnSurface = nullptr;
// Check if we already have a MultiComponent state
if (smootherPredictionStateOnSurface->variety() ==
Trk::TrackStateOnSurface::MultiComponent) {
smootherPredictionMultiStateOnSurface = smootherPredictionMultiStateOnSurface =
dynamic_cast<const Trk::MultiComponentStateOnSurface*>( static_cast<const Trk::MultiComponentStateOnSurface*>(
smootherPredictionStateOnSurface); smootherPredictionStateOnSurface);
}
if (!smootherPredictionMultiStateOnSurface) { if (!smootherPredictionMultiStateOnSurface) {
ATH_MSG_DEBUG( ATH_MSG_DEBUG(
...@@ -250,7 +256,7 @@ Trk::GsfSmoother::fit(const EventContext& ctx, ...@@ -250,7 +256,7 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
Trk::MultiComponentState extrapolatedState = Trk::MultiComponentState extrapolatedState =
m_extrapolator->extrapolate(ctx, m_extrapolator->extrapolate(ctx,
extrapolatorCache, extrapolatorCache,
updatedState, updatedState,
measurement->associatedSurface(), measurement->associatedSurface(),
Trk::oppositeMomentum, Trk::oppositeMomentum,
...@@ -301,8 +307,14 @@ Trk::GsfSmoother::fit(const EventContext& ctx, ...@@ -301,8 +307,14 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
std::unique_ptr<Trk::MultiComponentState> forwardsMultiStateOwn; std::unique_ptr<Trk::MultiComponentState> forwardsMultiStateOwn;
const Trk::MultiComponentStateOnSurface* forwardsMultiStateOnSurface = const Trk::MultiComponentStateOnSurface* forwardsMultiStateOnSurface =
dynamic_cast<const Trk::MultiComponentStateOnSurface*>( nullptr;
*trackStateOnSurface); // 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) { if (!forwardsMultiStateOnSurface) {
// Create new multiComponentState from single state // Create new multiComponentState from single state
...@@ -368,7 +380,7 @@ Trk::GsfSmoother::fit(const EventContext& ctx, ...@@ -368,7 +380,7 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
if (ccot && trackStateOnSurface == secondLastTrackStateOnSurface) { if (ccot && trackStateOnSurface == secondLastTrackStateOnSurface) {
Trk::MultiComponentState ccotState = Trk::MultiComponentState ccotState =
addCCOT(ctx,updatedStateOnSurface, ccot, smoothedTrajectory.get()); addCCOT(ctx, updatedStateOnSurface, ccot, smoothedTrajectory.get());
if (!ccotState.empty()) { if (!ccotState.empty()) {
updatedState = std::move(ccotState); updatedState = std::move(ccotState);
} }
...@@ -482,8 +494,15 @@ Trk::GsfSmoother::addCCOT(const EventContext& ctx, ...@@ -482,8 +494,15 @@ Trk::GsfSmoother::addCCOT(const EventContext& ctx,
const Trk::CaloCluster_OnTrack* ccot, const Trk::CaloCluster_OnTrack* ccot,
Trk::SmoothedTrajectory* smoothedTrajectory) const 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) { if (!currentMultiStateOS || !ccot) {
return {}; return {};
} }
...@@ -533,13 +552,12 @@ Trk::GsfSmoother::addCCOT(const EventContext& ctx, ...@@ -533,13 +552,12 @@ Trk::GsfSmoother::addCCOT(const EventContext& ctx,
fitQuality.release()); fitQuality.release());
// Extrapolate back to the surface nearest the origin // Extrapolate back to the surface nearest the origin
extrapolatedState = extrapolatedState = m_extrapolator->extrapolateDirectly(ctx,
m_extrapolator->extrapolateDirectly(ctx, updatedState,
updatedState, *currentSurface,
*currentSurface, Trk::oppositeMomentum,
Trk::oppositeMomentum, false,
false, Trk::nonInteracting);
Trk::nonInteracting);
if (extrapolatedState.empty()) { if (extrapolatedState.empty()) {
ATH_MSG_DEBUG("Extrapolation from CCOT to 1st measurement failed .. now " 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