ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::MaterialEffectsUpdator Class Referencefinal

Point-like (also called surface-based) update of TrackParameters and the associated covariance. More...

#include <MaterialEffectsUpdator.h>

Inheritance diagram for Trk::MaterialEffectsUpdator:
Collaboration diagram for Trk::MaterialEffectsUpdator:

Public Types

typedef IMaterialEffectsUpdator::ICache ICache

Public Member Functions

 MaterialEffectsUpdator (const std::string &, const std::string &, const IInterface *)
 AlgTool like constructor.
virtual ~MaterialEffectsUpdator ()
 Virtual destructor.
virtual StatusCode initialize () override
 AlgTool initailize method.
virtual std::unique_ptr< TrackParametersupdate (ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override
 Updator interface (full update for a layer) ---> ALWAYS pointer to new TrackParameters is returned.
virtual std::unique_ptr< TrackParametersupdate (ICache &cache, const TrackParameters *parm, const MaterialEffectsOnTrack &meff, Trk::ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override
 Updator interface (full update for a layer) according to user input through MaterialEffectsOnTrack ---> ALWAYS pointer to new TrackParameters is returned.
virtual std::unique_ptr< TrackParameterspreUpdate (ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override
 Updator interface (pre-update for a layer): ---> ALWAYS pointer to new TrackParameters is returned.
virtual std::unique_ptr< TrackParameterspostUpdate (ICache &cache, const TrackParameters &parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
 Updator interface (post-update for a layer): ---> ALWAYS pointer to new TrackParameters is returned if no postUpdate is to be done : return nullptr.
virtual std::unique_ptr< TrackParametersupdate (ICache &cache, const TrackParameters &parm, const MaterialProperties &mprop, double pathcorrection, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
 Dedicated Updator interface:-> create new track parameters.
virtual void validationAction (ICache &cache) const override final
 Validation Action - calls the writing and resetting of the TTree variables.
virtual void modelAction (ICache &cache, const TrackParameters *parm=nullptr) const override final
 Only has an effect if m_landauMode == true.
virtual std::unique_ptr< TrackParametersupdate (const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
 Updator interface (full update for a layer):
virtual std::unique_ptr< TrackParametersupdate (const TrackParameters *parm, const MaterialEffectsOnTrack &meff, Trk::ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
 User updator interface (full update for a layer):
virtual std::unique_ptr< TrackParameterspreUpdate (const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
 Updator interface (pre-update for a layer):
virtual std::unique_ptr< TrackParameterspostUpdate (const TrackParameters &parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
 Updator interface (pre-update for a layer):
virtual std::unique_ptr< TrackParametersupdate (const TrackParameters &parm, const MaterialProperties &mprop, double pathcorrection, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
 Updator interface: MaterialProperties based material update.
virtual void validationAction () const override final
 Validation Action: outside access to internal validation steps Optional.
virtual void modelAction (const TrackParameters *parm=nullptr) const override final
 Model Action: Provides the possibility of doing non-local MaterialEffectsUpdates for different models Optional.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
virtual ICache getCache () const
 Creates an instance of the cache to be used.

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool and IAlgTool interface methods.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::unique_ptr< TrackParametersupdateImpl (ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
std::unique_ptr< TrackParametersupdateImpl (ICache &cache, const TrackParameters *parm, const MaterialEffectsOnTrack &meff, Trk::ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
std::unique_ptr< TrackParameterspreUpdateImpl (ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
std::unique_ptr< TrackParameterspostUpdateImpl (ICache &cache, const TrackParameters &parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
std::unique_ptr< TrackParametersupdateImpl (ICache &cache, const TrackParameters *parm, const MaterialProperties &mprop, double pathcorrection, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
std::unique_ptr< TrackParametersupdateImpl (ICache &cache, const TrackParameters &parm, const MaterialProperties &mprop, double pathcorrection, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
bool checkCovariance (AmgSymMatrix(5) &updated) const
 A simple check method for the 'removeNoise' update model.
TrackParametersfinalLandauCovarianceUpdate (const TrackParameters *parm) const
ICachegetTLSCache () const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static void validationActionImpl (ICache &cache)
static void modelActionImpl (ICache &cache, const TrackParameters *parm=nullptr)

Private Attributes

BooleanProperty m_doEloss
BooleanProperty m_doMs
BooleanProperty m_forceMomentum
BooleanProperty m_useMostProbableEloss
BooleanProperty m_msgOutputValidationDirection
BooleanProperty m_msgOutputCorrections
BooleanProperty m_validationMode
BooleanProperty m_validationIgnoreUnmeasured
BooleanProperty m_landauMode
IntegerProperty m_validationDirection
DoubleProperty m_momentumCut
DoubleProperty m_momentumMax
DoubleProperty m_forcedMomentum {this, "ForcedMomentumValue", 2000. * Gaudi::Units::MeV, "Forced momentum value"}
ToolHandle< IEnergyLossUpdatorm_eLossUpdator
ToolHandle< IMultipleScatteringUpdatorm_msUpdator
ToolHandle< IMaterialMapperm_materialMapper
boost::thread_specific_ptr< ICachem_cache_tls
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Point-like (also called surface-based) update of TrackParameters and the associated covariance.

Pre/Post/update notation.

Given a sensitive detector element, it can be (e.g silicon sensors) that most of the material corresponds to the sensor itself or is located behind it.

In this case the material effects would be post-update with respect to the measurement update on the given surface, e.g in a Kalman filter procedure. The same material would have to be taken into account before, pre-update, the measurement update in the smoothing/ backward filtering kalman filtering process.

Pre/Post update make sense in these specific contexts. For a uniform detector or non-sensitive material a full update is applied.

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch
AthenaMT modifications Christos Anastopoulos

Definition at line 63 of file MaterialEffectsUpdator.h.

Member Typedef Documentation

◆ ICache

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MaterialEffectsUpdator()

Trk::MaterialEffectsUpdator::MaterialEffectsUpdator ( const std::string & t,
const std::string & n,
const IInterface * p )

AlgTool like constructor.

Definition at line 40 of file MaterialEffectsUpdator.cxx.

41 : AthAlgTool(t, n, p)
42{
43 declareInterface<IMaterialEffectsUpdator>(this);
44}
AthAlgTool()
Default constructor:

◆ ~MaterialEffectsUpdator()

Trk::MaterialEffectsUpdator::~MaterialEffectsUpdator ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ checkCovariance()

bool Trk::MaterialEffectsUpdator::checkCovariance ( AmgSymMatrix(5) & updated) const
private

A simple check method for the 'removeNoise' update model.

Definition at line 766 of file MaterialEffectsUpdator.cxx.

767{
768 if (updated(Trk::phi, Trk::phi) > 0. && updated(Trk::theta, Trk::theta) > 0. &&
769 updated(Trk::qOverP, Trk::qOverP) > 0.) {
770 return true;
771 }
772
773 // given an update
774 ATH_MSG_DEBUG(" [-] update material with 'removeNoise' results in negative covariance entries. Skipping update.");
775 return false;
776}
#define ATH_MSG_DEBUG(x)
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalLandauCovarianceUpdate()

TrackParameters * Trk::MaterialEffectsUpdator::finalLandauCovarianceUpdate ( const TrackParameters * parm) const
private

◆ getCache()

virtual ICache Trk::IMaterialEffectsUpdator::getCache ( ) const
inlinevirtualinherited

Creates an instance of the cache to be used.

by the client.

Definition at line 87 of file IMaterialEffectsUpdator.h.

87{ return {}; }

◆ getTLSCache()

ICache & Trk::MaterialEffectsUpdator::getTLSCache ( ) const
inlineprivate

Definition at line 357 of file MaterialEffectsUpdator.h.

358 {
359 ICache* cache = m_cache_tls.get();
360 if (!cache) {
361 cache = new ICache();
362 m_cache_tls.reset(cache);
363 }
364 return *cache;
365 }
IMaterialEffectsUpdator::ICache ICache
boost::thread_specific_ptr< ICache > m_cache_tls

◆ initialize()

StatusCode Trk::MaterialEffectsUpdator::initialize ( )
overridevirtual

AlgTool initailize method.

Definition at line 52 of file MaterialEffectsUpdator.cxx.

53{
54
55 ATH_MSG_DEBUG("Minimal momentum cut for material update : " << m_momentumCut << " MeV");
56
57 // retrieve the EnergyLoss Updator and Material Effects updator
58 if (m_doEloss) {
59 if (m_eLossUpdator.retrieve().isFailure()) {
60 ATH_MSG_FATAL("Failed to retrieve tool " << m_eLossUpdator
61 << ". No multiple scattering effects will be taken into account.");
62 m_doEloss = false;
63 return StatusCode::FAILURE;
64 }
65 ATH_MSG_DEBUG("Retrieved tool " << m_eLossUpdator);
66
67 } else {
68 m_eLossUpdator.disable();
69 }
70
71 if (m_doMs) {
72 if (m_msUpdator.retrieve().isFailure()) {
73 ATH_MSG_FATAL("Failed to retrieve tool " << m_msUpdator
74 << ". No energy loss effects will be taken into account.");
75 m_doMs = false;
76 return StatusCode::FAILURE;
77 }
78 ATH_MSG_DEBUG("Retrieved tool " << m_msUpdator);
79
80 } else {
81 m_msUpdator.disable();
82 }
83
84 // retrieve the material mapper for the validation mode
85 if (m_validationMode) {
86 if (m_materialMapper.retrieve().isFailure()) {
87 ATH_MSG_FATAL("Failed to retrieve tool " << m_materialMapper << ". No material recording.");
88 return StatusCode::FAILURE;
89 }
90 ATH_MSG_DEBUG("Retrieved tool " << m_materialMapper);
91
92 } else {
93 m_materialMapper.disable();
94 }
95
96 return StatusCode::SUCCESS;
97}
#define ATH_MSG_FATAL(x)
ToolHandle< IMultipleScatteringUpdator > m_msUpdator
ToolHandle< IEnergyLossUpdator > m_eLossUpdator
ToolHandle< IMaterialMapper > m_materialMapper

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Trk::IMaterialEffectsUpdator::interfaceID ( )
inlinestaticinherited

AlgTool and IAlgTool interface methods.

Definition at line 52 of file IMaterialEffectsUpdator.h.

53 {
55 }
static const InterfaceID IID_IMaterialEffectsUpdator("IMaterialEffectsUpdator", 1, 0)
Interface ID for IMaterialEffectsUpdator.

◆ modelAction() [1/2]

virtual void Trk::MaterialEffectsUpdator::modelAction ( const TrackParameters * param = nullptr) const
inlinefinaloverridevirtual

Model Action: Provides the possibility of doing non-local MaterialEffectsUpdates for different models Optional.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 237 of file MaterialEffectsUpdator.h.

239 {
240 ICache& cache = getTLSCache();
241 modelActionImpl(cache, parm);
242 }
static void modelActionImpl(ICache &cache, const TrackParameters *parm=nullptr)

◆ modelAction() [2/2]

virtual void Trk::MaterialEffectsUpdator::modelAction ( ICache & cache,
const TrackParameters * parm = nullptr ) const
inlinefinaloverridevirtual

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

Implements Trk::IMaterialEffectsUpdator.

Definition at line 164 of file MaterialEffectsUpdator.h.

166 {
167 modelActionImpl(cache, parm);
168 }

◆ modelActionImpl()

void Trk::MaterialEffectsUpdator::modelActionImpl ( ICache & cache,
const TrackParameters * parm = nullptr )
staticprivate

Definition at line 761 of file MaterialEffectsUpdator.cxx.

762{
763 cache.accumulatedElossSigma = 0;
764}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ postUpdate() [1/2]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::postUpdate ( const TrackParameters & param,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlinefinaloverridevirtual

Updator interface (pre-update for a layer):

Implements Trk::IMaterialEffectsUpdator.

Definition at line 207 of file MaterialEffectsUpdator.h.

213 {
214 ICache& cache = getTLSCache();
215 return postUpdateImpl(cache, parm, sf, dir, particle, matupmode);
216 }
std::unique_ptr< TrackParameters > postUpdateImpl(ICache &cache, const TrackParameters &parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const

◆ postUpdate() [2/2]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::postUpdate ( ICache & cache,
const TrackParameters & parm,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlinefinaloverridevirtual

Updator interface (post-update for a layer): ---> ALWAYS pointer to new TrackParameters is returned if no postUpdate is to be done : return nullptr.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 129 of file MaterialEffectsUpdator.h.

136 {
137 return postUpdateImpl(cache, parm, sf, dir, particle, matupmode);
138 }

◆ postUpdateImpl()

std::unique_ptr< Trk::TrackParameters > Trk::MaterialEffectsUpdator::postUpdateImpl ( ICache & cache,
const TrackParameters & parm,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
private

Definition at line 363 of file MaterialEffectsUpdator.cxx.

370 {
371 // no material properties - pass the parameters back
372 if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss) ||
373 !lay.isOnLayer(parm.position())) {
374 return parm.uniqueClone();
375 }
376
377 // get the quantities
378 const Trk::MaterialProperties* mprop = nullptr;
379 double postFactor = lay.postUpdateMaterialFactor(parm, dir);
380
381 // no material properties - pass them back
382 if (postFactor < 0.01) {
383 return parm.uniqueClone();
384 }
385
386 // set the output if restricted to the validation direction
387 bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true;
388
389 mprop = lay.fullUpdateMaterialProperties(parm);
390 double pathCorrection = std::abs(lay.surfaceRepresentation().pathCorrection(parm.position(), parm.momentum()));
391 pathCorrection *= postFactor;
392
393 // exit if no material properties
394 if (!mprop) {
395 return parm.uniqueClone();
396 }
397
398 // --------------------------------------------------------------------------------------------------
399 if (outputFlag) {
400 double layerR = lay.surfaceRepresentation().bounds().r();
401 double layerZ = lay.surfaceRepresentation().center().z();
402 double eta = parm.momentum().eta();
403 double sX0 = mprop->thicknessInX0();
404 double tX0 = pathCorrection * mprop->thicknessInX0();
405 ATH_MSG_VERBOSE(" [M] post material update, layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index "
406 << lay.layerIndex());
407 ATH_MSG_VERBOSE(" thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": "
408 << pathCorrection << ")");
409 }
410 // --------------------------------------------------------------------------------------------------
411 if (m_validationMode) {
412 cache.validationLayer = &lay;
413 }
414 return updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode);
415}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_VERBOSE(x)
std::unique_ptr< TrackParameters > updateImpl(ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
float thicknessInX0() const
Return the radiationlength fraction.
@ nonInteractingMuon

◆ preUpdate() [1/2]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::preUpdate ( const TrackParameters * param,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlinefinaloverridevirtual

Updator interface (pre-update for a layer):

Implements Trk::IMaterialEffectsUpdator.

Definition at line 196 of file MaterialEffectsUpdator.h.

202 {
203 ICache& cache = getTLSCache();
204 return preUpdateImpl(cache, parm, sf, dir, particle, matupmode);
205 }
std::unique_ptr< TrackParameters > preUpdateImpl(ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const

◆ preUpdate() [2/2]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::preUpdate ( ICache & cache,
const TrackParameters * parm,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlineoverridevirtual

Updator interface (pre-update for a layer): ---> ALWAYS pointer to new TrackParameters is returned.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 114 of file MaterialEffectsUpdator.h.

121 {
122 return preUpdateImpl(cache, parm, sf, dir, particle, matupmode);
123 }

◆ preUpdateImpl()

std::unique_ptr< Trk::TrackParameters > Trk::MaterialEffectsUpdator::preUpdateImpl ( ICache & cache,
const TrackParameters * parm,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
private

Definition at line 309 of file MaterialEffectsUpdator.cxx.

316 {
317 // no material properties - pass the parameters back
318 if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss)) {
319 return parm->uniqueClone();
320 }
321
322 // get the split factor
323 double preFactor = lay.preUpdateMaterialFactor(*parm, dir);
324 // return if the preFactor is less than one
325 if (preFactor < 0.01) {
326 return parm->uniqueClone();
327 }
328
329 // get the material properties
330 const Trk::MaterialProperties* mprop = nullptr;
331
332 // set the output if restricted to the validation direction
333 bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true;
334
335 mprop = lay.fullUpdateMaterialProperties(*parm);
336 double pathCorrection = std::abs(lay.surfaceRepresentation().pathCorrection(parm->position(), parm->momentum()));
337 pathCorrection *= preFactor;
338
339 // exit if no mprop could be assigned
340 if (!mprop) {
341 return parm->uniqueClone();
342 }
343 // --------------------------------------------------------------------------------------------------
344 if (outputFlag) {
345 double layerR = lay.surfaceRepresentation().bounds().r();
346 double layerZ = lay.surfaceRepresentation().center().z();
347 double eta = parm->momentum().eta();
348 double sX0 = mprop->thicknessInX0();
349 double tX0 = pathCorrection * mprop->thicknessInX0();
350 ATH_MSG_VERBOSE(" [M] pre material update at layer with [r,z] = [ " << layerR << ", " << layerZ << " ] - Index "
351 << lay.layerIndex());
352 ATH_MSG_VERBOSE(" thickness/X0 , path/X0 (eta: g.factor) = " << sX0 << " , " << tX0 << " (" << eta << ": "
353 << pathCorrection << ")");
354 }
355 // --------------------------------------------------------------------------------------------------
356 if (m_validationMode) {
357 cache.validationLayer = &lay;
358 }
359 return updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode);
360}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ update() [1/6]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::update ( const TrackParameters & param,
const MaterialProperties & mprop,
double pathcorrection,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlinefinaloverridevirtual

Updator interface: MaterialProperties based material update.

  • used by all Layer-based methods

Implements Trk::IMaterialEffectsUpdator.

Definition at line 218 of file MaterialEffectsUpdator.h.

225 {
226 ICache& cache = getTLSCache();
227 return updateImpl(
228 cache, parm, mprop, pathcorrection, dir, particle, matupmode);
229 }

◆ update() [2/6]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::update ( const TrackParameters * param,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlinefinaloverridevirtual

Updator interface (full update for a layer):

Implements Trk::IMaterialEffectsUpdator.

Definition at line 174 of file MaterialEffectsUpdator.h.

180 {
181
182 ICache& cache = getTLSCache();
183 return updateImpl(cache, parm, sf, dir, particle, matupmode);
184 }

◆ update() [3/6]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::update ( const TrackParameters * param,
const MaterialEffectsOnTrack & meff,
Trk::ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlinefinaloverridevirtual

User updator interface (full update for a layer):

Implements Trk::IMaterialEffectsUpdator.

Definition at line 186 of file MaterialEffectsUpdator.h.

191 {
192 ICache& cache = getTLSCache();
193 return updateImpl(cache, parm, meff, particle, matupmode);
194 }

◆ update() [4/6]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::update ( ICache & cache,
const TrackParameters & parm,
const MaterialProperties & mprop,
double pathcorrection,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlinefinaloverridevirtual

Dedicated Updator interface:-> create new track parameters.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 140 of file MaterialEffectsUpdator.h.

148 {
149 return updateImpl(
150 cache, parm, mprop, pathcorrection, dir, particle, matupmode);
151 }

◆ update() [5/6]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::update ( ICache & cache,
const TrackParameters * parm,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlineoverridevirtual

Updator interface (full update for a layer) ---> ALWAYS pointer to new TrackParameters is returned.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 87 of file MaterialEffectsUpdator.h.

94 {
95 return updateImpl(cache, parm, sf, dir, particle, matupmode);
96 }

◆ update() [6/6]

virtual std::unique_ptr< TrackParameters > Trk::MaterialEffectsUpdator::update ( ICache & cache,
const TrackParameters * parm,
const MaterialEffectsOnTrack & meff,
Trk::ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
inlineoverridevirtual

Updator interface (full update for a layer) according to user input through MaterialEffectsOnTrack ---> ALWAYS pointer to new TrackParameters is returned.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 101 of file MaterialEffectsUpdator.h.

107 {
108 return updateImpl(cache, parm, meff, particle, matupmode);
109 }

◆ updateImpl() [1/4]

std::unique_ptr< Trk::TrackParameters > Trk::MaterialEffectsUpdator::updateImpl ( ICache & cache,
const TrackParameters & parm,
const MaterialProperties & mprop,
double pathcorrection,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
private

Definition at line 590 of file MaterialEffectsUpdator.cxx.

598 {
599 // no material properties - pass them back
600 if (particle == Trk::geantino || (!m_doMs && !m_doEloss)) {
601 return parm.uniqueClone();
602 }
603
604 // get the kinematics
605 double p = parm.momentum().mag();
606 double updateMomentum = m_forceMomentum ? m_forcedMomentum.value() : p;
608 double E = std::sqrt(p * p + m * m);
609 double beta = p / E;
610
611 // set the output if restricted to the validation direction
612 bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true;
613
614 // no material update below or above a certain cut value
615 if (p > m_momentumCut && p < m_momentumMax) {
616 // the updatedParameters - first a copy
617 AmgVector(5) updatedParameters(parm.parameters());
618
619 // get the delta of the Energy
620 EnergyLoss energyLoss =
621 (m_doEloss)
622 ? m_eLossUpdator->energyLoss(matprop, updateMomentum, pathcorrection, dir, particle, m_useMostProbableEloss)
623 : EnergyLoss{};
624 // update for mean energy loss
625 double deltaE = energyLoss.deltaE() ;
626 double sigmaDeltaE = energyLoss.sigmaDeltaE();
627 if (m_landauMode && cache.accumulatedElossSigma != 0 && sigmaDeltaE != 0) {
628 if (dir == Trk::oppositeMomentum) {
629 deltaE += sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) +
630 cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma);
631 } else {
632 deltaE -= sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) +
633 cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma);
634 }
635
636 cache.accumulatedElossSigma += sigmaDeltaE;
637 } else if (m_landauMode) {
638 cache.accumulatedElossSigma += sigmaDeltaE;
639 }
640
641 double newP2 = (E + deltaE) * (E + deltaE) - m * m;
642 if (E + deltaE < -m) {
643 return nullptr; // protect against flip in correction
644 }
645 if (newP2 < m_momentumCut * m_momentumCut) {
646 return nullptr; // protect against FPE
647 }
648 double deltaP = std::sqrt(newP2) - p;
649 double sigmaQoverP = sigmaDeltaE / std::pow(beta * p, 2);
650
651 updatedParameters[Trk::qOverP] = parm.charge() / (p + deltaP);
652
653 // check if Parameters are measured parameters
654 std::optional<AmgSymMatrix(5)> updatedCovariance = std::nullopt;
655 if (parm.covariance() || (m_validationMode && !m_validationIgnoreUnmeasured)) {
656 // the new CovarianceMatrix - a copy first
657 updatedCovariance = AmgSymMatrix(5)(*parm.covariance());
658 // only update if msUpdator exists
659 double angularVariation =
660 (m_doMs) ? m_msUpdator->sigmaSquare(matprop, updateMomentum, pathcorrection, particle) : 0.;
661 // update the covariance entries - angular variation in phi has dependency on theta direction
662 // sign of the noise adding ----------------------------------------------------------------
663 int sign = int(matupmode);
664 // checks will only be done in the removeNoise mode
665 double sigmaDeltaPhiSq =
666 angularVariation / (std::sin(parm.parameters()[Trk::theta]) * std::sin(parm.parameters()[Trk::theta]));
667 double sigmaDeltaThetaSq = angularVariation;
668 // checks will only be done in the removeNoise mode
669 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::phi, Trk::phi), sign, sigmaDeltaPhiSq);
670 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::theta, Trk::theta), sign, sigmaDeltaThetaSq);
671 if (!m_landauMode) {
672 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::qOverP, Trk::qOverP), sign, sigmaQoverP * sigmaQoverP);
673 } else if (m_landauMode) {
674 // subtract what we added up till now and add what we should add up till now
675 // Landau's 68% limit is best modeled by 1.6*sigmaParameter
676 (*updatedCovariance)(Trk::qOverP, Trk::qOverP) -=
677 sign * std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), 2);
678 (*updatedCovariance)(Trk::qOverP, Trk::qOverP) +=
679 sign * std::pow(1.6 * cache.accumulatedElossSigma / ((p + deltaP) * (p + deltaP)), 2);
680 }
681 // the checks for the remove Noise mode -----------------------------------------------------
682 if (matupmode == Trk::removeNoise && !checkCovariance(*updatedCovariance)) {
683 // the covariance is invalid
684 return nullptr;
685 }
686 // -------------------------------------- screen output
687 // --------------------------------------
688 if (outputFlag && m_msgOutputCorrections) {
689 double sigmaAngle = std::sqrt(angularVariation);
690 ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / std::sin(parm.parameters()[Trk::theta]) << " / "
691 << sigmaAngle);
692 ATH_MSG_VERBOSE(" deltaP / sigmaQoverP = " << deltaP << " / " << sigmaQoverP);
693 }
694 // ----------------------------------------- validation section ----------------------------------
695 // validation if configured
697
698 if (cache.validationLayer) {
699 // all you have from MaterialProperties
700 double pathInX0 = pathcorrection * matprop.thicknessInX0();
701 double A = 0.;
702 double Z = 0.;
703 double rho = 0.;
704 double l0 = 0.;
705 // or better take the extended version for more information
706 const Trk::MaterialProperties* extProperties = dynamic_cast<const Trk::MaterialProperties*>(&matprop);
707
708 if (extProperties) {
709 A = extProperties->averageA();
710 Z = extProperties->averageZ();
711 rho = extProperties->averageRho();
712 l0 = extProperties->l0();
713 }
714
715 Trk::AssociatedMaterial assMatHit(parm.position(),
716 pathInX0,
717 matprop.x0(),
718 l0,
719 A,
720 Z,
721 rho,
722 pathcorrection,
723 cache.validationLayer->enclosingTrackingVolume(),
724 cache.validationLayer);
725
726 // record the Material hit ----------------------------------------------------------------
727 m_materialMapper->recordMaterialHit(assMatHit, parm.position());
728
729 // the steps
730 cache.validationSteps++;
731 cache.validationPhi += parm.position().phi();
732 cache.validationEta += parm.position().eta();
733 // reset the validation layer
734 cache.validationLayer = nullptr;
735 }
736 }
737 // ------------------------------------------validation section ----------------------------------
738 }
739 return parm.associatedSurface().createUniqueTrackParameters(
740 updatedParameters[Trk::loc1],
741 updatedParameters[Trk::loc2],
742 updatedParameters[Trk::phi],
743 updatedParameters[Trk::theta],
744 updatedParameters[Trk::qOverP],
745 std::move(updatedCovariance)
746 );
747 }
748 //default if we have not returned before
749 return parm.uniqueClone();
750}
#define AmgSymMatrix(dim)
#define AmgVector(rows)
#define COVARIANCEUPDATEWITHCHECK(cov, sign, value)
int sign(int a)
bool checkCovariance(AmgSymMatrix(5) &updated) const
A simple check method for the 'removeNoise' update model.
float averageRho() const
Return the average density of the material.
float averageA() const
Return the average A of the material [gram/mole].
float averageZ() const
Returns the average Z of the material.
float l0() const
Return the nuclear interaction length.
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
PropDirection
PropDirection, enum for direction of the propagation.
@ oppositeMomentum
@ loc2
generic first and second local coordinate
Definition ParamDefs.h:35
@ loc1
Definition ParamDefs.h:34

◆ updateImpl() [2/4]

std::unique_ptr< Trk::TrackParameters > Trk::MaterialEffectsUpdator::updateImpl ( ICache & cache,
const TrackParameters * parm,
const Layer & sf,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
private

Definition at line 101 of file MaterialEffectsUpdator.cxx.

108 {
109 // no material properties - pass them back
110 if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss) ||
111 !lay.isOnLayer(parm->position())) {
112 return parm->uniqueClone();
113 }
114
115 // get the quantities
116 const Trk::MaterialProperties* mprop = lay.fullUpdateMaterialProperties(*parm);
117 if (!mprop) {
118 return parm->uniqueClone();
119 }
120
121 // get the real pathlength
122 double pathCorrection = std::abs(lay.surfaceRepresentation().pathCorrection(parm->position(), parm->momentum()));
123
124 // --------------------------------------------------------------------------------------------------
125 if (m_validationMode) {
126 cache.validationLayer = &lay;
127 }
128 return updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode);
129}

◆ updateImpl() [3/4]

std::unique_ptr< Trk::TrackParameters > Trk::MaterialEffectsUpdator::updateImpl ( ICache & cache,
const TrackParameters * parm,
const MaterialEffectsOnTrack & meff,
Trk::ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
private

Definition at line 132 of file MaterialEffectsUpdator.cxx.

138 {
139 // no material properties - pass them back
140 // TODO, if the parm doesn't have a surface (i.e. its in
141 // curvilinear) then should we fall through?
142 if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss) ||
143 parm->associatedSurface() != meff.associatedSurface()) {
144 return parm->uniqueClone();
145 }
146
147 // get the kinematics
148 double p = parm->momentum().mag();
149 double updateMomentum = m_forceMomentum ? m_forcedMomentum.value() : p;
151 double E = std::sqrt(p * p + m * m);
152 double beta = p / E;
153
154 double pathcorrection = 1.; // Trick the MultipleScatteringUpdator interface
155
156 double energyLoss = 0;
157 double energyLossSigma = 0;
158
159 if (meff.energyLoss() != nullptr) {
160 energyLoss = meff.energyLoss()->deltaE();
161 energyLossSigma = meff.energyLoss()->sigmaDeltaE();
162 }
163
164 // update for mean energy loss
165 double newP = p;
166 double sigmaQoverP = 0;
167 double sigmaQoverPSq = 0;
168 // Landaus mpvs don't just add, if in Landau mode we need to do a different update
169 if (m_landauMode && cache.accumulatedElossSigma != 0 && energyLossSigma != 0) {
170 if (energyLoss > 0) {
171 energyLoss += energyLossSigma * std::log(1 + cache.accumulatedElossSigma / (energyLossSigma)) +
172 cache.accumulatedElossSigma * std::log(1 + energyLossSigma / cache.accumulatedElossSigma);
173 } else {
174 energyLoss -= energyLossSigma * std::log(1 + cache.accumulatedElossSigma / energyLossSigma) +
175 cache.accumulatedElossSigma * std::log(1 + energyLossSigma / cache.accumulatedElossSigma);
176 }
177 cache.accumulatedElossSigma += energyLossSigma;
178 } else if (m_landauMode) {
179 cache.accumulatedElossSigma += energyLossSigma;
180 }
181 double qOverPnew = parm->parameters()[Trk::qOverP];
182
183 if (p > m_momentumCut && p < m_momentumMax && m_doEloss) {
184 double newP2 = (E + energyLoss) * (E + energyLoss) - m * m;
185 if (newP2 < m_momentumCut * m_momentumCut) {
186 return nullptr; // protect FPE
187 }
188 if (E + energyLoss < -m) {
189 return nullptr; // protect against flip in correction
190 }
191 newP = std::sqrt(newP2);
192 sigmaQoverP = energyLossSigma / (beta * p * p);
193 sigmaQoverPSq = sigmaQoverP * sigmaQoverP;
194 qOverPnew = parm->charge() / newP;
195 }
196 Trk::DefinedParameter qOverPmod(qOverPnew, Trk::qOverP);
197
198 // check if Parameters are measured parameters
199 // the updatedParameters - first a copy
200 const Trk::TrackParameters* mpars = parm;
201 AmgVector(5) updatedParameters(mpars->parameters());
202 std::optional<AmgSymMatrix(5)> updatedCovariance = std::nullopt;
203 // initialize ErrorMatrix pointer
205 // the new CovarianceMatrix - a copy first
206 updatedCovariance = mpars->covariance()
207 ? std::optional<AmgSymMatrix(5)>(*mpars->covariance())
208 : std::nullopt;
209 double angularVariation = 0;
210 double sigmaDeltaPhiSq = 0;
211 double sigmaDeltaThetaSq = 0;
212
213 if (m_doMs) {
214 // If the meff has scattering angles use those, otherwise use MEffUpdator
215 if (meff.scatteringAngles() == nullptr) {
216 // Trick to keep using existing MultipleScatteringUpdator interface
217 // Here we know the path length to be meff.thicknessX0, so we set pathcorrection = 1
218 // and create a dummy materialProperties with the properties we are interested in
219 MaterialProperties mprop(meff.thicknessInX0(), 1., 1., 0., 0., 0.);
220 angularVariation = m_msUpdator->sigmaSquare(mprop, updateMomentum, pathcorrection, Trk::muon);
221 // sigmaDeltaPhiSq = angularVariation/(parm->sinTheta()*parm->sinTheta());
222 sigmaDeltaPhiSq =
223 angularVariation / (std::sin(parm->parameters()[Trk::theta]) * std::sin(parm->parameters()[Trk::theta]));
224 sigmaDeltaThetaSq = angularVariation;
225 } else {
226 // material update from mefots -> D.L.
227 sigmaDeltaPhiSq = meff.scatteringAngles()->sigmaDeltaPhi();
228 sigmaDeltaPhiSq *= sigmaDeltaPhiSq;
229 sigmaDeltaThetaSq = meff.scatteringAngles()->sigmaDeltaTheta();
230 sigmaDeltaThetaSq *= sigmaDeltaThetaSq;
231 updatedParameters[Trk::phi] = parm->position().phi() + meff.scatteringAngles()->deltaPhi();
232 updatedParameters[Trk::theta] = parm->position().theta() + meff.scatteringAngles()->deltaTheta();
233 }
234 }
235 // update the covariance entries - angular variation in phi has dependency on theta direction
236 if (updatedCovariance) {
237 // sign of the noise adding -----------------------
238 int sign = int(matupmode);
239 // check for non-zero covariance matrix
240 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::phi, Trk::phi), sign, sigmaDeltaPhiSq);
241 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::theta, Trk::theta), sign, sigmaDeltaThetaSq);
242 if (!m_landauMode) {
243 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::qOverP, Trk::qOverP), sign, sigmaQoverPSq);
244 } else if (m_landauMode) {
245 // subtract what we added up till now and add what we should add up till now
246 // Landau's 68% limit is approx 1.6*sigmaParameter
247 (*updatedCovariance)(Trk::qOverP, Trk::qOverP) -=
248 sign * std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), 2);
249 (*updatedCovariance)(Trk::qOverP, Trk::qOverP) +=
250 sign * std::pow(1.6 * cache.accumulatedElossSigma / (newP * newP), 2);
251 }
252 // the checks for the remove Noise mode -----------------------------------------------------
253 if (matupmode == Trk::removeNoise && !checkCovariance(*updatedCovariance)) {
254 // the covariance is invalid
255 return nullptr;
256 }
257 // -------------------------------------- screen output --------------------------------------
259 double sigmaAngle = std::sqrt(angularVariation);
260 ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / std::sin(parm->parameters()[Trk::theta]) << " / "
261 << sigmaAngle);
262 ATH_MSG_VERBOSE(" deltaP / sigmaQoverP = " << energyLoss << " / " << sigmaQoverP);
263 }
264 // -------------------------------------------------------------------------------------------
265 }
266 // ----------------------------------------- validation section ----------------------------------
267 // validation if configured
268 if (m_validationMode) {
269 if (cache.validationLayer) {
270 // all you have from MaterialProperties
271 double pathInX0 = meff.thicknessInX0();
272
273 Trk::AssociatedMaterial assMatHit(parm->position(),
274 pathInX0,
275 pathInX0,
276 0,
277 0,
278 0,
279 0,
280 pathcorrection,
281 cache.validationLayer->enclosingTrackingVolume(),
282 cache.validationLayer);
283
284 // record the Material hit ----------------------------------------------------------------
285 m_materialMapper->recordMaterialHit(assMatHit, parm->position());
286
287 // the steps
288 cache.validationSteps++;
289 cache.validationPhi += parm->position().phi();
290 cache.validationEta += parm->position().eta();
291 // reset the validation layer
292 cache.validationLayer = nullptr;
293 }
294 }
295 // ----------------------------------------- validation section ----------------------------------
296 }
297 updatedParameters[Trk::qOverP] = qOverPnew;
298 return parm->associatedSurface().createUniqueTrackParameters(
299 updatedParameters[Trk::loc1],
300 updatedParameters[Trk::loc2],
301 updatedParameters[Trk::phi],
302 updatedParameters[Trk::theta],
303 updatedParameters[Trk::qOverP],
304 updatedCovariance
305 );
306}
if(febId1==febId2)
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ updateImpl() [4/4]

