ATLAS Offline Software
Loading...
Searching...
No Matches
ActsDetectorElement Class Reference

#include <ActsDetectorElement.h>

Inheritance diagram for ActsDetectorElement:
Collaboration diagram for ActsDetectorElement:

Public Types

using DetectorType = ActsTrk::DetectorType
using AlignmentStore = ActsTrk::GeometryContext::AlignmentStore

Public Member Functions

 ActsDetectorElement (const InDetDD::SiDetectorElement &detElem)
 ActsDetectorElement (const Acts::Transform3 &trf, const InDetDD::TRT_BaseElement &detElem, const Identifier &id)
 Constructor for a straw surface.
 ActsDetectorElement (const InDetDD::HGTD_DetectorElement &detElem, const Identifier &id)
 Constructor for an HGTD surface.
virtual ~ActsDetectorElement ()=default
 Destructor.
Identifier identify () const override final
 Identifier.
DetectorType detectorType () const override final
 Detector type.
IdentifierHash identifyHash () const
 Identifier hash.
virtual unsigned int storeAlignedTransforms (ActsTrk::DetectorAlignStore &alignStore) const override
 Caches the aligned transformation in the provided store.
const Acts::Transform3 & localToGlobalTransform (const Acts::GeometryContext &tgContext) const
const Acts::Transform3 & localToGlobalTransform (const ActsTrk::GeometryContext &gctx) const override
 Returns the aligned local to global transform from the passed geometry context.
virtual const Acts::Transform3 & localToGlobalTransform (const ActsTrk::DetectorAlignStore *store) const final override
 Returns the reference to the aligned local to global transform from the DetectorAlignStore actually holding the transform of the Detector element.
const Acts::Surface & surface () const
 Return surface associated with this identifier, which should come from the.
Acts::Surface & surface ()
 Mutable surface to this detector element.
const Trk::SurfaceatlasSurface () const
 Return a shared pointer on the ATLAS surface associated with this identifier,.
double thickness () const
 Returns the thickness of the module.
IdentityHelper identityHelper () const
const Acts::Transform3 & getDefaultTransform () const
 Returns default transform.
const GeoVDetectorElement * upstreamDetectorElement () const
 Returns the underllying GeoModel detectorelement that this one is based on.
Amg::Transform3D localToGlobal (const ActsTrk::DetectorAlignStore *store) const

Private Attributes

IdentifierHash m_idHash {}
DetectorType m_type {DetectorType::UnDefined}
ActsTrk::ReadoutSurfacePositioning< ActsDetectorElementm_trfCache {0, this}
std::shared_ptr< ActsTrk::SurfacePlacementm_surfHolder {}
const GeoVDetectorElement * m_detElement {nullptr}
 Detector element as variant.
std::shared_ptr< const Acts::SurfaceBounds > m_bounds {}
 Boundaries of the detector element.
double m_thickness {0.}
 Thickness of this detector element.
std::unique_ptr< const Amg::Transform3Dm_trtTrf {}
Identifier m_explicitIdentifier {}

Detailed Description

Definition at line 58 of file ActsDetectorElement.h.

Member Typedef Documentation

◆ AlignmentStore

◆ DetectorType

Constructor & Destructor Documentation

◆ ActsDetectorElement() [1/3]

ActsDetectorElement::ActsDetectorElement ( const InDetDD::SiDetectorElement & detElem)

Definition at line 65 of file ActsDetectorElement.cxx.

