9 #include <boost/test/unit_test.hpp>
32 using namespace Acts::UnitLiterals;
45 std::vector<TrackingVolume const*>
volume;
50 template <
typename propagator_state_t,
typename stepper_t>
51 void operator()(propagator_state_t& state,
const stepper_t&
stepper,
53 result.
position.push_back(stepper.position(state.stepping));
54 result.
volume.push_back(state.navigation.currentVolume);
66 std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig;
67 for (
unsigned int i = 1; i < 5; i++) {
73 double rotationAngle =
M_PI * 0.5;
74 Vector3D xPos(
cos(rotationAngle), 0., sin(rotationAngle));
76 Vector3D zPos(-sin(rotationAngle), 0.,
cos(rotationAngle));
87 cfg.
surMat = std::make_shared<HomogeneousSurfaceMaterial>(matProp);
94 std::shared_ptr<const RectangleBounds> bounds,
double thickness) {
97 surfaceConfig.push_back(cfg);
101 BOOST_CHECK_EQUAL(surfaceConfig.size(), 4
u);
104 for (
const auto& cfg : surfaceConfig) {
105 std::shared_ptr<const PlaneSurface> pSur = cvb.
buildSurface(tgContext, cfg);
106 BOOST_CHECK_NE(pSur,
nullptr);
108 BOOST_CHECK_NE(pSur->surfaceMaterial(),
nullptr);
109 BOOST_CHECK_NE(pSur->associatedDetectorElement(),
nullptr);
114 std::vector<CuboidVolumeBuilder::LayerConfig> layerConfig;
115 for (
auto& sCfg : surfaceConfig) {
118 layerConfig.push_back(cfg);
122 BOOST_CHECK_EQUAL(layerConfig.size(), 4
u);
125 for (
auto& cfg : layerConfig) {
127 BOOST_CHECK_NE(layer,
nullptr);
128 BOOST_CHECK_NE(cfg.surface,
nullptr);
129 BOOST_CHECK_EQUAL(layer->surfaceArray()->surfaces().size(), 1
u);
133 for (
auto& cfg : layerConfig) {
134 cfg.surface =
nullptr;
139 volumeConfig.
position = {2.5_m, 0., 0.};
140 volumeConfig.
length = {5_m, 1_m, 1_m};
141 volumeConfig.
layerCfg = layerConfig;
142 volumeConfig.
name =
"Test volume";
144 std::make_shared<HomogeneousVolumeMaterial>(
makeBeryllium());
147 std::shared_ptr<TrackingVolume> trVol =
149 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
150 BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(),
151 volumeConfig.
layers.size() * 2 +
153 BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.
name);
154 BOOST_CHECK_NE(trVol->volumeMaterial(),
nullptr);
157 volumeConfig.
layers.clear();
159 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
160 BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(),
161 volumeConfig.
layers.size() * 2 +
163 BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.
name);
165 volumeConfig.
layers.clear();
166 for (
auto& lay : volumeConfig.
layerCfg) {
167 lay.surface =
nullptr;
171 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
172 for (
auto& lay : volumeConfig.
layers) {
176 volumeConfig.
layers.clear();
177 for (
auto& lay : volumeConfig.
layerCfg) {
181 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
182 for (
auto& lay : volumeConfig.
layers) {
190 std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig2;
191 for (
int i = 1; i < 5; i++) {
197 double rotationAngle =
M_PI * 0.5;
198 Vector3D xPos(
cos(rotationAngle), 0., sin(rotationAngle));
200 Vector3D zPos(-sin(rotationAngle), 0.,
cos(rotationAngle));
207 std::make_shared<const RectangleBounds>(
RectangleBounds(0.5_m, 0.5_m));
211 cfg.
surMat = std::make_shared<HomogeneousSurfaceMaterial>(matProp);
215 surfaceConfig2.push_back(cfg);
218 std::vector<CuboidVolumeBuilder::LayerConfig> layerConfig2;
219 for (
auto& sCfg : surfaceConfig2) {
222 layerConfig2.push_back(cfg);
225 volumeConfig2.
position = {-2.5_m, 0., 0.};
226 volumeConfig2.
length = {5_m, 1_m, 1_m};
227 volumeConfig2.
layerCfg = layerConfig2;
228 volumeConfig2.
name =
"Test volume2";
232 config.
length = {10_m, 1_m, 1_m};
233 config.
volumeCfg = {volumeConfig2, volumeConfig};
238 [=](
const auto& context,
const auto& inner,
const auto&) {
243 std::unique_ptr<const TrackingGeometry>
detector =
246 detector->lowestTrackingVolume(tgContext,
Vector3D(1., 0., 0.))
250 detector->lowestTrackingVolume(tgContext,
Vector3D(-1., 0., 0.))