diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h index 65b36f5be2c1f1ef7ab08bf23538a8c2a2bf4233..3219767c17e91b91a342f702d304d714d482255d 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h @@ -6,7 +6,7 @@ * @file GsfExtrapolator.h * @date Tuesday 25th January 2005 * @author Tom Athkinson, Anthony Morley, Christos Anastopoulos - * Extrapolation of MultiComponentState class. It is an + * Extrapolation of MultiComponentState class. It is an * AlgTool inheriting from the IMultiStateExtrapolator class */ diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h index 3d2d7084c795959a9dcc744144a6aa63a7ded006..6a33bf2581f06b35791891670d6d0cd858e8246f 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h @@ -9,12 +9,11 @@ * Abstract base class for extrapolation of a MultiComponentState */ - #ifndef TrkIMultiStateExtrapolator_H #define TrkIMultiStateExtrapolator_H -#include "TrkMultiComponentStateOnSurface/MultiComponentState.h" #include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" +#include "TrkMultiComponentStateOnSurface/MultiComponentState.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkEventPrimitives/PropDirection.h" @@ -49,7 +48,6 @@ struct StateAtBoundarySurface const TrackParameters* navigationParameters = nullptr; const TrackingVolume* trackingVolume = nullptr; - /** Update State at Boundary Surface Information */ void updateBoundaryInformation(const MultiComponentState* boundaryState, const TrackParameters* navParameters, @@ -61,7 +59,6 @@ struct StateAtBoundarySurface } }; - static const InterfaceID IID_IMultiStateExtrapolator("IMultiStateExtrapolator", 1, 0); @@ -70,53 +67,50 @@ class IMultiStateExtrapolator : virtual public IAlgTool { public: /** @brief MultiStateExtrapolator cache class. - * This object holds information regarding the state of the extrpolation process - * as well as a large store for material effects properties. - * - * The is owned by the tools that call the extrapolatator (Currently the GSFSmoother or Forward fitter) - * and it not exposed to the caller of the track fitter. - * Caller of the GSF Extrapolator is needs to ensure that there is one cache per thread - * to ensure thread safety. - * */ + * + * This object holds information regarding the state of the extrpolation + * process as well as a large store for material effects properties. + * + * It to be passed/owned as argument by the tools that call the extrapolator + */ struct Cache { - bool m_recall = false; //!< Flag the recall solution + bool m_recall = false; //!< Flag the recall solution const Surface* m_recallSurface = nullptr; //!< Surface for recall const Layer* m_recallLayer = nullptr; //!< Layer for recall - const TrackingVolume* - m_recallTrackingVolume = nullptr; //!< Tracking volume for recall - StateAtBoundarySurface - m_stateAtBoundarySurface; //!< Instance of structure describing the state - //!< at a boundary of tracking volumes - std::unique_ptr<std::vector<const Trk::TrackStateOnSurface*>> m_matstates; - std::vector<std::unique_ptr<const MultiComponentState>> - m_mcsGarbageBin; //!< Garbage bin for MultiComponentState objects - std::vector<std::unique_ptr<const TrackParameters>> - m_tpGarbageBin; //!< Garbage bin for TrackParameter objects + //!< Tracking volume for recall + const TrackingVolume* m_recallTrackingVolume = nullptr; - std::vector<Trk::IMultiStateMaterialEffects::Cache> - m_materialEffectsCaches; //!< Large cache for material effects + // ! < Instance of structure describing the state + //!< at a boundary of tracking volumes + StateAtBoundarySurface m_stateAtBoundarySurface; + //!< Large cache for material effects + std::vector<Trk::IMultiStateMaterialEffects::Cache> m_materialEffectsCaches; + std::unique_ptr<std::vector<const Trk::TrackStateOnSurface*>> m_matstates; + //!< Garbage bin for MultiComponentState objects + std::vector<std::unique_ptr<const MultiComponentState>> m_mcsGarbageBin; + //!< Garbage bin for TrackParameter objects + std::vector<std::unique_ptr<const TrackParameters>> m_tpGarbageBin; - Cache() - { - m_materialEffectsCaches.reserve(72); - } + Cache() { m_materialEffectsCaches.reserve(12); } - void reset(){ + void reset() + { m_recall = false; m_recallSurface = nullptr; m_recallLayer = nullptr; m_recallTrackingVolume = nullptr; m_matstates.reset(nullptr); - m_stateAtBoundarySurface.updateBoundaryInformation(nullptr,nullptr,nullptr); + m_stateAtBoundarySurface.updateBoundaryInformation( + nullptr, nullptr, nullptr); m_mcsGarbageBin.clear(); m_tpGarbageBin.clear(); m_materialEffectsCaches.clear(); }; }; - - /** Virtual destructor */ + + /** Virtual destructor */ virtual ~IMultiStateExtrapolator() = default; /** AlgTool interface method */ diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h index 870ee67246dd40e7cba3c32a92608f3de439fb6b..ff8bf5b7ff8bf6ef3e59eb4f9001b8d6cd0e8d53 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h @@ -6,14 +6,13 @@ * @file IMultiStateMaterialEffects.h * @date Thursday 17th February 2005 * @author Tom Atkinson, Anthony Morley, Christos Anastopoulos - * + * * Abstract base class for defining material * effects including energy loss and multiple scattering for * use in the multi-component state environment. These * material effects will produce multi-component state */ - #ifndef Trk_IMultiStateMaterialEffects_H #define Trk_IMultiStateMaterialEffects_H @@ -47,11 +46,12 @@ public: deltaParameters.reserve(6); deltaCovariances.reserve(6); } - Cache(Cache&&) = default; - Cache& operator=(Cache&&) = default; - ~Cache() = default; - Cache(const Cache&) = delete; - Cache& operator=(const Cache&) = delete; + + Cache(Cache&&) noexcept= default; + Cache& operator=(Cache&&) noexcept= default; + Cache(const Cache&) noexcept= default; + Cache& operator=(const Cache&) noexcept= default; + ~Cache() noexcept= default; std::vector<double> weights; std::vector<double> deltaPs; @@ -61,10 +61,11 @@ public: * "you must use the Eigen::aligned_allocator (not another aligned * allocator), and #include <Eigen/StdVector>." */ - std::vector<AmgVector(5),Eigen::aligned_allocator<AmgVector(5)>> + std::vector<AmgVector(5), Eigen::aligned_allocator<AmgVector(5)>> deltaParameters; std::vector<AmgSymMatrix(5), Eigen::aligned_allocator<AmgSymMatrix(5)>> deltaCovariances; + void reset() { weights.clear(); @@ -72,17 +73,14 @@ public: deltaParameters.clear(); deltaCovariances.clear(); } + void resetAndAddDummyValues() { reset(); weights.push_back(1); deltaPs.push_back(0); - AmgVector(5) newParameters; - newParameters.setZero(); - deltaParameters.push_back( std::move(newParameters) ); - AmgSymMatrix(5) newCovarianceMatrix; - newCovarianceMatrix.setZero(); - deltaCovariances.push_back( std::move(newCovarianceMatrix) ); + deltaParameters.emplace_back(AmgVector(5)::Zero()); + deltaCovariances.emplace_back(AmgSymMatrix(5)::Zero()); } }; @@ -99,7 +97,7 @@ public: IMultiStateMaterialEffects::Cache&, const ComponentParameters&, const MaterialProperties&, - double, + double pathLength, PropDirection direction = anyDirection, ParticleHypothesis particleHypothesis = nonInteracting) const = 0; };