diff --git a/Detector/DetCRD/CMakeLists.txt b/Detector/DetCRD/CMakeLists.txt index d3f0b06954b5d3a547cb13495dfb52201ebf0818..eb5e8fcb2507dd0b58bda0c89773cd1c31feaf8b 100644 --- a/Detector/DetCRD/CMakeLists.txt +++ b/Detector/DetCRD/CMakeLists.txt @@ -17,14 +17,17 @@ 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 new file mode 100644 index 0000000000000000000000000000000000000000..43e737a98a7a3d18e1902145b354c2aae07ffc10 --- /dev/null +++ b/Detector/DetCRD/compact/CRD_common_v01/VXD_v02_01.xml @@ -0,0 +1,166 @@ +<lccdd> + <info name="VXD_v02_01" + title="CepC VXD with skewed ladders" + author="H.Zeng, " + url="http://cepc.ihep.ac.cn" + status="developing" + version="v02"> + <comment>CepC vertex detector based on MOST2 project </comment> + </info> + <define> + <constant name="VXD_inner_radius" value="Vertex_inner_radius"/> + <constant name="VXD_outer_radius" value="Vertex_outer_radius"/> + <constant name="VXD_half_length" value="Vertex_half_length"/> + <constant name="VXD_inner_radius_1" value="BeamPipe_VertexRegion_rmax"/> + <constant name="VXD_radius_r1" value="16*mm"/> + <constant name="VXD_radius_r3" value="37*mm"/> + <constant name="VXD_radius_r5" value="58*mm"/> + <constant name="VXD_length_r1" value="62.5*mm"/> + <constant name="VXD_length_r3" value="125*mm"/> + <constant name="VXD_length_r5" value="125*mm"/> + <constant name="VXD_cone_max_z" value="Vertex_half_length-10*mm"/> + <constant name="VXD_cone_min_z" value="VXD_length_r5+10*mm"/> + <!--0.17mm silicon + 1.0mm carbon -> 0.65% of X0--> + <constant name="VXD_sensitive_thickness" value="0.17*mm"/> + <constant name="VXD_support_thickness" value="1*mm"/> + <constant name="VXD_sensor_length" value="30*mm"/> + <constant name="VXD1_inner_radius" value="16*mm"/> + <constant name="VXD2_inner_radius" value="37*mm"/> + <constant name="VXD3_inner_radius" value="58*mm"/> + <constant name="VXD4_inner_radius" value="79*mm"/> + <!-- <constant name="VXD_inner_radius_1" value="VXD_inner_radius + env_safety"/> --> + <!-- <constant name="VXD_outer_radius_1" value="VXD_inner_radius_1/cos(pi/8)"/> --> + <!-- <constant name="VXD_inner_radius_2" value="VXD2_inner_radius"/> --> + <!-- <constant name="VXD_outer_radius" value="OuterTracker_inner_radius"/> --> + <constant name="VXD1_half_length" value="90*mm"/> + <constant name="VXD2_half_length" value="90*mm"/> + <constant name="VXD3_half_length" value="90*mm"/> + <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"/> --> + </define> + + <detectors> + <detector id="DetID_VXD" name="VXDskew" type="SiTrackerSkewBarrel_v01" vis="VXDVis" readout="VXDCollection" insideTrackingVolume="true"> + <!-- <envelope> --> + <!-- <shape type="Assembly"/> --> + <!--shape type="BooleanShape" operation="Union" material="Air" > + <shape type="Tube" rmin="VXD_inner_radius" rmax="VXD_outer_radius_1" dz="VXD_half_length_1" /> + <shape type="Tube" rmin="VXD_inner_radius_2" rmax="VXD_outer_radius" dz="VXD_half_length" /> + </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="Tube" rmin="VXD_inner_radius" rmax="VXD_outer_radius" dz="VXD_half_length" /> + <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"/> + </shape> + <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 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> + </envelope> + + <type_flags type="DetType_TRACKER + DetType_BARREL + DetType_PIXEL "/> + + <reconstruction strip_width="0." strip_length="0." strip_pitch="0." strip_angle="0*deg" /> + + <global sensitive_thickness="VXD_sensitive_thickness" support_thickness="VXD_support_thickness" sensor_length="VXD_sensor_length" + sensitive_mat="G4_Si" support_mat="G4_C" sensitive_threshold_KeV="64*keV" /> + <display ladder="SeeThrough" support="VXDSupportVis" flex="VXDFlexVis" sens_env="SeeThrough" sens="GrayVis" deadsensor="GreenVis" deadwire="RedVis"/> + <!-- <display ladder="SeeThrough" support="BlackVis" flex="VXDFlexVis" sens_env="SeeThrough" sens="GrayVis" deadsensor="GreenVis" deadwire="RedVis"/> --> + <!-- <display ladder="SeeThrough" support="SeeThrough" flex="SeeThrough" sens_env="SeeThrough" sens="YellowVis" deadsensor="GreenVis" deadwire="SeeThrough"/> --> + + <layer layer_id="0" ladder_radius="17.4*mm" ladder_offset="(8.4-1.5)*mm" n_sensors_per_side="VXD1_half_length*2/VXD_sensor_length" + 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> + <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="1" ladder_radius="36.9*mm" ladder_offset="(8.4+5.0)*mm" n_sensors_per_side="VXD2_half_length*2/VXD_sensor_length" + 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> + <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="2" ladder_radius="57.7*mm" ladder_offset="(8.4+9.6)*mm" n_sensors_per_side="VXD3_half_length*2/VXD_sensor_length" + 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> + <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> + + + </detectors> + + <readouts> + <readout name="VXDCollection"> + <id>system:5,side:-2,layer:9,module:8,sensor:8,barrelside:-2</id> + </readout> + </readouts> +</lccdd> diff --git a/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02-onlyTracker.xml b/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02-onlyTracker.xml index 2397761df6e9cb259db958cd691453c9b70f45ed..661b0ff914ef45c3e006aee56dc4af482c596e49 100644 --- a/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02-onlyTracker.xml +++ b/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02-onlyTracker.xml @@ -31,7 +31,7 @@ <include ref="../CRD_common_v01/VXD_v01_01.xml"/> <include ref="../CRD_common_v01/FTD_SkewRing_v01_01.xml"/> <include ref="../CRD_common_v01/SIT_SimplePixel_v01_01.xml"/> - <include ref="../CRD_common_v01/DC_Simple_v01_01.xml"/> + <!-- <include ref="../CRD_common_v01/DC_Simple_v01_01.xml"/> --> <include ref="../CRD_common_v01/SET_SimplePlanar_v01_01.xml"/> <fields> diff --git a/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02.xml b/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02.xml index a508958484d0bd9cce4c894bd6d520d1ad15124e..6b7487a5d8f596123518134197bd91ab7c86a3aa 100644 --- a/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02.xml +++ b/Detector/DetCRD/compact/CRD_o1_v02/CRD_o1_v02.xml @@ -31,15 +31,15 @@ <include ref="../CRD_common_v01/VXD_v01_01.xml"/> <include ref="../CRD_common_v01/FTD_SkewRing_v01_01.xml"/> <include ref="../CRD_common_v01/SIT_SimplePixel_v01_01.xml"/> - <include ref="../CRD_common_v01/DC_Simple_v01_02.xml"/> + <!-- <include ref="../CRD_common_v01/DC_Simple_v01_01.xml"/> --> <include ref="../CRD_common_v01/SET_SimplePlanar_v01_01.xml"/> <include ref="../CRD_common_v01/Ecal_Crystal_Barrel_v01_01.xml"/> <!--include ref="../CRD_common_v01/Ecal_Crystal_Endcap_v01_01.xml"/--> - <include ref="../CRD_common_v01/Coil_Simple_v01_01.xml"/> + <!--include ref="../CRD_common_v01/Coil_Simple_v01_01.xml"/> <include ref="../CRD_common_v01/Hcal_Rpc_Barrel_v01_01.xml"/> <include ref="../CRD_common_v01/Hcal_Rpc_Endcaps_v01_01.xml"/> <include ref="../CRD_common_v01/Yoke_Barrel_v01_01.xml"/> - <include ref="../CRD_common_v01/Yoke_Endcaps_v01_01.xml"/> + <include ref="../CRD_common_v01/Yoke_Endcaps_v01_01.xml"/--> <!--include ref="../CRD_common_v01/Lcal_v01_01.xml"/--> <fields> diff --git a/Detector/DetCRD/compact/CRD_o1_v03/CRD_Dimensions_v01_02.xml b/Detector/DetCRD/compact/CRD_o1_v03/CRD_Dimensions_v01_02.xml new file mode 100644 index 0000000000000000000000000000000000000000..ee6b2b01be22d44412378f133357a1c2e3518c17 --- /dev/null +++ b/Detector/DetCRD/compact/CRD_o1_v03/CRD_Dimensions_v01_02.xml @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + + <info name="CRDDimensions" + title="master file with includes and world dimension" + author="C.D.Fu, Mengyao Liu" + url="no" + status="development" + version="1.0"> + <comment> + undeterminded parameters + </comment> + </info> + + <define> + <constant name="CrossingAngle" value="0.033*rad"/> + + <constant name="Global_endcap_costheta" value="0.99"/> + + <constant name="GlobalTrackerReadoutID_DCH" type="string" value="system:8,chamber:1,layer:7,phi:16"/> + <constant name="GlobalTrackerReadoutID" type="string" value="system:5,side:-2,layer:9,module:8,sensor:8,barrelside:-2"/> + + <constant name="Field_nominal_value" value="3*tesla"/> + <constant name="Field_outer_nominal_value" value="-1.3*tesla"/> + + <constant name="env_safety" value="0.1*mm"/> + + <constant name="DetID_NOTUSED" value=" 0"/> + <constant name="DetID_VXD" value=" 1"/> + <constant name="DetID_SIT" value=" 2"/> + <constant name="DetID_FTD" value=" 3"/> + <constant name="DetID_TPC" value=" 4"/> + <constant name="DetID_SET" value=" 5"/> + <constant name="DetID_ETD" value=" 6"/> + <constant name="DetID_DC" value=" 4"/> <!--in order to cheat Clupatra, same as TPC--> + + <constant name="DetID_ECAL" value=" 20"/> + <constant name="DetID_ECAL_PLUG" value=" 21"/> + <constant name="DetID_HCAL" value=" 22"/> + <constant name="DetID_HCAL_RING" value=" 23"/> + <constant name="DetID_LCAL" value=" 24"/> + <constant name="DetID_BCAL" value=" 25"/> + <constant name="DetID_LHCAL" value=" 26"/> + <constant name="DetID_YOKE" value=" 27"/> + <constant name="DetID_COIL" value=" 28"/> + <constant name="DetID_ECAL_ENDCAP" value=" 29"/> + <constant name="DetID_HCAL_ENDCAP" value=" 30"/> + <constant name="DetID_YOKE_ENDCAP" value=" 31"/> + + <constant name="DetID_bwd" value="-1"/> + <constant name="DetID_barrel" value=" 0"/> + <constant name="DetID_fwd" value="+1"/> + + <constant name="BeamPipe_Be_inner_thickness" value="0.5*mm"/> + <constant name="BeamPipe_Cooling_thickness" value="0.5*mm"/> + <constant name="BeamPipe_Be_outer_thickness" value="0.3*mm"/> + <constant name="BeamPipe_Be_total_thickness" value="BeamPipe_Be_inner_thickness+BeamPipe_Cooling_thickness+BeamPipe_Be_outer_thickness"/> + <constant name="BeamPipe_Al_thickness" value="BeamPipe_Be_total_thickness"/> + <constant name="BeamPipe_Cu_thickness" value="2.0*mm"/> + + <constant name="BeamPipe_CentralBe_zmax" value="120*mm"/> + <constant name="BeamPipe_CentralAl_zmax" value="205*mm"/> + <constant name="BeamPipe_ConeAl_zmax" value="655*mm"/> + <constant name="BeamPipe_LinkerAl_zmax" value="700*mm"/> + <constant name="BeamPipe_LinkerCu_zmax" value="780*mm"/> + <constant name="BeamPipe_Waist_zmax" value="805*mm"/> + <constant name="BeamPipe_Crotch_zmax" value="855*mm"/> + <constant name="BeamPipe_FirstSeparated_zmax" value="1110*mm"/> + <constant name="BeamPipe_SecondSeparated_zmax" value="2200*mm"/> + <constant name="BeamPipe_end_z" value="12*m"/> + + <constant name="BeamPipe_Central_inner_radius" value="14*mm"/> + <constant name="BeamPipe_Expanded_inner_radius" value="20*mm"/> + <constant name="BeamPipe_Upstream_inner_radius" value="6*mm"/> + <constant name="BeamPipe_Dnstream_inner_radius" value="10*mm"/> + <constant name="BeamPipe_Crotch_hole_height" value="30.67*mm"/> + <constant name="BeamPipe_VertexRegion_rmax" value="BeamPipe_Central_inner_radius+BeamPipe_Al_thickness"/> + <constant name="BeamPipe_ForwardRegion_rmax" value="BeamPipe_Expanded_inner_radius+BeamPipe_Cu_thickness"/> + + <constant name="Vertex_inner_radius" value="BeamPipe_Central_inner_radius+BeamPipe_Be_total_thickness"/> + <constant name="Vertex_outer_radius" value="101*mm"/> + <constant name="Vertex_half_length" value="200*mm"/> + + <constant name="DC_Endcap_dz" value="0.1*mm"/> + <constant name="DC_half_length" value="2980*mm" /> + <constant name="DC_safe_distance" value="0.02*mm"/> + <constant name="SDT_inner_wall_thickness" value="0.2*mm"/> + <constant name="SDT_outer_wall_thickness" value="2.8*mm"/> + <constant name="MainTracker_half_length" value="DC_half_length+DC_Endcap_dz" /> + + <!--obselete for single drift chamber--> + <constant name="InnerTracker_half_length" value="DC_half_length" /> + <constant name="InnerTracker_inner_radius" value="234*mm"/> + <constant name="InnerTracker_outer_radius" value="909*mm"/> + <constant name="OuterTracker_half_length" value="DC_half_length"/> + <constant name="OuterTracker_inner_radius" value="1082.18*mm"/> + <constant name="OuterTracker_outer_radius" value="1723*mm"/> + + <!-- Parameters of single drift chamber --> + <constant name="DC_chamber_layer_rbegin" value="800*mm"/> + <constant name="DC_chamber_layer_rend" value="1800*mm"/> + + <constant name="DC_inner_radius" value="DC_chamber_layer_rbegin-SDT_inner_wall_thickness-DC_safe_distance"/> + <constant name="DC_outer_radius" value="DC_chamber_layer_rend+SDT_outer_wall_thickness+DC_safe_distance"/> + + <constant name="SIT1_inner_radius" value="230*mm"/> + <constant name="SIT2_inner_radius" value="410*mm"/> + <constant name="SIT3_inner_radius" value="590*mm"/> + <constant name="SIT4_inner_radius" value="770*mm"/> + <constant name="SIT1_half_length" value="461*mm"/> + <constant name="SIT2_half_length" value="691*mm"/> + <constant name="SIT3_half_length" value="1013*mm"/> + <constant name="SIT4_half_length" value="1335*mm"/> + + <constant name="SET_inner_radius" value="1815*mm"/> + + <constant name="SiTracker_barrel_endcap_gap" value="5*mm"/> + <constant name="SiTracker_DC_endcap_gap" value="10*mm"/> + <constant name="SiTracker_endcap_z1" value="SIT1_half_length+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_z2" value="SIT2_half_length+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_z3" value="SIT3_half_length+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_z4" value="SIT4_half_length+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_z5" value="MainTracker_half_length+SiTracker_DC_endcap_gap"/> + <constant name="SiTracker_endcap_outer_radius1" value="SIT1_inner_radius+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_outer_radius2" value="SIT2_inner_radius+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_outer_radius3" value="SIT3_inner_radius+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_outer_radius4" value="SIT4_inner_radius+SiTracker_barrel_endcap_gap"/> + <constant name="SiTracker_endcap_outer_radius5" value="SET_inner_radius+SiTracker_barrel_endcap_gap"/> + <!--obseleted --> + <constant name="FTD_BeamPipe_cable_clearance" value="10*mm"/> + <constant name="FTD_BeamPipe_gap" value="15*mm"/> + <constant name="FTD_InnerTracker_gap" value="5*mm"/> + + <!--obseleted constance, used by old construct, should be removed while creating new constrcut--> + <constant name="TPC_Ecal_Hcal_barrel_halfZ" value="MainTracker_half_length"/> + <constant name="TPC_inner_radius" value="InnerTracker_inner_radius"/> + <constant name="TPC_outer_radius" value="OuterTracker_outer_radius"/> + <constant name="SIT1_Radius" value="SIT1_inner_radius"/> + <constant name="SIT1_Half_Length_Z" value="SIT1_half_length"/> + <constant name="SIT2_Radius" value="InnerTracker_inner_radius"/> <!--fake, used by FTD_Simple_Staggered and FTD_cepc, now should be determined by inner tracker--> + <constant name="SIT2_Half_Length_Z" value="SIT2_half_length"/> + <constant name="TUBE_IPOuterTube_end_z" value="BeamPipe_CentralAl_zmax"/> + <constant name="TUBE_IPOuterTube_end_radius" value="BeamPipe_Central_inner_radius+BeamPipe_Al_thickness"/> + <constant name="TUBE_IPOuterBulge_end_z" value="BeamPipe_Crotch_zmax"/><!--"BeamPipe_ConeAl_zmax"/--> + <constant name="TUBE_IPOuterBulge_end_radius" value="BeamPipe_Crotch_zmax*tan(CrossingAngle/2)+BeamPipe_Dnstream_inner_radius+BeamPipe_Cu_thickness"/> + <!--"BeamPipe_Expanded_inner_radius+BeamPipe_Al_thickness+5*mm"/--> + + <constant name="Ecal_barrel_inner_radius" value="1900*mm"/> + <constant name="Ecal_barrel_thickness" value="280*mm"/> + <constant name="Ecal_barrel_outer_radius" value="(Ecal_barrel_inner_radius+Ecal_barrel_thickness)/cos(pi/8)"/> + <constant name="Ecal_barrel_half_length" value="3350*mm"/> + <constant name="Ecal_barrel_symmetry" value="8"/> + + <constant name="Ecal_endcap_inner_radius" value="350*mm"/> + <constant name="Ecal_endcap_outer_radius" value="Ecal_barrel_inner_radius+Ecal_barrel_thickness"/> + <constant name="Ecal_endcap_zmin" value="3050*mm"/> + <constant name="Ecal_endcap_zmax" value="3350*mm"/> + <constant name="Ecal_endcap_symmetry" value="8"/> + <!--obseleted constance, used by old construct, should be removed while creating new constrcut--> + <constant name="EcalEndcap_outer_radius" value="Ecal_barrel_outer_radius"/> + + <constant name="Solenoid_inner_radius" value="2330*mm"/> + <constant name="Solenoid_outer_radius" value="2480*mm"/> + <constant name="Solenoid_half_length" value="3830*mm"/> + <constant name="SolenoidCoil_half_length" value="3800*mm"/> + <constant name="SolenoidCoil_radius" value="2351*mm"/> + <constant name="SolenoidCoil_center_radius" value="(Solenoid_inner_radius+Solenoid_outer_radius)/2"/> + + <constant name="Hcal_barrel_inner_radius" value="2530*mm"/> + <constant name="Hcal_barrel_outer_radius" value="3610*mm"/> + <constant name="Hcal_barrel_half_length" value="4480*mm"/> + <constant name="Hcal_barrel_symmetry" value="8"/> + + <constant name="Hcal_endcap_inner_radius" value="400*mm"/> + <constant name="Hcal_endcap_outer_radius" value="Hcal_barrel_outer_radius"/> + <constant name="Hcal_endcap_zmin" value="3400*mm"/> + <constant name="Hcal_endcap_zmax" value="4480*mm"/> + <constant name="Hcal_endcap_symmetry" value="8"/> + <!--obseleted constance, used by old construct, should be removed while creating new constrcut--> + <constant name="HcalEndcap_max_z" value="Hcal_endcap_zmax"/> + <constant name="Hcal_endcap_outer_symmetry" value="Hcal_endcap_symmetry"/> + <constant name="Hcal_outer_radius" value="Hcal_barrel_outer_radius"/> + + <!--constant name="Hcal_ring_inner_radius" value="Hcal_endcap_inner_radius"/> + <constant name="Hcal_ring_outer_radius" value="Solenoid_inner_radius"/> + <constant name="Hcal_ring_zmin" value="2600*mm"/> + <constant name="Hcal_ring_zmax" value="Hcal_endcap_zmin-10*mm"/> + <constant name="Hcal_ring_symmetry" value="8"/--> + + <constant name="Yoke_barrel_inner_radius" value="3660*mm"/> + <constant name="Yoke_barrel_outer_radius" value="4260*mm"/> + <constant name="Yoke_barrel_half_length" value="Hcal_endcap_zmax"/> + <constant name="Yoke_barrel_symmetry" value="8"/> + + <constant name="Yoke_endcap_inner_radius" value="400*mm"/> + <constant name="Yoke_endcap_outer_radius" value="Yoke_barrel_outer_radius"/> + <constant name="Yoke_endcap_zmin" value="4660*mm"/> + <constant name="Yoke_endcap_zmax" value="5460*mm"/> + <constant name="Yoke_endcap_outer_symmetry" value="8"/> + <constant name="Yoke_endcap_inner_symmetry" value="0"/> + <!--obseleted constance, used by old construct, should be removed while creating new constrcut--> + <constant name="Yoke_Z_start_endcaps" value="Yoke_endcap_zmin"/> + + <!--constant name="LumiCal_zmax" value="805*mm" /> + <constant name="LumiCal_zmin" value="700*mm"/> + <constant name="LumiCal_thickness" value="(LumiCal_zmax-LumiCal_zmin)/2.0"/> + <constant name="LumiCal_inner_radius" value="35.0*mm"/> + <constant name="LumiCal_outer_radius" value="100.0*mm- env_safety"/--> + + <constant name="tracker_region_zmax" value="OuterTracker_half_length"/> + <constant name="tracker_region_rmax" value="OuterTracker_outer_radius"/> + + </define> + + <limits> + <limitset name="cal_limits"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> + </limitset> + <limitset name="dc_limits"> + <limit name="step_length_max" particles="*" value="10.0" unit="mm" /> + </limitset> + <limitset name="tracker_limits"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> + </limitset> + </limits> + + <regions> + <region name="BeampipeRegion"/> + <region name="VertexRegion"/> + <region name="ForwardRegion"/> + </regions> + + <display> + <vis name="VXDVis" alpha="0.1" r="0.1" g=".5" b=".5" showDaughters="true" visible="true"/> + <vis name="VXDLayerVis" alpha="1.0" r="0.1" g=".5" b=".5" showDaughters="true" visible="true"/> + <vis name="VXDSupportVis" alpha="1.0" r="0.1" g="0.1" b="0.1" showDaughters="true" visible="true"/> + <vis name="VXDFlexVis" alpha="1.0" r="1.0" g="0.5" b="0.0" showDaughters="true" visible="true"/> + <vis name="FTDVis" alpha="1.0" r="0.5" g="0.87" b="0.11" showDaughters="true" visible="true"/> + <vis name="FTDSupportVis" alpha="1.0" r="0.3" g="0.3" b="1.0" showDaughters="true" visible="true"/> + <vis name="FTDSensitiveVis" alpha="1.0" r="0.3" g="0.5" b="1.0" showDaughters="true" visible="true"/> + <vis name="DCVis" alpha="1.0" r="0.96" g="0.64" b="0.90" showDaughters="true" visible="true"/> + <vis name="DCLayerVis" alpha="1.0" r="0.96" g="0.64" b="0.90" showDaughters="false" visible="true"/> + <vis name="SITVis" alpha="0.0" r="0.54" g="0.59" b="0.93" showDaughters="true" visible="false"/> + <vis name="SITSupportVis" alpha="1.0" r="0.0" g="0.0" b="1.0" showDaughters="false" visible="true"/> + <vis name="SITSensitiveVis" alpha="1.0" r="0.67" g="0.99" b="0.78" showDaughters="false" visible="true"/> + <vis name="SETVis" alpha="0.0" r="0.8" g="0.8" b="0.4" showDaughters="true" visible="false"/> + <vis name="SETSupportVis" alpha="1.0" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="SETSensitiveVis" alpha="1.0" r="0.0" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="ECALVis" alpha="1.0" r="0.2" g="0.6" b="0" showDaughters="true" visible="true"/> + <vis name="HCALVis" alpha="1.0" r="0.95" g="0.78" b="0.69" showDaughters="true" visible="true"/> + <vis name="SOLVis" alpha="1.0" r="0.4" g="0.4" b="0.4" showDaughters="true" visible="true"/> + <vis name="YOKEVis" alpha="1.0" r="0.64" g="0.75" b="0.99" showDaughters="false" visible="true"/> + <vis name="LCALVis" alpha="1.0" r="0.25" g="0.88" b="0.81" showDaughters="true" visible="true"/> + <vis name="SupportVis" alpha="1.0" r="0.2" g="0.2" b="0.2" showDaughters="true" visible="true"/> + <vis name="ShellVis" alpha="1.0" r="0.83" g="0.55" b="0.89" showDaughters="false" visible="true"/> + + <vis name="WhiteVis" alpha="0.0" r=".96" g=".96" b=".96" showDaughters="true" visible="true"/> + <vis name="LightGrayVis" alpha="0.0" r=".75" g=".75" b=".75" showDaughters="true" visible="true"/> + <vis name="Invisible" alpha="0.0" r="0.0" g="0.0" b="0.0" showDaughters="false" visible="false"/> + <vis name="SeeThrough" alpha="0.0" r="0.0" g="0.0" b="0.0" showDaughters="true" visible="false"/> + <vis name="RedVis" alpha="1.0" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="GreenVis" alpha="1.0" r="0.0" g="1.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="BlueVis" alpha="1.0" r="0.0" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="CyanVis" alpha="1.0" r="0.0" g="1.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="MagentaVis" alpha="1.0" r="1.0" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="YellowVis" alpha="1.0" r="1.0" g="1.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="BlackVis" alpha="1.0" r="0.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="GrayVis" alpha="1.0" r="0.5" g="0.5" b="0.5" showDaughters="true" visible="true"/> + </display> + +</lccdd> diff --git a/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03-onlyTracker.xml b/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03-onlyTracker.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c08a950232fc30df168820f7290b54bafa9f03c --- /dev/null +++ b/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03-onlyTracker.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + <info name="CRD_o1_v02" + title="CepC reference detctor with coil inside Hcal, pixel SIT and strip SET" + author="C.D.Fu, " + url="http://cepc.ihep.ac.cn" + status="developing" + version="v02"> + <comment>CepC reference detector simulation models used for detector study </comment> + </info> + + <includes> + <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> + <gdmlFile ref="../CRD_common_v01/materials.xml"/> + <gdmlFile ref="../materials.xml"/> + </includes> + + <define> + <constant name="world_size" value="25*m"/> + <constant name="world_x" value="world_size"/> + <constant name="world_y" value="world_size"/> + <constant name="world_z" value="world_size"/> + + <include ref="${DD4hepINSTALL}/DDDetectors/compact/detector_types.xml"/> + </define> + + <include ref="./CRD_Dimensions_v01_02.xml"/> + + <include ref="../CRD_common_v01/Beampipe_v01_01.xml"/> + <include ref="../CRD_common_v01/VXD_v02_01.xml"/> + <include ref="../CRD_common_v01/FTD_SkewRing_v01_01.xml"/> + <include ref="../CRD_common_v01/SIT_SimplePixel_v01_01.xml"/> + <!-- <include ref="../CRD_common_v01/DC_Simple_v01_01.xml"/> --> + <include ref="../CRD_common_v01/SET_SimplePlanar_v01_01.xml"/> + + <fields> + <field name="InnerSolenoid" type="solenoid" + inner_field="Field_nominal_value" + outer_field="0" + zmax="SolenoidCoil_half_length" + inner_radius="SolenoidCoil_center_radius" + outer_radius="Solenoid_outer_radius"> + </field> + <field name="OuterSolenoid" type="solenoid" + inner_field="0" + outer_field="Field_outer_nominal_value" + zmax="SolenoidCoil_half_length" + inner_radius="Solenoid_outer_radius" + outer_radius="Yoke_barrel_inner_radius"> + </field> + </fields> + +</lccdd> diff --git a/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03-onlyVXD.xml b/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03-onlyVXD.xml new file mode 100644 index 0000000000000000000000000000000000000000..36943247d2cc253b7fb923be4f697fc16ed52a48 --- /dev/null +++ b/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03-onlyVXD.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + <info name="CRD_o1_v02" + title="CepC reference detctor with coil inside Hcal, pixel SIT and strip SET" + author="C.D.Fu, " + url="http://cepc.ihep.ac.cn" + status="developing" + version="v02"> + <comment>CepC reference detector simulation models used for detector study </comment> + </info> + + <includes> + <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> + <gdmlFile ref="../CRD_common_v01/materials.xml"/> + <gdmlFile ref="../materials.xml"/> + </includes> + + <define> + <constant name="world_size" value="25*m"/> + <constant name="world_x" value="world_size"/> + <constant name="world_y" value="world_size"/> + <constant name="world_z" value="world_size"/> + + <include ref="${DD4hepINSTALL}/DDDetectors/compact/detector_types.xml"/> + </define> + + <include ref="./CRD_Dimensions_v01_02.xml"/> + + <!-- <include ref="../CRD_common_v01/Beampipe_v01_01.xml"/> --> + <include ref="../CRD_common_v01/VXD_v02_01.xml"/> + <!-- <include ref="../CRD_common_v01/FTD_SkewRing_v01_01.xml"/> --> + <!-- <include ref="../CRD_common_v01/SIT_SimplePixel_v01_01.xml"/> --> + <!-- <include ref="../CRD_common_v01/DC_Simple_v01_01.xml"/> --> + <!-- <include ref="../CRD_common_v01/SET_SimplePlanar_v01_01.xml"/> --> + + <fields> + <field name="InnerSolenoid" type="solenoid" + inner_field="Field_nominal_value" + outer_field="0" + zmax="SolenoidCoil_half_length" + inner_radius="SolenoidCoil_center_radius" + outer_radius="Solenoid_outer_radius"> + </field> + <field name="OuterSolenoid" type="solenoid" + inner_field="0" + outer_field="Field_outer_nominal_value" + zmax="SolenoidCoil_half_length" + inner_radius="Solenoid_outer_radius" + outer_radius="Yoke_barrel_inner_radius"> + </field> + </fields> + +</lccdd> diff --git a/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03.xml b/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03.xml new file mode 100644 index 0000000000000000000000000000000000000000..3083b13906a3c01f120e26ec1723922a03ff35ff --- /dev/null +++ b/Detector/DetCRD/compact/CRD_o1_v03/CRD_o1_v03.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + <info name="CRD_o1_v02" + title="CepC reference detctor with coil inside Hcal, pixel SIT and strip SET" + author="C.D.Fu, " + url="http://cepc.ihep.ac.cn" + status="developing" + version="v02"> + <comment>CepC reference detector simulation models used for detector study </comment> + </info> + + <includes> + <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> + <gdmlFile ref="../CRD_common_v01/materials.xml"/> + <gdmlFile ref="../materials.xml"/> + </includes> + + <define> + <constant name="world_size" value="25*m"/> + <constant name="world_x" value="world_size"/> + <constant name="world_y" value="world_size"/> + <constant name="world_z" value="world_size"/> + + <include ref="${DD4hepINSTALL}/DDDetectors/compact/detector_types.xml"/> + </define> + + <include ref="./CRD_Dimensions_v01_02.xml"/> + + <include ref="../CRD_common_v01/Beampipe_v01_01.xml"/> + <include ref="../CRD_common_v01/VXD_v02_01.xml"/> + <include ref="../CRD_common_v01/FTD_SkewRing_v01_01.xml"/> + <include ref="../CRD_common_v01/SIT_SimplePixel_v01_01.xml"/> + <!-- <include ref="../CRD_common_v01/DC_Simple_v01_01.xml"/> --> + <include ref="../CRD_common_v01/SET_SimplePlanar_v01_01.xml"/> + <include ref="../CRD_common_v01/Ecal_Crystal_Barrel_v01_01.xml"/> + <!--include ref="../CRD_common_v01/Ecal_Crystal_Endcap_v01_01.xml"/--> + <!--include ref="../CRD_common_v01/Coil_Simple_v01_01.xml"/> + <include ref="../CRD_common_v01/Hcal_Rpc_Barrel_v01_01.xml"/> + <include ref="../CRD_common_v01/Hcal_Rpc_Endcaps_v01_01.xml"/> + <include ref="../CRD_common_v01/Yoke_Barrel_v01_01.xml"/> + <include ref="../CRD_common_v01/Yoke_Endcaps_v01_01.xml"/--> + <!--include ref="../CRD_common_v01/Lcal_v01_01.xml"/--> + + <fields> + <field name="InnerSolenoid" type="solenoid" + inner_field="Field_nominal_value" + outer_field="0" + zmax="SolenoidCoil_half_length" + inner_radius="SolenoidCoil_center_radius" + outer_radius="Solenoid_outer_radius"> + </field> + <field name="OuterSolenoid" type="solenoid" + inner_field="0" + outer_field="Field_outer_nominal_value" + zmax="SolenoidCoil_half_length" + inner_radius="Solenoid_outer_radius" + outer_radius="Yoke_barrel_inner_radius"> + </field> + </fields> + +</lccdd> diff --git a/Detector/DetCRD/scripts/CRD-Sim.py b/Detector/DetCRD/scripts/CRD-Sim.py index 0e734b785f0c6442b320bc75e43c3d10472bc8a5..09a8e488c135927e3ee567be5e002c95752bcf7e 100644 --- a/Detector/DetCRD/scripts/CRD-Sim.py +++ b/Detector/DetCRD/scripts/CRD-Sim.py @@ -89,23 +89,6 @@ detsimalg.AnaElems = [ ] detsimalg.RootDetElem = "WorldDetElemTool" -dedxoption = "BetheBlochEquationDedxSimTool" -from Configurables import DriftChamberSensDetTool -dc_sensdettool = DriftChamberSensDetTool("DriftChamberSensDetTool") -dc_sensdettool.DedxSimTool = dedxoption - -from Configurables import DummyDedxSimTool -from Configurables import BetheBlochEquationDedxSimTool - -if dedxoption == "DummyDedxSimTool": - dedx_simtool = DummyDedxSimTool("DummyDedxSimTool") -elif dedxoption == "BetheBlochEquationDedxSimTool": - dedx_simtool = BetheBlochEquationDedxSimTool("BetheBlochEquationDedxSimTool") - dedx_simtool.material_Z = 2 - dedx_simtool.material_A = 4 - dedx_simtool.scale = 10 - dedx_simtool.resolution = 0.0001 - # output from Configurables import PodioOutput out = PodioOutput("outputalg") @@ -117,7 +100,7 @@ from Configurables import ApplicationMgr ApplicationMgr( TopAlg = [genalg, detsimalg, out], EvtSel = 'NONE', - EvtMax = 100, + EvtMax = 10000, ExtSvc = [rndmengine, rndmgensvc, dsvc, geosvc], OutputLevel=INFO ) diff --git a/Detector/DetCRD/scripts/CRD_skewVXD-Sim.py b/Detector/DetCRD/scripts/CRD_skewVXD-Sim.py new file mode 100644 index 0000000000000000000000000000000000000000..1ad0017d9027e71a589afa47c3deb3745c963185 --- /dev/null +++ b/Detector/DetCRD/scripts/CRD_skewVXD-Sim.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +from Gaudi.Configuration import * + +from Configurables import k4DataSvc +dsvc = k4DataSvc("EventDataSvc") + +from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ + +seed = [10] +# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi +rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_("RndmGenSvc.Engine") # The default engine in Geant4 +rndmengine.SetSingleton = True +rndmengine.Seeds = seed + +rndmgensvc = RndmGenSvc("RndmGenSvc") +rndmgensvc.Engine = rndmengine.name() + +#geometry_option = "CRD_o1_v01/CRD_o1_v01.xml" +geometry_option = "CRD_o1_v03/CRD_o1_v03.xml" +#... + +if not os.getenv("DETCRDROOT"): + print("Can't find the geometry. Please setup envvar DETCRDROOT." ) + sys.exit(-1) + +geometry_path = os.path.join(os.getenv("DETCRDROOT"), "compact", geometry_option) +if not os.path.exists(geometry_path): + print("Can't find the compact geometry file: %s"%geometry_path) + sys.exit(-1) + +from Configurables import GeomSvc +geosvc = GeomSvc("GeomSvc") +geosvc.compact = geometry_path + +############################################################################## +# Physics Generator +############################################################################## +from Configurables import GenAlgo +from Configurables import GtGunTool +from Configurables import StdHepRdr +from Configurables import SLCIORdr +from Configurables import HepMCRdr +from Configurables import GenPrinter +gun = GtGunTool("GtGunTool") +gun.Particles = ["mu-"] +#gun.Particles = ["nu_e"] +#gun.PositionXs = [0] +#gun.PositionYs = [0] +#gun.PositionZs = [0] +gun.EnergyMins = [100.] # GeV +gun.EnergyMaxs = [100.] # GeV +gun.ThetaMins = [0] # deg +gun.ThetaMaxs = [180] # deg +gun.PhiMins = [0] # deg +gun.PhiMaxs = [360] # deg +# stdheprdr = StdHepRdr("StdHepRdr") +# stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep" +# lciordr = SLCIORdr("SLCIORdr") +# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio" +# hepmcrdr = HepMCRdr("HepMCRdr") +# hepmcrdr.Input = "example_UsingIterators.txt" + +genprinter = GenPrinter("GenPrinter") + +genalg = GenAlgo("GenAlgo") +genalg.GenTools = ["GtGunTool"] +#genalg.GenTools = ["StdHepRdr"] +# genalg.GenTools = ["StdHepRdr", "GenPrinter"] +# genalg.GenTools = ["SLCIORdr", "GenPrinter"] +# genalg.GenTools = ["HepMCRdr", "GenPrinter"] + +############################################################################## +# Detector Simulation +############################################################################## +from Configurables import DetSimSvc +detsimsvc = DetSimSvc("DetSimSvc") + +from Configurables import DetSimAlg +detsimalg = DetSimAlg("DetSimAlg") +detsimalg.RandomSeeds = seed +# detsimalg.VisMacs = ["vis.mac"] +detsimalg.RunCmds = [ +# "/tracking/verbose 1", +] +detsimalg.AnaElems = [ + # example_anatool.name() +# "ExampleAnaElemTool", + "Edm4hepWriterAnaElemTool" +] +detsimalg.RootDetElem = "WorldDetElemTool" + +# output +from Configurables import PodioOutput +out = PodioOutput("outputalg") +out.filename = "CRD-skewVXD-Sim-100.root" +out.outputCommands = ["keep *"] + +# ApplicationMgr +from Configurables import ApplicationMgr +ApplicationMgr( + TopAlg = [genalg, detsimalg, out], + EvtSel = 'NONE', + EvtMax = 500, + ExtSvc = [rndmengine, rndmgensvc, dsvc, geosvc], + OutputLevel=INFO +) diff --git a/Detector/DetCRD/src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp b/Detector/DetCRD/src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e78fa02eeecd1a8f240c5780d9013a377640e9d3 --- /dev/null +++ b/Detector/DetCRD/src/Tracker/SiTrackerSkewBarrel_v01_geo.cpp @@ -0,0 +1,370 @@ +//==================================================================== +// cepcvxdgeo - CEPC vertex detector models in DD4hep +//-------------------------------------------------------------------- +// Hao Zeng, IHEP +// email: zenghao@ihep.ac.cn +// $Id$ +//==================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DD4hepUnits.h" +#include "DD4hep/DetType.h" +#include "DDRec/Surface.h" +#include "DDRec/DetectorData.h" +#include "XML/Utilities.h" +#include "XMLHandlerDB.h" +#include <cmath> + +using namespace std; + +using dd4hep::Box; +using dd4hep::DetElement; +using dd4hep::Material; +using dd4hep::Position; +using dd4hep::RotationY; +using dd4hep::RotationZYX; +using dd4hep::Transform3D; +using dd4hep::Rotation3D; +using dd4hep::Volume; +using dd4hep::_toString; +using dd4hep::rec::volSurfaceList; +using dd4hep::rec::ZPlanarData; +using dd4hep::mm; + +/** helper struct */ +struct VXD_Layer { + int n_ladders; + int n_sensors_per_ladder; + double sensor_length; + double half_z; + double sensitive_inner_radius ; + double support_inner_radius ; + double ladder_width ; + double ladder_dphi ; +}; + +//std::vector<VXD_Layer> _VXD_Layers; + +// /** helper struct */ +// struct extended_reconstruction_parameters { +// double sensor_length_mm; +// double strip_width_mm; +// double strip_length_mm; +// double strip_pitch_mm; +// double strip_angle_deg; +// }; + +//extended_reconstruction_parameters _e_r_p; + + +/** Construction of the VXD detector, ported from Mokka driver SIT_Simple_Pixel.cc + * + * Mokka History: + * Feb 7th 2011, Steve Aplin - original version + * F.Gaede, DESY, Jan 2014 - dd4hep SIT pixel + + * @author Hao Zeng, IHEP, July 2021 + */ +static dd4hep::Ref_t create_element(dd4hep::Detector& theDetector, xml_h e, dd4hep::SensitiveDetector sens) { + + xml_det_t x_det = e; + Material air = theDetector.air(); + int det_id = x_det.id(); + string name = x_det.nameStr(); + DetElement vxd(name, det_id); + + Volume envelope = dd4hep::xml::createPlacedEnvelope(theDetector, e, vxd); + dd4hep::xml::setDetectorTypeFlag(e, vxd) ; + if(theDetector.buildType()==dd4hep::BUILD_ENVELOPE) return vxd; + envelope.setVisAttributes(theDetector.visAttributes("SeeThrough")); + + sens.setType("tracker"); + std::cout << " ** building SiTrackerSkewBarrel_v01 ..." << std::endl ; + + 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"); + + + 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"); + + 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 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; + + std::cout << "sensitive_radius: " << sensitive_radius/mm << " mm" << endl; + std::cout << "n_sensors_per_ladder: " << n_sensors_per_ladder << endl; + + std::string layerName = dd4hep::_toString( layer_id , "layer_%d" ); + dd4hep::Assembly layer_assembly( layerName ) ; + pv = envelope.placeVolume( layer_assembly ) ; + dd4hep::DetElement layerDE( vxd , layerName , x_det.id() ); + layerDE.setPlacement( pv ) ; + + const double ladder_dphi = ( dd4hep::twopi / n_ladders ) ; + std::cout << "ladder_dphi: " << ladder_dphi << endl; + + //fetch the ladder parameters + xml_comp_t x_ladder(x_layer.child(_Unicode(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")); + 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; + + //fetch the flex parameters + double flex_thickness(0); + 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; + } + 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")); + + std::cout << "n_sensors_per_side: " << n_sensors_per_side << endl; + std::cout << "dead_gap: " << dead_gap/mm << " mm" << endl; + std::cout << "sensor_thickness: " << sensor_thickness/mm << " mm" << endl; + std::cout << "sensor_active_len: " << sensor_active_len/mm << " mm" << endl; + std::cout << "sensor_active_width: " << sensor_active_width/mm << " mm" << endl; + std::cout << "sensor_dead_width: " << sensor_dead_width/mm << " mm" << endl; + + //create ladder logical volume + Box LadderSolid((support_height+2*sensor_thickness+2*flex_thickness)/2.0, + support_width / 2.0, support_length / 2.0); + Volume LadderLogical(name + dd4hep::_toString( layer_id, "_LadderLogical_%02d"), + LadderSolid, air); + // create flex envelope logical volume + Box FlexEnvelopeSolid(flex_thickness / 2.0, flex_width / 2.0, flex_length / 2.0); + Volume FlexEnvelopeLogical(name + dd4hep::_toString( layer_id, "_FlexEnvelopeLogical_%02d"), FlexEnvelopeSolid, air); + FlexEnvelopeLogical.setVisAttributes(theDetector.visAttributes("SeeThrough")); + //vxd.setVisAttributes(theDetector, flexVis, FlexEnvelopeLogical); + + //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); + 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; + index++; + } + + //place the flex envelope inside the ladder envelope + pv = LadderLogical.placeVolume(FlexEnvelopeLogical, Position((support_height + flex_thickness) / 2.0, 0., 0.)); //top side + //define the transformation3D(only need a combination of translation and rotation) + Transform3D tran_mirro(RotationZYX(0., dd4hep::twopi/2.0, 0.), Position(-(support_height + flex_thickness) / 2.0, 0., 0.)); + pv = LadderLogical.placeVolume(FlexEnvelopeLogical, tran_mirro); //bottom side + + //create sensor envelope logical volume + Box SensorTopEnvelopeSolid(sensor_thickness / 2.0, support_width / 2.0, support_length / 2.0); + Volume SensorTopEnvelopeLogical(name + dd4hep::_toString( layer_id, "_SensorEnvelopeLogical_%02d"), SensorTopEnvelopeSolid, air); + Box SensorBottomEnvelopeSolid(sensor_thickness / 2.0, support_width / 2.0, support_length / 2.0); + Volume SensorBottomEnvelopeLogical(name + dd4hep::_toString( layer_id, "_SensorEnvelopeLogical_%02d"), SensorBottomEnvelopeSolid, air); + SensorTopEnvelopeLogical.setVisAttributes(theDetector.visAttributes(sensEnvVis)); + + //create sensor logical volume + Box SensorSolid(sensor_thickness / 2.0, sensor_active_width / 2.0, sensor_active_len / 2.0); + Volume SensorLogical(name + dd4hep::_toString( layer_id, "_SensorLogical_%02d"), SensorSolid, sensor_mat); + SensorLogical.setSensitiveDetector(sens); + //vxd.setVisAttributes(theDetector, deadsensVis, SensorDeadLogical); + SensorLogical.setVisAttributes(theDetector.visAttributes(sensVis)); + + //create dead sensor logical volume + Box SensorDeadSolid(sensor_thickness / 2.0, sensor_dead_width / 2.0, sensor_active_len / 2.0); + Volume SensorDeadLogical(name + dd4hep::_toString( layer_id, "_SensorDeadLogical_%02d"), SensorDeadSolid, sensor_mat); + SensorDeadLogical.setVisAttributes(theDetector.visAttributes(deadsensVis)); + + //create dead wire logical volume + Box SensorDeadWireSolid(sensor_deadwire_thickness / 2.0, sensor_deadwire_width / 2.0, sensor_deadwire_length / 2.0); + Volume SensorDeadWireLogical(name + dd4hep::_toString( layer_id, "_SensorDeadWireLogical_%02d"), SensorDeadWireSolid, sensor_deadwire_mat); + SensorDeadWireLogical.setVisAttributes(theDetector.visAttributes(deadwireVis)); + + //place the dead wire in the sensor envelope + // pv = SensorTopEnvelopeLogical.placeVolume(SensorDeadWireLogical, Position(0.0, (sensor_active_width-support_width/2.0) + sensor_dead_width/2.0 + sensor_deadwire_width/2.0, 0.0)); + // pv = SensorBottomEnvelopeLogical.placeVolume(SensorDeadWireLogical, Position(0.0, (sensor_active_width-support_width/2.0) + sensor_dead_width/2.0 + sensor_deadwire_width/2.0, 0.0)); + pv = SensorTopEnvelopeLogical.placeVolume(SensorDeadWireLogical, Position(0.0, (-support_width/2.0) + (sensor_deadwire_width/2.0), 0.0)); + pv = SensorBottomEnvelopeLogical.placeVolume(SensorDeadWireLogical, Position(0.0, (-support_width/2.0) + (sensor_deadwire_width/2.0), 0.0)); + + // place the active sensor and dead sensor inside the sensor envelope + std::vector<dd4hep::PlacedVolume> TopSensor_pv; + std::vector<dd4hep::PlacedVolume> BottomSensor_pv; + for(int isensor=0; isensor < n_sensors_per_side; ++isensor){ + double sensor_total_z = n_sensors_per_side*sensor_active_len + dead_gap*(n_sensors_per_side-1); + double xpos = 0.0; + double ypos_active = (support_width/2.0) - (sensor_active_width/2.0); + double ypos_dead = (-support_width/2.0) + sensor_deadwire_width + (sensor_dead_width/2.0); + double zpos = -sensor_total_z/2.0 + sensor_active_len/2.0 + isensor*(sensor_active_len + dead_gap); + pv = SensorTopEnvelopeLogical.placeVolume(SensorLogical, Position(xpos,ypos_active,zpos)); + //pv.addPhysVolID("topsensor", isensor ) ; + pv.addPhysVolID("sensor", isensor ).addPhysVolID("barrelside", 1) ; + TopSensor_pv.push_back(pv); + pv = SensorBottomEnvelopeLogical.placeVolume(SensorLogical, Position(xpos,ypos_active,zpos)); + //pv.addPhysVolID("bottomsensor", isensor ) ; + pv.addPhysVolID("sensor", isensor ).addPhysVolID("barrelside", -1) ; + BottomSensor_pv.push_back(pv); + pv = SensorTopEnvelopeLogical.placeVolume(SensorDeadLogical, Position(xpos,ypos_dead,zpos)); + pv = SensorBottomEnvelopeLogical.placeVolume(SensorDeadLogical, Position(xpos,ypos_dead,zpos)); + + } + //place the sensor envelope inside the ladder envelope + pv = LadderLogical.placeVolume(SensorTopEnvelopeLogical, + Position(support_height/2.0 + flex_thickness + sensor_thickness/2.0, 0., 0.));//top-side sensors + Transform3D tran_sen(RotationZYX(0., dd4hep::twopi/2.0, 0.), Position(-(support_height/2.0 + flex_thickness + sensor_thickness/2.0), 0., 0.)); + pv = LadderLogical.placeVolume(SensorBottomEnvelopeLogical,tran_sen);//bottom-side sensors + + //create the ladder support envelope + Box LadderSupportEnvelopeSolid(support_height/2.0, support_width/2.0, support_length/2.0); + Volume LadderSupportEnvelopeLogical(name + _toString( layer_id,"_SupEnvLogical_%02d"), LadderSupportEnvelopeSolid, air); + vxd.setVisAttributes(theDetector, "seeThrough", LadderSupportEnvelopeLogical); + + //create ladder support volume + Box LadderSupportSolid(support_thickness / 2.0 , support_width / 2.0 , support_length / 2.0); + Volume LadderSupportLogical(name + _toString( layer_id,"_SupLogical_%02d"), LadderSupportSolid, support_mat); + LadderSupportLogical.setVisAttributes(theDetector.visAttributes(supportVis)); + + //vxd.setVisAttributes(theDetector, sensVis, SensorLogical); + // vxd.setVisAttributes(theDetector, sensEnvVis, SensorBottomEnvelopeLogical); + // vxd.setVisAttributes(theDetector, ladderVis, LadderLogical); + + pv = LadderSupportEnvelopeLogical.placeVolume(LadderSupportLogical); + pv = LadderLogical.placeVolume(LadderSupportEnvelopeLogical); + + for(int i = 0; i < n_ladders; i++){ + std::stringstream ladder_enum; + ladder_enum << "vxt_ladder_" << layer_id << "_" << i; + DetElement ladderDE(layerDE, ladder_enum.str(), x_det.id()); + std::cout << "start building " << ladder_enum.str() << ":" << endl; + for(int isensor=0; isensor < n_sensors_per_side; ++isensor){ + std::stringstream topsensor_str; + std::stringstream bottomsensor_str; + topsensor_str << ladder_enum.str() << "_top_" << isensor; + // std::cout << "\tstart building " << topsensor_str.str() << ":" << endl; + bottomsensor_str << ladder_enum.str() << "_bottom_" << isensor; + // std::cout << "\tstart building " << bottomsensor_str.str() << ":" << endl; + DetElement topsensorDE(ladderDE, topsensor_str.str(), x_det.id()); + DetElement bottomsensorDE(ladderDE, bottomsensor_str.str(), x_det.id()); + topsensorDE.setPlacement(TopSensor_pv[isensor]); + // std::cout << "\t" << topsensor_str.str() << " done." << endl; + bottomsensorDE.setPlacement(BottomSensor_pv[isensor]); + // std::cout << "\t" << bottomsensor_str.str() << " done." << endl; + } + 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); + pv.addPhysVolID("layer", layer_id ).addPhysVolID("module", i ) ; + ladderDE.setPlacement(pv); + std::cout << ladder_enum.str() << " done." << endl; + + } + + // package the reconstruction data + dd4hep::rec::ZPlanarData::LayerLayout topLayer; + dd4hep::rec::ZPlanarData::LayerLayout bottomLayer; + + topLayer.ladderNumber = n_ladders; + topLayer.phi0 = 0.; + topLayer.sensorsPerLadder = n_sensors_per_side; + topLayer.lengthSensor = sensor_active_len; + topLayer.distanceSupport = sensitive_radius; + topLayer.thicknessSupport = support_thickness / 2.0; + topLayer.offsetSupport = ladder_offset; + topLayer.widthSupport = support_width; + topLayer.zHalfSupport = support_length / 2.0; + topLayer.distanceSensitive = sensitive_radius + support_thickness / 2.0; + topLayer.thicknessSensitive = sensor_thickness; + topLayer.offsetSensitive = ladder_offset; + topLayer.widthSensitive = sensor_active_width; + topLayer.zHalfSensitive = (n_sensors_per_side*(sensor_active_len + dead_gap) - dead_gap) / 2.0; + + bottomLayer.ladderNumber = n_ladders; + bottomLayer.phi0 = 0.; + bottomLayer.sensorsPerLadder = n_sensors_per_side; + bottomLayer.lengthSensor = sensor_active_len; + bottomLayer.distanceSupport = sensitive_radius - support_thickness / 2.0; + bottomLayer.thicknessSupport = support_thickness / 2.0; + bottomLayer.offsetSupport = ladder_offset; + bottomLayer.widthSupport = support_width; + bottomLayer.zHalfSupport = support_length / 2.0; + bottomLayer.distanceSensitive = sensitive_radius - support_thickness / 2.0 - sensor_thickness; + bottomLayer.thicknessSensitive = sensor_thickness; + bottomLayer.offsetSensitive = ladder_offset; + bottomLayer.widthSensitive = sensor_active_width; + bottomLayer.zHalfSensitive = (n_sensors_per_side*(sensor_active_len + dead_gap) - dead_gap) / 2.0; + + zPlanarData->layers.push_back(topLayer); + zPlanarData->layers.push_back(bottomLayer); + } + std::cout << (*zPlanarData) << endl; + vxd.addExtension< ZPlanarData >(zPlanarData); + if ( x_det.hasAttr(_U(combineHits)) ) { + vxd.setCombineHits(x_det.attr<bool>(_U(combineHits)),sens); + } + std::cout << "vxd done." << endl; + return vxd; +} +DECLARE_DETELEMENT(SiTrackerSkewBarrel_v01,create_element) diff --git a/Detector/DetCRD/src/include/FieldMapBrBz.h b/Detector/DetCRD/src/include/FieldMapBrBz.h new file mode 100644 index 0000000000000000000000000000000000000000..899b2c4a3865c662d7df72c1ba75d4d8b3f6cd12 --- /dev/null +++ b/Detector/DetCRD/src/include/FieldMapBrBz.h @@ -0,0 +1,48 @@ +#ifndef FieldMap_rzBrBz_h +#define FieldMap_rzBrBz_h 1 + +#include <DD4hep/FieldTypes.h> + +#include <string> +#include <vector> + +class FieldMapBrBz: public dd4hep::CartesianField::Object { +public: + + struct FieldValues_t { + double Br; + double Bz; + FieldValues_t(double _Br, double _Bz): + Br(_Br), Bz(_Bz) {} + }; + + int coorsOrder; // integer with the order with which variables are scanned in the fieldmap, 1(2) for RZ(ZR) order + std::string strCoorsOrder; // string with the order with which variables are scanned in the fieldmap, RZ or ZR order + std::string ntupleName; // tree name + std::string rhoVar; // rho coordinate name in tree + std::string zVar; // z coordinate name in tree + std::string BrhoVar; // Brho component name in tree + std::string BzVar; // Bz component name in tree + + int nRho, nZ; // bins in rho and z coordinates in fieldmap + int rhoOrdering; // rho coordinate ordering, 1(-1) if from low-to-high (high-to-low) + double rhoMin, rhoMax, rhoStep, rScale; // min, max, step-size and scale factor of rho coordinate in fieldmap + int zOrdering; // z coordinate ordering, 1(-1) if from low-to-high (high-to-low) + double zMin, zMax, zStep, zScale; // min, max, step-size and scale factor of z coordinate in fieldmap + + double bScale; //Bfield scale factor + std::vector< FieldValues_t > fieldMap; //List with the field map points + +public: + /// Initializing constructor + FieldMapBrBz(); + /// Call to access the field components at a given location + virtual void fieldComponents(const double* pos, double* field); + /// Field the FieldMap from the the tree specified in the XML + void fillFieldMapFromTree(const std::string& filename, double coorUnits, double BfieldUnits); + /// Get global index in the Field map + int getGlobalIndex(const int rBin, const int zBin); +}; + + +#endif // FieldMap_rzBrBz_h diff --git a/Detector/DetCRD/src/include/FieldMapXYZ.h b/Detector/DetCRD/src/include/FieldMapXYZ.h new file mode 100644 index 0000000000000000000000000000000000000000..ce8e06d15ac1d863ad375871e8c7e182ed0e1460 --- /dev/null +++ b/Detector/DetCRD/src/include/FieldMapXYZ.h @@ -0,0 +1,55 @@ +#ifndef FieldMap_XYZ_h +#define FieldMap_XYZ_h 1 + +#include <DD4hep/FieldTypes.h> + +#include <string> +#include <vector> + +class FieldMapXYZ: public dd4hep::CartesianField::Object { +public: + + struct FieldValues_t { + double Bx; + double By; + double Bz; + FieldValues_t(double _Bx, double _By, double _Bz): + Bx(_Bx), By(_By), Bz(_Bz) {} + }; + + int coorsOrder; // integer with the order with which variables are scanned in the fieldmap, 1(2) for RZ(ZR) order + std::string strCoorsOrder; // string with the order with which variables are scanned in the fieldmap, RZ or ZR order + std::string ntupleName; // tree name + std::string xVar; // x coordinate name in tree + std::string yVar; // y coordinate name in tree + std::string zVar; // z coordinate name in tree + std::string BxVar; // Bx component name in tree + std::string ByVar; // By component name in tree + std::string BzVar; // Bz component name in tree + + int nX, nY, nZ; // bins in x, y and z coordinates in fieldmap + int xOrdering; // x coordinate ordering, 1(-1) if from low-to-high (high-to-low) + double xMin,xMax,xStep,xScale; // min, max, step-size and scale factor of x coordinate in fieldmap + int yOrdering; // y coordinate ordering, 1(-1) if from low-to-high (high-to-low) + double yMin,yMax,yStep,yScale; // min, max, step-size and scale factor of y coordinate in fieldmap + int zOrdering; // z coordinate ordering, 1(-1) if from low-to-high (high-to-low) + double zMin,zMax,zStep,zScale; // min, max, step-size and scale factor of z coordinate in fieldmap + + double bScale; //Bfield scale factor + std::vector< FieldValues_t > fieldMap; //List with the field map points + +public: + /// Initializing constructor + FieldMapXYZ(); + + /// Call to access the field components at a given location + virtual void fieldComponents(const double* pos, double* field); + /// Field the FieldMap from the the tree specified in the XML + void fillFieldMapFromTree(const std::string& filename, double coorUnits, double BfieldUnits); + /// Get global index in the Field map + int getGlobalIndex(const int xBin, const int yBin, const int zBin); + +}; + + +#endif // FieldMap_XYZ_h diff --git a/Detector/DetCRD/src/include/LcgeoExceptions.h b/Detector/DetCRD/src/include/LcgeoExceptions.h new file mode 100644 index 0000000000000000000000000000000000000000..69166a0f240075bb8679bad32a3db37a8c690be6 --- /dev/null +++ b/Detector/DetCRD/src/include/LcgeoExceptions.h @@ -0,0 +1,27 @@ +//==================================================================== +// DDSim - LC simulation based on DD4hep +//-------------------------------------------------------------------- +// F.Gaede, DESY +//==================================================================== +#ifndef Exceptions_h +#define Exceptions_h + +#include <exception> + +namespace lcgeo { + + //define some exception to throw + class GeometryException : public std::exception{ + + protected: + std::string message; + GeometryException() { /*no_op*/ ; } + + public: + GeometryException( std::string text ){ + message = "GeometryException: " + text ; + } + virtual const char* what() const noexcept { return message.c_str() ; } + }; +} +#endif diff --git a/Detector/DetCRD/src/include/XMLHandlerDB.h b/Detector/DetCRD/src/include/XMLHandlerDB.h new file mode 100644 index 0000000000000000000000000000000000000000..7285d2bc0178b38af0a65d74247c67aa5c6c7269 --- /dev/null +++ b/Detector/DetCRD/src/include/XMLHandlerDB.h @@ -0,0 +1,23 @@ +#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 ; } + }; + +} diff --git a/Detector/DetCRD/src/include/lcgeo.h b/Detector/DetCRD/src/include/lcgeo.h new file mode 100644 index 0000000000000000000000000000000000000000..b5a233eee6078de0aca95c3d1966c55238713209 --- /dev/null +++ b/Detector/DetCRD/src/include/lcgeo.h @@ -0,0 +1,26 @@ +#ifndef lcgeo_h +#define lcgeo_h + +// file for some global configuration of lcgeo +// so far only version number: + +// define version macros for Lcgeo +#define LCGEO_MAJOR_VERSION 0 +#define LCGEO_MINOR_VERSION 5 + +#define LCGEO_VERSION_GE( MAJV , MINV ) ( ( LCGEO_MAJOR_VERSION > MAJV ) || ( (LCGEO_MAJOR_VERSION==MAJV) && ( LCGEO_MINOR_VERSION >= MINV ) ) ) + +#define LCGEO_VERSION_GT( MAJV , MINV ) ( ( LCGEO_MAJOR_VERSION > MAJV ) || ( (LCGEO_MAJOR_VERSION==MAJV) && ( LCGEO_MINOR_VERSION > MINV ) ) ) + +namespace lcgeo { + + /// return a string with the current lcgeo version in the form vXX-YY. + inline std::string versionString(){ + std::string vs("vXX-YY") ; + std::sprintf( &vs[0] , "v%2.2d-%2.2d", LCGEO_MAJOR_VERSION, LCGEO_MINOR_VERSION ) ; + return vs ; + } + +} + +#endif diff --git a/Service/GearSvc/src/GearSvc.cpp b/Service/GearSvc/src/GearSvc.cpp index 81c3611f63eafe0e0eb537b127b4cb44c0045a74..2dd18059de372380ffc007cb60e1099164c6b6df 100644 --- a/Service/GearSvc/src/GearSvc.cpp +++ b/Service/GearSvc/src/GearSvc.cpp @@ -86,6 +86,9 @@ StatusCode GearSvc::initialize() else if(it->first=="VXD"){ sc = convertVXD(sub); } + else if(it->first=="VXDskew"){ + sc = convertVXDskew(sub); + } else if(it->first=="FTD"){ sc = convertFTD(sub); } @@ -206,9 +209,9 @@ StatusCode GearSvc::convertVXD(dd4hep::DetElement& vxd){ double phi0=0; helpLayer thisLadder; double beryllium_ladder_block_length=0,end_electronics_half_z=0,side_band_electronics_width=0; - double rAlu=0, drAlu=0, rSty=0, drSty=0, dzSty=0, rInner=0, aluEndcapZ=0, aluHalfZ=0, alu_RadLen=0, Cryostat_dEdx=0; - double VXDSupportDensity=0, VXDSupportZeff=0, VXDSupportAeff=0, VXDSupportRadLen=0, VXDSupportIntLen=0; - double styDensity=0, styZeff=0, styAeff=0, styRadLen=0, styIntLen=0; + double rAlu=0, drAlu, rSty, drSty, dzSty, rInner, aluEndcapZ, aluHalfZ, alu_RadLen, Cryostat_dEdx; + double VXDSupportDensity, VXDSupportZeff, VXDSupportAeff, VXDSupportRadLen, VXDSupportIntLen=0; + double styDensity, styZeff, styAeff, styRadLen, styIntLen; dd4hep::Volume vxd_vol = vxd.volume(); for(int i=0;i<vxd_vol->GetNdaughters();i++){ TGeoNode* daughter = vxd_vol->GetNode(i); @@ -402,11 +405,11 @@ StatusCode GearSvc::convertVXD(dd4hep::DetElement& vxd){ int nFlexCable = 0, nFoamSpacer=0, nMetalTraces=0; int currentLayer = -1; - double tFlexCable=0, tFoamSpacer=0, tMetalTraces=0; - double radLFlexCable=0, radLFoamSpacer=0, radLMetalTraces=0; - double intLFlexCable=0, intLFoamSpacer=0, intLMetalTraces=0; - double dFlexCable=0, dFoamSpacer=0, dMetalTraces=0; - double metalZeff=0, metalZAeff=0, foamZeff=0, foamZAeff=0, flexZeff=0, flexZAeff=0; + double tFlexCable, tFoamSpacer, tMetalTraces; + double radLFlexCable, radLFoamSpacer, radLMetalTraces; + double intLFlexCable, intLFoamSpacer, intLMetalTraces; + double dFlexCable, dFoamSpacer, dMetalTraces; + double metalZeff, metalZAeff, foamZeff, foamZAeff, flexZeff, flexZAeff; for(int i=0;i<vol->GetNdaughters();i++){ TGeoNode* daughter = vol->GetNode(i); TGeoMaterial* matDaughter = daughter->GetMedium()->GetMaterial(); @@ -602,6 +605,52 @@ StatusCode GearSvc::convertVXD(dd4hep::DetElement& vxd){ return sc; } +StatusCode GearSvc::convertVXDskew(dd4hep::DetElement& vxd){ + dd4hep::rec::ZPlanarData* vxdskewData = nullptr; + try{ + vxdskewData = vxd.extension<dd4hep::rec::ZPlanarData>(); + } + catch(std::runtime_error& e){ + warning() << e.what() << " " << vxdskewData << endmsg; + return StatusCode::FAILURE; + } + + std::vector<dd4hep::rec::ZPlanarData::LayerLayout>& vxdlayers = vxdskewData->layers; + int nLayers = vxdlayers.size(); + double strip_angle_deg = vxdskewData->angleStrip*rad_to_deg; + + gear::ZPlanarParametersImpl* vxdParams = new gear::ZPlanarParametersImpl(gear::ZPlanarParametersImpl::CMOS, 0.0, 0.0, 0.0, 0.0, 0.0); + // sitParams->setDoubleVal("strip_width_mm", sitData->widthStrip*CLHEP::cm); + // sitParams->setDoubleVal("strip_length_mm", sitData->lengthStrip*CLHEP::cm); + // sitParams->setDoubleVal("strip_pitch_mm", sitData->pitchStrip*CLHEP::cm); + // sitParams->setDoubleVal("strip_angle_deg", strip_angle_deg); + std::vector<int> n_sensors_per_ladder; + for( int layer=0; layer < nLayers; layer++){ + dd4hep::rec::ZPlanarData::LayerLayout& layout = vxdlayers[layer]; + + int nLadders = layout.ladderNumber; + double phi0 = layout.phi0; + double supRMin = layout.distanceSupport*CLHEP::mm; + double supOffset = layout.offsetSupport*CLHEP::mm; + double supThickness = layout.thicknessSupport*CLHEP::mm; + double supHalfLength = layout.zHalfSupport*CLHEP::mm; + double supWidth = layout.widthSupport*CLHEP::mm; + double senRMin = layout.distanceSensitive*CLHEP::mm; + double senOffset = layout.offsetSensitive*CLHEP::mm; + double senThickness = layout.thicknessSensitive*CLHEP::mm; + double senHalfLength = layout.zHalfSensitive*CLHEP::mm; + double senWidth = layout.widthSensitive*CLHEP::mm; + int nSensorsPerLadder = layout.sensorsPerLadder; + double stripAngle = strip_angle_deg*CLHEP::degree; + n_sensors_per_ladder.push_back(nSensorsPerLadder); + vxdParams->addLayer(nLadders, phi0, supRMin, supOffset, supThickness, supHalfLength, supWidth, 0, senRMin, senOffset, senThickness, senHalfLength, senWidth, 0); + } + vxdParams->setIntVals("n_sensors_per_ladder",n_sensors_per_ladder); + m_gearMgr->setVXDParameters( vxdParams ) ; + + return StatusCode::SUCCESS; +} + StatusCode GearSvc::convertFTD(dd4hep::DetElement& ftd){ dd4hep::rec::ZDiskPetalsData* ftdData = nullptr; try{ diff --git a/Service/GearSvc/src/GearSvc.h b/Service/GearSvc/src/GearSvc.h index 3048526cb9d0c477519599941006cefb9ee6f3fc..52865a56573a8a8f452c712718ca69ae276be295 100644 --- a/Service/GearSvc/src/GearSvc.h +++ b/Service/GearSvc/src/GearSvc.h @@ -4,6 +4,7 @@ #include "GearSvc/IGearSvc.h" #include <GaudiKernel/Service.h> #include "DD4hep/Detector.h" +class dd4hep::DetElement; class TGeoNode; class GearSvc : public extends<Service, IGearSvc> @@ -20,6 +21,7 @@ class GearSvc : public extends<Service, IGearSvc> private: StatusCode convertBeamPipe(dd4hep::DetElement& pipe); StatusCode convertVXD(dd4hep::DetElement& vxd); + StatusCode convertVXDskew(dd4hep::DetElement& vxd); StatusCode convertSIT(dd4hep::DetElement& sit); StatusCode convertTPC(dd4hep::DetElement& tpc); StatusCode convertDC (dd4hep::DetElement& dc);