Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:10

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 <boost/test/unit_test.hpp>
0010 
0011 // In order to avoid conflicts with declarations in Geomodel that is fixed in
0012 // v3.5
0013 //  clang-formal off
0014 #include "Acts/Plugins/GeoModel/GeoModelDetectorObjectFactory.hpp"
0015 // clang-formal on
0016 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Plugins/GeoModel/GeoModelConverters.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Surfaces/SurfaceBounds.hpp"
0021 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0022 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0023 
0024 #include <GeoModelKernel/GeoFullPhysVol.h>
0025 #include <GeoModelKernel/GeoLogVol.h>
0026 #include <GeoModelKernel/GeoMaterial.h>
0027 #include <GeoModelKernel/GeoTrap.h>
0028 #include <GeoModelKernel/GeoTube.h>
0029 #include <GeoModelKernel/GeoVPhysVol.h>
0030 
0031 BOOST_AUTO_TEST_SUITE(GeoModelPlugin)
0032 
0033 // GeoBox conversion test case
0034 BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) {
0035   auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0036   // Let's create a GeoFullPhysVol object
0037 
0038   // (BOX object) - XY
0039   std::vector<double> dims = {5, 6, 50};
0040   auto tube = new GeoTube(dims[0], dims[1], dims[2]);
0041   auto logTube = new GeoLogVol("Tube", tube, material);
0042   auto physTube = make_intrusive<GeoFullPhysVol>(logTube);
0043 
0044   // create pars for conversion
0045   Acts::GeoModelDetectorObjectFactory::Config gmConfig;
0046   gmConfig.convertBox = {"Tube"};
0047   Acts::GeometryContext gContext;
0048   Acts::GeoModelDetectorObjectFactory::Cache gmCache;
0049 
0050   // create factory instance
0051   Acts::GeoModelDetectorObjectFactory factory(gmConfig);
0052 
0053   factory.convertFpv("Tube", physTube, gmCache, gContext);
0054   std::shared_ptr<Acts::Experimental::DetectorVolume> volumeTube =
0055       gmCache.boundingBoxes[0];
0056   const auto* bounds = dynamic_cast<const Acts::CylinderVolumeBounds*>(
0057       &volumeTube->volumeBounds());
0058   std::vector<double> convDims = bounds->values();
0059   for (std::size_t i = 0; i < dims.size(); i++) {
0060     BOOST_CHECK(dims[i] == convDims[i]);
0061   }
0062 }
0063 
0064 BOOST_AUTO_TEST_SUITE_END()