]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv11GeometrySDD.cxx
Separating well and badly reconstructed pileup vertices. Adding statistics of associa...
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySDD.cxx
index 6f6983f20998f61e63f36130c98c27391166c5f8..f0a601053bd8eff20fc4d9cb1ddb3b2604b97c6c 100755 (executable)
@@ -11,7 +11,7 @@
  * appear in the supporting documentation. The authors make no claims     *
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
- *********************************s*****************************************/
+ **************************************************************************/
 
 
 //*************************************************************************
@@ -30,6 +30,7 @@
 
 
 // General Root includes
+#include <Riostream.h>
 #include <TMath.h>
 
 // Root Geometry includes
 #include <TGeoTube.h>
 #include <TGeoTrd1.h>
 #include <TGeoArb8.h>
+#include <TGeoXtru.h>
 #include <TGeoCompositeShape.h>
 #include <TGeoMatrix.h>
 #include <TGeoNode.h>
 #include <TGeoPcon.h>
+#include <TGeoTorus.h>
 
-#include "AliITSgeom.h"
-#include "AliITSgeomSDD.h"
 #include "AliITSv11GeometrySDD.h"
 #include "AliITSv11GeomCableFlat.h"
 #include "AliITSv11GeomCableRound.h"
 
-const char*    AliITSv11GeometrySDD::fgSDDsensitiveVolName3 = "ITSsddSensitivL3";
-const char*    AliITSv11GeometrySDD::fgSDDsensitiveVolName4 = "ITSsddSensitivL4";
-const Double_t AliITSv11GeometrySDD::fgkSegmentLength     = 37.2*2*fgkmm;
+const char*    AliITSv11GeometrySDD::fgkSDDsensitiveVolName3 = "ITSsddSensitivL3";
+const char*    AliITSv11GeometrySDD::fgkSDDsensitiveVolName4 = "ITSsddSensitivL4";
+const Double_t AliITSv11GeometrySDD::fgkSegmentLength     = 37.21*2*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLadderWidth       = 50.0*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLadderHeight      = 30.0*fgkmm;
-const Double_t AliITSv11GeometrySDD::fgkLadderSegBoxDW    =  3.5*fgkmm;
-const Double_t AliITSv11GeometrySDD::fgkLadderSegBoxDH    =  3.*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkLadderSegBoxDW    =  7.5*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkLadderSegBoxDH    =  7.1*fgkmm;
 
 const Double_t AliITSv11GeometrySDD::fgkLadderBeamRadius  =  0.6*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLadderLa          =  3.*fgkmm;
@@ -98,7 +99,7 @@ const Double_t AliITSv11GeometrySDD::fgkBTBthick           =  0.25 *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkBTBlength          = 55. *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkBTBwidth           = 18*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkBTBaxisAtoBottom   =  4*fgkmm;
-const Double_t AliITSv11GeometrySDD::fgkBTBaxisAtoBase     =  1.2*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkBTBaxisAtoBase     =  2.2*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkRadiusAminBTB      =  1. *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkRadiusBminBTB      =  0.53 *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkBTBHoleLength      = 15 *fgkmm;
@@ -106,8 +107,8 @@ const Double_t AliITSv11GeometrySDD::fgkBTBHolewidth       =  6 *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkBTBHoleRefX        = 10 *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkBTBHoleRefY        =  6.5 *fgkmm;
 
-const Double_t AliITSv11GeometrySDD::fgkLay3Rmin           = 145.*fgkmm;
-const Double_t AliITSv11GeometrySDD::fgkLay3Rmax           = 200.*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkLay3Rmin           = 129.*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkLay3Rmax           = 205.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay3Length         = (524.+0.)*fgkmm; // ladder+supporting rings (length of the virtual tube)
 const Double_t AliITSv11GeometrySDD::fgkLay3LadderLength   = 524.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay3DetShortRadius = 146.0*fgkmm;
@@ -117,8 +118,8 @@ const Int_t    AliITSv11GeometrySDD::fgkLay3Ndet           =  6;
 const Int_t    AliITSv11GeometrySDD::fgkLay3Nladd          = 14;
 const Double_t AliITSv11GeometrySDD::fgkLay3CoolPipeSuppH  =  7.5*fgkmm;
 
-const Double_t AliITSv11GeometrySDD::fgkLay4Rmin           = 235.*fgkmm;
-const Double_t AliITSv11GeometrySDD::fgkLay4Rmax           = 286.*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkLay4Rmin           = 220.*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkLay4Rmax           = 291.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay4Length         = (671.+0.)*fgkmm;    // ladder+supporting rings (length of the virtual tube)
 const Double_t AliITSv11GeometrySDD::fgkLay4LadderLength   = 671.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay4DetShortRadius = 235.0*fgkmm;
@@ -133,7 +134,7 @@ const Double_t AliITSv11GeometrySDD::fgkEndLaddCardsShortRadiusLay4 = fgkLay4Det
 const Double_t AliITSv11GeometrySDD::fgkDistEndLaddCardsLadd = 0.*fgkmm;
 
 //hybrid 
-const Double_t AliITSv11GeometrySDD::fgkHybridAngle       = 46;           // approx !!!
+const Double_t AliITSv11GeometrySDD::fgkHybridAngle       = 48.5;           // approx !!!
 // Origine taken at the hybrid corner :
 const Double_t AliITSv11GeometrySDD::fgkHybridLength      = 65*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkHybridWidth       = 41*fgkmm;
@@ -159,6 +160,10 @@ const Double_t AliITSv11GeometrySDD::fgkHybFLUpperLength  = 59.878*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkHybFLUpperAlDZ    = 11.183*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkHybFLUpperAldx    =  2.307*fgkmm;
 
+const Double_t AliITSv11GeometrySDD::fgkHybCC2SensorLen   =  9.500*fgkmm;
+const Double_t AliITSv11GeometrySDD::fgkHybCC2SensorWid   =  1.490*fgkcm; //???
+const Double_t AliITSv11GeometrySDD::fgkHybCC2SensorAng   = 15.0;
+
 const Double_t AliITSv11GeometrySDD::fgkmu = 1*fgkmicron; // 1*fgkmicron; // can be increase for checking thin objects
 const Double_t AliITSv11GeometrySDD::fgkHybridThBridgeThick =  0.25*fgkmm;               // ???
 const Double_t AliITSv11GeometrySDD::fgkHybAlThick         =  30*fgkmu;
@@ -195,7 +200,8 @@ const Double_t AliITSv11GeometrySDD::fgkWaferWidth         =  72.5 *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkWaferLength        =  87.6 *fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkWaferThickSens     = 299.8*fgkmu;
 const Double_t AliITSv11GeometrySDD::fgkWaferWidthSens     =  70.17*fgkmm;
-const Double_t AliITSv11GeometrySDD::fgkWaferLengthSens    =  74.97*fgkmm;
+// 256 anodes times 294 microns of pitch
+const Double_t AliITSv11GeometrySDD::fgkWaferLengthSens    =  256*294*fgkmicron;
 
 const Double_t AliITSv11GeometrySDD::fgkDigitCablWidth     = 18.4*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkDigitCablAlThick   = (30+30*8./10.)*fgkmicron; // will probably change
@@ -463,8 +469,14 @@ const Double_t AliITSv11GeometrySDD::fgkSectionPlastPerMod = (TMath::Pi()*(3*0.3
                                                              - fgkSectionCuPerMod);
 
 const Double_t AliITSv11GeometrySDD::fgkSectionGlassPerMod = 3*0.006; // ???
+const Double_t AliITSv11GeometrySDD::fgkSectionCoolPolyuEL = 0.4672;
+const Double_t AliITSv11GeometrySDD::fgkSectionCoolWaterEL = 0.3496;
+const Double_t AliITSv11GeometrySDD::fgkEndLadderEarthCableR = 0.5*fgkmm;
 // (sections are given in cm square)
 const Double_t AliITSv11GeometrySDD::fgkCableBendRatio = 1.3; // ??? this factor account for the bending of cables
+const Double_t AliITSv11GeometrySDD::fgkHybridAlFoilThick = 0.1*fgkmm; // Thickness of Al foil on hybrid side - TO BE CHECKED
+const Double_t AliITSv11GeometrySDD::fgkHybridAlFoilWide = 4.2*fgkmm; // Width of Al foil on hybrid side - from digitCableA
+const Double_t AliITSv11GeometrySDD::fgkHybridAlFoilSide = 2.0*fgkmm; // Side length of Al foil on hybrid side
 
 const Double_t AliITSv11GeometrySDD::fgkConeSDDr1 = 11.87574*fgkcm;
 const Double_t AliITSv11GeometrySDD::fgkConeSDDr2 = 26.07574*fgkcm;
@@ -485,11 +497,8 @@ const Double_t AliITSv11GeometrySDD::fgkSDDCableR5    =  37*fgkcm; // third part
 const Double_t AliITSv11GeometrySDD::fgkSDDCableZ5    =  65*fgkcm; // third part of "cable cone"
 
 
-
-
-
-
-
+using std::endl;
+using std::cout;
 ClassImp(AliITSv11GeometrySDD)
 
 //________________________________________________________________________
@@ -502,6 +511,7 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD():
   fSDDsensor4(0),
   fBaseThermalBridge(0),
   fHybrid(0),
+  fLadderFoot(0),
   fCardLVR(0),
   fCardLVL(0),
   fCardHV(0),
@@ -542,6 +552,14 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD():
   //
   // Standard constructor
   //
+  fCommonVol[0] = NULL;
+  fCommonVol[1] = NULL;
+  fCommonTr[0] = NULL;
+  fCommonTr[1] = NULL;
+  for (Int_t i=0; i<fgkNladdSegCommonVol; i++){
+    fLaddSegCommonVol[i] = NULL;
+    fLaddSegCommonTr[i] = NULL;
+  }
   SetParameters();
 }
 
@@ -556,6 +574,7 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD(Int_t debug) :
   fSDDsensor4(0),
   fBaseThermalBridge(0),
   fHybrid(0),
+  fLadderFoot(0),
   fCardLVR(0),
   fCardLVL(0),
   fCardHV(0),
@@ -596,6 +615,14 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD(Int_t debug) :
   //
   // Constructor setting debugging level
   //
+  fCommonVol[0] = NULL;
+  fCommonVol[1] = NULL;
+  fCommonTr[0] = NULL;
+  fCommonTr[1] = NULL;
+  for (Int_t i=0; i<fgkNladdSegCommonVol; i++){
+    fLaddSegCommonVol[i] = NULL;
+    fLaddSegCommonTr[i] = NULL;
+  }
   SetParameters();
 }
 
@@ -609,6 +636,7 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD(const AliITSv11GeometrySDD &s) :
   fSDDsensor4(s.fSDDsensor4),
   fBaseThermalBridge(s.fBaseThermalBridge),
   fHybrid(s.fHybrid),
+  fLadderFoot(s.fLadderFoot),
   fCardLVR(s.fCardLVR),
   fCardLVL(s.fCardLVL),
   fCardHV(s.fCardHV),
@@ -648,6 +676,14 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD(const AliITSv11GeometrySDD &s) :
 {
   //     Copy Constructor
   // do only a "shallow copy" ...
+  fCommonVol[0] = s.fCommonVol[0];
+  fCommonVol[1] = s.fCommonVol[1];
+  fCommonTr[0] = s.fCommonTr[0];
+  fCommonTr[1] = s.fCommonTr[1];
+  for (Int_t i=0; i<fgkNladdSegCommonVol; i++){
+    fLaddSegCommonVol[i] = s.fLaddSegCommonVol[i];
+    fLaddSegCommonTr[i] = s.fLaddSegCommonTr[i];
+  }
   SetParameters();
 }
 
