File indexing completed on 2025-01-30 09:17:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "DD4hep/DetFactoryHelper.h"
0016
0017 using namespace std;
0018 using namespace dd4hep;
0019 using namespace dd4hep::detail;
0020
0021 static Ref_t create_element(Detector& description, xml_h e, Ref_t) {
0022 xml_det_t x_det = e;
0023 string name = x_det.nameStr();
0024 xml_comp_t box (x_det.child(_U(box)));
0025 xml_dim_t pos (x_det.child(_U(position)));
0026 xml_dim_t rot (x_det.child(_U(rotation)));
0027 Material mat (description.material(x_det.materialStr()));
0028 DetElement det (name,x_det.id());
0029 Volume det_vol(name+"_vol",Box(box.x(),box.y(),box.z()), mat);
0030 Volume mother = description.pickMotherVolume(det);
0031 Transform3D transform(Rotation3D(RotationZYX(rot.z(),rot.y(),rot.x())),Position(pos.x(),pos.y(),pos.z()));
0032 det_vol.setVisAttributes(description, x_det.visStr());
0033 PlacedVolume phv = mother.placeVolume(det_vol,transform);
0034 phv.addPhysVolID("id",x_det.id());
0035 det.setPlacement(phv);
0036 return det;
0037 }
0038
0039
0040 DECLARE_DETELEMENT(AlignmentBoxSegment,create_element)