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

Helper class to build the BeamPipe Blueprint node It adds the beam pipe as a node to the Blueprint. More...

#include <BeamPipeBlueprintNodeBuilder.h>

Inheritance diagram for ActsTrk::BeamPipeBlueprintNodeBuilder:
Collaboration diagram for ActsTrk::BeamPipeBlueprintNodeBuilder:

Public Member Functions

StatusCode initialize () override
std::shared_ptr< Acts::Experimental::BlueprintNode > buildBlueprintNode (const Acts::GeometryContext &gctx, std::shared_ptr< Acts::Experimental::BlueprintNode > &&child) override
 Build the BeamPipe Blueprint Node.

Private Attributes

const BeamPipeDetectorManagerm_beamPipeMgr {nullptr}
Gaudi::Property< bool > m_loadfromDatabase
Gaudi::Property< double > m_defaultInnerRadius

Detailed Description

Helper class to build the BeamPipe Blueprint node It adds the beam pipe as a node to the Blueprint.

Definition at line 17 of file BeamPipeBlueprintNodeBuilder.h.

Member Function Documentation

◆ buildBlueprintNode()

std::shared_ptr< Acts::Experimental::BlueprintNode > ActsTrk::BeamPipeBlueprintNodeBuilder::buildBlueprintNode ( const Acts::GeometryContext & gctx,
std::shared_ptr< Acts::Experimental::BlueprintNode > && child )
override

Build the BeamPipe Blueprint Node.

Parameters
gctxGeometry context
childExpected to be null; beam pipe has no inner child.

Definition at line 50 of file BeamPipeBlueprintNodeBuilder.cxx.

52 {
53
54 // Beam pipe is the innermost element and has no child to wrap
55 if (child) {
56 ATH_MSG_ERROR("BeamPipeBlueprintNodeBuilder expects no child node");
57 throw std::runtime_error("Child node is not null");
58 }
59
60 // If the manager is available, use it to construct the beam pipe geometry,
61 // and retrieve the beampipe radius from the geometry database.
62 // Otherwise, use default parameters to construct a simple tube.
63 double beamPipeRadius = m_defaultInnerRadius; // mm
64 Amg::Transform3D beamPipeTransform = Amg::Transform3D::Identity();
65
67
68 // Navigate the GeoModel tree to reach the actual beam pipe volume.
69 // When there is a single tree top, the real tube sits two levels down
70 // (envelope → envelope → tube).
71 PVConstLink beamPipeTopVolume = m_beamPipeMgr->getTreeTop(0);
72 if (m_beamPipeMgr->getNumTreeTops() == 1) {
73 beamPipeTopVolume =
74 m_beamPipeMgr->getTreeTop(0)->getChildVol(0)->getChildVol(0);
75 }
76
77 // Extract the translation so the volume is placed at the same
78 // position as the GeoModel volume.
79 beamPipeTransform =
80 Amg::getTranslate3D(beamPipeTopVolume->getX().translation());
81
82 // If SectionC03 is found, then overwrite the default radius
83 const GeoLogVol* beamPipeLogVolume = beamPipeTopVolume->getLogVol();
84 if (beamPipeLogVolume == nullptr) {
85 ATH_MSG_ERROR("Beam pipe volume has no log volume");
86 throw std::runtime_error("Beam pipe volume has no log volume");
87 }
88
89 const GeoTube* beamPipeTube =
90 dynamic_cast<const GeoTube*>(beamPipeLogVolume->getShape());
91 if (beamPipeTube == nullptr) {
92 ATH_MSG_ERROR("BeamPipeLogVolume was not of type GeoTube");
93 throw std::runtime_error{"BeamPipeLogVolume was not of type GeoTube"};
94 }
95
96 // SectionC03 is the central beam-pipe section at η≈0 whose mid-radius is
97 // used as the representative beam pipe radius for the Acts cylinder.
98 for (unsigned int i = 0; i < beamPipeTopVolume->getNChildVols(); i++) {
99 if (beamPipeTopVolume->getNameOfChildVol(i) != "SectionC03") {
100 continue;
101 }
102 PVConstLink childTopVolume = beamPipeTopVolume->getChildVol(i);
103 const GeoLogVol* childLogVolume = childTopVolume->getLogVol();
104 const GeoTube* childTube =
105 dynamic_cast<const GeoTube*>(childLogVolume->getShape());
106 if (childTube) {
107 beamPipeRadius = 0.5 * (childTube->getRMax() + childTube->getRMin());
108 break;
109 }
110 }
111
113 "BeamPipe constructed from database with radius = " << beamPipeRadius);
115 "BeamPipe shift : " << beamPipeTransform.translation().transpose());
116 } else {
118 "BeamPipe constructed from default parameters with radius = "
119 << beamPipeRadius);
121 "BeamPipe shift : " << beamPipeTransform.translation().transpose());
122 }
123
124 // Build the blueprint subtree:
125 // GeometryIdentifierNode (assigns volume ID s_beamPipeVolumeId)
126 // └── MaterialDesignator "BeamPipe_Material" (material on outer
127 // cylinder)
128 // └── StaticVolume "BeamPipe" (the actual cylinder)
129 auto beamPipeNode =
130 std::make_shared<Acts::Experimental::GeometryIdentifierBlueprintNode>();
131 beamPipeNode->setAllVolumeIdsTo(s_beamPipeVolumeId).incrementLayerIds(1);
132
133 auto& beamPipeContainer =
134 beamPipeNode->addCylinderContainer("BeamPipeContainer", AxisR);
135 beamPipeContainer.setAttachmentStrategy(AttachmentStrategy::Gap);
136 beamPipeContainer.setResizeStrategy(ResizeStrategy::Gap);
137
138 beamPipeContainer.addMaterial("BeamPipe_Material", [&](auto& mat) {
139 // Place material on the outer cylindrical surface facing outward
140 mat.configureFace(OuterCylinder, {AxisRPhi, Closed, 20},
141 {AxisZ, Bound, 20});
142 // A solid cylinder from r=0 to beamPipeRadius, extending ±3 m in z
143 mat.addStaticVolume(beamPipeTransform,
144 std::make_shared<Acts::CylinderVolumeBounds>(
145 0, beamPipeRadius * 1_mm, 3. * 1_m),
146 "BeamPipeVolume");
147 });
148
149 return beamPipeNode;
150}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
constexpr std::size_t s_beamPipeVolumeId
Amg::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Eigen::Affine3d Transform3D