std::unique_ptr< Trk::TrackParameters > Trk::MaterialEffectsUpdator::updateImpl ( ICache & cache,
const TrackParameters * parm,
const MaterialProperties & mprop,
double pathcorrection,
PropDirection dir = alongMomentum,
ParticleHypothesis particle = pion,
MaterialUpdateMode matupmode = addNoise ) const
private

Definition at line 419 of file MaterialEffectsUpdator.cxx.

427 {
428 // no material properties - pass them back
429 if (particle == Trk::geantino || particle == Trk::nonInteractingMuon || (!m_doMs && !m_doEloss)) {
430 return parm->uniqueClone();
431 }
432
433 // get the kinematics
434 double p = parm->momentum().mag();
435 double updateMomentum = m_forceMomentum ? m_forcedMomentum.value() : p;
437 double E = std::sqrt(p * p + m * m);
438 double beta = p / E;
439
440 // set the output if restricted to the validation direction
441 bool outputFlag = m_msgOutputValidationDirection ? dir == int(m_validationDirection) : true;
442
443 // no material update below/above a certain cut value
444 if (p > m_momentumCut && p < m_momentumMax) {
445 // get the delta of the Energy
446 EnergyLoss energyLoss =
447 (m_doEloss) ? m_eLossUpdator->energyLoss(matprop, updateMomentum,
448 pathcorrection, dir, particle,
450 : EnergyLoss{};
451 // update for mean energy loss
452 double deltaE = energyLoss.deltaE();
453 double sigmaDeltaE = energyLoss.sigmaDeltaE();
454
455 if (m_landauMode && cache.accumulatedElossSigma != 0 && sigmaDeltaE != 0) {
456 if (dir == Trk::oppositeMomentum) {
457 deltaE += sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) +
458 cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma);
459 } else {
460 deltaE -= sigmaDeltaE * std::log(1 + cache.accumulatedElossSigma / sigmaDeltaE) +
461 cache.accumulatedElossSigma * std::log(1 + sigmaDeltaE / cache.accumulatedElossSigma);
462 }
463 cache.accumulatedElossSigma += sigmaDeltaE;
464 } else if (m_landauMode) {
465 cache.accumulatedElossSigma += sigmaDeltaE;
466 }
467
468 double newP2 = (E + deltaE) * (E + deltaE) - m * m;
469 if (E + deltaE < -m) {
470 return nullptr; // protect against flip in correction
471 }
472 if (newP2 < m_momentumCut * m_momentumCut) {
473 return nullptr; // protect against FPE
474 }
475 double deltaP = std::sqrt(newP2) - p;
476 double sigmaQoverP = sigmaDeltaE / std::pow(beta * p, 2);
477
478 Trk::DefinedParameter qOverPmod(parm->charge() / (p + deltaP), Trk::qOverP);
479
480 // check if Parameters are measured parameters
481 const Trk::TrackParameters* mpars = parm;
482 AmgVector(5) updatedParameters(mpars->parameters());
483 // initialize ErrorMatrix pointer
484 std::optional<AmgSymMatrix(5)> updatedCovariance = std::nullopt;
485 {
486 // the new CovarianceMatrix - a copy first
487 updatedCovariance =
488 mpars->covariance()
489 ? std::optional<AmgSymMatrix(5)>(*mpars->covariance())
490 : std::nullopt;
491 // only update if msUpdator exists
492 double angularVariation =
493 (m_doMs) ? m_msUpdator->sigmaSquare(matprop, updateMomentum, pathcorrection, particle) : 0.;
494 // update the covariance entries - angular variation in phi has dependency on theta direction
495 if (updatedCovariance) {
496 // sign of the noise adding ----------------------------------------------------------------
497 int sign = int(matupmode);
498
499 double sigmaDeltaPhiSq =
500 angularVariation / (std::sin(parm->parameters()[Trk::theta]) * std::sin(parm->parameters()[Trk::theta]));
501 double sigmaDeltaThetaSq = angularVariation;
502 // checks will only be done in the removeNoise mode
503 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::phi, Trk::phi), sign, sigmaDeltaPhiSq);
504 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::theta, Trk::theta), sign, sigmaDeltaThetaSq);
505 if (!m_landauMode) {
506 COVARIANCEUPDATEWITHCHECK((*updatedCovariance)(Trk::qOverP, Trk::qOverP), sign, sigmaQoverP * sigmaQoverP);
507 } else if (m_landauMode) {
508 // subtract what we added up till now and add what we should add up till now
509 // Landau's 68% limit is approx 1.6*sigmaParameter
510 (*updatedCovariance)(Trk::qOverP, Trk::qOverP) -=
511 sign * std::pow(1.6 * (cache.accumulatedElossSigma - p * p * sigmaQoverP) / (p * p), 2);
512 (*updatedCovariance)(Trk::qOverP, Trk::qOverP) +=
513 sign * std::pow(1.6 * cache.accumulatedElossSigma / ((p + deltaP) * (p + deltaP)), 2);
514 }
515 // the checks for the remove Noise mode -----------------------------------------------------
516 if (matupmode == Trk::removeNoise && !checkCovariance(*updatedCovariance)) {
517 // the covariance is invalid
518 return nullptr;
519 }
520
521 // -------------------------------------- screen output --------------------------------------
522 if (outputFlag && m_msgOutputCorrections) {
523 double sigmaAngle = std::sqrt(angularVariation);
524 ATH_MSG_VERBOSE(" sigma(phi) / sigma(theta) = " << sigmaAngle / std::sin(parm->parameters()[Trk::theta])
525 << " / " << sigmaAngle);
526 ATH_MSG_VERBOSE(" deltaP / sigmaQoverP = " << deltaP << " / " << sigmaQoverP);
527 }
528 // -------------------------------------------------------------------------------------------
529 }
530 // ----------------------------------------- validation section ----------------------------------
531 // validation if configured
532 if (m_validationMode && dir == Trk::PropDirection(m_validationDirection.value()) && updatedCovariance) {
533
534 if (cache.validationLayer) {
535 // all you have from MaterialProperties
536 double pathInX0 = pathcorrection * matprop.thicknessInX0();
537 double A = 0.;
538 double Z = 0.;
539 double rho = 0.;
540 double l0 = 0.;
541 // or better take the extended version for more information
542 const Trk::MaterialProperties* extProperties = dynamic_cast<const Trk::MaterialProperties*>(&matprop);
543
544 if (extProperties) {
545 A = extProperties->averageA();
546 Z = extProperties->averageZ();
547 rho = extProperties->averageRho();
548 l0 = extProperties->l0();
549 }
550
551 Trk::AssociatedMaterial assMatHit(parm->position(),
552 pathInX0,
553 matprop.x0(),
554 l0,
555 A,
556 Z,
557 rho,
558 pathcorrection,
559 cache.validationLayer->enclosingTrackingVolume(),
560 cache.validationLayer);
561
562 // record the Material hit ----------------------------------------------------------------
563 m_materialMapper->recordMaterialHit(assMatHit, parm->position());
564 // the steps
565 cache.validationSteps++;
566 cache.validationPhi += parm->position().phi();
567 cache.validationEta += parm->position().eta();
568 // reset the cache.tion layer
569 cache.validationLayer = nullptr;
570 }
571 }
572 // ----------------------------------------- validation section ----------------------------------
573 }
574 updatedParameters[Trk::qOverP] = parm->charge() / (p + deltaP);
575 return parm->associatedSurface().createUniqueTrackParameters(
576 updatedParameters[Trk::loc1],
577 updatedParameters[Trk::loc2],
578 updatedParameters[Trk::phi],
579 updatedParameters[Trk::theta],
580 updatedParameters[Trk::qOverP],
581 std::move(updatedCovariance)
582 );
583 }
584 //default if we have not returned just above
585 return parm->uniqueClone();
586}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ validationAction() [1/2]

