9 #include <boost/test/unit_test.hpp>
34 using namespace Acts::UnitLiterals;
47 std::vector<TrackingVolume const*>
volume;
52 template <
typename propagator_state_t,
typename stepper_t>
53 void operator()(propagator_state_t& state,
const stepper_t&
stepper,
55 result.
position.push_back(stepper.position(state.stepping));
56 result.
volume.push_back(state.navigation.currentVolume);
68 std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig;
69 for (
unsigned int i = 1; i < 5; i++) {
75 double rotationAngle =
M_PI * 0.5;
76 Vector3D xPos(cos(rotationAngle), 0., sin(rotationAngle));
78 Vector3D zPos(-sin(rotationAngle), 0., cos(rotationAngle));
89 cfg.
surMat = std::make_shared<HomogeneousSurfaceMaterial>(matProp);
95 [](std::shared_ptr<const Transform3D> trans,
96 std::shared_ptr<const RectangleBounds> bounds,
double thickness) {
99 surfaceConfig.push_back(cfg);
103 BOOST_CHECK_EQUAL(surfaceConfig.size(), 4
u);
106 for (
const auto& cfg : surfaceConfig) {
107 std::shared_ptr<const PlaneSurface> pSur = cvb.
buildSurface(tgContext, cfg);
108 BOOST_CHECK_NE(pSur,
nullptr);
110 BOOST_CHECK_NE(pSur->surfaceMaterial(),
nullptr);
111 BOOST_CHECK_NE(pSur->associatedDetectorElement(),
nullptr);
116 std::vector<CuboidVolumeBuilder::LayerConfig> layerConfig;
117 for (
auto& sCfg : surfaceConfig) {
120 layerConfig.push_back(cfg);
124 BOOST_CHECK_EQUAL(layerConfig.size(), 4
u);
127 for (
auto& cfg : layerConfig) {
129 BOOST_CHECK_NE(layer,
nullptr);
130 BOOST_CHECK_NE(cfg.surface,
nullptr);
131 BOOST_CHECK_EQUAL(layer->surfaceArray()->surfaces().size(), 1
u);
135 for (
auto& cfg : layerConfig) {
136 cfg.surface =
nullptr;
141 volumeConfig.
position = {2.5_m, 0., 0.};
143 volumeConfig.
layerCfg = layerConfig;
144 volumeConfig.
name =
"Test volume";
146 std::make_shared<HomogeneousVolumeMaterial>(
makeBeryllium());
149 std::shared_ptr<TrackingVolume> trVol =
151 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
152 BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(),
153 volumeConfig.
layers.size() * 2 +
155 BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.
name);
156 BOOST_CHECK_NE(trVol->volumeMaterial(),
nullptr);
159 volumeConfig.
layers.clear();
161 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
162 BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(),
163 volumeConfig.
layers.size() * 2 +
165 BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.
name);
167 volumeConfig.
layers.clear();
168 for (
auto& lay : volumeConfig.
layerCfg) {
169 lay.surface =
nullptr;
173 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
174 for (
auto& lay : volumeConfig.
layers) {
178 volumeConfig.
layers.clear();
179 for (
auto& lay : volumeConfig.
layerCfg) {
183 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
184 for (
auto& lay : volumeConfig.
layers) {
192 std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig2;
193 for (
int i = 1; i < 5; i++) {
199 double rotationAngle =
M_PI * 0.5;
200 Vector3D xPos(cos(rotationAngle), 0., sin(rotationAngle));
202 Vector3D zPos(-sin(rotationAngle), 0., cos(rotationAngle));
213 cfg.
surMat = std::make_shared<HomogeneousSurfaceMaterial>(matProp);
217 surfaceConfig2.push_back(cfg);
220 std::vector<CuboidVolumeBuilder::LayerConfig> layerConfig2;
221 for (
auto& sCfg : surfaceConfig2) {
224 layerConfig2.push_back(cfg);
227 volumeConfig2.
position = {-2.5_m, 0., 0.};
229 volumeConfig2.
layerCfg = layerConfig2;
230 volumeConfig2.
name =
"Test volume2";
235 config.
volumeCfg = {volumeConfig2, volumeConfig};
240 [=](
const auto&
context,
const auto& inner,
const auto&) {
245 std::unique_ptr<const TrackingGeometry>
detector =
248 detector->lowestTrackingVolume(tgContext,
Vector3D(1., 0., 0.))
252 detector->lowestTrackingVolume(tgContext,
Vector3D(-1., 0., 0.))