LDMX Software
Public Member Functions | Private Attributes | List of all members
tracking::geo::DetectorElement Class Reference

Public Member Functions

 DetectorElement (const std::shared_ptr< Acts::Surface > &surface, const Acts::Transform3 &default_transform, double thickness)
 
Acts::Transform3 uncorrectedTransform () const
 
const Acts::Transform3 & transform (const Acts::GeometryContext &gctx) const override
 
const Acts::Surface & surface () const override
 
Acts::Surface & surface () override
 
double thickness () const override
 
Acts::GeometryIdentifier geometryId () const
 

Private Attributes

Acts::Transform3 m_transform = Acts::Transform3::Identity()
 
std::shared_ptr< Acts::Surface > m_surface
 
double m_thickness
 
bool m_debug {false}
 

Detailed Description

Definition at line 19 of file DetectorElement.h.

Constructor & Destructor Documentation

◆ DetectorElement()

tracking::geo::DetectorElement::DetectorElement ( const std::shared_ptr< Acts::Surface > &  surface,
const Acts::Transform3 &  default_transform,
double  thickness 
)
inline

Definition at line 27 of file DetectorElement.h.

28 {
29 m_surface = surface;
30 m_thickness = thickness;
31
32 // This is the local to global transformation
33 m_transform = default_transform;
34 }

◆ ~DetectorElement()

tracking::geo::DetectorElement::~DetectorElement ( )
override

Definition at line 7 of file DetectorElement.cxx.

7{};

Member Function Documentation

◆ geometryId()

Acts::GeometryIdentifier tracking::geo::DetectorElement::geometryId ( ) const
inline

Definition at line 68 of file DetectorElement.h.

68 {
69 if (!m_surface)
70 throw std::logic_error("DetectorElement:: surface not assigned");
71
72 return (m_surface->geometryId());
73 }

◆ surface() [1/2]

const Acts::Surface & tracking::geo::DetectorElement::surface ( ) const
override

Definition at line 49 of file DetectorElement.cxx.

49 {
50 if (!m_surface)
51 throw std::logic_error(
52 "DetectorElement::Attempted to return reference of null ptr");
53 return *m_surface;
54}

◆ surface() [2/2]

Acts::Surface & tracking::geo::DetectorElement::surface ( )
override

Definition at line 55 of file DetectorElement.cxx.

55 {
56 if (!m_surface)
57 throw std::logic_error(
58 "DetectorElement::Attempted to return reference of null ptr");
59 return *m_surface;
60}

◆ thickness()

double tracking::geo::DetectorElement::thickness ( ) const
override

Definition at line 64 of file DetectorElement.cxx.

64 {
65 // return m_thickness;
66 auto material = static_cast<const Acts::HomogeneousSurfaceMaterial*>(
67 m_surface->surfaceMaterial());
68 return material->materialSlab(Acts::Vector2{0., 0.}).thickness();
69}

◆ transform()

const Acts::Transform3 & tracking::geo::DetectorElement::transform ( const Acts::GeometryContext &  gctx) const
override

Definition at line 9 of file DetectorElement.cxx.

10 {
11 if (!m_surface)
12 throw std::logic_error("DetectorElement:: Sensor/Element ID not set");
13
14 // The elementId will be valid only after tracking geometry is built
15 // I will use this fact to return the default transform in order to build
16 // always the same default tracking geometry and modify later the sensor
17 // transformations.
18
19 unsigned int elementId = unpackGeometryIdentifier(m_surface->geometryId());
20
21 // Check if the elementId is valid
22 if (elementId > 9999) {
23 // elementId not valid: return default transformation
24 return m_transform;
25 }
26
27 auto ctx = gctx.get<GeometryContext*>();
28
29 // Found the aligned transform for this sensor
30 if ((ctx->alignment_map).count(elementId) > 0) {
31 const Acts::Transform3& c_transform = ctx->alignment_map[elementId];
32
33 if (m_debug) {
34 std::cout << "Aligned transform" << std::endl;
35 std::cout << c_transform.translation() << std::endl;
36 std::cout << c_transform.rotation() << std::endl;
37 std::cout << "Original transform" << std::endl;
38 std::cout << m_transform.translation() << std::endl;
39 std::cout << m_transform.rotation() << std::endl;
40 }
41
42 return c_transform;
43 }
44
45 else
46 return m_transform;
47}
unsigned int unpackGeometryIdentifier(const Acts::GeometryIdentifier &geoId)
The geometry identifier will return vol=0 and lay=0 when it is not valid.
Definition GeoUtils.cxx:5

◆ uncorrectedTransform()

Acts::Transform3 tracking::geo::DetectorElement::uncorrectedTransform ( ) const
inline

Definition at line 40 of file DetectorElement.h.

40{ return m_transform; }

Member Data Documentation

◆ m_debug

bool tracking::geo::DetectorElement::m_debug {false}
private

Definition at line 81 of file DetectorElement.h.

81{false};

◆ m_surface

std::shared_ptr<Acts::Surface> tracking::geo::DetectorElement::m_surface
private

Definition at line 79 of file DetectorElement.h.

◆ m_thickness

double tracking::geo::DetectorElement::m_thickness
private

Definition at line 80 of file DetectorElement.h.

◆ m_transform

Acts::Transform3 tracking::geo::DetectorElement::m_transform = Acts::Transform3::Identity()
private

Definition at line 77 of file DetectorElement.h.


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