From 5d6fee2a6052c39a746e7cecf8632ae811923780 Mon Sep 17 00:00:00 2001 From: Marshall Scott <mbscott@anl.gov> Date: Tue, 13 Apr 2021 15:32:03 -0400 Subject: [PATCH] SiDISCS creation xml and cpp --- compact/cb_SiDISCS.xml | 51 ++++++++++++++++++++++++++++++++++++ compact/definitions.xml | 21 +++++++++++++++ compact/display.xml | 7 +++++ reference_detector.xml | 4 ++- src/cb_SiDISCS.cpp | 57 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 compact/cb_SiDISCS.xml create mode 100644 src/cb_SiDISCS.cpp diff --git a/compact/cb_SiDISCS.xml b/compact/cb_SiDISCS.xml new file mode 100644 index 0000000..8b2b0e5 --- /dev/null +++ b/compact/cb_SiDISCS.xml @@ -0,0 +1,51 @@ +<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> + + <!-- Some information about detector--> + <info name="Central Barrel Discs" title="Central Barrel Discs" + author="Marshall Scott" + url="https://eicweb.phy.anl.gov/EIC/detectors/reference_detector.git" + status="development" + version="v1 2021-04-13"> + <comment>Central Barrel Discs</comment> + </info> + + <includes> + </includes> + + <limits> + </limits> + + <regions> + </regions> + + <display> + </display> + + <!-- Define detector --> + <detectors> + <comment> + Central Barrel Discs + </comment> + <detector id="cb_SiDISCS_ID" name="cb_SiDISCS" type="cb_SiDISCS" insideTrackingVolume="false" vis="cb_SiDISCSVis" readout="cb_SiDISCS_Hits"> + <material name="Ar10CO2"/> + <dimensions rmin="cb_SiDISCS_rin" rmax="cb_SiDISCS_rout" z_length="cb_SiDISCS_sizez" z="cb_SiDISCS_posz" phi0="170" phi1="330" number="cb_SiDISCS_nlayers" rmin1="cb_SiDISCS_lay_rin" rmax1="cb_SiDISCS_lay_rout" /> + <layer id="0" z="-cb_SiDISCS_sizez * 0.5 + (1 + 0) * cb_SiDISCS_lay_thickness + (1 + 0) * 5 * cm" inner_r="cb_SiDISCS_lay_rin" outer_r="cb_SiDISCS_lay_rout" vis="cb_SiDISCSVis_lay0" /> + <layer id="1" z="-cb_SiDISCS_sizez * 0.5 + (1 + 1) * cb_SiDISCS_lay_thickness + (1 + 1) * 5 * cm" inner_r="cb_SiDISCS_lay_rin" outer_r="cb_SiDISCS_lay_rout" vis="cb_SiDISCSVis_lay1" /> + <layer id="2" z="-cb_SiDISCS_sizez * 0.5 + (1 + 2) * cb_SiDISCS_lay_thickness + (1 + 2) * 5 * cm" inner_r="cb_SiDISCS_lay_rin" outer_r="cb_SiDISCS_lay_rout" vis="cb_SiDISCSVis_lay2" /> + <layer id="3" z="-cb_SiDISCS_sizez * 0.5 + (1 + 3) * cb_SiDISCS_lay_thickness + (1 + 3) * 5 * cm" inner_r="cb_SiDISCS_lay_rin" outer_r="cb_SiDISCS_lay_rout" vis="cb_SiDISCSVis_lay3" /> + <layer id="4" z="-cb_SiDISCS_sizez * 0.5 + (1 + 4) * cb_SiDISCS_lay_thickness + (1 + 4) * 5 * cm" inner_r="cb_SiDISCS_lay_rin" outer_r="cb_SiDISCS_lay_rout" vis="cb_SiDISCSVis_lay4" /> + </detector> + </detectors> + <readouts> + <readout name="cb_SiDISCS_Hits"> + <segmentation type="CartesianGridXY" grid_size_x="1.0*mm" grid_size_y="1.0*mm" /> + <id>system:8,layer:8,x:32:-16,y:-16</id> + </readout> + </readouts> + + + <plugins> + </plugins> +</lccdd> diff --git a/compact/definitions.xml b/compact/definitions.xml index 36d9cf5..48c027a 100644 --- a/compact/definitions.xml +++ b/compact/definitions.xml @@ -626,5 +626,26 @@ <constant name="ci_GEM_posx" value="0 * cm"/> <constant name="ci_GEM_nlayers" value="8"/> + <comment> + -------------------------- + Central Barrel Silicon Discs + -------------------------- + I will move this later + </comment> + <constant name="cb_SiDISCS_ID" value="500"/> + <constant name="cb_SiDISCS_rin" value="0 * cm"/> + <constant name="cb_SiDISCS_rout" value="20 * cm"/> + <constant name="cb_SiDISCS_sizez" value="30 * cm"/> + <constant name="cb_SiDISCS_shiftz" value="0 * cm"/> + <constant name="cb_SiDISCS_posz" value="50 * cm"/> + <constant name="cb_SiDISCS_phi0" value="170"/> + <constant name="cb_SiDISCS_phi1" value="330"/> + + <constant name="cb_SiDISCS_nlayers" value="5"/> + <constant name="cb_SiDISCS_lay_rin" value="5 * cm"/> + <constant name="cb_SiDISCS_lay_rout" value="cb_SiDISCS_rout - 1 * cm"/> + <constant name="cb_SiDISCS_lay_thickness" value="1 * cm"/><comment> No defined in .hh file</comment> + + </define> diff --git a/compact/display.xml b/compact/display.xml index d0733f6..8dad59e 100644 --- a/compact/display.xml +++ b/compact/display.xml @@ -59,6 +59,13 @@ <vis name="ci_GEMVis" r= "0.8" g="0.4" b="0.3" alpha="0.8" showDaughters="true" visible="true"/> <vis name="ci_HCALVis" r= "0.6" g="0" b="0.6" alpha="1.0" showDaughters="true" visible="true"/> + <vis name="cb_SiDISCSVis" r= "0.3" g="0.0" b="0.3" alpha="0.1" showDaughters="true" visible="true"/> + <vis name="cb_SiDISCSVis_lay0" r= "0.8" g="0.4" b="0.3" alpha="1.0" showDaughters="true" visible="true"/> + <vis name="cb_SiDISCSVis_lay1" r= "0.8" g="0.5" b="0.3" alpha="1.0" showDaughters="true" visible="true"/> + <vis name="cb_SiDISCSVis_lay2" r= "0.8" g="0.6" b="0.3" alpha="1.0" showDaughters="true" visible="true"/> + <vis name="cb_SiDISCSVis_lay3" r= "0.8" g="0.6" b="0.3" alpha="1.0" showDaughters="true" visible="true"/> + <vis name="cb_SiDISCSVis_lay4" r= "0.8" g="0.7" b="0.3" alpha="1.0" showDaughters="true" visible="true"/> + <comment> Deprecated colors. </comment> diff --git a/reference_detector.xml b/reference_detector.xml index b040d8d..d9e47d9 100644 --- a/reference_detector.xml +++ b/reference_detector.xml @@ -114,6 +114,7 @@ <include ref="reference_detector/vertex_tracker.xml"/> <include ref="compact/silicon_tracker.xml"/> --> + <include ref="ip6/beampipe.xml"/> <include ref="compact/solenoid.xml"/> <include ref="compact/ecal.xml"/> @@ -122,13 +123,14 @@ <include ref="compact/ce_GEM.xml"/> <include ref="compact/ffi_ZDC.xml"/> <include ref="compact/ci_GEM.xml"/> - + <include ref="compact/cb_SiDISCS.xml"/> <!-- <include ref="compact/ci_HCAL.xml"/> <include ref="compact/forward_rich.xml"/> <include ref="compact/roman_pots.xml"/> <include ref="compact/hcal.xml"/> --> + <include ref="eic/forward_ion_beamline.xml"/> diff --git a/src/cb_SiDISCS.cpp b/src/cb_SiDISCS.cpp new file mode 100644 index 0000000..5c638d2 --- /dev/null +++ b/src/cb_SiDISCS.cpp @@ -0,0 +1,57 @@ +#include <XML/Helper.h> +/////////////////////////// +// Central Ion GEM +/////////////////////////// + +using namespace dd4hep; + +static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens) +{ + + xml::DetElement detElem = handle; + std::string detName = detElem.nameStr(); + int detID = detElem.id(); + xml::Component dims = detElem.dimensions(); + double RIn = dims.rmin(); + double ROut = dims.rmax(); + double SizeZ = dims.z_length(); + double PosZ = dims.z(); + double lay_RIn = dims.rmin1(); + double lay_ROut = dims.rmax1(); + double lay_phi0 = dims.phi0(); + double lay_phi1 = dims.phi1(); + Material mat = desc.material("Ar10CO2"); + Material Vacuum = desc.material("Vacuum"); + + //Outer volume + Tube ci_SiDISCS_Solid(RIn, ROut, SizeZ / 2., 0., 360 * dd4hep::deg); + Volume envelopeVol("cb_SiDISCS_Logic", ci_SiDISCS_Solid, Vacuum); + envelopeVol.setVisAttributes(detElem.visStr()); + + //Ar10CO2 tube for the layers + Tube ci_SiDISCS_detSolid(lay_RIn, lay_ROut, PosZ / 2., lay_phi0 * dd4hep::deg, lay_phi1 * dd4hep::deg); + + //Adding layers to placed detector volume + for (xml_coll_t li(detElem,_U(layer)); li; ++li){ + xml_comp_t x_layer = li; + std::string layer_name = detName + _toString(x_layer.id(), "_layer%d"); + Volume layer_vol(layer_name, ci_SiDISCS_detSolid, mat); + layer_vol.setVisAttributes(x_layer.visStr()); + sens.setType("tracker"); + layer_vol.setSensitiveDetector(sens); + Position layer_pos(0, 0, x_layer.z()); + PlacedVolume layer_phv = envelopeVol.placeVolume(layer_vol, layer_pos); + layer_phv.addPhysVolID("layer", x_layer.id()); + } + + DetElement det(detName, detID); + Volume motherVol = desc.pickMotherVolume(det); + Transform3D tr(RotationZYX(0,0,0), Position(0, 0, 0)); + PlacedVolume detPV = motherVol.placeVolume(envelopeVol, tr); + detPV.addPhysVolID("system", detID); + det.setPlacement(detPV); + + return det; +} +// clang-format off +DECLARE_DETELEMENT(cb_SiDISCS, createDetector) -- GitLab