ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::TrackingGeometryTool Class Reference

#include <TrackingGeometryTool.h>

Inheritance diagram for ActsTrk::TrackingGeometryTool:
Collaboration diagram for ActsTrk::TrackingGeometryTool:

Public Member Functions

StatusCode initialize () override
virtual std::shared_ptr< const Acts::TrackingGeometry > trackingGeometry () const override
 Access to the built Acts tracking geometry.
virtual const ActsTrk::GeometryContextgetGeometryContext (const EventContext &ctx) const override
 Retrieve the geometry context with alignment constants from store gate.
virtual const ActsTrk::GeometryContextgetNominalGeometryContext () const override
 Returns the refrence to the nominal GeometryContext.
virtual const ActsTrk::DetectorElementToActsGeometryIdMapsurfaceIdMap () const override
 Returns the pointer to the identifier mapping between Acts::surface ID & IdentifierHash of the ITk surfaces.
virtual const Acts::TrackingVolume * getEnvelope (const ActsTrk::SystemEnvelope envType) const override
 Returns the envelope volume from the tracking geometry that's containing all volumes of the subsystem.

Private Member Functions

std::unique_ptr< ActsTrk::DetectorElementToActsGeometryIdMapcreateDetectorElementToGeoIdMap () const
 Creates and popules the DetectorElement -> Acts::Surface geo identifier map from the geometry service.

Private Attributes

ServiceHandle< ActsTrk::ITrackingGeometrySvcm_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
ActsTrk::GeoContextReadKey_t m_rchk {this, "ActsAlignmentKey", "ActsAlignment", "cond read key for the alignment"}
std::unique_ptr< const ActsTrk::DetectorElementToActsGeometryIdMapm_detIdMap {}

Detailed Description

Definition at line 27 of file TrackingGeometryTool.h.

Member Function Documentation

◆ createDetectorElementToGeoIdMap()

std::unique_ptr< ActsTrk::DetectorElementToActsGeometryIdMap > ActsTrk::TrackingGeometryTool::createDetectorElementToGeoIdMap ( ) const
private

Creates and popules the DetectorElement -> Acts::Surface geo identifier map from the geometry service.

Muon system

Definition at line 54 of file TrackingGeometryTool.cxx.

54 {
55 // create map from
56 auto detector_element_to_geoid = std::make_unique<DetectorElementToActsGeometryIdMap>();
57
58 struct Counter{
59 unsigned n_sensitive_elements{0};
60 unsigned n_detector_elements{0};
61 unsigned n_wrong_type{0};
62 };
63 Counter counter {};
64 trackingGeometry()->visitSurfaces([this, &counter, &detector_element_to_geoid](const Acts::Surface *surface) {
65 if (!surface || !surface->isSensitive()) {
66 ++counter.n_wrong_type;
67 return;
68 }
69 ++counter.n_sensitive_elements;
70 const auto* placement = dynamic_cast<const ISurfacePlacement*>(surface->surfacePlacement());
71 if (!placement) {
72 return;
73 }
74
75 auto insert_id = [&detector_element_to_geoid, &surface, &counter](const xAOD::UncalibMeasType type,
76 const IdentifierHash& hash) {
77 detector_element_to_geoid->insert(std::make_pair(makeDetectorElementKey(type, hash),
78 DetectorElementToActsGeometryIdMap::makeValue(surface->geometryId())));
79 ++counter.n_detector_elements;
80 };
81 switch(placement->detectorType()) {
82 using enum DetectorType;
83 case Pixel:
85 getActsDetectorElement(surface)->identifyHash());
86 break;
87 case Sct:
89 getActsDetectorElement(surface)->identifyHash());
90 break;
91 case Hgtd:
93 getActsDetectorElement(surface)->identifyHash());
94 break;
95 case Trt: {
96 break;
97 }
99 case Mdt:
100 case Rpc:
101 case Tgc:
102 case Csc:
103 case Mm:
104 case sTgc:{
105 // surface map not needed for the muon detectors
106 ++counter.n_detector_elements;
107 break;
108 }
109 case UnDefined:
110 ATH_MSG_ERROR("Undefined element encountered");
111 counter.n_detector_elements = 0;
112 return;
113 }
114 }, true /*sensitive surfaces*/);
115 ATH_MSG_INFO( "Surfaces without associated detector elements " << (counter.n_sensitive_elements -counter.n_detector_elements)
116 << " (with " << counter.n_detector_elements << ")" );
117 if (counter.n_sensitive_elements > 0 &&
118 counter.n_detector_elements==0) {
119 ATH_MSG_ERROR( "No surface with associated detector element" );
120 return nullptr;
121 }
122 if (counter.n_wrong_type>0) {
123 ATH_MSG_WARNING( "Surfaces associated to detector elements not of type Trk::TrkDetElementBase :" << counter.n_wrong_type);
124 }
125 return detector_element_to_geoid;
126}
const ActsDetectorElement * getActsDetectorElement(const Acts::Surface &surf)
Attempts to retrieve the ActsDetectorElement associated to the passed ActsSurface.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
virtual std::shared_ptr< const Acts::TrackingGeometry > trackingGeometry() const override
Access to the built Acts tracking geometry.
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
@ Mm
Maybe not needed in the migration.
@ Tgc
Resitive Plate Chambers.
@ sTgc
Micromegas (NSW).
@ Rpc
Monitored Drift Tubes.
@ Csc
Thin gap champers.
@ Mdt
MuonSpectrometer.
@ UnDefined
Small Thing Gap chambers (NSW).
DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash)
@ Pixel
Definition DetType.h:13
UncalibMeasType
Define the type of the uncalibrated measurement.
static const Acts::GeometryIdentifier & makeValue(const Acts::GeometryIdentifier &geo_id)

