9 #include <boost/test/unit_test.hpp>
21 #include <DD4hep/DetElement.h>
22 #include <DD4hep/DetFactoryHelper.h>
23 #include <DD4hep/Detector.h>
24 #include <XML/Utilities.h>
34 R
""""(
<detectors>
<detector id="0" name="BeamPipe" type="BarrelDetector">
<type_flags type="DetType_TRACKER + DetType_BEAMPIPE"/>
<layers>
<layer name="BP" id="0">
)"""";
37 R
""""(
<detectors>
<detector id="1" name="BarrelLayer" type="BarrelDetector" readout="PixelReadout">
<type_flags type="DetType_TRACKER + DetType_BARREL"/>
<layers>
<layer name="B0" id="0">
)"""";
40 R
""""(
</layer>
</layers>
</detector>
</detectors>
)"""";
44 BOOST_AUTO_TEST_SUITE(DD4hepPlugin)
53 cxml.open(fNameBase +
".xml");
58 <<
" <tubs rmin=\"25*mm\" rmax=\"25.8*mm\" dz=\"1800*mm\" "
61 cxml << indent_12_xml <<
" </acts_passive_surface>" <<
'\n';
67 auto lcdd = &(dd4hep::Detector::getInstance());
68 lcdd->fromCompact(fNameBase +
".xml");
69 lcdd->volumeManager();
70 lcdd->apply(
"DD4hepVolumeManager", 0,
nullptr);
72 auto world = lcdd->world();
75 auto sFactory = std::make_shared<Acts::DD4hepDetectorSurfaceFactory>(
86 lsOptions.
name =
"BeamPipe";
89 auto beamPipeInternalsBuilder =
90 beamPipeStructure.builder(dd4hepStore, world, lsOptions);
93 auto [surfaces,
volumes, surfacesUpdator, volumeUpdator] =
94 beamPipeInternalsBuilder->construct(tContext);
97 BOOST_CHECK(surfaces.size() == 1
u);
99 BOOST_CHECK(volumes.empty());
101 BOOST_CHECK(surfacesUpdator.connected());
103 BOOST_CHECK(volumeUpdator.connected());
106 lcdd->destroyInstance();
123 116., 3., 2., {52, 14});
129 std::vector<std::array<unsigned int, 4u> > zphiBinning = {
130 {1
u, 1
u, 0
u, 0u}, {14
u, 52
u, 1
u, 1u}, {28
u, 104
u, 0
u, 0u}};
133 for (
auto [
nz,
nphi, ez,
ephi] : zphiBinning) {
139 fNameBase +=
"_nphi";
142 cxml.open(fNameBase +
".xml");
149 cxml <<
" ztype=\"equidistant\"";
150 cxml <<
" phitype=\"equidistant\"";
151 cxml <<
" nz=\"" <<
nz <<
"\" zmin=\"-500*mm\" zmax=\"500*mm\"";
152 cxml <<
" zexpansion= \"" << ez <<
"\"";
153 cxml <<
" nphi=\"" <<
nphi <<
"\" phimin=\"-3.1415\" phimax=\"3.1415\"";
154 cxml <<
" phiexpansion= \"" <<
ephi <<
"\"/>";
156 cxml <<
"<modules>" <<
'\n';
158 for (
const auto&
s : cSurfaces) {
161 Acts::Transform3::Identity())
165 cxml <<
"</modules>" <<
'\n';
168 unsigned int passiveAddon = 0
u;
171 cxml << indent_12_xml
172 <<
" <tubs rmin=\"122*mm\" rmax=\"124*mm\" dz=\"500*mm\" "
175 cxml << indent_12_xml <<
" </acts_passive_surface>" <<
'\n';
177 }
else if (itest == 2
u) {
179 cxml << indent_12_xml
180 <<
" <tubs rmin=\"122*mm\" rmax=\"124*mm\" dz=\"500*mm\" "
183 cxml <<
" <acts_proto_material/>" <<
'\n';
184 cxml << indent_12_xml <<
" </acts_passive_surface>" <<
'\n';
193 auto lcdd = &(dd4hep::Detector::getInstance());
194 lcdd->fromCompact(fNameBase +
".xml");
195 lcdd->volumeManager();
196 lcdd->apply(
"DD4hepVolumeManager", 0,
nullptr);
198 auto world = lcdd->world();
201 auto sFactory = std::make_shared<Acts::DD4hepDetectorSurfaceFactory>(
212 lsOptions.
name =
"BarrelLayer";
215 auto barrelInternalsBuilder =
216 barrelStructure.builder(dd4hepStore, world, lsOptions);
219 auto [surfaces,
volumes, surfacesUpdator, volumeUpdator] =
220 barrelInternalsBuilder->construct(tContext);
223 BOOST_CHECK(surfaces.size() == 14
u * 52
u + passiveAddon);
225 BOOST_CHECK(volumes.empty());
227 BOOST_CHECK(surfacesUpdator.connected());
229 BOOST_CHECK(volumeUpdator.connected());
232 lcdd->destroyInstance();
236 BOOST_AUTO_TEST_SUITE_END()