diff --git a/src/BarrelTrackerWithFrame_geo.cpp b/src/BarrelTrackerWithFrame_geo.cpp index 99b860ed876349091ec39f1d908af66cc9ab05cd..6233a2a4eff431d6075c1c1acd791e85238aebd6 100644 --- a/src/BarrelTrackerWithFrame_geo.cpp +++ b/src/BarrelTrackerWithFrame_geo.cpp @@ -12,6 +12,7 @@ #include "DDRec/Surface.h" #include "DDRec/DetectorData.h" #include "XML/Layering.h" +#include "XML/Utilities.h" #include "Acts/Plugins/DD4hep/ActsExtension.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" @@ -27,13 +28,23 @@ using namespace dd4hep::detail; /** Barrel Tracker with space frame. * - * - Optional "frame" tag within the module element. * - Optional "support" tag within the detector element. + * + * The shapes are created using createShape which can be one of many basic geomtries. + * See the examples Check_shape_*.xml in + * [dd4hep's examples/ClientTests/compact](https://github.com/AIDASoft/DD4hep/tree/master/examples/ClientTests/compact) + * directory. + * + * + * - Optional "frame" tag within the module element. * * \ingroup trackers * * \code * \endcode + * + * + * @author Whitney Armstrong */ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, SensitiveDetector sens) { typedef vector<PlacedVolume> Placements; @@ -57,38 +68,47 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi Tube topVolumeShape(dimensions.rmin(), dimensions.rmax(), dimensions.length() * 0.5); Volume assembly(det_name,topVolumeShape,air); - -// The Cold Plate is approximately 30 mm wide and is based on the same carbon-ply layup -//as for the IB Stave. Two pipes with an inner diameter of 2.67 mm and a wall thickness -//of 64 μm have been used. The two pipes are interconnected at one end of the Cold Plate -//providing a loop, whose inlet and outlet are on the same side and correspond to the -// -//requirements have led to an equilateral section of the frame with a 42 mm wide side, that -//provides almost the same rigidity for all the possible Stave positions. -// -// module mat um -// -//Aluminium 50 -//Polyimide 100 -//Carbon fibre 120 -//Silicon 50 -//Eccobond-45 100 -// -//Metal layers Aluminium 200 -//Insulating layers Polyimide 200 -//Glue Cooling tube wall Eccobond-45 100 -// -//Carbon fleece 40 -//Carbon paper 30 -//Polyimide 64 -//Water -//Carbon fibre 120 -//Eccobond-45 100 - - - sens.setType("tracker"); + // Loop over the suports + for (xml_coll_t su(x_det, _U(support)); su; ++su) { + xml_comp_t x_support = su; + double support_thickness = getAttrOrDefault(x_support, _U(thickness), 2.0 * mm); + double support_length = getAttrOrDefault(x_support, _U(length), 2.0 * mm); + double support_rmin = getAttrOrDefault(x_support, _U(rmin), 2.0 * mm); + double support_zstart = getAttrOrDefault(x_support, _U(zstart), 2.0 * mm); + std::string support_name = getAttrOrDefault<std::string>(x_support, _Unicode(name), "support_tube"); + std::string support_vis = getAttrOrDefault<std::string>(x_support, _Unicode(vis), "AnlRed"); + xml_dim_t pos (x_support.child(_U(position), false)); + xml_dim_t rot (x_support.child(_U(rotation), false)); + Solid support_solid; + if(x_support.hasChild("shape")){ + xml_comp_t shape(x_support.child(_U(shape))); + string shape_type = shape.typeStr(); + support_solid = xml::createShape(description, shape_type, shape); + } else { + support_solid = Tube(support_rmin, support_rmin + support_thickness, support_length / 2); + } + Transform3D tr = Transform3D(Rotation3D(),Position(0,0,(support_zstart + support_length / 2))); + if ( pos.ptr() && rot.ptr() ) { + Rotation3D rot3D(RotationZYX(rot.z(0),rot.y(0),rot.x(0))); + Position pos3D(pos.x(0),pos.y(0),pos.z(0)); + tr = Transform3D(rot3D, pos3D); + } + else if ( pos.ptr() ) { + tr = Transform3D(Rotation3D(),Position(pos.x(0),pos.y(0),pos.z(0))); + } + else if ( rot.ptr() ) { + Rotation3D rot3D(RotationZYX(rot.z(0),rot.y(0),rot.x(0))); + tr = Transform3D(rot3D,Position()); + } + Material support_mat = description.material(x_support.materialStr()); + Volume support_vol(support_name, support_solid, support_mat); + support_vol.setVisAttributes(description.visAttributes(support_vis)); + pv = assembly.placeVolume(support_vol, tr); + // pv = assembly.placeVolume(support_vol, Position(0, 0, support_zstart + support_length / 2)); + } + // loop over the modules for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) { xml_comp_t x_mod = mi;