diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h index 1334fae9d69713437536362869bd13daf7827e0e..a2aae99c34fe19c8d37adbeaedcda384411df0a2 100755 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h @@ -84,61 +84,61 @@ public: virtual std::unique_ptr<ICache> getCache() const = 0; /** Updator interface (full update for a layer): - The parmeters are given as a pointer, they are delete inside the update + The parameters are given as a pointer, they are delete inside the update method. Layer-based material update */ virtual const TrackParameters* update( ICache& icache, - const TrackParameters* parm, + const TrackParameters* param, const Layer& sf, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** User updator interface (full update for a layer): - The parmeters are given as a pointer, they are deleted inside the update - method. Update occurs on the place where the parameters parm are according - to the specified MaterialEffectsOnTrack + The parameters are given as a pointer owned by the caller. + The returned ptr is owned by the caller */ - virtual const TrackParameters* update( + virtual TrackParameters* update( ICache& icache, - const TrackParameters* parm, + const TrackParameters* param, const MaterialEffectsOnTrack& meff, Trk::ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): - The parmeters are given as a pointer, they are delete inside the update - method. Layer-based material update + The parameters are given as a pointer owned by the caller. + The returned ptr is owned by the caller */ - virtual const TrackParameters* preUpdate( + virtual TrackParameters* preUpdate( ICache& icache, - const TrackParameters* parm, + const TrackParameters* param, const Layer& sf, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): - The parmeters are given as a pointer, they are delete inside the update - method. Layer-based material update if the postUpdate fails, it returns 0 + The parameters are given as a pointer owned by the caller. + The returned ptr is owned by the caller + Layer-based material update if the postUpdate fails, it returns 0 */ - virtual const TrackParameters* postUpdate( + virtual TrackParameters* postUpdate( ICache& icache, - const TrackParameters& parm, + const TrackParameters& param, const Layer& sf, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface: - The parmeters are given as a pointer, they are delete inside the update + The parameters are given as a pointer, they are delete inside the update method. MaterialProperties based material update - used by all Layer-based methods */ - virtual const TrackParameters* update( + virtual TrackParameters* update( ICache& icache, - const TrackParameters& parm, + const TrackParameters& param, const MaterialProperties& mprop, double pathcorrection, PropDirection dir = alongMomentum, @@ -150,58 +150,51 @@ public: /** Model Action:*/ virtual void modelAction(ICache& icache, - const TrackParameters* parm = nullptr) const = 0; + const TrackParameters* param = nullptr) const = 0; /** Updator interface (full update for a layer): - The parmeters are given as a pointer, they are delete inside the update - method. Layer-based material update */ - virtual const TrackParameters* update( - const TrackParameters* parm, + virtual TrackParameters* update( + const TrackParameters* param, const Layer& sf, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** User updator interface (full update for a layer): - The parmeters are given as a pointer, they are deleted inside the update - method. Update occurs on the place where the parameters parm are according - to the specified MaterialEffectsOnTrack */ - virtual const TrackParameters* update( - const TrackParameters* parm, + virtual TrackParameters* update( + const TrackParameters* param, const MaterialEffectsOnTrack& meff, ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): - The parmeters are given as a pointer, they are delete inside the update + The parameters are given as a pointer, they are delete inside the update method. Layer-based material update */ - virtual const TrackParameters* preUpdate( - const TrackParameters* parm, + virtual TrackParameters* preUpdate( + const TrackParameters* param, const Layer& sf, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): - The parmeters are given as a pointer, they are delete inside the update - method. Layer-based material update if the postUpdate fails, it returns 0 */ - virtual const TrackParameters* postUpdate( - const TrackParameters& parm, + + virtual TrackParameters* postUpdate( + const TrackParameters& param, const Layer& sf, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface: - The parmeters are given as a pointer, they are delete inside the update - method. MaterialProperties based material update + MaterialProperties based material update - used by all Layer-based methods */ - virtual const TrackParameters* update( - const TrackParameters& parm, + virtual TrackParameters* update( + const TrackParameters& param, const MaterialProperties& mprop, double pathcorrection, PropDirection dir = alongMomentum, @@ -216,7 +209,7 @@ public: * doing non-local MaterialEffectsUpdates for different models * Optional */ - virtual void modelAction(const TrackParameters* parm = nullptr) const = 0; + virtual void modelAction(const TrackParameters* param = nullptr) const = 0; }; } // end of namespace diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h index 489252c532b886c36d905242df3c897d6782644f..a7c8cc871d978f45b13122f0376f608a5c3b5e4a 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h @@ -47,59 +47,60 @@ class DummyMaterialEffectsUpdator : public AthAlgTool, StatusCode finalize() override; /** Updator interface (full update for a layer): Dummy full update - */ - const TrackParameters* update( const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override; + */ + TrackParameters* update(const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override; /** User updator interface (full update for a layer): The parmeters are given as a pointer, they are deleted inside the update method. Update occurs on the place where the parameters parm are according to the specified MaterialEffectsOnTrack */ - virtual const TrackParameters* update( const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { - (void) meff; - (void)particle; + virtual TrackParameters* update(const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { + (void)meff; + (void)particle; (void)matupmode; - return parm; + return parm->clone(); } /** Updator interface (pre-update for a layer): Dummy pre update - */ - virtual const TrackParameters* preUpdate( const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override; + */ + virtual TrackParameters* preUpdate(const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override; /** Updator interface (post-update for a layer): Dummy post update - */ - virtual const TrackParameters* postUpdate(const TrackParameters& parm, + */ + virtual TrackParameters* postUpdate(const TrackParameters& parm, const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override; + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override; /** Updator interface: The parmeters are given as a pointer, they are delete inside the update method. MaterialProperties based material update - used by all Layer-based methods */ - virtual const TrackParameters* update( const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override; - + virtual TrackParameters* update(const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override; + virtual void validationAction() const override {}; - virtual void modelAction(const TrackParameters* parm=nullptr) const override{ - if(parm) return; + virtual void modelAction(const TrackParameters* parm=nullptr) const override{ + if(parm) return; } typedef IMaterialEffectsUpdator::ICache ICache; @@ -116,66 +117,74 @@ class DummyMaterialEffectsUpdator : public AthAlgTool, return std::make_unique<Cache>(); } - virtual const TrackParameters* update(ICache& icache, const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { + virtual TrackParameters* update(ICache& icache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { (void)icache; - return update(parm,sf,dir,particle,matupmode); - } + return update(parm, sf, dir, particle, matupmode); + } - virtual const TrackParameters* update(ICache& icache, const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - Trk::ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override{ + virtual TrackParameters* update(ICache& icache, + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + Trk::ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { (void)icache; - return update(parm,meff,particle,matupmode); - } + return update(parm, meff, particle, matupmode); + } - virtual const TrackParameters* preUpdate(ICache& icache, const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override{ + virtual TrackParameters* preUpdate(ICache& icache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { (void)icache; - return preUpdate(parm,sf,dir,particle,matupmode); + return preUpdate(parm, sf, dir, particle, matupmode); } - virtual const TrackParameters* postUpdate(ICache& icache,const TrackParameters& parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override{ + virtual TrackParameters* postUpdate(ICache& icache, + const TrackParameters& parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { (void)icache; return postUpdate(parm,sf,dir,particle,matupmode); } - virtual const TrackParameters* update(ICache& icache, const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override{ + virtual TrackParameters* update(ICache& icache, const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir=alongMomentum, + ParticleHypothesis particle=pion, + MaterialUpdateMode matupmode=addNoise) const override{ (void) icache; return update(parm,mprop,pathcorrection,dir,particle,matupmode); } /** Validation Action: */ - virtual void validationAction(ICache& icache) const override { + virtual void validationAction(ICache& icache) const override { (void) icache; - validationAction(); + validationAction(); } /** Model Action:*/ - virtual void modelAction(ICache& icache,const TrackParameters* parm=nullptr) const override{ + virtual void modelAction(ICache& icache,const TrackParameters* parm=nullptr) const override{ (void) icache; - modelAction(parm); - } + modelAction(parm); + } private: @@ -184,7 +193,7 @@ class DummyMaterialEffectsUpdator : public AthAlgTool, bool m_validationMode; //!< boolean switch for the validation mode int m_validationDirectionSwitch; //!< jO switch for PropDirection PropDirection m_validationDirection; //!< distinction between forward and backward validation - ToolHandle< IMaterialMapper > m_materialMapper; //!< the material mapper for recording the layer material + ToolHandle< IMaterialMapper > m_materialMapper; //!< the material mapper for recording the layer material }; } // end of namespace diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h index 148939e7c31e22b918e7909f61e8d0667f9d802f..cdb1f7d0798affc183ee71384e95709cf0ad88fb 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h @@ -44,7 +44,7 @@ class IMaterialMapper; Point-like (also called surface-based) u pdate of TrackParameters and associated errors. - It extends the TrkParametersManipulator, for applying modifications on + It extends the TrkParametersManipulator, for applying modifications on the track parameters: - if the update is done on a pointer to a TrackParameters object, @@ -69,9 +69,6 @@ class MaterialEffectsUpdator : public AthAlgTool, /** AlgTool initailize method.*/ virtual StatusCode initialize() override ; - /** AlgTool finalize method */ - StatusCode finalize() override ; - /* * The concrete cache class for this specialization of the IMaterialEffectsUpdator */ @@ -108,8 +105,8 @@ class MaterialEffectsUpdator : public AthAlgTool, ---> ALWAYS the same pointer is returned the pointer to the same TrackParameters object is returned, it is manipulated (if sf.fullUpdateMaterial()) - */ - virtual const TrackParameters* update(ICache& icache, const TrackParameters* parm, + */ + virtual TrackParameters* update(ICache& icache, const TrackParameters* parm, const Layer& sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, @@ -119,7 +116,7 @@ class MaterialEffectsUpdator : public AthAlgTool, return nullptr; } Cache& cache= static_cast<Cache&> (icache); - const TrackParameters* outparam = updateImpl(cache,parm,sf,dir,particle,matupmode); + TrackParameters* outparam = updateImpl(cache,parm,sf,dir,particle,matupmode); return outparam; } /** Updator interface (full update for a layer) according to user @@ -128,7 +125,7 @@ class MaterialEffectsUpdator : public AthAlgTool, the pointer to the same TrackParameters object is returned, it is manipulated */ - virtual const TrackParameters* update(ICache& icache, + virtual TrackParameters* update(ICache& icache, const TrackParameters* parm, const MaterialEffectsOnTrack& meff, Trk::ParticleHypothesis particle = pion, @@ -140,7 +137,7 @@ class MaterialEffectsUpdator : public AthAlgTool, return nullptr; } Cache& cache = static_cast<Cache&>(icache); - const TrackParameters* outparam = updateImpl(cache, parm, meff, particle, matupmode); + TrackParameters* outparam = updateImpl(cache, parm, meff, particle, matupmode); return outparam; } @@ -149,7 +146,7 @@ class MaterialEffectsUpdator : public AthAlgTool, the pointer to the same TrackParametes object is returned, it is manipulated (if.preUpdateMaterial()) */ - virtual const TrackParameters* preUpdate(ICache& icache, + virtual TrackParameters* preUpdate(ICache& icache, const TrackParameters* parm, const Layer& sf, PropDirection dir = alongMomentum, @@ -161,7 +158,7 @@ class MaterialEffectsUpdator : public AthAlgTool, return nullptr; } Cache& cache = static_cast<Cache&>(icache); - const TrackParameters* outparam = preUpdateImpl(cache, parm, sf, dir, particle, matupmode); + TrackParameters* outparam = preUpdateImpl(cache, parm, sf, dir, particle, matupmode); return outparam; } @@ -169,43 +166,43 @@ class MaterialEffectsUpdator : public AthAlgTool, ---> ALWAYS pointer to new TrackParameters are returned if no postUpdate is to be done : return 0 */ - virtual const TrackParameters* postUpdate( + virtual TrackParameters* postUpdate( ICache& icache, const TrackParameters& parm, const Layer& sf, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const override + MaterialUpdateMode matupmode = addNoise) const override final { if (icache.type() != ICache::MaterialEffects) { ATH_MSG_WARNING("Wrong cache Type"); return nullptr; } Cache& cache = static_cast<Cache&>(icache); - const TrackParameters* outparam = postUpdateImpl(cache, parm, sf, dir, particle, matupmode); + TrackParameters* outparam = postUpdateImpl(cache, parm, sf, dir, particle, matupmode); return outparam; } /** Dedicated Updator interface:-> create new track parameters*/ - virtual const TrackParameters* update(ICache& icache, + virtual TrackParameters* update(ICache& icache, const TrackParameters& parm, const MaterialProperties& mprop, double pathcorrection, PropDirection dir = alongMomentum, ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const override + MaterialUpdateMode matupmode = addNoise) const override final { if (icache.type() != ICache::MaterialEffects) { ATH_MSG_WARNING("Wrong cache Type"); return nullptr; } Cache& cache = static_cast<Cache&>(icache); - const TrackParameters* outparam = + TrackParameters* outparam = updateImpl(cache, parm, mprop, pathcorrection, dir, particle, matupmode); return outparam; } /** Validation Action - calls the writing and resetting of the TTree variables */ - virtual void validationAction(ICache& icache) const override + virtual void validationAction(ICache& icache) const override final { if (icache.type() != ICache::MaterialEffects) { ATH_MSG_WARNING("Wrong cache Type"); @@ -217,7 +214,7 @@ class MaterialEffectsUpdator : public AthAlgTool, /** Only has an effect if m_landauMode == true. Resets mutable variables used for non-local calculation of energy loss if parm == 0. Otherwise, modifies parm with the final update of the covariance matrix*/ - virtual void modelAction(ICache& icache, const TrackParameters* parm = nullptr) const override + virtual void modelAction(ICache& icache, const TrackParameters* parm = nullptr) const override final { if (icache.type() != ICache::MaterialEffects) { @@ -228,110 +225,135 @@ class MaterialEffectsUpdator : public AthAlgTool, } public: - /* + /* * Public methods using the TLS cache. */ - virtual const TrackParameters* update( const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { + virtual TrackParameters* update( + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override final + { Cache& cache = getTLSCache(); - const TrackParameters* outparam = updateImpl(cache,parm,sf,dir,particle,matupmode); + TrackParameters* outparam = + updateImpl(cache, parm, sf, dir, particle, matupmode); return outparam; } - virtual const TrackParameters* update(const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - Trk::ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { + virtual TrackParameters* update( + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + Trk::ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override final + { Cache& cache = getTLSCache(); - const TrackParameters* outparam = updateImpl(cache,parm,meff,particle,matupmode); + TrackParameters* outparam = + updateImpl(cache, parm, meff, particle, matupmode); return outparam; } - virtual const TrackParameters* preUpdate( const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { + virtual TrackParameters* preUpdate( + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override final + { Cache& cache = getTLSCache(); - const TrackParameters* outparam = preUpdateImpl(cache,parm,sf,dir,particle,matupmode); + TrackParameters* outparam = + preUpdateImpl(cache, parm, sf, dir, particle, matupmode); return outparam; } - virtual const TrackParameters* postUpdate(const TrackParameters& parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override{ + virtual TrackParameters* postUpdate( + const TrackParameters& parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override final + { Cache& cache = getTLSCache(); - const TrackParameters* outparam = postUpdateImpl(cache,parm,sf,dir,particle,matupmode); + TrackParameters* outparam = + postUpdateImpl(cache, parm, sf, dir, particle, matupmode); return outparam; } - virtual const TrackParameters* update(const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { + virtual TrackParameters* update( + const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override final + { Cache& cache = getTLSCache(); - const TrackParameters* outparam = updateImpl(cache,parm,mprop,pathcorrection,dir,particle,matupmode); + TrackParameters* outparam = updateImpl( + cache, parm, mprop, pathcorrection, dir, particle, matupmode); return outparam; } - virtual void validationAction() const override{ + virtual void validationAction() const override final + { Cache& cache = getTLSCache(); validationActionImpl(cache); - } + } - virtual void modelAction(const TrackParameters* parm = nullptr) const override { + virtual void modelAction( + const TrackParameters* parm = nullptr) const override final + { Cache& cache = getTLSCache(); - modelActionImpl(cache,parm); - } + modelActionImpl(cache, parm); + } private: - /* The acutal implementation methods using the tool's - * concrete Cache*/ - const TrackParameters* updateImpl(Cache& cache, const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; - - const TrackParameters* updateImpl(Cache& cache, const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - Trk::ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; - - const TrackParameters* preUpdateImpl(Cache& cache, const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; - - const TrackParameters* postUpdateImpl(Cache& cache,const TrackParameters& parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; - - const TrackParameters* updateImpl(Cache& cache, const TrackParameters* parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; - - const TrackParameters* updateImpl(Cache& cache, const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; + /* The acutal implementation methods using the tool's + * concrete Cache*/ + TrackParameters* updateImpl(Cache& cache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + TrackParameters* updateImpl(Cache& cache, + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + Trk::ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + TrackParameters* preUpdateImpl( + Cache& cache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + TrackParameters* postUpdateImpl( + Cache& cache, + const TrackParameters& parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + TrackParameters* updateImpl(Cache& cache, + const TrackParameters* parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + TrackParameters* updateImpl(Cache& cache, + const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; void validationActionImpl(Cache& cache) const; @@ -339,7 +361,7 @@ class MaterialEffectsUpdator : public AthAlgTool, /** A simple check method for the 'removeNoise' update model */ bool checkCovariance(AmgSymMatrix(5)& updated) const ; - const TrackParameters* finalLandauCovarianceUpdate (const TrackParameters* parm) const; + TrackParameters* finalLandauCovarianceUpdate (const TrackParameters* parm) const; /* Private Class members*/ bool m_doCompoundLayerCheck; //!< turn on/off the necessary checks when we may have compound layers @@ -356,7 +378,7 @@ class MaterialEffectsUpdator : public AthAlgTool, // ------------ validation variables ------------------------------------------------- bool m_validationMode; //!< Switch for validation mode bool m_validationIgnoreUnmeasured; //!< Ignore unmeasured TrackParameters (Navigation!) - bool m_landauMode; //!< If in Landau mode, error propagation is done as for landaus + bool m_landauMode; //!< If in Landau mode, error propagation is done as for landaus int m_validationDirection; //!< validation direction // ------------------------------ double m_momentumCut; //!< Minimal momentum cut for update @@ -366,12 +388,12 @@ class MaterialEffectsUpdator : public AthAlgTool, ToolHandle< IEnergyLossUpdator > m_eLossUpdator; //!< AlgoTool for EnergyLoss updates ToolHandle< IMultipleScatteringUpdator > m_msUpdator; //!< AlgoTool for MultipleScatterin effects // the material mapper for the validation process - ToolHandle< IMaterialMapper > m_materialMapper; //!< the material mapper for recording the layer material - + ToolHandle< IMaterialMapper > m_materialMapper; //!< the material mapper for recording the layer material + /* * TLS part - * The solution adopted here is an effort to implement - * "Schmidt, Douglas & Pryce, Nat & H. Harrison, Timothy. (1998). + * The solution adopted here is an effort to implement + * "Schmidt, Douglas & Pryce, Nat & H. Harrison, Timothy. (1998). * Thread-Specific Storage for C/C++ - An Object * Behavioral Pattern for Accessing per-Thread State Efficiently." * Published in "More C++ Gems (SIGS Reference Library)". @@ -379,13 +401,13 @@ class MaterialEffectsUpdator : public AthAlgTool, */ mutable boost::thread_specific_ptr<Cache> m_cache_tls; - Cache& getTLSCache() const{ + Cache& getTLSCache() const{ Cache* cache = m_cache_tls.get(); if (!cache) { cache = new Cache(); m_cache_tls.reset( cache ); } - return *cache; + return *cache; } }; } // end of namespace diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/DummyMaterialEffectsUpdator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/DummyMaterialEffectsUpdator.cxx index 2b1b9a2e7abd0a3a17d2ae5988e835dad90394fe..4a4cf2eef1b7dd82362ca8c12a8b705ae79d9b62 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/src/DummyMaterialEffectsUpdator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/DummyMaterialEffectsUpdator.cxx @@ -34,8 +34,7 @@ Trk::DummyMaterialEffectsUpdator::DummyMaterialEffectsUpdator(const std::string } // destructor -Trk::DummyMaterialEffectsUpdator::~DummyMaterialEffectsUpdator() { -} +Trk::DummyMaterialEffectsUpdator::~DummyMaterialEffectsUpdator() = default; // Athena standard methods // initialize @@ -44,9 +43,9 @@ Trk::DummyMaterialEffectsUpdator::initialize() { if (m_materialMapper.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool " << m_materialMapper); return StatusCode::FAILURE; - } + } ATH_MSG_INFO("Retrieved tool " << m_materialMapper); - + // set the validation switch m_validationDirection = (m_validationDirectionSwitch == 1) ? Trk::alongMomentum : Trk::oppositeMomentum; @@ -62,7 +61,7 @@ Trk::DummyMaterialEffectsUpdator::finalize() { return StatusCode::SUCCESS; } -const Trk::TrackParameters * +Trk::TrackParameters * Trk::DummyMaterialEffectsUpdator::update(const TrackParameters *parm, const Layer &lay, PropDirection, @@ -101,10 +100,10 @@ Trk::DummyMaterialEffectsUpdator::update(const TrackParameters *parm, ATH_MSG_WARNING("update() ... dynamic cast to MaterialProperties failed!"); } } - return parm; + return parm->clone(); } -const Trk::TrackParameters * +Trk::TrackParameters * Trk::DummyMaterialEffectsUpdator::preUpdate(const TrackParameters *parm, const Layer &lay, PropDirection dir, @@ -117,7 +116,7 @@ Trk::DummyMaterialEffectsUpdator::preUpdate(const TrackParameters *parm, double preFactor = lay.preUpdateMaterialFactor(*parm, dir); // return if the preFactor is too small if (preFactor < 0.1) { - return(parm); + return parm->clone(); } double correctionFactor = fabs(lay.surfaceRepresentation().pathCorrection(parm->position(), parm->momentum())); @@ -155,10 +154,10 @@ Trk::DummyMaterialEffectsUpdator::preUpdate(const TrackParameters *parm, ATH_MSG_WARNING("preUpdate() ... dynamic cast to MaterialProperties failed!"); } } - return parm; + return parm->clone(); } -const Trk::TrackParameters * +Trk::TrackParameters * Trk::DummyMaterialEffectsUpdator::postUpdate(const TrackParameters &parm, const Layer &lay, PropDirection dir, @@ -207,7 +206,7 @@ Trk::DummyMaterialEffectsUpdator::postUpdate(const TrackParameters &parm, } // actual update method -const Trk::TrackParameters * +Trk::TrackParameters * Trk::DummyMaterialEffectsUpdator::update(const TrackParameters &parm, const MaterialProperties &, double, diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx index 6e4eb845895185ec637fb4b519d615e3fa3567cd..dd8e97ef1752b5c4ae206a395ca40bb6c226bf2e 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx @@ -8,114 +8,114 @@ // Trk include #include "TrkExTools/MaterialEffectsUpdator.h" -#include "TrkExInterfaces/IEnergyLossUpdator.h" -#include "TrkExInterfaces/IMultipleScatteringUpdator.h" +#include "GaudiKernel/ITHistSvc.h" #include "TrkDetDescrInterfaces/IMaterialMapper.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/DefinedParameter.h" -#include "TrkSurfaces/Surface.h" -#include "TrkGeometry/Layer.h" +#include "TrkEventPrimitives/ParamDefs.h" +#include "TrkExInterfaces/IEnergyLossUpdator.h" +#include "TrkExInterfaces/IMultipleScatteringUpdator.h" +#include "TrkGeometry/AssociatedMaterial.h" #include "TrkGeometry/CompoundLayer.h" +#include "TrkGeometry/Layer.h" #include "TrkGeometry/MaterialProperties.h" -#include "TrkGeometry/AssociatedMaterial.h" #include "TrkGeometry/TrackingVolume.h" -#include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h" #include "TrkMaterialOnTrack/EnergyLoss.h" +#include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h" #include "TrkMaterialOnTrack/ScatteringAngles.h" -#include "GaudiKernel/ITHistSvc.h" +#include "TrkParameters/TrackParameters.h" +#include "TrkSurfaces/Surface.h" // Amg #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" -//std -#include<functional> +// std #include <algorithm> +#include <functional> namespace { const Trk::ParticleMasses s_particleMasses{}; } // constructor -Trk::MaterialEffectsUpdator::MaterialEffectsUpdator(const std::string &t, const std::string &n, const IInterface *p) : - AthAlgTool(t, n, p), +Trk::MaterialEffectsUpdator::MaterialEffectsUpdator(const std::string& t, const std::string& n, const IInterface* p) + : AthAlgTool(t, n, p) + , // TrkParametersManipulator(), - m_doCompoundLayerCheck(false), - m_doEloss(true), - m_doMs(true), - m_forceMomentum(false), - m_xKalmanStraggling(false), - m_useMostProbableEloss(false), - m_msgOutputValidationDirection(true), - m_msgOutputCorrections(false), - m_validationMode(false), - m_validationIgnoreUnmeasured(true), - m_landauMode(false), - m_validationDirection(1), - m_momentumCut(50. * Gaudi::Units::MeV), - m_momentumMax(10. * Gaudi::Units::TeV), - m_forcedMomentum(2000. * Gaudi::Units::MeV), - m_eLossUpdator("Trk::EnergyLossUpdator/AtlasEnergyLossUpdator"), - m_msUpdator("Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator"), - m_materialMapper("Trk::MaterialMapper/AtlasMaterialMapper"){ - declareInterface<IMaterialEffectsUpdator>(this); - // configuration (to be changed to new genconf style) - declareProperty("CheckForCompoundLayers", m_doCompoundLayerCheck); - declareProperty("EnergyLoss", m_doEloss); - declareProperty("EnergyLossUpdator", m_eLossUpdator); - declareProperty("MultipleScattering", m_doMs); - declareProperty("MultipleScatteringUpdator", m_msUpdator); - // the momentum cut for particle interactions - declareProperty("MinimalMomentum", m_momentumCut); - declareProperty("MaximalMomentum", m_momentumMax); - declareProperty("ForceMomentum", m_forceMomentum); - declareProperty("ForcedMomentumValue", m_forcedMomentum); - declareProperty("MostProbableEnergyLoss", m_useMostProbableEloss); - declareProperty("ScreenOutputValidationDirection", m_msgOutputValidationDirection); - declareProperty("ScreenOutputCorrections", m_msgOutputCorrections); - // run vaidation mode true/false - declareProperty("ValidationMode", m_validationMode); - declareProperty("ValidationIgnoreUnmeasured", m_validationIgnoreUnmeasured); - declareProperty("ValidationDirection", m_validationDirection); - declareProperty("ValidationMaterialMapper", m_materialMapper); - declareProperty("LandauMode", m_landauMode); - } + m_doCompoundLayerCheck(false) + , m_doEloss(true) + , m_doMs(true) + , m_forceMomentum(false) + , m_xKalmanStraggling(false) + , m_useMostProbableEloss(false) + , m_msgOutputValidationDirection(true) + , m_msgOutputCorrections(false) + , m_validationMode(false) + , m_validationIgnoreUnmeasured(true) + , m_landauMode(false) + , m_validationDirection(1) + , m_momentumCut(50. * Gaudi::Units::MeV) + , m_momentumMax(10. * Gaudi::Units::TeV) + , m_forcedMomentum(2000. * Gaudi::Units::MeV) + , m_eLossUpdator("Trk::EnergyLossUpdator/AtlasEnergyLossUpdator") + , m_msUpdator("Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator") + , m_materialMapper("Trk::MaterialMapper/AtlasMaterialMapper") +{ + declareInterface<IMaterialEffectsUpdator>(this); + // configuration (to be changed to new genconf style) + declareProperty("CheckForCompoundLayers", m_doCompoundLayerCheck); + declareProperty("EnergyLoss", m_doEloss); + declareProperty("EnergyLossUpdator", m_eLossUpdator); + declareProperty("MultipleScattering", m_doMs); + declareProperty("MultipleScatteringUpdator", m_msUpdator); + // the momentum cut for particle interactions + declareProperty("MinimalMomentum", m_momentumCut); + declareProperty("MaximalMomentum", m_momentumMax); + declareProperty("ForceMomentum", m_forceMomentum); + declareProperty("ForcedMomentumValue", m_forcedMomentum); + declareProperty("MostProbableEnergyLoss", m_useMostProbableEloss); + declareProperty("ScreenOutputValidationDirection", m_msgOutputValidationDirection); + declareProperty("ScreenOutputCorrections", m_msgOutputCorrections); + // run vaidation mode true/false + declareProperty("ValidationMode", m_validationMode); + declareProperty("ValidationIgnoreUnmeasured", m_validationIgnoreUnmeasured); + declareProperty("ValidationDirection", m_validationDirection); + declareProperty("ValidationMaterialMapper", m_materialMapper); + declareProperty("LandauMode", m_landauMode); +} // destructor -Trk::MaterialEffectsUpdator::~MaterialEffectsUpdator() { -} +Trk::MaterialEffectsUpdator::~MaterialEffectsUpdator() = default; // Athena standard methods // initialize StatusCode -Trk::MaterialEffectsUpdator::initialize() { +Trk::MaterialEffectsUpdator::initialize() +{ ATH_MSG_INFO("Minimal momentum cut for material update : " << m_momentumCut << " MeV"); // retrieve the EnergyLoss Updator and Material Effects updator if (m_doEloss) { if (m_eLossUpdator.retrieve().isFailure()) { - ATH_MSG_FATAL( - "Failed to retrieve tool " << m_eLossUpdator << ". No multiple scattering effects will be taken into account."); + ATH_MSG_FATAL("Failed to retrieve tool " << m_eLossUpdator + << ". No multiple scattering effects will be taken into account."); m_doEloss = false; return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("Retrieved tool " << m_eLossUpdator); - - } - else { + } + ATH_MSG_DEBUG("Retrieved tool " << m_eLossUpdator); + + } else { m_eLossUpdator.disable(); } if (m_doMs) { if (m_msUpdator.retrieve().isFailure()) { - ATH_MSG_FATAL("Failed to retrieve tool " << m_msUpdator << - ". No energy loss effects will be taken into account."); + ATH_MSG_FATAL("Failed to retrieve tool " << m_msUpdator + << ". No energy loss effects will be taken into account."); m_doMs = false; return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("Retrieved tool " << m_msUpdator); - - } - else { + } + ATH_MSG_DEBUG("Retrieved tool " << m_msUpdator); + + } else { m_msUpdator.disable(); } @@ -124,48 +124,42 @@ Trk::MaterialEffectsUpdator::initialize() { if (m_materialMapper.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool " << m_materialMapper << ". No material recording."); return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("Retrieved tool " << m_materialMapper); - - } - else { + } + ATH_MSG_DEBUG("Retrieved tool " << m_materialMapper); + + } else { m_materialMapper.disable(); } return StatusCode::SUCCESS; } -// finalize -StatusCode -Trk::MaterialEffectsUpdator::finalize() { - ATH_MSG_DEBUG("finalize() successful"); - return StatusCode::SUCCESS; -} - -const Trk::TrackParameters * -Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm, - const Layer &lay, +Trk::TrackParameters* +Trk::MaterialEffectsUpdator::updateImpl(Cache& cache, + const TrackParameters* parm, + const Layer& lay, PropDirection dir, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // no material properties - pass them back if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss) || !lay.isOnLayer(parm->position())) { - return(parm); + return parm->clone(); } // get the quantities - const Trk::MaterialProperties *mprop = lay.fullUpdateMaterialProperties(*parm); + const Trk::MaterialProperties* mprop = lay.fullUpdateMaterialProperties(*parm); if (!mprop) { - return(parm); + return parm->clone(); } // get the real pathlength double pathCorrection = fabs(lay.surfaceRepresentation().pathCorrection(parm->position(), parm->momentum())); // set the output if restricted to the direction - bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; + bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; // -------------------------------------------------------------------------------------------------- if (msgLvl(MSG::VERBOSE) && outputFlag) { @@ -174,34 +168,33 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm double eta = parm->momentum().eta(); double sX0 = mprop->thicknessInX0(); double tX0 = pathCorrection * mprop->thicknessInX0(); - ATH_MSG_VERBOSE( - " [M] full material update, layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index " << - lay.layerIndex()); - ATH_MSG_VERBOSE( - " thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": " << pathCorrection << - ")"); + ATH_MSG_VERBOSE(" [M] full material update, layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index " + << lay.layerIndex()); + ATH_MSG_VERBOSE(" thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": " + << pathCorrection << ")"); } // -------------------------------------------------------------------------------------------------- - if (m_validationMode){ - cache.validationLayer = &lay ; + if (m_validationMode) { + cache.validationLayer = &lay; } - return(updateImpl(cache,parm, *mprop, pathCorrection, dir, particle, matupmode)); + return (updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode)); } -const Trk::TrackParameters * -Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm, - const MaterialEffectsOnTrack &meff, +Trk::TrackParameters* +Trk::MaterialEffectsUpdator::updateImpl(Cache& cache, + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // no material properties - pass them back // TODO, if the parm doesn't have a surface (i.e. its in // curvilinear) then should we fall through? if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss) || parm->associatedSurface() != meff.associatedSurface()) { - return(parm); + return parm->clone(); } - // get the kinematics double p = parm->momentum().mag(); double updateMomentum = (m_forceMomentum) ? m_forcedMomentum : p; @@ -209,7 +202,7 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm double E = sqrt(p * p + m * m); double beta = p / E; - double pathcorrection = 1.; // Trick the MultipleScatteringUpdator interface + double pathcorrection = 1.; // Trick the MultipleScatteringUpdator interface double energyLoss = 0; double energyLossSigma = 0; @@ -226,11 +219,11 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm // Landaus mpvs don't just add, if in Landau mode we need to do a different update if (m_landauMode && cache.accumulatedElossSigma != 0 && energyLossSigma != 0) { if (energyLoss > 0) { - energyLoss += energyLossSigma * log(1 + cache.accumulatedElossSigma / (energyLossSigma)) - +cache.accumulatedElossSigma * log(1 + energyLossSigma / cache.accumulatedElossSigma); + energyLoss += energyLossSigma * std::log(1 + cache.accumulatedElossSigma / (energyLossSigma)) + + cache.accumulatedElossSigma * std::log(1 + energyLossSigma / cache.accumulatedElossSigma); } else { - energyLoss -= energyLossSigma * log(1 + cache.accumulatedElossSigma / energyLossSigma) - + cache.accumulatedElossSigma * log(1 + energyLossSigma / cache.accumulatedElossSigma); + energyLoss -= energyLossSigma * std::log(1 + cache.accumulatedElossSigma / energyLossSigma) + + cache.accumulatedElossSigma * std::log(1 + energyLossSigma / cache.accumulatedElossSigma); } cache.accumulatedElossSigma += energyLossSigma; } else if (m_landauMode) { @@ -255,9 +248,9 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm // check if Parameters are measured parameters // the updatedParameters - first a copy - const Trk::TrackParameters *mpars = parm; + const Trk::TrackParameters* mpars = parm; AmgVector(5) updatedParameters(mpars->parameters()); - AmgSymMatrix(5) * updatedCovariance = nullptr; + AmgSymMatrix(5)* updatedCovariance = nullptr; // initialize ErrorMatrix pointer if (m_validationMode && !m_validationIgnoreUnmeasured) { // the new CovarianceMatrix - a copy first @@ -275,10 +268,10 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm MaterialProperties mprop(meff.thicknessInX0(), 1., 1., 0., 0., 0.); angularVariation = m_msUpdator->sigmaSquare(mprop, updateMomentum, pathcorrection, Trk::muon); // sigmaDeltaPhiSq = angularVariation/(parm->sinTheta()*parm->sinTheta()); - sigmaDeltaPhiSq = angularVariation / - (sin(parm->parameters()[Trk::theta]) * sin(parm->parameters()[Trk::theta])); + sigmaDeltaPhiSq = + angularVariation / (std::sin(parm->parameters()[Trk::theta]) * std::sin(parm->parameters()[Trk::theta])); sigmaDeltaThetaSq = angularVariation; - }else { + } else { // material update from mefots -> D.L. sigmaDeltaPhiSq = meff.scatteringAngles()->sigmaDeltaPhi(); sigmaDeltaPhiSq *= sigmaDeltaPhiSq; @@ -297,18 +290,16 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::theta, Trk::theta), sign, sigmaDeltaThetaSq); if (!m_xKalmanStraggling && !m_landauMode) { COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::qOverP, Trk::qOverP), sign, sigmaQoverPSq); - }else if (m_xKalmanStraggling) { /* to be filled in*/ - }else if (m_landauMode) { + } else if (m_xKalmanStraggling) { /* to be filled in*/ + } else if (m_landauMode) { // subtract what we added up till now and add what we should add up till now // Landau's 68% limit is approx 1.6*sigmaParameter /* Get the TLS to a local here once and use it for calculation*/ - (*updatedCovariance)(Trk::qOverP, - Trk::qOverP) -= sign * - std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), - 2); - (*updatedCovariance)(Trk::qOverP, Trk::qOverP) += sign * std::pow(1.6 * cache.accumulatedElossSigma / (newP * newP), - 2); + (*updatedCovariance)(Trk::qOverP, Trk::qOverP) -= + sign * std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), 2); + (*updatedCovariance)(Trk::qOverP, Trk::qOverP) += + sign * std::pow(1.6 * cache.accumulatedElossSigma / (newP * newP), 2); } // the checks for the remove Noise mode ----------------------------------------------------- if (matupmode == Trk::removeNoise && !checkCovariance(*updatedCovariance)) { @@ -322,27 +313,30 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm // -------------------------------------- screen output -------------------------------------- if (m_msgOutputCorrections) { double sigmaAngle = sqrt(angularVariation); - ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / sin( - parm->parameters()[Trk::theta]) << " / " << sigmaAngle); + ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / std::sin(parm->parameters()[Trk::theta]) << " / " + << sigmaAngle); ATH_MSG_VERBOSE(" deltaP / sigmaQoverP = " << energyLoss << " / " << sigmaQoverP); } // ------------------------------------------------------------------------------------------- } // ----------------------------------------- validation section ---------------------------------- // validation if configured - if (m_validationMode){ - if(cache.validationLayer) { + if (m_validationMode) { + if (cache.validationLayer) { // all you have from MaterialProperties double pathInX0 = meff.thicknessInX0(); Trk::AssociatedMaterial assMatHit(parm->position(), - pathInX0, pathInX0, - 0, 0, 0, 0, + pathInX0, + pathInX0, + 0, + 0, + 0, + 0, pathcorrection, cache.validationLayer->enclosingTrackingVolume(), cache.validationLayer); - // record the Material hit ---------------------------------------------------------------- m_materialMapper->recordMaterialHit(assMatHit, parm->position()); @@ -356,36 +350,40 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm } // ----------------------------------------- validation section ---------------------------------- } - // return parm; updatedParameters[Trk::qOverP] = qOverPnew; - return parm->associatedSurface().createTrackParameters(updatedParameters[Trk::loc1], updatedParameters[Trk::loc2], - updatedParameters[Trk::phi], updatedParameters[Trk::theta], - updatedParameters[Trk::qOverP], updatedCovariance); + return parm->associatedSurface().createTrackParameters(updatedParameters[Trk::loc1], + updatedParameters[Trk::loc2], + updatedParameters[Trk::phi], + updatedParameters[Trk::theta], + updatedParameters[Trk::qOverP], + updatedCovariance); } -const Trk::TrackParameters * -Trk::MaterialEffectsUpdator::preUpdateImpl(Cache& cache,const TrackParameters *parm, - const Layer &lay, +Trk::TrackParameters* +Trk::MaterialEffectsUpdator::preUpdateImpl(Cache& cache, + const TrackParameters* parm, + const Layer& lay, PropDirection dir, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // no material properties - pass the parameters back if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss)) { - return(parm); + return parm->clone(); } // get the split factor double preFactor = lay.preUpdateMaterialFactor(*parm, dir); // return if the preFactor is less than one if (preFactor < 0.01) { - return(parm); + return parm->clone(); } // get the material properties - const Trk::MaterialProperties *mprop = nullptr; + const Trk::MaterialProperties* mprop = nullptr; // set the output if restricted to the validation direction - bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; + bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; mprop = lay.fullUpdateMaterialProperties(*parm); double pathCorrection = fabs(lay.surfaceRepresentation().pathCorrection(parm->position(), parm->momentum())); @@ -393,7 +391,7 @@ Trk::MaterialEffectsUpdator::preUpdateImpl(Cache& cache,const TrackParameters *p // exit if no mprop could be assigned if (!mprop) { - return(parm); + return parm->clone(); } // -------------------------------------------------------------------------------------------------- if (outputFlag) { @@ -402,43 +400,43 @@ Trk::MaterialEffectsUpdator::preUpdateImpl(Cache& cache,const TrackParameters *p double eta = parm->momentum().eta(); double sX0 = mprop->thicknessInX0(); double tX0 = pathCorrection * mprop->thicknessInX0(); - ATH_MSG_VERBOSE( - " [M] pre material update at layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index " << - lay.layerIndex()); - ATH_MSG_VERBOSE( - " thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": " << pathCorrection << - ")"); + ATH_MSG_VERBOSE(" [M] pre material update at layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index " + << lay.layerIndex()); + ATH_MSG_VERBOSE(" thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": " + << pathCorrection << ")"); } // -------------------------------------------------------------------------------------------------- - if(m_validationMode){ - cache.validationLayer = &lay ; + if (m_validationMode) { + cache.validationLayer = &lay; } - return(updateImpl(cache,parm, *mprop, pathCorrection, dir, particle, matupmode)); + return (updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode)); } -const Trk::TrackParameters * -Trk::MaterialEffectsUpdator::postUpdateImpl(Cache& cache,const TrackParameters &parm, - const Layer &lay, +Trk::TrackParameters* +Trk::MaterialEffectsUpdator::postUpdateImpl(Cache& cache, + const TrackParameters& parm, + const Layer& lay, PropDirection dir, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // no material properties - pass the parameters back if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss) || !lay.isOnLayer(parm.position())) { - return(&parm); + return parm.clone(); } // get the quantities - const Trk::MaterialProperties *mprop = nullptr; + const Trk::MaterialProperties* mprop = nullptr; double postFactor = lay.postUpdateMaterialFactor(parm, dir); // no material properties - pass them back if (postFactor < 0.01) { - return(&parm); + return parm.clone(); } // set the output if restricted to the validation direction - bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; + bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; mprop = lay.fullUpdateMaterialProperties(parm); double pathCorrection = fabs(lay.surfaceRepresentation().pathCorrection(parm.position(), parm.momentum())); @@ -446,7 +444,7 @@ Trk::MaterialEffectsUpdator::postUpdateImpl(Cache& cache,const TrackParameters & // exit if no material properties if (!mprop) { - return(&parm); + return parm.clone(); } // -------------------------------------------------------------------------------------------------- @@ -456,31 +454,31 @@ Trk::MaterialEffectsUpdator::postUpdateImpl(Cache& cache,const TrackParameters & double eta = parm.momentum().eta(); double sX0 = mprop->thicknessInX0(); double tX0 = pathCorrection * mprop->thicknessInX0(); - ATH_MSG_VERBOSE( - " [M] post material update, layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index " << - lay.layerIndex()); - ATH_MSG_VERBOSE( - " thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": " << pathCorrection << - ")"); + ATH_MSG_VERBOSE(" [M] post material update, layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index " + << lay.layerIndex()); + ATH_MSG_VERBOSE(" thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": " + << pathCorrection << ")"); } // -------------------------------------------------------------------------------------------------- - if (m_validationMode){ - cache.validationLayer = &lay ; + if (m_validationMode) { + cache.validationLayer = &lay; } - return(updateImpl(cache,parm, *mprop, pathCorrection, dir, particle, matupmode)); + return (updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode)); } // actual update method - manipulation -const Trk::TrackParameters * -Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm, - const MaterialProperties &matprop, +Trk::TrackParameters* +Trk::MaterialEffectsUpdator::updateImpl(Cache& cache, + const TrackParameters* parm, + const MaterialProperties& matprop, double pathcorrection, PropDirection dir, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // no material properties - pass them back if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss)) { - return((parm)); + return parm->clone(); } // get the kinematics @@ -491,15 +489,15 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm double beta = p / E; // set the output if restricted to the validation direction - bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; + bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; // no material update below/above a certain cut value if (p > m_momentumCut && p < m_momentumMax) { // get the delta of the Energy - EnergyLoss *energyLoss = (m_doEloss) ? - m_eLossUpdator->energyLoss(matprop, updateMomentum, pathcorrection, dir, particle, - m_useMostProbableEloss) : - nullptr; + EnergyLoss* energyLoss = + (m_doEloss) + ? m_eLossUpdator->energyLoss(matprop, updateMomentum, pathcorrection, dir, particle, m_useMostProbableEloss) + : nullptr; // update for mean energy loss double deltaE = energyLoss ? energyLoss->deltaE() : 0; double sigmaDeltaE = energyLoss ? energyLoss->sigmaDeltaE() : 0; @@ -507,14 +505,14 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm if (m_landauMode && cache.accumulatedElossSigma != 0 && sigmaDeltaE != 0) { if (dir == Trk::oppositeMomentum) { - deltaE += sigmaDeltaE * log(1 + cache.accumulatedElossSigma / sigmaDeltaE) - + cache.accumulatedElossSigma * log(1 + sigmaDeltaE / cache.accumulatedElossSigma); + deltaE += sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) + + cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma); } else { - deltaE -= sigmaDeltaE * log(1 + cache.accumulatedElossSigma / sigmaDeltaE) - + cache.accumulatedElossSigma * log(1 + sigmaDeltaE / cache.accumulatedElossSigma); + deltaE -= sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) + + cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma); } cache.accumulatedElossSigma += sigmaDeltaE; - }else if (m_landauMode) { + } else if (m_landauMode) { cache.accumulatedElossSigma += sigmaDeltaE; } @@ -532,11 +530,11 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm // check if Parameters are measured parameters // const Trk::MeasuredTrackParameters* mpars = dynamic_cast<const Trk::MeasuredTrackParameters*>(parm); - const Trk::TrackParameters *mpars = parm; + const Trk::TrackParameters* mpars = parm; AmgVector(5) updatedParameters(mpars->parameters()); // initialize ErrorMatrix pointer // Trk::ErrorMatrix* updatedError = 0; - AmgSymMatrix(5) * updatedCovariance = nullptr; + AmgSymMatrix(5)* updatedCovariance = nullptr; if (mpars || (m_validationMode && !m_validationIgnoreUnmeasured)) { // the new CovarianceMatrix - a copy first if (mpars) { @@ -550,8 +548,8 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm // sign of the noise adding ---------------------------------------------------------------- int sign = int(matupmode); - double sigmaDeltaPhiSq = angularVariation / - (sin(parm->parameters()[Trk::theta]) * sin(parm->parameters()[Trk::theta])); + double sigmaDeltaPhiSq = + angularVariation / (std::sin(parm->parameters()[Trk::theta]) * std::sin(parm->parameters()[Trk::theta])); double sigmaDeltaThetaSq = angularVariation; // checks will only be done in the removeNoise mode COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::phi, Trk::phi), sign, sigmaDeltaPhiSq); @@ -560,19 +558,15 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::qOverP, Trk::qOverP), sign, sigmaQoverP * sigmaQoverP); } else if (m_xKalmanStraggling) { double q = parm->charge(); - COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::qOverP, - Trk::qOverP), sign, 0.2 * deltaP * deltaP * q * q * q * q); + COVARIANCEUPDATEWITHCHECK( + (*updatedCovariance)(Trk::qOverP, Trk::qOverP), sign, 0.2 * deltaP * deltaP * q * q * q * q); } else if (m_landauMode) { // subtract what we added up till now and add what we should add up till now // Landau's 68% limit is approx 1.6*sigmaParameter - (*updatedCovariance)(Trk::qOverP, - Trk::qOverP) -= sign * - std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), - 2); - (*updatedCovariance)(Trk::qOverP, - Trk::qOverP) += sign * - std::pow(1.6 * cache.accumulatedElossSigma / ((p + deltaP) * (p + deltaP)), - 2); + (*updatedCovariance)(Trk::qOverP, Trk::qOverP) -= + sign * std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), 2); + (*updatedCovariance)(Trk::qOverP, Trk::qOverP) += + sign * std::pow(1.6 * cache.accumulatedElossSigma / ((p + deltaP) * (p + deltaP)), 2); } // the checks for the remove Noise mode ----------------------------------------------------- if (matupmode == Trk::removeNoise && !checkCovariance(*updatedCovariance)) { @@ -587,19 +581,17 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm // -------------------------------------- screen output -------------------------------------- if (outputFlag && m_msgOutputCorrections) { double sigmaAngle = sqrt(angularVariation); - ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / sin( - parm->parameters()[Trk::theta]) << " / " << sigmaAngle); + ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / std::sin(parm->parameters()[Trk::theta]) + << " / " << sigmaAngle); ATH_MSG_VERBOSE(" deltaP / sigmaQoverP = " << deltaP << " / " << sigmaQoverP); } // ------------------------------------------------------------------------------------------- } // ----------------------------------------- validation section ---------------------------------- // validation if configured - if (m_validationMode - && dir == Trk::PropDirection(m_validationDirection) - && updatedCovariance) { + if (m_validationMode && dir == Trk::PropDirection(m_validationDirection) && updatedCovariance) { - if (cache.validationLayer){ + if (cache.validationLayer) { // all you have from MaterialProperties double pathInX0 = pathcorrection * matprop.thicknessInX0(); double A = 0.; @@ -607,8 +599,7 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm double rho = 0.; double l0 = 0.; // or better take the extended version for more information - const Trk::MaterialProperties *extProperties - = dynamic_cast<const Trk::MaterialProperties *>(&matprop); + const Trk::MaterialProperties* extProperties = dynamic_cast<const Trk::MaterialProperties*>(&matprop); if (extProperties) { A = extProperties->averageA(); @@ -618,16 +609,18 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm } Trk::AssociatedMaterial assMatHit(parm->position(), - pathInX0, matprop.x0(), - l0, A, Z, rho, + pathInX0, + matprop.x0(), + l0, + A, + Z, + rho, pathcorrection, cache.validationLayer->enclosingTrackingVolume(), cache.validationLayer); - // record the Material hit ---------------------------------------------------------------- - m_materialMapper->recordMaterialHit(assMatHit, - parm->position()); + m_materialMapper->recordMaterialHit(assMatHit, parm->position()); // the steps cache.validationSteps++; cache.validationPhi += parm->position().phi(); @@ -638,26 +631,31 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters *parm } // ----------------------------------------- validation section ---------------------------------- } - // parm = Trk::TrkParametersManipulator::manipulateParameter(parm, qOverPmod, updatedError); updatedParameters[Trk::qOverP] = parm->charge() / (p + deltaP); - parm = parm->associatedSurface().createTrackParameters(updatedParameters[Trk::loc1], updatedParameters[Trk::loc2], - updatedParameters[Trk::phi], updatedParameters[Trk::theta], - updatedParameters[Trk::qOverP], updatedCovariance); + return parm->associatedSurface().createTrackParameters(updatedParameters[Trk::loc1], + updatedParameters[Trk::loc2], + updatedParameters[Trk::phi], + updatedParameters[Trk::theta], + updatedParameters[Trk::qOverP], + updatedCovariance); } - return parm; + //default if we have not returned just above + return parm->clone(); } // actual update method -const Trk::TrackParameters * -Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm, - const MaterialProperties &matprop, +Trk::TrackParameters* +Trk::MaterialEffectsUpdator::updateImpl(Cache& cache, + const TrackParameters& parm, + const MaterialProperties& matprop, double pathcorrection, PropDirection dir, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // no material properties - pass them back if (particle == Trk::geantino || (!m_doMs && !m_doEloss)) { - return(&(parm)); + return parm.clone(); } // get the kinematics @@ -668,7 +666,7 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm double beta = p / E; // set the output if restricted to the validation direction - bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; + bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true; // no material update below or above a certain cut value if (p > m_momentumCut && p < m_momentumMax) { @@ -676,25 +674,25 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm AmgVector(5) updatedParameters(parm.parameters()); // get the delta of the Energy - EnergyLoss *energyLoss = (m_doEloss) ? - m_eLossUpdator->energyLoss(matprop, updateMomentum, pathcorrection, dir, particle, - m_useMostProbableEloss) : - nullptr; + EnergyLoss* energyLoss = + (m_doEloss) + ? m_eLossUpdator->energyLoss(matprop, updateMomentum, pathcorrection, dir, particle, m_useMostProbableEloss) + : nullptr; // update for mean energy loss double deltaE = energyLoss ? energyLoss->deltaE() : 0; double sigmaDeltaE = energyLoss ? energyLoss->sigmaDeltaE() : 0; delete energyLoss; if (m_landauMode && cache.accumulatedElossSigma != 0 && sigmaDeltaE != 0) { if (dir == Trk::oppositeMomentum) { - deltaE += sigmaDeltaE * log(1 + cache.accumulatedElossSigma / sigmaDeltaE) - + cache.accumulatedElossSigma * log(1 + sigmaDeltaE / cache.accumulatedElossSigma); + deltaE += sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) + + cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma); } else { - deltaE -= sigmaDeltaE * log(1 + cache.accumulatedElossSigma / sigmaDeltaE) - + cache.accumulatedElossSigma * log(1 + sigmaDeltaE / cache.accumulatedElossSigma); + deltaE -= sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) + + cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma); } cache.accumulatedElossSigma += sigmaDeltaE; - }else if (m_landauMode) { + } else if (m_landauMode) { cache.accumulatedElossSigma += sigmaDeltaE; } @@ -711,7 +709,7 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm updatedParameters[Trk::qOverP] = parm.charge() / (p + deltaP); // check if Parameters are measured parameters - AmgSymMatrix(5) * updatedCovariance = nullptr; + AmgSymMatrix(5)* updatedCovariance = nullptr; if (parm.covariance() || (m_validationMode && !m_validationIgnoreUnmeasured)) { // the new CovarianceMatrix - a copy first updatedCovariance = new AmgSymMatrix(5)(*parm.covariance()); @@ -722,8 +720,8 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm // sign of the noise adding ---------------------------------------------------------------- int sign = int(matupmode); // checks will only be done in the removeNoise mode - double sigmaDeltaPhiSq = angularVariation / - (sin(parm.parameters()[Trk::theta]) * sin(parm.parameters()[Trk::theta])); + double sigmaDeltaPhiSq = + angularVariation / (std::sin(parm.parameters()[Trk::theta]) * std::sin(parm.parameters()[Trk::theta])); double sigmaDeltaThetaSq = angularVariation; // checks will only be done in the removeNoise mode COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::phi, Trk::phi), sign, sigmaDeltaPhiSq); @@ -731,16 +729,13 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm if (!m_xKalmanStraggling && !m_landauMode) { COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::qOverP, Trk::qOverP), sign, sigmaQoverP * sigmaQoverP); } else if (m_xKalmanStraggling) { /* to be filled in*/ - }else if (m_landauMode) { + } else if (m_landauMode) { // subtract what we added up till now and add what we should add up till now // Landau's 68% limit is best modeled by 1.6*sigmaParameter - (*updatedCovariance)(Trk::qOverP, - Trk::qOverP) -= sign * - std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), - 2); - (*updatedCovariance)(Trk::qOverP, - Trk::qOverP) += sign * - std::pow(1.6 * cache.accumulatedElossSigma / ((p + deltaP) * (p + deltaP)), 2); + (*updatedCovariance)(Trk::qOverP, Trk::qOverP) -= + sign * std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), 2); + (*updatedCovariance)(Trk::qOverP, Trk::qOverP) += + sign * std::pow(1.6 * cache.accumulatedElossSigma / ((p + deltaP) * (p + deltaP)), 2); } // the checks for the remove Noise mode ----------------------------------------------------- @@ -754,16 +749,15 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm // -------------------------------------- if (outputFlag && m_msgOutputCorrections) { double sigmaAngle = sqrt(angularVariation); - ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / sin( - parm.parameters()[Trk::theta]) << " / " << sigmaAngle); + ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / std::sin(parm.parameters()[Trk::theta]) << " / " + << sigmaAngle); ATH_MSG_VERBOSE(" deltaP / sigmaQoverP = " << deltaP << " / " << sigmaQoverP); } // ----------------------------------------- validation section ---------------------------------- // validation if configured - if (m_validationMode - && dir == Trk::PropDirection(m_validationDirection)){ + if (m_validationMode && dir == Trk::PropDirection(m_validationDirection)) { - if(cache.validationLayer) { + if (cache.validationLayer) { // all you have from MaterialProperties double pathInX0 = pathcorrection * matprop.thicknessInX0(); double A = 0.; @@ -771,8 +765,7 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm double rho = 0.; double l0 = 0.; // or better take the extended version for more information - const Trk::MaterialProperties *extProperties - = dynamic_cast<const Trk::MaterialProperties *>(&matprop); + const Trk::MaterialProperties* extProperties = dynamic_cast<const Trk::MaterialProperties*>(&matprop); if (extProperties) { A = extProperties->averageA(); @@ -782,18 +775,18 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm } Trk::AssociatedMaterial assMatHit(parm.position(), - pathInX0, matprop.x0(), + pathInX0, + matprop.x0(), l0, - A, Z, rho, pathcorrection, + A, + Z, + rho, + pathcorrection, cache.validationLayer->enclosingTrackingVolume(), cache.validationLayer); - // record the Material hit ---------------------------------------------------------------- - m_materialMapper->recordMaterialHit(assMatHit, - parm.position()); - - + m_materialMapper->recordMaterialHit(assMatHit, parm.position()); // the steps cache.validationSteps++; @@ -805,29 +798,34 @@ Trk::MaterialEffectsUpdator::updateImpl(Cache& cache,const TrackParameters &parm } // ------------------------------------------validation section ---------------------------------- } - return parm.associatedSurface().createTrackParameters(updatedParameters[Trk::loc1], updatedParameters[Trk::loc2], - updatedParameters[Trk::phi], updatedParameters[Trk::theta], - updatedParameters[Trk::qOverP], updatedCovariance); + return parm.associatedSurface().createTrackParameters(updatedParameters[Trk::loc1], + updatedParameters[Trk::loc2], + updatedParameters[Trk::phi], + updatedParameters[Trk::theta], + updatedParameters[Trk::qOverP], + updatedCovariance); } return parm.clone(); } void -Trk::MaterialEffectsUpdator::validationActionImpl(Cache& cache) const { +Trk::MaterialEffectsUpdator::validationActionImpl(Cache& cache) const +{ cache.validationEta = 0.; cache.validationPhi = 0.; cache.validationSteps = 0; } void -Trk::MaterialEffectsUpdator::modelActionImpl(Cache& cache, const Trk::TrackParameters * /*parm*/) const { +Trk::MaterialEffectsUpdator::modelActionImpl(Cache& cache, const Trk::TrackParameters* /*parm*/) const +{ cache.accumulatedElossSigma = 0; } -bool -Trk::MaterialEffectsUpdator::checkCovariance(AmgSymMatrix(5) &updated) const { - if (updated(Trk::phi, - Trk::phi) > 0. && updated(Trk::theta, Trk::theta) > 0. && updated(Trk::qOverP, Trk::qOverP) > 0.) { +bool Trk::MaterialEffectsUpdator::checkCovariance(AmgSymMatrix(5) & updated) const +{ + if (updated(Trk::phi, Trk::phi) > 0. && updated(Trk::theta, Trk::theta) > 0. && + updated(Trk::qOverP, Trk::qOverP) > 0.) { return true; }