EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TGeoLayerBuilderTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TGeoLayerBuilderTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 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/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
11 
13 #include "Acts/Geometry/Layer.hpp"
20 
21 #include "TGeoManager.h"
22 
23 namespace Acts {
24 
25 namespace Test {
26 
28 struct RootGeometry {
30  auto path = Acts::Test::getDataPath("panda.root");
31  TGeoManager::Import(path.c_str());
32  }
33 };
34 
36 
38 
40 BOOST_AUTO_TEST_CASE(TGeoLayerBuilderTests) {
41  using TglConfig = TGeoLayerBuilder::LayerConfig;
42 
43  TglConfig b0Config;
44  b0Config.volumeName = "*";
45  b0Config.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5",
46  "PixelActiveo6"};
47  b0Config.localAxes = "XYZ";
48  b0Config.parseRanges = {{binR, {0., 40_mm}}, {binZ, {-60_mm, 15_mm}}};
49  b0Config.envelope = {0_mm, 0_mm};
50 
51  TglConfig eAllConfig;
52  eAllConfig.volumeName = "*";
53  eAllConfig.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5",
54  "PixelActiveo6"};
55  eAllConfig.localAxes = "XYZ";
56  eAllConfig.parseRanges = {{binR, {0., 40_mm}}, {binZ, {16_mm, 60_mm}}};
57  eAllConfig.splitConfigs = {{binZ, 5_mm}};
58  eAllConfig.envelope = {0_mm, 0_mm};
59 
60  std::vector<TglConfig> cConfigs = {b0Config};
61  std::vector<TglConfig> pConfigs = {eAllConfig};
62 
63  TGeoLayerBuilder::Config tglbConfig;
64  tglbConfig.configurationName = "Pixels";
65  tglbConfig.layerConfigurations[1] = cConfigs;
66  tglbConfig.layerConfigurations[2] = pConfigs;
67 
68  auto surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(
69  getDefaultLogger("SurfaceArrayCreator", Logging::VERBOSE));
70 
71  LayerCreator::Config lcConfig;
72  lcConfig.surfaceArrayCreator = surfaceArrayCreator;
73  auto layerCreator = std::make_shared<const LayerCreator>(
74  lcConfig, getDefaultLogger("LayerCreator", Logging::VERBOSE));
75  tglbConfig.layerCreator = layerCreator;
76 
77  ProtoLayerHelper::Config plhConfig;
78  auto protoLayerHelper = std::make_shared<const ProtoLayerHelper>(
79  plhConfig, getDefaultLogger("ProtoLayerHelper", Logging::VERBOSE));
80  tglbConfig.protoLayerHelper = protoLayerHelper;
81 
82  TGeoLayerBuilder tglb(tglbConfig,
83  getDefaultLogger("TGeoLayerBuilder", Logging::VERBOSE));
84 
85  ObjVisualization3D objVis;
86 
87  auto centralLayers = tglb.centralLayers(tgContext);
88  BOOST_CHECK_EQUAL(centralLayers.size(), 1u);
89  BOOST_CHECK_EQUAL(tglb.detectorElements().size(), 14u);
90 
91  auto positiveLayers = tglb.positiveLayers(tgContext);
92  // Check that it's split into two layers
93  size_t ipl = 0;
94  BOOST_CHECK_EQUAL(positiveLayers.size(), 2u);
95  BOOST_CHECK_EQUAL(tglb.detectorElements().size(), 14u + 16u);
96  for (const auto& pLayer : positiveLayers) {
97  auto sArray = pLayer->surfaceArray();
98  if (sArray) {
99  for (auto& surface : sArray->surfaces()) {
101  }
102  }
103  objVis.write("PositiveLayer_" + std::to_string(ipl++));
104  objVis.clear();
105  }
106 }
107 
108 } // namespace Test
109 
110 } // namespace Acts