EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SurfaceMaterialMapperTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SurfaceMaterialMapperTests.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 
25 
26 namespace Acts {
27 
29 std::shared_ptr<const TrackingGeometry> trackingGeometry() {
30  using namespace Acts::UnitLiterals;
31 
32  BinUtility zbinned(8, -40, 40, open, binZ);
33  auto matProxy = std::make_shared<const ProtoSurfaceMaterial>(zbinned);
34 
35  Logging::Level surfaceLLevel = Logging::INFO;
36  Logging::Level layerLLevel = Logging::INFO;
37  Logging::Level volumeLLevel = Logging::INFO;
38 
39  // configure surface array creator
40  auto surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(
41  getDefaultLogger("SurfaceArrayCreator", surfaceLLevel));
42  // configure the layer creator that uses the surface array creator
43  LayerCreator::Config lcConfig;
44  lcConfig.surfaceArrayCreator = surfaceArrayCreator;
45  auto layerCreator = std::make_shared<const LayerCreator>(
46  lcConfig, getDefaultLogger("LayerCreator", layerLLevel));
47  // configure the layer array creator
48  LayerArrayCreator::Config lacConfig;
49  auto layerArrayCreator = std::make_shared<const LayerArrayCreator>(
50  lacConfig, getDefaultLogger("LayerArrayCreator", layerLLevel));
51 
52  // tracking volume array creator
54  auto tVolumeArrayCreator = std::make_shared<const TrackingVolumeArrayCreator>(
55  tvacConfig, getDefaultLogger("TrackingVolumeArrayCreator", volumeLLevel));
56  // configure the cylinder volume helper
58  cvhConfig.layerArrayCreator = layerArrayCreator;
59  cvhConfig.trackingVolumeArrayCreator = tVolumeArrayCreator;
60  auto cylinderVolumeHelper = std::make_shared<const CylinderVolumeHelper>(
61  cvhConfig, getDefaultLogger("CylinderVolumeHelper", volumeLLevel));
62 
63  PassiveLayerBuilder::Config layerBuilderConfig;
64  layerBuilderConfig.layerIdentification = "CentralBarrel";
65  layerBuilderConfig.centralLayerRadii = {10., 20., 30.};
66  layerBuilderConfig.centralLayerHalflengthZ = {40., 40., 40.};
67  layerBuilderConfig.centralLayerThickness = {1., 1., 1.};
68  layerBuilderConfig.centralLayerMaterial = {matProxy, matProxy, matProxy};
69  auto layerBuilder = std::make_shared<const PassiveLayerBuilder>(
70  layerBuilderConfig,
71  getDefaultLogger("CentralBarrelBuilder", layerLLevel));
72  // create the volume for the beam pipe
74  cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
75  cvbConfig.volumeName = "BeamPipe";
76  cvbConfig.layerBuilder = layerBuilder;
77  cvbConfig.layerEnvelopeR = {1_mm, 1_mm};
78  cvbConfig.buildToRadiusZero = true;
79  cvbConfig.volumeSignature = 0;
80  auto centralVolumeBuilder = std::make_shared<const CylinderVolumeBuilder>(
81  cvbConfig, getDefaultLogger("CentralVolumeBuilder", volumeLLevel));
82 
83  // create the bounds and the volume
84  auto centralVolumeBounds =
85  std::make_shared<const CylinderVolumeBounds>(0., 40., 110.);
86 
87  GeometryContext gCtx;
88  auto centralVolume =
89  centralVolumeBuilder->trackingVolume(gCtx, nullptr, centralVolumeBounds);
90 
91  return std::make_shared<const TrackingGeometry>(centralVolume);
92 }
93 
94 std::shared_ptr<const TrackingGeometry> tGeometry = trackingGeometry();
95 
96 namespace Test {
97 
99 BOOST_AUTO_TEST_CASE(SurfaceMaterialMapper_tests) {
101  Navigator navigator(tGeometry);
104  std::move(stepper), std::move(navigator));
105 
108  SurfaceMaterialMapper smMapper(smmConfig, std::move(propagator));
109 
111  GeometryContext gCtx;
112  MagneticFieldContext mfCtx;
113 
115  auto mState = smMapper.createState(gCtx, mfCtx, *tGeometry);
116 
118  BOOST_CHECK_EQUAL(mState.accumulatedMaterial.size(), 3u);
119 }
120 
121 } // namespace Test
122 
123 } // namespace Acts