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 (const ActsTrk::DetectorAlignStore &alignStore) const override
 Caches the aligned transformation in the provided store. Returns the number of cached elements.
virtual const Acts::Transform3 & localToGlobalTransform (const Acts::GeometryContext &gctx) const final override
virtual const Acts::Surface & surface () const final override
 Return surface associated with this identifier, which should come from the.
virtual bool isSensitive () const final override
 Returns whether the detector element is sensitive.
virtual Acts::Surface & surface () final override
 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::TransformCacheDetEle< ActsDetectorElementm_trfCache {0, this}
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::shared_ptr< Acts::Surface > m_surface {}
 Corresponding Surface.
std::unique_ptr< const Amg::Transform3Dm_trtTrf {}
Identifier m_explicitIdentifier {}

Detailed Description

Definition at line 44 of file ActsDetectorElement.h.

Member Typedef Documentation

◆ AlignmentStore

◆ DetectorType

Constructor & Destructor Documentation

◆ ActsDetectorElement() [1/3]

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

Definition at line 53 of file ActsDetectorElement.cxx.

53 :
54 GeoVDetectorElement{detElem.getMaterialGeom()},
55 m_idHash(detElem.identifyHash()),
56 m_type{detElem.isPixel() ? DetectorType::Pixel : DetectorType::Sct},
57 m_detElement{&detElem},
59{
60
61
62 auto boundsType = detElem.bounds().type();
63
64 m_thickness = detElem.thickness();
65
66
67 if (boundsType == Trk::SurfaceBounds::Rectangle) {
68
69 const InDetDD::SiDetectorDesign &design = detElem.design();
70 double hlX = design.width() / 2. * length_unit;
71 double hlY = design.length() / 2. * length_unit;
72
73 auto rectangleBounds = std::make_shared<const Acts::RectangleBounds>(hlX, hlY);
74
75 m_bounds = rectangleBounds;
76 m_surface = Acts::Surface::makeShared<Acts::PlaneSurface>(rectangleBounds, *this);
77 m_surface->assignThickness(thickness());
78
79 } else if (boundsType == Trk::SurfaceBounds::Trapezoid) {
80
81 const InDetDD::SiDetectorDesign &design = detElem.design();
82
83 double minHlX = design.minWidth() / 2. * length_unit;
84 double maxHlX = design.maxWidth() / 2. * length_unit;
85 double hlY = design.length() / 2. * length_unit;
86
87 auto trapezoidBounds =
88 std::make_shared<const Acts::TrapezoidBounds>(minHlX, maxHlX, hlY);
89
90 m_bounds = trapezoidBounds;
91
92 m_surface = Acts::Surface::makeShared<Acts::PlaneSurface>(trapezoidBounds, *this);
93 m_surface->assignThickness(thickness());
94
95
96 } else if (boundsType == Trk::SurfaceBounds::Annulus) {
97
98 const InDetDD::SiDetectorDesign &design = detElem.design();
99 const auto *annulus = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&design);
100 if (annulus == nullptr) {
101 throw std::domain_error("ActsDetectorElement got inconsistent surface");
102 }
103
104 double phi = annulus->phiWidth();
105 double phiS = annulus->stereo();
106 double R = annulus->waferCentreR();
107 double maxR = annulus->maxR();
108 double minR = annulus->minR();
109
110 // phiAvg is the bounds-internal local rotation. We don't want one
111 double phiAvg = 0;
112 // phi is the total opening angle, set up symmetric phi bounds
113 double phiMax = phi / 2.;
114 double phiMin = -phiMax;
115
116
117 Amg::Vector2D originStripXYRotated(R * (1 - std::cos(phiS)),
118 R * std::sin(-phiS));
119
120 auto annulusBounds = std::make_shared<Acts::AnnulusBounds>(
121 minR, maxR, phiMin, phiMax, originStripXYRotated, phiAvg);
122 m_bounds = annulusBounds;
123
124 m_surface = Acts::Surface::makeShared<Acts::DiscSurface>(annulusBounds, *this);
125 m_surface->assignThickness(thickness());
126
127 } else {
128 std::cout << boundsType << std::endl;
129 throw std::domain_error("ActsDetectorElement does not support this surface type");
130 }
131}
constexpr double length_unit
Scalar phi() const
phi method
double m_thickness
Thickness of this detector element.
std::shared_ptr< const Acts::SurfaceBounds > m_bounds
Boundaries of the detector element.
std::shared_ptr< Acts::Surface > m_surface
Corresponding Surface.
const GeoVDetectorElement * m_detElement
Detector element as variant.
double thickness() const
Returns the thickness of the module.
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 133 of file ActsDetectorElement.cxx.

