diff --git a/Core/src/Detector/CylindricalContainerBuilder.cpp b/Core/src/Detector/CylindricalContainerBuilder.cpp index 70a7de145b0..25749434e04 100644 --- a/Core/src/Detector/CylindricalContainerBuilder.cpp +++ b/Core/src/Detector/CylindricalContainerBuilder.cpp @@ -156,7 +156,36 @@ Acts::Experimental::CylindricalContainerBuilder::CylindricalContainerBuilder( } } + if (m_cfg.builders.empty()) { + throw std::invalid_argument( + "CylindricalContainerBuilder: no sub builders provided."); + } m_cfg.binning = bpNode.binning; + // Check if binning value is correctly chosen + if (m_cfg.binning.size() == 1u) { + // 1-dimensional case + auto b = m_cfg.binning.front(); + if (b != Acts::binR && b != Acts::binZ && b != Acts::binPhi) { + throw std::invalid_argument( + "CylindricalContainerBuilder: 1D binning only supported in z, r, or " + "phi"); + } + } else if (m_cfg.binning.size() == 2u) { + // 2-dimensional case, this is for wrapping + if (m_cfg.binning != + std::vector{Acts::binZ, Acts::binR}) { + throw std::invalid_argument( + "CylindricalContainerBuilder: 2D binning only supports wrapping in " + "z-r."); + } else if (m_cfg.builders.size() != 2u) { + // Wrapping needs exactly one inner (volume or container) and one outer + // volume + throw std::invalid_argument( + "CylindricalContainerBuilder: 2D wrapping in z-r requires exactly " + "two builders."); + } + } + m_cfg.auxiliary = "*** acts auto-generated from proxy ***"; m_cfg.geoIdGenerator = bpNode.geoIdGenerator; m_cfg.rootVolumeFinderBuilder = bpNode.rootVolumeFinderBuilder; @@ -205,17 +234,6 @@ Acts::Experimental::CylindricalContainerBuilder::construct( } ACTS_VERBOSE("Number of root volumes: " << rootVolumes.size()); - // Check if a root volume finder is provided - if (m_cfg.rootVolumeFinderBuilder) { - // Return the container - return Acts::Experimental::DetectorComponent{ - {}, - portalContainer, - RootDetectorVolumes{ - rootVolumes, - m_cfg.rootVolumeFinderBuilder->construct(gctx, rootVolumes)}}; - } - // Geometry Id generation if (m_cfg.geoIdGenerator != nullptr) { ACTS_DEBUG("Assigning geometry ids to the detector"); @@ -244,6 +262,17 @@ Acts::Experimental::CylindricalContainerBuilder::construct( } } + // Check if a root volume finder is provided + if (m_cfg.rootVolumeFinderBuilder) { + // Return the container + return Acts::Experimental::DetectorComponent{ + {}, + portalContainer, + RootDetectorVolumes{ + rootVolumes, + m_cfg.rootVolumeFinderBuilder->construct(gctx, rootVolumes)}}; + } + // Return the container return Acts::Experimental::DetectorComponent{ {}, portalContainer, RootDetectorVolumes{rootVolumes, tryRootVolumes()}};