ATLAS Offline Software
LocalExtrapolatorCache.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 #include "TrkSurfaces/Surface.h"
7 
8 
9 namespace Trk{
10 
12  : m_trackParmContainer(128)
13  , m_lastValidParameters(m_trackParmContainer)
14  , m_parametersAtBoundary(m_trackParmContainer)
15  {
16  m_navigSurfs.reserve(1024);
17  m_navigVols.reserve(64);
18  m_navigVolsInt.reserve(64);
19  }
20 
21  Cache::Cache(const std::vector<const IMaterialEffectsUpdator*> & updaters)
22  : m_trackParmContainer(128), m_lastValidParameters(m_trackParmContainer),
23  m_parametersAtBoundary(m_trackParmContainer){
24  m_navigSurfs.reserve(1024);
25  m_navigVols.reserve(64);
26  m_navigVolsInt.reserve(64);
28  }
29 
30  Cache::~Cache() = default;
31 
34  return m_MaterialUpCache[tvol.geometrySignature()];
35  }
36 
40  }
41 
42  void
43  Cache::populateMatEffUpdatorCache(const std::vector<const IMaterialEffectsUpdator*> & updaters) {
44  size_t numUpdaters = updaters.size();
45  m_MaterialUpCache.reserve(numUpdaters);
46  for (const auto & thisUpdater : updaters) {
47  m_MaterialUpCache.emplace_back(thisUpdater->getCache());
48  }
49  }
50 
51  void
52  Cache::setRecallInformation(const Surface& rsf,const Layer& rlay,const TrackingVolume& rvol) {
53  m_recall = true;
54  m_recallSurface = &rsf;
55  m_recallLayer = &rlay;
56  m_recallTrackingVolume = &rvol;
57  }
58 
59  void
61  m_recall = false;
62  m_recallSurface = nullptr;
63  m_recallLayer = nullptr;
64  m_recallTrackingVolume = nullptr;
65  }
66 
67  std::string
68  Cache::to_string(const std::string& txt) const{
69  std::string result;
72  } else {
73  result = txt + " X0 " +std::to_string(m_extrapolationCache->x0tot()) + " Eloss deltaE "
74  + std::to_string(m_extrapolationCache->eloss()->deltaE()) + " Eloss sigma "
76  + std::to_string(m_extrapolationCache->eloss()->meanIoni()) + " sigmaIoni "
77  + std::to_string(m_extrapolationCache->eloss()->sigmaIoni()) + " meanRad "
78  + std::to_string(m_extrapolationCache->eloss()->meanRad()) + " sigmaRad "
80  }
81  return result;
82  }
83 
84 
85  bool
87  return (m_cacheEloss != nullptr && m_cacheEloss != m_extrapolationCache->eloss());
88  }
89 
90  std::string
91  Cache::elossPointerErrorMsg(int lineNumber) const{
92  std::string result;
93  if (lineNumber !=0) result = "Line " + std::to_string(lineNumber)+": ";
94  result += " PROBLEM Eloss cache pointer overwritten " + std::to_string(reinterpret_cast<std::uintptr_t>(m_cacheEloss))
95  + " from extrapolationCache " + std::to_string(reinterpret_cast<std::uintptr_t>(m_extrapolationCache->eloss()));
96  return result;
97  }
98 
99  void
101  m_staticBoundaries.clear();
102  const auto& bounds = m_currentStatic->boundarySurfaces();
103  for (size_t ib=0; ib< bounds.size(); ++ib){
104  const Trk::Surface& surf = bounds[ib]->surfaceRepresentation();
105  m_staticBoundaries.emplace_back(&surf, true);
106  }
107  }
108 
109  void
110  Cache::addOneNavigationLayer(const Trk::TrackingVolume* pDetVol, const Trk::Layer* pLayer, bool boundaryCheck){
111  m_layers.emplace_back(&(pLayer->surfaceRepresentation()), boundaryCheck);
112  m_navigLays.emplace_back(pDetVol, pLayer);
113  }
114 
115  void
116  Cache::addOneNavigationLayer(const Trk::Layer* pLayer, bool boundaryCheck){
117  m_layers.emplace_back(&(pLayer->surfaceRepresentation()), boundaryCheck);
118  m_navigLays.emplace_back(m_currentStatic, pLayer);
119  }
120 
121  void
123  if (!m_layers.empty()) {
124  m_navigSurfs.insert(m_navigSurfs.end(), m_layers.begin(), m_layers.end());
125  }
126  if (!m_denseBoundaries.empty()) {
127  m_navigSurfs.insert(m_navigSurfs.end(), m_denseBoundaries.begin(), m_denseBoundaries.end());
128  }
129  if (!m_navigBoundaries.empty()) {
130  m_navigSurfs.insert(m_navigSurfs.end(), m_navigBoundaries.begin(), m_navigBoundaries.end());
131  }
132  if (!m_detachedBoundaries.empty()) {
134  }
135  }
136 
137 
138 }
Trk::Cache::subMaterialEffectsUpdatorCache
IMaterialEffectsUpdator::ICache & subMaterialEffectsUpdatorCache()
Definition: LocalExtrapolatorCache.cxx:38
Trk::Cache::m_detachedBoundaries
std::vector< DestSurf > m_detachedBoundaries
Definition: LocalExtrapolatorCache.h:81
Trk::IMaterialEffectsUpdator::ICache
Cache class to allow passing information to/between calls.
Definition: IMaterialEffectsUpdator.h:63
get_generator_info.result
result
Definition: get_generator_info.py:21
Surface.h
Trk::TrackingVolume::geometrySignature
GeometrySignature geometrySignature() const
return the Signature
Trk::Cache::m_MaterialUpCache
std::vector< Trk::IMaterialEffectsUpdator::ICache > m_MaterialUpCache
internal switch for resolved configuration
Definition: LocalExtrapolatorCache.h:41
Trk::TrackingVolume::boundarySurfaces
std::vector< SharedObject< BoundarySurface< TrackingVolume > > > & boundarySurfaces()
Method to return the BoundarySurfaces.
Definition: TrackingVolume.cxx:982
Trk::Cache::m_extrapolationCache
Trk::ExtrapolationCache * m_extrapolationCache
cache pointer for Eloss
Definition: LocalExtrapolatorCache.h:67
Trk::Cache::m_navigBoundaries
std::vector< DestSurf > m_navigBoundaries
Definition: LocalExtrapolatorCache.h:83
Trk::Cache::m_recallTrackingVolume
const TrackingVolume * m_recallTrackingVolume
Definition: LocalExtrapolatorCache.h:57
Trk::Cache::m_layers
std::vector< DestSurf > m_layers
Definition: LocalExtrapolatorCache.h:84
Trk::Cache::populateMatEffUpdatorCache
void populateMatEffUpdatorCache(const std::vector< const IMaterialEffectsUpdator * > &updaters)
Definition: LocalExtrapolatorCache.cxx:43
Trk::Cache::m_navigLays
std::vector< std::pair< const Trk::TrackingVolume *, const Trk::Layer * > > m_navigLays
Definition: LocalExtrapolatorCache.h:88
Trk::EnergyLoss::sigmaDeltaE
double sigmaDeltaE() const
returns the symmatric error
Trk::Cache::setRecallInformation
void setRecallInformation(const Surface &, const Layer &, const TrackingVolume &)
Private method for setting recall Information.
Definition: LocalExtrapolatorCache.cxx:52
Trk::Cache::retrieveBoundaries
void retrieveBoundaries()
Retrieve boundaries.
Definition: LocalExtrapolatorCache.cxx:100
Trk::Cache::resetRecallInformation
void resetRecallInformation()
Definition: LocalExtrapolatorCache.cxx:60
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
Trk::EnergyLoss::sigmaRad
double sigmaRad() const
Trk::EnergyLoss::meanIoni
double meanIoni() const
Trk::Cache::addOneNavigationLayer
void addOneNavigationLayer(const Trk::TrackingVolume *pDetVol, const Trk::Layer *pLayer, bool boundaryCheck=true)
Add one layer and navigLayer.
Definition: LocalExtrapolatorCache.cxx:110
ExtrapolationCache.h
Trk::Layer::surfaceRepresentation
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
Trk::Cache::m_navigSurfs
std::vector< std::pair< const Trk::Surface *, Trk::BoundaryCheck > > m_navigSurfs
Definition: LocalExtrapolatorCache.h:89
Trk::EnergyLoss::deltaE
double deltaE() const
returns the
Trk::Cache::m_staticBoundaries
std::vector< DestSurf > m_staticBoundaries
Definition: LocalExtrapolatorCache.h:80
Trk::Cache::m_denseBoundaries
std::vector< DestSurf > m_denseBoundaries
Definition: LocalExtrapolatorCache.h:82
Trk::Cache::m_recallSurface
const Surface * m_recallSurface
Destination Layer for recall.
Definition: LocalExtrapolatorCache.h:53
Trk::EnergyLoss::meanRad
double meanRad() const
Trk::Cache::m_recallLayer
const Layer * m_recallLayer
Destination TrackingVolume for recall.
Definition: LocalExtrapolatorCache.h:55
Trk::Cache::elossPointerErrorMsg
std::string elossPointerErrorMsg(int lineNumber=0) const
String error message if the cache has a problem.
Definition: LocalExtrapolatorCache.cxx:91
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
Trk::ExtrapolationCache::x0tot
double x0tot() const
LocalExtrapolatorCache.h
Trk::Cache::elossPointerOverwritten
bool elossPointerOverwritten() const
Check cache integrity.
Definition: LocalExtrapolatorCache.cxx:86
Trk::Cache::m_navigVols
std::vector< const Trk::DetachedTrackingVolume * > m_navigVols
Definition: LocalExtrapolatorCache.h:90
Trk::Cache::m_recall
bool m_recall
Definition: LocalExtrapolatorCache.h:45
Trk::Cache::to_string
std::string to_string(const std::string &txt) const
String representation of cache.
Definition: LocalExtrapolatorCache.cxx:68
Trk::Cache::copyToNavigationSurfaces
void copyToNavigationSurfaces()
Insert navigation surfaces from layers, dense boundaries, navig boundaries and detached boundaries.
Definition: LocalExtrapolatorCache.cxx:122
Trk::Cache::~Cache
~Cache()
Trk::Cache::Cache
Cache()
Definition: LocalExtrapolatorCache.cxx:11
Trk::Cache::m_navigVolsInt
std::vector< std::pair< const Trk::TrackingVolume *, unsigned int > > m_navigVolsInt
Definition: LocalExtrapolatorCache.h:91
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Trk::Cache::m_cacheEloss
const Trk::EnergyLoss * m_cacheEloss
cache of TrackStateOnSurfaces
Definition: LocalExtrapolatorCache.h:69
Trk::Cache::m_currentStatic
const Trk::TrackingVolume * m_currentStatic
Definition: LocalExtrapolatorCache.h:58
Trk::ExtrapolationCache::eloss
const EnergyLoss * eloss() const
Trk::EnergyLoss::sigmaIoni
double sigmaIoni() const
Trk::Layer
Definition: Layer.h:73