Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:35: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 "Acts/Tests/CommonHelpers/CylindricalDetector.hpp"
0010 
0011 #include "Acts/Detector/CylindricalContainerBuilder.hpp"
0012 #include "Acts/Detector/DetectorBuilder.hpp"
0013 #include "Acts/Detector/DetectorComponents.hpp"
0014 #include "Acts/Detector/DetectorVolume.hpp"
0015 #include "Acts/Detector/GeometryIdGenerator.hpp"
0016 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Material/BinnedSurfaceMaterial.hpp"
0019 #include "Acts/Material/HomogeneousSurfaceMaterial.hpp"
0020 #include "Acts/Material/Material.hpp"
0021 #include "Acts/Material/MaterialSlab.hpp"
0022 #include "Acts/Navigation/DetectorVolumeFinders.hpp"
0023 #include "Acts/Navigation/InternalNavigation.hpp"
0024 #include "Acts/Surfaces/CylinderBounds.hpp"
0025 #include "Acts/Surfaces/CylinderSurface.hpp"
0026 #include "Acts/Surfaces/DiscSurface.hpp"
0027 #include "Acts/Surfaces/RadialBounds.hpp"
0028 
0029 #include <memory>
0030 
0031 auto materialSlab =
0032     Acts::MaterialSlab(Acts::Material::fromMolarDensity(1, 2, 3, 4, 5), 1.);
0033 
0034 using namespace Acts;
0035 using namespace Acts::Experimental;
0036 
0037 std::shared_ptr<const Detector> Acts::Test::buildCylindricalDetector(
0038     const Acts::GeometryContext& tContext) {
0039   auto material =
0040       std::make_shared<const HomogeneousSurfaceMaterial>(materialSlab);
0041 
0042   auto beampipe = std::make_shared<
0043       CylindricalVolumeBuilder<CylinderSurface, CylinderBounds>>(
0044       Transform3::Identity(), CylinderVolumeBounds(0., 50., 400.),
0045       CylinderBounds(25., 380.), "BeamPipe", material);
0046 
0047   // Declare a negative disc builder
0048   Transform3 negZ = Transform3::Identity();
0049   negZ.pretranslate(Vector3(0., 0., -300.));
0050   auto endcapN =
0051       std::make_shared<CylindricalVolumeBuilder<DiscSurface, RadialBounds>>(
0052           negZ, CylinderVolumeBounds(50., 140., 100.), RadialBounds(60., 120.),
0053           "NegativeEndcap", material);
0054 
0055   // Declare a barrel sub builder
0056   auto barrel0 = std::make_shared<
0057       CylindricalVolumeBuilder<CylinderSurface, CylinderBounds>>(
0058       Transform3::Identity(), CylinderVolumeBounds(50., 80., 200.),
0059       CylinderBounds(65., 180.), "Barrel0", material);
0060 
0061   // Declare a barrel sub builder
0062   auto barrel1 = std::make_shared<
0063       CylindricalVolumeBuilder<CylinderSurface, CylinderBounds>>(
0064       Transform3::Identity(), CylinderVolumeBounds(80., 110., 200.),
0065       CylinderBounds(95., 180.), "Barrel1", material);
0066 
0067   // Declare a barrel sub builder
0068   auto barrel2 = std::make_shared<
0069       CylindricalVolumeBuilder<CylinderSurface, CylinderBounds>>(
0070       Transform3::Identity(), CylinderVolumeBounds(110., 140., 200.),
0071       CylinderBounds(125., 180.), "Barrel2", material);
0072 
0073   // Create the barrel container builder
0074   CylindricalContainerBuilder::Config barrelRCfg;
0075   barrelRCfg.builders = {barrel0, barrel1, barrel2};
0076   barrelRCfg.binning = {AxisDirection::AxisR};
0077 
0078   auto barrel = std::make_shared<CylindricalContainerBuilder>(
0079       barrelRCfg, getDefaultLogger("BarrelBuilderR", Logging::INFO));
0080 
0081   Transform3 posZ = Transform3::Identity();
0082   posZ.pretranslate(Vector3(0., 0., 300.));
0083   auto endcapP =
0084       std::make_shared<CylindricalVolumeBuilder<DiscSurface, RadialBounds>>(
0085           posZ, CylinderVolumeBounds(50., 140., 100.), RadialBounds(60., 120.),
0086           "PositiveEndcap", material);
0087 
0088   // Create the barrel container builder
0089   CylindricalContainerBuilder::Config barrelEndcapCfg;
0090   barrelEndcapCfg.builders = {endcapN, barrel, endcapP};
0091   barrelEndcapCfg.binning = {AxisDirection::AxisZ};
0092 
0093   auto barrelEndcap = std::make_shared<CylindricalContainerBuilder>(
0094       barrelEndcapCfg, getDefaultLogger("BarrelEndcapBuilder", Logging::INFO));
0095 
0096   // Create the barrel container builder
0097   CylindricalContainerBuilder::Config detectorCfg;
0098   detectorCfg.builders = {beampipe, barrelEndcap};
0099   detectorCfg.binning = {AxisDirection::AxisR};
0100 
0101   auto containerBuilder = std::make_shared<CylindricalContainerBuilder>(
0102       detectorCfg, getDefaultLogger("DetectorBuilder", Logging::INFO));
0103 
0104   // Detector builder
0105   auto gigConfig = GeometryIdGenerator::Config();
0106   auto gig = std::make_shared<GeometryIdGenerator>(gigConfig);
0107 
0108   Acts::Experimental::DetectorBuilder::Config dCfg;
0109   dCfg.auxiliary = "*** Test : Cylindrical Detector ***";
0110   dCfg.name = "CylindricalDetector";
0111   dCfg.builder = containerBuilder;
0112   dCfg.geoIdGenerator = gig;
0113 
0114   return DetectorBuilder(dCfg).construct(tContext);
0115 }