Skip to content
Snippets Groups Projects
Commit ce30b716 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'IMultiStateMaterialEffects_cache' into 'master'

GSF tidy up a bit the caches

See merge request atlas/athena!35594
parents 34e67be0 a67523b8
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @file GsfExtrapolator.h * @file GsfExtrapolator.h
* @date Tuesday 25th January 2005 * @date Tuesday 25th January 2005
* @author Tom Athkinson, Anthony Morley, Christos Anastopoulos * @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 * AlgTool inheriting from the IMultiStateExtrapolator class
*/ */
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
* Abstract base class for extrapolation of a MultiComponentState * Abstract base class for extrapolation of a MultiComponentState
*/ */
#ifndef TrkIMultiStateExtrapolator_H #ifndef TrkIMultiStateExtrapolator_H
#define TrkIMultiStateExtrapolator_H #define TrkIMultiStateExtrapolator_H
#include "TrkMultiComponentStateOnSurface/MultiComponentState.h"
#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" #include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h"
#include "TrkMultiComponentStateOnSurface/MultiComponentState.h"
#include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkEventPrimitives/ParticleHypothesis.h"
#include "TrkEventPrimitives/PropDirection.h" #include "TrkEventPrimitives/PropDirection.h"
...@@ -49,7 +48,6 @@ struct StateAtBoundarySurface ...@@ -49,7 +48,6 @@ struct StateAtBoundarySurface
const TrackParameters* navigationParameters = nullptr; const TrackParameters* navigationParameters = nullptr;
const TrackingVolume* trackingVolume = nullptr; const TrackingVolume* trackingVolume = nullptr;
/** Update State at Boundary Surface Information */ /** Update State at Boundary Surface Information */
void updateBoundaryInformation(const MultiComponentState* boundaryState, void updateBoundaryInformation(const MultiComponentState* boundaryState,
const TrackParameters* navParameters, const TrackParameters* navParameters,
...@@ -61,7 +59,6 @@ struct StateAtBoundarySurface ...@@ -61,7 +59,6 @@ struct StateAtBoundarySurface
} }
}; };
static const InterfaceID IID_IMultiStateExtrapolator("IMultiStateExtrapolator", static const InterfaceID IID_IMultiStateExtrapolator("IMultiStateExtrapolator",
1, 1,
0); 0);
...@@ -70,53 +67,50 @@ class IMultiStateExtrapolator : virtual public IAlgTool ...@@ -70,53 +67,50 @@ class IMultiStateExtrapolator : virtual public IAlgTool
{ {
public: public:
/** @brief MultiStateExtrapolator cache class. /** @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. * 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. * It to be passed/owned as argument by the tools that call the extrapolator
* Caller of the GSF Extrapolator is needs to ensure that there is one cache per thread */
* to ensure thread safety.
* */
struct Cache 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 Surface* m_recallSurface = nullptr; //!< Surface for recall
const Layer* m_recallLayer = nullptr; //!< Layer for recall const Layer* m_recallLayer = nullptr; //!< Layer for recall
const TrackingVolume* //!< Tracking volume for recall
m_recallTrackingVolume = nullptr; //!< Tracking volume for recall const TrackingVolume* m_recallTrackingVolume = nullptr;
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
std::vector<Trk::IMultiStateMaterialEffects::Cache> // ! < Instance of structure describing the state
m_materialEffectsCaches; //!< Large cache for material effects //!< 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() Cache() { m_materialEffectsCaches.reserve(12); }
{
m_materialEffectsCaches.reserve(72);
}
void reset(){ void reset()
{
m_recall = false; m_recall = false;
m_recallSurface = nullptr; m_recallSurface = nullptr;
m_recallLayer = nullptr; m_recallLayer = nullptr;
m_recallTrackingVolume = nullptr; m_recallTrackingVolume = nullptr;
m_matstates.reset(nullptr); m_matstates.reset(nullptr);
m_stateAtBoundarySurface.updateBoundaryInformation(nullptr,nullptr,nullptr); m_stateAtBoundarySurface.updateBoundaryInformation(
nullptr, nullptr, nullptr);
m_mcsGarbageBin.clear(); m_mcsGarbageBin.clear();
m_tpGarbageBin.clear(); m_tpGarbageBin.clear();
m_materialEffectsCaches.clear(); m_materialEffectsCaches.clear();
}; };
}; };
/** Virtual destructor */ /** Virtual destructor */
virtual ~IMultiStateExtrapolator() = default; virtual ~IMultiStateExtrapolator() = default;
/** AlgTool interface method */ /** AlgTool interface method */
......
...@@ -6,14 +6,13 @@ ...@@ -6,14 +6,13 @@
* @file IMultiStateMaterialEffects.h * @file IMultiStateMaterialEffects.h
* @date Thursday 17th February 2005 * @date Thursday 17th February 2005
* @author Tom Atkinson, Anthony Morley, Christos Anastopoulos * @author Tom Atkinson, Anthony Morley, Christos Anastopoulos
* *
* Abstract base class for defining material * Abstract base class for defining material
* effects including energy loss and multiple scattering for * effects including energy loss and multiple scattering for
* use in the multi-component state environment. These * use in the multi-component state environment. These
* material effects will produce multi-component state * material effects will produce multi-component state
*/ */
#ifndef Trk_IMultiStateMaterialEffects_H #ifndef Trk_IMultiStateMaterialEffects_H
#define Trk_IMultiStateMaterialEffects_H #define Trk_IMultiStateMaterialEffects_H
...@@ -47,11 +46,12 @@ public: ...@@ -47,11 +46,12 @@ public:
deltaParameters.reserve(6); deltaParameters.reserve(6);
deltaCovariances.reserve(6); deltaCovariances.reserve(6);
} }
Cache(Cache&&) = default;
Cache& operator=(Cache&&) = default; Cache(Cache&&) noexcept= default;
~Cache() = default; Cache& operator=(Cache&&) noexcept= default;
Cache(const Cache&) = delete; Cache(const Cache&) noexcept= default;
Cache& operator=(const Cache&) = delete; Cache& operator=(const Cache&) noexcept= default;
~Cache() noexcept= default;
std::vector<double> weights; std::vector<double> weights;
std::vector<double> deltaPs; std::vector<double> deltaPs;
...@@ -61,10 +61,11 @@ public: ...@@ -61,10 +61,11 @@ public:
* "you must use the Eigen::aligned_allocator (not another aligned * "you must use the Eigen::aligned_allocator (not another aligned
* allocator), and #include <Eigen/StdVector>." * allocator), and #include <Eigen/StdVector>."
*/ */
std::vector<AmgVector(5),Eigen::aligned_allocator<AmgVector(5)>> std::vector<AmgVector(5), Eigen::aligned_allocator<AmgVector(5)>>
deltaParameters; deltaParameters;
std::vector<AmgSymMatrix(5), Eigen::aligned_allocator<AmgSymMatrix(5)>> std::vector<AmgSymMatrix(5), Eigen::aligned_allocator<AmgSymMatrix(5)>>
deltaCovariances; deltaCovariances;
void reset() void reset()
{ {
weights.clear(); weights.clear();
...@@ -72,17 +73,14 @@ public: ...@@ -72,17 +73,14 @@ public:
deltaParameters.clear(); deltaParameters.clear();
deltaCovariances.clear(); deltaCovariances.clear();
} }
void resetAndAddDummyValues() void resetAndAddDummyValues()
{ {
reset(); reset();
weights.push_back(1); weights.push_back(1);
deltaPs.push_back(0); deltaPs.push_back(0);
AmgVector(5) newParameters; deltaParameters.emplace_back(AmgVector(5)::Zero());
newParameters.setZero(); deltaCovariances.emplace_back(AmgSymMatrix(5)::Zero());
deltaParameters.push_back( std::move(newParameters) );
AmgSymMatrix(5) newCovarianceMatrix;
newCovarianceMatrix.setZero();
deltaCovariances.push_back( std::move(newCovarianceMatrix) );
} }
}; };
...@@ -99,7 +97,7 @@ public: ...@@ -99,7 +97,7 @@ public:
IMultiStateMaterialEffects::Cache&, IMultiStateMaterialEffects::Cache&,
const ComponentParameters&, const ComponentParameters&,
const MaterialProperties&, const MaterialProperties&,
double, double pathLength,
PropDirection direction = anyDirection, PropDirection direction = anyDirection,
ParticleHypothesis particleHypothesis = nonInteracting) const = 0; ParticleHypothesis particleHypothesis = nonInteracting) const = 0;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment