diff --git a/compact/B0_tracker.xml b/compact/B0_tracker.xml new file mode 100644 index 0000000000000000000000000000000000000000..165e3ebd8fa7e2730c92788a16906e3b875e4da5 --- /dev/null +++ b/compact/B0_tracker.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<lccdd> + <define> + <comment> + --------------------------------- + Far Forward B0 Tracker Parameters + --------------------------------- + </comment> + <constant name="B0Tracker_zpos" value="B0PF_CenterPosition + B0PF_Length/2.0 + 20.0*cm"/> + </define> + + <detectors> + <detector + id="B0Tracker_ID" + name="B0Tracker" + readout="B0TrackerHits" + type="ref_RectangularTracker" + insideTrackingVolume="true" + reflect="false" + vis="Argonne_Red"> + <position x="0" y="0" z="B0Tracker_zpos"/> + <layer id="1" + vis="Argonne_Blue" + x="20.0*cm" + y="10.0*cm" > + <slice material="Air" thickness="1.0*cm" vis="Argonne_Blue" sensitive="true" /> + <slice material="Air" thickness="1.0*cm" vis="Argonne_Blue" sensitive="true" /> + <slice material="Air" thickness="1.0*cm" vis="Argonne_Blue" sensitive="true" /> + <slice material="Air" thickness="1.0*cm" vis="Argonne_Blue" sensitive="true" /> + </layer> + </detector> + </detectors> + + <readouts> + <readout name="B0TrackerHits"> + <segmentation type="CartesianGridXY" grid_size_x="1.0*mm" grid_size_y="1.0*mm" /> + <id>system:8,barrel:3,layer:4,slice:4,x:32:-16,y:-16</id> + </readout> + </readouts> + +</lccdd> diff --git a/compact/definitions.xml b/compact/definitions.xml index 542083ea1a4492d62981fbbe0aa24bd3a4a7c3f1..1ffe34fedb6b71ebc4a17177a1075ef390ab95c5 100644 --- a/compact/definitions.xml +++ b/compact/definitions.xml @@ -235,11 +235,13 @@ (150-169) Far Forward Detectors ===================================== - Forward Roman Pot ID: 150 - Zero Degree Cal. ID: 160 + Forward Roman Pot ID: 150 + Forward B0 Tracker ID: 151 + Zero Degree Cal. ID: 160 </comment> <constant name="ForwardRomanPot_ID" value="150"/> + <constant name="B0Tracker_ID" value="151"/> <constant name="ffi_ZDC_ID" value="160"/> <comment> diff --git a/reference_detector.xml b/reference_detector.xml index a1493dc1c6c2351f59fa27fa1cd7683c262c55eb..1ff50a25ca15ee15c961c9953250ccaa2c7711aa 100644 --- a/reference_detector.xml +++ b/reference_detector.xml @@ -124,6 +124,7 @@ <include ref="compact/ci_GEM.xml"/> <include ref="compact/hcal.xml"/> <include ref="compact/forward_trd.xml"/> + <include ref="compact/B0_tracker.xml"/> <!-- <include ref="compact/ci_HCAL.xml"/> <include ref="compact/forward_rich.xml"/> diff --git a/src/ref_RectangularTracker_geo.cpp b/src/ref_RectangularTracker_geo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b8ae7436203c77c221a2ff8d44600109a890084 --- /dev/null +++ b/src/ref_RectangularTracker_geo.cpp @@ -0,0 +1,88 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// Modified : W.Armstrong +// +//========================================================================== +// +// Specialized generic detector constructor +// +//========================================================================== +#include "DD4hep/DetFactoryHelper.h" + +using namespace std; +using namespace dd4hep; +using namespace dd4hep::detail; + +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { + xml_det_t x_det = e; + Material air = description.air(); + string det_name = x_det.nameStr(); + bool reflect = x_det.reflect(); + DetElement sdet(det_name,x_det.id()); + Assembly assembly(det_name); + PlacedVolume pv; + int l_num = 0; + xml::Component pos = x_det.position(); + + for(xml_coll_t i(x_det,_U(layer)); i; ++i, ++l_num) { + xml_comp_t x_layer = i; + string l_nam = det_name + _toString(l_num, "_layer%d"); + double x_lay = x_layer.x(); + double y_lay = x_layer.y(); + double z = 0; + double zmin = 0; + double layerWidth = 0.; + int s_num = 0; + for(xml_coll_t j(x_layer,_U(slice)); j; ++j) { + double thickness = xml_comp_t(j).thickness(); + layerWidth += thickness; + } + Box l_box(x_lay/2.0, y_lay/2.0, layerWidth/2.0 ); + Volume l_vol(l_nam, l_box, air); + l_vol.setVisAttributes(description, x_layer.visStr()); + for (xml_coll_t j(x_layer, _U(slice)); j; ++j, ++s_num) { + xml_comp_t x_slice = j; + double thick = x_slice.thickness(); + Material mat = description.material(x_slice.materialStr()); + string s_nam = l_nam + _toString(s_num, "_slice%d"); + Volume s_vol(s_nam, Box(x_lay/2.0, y_lay/2.0, thick/2.0), mat); + if (x_slice.isSensitive()) { + sens.setType("tracker"); + s_vol.setSensitiveDetector(sens); + } + s_vol.setAttributes(description, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = l_vol.placeVolume(s_vol, Position(0, 0, z - zmin - layerWidth / 2 + thick / 2)); + pv.addPhysVolID("slice", s_num); + } + + DetElement layer(sdet,l_nam+"_pos",l_num); + pv = assembly.placeVolume(l_vol,Position(0,0,zmin+layerWidth/2.)); + pv.addPhysVolID("layer",l_num); + pv.addPhysVolID("barrel",1); + layer.setPlacement(pv); + if ( reflect ) { + pv = assembly.placeVolume(l_vol,Transform3D(RotationY(M_PI),Position(0,0,-zmin-layerWidth/2))); + pv.addPhysVolID("layer",l_num); + pv.addPhysVolID("barrel",2); + DetElement layerR = layer.clone(l_nam+"_neg"); + sdet.add(layerR.setPlacement(pv)); + } + } + if ( x_det.hasAttr(_U(combineHits)) ) { + sdet.setCombineHits(x_det.attr<bool>(_U(combineHits)),sens); + } + pv = description.pickMotherVolume(sdet).placeVolume(assembly,Position(pos.x(),pos.y(),pos.z())); + pv.addPhysVolID("system", x_det.id()); // Set the subdetector system ID. + sdet.setPlacement(pv); + return sdet; +} + +DECLARE_DETELEMENT(ref_RectangularTracker,create_detector)