65 :
66 GeoVDetectorElement{detElem.getMaterialGeom()},
67 m_idHash(detElem.identifyHash()),
68 m_type{detElem.isPixel() ? DetectorType::Pixel : DetectorType::Sct},
69 m_detElement{&detElem},
71{
72
73
74 auto boundsType = detElem.bounds().type();
75
76 m_thickness = detElem.thickness();
77
78
79 if (boundsType == Trk::SurfaceBounds::Rectangle) {
80
81 const InDetDD::SiDetectorDesign &design = detElem.design();
82 double hlX = design.width() / 2. * length_unit;
83 double hlY = design.length() / 2. * length_unit;
84
85 auto rectangleBounds = std::make_shared<Acts::RectangleBounds>(hlX, hlY);
86
87 m_bounds = rectangleBounds;
89 m_surfHolder->surface().assignThickness(thickness());
90
91 } else if (boundsType == Trk::SurfaceBounds::Trapezoid) {
92
93 const InDetDD::SiDetectorDesign &design = detElem.design();
94
95 double minHlX = design.minWidth() / 2. * length_unit;
96 double maxHlX = design.maxWidth() / 2. * length_unit;
97 double hlY = design.length() / 2. * length_unit;
98
99 auto trapezoidBounds = std::make_shared<Acts::TrapezoidBounds>(minHlX, maxHlX, hlY);
100
101 m_bounds = trapezoidBounds;
102
104 m_surfHolder->surface().assignThickness(thickness());
105
106
107 } else if (boundsType == Trk::SurfaceBounds::Annulus) {
108
109 const InDetDD::SiDetectorDesign &design = detElem.design();
110 const auto *annulus = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&design);
111 if (annulus == nullptr) {
112 throw std::domain_error("ActsDetectorElement got inconsistent surface");
113 }
114
115 double phi = annulus->phiWidth();
116 double phiS = annulus->stereo();
117 double R = annulus->waferCentreR();
118 double maxR = annulus->maxR();
119 double minR = annulus->minR();
120
121 // phiAvg is the bounds-internal local rotation. We don't want one
122 double phiAvg = 0;
123 // phi is the total opening angle, set up symmetric phi bounds
124 double phiMax = phi / 2.;
125 double phiMin = -phiMax;
126
127
128 Amg::Vector2D originStripXYRotated(R * (1 - std::cos(phiS)),
129 R * std::sin(-phiS));
130
131 auto annulusBounds = std::make_shared<Acts::AnnulusBounds>(minR, maxR,
132 phiMin, phiMax,
133 originStripXYRotated, phiAvg);
134 m_bounds = annulusBounds;
135
137 m_surfHolder->surface().assignThickness(thickness());
138
139 } else {
140 std::cout << boundsType << std::endl;
141 throw std::domain_error("ActsDetectorElement does not support this surface type");
142 }
143}
constexpr double length_unit
Scalar phi() const
phi method
double m_thickness
Thickness of this detector element.
ActsTrk::ReadoutSurfacePositioning< ActsDetectorElement > m_trfCache
std::shared_ptr< const Acts::SurfaceBounds > m_bounds
Boundaries of the detector element.
std::shared_ptr< ActsTrk::SurfacePlacement > m_surfHolder
const GeoVDetectorElement * m_detElement
Detector element as variant.
double thickness() const
Returns the thickness of the module.
static std::shared_ptr< SurfacePlacement > makeShared(IReadoutSurfacePositioning &transformCache, std::shared_ptr< Bounds_t > &&bounds)
Factory method to create a SurfacePlacement together with an Acts::Surface.
virtual double maxWidth() const =0
Method to calculate maximum width of a module.
virtual double minWidth() const =0
Method to calculate minimum width of a module.
virtual double length() const =0
Method to calculate length of a module.
virtual double width() const =0
Method to calculate average width of a module.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
virtual const Trk::SurfaceBounds & bounds() const override final
Return the boundaries of the element.
virtual Identifier identify() const override final
identifier of this detector element (inline)
virtual BoundsType type() const =0
Return the bounds type - for persistency optimization.
Eigen::Matrix< double, 2, 1 > Vector2D
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)

◆ ActsDetectorElement() [2/3]

ActsDetectorElement::ActsDetectorElement ( const Acts::Transform3 & trf,
const InDetDD::TRT_BaseElement & detElem,
const Identifier & id )

Constructor for a straw surface.

Parameters
transformTransform to the straw system

Definition at line 145 of file ActsDetectorElement.cxx.