@@ -687,7 +723,7 @@ void AliITSv11GeometrySDD::SetParameters() {
   // Define display colors and the non constant geometry parameters
   //
 
-  Double_t detLadderDist = 8*fgkmm; 
+  Double_t detLadderDist = 8.4*fgkmm; 
 
   fLay3LadderUnderSegDH = detLadderDist - (fgkWaHVcableAlThick+fgkWaHVcablePolyThick);
   fLay4LadderUnderSegDH = detLadderDist - (fgkWaHVcableAlThick+fgkWaHVcablePolyThick);
@@ -732,7 +768,7 @@ TGeoMedium* AliITSv11GeometrySDD::GetMedium(const char* mediumName) {
   //
 
   char ch[30];
-  sprintf(ch, "ITS_%s",mediumName);
+  snprintf(ch, 30, "ITS_%s",mediumName);
   TGeoMedium* medium =  gGeoManager->GetMedium(ch);
   if (! medium)
     printf("Error(AliITSv11GeometrySDD)::medium %s not found !\n", mediumName);
@@ -787,9 +823,10 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
   TGeoMedium *carbonFiberLadderStruct = GetMedium("SDD C AL (M55J)$"); //ITSsddCarbonM55J
   TGeoMedium *polyhamideSDD   = GetMedium("SDDKAPTON (POLYCH2)$");//ITSsddKAPTON_POLYCH2
   TGeoMedium *alSDD           = GetMedium("AL$"); //ITSal
-  TGeoMedium *stainless       = GetMedium("INOX$"); // for screws, what is the material ???????????
+  TGeoMedium *stainless       = GetMedium("AISI304L$"); // for screws
   TGeoMedium *coolerMediumSDD = GetMedium("WATER$");
-  TGeoMedium *raccordMedium   = GetMedium("INOX$");  // ??? material of raccordo ???
+  TGeoMedium *raccordMedium   = GetMedium("INOX$");  // same as AISI 316-L
+  TGeoMedium *copperMedium    = GetMedium("COPPER$");
 
   //********************************************************************
   // pieces of the carbon fiber structure
@@ -805,11 +842,13 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
   Double_t distCenterSideDown =  0.5*fgkLadderWidth/TMath::Cos(beta);
 
   //--- the top V of the Carbon Fiber Ladder (segment)
-  TGeoArb8 *cfLaddTop1 = CreateLadderSide( fgkSegmentLength/2., halfTheta, 
+  TGeoArb8 *cfLaddTop1 = CreateLadderSide( "CFladdTopCornerVol1shape",
+                                          fgkSegmentLength/2., halfTheta, 
                          -1, fgkLadderLa, fgkLadderHa, fgkLadderl);
   TGeoVolume *cfLaddTopVol1 = new TGeoVolume("ITSsddCFladdTopCornerVol1",
                                  cfLaddTop1,carbonFiberLadderStruct);
-  TGeoArb8 *cfLaddTop2 = CreateLadderSide( fgkSegmentLength/2., halfTheta,
+  TGeoArb8 *cfLaddTop2 = CreateLadderSide( "CFladdTopCornerVol2shape",
+                                          fgkSegmentLength/2., halfTheta,
                           1, fgkLadderLa, fgkLadderHa, fgkLadderl);
   TGeoVolume *cfLaddTopVol2 = new TGeoVolume("ITSsddCFladdTopCornerVol2",
                                  cfLaddTop2, carbonFiberLadderStruct);
@@ -818,11 +857,13 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
   TGeoTranslation *trTop1 = new TGeoTranslation(0, fgkLadderHeight/2-dy, 0);
 
   //--- the 2 side V
-  TGeoArb8 *cfLaddSide1 = CreateLadderSide( fgkSegmentLength/2., beta, -1,
+  TGeoArb8 *cfLaddSide1 = CreateLadderSide( "CFladdSideCornerVol1shape",
+                                           fgkSegmentLength/2., beta, -1,
                                            fgkLadderLb, fgkLadderHb, fgkLadderl);
   TGeoVolume *cfLaddSideVol1 = new TGeoVolume( "ITSsddCFladdSideCornerVol1",
                                   cfLaddSide1,carbonFiberLadderStruct);
-  TGeoArb8 *cfLaddSide2 = CreateLadderSide( fgkSegmentLength/2., beta, 1,
+  TGeoArb8 *cfLaddSide2 = CreateLadderSide( "CFladdSideCornerVol2shape",
+                                           fgkSegmentLength/2., beta, 1,
                                            fgkLadderLb, fgkLadderHb, fgkLadderl);
   TGeoVolume *cfLaddSideVol2 = new TGeoVolume( "ITSsddCFladdSideCornerVol2",
                                   cfLaddSide2,carbonFiberLadderStruct);
@@ -936,6 +977,14 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
   TGeoCombiTrans *bottomBeamTransf5 = new TGeoCombiTrans
     (0,-(fgkLadderHeight/2-fgkLadderBeamRadius)-dy,fgkSegmentLength/4, bottomBeamRot5);
 
+  // The ground wire running on the top vertex - M.S. 12 nov 2013
+  TGeoTube *groundWire = new TGeoTube(0, fgkEndLadderEarthCableR, fgkSegmentLength/2);
+  TGeoVolume *groundWireVol = new TGeoVolume("ITSsddGroundWire", groundWire,
+                                            copperMedium);
+  groundWireVol->SetLineColor(41); // should be something brown-ish
+  TGeoTranslation *trGroundWire = new TGeoTranslation(0,
+                              fgkLadderHeight/2-5*fgkEndLadderEarthCableR, 0);
+
   fLaddSegCommonVol[0] = cfLaddTopVol1;  fLaddSegCommonTr[0] = trTop1;
   fLaddSegCommonVol[1] = cfLaddTopVol2;  fLaddSegCommonTr[1] = trTop1;
   fLaddSegCommonVol[2] = cfLaddSideVol1; fLaddSegCommonTr[2] = ctSideR;
@@ -955,6 +1004,7 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
   fLaddSegCommonVol[16]= bottomBeam2Vol; fLaddSegCommonTr[16]= bottomBeamTransf3;
   fLaddSegCommonVol[17]= bottomBeam3Vol; fLaddSegCommonTr[17]= bottomBeamTransf4;
   fLaddSegCommonVol[18]= bottomBeam3Vol; fLaddSegCommonTr[18]= bottomBeamTransf5;
+  fLaddSegCommonVol[19]= groundWireVol;  fLaddSegCommonTr[19]= trGroundWire;
 
  
   //********************************************************************
@@ -962,7 +1012,7 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
   //********************************************************************
   char cableName[30];
   for (Int_t i=0; i<fgkLay3Ndet; i++) {
-    sprintf(cableName, "digitCableLay3A_%i",i);
+    snprintf(cableName, 30, "digitCableLay3A_%i",i);
     fDigitCableLay3A[i].SetName(cableName);
     fDigitCableLay3A[i].SetWidth(fgkDigitCablWidth);
     fDigitCableLay3A[i].SetThickness(fgkDigitCablPolyThick+fgkDigitCablAlThick);
@@ -970,7 +1020,7 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
     fDigitCableLay3A[i].SetLayer( 0, fgkDigitCablPolyThick, polyhamideSDD,
                                  fColorPolyhamide);
     fDigitCableLay3A[i].SetLayer(1, fgkDigitCablAlThick, alSDD, fColorAl);
-    sprintf(cableName, "digitCableLay3B_%i",i);
+    snprintf(cableName, 30, "digitCableLay3B_%i",i);
     fDigitCableLay3B[i].SetName(cableName);
     fDigitCableLay3B[i].SetWidth(fgkDigitCablWidth);
     fDigitCableLay3B[i].SetThickness(fgkDigitCablPolyThick+fgkDigitCablAlThick);
@@ -980,7 +1030,7 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
     fDigitCableLay3B[i].SetLayer(1, fgkDigitCablAlThick, alSDD, fColorAl);
   };
   for (Int_t i=0; i<fgkLay4Ndet; i++) {
-    sprintf(cableName, "digitCableLay4A_%i",i);
+    snprintf(cableName, 30, "digitCableLay4A_%i",i);
     fDigitCableLay4A[i].SetName(cableName);
     fDigitCableLay4A[i].SetWidth(fgkDigitCablWidth);
     fDigitCableLay4A[i].SetThickness(fgkDigitCablPolyThick+fgkDigitCablAlThick);
@@ -988,7 +1038,7 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
     fDigitCableLay4A[i].SetLayer( 0, fgkDigitCablPolyThick, polyhamideSDD,
                                  fColorPolyhamide);
     fDigitCableLay4A[i].SetLayer(1, fgkDigitCablAlThick, alSDD, fColorAl);
-    sprintf(cableName, "digitCableLay4B_%i",i);
+    snprintf(cableName, 30, "digitCableLay4B_%i",i);
     fDigitCableLay4B[i].SetName(cableName);
     fDigitCableLay4B[i].SetWidth(fgkDigitCablWidth);
     fDigitCableLay4B[i].SetThickness(fgkDigitCablPolyThick+fgkDigitCablAlThick);
@@ -1016,7 +1066,7 @@ void AliITSv11GeometrySDD::CreateBasicObjects() {
 
   fLadderFoot = CreateLadderFoot();
   CreateLVCard();
-  fCardHV     = CreateHVCard(0);
+  fCardHV     = CreateHVCard();
   fCardCarlos = CreateCarlosCard(0);
 
   //==================
@@ -1138,7 +1188,7 @@ void AliITSv11GeometrySDD::ShowOnePiece(TGeoVolume *moth) {
 //   TGeoVolumeAssembly *highVCard = CreateHVCard( 4 );
 //   moth->AddNode(highVCard, 1, 0);
 
-//   TGeoVolumeAssembly *supportRing = CreateSupportRing( 4 );
+//   TGeoVolumeAssembly *supportRing = CreateSupportRing();
 //   moth->AddNode(supportRing, 1, 0);
 
 //   TGeoVolume *endLadderCards = CreateEndLadderCardsV( 4 );
@@ -1215,6 +1265,7 @@ void AliITSv11GeometrySDD::Layer3(TGeoVolume *moth) {
 
   TGeoVolumeAssembly *lay3Ladder    = CreateLadder(3);
   TGeoVolumeAssembly *lay3Detectors = CreateDetectorsAssembly(3);
+  TGeoVolumeAssembly *lay3Ladd2Det  = CreateDetectorsAssemblyLadd2();
   //TGeoVolume *lay3Detectors = CreateDetectors(3);
   TGeoTube *virtualLayer3Shape = new TGeoTube("ITSsddLayer3Shape",
                                     fgkLay3Rmin,fgkLay3Rmax,fgkLay3Length*0.5);
@@ -1236,7 +1287,7 @@ void AliITSv11GeometrySDD::Layer3(TGeoVolume *moth) {
   for (Int_t iLadd = iLaddMin; iLadd < iLaddMax; iLadd++) {
 
     Double_t ladderPhi = -3*dPhi+iLadd*dPhi;
-    sprintf(rotName, "ITSsddLay3Ladd%i",iLadd);
+    snprintf(rotName, 30, "ITSsddLay3Ladd%i",iLadd);
     Double_t minRadiusLadBox = fLay3LaddShortRadius-fLay3LadderUnderSegDH;
     if (iLadd%2 != 0)
       minRadiusLadBox = fLay3LaddLongRadius-fLay3LadderUnderSegDH;
@@ -1256,19 +1307,19 @@ void AliITSv11GeometrySDD::Layer3(TGeoVolume *moth) {
                                0, ladderPhi, kFALSE);
     virtualLayer3->AddNode(lay3Ladder, iLadd, ctLadd);
     ///////////////////////////////////////////////////
-    sprintf(rotName, "ITSsddLay3DetBox%i",iLadd);
+    snprintf(rotName, 30, "ITSsddLay3DetBox%i",iLadd);
     Double_t minRadiusDetBox = fgkLay3DetShortRadius;
     if (iLadd%2 != 0) minRadiusDetBox = fgkLay3DetLongRadius;
     minRadiusDetBox += detectorsThick/2;
     TGeoCombiTrans *ctDet;
+    ctDet = CreateCombiTrans(rotName, minRadiusDetBox,
+                            0, ladderPhi, kTRUE);
+
     if (iLadd != 2)
-      ctDet = CreateCombiTrans(rotName, minRadiusDetBox,
-                              0, ladderPhi, kTRUE);
+      virtualLayer3->AddNode(lay3Detectors, iLadd, ctDet);
     else
-      ctDet = CreateCombiTrans(rotName, minRadiusDetBox,
-                              0, ladderPhi, kFALSE);
+      virtualLayer3->AddNode(lay3Ladd2Det , iLadd, ctDet);
 
-    virtualLayer3->AddNode(lay3Detectors, iLadd, ctDet);
     ///////////////////////////////////////////////////
   }
 
@@ -1463,7 +1514,7 @@ void AliITSv11GeometrySDD::ForwardLayer3(TGeoVolume *moth) {
     Double_t dR = 0;
     if (iLadd%2 != 0) dR = fgkLay3DetLongRadius-fgkLay3DetShortRadius;
 
-    sprintf(rotName, "ITSsddLay3EndLadd%i",iLadd);
+    snprintf(rotName, 30, "ITSsddLay3EndLadd%i",iLadd);
 
     TGeoCombiTrans *ctEndLaddPos = CreateCombiTrans(rotName, dR,
                                    fgkLay3Length/2, ladderPhi, kTRUE);
@@ -1479,8 +1530,12 @@ void AliITSv11GeometrySDD::ForwardLayer3(TGeoVolume *moth) {
     virtualForward3Neg->CheckOverlaps(0.01);
   }
 
-  moth->AddNode(virtualForward3Pos, 1);
-  moth->AddNode(virtualForward3Neg, 1);
+  // 180deg Y rotation to compensate the cancellation of ITSD volume
+  // (idortm[199] in AliITSv11Hybrid : z--->  -z;   x ---> -x;   y ---> y)
+  TGeoRotation *y180 = new TGeoRotation();
+  y180->SetAngles( 90.,180., 90., 90.,180.,  0.);
+  moth->AddNode(virtualForward3Pos, 1, y180);
+  moth->AddNode(virtualForward3Neg, 1, y180);
 }
 
 //________________________________________________________________________
@@ -1518,7 +1573,7 @@ void AliITSv11GeometrySDD::Layer4(TGeoVolume *moth) {
 
   // placing virtual ladder and detectors volumes following ladder 
   // ordering convention
-  char rotName[20];
+  char rotName[30];
   Int_t iLaddMin = 0;
   Int_t iLaddMax = fgkLay4Nladd;
   if ((fAddOnlyLadder4min >= 0)&&(fAddOnlyLadder4max < fgkLay4Nladd)) {
@@ -1528,7 +1583,7 @@ void AliITSv11GeometrySDD::Layer4(TGeoVolume *moth) {
   for (Int_t iLadd = iLaddMin; iLadd < iLaddMax; iLadd++) {
 
     Double_t ladderPhi = -5*dPhi + iLadd*dPhi;
-    sprintf(rotName, "ITSsddLay4Ladd%i",iLadd);
+    snprintf(rotName, 30, "ITSsddLay4Ladd%i",iLadd);
     Double_t minRadiusLadBox = fLay4LaddShortRadius-fLay4LadderUnderSegDH;
     if (iLadd%2 != 0)
       minRadiusLadBox = fLay4LaddLongRadius-fLay4LadderUnderSegDH;
@@ -1537,7 +1592,7 @@ void AliITSv11GeometrySDD::Layer4(TGeoVolume *moth) {
                                              0, ladderPhi, kTRUE);
     virtualLayer4->AddNode(lay4Ladder, iLadd, ctLadd);
     ///////////////////////////////////////////////////
-    sprintf(rotName, "ITSsddLay4DetBox%i",iLadd);
+    snprintf(rotName, 30, "ITSsddLay4DetBox%i",iLadd);
     Double_t minRadiusDetBox = fgkLay4DetShortRadius;
     if (iLadd%2 != 0)
       minRadiusDetBox = fgkLay4DetLongRadius;
@@ -1719,7 +1774,7 @@ void AliITSv11GeometrySDD::ForwardLayer4(TGeoVolume *moth) {
     if (iLadd%2 != 0)
       dR = fgkLay4DetLongRadius-fgkLay4DetShortRadius;
 
-    sprintf(rotName, "ITSsddLay4EndLadd%i",iLadd);
+    snprintf(rotName, 30, "ITSsddLay4EndLadd%i",iLadd);
 
     TGeoCombiTrans *ctEndLaddPos = CreateCombiTrans(rotName, dR,
                                   fgkLay4Length/2, ladderPhi, kTRUE);
@@ -1729,8 +1784,12 @@ void AliITSv11GeometrySDD::ForwardLayer4(TGeoVolume *moth) {
     virtualForward4Neg->AddNode(lay4EndLadder, iLadd*2, ctEndLaddNeg);
   }
 
-  moth->AddNode(virtualForward4Pos, 1);
-  moth->AddNode(virtualForward4Neg, 1);
+  // 180deg Y rotation to compensate the cancellation of ITSD volume
+  // (idortm[199] in AliITSv11Hybrid : z--->  -z;   x ---> -x;   y ---> y)
+  TGeoRotation *y180 = new TGeoRotation();
+  y180->SetAngles( 90.,180., 90., 90.,180.,  0.);
+  moth->AddNode(virtualForward4Pos, 1, y180);
+  moth->AddNode(virtualForward4Neg, 1, y180);
 }
 
 
@@ -1771,7 +1830,7 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateLadder(Int_t iLay) {
 
     //TGeoVolumeAssembly *laddSegment = CreateLadderSegment(iLay, iSegment);
     TGeoVolume *laddSegment = CreateLadderSegment(iLay, iSegment);
-    sprintf(transName, "ITSsddLay%iLaddSeg%i", iLay, iSegment);
+    snprintf(transName, 30, "ITSsddLay%iLaddSeg%i", iLay, iSegment);
     Double_t segmentPos = fgkSegmentLength*(nDetectors/2-1-iSegment) 
                           + fgkSegmentLength/2;
     TGeoTranslation *segTr = new TGeoTranslation(transName, 0,
@@ -1783,7 +1842,7 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateLadder(Int_t iLay) {
 
     TGeoVolume *laddSegment = CreateLadderSegment(iLay, iSegment);
     //TGeoVolumeAssembly *laddSegment = CreateLadderSegment(iLay, iSegment);
-    sprintf(transName, "ITSsddLay%iLaddSeg%i", iLay, iSegment);
+    snprintf(transName, 30, "ITSsddLay%iLaddSeg%i", iLay, iSegment);
     Double_t segmentPos = fgkSegmentLength*(nDetectors/2-1-iSegment) 
                           + fgkSegmentLength/2;
     TGeoTranslation *segTr = new TGeoTranslation(transName, 0,
@@ -1843,7 +1902,7 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateLadder(Int_t iLay) {
   AliITSv11GeomCableFlat cableHV[fgkLay4Ndet];  // temp !!!
   char cableHVname[30];
   for (Int_t iSegment = 0; iSegment<nDetectors; iSegment++) {
-    sprintf(cableHVname,"ITSsddHVcable%i", iSegment);
+    snprintf(cableHVname,30,"ITSsddHVcable%i", iSegment);
     cableHV[iSegment].SetName(cableHVname);
     cableHV[iSegment].SetThickness(fgkLongHVcablePolyThick+fgkLongHVcableAlThick);
     cableHV[iSegment].SetWidth(fgkTransitHVtailWidth);
@@ -1854,7 +1913,7 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateLadder(Int_t iLay) {
     cableHV[iSegment].SetInitialNode(virtualLadder);
   };
   Double_t x1[3], x2[3], x3[3],
-          vY[3] = {0,1,0}, vZ[3] = {0,0,1}, vYZ[3]={0,1,1};
+    vY[3] = {0,1,0}, vZ[3] = {0,0,1};
 
   x1[0] = -fgkTransitHVtailXpos;
   x2[0] = -fgkTransitHVtailXpos;
@@ -1881,7 +1940,7 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateLadder(Int_t iLay) {
     cableHV[iSegment].CreateAndInsertBoxCableSegment(2,0);
   };
 
-  vYZ[2] = -1;
+  //  vYZ[2] = -1;
   x1[0] = fgkTransitHVtailXpos;
   x2[0] = fgkTransitHVtailXpos;
   x3[0] = fgkTransitHVtailXpos;
@@ -1912,21 +1971,32 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateLadder(Int_t iLay) {
 
 
 //________________________________________________________________________
-TGeoArb8 *AliITSv11GeometrySDD::CreateLadderSide(Double_t dz, Double_t angle,
-                         Double_t xSign, Double_t L, Double_t H, Double_t l) {
+TGeoArb8 *AliITSv11GeometrySDD::CreateLadderSide(const char *name,
+                         Double_t dz, Double_t angle, Double_t xSign,
+                         Double_t L, Double_t H, Double_t l) {
     // Create one half of the V shape corner of CF ladder
   
     TGeoArb8 *cfLaddSide = new TGeoArb8(dz);
-    cfLaddSide->SetVertex( 0, 0,  0);
-    cfLaddSide->SetVertex( 1, 0, -H);
-    cfLaddSide->SetVertex( 2, xSign*(L*TMath::Sin(angle)-l*TMath::Cos(angle)),
-                          -L*TMath::Cos(angle)-l*TMath::Sin(angle));
-    cfLaddSide->SetVertex( 3, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
-    cfLaddSide->SetVertex( 4, 0,  0);
-    cfLaddSide->SetVertex( 5, 0, -H);
-    cfLaddSide->SetVertex( 6, xSign*(L*TMath::Sin(angle)-l*TMath::Cos(angle)),
-                          -L*TMath::Cos(angle)-l*TMath::Sin(angle));
-    cfLaddSide->SetVertex(7, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
+    cfLaddSide->SetName(name);
+
+    // Points must be in clockwise order
+    cfLaddSide->SetVertex(0, 0,  0);
+    cfLaddSide->SetVertex(2, xSign*(L*TMath::Sin(angle)-l*TMath::Cos(angle)),
+                         -L*TMath::Cos(angle)-l*TMath::Sin(angle));
+    cfLaddSide->SetVertex(4, 0,  0);
+    cfLaddSide->SetVertex(6, xSign*(L*TMath::Sin(angle)-l*TMath::Cos(angle)),
+                         -L*TMath::Cos(angle)-l*TMath::Sin(angle));
+    if (xSign < 0) {
+     cfLaddSide->SetVertex(1, 0, -H);
+     cfLaddSide->SetVertex(3, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
+     cfLaddSide->SetVertex(5, 0, -H);
+     cfLaddSide->SetVertex(7, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
+    } else {
+     cfLaddSide->SetVertex(1, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
+     cfLaddSide->SetVertex(3, 0, -H);
+     cfLaddSide->SetVertex(5, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
+     cfLaddSide->SetVertex(7, 0, -H);
+    }
     return cfLaddSide;
 }
 
@@ -1960,15 +2030,34 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
   TGeoMedium *alSDD80p100             = GetMedium("AL$");                 // to code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   TGeoMedium *alSDD50p100             = GetMedium("AL$");                 // to code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   TGeoMedium *polyhamideSDD           = GetMedium("SDDKAPTON (POLYCH2)$"); //ITSsddKAPTON_POLYCH2
-  TGeoMedium *niSDD                   = GetMedium("COPPER$");                // to code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *niSDD                   = GetMedium("NICKEL$");
   TGeoMedium *glueAG                  = GetMedium("SDDKAPTON (POLYCH2)$");  // to code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   TGeoMedium *siliconSDD              = GetMedium("SDD SI CHIP$"); //ITSsddSiChip
-  TGeoMedium *medSMD                  = GetMedium("SDD X7R capacitors$");      //  SDDX7Rcapacitors   TO CHECK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  TGeoMedium *medSMDweld              = GetMedium("SDD X7R capacitors$");      //  SDDX7Rcapacitors  TO CHECK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *medSMD                  = GetMedium("SDD X7R capacitors$"); //  SDDX7Rcapacitors
+  TGeoMedium *medSMDweld              = GetMedium("SDD X7R weld$");
 
   //**************************************************** main volume :
-  TGeoBBox *hybridBox = new TGeoBBox("",fgkHybridWidth/2, volumeThick/2,
-                                    (fgkHybridLength)/2);
+//  TGeoBBox *hybridBox = new TGeoBBox("",fgkHybridWidth/2, volumeThick/2,
+//                                  (fgkHybridLength)/2);
+  Double_t xhybr[6],yhybr[6];
+  xhybr[0] = -fgkHybridWidth/2;
+  yhybr[0] = -volumeThick/2;
+  xhybr[1] =  fgkHybridWidth/2;
+  yhybr[1] = -volumeThick/2;
+  xhybr[2] =  fgkHybridWidth/2;
+  yhybr[2] =  volumeThick/2;
+  xhybr[3] = -fgkHybridWidth/2;
+  yhybr[3] =  volumeThick/2;
+  xhybr[4] =  xhybr[3] - 1.05*fgkHybCC2SensorLen*SinD(fgkHybCC2SensorAng);
+  yhybr[4] =  yhybr[3] - 1.05*fgkHybCC2SensorLen*CosD(fgkHybCC2SensorAng);
+  xhybr[5] =  xhybr[4];
+  yhybr[5] =  yhybr[4] - volumeThick;
+
+  TGeoXtru *hybridBox = new TGeoXtru(2);
+  hybridBox->DefinePolygon(6, xhybr, yhybr);
+  hybridBox->DefineSection(0,-fgkHybridLength/2);
+  hybridBox->DefineSection(1, fgkHybridLength/2);
+
   TGeoVolume *hybrid = new TGeoVolume("ITSsddHybridVol", hybridBox,
                                      airSDD);
  
@@ -2078,7 +2167,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
   TGeoBBox *sAlBar2 = new TGeoBBox("sAlBar2", fgkHybridWidth/2,
                                   fgkHybAlThick/2, sideWidth2/2);
 
- TGeoTranslation *upGlueBarTr2 = new TGeoTranslation("upGlueBarTr2", 0,
 TGeoTranslation *upGlueBarTr2 = new TGeoTranslation("upGlueBarTr2", 0,
                              lowLayerYmin+(fgkHybGlueLowThick+fgkHybUpThick)/2,
                                               (fgkHybridLength-sideWidth2)/2);
   TGeoTranslation *alBarTr2 = new TGeoTranslation("alBarTr2", 0,
@@ -2159,7 +2248,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
   Double_t vX[3] = {1,0,0};
   for (Int_t i=0; i<3; i++) {
     char ch[20];
-    sprintf(ch, "lowFLpieceA%i", i+4);
+    snprintf(ch, 20, "lowFLpieceA%i", i+4);
     lowFLpiece.SetName(ch);
     lowFLpiece.SetWidth(zChips[i+1]-zChips[i]-fgkHybFLlowHoleDZ);
 
@@ -2173,7 +2262,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
     lowFLpiece.CreateAndInsertBoxCableSegment(1,90);
     lowFLpiece.ResetPoints();
 
-    sprintf(ch, "lowFLpieceB%i", i+4);
+    snprintf(ch, 20, "lowFLpieceB%i", i+4);
     lowFLpiece.SetName(ch);
     x1[0] = fgkHybridWidth/2 - piece3width;
     x2[0] = x1[0] - fgkHybFLlowHoleAmbDX;
@@ -2200,7 +2289,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
   char ch[20];
 
   for (Int_t i=0; i<4; i++) {
-    sprintf(ch, "pascalCC%i", i);
+    snprintf(ch, 20, "pascalCC%i", i);
     chip.SetName(ch);
     x1[0] = fgkHybFLlowPasX - fgkHybridWidth/2 - fgkHybPascalDX/2;
     x2[0] = x1[0] + fgkHybPascalDX;
@@ -2211,7 +2300,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
     chip.CreateAndInsertBoxCableSegment(1,-90);
     chip.ResetPoints();
 
-    sprintf(ch, "ambraCC%i", i);
+    snprintf(ch, 20, "ambraCC%i", i);
     chip.SetName(ch);
     x1[0] = fgkHybFLlowAmbX - fgkHybridWidth/2 - fgkHybAmbraDX/2;
     x2[0] = x1[0] + fgkHybAmbraDX;
@@ -2224,8 +2313,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
   //**************************************************** CC outside chips:
   // I don't think there is a second aluminium layer here ...
   for (Int_t i = 0; i<4; i++) {
-    char ch[20];
-    sprintf(ch, "ccLayerA%i", i);
+    snprintf(ch, 20, "ccLayerA%i", i);
 
     AliITSv11GeomCableFlat ccLayer1(ch, 6.6*fgkmm, ccUpLayerTotThick);
     ccLayer1.SetInitialNode(hybrid);
@@ -2245,7 +2333,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
     ccLayer1.AddCheckPoint( hybrid, 1, x2, vX );
     ccLayer1.CreateAndInsertBoxCableSegment(1,-90);
 
-    sprintf(ch, "ccLayerB%i", i);
+    snprintf(ch, 20, "ccLayerB%i", i);
     AliITSv11GeomCableFlat ccLayer2(ch, fgkHybChipsDZ, ccUpLayerTotThick);
     ccLayer2.SetInitialNode(hybrid);
     ccLayer2.SetNLayers(2);
@@ -2259,7 +2347,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
     ccLayer2.AddCheckPoint( hybrid, 1, x2, vX );
     ccLayer2.CreateAndInsertBoxCableSegment(1,-90);
     ccLayer2.ResetPoints();
-    sprintf(ch, "ccLayerC%i", i);
+    snprintf(ch, 20, "ccLayerC%i", i);
     ccLayer2.SetName(ch);
     x1[0] =  -fgkHybridWidth/2 + fgkHybFLlowAmbX + fgkHybAmbraDX/2;
     x2[0] = fgkHybridWidth/2 - fgkHybFLUpperWidth + 3*fgkmm;
@@ -2270,6 +2358,54 @@ TGeoVolume* AliITSv11GeometrySDD::CreateHybrid(Int_t iLRSide) {
     ccLayer2.AddCheckPoint( hybrid, 0, x1, vX );
     ccLayer2.AddCheckPoint( hybrid, 1, x2, vX );
     ccLayer2.CreateAndInsertBoxCableSegment(1,-90);
+
+  //**************************************************** CC to sensors:
+  // (alas, we cannot use GeomCableFlat here because section is not constant)
+    Double_t xcc[8],ycc[8];
+    xcc[0] = -0.5*ccLayer1.GetWidth();
+    ycc[0] =  0;
+    xcc[1] =  0.5*ccLayer1.GetWidth();
+    ycc[1] =  0;
+    xcc[2] = xcc[1];
+    ycc[2] = -fgkHybCC2SensorLen*0.8;
+    xcc[3] = xcc[2] + 0.1*fgkHybCC2SensorWid;
+    ycc[3] = ycc[2];
+    xcc[4] = xcc[3];
+    ycc[4] = -fgkHybCC2SensorLen;
+    xcc[5] = xcc[4] - fgkHybCC2SensorWid;
+    ycc[5] = ycc[4];
+    xcc[6] = xcc[5];
+    ycc[6] = 0.8*ycc[5];
+    xcc[7] = xcc[0];
+    ycc[7] = 0.2*ycc[5];
+
+    TGeoXtru* ccToSensPoliSh = new TGeoXtru(2);
+    ccToSensPoliSh->DefinePolygon(8, xcc, ycc);
+    ccToSensPoliSh->DefineSection(0, 0.);
+    ccToSensPoliSh->DefineSection(1, ccLayer1.GetThickness());
+
+    snprintf(ch, 20, "ccToSens%i", i);
+    TGeoVolume* ccToSensPoliVol = new TGeoVolume(ch, ccToSensPoliSh, polyhamideSDD);
+    ccToSensPoliVol->SetLineColor(fColorPolyhamide);
+
+    TGeoXtru* ccToSensAlSh = new TGeoXtru(2);
+    xcc[6] += 0.001;
+    ycc[7] -= 0.001;
+    ccToSensAlSh->DefinePolygon(8, xcc, ycc);
+    ccToSensAlSh->DefineSection(0, 0.);
+    ccToSensAlSh->DefineSection(1, fgkHybAlCCThick);
+
+    snprintf(ch, 20, "ccToSensAl%i", i);
+    TGeoVolume* ccToSensAlVol = new TGeoVolume(ch, ccToSensAlSh, alSDD50p100);
+    ccToSensAlVol->SetLineColor(fColorAl);
+
+    ccToSensPoliVol->AddNode(ccToSensAlVol, 1, 0);
+
+    Double_t coord[3];
+    ccLayer1.GetPoint(0,coord);
+    hybrid->AddNode(ccToSensPoliVol, i+1,
+                   new TGeoCombiTrans(coord[0], coord[1], coord[2],
+                       new TGeoRotation("",-90-fgkHybCC2SensorAng, 90, 90)));
   };
 
   //**************************************************** FL UP:
@@ -2370,6 +2506,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateLadderSegment(Int_t iLay, Int_t iSeg) {
   TGeoMedium *phynoxSDD       = GetMedium("INOX$");
   TGeoMedium *coolerMediumSDD = GetMedium("WATER$");
   TGeoMedium *airSDD          = GetMedium("SDD AIR$");
+  TGeoMedium *alSDD           = GetMedium("AL$");
 
   Double_t tDY = fgkLadderSegBoxDH/2; //space left on top of the ladder 
   Double_t segmentLength = fgkSegmentLength;
@@ -2433,11 +2570,37 @@ TGeoVolume* AliITSv11GeometrySDD::CreateLadderSegment(Int_t iLay, Int_t iSeg) {
  
   //TGeoVolumeAssembly *virtualSeg = new TGeoVolumeAssembly("ITSsddSegment");
 
-  TGeoBBox *segBox = new TGeoBBox("ITSsddSegBox",
-                                 fgkLadderWidth/2+fgkPinSuppWidth+fgkLadderSegBoxDW,
-                                 fgkLadderHeight/2+fgkLadderSegBoxDH/2,
-                                 segmentLength/2);
-  
+//   TGeoBBox *segBox = new TGeoBBox("ITSsddSegBox",
+//                               fgkLadderWidth/2+fgkPinSuppWidth+fgkLadderSegBoxDW,
+//                               fgkLadderHeight/2+fgkLadderSegBoxDH/2,
+//                               segmentLength/2);
+  // A shaped Xtru instead of a simple BBox to avoid overlaps and extrusions
+  TGeoXtru *segBox = new TGeoXtru(2);
+  segBox->SetName("ITSsddSegBox");
+
+  Double_t xseg[12],yseg[12];
+  xseg[ 0] = -(fgkLadderWidth/2+fgkPinSuppWidth+fgkLadderSegBoxDW);
+  yseg[ 0] =  fgkLadderHeight/2+fgkLadderSegBoxDH/2;
+  xseg[ 1] =  xseg[0];
+  yseg[ 1] = -yseg[0];
+  xseg[ 2] =  0.87*xseg[1];
+  yseg[ 2] =  yseg[1];
+  xseg[ 3] =  0.77*xseg[1];
+  yseg[ 3] = -yseg[0] - 0.62*fgkHybCC2SensorLen;
+  xseg[ 4] =  0.72*xseg[1];
+  yseg[ 4] =  yseg[3];
+  xseg[ 5] =  0.83*xseg[1];
+  yseg[ 5] =  yseg[1];
+
+  for (Int_t j=0; j<6; j++) {
+    xseg[6+j] = -xseg[5-j];
+    yseg[6+j] =  yseg[5-j];
+  }
+
+  segBox->DefinePolygon(12, xseg, yseg);
+  segBox->DefineSection(0,-segmentLength/2);
+  segBox->DefineSection(1, segmentLength/2);
+
   TGeoVolume *virtualSeg = new TGeoVolume("ITSsddSegment",
                                          segBox, airSDD);
   virtualSeg->SetVisibility(kFALSE);
@@ -2520,7 +2683,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateLadderSegment(Int_t iLay, Int_t iSeg) {
   virtualSeg->AddNode(fPinSupport, 7, transPS7);
   virtualSeg->AddNode(fPinSupport, 8, transPS8);
 
-  TGeoMedium *pinMed   = GetMedium("SDDKAPTON (POLYCH2)$");  // medium ???
+  TGeoMedium *pinMed   = GetMedium("RYTON$");
   Double_t fgkPinHeight = 4.5*fgkmm;
   TGeoTube *pineS = new TGeoTube("ITSsddPin",0,fgkPinR,
                                fgkPinHeight/2.);
@@ -2648,7 +2811,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateLadderSegment(Int_t iLay, Int_t iSeg) {
   //*************************
   // the 2 hybrids :
   //*************************
-  Double_t hybDy = ((TGeoBBox*)fHybrid->GetShape())->GetDY();
+  Double_t hybDy = ((TGeoXtru*)fHybrid->GetShape())->GetY(2);
   Double_t distAxeToHybridCenter = fgkBTBaxisAtoBase+hybDy;
   
   Double_t hybrVolX = ( distAxeToHybridCenter*CosD(fgkHybridAngle) 
@@ -2672,8 +2835,8 @@ TGeoVolume* AliITSv11GeometrySDD::CreateLadderSegment(Int_t iLay, Int_t iSeg) {
   //***********
   if (fAddCables) {
   // Starting from this segment
-  Double_t hybDz = ((TGeoBBox*)fHybrid->GetShape())->GetDZ();
-  Double_t hybDx = ((TGeoBBox*)fHybrid->GetShape())->GetDX();
+  Double_t hybDz = ((TGeoXtru*)fHybrid->GetShape())->GetZ(1);
+  Double_t hybDx = ((TGeoXtru*)fHybrid->GetShape())->GetX(1);
   Double_t posDigitCableAlongHyb = shiftHyb+ hybDx 
                                    - digitCableA->GetWidth()/2;
   Double_t distAxeToDigitCableCenter = distAxeToHybridCenter+hybDy
@@ -2718,6 +2881,46 @@ TGeoVolume* AliITSv11GeometrySDD::CreateLadderSegment(Int_t iLay, Int_t iSeg) {
     digitCableB[iCable].GetPoint( 1, coord);
     digitCableB[iCable].AddCheckPoint( virtualSeg, iPoint, coord, vZ);
   };
+
+  // Now the small Al foil on the same hybrid side
+  Double_t xfoil[5],yfoil[5];
+  hybDx *= 0.95;
+  xfoil[0] = -fgkHybridAlFoilWide/2;
+  yfoil[0] =  hybDx;
+  xfoil[1] =  fgkHybridAlFoilWide/2;
+  yfoil[1] =  yfoil[0];
+  xfoil[2] =  xfoil[1];
+  yfoil[2] = -hybDx + (fgkHybridAlFoilWide - fgkHybridAlFoilSide);
+  xfoil[3] =  xfoil[0] + fgkHybridAlFoilSide;
+  yfoil[3] = -hybDx;
+  xfoil[4] =  xfoil[0];
+  yfoil[4] =  yfoil[3];
+
+  TGeoXtru* alFoilSh = new TGeoXtru(2);
+  alFoilSh->DefinePolygon(5, xfoil, yfoil);
+  alFoilSh->DefineSection(0,-fgkHybridAlFoilThick/2);
+  alFoilSh->DefineSection(1, fgkHybridAlFoilThick/2);
+
+  TGeoVolume* alFoilVol = new TGeoVolume("ITSsddAlFoilHybSide", alFoilSh, alSDD);
+  alFoilVol->SetLineColor(fColorAl);
+
+  Double_t zFoilTrans = cableSideSign*(hybDz + alFoilSh->GetX(1));
+  TGeoRotation rotFoil3;
+  TGeoRotation rotFoil4;
+  if (cableSideSign > 0) {
+    rotFoil3 = TGeoRotation("", 90-fgkHybridAngle, -90, -90);
+    rotFoil4 = TGeoRotation("",-90+fgkHybridAngle,  90,  90);
+  } else {
+    rotFoil3 = TGeoRotation("", 90-fgkHybridAngle,  90, -90);
+    rotFoil4 = TGeoRotation("",-90+fgkHybridAngle, -90,  90);
+  }
+  TGeoCombiTrans *foiTr1 = new TGeoCombiTrans(*pipeTr2, rotFoil3);
+  TGeoCombiTrans *foiTr2 = new TGeoCombiTrans(*pipeTr1, rotFoil4);
+  AddTranslationToCombiTrans( foiTr1, -hybrVolX, hybrVolY, zFoilTrans);
+  AddTranslationToCombiTrans( foiTr2,  hybrVolX, hybrVolY, zFoilTrans);
+    
+  virtualSeg->AddNode(alFoilVol, 1, foiTr1);
+  virtualSeg->AddNode(alFoilVol, 2, foiTr2);
   };
 
   //**********************************
@@ -2732,7 +2935,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreatePinSupport() {
 // Create a pine support and its pine
 // axis of rotation is the cone axis, center in its middle
 //
-    TGeoMedium *rytonSDD = GetMedium("SDD C AL (M55J)$"); //medium = ryton ?
+    TGeoMedium *rytonSDD = GetMedium("RYTON$");
 
     TGeoCone *cone = new TGeoCone("ITSsddPinSuppCone",fgkPinSuppHeight/2.,
                                   0,fgkPinSuppRmax,0,fgkPinSuppRmax-
@@ -2773,19 +2976,19 @@ TGeoVolume* AliITSv11GeometrySDD::CreateCoolPipeSupportL() {
   Double_t diffX = fgkCoolPipeSuppHeight*TanD(fgkCoolPipeSuppAngle);
   
   TGeoArb8 *side1 = new TGeoArb8(fgkCoolPipeSuppHeight/2.);
+  side1->SetName("ITSsddCPSside1");
   side1->SetVertex( 0, 0, -fgkCoolPipeSuppWidthExt/2.);
-  side1->SetVertex( 1, fgkCoolPipeSuppMaxLength/2.-diffX,
-                      -fgkCoolPipeSuppWidthExt/2.);
+  side1->SetVertex( 1, 0,  fgkCoolPipeSuppWidthExt/2.);
   side1->SetVertex( 2, fgkCoolPipeSuppMaxLength/2.-diffX,
                       fgkCoolPipeSuppWidthExt/2.);
-  side1->SetVertex( 3, 0,  fgkCoolPipeSuppWidthExt/2.);
-  side1->SetVertex( 4, 0, -fgkCoolPipeSuppWidthExt/2.);
-  side1->SetVertex( 5, fgkCoolPipeSuppMaxLength/2.,
+  side1->SetVertex( 3, fgkCoolPipeSuppMaxLength/2.-diffX,
                       -fgkCoolPipeSuppWidthExt/2.);
+  side1->SetVertex( 4, 0, -fgkCoolPipeSuppWidthExt/2.);
+  side1->SetVertex( 5, 0,  fgkCoolPipeSuppWidthExt/2.);
   side1->SetVertex( 6, fgkCoolPipeSuppMaxLength/2.,
                       fgkCoolPipeSuppWidthExt/2.);
-  side1->SetVertex( 7, 0,  fgkCoolPipeSuppWidthExt/2.);
-  side1->SetName("ITSsddCPSside1");
+  side1->SetVertex( 7, fgkCoolPipeSuppMaxLength/2.,
+                      -fgkCoolPipeSuppWidthExt/2.);
 
   TGeoTranslation *side1Tr = new TGeoTranslation("ITSsddCPStr1",0,
                                 - fgkCoolPipeSuppAxeDist
@@ -2835,7 +3038,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateCoolPipeSupportL() {
     axe->InspectShape();
   };
 
-  TGeoMedium *rytonSDD = GetMedium("SDD C AL (M55J)$"); //medium = ryton ?  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *rytonSDD = GetMedium("RYTON$");
   
   TGeoCompositeShape *coolPipeSuppShape = new TGeoCompositeShape(
                                        "ITSsddCoolPipeSuppShapeL",
@@ -2862,6 +3065,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateCoolPipeSupportR() {
   Double_t diffX = fgkCoolPipeSuppHeight*TanD(fgkCoolPipeSuppAngle);
   
   TGeoArb8 *side1 = new TGeoArb8(fgkCoolPipeSuppHeight/2.);
+  side1->SetName("ITSsddCPSside1R");
   side1->SetVertex( 0, 0, -fgkCoolPipeSuppWidthExt/2.);
   side1->SetVertex( 1, -(fgkCoolPipeSuppMaxLength/2.-diffX),
                       -fgkCoolPipeSuppWidthExt/2.);
@@ -2874,7 +3078,6 @@ TGeoVolume* AliITSv11GeometrySDD::CreateCoolPipeSupportR() {
   side1->SetVertex( 6, -fgkCoolPipeSuppMaxLength/2.,
                       fgkCoolPipeSuppWidthExt/2.);
   side1->SetVertex( 7, 0,  fgkCoolPipeSuppWidthExt/2.);
-  side1->SetName("ITSsddCPSside1R");
 
   TGeoTranslation *side1Tr = new TGeoTranslation("ITSsddCPStr1R",0,
                                 - fgkCoolPipeSuppAxeDist
@@ -2935,7 +3138,7 @@ TGeoVolume* AliITSv11GeometrySDD::CreateCoolPipeSupportR() {
                                      "+ITSsddCPSaxeBoxR:ITSsddCPSAxBoxTrR"
                                      "-ITSsddCPSaxeR:ITSsddCPSaxeTrR");
   
-  TGeoMedium *rytonSDD = GetMedium("SDD C AL (M55J)$"); //medium = ryton ? To code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *rytonSDD = GetMedium("RYTON$");
   TGeoVolume *coolPipeSupp = new TGeoVolume( "ITSsddCoolPipeSupportR",
                                             coolPipeSuppShape, rytonSDD);
   coolPipeSupp->SetLineColor(fColorRyton);
@@ -3092,12 +3295,14 @@ TGeoVolumeAssembly* AliITSv11GeometrySDD::CreateEndLadder(Int_t iLay) {
   
   //--- The 3 V shape corners of the Carbon Fiber Ladder
   //--- the top V
-  TGeoArb8 *cfLaddTop1 = CreateLadderSide(topCornerLength/2., halfTheta, -1,
+  TGeoArb8 *cfLaddTop1 = CreateLadderSide("CFladdTopCornerV1shape",
+                                         topCornerLength/2., halfTheta, -1,
                                          fgkLadderLa, fgkLadderHa, fgkLadderl);
-  TGeoVolume *cfLaddTopVol1 = new TGeoVolume("ITSsddCFladdTopCornerVol1",
+  TGeoVolume *cfLaddTopVol1 = new TGeoVolume("ITSsddCFladdTopCornerV1",
                                  cfLaddTop1,carbonFiberLadderStruct);
   cfLaddTopVol1->SetLineColor(fColorCarbonFiber);
-  TGeoArb8 *cfLaddTop2 = CreateLadderSide( topCornerLength/2., halfTheta, 1,
+  TGeoArb8 *cfLaddTop2 = CreateLadderSide( "CFladdTopCornerV2shape",
+                                          topCornerLength/2., halfTheta, 1,
                                           fgkLadderLa, fgkLadderHa, fgkLadderl);
   TGeoVolume *cfLaddTopVol2 = new TGeoVolume("ITSsddCFladdTopCornerV2",
                                  cfLaddTop2,carbonFiberLadderStruct);
@@ -3108,12 +3313,14 @@ TGeoVolumeAssembly* AliITSv11GeometrySDD::CreateEndLadder(Int_t iLay) {
   virtualEnd->AddNode(cfLaddTopVol2, 1, trTop1);
 
   //--- the 2 side V
-  TGeoArb8 *cfLaddSide1 = CreateLadderSide( length/2., beta, -1,
+  TGeoArb8 *cfLaddSide1 = CreateLadderSide( "CFladdSideCornerV1shape",
+                                           length/2., beta, -1,
                                            fgkLadderLb, fgkLadderHb, fgkLadderl);
   TGeoVolume *cfLaddSideVol1 = new TGeoVolume("ITSsddCFladdSideCornerV1",
                                   cfLaddSide1,carbonFiberLadderStruct);
   cfLaddSideVol1->SetLineColor(fColorCarbonFiber);
-  TGeoArb8 *cfLaddSide2 = CreateLadderSide( length/2., beta, 1,
+  TGeoArb8 *cfLaddSide2 = CreateLadderSide( "CFladdSideCornerV2shape",
+                                           length/2., beta, 1,
                                            fgkLadderLb, fgkLadderHb, fgkLadderl);
   TGeoVolume *cfLaddSideVol2 = new TGeoVolume("ITSsddCFladdSideCornerV2",
                                   cfLaddSide2,carbonFiberLadderStruct);
@@ -3419,12 +3626,12 @@ TGeoVolumeAssembly* AliITSv11GeometrySDD::CreateCarlosCard(Int_t iLay) {
   //
 
   (void) iLay;
-  TGeoMedium *glassFiber  = GetMedium("SDD SI CHIP$");// glassFiber   TO CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *glassFiber  = GetMedium("GLASS FIBER$");// glassFiber
   TGeoMedium *siliconChip = GetMedium("SDD SI CHIP$");// ITSsddSiChip
   TGeoMedium *plastiChip  = GetMedium("SDDKAPTON (POLYCH2)$"); // ITSsddKAPTON_POLYCH2
   TGeoMedium *copper      = GetMedium("COPPER$"); 
-  TGeoMedium *alCu12SDD   = GetMedium("INOX$"); // ITSsddAlCu12,  to code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  TGeoMedium *stainless   = GetMedium("INOX$"); // for screws, what is the material ???????????
+  TGeoMedium *alCu12SDD   = GetMedium("ALCU12$"); // ITSsddAlCu12
+  TGeoMedium *stainless   = GetMedium("AISI304L$"); // for screws
 
   //=========================================
   // cooling support of the Carlos card (HeatBridge):
@@ -3504,23 +3711,23 @@ TGeoVolumeAssembly* AliITSv11GeometrySDD::CreateCarlosCard(Int_t iLay) {
   Double_t screw1z = ( aaa*sin(TMath::DegToRad()*fgkCarlosSuppAngle) + 
                       bbb*cos(TMath::DegToRad()*fgkCarlosSuppAngle) )-0.07;
 
-  TGeoRotation *CarlosSuppRot = (TGeoRotation *)fCommonTr[0];  
+  TGeoRotation *carlosSuppRot = (TGeoRotation *)fCommonTr[0];  
 
   TGeoCombiTrans* lScrewTr1 = new TGeoCombiTrans((fgkCarlosSuppX1+
                              fgkCarlosSuppX2+fgkCarlosSuppX3)/2,
-                             screw1y,screw1z, CarlosSuppRot);
+                             screw1y,screw1z, carlosSuppRot);
 
   TGeoCombiTrans* lScrewTr2 = new TGeoCombiTrans((fgkCarlosSuppX1+
                              fgkCarlosSuppX2+fgkCarlosSuppX3)/2,
-                             screw1z,screw1y, CarlosSuppRot);
+                             screw1z,screw1y, carlosSuppRot);
 
   TGeoCombiTrans *lScrewTr3 = new TGeoCombiTrans(-(fgkCarlosSuppX1+
                              fgkCarlosSuppX2+fgkCarlosSuppX3)/2,
-                             screw1y,screw1z, CarlosSuppRot);
+                             screw1y,screw1z, carlosSuppRot);
 
   TGeoCombiTrans *lScrewTr4 = new TGeoCombiTrans(-(fgkCarlosSuppX1+
                              fgkCarlosSuppX2+fgkCarlosSuppX3)/2,
-                             screw1z,screw1y, CarlosSuppRot);
+                             screw1z,screw1y, carlosSuppRot);
 
   assemblySupCarlos->AddNode(fCommonVol[0], 1, lScrewTr1);
   assemblySupCarlos->AddNode(fCommonVol[0], 2, lScrewTr2);
@@ -3707,12 +3914,12 @@ Int_t AliITSv11GeometrySDD::CreateLVCard() {
   // Creates the assemblies containing the LV cards (left and right)
   //
 
-  TGeoMedium *glassFiber  = GetMedium("SDD SI CHIP$");// glassFiber   TO CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *glassFiber  = GetMedium("GLASS FIBER$");// glassFiber
   TGeoMedium *siliconChip = GetMedium("SDD SI CHIP$");// ITSsddSiChip
   TGeoMedium *plastiChip  = GetMedium("SDDKAPTON (POLYCH2)$"); // ITSsddKAPTON_POLYCH2
   TGeoMedium *copper      = GetMedium("COPPER$"); 
-  TGeoMedium *alCu12SDD   = GetMedium("INOX$"); // ITSsddAlCu12,  to code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  TGeoMedium *stainless   = GetMedium("INOX$"); // for screws, what is the material ???????????
+  TGeoMedium *alCu12SDD   = GetMedium("ALCU12$"); // ITSsddAlCu12
+  TGeoMedium *stainless   = GetMedium("AISI304L$"); // for screws
 
   fCardLVL = new TGeoVolumeAssembly("ITSsddLVCardLeft");
   fCardLVR = new TGeoVolumeAssembly("ITSsddLVCardRight");
@@ -3945,18 +4152,17 @@ Int_t AliITSv11GeometrySDD::CreateLVCard() {
 }
 
 //________________________________________________________________________
-TGeoVolumeAssembly*  AliITSv11GeometrySDD::CreateHVCard(Int_t iLay){
+TGeoVolumeAssembly*  AliITSv11GeometrySDD::CreateHVCard(){
   // 
   // return an assembly containing the HV card
   //
-  iLay = iLay;
 
   TGeoMedium *ceramic          = GetMedium("CERAMICS$"); // ceramicHVcard
-  TGeoMedium *medSMDcapaMiddle = GetMedium("SDD X7R capacitors$");      //    TO CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  TGeoMedium *medSMDcapaEnd    = GetMedium("SDD X7R capacitors$");      // SDDX7RcapacitorsSDD   TO CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *medSMDcapaMiddle = GetMedium("SDD X7R capacitors$"); // check if different
+  TGeoMedium *medSMDcapaEnd    = GetMedium("SDD X7R capacitors$"); // check if different
   TGeoMedium *stainless        = GetMedium("INOX$");       // ITSspdStainlesSteal ???????????
   TGeoMedium *plastic          = GetMedium("SDDKAPTON (POLYCH2)$");  // ITS_ITSsddKAPTON_POLYCH2 ???????????
-  TGeoMedium *alCu12SDD       = GetMedium("INOX$"); // ITSsddAlCu12  : to code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *alCu12SDD       = GetMedium("ALCU12$"); // ITSsddAlCu12
 
   TGeoVolumeAssembly *highVCard = new TGeoVolumeAssembly("ITSsddHVCard");
 
@@ -4227,7 +4433,6 @@ TGeoVolumeAssembly*  AliITSv11GeometrySDD::CreateHVCard(Int_t iLay){
   return highVCard;
 }
 
-
 //________________________________________________________________________
 TGeoVolumeAssembly*  AliITSv11GeometrySDD::CreateEndLadderCards(Int_t iLay) {
 // 
@@ -4235,7 +4440,7 @@ TGeoVolumeAssembly*  AliITSv11GeometrySDD::CreateEndLadderCards(Int_t iLay) {
 // and their cooling system 
 //
 
-  TGeoMedium *alCu12SDD       = GetMedium("AL$"); // ITSsddAlCu12 : to code !!!!!!!!!!!!!!
+  TGeoMedium *alCu12SDD       = GetMedium("ALCU12$"); // ITSsddAlCu12
   TGeoMedium *phynoxSDD       = GetMedium("INOX$");
   TGeoMedium *coolerMediumSDD = GetMedium("WATER$");
 
@@ -4434,18 +4639,20 @@ TGeoVolume*  AliITSv11GeometrySDD::CreateEndLadderCardsV(Int_t iLay) {
 // This is the code actually used for the end ladder cards
 //
 
-  TGeoMedium *alCu12SDD       = GetMedium("AL$"); // ITSsddAlCu12 : to code !!!!!!!!!!!!!!
+  TGeoMedium *alCu12SDD       = GetMedium("ALCU12$"); // ITSsddAlCu12
   TGeoMedium *phynoxSDD       = GetMedium("INOX$");
   TGeoMedium *coolerMediumSDD = GetMedium("WATER$");
   TGeoMedium *copper          = GetMedium("COPPER$");
   TGeoMedium *plastic         = GetMedium("SDDKAPTON (POLYCH2)$");  // ???
   TGeoMedium *airSDD          = GetMedium("SDD AIR$");
-  TGeoMedium *opticalFiber    = GetMedium("SDD SI insensitive$");  //  To code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *opticalFiber    = GetMedium("SDD OPTICFIB$");
+  TGeoMedium *polyurethane    = GetMedium("POLYURETHANE$");
 
   Double_t endLadPipeUlength = fgkEndLadPipeUlengthLay3;
   Double_t endLadPipeArmZ    = fgkEndLadPipeArmZLay3;
   Int_t    nCards = 3;
   Double_t rREF   = fgkEndLaddCardsShortRadiusLay3;
+  Double_t deltaZcables = 0;
   // reference radius corresponding to local y=0
 
   if (iLay==4) {
@@ -4453,6 +4660,7 @@ TGeoVolume*  AliITSv11GeometrySDD::CreateEndLadderCardsV(Int_t iLay) {
     endLadPipeArmZ = fgkEndLadPipeArmZLay4;
     nCards = 4;
     rREF = fgkEndLaddCardsShortRadiusLay4;
+    deltaZcables = 2.8*fgkmm;
   }
 
   Double_t cardLVxShift = (fgkEndLadPipeUwidth/2-fgkEndLadPipeArmX/2
@@ -4497,10 +4705,10 @@ TGeoVolume*  AliITSv11GeometrySDD::CreateEndLadderCardsV(Int_t iLay) {
   // are escaping...
   Double_t cableSectionR1 = cablesRadius-thickTotCable/2;
   Double_t cableSectionR2 = rMax;
-  Double_t cableSectionZ1 = zMax + 6.3*fgkmm + 2.5*fgkcm;
-  Double_t cableSectionZ2 = zMax + 7.3*fgkmm + 4*fgkcm;
-  // Those 6.3 and 7.3 are to be fixed to stick the maximum to the SDD cone
-  // (I'm waiting for the new cone)
+  Double_t cableSectionZ1 = zMax + 23.6*fgkmm + 3.0*fgkcm + deltaZcables;
+  Double_t cableSectionZ2 = zMax + 23.6*fgkmm + 4.0*fgkcm + deltaZcables;
+  // Those numbers are to be fixed to stick the maximum to the SDD cone
+  // (hardcoded numbers are ugly, but it's easier to find where to stop)
 
   containerShape->DefineSection(8, cableSectionZ1, cableSectionR1, rMax);
   containerShape->DefineSection(9, cableSectionZ2, cableSectionR2, rMax);
@@ -4679,20 +4887,29 @@ TGeoVolume*  AliITSv11GeometrySDD::CreateEndLadderCardsV(Int_t iLay) {
 
 
   Double_t sectionV   = (fgkSectionCuPerMod+fgkSectionPlastPerMod
-                        + fgkSectionGlassPerMod)*nCards;
+                        + fgkSectionGlassPerMod)*nCards
+                        + fgkSectionCoolPolyuEL + fgkSectionCoolWaterEL;
   // We fix thickness, then width is calculated accordingly
-   Double_t width      = sectionV/thickTotCable;
+  Double_t width      = sectionV/thickTotCable;
   Double_t thickCu    = thickTotCable*fgkSectionCuPerMod
-              / (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod);
+            / (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod+fgkSectionCoolPolyuEL+fgkSectionCoolWaterEL);
   Double_t thickPlast = thickTotCable*fgkSectionPlastPerMod
-              / (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod);
-  Double_t thickGlass = thickTotCable - thickCu - thickPlast;
+            / (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod+fgkSectionCoolPolyuEL+fgkSectionCoolWaterEL);
+  Double_t thickGlass = thickTotCable*fgkSectionGlassPerMod
+            / (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod+fgkSectionCoolPolyuEL+fgkSectionCoolWaterEL);
+
+  Double_t thickCoolPolyu = thickTotCable*fgkSectionCoolPolyuEL
+            / (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod+fgkSectionCoolPolyuEL+fgkSectionCoolWaterEL);
+  Double_t thickCoolWater = thickTotCable*fgkSectionCoolWaterEL
+            / (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod+fgkSectionCoolPolyuEL+fgkSectionCoolWaterEL);
 
   AliITSv11GeomCableFlat cable("SDDcableEndLadder",width,thickTotCable);
-  cable.SetNLayers(3);
+  cable.SetNLayers(5);
   cable.SetLayer(0, thickCu, copper, kRed);
   cable.SetLayer(1, thickPlast, plastic, kYellow);
   cable.SetLayer(2, thickGlass, opticalFiber, kGreen);
+  cable.SetLayer(3, thickCoolPolyu, polyurethane, kGray);
+  cable.SetLayer(4, thickCoolWater, coolerMediumSDD, kBlue);
 
   Double_t zVect[3]={0,0,1};
   Double_t xMinCable = firstCarlosCardZ+nCards*(fgkCarlosSuppZ3
@@ -4709,17 +4926,27 @@ TGeoVolume*  AliITSv11GeometrySDD::CreateEndLadderCardsV(Int_t iLay) {
   cable.SetInitialNode(endLadderCards);
   cable.CreateAndInsertCableSegment(1);
 
+  // The earth cable
+  TGeoTorus *earthShape = new TGeoTorus(rMax-fgkEndLadderEarthCableR,
+                                       0., fgkEndLadderEarthCableR,
+                                       phi0, dphi); // same as containerShape
+
+  TGeoVolume *earthCable = new TGeoVolume("SDDcableEndLadderEarthCable",
+                                         earthShape, copper);
+
+  endLadderCards->AddNode(earthCable, 1,
+                       new TGeoTranslation(0, 0, fgkDistEndLaddCardsLadd+1));
+
   return endLadderCards;
 }
 
 //________________________________________________________________________
-TGeoVolumeAssembly* AliITSv11GeometrySDD::CreateSupportRing(Int_t iLay) {
+TGeoVolumeAssembly* AliITSv11GeometrySDD::CreateSupportRing() {
 //
 // return an assembly of the support rings, attaching the ladders to the cone 
 //
 
 
-  iLay = iLay;
 
   TGeoMedium *stainless = GetMedium("INOX$"); // To code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   TGeoVolumeAssembly *supportRing = new TGeoVolumeAssembly("supportRing");
@@ -4825,7 +5052,7 @@ void AliITSv11GeometrySDD::CreateSDDsensor() {
   TGeoMedium *siliconSDDsens = GetMedium("SI$");                  // ITSsddSi
   TGeoMedium *alSDD          = GetMedium("AL$");                  // ITSal
   TGeoMedium *polyhamideSDD  = GetMedium("SDDKAPTON (POLYCH2)$"); // ITSsddKAPTON_POLYCH2
-  TGeoMedium *glassSDD       = GetMedium("SDD SI insensitive$");  //  To code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *glassSDD       = GetMedium("STDGLASS$");            // StdGlass
 
 
   Double_t rWraping = fgkWaferThickness/2+fgkWaHVcableAlThick+fgkWaHVcablePolyThick;
@@ -4863,7 +5090,7 @@ void AliITSv11GeometrySDD::CreateSDDsensor() {
     wafer3->SetLineColor(fColorSilicon);
     TGeoBBox *sensBox3 = new TGeoBBox("ITSsddSensorSensBox3",
                        fgkWaferWidthSens/2, fgkWaferThickSens/2, fgkWaferLengthSens/2);
-    TGeoVolume *sensVol3 = new TGeoVolume(fgSDDsensitiveVolName3,sensBox3, siliconSDDsens);
+    TGeoVolume *sensVol3 = new TGeoVolume(fgkSDDsensitiveVolName3,sensBox3, siliconSDDsens);
     sensVol3->SetLineColor(fColorSilicon+5);
     wafer3->AddNode(sensVol3, 1, 0);
     fSDDsensor3->AddNode(wafer3, 1, 0);
@@ -4872,7 +5099,7 @@ void AliITSv11GeometrySDD::CreateSDDsensor() {
     wafer4->SetLineColor(fColorSilicon);
     TGeoBBox *sensBox4 = new TGeoBBox("ITSsddSensorSensBox4",
                        fgkWaferWidthSens/2, fgkWaferThickSens/2, fgkWaferLengthSens/2);
-    TGeoVolume *sensVol4 = new TGeoVolume(fgSDDsensitiveVolName4,sensBox4, siliconSDDsens);
+    TGeoVolume *sensVol4 = new TGeoVolume(fgkSDDsensitiveVolName4,sensBox4, siliconSDDsens);
     sensVol4->SetLineColor(fColorSilicon+5);
     wafer4->AddNode(sensVol4, 1, 0);
     fSDDsensor4->AddNode(wafer4, 1, 0);
@@ -5214,14 +5441,14 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateDetectorsAssembly(Int_t iLay) {
 //
   
   Int_t    nDetectors   = fgkLay3Ndet;
-  Double_t ladderLength = fgkLay3LadderLength;
+  //  Double_t ladderLength = fgkLay3LadderLength;
   Double_t *sensorZPos  = fLay3sensorZPos;
   TGeoVolume *sensorSDD = fSDDsensor3;
 
   if (iLay==3) {}
   else if (iLay==4) {
     nDetectors   = fgkLay4Ndet;
-    ladderLength = fgkLay4LadderLength;
+    //    ladderLength = fgkLay4LadderLength;
     sensorZPos   = fLay4sensorZPos;
     sensorSDD    = fSDDsensor4;
   } else {
@@ -5229,7 +5456,7 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateDetectorsAssembly(Int_t iLay) {
   };
 
   char name[30];
-  sprintf(name,"ITSsddDetBox%i",iLay);
+  snprintf(name,30,"ITSsddDetBox%i",iLay);
   
   TGeoVolumeAssembly  *virtualDet = new TGeoVolumeAssembly("ITSsddLadd");
 
@@ -5238,7 +5465,7 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateDetectorsAssembly(Int_t iLay) {
     Double_t localY = fgkLadWaferSep/2+fgkWaferThickness/2;
     if (iLay==3) if (i%2!=0) localY = -localY;
     if (iLay==4) if (i%2==0) localY = -localY;
-    sprintf(name, "ITSsddLay%iSensorPos%i",iLay, i);
+    snprintf(name, 30, "ITSsddLay%iSensorPos%i",iLay, i);
  
     if (i >= nDetectors/2) {
       TGeoTranslation *sensorPos = new TGeoTranslation(0,localY,localZ);
@@ -5260,121 +5487,45 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateDetectorsAssembly(Int_t iLay) {
 
 
 //________________________________________________________________________
-Int_t AliITSv11GeometrySDD::ExportSensorGeometry(AliITSgeom *geom, Int_t iLaySDD,
-                                                Int_t startMod) {
+TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateDetectorsAssemblyLadd2() {
 //
-// export the geometry in a AliITSgeom object
-// Obsolete
+// return a box volume containing the detectors
+// Special case for Layer 3 Ladder 2 which is rotated (cannot simply
+// rotate the standard volume, because the module numbering would be wrong)
+// M.Sitta 25 Nov 2009
 //
+  
+  Int_t    nDetectors   = fgkLay3Ndet;
+  Double_t *sensorZPos  = fLay3sensorZPos;
+  TGeoVolume *sensorSDD = fSDDsensor3;
 
-  if (! geom) {
-    printf("error:Try to fill null (AliITSgeom *) object");
-    return kFALSE;
-  };
-  if (! fMotherVol) {
-    printf("error:Try to set sensor geometry while geometry is not defined\n");
-    return kFALSE;
-  };
-
-  const Float_t kDxyz[3] = {fgkWaferWidthSens/2., fgkWaferThickSens/2.,
-                           fgkWaferLengthSens/2.};
-  if(!(geom->IsShapeDefined(kSDD)))
-    geom->ReSetShape(kSDD, new AliITSgeomSDD256(3, kDxyz));
-
-  char layerName[30];
-  char ladderName[30];
-  char sensorName[30];
-  char senstivName[30];
-  const Int_t kNLay = 2;
-  const Int_t kNLadd[kNLay] = {fgkLay3Nladd, fgkLay4Nladd};
-  const Int_t kNDet[kNLay]  = {fgkLay3Ndet,  fgkLay4Ndet};
-
-  if (GetDebug(1))
-    printf("AliITSv11GeometrySDD::SetSensorGeometry(), nodes found :\n");
-
-  Int_t firstSDDmod = startMod;
-  for (Int_t iLay=0; iLay<kNLay; iLay++) {
-    /////////////////////////////////////////
-    sprintf(layerName, "ITSsddLayer%i_1",iLay+3);
-    TGeoNode *layNode = fMotherVol->GetNode(layerName);
-    if (layNode) {
-      if (GetDebug(1)) printf("%s\n",layNode->GetName());
-      TGeoVolume *layVolume = layNode->GetVolume();
-      TGeoHMatrix layMatrix(*layNode->GetMatrix());
-
-      for (Int_t iLadd=0; iLadd<kNLadd[iLay]; iLadd++) {
-       /////////////////////////////////////////
-       sprintf(ladderName, "ITSsddLadd_%i", iLadd);
-       TGeoNode *laddNode = layVolume->GetNode(ladderName);
-       if (laddNode) {
-         if (GetDebug(1)) printf("|   %s\n",laddNode->GetName());
-         TGeoVolume *laddVolume = laddNode->GetVolume();
-         TGeoHMatrix laddMatrix(layMatrix);
-         laddMatrix.Multiply(laddNode->GetMatrix());
-
-         for (Int_t iDet=0; iDet<kNDet[iLay]; iDet++) {
-           /////////////////////////////////////////
-           sprintf(sensorName, "ITSsddSensor_%i",iDet);
-           TGeoNode *detNode = laddVolume->GetNode(sensorName);
-           if (detNode) {
-             if (GetDebug(1)) printf("|   |   %s\n",detNode->GetName());
-             TGeoVolume *detVolume = detNode->GetVolume();
-             TGeoHMatrix detMatrix(laddMatrix);
-             detMatrix.Multiply(detNode->GetMatrix());
-
-             TGeoNode *wafNode = detVolume->GetNode("ITSsddWafer_1");
-             if (wafNode) {
-               TGeoVolume *wafVolume = wafNode->GetVolume();
-               TGeoHMatrix wafMatrix(detMatrix);
-               detMatrix.Multiply(wafNode->GetMatrix());
-               //--------------------------------------------------------
-               sprintf(senstivName, "%s%s", fgSDDsensitiveVolName3,"_1");
-               TGeoNode *sensitivNode = wafVolume->GetNode(senstivName);
-             if (sensitivNode) {
-               TGeoHMatrix sensMatrix(wafMatrix);
-               sensMatrix.Multiply(sensitivNode->GetMatrix());
-
-               // Sticking to the convention for local wafer coordinate
-               // in AliITSgeom :
-               if (iDet >= kNDet[iLay]/2) {
-                 //              TGeoRotation rotY("",0,180,0);
-                 TGeoRotation rotY("",-180,-180,0);
-                 sensMatrix.Multiply(&rotY);
-               };
-               // Creating the matrix in AliITSgeom for
-               // this sensitive volume :
-               Double_t *trans = sensMatrix.GetTranslation();
-               Double_t *r     = sensMatrix.GetRotationMatrix();
-               Double_t rot[10] = {r[0],r[1],r[2],
-                                   r[3],r[4],r[5],
-                                   r[6],r[7],r[8], 1.0};
-               //rot[9]!=0.0 => not a unity matrix
-               geom->CreateMatrix(startMod,iLay+iLaySDD,iLadd+1,iDet+1,
-                                 kSDD,trans,rot);
-               // iLadd+1, iDet+1 because ladd. and det. start at +1
-               // elsewhere
-               startMod++;
-
-             } else
-               printf("Error (ExportSensorGeometry) %s not found !\n",
-                      senstivName);
-             } else
-               printf("Error (ExportSensorGeometry) %s not found !\n",
-                      "ITSsddWafer_1");
-           } else
-             printf("Error (ExportSensorGeometry) %s not found !\n",
-                    sensorName);
-         };
-       } else 
-         printf("Error (ExportSensorGeometry) %s not found !\n",
-                ladderName);
-      };  
-    } else
-      printf("Error (ExportSensorGeometry) %s not found !\n",
-            layerName);
-  };
+  char name[30];
+  snprintf(name,30,"ITSsddDetBoxLadd2");
+  
+  TGeoVolumeAssembly  *virtualDet = new TGeoVolumeAssembly("ITSsddLadd");
 
-  return (startMod-firstSDDmod);
+  for (Int_t i=0; i<nDetectors; i++) {
+    Double_t localZ = (-1.)*sensorZPos[nDetectors-1-i];
+    Double_t localY = fgkLadWaferSep/2+fgkWaferThickness/2;
+    if (i%2==0) localY = -localY;
+    snprintf(name, 30, "ITSsddLayLadd2SensorPos%i", i);
+    if (i >= nDetectors/2) {
+      TGeoTranslation *sensorPos = new TGeoTranslation(0,localY,localZ);
+      sensorPos->SetName(name);
+      virtualDet->AddNode(sensorSDD, i, sensorPos);
+    }
+    else {
+      TGeoRotation *rotSensor = new TGeoRotation("",0, 180, 180);
+      TGeoCombiTrans *sensorPos = new TGeoCombiTrans(0,localY,
+                                                    localZ, rotSensor);
+      sensorPos->SetName(name);
+      virtualDet->AddNode(sensorSDD, i, sensorPos);
+    };
+  }
+  
+  if(GetDebug(1)) virtualDet->CheckOverlaps(0.01);
+  return virtualDet;
 }
 
 
@@ -5400,7 +5551,7 @@ GetCurrentLayLaddDet(Int_t &lay, Int_t &ladd, Int_t&det) const {
 
  // Get the layer index :
   if (node->GetNdaughters()==fgkLay3Ndet)
-    lay = 3;            // this has to be equal to the iLaySDD argument given to ExportSensorGeometry() !!!
+    lay = 3;
   else lay = 4;
 
   return kTRUE;
@@ -5448,7 +5599,7 @@ TGeoPcon* AliITSv11GeometrySDD::CreateConeConstSection(Double_t r1max, Double_t
 
 //________________________________________________________________________
 Double_t AliITSv11GeometrySDD::GetConeZ(Double_t r, Double_t refR1, Double_t refR2, 
-                                       Double_t refZ1, Double_t refZ2) {
+                                       Double_t refZ1, Double_t refZ2) const {
   // just a helping function
   return refZ1+(refZ2-refZ1)*(r-refR1)/(refR2-refR1);
 }
@@ -5463,11 +5614,11 @@ Int_t AliITSv11GeometrySDD::CreateAndInsetConeCablePart(TGeoVolume *mother, Doub
   // and attached at the border of the SSD cone
 
   TGeoMedium *copper     = GetMedium("COPPER$");
-  TGeoMedium *plastic    = GetMedium("SDDKAPTON (POLYCH2)$");  // ???
-  TGeoMedium *opticalFiber = GetMedium("SDD SI insensitive$");  //  To code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  TGeoMedium *plastic    = GetMedium("SDDKAPTON (POLYCH2)$");
+  TGeoMedium *opticalFiber = GetMedium("SDD OPTICFIB$");
 
   char titleCable[30];
-  sprintf(titleCable,"cableSDDport%i",(Int_t)angle);
+  snprintf(titleCable,30,"cableSDDport%i",(Int_t)angle);
 
   //---
   Double_t section = (fgkSectionCuPerMod+fgkSectionPlastPerMod+fgkSectionGlassPerMod)*(nLay3+nLay4);
@@ -5510,14 +5661,25 @@ Int_t AliITSv11GeometrySDD::CreateAndInsetConeCablePart(TGeoVolume *mother, Doub
 
 
 //________________________________________________________________________
-void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
-
-  // Creates and inserts the SDD cables running on SDD and SSD cones
+void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth)
+{
+//
+// Creates and inserts the SDD cables running on SDD and SSD cones
+//
+// Input:
+//         moth : the TGeoVolume owing the volume structure
+// Output:
+//
+// Created:         ???       Ludovic Gaudichet
+// Updated:      15 Mar 2008  Mario Sitta
+// Updated:      14 Apr 2008  Mario Sitta            Overlap fixes
+// Updated:      09 May 2008  Mario Sitta            SSD overlap fixes
+//
 
-  TGeoMedium *copper     = GetMedium("COPPER$");
-  TGeoMedium *plastic    = GetMedium("SDDKAPTON (POLYCH2)$");  // ???
-  TGeoMedium *opticalFiber = GetMedium("SDD SI insensitive$");  //  To code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  TGeoMedium *airSDD     = GetMedium("SDD AIR$");
+  TGeoMedium *copper       = GetMedium("COPPER$");
+  TGeoMedium *plastic      = GetMedium("SDDKAPTON (POLYCH2)$");
+  TGeoMedium *opticalFiber = GetMedium("SDD OPTICFIB$");
+  TGeoMedium *airSDD       = GetMedium("SDD AIR$");
 
 
   //==================================
@@ -5535,10 +5697,29 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
   Double_t sectionLay4Plastic = fgkCableBendRatio*fgkSectionPlastPerMod*nModLay4/2;
   Double_t sectionLay4Glass   = fgkCableBendRatio*fgkSectionGlassPerMod*nModLay4/2;
 
-  // calculate z1, z2 thanks to R1 and R2
-  Double_t sddCableZ1 = GetConeZ(fgkSDDCableR1, fgkConeSDDr1,fgkConeSDDr2,fgkConeSDDz1,fgkConeSDDz2);
-  Double_t sddCableZ2 = GetConeZ(fgkSDDCableR2, fgkConeSDDr1,fgkConeSDDr2,fgkConeSDDz1,fgkConeSDDz2);
-  Double_t sddCableZ3 = GetConeZ(fgkSDDCableR3, fgkConeSDDr1,fgkConeSDDr2,fgkConeSDDz1,fgkConeSDDz2);
+  // Do not use hardcoded numbers, get them from real shapes - M.S. 15/03/08
+  TGeoVolume *sddCone = gGeoManager->GetVolume("SDDCarbonFiberCone");
+  TGeoPcon *sddConeShape = (TGeoPcon*)sddCone->GetShape();
+
+  TGeoVolume *sddCylinder = gGeoManager->GetVolume("SDDCarbonFiberCylinder");
+  TGeoTube *sddCylinderShape = (TGeoTube*)sddCylinder->GetShape();
+
+  // (were fgkConeSDDr1, fgkConeSDDr2, fgkConeSDDz1, fgkConeSDDz2 hardcoded)
+  Double_t coneSDDr1 = sddConeShape->GetRmin(5);
+  Double_t coneSDDr2 = sddConeShape->GetRmin(3);
+
+  Double_t coneSDDz1 = sddConeShape->GetZ(9) - sddConeShape->GetZ(5) +
+                      sddCylinderShape->GetDz();
+  Double_t coneSDDz2 = sddConeShape->GetZ(9) - sddConeShape->GetZ(3) +
+                      sddCylinderShape->GetDz();
+
+  // Calculate z1, z2 thanks to R1 and R2
+  Double_t sddCableZ1 = GetConeZ(fgkSDDCableR1, coneSDDr1, coneSDDr2,
+                                               coneSDDz1, coneSDDz2);
+  Double_t sddCableZ2 = GetConeZ(fgkSDDCableR2, coneSDDr1, coneSDDr2,
+                                               coneSDDz1, coneSDDz2);
+  Double_t sddCableZ3 = GetConeZ(fgkSDDCableR3, coneSDDr1, coneSDDr2,
+                                               coneSDDz1, coneSDDz2);
 
   TGeoRotation *rotCableSDD = new TGeoRotation("rotCableSDD",0,180,0);
 
@@ -5551,17 +5732,23 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
                  sectionLay3Plastic+sectionLay3Cu+sectionLay3Glass, 1);
 
   TGeoPcon* pcon1container = new TGeoPcon(0,360,2);
-  pcon1container->DefineSection(0, sddCableZ1, pcon1all->GetRmin(0), pcon1all->GetRmax(0));
+  pcon1container->DefineSection(0, sddCableZ1, pcon1all->GetRmin(0),
+                                              pcon1all->GetRmax(0));
+
   Double_t drMax = pcon1all->GetRmax(0)- pcon1all->GetRmin(0);
-  pcon1container->DefineSection(1, sddCableZ2, pcon1all->GetRmax(1)-drMax, pcon1all->GetRmax(1));
-  delete pcon1all;
-  TGeoVolume *vpcon1container = new TGeoVolume("vpcon1container", pcon1container, airSDD);
+  pcon1container->DefineSection(1, sddCableZ2, pcon1all->GetRmax(1)-drMax,
+                                              pcon1all->GetRmax(1));
+
+  TGeoVolume *vpcon1container = new TGeoVolume("vpcon1container",
+                                              pcon1container, airSDD);
   vpcon1container->SetVisibility(kFALSE);
 
   TGeoPcon* pcon1plast = CreateConeConstSection(fgkSDDCableR1, sddCableZ1,
                                                fgkSDDCableR2, sddCableZ2,
                                                sectionLay3Plastic, 3);
-  TGeoVolume *vpcon1plast = new TGeoVolume("ITScablesSDDpcon1Plast", pcon1plast, plastic);
+
+  TGeoVolume *vpcon1plast = new TGeoVolume("ITScablesSDDpcon1Plast",
+                                          pcon1plast, plastic);
   vpcon1plast->SetLineColor(kYellow);
   vpcon1container->AddNode(vpcon1plast, 0);
 
@@ -5569,22 +5756,24 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
   TGeoPcon* pcon1Cu = CreateConeConstSection(fgkSDDCableR1 - dr1a, sddCableZ1,
                                             fgkSDDCableR2 - dr1a, sddCableZ2,
                                             sectionLay3Cu, 3);
-  TGeoVolume *vpcon1Cu = new TGeoVolume("ITScablesSDDpcon1Cu", pcon1Cu, copper);
+
+  TGeoVolume *vpcon1Cu = new TGeoVolume("ITScablesSDDpcon1Cu",
+                                       pcon1Cu, copper);
   vpcon1Cu->SetLineColor(kRed);
   vpcon1container->AddNode(vpcon1Cu, 0);
-  //moth->AddNode(vpcon1Cu, 0);
 
-  //---
   Double_t dr1b = pcon1Cu->GetRmax(0) - pcon1Cu->GetRmin(0);
   TGeoPcon* pcon1glass = CreateConeConstSection(fgkSDDCableR1-dr1a-dr1b, sddCableZ1,
                                                fgkSDDCableR2-dr1a-dr1b, sddCableZ2,
                                                sectionLay3Glass, 3);
-  TGeoVolume *vpcon1glass = new TGeoVolume("ITScablesSDDpcon1glass", pcon1glass, opticalFiber);
+
+  TGeoVolume *vpcon1glass = new TGeoVolume("ITScablesSDDpcon1glass",
+                                          pcon1glass, opticalFiber);
   vpcon1glass->SetLineColor(kGreen);
   vpcon1container->AddNode(vpcon1glass, 0);
 
-  moth->AddNode(vpcon1container, 0);
-  moth->AddNode(vpcon1container, 1, rotCableSDD);
+  moth->AddNode(vpcon1container, 1);
+  moth->AddNode(vpcon1container, 2, rotCableSDD);
 
   //==================================
   //  2nd set of cones : cables from layer 3 and layer 4
@@ -5592,21 +5781,30 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
 
   TGeoPcon* pcon2all = CreateConeConstSection(fgkSDDCableR2, sddCableZ2,
                                              fgkSDDCableR3, sddCableZ3,
-                                             sectionLay3Plastic+sectionLay4Plastic+
-                                             sectionLay3Cu+sectionLay4Cu+
-                                             sectionLay3Glass+sectionLay4Glass, 1);
+                                     sectionLay3Plastic+sectionLay4Plastic+
+                                     sectionLay3Cu+sectionLay4Cu+
+                                     sectionLay3Glass+sectionLay4Glass, 1);
+
   TGeoPcon* pcon2container = new TGeoPcon(0,360,2);
-  pcon2container->DefineSection(0, sddCableZ2, pcon2all->GetRmin(0), pcon2all->GetRmax(0));
+  pcon2container->DefineSection(0, sddCableZ2, pcon2all->GetRmin(0),
+                                              pcon2all->GetRmax(0));
+
   drMax = pcon2all->GetRmax(0)- pcon2all->GetRmin(0);
-  pcon2container->DefineSection(1, sddCableZ3, pcon2all->GetRmax(1)-drMax, pcon2all->GetRmax(1));
-  delete pcon2all;
-  TGeoVolume *vpcon2container = new TGeoVolume("vpcon2container", pcon2container, airSDD);
+  pcon2container->DefineSection(1, sddCableZ3, pcon2all->GetRmax(1)-drMax,
+                                              pcon2all->GetRmax(1));
+
+
+  TGeoVolume *vpcon2container = new TGeoVolume("vpcon2container",
+                                              pcon2container, airSDD);
   vpcon2container->SetVisibility(kFALSE);
 
   TGeoPcon* pcon2plast = CreateConeConstSection(fgkSDDCableR2, sddCableZ2,
                                                fgkSDDCableR3, sddCableZ3,
-                                               sectionLay3Plastic+sectionLay4Plastic, 3);
-  TGeoVolume *vpcon2plast = new TGeoVolume("ITScablesSDDpcon2Plast", pcon2plast, plastic);
+                                               sectionLay3Plastic+
+                                               sectionLay4Plastic, 3);
+
+  TGeoVolume *vpcon2plast = new TGeoVolume("ITScablesSDDpcon2Plast",
+                                          pcon2plast, plastic);
   vpcon2plast->SetLineColor(kYellow);
   vpcon2container->AddNode(vpcon2plast, 0);
 
@@ -5614,97 +5812,118 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
   TGeoPcon* pcon2Cu = CreateConeConstSection(fgkSDDCableR2 - dr2a, sddCableZ2,
                                             fgkSDDCableR3 - dr2a, sddCableZ3,
                                             sectionLay3Cu+sectionLay4Cu, 3);
-  TGeoVolume *vpcon2Cu = new TGeoVolume("ITScablesSDDpcon2Cu", pcon2Cu, copper);
+
+  TGeoVolume *vpcon2Cu = new TGeoVolume("ITScablesSDDpcon2Cu",
+                                       pcon2Cu, copper);
   vpcon2Cu->SetLineColor(kRed);
   vpcon2container->AddNode(vpcon2Cu, 0);
 
-  //---
   Double_t dr2b = pcon2Cu->GetRmax(0) - pcon2Cu->GetRmin(0);
   TGeoPcon* pcon2glass = CreateConeConstSection(fgkSDDCableR2-dr2a-dr2b, sddCableZ2,
                                                fgkSDDCableR3-dr2a-dr2b, sddCableZ3,
-                                               sectionLay3Glass+sectionLay4Glass, 3);
-  TGeoVolume *vpcon2glass = new TGeoVolume("ITScablesSDDpcon2glass", pcon2glass, opticalFiber);
+                                               sectionLay3Glass+
+                                               sectionLay4Glass, 3);
+
+  TGeoVolume *vpcon2glass = new TGeoVolume("ITScablesSDDpcon2glass",
+                                          pcon2glass, opticalFiber);
   vpcon2glass->SetLineColor(kGreen);
   vpcon2container->AddNode(vpcon2glass, 0);
 
-  moth->AddNode(vpcon2container, 0);
-  moth->AddNode(vpcon2container, 1, rotCableSDD);
+  moth->AddNode(vpcon2container, 1);
+  moth->AddNode(vpcon2container, 2, rotCableSDD);
 
   //==================================
   //  intermediate cylinder
   //==================================
 
-  TGeoTube *interCyl = new TGeoTube("sddCableInterCyl", pcon2container->GetRmin(1),
+  // (was fgkSDDCableDZint hardcoded)
+  Double_t sddCableDZint = (sddConeShape->GetZ(9) - sddConeShape->GetZ(0) +
+                           sddCylinderShape->GetDz()) - sddCableZ3;
+
+  TGeoTube *interCyl = new TGeoTube("sddCableInterCyl",
+                                   pcon2container->GetRmin(1),
                                    pcon2container->GetRmax(1),
-                                   fgkSDDCableDZint/2);
-  TGeoVolume *vInterCyl = new TGeoVolume("vSddCableInterCyl",interCyl, airSDD);
+                                   sddCableDZint/2);
+
+  TGeoVolume *vInterCyl = new TGeoVolume("vSddCableInterCyl",
+                                        interCyl, airSDD);
   vInterCyl->SetVisibility(kFALSE);
 
-  //---
   Double_t rmaxCylPlast = pcon2container->GetRmax(1);
   Double_t rminCylPlast = TMath::Sqrt(rmaxCylPlast*rmaxCylPlast - 
-                                (sectionLay3Plastic+sectionLay4Plastic)/TMath::Pi() );
+                       (sectionLay3Plastic+sectionLay4Plastic)/TMath::Pi() );
 
   TGeoTube *interCylPlast = new TGeoTube("sddCableInterCylPlast", rminCylPlast,
-                                        rmaxCylPlast, fgkSDDCableDZint/2);
-  TGeoVolume *vInterCylPlast = new TGeoVolume("vSddCableInterCylPlast", interCylPlast, plastic);
+                                        rmaxCylPlast, sddCableDZint/2);
+
+  TGeoVolume *vInterCylPlast = new TGeoVolume("vSddCableInterCylPlast",
+                                             interCylPlast, plastic);
   vInterCylPlast->SetLineColor(kYellow);
   vInterCyl->AddNode(vInterCylPlast, 0);
 
-  //---
   Double_t rmaxCylCu = pcon2Cu->GetRmax(3);
   Double_t rminCylCu = TMath::Sqrt(rmaxCylCu*rmaxCylCu - 
-                                (sectionLay3Cu+sectionLay4Cu)/TMath::Pi() );
+                      (sectionLay3Cu+sectionLay4Cu)/TMath::Pi() );
+
   TGeoTube *interCylCu = new TGeoTube("sddCableInterCylCu", rminCylCu,
-                                        rmaxCylCu, fgkSDDCableDZint/2);
-  TGeoVolume *vInterCylCu = new TGeoVolume("vSddCableInterCylCu", interCylCu, copper);
+                                     rmaxCylCu, sddCableDZint/2);
+
+  TGeoVolume *vInterCylCu = new TGeoVolume("vSddCableInterCylCu",
+                                          interCylCu, copper);
   vInterCylCu->SetLineColor(kRed);
   vInterCyl->AddNode(vInterCylCu, 0);
 
-  //---
   Double_t rmaxCylGlass = pcon2glass->GetRmax(3);
   Double_t rminCylGlass = TMath::Sqrt(rmaxCylGlass*rmaxCylGlass - 
-                                (sectionLay3Glass+sectionLay4Glass)/TMath::Pi() );
+                         (sectionLay3Glass+sectionLay4Glass)/TMath::Pi() );
+
   TGeoTube *interCylGlass = new TGeoTube("sddCableInterCylGlass", rminCylGlass,
-                                        rmaxCylGlass, fgkSDDCableDZint/2);
-  TGeoVolume *vInterCylGlass = new TGeoVolume("vSddCableInterCylGlass",interCylGlass,opticalFiber);
+                                        rmaxCylGlass, sddCableDZint/2);
+
+  TGeoVolume *vInterCylGlass = new TGeoVolume("vSddCableInterCylGlass",
+                                             interCylGlass,opticalFiber);
   vInterCylGlass->SetLineColor(kGreen);
   vInterCyl->AddNode(vInterCylGlass, 0);
 
-  //---
-  TGeoTranslation *trInterCylP = new TGeoTranslation("trSddCableInterCylPos",
-                                                   0,0,sddCableZ3+fgkSDDCableDZint/2);
-  moth->AddNode(vInterCyl, 0,trInterCylP);
-  TGeoTranslation *trInterCylN = new TGeoTranslation("trSddCableInterCylNeg",
-                                                   0,0,-sddCableZ3-fgkSDDCableDZint/2);
-
-  moth->AddNode(vInterCyl, 1,trInterCylN);
+  moth->AddNode(vInterCyl, 1, new TGeoTranslation(0, 0,
+                             sddCableZ3+sddCableDZint/2));
+  moth->AddNode(vInterCyl, 2, new TGeoTranslation(0, 0,
+                            -sddCableZ3-sddCableDZint/2));
 
   //==================================
   // cable cone on the SSD cone
   //==================================
 
   Double_t sddCableR4 = rmaxCylPlast;
-  Double_t sddCableZ4 = sddCableZ3+fgkSDDCableDZint;
+  Double_t sddCableZ4 = sddCableZ3 + sddCableDZint;
 
   TGeoPcon* pcon3all = CreateConeConstSection(sddCableR4, sddCableZ4,
                                              fgkSDDCableR5, fgkSDDCableZ5,
-                                             sectionLay3Plastic+sectionLay4Plastic+
+                                             sectionLay3Plastic+
+                                             sectionLay4Plastic+
                                              sectionLay3Cu+sectionLay4Cu+
                                              sectionLay3Glass+sectionLay4Glass, 1);
 
   TGeoPcon* pcon3container = new TGeoPcon(0,360,2);
-  pcon3container->DefineSection(0, sddCableZ4, pcon3all->GetRmin(0), pcon3all->GetRmax(0));
+  pcon3container->DefineSection(0, sddCableZ4, pcon3all->GetRmin(0),
+                                              pcon3all->GetRmax(0));
+
   drMax = pcon3all->GetRmax(0) - pcon3all->GetRmin(0);
-  pcon3container->DefineSection(1, fgkSDDCableZ5, pcon3all->GetRmax(1)-drMax, pcon3all->GetRmax(1));
-  delete pcon3all;
-  TGeoVolume *vpcon3container = new TGeoVolume("vpcon3container", pcon3container, airSDD);
+  pcon3container->DefineSection(1, fgkSDDCableZ5, pcon3all->GetRmax(1)-drMax,
+                                              pcon3all->GetRmax(1));
+
+
+  TGeoVolume *vpcon3container = new TGeoVolume("vpcon3container",
+                                              pcon3container, airSDD);
   vpcon3container->SetVisibility(kFALSE);
 
   TGeoPcon* pcon3plast = CreateConeConstSection(sddCableR4, sddCableZ4,
                                                fgkSDDCableR5, fgkSDDCableZ5,
-                                               sectionLay3Plastic+sectionLay4Plastic, 3);
-  TGeoVolume *vpcon3plast = new TGeoVolume("ITScablesSDDpcon3Plast", pcon3plast, plastic);
+                                               sectionLay3Plastic+
+                                               sectionLay4Plastic, 3);
+
+  TGeoVolume *vpcon3plast = new TGeoVolume("ITScablesSDDpcon3Plast",
+                                          pcon3plast, plastic);
   vpcon3plast->SetLineColor(kYellow);
   vpcon3container->AddNode(vpcon3plast, 0);
 
@@ -5712,36 +5931,41 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
   TGeoPcon* pcon3Cu = CreateConeConstSection(sddCableR4 - dr3a, sddCableZ4,
                                             fgkSDDCableR5 - dr3a, fgkSDDCableZ5,
                                             sectionLay3Cu+sectionLay4Cu, 3);
-  TGeoVolume *vpcon3Cu = new TGeoVolume("ITScablesSDDpcon3Cu", pcon3Cu, copper);
+
+  TGeoVolume *vpcon3Cu = new TGeoVolume("ITScablesSDDpcon3Cu",
+                                       pcon3Cu, copper);
   vpcon3Cu->SetLineColor(kRed);
   vpcon3container->AddNode(vpcon3Cu, 0);
 
-  //---
   Double_t dr3b = pcon3Cu->GetRmax(0) - pcon3Cu->GetRmin(0);
   TGeoPcon* pcon3glass = CreateConeConstSection(sddCableR4-dr3a-dr3b, sddCableZ4,
                                                fgkSDDCableR5-dr3a-dr3b, fgkSDDCableZ5,
                                                sectionLay3Glass+sectionLay4Glass, 3);
-  TGeoVolume *vpcon3glass = new TGeoVolume("ITScablesSDDpcon3glass", pcon3glass,opticalFiber);
+
+  TGeoVolume *vpcon3glass = new TGeoVolume("ITScablesSDDpcon3glass",
+                                          pcon3glass,opticalFiber);
   vpcon3glass->SetLineColor(kGreen);
   vpcon3container->AddNode(vpcon3glass, 0);
 
-  moth->AddNode(vpcon3container, 0);
-  moth->AddNode(vpcon3container, 1, rotCableSDD);
-
+  moth->AddNode(vpcon3container, 1);
+  moth->AddNode(vpcon3container, 2, rotCableSDD);
 
   //==================================
   // cables that are grouped at the end of SSD cones
   //==================================
 
-  Double_t fgkSDDCableR6 = fgkSDDCableR5+10;
-  Double_t fgkSDDCableZ6 = fgkSDDCableZ5+10;
+//  Double_t fgkSDDCableR6 = fgkSDDCableR5+9;
+//  Double_t fgkSDDCableZ6 = fgkSDDCableZ5+8.8;
+  Double_t fgkSDDCableR6 = fgkSDDCableR5+8;
+  Double_t fgkSDDCableZ6 = fgkSDDCableZ5+8;
 
   TGeoVolumeAssembly *endConeSDDCable = new TGeoVolumeAssembly("endConeSDDCable");
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 40, 1*3,2*4, fgkSDDCableR5,
-                             fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
+  // Add some hardcoded shifts to avoid overlaps with SSD pathc panels
+  CreateAndInsetConeCablePart(endConeSDDCable, 20, 1*3,2*4, fgkSDDCableR5,
+                             fgkSDDCableZ5,fgkSDDCableR6-2.6,fgkSDDCableZ6-2.6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 60, 1*3,1*4, fgkSDDCableR5,
+  CreateAndInsetConeCablePart(endConeSDDCable, 50, 1*3,1*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
   CreateAndInsetConeCablePart(endConeSDDCable, 85, 2*3,1*4, fgkSDDCableR5,
@@ -5750,10 +5974,10 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
   CreateAndInsetConeCablePart(endConeSDDCable, 95, 0*3,1*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 110, 2*3,3*4, fgkSDDCableR5,
-                             fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
+  CreateAndInsetConeCablePart(endConeSDDCable, 105, 2*3,3*4, fgkSDDCableR5,
+                             fgkSDDCableZ5,fgkSDDCableR6-2.6,fgkSDDCableZ6-2.6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 146, 0*3,3*4, fgkSDDCableR5,
+  CreateAndInsetConeCablePart(endConeSDDCable, 129, 0*3,3*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
   CreateAndInsetConeCablePart(endConeSDDCable, 176, 0*3,1*4, fgkSDDCableR5,
@@ -5762,24 +5986,27 @@ void AliITSv11GeometrySDD::SDDCables(TGeoVolume *moth) {
   CreateAndInsetConeCablePart(endConeSDDCable, 190, 2*3,0*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 220, 1*3,2*4, fgkSDDCableR5,
-                             fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
+  CreateAndInsetConeCablePart(endConeSDDCable, 210, 1*3,2*4, fgkSDDCableR5,
+                             fgkSDDCableZ5,fgkSDDCableR6-2.6,fgkSDDCableZ6-2.6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 240, 1*3,2*4, fgkSDDCableR5,
+  CreateAndInsetConeCablePart(endConeSDDCable, 230, 1*3,2*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 290, 2*3,2*4, fgkSDDCableR5,
+  CreateAndInsetConeCablePart(endConeSDDCable, 277, 2*3,2*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 315, 1*3,1*4, fgkSDDCableR5,
+  CreateAndInsetConeCablePart(endConeSDDCable, 306, 1*3,1*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
-  CreateAndInsetConeCablePart(endConeSDDCable, 350, 1*3,3*4, fgkSDDCableR5,
+  CreateAndInsetConeCablePart(endConeSDDCable, 353, 1*3,3*4, fgkSDDCableR5,
                              fgkSDDCableZ5,fgkSDDCableR6,fgkSDDCableZ6);
 
-  moth->AddNode(endConeSDDCable, 0, 0);
+  moth->AddNode(endConeSDDCable, 1, 0);
 
   TGeoRotation* reflect = new TGeoRotation("reflectEndConeSDDCable");
   reflect->ReflectZ(kTRUE);
-  moth->AddNode(endConeSDDCable, 1, reflect);
+  moth->AddNode(endConeSDDCable, 2, reflect);
+
+
+  return;
 }