ATLAS Offline Software
Loading...
Searching...
No Matches
ReadoutGeoDumpAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#include "ReadoutGeoDumpAlg.h"
5
6
7#include "Acts/Geometry/TrackingGeometry.hpp"
9namespace ActsTrk {
10
12 ATH_CHECK(m_tree.init(this));
13 ATH_CHECK(m_trackingGeoTool.retrieve());
14 for (const auto type : m_detTypes){
15 try{
16 m_selTypes.insert(static_cast<DetectorType>(type));
17 } catch (...) {
18 ATH_MSG_ERROR("Cannot translate "<<m_detTypes);
19 return StatusCode::FAILURE;
20 }
21 }
22
23 return StatusCode::SUCCESS;
24 }
26 ATH_CHECK(m_tree.write());
27 return StatusCode::SUCCESS;
28 }
30 if (m_executed) {
31 return StatusCode::SUCCESS;
32 }
33 const EventContext& ctx{Gaudi::Hive::currentContext()};
34
35 const GeometryContext& gctx{m_trackingGeoTool->getGeometryContext(ctx)};
36
37 const auto trackingGeo = m_trackingGeoTool->trackingGeometry();
38
39 trackingGeo->visitSurfaces([&](const Acts::Surface* surface){
40 // We only want alignable surfaces
41 if (!surface->isAlignable()) {
42 return;
43 }
44 const auto* detEl = dynamic_cast<const IDetectorElement*>(surface->surfacePlacement());
45 // Somehow it's not a known detector element
46 if (!detEl) {
47 return;
48 }
49 // The detector element is from another system
50 if(!m_selTypes.empty() && !m_selTypes.count(detEl->detectorType())){
51 return;
52 }
53 //
54 m_readoutTransform = surface->localToGlobalTransform(gctx.context());
55 m_identifier = detEl->identify().get_compact();
56 m_detType = Acts::toUnderlying(detEl->detectorType());
57 const auto& bounds = surface->bounds();
58 m_boundsType = Acts::toUnderlying(bounds.type());
59 m_thickness = surface->thickness();
60 for (const double val : bounds.values()){
61 m_boundValues.push_back(val);
62 }
63 if (!m_tree.fill(ctx)) {
64 THROW_EXCEPTION("Failed to fill the tree");
65 }
66 }, false);
67 m_executed = false;
68 return StatusCode::SUCCESS;
69 }
70
71}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Acts::GeometryContext context() const
Base class interface for the actual readout elements.
MuonVal::ScalarBranch< std::uint8_t > & m_boundsType
What is the type of the associated Acts Bounds.
StatusCode execute() override
MuonVal::ScalarBranch< Identifier::value_type > & m_identifier
the Ahtena identifier of the readout element
MuonVal::ScalarBranch< double > & m_thickness
Thickness of the readout surface.
bool m_executed
Flag whether the algorithm is executed.
MuonVal::MuonTesterTree m_tree
Write a TTree for validation purposes.
MuonVal::CoordTransformBranch m_readoutTransform
Final transform of the readout element.
StatusCode finalize() override
MuonVal::ScalarBranch< std::uint8_t > & m_detType
The DetectorType of the readout element.
StatusCode initialize() override
std::unordered_set< DetectorType > m_selTypes
MuonVal::VectorBranch< double > & m_boundValues
The defining parameter of the surface bounds.
PublicToolHandle< ITrackingGeometryTool > m_trackingGeoTool
Tool handle to the tracking geometry.
Gaudi::Property< std::set< unsigned short > > m_detTypes
Configure which detector types shall be dumped.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10