12 #include "DD4hep/DetFactoryHelper.h"
15 using namespace dd4hep;
18 xml_det_t x_det = xml;
19 string detName = x_det.nameStr();
22 DetElement CaloBarrel(detName, x_det.id());
26 barrelExtension->addType(
"barrel",
"detector");
30 dd4hep::xml::Dimension x_det_dim(x_det.dimensions());
31 Tube barrelShape(x_det_dim.rmin(), x_det_dim.rmax(), x_det_dim.dz());
32 Volume barrelVolume(detName, barrelShape, oddd.air());
33 barrelVolume.setVisAttributes(oddd, x_det.visStr());
38 for (xml_coll_t tubIt(x_det, _U(tubs)); tubIt; ++tubIt) {
39 xml_comp_t VolDet = tubIt;
40 dd4hep::Tube VolShape(VolDet.rmin(), VolDet.rmax(), VolDet.dz());
41 std::string VolName = dd4hep::xml::_toString(VolDet.nameStr());
42 dd4hep::Volume Volume(VolName, VolShape,
43 oddd.material(VolDet.materialStr()));
45 dd4hep::DetElement vol_det(CaloBarrel, VolName, VolIdx);
47 if (VolDet.hasAttr(_U(vis))) {
48 Volume.setVisAttributes(oddd, VolDet.visStr());
53 detVolume->
addType(
"passive cylinder",
"volume");
57 dd4hep::Position transvol(0., 0., 0.);
58 dd4hep::PlacedVolume placedVolume =
59 barrelVolume.placeVolume(Volume, transvol);
61 placedVolume.addPhysVolID(VolName, VolIdx);
62 vol_det.setPlacement(placedVolume);
67 Volume motherVolume = oddd.pickMotherVolume(CaloBarrel);
68 PlacedVolume placedTube = motherVolume.placeVolume(barrelVolume);
69 placedTube.addPhysVolID(detName, CaloBarrel.id());
70 CaloBarrel.setPlacement(placedTube);