From 262d2c74006b996602786b40f96b8b03ef3955ea Mon Sep 17 00:00:00 2001
From: Chengdong Fu <fucd@ihep.ac.cn>
Date: Thu, 3 Dec 2020 10:21:23 +0800
Subject: [PATCH] fix overlap

---
 .../DetCEPCv4/compact/Beampipe_o1_v01_01.xml     | 16 ++++++++--------
 Detector/DetCEPCv4/compact/envelope_defs.xml     |  7 ++++---
 Detector/DetCEPCv4/compact/ftd_cepc.xml          | 12 ++++++------
 Detector/DetCEPCv4/compact/services_defs.xml     |  1 +
 Detector/DetCEPCv4/compact/top_defs.xml          |  4 ++--
 5 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml b/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml
index 4b6d0ef0..a7ce385d 100644
--- a/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml
+++ b/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml
@@ -103,17 +103,17 @@
            rMax1="TUBE_incoming_beamcalToQD0_InnerRadius+TUBE_upstream_thickness"  rMax2="TUBE_incoming_QD0andBeyond_InnerRadius+TUBE_upstream_thickness"
            material="stainless_steel" name="BeamCalToQD0UpstreamTrans" />
 
-  <section type ="Upstream"
+  <!--section type ="Upstream"
            start="TUBE_QD0_Lstar"                    end="TUBE_QD0_Lstar+TUBE_QD0_length"
            rMin1="TUBE_incoming_QD0andBeyond_InnerRadius"          rMin2="TUBE_incoming_QD0andBeyond_InnerRadius"
            rMax1="TUBE_incoming_QD0andBeyond_InnerRadius+20*mm"    rMax2="TUBE_incoming_QD0andBeyond_InnerRadius+20*mm"
-           material="stainless_steel" name="QD0CryoUpstream" />
+           material="stainless_steel" name="QD0CryoUpstream" /-->
 
-  <section type ="Upstream"
+  <!--section type ="Upstream"
            start="TUBE_QD0_Lstar+TUBE_QD0_length"    end="10*m"
            rMin1="TUBE_incoming_QD0andBeyond_InnerRadius"          rMin2="TUBE_incoming_QD0andBeyond_InnerRadius"
            rMax1="TUBE_incoming_QD0andBeyond_InnerRadius+TUBE_upstream_thickness"    rMax2="TUBE_incoming_QD0andBeyond_InnerRadius+TUBE_upstream_thickness"
-           material="stainless_steel" name="BeyondQD0Upstream" />
+           material="stainless_steel" name="BeyondQD0Upstream" /-->
 
 
 
@@ -137,17 +137,17 @@
            rMax1="TUBE_outgoing_beamcalToQD0_InnerRadius+TUBE_upstream_thickness"  rMax2="TUBE_outgoing_beamcalToQD0_InnerRadius+TUBE_upstream_thickness"
            material="stainless_steel" name="BeamCalToQDEX1ADnstream" />
 
-  <section type ="Dnstream"
+  <!--section type ="Dnstream"
            start="TUBE_QDEX1A_Lstar"                    end="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length"
            rMin1="TUBE_outgoing_QD0andBeyond_InnerRadius"          rMin2="TUBE_outgoing_QD0andBeyond_InnerRadius"
            rMax1="TUBE_outgoing_QD0andBeyond_InnerRadius+20*mm"    rMax2="TUBE_outgoing_QD0andBeyond_InnerRadius+20*mm"
-           material="stainless_steel" name="QDEX1A" />
+           material="stainless_steel" name="QDEX1A" /-->
 
-  <section type ="Dnstream"
+  <!--section type ="Dnstream"
            start="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length"         end="10*m"
            rMin1="TUBE_outgoing_QD0andBeyond_InnerRadius"          rMin2="TUBE_outgoing_QD0andBeyond_InnerRadius"
            rMax1="TUBE_outgoing_QD0andBeyond_InnerRadius+TUBE_upstream_thickness"    rMax2="TUBE_outgoing_QD0andBeyond_InnerRadius+TUBE_upstream_thickness"