135 :
136 GeoVDetectorElement{detElem.getMaterialGeom()},
137 m_idHash(detElem.identifyHash()),
138 m_type{DetectorType::Trt},
139 m_detElement{&detElem},
140 m_trtTrf{std::make_unique<Amg::Transform3D>(trf)},
142{
143
144
145 // we know this is a straw
146 double length = detElem.strawLength() * 0.5 * length_unit;
147
148 // we need to find the radius
149 auto ecElem = dynamic_cast<const InDetDD::TRT_EndcapElement *>(&detElem);
150 auto brlElem = dynamic_cast<const InDetDD::TRT_BarrelElement *>(&detElem);
151 double innerTubeRadius{0.};
152 if (ecElem) {
153 innerTubeRadius = ecElem->getDescriptor()->innerTubeRadius() * length_unit;
154 } else {
155 if (brlElem) {
156 innerTubeRadius =
157 brlElem->getDescriptor()->innerTubeRadius() * length_unit;
158 } else {
159 THROW_EXCEPTION("Cannot get tube radius for element in ActsDetectorElement c'tor");
160 }
161 }
162
163 auto lineBounds =
164 std::make_shared<const Acts::LineBounds>(innerTubeRadius, length);
165 m_bounds = lineBounds;
166
167 m_surface = Acts::Surface::makeShared<Acts::StrawSurface>(lineBounds, *this);
168 m_surface->assignThickness(thickness());
169}
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 171 of file ActsDetectorElement.cxx.

171 :
172 GeoVDetectorElement{detElem.getMaterialGeom()},
173 m_idHash(detElem.identifyHash()),
174 m_type{DetectorType::Hgtd},
175 m_detElement{&detElem},
176 m_thickness{detElem.thickness()},
178{
179
180 auto boundsType = detElem.bounds().type();
181
182 if (boundsType == Trk::SurfaceBounds::Rectangle) {
183
184 const InDetDD::HGTD_ModuleDesign &design = detElem.design();
185 double hlX = design.width() / 2. * length_unit;
186 double hlY = design.length() / 2. * length_unit;
187
188 auto rectangleBounds =
189 std::make_shared<const Acts::RectangleBounds>(hlX, hlY);
190
191 m_bounds = rectangleBounds;
192
193 m_surface = Acts::Surface::makeShared<Acts::PlaneSurface>(rectangleBounds, *this);
194 m_surface->assignThickness(thickness());
195
196 } else {
197 throw std::domain_error(
198 "ActsDetectorElement: the surface type of HGTD is not does not Rectangle, it is wrong");
199 }
200}
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 274 of file ActsDetectorElement.cxx.

274 {
275 if (const auto *detElem =
276 dynamic_cast<const InDetDD::SiDetectorElement *>(m_detElement);
277 detElem != nullptr) {
278 return detElem->surface();
279 } else {
280 throw std::domain_error("Cannot get surface for TRT element");
281 }
282}

◆ detectorType()

DetectorType ActsDetectorElement::detectorType ( ) const
finaloverridevirtual

Detector type.

Implements ActsTrk::IDetectorElementBase.

Definition at line 294 of file ActsDetectorElement.cxx.

