ATLAS Offline Software
Loading...
Searching...
No Matches
LocalExtrapolatorCache.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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;
90 } else {
91 result = txt + " X0 " +std::to_string(m_extrapolationCache->x0tot()) + " Eloss deltaE "
92 + std::to_string(m_extrapolationCache->eloss()->deltaE()) + " Eloss sigma "
93 + std::to_string(m_extrapolationCache->eloss()->sigmaDeltaE()) + " meanIoni "
94 + std::to_string(m_extrapolationCache->eloss()->meanIoni()) + " sigmaIoni "
95 + std::to_string(m_extrapolationCache->eloss()->sigmaIoni()) + " meanRad "
96 + std::to_string(m_extrapolationCache->eloss()->meanRad()) + " sigmaRad "
97 + std::to_string(m_extrapolationCache->eloss()->sigmaRad());
98 }
99 return result;
100 }
101
102
103 bool
105 return (m_cacheEloss != nullptr && m_cacheEloss != m_extrapolationCache->eloss());
106 }
107
108 std::string
109 Cache::elossPointerErrorMsg(int lineNumber) const{
110 std::string result;
111 if (lineNumber !=0) result = "Line " + std::to_string(lineNumber)+": ";
112 result += " PROBLEM Eloss cache pointer overwritten " + std::to_string(reinterpret_cast<std::uintptr_t>(m_cacheEloss))
113 + " from extrapolationCache " + std::to_string(reinterpret_cast<std::uintptr_t>(m_extrapolationCache->eloss()));
114 return result;
115 }
116
117 void
119 m_staticBoundaries.clear();
120 const auto& bounds = m_currentStatic->boundarySurfaces();
121 for (size_t ib=0; ib< bounds.size(); ++ib){
122 const Trk::Surface& surf = bounds[ib]->surfaceRepresentation();
123 m_staticBoundaries.emplace_back(&surf, true);
124 }
125 }
126
127 void
128 Cache::addOneNavigationLayer(const Trk::TrackingVolume* pDetVol, const Trk::Layer* pLayer, bool boundaryCheck){
129 m_layers.emplace_back(&(pLayer->surfaceRepresentation()), boundaryCheck);
130 m_navigLays.emplace_back(pDetVol, pLayer);
131 }
132
133 void
134 Cache::addOneNavigationLayer(const Trk::Layer* pLayer, bool boundaryCheck){
135 m_layers.emplace_back(&(pLayer->surfaceRepresentation()), boundaryCheck);
136 m_navigLays.emplace_back(m_currentStatic, pLayer);
137 }
138
139 void
141 if (!m_layers.empty()) {
142 m_navigSurfs.insert(m_navigSurfs.end(), m_layers.begin(), m_layers.end());
143 }
144 if (!m_denseBoundaries.empty()) {
145 m_navigSurfs.insert(m_navigSurfs.end(), m_denseBoundaries.begin(), m_denseBoundaries.end());
146 }
147 if (!m_navigBoundaries.empty()) {
148 m_navigSurfs.insert(m_navigSurfs.end(), m_navigBoundaries.begin(), m_navigBoundaries.end());
149 }
150 if (!m_detachedBoundaries.empty()) {
152 }
153 }
154
155
156}
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.
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