Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-14 07:38:05

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 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/CylinderLayer.hpp"
0013 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Geometry/LayerArrayCreator.hpp"
0016 #include "Acts/Geometry/TrackingGeometry.hpp"
0017 #include "Acts/Geometry/TrackingVolume.hpp"
0018 #include "Acts/Geometry/TrackingVolumeArrayCreator.hpp"
0019 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0020 #include "Acts/Material/HomogeneousSurfaceMaterial.hpp"
0021 #include "Acts/Material/HomogeneousVolumeMaterial.hpp"
0022 #include "Acts/Material/Material.hpp"
0023 #include "Acts/Material/PropagatorMaterialAssigner.hpp"
0024 #include "Acts/Propagator/Navigator.hpp"
0025 #include "Acts/Propagator/StraightLineStepper.hpp"
0026 #include "Acts/Surfaces/CylinderSurface.hpp"
0027 #include "Acts/Surfaces/SurfaceArray.hpp"
0028 
0029 using namespace Acts;
0030 
0031 namespace ActsTests {
0032 
0033 auto tContext = GeometryContext::dangerouslyDefaultConstruct();
0034 auto mContext = MagneticFieldContext();
0035 
0036 double rMin = 0.;
0037 double rMid = 25.;
0038 double rMax = 110.;
0039 
0040 auto vCylinderOuter = std::make_shared<CylinderVolumeBounds>(rMid, rMax, 110.);
0041 
0042 auto pCylinder = std::make_shared<const CylinderBounds>(20., 100.);
0043 
0044 auto surfaceMaterial = std::make_shared<HomogeneousSurfaceMaterial>();
0045 
0046 Material mat = Material::fromMolarDensity(1., 2., 3., 4., 5.);
0047 auto volumeMaterial = std::make_shared<HomogeneousVolumeMaterial>(mat);
0048 
0049 BOOST_AUTO_TEST_SUITE(MaterialSuite)
0050 
0051 /// Test with TrackingGeometry
0052 BOOST_AUTO_TEST_CASE(FindSurfaceIntersectionsTrackingGeometry) {
0053   auto vCylinderInner =
0054       std::make_shared<CylinderVolumeBounds>(rMin, rMid, 110.);
0055 
0056   // Create a tracking geometry with  one material layer and one material volume
0057   auto pCylinderLayer =
0058       CylinderLayer::create(Transform3::Identity(), pCylinder, nullptr, 1.);
0059   pCylinderLayer->surfaceRepresentation().assignSurfaceMaterial(
0060       surfaceMaterial);
0061 
0062   LayerArrayCreator::Config lacConfig;
0063   LayerArrayCreator lac = LayerArrayCreator(lacConfig);
0064   auto layers = lac.layerArray(tContext, {pCylinderLayer}, rMin, rMid,
0065                                arbitrary, AxisDirection::AxisR);
0066 
0067   auto innerVolume = std::make_shared<TrackingVolume>(
0068       Transform3::Identity(), vCylinderInner, nullptr, std::move(layers),
0069       nullptr, MutableTrackingVolumeVector{}, "InnerVolumeWithLayers");
0070 
0071   auto outerVolume = std::make_shared<TrackingVolume>(
0072       Transform3::Identity(), vCylinderOuter, volumeMaterial, nullptr, nullptr,
0073       MutableTrackingVolumeVector{}, "OuterVolume");
0074   innerVolume->glueTrackingVolume(tContext, tubeOuterCover, outerVolume.get(),
0075                                   tubeInnerCover);
0076 
0077   TrackingVolumeArrayCreator::Config tvacConfig;
0078   TrackingVolumeArrayCreator tvac = TrackingVolumeArrayCreator(tvacConfig);
0079 
0080   auto volumes = tvac.trackingVolumeArray(tContext, {innerVolume, outerVolume},
0081                                           AxisDirection::AxisR);
0082 
0083   auto vCylinderTop = std::make_shared<CylinderVolumeBounds>(rMin, rMax, 110.);
0084 
0085   auto topVolume = std::make_shared<TrackingVolume>(
0086       Transform3::Identity(), vCylinderTop, nullptr, nullptr, volumes,
0087       MutableTrackingVolumeVector{}, "TopVolume");
0088 
0089   auto tGeometry = std::make_shared<TrackingGeometry>(topVolume);
0090 
0091   // Create a navigator and a propagator
0092   Navigator::Config navConfig{tGeometry};
0093   Navigator navigator(navConfig);
0094 
0095   using StraightLinePropagator = Propagator<StraightLineStepper, Navigator>;
0096 
0097   StraightLineStepper stepper;
0098   StraightLinePropagator propagator(stepper, navigator);
0099 
0100   using PropagationMaterialAssigner =
0101       PropagatorMaterialAssigner<StraightLinePropagator>;
0102 
0103   PropagationMaterialAssigner pmAssigner(propagator);
0104   auto [surfaceCandides, volumeCandidates] = pmAssigner.assignmentCandidates(
0105       tContext, mContext, Vector3(0, 0, 0), Vector3(1, 1, 0).normalized());
0106 
0107   BOOST_CHECK_EQUAL(surfaceCandides.size(), 1u);
0108   BOOST_CHECK_EQUAL(volumeCandidates.size(), 1u);
0109 }
0110 
0111 BOOST_AUTO_TEST_SUITE_END()
0112 
0113 }  // namespace ActsTests