From 76b6bd839f2135e6dba3a93955c2a80e2110dcda Mon Sep 17 00:00:00 2001
From: matta <matta@npt>
Date: Tue, 5 Feb 2013 12:18:12 +0000
Subject: [PATCH] * Fixing geometry for Sharc (no PAD case)

---
 NPSimulation/include/Sharc.hh | 20 ++++++++++----------
 NPSimulation/src/Sharc.cc     |  6 +++---
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/NPSimulation/include/Sharc.hh b/NPSimulation/include/Sharc.hh
index a3c5e3333..7d71daa82 100644
--- a/NPSimulation/include/Sharc.hh
+++ b/NPSimulation/include/Sharc.hh
@@ -71,15 +71,17 @@ namespace SHARC
   const G4int    BOX_Wafer_Back_NumberOfStrip = 16 ;
   
   // Compute
-  const G4double BOX_Exposed_Length1 = BOX_Wafer_Length + BOX_PCB_Slot1_Border +0.5*BOX_PCB_Slot1_Width;
-  const G4double BOX_CenterOffset1 = 0.5* (BOX_PCB_Length-BOX_Exposed_Length1-BOX_PCB_Border_ShortSide);
+  const G4double BOX_LeftOver =  BOX_PCB_Length - BOX_PCB_Border_ShortSide - BOX_Wafer_Length - BOX_PCB_Slot1_Border - BOX_PCB_Slot1_Width ;
+  const G4double BOX_Exposed_Length1 = BOX_Wafer_Length + BOX_PCB_Slot1_Border ;
   
-  const G4double BOX_Wafer_Width_Offset =
-  BOX_PCB_Width*0.5 - BOX_PCB_Border_LongSide - BOX_Wafer_Width*0.5;
-  const G4double BOX_Wafer_Length_Offset = BOX_CenterOffset1;
+  const G4double BOX_CenterOffset1 = - 0.5 * BOX_PCB_Length+BOX_PCB_Border_ShortSide+0.5*BOX_Exposed_Length1;
+  const G4double BOX_DetectorSpacing = 0.5*BOX_Exposed_Length1+0.5*BOX_PCB_Slot1_Width;
   
-  const G4double BOX_PCB_Slot1_Position = (BOX_PCB_Slot1_Border+0.5*BOX_PCB_Slot1_Width+0.5*BOX_Wafer_Length-BOX_CenterOffset1);
+  const G4double BOX_Wafer_Width_Offset = -0.5*BOX_PCB_Width + BOX_PCB_Border_LongSide + 0.5*BOX_Wafer_Width;
+  const G4double BOX_Wafer_Length_Offset = -0.5*BOX_PCB_Length + BOX_PCB_Border_ShortSide + 0.5*BOX_Wafer_Length;
   
+  const G4double BOX_PCB_Slot1_Position = 0.5*BOX_PCB_Length-BOX_LeftOver - 0.5*BOX_PCB_Slot1_Width;
+
   // PAD //
   // PAD PCB
   const G4double PAD_PCB_Width  = 61.10*mm;
@@ -94,10 +96,8 @@ namespace SHARC
   const G4double PAD_Wafer_DeadLayer_Thickness = 0.1*um;
   
   // Compute
-  const G4double PAD_Wafer_Width_Offset =
-  PAD_PCB_Width/2. - PAD_PCB_Border_LongSide - PAD_Wafer_Width/2.;
-  const G4double PAD_Wafer_Length_Offset =
-  PAD_PCB_Length/2. - PAD_PCB_Border_ShortSide - PAD_Wafer_Length/2.;
+  const G4double PAD_Wafer_Width_Offset = PAD_PCB_Width/2. - PAD_PCB_Border_LongSide - PAD_Wafer_Width/2.;
+  const G4double PAD_Wafer_Length_Offset = PAD_PCB_Length/2. - PAD_PCB_Border_ShortSide - PAD_Wafer_Length/2.;
   // Double stage box case (DSSD+PAD)
   const G4double BOX_PCB_Slot2_Width = BOX_PCB_Thickness+PAD_PCB_Thickness;
   const G4double BOX_PCB_Slot2_Border = 2.7*mm;
diff --git a/NPSimulation/src/Sharc.cc b/NPSimulation/src/Sharc.cc
index a4851b4f9..08bd34d6c 100644
--- a/NPSimulation/src/Sharc.cc
+++ b/NPSimulation/src/Sharc.cc
@@ -12,7 +12,7 @@
  * Last update    :                                                          *
  *---------------------------------------------------------------------------*
  * Decription:                                                               *
- *  This class describe the SHarc Silicon array                              *
+ *  This class describe the Sharc Silicon array                              *
  *                                                                           *
  *---------------------------------------------------------------------------*
  * Comment:                                                                  *
@@ -378,7 +378,7 @@ void Sharc::ConstructBOXDetector(G4LogicalVolume* world){
       G4ThreeVector Box_Wafer_Offset =
       G4ThreeVector(BOX_Wafer_Length_Offset, BOX_Wafer_Width_Offset,0 );
       
-      G4SubtractionSolid* PCB1 = new G4SubtractionSolid("PCB", PCBFull, SlotShape,new G4RotationMatrix,G4ThreeVector(-BOX_PCB_Slot_Position, 0,0.5*BOX_PCB_Thickness));
+      G4SubtractionSolid* PCB1 = new G4SubtractionSolid("PCB", PCBFull, SlotShape,new G4RotationMatrix,G4ThreeVector(BOX_PCB_Slot_Position, 0,0.5*BOX_PCB_Thickness));
       
       G4SubtractionSolid* PCB = new G4SubtractionSolid("PCB", PCB1, WaferShape,new G4RotationMatrix,Box_Wafer_Offset);
       
@@ -469,7 +469,7 @@ void Sharc::ConstructBOXDetector(G4LogicalVolume* world){
 
       // Distance of the PCB to the target
       G4ThreeVector DetectorSpacing =
-        -G4ThreeVector(0, 0,BOX_Exposed_Length1*0.5);
+        -G4ThreeVector(0, 0,BOX_DetectorSpacing);
 
       // If a PAD is present, DSSD is not in the center of the Slot:
       G4ThreeVector PAD_OFFSET=-G4ThreeVector(0.5*PAD_PCB_Thickness,0,0);
-- 
GitLab