diff --git a/Detector/DetDriftChamber/compact/det.xml b/Detector/DetDriftChamber/compact/det.xml index bfd81e73dea5721de9e4b9bbb16f0d25512b6d3b..b9997bbeb6853ee404e61426c9a8e52595021800 100644 --- a/Detector/DetDriftChamber/compact/det.xml +++ b/Detector/DetDriftChamber/compact/det.xml @@ -53,6 +53,10 @@ <constant name="SDT_outer_chamber_outer_wall_radius_min" value="1715*mm"/> <constant name="SDT_outer_chamber_outer_wall_radius_max" value="1717.8*mm"/> + <constant name="SDT_Endcap_rmin" value="SDT_radius_min"/> + <constant name="SDT_Endcap_rmax" value="SDT_radius_max"/> + <constant name="SDT_Endcap_dz" value="0.1*mm"/> + </define> <display> @@ -72,8 +76,8 @@ <detector id="7" name="DriftChamber" type="DriftChamber" readout="DriftChamberHitsCollection" vis="VisibleBlue" sensitive="true" region="DriftChamberRegion"> <envelope vis="SeeThrough"> <shape type="BooleanShape" operation="Union" material="Air"> - <shape type="Tube" rmin="SDT_radius_min" rmax="909*mm" dz="SDT_half_length" /> - <shape type="Tube" rmin="1084.8*mm" rmax="SDT_radius_max" dz="SDT_half_length" /> + <shape type="Tube" rmin="SDT_radius_min" rmax="909*mm" dz="SDT_half_length+SDT_Endcap_dz" /> + <shape type="Tube" rmin="1084.8*mm" rmax="SDT_radius_max" dz="SDT_half_length+SDT_Endcap_dz" /> </shape> </envelope> diff --git a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp index 8a978ef41b86175dc1d95f4097e258be5f3bf9c5..61c48f89fa91bccda4172d2caa1cf76f1387fd6f 100644 --- a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp +++ b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp @@ -143,6 +143,14 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, } } + // End cap + double Endcap_rmin = theDetector.constant<double>("SDT_Endcap_rmin"); + double Endcap_rmax = theDetector.constant<double>("SDT_Endcap_rmax"); + double Endcap_z = theDetector.constant<double>("SDT_Endcap_dz"); + dd4hep::Tube det_Endcap_solid(Endcap_rmin,Endcap_rmax,Endcap_z); + dd4hep::Volume det_Endcap_vol(det_name+"Endcap",det_Endcap_solid,det_mat); + det_Endcap_vol.setVisAttributes(theDetector,"VisibleRed"); + //Initialize the segmentation dd4hep::Readout readout = sd.readout(); dd4hep::Segmentation geomseg = readout.segmentation(); @@ -256,6 +264,14 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, dd4hep::PlacedVolume wall_phy = envelope.placeVolume(wall_vol,transform); } + // - place Endcap + double endcap_pos[2] = {chamber_length*0.5+Endcap_z*0.5,-chamber_length*0.5-Endcap_z*0.5}; + dd4hep::PlacedVolume endcap_phy; + for(int i=0; i<2; i++) { + dd4hep::Transform3D Endcap_transform(dd4hep::Rotation3D(),dd4hep::Position(0,0,endcap_pos[i])); + endcap_phy = envelope.placeVolume(det_Endcap_vol,Endcap_transform); + } + if ( x_det.hasAttr(_U(id)) ) { phv.addPhysVolID("system",x_det.id()); }