147 :
148 GeoVDetectorElement{detElem.getMaterialGeom()},
149 m_idHash(detElem.identifyHash()),
150 m_type{DetectorType::Trt},
151 m_detElement{&detElem},
152 m_trtTrf{std::make_unique<Amg::Transform3D>(trf)},
154{
155
156
157 // we know this is a straw
158 double length = detElem.strawLength() * 0.5 * length_unit;
159
160 // we need to find the radius
161 auto ecElem = dynamic_cast<const InDetDD::TRT_EndcapElement *>(&detElem);
162 auto brlElem = dynamic_cast<const InDetDD::TRT_BarrelElement *>(&detElem);
163 double innerTubeRadius{0.};
164 if (ecElem) {
165 innerTubeRadius = ecElem->getDescriptor()->innerTubeRadius() * length_unit;
166 } else {
167 if (brlElem) {
168 innerTubeRadius =
169 brlElem->getDescriptor()->innerTubeRadius() * length_unit;
170 } else {
171 THROW_EXCEPTION("Cannot get tube radius for element in ActsDetectorElement c'tor");
172 }
173 }
174
175 auto lineBounds = std::make_shared<Acts::LineBounds>(innerTubeRadius, length);
176 m_bounds = lineBounds;
177
179 m_surfHolder->surface().assignThickness(thickness());
180}
double length(const pvec &v)
std::unique_ptr< const Amg::Transform3D > m_trtTrf
virtual const double & strawLength() const =0
Active straw length.
virtual IdentifierHash identifyHash() const override final
identifier hash
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ ActsDetectorElement() [3/3]

ActsDetectorElement::ActsDetectorElement ( const InDetDD::HGTD_DetectorElement & detElem,
const Identifier & id )

Constructor for an HGTD surface.

Definition at line 182 of file ActsDetectorElement.cxx.

182 :
183 GeoVDetectorElement{detElem.getMaterialGeom()},
184 m_idHash(detElem.identifyHash()),
185 m_type{DetectorType::Hgtd},
186 m_detElement{&detElem},
187 m_thickness{detElem.thickness()},
189{
190
191 auto boundsType = detElem.bounds().type();
192
193 if (boundsType == Trk::SurfaceBounds::Rectangle) {
194
195 const InDetDD::HGTD_ModuleDesign &design = detElem.design();
196 double hlX = design.width() / 2. * length_unit;
197 double hlY = design.length() / 2. * length_unit;
198
199 auto rectangleBounds = std::make_shared<Acts::RectangleBounds>(hlX, hlY);
200
201 m_bounds = rectangleBounds;
202
204 m_surfHolder->surface().assignThickness(thickness());
205
206 } else {
207 throw std::domain_error(
208 "ActsDetectorElement: the surface type of HGTD is not does not Rectangle, it is wrong");
209 }
210}
const HGTD_ModuleDesign & design() const override final
access to the local description:
virtual double width() const
Method to calculate average width of a module.
virtual double length() const
Method to calculate length of a module.

◆ ~ActsDetectorElement()

virtual ActsDetectorElement::~ActsDetectorElement ( )
virtualdefault

Destructor.

Member Function Documentation

◆ atlasSurface()

const Trk::Surface & ActsDetectorElement::atlasSurface ( ) const

Return a shared pointer on the ATLAS surface associated with this identifier,.

Definition at line 291 of file ActsDetectorElement.cxx.

291 {
292 if (const auto *detElem =
293 dynamic_cast<const InDetDD::SolidStateDetectorElementBase*>(m_detElement);
294 detElem != nullptr) {
295 return detElem->surface();
296 } else {
297 throw std::domain_error(std::format("Cannot get surface for {:} element" , detectorType()));
298 }
299}
DetectorType detectorType() const override final
Detector type.

◆ detectorType()

DetectorType ActsDetectorElement::detectorType ( ) const
finaloverridevirtual

Detector type.

Implements ActsTrk::IDetectorElement.

Definition at line 311 of file ActsDetectorElement.cxx.

311{ return m_type; }

◆ getDefaultTransform()

const Acts::Transform3 & ActsDetectorElement::getDefaultTransform ( ) const

Returns default transform.

For TRT this is static and set in constructor. For silicon detectors it is calulated from GM, and stored. Thus the method is not const. The store is mutexed.

Definition at line 279 of file ActsDetectorElement.cxx.

279 {
280 return m_trfCache.getTransform(nullptr);
281}

◆ identify()

Identifier ActsDetectorElement::identify ( ) const
finaloverridevirtual

Identifier.

Implements ActsTrk::IDetectorElement.

Definition at line 303 of file ActsDetectorElement.cxx.

