ATLAS Offline Software
Loading...
Searching...
No Matches
TimedExtrapolator.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// TimedExtrapolator.h, (c) ATLAS Detector software
8
9#ifndef TRKEXTOOLS_TIMEDEXTRAPOLATOR_H
10#define TRKEXTOOLS_TIMEDEXTRAPOLATOR_H
11
13
16
17// Gaudi
19#include "GaudiKernel/ToolHandle.h"
20// Trk
30// STL
31#include <cstring>
32#include <map>
33#include <vector>
34
35// For marking not thread safety
37class MsgStream;
38
39namespace Trk {
40
41class Track;
42class Surface;
43class Layer;
44class Volume;
49class IPropagator;
51class INavigator;
54
55typedef std::vector<const Trk::TrackParameters*> TrackParametersVector;
56
57typedef std::pair<const Surface*, BoundaryCheck> DestSurf;
58
60{
61 const Surface* surface; // surface
62 double distance; // distance to surface
63 unsigned int bIndex; // boundary index for fast navigation to the next volume
64 //
65 DestBound(const Surface* surf, double dist, unsigned int index)
66 : surface(surf)
67 , distance(dist)
68 , bIndex(index)
69 {
70 }
71};
72
74{
78 //
80 const TrackingVolume* exitTV,
81 const TrackingVolume* entryTV)
82 : trPar(parms)
83 , exitVol(exitTV)
84 , entryVol(entryTV)
85 {
86 }
87};
88
90{
91 float distance;
94 //
95 IdentifiedIntersection(float dist, int id, const Trk::Material* mat)
96 : distance(dist)
97 , identifier(id)
98 , material(mat)
99 {
100 }
101};
102
109
111{
117
119 : nextVolume(nullptr)
120 , nextParameters(nullptr)
121 , navParameters(nullptr)
123 {
124 }
125
128 const TrackParameters* nextPars,
129 const TrackParameters* navPars,
131 {
132 nextVolume = tvol;
133 nextParameters = nextPars;
134 navParameters = navPars;
135 exitFace = face;
136 }
137
140 {
141 nextVolume = nullptr;
142 nextParameters = nullptr;
143 navParameters = nullptr;
145 }
146};
147
160
162 : public AthAlgTool
163 , virtual public ITimedExtrapolator
164{
165public:
167 TimedExtrapolator(const std::string&, const std::string&, const IInterface*);
170
177 virtual StatusCode initialize() override;
179 virtual StatusCode finalize() override;
180
185 virtual std::unique_ptr<const Trk::TrackParameters> extrapolateWithPathLimit(
186 const Trk::TrackParameters& parm,
187 Trk::PathLimit& pathLim,
188 Trk::TimeLimit& time,
191 std::vector<Trk::HitInfo>*& hitVector,
192 Trk::GeometrySignature& nextGeoID,
193 const Trk::TrackingVolume* boundaryVol = nullptr) const override;
194
199 virtual std::unique_ptr<const Trk::TrackParameters>
201 const Trk::TrackParameters& parm,
202 Trk::PathLimit& pathLim,
203 Trk::TimeLimit& time,
206 std::vector<Trk::HitInfo>*& hitVector,
207 Trk::GeometrySignature& nextGeoId,
208 const Trk::TrackingVolume* boundaryVol = nullptr) const override;
209
212 virtual const TrackingGeometry* trackingGeometry() const override;
213
217 virtual void validationAction() const override;
218
219private:
220 struct Cache;
221 std::unique_ptr<const Trk::TrackParameters> extrapolateToVolumeWithPathLimit(
223 const Trk::TrackParameters& parm,
224 Trk::TimeLimit& time,
227 Trk::GeometrySignature& nextGeoID,
228 const Trk::TrackingVolume* destVol) const;
229
231 const Trk::TrackParameters& parm,
232 Trk::TimeLimit& time,
235 Trk::GeometrySignature& nextGeoId,
236 const Trk::AlignableTrackingVolume* aliTV) const;
237
238 std::unique_ptr<const Trk::TrackParameters> transportToVolumeWithPathLimit(
240 const Trk::TrackParameters& parm,
241 Trk::TimeLimit& time,
244 Trk::GeometrySignature& nextGeoId,
245 const Trk::TrackingVolume* boundaryVol) const;
246
248 const Trk::TrackParameters& parm,
249 Trk::TimeLimit& time,
252 Trk::GeometrySignature& nextGeoId,
253 const Trk::AlignableTrackingVolume* aliTV) const;
254
256 const IPropagator* subPropagator(const TrackingVolume& tvol) const;
257
260
263 const Trk::TrackParameters* garbage) const;
264
267
270 const IPropagator& prop,
271 const TrackParameters& parm,
272 const TrackParameters& parsOnLayer,
273 const Layer& lay,
274 // const TrackingVolume& tvol,
275 float time,
277 const BoundaryCheck& bcheck = true,
278 ParticleHypothesis particle = pion,
279 bool startingLayer = false) const;
280
283 // unsigned int geoIDToDetOrder(Trk::GeometrySignature geoid) const;
284
286 std::string positionOutput(const Amg::Vector3D& pos) const;
287
289 static std::string momentumOutput(const Amg::Vector3D& mom);
290
291 // --------------- Used Tools ----------------------------- //
292
293 ToolHandleArray<IPropagator> m_propagators{this,
294 "Propagators", {}, "Array of Propagators"};
295 ToolHandle<IPropagator> m_stepPropagator{this,
296 "STEP_Propagator", "Trk::STEP_Propagator/AtlasSTEP_Propagator"};
297 ToolHandle<INavigator> m_navigator{this,
298 "Navigator", "Trk::Navigator/AtlasNavigator",
299 "Navigator for TrackingGeometry and magnetic fiels access"};
300 ToolHandleArray<ITimedMatEffUpdator> m_updators{this,
301 "MaterialEffectsUpdators", {}, "Array of Material Updators"};
302 ToolHandleArray<IMultipleScatteringUpdator> m_msupdators{this,
303 "MultipleScatteringUpdators", {}, " Array of MultipleScattering Updators"};
304 ToolHandle<IEnergyLossUpdator> m_elossupdater{this,
305 "EnergyLossUpdater", "Trk::EnergyLossUpdator/AtlasEnergyLossUpdator"};
306
307 // ---------------- For Extrapolation handling ------------ //
308
309 std::vector<const IPropagator*>
311 std::vector<const ITimedMatEffUpdator*>
313
314 // ---------------- For Extrapolator configuration ------------ //
315
316 StringArrayProperty m_propNames{this, "SubPropagators", {},
317 "configuration of subPropagators"};
318 StringArrayProperty m_updatNames{this, "SubMEUpdators", {},
319 "configuration of subupdaters"};
320
321 // --------------- General steering & Navigation -------------- //
322
323 UnsignedIntegerProperty m_meotpIndex{
324 this, "MaterialEffectsOnTrackProviderIndex", 0,
325 "if several meotps are available in a volume steer which one to use"};
326 unsigned int m_configurationLevel = 10;
328 BooleanProperty m_includeMaterialEffects{this, "ApplyMaterialEffects", true,
329 "boolean to switch on/off material effects"};
330 BooleanProperty m_stopWithNavigationBreak{this, "StopWithNavigationBreak", false,
331 "return 0 if navigation breaks - for validation reasons"};
332 BooleanProperty m_stopWithUpdateZero{this, "StopWithUpdateKill", false,
333 "return 0 if update kills the trajectory"};
334 BooleanProperty m_skipInitialLayerUpdate{this, "SkipInitialPostUpdate", false,
335 "skip the initial post-Update at the layer [Fatras conversion mode]"};
336 BooleanProperty m_referenceMaterial{this, "ReferenceMaterial", false,
337 "use the reference material for the update"};
338 UnsignedIntegerProperty m_initialLayerAttempts{this, "InitialLayerAttempts", 3,
339 "allowed layer intersection attempts at the start of a volume"};
340 UnsignedIntegerProperty m_successiveLayerAttempts{
341 this, "SuccessiveLayerAttempts", 1,
342 "layer intersection attemps after one layer has been hit sucessfully"};
343
344 DoubleProperty m_tolerance{this, "Tolerance", 0.002, "surface & volume tolerance"};
345
346 BooleanProperty m_caloMsSecondary{this, "CaloMsSecondary", false,
347 "handling of secondaries beyond ID"};
348
349 // ------------------------------------------------------- //
350
351 BooleanProperty m_robustSampling{this, "RobustSampling", true};
353 this, "UseDenseVolumeDescription", true,
354 "use dense volume description when available in ID/Calo"};
355 BooleanProperty m_useMuonMatApprox{this, "UseMuonMatApproximation", false,
356 "use approximative MS inert material"};
357 BooleanProperty m_resolveActive{this, "ResolveMuonStation", false};
358 BooleanProperty m_resolveMultilayers{this, "ResolveMultilayers", true};
359
360 //-------------------------- SCREEN output steering
361 //-------------------------------------------//
362 BooleanProperty m_printHelpOutputAtInitialize{this, "HelpOutput", false};
363 BooleanProperty m_printRzOutput{this, "positionOutput", true};
364 // ----------------------------- navigation validation section
365 // -----------------------------------------------------------
366
367 BooleanProperty m_navigationStatistics{this, "NavigationStatisticsOutput", false,
368 "steer the output for the navigation statistics"};
369 BooleanProperty m_navigationBreakDetails{this, "DetailedNavigationOutput", false,
370 "steer the output for the navigation break details"};
372 "MaterialEffectsOnTrackValidation", false, "mat effects on track validation"};
373 unsigned int m_maxNavigSurf{};
374 unsigned int m_maxNavigVol{};
375
376 struct Cache
377 {
378 Cache(unsigned int max_navig_surf = 1000.)
379 : m_path(0., 0)
380 {
381 m_navigSurfs.reserve(max_navig_surf);
382 }
384 {
385 for (std::pair<const Trk::TrackParameters*, bool> param : m_garbageBin) {
386 if (param.second) {
387 delete param.first;
388 }
389 }
390 }
391 bool m_dense{};
392
393 // ------------ Recall / Boundary Information ----------------------- //
395 std::vector<Trk::HitInfo>* m_hitVector{};
396
397 std::map<const Trk::TrackParameters*, bool>
399
403 std::pair<unsigned int, unsigned int> m_denseResolved{};
404 unsigned int m_layerResolved{};
405 std::vector<std::pair<const Trk::DetachedTrackingVolume*, unsigned int>> m_detachedVols;
406 std::vector<std::pair<const Trk::TrackingVolume*, unsigned int>> m_denseVols;
407 std::vector<std::pair<const Trk::TrackingVolume*, const Trk::Layer*>> m_navigLays;
408 std::vector<DestSurf> m_staticBoundaries;
409 std::vector<DestSurf> m_detachedBoundaries;
410 std::vector<DestSurf> m_denseBoundaries;
411 std::vector<DestSurf> m_navigBoundaries;
412 std::vector<DestSurf> m_layers;
414 double m_time{};
415
416 //------------------------- NAVIGATION --------
417 //----------------------------------------------//
419
420 // ------------------------------- cache
421 // --------------------------------------------------------------------
422
424
425 std::vector<std::pair<const Trk::Surface*, Trk::BoundaryCheck>> m_navigSurfs;
426 std::vector<std::pair<const Trk::Surface*, double>> m_trSurfs;
427 std::vector<Trk::DestBound> m_trStaticBounds; // need to cache the boundary index, too
428 std::vector<std::pair<const Trk::Surface*, double>> m_trDenseBounds;
429 std::vector<std::pair<const Trk::Surface*, double>> m_trLays;
430
432 };
433
434 //------------ Magnetic field properties
435 BooleanProperty m_fastField{this, "MagneticFieldProperties", false};
437
438
439};
440
441inline const TrackingGeometry*
443{
444 if (m_navigator) {
445 return m_navigator->trackingGeometry(Gaudi::Hive::currentContext());
446 }
447 return nullptr;
448}
449
450inline const IPropagator*
452{
453 const IPropagator* currentPropagator = (tvol.geometrySignature() < m_subPropagators.size())
455 : nullptr;
456 if (!currentPropagator) {
457 msg(MSG::ERROR) << "[!] Configuration problem: no Propagator found for volumeSignature: "
458 << tvol.geometrySignature() << endmsg;
459 }
460 return currentPropagator;
461}
462
463inline const ITimedMatEffUpdator*
465{
466 return (tvol.geometrySignature() < m_subUpdators.size()) ? m_subUpdators[tvol.geometrySignature()]
467 : nullptr;
468}
469
470inline void
472 const Trk::TrackParameters* pars) const
473{
474 if (pars)
475 cache.m_garbageBin[pars] = true;
476}
477
478
479} // end of namespace
480
481#endif // TRKEXTOOLS_TIMEDEXTRAPOLATOR_H
482
#define endmsg
std::vector< FPGATrackSimHit > hitVector
Define macros for attributes used to control the static checker.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
MsgStream & msg() const
Base Class for a navigation object (active) in the Calo realm.
The BoundaryCheck class allows to steer the way surface boundaries are used for inside/outside checks...
Base Class for a navigation object (active/passive) in the Tracking realm.
Interface class IDynamicLayerCreator It inherits from IAlgTool.
Interface class IEnergyLossUpdator.
Interface class IMultipleScatteringUpdator.
Interface class for the navigation AlgTool, it inherits from IAlgTool Detailed information about priv...
Definition INavigator.h:68
Interface class IPropagators It inherits from IAlgTool.
Definition IPropagator.h:55
Interface class for the extrapolation AlgTool, it inherits from IAlgTool Detailed information about p...
Interface class for the updater AlgTool, it inherits from IAlgTool Detailed information about private...
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
magnetic field properties to steer the behavior of the extrapolation
A common object to be contained by.
Definition Material.h:117
Abstract Base Class for tracking surfaces.
BoundaryTrackParameters transportInAlignableTV(Trk::TimedExtrapolator::Cache &cache, const Trk::TrackParameters &parm, Trk::TimeLimit &time, Trk::PropDirection dir, Trk::ParticleHypothesis particle, Trk::GeometrySignature &nextGeoId, const Trk::AlignableTrackingVolume *aliTV) const
ToolHandleArray< IPropagator > m_propagators
TimedExtrapolator(const std::string &, const std::string &, const IInterface *)
Constructor.
BooleanProperty m_resolveActive
const IPropagator * subPropagator(const TrackingVolume &tvol) const
Access the subPropagator to the given volume.
BooleanProperty m_navigationStatistics
BooleanProperty m_printRzOutput
BooleanProperty m_useDenseVolumeDescription
virtual StatusCode finalize() override
AlgTool finalize method.
virtual std::unique_ptr< const Trk::TrackParameters > transportNeutralsWithPathLimit(const Trk::TrackParameters &parm, Trk::PathLimit &pathLim, Trk::TimeLimit &time, Trk::PropDirection dir, Trk::ParticleHypothesis particle, std::vector< Trk::HitInfo > *&hitVector, Trk::GeometrySignature &nextGeoId, const Trk::TrackingVolume *boundaryVol=nullptr) const override
Transport method for neutral, possibly unstable particles.
BooleanProperty m_resolveMultilayers
BooleanProperty m_stopWithUpdateZero
std::unique_ptr< const Trk::TrackParameters > extrapolateToVolumeWithPathLimit(Trk::TimedExtrapolator::Cache &cache, const Trk::TrackParameters &parm, Trk::TimeLimit &time, Trk::PropDirection dir, Trk::ParticleHypothesis particle, Trk::GeometrySignature &nextGeoID, const Trk::TrackingVolume *destVol) const
ToolHandle< INavigator > m_navigator
ToolHandleArray< ITimedMatEffUpdator > m_updators
StringArrayProperty m_propNames
ToolHandle< IEnergyLossUpdator > m_elossupdater
BooleanProperty m_printHelpOutputAtInitialize
virtual const TrackingGeometry * trackingGeometry() const override
Return the TrackingGeometry used by the Extrapolator (forward information from Navigator)
ToolHandleArray< IMultipleScatteringUpdator > m_msupdators
BooleanProperty m_skipInitialLayerUpdate
Trk::MagneticFieldProperties m_fieldProperties
BooleanProperty m_stopWithNavigationBreak
ToolHandle< IPropagator > m_stepPropagator
BooleanProperty m_useMuonMatApprox
BooleanProperty m_includeMaterialEffects
BooleanProperty m_materialEffectsOnTrackValidation
UnsignedIntegerProperty m_meotpIndex
BoundaryTrackParameters extrapolateInAlignableTV(Trk::TimedExtrapolator::Cache &cache, const Trk::TrackParameters &parm, Trk::TimeLimit &time, Trk::PropDirection dir, Trk::ParticleHypothesis particle, Trk::GeometrySignature &nextGeoId, const Trk::AlignableTrackingVolume *aliTV) const
BooleanProperty m_navigationBreakDetails
UnsignedIntegerProperty m_successiveLayerAttempts
virtual void validationAction() const override
Validation Action: Can be implemented optionally, outside access to internal validation steps.
static std::string momentumOutput(const Amg::Vector3D &mom)
For the output - global momentum.
virtual ~TimedExtrapolator()
Destructor.
std::string positionOutput(const Amg::Vector3D &pos) const
Private method for conversion of the synchronized geometry signature to the natural subdetector order...
virtual std::unique_ptr< const Trk::TrackParameters > extrapolateWithPathLimit(const Trk::TrackParameters &parm, Trk::PathLimit &pathLim, Trk::TimeLimit &time, Trk::PropDirection dir, Trk::ParticleHypothesis particle, std::vector< Trk::HitInfo > *&hitVector, Trk::GeometrySignature &nextGeoID, const Trk::TrackingVolume *boundaryVol=nullptr) const override
Extrapolation method for charged, possibly unstable particles.
std::vector< const IPropagator * > m_subPropagators
Propagators to chose from (steered by signature)
unsigned int m_configurationLevel
see the supported levels of configuration above
std::vector< const ITimedMatEffUpdator * > m_subUpdators
Updators to chose from (steered by signature)
void emptyGarbageBin(Trk::TimedExtrapolator::Cache &cache, const Trk::TrackParameters *) const
Private method for emptying the GarbageBin.
StringArrayProperty m_updatNames
std::unique_ptr< const Trk::TrackParameters > transportToVolumeWithPathLimit(Trk::TimedExtrapolator::Cache &cache, const Trk::TrackParameters &parm, Trk::TimeLimit &time, Trk::PropDirection dir, Trk::ParticleHypothesis particle, Trk::GeometrySignature &nextGeoId, const Trk::TrackingVolume *boundaryVol) const
BooleanProperty m_caloMsSecondary
const ITimedMatEffUpdator * subMaterialEffectsUpdator(const TrackingVolume &tvol) const
Access the subPropagator to the given volume.
UnsignedIntegerProperty m_initialLayerAttempts
BooleanProperty m_referenceMaterial
virtual StatusCode initialize() override
AlgTool initailize method.
void throwIntoGarbageBin(Trk::TimedExtrapolator::Cache &cache, const Trk::TrackParameters *garbage) const
Private method for throwing into the GarbageBin.
BooleanProperty m_robustSampling
void overlapSearch(Trk::TimedExtrapolator::Cache &cache, const IPropagator &prop, const TrackParameters &parm, const TrackParameters &parsOnLayer, const Layer &lay, float time, PropDirection dir=anyDirection, const BoundaryCheck &bcheck=true, ParticleHypothesis particle=pion, bool startingLayer=false) const
Private to search for overlap surfaces.
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
GeometrySignature geometrySignature() const
return the Signature
Base class for all volumes inside the tracking realm, it defines the interface for inherited Volume c...
Definition Volume.h:36
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
PropDirection
PropDirection, enum for direction of the propagation.
@ anyDirection
BoundarySurfaceFace
Enum to describe the position of the BoundarySurface respectively to the frame orientatin of the volu...
std::vector< const Trk::TrackParameters * > TrackParametersVector
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
std::pair< const Surface *, BoundaryCheck > DestSurf
typedef for input surfaces, boundary check
Definition IPropagator.h:45
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition index.py:1
BoundaryTrackParameters(const TrackParameters *parms, const TrackingVolume *exitTV, const TrackingVolume *entryTV)
const TrackParameters * trPar
const TrackingVolume * exitVol
const TrackingVolume * entryVol
unsigned int bIndex
DestBound(const Surface *surf, double dist, unsigned int index)
const Surface * surface
const Trk::Material * material
IdentifiedIntersection(float dist, int id, const Trk::Material *mat)
const TrackParameters * navParameters
void boundaryInformation(const TrackingVolume *tvol, const TrackParameters *nextPars, const TrackParameters *navPars, BoundarySurfaceFace face=undefinedFace)
reset the boundary information by invalidating it
const TrackingVolume * nextVolume
< the members
const TrackParameters * nextParameters
ParamsNextVolume()
update the boundaryInformation
BoundarySurfaceFace exitFace
std::pair< unsigned int, unsigned int > m_denseResolved
std::vector< DestSurf > m_staticBoundaries
const Trk::TrackingVolume * m_highestVolume
std::vector< std::pair< const Trk::TrackingVolume *, const Trk::Layer * > > m_navigLays
std::vector< std::pair< const Trk::Surface *, double > > m_trDenseBounds
std::vector< Trk::DestBound > m_trStaticBounds
const Trk::TrackingVolume * m_currentDense
std::vector< DestSurf > m_layers
const Trk::TrackingVolume * m_currentStatic
std::vector< std::pair< const Trk::Surface *, Trk::BoundaryCheck > > m_navigSurfs
Cache(unsigned int max_navig_surf=1000.)
std::vector< std::pair< const Trk::TrackingVolume *, unsigned int > > m_denseVols
const Layer * m_lastMaterialLayer
cache layer with last material update
std::vector< std::pair< const Trk::Surface *, double > > m_trLays
std::vector< std::pair< const Trk::Surface *, double > > m_trSurfs
std::vector< DestSurf > m_detachedBoundaries
std::map< const Trk::TrackParameters *, bool > m_garbageBin
garbage collection during extrapolation
std::vector< Trk::HitInfo > * m_hitVector
return helper for hit info
bool m_dense
internal switch for resolved configuration
ParamsNextVolume m_parametersAtBoundary
return helper for parameters and boundary
std::vector< std::pair< const Trk::DetachedTrackingVolume *, unsigned int > > m_detachedVols
std::vector< DestSurf > m_denseBoundaries
std::vector< DestSurf > m_navigBoundaries