-           material="stainless_steel" name="BeyondQD0Dnstream" />
+           material="stainless_steel" name="BeyondQD0Dnstream" /-->
 
 </detector>
 
diff --git a/Detector/DetCEPCv4/compact/envelope_defs.xml b/Detector/DetCEPCv4/compact/envelope_defs.xml
index e80faf2d..920b90ee 100644
--- a/Detector/DetCEPCv4/compact/envelope_defs.xml
+++ b/Detector/DetCEPCv4/compact/envelope_defs.xml
@@ -50,12 +50,13 @@
   <constant name="VXD_inner_radius"   value="top_VXD_inner_radius"/>
   <constant name="VXD_outer_radius"   value="top_VXD_outer_radius"/>
   <constant name="VXD_half_length"    value="top_VXD_half_length"/>
-  <constant name="VXD_cone_min_z"     value="TUBE_IPInnerTube_end_z"/>
+  <!--constant name="VXD_cone_min_z"     value="TUBE_IPInnerTube_end_z"/-->
+  <constant name="VXD_cone_min_z"     value="135*mm"/>
   <!--constant name="VXD_cone_max_z"     value="TUBE_IPInnerBulge_end_z"/-->
-  <constant name="VXD_cone_max_z"     value="VXD_half_length"/>
+  <constant name="VXD_cone_max_z"     value="VXD_half_length-10*mm"/>
   <!--constant name="VXD_cone_max_z"     value="125.1*mm "/-->
   <constant name="VXD_inner_radius_1" value="TUBE_IPInnerBulge_end_envradius + env_safety "/>
-
+  <!--constant name="VXD_inner_radius_1" value="TUBE_central_inner_radius + TUBE_central_thickness + env_safety"/-->
 
   <constant name="SIT_inner_radius"    value="SIT1_Radius - env_safety"/>
   <constant name="SIT_outer_radius_1"  value="SIT2_Radius - env_safety"/>
diff --git a/Detector/DetCEPCv4/compact/ftd_cepc.xml b/Detector/DetCEPCv4/compact/ftd_cepc.xml
index 1566734d..c32b7636 100644
--- a/Detector/DetCEPCv4/compact/ftd_cepc.xml
+++ b/Detector/DetCEPCv4/compact/ftd_cepc.xml
@@ -19,7 +19,8 @@
                   <shape type="Tube" rmin="FTD_inner_radius"   rmax="FTD_outer_radius" dz="FTD_half_length"  />
                   <shape type="Tube" rmin="0." rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_0" />
                 </shape>
-                <shape type="Tube" rmin="FTD_outer_radius_1" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2-petal_cp_support_thickness-petal_support_zoffset" />
+                <!--shape type="Tube" rmin="FTD_outer_radius_1" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2-petal_cp_support_thickness-petal_support_zoffset" /-->
+		<shape type="Tube" rmin="FTD_outer_radius_1" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2-FTD_layer_shift"/>
               </shape>
               <shape type="Tube" rmin="FTD_outer_radius_2" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2" />
             </shape>
@@ -46,9 +47,9 @@
       <!-- SQL command: "select * from extended_reconstruction_parameters;"  same as ftd_cepc_v4 checked by fucd -->
       <extended_reconstruction_parameters strip_width="0.001*mm" strip_length="250*mm" strip_pitch="0.01*mm" strip_angle="5*deg"  />
 
