ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleGeometryTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SimpleGeometryTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
19 #include "Acts/Utilities/Units.hpp"
20 
21 using namespace Acts::UnitLiterals;
22 
23 namespace Acts {
24 namespace Test {
25 
26 // Create a test context
28 
32 BOOST_AUTO_TEST_CASE(SimpleGeometryTest) {
33  Logging::Level surfaceLLevel = Logging::INFO;
34  Logging::Level layerLLevel = Logging::INFO;
35  Logging::Level volumeLLevel = Logging::INFO;
36 
37  // configure surface array creator
39  auto surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(
40  sacConfig, getDefaultLogger("SurfaceArrayCreator", surfaceLLevel));
41  // configure the layer creator that uses the surface array creator
42  LayerCreator::Config lcConfig;
43  lcConfig.surfaceArrayCreator = surfaceArrayCreator;
44  auto layerCreator = std::make_shared<const LayerCreator>(
45  lcConfig, getDefaultLogger("LayerCreator", layerLLevel));
46  // configure the layer array creator
47  LayerArrayCreator::Config lacConfig;
48  auto layerArrayCreator = std::make_shared<const LayerArrayCreator>(
49  lacConfig, getDefaultLogger("LayerArrayCreator", layerLLevel));
50 
51  // tracking volume array creator
53  auto tVolumeArrayCreator = std::make_shared<const TrackingVolumeArrayCreator>(
54  tvacConfig, getDefaultLogger("TrackingVolumeArrayCreator", volumeLLevel));
55  // configure the cylinder volume helper
57  cvhConfig.layerArrayCreator = layerArrayCreator;
58  cvhConfig.trackingVolumeArrayCreator = tVolumeArrayCreator;
59  auto cylinderVolumeHelper = std::make_shared<const CylinderVolumeHelper>(
60  cvhConfig, getDefaultLogger("CylinderVolumeHelper", volumeLLevel));
61 
62  // ----------------- build a beam pipe -----------------------------------
64  bplConfig.layerIdentification = "BeamPipe";
65  bplConfig.centralLayerRadii = std::vector<double>(1, 3_mm);
66  bplConfig.centralLayerHalflengthZ = std::vector<double>(1, 40_mm);
67  bplConfig.centralLayerThickness = std::vector<double>(1, 0.8_mm);
68  auto beamPipeBuilder = std::make_shared<const PassiveLayerBuilder>(
69  bplConfig, getDefaultLogger("BeamPipeLayerBuilder", layerLLevel));
70  // create the volume for the beam pipe
72  bpvConfig.trackingVolumeHelper = cylinderVolumeHelper;
73  bpvConfig.volumeName = "BeamPipe";
74  bpvConfig.layerBuilder = beamPipeBuilder;
75  bpvConfig.layerEnvelopeR = {1_mm, 1_mm};
76  bpvConfig.buildToRadiusZero = true;
77  bpvConfig.volumeSignature = 0;
78  auto beamPipeVolumeBuilder = std::make_shared<const CylinderVolumeBuilder>(
79  bpvConfig, getDefaultLogger("BeamPipeVolumeBuilder", volumeLLevel));
80 
81  PassiveLayerBuilder::Config layerBuilderConfig;
82  layerBuilderConfig.layerIdentification = "CentralBarrel";
83  layerBuilderConfig.centralLayerRadii = {10_mm, 20_mm, 30_mm};
84  layerBuilderConfig.centralLayerHalflengthZ = {40_mm, 40_mm, 40_mm};
85  layerBuilderConfig.centralLayerThickness = {1_mm, 1_mm, 1_mm};
86  auto layerBuilder = std::make_shared<const PassiveLayerBuilder>(
87  layerBuilderConfig,
88  getDefaultLogger("CentralBarrelBuilder", layerLLevel));
89  // create the volume for the central barrel
91  cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
92  cvbConfig.volumeName = "CentralBarrel";
93  cvbConfig.layerBuilder = layerBuilder;
94  cvbConfig.layerEnvelopeR = {1_mm, 1_mm};
95  cvbConfig.buildToRadiusZero = false;
96  cvbConfig.volumeSignature = 0;
97  auto centralVolumeBuilder = std::make_shared<const CylinderVolumeBuilder>(
98  cvbConfig, getDefaultLogger("CentralVolumeBuilder", volumeLLevel));
99 
100  // Make the TrackingGeometry Builder
102  tgbConfig.trackingVolumeBuilders.push_back(
103  [=](const auto& context, const auto& inner, const auto&) {
104  return beamPipeVolumeBuilder->trackingVolume(context, inner);
105  });
106  tgbConfig.trackingVolumeBuilders.push_back(
107  [=](const auto& context, const auto& inner, const auto&) {
108  return centralVolumeBuilder->trackingVolume(context, inner);
109  });
110  tgbConfig.trackingVolumeHelper = cylinderVolumeHelper;
111 
112  TrackingGeometryBuilder tgBuilder(tgbConfig);
113  auto tGeometry = tgBuilder.trackingGeometry(tgContext);
114 
115  BOOST_CHECK(tGeometry != nullptr);
116 }
117 } // namespace Test
118 } // namespace Acts