9 #include <boost/test/unit_test.hpp>
25 #include <unordered_map>
30 using namespace Acts::UnitLiterals;
49 double surfaceHalfLengthZ = 50_mm;
50 double surfaceRstagger = 5_mm;
51 double surfaceZoverlap = 10_mm;
52 double layerEnvelope = 0.5_mm;
53 double volumeEnvelope = 10_mm;
56 double iiv_surfaceR = 25_mm;
58 iiv_surfaceR + 0.5 * surfaceRstagger + layerEnvelope + volumeEnvelope;
61 double iov_surfaceR = 100_mm;
63 iov_surfaceR + 0.5 * surfaceRstagger + layerEnvelope + volumeEnvelope;
67 tgContext, surfaceHalfLengthZ, iiv_surfaceR, surfaceRstagger,
68 surfaceZoverlap, layerEnvelope, volumeEnvelope, 0., iiv_volumeR,
72 tgContext, surfaceHalfLengthZ, iov_surfaceR, surfaceRstagger,
73 surfaceZoverlap, layerEnvelope, volumeEnvelope, iiv_volumeR, iov_volumeR,
78 (4 * surfaceHalfLengthZ - surfaceZoverlap) + volumeEnvelope;
81 tgContext, iiVolume, ioVolume, iov_volumeR, volumeHalfZ,
"InnerVolume");
84 double ov_surfaceR = 150_mm;
86 ov_surfaceR + 0.5 * surfaceRstagger + layerEnvelope + volumeEnvelope;
90 tgContext, surfaceHalfLengthZ, ov_surfaceR, surfaceRstagger,
91 surfaceZoverlap, layerEnvelope, volumeEnvelope, iov_volumeR, ov_volumeR,
119 BOOST_CHECK_EQUAL(geoid, bs_vol_id);
121 auto bs_bsf_id = bSf->surfaceRepresentation().geometryId().boundary();
122 auto bs_ext_id = bSf->surfaceRepresentation().geometryId().extra();
123 BOOST_CHECK_EQUAL(++bsurface_id, bs_bsf_id);
124 BOOST_CHECK_EQUAL(bs_ext_id, 0);
132 auto lay_vol_id = lay->geometryId().volume();
133 auto lay_lay_id = lay->geometryId().layer();
134 BOOST_CHECK_EQUAL(++layer_id, lay_lay_id);
135 BOOST_CHECK_EQUAL(geoid, lay_vol_id);
137 if (lay->approachDescriptor() !=
nullptr) {
140 for (
const auto& asf :
141 lay->approachDescriptor()->containedSurfaces()) {
143 auto asf_vol_id = asf->geometryId().volume();
144 auto asf_lay_id = asf->geometryId().layer();
145 auto asf_asf_id = asf->geometryId().approach();
146 auto ssf_ext_id = asf->geometryId().extra();
147 BOOST_CHECK_EQUAL(layer_id, asf_lay_id);
148 BOOST_CHECK_EQUAL(geoid, asf_vol_id);
149 BOOST_CHECK_EQUAL(++asurface_id, asf_asf_id);
150 BOOST_CHECK_EQUAL(0, ssf_ext_id);
154 if (lay->surfaceArray() !=
nullptr) {
157 for (
const auto& ssf : lay->surfaceArray()->surfaces()) {
159 auto ssf_vol_id = ssf->geometryId().volume();
160 auto ssf_lay_id = ssf->geometryId().layer();
161 auto ssf_ssf_id = ssf->geometryId().sensitive();
162 auto ssf_ext_id = ssf->geometryId().extra();
163 BOOST_CHECK_EQUAL(layer_id, ssf_lay_id);
164 BOOST_CHECK_EQUAL(geoid, ssf_vol_id);
165 BOOST_CHECK_EQUAL(++ssurface_id, ssf_ssf_id);
166 BOOST_CHECK_EQUAL(0, ssf_ext_id);
174 auto ioVolumes = world->confinedVolumes()->arrayObjects();
176 BOOST_CHECK_EQUAL(2ul, ioVolumes.size());
178 auto iioVolumes = ioVolumes[0]->confinedVolumes()->arrayObjects();
180 BOOST_CHECK_EQUAL(2ul, iioVolumes.size());
183 check_vol(*world, 1);
185 check_vol(*ioVolumes[0], 2);
187 check_vol(*iioVolumes[0], 3);
189 check_vol(*iioVolumes[1], 4);
191 check_vol(*ioVolumes[1], 5);
194 template <
typename Callable>
203 return callable(identifier, surface);
209 std::unordered_map<const Surface*, size_t> extraMap;
212 extraMap[&srf] = extra;
232 BOOST_CHECK_EQUAL(geoid, bs_vol_id);
234 auto bs_bsf_id = bSf->surfaceRepresentation().geometryId().boundary();
235 auto bs_ext_id = bSf->surfaceRepresentation().geometryId().extra();
236 BOOST_CHECK_EQUAL(++bsurface_id, bs_bsf_id);
237 BOOST_CHECK_EQUAL(bs_ext_id, 0);
245 auto lay_vol_id = lay->geometryId().volume();
246 auto lay_lay_id = lay->geometryId().layer();
247 BOOST_CHECK_EQUAL(++layer_id, lay_lay_id);
248 BOOST_CHECK_EQUAL(geoid, lay_vol_id);
250 if (lay->approachDescriptor() !=
nullptr) {
253 for (
const auto& asf :
254 lay->approachDescriptor()->containedSurfaces()) {
256 auto asf_vol_id = asf->geometryId().volume();
257 auto asf_lay_id = asf->geometryId().layer();
258 auto asf_asf_id = asf->geometryId().approach();
259 auto ssf_ext_id = asf->geometryId().extra();
260 BOOST_CHECK_EQUAL(layer_id, asf_lay_id);
261 BOOST_CHECK_EQUAL(geoid, asf_vol_id);
262 BOOST_CHECK_EQUAL(++asurface_id, asf_asf_id);
263 BOOST_CHECK_EQUAL(0, ssf_ext_id);
267 if (lay->surfaceArray() !=
nullptr) {
270 for (
const auto& ssf : lay->surfaceArray()->surfaces()) {
272 auto ssf_vol_id = ssf->geometryId().volume();
273 auto ssf_lay_id = ssf->geometryId().layer();
274 auto ssf_ssf_id = ssf->geometryId().sensitive();
275 auto ssf_ext_id = ssf->geometryId().extra();
276 BOOST_CHECK_EQUAL(layer_id, ssf_lay_id);
277 BOOST_CHECK_EQUAL(geoid, ssf_vol_id);
278 BOOST_CHECK_EQUAL(++ssurface_id, ssf_ssf_id);
279 BOOST_CHECK_EQUAL(extraMap[ssf], ssf_ext_id);
287 auto ioVolumes = world->confinedVolumes()->arrayObjects();
289 BOOST_CHECK_EQUAL(2ul, ioVolumes.size());
291 auto iioVolumes = ioVolumes[0]->confinedVolumes()->arrayObjects();
293 BOOST_CHECK_EQUAL(2ul, iioVolumes.size());
296 check_vol(*world, 1);
298 check_vol(*ioVolumes[0], 2);
300 check_vol(*iioVolumes[0], 3);
302 check_vol(*iioVolumes[1], 4);
304 check_vol(*ioVolumes[1], 5);
314 size_t nSurfaces = 0;
315 tGeometry.
visitSurfaces([&nSurfaces](
const auto*) { nSurfaces++; });
317 BOOST_CHECK_EQUAL(nSurfaces, 9
u);