File indexing completed on 2025-01-18 09:14:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "DD4hep/DetFactoryHelper.h"
0018
0019 using namespace std;
0020 using namespace dd4hep;
0021 using namespace dd4hep::detail;
0022
0023 static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) {
0024 xml_det_t x_det (e);
0025 xml_comp_t x_tube = x_det.tubs();
0026 xml_dim_t pos = x_det.position();
0027 xml_dim_t rot = x_det.rotation();
0028 string name = x_det.nameStr();
0029 Tube tub (x_tube.rmin(),x_tube.rmax(),x_tube.zhalf());
0030 Volume vol (name,tub,description.material(x_det.materialStr()));
0031
0032 vol.setVisAttributes(description, x_det.visStr());
0033 vol.setLimitSet(description, x_det.limitsStr());
0034 vol.setRegion(description, x_det.regionStr());
0035 if ( x_det.isSensitive() ) {
0036 SensitiveDetector sd = sens;
0037 xml_dim_t sd_typ = x_det.child(_U(sensitive));
0038 vol.setSensitiveDetector(sens);
0039 sd.setType(sd_typ.typeStr());
0040 }
0041
0042 DetElement sdet(name,x_det.id());
0043 Volume mother = description.pickMotherVolume(sdet);
0044 PlacedVolume phv =
0045 mother.placeVolume(vol,Transform3D(RotationZYX(rot.z(),rot.y(),rot.x()),Position(-pos.x(),-pos.y(),pos.z())));
0046 if ( x_det.hasAttr(_U(id)) ) {
0047 phv.addPhysVolID("system",x_det.id());
0048 }
0049 sdet.setPlacement(phv);
0050 return sdet;
0051 }
0052
0053 DECLARE_DETELEMENT(Lhe_TubeSegment,create_element)