diff --git a/Detector/DetCRD/CMakeLists.txt b/Detector/DetCRD/CMakeLists.txt index eb5e8fcb2507dd0b58bda0c89773cd1c31feaf8b..08194569d3467ab92ddf868b9664f06cddb70cb3 100644 --- a/Detector/DetCRD/CMakeLists.txt +++ b/Detector/DetCRD/CMakeLists.txt @@ -17,17 +17,14 @@ find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) gaudi_add_module(DetCRD SOURCES src/Calorimeter/CRDEcal_v01.cpp + src/Calorimeter/RotatedPolyhedraBarrelCalorimeter_v01_geo.cpp + src/Calorimeter/RotatedCrystalCalorimeter_v01_geo.cpp src/Other/CRDBeamPipe_v01_geo.cpp src/Tracker/SiTrackerSkewRing_v01_geo.cpp src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp LINK ${DD4hep_COMPONENT_LIBRARIES} ) - -target_include_directories(DetCRD PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/src/include - $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) - set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}") dd4hep_generate_rootmap(DetCRD) diff --git a/Detector/DetCRD/compact/CRD_common_v01/VXD_v02_01.xml b/Detector/DetCRD/compact/CRD_common_v01/VXD_v02_01.xml index 43e737a98a7a3d18e1902145b354c2aae07ffc10..0d7819746980429fb0e6b5f5d6e6bf3ed6a384b1 100644 --- a/Detector/DetCRD/compact/CRD_common_v01/VXD_v02_01.xml +++ b/Detector/DetCRD/compact/CRD_common_v01/VXD_v02_01.xml @@ -38,10 +38,11 @@ <constant name="VXD4_half_length" value="90*mm"/> <!-- <constant name="VXD_half_length_1" value="VXD1_half_length"/> --> <!-- <constant name="VXD_layer_gap" value="2.5*mm"/> --> + <constant name="VXD4_half_length" value="90*mm"/> </define> <detectors> - <detector id="DetID_VXD" name="VXDskew" type="SiTrackerSkewBarrel_v01" vis="VXDVis" readout="VXDCollection" insideTrackingVolume="true"> + <detector id="DetID_VXD" name="VXD" type="SiTrackerSkewBarrel_v01" vis="VXDVis" readout="VXDCollection" insideTrackingVolume="true"> <!-- <envelope> --> <!-- <shape type="Assembly"/> --> <!--shape type="BooleanShape" operation="Union" material="Air" > @@ -50,7 +51,7 @@ </shape--> <!-- </envelope> --> <envelope vis="VXDVis"> - <shape type="BooleanShape" operation="Subtraction" material="Air" > + <shape type="BooleanShape" operation="Subtraction" material="Air" > --> <shape type="BooleanShape" operation="Subtraction" material="Air" > <shape type="BooleanShape" operation="Subtraction" material="Air" > <shape type="BooleanShape" operation="Subtraction" material="Air" > @@ -61,16 +62,16 @@ <shape type="Tube" rmin="0." rmax="VXD_inner_radius_1" dz="(VXD_half_length - VXD_cone_max_z)/2. + env_safety " /> <position x="0" y="0" z="- ( VXD_half_length-(VXD_half_length - VXD_cone_max_z)/2.+ env_safety ) "/> <rotation x="0" y="180.*deg" z="0" /> - </shape> + </shape> <shape type="Cone" rmin1="0" rmax1="VXD_inner_radius" rmin2="0" rmax2="VXD_inner_radius_1" - z="(VXD_cone_max_z-VXD_cone_min_z)/2. + env_safety "/> - <position x="0" y="0" z="VXD_cone_min_z+(VXD_cone_max_z-VXD_cone_min_z)/2."/> - </shape> - <shape type="Cone" rmin1="0" rmax1="VXD_inner_radius" rmin2="0" rmax2="VXD_inner_radius_1" - z="(VXD_cone_max_z-VXD_cone_min_z)/2. + env_safety "/> - <position x="0" y="0" z="-(VXD_cone_min_z+(VXD_cone_max_z-VXD_cone_min_z)/2.)"/> - <rotation x="0" y="180.*deg" z="0" /> - </shape> + z="(VXD_cone_max_z-VXD_cone_min_z)/2. + env_safety "/> + <position x="0" y="0" z="VXD_cone_min_z+(VXD_cone_max_z-VXD_cone_min_z)/2."/> + </shape> + <shape type="Cone" rmin1="0" rmax1="VXD_inner_radius" rmin2="0" rmax2="VXD_inner_radius_1" + z="(VXD_cone_max_z-VXD_cone_min_z)/2. + env_safety "/> + <position x="0" y="0" z="-(VXD_cone_min_z+(VXD_cone_max_z-VXD_cone_min_z)/2.)"/> + <rotation x="0" y="180.*deg" z="0" /> + </shape> </envelope> <type_flags type="DetType_TRACKER + DetType_BARREL + DetType_PIXEL "/> @@ -87,19 +88,19 @@ n_ladders="10" ladder_clearance="0.1*mm" faces_IP="1" is_VXD1="1" is_VXD2="0" > <ladder isDoubleSided="true"> <ladderSupport height="2*mm" length="200*mm" thickness="350*um" width="16.8*mm" mat="CarbonFiber"/> - <flex n_layers="3"> - <layer length="200*mm" thickness="60*um" width="16.8*mm" mat="Epoxy"/> - <layer length="200*mm" thickness="74*um" width="16.8*mm" mat="Kapton"/> - <layer length="200*mm" thickness="26.8*um" width="16.8*mm" mat="G4_Al"/> - <!-- <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> - <!-- <layer length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> - <!-- <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> - <!-- <layer length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> - <!-- <layer length="200*mm" thickness="50*um" width="16.8*mm" mat="Kapton"/> --> - <!-- <layer length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> - <!-- <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> - <!-- <layer length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> - <!-- <layer length="200*mm" thickness="15*um" width="14.8*mm" mat="Epoxy"/> --> + <flex n_slices="3"> + <slice length="200*mm" thickness="60*um" width="16.8*mm" mat="Epoxy"/> + <slice length="200*mm" thickness="74*um" width="16.8*mm" mat="Kapton"/> + <slice length="200*mm" thickness="26.8*um" width="16.8*mm" mat="G4_Al"/> + <!-- <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> + <!-- <slice length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> + <!-- <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> + <!-- <slice length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> + <!-- <slice length="200*mm" thickness="50*um" width="16.8*mm" mat="Kapton"/> --> + <!-- <slice length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> + <!-- <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> + <!-- <slice length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> + <!-- <slice length="200*mm" thickness="15*um" width="14.8*mm" mat="Epoxy"/> --> </flex> <sensor n_sensors="7" gap="0.1*mm" thickness="50*um" active_length="25.6*mm" active_width="12.8*mm" dead_width="2*mm" sensor_mat="G4_Si" deadwire_length="(7*(25.6+0.1)-0.1)*mm" deadwire_width="2*mm" deadwire_thickness="(50/10)*um" deadwire_mat="G4_Al"/> @@ -109,19 +110,19 @@ n_ladders="22" ladder_clearance="0.1*mm" faces_IP="1" is_VXD1="0" is_VXD2="1" > <ladder isDoubleSided="true"> <ladderSupport height="2*mm" length="200*mm" thickness="350*um" width="16.8*mm" mat="CarbonFiber"/> - <flex n_layers="3"> - <layer length="200*mm" thickness="60*um" width="16.8*mm" mat="Epoxy"/> - <layer length="200*mm" thickness="74*um" width="16.8*mm" mat="Kapton"/> - <layer length="200*mm" thickness="26.8*um" width="16.8*mm" mat="G4_Al"/> - <!-- <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> - <!-- <layer length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> - <!-- <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> - <!-- <layer length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> - <!-- <layer length="200*mm" thickness="50*um" width="16.8*mm" mat="Kapton"/> --> - <!-- <layer length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> - <!-- <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> - <!-- <layer length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> - <!-- <layer length="200*mm" thickness="15*um" width="14.8*mm" mat="Epoxy"/> --> + <flex n_slices="3"> + <slice length="200*mm" thickness="60*um" width="16.8*mm" mat="Epoxy"/> + <slice length="200*mm" thickness="74*um" width="16.8*mm" mat="Kapton"/> + <slice length="200*mm" thickness="26.8*um" width="16.8*mm" mat="G4_Al"/> + <!-- <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> + <!-- <slice length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> + <!-- <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> + <!-- <slice length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> + <!-- <slice length="200*mm" thickness="50*um" width="16.8*mm" mat="Kapton"/> --> + <!-- <slice length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> --> + <!-- <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> --> + <!-- <slice length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> --> + <!-- <slice length="200*mm" thickness="15*um" width="14.8*mm" mat="Epoxy"/> --> </flex> <sensor n_sensors="7" gap="0.1*mm" thickness="50*um" active_length="25.6*mm" active_width="12.8*mm" dead_width="2*mm" sensor_mat="G4_Si" deadwire_length="(7*(25.6+0.1)-0.1)*mm" deadwire_width="2*mm" deadwire_thickness="(50/10)*um" deadwire_mat="G4_Al"/> @@ -131,27 +132,25 @@ n_ladders="32" ladder_clearance="0.1*mm" faces_IP="1" is_VXD1="0" is_VXD2="0" > <ladder isDoubleSided="true"> <ladderSupport height="2*mm" length="200*mm" thickness="350*um" width="16.8*mm" mat="CarbonFiber"/> - <flex n_layers="3"> - <layer length="200*mm" thickness="60*um" width="16.8*mm" mat="Epoxy"/> - <layer length="200*mm" thickness="74*um" width="16.8*mm" mat="Kapton"/> - <layer length="200*mm" thickness="26.8*um" width="16.8*mm" mat="G4_Al"/> - <!-- <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> - <layer length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> - <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> - <layer length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> - <layer length="200*mm" thickness="50*um" width="16.8*mm" mat="Kapton"/> - <layer length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> - <layer length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> - <layer length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> - <layer length="200*mm" thickness="15*um" width="14.8*mm" mat="Epoxy"/> --> + <flex n_slices="3"> + <slice length="200*mm" thickness="60*um" width="16.8*mm" mat="Epoxy"/> + <slice length="200*mm" thickness="74*um" width="16.8*mm" mat="Kapton"/> + <slice length="200*mm" thickness="26.8*um" width="16.8*mm" mat="G4_Al"/> + <!-- <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> + <slice length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> + <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> + <slice length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> + <slice length="200*mm" thickness="50*um" width="16.8*mm" mat="Kapton"/> + <slice length="200*mm" thickness="13.4*um" width="16.8*mm" mat="G4_Al"/> + <slice length="200*mm" thickness="15*um" width="16.8*mm" mat="Epoxy"/> + <slice length="200*mm" thickness="12*um" width="16.8*mm" mat="Kapton"/> + <slice length="200*mm" thickness="15*um" width="14.8*mm" mat="Epoxy"/> --> </flex> <sensor n_sensors="7" gap="0.1*mm" thickness="50*um" active_length="25.6*mm" active_width="12.8*mm" dead_width="2*mm" sensor_mat="G4_Si" deadwire_length="(7*(25.6+0.1)-0.1)*mm" deadwire_width="2*mm" deadwire_thickness="(50/10)*um" deadwire_mat="G4_Al"/> </ladder> </layer> - <!-- <layer layer_id="3" ladder_radius="VXD4_inner_radius+0.5*VXD_sensitive_thickness" n_sensors_per_side="VXD4_half_length*2/VXD_sensor_length" --> - <!-- n_ladders="2*pi*VXD4_inner_radius/VXD_sensor_length" ladder_clearance="0.1*mm" faces_IP="1" is_VXD1="0" is_VXD2="0" /> --> </detector> diff --git a/Detector/DetCRD/src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp b/Detector/DetCRD/src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp index e78fa02eeecd1a8f240c5780d9013a377640e9d3..e7c0c36ca193bb86873a1791ad3e6f39e159785d 100644 --- a/Detector/DetCRD/src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp +++ b/Detector/DetCRD/src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp @@ -11,7 +11,6 @@ #include "DDRec/Surface.h" #include "DDRec/DetectorData.h" #include "XML/Utilities.h" -#include "XMLHandlerDB.h" #include <cmath> using namespace std; @@ -83,33 +82,30 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h dd4hep::rec::ZPlanarData* zPlanarData = new dd4hep::rec::ZPlanarData; // fetch the global parameters - XMLHandlerDB db0 = XMLHandlerDB( x_det.child( _Unicode( global ) ) ) ; - //Material support_mat = theDetector.material(db0->fetchString("support_mat")); //fetch the display parameters - db0 = XMLHandlerDB( x_det.child( _Unicode( display ) ) ) ; - std::string ladderVis = db0->fetchString("ladder"); - std::string supportVis = db0->fetchString("support"); - std::string flexVis = db0->fetchString("flex"); - std::string sensEnvVis = db0->fetchString("sens_env"); - std::string sensVis = db0->fetchString("sens"); - std::string deadsensVis = db0->fetchString("deadsensor"); - std::string deadwireVis = db0->fetchString("deadwire"); + xml_comp_t x_display(x_det.child(_Unicode(display))); + std::string ladderVis = x_display.attr<string>(_Unicode(ladder)); + std::string supportVis = x_display.attr<string>(_Unicode(support)); + std::string flexVis = x_display.attr<string>(_Unicode(flex)); + std::string sensEnvVis = x_display.attr<string>(_Unicode(sens_env)); + std::string sensVis = x_display.attr<string>(_Unicode(sens)); + std::string deadsensVis = x_display.attr<string>(_Unicode(deadsensor)); + std::string deadwireVis = x_display.attr<string>(_Unicode(deadwire)); for(xml_coll_t layer_i(x_det,_U(layer)); layer_i; ++layer_i){ xml_comp_t x_layer(layer_i); - XMLHandlerDB db = XMLHandlerDB( x_layer ); dd4hep::PlacedVolume pv; - int layer_id = db->fetchInt("layer_id"); + int layer_id = x_layer.attr<int>(_Unicode(layer_id)); std::cout << "layer_id: " << layer_id << endl; - double sensitive_radius = db->fetchDouble("ladder_radius"); - int n_sensors_per_ladder = db->fetchInt("n_sensors_per_side"); - int n_ladders = db->fetchInt("n_ladders") ; - double ladder_offset = db->fetchDouble("ladder_offset"); + double sensitive_radius = x_layer.attr<double>(_Unicode(ladder_radius)); + int n_sensors_per_ladder = x_layer.attr<int>(_Unicode(n_sensors_per_side)); + int n_ladders = x_layer.attr<int>(_Unicode(n_ladders)) ; + double ladder_offset = x_layer.attr<double>(_Unicode(ladder_offset)); double ladder_radius = sqrt(ladder_offset*ladder_offset + sensitive_radius*sensitive_radius); double ladder_phi0 = -atan(ladder_offset/sensitive_radius); std::cout << "ladder_radius: " << ladder_radius/mm <<" mm" << endl; @@ -128,15 +124,15 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h //fetch the ladder parameters xml_comp_t x_ladder(x_layer.child(_Unicode(ladder))); - db = XMLHandlerDB(x_ladder); + // db = XMLHandlerDB(x_ladder); //fetch the ladder support parameters - db = XMLHandlerDB(x_ladder.child(_Unicode(ladderSupport))); - double support_length = db->fetchDouble("length"); - double support_thickness = db->fetchDouble("thickness"); - double support_height = db->fetchDouble("height"); - double support_width = db->fetchDouble("width"); - Material support_mat = theDetector.material(db->fetchString("mat")); + xml_comp_t x_ladder_support(x_ladder.child(_Unicode(ladderSupport))); + double support_length = x_ladder_support.attr<double>(_Unicode(length)); + double support_thickness = x_ladder_support.attr<double>(_Unicode(thickness)); + double support_height = x_ladder_support.attr<double>(_Unicode(height)); + double support_width = x_ladder_support.attr<double>(_Unicode(width)); + Material support_mat = theDetector.material(x_ladder_support.attr<string>(_Unicode(mat))); std::cout << "support_length: " << support_length/mm << " mm" << endl; std::cout << "support_thickness: " << support_thickness/mm << " mm" << endl; std::cout << "support_width: " << support_width/mm << " mm" << endl; @@ -146,34 +142,33 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h double flex_width(0); double flex_length(0); xml_comp_t x_flex(x_ladder.child(_Unicode(flex))); - for(xml_coll_t flex_i(x_flex,_U(layer)); flex_i; ++flex_i){ - xml_comp_t x_flex_layer(flex_i); - db = XMLHandlerDB(x_flex_layer); - double x_flex_layer_thickness = db->fetchDouble("thickness"); - double x_flex_layer_width = db->fetchDouble("width"); - double x_flex_layer_length = db->fetchDouble("length"); - flex_thickness += x_flex_layer_thickness; - if (x_flex_layer_width > flex_width) flex_width = x_flex_layer_width; - if (x_flex_layer_length > flex_length) flex_length = x_flex_layer_length; - std::cout << "x_flex_layer_thickness: " << x_flex_layer_thickness/mm << " mm" << endl; + for(xml_coll_t flex_i(x_flex,_U(slice)); flex_i; ++flex_i){ + xml_comp_t x_flex_slice(flex_i); + double x_flex_slice_thickness = x_flex_slice.attr<double>(_Unicode(thickness)); + double x_flex_slice_width = x_flex_slice.attr<double>(_Unicode(width)); + double x_flex_slice_length = x_flex_slice.attr<double>(_Unicode(length)); + flex_thickness += x_flex_slice_thickness; + if (x_flex_slice_width > flex_width) flex_width = x_flex_slice_width; + if (x_flex_slice_length > flex_length) flex_length = x_flex_slice_length; + std::cout << "x_flex_slice_thickness: " << x_flex_slice_thickness/mm << " mm" << endl; } std::cout << "flex_thickness: " << flex_thickness/mm << " mm" << endl; std::cout << "flex_width: " << flex_width/mm << " mm" << endl; std::cout << "flex_length: " << flex_length/mm << " mm" << endl; //fetch the sensor parameters - db = XMLHandlerDB(x_ladder.child(_Unicode(sensor))); - int n_sensors_per_side = db->fetchInt("n_sensors"); - double dead_gap = db->fetchDouble("gap"); - double sensor_thickness = db->fetchDouble("thickness"); - double sensor_active_len = db->fetchDouble("active_length"); - double sensor_active_width = db->fetchDouble("active_width"); - double sensor_dead_width = db->fetchDouble("dead_width"); - double sensor_deadwire_length = db->fetchDouble("deadwire_length"); - double sensor_deadwire_width = db->fetchDouble("deadwire_width"); - double sensor_deadwire_thickness = db->fetchDouble("deadwire_thickness"); - Material sensor_mat = theDetector.material(db->fetchString("sensor_mat")); - Material sensor_deadwire_mat = theDetector.material(db->fetchString("deadwire_mat")); + xml_comp_t x_sensor(x_ladder.child(_Unicode(sensor))); + int n_sensors_per_side = x_sensor.attr<int>(_Unicode(n_sensors)); + double dead_gap = x_sensor.attr<double>(_Unicode(gap)); + double sensor_thickness = x_sensor.attr<double>(_Unicode(thickness)); + double sensor_active_len = x_sensor.attr<double>(_Unicode(active_length)); + double sensor_active_width = x_sensor.attr<double>(_Unicode(active_width)); + double sensor_dead_width = x_sensor.attr<double>(_Unicode(dead_width)); + double sensor_deadwire_length = x_sensor.attr<double>(_Unicode(deadwire_length)); + double sensor_deadwire_width = x_sensor.attr<double>(_Unicode(deadwire_width)); + double sensor_deadwire_thickness = x_sensor.attr<double>(_Unicode(deadwire_thickness)); + Material sensor_mat = theDetector.material(x_sensor.attr<string>(_Unicode(sensor_mat))); + Material sensor_deadwire_mat = theDetector.material(x_sensor.attr<string>(_Unicode(deadwire_mat))); std::cout << "n_sensors_per_side: " << n_sensors_per_side << endl; std::cout << "dead_gap: " << dead_gap/mm << " mm" << endl; @@ -196,22 +191,21 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h //create the flex layers inside the flex envelope double flex_height(0); int index = 0; - for(xml_coll_t flex_i(x_flex,_U(layer)); flex_i; ++flex_i){ - xml_comp_t x_flex_layer(flex_i); - db = XMLHandlerDB(x_flex_layer); - double x_flex_layer_thickness = db->fetchDouble("thickness"); - double x_flex_layer_width = db->fetchDouble("width"); - double x_flex_layer_length = db->fetchDouble("length"); - Material x_flex_layer_mat = theDetector.material(db->fetchString("mat")); - flex_height += x_flex_layer_thickness; - Box FlexLayerSolid(x_flex_layer_thickness/2.0, x_flex_layer_width/2.0, x_flex_layer_length/2.0); - Volume FlexLayerLogical(name + dd4hep::_toString( layer_id, "_FlexLayerLogical_%02d") + dd4hep::_toString( index, "index_%02d"), FlexLayerSolid, x_flex_layer_mat); + for(xml_coll_t flex_i(x_flex,_U(slice)); flex_i; ++flex_i){ + xml_comp_t x_flex_slice(flex_i); + double x_flex_slice_thickness = x_flex_slice.attr<double>(_Unicode(thickness)); + double x_flex_slice_width = x_flex_slice.attr<double>(_Unicode(width)); + double x_flex_slice_length = x_flex_slice.attr<double>(_Unicode(length)); + Material x_flex_slice_mat = theDetector.material(x_flex_slice.attr<string>(_Unicode(mat))); + flex_height += x_flex_slice_thickness; + Box FlexLayerSolid(x_flex_slice_thickness/2.0, x_flex_slice_width/2.0, x_flex_slice_length/2.0); + Volume FlexLayerLogical(name + dd4hep::_toString( layer_id, "_FlexLayerLogical_%02d") + dd4hep::_toString( index, "index_%02d"), FlexLayerSolid, x_flex_slice_mat); FlexLayerLogical.setVisAttributes(theDetector.visAttributes(flexVis)); pv = FlexEnvelopeLogical.placeVolume(FlexLayerLogical, Position(flex_height/2.0, 0., 0.)); - std::cout << "flex thickness = " << x_flex_layer_thickness << std::endl; - std::cout << "flex width = " << x_flex_layer_width << std::endl; - std::cout << "flex length = " << x_flex_layer_length << std::endl; - // std::cout << "flex material: " << x_flex_layer_mat << std::endl; + std::cout << "flex thickness = " << x_flex_slice_thickness << std::endl; + std::cout << "flex width = " << x_flex_slice_width << std::endl; + std::cout << "flex length = " << x_flex_slice_length << std::endl; + // std::cout << "flex material: " << x_flex_slice_mat << std::endl; index++; } @@ -300,6 +294,24 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h ladder_enum << "vxt_ladder_" << layer_id << "_" << i; DetElement ladderDE(layerDE, ladder_enum.str(), x_det.id()); std::cout << "start building " << ladder_enum.str() << ":" << endl; + + //====== create the meassurement surface =================== + dd4hep::rec::Vector3D o(0,0,0); + dd4hep::rec::Vector3D u( 0., 0., 1.); + dd4hep::rec::Vector3D v( 0., 1., 0.); + dd4hep::rec::Vector3D n( 1., 0., 0.); + double inner_thick_top = sensor_thickness/2.0; + double outer_thick_top = support_height/2.0 + flex_height + sensor_thickness/2.0; + double inner_thick_bottom = support_height/2.0 + flex_height + sensor_thickness/2.0; + double outer_thick_bottom = sensor_thickness/2.0; + dd4hep::rec::VolPlane surfTop( SensorLogical , + dd4hep::rec::SurfaceType(dd4hep::rec::SurfaceType::Sensitive), + inner_thick_top, outer_thick_top , u,v,n,o ) ; + dd4hep::rec::VolPlane surfBottom( SensorLogical , + dd4hep::rec::SurfaceType(dd4hep::rec::SurfaceType::Sensitive), + inner_thick_bottom, outer_thick_bottom, u,v,n,o ) ; + + for(int isensor=0; isensor < n_sensors_per_side; ++isensor){ std::stringstream topsensor_str; std::stringstream bottomsensor_str; @@ -310,9 +322,11 @@ static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4h DetElement topsensorDE(ladderDE, topsensor_str.str(), x_det.id()); DetElement bottomsensorDE(ladderDE, bottomsensor_str.str(), x_det.id()); topsensorDE.setPlacement(TopSensor_pv[isensor]); + volSurfaceList(topsensorDE)->push_back(surfTop); // std::cout << "\t" << topsensor_str.str() << " done." << endl; bottomsensorDE.setPlacement(BottomSensor_pv[isensor]); // std::cout << "\t" << bottomsensor_str.str() << " done." << endl; + volSurfaceList(bottomsensorDE)->push_back(surfBottom); } Transform3D tr (RotationZYX(ladder_dphi*i,0.,0.),Position(ladder_radius*cos(ladder_phi0+ladder_dphi*i), ladder_radius*sin(ladder_phi0+ladder_dphi*i), 0.)); pv = layer_assembly.placeVolume(LadderLogical,tr); diff --git a/Detector/DetCRD/src/include/XMLHandlerDB.h b/Detector/DetCRD/src/include/XMLHandlerDB.h deleted file mode 100644 index 7285d2bc0178b38af0a65d74247c67aa5c6c7269..0000000000000000000000000000000000000000 --- a/Detector/DetCRD/src/include/XMLHandlerDB.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "XML/XMLDetector.h" -#include <string> - -namespace { - /** Wrapper class to replace the Database class used in Mokka to read the parameters. - * Assumes parameters are stored as attributes of the corresponding xml element. - */ - struct XMLHandlerDB{ - xml_comp_t x_det ; - /** C'tor initializes the handle */ - XMLHandlerDB(xml_comp_t det) : x_det(det) {} - - double fetchDouble( const char* _name){ return x_det.attr<double>( dd4hep::xml::Strng_t(_name) ) ; } - - int fetchInt( const char* _name){ return x_det.attr<int>( dd4hep::xml::Strng_t(_name) ) ; } - - std::string fetchString( const char* _name){ return x_det.attr<std::string>( dd4hep::xml::Strng_t(_name) ) ;} - - /** allow this to be used as a 'pointer' ( as was used for Mokka Database object)*/ - XMLHandlerDB* operator->() { return this ; } - }; - -}