File indexing completed on 2025-01-18 09:14:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "DD4hep/DetFactoryHelper.h"
0016
0017 using namespace dd4hep;
0018 using namespace dd4hep::detail;
0019
0020 static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) {
0021
0022 xml_dim_t x_det = e;
0023
0024 DetElement d_det(x_det.nameStr(),x_det.id());
0025
0026
0027 xml_dim_t x_det_dim(x_det.dimensions());
0028 double inner_r = x_det_dim.rmin();
0029 double outer_r = x_det_dim.rmax();
0030 Assembly calo_vol(x_det.nameStr()+"_envelope");
0031
0032
0033 calo_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
0034
0035
0036 Tube tub(inner_r,outer_r,x_det_dim.z()/2.0,0.0,2*M_PI);
0037 Volume tub_vol(x_det.nameStr()+"_tube",tub,description.material("Iron"));
0038 calo_vol.placeVolume(tub_vol).addPhysVolID("module",1);
0039 sens.setType("calorimeter");
0040 tub_vol.setSensitiveDetector(sens);
0041 d_det.setAttributes(description,tub_vol,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
0042
0043
0044 PlacedVolume calo_plv = description.pickMotherVolume(d_det).placeVolume(calo_vol);
0045 calo_plv.addPhysVolID("system",x_det.id());
0046 calo_plv.addPhysVolID("barrel",0);
0047 d_det.setPlacement(calo_plv);
0048 return d_det;
0049 }
0050
0051 DECLARE_DETELEMENT(IronCylinder,create_detector)