74 const Acts::GeometryContext& gctx,
75 std::shared_ptr<Acts::BlueprintNode>&& child) {
77 ExtentEnvelope envelope = ExtentEnvelope{{
81 auto itkHgtdPad = std::make_shared<Acts::PadBlueprintNode>(
82 "itkHgtdPad", envelope);
85 std::make_shared<Acts::CylinderContainerBlueprintNode>(
89 itkHgtdNode->addChild(std::move(child));
93 itkHgtdPad->addChild(itkHgtdNode);
98 const Acts::GeometryContext& ,
99 Acts::BlueprintNode&
node) {
102 throw std::runtime_error(
"HGTD manager not available");
106 <<
m_hgtdMgr->getDetectorElementCollection()->size()
109 std::vector<std::shared_ptr<ActsDetectorElement>> elements;
111 for (
const auto* element : *
m_hgtdMgr->getDetectorElementCollection()) {
114 if (hgtdDetElement ==
nullptr) {
116 throw std::runtime_error{
"Corrupt detector element collection"};
118 elements.push_back(std::make_shared<ActsDetectorElement>(
119 *hgtdDetElement, hgtdDetElement->
identify()));
124 elements.begin(), elements.end());
126 for (
int bec : {-2, 2}) {
127 const std::string s = bec > 0 ?
"p" :
"n";
129 std::map<int, std::vector<std::shared_ptr<Acts::Surface>>> layers{};
131 for (
auto& element : elements) {
135 <<
id.bec() <<
", layer/disk " <<
id.layer_disk()
136 <<
", eta_module " <<
id.eta_module() <<
", phi_module "
139 if (
id.bec() * bec <= 0) {
143 layers[
id.layer_disk()].push_back(element->surface().getSharedPtr());
146 ATH_MSG_DEBUG(
"Found " << layers.size() <<
" layers in HGTD " << s <<
"EC");
147 for (
auto& [key, surfaces] : layers) {
152 node.withGeometryIdentifier([&layers, bec, s,
this](
auto& geoId) {
153 std::string ecName =
"HGTD_" + s +
"EC";
155 .incrementLayerIds(1);
157 geoId.addCylinderContainer(ecName, AxisR, [&](
auto& hgtd) {
158 hgtd.setAttachmentStrategy(AttachmentStrategy::Gap);
159 hgtd.setResizeStrategy(ResizeStrategy::Gap);
161 hgtd.addCylinderContainer(
162 ecName +
"_Container", AxisZ, [&](
auto& hgtdContainer) {
166 hgtdContainer.setAttachmentStrategy(
167 bec > 0 ? AttachmentStrategy::Second
168 : AttachmentStrategy::First);
169 hgtdContainer.setResizeStrategy(ResizeStrategy::Gap);
171 const int innermostLayer = layers.begin()->first;
172 for (
auto& [key, surfaces] : layers) {
173 std::string layerName = ecName +
"_" + std::to_string(key);
180 key == innermostLayer);
189 Acts::BlueprintNode& parent,
int bec,
int index,
190 const std::string& name,
191 std::vector<std::shared_ptr<Acts::Surface>>& surfaces,
bool isInnermost) {
192 using enum Acts::SurfaceArrayNavigationPolicy::LayerType;
193 using enum Acts::CylinderVolumeBounds::Face;
194 using enum Acts::AxisDirection;
202 const auto outwardDisc = (bec > 0) ? PositiveDisc : NegativeDisc;
203 const auto inwardDisc = (bec > 0) ? NegativeDisc : PositiveDisc;
204 const bool hasMaterial = (
index != 3) || isInnermost;
206 auto configureLayer = [&](
auto&
node) {
207 node.addLayer(name, [&surfaces](
auto& layer) {
208 layer.setNavigationPolicyFactory(
209 Acts::NavigationPolicyFactory{}
210 .add<Acts::SurfaceArrayNavigationPolicy>(
211 Acts::SurfaceArrayNavigationPolicy::Config{.layerType = Disc,
212 .bins = {0, 0}, .numberOfBinsFactor = 5.0})
213 .add<Acts::CylinderNavigationPolicy>()
215 layer.setSurfaces(surfaces);
216 layer.setEnvelope(Acts::ExtentEnvelope{{
217 .z = {0.1_mm, 0.1_mm},
226 parent.addMaterial(name +
"_Material", [&](
auto& mat) {
228 mat.configureFace(outwardDisc, AxisSpec::DeferredEquidistant(20, AxisR),
229 AxisSpec::DeferredEquidistant(40, AxisPhi));
232 mat.configureFace(inwardDisc, AxisSpec::DeferredEquidistant(20, AxisR),
233 AxisSpec::DeferredEquidistant(40, AxisPhi));
238 configureLayer(parent);