Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:08:28

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsPlugins/GeoModel/detail/GeoShiftConverter.hpp"
0010 
0011 #include "Acts/Surfaces/PlaneSurface.hpp"
0012 #include "Acts/Surfaces/StrawSurface.hpp"
0013 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0014 #include "ActsPlugins/GeoModel/GeoModelConversionError.hpp"
0015 #include "ActsPlugins/GeoModel/detail/GeoBoxConverter.hpp"
0016 #include "ActsPlugins/GeoModel/detail/GeoTrdConverter.hpp"
0017 #include "ActsPlugins/GeoModel/detail/GeoTubeConverter.hpp"
0018 
0019 #include <GeoModelHelpers/GeoShapeUtils.h>
0020 #include <GeoModelKernel/GeoShapeShift.h>
0021 #include <GeoModelKernel/GeoTube.h>
0022 
0023 using namespace Acts;
0024 
0025 namespace ActsPlugins::detail {
0026 
0027 namespace {
0028 
0029 template <typename ContainedShape, typename Converter>
0030 Result<GeoModelSensitiveSurface> impl(PVConstLink geoPV,
0031                                       const GeoShapeShift& geoShift,
0032                                       const Transform3& absTransform,
0033                                       SurfaceBoundFactory& boundFactory,
0034                                       bool sensitive) {
0035   auto* trd = dynamic_cast<const ContainedShape*>(geoShift.getOp());
0036 
0037   if (trd == nullptr) {
0038     return GeoModelConversionError::WrongShapeForConverter;
0039   }
0040 
0041   return Converter{}(geoPV, *trd, absTransform * geoShift.getX(), boundFactory,
0042                      sensitive);
0043 }
0044 
0045 }  // namespace
0046 
0047 Result<GeoModelSensitiveSurface> GeoShiftConverter::operator()(
0048     const PVConstLink& geoPV, const GeoShapeShift& geoShift,
0049     const Transform3& absTransform, SurfaceBoundFactory& boundFactory,
0050     bool sensitive) const {
0051   const auto opType = geoShift.getOp()->typeID();
0052   if (opType == GeoTrd::getClassTypeID()) {
0053     return impl<GeoTrd, detail::GeoTrdConverter>(geoPV, geoShift, absTransform,
0054                                                  boundFactory, sensitive);
0055   } else if (opType == GeoBox::getClassTypeID()) {
0056     return impl<GeoBox, detail::GeoBoxConverter>(geoPV, geoShift, absTransform,
0057                                                  boundFactory, sensitive);
0058   } else if (opType == GeoTube::getClassTypeID()) {
0059     return impl<GeoTube, detail::GeoTubeConverter>(
0060         geoPV, geoShift, absTransform, boundFactory, sensitive);
0061   }
0062 
0063   return GeoModelConversionError::WrongShapeForConverter;
0064 }
0065 
0066 }  // namespace ActsPlugins::detail