File indexing completed on 2025-10-22 07:52:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsPlugins/GeoModel/detail/GeoSubtractionConverter.hpp"
0010
0011 #include "Acts/Definitions/Common.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/Surfaces/DiamondBounds.hpp"
0014 #include "Acts/Surfaces/PlaneSurface.hpp"
0015 #include "Acts/Surfaces/RectangleBounds.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0018 #include "ActsPlugins/GeoModel/GeoModelConversionError.hpp"
0019 #include "ActsPlugins/GeoModel/GeoModelConverters.hpp"
0020 #include "ActsPlugins/GeoModel/IGeoShapeConverter.hpp"
0021
0022 #include <GeoModelKernel/GeoBox.h>
0023 #include <GeoModelKernel/GeoLogVol.h>
0024 #include <GeoModelKernel/GeoPhysVol.h>
0025 #include <GeoModelKernel/GeoShape.h>
0026 #include <GeoModelKernel/GeoShapeShift.h>
0027 #include <GeoModelKernel/Units.h>
0028
0029 using namespace Acts;
0030
0031 Result<ActsPlugins::GeoModelSensitiveSurface>
0032 ActsPlugins::detail::GeoSubtractionConverter::operator()(
0033 [[maybe_unused]] const PVConstLink& geoPV,
0034 const GeoShapeSubtraction& geoSub, const Transform3& absTransform,
0035 SurfaceBoundFactory& boundFactory, [[maybe_unused]] bool sensitive) const {
0036 const GeoShape* shapeA = geoSub.getOpA();
0037 int shapeId = shapeA->typeID();
0038 std::shared_ptr<const IGeoShapeConverter> converter =
0039 geoShapesConverters(shapeId);
0040 if (converter == nullptr) {
0041 throw std::runtime_error("The converter for " + shapeA->type() +
0042 " is nullptr");
0043 }
0044
0045 auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0046 auto logA = make_intrusive<GeoLogVol>("", shapeA, material);
0047 PVConstLink pvA = make_intrusive<GeoPhysVol>(logA);
0048
0049
0050 auto converted =
0051 converter->toSensitiveSurface(pvA, absTransform, boundFactory);
0052 if (converted.ok()) {
0053 return converted.value();
0054 } else {
0055 throw std::runtime_error("Unexpected error in the conversion of " +
0056 shapeA->type());
0057 }
0058 }