virtual void Trk::MaterialEffectsUpdator::validationAction ( ) const
inlinefinaloverridevirtual

Validation Action: outside access to internal validation steps Optional.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 231 of file MaterialEffectsUpdator.h.

232 {
233 ICache& cache = getTLSCache();
235 }
static void validationActionImpl(ICache &cache)

◆ validationAction() [2/2]

virtual void Trk::MaterialEffectsUpdator::validationAction ( ICache & cache) const
inlinefinaloverridevirtual

Validation Action - calls the writing and resetting of the TTree variables.

Implements Trk::IMaterialEffectsUpdator.

Definition at line 155 of file MaterialEffectsUpdator.h.

156 {
158 }

◆ validationActionImpl()

void Trk::MaterialEffectsUpdator::validationActionImpl ( ICache & cache)
staticprivate

Definition at line 753 of file MaterialEffectsUpdator.cxx.

754{
755 cache.validationEta = 0.;
756 cache.validationPhi = 0.;
757 cache.validationSteps = 0;
758}

Member Data Documentation

◆ m_cache_tls

boost::thread_specific_ptr<ICache> Trk::MaterialEffectsUpdator::m_cache_tls
mutableprivate

Definition at line 356 of file MaterialEffectsUpdator.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doEloss

BooleanProperty Trk::MaterialEffectsUpdator::m_doEloss
private
Initial value:
{this, "EnergyLoss", true,
"steer energy loss On/Off from outside"}

