Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-17 08:00:09

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