ATLAS Offline Software
Loading...
Searching...
No Matches
MaterialEffectsUpdator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4
6// MaterialEffectsUpdator.h, c) ATLAS Detector software
8
9#ifndef TRKEXTOOLS_MATERIALEFFECTSUPDATOR_H
10#define TRKEXTOOLS_MATERIALEFFECTSUPDATOR_H
11
13// Trk
20// Gaudi
22#include "GaudiKernel/ToolHandle.h"
23
24#include <string>
25#include <vector>
26
27#include <boost/thread/tss.hpp>
28
29namespace Trk {
30
31class Layer;
32// class TrackParameters;
34
62
64 : public AthAlgTool
65 , virtual public IMaterialEffectsUpdator
66{
67
68public:
70 MaterialEffectsUpdator(const std::string&,
71 const std::string&,
72 const IInterface*);
73
76
78 virtual StatusCode initialize() override;
79 /*
80 * The concrete cache class for this specialization of the
81 * IMaterialEffectsUpdator
82 */
87 virtual std::unique_ptr<TrackParameters> update(
88 ICache& cache,
89 const TrackParameters* parm,
90 const Layer& sf,
92 ParticleHypothesis particle = pion,
93 MaterialUpdateMode matupmode = addNoise) const override
94 {
95 return updateImpl(cache, parm, sf, dir, particle, matupmode);
96 }
97
101 virtual std::unique_ptr<TrackParameters> update(
102 ICache& cache,
103 const TrackParameters* parm,
104 const MaterialEffectsOnTrack& meff,
105 Trk::ParticleHypothesis particle = pion,
106 MaterialUpdateMode matupmode = addNoise) const override
107 {
108 return updateImpl(cache, parm, meff, particle, matupmode);
109 }
110
114 virtual std::unique_ptr<TrackParameters> preUpdate(
115 ICache& cache,
116 const TrackParameters* parm,
117 const Layer& sf,
119 ParticleHypothesis particle = pion,
120 MaterialUpdateMode matupmode = addNoise) const override
121 {
122 return preUpdateImpl(cache, parm, sf, dir, particle, matupmode);
123 }
124
129 virtual std::unique_ptr<TrackParameters> postUpdate(
130 ICache& cache,
131 const TrackParameters& parm,
132 const Layer& sf,
134 ParticleHypothesis particle = pion,
135 MaterialUpdateMode matupmode = addNoise) const override final
136 {
137 return postUpdateImpl(cache, parm, sf, dir, particle, matupmode);
138 }
139
140 virtual std::unique_ptr<TrackParameters> update(
141 ICache& cache,
142 const TrackParameters& parm,
143 const MaterialProperties& mprop,
144 double pathcorrection,
146 ParticleHypothesis particle = pion,
147 MaterialUpdateMode matupmode = addNoise) const override final
148 {
149 return updateImpl(
150 cache, parm, mprop, pathcorrection, dir, particle, matupmode);
151 }
152
155 virtual void validationAction(ICache& cache) const override final
156 {
158 }
159
164 virtual void modelAction(ICache& cache, const TrackParameters* parm = nullptr)
165 const override final
166 {
167 modelActionImpl(cache, parm);
168 }
169
170public:
171 /*
172 * Public methods using the TLS cache.
173 */
174 virtual std::unique_ptr<TrackParameters> update(
175 const TrackParameters* parm,
176 const Layer& sf,
178 ParticleHypothesis particle = pion,
179 MaterialUpdateMode matupmode = addNoise) const override final
180 {
181
182 ICache& cache = getTLSCache();
183 return updateImpl(cache, parm, sf, dir, particle, matupmode);
184 }
185
186 virtual std::unique_ptr<TrackParameters> update(
187 const TrackParameters* parm,
188 const MaterialEffectsOnTrack& meff,
189 Trk::ParticleHypothesis particle = pion,
190 MaterialUpdateMode matupmode = addNoise) const override final
191 {
192 ICache& cache = getTLSCache();
193 return updateImpl(cache, parm, meff, particle, matupmode);
194 }
195
196 virtual std::unique_ptr<TrackParameters> preUpdate(
197 const TrackParameters* parm,
198 const Layer& sf,
200 ParticleHypothesis particle = pion,
201 MaterialUpdateMode matupmode = addNoise) const override final
202 {
203 ICache& cache = getTLSCache();
204 return preUpdateImpl(cache, parm, sf, dir, particle, matupmode);
205 }
206
207 virtual std::unique_ptr<TrackParameters> postUpdate(
208 const TrackParameters& parm,
209 const Layer& sf,
211 ParticleHypothesis particle = pion,
212 MaterialUpdateMode matupmode = addNoise) const override final
213 {
214 ICache& cache = getTLSCache();
215 return postUpdateImpl(cache, parm, sf, dir, particle, matupmode);
216 }
217
218 virtual std::unique_ptr<TrackParameters> update(
219 const TrackParameters& parm,
220 const MaterialProperties& mprop,
221 double pathcorrection,
223 ParticleHypothesis particle = pion,
224 MaterialUpdateMode matupmode = addNoise) const override final
225 {
226 ICache& cache = getTLSCache();
227 return updateImpl(
228 cache, parm, mprop, pathcorrection, dir, particle, matupmode);
229 }
230
231 virtual void validationAction() const override final
232 {
233 ICache& cache = getTLSCache();
235 }
236
237 virtual void modelAction(
238 const TrackParameters* parm = nullptr) const override final
239 {
240 ICache& cache = getTLSCache();
241 modelActionImpl(cache, parm);
242 }
243
244private:
245 /* The acutal implementation methods using the tool's
246 * concrete Cache*/
247 std::unique_ptr<TrackParameters> updateImpl(
248 ICache& cache,
249 const TrackParameters* parm,
250 const Layer& sf,
252 ParticleHypothesis particle = pion,
253 MaterialUpdateMode matupmode = addNoise) const;
254
255 std::unique_ptr<TrackParameters> updateImpl(
256 ICache& cache,
257 const TrackParameters* parm,
258 const MaterialEffectsOnTrack& meff,
259 Trk::ParticleHypothesis particle = pion,
260 MaterialUpdateMode matupmode = addNoise) const;
261
262 std::unique_ptr<TrackParameters> preUpdateImpl(
263 ICache& cache,
264 const TrackParameters* parm,
265 const Layer& sf,
267 ParticleHypothesis particle = pion,
268 MaterialUpdateMode matupmode = addNoise) const;
269
270 std::unique_ptr<TrackParameters> postUpdateImpl(
271 ICache& cache,
272 const TrackParameters& parm,
273 const Layer& sf,
275 ParticleHypothesis particle = pion,
276 MaterialUpdateMode matupmode = addNoise) const;
277
278 std::unique_ptr<TrackParameters> updateImpl(
279 ICache& cache,
280 const TrackParameters* parm,
281 const MaterialProperties& mprop,
282 double pathcorrection,
284 ParticleHypothesis particle = pion,
285 MaterialUpdateMode matupmode = addNoise) const;
286
287 std::unique_ptr<TrackParameters> updateImpl(
288 ICache& cache,
289 const TrackParameters& parm,
290 const MaterialProperties& mprop,
291 double pathcorrection,
293 ParticleHypothesis particle = pion,
294 MaterialUpdateMode matupmode = addNoise) const;
295
296 static void validationActionImpl(ICache& cache);
297
298 static void modelActionImpl(ICache& cache,
299 const TrackParameters* parm = nullptr);
300
302 bool checkCovariance(AmgSymMatrix(5) & updated) const;
304 const TrackParameters* parm) const;
305
306 /* Private Class members*/
307 BooleanProperty m_doEloss{this, "EnergyLoss", true,
308 "steer energy loss On/Off from outside"};
309 BooleanProperty m_doMs{this, "MultipleScattering", true,
310 "steer multiple scattering On/Off from outside"};
311
312 BooleanProperty m_forceMomentum{this, "ForceMomentum", false,
313 "Force the momentum to be a specific value"};
314 BooleanProperty m_useMostProbableEloss{this, "MostProbableEnergyLoss", false,
315 "use the most probable energy loss"};
316
318 {this, "ScreenOutputValidationDirection", true,
319 "validation direction used for screen output"};
320 BooleanProperty m_msgOutputCorrections{this, "ScreenOutputCorrections", false,
321 "screen output of actual corrections"};
322
323 // ------------ validation variables
324 // -------------------------------------------------
325 BooleanProperty m_validationMode{this, "ValidationMode", false,
326 "Switch for validation mode"};
328 {this, "ValidationIgnoreUnmeasured", false,
329 "Ignore unmeasured TrackParameters (Navigation!)"};
330 BooleanProperty m_landauMode{this, "LandauMode", false,
331 "If in Landau mode, error propagation is done as for landaus"};
332 IntegerProperty m_validationDirection{this, "ValidationDirection", 1,
333 "validation direction"};
334 // ------------------------------
335 DoubleProperty m_momentumCut{this, "MinimalMomentum", 50. * Gaudi::Units::MeV,
336 "Minimal momentum cut for update"};
337 DoubleProperty m_momentumMax{this, "MaximalMomentum", 10. * Gaudi::Units::TeV,
338 "Maximal momentum cut for update"};
339 DoubleProperty m_forcedMomentum
340 {this, "ForcedMomentumValue", 2000. * Gaudi::Units::MeV, "Forced momentum value"};
341
342 ToolHandle<IEnergyLossUpdator> m_eLossUpdator
343 {this, "EnergyLossUpdator", "Trk::EnergyLossUpdator/AtlasEnergyLossUpdator",
344 "AlgoTool for EnergyLoss updates"};
345 ToolHandle<IMultipleScatteringUpdator> m_msUpdator
346 {this, "MultipleScatteringUpdator",
347 "Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator",
348 "AlgoTool for MultipleScatterin effects"};
349 ToolHandle<IMaterialMapper> m_materialMapper
350 {this, "ValidationMaterialMapper", "Trk::MaterialMapper/AtlasMaterialMapper",
351 "the material mapper for recording the layer material"};
352
353 /*
354 * TLS part
355 */
356 mutable boost::thread_specific_ptr<ICache> m_cache_tls;
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 }
366};
367} // end of namespace
368
369#endif // TRKEXTOOLS_MATERIALEFFECTSUPDATOR_H
370
#define AmgSymMatrix(dim)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Cache class to allow passing information to/between calls.
Interface class for the updater AlgTool, it inherits from IAlgTool.
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
represents the full description of deflection and e-loss of a track in material.
ToolHandle< IMultipleScatteringUpdator > m_msUpdator
std::unique_ptr< TrackParameters > postUpdateImpl(ICache &cache, const TrackParameters &parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
static void validationActionImpl(ICache &cache)
virtual std::unique_ptr< TrackParameters > update(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.
IMaterialEffectsUpdator::ICache ICache
virtual std::unique_ptr< TrackParameters > update(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 --...
virtual std::unique_ptr< TrackParameters > update(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):
TrackParameters * finalLandauCovarianceUpdate(const TrackParameters *parm) const
ToolHandle< IEnergyLossUpdator > m_eLossUpdator
virtual void modelAction(const TrackParameters *parm=nullptr) const override final
Model Action: Provides the possibility of doing non-local MaterialEffectsUpdates for different models...
virtual std::unique_ptr< TrackParameters > postUpdate(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):
bool checkCovariance(AmgSymMatrix(5) &updated) const
A simple check method for the 'removeNoise' update model.
virtual std::unique_ptr< TrackParameters > postUpdate(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 i...
virtual void validationAction() const override final
Validation Action: outside access to internal validation steps Optional.
virtual void modelAction(ICache &cache, const TrackParameters *parm=nullptr) const override final
Only has an effect if m_landauMode == true.
virtual std::unique_ptr< TrackParameters > update(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 std::unique_ptr< TrackParameters > update(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.
std::unique_ptr< TrackParameters > preUpdateImpl(ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
MaterialEffectsUpdator(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
virtual void validationAction(ICache &cache) const override final
Validation Action - calls the writing and resetting of the TTree variables.
std::unique_ptr< TrackParameters > updateImpl(ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
virtual std::unique_ptr< TrackParameters > update(const TrackParameters *parm, const MaterialEffectsOnTrack &meff, Trk::ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override final
User updator interface (full update for a layer):
ToolHandle< IMaterialMapper > m_materialMapper
boost::thread_specific_ptr< ICache > m_cache_tls
virtual std::unique_ptr< TrackParameters > preUpdate(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 StatusCode initialize() override
AlgTool initailize method.
static void modelActionImpl(ICache &cache, const TrackParameters *parm=nullptr)
virtual ~MaterialEffectsUpdator()
Virtual destructor.
virtual std::unique_ptr< TrackParameters > preUpdate(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.
Material with information about thickness of material.
Ensure that the ATLAS eigen extensions are properly loaded.
PropDirection
PropDirection, enum for direction of the propagation.
@ alongMomentum
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
MaterialUpdateMode
This is a steering enum to force the material update it can be: (1) addNoise (-1) removeNoise Second ...
ParametersBase< TrackParametersDim, Charged > TrackParameters