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 // switching format off to avoid conflicting declaration in GeoModel
0012 // needed until Acts GeoModel bumps to 6.5
0013 //clang-format off
0014 #include "Acts/Plugins/GeoModel/GeoModelDetectorObjectFactory.hpp"
0015 //clang-format on
0016 #include "Acts/Geometry/CuboidVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Plugins/GeoModel/GeoModelConverters.hpp"
0019 #include "Acts/Surfaces/RectangleBounds.hpp"
0020 #include "Acts/Surfaces/Surface.hpp"
0021 #include "Acts/Surfaces/SurfaceBounds.hpp"
0022 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0023 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0024 
0025 #include <GeoModelKernel/GeoBox.h>
0026 #include <GeoModelKernel/GeoFullPhysVol.h>
0027 #include <GeoModelKernel/GeoLogVol.h>
0028 #include <GeoModelKernel/GeoMaterial.h>
0029 #include <GeoModelKernel/GeoTrap.h>
0030 #include <GeoModelKernel/GeoTrd.h>
0031 #include <GeoModelKernel/GeoVPhysVol.h>
0032 
0033 BOOST_AUTO_TEST_SUITE(GeoModelPlugin)
0034 
0035 // GeoBox conversion test case
0036 BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) {
0037   auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0038   // Let's create a GeoFullPhysVol object
0039 
0040   // (BOX object) - XY
0041   std::vector<double> hls = {100, 200, 2};
0042   auto box = new GeoBox(hls[0], hls[1], hls[2]);
0043   auto logBox = new GeoLogVol("Box", box, material);
0044   auto physBox = make_intrusive<GeoFullPhysVol>(logBox);
0045 
0046   // create pars for conversion
0047   Acts::GeoModelDetectorObjectFactory::Config gmConfig;
0048   gmConfig.convertBox = {"Box"};
0049   Acts::GeometryContext gContext;
0050   Acts::GeoModelDetectorObjectFactory::Cache gmCache;
0051 
0052   // create factory instance
0053   Acts::GeoModelDetectorObjectFactory factory(gmConfig);
0054 
0055   factory.convertFpv("Box", physBox, gmCache, gContext);
0056   std::shared_ptr<Acts::Experimental::DetectorVolume> volumeBox =
0057       gmCache.boundingBoxes[0];
0058   const auto* bounds =
0059       dynamic_cast<const Acts::CuboidVolumeBounds*>(&volumeBox->volumeBounds());
0060   std::vector<double> convHls = bounds->values();
0061   for (std::size_t i = 0; i < hls.size(); i++) {
0062     BOOST_CHECK(hls[i] == convHls[i]);
0063   }
0064 }
0065 
0066 BOOST_AUTO_TEST_SUITE_END()