◆ getEnvelope()

const Acts::TrackingVolume * ActsTrk::TrackingGeometryTool::getEnvelope ( const ActsTrk::SystemEnvelope envType) const
overridevirtual

Returns the envelope volume from the tracking geometry that's containing all volumes of the subsystem.

Definition at line 31 of file TrackingGeometryTool.cxx.

31 {
32 return m_trackingGeometrySvc->getEnvelope(envType);
33}
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc

◆ getGeometryContext()

const GeometryContext & ActsTrk::TrackingGeometryTool::getGeometryContext ( const EventContext & ctx) const
overridevirtual

Retrieve the geometry context with alignment constants from store gate.

Parameters
ctxeventCotnext to access store gate

Definition at line 39 of file TrackingGeometryTool.cxx.

39 {
40 ATH_MSG_DEBUG("Creating alignment context for event");
41 const GeometryContext* geoCtx{nullptr};
42 if (!SG::get(geoCtx, m_rchk, ctx).isSuccess()) {
43 ATH_MSG_ERROR("Creating alignment context failed: read cond handle invalid!");
44 }
45 return *geoCtx;
46}
#define ATH_MSG_DEBUG(x)
ActsTrk::GeoContextReadKey_t m_rchk
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

◆ getNominalGeometryContext()

const GeometryContext & ActsTrk::TrackingGeometryTool::getNominalGeometryContext ( ) const
overridevirtual

Returns the refrence to the nominal GeometryContext.

The context is hold by the tracking geometry service and does not contain any alignable transforms

Definition at line 48 of file TrackingGeometryTool.cxx.

48 {
49 return m_trackingGeometrySvc->getNominalContext();
50}

◆ initialize()

StatusCode ActsTrk::TrackingGeometryTool::initialize ( )
override

Definition at line 13 of file TrackingGeometryTool.cxx.

13 {
14 ATH_MSG_DEBUG(name() << " initializing");
15 if (parent() != toolSvc()) {
16 ATH_MSG_ERROR("The tool is initialized as a private tool but should be public");
17 return StatusCode::FAILURE;
18 }
20 ATH_CHECK(m_rchk.initialize());
22 if (!m_detIdMap) {
23 return StatusCode::FAILURE;
24 }
25 return StatusCode::SUCCESS;
26}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::unique_ptr< ActsTrk::DetectorElementToActsGeometryIdMap > createDetectorElementToGeoIdMap() const
Creates and popules the DetectorElement -> Acts::Surface geo identifier map from the geometry service...
std::unique_ptr< const ActsTrk::DetectorElementToActsGeometryIdMap > m_detIdMap

◆ surfaceIdMap()

const ActsTrk::DetectorElementToActsGeometryIdMap * ActsTrk::TrackingGeometryTool::surfaceIdMap ( ) const
overridevirtual

Returns the pointer to the identifier mapping between Acts::surface ID & IdentifierHash of the ITk surfaces.

Definition at line 35 of file TrackingGeometryTool.cxx.

35 {
36 return m_detIdMap.get();
37}

◆ trackingGeometry()

std::shared_ptr< const Acts::TrackingGeometry > ActsTrk::TrackingGeometryTool::trackingGeometry ( ) const
overridevirtual

Access to the built Acts tracking geometry.

Definition at line 28 of file TrackingGeometryTool.cxx.

28 {
29 return m_trackingGeometrySvc->trackingGeometry();
30}

Member Data Documentation

◆ m_detIdMap

std::unique_ptr<const ActsTrk::DetectorElementToActsGeometryIdMap> ActsTrk::TrackingGeometryTool::m_detIdMap {}
private

Definition at line 52 of file TrackingGeometryTool.h.

52{};

◆ m_rchk

ActsTrk::GeoContextReadKey_t ActsTrk::TrackingGeometryTool::m_rchk {this, "ActsAlignmentKey", "ActsAlignment", "cond read key for the alignment"}
private

Definition at line 50 of file TrackingGeometryTool.h.

50{this, "ActsAlignmentKey", "ActsAlignment", "cond read key for the alignment"};

◆ m_trackingGeometrySvc

ServiceHandle<ActsTrk::ITrackingGeometrySvc> ActsTrk::TrackingGeometryTool::m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
private

Definition at line 48 of file TrackingGeometryTool.h.

48{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};

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