9 #include <boost/test/unit_test.hpp>
28 #include <nlohmann/json.hpp>
43 bool nameEq = (one.
name == two.
name);
48 BOOST_CHECK(extentEq);
51 bool internalValueEq = (one.
internal.has_value() == two.
internal.has_value());
52 BOOST_CHECK(internalValueEq);
53 bool internalEq = internalValueEq;
56 const auto& itsOne = one.
internal.value();
57 const auto& itsTwo = two.
internal.value();
58 bool layerTypeEq = (itsOne.layerType == itsTwo.layerType);
59 BOOST_CHECK(layerTypeEq);
60 internalEq = layerTypeEq;
62 (itsOne.surfaceBinning.size() == itsTwo.surfaceBinning.size());
63 BOOST_CHECK(sBinningSizeEq);
64 internalEq = internalEq and sBinningSizeEq;
67 BOOST_CHECK(sBinningEq);
68 internalEq = internalEq and sBinningEq;
71 BOOST_CHECK(internalEq);
74 bool containerValueEq =
76 BOOST_CHECK(containerValueEq);
77 bool containerEq = containerValueEq;
80 const auto& ctsOne = one.
container.value();
81 const auto& ctsTwo = two.
container.value();
82 bool layerContainerEq = (ctsOne.layerContainer == ctsTwo.layerContainer);
83 BOOST_CHECK(layerContainerEq);
84 containerEq = layerContainerEq;
86 ctsOne.constituentBinning.size() == ctsTwo.constituentBinning.size();
87 containerEq = containerEq and cBinningSizeEq;
88 BOOST_CHECK(cBinningSizeEq);
91 BOOST_CHECK(cBinningEq);
92 containerEq = containerEq and cBinningEq;
96 (ctsOne.constituentVolumes.size() == ctsTwo.constituentVolumes.size());
98 containerEq = cSizeEq;
100 const auto& cTwo = ctsTwo.constituentVolumes[ic];
103 containerEq = containerEq and cEq;
106 BOOST_CHECK(containerEq);
109 return nameEq and extentEq and internalEq and containerEq;
114 BOOST_AUTO_TEST_SUITE(ProtoDetectorJsonConverter)
127 beamPipeContainer.
name =
"odd-beam-pipe";
130 beamPipe.
name =
"odd-beam-pipe-l";
133 Acts::Surface::SurfaceType::Cylinder};
139 pixelContainer.
name =
"odd-pixel";
140 pixelContainer.extent.set(
Acts::binR, 25., 200);
143 pixelNec.
name =
"odd-pixel-nec";
147 pixNecD6.
name =
"odd-pixel-nec-d6";
150 pixNecD5.
name =
"odd-pixel-nec-d5";
153 pixNecD4.
name =
"odd-pixel-nec-d4";
156 pixNecD3.
name =
"odd-pixel-nec-d3";
159 pixNecD2.
name =
"odd-pixel-nec-d2";
162 pixNecD1.
name =
"odd-pixel-nec-d1";
165 pixNecD0.
name =
"odd-pixel-nec-d0";
168 {pixNecD6, pixNecD5, pixNecD4, pixNecD3, pixNecD2, pixNecD1, pixNecD0},
177 for (
auto& cv : pixelNec.
container.value().constituentVolumes) {
178 cv.extent.setEnvelope(discLayerEnvelope);
180 Acts::Surface::SurfaceType::Disc, {pixEcBinningR, pixEcBinningPhi}};
184 pixelBarrel.
name =
"odd-pixel-barrel";
188 pixBarrelL0.
name =
"odd-pixel-barrel-l0";
192 pixBarrelL1.
name =
"odd-pixel-barrel-l1";
196 pixBarrelL2.
name =
"odd-pixel-barrel-l2";
200 pixBarrelL3.
name =
"odd-pixel-barrel-l3";
205 {pixBarrelL0, pixBarrelL1, pixBarrelL2, pixBarrelL3},
209 for (
auto& cv : pixelBarrel.
container.value().constituentVolumes) {
210 cv.extent.setEnvelope(cylinderLayerEnvelope);
212 Acts::Surface::SurfaceType::Cylinder};
216 pixelPec.
name =
"odd-pixel-pec";
220 pixPecD0.
name =
"odd-pixel-pec-d0";
223 pixPecD1.
name =
"odd-pixel-pec-d1";
226 pixPecD2.
name =
"odd-pixel-pec-d2";
229 pixPecD3.
name =
"odd-pixel-pec-d3";
232 pixPecD4.
name =
"odd-pixel-pec-d4";
235 pixPecD5.
name =
"odd-pixel-pec-d5";
238 pixPecD6.
name =
"odd-pixel-pec-d6";
242 {pixPecD0, pixPecD1, pixPecD2, pixPecD3, pixPecD4, pixPecD5, pixPecD6},
246 for (
auto& cv : pixelPec.
container.value().constituentVolumes) {
247 cv.extent.setEnvelope(discLayerEnvelope);
249 Acts::Surface::SurfaceType::Disc, {pixEcBinningR, pixEcBinningPhi}};
253 {pixelNec, pixelBarrel, pixelPec},
255 {-3100., -580., 580., 3100.})}};
259 pstContainer.
name =
"odd-pst";
260 pstContainer.extent.set(
Acts::binR, 200., 210.);
262 pst.
name =
"odd-pst-l";
265 Acts::Surface::SurfaceType::Cylinder};
271 sstripContainer.
name =
"odd-sstrip";
272 sstripContainer.extent.set(
Acts::binR, 210., 720);
280 sstripNec.
name =
"odd-sstrip-nec";
283 sstripNecD5.
name =
"odd-sstrip-nec-d5";
286 sstripNecD4.
name =
"odd-sstrip-nec-d4";
289 sstripNecD3.
name =
"odd-sstrip-nec-d3";
292 sstripNecD2.
name =
"odd-sstrip-nec-d2";
295 sstripNecD1.
name =
"odd-sstrip-nec-d1";
298 sstripNecD0.
name =
"odd-sstrip-nec-d0";
302 {sstripNecD5, sstripNecD4, sstripNecD3, sstripNecD2, sstripNecD1,
307 for (
auto& cv : sstripNec.
container.value().constituentVolumes) {
308 cv.extent.setEnvelope(discLayerEnvelope);
310 Acts::Surface::SurfaceType::Disc,
311 {sstripEcBinningR, sstripEcBinningPhi}};
315 sstripBarrel.
name =
"odd-sstrip-barrel";
319 sstripBarrelL0.
name =
"odd-sstrip-barrel-l0";
322 sstripBarrelL1.
name =
"odd-sstrip-barrel-l1";
325 sstripBarrelL2.
name =
"odd-sstrip-barrel-l2";
328 sstripBarrelL3.
name =
"odd-sstrip-barrel-l3";
332 {sstripBarrelL0, sstripBarrelL1, sstripBarrelL2, sstripBarrelL3},
336 for (
auto& cv : sstripBarrel.
container.value().constituentVolumes) {
337 cv.extent.setEnvelope(cylinderLayerEnvelope);
339 Acts::Surface::SurfaceType::Cylinder};
343 sstripPec.
name =
"odd-sstrip-pec";
347 sstripPecD0.
name =
"odd-sstrip-pec-d0";
350 sstripPecD1.
name =
"odd-sstrip-pec-d1";
353 sstripPecD2.
name =
"odd-sstrip-pec-d2";
356 sstripPecD3.
name =
"odd-sstrip-pec-d3";
359 sstripPecD4.
name =
"odd-sstrip-pec-d4";
362 sstripPecD5.
name =
"odd-sstrip-pec-d5";
366 {sstripPecD0, sstripPecD1, sstripPecD2, sstripPecD3, sstripPecD4,
370 for (
auto& cv : sstripPec.
container.value().constituentVolumes) {
371 cv.extent.setEnvelope(discLayerEnvelope);
373 Acts::Surface::SurfaceType::Disc,
374 {sstripEcBinningR, sstripEcBinningPhi}};
378 {sstripNec, sstripBarrel, sstripPec},
380 {-3100., -1200., 1200., 3100.})}};
384 lstripContainer.
name =
"odd-lstrip";
385 lstripContainer.extent.set(
Acts::binR, 720, 1100.);
388 lstripNec.
name =
"odd-lstrip-nec";
391 lstripNecD5.
name =
"odd-lstrip-nec-d5";
394 lstripNecD4.
name =
"odd-lstrip-nec-d4";
397 lstripNecD3.
name =
"odd-lstrip-nec-d3";
400 lstripNecD2.
name =
"odd-lstrip-nec-d2";
403 lstripNecD1.
name =
"odd-lstrip-nec-d1";
406 lstripNecD0.
name =
"odd-lstrip-nec-d0";
410 {lstripNecD5, lstripNecD4, lstripNecD3, lstripNecD2, lstripNecD1,
415 for (
auto& cv : lstripNec.
container.value().constituentVolumes) {
416 cv.extent.setEnvelope(discLayerEnvelope);
422 lstripBarrel.
name =
"odd-lstrip-barrel";
426 lstripBarrelL0.
name =
"odd-lstrip-barrel-l0";
429 lstripBarrelL1.
name =
"odd-lstrip-barrel-l1";
433 {lstripBarrelL0, lstripBarrelL1},
437 for (
auto& cv : lstripBarrel.
container.value().constituentVolumes) {
438 cv.extent.setEnvelope(cylinderLayerEnvelope);
440 Acts::Surface::SurfaceType::Cylinder};
444 lstripPec.
name =
"odd-lstrip-pec";
448 lstripPecD0.
name =
"odd-lstrip-pec-d0";
451 lstripPecD1.
name =
"odd-lstrip-pec-d1";
454 lstripPecD2.
name =
"odd-lstrip-pec-d2";
457 lstripPecD3.
name =
"odd-lstrip-pec-d3";
460 lstripPecD4.
name =
"odd-lstrip-pec-d4";
463 lstripPecD5.
name =
"odd-lstrip-pec-d5";
467 {lstripPecD0, lstripPecD1, lstripPecD2, lstripPecD3, lstripPecD4,
471 for (
auto& cv : lstripPec.
container.value().constituentVolumes) {
474 cv.extent.setEnvelope(discLayerEnvelope);
477 {lstripNec, lstripBarrel, lstripPec},
479 {-3100., -1200., 1200., 3100.})}};
483 detectorContainer.
name =
"odd-light-world";
484 detectorContainer.extent.set(
Acts::binR, 0., 1100.);
485 detectorContainer.extent.set(
Acts::binZ, -3100., 3100.);
487 {beamPipeContainer, pixelContainer, pstContainer, sstripContainer,
490 {0., 25., 200., 210., 720., 1100.})}};
494 detector.name =
"odd-light";
495 detector.worldVolume = detectorContainer;
502 out.open(
"odd-proto-detector.json");
509 BOOST_CHECK(detector.name == detectorIn.
name);
511 const auto& world = detector.worldVolume;
514 BOOST_CHECK(
isEqual(world, worldIn, 0.1));
517 BOOST_AUTO_TEST_SUITE_END()