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
0016 #include "DD4hep/DetFactoryHelper.h"
0017 #include "XML/Layering.h"
0018
0019 using namespace std;
0020 using namespace dd4hep;
0021 using namespace dd4hep::detail;
0022
0023 static Ref_t create_detector(Detector& description, xml_h e, Ref_t) {
0024 xml_det_t x_det = e;
0025 string name = x_det.nameStr();
0026 DetElement sdet (name,x_det.id());
0027 Material mat (description.material(x_det.materialStr()));
0028
0029
0030 double c0 = 3.5;
0031 double rmin = 0.0, rmax = 0.0, z = 0.0;
0032
0033 for(xml_coll_t c(x_det,_U(zplane)); c; ++c) {
0034 xml_comp_t dim(c);
0035 rmin = dim.rmin();
0036 rmax = dim.rmax();
0037 z = dim.z();
0038 }
0039
0040 double ra = rmax * c0;
0041 double rb = rmax;
0042 double thick = rmax - rmin;
0043
0044 EllipticalTube bpElTubeOut(ra+thick, rb+thick, z);
0045 EllipticalTube bpElTubeInn(ra, rb, z+thick);
0046 SubtractionSolid bpElTube(bpElTubeOut,bpElTubeInn);
0047
0048 Tube bpTube1(rb, rb+thick, z+thick, 3*M_PI/2, M_PI/2);
0049 UnionSolid beamTube1(bpElTube,bpTube1);
0050
0051 Tube bpTube2(rb+thick, ra+thick, z+thick, 3*M_PI/2, M_PI/2);
0052 SubtractionSolid beamTube(beamTube1,bpTube2);
0053
0054 Volume volume(name, beamTube, mat);
0055
0056 double z_offset = x_det.hasAttr(_U(z_offset)) ? x_det.z_offset() : 0.0;
0057
0058 volume.setVisAttributes(description, x_det.visStr());
0059 PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(volume,Position(0,0,z_offset));
0060 sdet.setPlacement(pv);
0061
0062 if ( x_det.hasAttr(_U(id)) ) {
0063 int det_id = x_det.id();
0064 pv.addPhysVolID("system",det_id);
0065 }
0066 return sdet;
0067 }
0068
0069 DECLARE_DETELEMENT(LheD_tracker_BeamPipe,create_detector)
0070