Definition at line 307 of file MaterialEffectsUpdator.h.

307 {this, "EnergyLoss", true,
308 "steer energy loss On/Off from outside"};

◆ m_doMs

BooleanProperty Trk::MaterialEffectsUpdator::m_doMs
private
Initial value:
{this, "MultipleScattering", true,
"steer multiple scattering On/Off from outside"}

Definition at line 309 of file MaterialEffectsUpdator.h.

309 {this, "MultipleScattering", true,
310 "steer multiple scattering On/Off from outside"};

◆ m_eLossUpdator

ToolHandle<IEnergyLossUpdator> Trk::MaterialEffectsUpdator::m_eLossUpdator
private
Initial value:
{this, "EnergyLossUpdator", "Trk::EnergyLossUpdator/AtlasEnergyLossUpdator",
"AlgoTool for EnergyLoss updates"}

Definition at line 342 of file MaterialEffectsUpdator.h.

343 {this, "EnergyLossUpdator", "Trk::EnergyLossUpdator/AtlasEnergyLossUpdator",
344 "AlgoTool for EnergyLoss updates"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_forcedMomentum

DoubleProperty Trk::MaterialEffectsUpdator::m_forcedMomentum {this, "ForcedMomentumValue", 2000. * Gaudi::Units::MeV, "Forced momentum value"}
private

Definition at line 339 of file MaterialEffectsUpdator.h.

340{this, "ForcedMomentumValue", 2000. * Gaudi::Units::MeV, "Forced momentum value"};

◆ m_forceMomentum

BooleanProperty Trk::MaterialEffectsUpdator::m_forceMomentum
private
Initial value:
{this, "ForceMomentum", false,
"Force the momentum to be a specific value"}

Definition at line 312 of file MaterialEffectsUpdator.h.

312 {this, "ForceMomentum", false,
313 "Force the momentum to be a specific value"};

◆ m_landauMode

BooleanProperty Trk::MaterialEffectsUpdator::m_landauMode
private
Initial value:
{this, "LandauMode", false,
"If in Landau mode, error propagation is done as for landaus"}

Definition at line 330 of file MaterialEffectsUpdator.h.

330 {this, "LandauMode", false,
331 "If in Landau mode, error propagation is done as for landaus"};

◆ m_materialMapper

ToolHandle<IMaterialMapper> Trk::MaterialEffectsUpdator::m_materialMapper
private
Initial value:
{this, "ValidationMaterialMapper", "Trk::MaterialMapper/AtlasMaterialMapper",
"the material mapper for recording the layer material"}

Definition at line 349 of file MaterialEffectsUpdator.h.

350 {this, "ValidationMaterialMapper", "Trk::MaterialMapper/AtlasMaterialMapper",
351 "the material mapper for recording the layer material"};

◆ m_momentumCut

DoubleProperty Trk::MaterialEffectsUpdator::m_momentumCut
private
Initial value:
{this, "MinimalMomentum", 50. * Gaudi::Units::MeV,
"Minimal momentum cut for update"}

Definition at line 335 of file MaterialEffectsUpdator.h.

335 {this, "MinimalMomentum", 50. * Gaudi::Units::MeV,
336 "Minimal momentum cut for update"};

◆ m_momentumMax

DoubleProperty Trk::MaterialEffectsUpdator::m_momentumMax
private
Initial value:
{this, "MaximalMomentum", 10. * Gaudi::Units::TeV,
"Maximal momentum cut for update"}

Definition at line 337 of file MaterialEffectsUpdator.h.

337 {this, "MaximalMomentum", 10. * Gaudi::Units::TeV,
338 "Maximal momentum cut for update"};

◆ m_msgOutputCorrections

BooleanProperty Trk::MaterialEffectsUpdator::m_msgOutputCorrections
private
Initial value:
{this, "ScreenOutputCorrections", false,
"screen output of actual corrections"}

Definition at line 320 of file MaterialEffectsUpdator.h.

320 {this, "ScreenOutputCorrections", false,
321 "screen output of actual corrections"};

◆ m_msgOutputValidationDirection

BooleanProperty Trk::MaterialEffectsUpdator::m_msgOutputValidationDirection
private
Initial value:
{this, "ScreenOutputValidationDirection", true,
"validation direction used for screen output"}

Definition at line 317 of file MaterialEffectsUpdator.h.

318 {this, "ScreenOutputValidationDirection", true,
319 "validation direction used for screen output"};

◆ m_msUpdator

ToolHandle<IMultipleScatteringUpdator> Trk::MaterialEffectsUpdator::m_msUpdator
private
Initial value:
{this, "MultipleScatteringUpdator",
"Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator",
"AlgoTool for MultipleScatterin effects"}

Definition at line 345 of file MaterialEffectsUpdator.h.

346 {this, "MultipleScatteringUpdator",
347 "Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator",
348 "AlgoTool for MultipleScatterin effects"};

◆ m_useMostProbableEloss

BooleanProperty Trk::MaterialEffectsUpdator::m_useMostProbableEloss
private
Initial value:
{this, "MostProbableEnergyLoss", false,
"use the most probable energy loss"}

Definition at line 314 of file MaterialEffectsUpdator.h.

314 {this, "MostProbableEnergyLoss", false,
315 "use the most probable energy loss"};

◆ m_validationDirection

IntegerProperty Trk::MaterialEffectsUpdator::m_validationDirection
private
Initial value:
{this, "ValidationDirection", 1,
"validation direction"}

Definition at line 332 of file MaterialEffectsUpdator.h.

332 {this, "ValidationDirection", 1,
333 "validation direction"};

◆ m_validationIgnoreUnmeasured

BooleanProperty Trk::MaterialEffectsUpdator::m_validationIgnoreUnmeasured
private
Initial value:
{this, "ValidationIgnoreUnmeasured", false,
"Ignore unmeasured TrackParameters (Navigation!)"}

Definition at line 327 of file MaterialEffectsUpdator.h.

328 {this, "ValidationIgnoreUnmeasured", false,
329 "Ignore unmeasured TrackParameters (Navigation!)"};

◆ m_validationMode

BooleanProperty Trk::MaterialEffectsUpdator::m_validationMode
private
Initial value:
{this, "ValidationMode", false,
"Switch for validation mode"}

Definition at line 325 of file MaterialEffectsUpdator.h.

325 {this, "ValidationMode", false,
326 "Switch for validation mode"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: