Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-20 07:59:57

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/Units.hpp"
0012 #include "Acts/Geometry/ApproachDescriptor.hpp"
0013 #include "Acts/Geometry/BoundarySurfaceT.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Geometry/GeometryIdentifier.hpp"
0016 #include "Acts/Geometry/Layer.hpp"
0017 #include "Acts/Geometry/TrackingVolume.hpp"
0018 #include "Acts/Surfaces/Surface.hpp"
0019 #include "Acts/Surfaces/SurfaceArray.hpp"
0020 #include "Acts/Utilities/BinnedArray.hpp"
0021 
0022 #include <memory>
0023 #include <vector>
0024 
0025 #include "TrackingVolumeCreation.hpp"
0026 
0027 using namespace Acts;
0028 using namespace Acts::UnitLiterals;
0029 
0030 namespace ActsTests {
0031 
0032 // Create a test context
0033 GeometryContext tgContext = GeometryContext();
0034 
0035 ///  create three cylinder surfaces
0036 ///  the surface radius (will also be the layer radius)
0037 double iVsurfaceHalfLengthZ = 50_mm;
0038 double iVsurfaceR = 25_mm;
0039 double iVsurfaceRstagger = 5_mm;
0040 double iVsurfaceZoverlap = 10_mm;
0041 double iVlayerEnvelope = 0.5_mm;
0042 double iVvolumeEnvelope = 10_mm;
0043 double iVvolumeR =
0044     iVsurfaceR + 0.5 * iVsurfaceRstagger + iVlayerEnvelope + iVvolumeEnvelope;
0045 
0046 ///  the surface radius (will also be the layer radius)
0047 double oVsurfaceHalfLengthZ = 50_mm;
0048 double oVsurfaceR = 100_mm;
0049 double oVsurfaceRstagger = 5_mm;
0050 double oVsurfaceZoverlap = 10_mm;
0051 double oVlayerEnvelope = 0.5_mm;
0052 double oVvolumeEnvelope = 10_mm;
0053 double oVvolumeR =
0054     oVsurfaceR + 0.5 * oVsurfaceRstagger + oVlayerEnvelope + oVvolumeEnvelope;
0055 
0056 ///  inner volume
0057 auto iVolume = constructCylinderVolume(
0058     tgContext, iVsurfaceHalfLengthZ, iVsurfaceR, iVsurfaceRstagger,
0059     iVsurfaceZoverlap, iVlayerEnvelope, iVvolumeEnvelope, 0., iVvolumeR,
0060     "InnerVolume");
0061 
0062 BOOST_AUTO_TEST_SUITE(GeometrySuite)
0063 
0064 BOOST_AUTO_TEST_CASE(GeometryIdentifier_innervolume_test) {
0065   BOOST_CHECK_EQUAL(0ul, iVolume->geometryId().value());
0066   // check the boundary surfaces
0067   for (const auto& bSf : iVolume->boundarySurfaces()) {
0068     BOOST_CHECK_EQUAL(0ul, bSf->surfaceRepresentation().geometryId().value());
0069     for (const auto& lay : iVolume->confinedLayers()->arrayObjects()) {
0070       BOOST_CHECK_EQUAL(0ul, lay->geometryId().value());
0071       // check the approach surfaces
0072       for (const auto& asf : lay->approachDescriptor()->containedSurfaces()) {
0073         BOOST_CHECK_EQUAL(0ul, asf->geometryId().value());
0074       }
0075       // check the layer surface array
0076       for (const auto& ssf : lay->surfaceArray()->surfaces()) {
0077         BOOST_CHECK_EQUAL(0ul, ssf->geometryId().value());
0078       }
0079     }
0080   }
0081 }
0082 
0083 ///  outer volume
0084 auto oVolume = constructCylinderVolume(
0085     tgContext, oVsurfaceHalfLengthZ, oVsurfaceR, oVsurfaceRstagger,
0086     oVsurfaceZoverlap, oVlayerEnvelope, oVvolumeEnvelope, iVvolumeR, oVvolumeR,
0087     "OuterVolume");
0088 
0089 BOOST_AUTO_TEST_CASE(GeometryIdentifier_outervolume_test) {
0090   BOOST_CHECK_EQUAL(0ul, oVolume->geometryId().value());
0091   // check the boundary surfaces
0092   for (const auto& bSf : iVolume->boundarySurfaces()) {
0093     BOOST_CHECK_EQUAL(0ul, bSf->surfaceRepresentation().geometryId().value());
0094     for (const auto& lay : oVolume->confinedLayers()->arrayObjects()) {
0095       BOOST_CHECK_EQUAL(0ul, lay->geometryId().value());
0096       // check the approach surfaces
0097       for (const auto& asf : lay->approachDescriptor()->containedSurfaces()) {
0098         BOOST_CHECK_EQUAL(0ul, asf->geometryId().value());
0099       }
0100       // check the layer surface array
0101       for (const auto& ssf : lay->surfaceArray()->surfaces()) {
0102         BOOST_CHECK_EQUAL(0ul, ssf->geometryId().value());
0103       }
0104     }
0105   }
0106 }
0107 //
0108 double oVvolumeHalfZ =
0109     (4 * oVsurfaceHalfLengthZ - oVsurfaceZoverlap) + oVvolumeEnvelope;
0110 // now create the container volume
0111 auto hVolume = constructContainerVolume(tgContext, iVolume, oVolume, oVvolumeR,
0112                                         oVvolumeHalfZ, "Container");
0113 
0114 ///  pre-check on GeometryIdentifier
0115 BOOST_AUTO_TEST_CASE(GeometryIdentifier_containervolume_test) {
0116   ///  let's check that the geometry ID values are all 0
0117   BOOST_CHECK_EQUAL(0ul, hVolume->geometryId().value());
0118   /// check the boundaries of the hVolume, should also be 0
0119   for (const auto& hbsf : hVolume->boundarySurfaces()) {
0120     BOOST_CHECK_EQUAL(0ul, hbsf->surfaceRepresentation().geometryId().value());
0121   }
0122   for (const auto& cVol : hVolume->confinedVolumes()->arrayObjects()) {
0123     /// let's check everything is set to 0
0124     BOOST_CHECK_EQUAL(0ul, cVol->geometryId().value());
0125     // check the boundary surfaces
0126     for (const auto& bSf : cVol->boundarySurfaces()) {
0127       BOOST_CHECK_EQUAL(0ul, bSf->surfaceRepresentation().geometryId().value());
0128     }
0129     for (const auto& lay : cVol->confinedLayers()->arrayObjects()) {
0130       BOOST_CHECK_EQUAL(0ul, lay->geometryId().value());
0131       // check the approach surfaces
0132       for (const auto& asf : lay->approachDescriptor()->containedSurfaces()) {
0133         BOOST_CHECK_EQUAL(0ul, asf->geometryId().value());
0134       }
0135       // check the layer surface array
0136       for (auto ssf : lay->surfaceArray()->surfaces()) {
0137         BOOST_CHECK_EQUAL(0ul, ssf->geometryId().value());
0138       }
0139     }
0140   }
0141 }
0142 
0143 BOOST_AUTO_TEST_SUITE_END()
0144 
0145 }  // namespace ActsTests