From 5c377e9582392c2ca3b3ca518557b026f76c1428 Mon Sep 17 00:00:00 2001
From: "shexin@ihep.ac.cn" <shexin@ihep.ac.cn>
Date: Fri, 21 Jun 2024 08:35:23 +0000
Subject: [PATCH] TPC geometry update 2

---
 .../TDR_o1_v01/TDR_o1_v01-onlyTracker.xml     |  3 +++
 .../src/Tracker/TPC_ModularEndcap_o1_v01.cpp  | 26 +++++++++++++++++++
 .../DetCRD/src/Tracker/TPC_Simple_o1_v01.cpp  | 25 ++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/Detector/DetCRD/compact/TDR_o1_v01/TDR_o1_v01-onlyTracker.xml b/Detector/DetCRD/compact/TDR_o1_v01/TDR_o1_v01-onlyTracker.xml
index bbfe7dce..402afae0 100644
--- a/Detector/DetCRD/compact/TDR_o1_v01/TDR_o1_v01-onlyTracker.xml
+++ b/Detector/DetCRD/compact/TDR_o1_v01/TDR_o1_v01-onlyTracker.xml
@@ -33,6 +33,9 @@
   <include ref="../CRD_common_v02/FTD_SkewRing_v01_05.xml"/>
   <include ref="../CRD_common_v02/SIT_SimplePixel_v01_03.xml"/>
   <include ref="../CRD_common_v01/TPC_Simple_v10_02.xml"/>
+  <include ref="../CRD_common_v01/SET_SimplePixel_v01_01.xml"/-->
+  <include ref="./TPC_ModularEndcap_TDR_o1_v01.xml"/>
+  
   <!--prepare for update, need check first-->
   <!--include ref="../CRD_common_v02/TPC_ModularEndcap_o1_v01.xml"/-->
   <include ref="../CRD_common_v01/SET_SimplePixel_v01_01.xml"/>
diff --git a/Detector/DetCRD/src/Tracker/TPC_ModularEndcap_o1_v01.cpp b/Detector/DetCRD/src/Tracker/TPC_ModularEndcap_o1_v01.cpp
index 140f1f81..2ec03997 100644
--- a/Detector/DetCRD/src/Tracker/TPC_ModularEndcap_o1_v01.cpp
+++ b/Detector/DetCRD/src/Tracker/TPC_ModularEndcap_o1_v01.cpp
@@ -28,6 +28,7 @@ using dd4hep::rec::SurfaceType;
 using dd4hep::rec::volSurfaceList;
 using dd4hep::rec::VolPlane;
 using dd4hep::rec::FixedPadSizeTPCData;
+using dd4hep::rec::ConicalSupportData;
 
 /** Construction of TPC detector, ported from Mokka driver TPC10.cc
  * Mokka History:
@@ -507,6 +508,31 @@ static Ref_t create_element(Detector& theDetector, xml_h e, SensitiveDetector se
     tpcData->driftLength = dzTotal/2.- dz_Endplate - dz_Readout - dz_Cathode/2.0; // SJA: cathode has to be added as the sensitive region does not start at 0.00    
     tpcData->zMinReadout = dz_Cathode/2.0; 
 
+    ConicalSupportData* supportData = new ConicalSupportData;
+
+    ConicalSupportData::Section section0;
+    section0.rInner = rInner + drInnerWall; 
+    section0.rOuter = rOuter - drOuterWall;
+    section0.zPos   = dzTotal/2. - dz_Endplate - dz_Readout; 
+
+    ConicalSupportData::Section section1;
+    section1.rInner = rInner + drInnerWall; 
+    section1.rOuter = rOuter - drOuterWall;
+    section1.zPos   = dzTotal/2. - dz_Endplate; 
+
+    ConicalSupportData::Section section2;
+    section2.rInner = rInner ; 
+    section2.rOuter = rOuter ;
+    section2.zPos   = dzTotal/2.; 
+
+    supportData->sections.push_back(section0);
+    supportData->sections.push_back(section1);
+    supportData->sections.push_back(section2);
+
+
+    tpc.addExtension< FixedPadSizeTPCData >(tpcData);
+    tpc.addExtension< ConicalSupportData >(supportData);
+
     //tpc.setVisAttributes( theDetector, x_det.visStr(), envelope );
     tpc.setVisAttributes( theDetector, "TPCMotherVis1", envelope );
     //  if( tpc.isValid() ) 
diff --git a/Detector/DetCRD/src/Tracker/TPC_Simple_o1_v01.cpp b/Detector/DetCRD/src/Tracker/TPC_Simple_o1_v01.cpp
index 0ce7ec73..8dd22ac7 100644
--- a/Detector/DetCRD/src/Tracker/TPC_Simple_o1_v01.cpp
+++ b/Detector/DetCRD/src/Tracker/TPC_Simple_o1_v01.cpp
@@ -28,6 +28,7 @@ using dd4hep::rec::SurfaceType;
 using dd4hep::rec::volSurfaceList;
 using dd4hep::rec::VolPlane;
 using dd4hep::rec::FixedPadSizeTPCData;
+using dd4hep::rec::ConicalSupportData;
 
 /** Construction of TPC detector, ported from Mokka driver TPC10.cc
  * Mokka History:
@@ -450,6 +451,30 @@ static Ref_t create_element(Detector& theDetector, xml_h e, SensitiveDetector se
     tpcData->padWidth =  tpcpadwidth;
     tpcData->driftLength = dzTotal/2.- dz_Endplate - dz_Readout - dz_Cathode/2.0; // SJA: cathode has to be added as the sensitive region does not start at 0.00    
     tpcData->zMinReadout = dz_Cathode/2.0; 
+    
+    ConicalSupportData* supportData = new ConicalSupportData;
+
+    ConicalSupportData::Section section0;
+    section0.rInner = rInner + drInnerWall; 
+    section0.rOuter = rOuter - drOuterWall;
+    section0.zPos   = dzTotal/2. - dz_Endplate - dz_Readout; 
+
+    ConicalSupportData::Section section1;
+    section1.rInner = rInner + drInnerWall; 
+    section1.rOuter = rOuter - drOuterWall;
+    section1.zPos   = dzTotal/2. - dz_Endplate; 
+
+    ConicalSupportData::Section section2;
+    section2.rInner = rInner ; 
+    section2.rOuter = rOuter ;
+    section2.zPos   = dzTotal/2.; 
+
+    supportData->sections.push_back(section0);
+    supportData->sections.push_back(section1);
+    supportData->sections.push_back(section2);
+
+    tpc.addExtension< FixedPadSizeTPCData >(tpcData);
+    tpc.addExtension< ConicalSupportData >(supportData);
 
     //tpc.setVisAttributes( theDetector, x_det.visStr(), envelope );
     tpc.setVisAttributes( theDetector, "TPCMotherVis1", envelope );
-- 
GitLab