303 {
305}

◆ identifyHash()

IdentifierHash ActsDetectorElement::identifyHash ( ) const
inline

Identifier hash.

Definition at line 89 of file ActsDetectorElement.h.

89{ return m_idHash; }

◆ identityHelper()

IdentityHelper ActsDetectorElement::identityHelper ( ) const

Definition at line 254 of file ActsDetectorElement.cxx.

254 {
255 if (detectorType() == DetectorType::Pixel || detectorType() == DetectorType::Sct ||
256 detectorType() == DetectorType::Hgtd) {
257 return IdentityHelper(static_cast<const InDetDD::SolidStateDetectorElementBase *>(m_detElement));
258 } else {
259 throw std::domain_error(std::format("Cannot get IdentityHelper for {:} element" ,detectorType()));
260 }
261}

◆ localToGlobal()

Amg::Transform3D ActsDetectorElement::localToGlobal ( const ActsTrk::DetectorAlignStore * store) const

Pixel or Sct

Definition at line 212 of file ActsDetectorElement.cxx.

212 {
213
214 GeoAlignmentStore* geoModelStore = store ? store->geoModelAlignment.get() : nullptr;
215 Amg::Transform3D l2g{Amg::Transform3D::Identity()};
216 switch (m_type) {
217 case DetectorType::Hgtd:{
218 l2g= m_detElement->getMaterialGeom()->getAbsoluteTransform(geoModelStore);
219 break;
220 } case DetectorType::Trt: {
221 l2g = (*m_trtTrf);
222 break;
223 }
225 default: {
226 const auto& detElem = static_cast<const InDetDD::SiDetectorElement&>(*m_detElement);
227 const InDetDD::SiDetectorDesign&design = detElem.design();
228 const Trk::SurfaceBounds::BoundsType boundsType = detElem.bounds().type();
229
230 // extra shift for split row modules
231 Amg::Transform3D extraTransform{Amg::CLHEPTransformToEigen(detElem.recoToHitTransform())};
232 if (boundsType == Trk::SurfaceBounds::Rectangle &&
233 typeid(design) == typeid(InDetDD::StripBoxDesign) ) {
234 extraTransform = design.moduleShift() * extraTransform;
235 } else if (boundsType == Trk::SurfaceBounds::Annulus) {
236 // need to rotate pi/2 to reproduce ABXY orientation, phiS so that phi=0
237 // is center and symmetric
238 const double phiShift = M_PI_2 - static_cast<const InDetDD::StripStereoAnnulusDesign&>(design).stereo();
239
240 const Amg::Vector2D origin2D = static_cast<const Acts::AnnulusBounds&>(surface().bounds()).moduleOrigin();
241 const Amg::Translation3D transl{origin2D.x(), origin2D.y(), 0};
242 const Amg::Transform3D originTrf{transl * Amg::getRotateZ3D(-phiShift)};
243 extraTransform = extraTransform * originTrf.inverse();
244 }
245 l2g = m_detElement->getMaterialGeom()->getAbsoluteTransform(geoModelStore) * extraTransform;
246 }
247 };
248 // need to make sure translation has correct units
249 l2g.translation() *= 1.0 / CLHEP::mm * length_unit;
250
251 return l2g;
252
253}
const Acts::Surface & surface() const
Return surface associated with this identifier, which should come from the.
virtual const Amg::Transform3D moduleShift() const
BoundsType
This enumerator simplifies the persistency, by saving a dynamic_cast to happen.
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Amg::Transform3D getRotateZ3D(double angle)
Rotate the coordinate system by an angle around the z-axis.
Eigen::Affine3d Transform3D
Eigen::Translation< double, 3 > Translation3D
TestStore store
Definition TestStore.cxx:23

◆ localToGlobalTransform() [1/3]

const Acts::Transform3 & ActsDetectorElement::localToGlobalTransform ( const Acts::GeometryContext & tgContext) const

Definition at line 268 of file ActsDetectorElement.cxx.

268 {
269 return m_trfCache.getTransform(anygctx);
270}

◆ localToGlobalTransform() [2/3]

const Acts::Transform3 & ActsDetectorElement::localToGlobalTransform ( const ActsTrk::DetectorAlignStore * store) const
finaloverridevirtual

