ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 ActsGeometryContextgetGeometryContext (const EventContext &ctx) const override
 
virtual const ActsGeometryContextgetNominalGeometryContext () 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. More...
 

Private Attributes

ServiceHandle< IActsTrackingGeometrySvcm_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
 
SG::ReadHandleKey< ActsGeometryContextm_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_detector_elements{0};
57  unsigned n_missing_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  const auto* detEl = dynamic_cast<const IDetectorElementBase*>(surface->associatedDetectorElement());
67  if (!detEl) {
68  ++counter.n_missing_detector_elements;
69  return;
70  }
71  auto insert_id = [&detector_element_to_geoid, &surface, &counter](const xAOD::UncalibMeasType type,
72  const IdentifierHash& hash) {
73  detector_element_to_geoid->insert(std::make_pair(makeDetectorElementKey(type, hash),
74  DetectorElementToActsGeometryIdMap::makeValue(surface->geometryId())));
75  ++counter.n_detector_elements;
76  };
77  switch(detEl->detectorType()) {
78  using enum DetectorType;
79  case Pixel:
81  dynamic_cast<const ActsDetectorElement*>(detEl)->identifyHash());
82  break;
83  case Sct:
85  dynamic_cast<const ActsDetectorElement*>(detEl)->identifyHash());
86  break;
87  case Hgtd:
89  dynamic_cast<const ActsDetectorElement*>(detEl)->identifyHash());
90  break;
91  case Trt: {
92  break;
93  }
95  case Mdt:
96  case Rpc:
97  case Tgc:
98  case Csc:
99  case Mm:
100  case sTgc:{
101  // surface map not needed for the muon detectors
102  ++counter.n_detector_elements;
103  break;
104  }
105  case UnDefined:
106  ATH_MSG_ERROR("Undefined element encountered");
107  counter.n_detector_elements = 0;
108  return;
109  }
110  }, true /*sensitive surfaces*/);
111  ATH_MSG_INFO( "Surfaces without associated detector elements " << counter.n_missing_detector_elements
112  << " (with " << counter.n_detector_elements << ")" );
113  if (counter.n_detector_elements==0) {
114  ATH_MSG_ERROR( "No surface with associated detector element" );
115  return nullptr;
116  }
117  if (counter.n_wrong_type>0) {
118  ATH_MSG_WARNING( "Surfaces associated to detector elements not of type Trk::TrkDetElementBase :" << counter.n_wrong_type);
119  }
120  return detector_element_to_geoid;
121 }

◆ getGeometryContext()

const ActsGeometryContext & 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 ActsGeometryContext* 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 }

◆ getNominalGeometryContext()

const ActsGeometryContext & ActsTrackingGeometryTool::getNominalGeometryContext ( ) const
overridevirtual

Definition at line 45 of file ActsTrackingGeometryTool.cxx.

45  {
46  return m_trackingGeometrySvc->getNominalContext();
47 }

◆ 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  }
20  ATH_CHECK(m_trackingGeometrySvc.retrieve());
23  if (!m_detIdMap) {
24  return StatusCode::FAILURE;
25  }
26  return StatusCode::SUCCESS;
27 }

◆ 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.

◆ m_rchk

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

Definition at line 47 of file ActsTrackingGeometryTool.h.

◆ m_trackingGeometrySvc

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

Definition at line 45 of file ActsTrackingGeometryTool.h.


The documentation for this class was generated from the following files:
xAOD::UncalibMeasType::HGTDClusterType
@ HGTDClusterType
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
ActsTrk::DetectorType::UnDefined
@ UnDefined
Small Thing Gap chambers (NSW)
ActsTrk::DetectorType::Tgc
@ Tgc
Resitive Plate Chambers.
ActsTrk::DetectorType::Sct
@ Sct
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
Hgtd
Definition: HgtdTimedClusteringTool.cxx:10
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ActsTrk::IDetectorElementBase
base class interface providing the bare minimal interface extension.
Definition: IDetectorElement.h:32
DetType::Pixel
@ Pixel
Definition: DetType.h:13
InDetDD::DetectorType
DetectorType
Definition: DetectorDesign.h:45
ActsTrk::DetectorType::Mm
@ Mm
Maybe not needed in the migration.
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition: ReadCondHandle.h:287
ActsTrk::DetectorType::Csc
@ Csc
Thin gap champers.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ActsTrk::makeDetectorElementKey
DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash)
Definition: DetectorElementToActsGeometryIdMap.h:23
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::DetectorType::Trt
@ Trt
Maybe the Sct / Pixel for Itk become seperate entries?
ActsDetectorElement
Definition: ActsDetectorElement.h:44
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
ActsTrk::DetectorType::Mdt
@ Mdt
MuonSpectrometer.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActsTrackingGeometryTool::m_trackingGeometrySvc
ServiceHandle< IActsTrackingGeometrySvc > m_trackingGeometrySvc
Definition: ActsTrackingGeometryTool.h:45
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
ActsTrackingGeometryTool::m_rchk
SG::ReadHandleKey< ActsGeometryContext > m_rchk
Definition: ActsTrackingGeometryTool.h:47
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::UncalibMeasType
UncalibMeasType
Define the type of the uncalibrated measurement.
Definition: MeasurementDefs.h:25
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
ActsTrk::DetectorType::Rpc
@ Rpc
Monitored Drift Tubes.
ActsTrackingGeometryTool::createDetectorElementToGeoIdMap
std::unique_ptr< ActsTrk::DetectorElementToActsGeometryIdMap > createDetectorElementToGeoIdMap() const
Creates and popules the DetectorElement -> Acts::Surface geo identifier map from the geometry service...
Definition: ActsTrackingGeometryTool.cxx:51
ActsTrackingGeometryTool::m_detIdMap
std::unique_ptr< const ActsTrk::DetectorElementToActsGeometryIdMap > m_detIdMap
Definition: ActsTrackingGeometryTool.h:49
test_pyathena.counter
counter
Definition: test_pyathena.py:15
ActsTrackingGeometryTool::trackingGeometry
virtual std::shared_ptr< const Acts::TrackingGeometry > trackingGeometry() const override
Definition: ActsTrackingGeometryTool.cxx:29
xAOD::UncalibMeasType::PixelClusterType
@ PixelClusterType