Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
ActsDetectorElement Class Reference

#include <ActsDetectorElement.h>

Inheritance diagram for ActsDetectorElement:
Collaboration diagram for ActsDetectorElement:

Public Types

using DetectorType = ActsTrk::DetectorType
 
using AlignmentStore = ActsGeometryContext::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. More...
 
 ActsDetectorElement (const InDetDD::HGTD_DetectorElement &detElem, const Identifier &id)
 Constructor for an HGTD surface. More...
 
virtual ~ActsDetectorElement ()=default
 Destructor. More...
 
Identifier identify () const override final
 Identifier. More...
 
DetectorType detectorType () const override final
 Detector type. More...
 
IdentifierHash identifyHash () const
 Identifier hash. More...
 
virtual unsigned int storeAlignedTransforms (const ActsTrk::DetectorAlignStore &alignStore) const override
 Caches the aligned transformation in the provided store. Returns the number of cached elements. More...
 
virtual const Acts::Transform3 & transform (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. More...
 
virtual Acts::Surface & surface () final override
 Mutable surface to this detector element. More...
 
const Trk::SurfaceatlasSurface () const
 Return a shared pointer on the ATLAS surface associated with this identifier,. More...
 
virtual double thickness () const final override
 Returns the thickness of the module. More...
 
IdentityHelper identityHelper () const
 
const Acts::Transform3 & getDefaultTransform () const
 Returns default transform. More...
 
const GeoVDetectorElement * upstreamDetectorElement () const
 Returns the underllying GeoModel detectorelement that this one is based on. More...
 
Amg::Transform3D transform (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. More...
 
std::shared_ptr< const Acts::SurfaceBounds > m_bounds {}
 Boundaries of the detector element. More...
 
double m_thickness {0.}
 Thickness of this detector element. More...
 
std::shared_ptr< Acts::Surface > m_surface {}
 Corresponding Surface. More...
 
std::vector< std::shared_ptr< const Acts::Surface > > m_surfaces {}
 
std::unique_ptr< const Amg::Transform3Dm_trtTrf {}
 
Identifier m_explicitIdentifier {}
 

Detailed Description

Definition at line 42 of file ActsDetectorElement.h.

Member Typedef Documentation

◆ AlignmentStore

Definition at line 45 of file ActsDetectorElement.h.

◆ DetectorType

Definition at line 44 of file ActsDetectorElement.h.

Constructor & Destructor Documentation

◆ ActsDetectorElement() [1/3]

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

Definition at line 51 of file ActsDetectorElement.cxx.

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

◆ 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 128 of file ActsDetectorElement.cxx.

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

◆ ActsDetectorElement() [3/3]

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

Constructor for an HGTD surface.

Definition at line 165 of file ActsDetectorElement.cxx.

165  :
166  GeoVDetectorElement{detElem.getMaterialGeom()},
167  m_idHash(detElem.identifyHash()),
168  m_type{DetectorType::Hgtd},
169  m_detElement{&detElem},
170  m_thickness{detElem.thickness()},
172 {
173 
174  auto boundsType = detElem.bounds().type();
175 
176  if (boundsType == Trk::SurfaceBounds::Rectangle) {
177 
178  const InDetDD::HGTD_ModuleDesign &design = detElem.design();
179  double hlX = design.width() / 2. * length_unit;
180  double hlY = design.length() / 2. * length_unit;
181 
182  auto rectangleBounds =
183  std::make_shared<const Acts::RectangleBounds>(hlX, hlY);
184 
185  m_bounds = rectangleBounds;
186 
187  m_surface = Acts::Surface::makeShared<Acts::PlaneSurface>(rectangleBounds, *this);
188 
189  } else {
190  throw std::domain_error(
191  "ActsDetectorElement: the surface type of HGTD is not does not Rectangle, it is wrong");
192  }
193 }

◆ ~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 267 of file ActsDetectorElement.cxx.

267  {
268  if (const auto *detElem =
269  dynamic_cast<const InDetDD::SiDetectorElement *>(m_detElement);
270  detElem != nullptr) {
271  return detElem->surface();
272  } else {
273  throw std::domain_error("Cannot get surface for TRT element");
274  }
275 }

◆ detectorType()

DetectorType ActsDetectorElement::detectorType ( ) const
finaloverridevirtual

Detector type.

Implements ActsTrk::IDetectorElementBase.

Definition at line 287 of file ActsDetectorElement.cxx.

287 { 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 255 of file ActsDetectorElement.cxx.

255  {
256  return m_trfCache.getTransform(nullptr);
257 }

◆ identify()

Identifier ActsDetectorElement::identify ( ) const
finaloverridevirtual

Identifier.

Implements ActsTrk::IDetectorElementBase.

Definition at line 279 of file ActsDetectorElement.cxx.

279  {
280  return m_explicitIdentifier;
281 }

◆ identifyHash()

IdentifierHash ActsDetectorElement::identifyHash ( ) const
inline

Identifier hash.

Definition at line 73 of file ActsDetectorElement.h.

73 { return m_idHash; }

◆ identityHelper()

IdentityHelper ActsDetectorElement::identityHelper ( ) const

Definition at line 237 of file ActsDetectorElement.cxx.

237  {
238  if (detectorType() == DetectorType::Pixel || detectorType() == DetectorType::Sct) {
239  return IdentityHelper(static_cast<const InDetDD::SiDetectorElement *>(m_detElement));
240  } else {
241  throw std::domain_error("Cannot get IdentityHelper for TRT element");
242  }
243 }

◆ 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 249 of file ActsDetectorElement.cxx.

249  {
250  if (store.detType != detectorType()) return 0;
251  m_trfCache.getTransform(&store);
252  return 1;
253 }

◆ surface() [1/2]

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

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

Definition at line 259 of file ActsDetectorElement.cxx.

259  {
260  return (*m_surface);
261 }

◆ surface() [2/2]

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

Mutable surface to this detector element.

Definition at line 263 of file ActsDetectorElement.cxx.

263  {
264  return (*m_surface);
265 }

◆ thickness()

double ActsDetectorElement::thickness ( ) const
finaloverridevirtual

Returns the thickness of the module.

Definition at line 277 of file ActsDetectorElement.cxx.

277 { return m_thickness; }

◆ transform() [1/2]

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

Definition at line 245 of file ActsDetectorElement.cxx.

245  {
246  return m_trfCache.transform(anygctx);
247 }

◆ transform() [2/2]

Amg::Transform3D ActsDetectorElement::transform ( const ActsTrk::DetectorAlignStore store) const

Pixel or Sct

Definition at line 195 of file ActsDetectorElement.cxx.

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

◆ upstreamDetectorElement()

const GeoVDetectorElement * ActsDetectorElement::upstreamDetectorElement ( ) const

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

Definition at line 284 of file ActsDetectorElement.cxx.

284  {
285  return m_detElement;
286 }

Member Data Documentation

◆ m_bounds

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

Boundaries of the detector element.

Definition at line 112 of file ActsDetectorElement.h.

◆ m_detElement

const GeoVDetectorElement* ActsDetectorElement::m_detElement {nullptr}
private

Detector element as variant.

Definition at line 110 of file ActsDetectorElement.h.

◆ m_explicitIdentifier

Identifier ActsDetectorElement::m_explicitIdentifier {}
private

Definition at line 121 of file ActsDetectorElement.h.

◆ m_idHash

IdentifierHash ActsDetectorElement::m_idHash {}
private

Definition at line 106 of file ActsDetectorElement.h.

◆ m_surface

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

Corresponding Surface.

Definition at line 116 of file ActsDetectorElement.h.

◆ m_surfaces

std::vector<std::shared_ptr<const Acts::Surface> > ActsDetectorElement::m_surfaces {}
private

Definition at line 117 of file ActsDetectorElement.h.

◆ m_thickness

double ActsDetectorElement::m_thickness {0.}
private

Thickness of this detector element.

Definition at line 114 of file ActsDetectorElement.h.

◆ m_trfCache

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

Definition at line 108 of file ActsDetectorElement.h.

◆ m_trtTrf

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

Definition at line 119 of file ActsDetectorElement.h.

◆ m_type

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

Definition at line 107 of file ActsDetectorElement.h.


The documentation for this class was generated from the following files:
GeoAlignmentStore
Ensure that the extensions for the Vector3D are properly loaded.
Definition: GeoAlignmentStore.h:24
SGTest::store
TestStore store
Definition: TestStore.cxx:23
Trk::SurfaceBounds::BoundsType
BoundsType
Definition: SurfaceBounds.h:59
ActsDetectorElement::m_type
DetectorType m_type
Definition: ActsDetectorElement.h:107
InDetDD::TRT_BaseElement::strawLength
virtual const double & strawLength() const =0
Active straw length.
InDetDD::TRT_BarrelElement
Definition: TRT_BarrelElement.h:44
InDetDD::DetectorDesign::width
virtual double width() const =0
Method to calculate average width of a module.
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
InDetDD::DetectorDesign::moduleShift
virtual const Amg::Transform3D moduleShift() const
Definition: DetectorDesign.cxx:130
ActsDetectorElement::m_detElement
const GeoVDetectorElement * m_detElement
Detector element as variant.
Definition: ActsDetectorElement.h:110
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::SurfaceBounds::Rectangle
@ Rectangle
Definition: SurfaceBounds.h:65
InDetDD::StripBoxDesign
Definition: StripBoxDesign.h:31
InDetDD::DetectorDesign::length
virtual double length() const =0
Method to calculate length of a module.
InDetDD::TRT_EndcapElement
Definition: TRT_EndcapElement.h:44
Trk::SurfaceBounds::Annulus
@ Annulus
Definition: SurfaceBounds.h:70
ActsDetectorElement::detectorType
DetectorType detectorType() const override final
Detector type.
Definition: ActsDetectorElement.cxx:287
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
length_unit
constexpr double length_unit
Definition: ActsDetectorElement.cxx:49
InDetDD::TRT_BarrelDescriptor::innerTubeRadius
double innerTubeRadius() const
Get inner tube radius of the straw.
ActsDetectorElement::m_trtTrf
std::unique_ptr< const Amg::Transform3D > m_trtTrf
Definition: ActsDetectorElement.h:119
InDetDD::HGTD_ModuleDesign::length
virtual double length() const
Method to calculate length of a module.
Definition: HGTD_ModuleDesign.cxx:65
ActsDetectorElement::m_idHash
IdentifierHash m_idHash
Definition: ActsDetectorElement.h:106
InDetDD::SolidStateDetectorElementBase::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
InDetDD::HGTD_DetectorElement::design
const HGTD_ModuleDesign & design() const override final
access to the local description:
Definition: HGTD_DetectorElement.h:121
Amg::getRotateZ3D
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Definition: GeoPrimitivesHelpers.h:270
ActsDetectorElement::m_bounds
std::shared_ptr< const Acts::SurfaceBounds > m_bounds
Boundaries of the detector element.
Definition: ActsDetectorElement.h:112
Trk::SurfaceBounds::type
virtual BoundsType type() const =0
Return the bounds type - for persistency optimization.
ActsTrk::DetectorType::Pixel
@ Pixel
Inner detector legacy.
InDetDD::SolidStateDetectorElementBase::thickness
double thickness() const
InDetDD::TRT_BarrelElement::getDescriptor
const TRT_BarrelDescriptor * getDescriptor() const
Returns a pointer to a descriptor, giving common information on module construction:
Definition: TRT_BarrelElement.cxx:72
InDetDD::StripStereoAnnulusDesign
Definition: StripStereoAnnulusDesign.h:50
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
ActsDetectorElement::m_surface
std::shared_ptr< Acts::Surface > m_surface
Corresponding Surface.
Definition: ActsDetectorElement.h:116
InDetDD::SolidStateDetectorElementBase::bounds
virtual const Trk::SurfaceBounds & bounds() const override final
Return the boundaries of the element.
Definition: SolidStateDetectorElementBase.cxx:198
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
InDetDD::DetectorDesign::maxWidth
virtual double maxWidth() const =0
Method to calculate maximum width of a module.
InDetDD::TRT_BaseElement::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash
InDetDD::SiDetectorElement::isPixel
bool isPixel() const
InDetDD::DetectorDesign::bounds
virtual const Trk::SurfaceBounds & bounds() const =0
Element boundary.
ActsDetectorElement::m_thickness
double m_thickness
Thickness of this detector element.
Definition: ActsDetectorElement.h:114
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
Trk::SurfaceBounds::Trapezoid
@ Trapezoid
Definition: SurfaceBounds.h:67
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
ActsDetectorElement::m_trfCache
ActsTrk::TransformCacheDetEle< ActsDetectorElement > m_trfCache
Definition: ActsDetectorElement.h:108
InDetDD::DetectorDesign::minWidth
virtual double minWidth() const =0
Method to calculate minimum width of a module.
Amg::CLHEPTransformToEigen
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Definition: CLHEPtoEigenConverter.h:38
ActsDetectorElement::m_explicitIdentifier
Identifier m_explicitIdentifier
Definition: ActsDetectorElement.h:121
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
InDetDD::HGTD_ModuleDesign
Definition: HGTD_ModuleDesign.h:43
InDetDD::HGTD_ModuleDesign::width
virtual double width() const
Method to calculate average width of a module.
Definition: HGTD_ModuleDesign.cxx:71
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
CaloLCW_tf.trf
trf
Definition: CaloLCW_tf.py:20
InDetDD::SiDetectorDesign
Definition: SiDetectorDesign.h:50
IdentityHelper
Definition: IdentityHelper.h:14
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
InDetDD::SolidStateDetectorElementBase::identify
virtual Identifier identify() const override final
identifier of this detector element (inline)