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

#include <ActsTrackingGeometryTool.h>

Inheritance diagram for ActsTrackingGeometryTool:
Collaboration diagram for ActsTrackingGeometryTool:

Public Member Functions

StatusCode initialize () override
virtual std::shared_ptr< const Acts::TrackingGeometry > trackingGeometry () const override
virtual const ActsTrk::GeometryContextgetGeometryContext (const EventContext &ctx) const override
virtual const ActsTrk::GeometryContextgetNominalGeometryContext () const override
virtual const ActsTrk::DetectorElementToActsGeometryIdMapsurfaceIdMap () const override

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"}
SG::ReadHandleKey< ActsTrk::GeometryContextm_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 ActsTrackingGeometryTool.h.

Member Function Documentation

◆ createDetectorElementToGeoIdMap()

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

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

Muon system

Definition at line 51 of file ActsTrackingGeometryTool.cxx.

51 {
52 // create map from
53 auto detector_element_to_geoid = std::make_unique<DetectorElementToActsGeometryIdMap>();
54
55 struct Counter{
56 unsigned n_sensitive_elements{0};
57 unsigned n_detector_elements{0};
58 unsigned n_wrong_type{0};
59 };
60 Counter counter {};
61 trackingGeometry()->visitSurfaces([this, &counter, &detector_element_to_geoid](const Acts::Surface *surface) {
62 if (!surface || !surface->associatedDetectorElement()) {
63 ++counter.n_wrong_type;
64 return;
65 }
66 ++counter.n_sensitive_elements;
67 const auto* detEl = dynamic_cast<const IDetectorElementBase*>(surface->associatedDetectorElement());
68 if (!detEl) {
69 return;
70 }
71
72 auto insert_id = [&detector_element_to_geoid, &surface, &counter](const xAOD::UncalibMeasType type,
73 const IdentifierHash& hash) {
74 detector_element_to_geoid->insert(std::make_pair(makeDetectorElementKey(type, hash),
75 DetectorElementToActsGeometryIdMap::makeValue(surface->geometryId())));
76 ++counter.n_detector_elements;
77 };
78 switch(detEl->detectorType()) {
79 using enum DetectorType;
80 case Pixel:
82 dynamic_cast<const ActsDetectorElement*>(detEl)->identifyHash());
83 break;
84 case Sct:
86 dynamic_cast<const ActsDetectorElement*>(detEl)->identifyHash());
87 break;
88 case Hgtd:
90 dynamic_cast<const ActsDetectorElement*>(detEl)->identifyHash());
91 break;
92 case Trt: {
93 break;
94 }
96 case Mdt:
97 case Rpc:
98 case Tgc:
99 case Csc:
100 case Mm:
101 case sTgc:{
102 // surface map not needed for the muon detectors
103 ++counter.n_detector_elements;
104 break;
105 }
106 case UnDefined:
107 ATH_MSG_ERROR("Undefined element encountered");
108 counter.n_detector_elements = 0;
109 return;
110 }
111 }, true /*sensitive surfaces*/);
112 ATH_MSG_INFO( "Surfaces without associated detector elements " << (counter.n_sensitive_elements -counter.n_detector_elements)
113 << " (with " << counter.n_detector_elements << ")" );
114 if (counter.n_sensitive_elements > 0 &&
115 counter.n_detector_elements==0) {
116 ATH_MSG_ERROR( "No surface with associated detector element" );
117 return nullptr;
118 }
119 if (counter.n_wrong_type>0) {
120 ATH_MSG_WARNING( "Surfaces associated to detector elements not of type Trk::TrkDetElementBase :" << counter.n_wrong_type);
121 }
122 return detector_element_to_geoid;
123}
#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
DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash)
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.
@ Trt
Maybe the Sct / Pixel for Itk become seperate entries?
@ Mdt
MuonSpectrometer.
@ UnDefined
Small Thing Gap chambers (NSW)
@ Pixel
Definition DetType.h:13
UncalibMeasType
Define the type of the uncalibrated measurement.
static const Acts::GeometryIdentifier & makeValue(const Acts::GeometryIdentifier &geo_id)

◆ getGeometryContext()

const GeometryContext & ActsTrackingGeometryTool::getGeometryContext ( const EventContext & ctx) const
overridevirtual

Definition at line 36 of file ActsTrackingGeometryTool.cxx.

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

◆ getNominalGeometryContext()

const GeometryContext & ActsTrackingGeometryTool::getNominalGeometryContext ( ) const
overridevirtual

Definition at line 45 of file ActsTrackingGeometryTool.cxx.

45 {
46 return m_trackingGeometrySvc->getNominalContext();
47}
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc

◆ initialize()

StatusCode ActsTrackingGeometryTool::initialize ( )
override

Definition at line 14 of file ActsTrackingGeometryTool.cxx.

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

◆ surfaceIdMap()

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

Definition at line 32 of file ActsTrackingGeometryTool.cxx.

32 {
33 return m_detIdMap.get();
34}

◆ trackingGeometry()

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

Definition at line 29 of file ActsTrackingGeometryTool.cxx.

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

Member Data Documentation

◆ m_detIdMap

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

Definition at line 49 of file ActsTrackingGeometryTool.h.

49{};

◆ m_rchk

SG::ReadHandleKey<ActsTrk::GeometryContext> ActsTrackingGeometryTool::m_rchk {this, "ActsAlignmentKey", "ActsAlignment", "cond read key for the alignment"}
private

Definition at line 47 of file ActsTrackingGeometryTool.h.

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

◆ m_trackingGeometrySvc

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

Definition at line 45 of file ActsTrackingGeometryTool.h.

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

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