Returns the reference to the aligned local to global transform from the DetectorAlignStore actually holding the transform of the Detector element.

Parameters
storePointer to the alignment store. If not provided the nominal transform is returned

Implements ActsTrk::IDetectorElement.

Definition at line 271 of file ActsDetectorElement.cxx.

271 {
272 return m_trfCache.getTransform(store);
273}

◆ localToGlobalTransform() [3/3]

const Acts::Transform3 & ActsDetectorElement::localToGlobalTransform ( const ActsTrk::GeometryContext & gctx) const
overridevirtual

Returns the aligned local to global transform from the passed geometry context.

Parameters
gctxReference to the ATLAS geometry context

Implements ActsTrk::IDetectorElement.

Definition at line 265 of file ActsDetectorElement.cxx.

265 {
266 return m_trfCache.getTransform(gctx);
267}

◆ storeAlignedTransforms()

unsigned int ActsDetectorElement::storeAlignedTransforms ( ActsTrk::DetectorAlignStore & store) const
overridevirtual

Caches the aligned transformation in the provided store.

Returns the number of cached elements

Implements ActsTrk::IDetectorElement.

Definition at line 275 of file ActsDetectorElement.cxx.

275 {
276 return m_trfCache.storeTransform(store);
277}

◆ surface() [1/2]

Acts::Surface & ActsDetectorElement::surface ( )

Mutable surface to this detector element.

Definition at line 287 of file ActsDetectorElement.cxx.

287 {
288 return m_surfHolder->surface();
289}

◆ surface() [2/2]

const Acts::Surface & ActsDetectorElement::surface ( ) const

Return surface associated with this identifier, which should come from the.

Definition at line 283 of file ActsDetectorElement.cxx.

283 {
284 return m_surfHolder->surface();
285}

◆ thickness()

double ActsDetectorElement::thickness ( ) const

Returns the thickness of the module.

Definition at line 301 of file ActsDetectorElement.cxx.

301{ return m_thickness; }

◆ upstreamDetectorElement()

const GeoVDetectorElement * ActsDetectorElement::upstreamDetectorElement ( ) const

Returns the underllying GeoModel detectorelement that this one is based on.

Definition at line 308 of file ActsDetectorElement.cxx.

308 {
309 return m_detElement;
310}

Member Data Documentation

◆ m_bounds

std::shared_ptr<const Acts::SurfaceBounds> ActsDetectorElement::m_bounds {}
private

Boundaries of the detector element.

Definition at line 133 of file ActsDetectorElement.h.

133{};

◆ m_detElement

const GeoVDetectorElement* ActsDetectorElement::m_detElement {nullptr}
private

Detector element as variant.

Definition at line 131 of file ActsDetectorElement.h.

131{nullptr};

◆ m_explicitIdentifier

Identifier ActsDetectorElement::m_explicitIdentifier {}
private

Definition at line 139 of file ActsDetectorElement.h.

139{};

◆ m_idHash

IdentifierHash ActsDetectorElement::m_idHash {}
private

Definition at line 125 of file ActsDetectorElement.h.

125{};

◆ m_surfHolder

std::shared_ptr<ActsTrk::SurfacePlacement> ActsDetectorElement::m_surfHolder {}
private

Definition at line 129 of file ActsDetectorElement.h.

129{};

◆ m_thickness

double ActsDetectorElement::m_thickness {0.}
private

Thickness of this detector element.

Definition at line 135 of file ActsDetectorElement.h.

135{0.};

◆ m_trfCache

ActsTrk::ReadoutSurfacePositioning<ActsDetectorElement> ActsDetectorElement::m_trfCache {0, this}
private

Definition at line 127 of file ActsDetectorElement.h.

127{0, this};

◆ m_trtTrf

std::unique_ptr<const Amg::Transform3D> ActsDetectorElement::m_trtTrf {}
private

Definition at line 137 of file ActsDetectorElement.h.

137{};

◆ m_type

DetectorType ActsDetectorElement::m_type {DetectorType::UnDefined}
private

Definition at line 126 of file ActsDetectorElement.h.

126{DetectorType::UnDefined};

The documentation for this class was generated from the following files: