Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:15:34

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 "Acts/Plugins/GeoModel/detail/GeoSubtractionConverter.hpp"
0010 
0011 #include "Acts/Definitions/Common.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/Plugins/GeoModel/GeoModelConversionError.hpp"
0014 #include "Acts/Plugins/GeoModel/GeoModelConverters.hpp"
0015 #include "Acts/Plugins/GeoModel/IGeoShapeConverter.hpp"
0016 #include "Acts/Surfaces/DiamondBounds.hpp"
0017 #include "Acts/Surfaces/PlaneSurface.hpp"
0018 #include "Acts/Surfaces/RectangleBounds.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0021 
0022 #include <GeoModelKernel/GeoBox.h>
0023 #include <GeoModelKernel/GeoFullPhysVol.h>
0024 #include <GeoModelKernel/GeoLogVol.h>
0025 #include <GeoModelKernel/GeoShape.h>
0026 #include <GeoModelKernel/GeoShapeShift.h>
0027 #include <GeoModelKernel/Units.h>
0028 
0029 Acts::Result<Acts::GeoModelSensitiveSurface>
0030 Acts::detail::GeoSubtractionConverter::operator()(
0031     [[maybe_unused]] const PVConstLink& geoPV,
0032     const GeoShapeSubtraction& geoSub, const Transform3& absTransform,
0033     [[maybe_unused]] bool sensitive) const {
0034   const GeoShape* shapeA = geoSub.getOpA();
0035   int shapeId = shapeA->typeID();
0036   std::shared_ptr<const Acts::IGeoShapeConverter> converter =
0037       Acts::geoShapesConverters(shapeId);
0038   if (converter == nullptr) {
0039     throw std::runtime_error("The converter for " + shapeA->type() +
0040                              " is nullptr");
0041   }
0042   // Material and name for the PVConstLink declaration are dummie variables
0043   GeoIntrusivePtr<GeoMaterial> material(new GeoMaterial("Material", 1.0));
0044   GeoIntrusivePtr<GeoLogVol> logA(new GeoLogVol("", shapeA, material));
0045   PVConstLink pvA = new GeoVPhysVol(logA);
0046 
0047   // recursively call the the converter
0048   auto converted = converter->toSensitiveSurface(pvA, absTransform);
0049   if (converted.ok()) {
0050     return converted.value();
0051   } else {
0052     throw std::runtime_error("Unexpected error in the conversion of " +
0053                              shapeA->type());
0054   }
0055 }