Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:41

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