294{ 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 262 of file ActsDetectorElement.cxx.

262 {
263 return m_trfCache.getTransform(nullptr);
264}
ActsTrk::TransformCacheDetEle< ActsDetectorElement > m_trfCache

◆ identify()

Identifier ActsDetectorElement::identify ( ) const
finaloverridevirtual

Identifier.

Implements ActsTrk::IDetectorElementBase.

Definition at line 286 of file ActsDetectorElement.cxx.

286 {
288}

◆ identifyHash()

IdentifierHash ActsDetectorElement::identifyHash ( ) const
inline

Identifier hash.

Definition at line 75 of file ActsDetectorElement.h.

75{ return m_idHash; }

◆ identityHelper()

IdentityHelper ActsDetectorElement::identityHelper ( ) const

Definition at line 244 of file ActsDetectorElement.cxx.

244 {
245 if (detectorType() == DetectorType::Pixel || detectorType() == DetectorType::Sct) {
246 return IdentityHelper(static_cast<const InDetDD::SiDetectorElement *>(m_detElement));
247 } else {
248 throw std::domain_error("Cannot get IdentityHelper for TRT element");
249 }
250}
DetectorType detectorType() const override final
Detector type.

◆ isSensitive()

virtual bool ActsDetectorElement::isSensitive ( ) const
inlinefinaloverridevirtual

Returns whether the detector element is sensitive.

Definition at line 85 of file ActsDetectorElement.h.

85{ return true; }

◆ localToGlobal()

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

Pixel or Sct

Definition at line 202 of file ActsDetectorElement.cxx.

202 {
203
204 GeoAlignmentStore* geoModelStore = store ? store->geoModelAlignment.get() : nullptr;
205 Amg::Transform3D l2g{Amg::Transform3D::Identity()};
206 switch (m_type) {
207 case DetectorType::Hgtd:{
208 l2g= m_detElement->getMaterialGeom()->getAbsoluteTransform(geoModelStore);
209 break;
210 } case DetectorType::Trt: {
211 l2g = (*m_trtTrf);
212 break;
213 }
215 default: {
216 const auto& detElem = static_cast<const InDetDD::SiDetectorElement&>(*m_detElement);
217 const InDetDD::SiDetectorDesign&design = detElem.design();
218 const Trk::SurfaceBounds::BoundsType boundsType = detElem.bounds().type();
219
220 // extra shift for split row modules
221 Amg::Transform3D extraTransform{Amg::CLHEPTransformToEigen(detElem.recoToHitTransform())};
222 if (boundsType == Trk::SurfaceBounds::Rectangle &&
223 typeid(design) == typeid(InDetDD::StripBoxDesign) ) {
224 extraTransform = design.moduleShift() * extraTransform;
225 } else if (boundsType == Trk::SurfaceBounds::Annulus) {
226 // need to rotate pi/2 to reproduce ABXY orientation, phiS so that phi=0
227 // is center and symmetric
228 const double phiShift = M_PI_2 - static_cast<const InDetDD::StripStereoAnnulusDesign&>(design).stereo();
229
230 const Amg::Vector2D origin2D = static_cast<const Acts::AnnulusBounds&>(m_surface->bounds()).moduleOrigin();
231 const Amg::Translation3D transl{origin2D.x(), origin2D.y(), 0};
232 const Amg::Transform3D originTrf{transl * Amg::getRotateZ3D(-phiShift)};
233 extraTransform = extraTransform * originTrf.inverse();
234 }
235 l2g = m_detElement->getMaterialGeom()->getAbsoluteTransform(geoModelStore) * extraTransform;
236 }
237 };
238 // need to make sure translation has correct units
239 l2g.translation() *= 1.0 / CLHEP::mm * length_unit;
240
241 return l2g;
242
243}
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)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D
Eigen::Translation< double, 3 > Translation3D
TestStore store
Definition TestStore.cxx:23

◆ localToGlobalTransform()

const Acts::Transform3 & ActsDetectorElement::localToGlobalTransform ( const Acts::GeometryContext & gctx) const
finaloverridevirtual

Definition at line 252 of file ActsDetectorElement.cxx.

252 {
253 return m_trfCache.localToGlobalTransform(anygctx);
254}

◆ storeAlignedTransforms()

unsigned int ActsDetectorElement::storeAlignedTransforms ( const 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 256 of file ActsDetectorElement.cxx.

256 {
257 if (store.detType != detectorType()) return 0;
258 m_trfCache.getTransform(&store);
259 return 1;
260}

◆ surface() [1/2]

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

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

Definition at line 266 of file ActsDetectorElement.cxx.

266 {
267 return (*m_surface);
268}

◆ surface() [2/2]

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

Mutable surface to this detector element.

Definition at line 270 of file ActsDetectorElement.cxx.

270 {
271 return (*m_surface);
272}

◆ thickness()

double ActsDetectorElement::thickness ( ) const

Returns the thickness of the module.

Definition at line 284 of file ActsDetectorElement.cxx.

284{ return m_thickness; }

◆ upstreamDetectorElement()

const GeoVDetectorElement * ActsDetectorElement::upstreamDetectorElement ( ) const

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

Definition at line 291 of file ActsDetectorElement.cxx.

291 {
292 return m_detElement;
293}

Member Data Documentation

◆ m_bounds

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

Boundaries of the detector element.

Definition at line 116 of file ActsDetectorElement.h.

116{};

◆ m_detElement

const GeoVDetectorElement* ActsDetectorElement::m_detElement {nullptr}
private

Detector element as variant.

Definition at line 114 of file ActsDetectorElement.h.

114{nullptr};

◆ m_explicitIdentifier

Identifier ActsDetectorElement::m_explicitIdentifier {}
private

Definition at line 124 of file ActsDetectorElement.h.

124{};

◆ m_idHash

IdentifierHash ActsDetectorElement::m_idHash {}
private

Definition at line 110 of file ActsDetectorElement.h.

110{};

◆ m_surface

std::shared_ptr<Acts::Surface> ActsDetectorElement::m_surface {}
private

Corresponding Surface.

Definition at line 120 of file ActsDetectorElement.h.

120{};

◆ m_thickness

double ActsDetectorElement::m_thickness {0.}
private

Thickness of this detector element.

Definition at line 118 of file ActsDetectorElement.h.

118{0.};

◆ m_trfCache

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

Definition at line 112 of file ActsDetectorElement.h.

112{0, this};

◆ m_trtTrf

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

Definition at line 122 of file ActsDetectorElement.h.

122{};

◆ m_type

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

Definition at line 111 of file ActsDetectorElement.h.

111{DetectorType::UnDefined};

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