◆ initialize()

StatusCode ActsTrk::BeamPipeBlueprintNodeBuilder::initialize ( )
override

Definition at line 42 of file BeamPipeBlueprintNodeBuilder.cxx.

42 {
44 ATH_CHECK(detStore()->retrieve(m_beamPipeMgr, "BeamPipe"));
45 }
46 return StatusCode::SUCCESS;
47}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_beamPipeMgr

const BeamPipeDetectorManager* ActsTrk::BeamPipeBlueprintNodeBuilder::m_beamPipeMgr {nullptr}
private

Definition at line 32 of file BeamPipeBlueprintNodeBuilder.h.

32{nullptr};

◆ m_defaultInnerRadius

Gaudi::Property<double> ActsTrk::BeamPipeBlueprintNodeBuilder::m_defaultInnerRadius
private
Initial value:
{
this, "defaultInnerRadius", 20.,
"The inner radius of the beam pipe to use if not loading from the "
"database."}

Definition at line 39 of file BeamPipeBlueprintNodeBuilder.h.

39 {
40 this, "defaultInnerRadius", 20.,
41 "The inner radius of the beam pipe to use if not loading from the "
42 "database."};

◆ m_loadfromDatabase

Gaudi::Property<bool> ActsTrk::BeamPipeBlueprintNodeBuilder::m_loadfromDatabase
private
Initial value:
{
this, "loadFromDatabase", true,
"Whether to load the beam pipe geometry from the geometry database. If "
"false, a default tube will be created based on some default value."}

Definition at line 34 of file BeamPipeBlueprintNodeBuilder.h.

34 {
35 this, "loadFromDatabase", true,
36 "Whether to load the beam pipe geometry from the geometry database. If "
37 "false, a default tube will be created based on some default value."};

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