ATLAS Offline Software
Loading...
Searching...
No Matches
Layer.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6// Layer.cxx, (c) ATLAS Detector software
8
9// Trk
10#include "TrkGeometry/Layer.h"
11
15#include "TrkSurfaces/Surface.h"
16#include "TrkVolumes/Volume.h"
17
19 double thickness,
20 std::unique_ptr<Trk::OverlapDescriptor> olap, int laytyp)
21 : m_surfaceArray(nullptr),
22 m_layerMaterialProperties(laymatprop.clone()),
24 m_overlapDescriptor(std::move(olap)),
25 m_previousLayer(nullptr),
26 m_nextLayer(nullptr),
27 m_binUtility(nullptr),
30 m_index(-1),
31 m_layerType(laytyp),
32 m_ref(0.) {}
33
34Trk::Layer::Layer(std::unique_ptr<Trk::SurfaceArray> surfaceArray, double thickness,
35 std::unique_ptr<Trk::OverlapDescriptor> olap, int laytyp)
39 m_overlapDescriptor(std::move(olap)),
40 m_previousLayer(nullptr),
41 m_nextLayer(nullptr),
42 m_binUtility(nullptr),
45 m_index(-1),
46 m_layerType(laytyp),
47 m_ref(0.) {}
48
49Trk::Layer::Layer(std::unique_ptr<Trk::SurfaceArray> surfaceArray,
50 const Trk::LayerMaterialProperties& laymatprop,
51 double thickness,
52 std::unique_ptr<Trk::OverlapDescriptor> olap, int laytyp)
54 m_layerMaterialProperties(laymatprop.clone()),
56 m_overlapDescriptor(std::move(olap)),
57 m_previousLayer(nullptr),
58 m_nextLayer(nullptr),
59 m_binUtility(nullptr),
62 m_index(-1),
63 m_layerType(laytyp),
64 m_ref(0.) {}
65
68 : nullptr),
70 ? lay.m_layerMaterialProperties->clone()
71 : nullptr),
74 lay.m_overlapDescriptor ? lay.m_overlapDescriptor->clone() : nullptr),
75 m_previousLayer(nullptr),
76 m_nextLayer(nullptr),
77 m_binUtility(nullptr),
80 m_index(-1),
82 m_ref(lay.m_ref) {}
83
85 if (this != &lay) {
89 (lay.m_overlapDescriptor) ? lay.m_overlapDescriptor->clone() : nullptr);
90 m_surfaceArray.reset((lay.m_surfaceArray) ? lay.m_surfaceArray->clone()
91 : nullptr);
93
94 // just assign by pointer
99 //
100 m_index = lay.m_index;
102 m_ref = lay.m_ref;
103 }
104 return (*this);
105}
106
108 if (m_surfaceArray) return m_surfaceArray->object(gp);
109 return nullptr;
110}
111
113 if (m_surfaceArray) return m_surfaceArray->object(lp);
114 return nullptr;
115}
116
117const Trk::Surface* Trk::Layer::subSurfaceReference(unsigned int idx) const {
118 // the reference surface
119 const Trk::Surface* referenceSurface = nullptr;
120 if (m_surfaceArray) {
121 // get a reference surface
122 std::span<Trk::Surface const * const> surfaces = std::as_const(*m_surfaceArray).arrayObjects();
123 // get a reference surface
124 unsigned int rfSurfaces = surfaces.size();
125 if (idx && idx < rfSurfaces) return surfaces[idx];
126 // get the first one which is non zero
127 for (unsigned int rsf = 0; rsf < rfSurfaces; ++rsf) {
128 referenceSurface = surfaces[rsf];
129 if (referenceSurface) break;
130 }
131 }
132 return referenceSurface;
133}
134
136 const BoundaryCheck& bchk) const {
137 return (surfaceRepresentation())
138 .isOnSurface(gp, bchk, 0.5 * m_layerThickness);
139}
140
141const Trk::Layer* Trk::Layer::previousLayer(bool skipNavLayer) const {
142 if (!skipNavLayer) return m_previousLayer;
143 const Trk::Layer* prevMatLayer = m_previousLayer;
144 // get the previoys Material layer
145 while (prevMatLayer && !prevMatLayer->layerMaterialProperties() &&
146 !prevMatLayer->surfaceArray())
147 prevMatLayer = prevMatLayer->previousLayer();
148 return prevMatLayer;
149}
150
151const Trk::Layer* Trk::Layer::nextLayer(bool skipNavLayer) const {
152 if (!skipNavLayer) return m_nextLayer;
153 const Trk::Layer* nextMatLayer = m_nextLayer;
154 // get the next Material layer
155 while (nextMatLayer && !nextMatLayer->layerMaterialProperties() &&
156 !nextMatLayer->surfaceArray())
157 nextMatLayer = nextMatLayer->nextLayer();
158 return nextMatLayer;
159}
160
162 const Amg::Vector3D& mom) const {
163 // no binutility -> no chance to find out the direction
164 if (!m_binUtility) return nullptr;
165 return (m_binUtility->orderDirection(gp, mom) == Trk::next) ? m_nextLayer
167}
168
170 const Trk::TrackParameters& parm) const {
172 return m_layerMaterialProperties->fullMaterial(parm.position());
173 }
174 return nullptr;
175}
176
178 double scale) {
179 m_layerMaterialProperties.reset(prop.clone());
180 if (scale != 1.0) {
181 (*(m_layerMaterialProperties)) *= scale;
182 }
183}
184
185void
186Trk::Layer::compactify(size_t& cSurfaces, size_t& tSurfaces)
187{
188 // set the layer surface representation
189 ++tSurfaces;
190 if (surfaceRepresentation().owner() == Trk::noOwn) {
192 ++cSurfaces;
193 }
194 // set the subsurface representation, usually already owned by DetElement
195 if (m_surfaceArray) {
196 std::span<Trk::Surface * const> surfaces = m_surfaceArray->arrayObjects();
197 for (Trk::Surface * const sIter : surfaces) {
198 if (sIter && (*sIter).owner() == Trk::noOwn) {
199 (*sIter).setOwner(Trk::TGOwn);
200 ++cSurfaces;
201 }
202 ++tSurfaces;
203 }
204 }
205}
206
211 const Trk::BoundaryCheck&, bool,
212 const Trk::ICompatibilityEstimator*) const {
213 return surfaceRepresentation();
214}
215
217 std::vector<Trk::SurfaceIntersection>& cSurfaces,
219 const Trk::BoundaryCheck& bcheck, bool materialSurfacesOnly,
220 const Trk::Surface* startSurface, const Trk::Surface* endSurface,
221 const Trk::ICompatibilityEstimator* ice) const {
222 return getCompatibleSurfaces(cSurfaces, pars, pdir, bcheck,
223 materialSurfacesOnly, startSurface, endSurface,
224 ice);
225}
226
228 std::vector<Trk::SurfaceIntersection>& cSurfaces,
230 const Trk::BoundaryCheck& bcheck, bool materialSurfacesOnly,
231 const Trk::Surface* startSurface, const Trk::Surface* endSurface,
232 const Trk::ICompatibilityEstimator* ice) const {
233 return getCompatibleSurfaces(cSurfaces, pars, pdir, bcheck,
234 materialSurfacesOnly, startSurface, endSurface,
235 ice);
236}
237
238bool Trk::Layer::hasSubStructure(bool resolveSensitive) const {
239 return resolveSensitive && m_surfaceArray;
240}
The BoundaryCheck class allows to steer the way surface boundaries are used for inside/outside checks...
This virtual base class encapsulates the logics to build pre/post/full update material for Layer stru...
virtual LayerMaterialProperties * clone() const =0
Pseudo-Constructor clone()
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
void assignMaterialProperties(const LayerMaterialProperties &, double scale=1.0)
assignMaterialPropeties
Definition Layer.cxx:177
size_t compatibleSurfaces(std::vector< SurfaceIntersection > &cSurfaces, const TrackParameters &pars, PropDirection pdir, const BoundaryCheck &bcheck, bool materialSurfacesOnly=true, const Surface *startSurface=nullptr, const Surface *endSurface=nullptr, const ICompatibilityEstimator *ice=nullptr) const
get compatible surfaces starting from charged parameters
void compactify(size_t &cSurfaces, size_t &tSurfaces)
register layer index for material map registration
Definition Layer.cxx:186
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const Layer * previousLayer(bool skipNavLayer=false) const
getting what's stored to be the previous Layer, boolean to skip navigation layers
Definition Layer.cxx:141
Layer()=default
Default Constructor.
const MaterialProperties * fullUpdateMaterialProperties(const TrackParameters &par) const
getting the MaterialProperties back - for full update
Definition Layer.cxx:169
virtual bool isOnLayer(const Amg::Vector3D &gp, const BoundaryCheck &bcheck=BoundaryCheck(true)) const
isOnLayer() method, using isOnSurface() with Layer specific tolerance
Definition Layer.cxx:135
LayerIndex m_index
LayerIndex.
Definition Layer.h:306
const Layer * m_previousLayer
< the previous Layer according to BinGenUtils
Definition Layer.h:296
const Layer * nextLayer(const Amg::Vector3D &gp, const Amg::Vector3D &udir) const
getting the next/previous Layer if registered - unit for direction vector required
Definition Layer.cxx:161
const SurfaceArray * surfaceArray() const
Return the entire SurfaceArray, returns nullptr if no SurfaceArray.
const LayerMaterialProperties * layerMaterialProperties() const
getting the LayerMaterialProperties including full/pre/post update
std::unique_ptr< OverlapDescriptor > m_overlapDescriptor
Definition Layer.h:292
const Layer * m_nextLayer
BinUtility for next/previous decision.
Definition Layer.h:298
double m_layerThickness
descriptor for overlap/next surface (owning ptr)
Definition Layer.h:290
double thickness() const
Return the Thickness of the Layer.
const DetachedTrackingVolume * m_enclosingDetachedTrackingVolume
Definition Layer.h:304
Layer & operator=(const Layer &lay)
Assignment operator for Derived classes.
Definition Layer.cxx:84
const BinUtility * m_binUtility
Enclosing TrackingVolume.
Definition Layer.h:300
virtual bool hasSubStructure(bool resolveSensitive=false) const
Has sub-structure method:
Definition Layer.cxx:238
int m_layerType
active passive layer
Definition Layer.h:307
const Surface * subSurface(const Amg::Vector3D &gp) const
If no subSurface array is defined or no subSurface can be found to the given Amg::Vector3D,...
Definition Layer.cxx:107
double m_ref
reference measure for local coordinate convertors
Definition Layer.h:308
std::unique_ptr< LayerMaterialProperties > m_layerMaterialProperties
thickness of the Layer
Definition Layer.h:288
virtual const Surface & surfaceOnApproach(const Amg::Vector3D &pos, const Amg::Vector3D &dir, PropDirection pdir, const BoundaryCheck &bcheck, bool resolveSubSurfaces=0, const ICompatibilityEstimator *ice=nullptr) const
Surface seen on approach - if not defined differently, it is the surfaceRepresentation()
Definition Layer.cxx:209
const TrackingVolume * m_enclosingTrackingVolume
Enclosing DetachedTrackingVolume.
Definition Layer.h:302
std::unique_ptr< SurfaceArray > m_surfaceArray
MaterialPoperties of this layer Surface.
Definition Layer.h:286
const Surface * subSurfaceReference(unsigned int idx=0) const
Return a reference sub surface of the layer, usually the first one in the array.
Definition Layer.cxx:117
Material with information about thickness of material.
const Amg::Vector3D & position() const
Access method for the position.
Abstract Base Class for tracking surfaces.
virtual bool isOnSurface(const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const
This method returns true if the GlobalPosition is on the Surface for both, within or without check of...
Definition Surface.cxx:123
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
PropDirection
PropDirection, enum for direction of the propagation.
@ next
Definition BinningData.h:33
ParametersBase< NeutralParametersDim, Neutral > NeutralParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
STL namespace.