From 39dd782c898f209486a0348ed061cc7cf2148a9d Mon Sep 17 00:00:00 2001
From: Nikiforos Nikiforou <Nikiforos.Nikiforou@cern.ch>
Date: Mon, 27 Oct 2014 16:32:06 +0000
Subject: [PATCH] Fixed minor bugs in geometry of CLICSiD example

---
 DDCore/CMakeLists.txt                        |  2 +-
 examples/CLICSiD/compact/compact.xml         | 10 +++++-----
 examples/CLICSiD/src/PolyconeSupport_geo.cpp |  2 +-
 examples/CLICSiD/src/SiTrackerBarrel_geo.cpp |  6 +++++-
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt
index 975c450b4..c6519b47f 100644
--- a/DDCore/CMakeLists.txt
+++ b/DDCore/CMakeLists.txt
@@ -57,4 +57,4 @@ install(TARGETS DD4hepCore
   )
 
 # to do: add corresponding uninstall...
-#-------------------------------------------------------
\ No newline at end of file
+#-------------------------------------------------------
diff --git a/examples/CLICSiD/compact/compact.xml b/examples/CLICSiD/compact/compact.xml
index 37e9eb943..6b84eab79 100644
--- a/examples/CLICSiD/compact/compact.xml
+++ b/examples/CLICSiD/compact/compact.xml
@@ -563,7 +563,7 @@
             </layer>
         </detector>
         
-        <detector id="5" name="SiTrackerForward" type="SiTrackerEndcap2" readout="SiTrackerForwardHits">    
+        <detector id="5" name="SiTrackerForward" type="SiTrackerEndcap2" readout="SiTrackerForwardHits" reflect="true">    
             <comment>Forward Tracker inside Vertex Support Barrel</comment>
             <module name="SiTrackerForwardModule1">
                 <trd x1="ForwardTracker_rmin1 * tan(pi/(ForwardTrackerModules-0.1))" x2="ForwardTracker_rmax * sin(pi/(ForwardTrackerModules-0.1))" z="(ForwardTracker_rmax - ForwardTracker_rmin1) / 2" />
@@ -1275,10 +1275,10 @@
         </detector>
         <detector name="SiTrackerEndcapSupport2Reflect" type="PolyconeSupport" insideTrackingVolume="true" vis="SupportVis">
             <material name="Rohacell31"/>
-            <zplane rmin="510.448*mm" rmax="510.448*mm" z="-750.919" />
-            <zplane rmin="438.449*mm" rmax="510.448*mm" z="-757.218" />
-            <zplane rmin="206.234*mm" rmax="278.187*mm" z="-777.535" />
-            <zplane rmin="206.234*mm" rmax="206.234*mm" z="-783.834" />
+            <zplane rmin="510.448*mm" rmax="510.448*mm" z="-750.919*mm" />
+            <zplane rmin="438.449*mm" rmax="510.448*mm" z="-757.218*mm" />
+            <zplane rmin="206.234*mm" rmax="278.187*mm" z="-777.535*mm" />
+            <zplane rmin="206.234*mm" rmax="206.234*mm" z="-783.834*mm" />
         </detector>
         <detector name="SiTrackerEndcapSupport3Reflect" type="PolyconeSupport" insideTrackingVolume="true" vis="SupportVis">
             <material name="CarbonFiber"/>
diff --git a/examples/CLICSiD/src/PolyconeSupport_geo.cpp b/examples/CLICSiD/src/PolyconeSupport_geo.cpp
index 87bbdec67..b5ca65cff 100644
--- a/examples/CLICSiD/src/PolyconeSupport_geo.cpp
+++ b/examples/CLICSiD/src/PolyconeSupport_geo.cpp
@@ -24,7 +24,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, Ref_t)  {
     xml_comp_t dim(c);
     rmin.push_back(dim.rmin());
     rmax.push_back(dim.rmax());
-    z.push_back(dim.z()/2);
+    z.push_back(dim.z()); //Dropped division by 2 in z. Half length not needed
   }
   if ( num < 2 )  {
     throw runtime_error("PolyCone["+name+"]> Not enough Z planes. minimum is 2!");
diff --git a/examples/CLICSiD/src/SiTrackerBarrel_geo.cpp b/examples/CLICSiD/src/SiTrackerBarrel_geo.cpp
index bb34c972a..9206fd750 100644
--- a/examples/CLICSiD/src/SiTrackerBarrel_geo.cpp
+++ b/examples/CLICSiD/src/SiTrackerBarrel_geo.cpp
@@ -108,7 +108,11 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
       // Loop over the number of modules in z.
       for (int j = 0; j < nz; j++)	  {
 	// Module PhysicalVolume.
-	Transform3D tr(RotationZYX(0,-((M_PI/2)-phic-phi_tilt),M_PI/2),Position(x,y,module_z));
+// 	Transform3D tr(RotationZYX(0,-((M_PI/2)-phic-phi_tilt),M_PI/2),Position(x,y,module_z));
+    
+    //NOTE (Nikiforos, 26/08 Rotations needed to be fixed so that component1 (silicon) is on the outside      
+    Transform3D tr(RotationZYX(0,((M_PI/2)-phic-phi_tilt),-M_PI/2),Position(x,y,module_z));
+          
 	pv = lay_vol.placeVolume(m_env,tr);
 	pv.addPhysVolID("module", module++);
 	// Adjust the x and y coordinates of the module.
-- 
GitLab