From 3ee63011208d22e3200b2f95d41cb3b4a74da79e Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Sat, 29 May 2021 02:56:45 -0500 Subject: [PATCH] modified: ip6/beampipe.xml modified: src/IP6BeamPipe.cpp --- ip6/beampipe.xml | 1 + src/IP6BeamPipe.cpp | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ip6/beampipe.xml b/ip6/beampipe.xml index b616b58..ce59100 100644 --- a/ip6/beampipe.xml +++ b/ip6/beampipe.xml @@ -9,6 +9,7 @@ <detectors> <detector id="BeamPipe_ID" name="BeamPipe" type="IP6BeamPipe" vis="BeamPipeVis"> + <!--<beampipe/>--> <IP_pipe OD="BeampipeOD" wall_thickness="4*mm" crossing_angle="CrossingAngle" /> <downstream_pipe straight_length="685.0 * mm" length="4500.0 * mm" /> <upstream_pipe straight_length="1300.0 * mm" length="4500.0 * mm" /> diff --git a/src/IP6BeamPipe.cpp b/src/IP6BeamPipe.cpp index f40dda4..81a08ae 100644 --- a/src/IP6BeamPipe.cpp +++ b/src/IP6BeamPipe.cpp @@ -11,6 +11,8 @@ #include "TMath.h" #include <XML/Helper.h> +#include "Acts/Plugins/DD4hep/ActsExtension.hpp" +#include "Acts/Definitions/Units.hpp" using namespace std; using namespace dd4hep; @@ -39,8 +41,25 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector sens) { Material m_Cu = det.material("Copper"); Material m_Al = det.material("Aluminum"); Material m_Be = det.material("Beryllium"); + Material m_Vacuum = det.material("Vacuum"); string vis_name = x_det.visStr(); + Acts::ActsExtension* beampipeExtension = new Acts::ActsExtension(); + bool isBeamPipe = x_det.hasChild(_U(beampipe)); + beampipeExtension->addType("passive cylinder", "layer"); + if (isBeamPipe) { + beampipeExtension->addType("beampipe", "layer"); + } + + //tubeVolume.setVisAttributes(oddd, x_det.visStr()); + + //// Place it in the mother + //Volume motherVolume = oddd.pickMotherVolume(cylinderElement); + //PlacedVolume placedTube = motherVolume.placeVolume(tubeVolume); + //placedTube.addPhysVolID(detName, cylinderElement.id()); + //sdet.setPlacement(placedTube); + + int n = 0; xml::Component IP_pipe_c = x_det.child(_Unicode(IP_pipe)); @@ -79,6 +98,12 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector sens) { // ----------------------------- // IP beampipe + Tube IP_tube(IP_beampipe_ID/2.0, IP_beampipe_OD/2.0, downstream_straight_length/2.0+upstream_straight_length/2.0); + Tube IP_vacuum(0.0, IP_beampipe_ID/2.0, downstream_straight_length/2.0+upstream_straight_length/2.0); + + Volume v_IP_tube("v_IP_tube", IP_tube, m_Be); + Volume v_IP_vacuum("v_IP_vacuum", IP_vacuum, m_Vacuum ); + Tube downstream_IP_tube(IP_beampipe_ID/2.0, IP_beampipe_OD/2.0, downstream_straight_length/2.0); Tube downstream_IP_vacuum(0.0, IP_beampipe_ID/2.0, downstream_straight_length/2.0); Tube upstream_IP_tube(IP_beampipe_ID/2.0, IP_beampipe_OD/2.0, upstream_straight_length/2.0); @@ -91,11 +116,15 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector sens) { //v_downstream_IP_tube.setVisAttributes(det,"RedVis"); sdet.setAttributes(det, v_upstream_IP_tube , x_det.regionStr(), x_det.limitsStr(), vis_name); sdet.setAttributes(det, v_downstream_IP_tube, x_det.regionStr(), x_det.limitsStr(), vis_name); + sdet.setAttributes(det, v_IP_tube, x_det.regionStr(), x_det.limitsStr(), vis_name); - auto pv_upstream_IP_tube = assembly.placeVolume( v_upstream_IP_tube, Position(0, 0, -upstream_straight_length / 2.0)); + //auto pv_upstream_IP_tube = assembly.placeVolume( v_upstream_IP_tube, Position(0, 0, -upstream_straight_length / 2.0)); + //auto pv_downstream_IP_tube = assembly.placeVolume( v_downstream_IP_tube, Position(0, 0, downstream_straight_length / 2.0)); + auto pv_IP_tube = assembly.placeVolume( v_IP_tube, Position(0, 0, -upstream_straight_length / 2.0 +downstream_straight_length / 2.0)); - auto pv_downstream_IP_tube = assembly.placeVolume( - v_downstream_IP_tube, Position(0, 0, downstream_straight_length / 2.0)); + DetElement beampipe_element(sdet, "beampipe_de", 1); + beampipe_element.addExtension<Acts::ActsExtension>(beampipeExtension); + beampipe_element.setPlacement(pv_IP_tube); // ----------------------------- // upstream -- GitLab