From b9d4eefa69c5061206cf0b8ba88be21cb172c091 Mon Sep 17 00:00:00 2001
From: "audrey.chatillon" <audrey.chatillon@gmail.com>
Date: Thu, 2 Jan 2025 15:02:18 +0100
Subject: [PATCH] [Epic] add gas in the central part of the fission chamber

---
 NPSimulation/Detectors/Epic/Epic.cc | 97 +++++++++++++++++++----------
 NPSimulation/Detectors/Epic/Epic.hh |  2 +
 2 files changed, 67 insertions(+), 32 deletions(-)

diff --git a/NPSimulation/Detectors/Epic/Epic.cc b/NPSimulation/Detectors/Epic/Epic.cc
index c551cf27f..29455a208 100644
--- a/NPSimulation/Detectors/Epic/Epic.cc
+++ b/NPSimulation/Detectors/Epic/Epic.cc
@@ -84,7 +84,9 @@ Epic::Epic(){
   m_VisFCWall = new G4VisAttributes(G4Colour(0.1,0.5,0.7,1));
   m_VisAl = new G4VisAttributes(G4Colour(0.839,0.803,0.803,1));
   m_VisTi = new G4VisAttributes(G4Colour(0.776,0.662,0.662,0.5));
-  m_VisGas = new G4VisAttributes(G4Colour(0.576,0.662,0.662,0.3));
+  m_VisGasAK = new G4VisAttributes(G4Colour(0.576,0.662,0.662,0.3));
+  m_VisGasKK = new G4VisAttributes(G4Colour(0.576,0.662,0.662,0.5));
+  m_VisGas = new G4VisAttributes(G4Colour(0.576,0.662,0.662,0.1));
   m_VisCu = new G4VisAttributes(G4Colour(0.70, 0.40, 0. ,1));
   m_VisRogers4003C = new G4VisAttributes(G4Colour(0.60, 0.60, 0.2 ,1));
 
@@ -189,9 +191,10 @@ G4AssemblyVolume* Epic::BuildEpic(){
   G4Material* Cu_material = MaterialManager::getInstance()->GetMaterialFromLibrary("Cu");
   G4Material* Ti_material = MaterialManager::getInstance()->GetMaterialFromLibrary("Ti");
   G4Material* Rogers_material = MaterialManager::getInstance()->GetMaterialFromLibrary("Rogers4003C");
+  G4Material* gas_material = MaterialManager::getInstance()->GetGasFromLibrary(m_GasMaterial, m_Pressure, 300*kelvin);
 
 
-  // --- PCB material (6 layers of Cu)
+  // --- PCB (6 layers of Cu)
   double posY_PCB   = -85.0*mm;    // @the 6-Cu layers
   double PCB_width  = 180.0*mm;
   double PCB_length = 330.0*mm;
@@ -212,7 +215,7 @@ G4AssemblyVolume* Epic::BuildEpic(){
   Tv.setY(posY_PCB);
   m_EpicVolume->AddPlacedVolume(PCB_Cu_vol, Tv, Rv);
 
-  // --- Flange in Aluminium
+  // --- FLANGE IN ALUMINIUM
   double flange_full_width  = PCB_width;
   double flange_full_length = PCB_length;
   double flange_full_height =   5.*mm;       double posY_flange = posY_PCB - 0.5*PCB_Cu_height - 0.5*flange_full_height ;
@@ -237,7 +240,7 @@ G4AssemblyVolume* Epic::BuildEpic(){
   m_EpicVolume->AddPlacedVolume(flange_vol, Tv, Rv);
 
 
-  // --- Frame in Aluminium
+  // --- FRAME IN ALUMINIUM
   double frame_foot_full_width  = flange_full_width;
   double frame_foot_full_length = flange_full_length;
   double frame_foot_full_height = flange_full_height;    double posY_frame_foot = posY_PCB + 0.5*PCB_Cu_height + PCB_Rogers_height + 0.5*frame_foot_full_height ;
@@ -288,23 +291,37 @@ G4AssemblyVolume* Epic::BuildEpic(){
   m_EpicVolume->AddPlacedVolume(frame_final_vol, Tv, Rv);
 
 
-  //--- Cathodes (TO DO : rajouter les depots)
+  //--- TITANE WINDOWS (TO DO)
+
+  //--- CENTRAL PART OF THE FISSION CHAMBER
+  //  - Cathodes (TO DO : rajouter les depots) 
+  //  - Anodes
+  //  - gas volumes : active gas_AK and gas_KK
   double posZ_first_cathode = -1.*(double)m_nA*m_Distance_AK*mm - (double)std::trunc(0.5*m_nA)*m_InterDistance_KK*mm;
-  // Build First Cathode
+  
+  // Build the first cathode and the first anode
   BuildCathode(posZ_first_cathode);
-  // Build the central pairs of cathodes back to back
+  BuildAnode(posZ_first_cathode + m_Distance_AK*mm);
+
+  // Build the central pairs of cathodes back to back, the anodes and the gas_KK
+  G4Tubs* gas_KK_solid = new G4Tubs("gas_KK",0,37.*mm,0.5*m_InterDistance_KK,0,360*deg);
+  G4LogicalVolume* gas_KK_vol = new G4LogicalVolume(gas_KK_solid, gas_material,"logic_gas_KK",0,0,0);
+  gas_KK_vol->SetVisAttributes(m_VisGasKK);
   for(int i=1; i<m_nA; i++){
     double posZ_current_cathode = posZ_first_cathode + (double)i*2.*m_Distance_AK*mm + (double)(i-0.5)*m_InterDistance_KK*mm ;  
     BuildCathode(posZ_current_cathode - 0.5*m_InterDistance_KK*mm);
+    Tv.setY(0);
+    Tv.setZ(posZ_current_cathode);
+    m_EpicVolume->AddPlacedVolume(gas_KK_vol, Tv, Rv);
     BuildCathode(posZ_current_cathode + 0.5*m_InterDistance_KK*mm);
+    BuildAnode(posZ_current_cathode + 0.5*m_InterDistance_KK*mm + m_Distance_AK*mm);
   }
-  // Build Last Cathode
+
+  // Build the last cathode
   BuildCathode(posZ_first_cathode + (double)m_nA*2.*m_Distance_AK*mm + (double)(m_nA-1)*m_InterDistance_KK*mm);
   
 
-  // --- Anodes 
-
-
+  // --- UNACTIVE GAS VOLUME
 
 
 /*
@@ -320,7 +337,6 @@ G4AssemblyVolume* Epic::BuildEpic(){
   double gas_length = 29.8*cm;
   G4Box* gas_solid = new G4Box("Gas_solid", 0.5*gas_width, 0.5*gas_height, 0.5*gas_length);
 
-  G4Material* gas_material = MaterialManager::getInstance()->GetGasFromLibrary(m_GasMaterial, m_Pressure, 300*kelvin);
   G4LogicalVolume* gas_volume = new G4LogicalVolume(gas_solid, gas_material, "gas_logic", 0, 0, 0);
   gas_volume->SetSensitiveDetector(m_EpicScorer);
   //m_VisGas->SetForceWireframe(true);
@@ -412,20 +428,16 @@ G4AssemblyVolume* Epic::BuildEpic(){
 
 */
 
-
-
-
-
-
-
   return m_EpicVolume;
 } 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 void Epic::BuildCathode(double Zpos){
-  // Al plate: 12 um
-  G4Tubs* Al_plate_solid = new G4Tubs("Al_plate",0,40*mm,12*micrometer,0,360*deg);
+  // Al plate: 
+  //   thickness = 12 um
+  //   external radius = 37 mm
+  G4Tubs* Al_plate_solid = new G4Tubs("Al_plate",0,37.*mm,6.*micrometer,0,360*deg);
   G4Material* Al_material = MaterialManager::getInstance()->GetMaterialFromLibrary("Al");
-  G4LogicalVolume* Al_vol = new G4LogicalVolume(Al_plate_solid, Al_material,"logic_Al",0,0,0);
+  G4LogicalVolume* Al_vol = new G4LogicalVolume(Al_plate_solid, Al_material,"logic_AlK",0,0,0);
   Al_vol->SetVisAttributes(m_VisAl);
 
   G4RotationMatrix *Rv=new G4RotationMatrix(0,0,0);
@@ -439,28 +451,49 @@ void Epic::BuildCathode(double Zpos){
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 void Epic::BuildAnode(double Zpos){
-  // Cu plate: 17 um
-  G4Tubs* Cu_plate_solid = new G4Tubs("Cu_plate",0,40*mm,0.5*Epic_NS::Cu_Thickness,0,360*deg);
+
+  G4RotationMatrix *Rv=new G4RotationMatrix(0,0,0);
+  G4ThreeVector Tv;
+  Tv.setX(0); Tv.setY(0); Tv.setZ(0);
+
+  // Get Material
   G4Material* Cu_material = MaterialManager::getInstance()->GetMaterialFromLibrary("Cu");
-  G4LogicalVolume* Cu_vol = new G4LogicalVolume(Cu_plate_solid, Cu_material,"logic_Cu",0,0,0);
+  G4Material* Kapton_material = MaterialManager::getInstance()->GetMaterialFromLibrary("Kapton");
+  G4Material* gas_material = MaterialManager::getInstance()->GetGasFromLibrary(m_GasMaterial, m_Pressure, 300*kelvin);
+
+  // Cu plate: 17 um
+  G4Tubs* Cu_plate_solid = new G4Tubs("Cu_plate",0,37.*mm,0.5*Epic_NS::Cu_Thickness,0,360*deg);
+  G4LogicalVolume* Cu_vol = new G4LogicalVolume(Cu_plate_solid, Cu_material,"logic_CuA",0,0,0);
   Cu_vol->SetVisAttributes(m_VisCu);
 
   // Kapton: 50 um
-  G4Tubs* Kapton_solid = new G4Tubs("Kapton",0,40*mm,0.5*Epic_NS::Kapton_Thickness,0,360*deg);
-  G4Material* Kapton_material = MaterialManager::getInstance()->GetMaterialFromLibrary("Kapton");
-  G4LogicalVolume* Kapton_vol = new G4LogicalVolume(Kapton_solid, Kapton_material,"logic_Kapton",0,0,0);
+  G4Tubs* Kapton_solid = new G4Tubs("Kapton",0,37.*mm,0.5*Epic_NS::Kapton_Thickness,0,360*deg);
+  G4LogicalVolume* Kapton_vol = new G4LogicalVolume(Kapton_solid, Kapton_material,"logic_KaptonA",0,0,0);
   Kapton_vol->SetVisAttributes(m_VisFCWall);
 
-  G4RotationMatrix *Rv=new G4RotationMatrix(0,0,0);
-  G4ThreeVector Tv;
-  Tv.setX(0); Tv.setY(0); Tv.setZ(0);
+  // Sensitive gas volumes before and after anode (TO DO, several slices instead of a unique gas volume)
+  G4Tubs* gas_AK_solid = new G4Tubs("gas_AK",0,37.*mm,0.5*m_Distance_AK,0,360*deg);
+  G4LogicalVolume* gas_AK_vol = new G4LogicalVolume(gas_AK_solid, gas_material,"logic_gas_AK",0,0,0);
+  gas_AK_vol->SetSensitiveDetector(m_EpicScorer);
+  gas_AK_vol->SetVisAttributes(m_VisGasAK);
 
-  Tv.setZ(Zpos);
-  m_EpicVolume->AddPlacedVolume(Kapton_vol, Tv, Rv);
+
+  // Build
+  
+  Tv.setZ(Zpos-0.5*m_Distance_AK*mm);
+  m_EpicVolume->AddPlacedVolume(gas_AK_vol, Tv, Rv);
+  
   Tv.setZ(Zpos-0.5*Epic_NS::Kapton_Thickness-0.5*Epic_NS::Cu_Thickness);
   m_EpicVolume->AddPlacedVolume(Cu_vol, Tv, Rv);
+  
+  Tv.setZ(Zpos);
+  m_EpicVolume->AddPlacedVolume(Kapton_vol, Tv, Rv);
+  
   Tv.setZ(Zpos+0.5*Epic_NS::Kapton_Thickness+0.5*Epic_NS::Cu_Thickness);
   m_EpicVolume->AddPlacedVolume(Cu_vol, Tv, Rv);
+  
+  Tv.setZ(Zpos+0.5*m_Distance_AK*mm);
+  m_EpicVolume->AddPlacedVolume(gas_AK_vol, Tv, Rv);
 
 }
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/NPSimulation/Detectors/Epic/Epic.hh b/NPSimulation/Detectors/Epic/Epic.hh
index 07d7abd3d..5b474b7d9 100644
--- a/NPSimulation/Detectors/Epic/Epic.hh
+++ b/NPSimulation/Detectors/Epic/Epic.hh
@@ -111,6 +111,8 @@ class Epic : public NPS::VDetector{
     G4VisAttributes* m_VisFCWall;
     G4VisAttributes* m_VisAl;
     G4VisAttributes* m_VisCu;
+    G4VisAttributes* m_VisGasAK;
+    G4VisAttributes* m_VisGasKK;
     G4VisAttributes* m_VisGas;
     G4VisAttributes* m_VisTi;
     G4VisAttributes* m_VisRogers4003C;
-- 
GitLab