ATLAS Offline Software
Loading...
Searching...
No Matches
LocalExtrapolatorCache.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3 */
7
8namespace {
9 inline void setMaxAtomic(unsigned int new_value, std::atomic<unsigned int> &destination) {
10 for(;;) {
11 unsigned int is_value = destination;
12 unsigned int max_value = std::max(is_value,new_value);
13 if (max_value == is_value) break;
14 else if (destination.compare_exchange_weak(is_value,max_value)) { break; }
15 }
16 }
17}
18namespace Trk{
19
21 : m_ownedPtrs(128)
22 , m_statPtr(&stat){
23 m_navigSurfs.reserve(1024);
24 m_navigVols.reserve(64);
25 m_navigVolsInt.reserve(64);
26 }
27
28 Cache::Cache(const std::vector<const IMaterialEffectsUpdator*> & updaters)
29 : m_ownedPtrs(128){
30 m_navigSurfs.reserve(1024);
31 m_navigVols.reserve(64);
32 m_navigVolsInt.reserve(64);
34 }
35
37 if (m_statPtr) {
39 // only consider cases with some depth
40 setMaxAtomic(m_recursionCount[kMaxRecursionCount], m_statPtr->m_maxRecursionCount);
41 }
42 if (m_nPropagations > 200 ) {
43 // only consider cases with some propagations.
44 setMaxAtomic(m_nPropagations, m_statPtr->m_maxPropagations);
45 }
46 if (m_methodSequence>100 ) {
47 setMaxAtomic(m_methodSequence, m_statPtr->m_maxMethodSequence);
48 }
49 }
50 }
51
56
61
62 void
63 Cache::populateMatEffUpdatorCache(const std::vector<const IMaterialEffectsUpdator*> & updaters) {
64 const size_t numUpdaters = updaters.size();
65 m_MaterialUpCache.reserve(numUpdaters);
66 for (const auto & thisUpdater : updaters) {
67 m_MaterialUpCache.emplace_back(thisUpdater->getCache());
68 }
69 }
70
71 void
72 Cache::setRecallInformation(const Surface& rsf,const Layer& rlay,const TrackingVolume& rvol) {
73 m_recallSurface = &rsf;
74 m_recallLayer = &rlay;
76 }
77
78 void
80 m_recallSurface = nullptr;
81 m_recallLayer = nullptr;
82 m_recallTrackingVolume = nullptr;
83 }
84
85 std::string
86 Cache::to_string(const std::string& txt) const{
87 std::string result;
89 result = elossPointerErrorMsg();
90 } else {
92 result = txt + " X0 " +std::to_string(m_extrapolationCache->x0tot()) + " Eloss deltaE "
93 + std::to_string(m_extrapolationCache->eloss()->deltaE()) + " Eloss sigma "
94 + std::to_string(m_extrapolationCache->eloss()->sigmaDeltaE()) + " meanIoni "
95 + std::to_string(m_extrapolationCache->eloss()->meanIoni()) + " sigmaIoni "
96 + std::to_string(m_extrapolationCache->eloss()->sigmaIoni()) + " meanRad "
97 + std::to_string(m_extrapolationCache->eloss()->meanRad()) + " sigmaRad "
98 + std::to_string(m_extrapolationCache->eloss()->sigmaRad());
99 }
100 }
101 return result;
102 }
103
104
105 bool
109
110 std::string
111 Cache::elossPointerErrorMsg(int lineNumber) const{
112 std::string result;
113 if (lineNumber !=0) result = "Line " + std::to_string(lineNumber)+": ";
115 result += " PROBLEM Eloss cache pointer overwritten " + std::to_string(reinterpret_cast<std::uintptr_t>(m_cacheEloss))
116 + " from extrapolationCache " + std::to_string(reinterpret_cast<std::uintptr_t>(m_extrapolationCache->eloss()));
117 }
118 return result;
119 }
120
121 void
123 m_staticBoundaries.clear();
124 const auto& bounds = m_currentStatic->boundarySurfaces();
125 for (size_t ib=0; ib< bounds.size(); ++ib){
126 const Trk::Surface& surf = bounds[ib]->surfaceRepresentation();
127 m_staticBoundaries.emplace_back(&surf, true);
128 }
129 }
130
131 void
132 Cache::addOneNavigationLayer(const Trk::TrackingVolume* pDetVol, const Trk::Layer* pLayer, bool boundaryCheck){
133 m_layers.emplace_back(&(pLayer->surfaceRepresentation()), boundaryCheck);
134 m_navigLays.emplace_back(pDetVol, pLayer);
135 }
136
137 void
138 Cache::addOneNavigationLayer(const Trk::Layer* pLayer, bool boundaryCheck){
139 m_layers.emplace_back(&(pLayer->surfaceRepresentation()), boundaryCheck);
140 m_navigLays.emplace_back(m_currentStatic, pLayer);
141 }
142
143 void
145 if (!m_layers.empty()) {
146 m_navigSurfs.insert(m_navigSurfs.end(), m_layers.begin(), m_layers.end());
147 }
148 if (!m_denseBoundaries.empty()) {
149 m_navigSurfs.insert(m_navigSurfs.end(), m_denseBoundaries.begin(), m_denseBoundaries.end());
150 }
151 if (!m_navigBoundaries.empty()) {
152 m_navigSurfs.insert(m_navigSurfs.end(), m_navigBoundaries.begin(), m_navigBoundaries.end());
153 }
154 if (!m_detachedBoundaries.empty()) {
156 }
157 }
158
159
160}
Cache class to allow passing information to/between calls.
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
Abstract Base Class for tracking surfaces.
Definition Surface.h:79
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
GeometrySignature geometrySignature() const
return the Signature
Ensure that the ATLAS eigen extensions are properly loaded.
Cache(Dbg::PropStat &stat)
IMaterialEffectsUpdator::ICache & subMaterialEffectsUpdatorCache()
std::string elossPointerErrorMsg(int lineNumber=0) const
String error message if the cache has a problem.
const Trk::EnergyLoss * m_cacheEloss
cache of TrackStateOnSurfaces
void retrieveBoundaries()
Retrieve boundaries.
void setRecallInformation(const Surface &, const Layer &, const TrackingVolume &)
Private method for setting recall Information.
bool elossPointerOverwritten() const
Check cache integrity.
std::vector< std::pair< const Trk::Surface *, Trk::BoundaryCheck > > m_navigSurfs
std::array< unsigned short, kNRecursionValues > m_recursionCount
const TrackingVolume * m_recallTrackingVolume
const Layer * m_recallLayer
Destination TrackingVolume for recall.
std::vector< const Trk::DetachedTrackingVolume * > m_navigVols
std::vector< Trk::IMaterialEffectsUpdator::ICache > m_MaterialUpCache
internal switch for resolved configuration
void addOneNavigationLayer(const Trk::TrackingVolume *pDetVol, const Trk::Layer *pLayer, bool boundaryCheck=true)
Add one layer and navigLayer.
Dbg::PropStat * m_statPtr
std::vector< DestSurf > m_detachedBoundaries
void populateMatEffUpdatorCache(const std::vector< const IMaterialEffectsUpdator * > &updaters)
std::vector< std::pair< const Trk::TrackingVolume *, const Trk::Layer * > > m_navigLays
unsigned int m_nPropagations
const Surface * m_recallSurface
Destination Layer for recall.
std::vector< DestSurf > m_staticBoundaries
Trk::ExtrUniquePtrHolder< Trk::TrackParameters > m_ownedPtrs
parameters to be used for final propagation in case of fallback
std::vector< std::pair< const Trk::TrackingVolume *, unsigned int > > m_navigVolsInt
std::string to_string(const std::string &txt) const
String representation of cache.
std::vector< DestSurf > m_navigBoundaries
void copyToNavigationSurfaces()
Insert navigation surfaces from layers, dense boundaries, navig boundaries and detached boundaries.
Trk::ExtrapolationCache * m_extrapolationCache
cache pointer for Eloss
const Trk::TrackingVolume * m_currentStatic
std::vector< DestSurf > m_layers
unsigned int m_methodSequence
std::vector< DestSurf > m_denseBoundaries