]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv11GeometrySDD.cxx
Fix for Coverity warnings (M. Sitta)
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySDD.cxx
index 6f6983f20998f61e63f36130c98c27391166c5f8..80a95cbd75b4964f378ad81a39b4a0a96ba6afd1 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*****************************************/
+ **************************************************************************/
 
 
 //*************************************************************************
@@ -43,6 +43,7 @@
 #include <TGeoMatrix.h>
 #include <TGeoNode.h>
 #include <TGeoPcon.h>
+#include <TGeoTorus.h>
 
 #include "AliITSgeom.h"
 #include "AliITSgeomSDD.h"
@@ -106,7 +107,7 @@ 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::fgkLay3Rmin           = 129.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay3Rmax           = 200.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay3Length         = (524.+0.)*fgkmm; // ladder+supporting rings (length of the virtual tube)
 const Double_t AliITSv11GeometrySDD::fgkLay3LadderLength   = 524.*fgkmm;
@@ -117,7 +118,7 @@ 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::fgkLay4Rmin           = 220.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay4Rmax           = 286.*fgkmm;
 const Double_t AliITSv11GeometrySDD::fgkLay4Length         = (671.+0.)*fgkmm;    // ladder+supporting rings (length of the virtual tube)
 const Double_t AliITSv11GeometrySDD::fgkLay4LadderLength   = 671.*fgkmm;
@@ -195,7 +196,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,6 +465,9 @@ 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
 
@@ -502,6 +507,7 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD():
   fSDDsensor4(0),
   fBaseThermalBridge(0),
   fHybrid(0),
+  fLadderFoot(0),
   fCardLVR(0),
   fCardLVL(0),
   fCardHV(0),
@@ -542,6 +548,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 +570,7 @@ AliITSv11GeometrySDD::AliITSv11GeometrySDD(Int_t debug) :
   fSDDsensor4(0),
   fBaseThermalBridge(0),
   fHybrid(0),
+  fLadderFoot(0),
   fCardLVR(0),
   fCardLVL(0),
   fCardHV(0),
@@ -596,6 +611,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 +632,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 +672,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();
 }
 
@@ -805,11 +837,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 +852,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);
@@ -1215,6 +1251,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);
@@ -1261,14 +1298,14 @@ void AliITSv11GeometrySDD::Layer3(TGeoVolume *moth) {
     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);
     ///////////////////////////////////////////////////
   }
 
@@ -1479,8 +1516,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);
 }
 
 //________________________________________________________________________
@@ -1729,8 +1770,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);
 }
 
 
@@ -1912,21 +1957,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;
 }
 
@@ -2224,7 +2280,6 @@ 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);
 
     AliITSv11GeomCableFlat ccLayer1(ch, 6.6*fgkmm, ccUpLayerTotThick);
@@ -2773,19 +2828,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
@@ -2862,6 +2917,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 +2930,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
@@ -3092,12 +3147,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 +3165,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);
@@ -4440,12 +4499,14 @@ TGeoVolume*  AliITSv11GeometrySDD::CreateEndLadderCardsV(Int_t iLay) {
   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 +4514,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 +4559,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 +4741,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,6 +4780,17 @@ 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;
 }
 
@@ -5259,6 +5341,49 @@ TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateDetectorsAssembly(Int_t iLay) {
 }
 
 
+//________________________________________________________________________
+TGeoVolumeAssembly *AliITSv11GeometrySDD::CreateDetectorsAssemblyLadd2() {
+//
+// 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;
+
+  char name[30];
+  sprintf(name,"ITSsddDetBoxLadd2");
+  
+  TGeoVolumeAssembly  *virtualDet = new TGeoVolumeAssembly("ITSsddLadd");
+
+  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;
+    sprintf(name, "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;
+}
+
+
 //________________________________________________________________________
 Int_t AliITSv11GeometrySDD::ExportSensorGeometry(AliITSgeom *geom, Int_t iLaySDD,
                                                 Int_t startMod) {
@@ -5463,8 +5588,8 @@ 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);
@@ -5510,14 +5635,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 +5671,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 +5706,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 +5730,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 +5755,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 +5786,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 +5905,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 +5948,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 +5960,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;
 }