9 #include <boost/test/unit_test.hpp>
36 using namespace Acts::UnitLiterals;
49 std::vector<TrackingVolume const*>
volume;
54 template <
typename propagator_state_t,
typename stepper_t,
56 void operator()(propagator_state_t&
state,
const stepper_t&
stepper,
58 result.
position.push_back(stepper.position(state.stepping));
59 result.
volume.push_back(navigator.currentVolume(state.navigation));
71 std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig;
72 for (
unsigned int i = 1;
i < 5;
i++) {
78 double rotationAngle = M_PI * 0.5;
79 Vector3 xPos(cos(rotationAngle), 0., sin(rotationAngle));
81 Vector3 zPos(-sin(rotationAngle), 0., cos(rotationAngle));
92 cfg.
surMat = std::make_shared<HomogeneousSurfaceMaterial>(matProp);
99 const std::shared_ptr<const RectangleBounds>&
bounds,
103 surfaceConfig.push_back(cfg);
107 BOOST_CHECK_EQUAL(surfaceConfig.size(), 4
u);
110 for (
const auto&
cfg : surfaceConfig) {
111 std::shared_ptr<const Surface> pSur = cvb.
buildSurface(tgContext,
cfg);
112 BOOST_CHECK_NE(pSur,
nullptr);
114 BOOST_CHECK_NE(pSur->surfaceMaterial(),
nullptr);
115 BOOST_CHECK_NE(pSur->associatedDetectorElement(),
nullptr);
120 std::vector<CuboidVolumeBuilder::LayerConfig> layerConfig;
121 for (
auto& sCfg : surfaceConfig) {
124 layerConfig.push_back(cfg);
128 BOOST_CHECK_EQUAL(layerConfig.size(), 4
u);
131 for (
auto&
cfg : layerConfig) {
133 BOOST_CHECK_NE(layer,
nullptr);
134 BOOST_CHECK(!
cfg.surfaces.empty());
135 BOOST_CHECK_EQUAL(layer->surfaceArray()->surfaces().size(), 1
u);
139 for (
auto&
cfg : layerConfig) {
145 volumeConfig.
position = {2.5_m, 0., 0.};
146 volumeConfig.
length = {5_m, 1_m, 1_m};
147 volumeConfig.
layerCfg = layerConfig;
148 volumeConfig.
name =
"Test volume";
150 std::make_shared<HomogeneousVolumeMaterial>(
makeBeryllium());
153 std::shared_ptr<TrackingVolume> trVol =
155 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
156 BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(),
157 volumeConfig.
layers.size() * 2 +
159 BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.
name);
160 BOOST_CHECK_NE(trVol->volumeMaterial(),
nullptr);
163 volumeConfig.
layers.clear();
165 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
166 BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(),
167 volumeConfig.
layers.size() * 2 +
169 BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.
name);
171 volumeConfig.
layers.clear();
172 for (
auto& lay : volumeConfig.
layerCfg) {
177 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
178 for (
auto& lay : volumeConfig.
layers) {
182 volumeConfig.
layers.clear();
183 for (
auto& lay : volumeConfig.
layerCfg) {
187 BOOST_CHECK_EQUAL(volumeConfig.
layers.size(), 4
u);
188 for (
auto& lay : volumeConfig.
layers) {
196 std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig2;
197 for (
int i = 1;
i < 5;
i++) {
203 double rotationAngle = M_PI * 0.5;
204 Vector3 xPos(cos(rotationAngle), 0., sin(rotationAngle));
206 Vector3 zPos(-sin(rotationAngle), 0., cos(rotationAngle));
213 std::make_shared<const RectangleBounds>(
RectangleBounds(0.5_m, 0.5_m));
217 cfg.
surMat = std::make_shared<HomogeneousSurfaceMaterial>(matProp);
221 surfaceConfig2.push_back(cfg);
224 std::vector<CuboidVolumeBuilder::LayerConfig> layerConfig2;
225 for (
auto& sCfg : surfaceConfig2) {
228 layerConfig2.push_back(cfg);
231 volumeConfig2.
position = {-2.5_m, 0., 0.};
232 volumeConfig2.
length = {5_m, 1_m, 1_m};
233 volumeConfig2.
layerCfg = layerConfig2;
234 volumeConfig2.
name =
"Test volume2";
238 config.
length = {10_m, 1_m, 1_m};
239 config.
volumeCfg = {volumeConfig2, volumeConfig};
244 [=](
const auto& context,
const auto& inner,
const auto&) {
249 std::unique_ptr<const TrackingGeometry>
detector =
252 detector->lowestTrackingVolume(tgContext,
Vector3(1., 0., 0.))
256 detector->lowestTrackingVolume(tgContext,
Vector3(-1., 0., 0.))