Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:26:20

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