-      <!-- SQL command: "select * from disks;"  same as ftd_cepc_v4 checked by fucd-->
-      <disk disk_number="1" z_position_ReltoTPCLength="0"                            disk_si_thickness="0.02*mm" petal_cp_support_dxMax="72*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0"  />
-      <disk disk_number="2" z_position_ReltoTPCLength="FTD_disk2_zPosRelToTpcLength" disk_si_thickness="0.02*mm" petal_cp_support_dxMax="72*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0"  />
+      <!-- SQL command: "select * from disks;"  same as ftd_cepc_v4 checked by fucd, but overlap exist, reduce petal_cp_support_dxMax from 72mm to 71.4mm/71.8mm-->
+      <disk disk_number="1" z_position_ReltoTPCLength="0"                            disk_si_thickness="0.02*mm" petal_cp_support_dxMax="71.4*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0"  />
+      <disk disk_number="2" z_position_ReltoTPCLength="FTD_disk2_zPosRelToTpcLength" disk_si_thickness="0.02*mm" petal_cp_support_dxMax="71.8*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0"  />
       <disk disk_number="3" z_position_ReltoTPCLength="FTD_disk3_zPosRelToTpcLength" disk_si_thickness="0.20*mm" petal_cp_support_dxMax="122.49*mm" padUp_Si_dxMax="118.46*mm" petal_cp_support_thickness="2*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="0" double_sided="1"  />
       <disk disk_number="4" z_position_ReltoTPCLength="FTD_disk4_zPosRelToTpcLength" disk_si_thickness="0.20*mm" petal_cp_support_dxMax="122.49*mm" padUp_Si_dxMax="118.46*mm" petal_cp_support_thickness="2*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="0" double_sided="1"  />
       <disk disk_number="5" z_position_ReltoTPCLength="FTD_disk5_zPosRelToTpcLength" disk_si_thickness="0.20*mm" petal_cp_support_dxMax="122.49*mm" padUp_Si_dxMax="118.46*mm" petal_cp_support_thickness="2*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="0" double_sided="1"  />
@@ -61,8 +62,7 @@
 
   <readouts>
     <readout name="FTDCollection">
-      <!-- fixme: for now DD4hep cannot handle signed values - side should actually be "-2" -->
-      <id>system:5,side:2,layer:9,module:8,sensor:8</id>
+      <id>system:5,side:-2,layer:9,module:8,sensor:8</id>
     </readout>
   </readouts>
 
diff --git a/Detector/DetCEPCv4/compact/services_defs.xml b/Detector/DetCEPCv4/compact/services_defs.xml
index 91e4ed58..f60250d5 100644
--- a/Detector/DetCEPCv4/compact/services_defs.xml
+++ b/Detector/DetCEPCv4/compact/services_defs.xml
@@ -39,6 +39,7 @@
   <constant name="SServices_FTD2_cone_thickness" value="0.040*mm"/>
   <constant name="SServices_FTD3_cone_thickness" value="0.020*mm"/>
   <constant name="SServices_FTD7_cables_thickness" value="0.85*mm"/>
+  <constant name="FTD_layer_shift" value="petal_cp_support_thickness+petal_support_zoffset+1*mm"/>
 
   <constant name="VXD_cable_cross_section_area" value="25.0*mm*mm"/>
   <constant name="VXD_cable_inner1_radius" value="30.0*mm"/>
diff --git a/Detector/DetCEPCv4/compact/top_defs.xml b/Detector/DetCEPCv4/compact/top_defs.xml
index 8516b3a1..bb0f6ac7 100644
--- a/Detector/DetCEPCv4/compact/top_defs.xml
+++ b/Detector/DetCEPCv4/compact/top_defs.xml
@@ -10,11 +10,11 @@
   <constant name="CepC_Main_Crossing_Angle" value="33*mrad"/>
 
   <!-- the field inside and outside the solenoid -->
-  <constant name="outerField_nominal_value" value="-1.5*tesla"/>
+  <constant name="outerField_nominal_value" value="-1.33716*tesla"/>
 
 
   <!-- VXD -->
-  <constant name="top_VXD_inner_radius"   value="15.95*mm "/>
+  <constant name="top_VXD_inner_radius"   value="15*mm "/>
   <constant name="top_VXD_outer_radius"   value="101*mm "/>
   <constant name="top_VXD_half_length"    value="200*mm "/>
 
-- 
GitLab