LCOV - code coverage report
Current view: top level - ITS/ITSsim - AliITSv11GeometrySupport.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6646 6670 99.6 %
Date: 2016-06-14 17:26:59 Functions: 27 27 100.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // This class Defines the Geometry for the ITS services and support cones
      17             : // outside of the ceneteral volume (except for the Ceneteral support 
      18             : // cylinders. Other classes define the rest of the ITS. Specificaly the ITS
      19             : // The SSD support cone,SSD Support centeral cylinder, SDD support cone,
      20             : // The SDD cupport centeral cylinder, the SPD Thermal Sheald, The supports
      21             : // and cable trays on both the RB26 (muon dump) and RB24 sides, and all of
      22             : // the cabling from the ladders/stave ends out past the TPC. 
      23             : 
      24             : /* $Id$ */
      25             : // General Root includes
      26             : #include <TMath.h>
      27             : // Root Geometry includes
      28             : //#include <AliLog.h>
      29             : #include <TGeoManager.h>
      30             : #include <TGeoVolume.h>
      31             : #include <TGeoPcon.h>
      32             : #include <TGeoCone.h>
      33             : #include <TGeoTube.h> // contaings TGeoTubeSeg
      34             : #include <TGeoArb8.h>
      35             : #include <TGeoXtru.h>
      36             : #include <TGeoCompositeShape.h>
      37             : #include <TGeoMatrix.h>
      38             : #include "AliITSv11GeometrySupport.h"
      39             : 
      40         116 : ClassImp(AliITSv11GeometrySupport)
      41             : 
      42             : #define SQ(A) (A)*(A)
      43             : 
      44             : //______________________________________________________________________
      45             : void AliITSv11GeometrySupport::SPDCone(TGeoVolume *moth,const TGeoManager *mgr)
      46             : {
      47             : //
      48             : // Creates the SPD thermal shield as a volume assembly
      49             : // and adds it to the mother volume
      50             : // (this is actually a merge of the previous SPDThermalSheald method
      51             : // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06 and the
      52             : // CreateSPDThermalShield method of AliITSv11Hybrid)
      53             : //
      54             : // Input:
      55             : //         moth : the TGeoVolume owing the volume structure
      56             : //         mgr  : the GeoManager (default gGeoManager)
      57             : // Output:
      58             : //
      59             : // Created:         ???          ???
      60             : // Updated:      11 Dec 2007  Mario Sitta
      61             : // Updated:      20 Mar 2012  Mario Sitta  Reimplemented with simpler shapes
      62             : // Updated:      20 Jul 2012  Mario Sitta  Reimplemented with Composite Shape
      63             : // Updated:      12 Oct 2012  Mario Sitta  Composite Shape also for EndCap
      64             : //
      65             : // Technical data are taken from:  ALICE-Thermal Screen "Cone transition"
      66             : // (thermal-screen1_a3.ps), "Cylinder" (thermal-screen2_a3.ps), "Half
      67             : // assembly" (thermal-screen3_a3.ps), "Flange" (thermal-screen4_a3.ps)
      68             : 
      69             : 
      70             :   // Dimensions of the Central shield
      71           2 :   const Double_t kHalfLengthCentral  = 399.9*fgkmm;
      72           1 :   const Double_t kThicknessCentral   = 0.4*fgkmm;
      73           1 :   const Double_t kInnerRadiusCentral = 8.1475*fgkcm;
      74           1 :   const Double_t kOuterRadiusCentral = 9.9255*fgkcm;
      75           1 :   const Double_t kInnerACentral = 3.1674*fgkcm;
      76           1 :   const Double_t kInnerBCentral = 2.023 *fgkcm;
      77           1 :   const Double_t kOuterACentral = 2.4374*fgkcm;
      78           1 :   const Double_t kOuterBCentral = 3.8162*fgkcm;
      79           1 :   const Double_t kCoolManifHoleWid  = 24.0*fgkmm; // TO BE CHECKED!
      80           1 :   const Double_t kCoolManifHoleLen  = 57.5*fgkmm; // 54.2 + 1.5*2 + 0.3 toll.
      81           1 :   const Double_t kCoolManifHoleZPos = 36.47*fgkcm;// MUST match SPD class
      82           1 :   const Double_t kCoolSuppHoleWid  = 15.0*fgkmm;
      83           1 :   const Double_t kCoolSuppHoleLen  = 38.4*fgkmm; // 35.1 + 1.5*2 + 0.3 toll.// TO BE CHECKED!
      84           1 :   const Double_t kCoolSuppHoleZPos = 26.5*fgkcm;
      85             :   // Dimensions of the EndCap shield
      86           1 :   const Double_t kHalfLengthEndCap  = 25.*fgkmm;
      87           1 :   const Double_t kThicknessEndCap   = 2.0*fgkmm;
      88           1 :   const Double_t kInnerRadiusEndCap = 8.0775*fgkcm;
      89           1 :   const Double_t kOuterRadiusEndCap = 9.9955*fgkcm;
      90           1 :   const Double_t kInnerAEndCap = 3.1453*fgkcm;
      91           1 :   const Double_t kInnerBEndCap = 2.0009*fgkcm;
      92           1 :   const Double_t kOuterAEndCap = 2.4596*fgkcm;
      93           1 :   const Double_t kOuterBEndCap = 3.8384*fgkcm;
      94             :   // Dimensions of the Cone shield
      95           1 :   const Double_t kHalfLengthCone  = 145.*fgkmm;
      96           1 :   const Double_t kThicknessCone   = 0.3*fgkmm;
      97           1 :   const Double_t kInnerRadialCone = 37.3*fgkcm;
      98           1 :   const Double_t kOuterRadialCone = 39.0*fgkcm;
      99           1 :   const Double_t kInnerACone = 14.2344*fgkcm;
     100           1 :   const Double_t kInnerBCone =  9.0915*fgkcm;
     101           1 :   const Double_t kOuterACone =  9.5058*fgkcm;
     102           1 :   const Double_t kOuterBCone = 14.8831*fgkcm;
     103             :   // Dimensions of the filler blocks and bars
     104           1 :   const Double_t kFillerBlockLength = 20.0*fgkmm;
     105           1 :   const Double_t kFillerBlockHoleR  = 2.4*fgkmm;
     106           1 :   const Double_t kFillerBlockZTrans = 1.5*fgkmm;
     107           1 :   const Double_t kFillerBarLength = 220.0*fgkmm;
     108             :   const Double_t kFillerBarThick  =   1.0*fgkmm;
     109             :   // Dimensions of the Flange's Ring and Wing
     110           1 :   const Double_t kHalfLengthRing  = 7.5*fgkmm;
     111             :   const Double_t kThicknessRing   = 0.3*fgkmm;
     112             :   const Double_t kInnerRadiusRing = 37.3*fgkcm;
     113           1 :   const Double_t kOuterRadiusRing = 42.0*fgkcm;
     114           1 :   const Double_t kOuterRadiusWing = 49.25*fgkcm;
     115           1 :   const Double_t kWideWing      = 6.0*fgkcm;
     116             :   const Double_t kThetaWing     = 45.0;
     117             :   // Common data
     118             :   const Double_t kThetaDeg = 36.0;
     119           1 :   const Double_t kTheta = kThetaDeg*TMath::DegToRad();
     120           1 :   const Double_t kThicknessOmega = 0.3*fgkmm;
     121             : 
     122             :   // Local variables
     123             :   Double_t xpos, ypos, zpos;
     124           1 :   Double_t xXtru[24], yXtru[24];
     125           1 :   Double_t xshld[24], yshld[24]; // Coord. of external thermal shape
     126           1 :   Double_t xair[24] , yair[24];  // Coord. of whole air shape
     127           1 :   Double_t xomega[48], yomega[48];
     128             : 
     129             : 
     130             :   // The entire shield is made up of two half central shields
     131             :   // symmetric with respect to the XZ plane, four half end cap
     132             :   // shields, again symmetric with respect to the XZ plane, and four
     133             :   // half cones, symmetric with respect to the XZ plane too.
     134             : 
     135           1 :   TGeoVolumeAssembly *vM = new TGeoVolumeAssembly("ITSspdThermalShield");
     136             : 
     137             :   // The central half shield: a Composite Shape of carbon fiber.
     138             :   // We need Composite Shapes because we have holes in which the SPD
     139             :   // cooling manifolds and their supports will be placed.
     140             :   // All Composite elements are XTru shapes
     141             : 
     142             :   // First determine the external shape points
     143           1 :   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
     144             :                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
     145           1 :                         kTheta,xshld,yshld);
     146             : 
     147             :   // Now rescale to get the air volume dimensions
     148           2 :     InsidePoint(xshld[23], yshld[23],
     149           1 :                 xshld[ 0], yshld[ 0],
     150           1 :                 xshld[ 1], yshld[ 1], kThicknessCentral,
     151           1 :                 xair[0], yair[0]);
     152          46 :   for (Int_t i=1; i<23; i++) {
     153          44 :     InsidePoint(xshld[i-1], yshld[i-1],
     154          22 :                 xshld[ i ], yshld[ i ],
     155          22 :                 xshld[i+1], yshld[i+1], kThicknessCentral,
     156          22 :                 xair[i], yair[i]);
     157             :   }
     158           2 :     InsidePoint(xshld[22], yshld[22],
     159           1 :                 xshld[23], yshld[23],
     160           1 :                 xshld[ 0], yshld[ 0], kThicknessCentral,
     161           1 :                 xair[23], yair[23]);
     162             : 
     163             :   // Then use them to determine the Omega shape points
     164           1 :   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
     165             : 
     166             :   // Finally create the single Xtru volumes
     167           1 :   TGeoXtru *uppershape = new TGeoXtru(2);
     168           1 :   uppershape->SetName("upTS");
     169             : 
     170          14 :   for (Int_t j=0; j<6; j++) {
     171           6 :     xXtru[j  ] = xair[11-j];
     172           6 :     yXtru[j  ] = yair[11-j];
     173           6 :     xXtru[j+6] = xshld[j+6];
     174           6 :     yXtru[j+6] = yshld[j+6];
     175             :   }
     176           1 :   yXtru[5] = yXtru[6];  // Air is not at same Y as thermal shield
     177          26 :   for (Int_t j=0; j<12; j++) {
     178          12 :     xXtru[23-j] = -xXtru[j];
     179          12 :     yXtru[23-j] =  yXtru[j];
     180             :   }
     181             : 
     182           1 :   uppershape->DefinePolygon(24,xXtru,yXtru);
     183           1 :   uppershape->DefineSection(0,-kHalfLengthCentral);
     184           1 :   uppershape->DefineSection(1, kHalfLengthCentral);
     185             : 
     186           1 :   TGeoXtru *lowershape = new TGeoXtru(2);
     187           1 :   lowershape->SetName("lwTS");
     188             : 
     189          14 :   for (Int_t j=0; j<6; j++) {
     190           6 :     xXtru[j  ] = xshld[j];
     191           6 :     yXtru[j  ] = yshld[j];
     192           6 :     xXtru[j+6] = xair[5-j];
     193           6 :     yXtru[j+6] = yair[5-j];
     194             :   }
     195           1 :   yXtru[6] = yXtru[5];  // Air is not at same Y as thermal shield
     196          26 :   for (Int_t j=0; j<12; j++) {
     197          12 :     xXtru[23-j] = -xXtru[j];
     198          12 :     yXtru[23-j] =  yXtru[j];
     199             :   }
     200             : 
     201           1 :   lowershape->DefinePolygon(24,xXtru,yXtru);
     202           1 :   lowershape->DefineSection(0,-kHalfLengthCentral);
     203           1 :   lowershape->DefineSection(1, kHalfLengthCentral);
     204             : 
     205           1 :   yomega[10] = yshld[6];   // Add also base thickness
     206           1 :   yomega[11] = yomega[10];
     207           1 :   yomega[36] = yshld[17];
     208           1 :   yomega[37] = yomega[36];
     209             : 
     210           1 :   TGeoXtru *omegashape = new TGeoXtru(2);
     211           1 :   omegashape->SetName("omTS");
     212             : 
     213           1 :   omegashape->DefinePolygon(48,xomega,yomega);
     214           1 :   omegashape->DefineSection(0,-kHalfLengthCentral);
     215           1 :   omegashape->DefineSection(1, kHalfLengthCentral);
     216             : 
     217             :   // And now the holes and their position matrices
     218           1 :   Double_t radius = 0.5*(uppershape->GetY(11)+lowershape->GetY(0));
     219             : 
     220           2 :   TGeoBBox *manifhole = new TGeoBBox(kCoolManifHoleWid/2,
     221           1 :           0.55*(uppershape->GetY(11)-lowershape->GetY(0)),
     222           1 :                                      kCoolManifHoleLen/2);
     223           1 :   manifhole->SetName("mhTS");
     224             : 
     225             :   zpos = kCoolManifHoleZPos;
     226             : 
     227           1 :   TGeoTranslation *m1p = new TGeoTranslation("m1p",0,radius, zpos);
     228           1 :   TGeoTranslation *m1n = new TGeoTranslation("m1n",0,radius,-zpos);
     229           1 :   m1p->RegisterYourself();
     230           1 :   m1n->RegisterYourself();
     231             : 
     232           3 :   TGeoCombiTrans *m2p = new TGeoCombiTrans("m2p",radius*SinD(kThetaDeg),
     233           2 :                                                  radius*CosD(kThetaDeg),
     234             :                                            zpos,
     235           2 :                                         new TGeoRotation("",-kThetaDeg,0,0));
     236           3 :   TGeoCombiTrans *m2n = new TGeoCombiTrans("m2n",radius*SinD(kThetaDeg),
     237           2 :                                                  radius*CosD(kThetaDeg),
     238             :                                           -zpos,
     239           2 :                                         new TGeoRotation("",-kThetaDeg,0,0));
     240           1 :   m2p->RegisterYourself();
     241           1 :   m2n->RegisterYourself();
     242             : 
     243           3 :   TGeoCombiTrans *m3p = new TGeoCombiTrans("m3p",radius*SinD(-kThetaDeg),
     244           2 :                                                  radius*CosD(-kThetaDeg),
     245             :                                            zpos,
     246           2 :                                         new TGeoRotation("",kThetaDeg,0,0));
     247           3 :   TGeoCombiTrans *m3n = new TGeoCombiTrans("m3n",radius*SinD(-kThetaDeg),
     248           2 :                                                  radius*CosD(-kThetaDeg),
     249             :                                           -zpos,
     250           2 :                                         new TGeoRotation("",kThetaDeg,0,0));
     251           1 :   m3p->RegisterYourself();
     252           1 :   m3n->RegisterYourself();
     253             : 
     254           3 :   TGeoCombiTrans *m4p = new TGeoCombiTrans("m4p",radius*SinD(2*kThetaDeg),
     255           2 :                                                  radius*CosD(2*kThetaDeg),
     256             :                                            zpos,
     257           2 :                                         new TGeoRotation("",-2*kThetaDeg,0,0));
     258           3 :   TGeoCombiTrans *m4n = new TGeoCombiTrans("m4n",radius*SinD(2*kThetaDeg),
     259           2 :                                                  radius*CosD(2*kThetaDeg),
     260             :                                           -zpos,
     261           2 :                                         new TGeoRotation("",-2*kThetaDeg,0,0));
     262           1 :   m4p->RegisterYourself();
     263           1 :   m4n->RegisterYourself();
     264             : 
     265           3 :   TGeoCombiTrans *m5p = new TGeoCombiTrans("m5p",radius*SinD(-2*kThetaDeg),
     266           2 :                                                  radius*CosD(-2*kThetaDeg),
     267             :                                            zpos,
     268           2 :                                         new TGeoRotation("",2*kThetaDeg,0,0));
     269           3 :   TGeoCombiTrans *m5n = new TGeoCombiTrans("m5n",radius*SinD(-2*kThetaDeg),
     270           2 :                                                  radius*CosD(-2*kThetaDeg),
     271             :                                           -zpos,
     272           2 :                                         new TGeoRotation("",2*kThetaDeg,0,0));
     273           1 :   m5p->RegisterYourself();
     274           1 :   m5n->RegisterYourself();
     275             : 
     276           2 :   TGeoBBox *supphole = new TGeoBBox(kCoolSuppHoleWid/2,
     277           1 :          0.55*(uppershape->GetY(11)-lowershape->GetY(0)),
     278           1 :                                     kCoolSuppHoleLen/2);
     279           1 :   supphole->SetName("shTS");
     280             : 
     281             :   zpos = kCoolSuppHoleZPos;
     282             : 
     283           1 :   TGeoTranslation *s1p = new TGeoTranslation("s1p",0,radius, zpos);
     284           1 :   TGeoTranslation *s1n = new TGeoTranslation("s1n",0,radius,-zpos);
     285           1 :   s1p->RegisterYourself();
     286           1 :   s1n->RegisterYourself();
     287             : 
     288           3 :   TGeoCombiTrans *s2p = new TGeoCombiTrans("s2p",radius*SinD(kThetaDeg),
     289           2 :                                                  radius*CosD(kThetaDeg),
     290             :                                            zpos,
     291           2 :                                         new TGeoRotation("",-kThetaDeg,0,0));
     292           3 :   TGeoCombiTrans *s2n = new TGeoCombiTrans("s2n",radius*SinD(kThetaDeg),
     293           2 :                                                  radius*CosD(kThetaDeg),
     294             :                                           -zpos,
     295           2 :                                         new TGeoRotation("",-kThetaDeg,0,0));
     296           1 :   s2p->RegisterYourself();
     297           1 :   s2n->RegisterYourself();
     298             : 
     299           3 :   TGeoCombiTrans *s3p = new TGeoCombiTrans("s3p",radius*SinD(-kThetaDeg),
     300           2 :                                                  radius*CosD(-kThetaDeg),
     301             :                                            zpos,
     302           2 :                                         new TGeoRotation("",kThetaDeg,0,0));
     303           3 :   TGeoCombiTrans *s3n = new TGeoCombiTrans("s3n",radius*SinD(-kThetaDeg),
     304           2 :                                                  radius*CosD(-kThetaDeg),
     305             :                                           -zpos,
     306           2 :                                         new TGeoRotation("",kThetaDeg,0,0));
     307           1 :   s3p->RegisterYourself();
     308           1 :   s3n->RegisterYourself();
     309             : 
     310           3 :   TGeoCombiTrans *s4p = new TGeoCombiTrans("s4p",radius*SinD(2*kThetaDeg),
     311           2 :                                                  radius*CosD(2*kThetaDeg),
     312             :                                            zpos,
     313           2 :                                         new TGeoRotation("",-2*kThetaDeg,0,0));
     314           3 :   TGeoCombiTrans *s4n = new TGeoCombiTrans("s4n",radius*SinD(2*kThetaDeg),
     315           2 :                                                  radius*CosD(2*kThetaDeg),
     316             :                                           -zpos,
     317           2 :                                         new TGeoRotation("",-2*kThetaDeg,0,0));
     318           1 :   s4p->RegisterYourself();
     319           1 :   s4n->RegisterYourself();
     320             : 
     321           3 :   TGeoCombiTrans *s5p = new TGeoCombiTrans("s5p",radius*SinD(-2*kThetaDeg),
     322           2 :                                                  radius*CosD(-2*kThetaDeg),
     323             :                                            zpos,
     324           2 :                                         new TGeoRotation("",2*kThetaDeg,0,0));
     325           3 :   TGeoCombiTrans *s5n = new TGeoCombiTrans("s5n",radius*SinD(-2*kThetaDeg),
     326           2 :                                                  radius*CosD(-2*kThetaDeg),
     327             :                                           -zpos,
     328           2 :                                         new TGeoRotation("",2*kThetaDeg,0,0));
     329           1 :   s5p->RegisterYourself();
     330           1 :   s5n->RegisterYourself();
     331             : 
     332             :   // Finally the actual shape
     333           1 :   TGeoCompositeShape *centralshape = new TGeoCompositeShape("centralTS",
     334             :     "upTS+lwTS+omTS-mhTS:m1p-mhTS:m1n-mhTS:m2p-mhTS:m2n-mhTS:m3p-mhTS:m3n-mhTS:m4p-mhTS:m4n-mhTS:m5p-mhTS:m5n-shTS:s1p-shTS:s1n-shTS:s2p-shTS:s2n-shTS:s3p-shTS:s3n-shTS:s4p-shTS:s4n-shTS:s5p-shTS:s5n");
     335             : 
     336             :   // The end cap half shield: a Composite Shape of carbon fiber.
     337             :   // We need Composite Shapes because we have elements partially
     338             :   // entering the empty spaces, and this would create overlaps or
     339             :   // extrusions.
     340             :   // All Composite elements are XTru shapes
     341             : 
     342             :   // First determine the external shape points
     343           1 :   CreateSPDThermalShape(kInnerAEndCap,kInnerBEndCap,kInnerRadiusEndCap,
     344             :                         kOuterAEndCap,kOuterBEndCap,kOuterRadiusEndCap,
     345             :                         kTheta,xshld,yshld);
     346             : 
     347             :   // Now rescale to get the air volume dimensions
     348           2 :     InsidePoint(xshld[23], yshld[23],
     349           1 :                 xshld[ 0], yshld[ 0],
     350           1 :                 xshld[ 1], yshld[ 1], kThicknessEndCap,
     351             :                 xair[0], yair[0]);
     352          46 :   for (Int_t i=1; i<23; i++) {
     353          44 :     InsidePoint(xshld[i-1], yshld[i-1],
     354          22 :                 xshld[ i ], yshld[ i ],
     355          22 :                 xshld[i+1], yshld[i+1], kThicknessEndCap,
     356          22 :                 xair[i], yair[i]);
     357             :   }
     358           2 :     InsidePoint(xshld[22], yshld[22],
     359           1 :                 xshld[23], yshld[23],
     360           1 :                 xshld[ 0], yshld[ 0], kThicknessEndCap,
     361             :                 xair[23], yair[23]);
     362             : 
     363             :   // Then use them to determine the Omega shape points
     364           1 :   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
     365             : 
     366             :   // Finally create the single Xtru volumes
     367           1 :   TGeoXtru *upendcapshape = new TGeoXtru(2);
     368           1 :   upendcapshape->SetName("upEC");
     369             : 
     370          14 :   for (Int_t j=0; j<6; j++) {
     371           6 :     xXtru[j  ] = xair[11-j];
     372           6 :     yXtru[j  ] = yair[11-j];
     373           6 :     xXtru[j+6] = xshld[j+6];
     374           6 :     yXtru[j+6] = yshld[j+6];
     375             :   }
     376           1 :   yXtru[5] = yXtru[6];  // Air is not at same Y as thermal shield
     377          26 :   for (Int_t j=0; j<12; j++) {
     378          12 :     xXtru[23-j] = -xXtru[j];
     379          12 :     yXtru[23-j] =  yXtru[j];
     380             :   }
     381             : 
     382           1 :   upendcapshape->DefinePolygon(24,xXtru,yXtru);
     383           1 :   upendcapshape->DefineSection(0,-kHalfLengthEndCap);
     384           1 :   upendcapshape->DefineSection(1, kHalfLengthEndCap);
     385             : 
     386           1 :   TGeoXtru *lowendcapshape = new TGeoXtru(2);
     387           1 :   lowendcapshape->SetName("lwEC");
     388             : 
     389          14 :   for (Int_t j=0; j<6; j++) {
     390           6 :     xXtru[j  ] = xshld[j];
     391           6 :     yXtru[j  ] = yshld[j];
     392           6 :     xXtru[j+6] = xair[5-j];
     393           6 :     yXtru[j+6] = yair[5-j];
     394             :   }
     395           1 :   yXtru[6] = yXtru[5];  // Air is not at same Y as thermal shield
     396          26 :   for (Int_t j=0; j<12; j++) {
     397          12 :     xXtru[23-j] = -xXtru[j];
     398          12 :     yXtru[23-j] =  yXtru[j];
     399             :   }
     400             : 
     401           1 :   lowendcapshape->DefinePolygon(24,xXtru,yXtru);
     402           1 :   lowendcapshape->DefineSection(0,-kHalfLengthEndCap);
     403           1 :   lowendcapshape->DefineSection(1, kHalfLengthEndCap);
     404             : 
     405           1 :   yomega[10] = yshld[6];   // Add also base thickness
     406           1 :   yomega[11] = yomega[10];
     407           1 :   yomega[36] = yshld[17];
     408           1 :   yomega[37] = yomega[36];
     409             : 
     410           1 :   TGeoXtru *omgendcapshape = new TGeoXtru(2);
     411           1 :   omgendcapshape->SetName("omEC");
     412             : 
     413           1 :   omgendcapshape->DefinePolygon(48,xomega,yomega);
     414           1 :   omgendcapshape->DefineSection(0,-kHalfLengthEndCap);
     415           1 :   omgendcapshape->DefineSection(1, kHalfLengthEndCap);
     416             : 
     417             :   // Finally the actual shape
     418           1 :   TGeoCompositeShape *endcapshape = new TGeoCompositeShape("endcapTS",
     419             :                                                            "upEC+lwEC+omEC");
     420             : 
     421             :   // The filler block: a Xtru
     422           1 :   TGeoXtru *fillershape = new TGeoXtru(2);
     423             : 
     424           1 :   xXtru[0] = omgendcapshape->GetX(1) + 0.0002; // Avoid thiny extrusion
     425           1 :   yXtru[0] = omgendcapshape->GetY(1);
     426           1 :   xXtru[1] = omgendcapshape->GetX(0) + 0.0002;
     427           1 :   yXtru[1] = omgendcapshape->GetY(0);
     428           1 :   xXtru[2] = omgendcapshape->GetX(47) - 0.0002;
     429           1 :   yXtru[2] = omgendcapshape->GetY(47);
     430           1 :   xXtru[3] = omgendcapshape->GetX(46);
     431           1 :   yXtru[3] = omgendcapshape->GetY(46);
     432             : 
     433           1 :   fillershape->DefinePolygon(4,xXtru,yXtru);
     434           1 :   fillershape->DefineSection(0,-kFillerBlockLength/2);
     435           1 :   fillershape->DefineSection(1, kFillerBlockLength/2);
     436             : 
     437             :   // The hole in the filler: a Tube (made of air)
     438           1 :   TGeoTube *fillerholeshape = new TGeoTube(0, kFillerBlockHoleR,
     439             :                                            kFillerBlockLength/2);
     440             : 
     441             :   // The filler bar: a BBox
     442           1 :   Double_t fside = omgendcapshape->GetY(14) - omgendcapshape->GetY(13);
     443           1 :   TGeoBBox *fillbarshape = new TGeoBBox(fside/2, fside/2, kFillerBarLength/2);
     444             : 
     445             :   // The hole in the bar filler: a smaller BBox (made of air)
     446           1 :   fside -= 2*kFillerBarThick;
     447           1 :   TGeoBBox *fillbarholeshape = new TGeoBBox(fside/2, fside/2,
     448             :                                             kFillerBarLength/2);
     449             : 
     450             :   // The cone half shield is more complex since there is no basic
     451             :   // TGeo shape to describe it correctly. So it is a Composite Shape
     452             :   // of a series of TGeoArb8 shapes, in which TGeoArb8 shapes filled
     453             :   // with air are placed, which all together make up the cone AND
     454             :   // its internal insert. Part of the following code is adapted from
     455             :   // old SPDThermalSheald method.
     456             : 
     457             :   // sCn : Filled portions, sChn : Air holes
     458           1 :   TGeoArb8 *sC1  = new TGeoArb8(kHalfLengthCone);
     459           1 :   TGeoArb8 *sC2  = new TGeoArb8(kHalfLengthCone);
     460           1 :   TGeoArb8 *sC3  = new TGeoArb8(kHalfLengthCone);
     461           1 :   TGeoArb8 *sC4  = new TGeoArb8(kHalfLengthCone);
     462           1 :   TGeoArb8 *sC5  = new TGeoArb8(kHalfLengthCone);
     463           1 :   TGeoArb8 *sC6  = new TGeoArb8(kHalfLengthCone);
     464           1 :   TGeoArb8 *sC7  = new TGeoArb8(kHalfLengthCone);
     465           1 :   TGeoArb8 *sC8  = new TGeoArb8(kHalfLengthCone);
     466           1 :   TGeoArb8 *sC9  = new TGeoArb8(kHalfLengthCone);
     467           1 :   TGeoArb8 *sC10 = new TGeoArb8(kHalfLengthCone);
     468           1 :   TGeoArb8 *sC11 = new TGeoArb8(kHalfLengthCone);
     469             : 
     470           1 :   sC1->SetName("sC1");
     471           1 :   sC2->SetName("sC2");
     472           1 :   sC3->SetName("sC3");
     473           1 :   sC4->SetName("sC4");
     474           1 :   sC5->SetName("sC5");
     475           1 :   sC6->SetName("sC6");
     476           1 :   sC7->SetName("sC7");
     477           1 :   sC8->SetName("sC8");
     478           1 :   sC9->SetName("sC9");
     479           1 :   sC10->SetName("sC10");
     480           1 :   sC11->SetName("sC11");
     481             : 
     482           1 :   TGeoArb8 *sCh1  = new TGeoArb8(kHalfLengthCone);
     483           1 :   TGeoArb8 *sCh2  = new TGeoArb8(kHalfLengthCone);
     484           1 :   TGeoArb8 *sCh3  = new TGeoArb8(kHalfLengthCone);
     485           1 :   TGeoArb8 *sCh4  = new TGeoArb8(kHalfLengthCone);
     486           1 :   TGeoArb8 *sCh5  = new TGeoArb8(kHalfLengthCone);
     487           1 :   TGeoArb8 *sCh6  = new TGeoArb8(kHalfLengthCone);
     488           1 :   TGeoArb8 *sCh7  = new TGeoArb8(kHalfLengthCone);
     489           1 :   TGeoArb8 *sCh8  = new TGeoArb8(kHalfLengthCone);
     490           1 :   TGeoArb8 *sCh9  = new TGeoArb8(kHalfLengthCone);
     491           1 :   TGeoArb8 *sCh10 = new TGeoArb8(kHalfLengthCone);
     492           1 :   TGeoArb8 *sCh11 = new TGeoArb8(kHalfLengthCone);
     493             : 
     494           1 :   sCh1->SetName("sCh1");
     495           1 :   sCh2->SetName("sCh2");
     496           1 :   sCh3->SetName("sCh3");
     497           1 :   sCh4->SetName("sCh4");
     498           1 :   sCh5->SetName("sCh5");
     499           1 :   sCh6->SetName("sCh6");
     500           1 :   sCh7->SetName("sCh7");
     501           1 :   sCh8->SetName("sCh8");
     502           1 :   sCh9->SetName("sCh9");
     503           1 :   sCh10->SetName("sCh10");
     504           1 :   sCh11->SetName("sCh11");
     505             : 
     506             :   // Smaller end: determine the coordinates of the points of carbon fiber
     507           1 :   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
     508             :                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
     509             :                         kTheta,xshld,yshld);
     510             : 
     511           1 :   sC1->SetVertex(0, xshld[12], yshld[12]);
     512           1 :   sC1->SetVertex(1, xshld[11], yshld[11]);
     513           1 :   sC1->SetVertex(2, xshld[ 0], yshld[ 0]);
     514           1 :   sC1->SetVertex(3, xshld[23], yshld[23]);
     515             : 
     516           1 :   sC2->SetVertex(0, xshld[11], yshld[11]);
     517           1 :   sC2->SetVertex(1, xshld[10], yshld[10]);
     518           1 :   sC2->SetVertex(2, xshld[ 1], yshld[ 1]);
     519           1 :   sC2->SetVertex(3, xshld[ 0], yshld[ 0]);
     520             : 
     521           1 :   sC3->SetVertex(0, xshld[10], yshld[10]);
     522           1 :   sC3->SetVertex(1, xshld[ 9], yshld[ 9]);
     523           1 :   sC3->SetVertex(2, xshld[ 2], yshld[ 2]);
     524           1 :   sC3->SetVertex(3, xshld[ 1], yshld[ 1]);
     525             : 
     526           1 :   sC4->SetVertex(0, xshld[ 9], yshld[ 9]);
     527           1 :   sC4->SetVertex(1, xshld[ 8], yshld[ 8]);
     528           1 :   sC4->SetVertex(2, xshld[ 3], yshld[ 3]);
     529           1 :   sC4->SetVertex(3, xshld[ 2], yshld[ 2]);
     530             : 
     531           1 :   sC5->SetVertex(0, xshld[ 8], yshld[ 8]);
     532           1 :   sC5->SetVertex(1, xshld[ 7], yshld[ 7]);
     533           1 :   sC5->SetVertex(2, xshld[ 4], yshld[ 4]);
     534           1 :   sC5->SetVertex(3, xshld[ 3], yshld[ 3]);
     535             : 
     536           1 :   sC6->SetVertex(0, xshld[ 7], yshld[ 7]);
     537           1 :   sC6->SetVertex(1, xshld[ 6], yshld[ 6]);
     538           1 :   sC6->SetVertex(2, xshld[ 5], yshld[ 5]);
     539           1 :   sC6->SetVertex(3, xshld[ 4], yshld[ 4]);
     540             : 
     541           1 :   sC7->SetVertex(0,-xshld[10], yshld[10]);
     542           1 :   sC7->SetVertex(1,-xshld[11], yshld[11]);
     543           1 :   sC7->SetVertex(2,-xshld[ 0], yshld[ 0]);
     544           1 :   sC7->SetVertex(3,-xshld[ 1], yshld[ 1]);
     545             : 
     546           1 :   sC8->SetVertex(0,-xshld[ 9], yshld[ 9]);
     547           1 :   sC8->SetVertex(1,-xshld[10], yshld[10]);
     548           1 :   sC8->SetVertex(2,-xshld[ 1], yshld[ 1]);
     549           1 :   sC8->SetVertex(3,-xshld[ 2], yshld[ 2]);
     550             : 
     551           1 :   sC9->SetVertex(0,-xshld[ 8], yshld[ 8]);
     552           1 :   sC9->SetVertex(1,-xshld[ 9], yshld[ 9]);
     553           1 :   sC9->SetVertex(2,-xshld[ 2], yshld[ 2]);
     554           1 :   sC9->SetVertex(3,-xshld[ 3], yshld[ 3]);
     555             : 
     556           1 :   sC10->SetVertex(0,-xshld[ 7], yshld[ 7]);
     557           1 :   sC10->SetVertex(1,-xshld[ 8], yshld[ 8]);
     558           1 :   sC10->SetVertex(2,-xshld[ 3], yshld[ 3]);
     559           1 :   sC10->SetVertex(3,-xshld[ 4], yshld[ 4]);
     560             : 
     561           1 :   sC11->SetVertex(0,-xshld[ 6], yshld[ 6]);
     562           1 :   sC11->SetVertex(1,-xshld[ 7], yshld[ 7]);
     563           1 :   sC11->SetVertex(2,-xshld[ 4], yshld[ 4]);
     564           1 :   sC11->SetVertex(3,-xshld[ 5], yshld[ 5]);
     565             : 
     566             :   // Then rescale to get the air volume dimensions
     567           2 :     InsidePoint(xshld[23], yshld[23],
     568           1 :                 xshld[ 0], yshld[ 0],
     569           1 :                 xshld[ 1], yshld[ 1], kThicknessCone,
     570             :                 xair[0], yair[0]);
     571          46 :   for (Int_t i=1; i<23; i++) {
     572          44 :     InsidePoint(xshld[i-1], yshld[i-1],
     573          22 :                 xshld[ i ], yshld[ i ],
     574          22 :                 xshld[i+1], yshld[i+1], kThicknessCone,
     575          22 :                 xair[i], yair[i]);
     576             :   }
     577           2 :     InsidePoint(xshld[22], yshld[22],
     578           1 :                 xshld[23], yshld[23],
     579           1 :                 xshld[ 0], yshld[ 0], kThicknessCone,
     580             :                 xair[23], yair[23]);
     581             : 
     582             :   // Then use them to determine the Omega shape points
     583           1 :   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
     584             : 
     585             :   // Finally fill the small end coordinates of the air shapes
     586           1 :   sCh1->SetVertex(0, xomega[ 0], yomega[ 0]);
     587           1 :   sCh1->SetVertex(1, xomega[ 1], yomega[ 1]);
     588           1 :   sCh1->SetVertex(2,-xomega[ 1], yomega[ 1]);
     589           1 :   sCh1->SetVertex(3,-xomega[ 0], yomega[ 0]);
     590             : 
     591           1 :   sCh2->SetVertex(0, xomega[20], yomega[20]);
     592           1 :   sCh2->SetVertex(1, xomega[21], yomega[21]);
     593           1 :   sCh2->SetVertex(2, xomega[22], yomega[22]);
     594           1 :   sCh2->SetVertex(3, xomega[23], yomega[23]);
     595             : 
     596           1 :   sCh3->SetVertex(0, xomega[ 2], yomega[ 2]);
     597           1 :   sCh3->SetVertex(1, xomega[ 3], yomega[ 3]);
     598           1 :   sCh3->SetVertex(2, xomega[ 4], yomega[ 4]);
     599           1 :   sCh3->SetVertex(3, xomega[ 5], yomega[ 5]);
     600             : 
     601           1 :   sCh4->SetVertex(0, xomega[16], yomega[16]);
     602           1 :   sCh4->SetVertex(1, xomega[17], yomega[17]);
     603           1 :   sCh4->SetVertex(2, xomega[18], yomega[18]);
     604           1 :   sCh4->SetVertex(3, xomega[19], yomega[19]);
     605             : 
     606           1 :   sCh5->SetVertex(0, xomega[ 6], yomega[ 6]);
     607           1 :   sCh5->SetVertex(1, xomega[ 7], yomega[ 7]);
     608           1 :   sCh5->SetVertex(2, xomega[ 8], yomega[ 8]);
     609           1 :   sCh5->SetVertex(3, xomega[ 9], yomega[ 9]);
     610             : 
     611           1 :   sCh6->SetVertex(0, xomega[12], yomega[12]);
     612           1 :   sCh6->SetVertex(1, xomega[13], yomega[13]);
     613           1 :   sCh6->SetVertex(2, xomega[14], yomega[14]);
     614           1 :   sCh6->SetVertex(3, xomega[15], yomega[15]);
     615             : 
     616           1 :   sCh7->SetVertex(0,-xomega[21], yomega[21]);
     617           1 :   sCh7->SetVertex(1,-xomega[20], yomega[20]);
     618           1 :   sCh7->SetVertex(2,-xomega[23], yomega[23]);
     619           1 :   sCh7->SetVertex(3,-xomega[22], yomega[22]);
     620             : 
     621           1 :   sCh8->SetVertex(0,-xomega[ 3], yomega[ 3]);
     622           1 :   sCh8->SetVertex(1,-xomega[ 2], yomega[ 2]);
     623           1 :   sCh8->SetVertex(2,-xomega[ 5], yomega[ 5]);
     624           1 :   sCh8->SetVertex(3,-xomega[ 4], yomega[ 4]);
     625             : 
     626           1 :   sCh9->SetVertex(0,-xomega[17], yomega[17]);
     627           1 :   sCh9->SetVertex(1,-xomega[16], yomega[16]);
     628           1 :   sCh9->SetVertex(2,-xomega[19], yomega[19]);
     629           1 :   sCh9->SetVertex(3,-xomega[18], yomega[18]);
     630             : 
     631           1 :   sCh10->SetVertex(0,-xomega[ 7], yomega[ 7]);
     632           1 :   sCh10->SetVertex(1,-xomega[ 6], yomega[ 6]);
     633           1 :   sCh10->SetVertex(2,-xomega[ 9], yomega[ 9]);
     634           1 :   sCh10->SetVertex(3,-xomega[ 8], yomega[ 8]);
     635             : 
     636           1 :   sCh11->SetVertex(0,-xomega[13], yomega[13]);
     637           1 :   sCh11->SetVertex(1,-xomega[12], yomega[12]);
     638           1 :   sCh11->SetVertex(2,-xomega[15], yomega[15]);
     639           1 :   sCh11->SetVertex(3,-xomega[14], yomega[14]);
     640             : 
     641             :   // Bigger end: determine the coordinates of the points of carbon fiber
     642             : 
     643             :   // Drawings give only the radius, convert it to the apothegm
     644           2 :   Double_t kInnerRadiusCone = TMath::Sqrt(kInnerRadialCone*kInnerRadialCone
     645           1 :                                           - 0.25*kInnerACone*kInnerACone);
     646           2 :   Double_t kOuterRadiusCone = TMath::Sqrt(kOuterRadialCone*kOuterRadialCone
     647           1 :                                           - 0.25*kOuterACone*kOuterACone);
     648             : 
     649           1 :   CreateSPDThermalShape(kInnerACone,kInnerBCone,kInnerRadiusCone,
     650             :                         kOuterACone,kOuterBCone,kOuterRadiusCone,
     651             :                         kTheta,xshld,yshld);
     652             : 
     653           1 :   sC1->SetVertex(4, xshld[12], yshld[12]);
     654           1 :   sC1->SetVertex(5, xshld[11], yshld[11]);
     655           1 :   sC1->SetVertex(6, xshld[ 0], yshld[ 0]);
     656           1 :   sC1->SetVertex(7, xshld[23], yshld[23]);
     657             : 
     658           1 :   sC2->SetVertex(4, xshld[11], yshld[11]);
     659           1 :   sC2->SetVertex(5, xshld[10], yshld[10]);
     660           1 :   sC2->SetVertex(6, xshld[ 1], yshld[ 1]);
     661           1 :   sC2->SetVertex(7, xshld[ 0], yshld[ 0]);
     662             : 
     663           1 :   sC3->SetVertex(4, xshld[10], yshld[10]);
     664           1 :   sC3->SetVertex(5, xshld[ 9], yshld[ 9]);
     665           1 :   sC3->SetVertex(6, xshld[ 2], yshld[ 2]);
     666           1 :   sC3->SetVertex(7, xshld[ 1], yshld[ 1]);
     667             : 
     668           1 :   sC4->SetVertex(4, xshld[ 9], yshld[ 9]);
     669           1 :   sC4->SetVertex(5, xshld[ 8], yshld[ 8]);
     670           1 :   sC4->SetVertex(6, xshld[ 3], yshld[ 3]);
     671           1 :   sC4->SetVertex(7, xshld[ 2], yshld[ 2]);
     672             : 
     673           1 :   sC5->SetVertex(4, xshld[ 8], yshld[ 8]);
     674           1 :   sC5->SetVertex(5, xshld[ 7], yshld[ 7]);
     675           1 :   sC5->SetVertex(6, xshld[ 4], yshld[ 4]);
     676           1 :   sC5->SetVertex(7, xshld[ 3], yshld[ 3]);
     677             : 
     678           1 :   sC6->SetVertex(4, xshld[ 7], yshld[ 7]);
     679           1 :   sC6->SetVertex(5, xshld[ 6], yshld[ 6]);
     680           1 :   sC6->SetVertex(6, xshld[ 5], yshld[ 5]);
     681           1 :   sC6->SetVertex(7, xshld[ 4], yshld[ 4]);
     682             : 
     683           1 :   sC7->SetVertex(4,-xshld[10], yshld[10]);
     684           1 :   sC7->SetVertex(5,-xshld[11], yshld[11]);
     685           1 :   sC7->SetVertex(6,-xshld[ 0], yshld[ 0]);
     686           1 :   sC7->SetVertex(7,-xshld[ 1], yshld[ 1]);
     687             : 
     688           1 :   sC8->SetVertex(4,-xshld[ 9], yshld[ 9]);
     689           1 :   sC8->SetVertex(5,-xshld[10], yshld[10]);
     690           1 :   sC8->SetVertex(6,-xshld[ 1], yshld[ 1]);
     691           1 :   sC8->SetVertex(7,-xshld[ 2], yshld[ 2]);
     692             : 
     693           1 :   sC9->SetVertex(4,-xshld[ 8], yshld[ 8]);
     694           1 :   sC9->SetVertex(5,-xshld[ 9], yshld[ 9]);
     695           1 :   sC9->SetVertex(6,-xshld[ 2], yshld[ 2]);
     696           1 :   sC9->SetVertex(7,-xshld[ 3], yshld[ 3]);
     697             : 
     698           1 :   sC10->SetVertex(4,-xshld[ 7], yshld[ 7]);
     699           1 :   sC10->SetVertex(5,-xshld[ 8], yshld[ 8]);
     700           1 :   sC10->SetVertex(6,-xshld[ 3], yshld[ 3]);
     701           1 :   sC10->SetVertex(7,-xshld[ 4], yshld[ 4]);
     702             : 
     703           1 :   sC11->SetVertex(4,-xshld[ 6], yshld[ 6]);
     704           1 :   sC11->SetVertex(5,-xshld[ 7], yshld[ 7]);
     705           1 :   sC11->SetVertex(6,-xshld[ 4], yshld[ 4]);
     706           1 :   sC11->SetVertex(7,-xshld[ 5], yshld[ 5]);
     707             : 
     708             :   // Then rescale to get the air volume dimensions
     709           2 :     InsidePoint(xshld[23], yshld[23],
     710           1 :                 xshld[ 0], yshld[ 0],
     711           1 :                 xshld[ 1], yshld[ 1], kThicknessCone,
     712             :                 xair[0], yair[0]);
     713          46 :   for (Int_t i=1; i<23; i++) {
     714          44 :     InsidePoint(xshld[i-1], yshld[i-1],
     715          22 :                 xshld[ i ], yshld[ i ],
     716          22 :                 xshld[i+1], yshld[i+1], kThicknessCone,
     717          22 :                 xair[i], yair[i]);
     718             :   }
     719           2 :     InsidePoint(xshld[22], yshld[22],
     720           1 :                 xshld[23], yshld[23],
     721           1 :                 xshld[ 0], yshld[ 0], kThicknessCone,
     722             :                 xair[23], yair[23]);
     723             : 
     724             :   // Then use them to determine the Omega shape points
     725           1 :   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
     726             : 
     727             :   // Finally fill the big end coordinates of the air shapes
     728           1 :   sCh1->SetVertex(4, xomega[ 0], yomega[ 0]);
     729           1 :   sCh1->SetVertex(5, xomega[ 1], yomega[ 1]);
     730           1 :   sCh1->SetVertex(6,-xomega[ 1], yomega[ 1]);
     731           1 :   sCh1->SetVertex(7,-xomega[ 0], yomega[ 0]);
     732             : 
     733           1 :   sCh2->SetVertex(4, xomega[20], yomega[20]);
     734           1 :   sCh2->SetVertex(5, xomega[21], yomega[21]);
     735           1 :   sCh2->SetVertex(6, xomega[22], yomega[22]);
     736           1 :   sCh2->SetVertex(7, xomega[23], yomega[23]);
     737             : 
     738           1 :   sCh3->SetVertex(4, xomega[ 2], yomega[ 2]);
     739           1 :   sCh3->SetVertex(5, xomega[ 3], yomega[ 3]);
     740           1 :   sCh3->SetVertex(6, xomega[ 4], yomega[ 4]);
     741           1 :   sCh3->SetVertex(7, xomega[ 5], yomega[ 5]);
     742             : 
     743           1 :   sCh4->SetVertex(4, xomega[16], yomega[16]);
     744           1 :   sCh4->SetVertex(5, xomega[17], yomega[17]);
     745           1 :   sCh4->SetVertex(6, xomega[18], yomega[18]);
     746           1 :   sCh4->SetVertex(7, xomega[19], yomega[19]);
     747             : 
     748           1 :   sCh5->SetVertex(4, xomega[ 6], yomega[ 6]);
     749           1 :   sCh5->SetVertex(5, xomega[ 7], yomega[ 7]);
     750           1 :   sCh5->SetVertex(6, xomega[ 8], yomega[ 8]);
     751           1 :   sCh5->SetVertex(7, xomega[ 9], yomega[ 9]);
     752             : 
     753           1 :   sCh6->SetVertex(4, xomega[12], yomega[12]);
     754           1 :   sCh6->SetVertex(5, xomega[13], yomega[13]);
     755           1 :   sCh6->SetVertex(6, xomega[14], yomega[14]);
     756           1 :   sCh6->SetVertex(7, xomega[15], yomega[15]);
     757             : 
     758           1 :   sCh7->SetVertex(4,-xomega[21], yomega[21]);
     759           1 :   sCh7->SetVertex(5,-xomega[20], yomega[20]);
     760           1 :   sCh7->SetVertex(6,-xomega[23], yomega[23]);
     761           1 :   sCh7->SetVertex(7,-xomega[22], yomega[22]);
     762             : 
     763           1 :   sCh8->SetVertex(4,-xomega[ 3], yomega[ 3]);
     764           1 :   sCh8->SetVertex(5,-xomega[ 2], yomega[ 2]);
     765           1 :   sCh8->SetVertex(6,-xomega[ 5], yomega[ 5]);
     766           1 :   sCh8->SetVertex(7,-xomega[ 4], yomega[ 4]);
     767             : 
     768           1 :   sCh9->SetVertex(4,-xomega[17], yomega[17]);
     769           1 :   sCh9->SetVertex(5,-xomega[16], yomega[16]);
     770           1 :   sCh9->SetVertex(6,-xomega[19], yomega[19]);
     771           1 :   sCh9->SetVertex(7,-xomega[18], yomega[18]);
     772             : 
     773           1 :   sCh10->SetVertex(4,-xomega[ 7], yomega[ 7]);
     774           1 :   sCh10->SetVertex(5,-xomega[ 6], yomega[ 6]);
     775           1 :   sCh10->SetVertex(6,-xomega[ 9], yomega[ 9]);
     776           1 :   sCh10->SetVertex(7,-xomega[ 8], yomega[ 8]);
     777             : 
     778           1 :   sCh11->SetVertex(4,-xomega[13], yomega[13]);
     779           1 :   sCh11->SetVertex(5,-xomega[12], yomega[12]);
     780           1 :   sCh11->SetVertex(6,-xomega[15], yomega[15]);
     781           1 :   sCh11->SetVertex(7,-xomega[14], yomega[14]);
     782             : 
     783             :   // Now the actual carbon fiber cone: a CompositeShape
     784           1 :   TGeoCompositeShape *sCone = new TGeoCompositeShape("sCone",
     785             :                             "sC1+sC2+sC3+sC4+sC5+sC6+sC7+sC8+sC9+sC10+sC11");
     786             : 
     787             :   // Finally the carbon fiber Ring with its Wings and their
     788             :   // stesalite inserts. They are Tube and TubeSeg shapes
     789             : 
     790           1 :   TGeoTube *ringshape = new TGeoTube(kInnerRadiusRing,kOuterRadiusRing,
     791             :                                      kHalfLengthRing);
     792             : 
     793           2 :   TGeoTube *ringinsertshape = new TGeoTube(kInnerRadiusRing+kThicknessRing,
     794           1 :                                            kOuterRadiusRing-kThicknessRing,
     795           1 :                                            kHalfLengthRing-kThicknessRing);
     796             : 
     797             :   Double_t angleWideWing, angleWideWingThickness;
     798           1 :   angleWideWing = (kWideWing/kOuterRadiusWing)*TMath::RadToDeg();
     799           1 :   angleWideWingThickness = (kThicknessRing/kOuterRadiusWing)*TMath::RadToDeg();
     800             : 
     801           1 :   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kOuterRadiusRing,kOuterRadiusWing,
     802             :                                            kHalfLengthRing, 0, angleWideWing);
     803             : 
     804           2 :   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kOuterRadiusRing,
     805           1 :              kOuterRadiusWing-kThicknessRing, kHalfLengthRing-kThicknessRing,
     806           1 :              angleWideWingThickness, angleWideWing-angleWideWingThickness);
     807             : 
     808             : 
     809             :   // We have the shapes: now create the real volumes
     810             : 
     811           1 :   TGeoMedium *medSPDcf  = mgr->GetMedium("ITS_SPD shield$");
     812           1 :   TGeoMedium *medSPDair = mgr->GetMedium("ITS_SPD AIR$");
     813           1 :   TGeoMedium *medSPDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
     814             : 
     815           2 :   TGeoVolume *centralshield = new TGeoVolume("SPDcentralshield",
     816           1 :                                              centralshape,medSPDcf);
     817           1 :   centralshield->SetVisibility(kTRUE);
     818           1 :   centralshield->SetLineColor(7);
     819           1 :   centralshield->SetLineWidth(1);
     820           1 :   centralshield->SetFillColor(centralshield->GetLineColor());
     821           1 :   centralshield->SetFillStyle(4090); // 90% transparent
     822             : 
     823           2 :   TGeoVolume *endcapshield = new TGeoVolume("SPDendcapshield",
     824           1 :                                              endcapshape,medSPDcf);
     825           1 :   endcapshield->SetVisibility(kTRUE);
     826           1 :   endcapshield->SetLineColor(7);
     827           1 :   endcapshield->SetLineWidth(1);
     828           1 :   endcapshield->SetFillColor(endcapshield->GetLineColor());
     829           1 :   endcapshield->SetFillStyle(4090); // 90% transparent
     830             : 
     831           2 :   TGeoVolume *fillerblock = new TGeoVolume("SPDfillerblock",
     832           1 :                                            fillershape,medSPDcf);
     833           1 :   fillerblock->SetVisibility(kTRUE);
     834           1 :   fillerblock->SetLineColor(7);
     835           1 :   fillerblock->SetLineWidth(1);
     836           1 :   fillerblock->SetFillColor(fillerblock->GetLineColor());
     837           1 :   fillerblock->SetFillStyle(4090); // 90% transparent
     838             : 
     839           2 :   TGeoVolume *fillerhole = new TGeoVolume("SPDfillerhole",
     840           1 :                                           fillerholeshape,medSPDair);
     841           1 :   fillerhole->SetVisibility(kTRUE);
     842           1 :   fillerhole->SetLineColor(5); // Yellow
     843           1 :   fillerhole->SetLineWidth(1);
     844           1 :   fillerhole->SetFillColor(fillerhole->GetLineColor());
     845           1 :   fillerhole->SetFillStyle(4090); // 90% transparent
     846             : 
     847           1 :   ypos = (fillershape->GetY(0)+fillershape->GetY(1))/2;
     848           2 :   fillerblock->AddNode(fillerhole, 1, new TGeoTranslation(0, ypos, 0));
     849             : 
     850           1 :   zpos = omgendcapshape->GetZ(1) - fillershape->GetZ(1) - kFillerBlockZTrans;
     851           2 :   endcapshield->AddNode(fillerblock, 1, new TGeoTranslation(0, 0, zpos));
     852           3 :   endcapshield->AddNode(fillerblock, 2, new TGeoCombiTrans(0, 0, zpos,
     853           2 :                                        new TGeoRotation("", kThetaDeg,0,0)));
     854           3 :   endcapshield->AddNode(fillerblock, 3, new TGeoCombiTrans(0, 0, zpos,
     855           2 :                                        new TGeoRotation("",-kThetaDeg,0,0)));
     856           3 :   endcapshield->AddNode(fillerblock, 4, new TGeoCombiTrans(0, 0, zpos,
     857           2 :                                        new TGeoRotation("", 2*kThetaDeg,0,0)));
     858           3 :   endcapshield->AddNode(fillerblock, 5, new TGeoCombiTrans(0, 0, zpos,
     859           2 :                                        new TGeoRotation("",-2*kThetaDeg,0,0)));
     860             : 
     861           2 :   TGeoVolume *fillerbar = new TGeoVolume("SPDfillerbar",
     862           1 :                                          fillbarshape,medSPDcf);
     863           1 :   fillerbar->SetVisibility(kTRUE);
     864           1 :   fillerbar->SetLineColor(7);
     865           1 :   fillerbar->SetLineWidth(1);
     866           1 :   fillerbar->SetFillColor(fillerbar->GetLineColor());
     867           1 :   fillerbar->SetFillStyle(4090); // 90% transparent
     868             : 
     869           2 :   TGeoVolume *fillbarhole = new TGeoVolume("SPDfillerbarhole",
     870           1 :                                              fillbarholeshape,medSPDair);
     871           1 :   fillbarhole->SetVisibility(kTRUE);
     872           1 :   fillbarhole->SetLineColor(5); // Yellow
     873           1 :   fillbarhole->SetLineWidth(1);
     874           1 :   fillbarhole->SetFillColor(fillbarhole->GetLineColor());
     875           1 :   fillbarhole->SetFillStyle(4090); // 90% transparent
     876             : 
     877           1 :   fillerbar->AddNode(fillbarhole, 1, 0);
     878             : 
     879           1 :   TGeoVolume *vCone = new TGeoVolume("SPDconeshield",sCone,medSPDcf);
     880           1 :   vCone->SetVisibility(kTRUE);
     881           1 :   vCone->SetLineColor(7);
     882           1 :   vCone->SetLineWidth(1);
     883           1 :   vCone->SetFillColor(vCone->GetLineColor());
     884           1 :   vCone->SetFillStyle(4090); // 90% transparent
     885             : 
     886           1 :   TGeoVolume *vCh1 = new TGeoVolume("SPDconeshieldH1",sCh1,medSPDair);
     887           1 :   vCh1->SetVisibility(kTRUE);
     888           1 :   vCh1->SetLineColor(5); // Yellow
     889           1 :   vCh1->SetLineWidth(1);
     890           1 :   vCh1->SetFillColor(vCh1->GetLineColor());
     891           1 :   vCh1->SetFillStyle(4090); // 90% transparent
     892             : 
     893           1 :   TGeoVolume *vCh2 = new TGeoVolume("SPDconeshieldH2",sCh2,medSPDair);
     894           1 :   vCh2->SetVisibility(kTRUE);
     895           1 :   vCh2->SetLineColor(5); // Yellow
     896           1 :   vCh2->SetLineWidth(1);
     897           1 :   vCh2->SetFillColor(vCh2->GetLineColor());
     898           1 :   vCh2->SetFillStyle(4090); // 90% transparent
     899             : 
     900           1 :   TGeoVolume *vCh3 = new TGeoVolume("SPDconeshieldH3",sCh3,medSPDair);
     901           1 :   vCh3->SetVisibility(kTRUE);
     902           1 :   vCh3->SetLineColor(5); // Yellow
     903           1 :   vCh3->SetLineWidth(1);
     904           1 :   vCh3->SetFillColor(vCh3->GetLineColor());
     905           1 :   vCh3->SetFillStyle(4090); // 90% transparent
     906             : 
     907           1 :   TGeoVolume *vCh4 = new TGeoVolume("SPDconeshieldH4",sCh4,medSPDair);
     908           1 :   vCh4->SetVisibility(kTRUE);
     909           1 :   vCh4->SetLineColor(5); // Yellow
     910           1 :   vCh4->SetLineWidth(1);
     911           1 :   vCh4->SetFillColor(vCh4->GetLineColor());
     912           1 :   vCh4->SetFillStyle(4090); // 90% transparent
     913             : 
     914           1 :   TGeoVolume *vCh5 = new TGeoVolume("SPDconeshieldH5",sCh5,medSPDair);
     915           1 :   vCh5->SetVisibility(kTRUE);
     916           1 :   vCh5->SetLineColor(5); // Yellow
     917           1 :   vCh5->SetLineWidth(1);
     918           1 :   vCh5->SetFillColor(vCh5->GetLineColor());
     919           1 :   vCh5->SetFillStyle(4090); // 90% transparent
     920             : 
     921           1 :   TGeoVolume *vCh6 = new TGeoVolume("SPDconeshieldH6",sCh6,medSPDair);
     922           1 :   vCh6->SetVisibility(kTRUE);
     923           1 :   vCh6->SetLineColor(5); // Yellow
     924           1 :   vCh6->SetLineWidth(1);
     925           1 :   vCh6->SetFillColor(vCh6->GetLineColor());
     926           1 :   vCh6->SetFillStyle(4090); // 90% transparent
     927             : 
     928           1 :   TGeoVolume *vCh7 = new TGeoVolume("SPDconeshieldH7",sCh7,medSPDair);
     929           1 :   vCh7->SetVisibility(kTRUE);
     930           1 :   vCh7->SetLineColor(5); // Yellow
     931           1 :   vCh7->SetLineWidth(1);
     932           1 :   vCh7->SetFillColor(vCh7->GetLineColor());
     933           1 :   vCh7->SetFillStyle(4090); // 90% transparent
     934             : 
     935           1 :   TGeoVolume *vCh8 = new TGeoVolume("SPDconeshieldH8",sCh8,medSPDair);
     936           1 :   vCh8->SetVisibility(kTRUE);
     937           1 :   vCh8->SetLineColor(5); // Yellow
     938           1 :   vCh8->SetLineWidth(1);
     939           1 :   vCh8->SetFillColor(vCh8->GetLineColor());
     940           1 :   vCh8->SetFillStyle(4090); // 90% transparent
     941             : 
     942           1 :   TGeoVolume *vCh9 = new TGeoVolume("SPDconeshieldH9",sCh9,medSPDair);
     943           1 :   vCh9->SetVisibility(kTRUE);
     944           1 :   vCh9->SetLineColor(5); // Yellow
     945           1 :   vCh9->SetLineWidth(1);
     946           1 :   vCh9->SetFillColor(vCh9->GetLineColor());
     947           1 :   vCh9->SetFillStyle(4090); // 90% transparent
     948             : 
     949           1 :   TGeoVolume *vCh10 = new TGeoVolume("SPDconeshieldH10",sCh10,medSPDair);
     950           1 :   vCh10->SetVisibility(kTRUE);
     951           1 :   vCh10->SetLineColor(5); // Yellow
     952           1 :   vCh10->SetLineWidth(1);
     953           1 :   vCh10->SetFillColor(vCh10->GetLineColor());
     954           1 :   vCh10->SetFillStyle(4090); // 90% transparent
     955             : 
     956           1 :   TGeoVolume *vCh11 = new TGeoVolume("SPDconeshieldH11",sCh11,medSPDair);
     957           1 :   vCh11->SetVisibility(kTRUE);
     958           1 :   vCh11->SetLineColor(5); // Yellow
     959           1 :   vCh11->SetLineWidth(1);
     960           1 :   vCh11->SetFillColor(vCh11->GetLineColor());
     961           1 :   vCh11->SetFillStyle(4090); // 90% transparent
     962             : 
     963           1 :   vCone->AddNode(vCh1 ,1,0);
     964           1 :   vCone->AddNode(vCh2 ,1,0);
     965           1 :   vCone->AddNode(vCh3 ,1,0);
     966           1 :   vCone->AddNode(vCh4 ,1,0);
     967           1 :   vCone->AddNode(vCh5 ,1,0);
     968           1 :   vCone->AddNode(vCh6 ,1,0);
     969           1 :   vCone->AddNode(vCh7 ,1,0);
     970           1 :   vCone->AddNode(vCh8 ,1,0);
     971           1 :   vCone->AddNode(vCh9 ,1,0);
     972           1 :   vCone->AddNode(vCh10,1,0);
     973           1 :   vCone->AddNode(vCh11,1,0);
     974             : 
     975           1 :   TGeoVolume *ring = new TGeoVolume("SPDshieldring",ringshape,medSPDcf);
     976           1 :   ring->SetVisibility(kTRUE);
     977           1 :   ring->SetLineColor(7);
     978           1 :   ring->SetLineWidth(1);
     979             : 
     980           2 :   TGeoVolume *ringinsert = new TGeoVolume("SPDshieldringinsert",
     981           1 :                                           ringinsertshape,medSPDste);
     982           1 :   ringinsert->SetVisibility(kTRUE);
     983           1 :   ringinsert->SetLineColor(3); // Green
     984             : //  ringinsert->SetLineWidth(1);
     985           1 :   ringinsert->SetFillColor(ringinsert->GetLineColor());
     986           1 :   ringinsert->SetFillStyle(4010); // 10% transparent
     987             : 
     988           1 :   ring->AddNode(ringinsert,1,0);
     989             : 
     990           1 :   TGeoVolume *wing = new TGeoVolume("SPDshieldringwing",wingshape,medSPDcf);
     991           1 :   wing->SetVisibility(kTRUE);
     992           1 :   wing->SetLineColor(7);
     993           1 :   wing->SetLineWidth(1);
     994             : 
     995           2 :   TGeoVolume *winginsert = new TGeoVolume("SPDshieldwinginsert",
     996           1 :                                           winginsertshape,medSPDste);
     997           1 :   winginsert->SetVisibility(kTRUE);
     998           1 :   winginsert->SetLineColor(3); // Green
     999             : //  winginsert->SetLineWidth(1);
    1000           1 :   winginsert->SetFillColor(winginsert->GetLineColor());
    1001           1 :   winginsert->SetFillStyle(4010); // 10% transparent
    1002             : 
    1003           1 :   wing->AddNode(winginsert,1,0);
    1004             : 
    1005             : 
    1006             :   // Add all volumes in the assembly
    1007           1 :   const Double_t kLittleZTrans = 0.1*fgkmm;
    1008           2 :   vM->AddNode(centralshield,1,new TGeoTranslation(0,0,-kLittleZTrans));
    1009           3 :   vM->AddNode(centralshield,2,new TGeoCombiTrans( 0,0,-kLittleZTrans,
    1010           2 :                                   new TGeoRotation("",180,0,0)));
    1011             : 
    1012           1 :   zpos = kHalfLengthCentral+kHalfLengthEndCap;
    1013           2 :   vM->AddNode(endcapshield,1,
    1014           2 :               new TGeoTranslation(0,0, zpos-kLittleZTrans));
    1015           3 :   vM->AddNode(endcapshield,2,new TGeoCombiTrans(
    1016           2 :               0, 0,-zpos-kLittleZTrans, new TGeoRotation("",  0,180,0) ) );
    1017           3 :   vM->AddNode(endcapshield,3,new TGeoCombiTrans(
    1018           2 :               0, 0, zpos-kLittleZTrans, new TGeoRotation("",180,  0,0) ) );
    1019           3 :   vM->AddNode(endcapshield,4,new TGeoCombiTrans(
    1020           2 :               0, 0,-zpos-kLittleZTrans, new TGeoRotation("",180,180,0) ) );
    1021             : 
    1022           1 :   xpos = omgendcapshape->GetX(13) + fillbarshape->GetDX();
    1023           1 :   ypos = omgendcapshape->GetY(13) + fillbarshape->GetDY();
    1024           1 :   zpos -= fillbarshape->GetDZ();
    1025           2 :   vM->AddNode(fillerbar, 1, new TGeoTranslation( xpos, ypos, zpos));
    1026           2 :   vM->AddNode(fillerbar, 2, new TGeoTranslation(-xpos, ypos, zpos));
    1027           2 :   vM->AddNode(fillerbar, 3, new TGeoTranslation( xpos,-ypos, zpos));
    1028           2 :   vM->AddNode(fillerbar, 4, new TGeoTranslation(-xpos,-ypos, zpos));
    1029           2 :   vM->AddNode(fillerbar, 5, new TGeoTranslation( xpos, ypos,-zpos));
    1030           2 :   vM->AddNode(fillerbar, 6, new TGeoTranslation(-xpos, ypos,-zpos));
    1031           2 :   vM->AddNode(fillerbar, 7, new TGeoTranslation( xpos,-ypos,-zpos));
    1032           2 :   vM->AddNode(fillerbar, 8, new TGeoTranslation(-xpos,-ypos,-zpos));
    1033             : 
    1034           1 :   zpos = kHalfLengthCentral+2*kHalfLengthEndCap+kHalfLengthCone;
    1035           2 :   vM->AddNode(vCone ,1, new TGeoTranslation(0, 0,  zpos-kLittleZTrans));
    1036             : 
    1037           3 :   vM->AddNode(vCone ,2, new TGeoCombiTrans(0, 0,  zpos-kLittleZTrans,
    1038           2 :                                 new TGeoRotation("", 0, 0, 180)   ));
    1039             : 
    1040           3 :   vM->AddNode(vCone ,3, new TGeoCombiTrans(0, 0, -zpos-kLittleZTrans,
    1041           2 :                                 new TGeoRotation("", 0, 180, 0)   ));
    1042             : 
    1043           3 :   vM->AddNode(vCone ,4, new TGeoCombiTrans(0, 0, -zpos-kLittleZTrans,
    1044           2 :                                 new TGeoRotation("", 0, 180, 180)   ));
    1045             : 
    1046           1 :   zpos = kHalfLengthCentral+2*kHalfLengthEndCap+2*kHalfLengthCone
    1047           1 :        + kHalfLengthRing;
    1048           2 :   vM->AddNode(ring,1,new TGeoTranslation(0, 0, zpos-kLittleZTrans));
    1049           2 :   vM->AddNode(ring,2,new TGeoTranslation(0, 0,-zpos-kLittleZTrans));
    1050             : 
    1051          10 :   for (Int_t i=0; i<4; i++) {
    1052           4 :     Double_t thetaW = kThetaWing*(2*i+1) - angleWideWing/2.;
    1053          12 :     vM->AddNode(wing,2*i+1,new TGeoCombiTrans(0, 0, zpos-kLittleZTrans,
    1054           8 :                                new TGeoRotation("",thetaW,0,0) ) );
    1055          12 :     vM->AddNode(wing,2*i+2,new TGeoCombiTrans(0, 0,-zpos-kLittleZTrans,
    1056           8 :                                new TGeoRotation("",thetaW,0,0) ) );
    1057             :   }
    1058             : 
    1059           1 :   vM->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    1060             : 
    1061             :   // Some debugging if requested
    1062           1 :   if(GetDebug(1)){
    1063           0 :     vM->PrintNodes();
    1064           0 :     vM->InspectShape();
    1065           0 :   }
    1066             : 
    1067             :   // Finally put the entire shield in the mother volume
    1068           1 :   moth->AddNode(vM,1,0);
    1069             : 
    1070             :   return;
    1071           1 : }
    1072             : 
    1073             : //______________________________________________________________________
    1074             : void AliITSv11GeometrySupport::CreateSPDThermalShape(
    1075             :      Double_t ina, Double_t inb, Double_t inr,
    1076             :      Double_t oua, Double_t oub, Double_t our,
    1077             :      Double_t   t, Double_t *x , Double_t *y ) const
    1078             : {
    1079             : //
    1080             : // Creates the proper sequence of X and Y coordinates to determine
    1081             : // the base XTru polygon for the SPD thermal shapes
    1082             : //
    1083             : // Input:
    1084             : //        ina, inb : inner shape sides
    1085             : //        inr      : inner radius
    1086             : //        oua, oub : outer shape sides
    1087             : //        our      : outer radius
    1088             : //        t        : theta angle
    1089             : //
    1090             : // Output:
    1091             : //        x, y : coordinate vectors [24]
    1092             : //
    1093             : // Created:      14 Nov 2007  Mario Sitta
    1094             : // Updated:      11 Dec 2007  Mario Sitta
    1095             : //
    1096           8 :   Double_t xlocal[6],ylocal[6];
    1097             : 
    1098             :   //Create the first inner quadrant (X > 0)
    1099           4 :   FillSPDXtruShape(ina,inb,inr,t,xlocal,ylocal);
    1100          56 :   for (Int_t i=0; i<6; i++) {
    1101          24 :     x[i] = xlocal[i];
    1102          24 :     y[i] = ylocal[i];
    1103             :   }
    1104             : 
    1105             :   // Then reflex on the second quadrant (X < 0)
    1106          56 :   for (Int_t i=0; i<6; i++) {
    1107          24 :     x[23-i] = -x[i];
    1108          24 :     y[23-i] =  y[i];
    1109             :   }
    1110             : 
    1111             :   // Now create the first outer quadrant (X > 0)
    1112           4 :   FillSPDXtruShape(oua,oub,our,t,xlocal,ylocal);
    1113          56 :   for (Int_t i=0; i<6; i++) {
    1114          24 :     x[11-i] = xlocal[i];
    1115          24 :     y[11-i] = ylocal[i];
    1116             :   }
    1117             : 
    1118             :   // Finally reflex on the second quadrant (X < 0)
    1119          56 :   for (Int_t i=0; i<6; i++) {
    1120          24 :     x[12+i] = -x[11-i];
    1121          24 :     y[12+i] =  y[11-i];
    1122             :   }
    1123             : 
    1124             :   return;
    1125           4 : }
    1126             : 
    1127             : //______________________________________________________________________
    1128             : void AliITSv11GeometrySupport::CreateSPDOmegaShape(
    1129             :                    const Double_t *xin, const Double_t *yin, Double_t  d,
    1130             :                    Double_t   *x, Double_t *y)
    1131             : {
    1132             : //
    1133             : // Creates the proper sequence of X and Y coordinates to determine
    1134             : // the SPD Omega XTru polygon
    1135             : //
    1136             : // Input:
    1137             : //        xin, yin : coordinates of the air volume
    1138             : //        d        : Omega shape thickness
    1139             : //        t        : theta angle
    1140             : //
    1141             : // Output:
    1142             : //        x, y     : coordinate vectors [48]
    1143             : //
    1144             : // Created:      17 Nov 2007  Mario Sitta
    1145             : // Updated:      11 Dec 2007  Mario Sitta
    1146             : // Updated:      20 Feb 2009  Mario Sitta       New algorithm (the old one
    1147             : //                                              gives erroneous vertexes)
    1148             : //
    1149             : 
    1150             :   // This vector contains the index of those points which coincide
    1151             :   // with the corresponding points in the air shape
    1152           8 :   Int_t indexAir2Omega[12] = {1, 2, 5, 6, 9, 10, 11, 15, 16, 19, 20, 23};
    1153             : 
    1154             :   // First fill those vertexes corresponding to
    1155             :   // the edges aligned to the air shape edges
    1156         104 :   for (Int_t j=0; j<12; j++) {
    1157          48 :     x[*(indexAir2Omega+j)] = xin[j];
    1158          48 :     y[*(indexAir2Omega+j)] = yin[j];
    1159             :   }
    1160             : 
    1161             :   // Now get the coordinates of the first inner point
    1162           4 :   PointFromParallelLines(x[23],y[23],x[1],y[1],d,x[0],y[0]);
    1163             : 
    1164             :   // Knowing this, the second internal point can be determined
    1165           4 :   InsidePoint(x[0],y[0],x[1],y[1],x[2],y[2],d,x[22],y[22]);
    1166             : 
    1167             :   // The third point is now computable
    1168           4 :   ReflectPoint(x[1],y[1],x[2],y[2],x[22],y[22],x[21],y[21]);
    1169             : 
    1170             :   // Repeat this logic
    1171           4 :   InsidePoint(x[21],y[21],x[20],y[20],x[19],y[19],-d,x[3],y[3]);
    1172             : 
    1173           4 :   ReflectPoint(x[20],y[20],x[19],y[19],x[3],y[3],x[4],y[4]);
    1174             : 
    1175           4 :   InsidePoint(x[4],y[4],x[5],y[5],x[6],y[6],d,x[18],y[18]);
    1176             : 
    1177           4 :   ReflectPoint(x[5],y[5],x[6],y[6],x[18],y[18],x[17],y[17]);
    1178             : 
    1179           4 :   InsidePoint(x[17],y[17],x[16],y[16],x[15],y[15],-d,x[7],y[7]);
    1180             : 
    1181           4 :   ReflectPoint(x[16],y[16],x[15],y[15],x[7],y[7],x[8],y[8]);
    1182             : 
    1183           4 :   InsidePoint(x[8],y[8],x[9],y[9],x[10],y[10],d,x[14],y[14]);
    1184             : 
    1185             :   // These need to be fixed explicitly
    1186           4 :   x[12] = x[11];
    1187           4 :   y[12] = y[11] + d;
    1188           4 :   x[13] = x[10] + d;
    1189           4 :   y[13] = y[12];
    1190             : 
    1191             :   // Finally reflect on the negative side
    1192         200 :   for (Int_t i=0; i<24; i++) {
    1193          96 :     x[24+i] = -x[23-i];
    1194          96 :     y[24+i] =  y[23-i];
    1195             :   }
    1196             : 
    1197             :   // Wow ! We've finished
    1198             :   return;
    1199           4 : }
    1200             : 
    1201             : //______________________________________________________________________
    1202             : void AliITSv11GeometrySupport::FillSPDXtruShape(Double_t a, Double_t b,
    1203             :                                                 Double_t r, Double_t t,
    1204             :                                                 Double_t *x, Double_t *y) const
    1205             : {
    1206             : //
    1207             : // Creates the partial sequence of X and Y coordinates to determine
    1208             : // the lateral part of the SPD thermal shield
    1209             : //
    1210             : // Input:
    1211             : //        a, b : shape sides
    1212             : //        r    : radius
    1213             : //        t    : theta angle
    1214             : //
    1215             : // Output:
    1216             : //        x, y : coordinate vectors [6]
    1217             : //
    1218             : // Created:      14 Nov 2007  Mario Sitta
    1219             : //
    1220          16 :   x[0] = a/2;
    1221           8 :   y[0] = r;
    1222             : 
    1223           8 :   x[1] = x[0] + b * TMath::Cos(t/2);
    1224           8 :   y[1] = y[0] - b * TMath::Sin(t/2);
    1225             : 
    1226           8 :   x[2] = x[1] + a * TMath::Cos(t);
    1227           8 :   y[2] = y[1] - a * TMath::Sin(t);
    1228             : 
    1229           8 :   x[3] = x[2] + b * TMath::Cos(3*t/2);
    1230           8 :   y[3] = y[2] - b * TMath::Sin(3*t/2);
    1231             : 
    1232           8 :   x[4] = x[3] + a * TMath::Cos(2*t);
    1233           8 :   y[4] = y[3] - a * TMath::Sin(2*t);
    1234             : 
    1235           8 :   x[5] = x[4];
    1236           8 :   y[5] = 0.;
    1237             : 
    1238           8 :   return;
    1239             : }
    1240             : 
    1241             : //______________________________________________________________________
    1242             : void AliITSv11GeometrySupport::PointFromParallelLines(Double_t x1, Double_t y1,
    1243             :                               Double_t x2, Double_t y2, Double_t d,
    1244             :                               Double_t &x, Double_t &y) const
    1245             : {
    1246             : //
    1247             : // Determines the X and Y of the first internal point of the Omega shape
    1248             : // (i.e. the coordinates of a point given two parallel lines passing by
    1249             : // two points and placed at a known distance)
    1250             : //
    1251             : // Input:
    1252             : //        x1, y1 : first point
    1253             : //        x2, y2 : second point
    1254             : //        d      : distance between the two lines
    1255             : //
    1256             : // Output:
    1257             : //        x, y   : coordinate of the point
    1258             : //
    1259             : // Created:      22 Feb 2009  Mario Sitta
    1260             : //
    1261             : //Begin_Html
    1262             : /*
    1263             : <img src="ITS/doc/PointFromParallelLines.gif">
    1264             : */
    1265             : //End_Html
    1266             : 
    1267             :   // The slope of the paralles lines at a distance d
    1268             :   Double_t m; 
    1269             : 
    1270             :   // The parameters of the solving equation
    1271             :   // a x^2 - 2 b x + c = 0
    1272           8 :   Double_t a = (x1 - x2)*(x1 - x2) - d*d;
    1273           4 :   Double_t b = (x1 - x2)*(y1 - y2);
    1274           4 :   Double_t c = (y1 - y2)*(y1 - y2) - d*d;
    1275             : 
    1276             :   // (delta4 is Delta/4 because we use the reduced formula)
    1277           4 :   Double_t delta4 = b*b - a*c;
    1278             : 
    1279             :   // Compute the slope of the two parallel lines
    1280             :   // (one of the two possible slopes, the one with the smaller
    1281             :   // absolute value is needed)
    1282           4 :   if (delta4 < 0) { // Should never happen with our data, but just to be sure
    1283           0 :     x = -1;         // x is expected positive, so this flags an error
    1284           0 :     return;
    1285             :   } else
    1286           4 :     m = (b + TMath::Sqrt(delta4))/a;  // b is negative with our data
    1287             : 
    1288             :   // Finally compute the coordinates of the point
    1289           4 :   x = x2 + (y1 - y2 - d)/m;
    1290           4 :   y = y1 - d;
    1291             : 
    1292             :   // Done
    1293           4 :   return;
    1294           4 : }
    1295             : 
    1296             : //______________________________________________________________________
    1297             : void AliITSv11GeometrySupport::ReflectPoint(Double_t x1, Double_t y1,
    1298             :                                             Double_t x2, Double_t y2,
    1299             :                                             Double_t x3, Double_t y3,
    1300             :                                             Double_t &x, Double_t &y) const
    1301             : {
    1302             : //
    1303             : // Given two points (x1,y1) and (x2,y2), determines the point (x,y)
    1304             : // lying on the line parallel to the line passing by these points,
    1305             : // at a distance d and passing by the point (x3,y3), which is symmetric to
    1306             : // the third point with respect to the axis of the segment delimited by
    1307             : // the two first points.
    1308             : //
    1309             : // Input:
    1310             : //        x1, y1 : first point
    1311             : //        x2, y2 : second point
    1312             : //        x3, y3 : third point
    1313             : //        d      : distance between the two lines
    1314             : //
    1315             : // Output:
    1316             : //        x, y   : coordinate of the reflected point
    1317             : //
    1318             : // Created:      22 Feb 2009  Mario Sitta
    1319             : //
    1320             : //Begin_Html
    1321             : /*
    1322             : <img src="ITS/doc/ReflectPoint.gif">
    1323             : */
    1324             : //End_Html
    1325             : 
    1326             :   // The slope of the line passing by the first two points
    1327          32 :   Double_t k = (y2 - y1)/(x2 - x1);
    1328             : 
    1329             :   // The middle point of the segment 1-2
    1330          16 :   Double_t xK = (x1 + x2)/2.;
    1331          16 :   Double_t yK = (y1 + y2)/2.;
    1332             : 
    1333             :   // The intercept between the axis of the segment 1-2 and the line
    1334             :   // passing by 3 and parallel to the line passing by 1-2
    1335          16 :   Double_t xH = (k*k*x3 + k*(yK - y3) + xK)/(k*k + 1);
    1336          16 :   Double_t yH = k*(xH - x3) + y3;
    1337             : 
    1338             :   // The point symmetric to 3 with respect to H
    1339          16 :   x = 2*xH - x3;
    1340          16 :   y = 2*yH - y3;
    1341             : 
    1342             :   // Done
    1343             :   return;
    1344          16 : }
    1345             : 
    1346             : //______________________________________________________________________
    1347             : void AliITSv11GeometrySupport::SDDCone(TGeoVolume *moth,const TGeoManager *mgr)
    1348             : {
    1349             : //
    1350             : // Creates the SDD support cone and cylinder geometry as a
    1351             : // volume assembly and adds it to the mother volume
    1352             : // (part of this code is taken or anyway inspired to SDDCone method
    1353             : // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    1354             : //
    1355             : // Input:
    1356             : //         moth : the TGeoVolume owing the volume structure
    1357             : //         mgr  : the GeoManager (default gGeoManager)
    1358             : // Output:
    1359             : //
    1360             : // Created:         ???       Bjorn S. Nilsen
    1361             : // Updated:      18 Feb 2008  Mario Sitta
    1362             : // Updated:      25 Jul 2008  Mario Sitta   SDDCarbonFiberCone simpler
    1363             : // Updated:      10 Jun 2010  Mario Sitta   Cables across cone holes added
    1364             : //
    1365             : // Technical data are taken from:  "Supporto Generale Settore SDD"
    1366             : // (technical drawings ALR-0816/1-B), "Supporto Globale Settore SDD"
    1367             : // (technical drawings ALR-0816/2A, ALR-0816/2B, ALR-0816/2C, ALR-0816/2D), 
    1368             : // private communication with B. Giraudo
    1369             : 
    1370             :   // Dimensions of the Central cylinder and flanges
    1371           2 :   const Double_t kCylinderHalfLength = (790.0/2)*fgkmm;
    1372           1 :   const Double_t kCylinderInnerR     = (210.0/2)*fgkmm;
    1373           1 :   const Double_t kCylinderOuterR     = (231.0/2)*fgkmm;
    1374           1 :   const Double_t kFlangeHalfLength   = ( 15.0/2)*fgkmm;
    1375           1 :   const Double_t kFlangeInnerR       = (210.5/2)*fgkmm;
    1376           1 :   const Double_t kFlangeOuterR       = (230.5/2)*fgkmm;
    1377             :   const Double_t kInsertoHalfLength  =
    1378           1 :                                      kCylinderHalfLength - 2*kFlangeHalfLength;
    1379             : //  const Double_t kCFThickness        = kFlangeInnerR - kCylinderInnerR;
    1380           1 :   const Double_t kBoltDiameter       =       6.0*fgkmm; // M6 screw
    1381             :   const Double_t kBoltDepth          =       6.0*fgkmm; // In the flange
    1382           1 :   const Double_t kBoltRadius         = (220.0/2)*fgkmm; // Radius in flange
    1383           1 :   const Double_t kThetaBolt          =      30.0*fgkDegree;
    1384           1 :   const Int_t    kNBolts             = (Int_t)(360.0/kThetaBolt);
    1385             :   // Dimensions of the Cone
    1386           1 :   const Double_t kConeROutMin        = (540.0/2)*fgkmm;
    1387           1 :   const Double_t kConeROutMax        = (560.0/2)*fgkmm;
    1388           1 :   const Double_t kConeRCurv          =      10.0*fgkmm; // Radius of curvature
    1389             :   const Double_t kConeRinMin         = (210.0/2)*fgkmm;
    1390             : //  const Double_t kConeRinMax         = (216.0/2)*fgkmm;
    1391             :   const Double_t kConeRinCylinder    = (231.0/2)*fgkmm;
    1392           1 :   const Double_t kConeZCylinder      =     192.0*fgkmm;
    1393           1 :   const Double_t kConeZOuterMilled   =      23.0*fgkmm;
    1394           1 :   const Double_t kConeDZin           =      15.0*fgkmm; // ???
    1395             :   const Double_t kConeThickness      =      10.0*fgkmm; // Rohacell + Carb.Fib.
    1396           1 :   const Double_t kConeTheta          =      45.0*fgkDegree; // SDD cone angle
    1397             :   const Double_t kSinConeTheta       =
    1398           1 :                                      TMath::Sin(kConeTheta*TMath::DegToRad());
    1399             :   const Double_t kCosConeTheta       =
    1400           1 :                                      TMath::Cos(kConeTheta*TMath::DegToRad());
    1401             :   const Double_t kTanConeTheta       =
    1402           1 :                                      TMath::Tan(kConeTheta*TMath::DegToRad());
    1403             :   // Dimensions of the Cone Inserts
    1404           1 :   const Double_t kConeCFThickness    =       1.5*fgkmm;//Carbon fiber thickness
    1405             :   // Dimensions of the Cone Holes
    1406           1 :   const Double_t kHole1RMin          = (450.0/2)*fgkmm;
    1407           1 :   const Double_t kHole1RMax          = (530.0/2)*fgkmm;
    1408           1 :   const Double_t kHole2RMin          = (280.0/2)*fgkmm;
    1409           1 :   const Double_t kHole2RMax          = (375.0/2)*fgkmm;
    1410           1 :   const Double_t kHole1Phi           =      25.0*fgkDegree;
    1411           1 :   const Double_t kHole2Phi           =      50.0*fgkDegree;
    1412           1 :   const Double_t kHole3RMin          =     205.0*fgkmm;
    1413           1 :   const Double_t kHole3DeltaR        =        15*fgkmm;
    1414           1 :   const Double_t kHole3Width         =        30*fgkmm;
    1415             :   const Int_t    kNHole3             =         6      ;
    1416           1 :   const Double_t kHole4RMin          =     116.0*fgkmm;
    1417             :   const Double_t kHole4DeltaR        =        15*fgkmm;
    1418             :   const Double_t kHole4Width         =        30*fgkmm;
    1419             :   //  const Int_t    kNHole4             =         3      ;
    1420             :   // Fraction of materials in holes
    1421             :   const Double_t kHolePlasticFrac    =       0.55846;
    1422             :   const Double_t kHoleCuFrac         =       0.06319;
    1423             :   const Double_t kHoleGlassFrac      =       0.02652;
    1424             : 
    1425             :   // Local variables
    1426           1 :   Double_t x, y, z, t, dza, rmin, rmax;
    1427             : 
    1428             : 
    1429             :   // Recover the needed materials
    1430           1 :   TGeoMedium *medSDDcf    = mgr->GetMedium("ITS_SDD C (M55J)$");
    1431           1 :   TGeoMedium *medSDDair   = mgr->GetMedium("ITS_SDD AIR$");
    1432           1 :   TGeoMedium *medSDDste   = mgr->GetMedium("ITS_G10FR4$"); // stesalite
    1433           1 :   TGeoMedium *medSDDroh   = mgr->GetMedium("ITS_ROHACELL$");
    1434           1 :   TGeoMedium *medSDDss    = mgr->GetMedium("ITS_INOX$");
    1435           1 :   TGeoMedium *medSDDplast = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
    1436           1 :   TGeoMedium *medSDDCu    = mgr->GetMedium("ITS_COPPER$");
    1437           1 :   TGeoMedium *medSDDglass = mgr->GetMedium("ITS_SDD OPTICFIB$");
    1438             : 
    1439             :   // First define the geometrical shapes
    1440             : 
    1441             :   // Central cylinder with its internal foam and the lateral flanges:
    1442             :   // a carbon fiber Tube which contains a rohacell Tube and two
    1443             :   // stesalite Tube's
    1444           1 :   TGeoTube *cylindershape = new TGeoTube(kCylinderInnerR,kCylinderOuterR,
    1445             :                                          kCylinderHalfLength);
    1446             : 
    1447           1 :   TGeoTube *insertoshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
    1448             :                                         kInsertoHalfLength);
    1449             : 
    1450           1 :   TGeoTube *flangeshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
    1451             :                                        kFlangeHalfLength);
    1452             : 
    1453             :   // The flange bolt: it is a Tube
    1454           1 :   TGeoTube *boltshape = new TGeoTube(0.0, 0.5*kBoltDiameter, 0.5*kBoltDepth);
    1455             : 
    1456             :   // Debug if requested
    1457           1 :   if (GetDebug(1)) {
    1458           0 :     cylindershape->InspectShape();
    1459           0 :     insertoshape->InspectShape();
    1460           0 :     flangeshape->InspectShape();
    1461           0 :     boltshape->InspectShape();
    1462           0 :   }
    1463             : 
    1464             : 
    1465             :   // We have the shapes: now create the real volumes
    1466             : 
    1467           2 :   TGeoVolume *cfcylinder = new TGeoVolume("SDDCarbonFiberCylinder",
    1468           1 :                                           cylindershape,medSDDcf);
    1469           1 :   cfcylinder->SetVisibility(kTRUE);
    1470           1 :   cfcylinder->SetLineColor(4); // Blue
    1471           1 :   cfcylinder->SetLineWidth(1);
    1472           1 :   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
    1473           1 :   cfcylinder->SetFillStyle(4000); // 0% transparent
    1474             : 
    1475           2 :   TGeoVolume *foamcylinder = new TGeoVolume("SDDFoamCylinder",
    1476           1 :                                             insertoshape,medSDDroh);
    1477           1 :   foamcylinder->SetVisibility(kTRUE);
    1478           1 :   foamcylinder->SetLineColor(3); // Green
    1479           1 :   foamcylinder->SetLineWidth(1);
    1480           1 :   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
    1481           1 :   foamcylinder->SetFillStyle(4050); // 50% transparent
    1482             : 
    1483           2 :   TGeoVolume *flangecylinder = new TGeoVolume("SDDFlangeCylinder",
    1484           1 :                                               flangeshape,medSDDste);
    1485           1 :   flangecylinder->SetVisibility(kTRUE);
    1486           1 :   flangecylinder->SetLineColor(2); // Red
    1487           1 :   flangecylinder->SetLineWidth(1);
    1488           1 :   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
    1489           1 :   flangecylinder->SetFillStyle(4050); // 50% transparent
    1490             : 
    1491           1 :   TGeoVolume *bolt = new TGeoVolume("SDDFlangeBolt",boltshape,medSDDss);
    1492           1 :   bolt->SetVisibility(kTRUE);
    1493           1 :   bolt->SetLineColor(1);  // Black
    1494           1 :   bolt->SetLineWidth(1);
    1495           1 :   bolt->SetFillColor(bolt->GetLineColor());
    1496           1 :   bolt->SetFillStyle(4050); // 50% transparent
    1497             : 
    1498             :   // Mount up the cylinder
    1499          26 :   for(Int_t i=0; i<kNBolts; i++){
    1500          12 :     t = kThetaBolt*i;
    1501          12 :     x = kBoltRadius*CosD(t);
    1502          12 :     y = kBoltRadius*SinD(t);
    1503          12 :     z = kFlangeHalfLength-kBoltDepth;
    1504          24 :     flangecylinder->AddNode(bolt, i+1, new TGeoTranslation("",x,y,z));
    1505             :   }
    1506             : 
    1507           1 :   cfcylinder->AddNode(foamcylinder,1,0);
    1508           2 :   cfcylinder->AddNode(flangecylinder,1,
    1509           2 :               new TGeoTranslation(0, 0, kInsertoHalfLength+kFlangeHalfLength));
    1510           3 :   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
    1511           1 :               0, 0, -kInsertoHalfLength-kFlangeHalfLength,
    1512           2 :               new TGeoRotation("",0,180,0)     ) );
    1513             : 
    1514             : 
    1515             :   // SDD Support Cone with its internal inserts: a carbon fiber Pcon
    1516             :   // with holes which contains a stesalite Pcon which on turn contains a
    1517             :   // rohacell Pcon
    1518             : 
    1519           1 :   dza = kConeThickness/kSinConeTheta-(kConeROutMax-kConeROutMin)/kTanConeTheta;
    1520             : 
    1521           1 :   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 10);
    1522             : 
    1523           1 :   coneshape->Z(0)     = 0.0;
    1524           1 :   coneshape->Rmin(0)  = kConeROutMin;
    1525           1 :   coneshape->Rmax(0)  = kConeROutMax;
    1526             : 
    1527           1 :   coneshape->Z(1)     = kConeZOuterMilled - dza;
    1528           1 :   coneshape->Rmin(1)  = coneshape->GetRmin(0);
    1529           1 :   coneshape->Rmax(1)  = coneshape->GetRmax(0);
    1530             : 
    1531           1 :   coneshape->Z(2)     = kConeZOuterMilled;
    1532           1 :   coneshape->Rmax(2)  = coneshape->GetRmax(0);
    1533             : 
    1534           2 :   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(1),
    1535           1 :                     coneshape->GetRmin(1),kConeTheta,z,rmin);
    1536           1 :   coneshape->Z(3)     = z;
    1537           1 :   coneshape->Rmin(3)  = rmin;
    1538             : 
    1539           1 :   coneshape->Rmin(2)  = RminFrom2Points(coneshape,3,1,coneshape->GetZ(2));
    1540             : 
    1541           2 :   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(2),
    1542           1 :                     coneshape->GetRmax(2),kConeTheta,z,rmax);
    1543           1 :   coneshape->Z(4)     = z;
    1544           1 :   coneshape->Rmax(4)  = rmax;
    1545           1 :   coneshape->Rmin(4)  = RminFromZpCone(coneshape,3,kConeTheta,
    1546           1 :                                        coneshape->GetZ(4),0.0);
    1547             : 
    1548           1 :   coneshape->Rmax(3)  = RmaxFrom2Points(coneshape,4,2,coneshape->GetZ(3));
    1549             : 
    1550           1 :   coneshape->Z(6)     = kConeZCylinder - kConeDZin;
    1551             : 
    1552           2 :   RadiusOfCurvature(kConeRCurv,90.0,coneshape->GetZ(6),0.0,
    1553           1 :                     90.0-kConeTheta,z,rmin);
    1554           1 :   coneshape->Z(5)     = z;
    1555           1 :   coneshape->Rmin(5)  = RminFromZpCone(coneshape,3,kConeTheta,z);
    1556           1 :   coneshape->Rmax(5)  = RmaxFromZpCone(coneshape,4,kConeTheta,z);
    1557             : 
    1558           1 :   RadiusOfCurvature(kConeRCurv,90.-kConeTheta,
    1559           1 :                     0.0,coneshape->Rmin(5),90.0,z,rmin);
    1560           1 :   coneshape->Rmin(6)  = rmin;
    1561           1 :   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,4,kConeTheta,
    1562           1 :                                        coneshape->GetZ(6));
    1563             : 
    1564           1 :   coneshape->Z(7)     = coneshape->GetZ(6);
    1565           1 :   coneshape->Rmin(7)  = kConeRinMin;
    1566           1 :   coneshape->Rmax(7)  = coneshape->GetRmax(6);
    1567             : 
    1568           1 :   coneshape->Rmin(8)  = kConeRinMin;
    1569             : 
    1570           1 :   RadiusOfCurvature(kConeRCurv,90.0,kConeZCylinder,kConeRinCylinder,
    1571             :                     90.0-kConeTheta,z,rmax);
    1572           1 :   coneshape->Z(8)     = z;
    1573           1 :   coneshape->Rmax(8)  = rmax;
    1574             : 
    1575           1 :   coneshape->Z(9)     = kConeZCylinder;
    1576           1 :   coneshape->Rmin(9)  = kConeRinMin;
    1577           1 :   coneshape->Rmax(9)  = kConeRinCylinder;
    1578             : 
    1579             : 
    1580             :   // SDD Cone Insert: another Pcon
    1581             :   Double_t x0, y0, x1, y1, x2, y2;
    1582           1 :   TGeoPcon *coneinsertshape = new TGeoPcon(0.0, 360.0, 9);
    1583             : 
    1584           1 :   coneinsertshape->Z(0)    = coneshape->GetZ(0) + kConeCFThickness;
    1585           1 :   coneinsertshape->Rmin(0) = coneshape->GetRmin(0) + kConeCFThickness;
    1586           1 :   coneinsertshape->Rmax(0) = coneshape->GetRmax(0) - kConeCFThickness;
    1587             : 
    1588           1 :   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
    1589           1 :   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
    1590           1 :   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
    1591           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
    1592           1 :   coneinsertshape->Z(1)    = z;
    1593           1 :   coneinsertshape->Rmin(1) = rmin;
    1594           1 :   coneinsertshape->Rmax(1) = coneinsertshape->GetRmax(0);
    1595             : 
    1596           1 :   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmax(1);
    1597           1 :   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmax(2);
    1598           1 :   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmax(3);
    1599           1 :   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
    1600           1 :   coneinsertshape->Z(2)    = z;
    1601           1 :   coneinsertshape->Rmax(2) = rmax;
    1602             : 
    1603           1 :   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
    1604           1 :   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
    1605           1 :   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
    1606           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
    1607           1 :   coneinsertshape->Z(3)    = z;
    1608           1 :   coneinsertshape->Rmin(3) = rmin;
    1609             : 
    1610           1 :   x0 = coneinsertshape->GetZ(1); y0 = coneinsertshape->GetRmin(1);
    1611           1 :   x1 = coneinsertshape->GetZ(3); y1 = coneinsertshape->GetRmin(3);
    1612           1 :   coneinsertshape->Rmin(2) = Yfrom2Points(x0, y0, x1, y1,
    1613           1 :                                           coneinsertshape->Z(2));
    1614             : 
    1615           1 :   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
    1616           1 :   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
    1617           1 :   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
    1618           1 :   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
    1619           1 :   coneinsertshape->Z(4)    = z;
    1620           1 :   coneinsertshape->Rmax(4) = rmax;
    1621             : 
    1622           1 :   x0 = coneinsertshape->GetZ(2); y0 = coneinsertshape->GetRmax(2);
    1623           1 :   x1 = coneinsertshape->GetZ(4); y1 = coneinsertshape->GetRmax(4);
    1624           1 :   coneinsertshape->Rmax(3) = Yfrom2Points(x0, y0, x1, y1,
    1625           1 :                                           coneinsertshape->Z(3));
    1626             : 
    1627           1 :   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmin(4);
    1628           1 :   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmin(5);
    1629           1 :   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmin(6);
    1630           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
    1631           1 :   coneinsertshape->Z(5)    = z;
    1632           1 :   coneinsertshape->Rmin(5) = rmin;
    1633           2 :   coneinsertshape->Rmax(5) = coneinsertshape->GetRmax(4) -
    1634           1 :           kTanConeTheta*(coneinsertshape->GetZ(5) - coneinsertshape->GetZ(4));
    1635             : 
    1636           1 :   x0 = coneinsertshape->GetZ(3); y0 = coneinsertshape->GetRmin(3);
    1637           1 :   x1 = coneinsertshape->GetZ(5); y1 = coneinsertshape->GetRmin(5);
    1638           1 :   coneinsertshape->Rmin(4) = Yfrom2Points(x0, y0, x1, y1,
    1639           1 :                                           coneinsertshape->Z(4));
    1640             : 
    1641           1 :   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmin(5);
    1642           1 :   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmin(6);
    1643           1 :   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmin(7);
    1644           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
    1645           1 :   coneinsertshape->Z(6)    = z;
    1646           1 :   coneinsertshape->Rmin(6) = rmin;
    1647           2 :   coneinsertshape->Rmax(6) = coneinsertshape->GetRmax(4) -
    1648           1 :           kTanConeTheta*(coneinsertshape->GetZ(6) - coneinsertshape->GetZ(4));
    1649             : 
    1650           1 :   coneinsertshape->Z(7)    = coneinsertshape->GetZ(6);
    1651           1 :   coneinsertshape->Rmin(7) = coneshape->GetRmin(7) + kConeCFThickness;
    1652           1 :   coneinsertshape->Rmax(7) = coneinsertshape->GetRmax(6);
    1653             : 
    1654           1 :   coneinsertshape->Z(8)    = coneshape->GetZ(9) - kConeCFThickness;
    1655           1 :   coneinsertshape->Rmin(8) = coneinsertshape->GetRmin(7);
    1656           2 :   coneinsertshape->Rmax(8) = coneinsertshape->GetRmax(4) -
    1657           1 :           kTanConeTheta*(coneinsertshape->GetZ(8) - coneinsertshape->GetZ(4));
    1658             : 
    1659             :   // SDD Cone Foam: another Pcon
    1660           1 :   TGeoPcon *conefoamshape = new TGeoPcon(0.0, 360.0, 4);
    1661             : 
    1662           2 :   RadiusOfCurvature(kConeRCurv+kConeCFThickness,0.0,coneinsertshape->GetZ(1),
    1663           1 :                     coneinsertshape->GetRmin(1),kConeTheta,z,rmin);
    1664             : 
    1665           1 :   conefoamshape->Z(0)    = z;
    1666           1 :   conefoamshape->Rmin(0) = rmin;
    1667           1 :   conefoamshape->Rmax(0) = conefoamshape->GetRmin(0);
    1668             : 
    1669           2 :   conefoamshape->Z(1)    = conefoamshape->GetZ(0)+
    1670           1 :                          (kConeThickness-2.0*kConeCFThickness)/kSinConeTheta;
    1671           1 :   conefoamshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,kConeTheta,
    1672           1 :                                           conefoamshape->GetZ(1));
    1673           1 :   conefoamshape->Rmax(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
    1674           1 :                                           conefoamshape->GetZ(1));
    1675             : 
    1676           1 :   conefoamshape->Z(2)    = coneshape->GetZ(5)-kConeCFThickness;
    1677           1 :   conefoamshape->Rmin(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
    1678           1 :                                           conefoamshape->GetZ(2));
    1679           1 :   conefoamshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
    1680           1 :                                           conefoamshape->GetZ(2));
    1681             : 
    1682           2 :   conefoamshape->Z(3)    = coneinsertshape->GetZ(5)+
    1683           1 :                          (kConeThickness-2.0*kConeCFThickness)*kCosConeTheta;
    1684           1 :   conefoamshape->Rmax(3) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
    1685           1 :                                           conefoamshape->GetZ(3));
    1686           1 :   conefoamshape->Rmin(3) = conefoamshape->GetRmax(3);
    1687             : 
    1688             :   // SDD Cone Holes: Pcon's
    1689             :   // A single hole volume gives an overlap with coneinsert, so
    1690             :   // three contiguous volumes are created: one to be put in the cone foam
    1691             :   // and two in the cone carbon fiber envelope
    1692           1 :   TGeoPcon *hole1shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
    1693             : 
    1694           1 :   hole1shape->Rmin(0) = kHole1RMax;
    1695           1 :   hole1shape->Rmax(0) = hole1shape->GetRmin(0);
    1696           1 :   hole1shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
    1697           1 :                                        hole1shape->GetRmin(0));
    1698             : 
    1699           1 :   hole1shape->Rmax(1) = hole1shape->GetRmax(0);
    1700           1 :   hole1shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1701           1 :                                        hole1shape->GetRmax(1));
    1702           1 :   hole1shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
    1703           1 :                                        hole1shape->GetZ(1));
    1704             : 
    1705           1 :   hole1shape->Rmin(2) = kHole1RMin;
    1706           1 :   hole1shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    1707           1 :                                        hole1shape->GetRmin(2));
    1708           1 :   hole1shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
    1709           1 :                                        hole1shape->GetZ(2));
    1710             : 
    1711           1 :   hole1shape->Rmin(3) = hole1shape->GetRmin(2);
    1712           1 :   hole1shape->Rmax(3) = hole1shape->GetRmin(3);
    1713           1 :   hole1shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1714           1 :                                        hole1shape->GetRmax(3));
    1715             : 
    1716           1 :   TGeoPcon *hole11shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
    1717             : 
    1718           1 :   hole11shape->Rmin(0) = kHole1RMax;
    1719           1 :   hole11shape->Rmax(0) = hole11shape->GetRmin(0);
    1720           1 :   hole11shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1721           1 :                                         hole11shape->GetRmin(0));
    1722             : 
    1723           1 :   hole11shape->Rmax(1) = hole11shape->GetRmax(0);
    1724           1 :   hole11shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
    1725           1 :                                         hole11shape->GetRmax(1));
    1726           1 :   hole11shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
    1727           1 :                                         hole11shape->GetZ(1));
    1728             : 
    1729           1 :   hole11shape->Rmin(2) = kHole1RMin;
    1730           1 :   hole11shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1731           1 :                                         hole11shape->GetRmin(2));
    1732           1 :   hole11shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
    1733           1 :                                         hole11shape->GetZ(2));
    1734             : 
    1735           1 :   hole11shape->Rmin(3) = hole11shape->GetRmin(2);
    1736           1 :   hole11shape->Rmax(3) = hole11shape->GetRmin(3);
    1737           1 :   hole11shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
    1738           1 :                                         hole11shape->GetRmax(3));
    1739             : 
    1740           1 :   TGeoPcon *hole12shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
    1741             : 
    1742           1 :   hole12shape->Rmin(0) = kHole1RMax;
    1743           1 :   hole12shape->Rmax(0) = hole12shape->GetRmin(0);
    1744           1 :   hole12shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
    1745           1 :                                         hole12shape->GetRmin(0));
    1746             : 
    1747           1 :   hole12shape->Rmax(1) = hole12shape->GetRmax(0);
    1748           1 :   hole12shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1749           1 :                                         hole12shape->GetRmax(1));
    1750           1 :   hole12shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
    1751           1 :                                         hole12shape->GetZ(1));
    1752             : 
    1753           1 :   hole12shape->Rmin(2) = kHole1RMin;
    1754           1 :   hole12shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
    1755           1 :                                         hole12shape->GetRmin(2));
    1756           1 :   hole12shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
    1757           1 :                                         hole12shape->GetZ(2));
    1758             : 
    1759           1 :   hole12shape->Rmin(3) = hole12shape->GetRmin(2);
    1760           1 :   hole12shape->Rmax(3) = hole12shape->GetRmin(3);
    1761           1 :   hole12shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1762           1 :                                         hole12shape->GetRmax(3));
    1763             : 
    1764             :   //
    1765           1 :   TGeoPcon *hole2shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
    1766             : 
    1767           1 :   hole2shape->Rmin(0) = kHole2RMax;
    1768           1 :   hole2shape->Rmax(0) = hole2shape->GetRmin(0);
    1769           1 :   hole2shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
    1770           1 :                                        hole2shape->GetRmin(0));
    1771             : 
    1772           1 :   hole2shape->Rmax(1) = hole2shape->GetRmax(0);
    1773           1 :   hole2shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1774           1 :                                        hole2shape->GetRmax(1));
    1775           1 :   hole2shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
    1776           1 :                                        hole2shape->GetZ(1));
    1777             : 
    1778           1 :   hole2shape->Rmin(2) = kHole2RMin;
    1779           1 :   hole2shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    1780           1 :                                        hole2shape->GetRmin(2));
    1781           1 :   hole2shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
    1782           1 :                                        hole2shape->GetZ(2));
    1783             : 
    1784           1 :   hole2shape->Rmin(3) = hole2shape->GetRmin(2);
    1785           1 :   hole2shape->Rmax(3) = hole2shape->GetRmin(3);
    1786           1 :   hole2shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1787           1 :                                        hole2shape->GetRmax(3));
    1788             : 
    1789           1 :   TGeoPcon *hole21shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
    1790             : 
    1791           1 :   hole21shape->Rmin(0) = kHole2RMax;
    1792           1 :   hole21shape->Rmax(0) = hole21shape->GetRmin(0);
    1793           1 :   hole21shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1794           1 :                                         hole21shape->GetRmin(0));
    1795             : 
    1796           1 :   hole21shape->Rmax(1) = hole21shape->GetRmax(0);
    1797           1 :   hole21shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
    1798           1 :                                         hole21shape->GetRmax(1));
    1799           1 :   hole21shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
    1800           1 :                                         hole21shape->GetZ(1));
    1801             : 
    1802           1 :   hole21shape->Rmin(2) = kHole2RMin;
    1803           1 :   hole21shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1804           1 :                                         hole21shape->GetRmin(2));
    1805           1 :   hole21shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
    1806           1 :                                         hole21shape->GetZ(2));
    1807             : 
    1808           1 :   hole21shape->Rmin(3) = hole21shape->GetRmin(2);
    1809           1 :   hole21shape->Rmax(3) = hole21shape->GetRmin(3);
    1810           1 :   hole21shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
    1811           1 :                                         hole21shape->GetRmax(3));
    1812             : 
    1813           1 :   TGeoPcon *hole22shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
    1814             : 
    1815           1 :   hole22shape->Rmin(0) = kHole2RMax;
    1816           1 :   hole22shape->Rmax(0) = hole22shape->GetRmin(0);
    1817           1 :   hole22shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
    1818           1 :                                         hole22shape->GetRmin(0));
    1819             : 
    1820           1 :   hole22shape->Rmax(1) = hole22shape->GetRmax(0);
    1821           1 :   hole22shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1822           1 :                                         hole22shape->GetRmax(1));
    1823           1 :   hole22shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
    1824           1 :                                         hole22shape->GetZ(1));
    1825             : 
    1826           1 :   hole22shape->Rmin(2) = kHole2RMin;
    1827           1 :   hole22shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
    1828           1 :                                         hole22shape->GetRmin(2));
    1829           1 :   hole22shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
    1830           1 :                                         hole22shape->GetZ(2));
    1831             : 
    1832           1 :   hole22shape->Rmin(3) = hole22shape->GetRmin(2);
    1833           1 :   hole22shape->Rmax(3) = hole22shape->GetRmin(3);
    1834           1 :   hole22shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1835           1 :                                         hole22shape->GetRmax(3));
    1836             : 
    1837             :   //
    1838             :   Double_t holePhi;
    1839           1 :   holePhi = (kHole3Width/kHole3RMin)*TMath::RadToDeg();
    1840             : 
    1841           1 :   TGeoPcon *hole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    1842             : 
    1843           1 :   hole3shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
    1844           1 :   hole3shape->Rmax(0) = hole3shape->GetRmin(0);
    1845           1 :   hole3shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
    1846           1 :                                        hole3shape->GetRmin(0));
    1847             : 
    1848           1 :   hole3shape->Rmax(1) = hole3shape->GetRmax(0);
    1849           1 :   hole3shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1850           1 :                                        hole3shape->GetRmax(1));
    1851           1 :   hole3shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
    1852           1 :                                        hole3shape->GetZ(1));
    1853             : 
    1854           1 :   hole3shape->Rmin(2) = kHole3RMin;
    1855           1 :   hole3shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    1856           1 :                                        hole3shape->GetRmin(2));
    1857           1 :   hole3shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
    1858           1 :                                        hole3shape->GetZ(2));
    1859             : 
    1860           1 :   hole3shape->Rmin(3) = hole3shape->GetRmin(2);
    1861           1 :   hole3shape->Rmax(3) = hole3shape->GetRmin(3);
    1862           1 :   hole3shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1863           1 :                                        hole3shape->GetRmax(3));
    1864             : 
    1865           1 :   TGeoPcon *hole31shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    1866             : 
    1867           1 :   hole31shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
    1868           1 :   hole31shape->Rmax(0) = hole31shape->GetRmin(0);
    1869           1 :   hole31shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1870           1 :                                         hole31shape->GetRmin(0));
    1871             : 
    1872           1 :   hole31shape->Rmax(1) = hole31shape->GetRmax(0);
    1873           1 :   hole31shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
    1874           1 :                                         hole31shape->GetRmax(1));
    1875           1 :   hole31shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
    1876           1 :                                         hole31shape->GetZ(1));
    1877             : 
    1878           1 :   hole31shape->Rmin(2) = kHole3RMin;
    1879           1 :   hole31shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1880           1 :                                         hole31shape->GetRmin(2));
    1881           1 :   hole31shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
    1882           1 :                                         hole31shape->GetZ(2));
    1883             : 
    1884           1 :   hole31shape->Rmin(3) = hole31shape->GetRmin(2);
    1885           1 :   hole31shape->Rmax(3) = hole31shape->GetRmin(3);
    1886           1 :   hole31shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
    1887           1 :                                         hole31shape->GetRmax(3));
    1888             : 
    1889           1 :   TGeoPcon *hole32shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    1890             : 
    1891           1 :   hole32shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
    1892           1 :   hole32shape->Rmax(0) = hole32shape->GetRmin(0);
    1893           1 :   hole32shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
    1894           1 :                                         hole32shape->GetRmin(0));
    1895             : 
    1896           1 :   hole32shape->Rmax(1) = hole32shape->GetRmax(0);
    1897           1 :   hole32shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1898           1 :                                         hole32shape->GetRmax(1));
    1899           1 :   hole32shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
    1900           1 :                                         hole32shape->GetZ(1));
    1901             : 
    1902           1 :   hole32shape->Rmin(2) = kHole3RMin;
    1903           1 :   hole32shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
    1904           1 :                                         hole32shape->GetRmin(2));
    1905           1 :   hole32shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
    1906           1 :                                         hole32shape->GetZ(2));
    1907             : 
    1908           1 :   hole32shape->Rmin(3) = hole32shape->GetRmin(2);
    1909           1 :   hole32shape->Rmax(3) = hole32shape->GetRmin(3);
    1910           1 :   hole32shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1911           1 :                                         hole32shape->GetRmax(3));
    1912             : 
    1913             :   //
    1914           1 :   holePhi = (kHole4Width/kHole4RMin)*TMath::RadToDeg();
    1915             : 
    1916           1 :   TGeoPcon *hole4shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    1917             : 
    1918           1 :   hole4shape->Rmin(0) = kHole4RMin + kHole4DeltaR;
    1919           1 :   hole4shape->Rmax(0) = hole4shape->GetRmin(0);
    1920           1 :   hole4shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1921           1 :                                        hole4shape->GetRmin(0));
    1922             : 
    1923           1 :   hole4shape->Rmax(1) = hole4shape->GetRmax(0);
    1924           1 :   hole4shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1925           1 :                                        hole4shape->GetRmax(1));
    1926           1 :   hole4shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
    1927           1 :                                        hole4shape->GetZ(1));
    1928             : 
    1929           1 :   hole4shape->Rmin(2) = kHole4RMin;
    1930           1 :   hole4shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
    1931           1 :                                        hole4shape->GetRmin(2));
    1932           1 :   hole4shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
    1933           1 :                                        hole4shape->GetZ(2));
    1934             : 
    1935           1 :   hole4shape->Rmin(3) = hole4shape->GetRmin(2);
    1936           1 :   hole4shape->Rmax(3) = hole4shape->GetRmin(3);
    1937           1 :   hole4shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
    1938           1 :                                        hole4shape->GetRmax(3));
    1939             : 
    1940             :   // Cables to be put inside the holes: Pcon's
    1941             :   // (fractions are manually computed from AliITSv11GeometrySDD::SDDCables
    1942           1 :   TGeoPcon *hole1plastshape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
    1943             : 
    1944           1 :   hole1plastshape->Rmin(0) = hole1shape->GetRmin(0);
    1945           1 :   hole1plastshape->Rmax(0) = hole1shape->GetRmax(0);
    1946           1 :   hole1plastshape->Z(0)    = hole1shape->GetZ(0);
    1947             : 
    1948           1 :   hole1plastshape->Rmin(1) = hole1shape->GetRmin(1);
    1949           1 :   hole1plastshape->Rmax(1) = hole1shape->GetRmax(1);
    1950           1 :   hole1plastshape->Z(1)    = hole1shape->GetZ(1);
    1951             : 
    1952           1 :   dza = hole1plastshape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHolePlasticFrac;
    1953             : 
    1954           1 :   hole1plastshape->Rmin(2) = dza;
    1955           1 :   hole1plastshape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    1956           1 :                                             hole1plastshape->GetRmin(2));
    1957           1 :   hole1plastshape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
    1958           1 :                                             hole1plastshape->GetZ(2));
    1959             : 
    1960           1 :   hole1plastshape->Rmin(3) = hole1plastshape->GetRmin(2);
    1961           1 :   hole1plastshape->Rmax(3) = hole1plastshape->GetRmin(3);
    1962           1 :   hole1plastshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1963           1 :                                             hole1plastshape->GetRmax(3));
    1964             : 
    1965           1 :   TGeoPcon *hole1Cushape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
    1966             : 
    1967           1 :   hole1Cushape->Rmin(0) = hole1plastshape->GetRmin(2);
    1968           1 :   hole1Cushape->Rmax(0) = hole1Cushape->GetRmin(0);
    1969           1 :   hole1Cushape->Z(0)    = hole1plastshape->GetZ(2);
    1970             : 
    1971           1 :   dza = hole1Cushape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHoleCuFrac;
    1972             : 
    1973           1 :   hole1Cushape->Rmin(1) = dza;
    1974           1 :   hole1Cushape->Rmax(1) = hole1Cushape->GetRmax(0);
    1975           1 :   hole1Cushape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    1976           1 :                                          hole1Cushape->GetRmin(1));
    1977             : 
    1978           1 :   hole1Cushape->Rmax(2) = hole1Cushape->GetRmax(0);
    1979           1 :   hole1Cushape->Rmin(2) = hole1Cushape->GetRmin(1);
    1980           1 :   hole1Cushape->Z(2)    = hole1plastshape->GetZ(3);
    1981             : 
    1982           1 :   hole1Cushape->Rmin(3) = hole1Cushape->GetRmin(1);
    1983           1 :   hole1Cushape->Rmax(3) = hole1Cushape->GetRmin(3);
    1984           1 :   hole1Cushape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    1985           1 :                                          hole1Cushape->GetRmax(3));
    1986             : 
    1987           1 :   TGeoPcon *hole1glassshape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
    1988             : 
    1989           1 :   hole1glassshape->Rmin(0) = hole1Cushape->GetRmin(1);
    1990           1 :   hole1glassshape->Rmax(0) = hole1glassshape->GetRmin(0);
    1991           1 :   hole1glassshape->Z(0)    = hole1Cushape->GetZ(1);
    1992             : 
    1993           1 :   dza = hole1glassshape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHoleGlassFrac;
    1994             : 
    1995           1 :   hole1glassshape->Rmin(1) = dza;
    1996           1 :   hole1glassshape->Rmax(1) = hole1glassshape->GetRmax(0);
    1997           1 :   hole1glassshape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    1998           1 :                                             hole1glassshape->GetRmin(1));
    1999             : 
    2000           1 :   hole1glassshape->Rmax(2) = hole1glassshape->GetRmax(0);
    2001           1 :   hole1glassshape->Rmin(2) = hole1glassshape->GetRmin(1);
    2002           1 :   hole1glassshape->Z(2)    = hole1Cushape->GetZ(3);
    2003             : 
    2004           1 :   hole1glassshape->Rmin(3) = hole1glassshape->GetRmin(1);
    2005           1 :   hole1glassshape->Rmax(3) = hole1glassshape->GetRmin(3);
    2006           1 :   hole1glassshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    2007           1 :                                             hole1glassshape->GetRmax(3));
    2008             :   //
    2009           1 :   TGeoPcon *hole2plastshape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
    2010             : 
    2011           1 :   hole2plastshape->Rmin(0) = hole2shape->GetRmin(0);
    2012           1 :   hole2plastshape->Rmax(0) = hole2shape->GetRmax(0);
    2013           1 :   hole2plastshape->Z(0)    = hole2shape->GetZ(0);
    2014             : 
    2015           1 :   hole2plastshape->Rmin(1) = hole2shape->GetRmin(1);
    2016           1 :   hole2plastshape->Rmax(1) = hole2shape->GetRmax(1);
    2017           1 :   hole2plastshape->Z(1)    = hole2shape->GetZ(1);
    2018             : 
    2019           1 :   dza = hole2plastshape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHolePlasticFrac;
    2020             : 
    2021           1 :   hole2plastshape->Rmin(2) = dza;
    2022           1 :   hole2plastshape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    2023           1 :                                             hole2plastshape->GetRmin(2));
    2024           1 :   hole2plastshape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
    2025           1 :                                             hole2plastshape->GetZ(2));
    2026             : 
    2027           1 :   hole2plastshape->Rmin(3) = hole2plastshape->GetRmin(2);
    2028           1 :   hole2plastshape->Rmax(3) = hole2plastshape->GetRmin(3);
    2029           1 :   hole2plastshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    2030           1 :                                             hole2plastshape->GetRmax(3));
    2031             : 
    2032           1 :   TGeoPcon *hole2Cushape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
    2033             : 
    2034           1 :   hole2Cushape->Rmin(0) = hole2plastshape->GetRmin(2);
    2035           1 :   hole2Cushape->Rmax(0) = hole2Cushape->GetRmin(0);
    2036           1 :   hole2Cushape->Z(0)    = hole2plastshape->GetZ(2);
    2037             : 
    2038           1 :   dza = hole2Cushape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHoleCuFrac;
    2039             : 
    2040           1 :   hole2Cushape->Rmin(1) = dza;
    2041           1 :   hole2Cushape->Rmax(1) = hole2Cushape->GetRmax(0);
    2042           1 :   hole2Cushape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    2043           1 :                                          hole2Cushape->GetRmin(1));
    2044             : 
    2045           1 :   hole2Cushape->Rmax(2) = hole2Cushape->GetRmax(0);
    2046           1 :   hole2Cushape->Rmin(2) = hole2Cushape->GetRmin(1);
    2047           1 :   hole2Cushape->Z(2)    = hole2plastshape->GetZ(3);
    2048             : 
    2049           1 :   hole2Cushape->Rmin(3) = hole2Cushape->GetRmin(1);
    2050           1 :   hole2Cushape->Rmax(3) = hole2Cushape->GetRmin(3);
    2051           1 :   hole2Cushape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    2052           1 :                                          hole2Cushape->GetRmax(3));
    2053             : 
    2054           1 :   TGeoPcon *hole2glassshape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
    2055             : 
    2056           1 :   hole2glassshape->Rmin(0) = hole2Cushape->GetRmin(1);
    2057           1 :   hole2glassshape->Rmax(0) = hole2glassshape->GetRmin(0);
    2058           1 :   hole2glassshape->Z(0)    = hole2Cushape->GetZ(1);
    2059             : 
    2060           1 :   dza = hole2glassshape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHoleGlassFrac;
    2061             : 
    2062           1 :   hole2glassshape->Rmin(1) = dza;
    2063           1 :   hole2glassshape->Rmax(1) = hole2glassshape->GetRmax(0);
    2064           1 :   hole2glassshape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
    2065           1 :                                             hole2glassshape->GetRmin(1));
    2066             : 
    2067           1 :   hole2glassshape->Rmax(2) = hole2glassshape->GetRmax(0);
    2068           1 :   hole2glassshape->Rmin(2) = hole2glassshape->GetRmin(1);
    2069           1 :   hole2glassshape->Z(2)    = hole2Cushape->GetZ(3);
    2070             : 
    2071           1 :   hole2glassshape->Rmin(3) = hole2glassshape->GetRmin(1);
    2072           1 :   hole2glassshape->Rmax(3) = hole2glassshape->GetRmin(3);
    2073           1 :   hole2glassshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
    2074           1 :                                             hole2glassshape->GetRmax(3));
    2075             : 
    2076             : 
    2077             :   // Debug if requested
    2078           1 :   if (GetDebug(1)) {
    2079           0 :     coneshape->InspectShape();
    2080           0 :     coneinsertshape->InspectShape();
    2081           0 :     conefoamshape->InspectShape();
    2082           0 :     hole1shape->InspectShape();
    2083           0 :     hole2shape->InspectShape();
    2084           0 :     hole3shape->InspectShape();
    2085           0 :     hole4shape->InspectShape();
    2086           0 :   }
    2087             : 
    2088             : 
    2089             :   // We have the shapes: now create the real volumes
    2090             : 
    2091           2 :   TGeoVolume *cfcone = new TGeoVolume("SDDCarbonFiberCone",
    2092           1 :                                       coneshape,medSDDcf);
    2093           1 :   cfcone->SetVisibility(kTRUE);
    2094           1 :   cfcone->SetLineColor(4); // Blue
    2095           1 :   cfcone->SetLineWidth(1);
    2096           1 :   cfcone->SetFillColor(cfcone->GetLineColor());
    2097           1 :   cfcone->SetFillStyle(4000); // 0% transparent
    2098             : 
    2099           2 :   TGeoVolume *cfconeinsert = new TGeoVolume("SDDCarbonFiberConeInsert",
    2100           1 :                                             coneinsertshape,medSDDste);
    2101           1 :   cfconeinsert->SetVisibility(kTRUE);
    2102           1 :   cfconeinsert->SetLineColor(2); // Red
    2103           1 :   cfconeinsert->SetLineWidth(1);
    2104           1 :   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
    2105           1 :   cfconeinsert->SetFillStyle(4050); // 50% transparent
    2106             : 
    2107           2 :   TGeoVolume *cfconefoam = new TGeoVolume("SDDCarbonFiberConeFoam",
    2108           1 :                                           conefoamshape,medSDDroh);
    2109           1 :   cfconefoam->SetVisibility(kTRUE);
    2110           1 :   cfconefoam->SetLineColor(7); // Light blue
    2111           1 :   cfconefoam->SetLineWidth(1);
    2112           1 :   cfconefoam->SetFillColor(cfconefoam->GetLineColor());
    2113           1 :   cfconefoam->SetFillStyle(4050); // 50% transparent
    2114             : 
    2115           2 :   TGeoVolume *hole1 = new TGeoVolume("SDDCableHole1",
    2116           1 :                                      hole1shape,medSDDair);
    2117           1 :   hole1->SetVisibility(kTRUE);
    2118           1 :   hole1->SetLineColor(5); // Yellow
    2119           1 :   hole1->SetLineWidth(1);
    2120           1 :   hole1->SetFillColor(hole1->GetLineColor());
    2121           1 :   hole1->SetFillStyle(4090); // 90% transparent
    2122             : 
    2123           2 :   TGeoVolume *hole11 = new TGeoVolume("SDDCableHole11",
    2124           1 :                                       hole11shape,medSDDair);
    2125           1 :   hole11->SetVisibility(kTRUE);
    2126           1 :   hole11->SetLineColor(5); // Yellow
    2127           1 :   hole11->SetLineWidth(1);
    2128           1 :   hole11->SetFillColor(hole11->GetLineColor());
    2129           1 :   hole11->SetFillStyle(4090); // 90% transparent
    2130             : 
    2131           2 :   TGeoVolume *hole12 = new TGeoVolume("SDDCableHole12",
    2132           1 :                                       hole12shape,medSDDair);
    2133           1 :   hole12->SetVisibility(kTRUE);
    2134           1 :   hole12->SetLineColor(5); // Yellow
    2135           1 :   hole12->SetLineWidth(1);
    2136           1 :   hole12->SetFillColor(hole12->GetLineColor());
    2137           1 :   hole12->SetFillStyle(4090); // 90% transparent
    2138             : 
    2139           2 :   TGeoVolume *hole1plast = new TGeoVolume("SDDCableHole1Plast",
    2140           1 :                                           hole1plastshape,medSDDplast);
    2141           1 :   hole1plast->SetVisibility(kTRUE);
    2142           1 :   hole1plast->SetLineColor(kBlue);
    2143           1 :   hole1plast->SetLineWidth(1);
    2144           1 :   hole1plast->SetFillColor(hole1plast->GetLineColor());
    2145           1 :   hole1plast->SetFillStyle(4090); // 90% transparent
    2146             : 
    2147           2 :   TGeoVolume *hole1Cu = new TGeoVolume("SDDCableHole1Cu",
    2148           1 :                                        hole1Cushape,medSDDCu);
    2149           1 :   hole1Cu->SetVisibility(kTRUE);
    2150           1 :   hole1Cu->SetLineColor(kRed);
    2151           1 :   hole1Cu->SetLineWidth(1);
    2152           1 :   hole1Cu->SetFillColor(hole1Cu->GetLineColor());
    2153           1 :   hole1Cu->SetFillStyle(4090); // 90% transparent
    2154             : 
    2155           2 :   TGeoVolume *hole1glass = new TGeoVolume("SDDCableHole1glass",
    2156           1 :                                           hole1glassshape,medSDDglass);
    2157           1 :   hole1glass->SetVisibility(kTRUE);
    2158           1 :   hole1glass->SetLineColor(kGreen);
    2159           1 :   hole1glass->SetLineWidth(1);
    2160           1 :   hole1glass->SetFillColor(hole1glass->GetLineColor());
    2161           1 :   hole1glass->SetFillStyle(4090); // 90% transparent
    2162             : 
    2163           2 :   TGeoVolume *hole2 = new TGeoVolume("SDDCableHole2",
    2164           1 :                                      hole2shape,medSDDair);
    2165           1 :   hole2->SetVisibility(kTRUE);
    2166           1 :   hole2->SetLineColor(5); // Yellow
    2167           1 :   hole2->SetLineWidth(1);
    2168           1 :   hole2->SetFillColor(hole2->GetLineColor());
    2169           1 :   hole2->SetFillStyle(4090); // 90% transparent
    2170             : 
    2171           2 :   TGeoVolume *hole21 = new TGeoVolume("SDDCableHole21",
    2172           1 :                                       hole21shape,medSDDair);
    2173           1 :   hole21->SetVisibility(kTRUE);
    2174           1 :   hole21->SetLineColor(5); // Yellow
    2175           1 :   hole21->SetLineWidth(1);
    2176           1 :   hole21->SetFillColor(hole21->GetLineColor());
    2177           1 :   hole21->SetFillStyle(4090); // 90% transparent
    2178             : 
    2179           2 :   TGeoVolume *hole22 = new TGeoVolume("SDDCableHole22",
    2180           1 :                                       hole22shape,medSDDair);
    2181           1 :   hole22->SetVisibility(kTRUE);
    2182           1 :   hole22->SetLineColor(5); // Yellow
    2183           1 :   hole22->SetLineWidth(1);
    2184           1 :   hole22->SetFillColor(hole22->GetLineColor());
    2185           1 :   hole22->SetFillStyle(4090); // 90% transparent
    2186             : 
    2187           2 :   TGeoVolume *hole2plast = new TGeoVolume("SDDCableHole2Plast",
    2188           1 :                                           hole2plastshape,medSDDplast);
    2189           1 :   hole2plast->SetVisibility(kTRUE);
    2190           1 :   hole2plast->SetLineColor(kBlue);
    2191           1 :   hole2plast->SetLineWidth(1);
    2192           1 :   hole2plast->SetFillColor(hole2plast->GetLineColor());
    2193           1 :   hole2plast->SetFillStyle(4090); // 90% transparent
    2194             : 
    2195           2 :   TGeoVolume *hole2Cu = new TGeoVolume("SDDCableHole2Cu",
    2196           1 :                                        hole2Cushape,medSDDCu);
    2197           1 :   hole2Cu->SetVisibility(kTRUE);
    2198           1 :   hole2Cu->SetLineColor(kRed);
    2199           1 :   hole2Cu->SetLineWidth(1);
    2200           1 :   hole2Cu->SetFillColor(hole2Cu->GetLineColor());
    2201           1 :   hole2Cu->SetFillStyle(4090); // 90% transparent
    2202             : 
    2203           2 :   TGeoVolume *hole2glass = new TGeoVolume("SDDCableHole2glass",
    2204           1 :                                           hole2glassshape,medSDDglass);
    2205           1 :   hole2glass->SetVisibility(kTRUE);
    2206           1 :   hole2glass->SetLineColor(kGreen);
    2207           1 :   hole2glass->SetLineWidth(1);
    2208           1 :   hole2glass->SetFillColor(hole2glass->GetLineColor());
    2209           1 :   hole2glass->SetFillStyle(4090); // 90% transparent
    2210             : 
    2211           2 :   TGeoVolume *hole3 = new TGeoVolume("SDDCableHole3",
    2212           1 :                                      hole3shape,medSDDair);
    2213           1 :   hole3->SetVisibility(kTRUE);
    2214           1 :   hole3->SetLineColor(5); // Yellow
    2215           1 :   hole3->SetLineWidth(1);
    2216           1 :   hole3->SetFillColor(hole3->GetLineColor());
    2217           1 :   hole3->SetFillStyle(4090); // 90% transparent
    2218             : 
    2219           2 :   TGeoVolume *hole31 = new TGeoVolume("SDDCableHole31",
    2220           1 :                                       hole31shape,medSDDair);
    2221           1 :   hole31->SetVisibility(kTRUE);
    2222           1 :   hole31->SetLineColor(5); // Yellow
    2223           1 :   hole31->SetLineWidth(1);
    2224           1 :   hole31->SetFillColor(hole31->GetLineColor());
    2225           1 :   hole31->SetFillStyle(4090); // 90% transparent
    2226             : 
    2227           2 :   TGeoVolume *hole32 = new TGeoVolume("SDDCableHole32",
    2228           1 :                                       hole32shape,medSDDair);
    2229           1 :   hole32->SetVisibility(kTRUE);
    2230           1 :   hole32->SetLineColor(5); // Yellow
    2231           1 :   hole32->SetLineWidth(1);
    2232           1 :   hole32->SetFillColor(hole32->GetLineColor());
    2233           1 :   hole32->SetFillStyle(4090); // 90% transparent
    2234             : 
    2235           2 :   TGeoVolume *hole4 = new TGeoVolume("SDDCableHole4",
    2236           1 :                                      hole4shape,medSDDair);
    2237           1 :   hole4->SetVisibility(kTRUE);
    2238           1 :   hole4->SetLineColor(5); // Yellow
    2239           1 :   hole4->SetLineWidth(1);
    2240           1 :   hole4->SetFillColor(hole4->GetLineColor());
    2241           1 :   hole4->SetFillStyle(4090); // 90% transparent
    2242             : 
    2243             :   // Mount up a cone
    2244           1 :   cfconeinsert->AddNode(cfconefoam,1,0);
    2245             : 
    2246           1 :   hole1->AddNode(hole1plast, 1, 0);
    2247           1 :   hole1->AddNode(hole1Cu, 1, 0);
    2248           1 :   hole1->AddNode(hole1glass, 1, 0);
    2249             : 
    2250           1 :   hole2->AddNode(hole2plast, 1, 0);
    2251           1 :   hole2->AddNode(hole2Cu, 1, 0);
    2252           1 :   hole2->AddNode(hole2glass, 1, 0);
    2253             : 
    2254          26 :   for (Int_t i=0; i<12; i++) {
    2255          12 :     Double_t phiH = i*30.0;
    2256          24 :     cfconefoam->AddNode(hole1 , i+1, new TGeoRotation("", 0, 0, phiH));
    2257          24 :         cfcone->AddNode(hole11, i+1, new TGeoRotation("", 0, 0, phiH));
    2258          24 :         cfcone->AddNode(hole12, i+1, new TGeoRotation("", 0, 0, phiH));
    2259             :   }
    2260             : 
    2261          14 :   for (Int_t i=0; i<6; i++) {
    2262           6 :     Double_t phiH = i*60.0;
    2263          12 :     cfconefoam->AddNode(hole2 , i+1, new TGeoRotation("", 0, 0, phiH));
    2264          12 :         cfcone->AddNode(hole21, i+1, new TGeoRotation("", 0, 0, phiH));
    2265          12 :         cfcone->AddNode(hole22, i+1, new TGeoRotation("", 0, 0, phiH));
    2266             :   }
    2267             : 
    2268          14 :   for (Int_t i=0; i<kNHole3; i++) {
    2269             :     Double_t phiH0 = 360./(Double_t)kNHole3;
    2270           6 :     Double_t phiH  = i*phiH0 + 0.5*phiH0;
    2271          12 :     cfconefoam->AddNode(hole3 , i+1, new TGeoRotation("", phiH, 0, 0));
    2272          12 :         cfcone->AddNode(hole31, i+1, new TGeoRotation("", phiH, 0, 0));
    2273          12 :         cfcone->AddNode(hole32, i+1, new TGeoRotation("", phiH, 0, 0));
    2274             :   }
    2275             : 
    2276           1 :   cfcone->AddNode(cfconeinsert,1,0);
    2277             : 
    2278             : /*
    2279             :   for (Int_t i=0; i<kNHole4; i++) {
    2280             :     Double_t phiH0 = 360./(Double_t)kNHole4;
    2281             :     Double_t phiH  = i*phiH0 + 0.25*phiH0;
    2282             :     cfcone->AddNode(hole4, i+1, new TGeoRotation("", phiH, 0, 0));
    2283             :   }
    2284             : */
    2285             :   // Finally put everything in the mother volume
    2286           1 :   moth->AddNode(cfcylinder,1,0);
    2287             : 
    2288           1 :   z = coneshape->Z(9);
    2289           2 :   moth->AddNode(cfcone,1,new TGeoTranslation(0, 0, -z - kCylinderHalfLength));
    2290           3 :   moth->AddNode(cfcone,2,new TGeoCombiTrans (0, 0,  z + kCylinderHalfLength,
    2291           2 :                          new TGeoRotation("", 0, 180, 0)                   ));
    2292             : 
    2293             : 
    2294             :   return;
    2295           1 : }
    2296             : 
    2297             : //______________________________________________________________________
    2298             : void AliITSv11GeometrySupport::SSDCone(TGeoVolume *moth,const TGeoManager *mgr)
    2299             : {
    2300             : //
    2301             : // Creates the SSD support cone and cylinder geometry. as a
    2302             : // volume assembly and adds it to the mother volume
    2303             : // (part of this code is taken or anyway inspired to SSDCone method
    2304             : // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    2305             : //
    2306             : // Input:
    2307             : //         moth : the TGeoVolume owing the volume structure
    2308             : //         mgr  : the GeoManager (default gGeoManager)
    2309             : // Output:
    2310             : //
    2311             : // Created:         ???       Bjorn S. Nilsen
    2312             : // Updated:      08 Mar 2008  Mario Sitta
    2313             : //
    2314             : // Technical data are taken from:  "ITS Supporto Generale" (technical
    2315             : // drawings ALR3-0743/1, ALR3-0743/1A and ALR3-0743/1B), "Supporto Generale
    2316             : // Settore SSD" (technical drawings ALR3-0743/2A and ALR3-0743/2E), private
    2317             : // communication with B. Giraudo
    2318             : //
    2319             : // Updated:      11 Apr 2008  Mario Sitta
    2320             : // Measures from drawings give overlaps with SPD thermal shield wings,
    2321             : // so the terminal part of the SSD cone was reduced
    2322             : //
    2323             : // Updated:      30 Mar 2010  Mario Sitta
    2324             : // Following M. van Leeuwen's suggestion on material budget, the thickness
    2325             : // of the carbon fiber cylinder was increased from 0.6 to 0.625mm
    2326             : 
    2327             :   // Dimensions of the Central cylinder and flanges
    2328           2 :   const Double_t kCylinderHalfLength   = (1143.6/2) *fgkmm;
    2329           1 :   const Double_t kCylinderOuterRadius  = ( 595.0/2) *fgkmm;
    2330           1 :   const Double_t kCylinderThickness    =       0.625*fgkmm;
    2331           1 :   const Double_t kFoamHalfLength       = (1020.0/2) *fgkmm;
    2332           1 :   const Double_t kFoamThickness        =        5.0 *fgkmm;
    2333             :   const Double_t kFlangeHalfLength     =
    2334           1 :                                       (kCylinderHalfLength-kFoamHalfLength)/2.;
    2335           1 :   const Double_t kFlangeInnerRadius    = ( 563.0/2) *fgkmm;
    2336             :   // Dimensions of the Cone
    2337           1 :   const Double_t kConeROuterMin        = ( 957.0/2) *fgkmm;
    2338           1 :   const Double_t kConeROuterMax        = ( 997.0/2) *fgkmm;
    2339           1 :   const Double_t kConeRInnerMin        = ( 564.0/2) *fgkmm;
    2340           1 :   const Double_t kConeRCurv1           =       10.0 *fgkmm;
    2341           1 :   const Double_t kConeRCurv2           =       25.0 *fgkmm;
    2342           1 :   const Double_t kConeCent1RCurv2      = ( 578.0/2) *fgkmm;
    2343           1 :   const Double_t kConeCent2RCurv2      = ( 592.0/2) *fgkmm;
    2344             : //  const Double_t kConeZOuterRing       =       47.0 *fgkmm;
    2345             : //  const Double_t kConeZOuterRingInside =       30.25*fgkmm;
    2346             : //  const Double_t kConeZInnerRing       =      161.5 *fgkmm;
    2347             : //  const Double_t kConeZLength          =      176.5 *fgkmm;
    2348           1 :   const Double_t kConeZOuterRing       =       38.5 *fgkmm;
    2349           1 :   const Double_t kConeZOuterRingInside =       22.2 *fgkmm;
    2350           1 :   const Double_t kConeZInnerRing       =      153.0 *fgkmm;
    2351           1 :   const Double_t kConeZLength          =      168.0 *fgkmm;
    2352           1 :   const Double_t kConeZPosition        = kConeZLength + kCylinderHalfLength;
    2353           1 :   const Double_t kConeThickness        =       13.0 *fgkmm; // Cone thickness
    2354           1 :   const Double_t kConeTheta            =       39.1 *fgkDegree; // Cone angle
    2355             :   const Double_t kSinConeTheta         =
    2356           1 :                                       TMath::Sin(kConeTheta*TMath::DegToRad());
    2357             :   const Double_t kCosConeTheta         =
    2358           1 :                                       TMath::Cos(kConeTheta*TMath::DegToRad());
    2359             :   // Dimensions of the Foam cores
    2360           1 :   const Double_t kConeFoam1Length      =      112.3 *fgkmm;
    2361           1 :   const Double_t kConeFoam2Length      =       58.4 *fgkmm;
    2362             :   // Dimensions of the Cone Holes
    2363           1 :   const Double_t kCoolingHoleWidth     =       40.0 *fgkmm;
    2364           1 :   const Double_t kCoolingHoleHight     =       30.0 *fgkmm;
    2365           1 :   const Double_t kCoolingHoleRmin      =      350.0 *fgkmm;
    2366           1 :   const Double_t kCoolingHolePhi       =       45.0 *fgkDegree;
    2367           1 :   const Double_t kMountingHoleWidth    =       20.0 *fgkmm;
    2368             :   const Double_t kMountingHoleHight    =       20.0 *fgkmm;
    2369           1 :   const Double_t kMountingHoleRmin     =      317.5 *fgkmm;
    2370           1 :   const Double_t kMountingHolePhi      =       60.0 *fgkDegree;
    2371           1 :   const Double_t kCableHoleRin         = ( 800.0/2) *fgkmm;
    2372           1 :   const Double_t kCableHoleRout        = ( 920.0/2) *fgkmm;
    2373           1 :   const Double_t kCableHoleWidth       =      200.0 *fgkmm;
    2374             : //  const Double_t kCableHoleAngle       =       42.0 *fgkDegree;
    2375             :   // Dimensions of the Cone Wings
    2376           1 :   const Double_t kWingRmax             =      527.5 *fgkmm;
    2377           1 :   const Double_t kWingWidth            =       70.0 *fgkmm;
    2378           1 :   const Double_t kWingHalfThick        = (  10.0/2) *fgkmm;
    2379             :   const Double_t kThetaWing            =       45.0 *fgkDegree;
    2380             :   // Dimensions of the SSD-SDD Mounting Brackets
    2381           1 :   const Double_t kBracketRmin          = ( 541.0/2) *fgkmm;// See SDD ROutMin
    2382           1 :   const Double_t kBracketRmax          = ( 585.0/2) *fgkmm;
    2383           1 :   const Double_t kBracketHalfLength    = (   4.0/2) *fgkmm;
    2384           1 :   const Double_t kBracketPhi           = (70.*fgkmm/kBracketRmax)*fgkRadian;
    2385             :   // Common data
    2386           1 :   const Double_t kCFThickness          =        0.75*fgkmm; //Carb. fib. thick.
    2387             : 
    2388             : 
    2389             :   // Local variables
    2390           1 :   Double_t rmin1, rmin2, rmax, z;
    2391             : 
    2392             :   //
    2393             :   //Begin_Html
    2394             :   /*
    2395             :     <img src="picts/ITS/file_name.gif">
    2396             :     <P>
    2397             :     <FONT FACE'"TIMES">
    2398             :     ITS SSD central support and thermal shield cylinder.
    2399             :     </FONT>
    2400             :     </P>
    2401             :   */
    2402             :   //End_Html
    2403             :   //
    2404             : 
    2405             :   // Central cylinder with its internal foam and the lateral flanges:
    2406             :   // a carbon fiber Pcon which contains a rohacell Tube and two
    2407             :   // stesalite Cone's
    2408           1 :   TGeoPcon *externalcylshape = new TGeoPcon(0,360,4);
    2409             : 
    2410           1 :   rmax  = kCylinderOuterRadius;
    2411           1 :   rmin1 = kFlangeInnerRadius - kCylinderThickness;
    2412           1 :   rmin2 = rmax - 2*kCylinderThickness - kFoamThickness;
    2413           1 :   externalcylshape->DefineSection(0,-kCylinderHalfLength,rmin1,rmax);
    2414           1 :   externalcylshape->DefineSection(1,-kFoamHalfLength    ,rmin2,rmax);
    2415           1 :   externalcylshape->DefineSection(2, kFoamHalfLength    ,rmin2,rmax);
    2416           1 :   externalcylshape->DefineSection(3, kCylinderHalfLength,rmin1,rmax);
    2417             : 
    2418           1 :   rmax  = kCylinderOuterRadius - kCylinderThickness;
    2419           1 :   rmin1 = rmax - kFoamThickness;
    2420           1 :   TGeoTube *foamshape = new TGeoTube(rmin1,rmax,kFoamHalfLength);
    2421             : 
    2422           1 :   rmax  = kCylinderOuterRadius - kCylinderThickness;
    2423           1 :   rmin1 = rmax - kFoamThickness;
    2424             :   rmin2 = kFlangeInnerRadius;
    2425           2 :   TGeoCone *flangeshape = new TGeoCone(kFlangeHalfLength,
    2426           1 :                                        rmin1,rmax,rmin2,rmax);
    2427             : 
    2428             : 
    2429             :   // We have the shapes: now create the real volumes
    2430             : 
    2431           1 :   TGeoMedium *medSSDcf  = mgr->GetMedium("ITS_SSD C (M55J)$");
    2432           1 :   TGeoMedium *medSSDair = mgr->GetMedium("ITS_SSD AIR$");
    2433           1 :   TGeoMedium *medSSDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
    2434           1 :   TGeoMedium *medSSDroh = mgr->GetMedium("ITS_ROHACELL$");
    2435           1 :   TGeoMedium *medSSDal  = mgr->GetMedium("ITS_ALUMINUM$");
    2436             : 
    2437           2 :   TGeoVolume *cfcylinder = new TGeoVolume("SSDexternalcylinder",
    2438           1 :                                            externalcylshape,medSSDcf);
    2439           1 :   cfcylinder->SetVisibility(kTRUE);
    2440           1 :   cfcylinder->SetLineColor(4); // blue
    2441           1 :   cfcylinder->SetLineWidth(1);
    2442           1 :   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
    2443           1 :   cfcylinder->SetFillStyle(4000); // 0% transparent
    2444             : 
    2445           2 :   TGeoVolume *foamcylinder = new TGeoVolume("SSDfoamcylinder",
    2446           1 :                                             foamshape,medSSDroh);
    2447           1 :   foamcylinder->SetVisibility(kTRUE);
    2448           1 :   foamcylinder->SetLineColor(3); // green
    2449           1 :   foamcylinder->SetLineWidth(1);
    2450           1 :   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
    2451           1 :   foamcylinder->SetFillStyle(4050); // 50% transparent
    2452             : 
    2453           2 :   TGeoVolume *flangecylinder = new TGeoVolume("SSDflangecylinder",
    2454           1 :                                               flangeshape,medSSDste);
    2455           1 :   flangecylinder->SetVisibility(kTRUE);
    2456           1 :   flangecylinder->SetLineColor(2); // red
    2457           1 :   flangecylinder->SetLineWidth(1);
    2458           1 :   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
    2459           1 :   flangecylinder->SetFillStyle(4050); // 50% transparent
    2460             : 
    2461             :   // Mount up the cylinder
    2462           1 :   cfcylinder->AddNode(foamcylinder,1,0);
    2463           2 :   cfcylinder->AddNode(flangecylinder,1,
    2464           2 :               new TGeoTranslation(0, 0, kFoamHalfLength+kFlangeHalfLength));
    2465           3 :   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
    2466           1 :               0, 0, -kFoamHalfLength-kFlangeHalfLength,
    2467           2 :               new TGeoRotation("",0,180,0)     ) );
    2468             : 
    2469             : 
    2470             :   // The whole Cone as an assembly
    2471           1 :   TGeoVolumeAssembly *vC = new TGeoVolumeAssembly("ITSssdCone");
    2472             : 
    2473             : 
    2474             :   // SSD Support Cone with its internal inserts: a carbon fiber Pcon
    2475             :   // with holes which contains a stesalite Pcon which on turn contains a
    2476             :   // rohacell Pcon
    2477           1 :   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 12);
    2478             : 
    2479           1 :   coneshape->Z(0)     = 0.0;
    2480           1 :   coneshape->Rmin(0)  = kConeROuterMin;
    2481           1 :   coneshape->Rmax(0)  = kConeROuterMax;
    2482             : 
    2483           1 :   coneshape->Z(1)     = kConeZOuterRingInside - kConeRCurv1;
    2484           1 :   coneshape->Rmin(1)  = coneshape->GetRmin(0);
    2485           1 :   coneshape->Rmax(1)  = coneshape->GetRmax(0);
    2486             : 
    2487           1 :   coneshape->Z(2)     = kConeZOuterRingInside;
    2488           1 :   coneshape->Rmin(2)  = coneshape->GetRmin(1) - kConeRCurv1;
    2489           1 :   coneshape->Rmax(2)  = coneshape->GetRmax(0);
    2490             : 
    2491           1 :   coneshape->Z(3)     = coneshape->GetZ(2);
    2492           1 :   coneshape->Rmax(3)  = coneshape->GetRmax(0);
    2493             : 
    2494           1 :   coneshape->Z(4)     = kConeZOuterRing - kConeRCurv1;
    2495           1 :   coneshape->Rmax(4)  = coneshape->GetRmax(0);
    2496             : 
    2497           1 :   coneshape->Z(5)     = kConeZOuterRing;
    2498           1 :   coneshape->Rmax(5)  = coneshape->GetRmax(4) - kConeRCurv1;
    2499             : 
    2500           1 :   coneshape->Z(6)     = coneshape->GetZ(5);
    2501             : 
    2502           2 :   RadiusOfCurvature(kConeRCurv2,90.0,kConeZInnerRing,kConeCent1RCurv2,
    2503           1 :                     90.0-kConeTheta,z,rmin1);
    2504           1 :   coneshape->Z(7)     = z;
    2505           1 :   coneshape->Rmin(7)  = rmin1;
    2506             : 
    2507           1 :   coneshape->Rmin(3)  = RminFromZpCone(coneshape,7,90.-kConeTheta,
    2508           1 :                                        coneshape->GetZ(3));
    2509             : 
    2510           1 :   coneshape->Rmin(4)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(4));
    2511             : 
    2512           1 :   coneshape->Rmin(5)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(5));
    2513             : 
    2514           1 :   coneshape->Rmin(6) = coneshape->GetRmin(5);
    2515             : 
    2516           1 :   coneshape->Z(8)     = kConeZInnerRing;
    2517           1 :   coneshape->Rmin(8)  = kConeCent1RCurv2;
    2518             : 
    2519           1 :   coneshape->Z(9)     = coneshape->GetZ(8);
    2520           1 :   coneshape->Rmin(9)  = kConeRInnerMin;
    2521             : 
    2522           1 :   RadiusOfCurvature(kConeRCurv2,90.0,kConeZLength,kConeCent2RCurv2,
    2523             :                     90.0-kConeTheta,z,rmax);
    2524             : 
    2525           1 :   coneshape->Z(10)    = z;
    2526           1 :   coneshape->Rmin(10) = coneshape->GetRmin(9);
    2527           1 :   coneshape->Rmax(10) = rmax;
    2528             : 
    2529           1 :   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,10,90.-kConeTheta,
    2530           1 :                                        coneshape->GetZ(6));
    2531             : 
    2532           1 :   coneshape->Rmax(7)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(7));
    2533             : 
    2534           1 :   coneshape->Rmax(8)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(8));
    2535             : 
    2536           1 :   coneshape->Rmax(9)  = coneshape->GetRmax(8);
    2537             : 
    2538           1 :   coneshape->Z(11)    = kConeZLength;
    2539           1 :   coneshape->Rmin(11) = coneshape->GetRmin(10);
    2540           1 :   coneshape->Rmax(11) = kConeCent2RCurv2;
    2541             : 
    2542             :   // SSD Cone Insert: another Pcon
    2543             :   Double_t x0, y0, x1, y1, x2, y2;
    2544           1 :   TGeoPcon *coneinsertshape = new TGeoPcon(0.0,360.0,12);
    2545             : 
    2546           1 :   coneinsertshape->Z(0)     = coneshape->GetZ(0) + kCFThickness;
    2547           1 :   coneinsertshape->Rmin(0)  = coneshape->GetRmin(0) + kCFThickness;
    2548           1 :   coneinsertshape->Rmax(0)  = coneshape->GetRmax(0) - kCFThickness;
    2549             : 
    2550           1 :   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
    2551           1 :   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
    2552           1 :   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
    2553           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
    2554           1 :   coneinsertshape->Z(1)     = z;
    2555           1 :   coneinsertshape->Rmin(1)  = rmin1;
    2556           1 :   coneinsertshape->Rmax(1)  = coneinsertshape->GetRmax(0);
    2557             : 
    2558           1 :   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmin(1);
    2559           1 :   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmin(2);
    2560           1 :   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmin(3);
    2561           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
    2562           1 :   coneinsertshape->Z(2)     = z;
    2563           1 :   coneinsertshape->Rmin(2)  = rmin1;
    2564           1 :   coneinsertshape->Rmax(2)  = coneinsertshape->GetRmax(1);
    2565             : 
    2566           1 :   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
    2567           1 :   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
    2568           1 :   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
    2569           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
    2570           1 :   coneinsertshape->Z(3)     = z;
    2571           1 :   coneinsertshape->Rmin(3)  = rmin1;
    2572           1 :   coneinsertshape->Rmax(3)  = coneinsertshape->GetRmax(2);
    2573             : 
    2574           1 :   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
    2575           1 :   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
    2576           1 :   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
    2577           1 :   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
    2578           1 :   coneinsertshape->Z(4)     = z;
    2579           1 :   coneinsertshape->Rmax(4)  = rmax;
    2580             : 
    2581           1 :   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmax(4);
    2582           1 :   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmax(5);
    2583           1 :   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmax(6);
    2584           1 :   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
    2585           1 :   coneinsertshape->Z(5)     = z;
    2586           1 :   coneinsertshape->Rmax(5)  = rmax;
    2587             : 
    2588           1 :   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmax(5);
    2589           1 :   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmax(6);
    2590           1 :   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmax(7);
    2591           1 :   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
    2592           1 :   coneinsertshape->Z(6)     = z;
    2593           1 :   coneinsertshape->Rmax(6)  = rmax;
    2594             : 
    2595           1 :   x0 = coneshape->GetZ(6); y0 = coneshape->GetRmin(6);
    2596           1 :   x1 = coneshape->GetZ(7); y1 = coneshape->GetRmin(7);
    2597           1 :   x2 = coneshape->GetZ(8); y2 = coneshape->GetRmin(8);
    2598           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
    2599           1 :   coneinsertshape->Z(7)     = z;
    2600           1 :   coneinsertshape->Rmin(7)  = rmin1;
    2601             : 
    2602           1 :   coneinsertshape->Rmin(4)  = RminFrom2Points(coneinsertshape,3,7,
    2603           1 :                                               coneinsertshape->GetZ(4));
    2604             : 
    2605           1 :   coneinsertshape->Rmin(5)  = RminFrom2Points(coneinsertshape,3,7,
    2606           1 :                                               coneinsertshape->GetZ(5));
    2607             : 
    2608           1 :   coneinsertshape->Rmin(6)  = coneinsertshape->GetRmin(5);
    2609             : 
    2610           1 :   x0 = coneshape->GetZ(7); y0 = coneshape->GetRmin(7);
    2611           1 :   x1 = coneshape->GetZ(8); y1 = coneshape->GetRmin(8);
    2612           1 :   x2 = coneshape->GetZ(9); y2 = coneshape->GetRmin(9);
    2613           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
    2614           1 :   coneinsertshape->Z(8)     = z;
    2615           1 :   coneinsertshape->Rmin(8)  = rmin1;
    2616             : 
    2617           1 :   x0 = coneshape->GetZ( 8); y0 = coneshape->GetRmin( 8);
    2618           1 :   x1 = coneshape->GetZ( 9); y1 = coneshape->GetRmin( 9);
    2619           1 :   x2 = coneshape->GetZ(10); y2 = coneshape->GetRmin(10);
    2620           1 :   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
    2621           1 :   coneinsertshape->Z(9)     = z;
    2622           1 :   coneinsertshape->Rmin(9)  = rmin1;
    2623             : 
    2624           1 :   x0 = coneshape->GetZ( 9); y0 = coneshape->GetRmax( 9);
    2625           1 :   x1 = coneshape->GetZ(10); y1 = coneshape->GetRmax(10);
    2626           1 :   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmax(11);
    2627           1 :   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
    2628           1 :   coneinsertshape->Z(10)    = z;
    2629           1 :   coneinsertshape->Rmax(10) = rmax;
    2630           1 :   coneinsertshape->Rmin(10) = coneinsertshape->GetRmin(9);
    2631             : 
    2632           1 :   coneinsertshape->Rmax(7)  = RmaxFrom2Points(coneinsertshape,6,10,
    2633           1 :                                               coneinsertshape->GetZ(7));
    2634             : 
    2635           1 :   coneinsertshape->Rmax(8)  = RmaxFrom2Points(coneinsertshape,6,10,
    2636           1 :                                               coneinsertshape->GetZ(8));
    2637             : 
    2638           1 :   coneinsertshape->Rmax(9)  = coneinsertshape->GetRmax(8);
    2639             : 
    2640           1 :   x0 = coneshape->GetZ(10); y0 = coneshape->GetRmax(10);
    2641           1 :   x1 = coneshape->GetZ(11); y1 = coneshape->GetRmax(11);
    2642           1 :   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmin(11);
    2643           1 :   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
    2644           1 :   coneinsertshape->Z(11)    = z;
    2645           1 :   coneinsertshape->Rmax(11) = rmax;
    2646           1 :   coneinsertshape->Rmin(11) = coneinsertshape->GetRmin(10);
    2647             : 
    2648             :   // SSD Cone Foams: two other Pcon's
    2649           1 :   TGeoPcon *conefoam1shape = new TGeoPcon(0.0, 360.0, 4);
    2650             : 
    2651           1 :   conefoam1shape->Z(0)    = coneinsertshape->GetZ(3);
    2652           1 :   conefoam1shape->Rmin(0) = coneinsertshape->GetRmin(3);
    2653           1 :   conefoam1shape->Rmax(0) = conefoam1shape->GetRmin(0);
    2654             : 
    2655           1 :   conefoam1shape->Rmax(1) = conefoam1shape->GetRmax(0);
    2656           1 :   conefoam1shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
    2657           1 :                                            conefoam1shape->GetRmax(1));
    2658           1 :   conefoam1shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
    2659           1 :                                            conefoam1shape->GetZ(1));
    2660             : 
    2661           1 :   Double_t t = kConeThickness - 2*kCFThickness;
    2662           2 :   conefoam1shape->Rmin(2) = conefoam1shape->GetRmax(0) -
    2663           1 :                            (kConeFoam1Length*kCosConeTheta - t*kSinConeTheta);
    2664           1 :   conefoam1shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
    2665           1 :                                            conefoam1shape->GetRmin(2));
    2666           1 :   conefoam1shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
    2667           1 :                                            conefoam1shape->GetZ(2));
    2668             : 
    2669           1 :   conefoam1shape->Rmin(3) = conefoam1shape->GetRmin(2);
    2670           1 :   conefoam1shape->Rmax(3) = conefoam1shape->GetRmin(3);
    2671           1 :   conefoam1shape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
    2672           1 :                                            conefoam1shape->GetRmax(3));
    2673             : 
    2674           1 :   TGeoPcon *conefoam2shape = new TGeoPcon(0.0, 360.0, 4);
    2675             : 
    2676           1 :   conefoam2shape->Z(3)    = coneinsertshape->GetZ(10);
    2677           1 :   conefoam2shape->Rmin(3) = coneinsertshape->GetRmax(10);
    2678           1 :   conefoam2shape->Rmax(3) = conefoam2shape->GetRmin(3);
    2679             : 
    2680           1 :   conefoam2shape->Rmin(2) = conefoam2shape->GetRmin(3);
    2681           1 :   conefoam2shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
    2682           1 :                                            conefoam2shape->GetRmin(2));
    2683           1 :   conefoam2shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
    2684           1 :                                            conefoam2shape->GetZ(2));
    2685             : 
    2686           2 :   conefoam2shape->Rmin(0) = conefoam2shape->GetRmax(2) +
    2687           1 :                            (kConeFoam2Length*kCosConeTheta - t*kSinConeTheta);
    2688           1 :   conefoam2shape->Rmax(0) = conefoam2shape->GetRmin(0);
    2689           1 :   conefoam2shape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
    2690           1 :                                            conefoam2shape->GetRmin(0));
    2691             : 
    2692           1 :   conefoam2shape->Rmax(1) = conefoam2shape->GetRmax(0);
    2693           1 :   conefoam2shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
    2694           1 :                                            conefoam2shape->GetRmax(1));
    2695           1 :   conefoam2shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
    2696           1 :                                            conefoam2shape->GetZ(1));
    2697             : 
    2698             :   // SSD Cone Holes: Pcon's
    2699             :   // A single hole volume gives an overlap with coneinsert, so
    2700             :   // three contiguous volumes are created: one to be put in coneinsert
    2701             :   // and two in the cone carbon fiber envelope
    2702             :   Double_t holePhi;
    2703           1 :   holePhi = (kCoolingHoleWidth/kCoolingHoleRmin)*TMath::RadToDeg();
    2704             : 
    2705           1 :   TGeoPcon *coolingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
    2706             : 
    2707           1 :   coolingholeshape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
    2708           1 :   coolingholeshape->Rmax(0) = coolingholeshape->GetRmin(0);
    2709           1 :   coolingholeshape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
    2710           1 :                                              coolingholeshape->GetRmin(0));
    2711             : 
    2712           1 :   coolingholeshape->Rmax(1) = coolingholeshape->GetRmax(0);
    2713           1 :   coolingholeshape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
    2714           1 :                                              coolingholeshape->GetRmax(1));
    2715           1 :   coolingholeshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
    2716           1 :                                              coolingholeshape->GetZ(1));
    2717             : 
    2718           1 :   coolingholeshape->Rmin(2) = kCoolingHoleRmin;
    2719           1 :   coolingholeshape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
    2720           1 :                                              coolingholeshape->GetRmin(2));
    2721           1 :   coolingholeshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
    2722           1 :                                              coolingholeshape->GetZ(2));
    2723             : 
    2724           1 :   coolingholeshape->Rmin(3) = coolingholeshape->GetRmin(2);
    2725           1 :   coolingholeshape->Rmax(3) = coolingholeshape->GetRmin(3);
    2726           1 :   coolingholeshape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
    2727           1 :                                              coolingholeshape->GetRmax(3));
    2728             : 
    2729           1 :   TGeoPcon *coolinghole2shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    2730             : 
    2731           1 :   coolinghole2shape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
    2732           1 :   coolinghole2shape->Rmax(0) = coolinghole2shape->GetRmin(0);
    2733           1 :   coolinghole2shape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
    2734           1 :                                               coolinghole2shape->GetRmin(0));
    2735             : 
    2736           1 :   coolinghole2shape->Rmax(1) = coolinghole2shape->GetRmax(0);
    2737           1 :   coolinghole2shape->Z(1)    = coolingholeshape->GetZ(0);
    2738           1 :   coolinghole2shape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
    2739           1 :                                               coolinghole2shape->GetZ(1));
    2740             : 
    2741           1 :   coolinghole2shape->Rmin(2) = kCoolingHoleRmin;
    2742           1 :   coolinghole2shape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
    2743           1 :                                               coolinghole2shape->GetRmin(2));
    2744           1 :   coolinghole2shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
    2745           1 :                                               coolinghole2shape->GetZ(2));
    2746             : 
    2747           1 :   coolinghole2shape->Rmin(3) = coolinghole2shape->GetRmin(2);
    2748           1 :   coolinghole2shape->Rmax(3) = coolinghole2shape->GetRmin(3);
    2749           1 :   coolinghole2shape->Z(3)    = coolingholeshape->GetZ(2);
    2750             : 
    2751           1 :   TGeoPcon *coolinghole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    2752             : 
    2753           1 :   coolinghole3shape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
    2754           1 :   coolinghole3shape->Rmax(0) = coolinghole3shape->GetRmin(0);
    2755           1 :   coolinghole3shape->Z(0)    = coolingholeshape->GetZ(1);
    2756             : 
    2757           1 :   coolinghole3shape->Rmax(1) = coolinghole3shape->GetRmax(0);
    2758           1 :   coolinghole3shape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
    2759           1 :                                               coolinghole3shape->GetRmax(1));
    2760           1 :   coolinghole3shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
    2761           1 :                                               coolinghole3shape->GetZ(1));
    2762             : 
    2763           1 :   coolinghole3shape->Rmin(2) = kCoolingHoleRmin;
    2764           1 :   coolinghole3shape->Z(2)    = coolingholeshape->GetZ(3);
    2765           1 :   coolinghole3shape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
    2766           1 :                                               coolinghole3shape->GetZ(2));
    2767             : 
    2768           1 :   coolinghole3shape->Rmin(3) = coolinghole3shape->GetRmin(2);
    2769           1 :   coolinghole3shape->Rmax(3) = coolinghole3shape->GetRmin(3);
    2770           1 :   coolinghole3shape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
    2771           1 :                                               coolinghole3shape->GetRmax(3));
    2772             : 
    2773             :   //
    2774           1 :   holePhi = (kMountingHoleWidth/kMountingHoleRmin)*TMath::RadToDeg();
    2775             : 
    2776           1 :   TGeoPcon *mountingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
    2777             : 
    2778           1 :   mountingholeshape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
    2779           1 :   mountingholeshape->Rmax(0) = mountingholeshape->GetRmin(0);
    2780           1 :   mountingholeshape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
    2781           1 :                                               mountingholeshape->GetRmin(0));
    2782             : 
    2783           1 :   mountingholeshape->Rmin(1) = kMountingHoleRmin;
    2784           1 :   mountingholeshape->Rmax(1) = mountingholeshape->GetRmax(0);
    2785           1 :   mountingholeshape->Z(1)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
    2786           1 :                                               mountingholeshape->GetRmin(1));
    2787             : 
    2788           1 :   mountingholeshape->Rmin(2) = mountingholeshape->GetRmin(1);
    2789           1 :   mountingholeshape->Rmax(2) = mountingholeshape->GetRmax(1);
    2790           1 :   mountingholeshape->Z(2)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
    2791           1 :                                               mountingholeshape->GetRmax(2));
    2792             : 
    2793           1 :   mountingholeshape->Rmin(3) = mountingholeshape->GetRmin(2);
    2794           1 :   mountingholeshape->Rmax(3) = mountingholeshape->GetRmin(3);
    2795           1 :   mountingholeshape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
    2796           1 :                                               mountingholeshape->GetRmax(3));
    2797             : 
    2798           1 :   TGeoPcon *mountinghole2shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    2799             : 
    2800           1 :   mountinghole2shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
    2801           1 :   mountinghole2shape->Rmax(0) = mountingholeshape->GetRmin(0);
    2802           1 :   mountinghole2shape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
    2803           1 :                                                mountinghole2shape->GetRmin(0));
    2804             : 
    2805           1 :   mountinghole2shape->Rmax(1) = mountinghole2shape->GetRmax(0);
    2806           1 :   mountinghole2shape->Z(1)    = mountingholeshape->Z(0);
    2807           1 :   mountinghole2shape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
    2808           1 :                                                mountinghole2shape->GetZ(1));
    2809             : 
    2810           1 :   mountinghole2shape->Rmin(2) = kMountingHoleRmin;
    2811           1 :   mountinghole2shape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
    2812           1 :                                                mountinghole2shape->GetRmin(2));
    2813           1 :   mountinghole2shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
    2814           1 :                                                mountinghole2shape->GetZ(2));
    2815             : 
    2816           1 :   mountinghole2shape->Rmin(3) = mountinghole2shape->Rmin(2);
    2817           1 :   mountinghole2shape->Rmax(3) = mountinghole2shape->Rmin(3);
    2818           1 :   mountinghole2shape->Z(3)    = mountingholeshape->Z(1);
    2819             : 
    2820           1 :   TGeoPcon *mountinghole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
    2821             : 
    2822           1 :   mountinghole3shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
    2823           1 :   mountinghole3shape->Rmax(0) = mountingholeshape->GetRmin(0);
    2824           1 :   mountinghole3shape->Z(0)    = mountingholeshape->GetZ(2);
    2825             : 
    2826           1 :   mountinghole3shape->Rmax(1) = mountinghole3shape->GetRmax(0);
    2827           1 :   mountinghole3shape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
    2828           1 :                                                mountinghole3shape->GetRmax(1));
    2829           1 :   mountinghole3shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
    2830           1 :                                                mountinghole3shape->GetZ(1));
    2831             : 
    2832           1 :   mountinghole3shape->Rmin(2) = kMountingHoleRmin;
    2833           1 :   mountinghole3shape->Z(2)    = mountingholeshape->Z(3);
    2834           1 :   mountinghole3shape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
    2835           1 :                                                mountinghole3shape->GetZ(2));
    2836             : 
    2837           1 :   mountinghole3shape->Rmin(3) = mountinghole3shape->Rmin(2);
    2838           1 :   mountinghole3shape->Rmax(3) = mountinghole3shape->Rmin(3);
    2839           1 :   mountinghole3shape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
    2840           1 :                                                mountinghole3shape->GetRmax(3));
    2841             : 
    2842             :   // The Cable Hole is even more complicated, a Composite Shape
    2843             :   // is unavoidable here (gosh!)
    2844           1 :   TGeoPcon *coneshapecopy = new TGeoPcon("conecopy",0.0, 360.0, 12);
    2845             : 
    2846          26 :   for (Int_t i=0; i<12; i++) {
    2847          12 :     coneshapecopy->Rmin(i) = coneshape->GetRmin(i);
    2848          12 :     coneshapecopy->Rmax(i) = coneshape->GetRmax(i);
    2849          12 :     coneshapecopy->Z(i)    = coneshape->GetZ(i);
    2850             :   }
    2851             : 
    2852           1 :   holePhi = (kCableHoleWidth/kCableHoleRout)*TMath::RadToDeg();
    2853           2 :   TGeoConeSeg *chCS = new TGeoConeSeg("chCS", 0.5*kConeZLength,
    2854             :                                       kCableHoleRin, kCableHoleRout,
    2855             :                                       kCableHoleRin, kCableHoleRout,
    2856           1 :                                       -0.5*holePhi, 0.5*holePhi);
    2857             : 
    2858           1 :   TGeoCompositeShape *cableholeshape = new TGeoCompositeShape(
    2859             :                                            "SSDCableHoleShape",
    2860             :                                            "conecopy*chCS");
    2861             : 
    2862           1 :   if(GetDebug(1)){
    2863           0 :     chCS->InspectShape();
    2864           0 :     cableholeshape->InspectShape();
    2865           0 :   }
    2866             : 
    2867             :   // SSD Cone Wings: Tube and TubeSeg shapes
    2868             :   Double_t angleWideWing, angleWideWingThickness;
    2869           1 :   angleWideWing = (kWingWidth/kWingRmax)*TMath::RadToDeg();
    2870           1 :   angleWideWingThickness = (kCFThickness/kWingRmax)*TMath::RadToDeg();
    2871             : 
    2872           1 :   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kConeROuterMax, kWingRmax,
    2873             :                                            kWingHalfThick,
    2874             :                                            0, angleWideWing);
    2875             : 
    2876           2 :   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kConeROuterMax,
    2877           1 :                                  kWingRmax-kCFThickness,
    2878           1 :                                  kWingHalfThick-kCFThickness,
    2879             :                                  angleWideWingThickness,
    2880           1 :                                  angleWideWing-angleWideWingThickness);
    2881             : 
    2882             :   // SDD support plate, SSD side (Mounting Bracket): a TubeSeg
    2883           2 :   TGeoTubeSeg *bracketshape = new TGeoTubeSeg(kBracketRmin, kBracketRmax,
    2884           1 :                             kBracketHalfLength, -kBracketPhi/2, kBracketPhi/2);
    2885             : 
    2886             : 
    2887             :   // We have the shapes: now create the real volumes
    2888             : 
    2889           2 :   TGeoVolume *cfcone = new TGeoVolume("SSDCarbonFiberCone",
    2890           1 :                                       coneshape,medSSDcf);
    2891           1 :   cfcone->SetVisibility(kTRUE);
    2892           1 :   cfcone->SetLineColor(4); // Blue
    2893           1 :   cfcone->SetLineWidth(1);
    2894           1 :   cfcone->SetFillColor(cfcone->GetLineColor());
    2895           1 :   cfcone->SetFillStyle(4000); // 0% transparent
    2896             : 
    2897           2 :   TGeoVolume *cfconeinsert = new TGeoVolume("SSDCarbonFiberConeInsert",
    2898           1 :                                             coneinsertshape,medSSDste);
    2899           1 :   cfconeinsert->SetVisibility(kTRUE);
    2900           1 :   cfconeinsert->SetLineColor(2); // Red
    2901           1 :   cfconeinsert->SetLineWidth(1);
    2902           1 :   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
    2903           1 :   cfconeinsert->SetFillStyle(4050); // 50% transparent
    2904             : 
    2905           2 :   TGeoVolume *cfconefoam1 = new TGeoVolume("SSDCarbonFiberConeFoam1",
    2906           1 :                                             conefoam1shape,medSSDroh);
    2907           1 :   cfconefoam1->SetVisibility(kTRUE);
    2908           1 :   cfconefoam1->SetLineColor(3); // Green
    2909           1 :   cfconefoam1->SetLineWidth(1);
    2910           1 :   cfconefoam1->SetFillColor(cfconefoam1->GetLineColor());
    2911           1 :   cfconefoam1->SetFillStyle(4050); // 50% transparent
    2912             : 
    2913           2 :   TGeoVolume *cfconefoam2 = new TGeoVolume("SSDCarbonFiberConeFoam2",
    2914           1 :                                             conefoam2shape,medSSDroh);
    2915           1 :   cfconefoam2->SetVisibility(kTRUE);
    2916           1 :   cfconefoam2->SetLineColor(3); // Green
    2917           1 :   cfconefoam2->SetLineWidth(1);
    2918           1 :   cfconefoam2->SetFillColor(cfconefoam2->GetLineColor());
    2919           1 :   cfconefoam2->SetFillStyle(4050); // 50% transparent
    2920             : 
    2921           2 :   TGeoVolume *coolinghole = new TGeoVolume("SSDCoolingHole",
    2922           1 :                                            coolingholeshape,medSSDair);
    2923           1 :   coolinghole->SetVisibility(kTRUE);
    2924           1 :   coolinghole->SetLineColor(5); // Yellow
    2925           1 :   coolinghole->SetLineWidth(1);
    2926           1 :   coolinghole->SetFillColor(coolinghole->GetLineColor());
    2927           1 :   coolinghole->SetFillStyle(4090); // 90% transparent
    2928             : 
    2929           2 :   TGeoVolume *coolinghole2 = new TGeoVolume("SSDCoolingHole2",
    2930           1 :                                             coolinghole2shape,medSSDair);
    2931           1 :   coolinghole2->SetVisibility(kTRUE);
    2932           1 :   coolinghole2->SetLineColor(5); // Yellow
    2933           1 :   coolinghole2->SetLineWidth(1);
    2934           1 :   coolinghole2->SetFillColor(coolinghole2->GetLineColor());
    2935           1 :   coolinghole2->SetFillStyle(4090); // 90% transparent
    2936             : 
    2937           2 :   TGeoVolume *coolinghole3 = new TGeoVolume("SSDCoolingHole3",
    2938           1 :                                             coolinghole3shape,medSSDair);
    2939           1 :   coolinghole3->SetVisibility(kTRUE);
    2940           1 :   coolinghole3->SetLineColor(5); // Yellow
    2941           1 :   coolinghole3->SetLineWidth(1);
    2942           1 :   coolinghole3->SetFillColor(coolinghole3->GetLineColor());
    2943           1 :   coolinghole3->SetFillStyle(4090); // 90% transparent
    2944             : 
    2945           2 :   TGeoVolume *mountinghole = new TGeoVolume("SSDMountingHole",
    2946           1 :                                             mountingholeshape,medSSDair);
    2947           1 :   mountinghole->SetVisibility(kTRUE);
    2948           1 :   mountinghole->SetLineColor(5); // Yellow
    2949           1 :   mountinghole->SetLineWidth(1);
    2950           1 :   mountinghole->SetFillColor(mountinghole->GetLineColor());
    2951           1 :   mountinghole->SetFillStyle(4090); // 90% transparent
    2952             : 
    2953           2 :   TGeoVolume *mountinghole2 = new TGeoVolume("SSDMountingHole2",
    2954           1 :                                              mountinghole2shape,medSSDair);
    2955           1 :   mountinghole2->SetVisibility(kTRUE);
    2956           1 :   mountinghole2->SetLineColor(5); // Yellow
    2957           1 :   mountinghole2->SetLineWidth(1);
    2958           1 :   mountinghole2->SetFillColor(mountinghole2->GetLineColor());
    2959           1 :   mountinghole2->SetFillStyle(4090); // 90% transparent
    2960             : 
    2961           2 :   TGeoVolume *mountinghole3 = new TGeoVolume("SSDMountingHole3",
    2962           1 :                                              mountinghole3shape,medSSDair);
    2963           1 :   mountinghole3->SetVisibility(kTRUE);
    2964           1 :   mountinghole3->SetLineColor(5); // Yellow
    2965           1 :   mountinghole3->SetLineWidth(1);
    2966           1 :   mountinghole3->SetFillColor(mountinghole3->GetLineColor());
    2967           1 :   mountinghole3->SetFillStyle(4090); // 90% transparent
    2968             : 
    2969           1 :   TGeoVolume *wing = new TGeoVolume("SSDWing",wingshape,medSSDcf);
    2970           1 :   wing->SetVisibility(kTRUE);
    2971           1 :   wing->SetLineColor(4); // Blue
    2972           1 :   wing->SetLineWidth(1);
    2973           1 :   wing->SetFillColor(wing->GetLineColor());
    2974           1 :   wing->SetFillStyle(4000); // 0% transparent
    2975             : 
    2976           2 :   TGeoVolume *cablehole = new TGeoVolume("SSDCableHole",
    2977           1 :                                          cableholeshape,medSSDair);
    2978           1 :   cablehole->SetVisibility(kTRUE);
    2979           1 :   cablehole->SetLineColor(5); // Yellow
    2980           1 :   cablehole->SetLineWidth(1);
    2981           1 :   cablehole->SetFillColor(cablehole->GetLineColor());
    2982           1 :   cablehole->SetFillStyle(4090); // 90% transparent
    2983             : 
    2984           2 :   TGeoVolume *winginsert = new TGeoVolume("SSDWingInsert",
    2985           1 :                                           winginsertshape,medSSDste);
    2986           1 :   winginsert->SetVisibility(kTRUE);
    2987           1 :   winginsert->SetLineColor(2); // Red
    2988           1 :   winginsert->SetLineWidth(1);
    2989           1 :   winginsert->SetFillColor(winginsert->GetLineColor());
    2990           1 :   winginsert->SetFillStyle(4050); // 50% transparent
    2991             : 
    2992           2 :   TGeoVolume *bracket = new TGeoVolume("SSDMountingBracket",
    2993           1 :                                        bracketshape,medSSDal);
    2994           1 :   bracket->SetVisibility(kTRUE);
    2995           1 :   bracket->SetLineColor(6); // Purple
    2996           1 :   bracket->SetLineWidth(1);
    2997           1 :   bracket->SetFillColor(bracket->GetLineColor());
    2998           1 :   bracket->SetFillStyle(4000); // 0% transparent
    2999             : 
    3000             :   // Mount up a cone
    3001          14 :   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
    3002           6 :     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
    3003          12 :     cfconefoam2->AddNode(mountinghole,i+1, new TGeoRotation("", phiH, 0, 0));
    3004             :   }
    3005             : 
    3006          18 :   for (Int_t i=0; i<(Int_t)(360./kCoolingHolePhi); i++) {
    3007           8 :     Double_t phiH = i*kCoolingHolePhi + 0.5*kCoolingHolePhi;
    3008          16 :     cfconeinsert->AddNodeOverlap(coolinghole,i+1, new TGeoRotation("", phiH, 0, 0));
    3009             :   }
    3010             : 
    3011           1 :   cfconeinsert->AddNode(cfconefoam1,1,0);
    3012           1 :   cfconeinsert->AddNode(cfconefoam2,1,0);
    3013             : 
    3014           1 :   cfcone->AddNode(cfconeinsert,1,0);
    3015             : 
    3016          18 :   for (Int_t i=0; i<(Int_t)(360./kCoolingHolePhi); i++) {
    3017           8 :     Double_t phiH = i*kCoolingHolePhi + 0.5*kCoolingHolePhi;
    3018          16 :     cfcone->AddNode(coolinghole2,i+1, new TGeoRotation("", phiH, 0, 0));
    3019          16 :     cfcone->AddNode(coolinghole3,i+1, new TGeoRotation("", phiH, 0, 0));
    3020          16 :     cfcone->AddNodeOverlap(cablehole,i+1, new TGeoRotation("", phiH, 0, 0));
    3021             :   }
    3022             : 
    3023          14 :   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
    3024           6 :     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
    3025          12 :     cfcone->AddNode(mountinghole2,i+1, new TGeoRotation("", phiH, 0, 0));
    3026          12 :     cfcone->AddNode(mountinghole3,i+1, new TGeoRotation("", phiH, 0, 0));
    3027             :   }
    3028             : 
    3029           1 :   wing->AddNode(winginsert,1,0);
    3030             : 
    3031             :   // Add all volumes in the Cone assembly
    3032           2 :   vC->AddNode(cfcone,1,new TGeoTranslation(0,0,-kConeZPosition));
    3033             : 
    3034          10 :   for (Int_t i=0; i<4; i++) {
    3035           4 :     Double_t thetaW = kThetaWing + 90.*i + angleWideWing/2.;
    3036          12 :     vC->AddNode(wing, i+1, new TGeoCombiTrans(0, 0, -kConeZPosition+kWingHalfThick,
    3037           8 :                            new TGeoRotation("",thetaW,180,0)));
    3038             :   }
    3039             : 
    3040           2 :   Double_t zBracket = kConeZPosition - coneshape->GetZ(9) +
    3041           1 :                       2*bracketshape->GetDz();
    3042           8 :   for (Int_t i=0; i<3; i++) {
    3043           3 :     Double_t thetaB = 60 + 120.*i;
    3044           9 :     vC->AddNode(bracket, i+1, new TGeoCombiTrans(0, 0, -zBracket,
    3045           6 :                               new TGeoRotation("",thetaB,0,0)));
    3046             :   }
    3047             : 
    3048           1 :   vC->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    3049             : 
    3050             :   // Finally put everything in the mother volume
    3051           1 :   moth->AddNode(cfcylinder,1,0);
    3052             : 
    3053           1 :   moth->AddNode(vC, 1, 0 );
    3054           2 :   moth->AddNode(vC, 2, new TGeoRotation("",180, 180, 0) );
    3055             : 
    3056             :   // Some debugging if requested
    3057           1 :   if(GetDebug(1)){
    3058           0 :     vC->PrintNodes();
    3059           0 :     vC->InspectShape();
    3060           0 :   }
    3061             : 
    3062             :   return;
    3063           1 : }
    3064             : 
    3065             : //______________________________________________________________________
    3066             : void AliITSv11GeometrySupport::ServicesCableSupport(TGeoVolume *moth,
    3067             :                                                     TGeoManager *mgr){
    3068             : //
    3069             : // Creates the cable trays which are outside the ITS support cones
    3070             : // but still inside the TPC
    3071             : // This is now a stearing routine, the actual work is done by three
    3072             : // specialized methods to avoid a really huge unique method
    3073             : //
    3074             : // Input:
    3075             : //         moth : the TGeoVolume owing the volume structure
    3076             : //         mgr  : the GeoManager (default gGeoManager)
    3077             : // Output:
    3078             : //
    3079             : // Created:      15 Nov 2009  Mario Sitta
    3080             : //
    3081             : 
    3082           2 :   TraySupportsSideA(moth, mgr);
    3083             : 
    3084           1 :   ServicesCableSupportSPD(moth, mgr);
    3085           1 :   ServicesCableSupportSDD(moth, mgr);
    3086           1 :   ServicesCableSupportSSD(moth, mgr);
    3087             : 
    3088           1 :   return;
    3089             : }
    3090             : 
    3091             : //______________________________________________________________________
    3092             : void AliITSv11GeometrySupport::TraySupportsSideA(TGeoVolume *moth,
    3093             :                                            const TGeoManager *mgr){
    3094             : //
    3095             : // Creates the structure supporting the ITS cable trays on Side A
    3096             : //
    3097             : // Input:
    3098             : //         moth : the TGeoVolume owing the volume structure
    3099             : //         mgr  : the GeoManager (default gGeoManager)
    3100             : // Output:
    3101             : //
    3102             : // Created:      14 Dec 2009  Mario Sitta
    3103             : // Updated:      26 Feb 2010  Mario Sitta
    3104             : //
    3105             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    3106             : // drawings and other (oral) information given by F.Tosello
    3107             : //
    3108             : 
    3109             :   // Dimensions and positions of the A-Side Cable Tray Support Ring
    3110             :   // (0872/G/A/01)
    3111           2 :   const Double_t kSuppRingYTrans      =  110.00 *fgkmm;
    3112           1 :   const Double_t kSuppRingZTrans      =(1011.00+435.00) *fgkmm;
    3113           1 :   const Double_t kSuppForwYTrans      =  185.00 *fgkmm;
    3114             : 
    3115           1 :   const Double_t kExtSuppRingSpace1   =   33.00 *fgkmm;
    3116           1 :   const Double_t kExtSuppRingSpace2   =   45.00 *fgkmm;
    3117           1 :   const Double_t kExtSuppRingSpcAbov  =   30.00 *fgkmm;
    3118           1 :   const Double_t kExtSuppRingBase     =  491.50 *fgkmm;
    3119           1 :   const Double_t kExtSuppRingInward   =   35.00 *fgkmm;
    3120           1 :   const Double_t kExtSuppRingRmax     =  540.00 *fgkmm;
    3121           1 :   const Double_t kExtSuppRingRint1    =  465.00 *fgkmm;
    3122           1 :   const Double_t kExtSuppRingRint2    =  467.00 *fgkmm;
    3123           1 :   const Double_t kExtSuppRingInnerHi  =  450.00 *fgkmm;
    3124           1 :   const Double_t kExtSuppRingInWide   =  100.00 *fgkmm;
    3125           1 :   const Double_t kExtSuppRingR7       =    7.00 *fgkmm;
    3126           1 :   const Double_t kExtSuppRingR5       =    5.00 *fgkmm;
    3127           1 :   const Double_t kExtSuppRingThick    =   20.00 *fgkmm;
    3128             : 
    3129           1 :   const Double_t kExtSuppRingSpcAng   =   10.50 *TMath::DegToRad();
    3130           1 :   const Double_t kExtSuppRingPartPhi  =   15.00 *TMath::DegToRad();
    3131           1 :   const Double_t kExtSuppRingIntAng   =    7.00 *TMath::DegToRad();
    3132           1 :   const Double_t kExtSuppRingBaseAng  =   75.00 *TMath::DegToRad();
    3133           1 :   const Double_t kExtSuppRingR7Ang    =  100.00 *TMath::DegToRad(); // Guessed
    3134             : 
    3135             :   const Int_t    kExtSuppRingNPtsArc  =   10; // N.points to approximate arc
    3136             : 
    3137           1 :   const Double_t kIntSuppRingThick1   =   15.00 *fgkmm;
    3138           1 :   const Double_t kIntSuppRingThick2   =   13.00 *fgkmm;
    3139           1 :   const Double_t kIntSuppRingInward   =   24.00 *fgkmm;
    3140           1 :   const Double_t kIntSuppRingThick    =   20.00 *fgkmm;
    3141             : 
    3142           1 :   const Double_t kSuppCylHeight       =  340.00 *fgkmm;
    3143           1 :   const Double_t kSuppCylRint         =  475.00 *fgkmm;
    3144           1 :   const Double_t kSuppCylRext         =  478.00 *fgkmm;
    3145           1 :   const Double_t kSuppCylDispl        =  137.70 *fgkmm;
    3146             : 
    3147           1 :   const Double_t kSuppSpacerHeight    =   30.00 *fgkmm;
    3148           1 :   const Double_t kSuppSpacerThick     =   10.00 *fgkmm;
    3149             : 
    3150             :   const Double_t kSuppSpacerAngle     =   15.00;  // Degrees
    3151             : 
    3152           1 :   const Double_t kSuppForwRingRint1   =  500.00 *fgkmm;
    3153           1 :   const Double_t kSuppForwRingRint2   =  540.00 *fgkmm;
    3154           1 :   const Double_t kSuppForwRingRext    =  560.00 *fgkmm;
    3155           1 :   const Double_t kSuppForwRingThikAll =   50.00 *fgkmm;
    3156             :   const Double_t kSuppForwRingThikInt =   20.00 *fgkmm;
    3157             : 
    3158             :   // (0872/G/B/01)
    3159           1 :   const Double_t kSuppForwConeRmin    =  558.00 *fgkmm;
    3160           1 :   const Double_t kSuppForwConeRmax    =  681.00 *fgkmm;
    3161           1 :   const Double_t kSuppForwConeLen1    =  318.00 *fgkmm;
    3162           1 :   const Double_t kSuppForwConeLen2    =  662.00 *fgkmm;
    3163           1 :   const Double_t kSuppForwConeThick   =    3.00 *fgkmm;
    3164             : 
    3165           1 :   const Double_t kSuppBackRingPlacTop =   90.00 *fgkmm;
    3166             :   const Double_t kSuppBackRingPlacSid =   50.00 *fgkmm;
    3167           1 :   const Double_t kSuppBackRingHeight  =  760.00 *fgkmm;
    3168             :   const Double_t kSuppBackRingRext    =  760.00 *fgkmm;
    3169           1 :   const Double_t kSuppBackRingRint    =  685.00 *fgkmm;
    3170             : //  const Double_t kSuppBackRingRint2   =  675.00 *fgkmm;
    3171             :   const Double_t kSuppBackRingR10     =   10.00 *fgkmm;
    3172           1 :   const Double_t kSuppBackRingBase    =  739.00 *fgkmm;
    3173             :   const Double_t kSuppBackRingThikAll =   50.00 *fgkmm;
    3174             :   const Double_t kSuppBackRingThick1  =   20.00 *fgkmm;
    3175             :   const Double_t kSuppBackRingThick2  =   20.00 *fgkmm;
    3176             : 
    3177             : //  const Double_t kSuppBackRingPlacAng =   10.00 *TMath::DegToRad();
    3178           1 :   const Double_t kSuppBackRingPlacAng =   10.25 *TMath::DegToRad();//Fix ovlp.
    3179           1 :   const Double_t kSuppBackRing2ndAng1 =   78.40 *TMath::DegToRad();
    3180           1 :   const Double_t kSuppBackRing2ndAng2 =   45.00 *TMath::DegToRad();
    3181             : 
    3182             :   const Int_t    kSuppBackRingNPtsArc =   10; // N.points to approximate arc
    3183             : 
    3184             :   // (0872/G/C/01)
    3185           1 :   const Double_t kRearSuppZTransGlob  =(1011.00+9315.00-6040.00) *fgkmm;
    3186           1 :   const Double_t kBackRodZTrans       = 2420.00 *fgkmm;
    3187             : 
    3188           1 :   const Double_t kBackRodLength       = 1160.00 *fgkmm;
    3189           1 :   const Double_t kBackRodThickLen     =   20.00 *fgkmm;
    3190             :   const Double_t kBackRodDiameter     =   20.00 *fgkmm;
    3191             : 
    3192           1 :   const Double_t kSuppRearRingRint    =  360.00 *fgkmm;
    3193           1 :   const Double_t kSuppRearRingRext1   =  410.00 *fgkmm;
    3194           1 :   const Double_t kSuppRearRingRext2   =  414.00 *fgkmm;
    3195           1 :   const Double_t kSuppRearRingHeight  =  397.00 *fgkmm;
    3196           1 :   const Double_t kSuppRearRingTopWide =  111.87 *fgkmm;
    3197           1 :   const Double_t kSuppRearRingBase    =  451.50 *fgkmm;
    3198           1 :   const Double_t kSuppRearRingBaseHi  =   58.00 *fgkmm;
    3199           1 :   const Double_t kSuppRearRingSideHi  =   52.00 *fgkmm;
    3200           1 :   const Double_t kSuppRearRingInside  =   40.00 *fgkmm;
    3201           1 :   const Double_t kSuppRearRingInsideHi=   12.00 *fgkmm;
    3202             :   const Double_t kSuppRearRingThick   =   20.00 *fgkmm;
    3203           1 :   const Double_t kSuppRearRingXRodHole=  441.50 *fgkmm;
    3204           1 :   const Double_t kSuppRearRingYRodHole=   42.00 *fgkmm;
    3205             : 
    3206           1 :   const Double_t kSuppRearRing1stAng  =   22.00 *TMath::DegToRad();
    3207           1 :   const Double_t kSuppRearRingStepAng =   15.00 *TMath::DegToRad();
    3208             : 
    3209             :   const Int_t    kSuppRearRingNPtsArc =   10; // N.points to approximate arc
    3210             : 
    3211             : 
    3212             :   // Local variables
    3213           1 :   Double_t xprof[2*(15+kExtSuppRingNPtsArc)],yprof[2*(15+kExtSuppRingNPtsArc)];
    3214           1 :   Double_t slp1, slp2, phi, xm, ym;
    3215             :   Double_t xloc, yloc, zloc, rmin, rmax, deltaR;
    3216             :   Int_t npoints;
    3217             : 
    3218             : 
    3219             :   // The whole support as an assembly
    3220           1 :   TGeoVolumeAssembly *trayASuppStruct = new TGeoVolumeAssembly("ITSsuppSideAStructure");
    3221             :   
    3222             : 
    3223             :   // First create all needed shapes
    3224             : 
    3225             :   // The External Ring (part of 0872/G/A/01): a really complex Xtru
    3226           1 :   TGeoXtru *extSuppRing = new TGeoXtru(2);
    3227             : 
    3228             :   // First the upper notch...
    3229           1 :   xprof[ 0] = kExtSuppRingSpace1;
    3230           1 :   yprof[ 0] = kExtSuppRingInnerHi + kExtSuppRingSpcAbov;
    3231             : 
    3232           1 :   slp1 = TMath::Tan(TMath::Pi()/2 - kExtSuppRingSpcAng);
    3233           2 :   IntersectCircle(slp1, xprof[0], yprof[0], kExtSuppRingRmax, 0., 0.,
    3234           1 :                   xprof[5], yprof[5], xm, ym); // Ignore dummy xm,ym
    3235             : 
    3236           1 :   xprof[ 4] = xprof[5];
    3237           1 :   yprof[ 4] = yprof[5] - kExtSuppRingR5/TMath::Tan(kExtSuppRingSpcAng);
    3238           1 :   xprof[ 3] = xprof[4] - kExtSuppRingR5*(1 - TMath::Cos(TMath::Pi()/6));
    3239           1 :   yprof[ 3] = yprof[4] - kExtSuppRingR5*(    TMath::Sin(TMath::Pi()/6));
    3240           1 :   xprof[ 2] = xprof[4] - kExtSuppRingR5*(1 - TMath::Cos(TMath::Pi()/3));
    3241           1 :   yprof[ 2] = yprof[4] - kExtSuppRingR5*(    TMath::Sin(TMath::Pi()/3));
    3242           1 :   xprof[ 1] = xprof[4] - kExtSuppRingR5;
    3243           1 :   yprof[ 1] = yprof[4] - kExtSuppRingR5;
    3244             : 
    3245             :   Int_t indx = 5+kExtSuppRingNPtsArc;
    3246             :   // ...then the external arc, approximated with segments,...
    3247           1 :   xprof[indx] = kExtSuppRingBase;
    3248           2 :   yprof[indx] = TMath::Sqrt(kExtSuppRingRmax*kExtSuppRingRmax -
    3249           1 :                             kExtSuppRingBase*kExtSuppRingBase);
    3250           1 :   Double_t alphamin = TMath::ASin(kExtSuppRingSpace2/kExtSuppRingRmax);
    3251           2 :   Double_t alphamax = TMath::Pi()/2 -
    3252           1 :                     TMath::ASin(yprof[5+kExtSuppRingNPtsArc]/kExtSuppRingRmax);
    3253             : 
    3254          20 :   for (Int_t jp = 1; jp < kExtSuppRingNPtsArc; jp++) {
    3255           9 :     Double_t alpha = jp*(alphamax-alphamin)/kExtSuppRingNPtsArc;
    3256           9 :     xprof[5+jp] = kExtSuppRingRmax*TMath::Sin(alpha);
    3257           9 :     yprof[5+jp] = kExtSuppRingRmax*TMath::Cos(alpha);
    3258             :   }
    3259             :   // ...and finally the interior profile
    3260           1 :   xprof[indx+1] = kExtSuppRingBase;
    3261           1 :   yprof[indx+1] = kSuppRingYTrans;
    3262           1 :   xprof[indx+2] = xprof[indx+1] - kExtSuppRingInward;
    3263           1 :   yprof[indx+2] = yprof[indx+1];
    3264             : 
    3265           1 :   phi  = TMath::Pi()/2 - 4*kExtSuppRingPartPhi - kExtSuppRingIntAng;
    3266           1 :   slp1 = TMath::Tan(TMath::Pi() - kExtSuppRingBaseAng);
    3267           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3268           1 :   xm   = kExtSuppRingRint2*TMath::Cos(phi);
    3269           1 :   ym   = kExtSuppRingRint2*TMath::Sin(phi);
    3270           2 :   IntersectLines(slp1, xprof[indx+2], yprof[indx+2], slp2, xm, ym,
    3271           1 :                  xprof[indx+3], yprof[indx+3]);
    3272             : 
    3273             :   slp1 = slp2;
    3274           1 :   phi += kExtSuppRingPartPhi;
    3275           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3276           1 :   xm   = kExtSuppRingRint1*TMath::Cos(phi);
    3277           1 :   ym   = kExtSuppRingRint1*TMath::Sin(phi);
    3278           2 :   IntersectLines(slp1, xprof[indx+3], yprof[indx+3], slp2, xm, ym,
    3279           1 :                  xprof[indx+4], yprof[indx+4]);
    3280             :   
    3281             :   slp1 = slp2;
    3282           1 :   phi += kExtSuppRingPartPhi;
    3283           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3284           1 :   xm   = kExtSuppRingRint2*TMath::Cos(phi);
    3285           1 :   ym   = kExtSuppRingRint2*TMath::Sin(phi);
    3286           2 :   IntersectLines(slp1, xprof[indx+4], yprof[indx+4], slp2, xm, ym,
    3287           1 :                  xprof[indx+5], yprof[indx+5]);
    3288             :   
    3289             :   slp1 = slp2;
    3290           1 :   phi += kExtSuppRingPartPhi;
    3291           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3292           1 :   xm   = kExtSuppRingRint1*TMath::Cos(phi);
    3293           1 :   ym   = kExtSuppRingRint1*TMath::Sin(phi);
    3294           2 :   IntersectLines(slp1, xprof[indx+5], yprof[indx+5], slp2, xm, ym,
    3295           1 :                  xprof[indx+6], yprof[indx+6]);
    3296             :   
    3297           1 :   xprof[indx+9] = kExtSuppRingInWide;
    3298           1 :   yprof[indx+9] = kExtSuppRingInnerHi;
    3299           2 :   xprof[indx+8] = xprof[indx+9] +
    3300           1 :                   (1 - TMath::Cos(kExtSuppRingR7Ang/2))*kExtSuppRingR7;
    3301           2 :   yprof[indx+8] = yprof[indx+9] +
    3302           1 :                   (    TMath::Sin(kExtSuppRingR7Ang/2))*kExtSuppRingR7;
    3303           2 :   xprof[indx+7] = xprof[indx+9] +
    3304           1 :                   (1 + TMath::Cos(kExtSuppRingR7Ang  ))*kExtSuppRingR7;
    3305           2 :   yprof[indx+7] = yprof[indx+9] +
    3306           1 :                   (    TMath::Sin(kExtSuppRingR7Ang  ))*kExtSuppRingR7;
    3307             :   // Gosh, we did the right side! now reflex on the left side
    3308             :   npoints = (sizeof(xprof)/sizeof(Double_t))/2;
    3309          52 :   for (Int_t jp = 0; jp < npoints; jp++) {
    3310          25 :     xprof[npoints+jp] = -xprof[npoints-1-jp];
    3311          25 :     yprof[npoints+jp] =  yprof[npoints-1-jp];
    3312             :   }
    3313             :   // wow! now the actual Xtru
    3314           1 :   extSuppRing->DefinePolygon(2*npoints, xprof, yprof);
    3315           1 :   extSuppRing->DefineSection(0,0);
    3316           1 :   extSuppRing->DefineSection(1,kExtSuppRingThick);
    3317             : 
    3318             :   // The Internal Ring (part of 0872/G/A/01): another complex Xtru
    3319           1 :   TGeoXtru *intSuppRing = new TGeoXtru(2);
    3320             : 
    3321             :   // First the external profile...
    3322             :   npoints = 0;
    3323             : 
    3324             :   slp1 = 0;
    3325           1 :   phi  = TMath::Pi()/2 - kExtSuppRingPartPhi - kExtSuppRingIntAng;
    3326           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3327           1 :   xm   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Cos(phi);
    3328           1 :   ym   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Sin(phi);
    3329           1 :   IntersectLines(slp1,  0, kExtSuppRingInnerHi+kExtSuppRingSpcAbov,
    3330           1 :                  slp2, xm, ym,
    3331             :                  xprof[npoints], yprof[npoints]);
    3332             :   npoints++;
    3333             : 
    3334             :   slp1 = slp2;
    3335           1 :   phi -= kExtSuppRingPartPhi;
    3336           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3337           1 :   xm   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Cos(phi);
    3338           1 :   ym   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Sin(phi);
    3339           2 :   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
    3340           1 :                  slp2, xm, ym,
    3341             :                  xprof[npoints], yprof[npoints]);
    3342             :   npoints++;
    3343             : 
    3344             :   slp1 = slp2;
    3345           1 :   phi -= kExtSuppRingPartPhi;
    3346           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3347           1 :   xm   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Cos(phi);
    3348           1 :   ym   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Sin(phi);
    3349           2 :   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
    3350           1 :                  slp2, xm, ym,
    3351             :                  xprof[npoints], yprof[npoints]);
    3352             :   npoints++;
    3353             : 
    3354             :   slp1 = slp2;
    3355           1 :   phi -= kExtSuppRingPartPhi;
    3356           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
    3357           1 :   xm   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Cos(phi);
    3358           1 :   ym   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Sin(phi);
    3359           2 :   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
    3360           1 :                  slp2, xm, ym,
    3361             :                  xprof[npoints], yprof[npoints]);
    3362             :   npoints++;
    3363             : 
    3364           1 :   xprof[npoints] = kExtSuppRingBase-kIntSuppRingInward;
    3365           1 :   yprof[npoints] = Yfrom2Points(xprof[npoints-1], yprof[npoints-1], xm, ym,
    3366             :                                 xprof[npoints]);
    3367             :   npoints++;
    3368             : 
    3369           1 :   xprof[npoints] = xprof[npoints-1];
    3370           1 :   yprof[npoints] = kSuppRingYTrans;
    3371             :   npoints++;
    3372             :   // ...and then the interior profile, which is identical to extSuppRing one
    3373          18 :   for (Int_t jp=0; jp < 8; jp++) {
    3374           8 :     xprof[npoints] = extSuppRing->GetX(17+jp);
    3375           8 :     yprof[npoints] = extSuppRing->GetY(17+jp);
    3376           8 :     npoints++;
    3377             :   }
    3378             :   // We did the right side! now reflex on the left side
    3379          30 :   for (Int_t jp = 0; jp < npoints; jp++) {
    3380          14 :     xprof[npoints+jp] = -xprof[npoints-1-jp];
    3381          14 :     yprof[npoints+jp] =  yprof[npoints-1-jp];
    3382             :   }
    3383             :   // And now the actual Xtru
    3384           1 :   intSuppRing->DefinePolygon(2*npoints, xprof, yprof);
    3385           1 :   intSuppRing->DefineSection(0,0);
    3386           1 :   intSuppRing->DefineSection(1,kIntSuppRingThick);
    3387             : 
    3388             :   // The intermediate cylinder (0872/G/A/03): a TubeSeg
    3389           1 :   alphamin = TMath::ASin(kSuppCylDispl/kSuppCylRint)*TMath::RadToDeg();
    3390           1 :   alphamax = 180 - alphamin;
    3391           2 :   TGeoTubeSeg *interCylind = new TGeoTubeSeg(kSuppCylRint, kSuppCylRext,
    3392           1 :                                      kSuppCylHeight/2, alphamin, alphamax);
    3393             : 
    3394             :   // The spacer (0872/G/A/03): a simple Xtru
    3395           1 :   TGeoXtru *suppSpacer = new TGeoXtru(2);
    3396             : 
    3397           1 :   xprof[0] = kSuppSpacerHeight;
    3398           1 :   yprof[0] = kSuppSpacerThick;
    3399           1 :   xprof[1] = xprof[0];
    3400           1 :   yprof[1] = 0;
    3401           1 :   xprof[2] = 0;
    3402           1 :   yprof[2] = 0;
    3403           1 :   xprof[3] = kSuppSpacerThick*SinD(kSuppSpacerAngle);
    3404           1 :   yprof[3] = yprof[0];
    3405             : 
    3406           1 :   suppSpacer->DefinePolygon(4, xprof, yprof);
    3407           1 :   suppSpacer->DefineSection(0,-kSuppCylHeight/2);
    3408           1 :   suppSpacer->DefineSection(1, kSuppCylHeight/2);
    3409             : 
    3410             :   // The forward ring (0872/G/B/02): a Pcon (slight oversimplification)
    3411           1 :   Double_t rmean = (kSuppForwRingRint1+kSuppForwRingRext)/2;
    3412           1 :   alphamin = TMath::ASin(kSuppForwYTrans/rmean)*TMath::RadToDeg();
    3413           1 :   alphamax = 180 - alphamin;
    3414             : 
    3415           1 :   TGeoPcon *forwardRing = new TGeoPcon(alphamin,alphamax-alphamin,4);
    3416             : 
    3417           1 :   forwardRing->DefineSection(0,0,
    3418             :                              kSuppForwRingRint1,kSuppForwRingRext);
    3419           1 :   forwardRing->DefineSection(1,kSuppForwRingThikInt,
    3420             :                              kSuppForwRingRint1,kSuppForwRingRext);
    3421           1 :   forwardRing->DefineSection(2,kSuppForwRingThikInt,
    3422             :                              kSuppForwRingRint2,kSuppForwRingRext);
    3423           1 :   forwardRing->DefineSection(3,kSuppForwRingThikAll,
    3424             :                              kSuppForwRingRint2,kSuppForwRingRext);
    3425             : 
    3426             :   // The forward cone (0872/G/B/03): a TGeoPcon
    3427           1 :   TGeoPcon *forwardCone = new TGeoPcon(alphamin,alphamax-alphamin,3);
    3428             : 
    3429           2 :   forwardCone->DefineSection(0,0,
    3430           1 :                              kSuppForwConeRmin-kSuppForwConeThick,
    3431             :                              kSuppForwConeRmin);
    3432           1 :   forwardCone->DefineSection(1,kSuppForwConeLen1,
    3433             :                              kSuppForwConeRmin-kSuppForwConeThick,
    3434             :                              kSuppForwConeRmin);
    3435           2 :   forwardCone->DefineSection(2,kSuppForwConeLen1+kSuppForwConeLen2,
    3436           1 :                              kSuppForwConeRmax-kSuppForwConeThick,
    3437             :                              kSuppForwConeRmax);
    3438             : 
    3439             :   // The first part of the Back Ring (part of 0872/G/B/01): a complex Xtru
    3440           1 :   TGeoXtru *firstSuppBackRing = new TGeoXtru(2);
    3441             : 
    3442             :   // First the external profile... (the arc is approximated with segments)
    3443             :   npoints = 0;
    3444             : 
    3445           1 :   xprof[npoints] = kSuppBackRingPlacTop;
    3446           1 :   yprof[npoints] = kSuppBackRingHeight;
    3447             :   npoints++;
    3448             : 
    3449           1 :   alphamax = TMath::Pi()/2 - TMath::ASin(kSuppBackRingPlacTop/kSuppBackRingRext);
    3450           1 :   alphamin = TMath::ASin((kSuppForwYTrans+kSuppBackRingPlacSid)/kSuppBackRingRext);
    3451             : 
    3452           1 :   xprof[npoints] = xprof[npoints-1];
    3453           1 :   yprof[npoints] = kSuppBackRingRext*TMath::Sin(alphamax);
    3454             :   npoints++;
    3455             : 
    3456          22 :   for (Int_t jp = 1; jp <= kSuppBackRingNPtsArc; jp++) {
    3457          10 :     Double_t alpha = alphamax - jp*(alphamax-alphamin)/kSuppBackRingNPtsArc;
    3458          10 :     xprof[npoints] = kSuppBackRingRext*TMath::Cos(alpha);
    3459          10 :     yprof[npoints] = kSuppBackRingRext*TMath::Sin(alpha);
    3460          10 :     npoints++;
    3461             :   }
    3462             : 
    3463           1 :   xprof[npoints] = kSuppBackRingBase -
    3464           1 :                    kSuppBackRingPlacSid*TMath::Tan(kSuppBackRingPlacAng);
    3465           1 :   yprof[npoints] = yprof[npoints-1];
    3466           1 :   npoints++;
    3467             : 
    3468           1 :   xprof[npoints] = kSuppBackRingBase;
    3469           1 :   yprof[npoints] = kSuppForwYTrans;
    3470           1 :   npoints++;
    3471             :   // ...then the internal profile (the arc is approximated with segments)
    3472           1 :   alphamin = TMath::ASin(kSuppForwYTrans/kSuppBackRingRint);
    3473           1 :   alphamax = TMath::Pi()/2;
    3474             : 
    3475          22 :   for (Int_t jp = 0; jp < kSuppBackRingNPtsArc; jp++) {
    3476          10 :     Double_t alpha = alphamin + jp*(alphamax-alphamin)/kSuppBackRingNPtsArc;
    3477          10 :     xprof[npoints] = kSuppBackRingRint*TMath::Cos(alpha);
    3478          10 :     yprof[npoints] = kSuppBackRingRint*TMath::Sin(alpha);
    3479          10 :     npoints++;
    3480             :   }
    3481             : 
    3482           1 :   xprof[npoints] = 0;
    3483           1 :   yprof[npoints] = kSuppBackRingRint;
    3484           1 :   npoints++;
    3485             :   // We did the right side! now reflex on the left side (except last point)
    3486          50 :   for (Int_t jp = 0; jp < npoints-1; jp++) {
    3487          24 :     xprof[npoints+jp] = -xprof[npoints-jp-2];
    3488          24 :     yprof[npoints+jp] =  yprof[npoints-jp-2];
    3489             :   }
    3490             :   // And now the actual Xtru
    3491           1 :   firstSuppBackRing->DefinePolygon(2*npoints-1, xprof, yprof);
    3492           1 :   firstSuppBackRing->DefineSection(0,0);
    3493           1 :   firstSuppBackRing->DefineSection(1,kSuppBackRingThick1);
    3494             : 
    3495             :   // The second part of the Back Ring (part of 0872/G/B/01): a Pcon
    3496             :   // (slight oversimplification)
    3497           1 :   alphamin = TMath::ASin(kSuppForwYTrans/kSuppBackRingRint)*TMath::RadToDeg();
    3498           1 :   alphamax = 180 - alphamin;
    3499             : 
    3500           1 :   TGeoPcon *secondSuppBackRing = new TGeoPcon(alphamin,alphamax-alphamin,6);
    3501             : 
    3502           1 :   deltaR = kSuppBackRingThick2/TMath::Sin(kSuppBackRing2ndAng1);
    3503           1 :   rmin = kSuppBackRingRint - kSuppBackRingThick1/TMath::Tan(kSuppBackRing2ndAng1);
    3504           1 :   rmax = rmin + deltaR + kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1);
    3505           1 :   secondSuppBackRing->DefineSection(0, 0, rmin, rmax);
    3506             : 
    3507           1 :   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1/3));
    3508           1 :   rmax -= kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1/3);
    3509           1 :   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
    3510           1 :   secondSuppBackRing->DefineSection(1, zloc, rmin, rmax);
    3511             : 
    3512           1 :   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1*2/3));
    3513           1 :   rmax = secondSuppBackRing->GetRmax(0) - kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1*2/3);
    3514           1 :   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
    3515           1 :   secondSuppBackRing->DefineSection(2, zloc, rmin, rmax);
    3516             : 
    3517           1 :   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1));
    3518           1 :   rmax = secondSuppBackRing->GetRmax(0) - kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1);
    3519           1 :   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
    3520           1 :   secondSuppBackRing->DefineSection(3, zloc, rmin, rmax);
    3521             : 
    3522           1 :   slp1 = TMath::Tan(kSuppBackRing2ndAng2);
    3523           1 :   slp2 = TMath::Tan(TMath::Pi()/2 + kSuppBackRing2ndAng1);
    3524           1 :   IntersectLines(-slp1,kSuppBackRingThikAll,deltaR/2,
    3525             :                   slp2,kSuppBackRingThikAll,deltaR,
    3526             :                   xm, ym);
    3527             : 
    3528           1 :   zloc = xm - kSuppBackRingThick1;
    3529           1 :   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
    3530           1 :   rmax = rmin + deltaR;
    3531           1 :   secondSuppBackRing->DefineSection(4, zloc, rmin, rmax);
    3532             : 
    3533           1 :   zloc = kSuppBackRingThikAll - kSuppBackRingThick1;
    3534           1 :   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
    3535           1 :   rmax = rmin + deltaR/2;
    3536           1 :   secondSuppBackRing->DefineSection(5, zloc, rmin, rmax);
    3537             : 
    3538             :   // The supporting rod: a Tube
    3539           2 :   TGeoTube *suppRod = new TGeoTube(0, kBackRodDiameter/2,
    3540           1 :                                    (kBackRodLength - kBackRodThickLen)/2);
    3541             : 
    3542             :   // The Back Ring (0872/G/C/01): another complex Xtru
    3543           1 :   TGeoXtru *suppRearRing = new TGeoXtru(2);
    3544             : 
    3545             :   // First the external profile...
    3546             :   npoints = 0;
    3547             : 
    3548           1 :   xprof[npoints] = kSuppRearRingTopWide;
    3549           1 :   yprof[npoints] = kSuppRearRingHeight;
    3550             :   npoints++;
    3551             : 
    3552             :   phi = kSuppRearRing1stAng;
    3553           1 :   slp1 = TMath::Tan(TMath::Pi() - phi);
    3554           1 :   phi += kSuppRearRingStepAng;
    3555           1 :   slp2 = TMath::Tan(TMath::Pi() - phi);
    3556           1 :   xm = kSuppRearRingRext2*TMath::Sin(phi);
    3557           1 :   ym = kSuppRearRingRext2*TMath::Cos(phi);
    3558           1 :   IntersectLines(slp1, kSuppRearRingTopWide, kSuppRearRingHeight,
    3559           1 :                  slp2, xm, ym,
    3560             :                  xprof[npoints], yprof[npoints]);
    3561             :   npoints++;
    3562             : 
    3563             :   slp1 = slp2;
    3564           1 :   phi += kSuppRearRingStepAng;
    3565           1 :   slp2 = TMath::Tan(TMath::Pi() - phi);
    3566           1 :   xm = kSuppRearRingRext1*TMath::Sin(phi);
    3567           1 :   ym = kSuppRearRingRext1*TMath::Cos(phi);
    3568           2 :   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
    3569           1 :                  slp2, xm, ym,
    3570             :                  xprof[npoints], yprof[npoints]);
    3571             :   npoints++;
    3572             : 
    3573             :   slp1 = slp2;
    3574           1 :   phi += kSuppRearRingStepAng;
    3575           1 :   slp2 = TMath::Tan(TMath::Pi() - phi);
    3576           1 :   xm = kSuppRearRingRext2*TMath::Sin(phi);
    3577           1 :   ym = kSuppRearRingRext2*TMath::Cos(phi);
    3578           2 :   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
    3579           1 :                  slp2, xm, ym,
    3580             :                  xprof[npoints], yprof[npoints]);
    3581             :   npoints++;
    3582             : 
    3583             :   slp1 = slp2;
    3584             :   slp2 = 0;
    3585           1 :   xm = kSuppRearRingBase;
    3586           1 :   ym = kSuppRearRingBaseHi + kSuppRearRingSideHi;
    3587           2 :   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
    3588           1 :                  slp2, xm, ym,
    3589             :                  xprof[npoints], yprof[npoints]);
    3590             :   npoints++;
    3591             : 
    3592           1 :   xprof[npoints] = kSuppRearRingBase;
    3593           1 :   yprof[npoints] = kSuppRearRingBaseHi + kSuppRearRingSideHi;
    3594             :   npoints++;
    3595           1 :   xprof[npoints] = xprof[npoints - 1];
    3596           1 :   yprof[npoints] = kSuppRearRingBaseHi;
    3597             :   npoints++;
    3598           1 :   xprof[npoints] = xprof[npoints - 1] - kSuppRearRingInside;
    3599           1 :   yprof[npoints] = yprof[npoints - 1];
    3600             :   npoints++;
    3601           1 :   xprof[npoints] = xprof[npoints - 1];
    3602           1 :   yprof[npoints] = yprof[npoints - 1] + kSuppRearRingInsideHi;
    3603             :   npoints++;
    3604             :   // ...then the internal arc, approximated with segments,...
    3605           1 :   xprof[npoints] = kSuppRearRingRint;
    3606           1 :   yprof[npoints] = yprof[npoints - 1];
    3607             : 
    3608           1 :   alphamin = TMath::ASin(kSuppRearRingBaseHi/kSuppRearRingRint);
    3609           1 :   alphamax = TMath::Pi()/2;
    3610             : 
    3611          20 :   for (Int_t jp = 1; jp < kSuppRearRingNPtsArc; jp++) {
    3612           9 :     Double_t alpha = alphamin + jp*(alphamax-alphamin)/kSuppRearRingNPtsArc;
    3613           9 :     xprof[npoints+jp] = kSuppRearRingRint*TMath::Cos(alpha);
    3614           9 :     yprof[npoints+jp] = kSuppRearRingRint*TMath::Sin(alpha);
    3615             :   }
    3616             : 
    3617           1 :   xprof[npoints+kSuppRearRingNPtsArc] = 0;
    3618           1 :   yprof[npoints+kSuppRearRingNPtsArc] = kSuppRearRingRint;
    3619             :   // We did the right side! now reflex on the left side
    3620             :   Int_t nTotalPoints = npoints+kSuppRearRingNPtsArc;
    3621          40 :   for (Int_t jp = 0; jp < nTotalPoints; jp++) {
    3622          19 :     xprof[nTotalPoints+1+jp] = -xprof[nTotalPoints-1-jp];
    3623          19 :     yprof[nTotalPoints+1+jp] =  yprof[nTotalPoints-1-jp];
    3624             :   }
    3625             : 
    3626             :   // And now the actual Xtru
    3627           1 :   suppRearRing->DefinePolygon(2*nTotalPoints+1, xprof, yprof);
    3628           1 :   suppRearRing->DefineSection(0,0);
    3629           1 :   suppRearRing->DefineSection(1,kSuppRearRingThick);
    3630             : 
    3631             : 
    3632             :   // We have all shapes: now create the real volumes
    3633           1 :   TGeoMedium *medAl = mgr->GetMedium("ITS_ANTICORODAL$");
    3634             : 
    3635           2 :   TGeoVolume *sideAExtSuppRing = new TGeoVolume("ITSsuppSideAExtSuppRing",
    3636           1 :                                                  extSuppRing, medAl);
    3637             : 
    3638           1 :   sideAExtSuppRing->SetVisibility(kTRUE);
    3639           1 :   sideAExtSuppRing->SetLineColor(kMagenta+1);
    3640           1 :   sideAExtSuppRing->SetLineWidth(1);
    3641           1 :   sideAExtSuppRing->SetFillColor(sideAExtSuppRing->GetLineColor());
    3642           1 :   sideAExtSuppRing->SetFillStyle(4000); // 0% transparent
    3643             : 
    3644           2 :   TGeoVolume *sideAIntSuppRing = new TGeoVolume("ITSsuppSideAIntSuppRing",
    3645           1 :                                                  intSuppRing, medAl);
    3646             : 
    3647           1 :   sideAIntSuppRing->SetVisibility(kTRUE);
    3648           1 :   sideAIntSuppRing->SetLineColor(kMagenta+1);
    3649           1 :   sideAIntSuppRing->SetLineWidth(1);
    3650           1 :   sideAIntSuppRing->SetFillColor(sideAIntSuppRing->GetLineColor());
    3651           1 :   sideAIntSuppRing->SetFillStyle(4000); // 0% transparent
    3652             : 
    3653           2 :   TGeoVolume *sideASuppCyl = new TGeoVolume("ITSsuppSideASuppCyl",
    3654           1 :                                             interCylind, medAl);
    3655             : 
    3656           1 :   sideASuppCyl->SetVisibility(kTRUE);
    3657           1 :   sideASuppCyl->SetLineColor(kMagenta+1);
    3658           1 :   sideASuppCyl->SetLineWidth(1);
    3659           1 :   sideASuppCyl->SetFillColor(sideASuppCyl->GetLineColor());
    3660           1 :   sideASuppCyl->SetFillStyle(4000); // 0% transparent
    3661             : 
    3662           2 :   TGeoVolume *sideASuppSpacer = new TGeoVolume("ITSsuppSideASuppSpacer",
    3663           1 :                                                suppSpacer, medAl);
    3664             : 
    3665           1 :   sideASuppSpacer->SetVisibility(kTRUE);
    3666           1 :   sideASuppSpacer->SetLineColor(kMagenta+1);
    3667           1 :   sideASuppSpacer->SetLineWidth(1);
    3668           1 :   sideASuppSpacer->SetFillColor(sideASuppSpacer->GetLineColor());
    3669           1 :   sideASuppSpacer->SetFillStyle(4000); // 0% transparent
    3670             : 
    3671           2 :   TGeoVolume *sideASuppForwRing = new TGeoVolume("ITSsuppSideASuppForwRing",
    3672           1 :                                                  forwardRing, medAl);
    3673             : 
    3674           1 :   sideASuppForwRing->SetVisibility(kTRUE);
    3675           1 :   sideASuppForwRing->SetLineColor(kMagenta+1);
    3676           1 :   sideASuppForwRing->SetLineWidth(1);
    3677           1 :   sideASuppForwRing->SetFillColor(sideASuppForwRing->GetLineColor());
    3678           1 :   sideASuppForwRing->SetFillStyle(4000); // 0% transparent
    3679             : 
    3680           2 :   TGeoVolume *sideASuppForwCone = new TGeoVolume("ITSsuppSideASuppForwCone",
    3681           1 :                                                  forwardCone, medAl);
    3682             : 
    3683           1 :   sideASuppForwCone->SetVisibility(kTRUE);
    3684           1 :   sideASuppForwCone->SetLineColor(kMagenta+1);
    3685           1 :   sideASuppForwCone->SetLineWidth(1);
    3686           1 :   sideASuppForwCone->SetFillColor(sideASuppForwCone->GetLineColor());
    3687           1 :   sideASuppForwCone->SetFillStyle(4000); // 0% transparent
    3688             : 
    3689           2 :   TGeoVolume *sideAFirstSuppBackRing = new TGeoVolume("ITSsuppSideAFirstSuppBackRing",
    3690           1 :                                                      firstSuppBackRing, medAl);
    3691             : 
    3692           1 :   sideAFirstSuppBackRing->SetVisibility(kTRUE);
    3693           1 :   sideAFirstSuppBackRing->SetLineColor(kMagenta+1);
    3694           1 :   sideAFirstSuppBackRing->SetLineWidth(1);
    3695           1 :   sideAFirstSuppBackRing->SetFillColor(sideAFirstSuppBackRing->GetLineColor());
    3696           1 :   sideAFirstSuppBackRing->SetFillStyle(4000); // 0% transparent
    3697             : 
    3698           2 :   TGeoVolume *sideASecondSuppBackRing = new TGeoVolume("ITSsuppSideASecondSuppBackRing",
    3699           1 :                                                        secondSuppBackRing, medAl);
    3700             : 
    3701           1 :   sideASecondSuppBackRing->SetVisibility(kTRUE);
    3702           1 :   sideASecondSuppBackRing->SetLineColor(kMagenta+1);
    3703           1 :   sideASecondSuppBackRing->SetLineWidth(1);
    3704           1 :   sideASecondSuppBackRing->SetFillColor(sideASecondSuppBackRing->GetLineColor());
    3705           1 :   sideASecondSuppBackRing->SetFillStyle(4000); // 0% transparent
    3706             : 
    3707           2 :   TGeoVolume *sideASuppRod = new TGeoVolume("ITSsuppSideASuppRod",
    3708           1 :                                             suppRod, medAl);
    3709             : 
    3710           1 :   sideASuppRod->SetVisibility(kTRUE);
    3711           1 :   sideASuppRod->SetLineColor(kMagenta+1);
    3712           1 :   sideASuppRod->SetLineWidth(1);
    3713           1 :   sideASuppRod->SetFillColor(sideASuppRod->GetLineColor());
    3714           1 :   sideASuppRod->SetFillStyle(4000); // 0% transparent
    3715             : 
    3716           2 :   TGeoVolume *sideASuppRearRing = new TGeoVolume("ITSsuppSideASuppRearRing",
    3717           1 :                                                  suppRearRing, medAl);
    3718             : 
    3719           1 :   sideASuppRearRing->SetVisibility(kTRUE);
    3720           1 :   sideASuppRearRing->SetLineColor(kMagenta+1);
    3721           1 :   sideASuppRearRing->SetLineWidth(1);
    3722           1 :   sideASuppRearRing->SetFillColor(sideASuppRearRing->GetLineColor());
    3723           1 :   sideASuppRearRing->SetFillStyle(4000); // 0% transparent
    3724             : 
    3725             : 
    3726             :   // Now build up the support structure
    3727             :   zloc = kSuppRingZTrans;
    3728           2 :   trayASuppStruct->AddNode(sideAExtSuppRing, 1,
    3729           2 :                            new TGeoTranslation(0, 0, zloc) );
    3730           2 :   trayASuppStruct->AddNode(sideAExtSuppRing, 2,
    3731           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3732           2 :                                                new TGeoRotation("",180,0,0)));
    3733             : 
    3734           1 :   zloc += kExtSuppRingThick;
    3735           2 :   trayASuppStruct->AddNode(sideAIntSuppRing, 1,
    3736           2 :                            new TGeoTranslation(0, 0, zloc) );
    3737           2 :   trayASuppStruct->AddNode(sideAIntSuppRing, 2,
    3738           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3739           2 :                                                new TGeoRotation("",180,0,0)));
    3740             : 
    3741             :   xloc = kExtSuppRingBase - kIntSuppRingInward;
    3742             :   yloc = kSuppRingYTrans;
    3743           1 :   zloc += (kIntSuppRingThick + kSuppCylHeight/2);
    3744           2 :   trayASuppStruct->AddNode(sideASuppCyl, 1,
    3745           2 :                            new TGeoTranslation(0, 0, zloc) );
    3746           2 :   trayASuppStruct->AddNode(sideASuppCyl, 2,
    3747           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3748           2 :                                                new TGeoRotation("",180,0,0)));
    3749           2 :   trayASuppStruct->AddNode(sideASuppSpacer, 1,
    3750           3 :                            new TGeoCombiTrans( xloc, yloc, zloc,
    3751           2 :                            new TGeoRotation("",90+kSuppSpacerAngle,0,0)));
    3752           2 :   trayASuppStruct->AddNode(sideASuppSpacer, 2,
    3753           3 :                            new TGeoCombiTrans(-xloc, yloc, zloc,
    3754           2 :                            new TGeoRotation("",0,180,kSuppSpacerAngle-90)));
    3755           2 :   trayASuppStruct->AddNode(sideASuppSpacer, 3,
    3756           3 :                            new TGeoCombiTrans( xloc,-yloc, zloc,
    3757           2 :                            new TGeoRotation("",180,180,kSuppSpacerAngle-90)));
    3758           2 :   trayASuppStruct->AddNode(sideASuppSpacer, 4,
    3759           3 :                            new TGeoCombiTrans(-xloc,-yloc, zloc,
    3760           2 :                            new TGeoRotation("",270+kSuppSpacerAngle,0,0)));
    3761             : 
    3762             : 
    3763           1 :   zloc += kSuppCylHeight/2;
    3764           2 :   trayASuppStruct->AddNode(sideAIntSuppRing, 3,
    3765           2 :                            new TGeoTranslation(0, 0, zloc) );
    3766           2 :   trayASuppStruct->AddNode(sideAIntSuppRing, 4,
    3767           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3768           2 :                                                new TGeoRotation("",180,0,0)));
    3769             : 
    3770           1 :   zloc += kIntSuppRingThick;
    3771           2 :   trayASuppStruct->AddNode(sideAExtSuppRing, 3,
    3772           2 :                            new TGeoTranslation(0, 0, zloc) );
    3773           2 :   trayASuppStruct->AddNode(sideAExtSuppRing, 4,
    3774           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3775           2 :                                                new TGeoRotation("",180,0,0)));
    3776             : 
    3777           1 :   zloc += kExtSuppRingThick;
    3778           2 :   trayASuppStruct->AddNode(sideASuppForwRing, 1,
    3779           2 :                            new TGeoTranslation(0, 0, zloc) );
    3780           2 :   trayASuppStruct->AddNode(sideASuppForwRing, 2,
    3781           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3782           2 :                                                new TGeoRotation("",180,0,0)));
    3783             : 
    3784           1 :   zloc += kSuppForwRingThikAll;
    3785           2 :   trayASuppStruct->AddNode(sideASuppForwCone, 1,
    3786           2 :                            new TGeoTranslation(0, 0, zloc) );
    3787           2 :   trayASuppStruct->AddNode(sideASuppForwCone, 2,
    3788           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3789           2 :                                                new TGeoRotation("",180,0,0)));
    3790             : 
    3791           1 :   zloc += (kSuppForwConeLen1+kSuppForwConeLen2);
    3792           2 :   trayASuppStruct->AddNode(sideAFirstSuppBackRing, 1,
    3793           2 :                            new TGeoTranslation(0, 0, zloc) );
    3794           2 :   trayASuppStruct->AddNode(sideAFirstSuppBackRing, 2,
    3795           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3796           2 :                                                new TGeoRotation("",180,0,0)));
    3797             : 
    3798           1 :   zloc += kSuppBackRingThick1;
    3799           2 :   trayASuppStruct->AddNode(sideASecondSuppBackRing, 1,
    3800           2 :                            new TGeoTranslation(0, 0, zloc) );
    3801           2 :   trayASuppStruct->AddNode(sideASecondSuppBackRing, 2,
    3802           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3803           2 :                                                new TGeoRotation("",180,0,0)));
    3804             : 
    3805             :   xloc = kSuppRearRingXRodHole;
    3806           1 :   yloc = kSuppRearRingBaseHi + kSuppRearRingYRodHole;
    3807           1 :   zloc = kRearSuppZTransGlob - kBackRodZTrans + suppRod->GetDz();
    3808           2 :   trayASuppStruct->AddNode(sideASuppRod, 1,
    3809           2 :                            new TGeoTranslation( xloc, yloc, zloc) );
    3810           2 :   trayASuppStruct->AddNode(sideASuppRod, 2,
    3811           2 :                            new TGeoTranslation(-xloc, yloc, zloc) );
    3812           2 :   trayASuppStruct->AddNode(sideASuppRod, 3,
    3813           2 :                            new TGeoTranslation( xloc,-yloc, zloc) );
    3814           2 :   trayASuppStruct->AddNode(sideASuppRod, 4,
    3815           2 :                            new TGeoTranslation(-xloc,-yloc, zloc) );
    3816             : 
    3817           1 :   zloc += suppRod->GetDz();
    3818           2 :   trayASuppStruct->AddNode(sideASuppRearRing, 1,
    3819           2 :                            new TGeoTranslation( 0, 0, zloc) );
    3820           2 :   trayASuppStruct->AddNode(sideASuppRearRing, 2,
    3821           3 :                            new TGeoCombiTrans( 0, 0, zloc,
    3822           2 :                                                new TGeoRotation("",180,0,0)));
    3823             : 
    3824           1 :   trayASuppStruct->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    3825             :   // Finally put everything in the mother volume
    3826           1 :   moth->AddNode(trayASuppStruct,1,0);
    3827             : 
    3828             :   return;
    3829           1 : }
    3830             : 
    3831             : //______________________________________________________________________
    3832             : void AliITSv11GeometrySupport::ServicesCableSupportSPD(TGeoVolume *moth,
    3833             :                                                        TGeoManager *mgr){
    3834             : //
    3835             : // Creates the all SPD cable trays which are outside the ITS support cones
    3836             : // but still inside the TPC
    3837             : // In order to avoid a huge monolithic routine, this method actually
    3838             : // calls inner methods to create and assemble the various (macro)pieces
    3839             : //
    3840             : // Input:
    3841             : //         moth : the TGeoVolume owing the volume structure
    3842             : //         mgr  : the GeoManager (default gGeoManager)
    3843             : // Output:
    3844             : //
    3845             : // Created:         ???       Bjorn S. Nilsen
    3846             : // Updated:      15 Nov 2009  Mario Sitta
    3847             : //
    3848             : // Technical data are taken from AutoCAD drawings and other (oral)
    3849             : // information given by F.Tosello
    3850             : //
    3851             : 
    3852           2 :   SPDCableTraysSideA(moth, mgr);
    3853           1 :   SPDCableTraysSideC(moth, mgr);
    3854             : 
    3855           1 : }
    3856             : 
    3857             : //______________________________________________________________________
    3858             : void AliITSv11GeometrySupport::ServicesCableSupportSDD(TGeoVolume *moth,
    3859             :                                                        TGeoManager *mgr){
    3860             : //
    3861             : // Creates the all SDD cable trays which are outside the ITS support cones
    3862             : // but still inside the TPC
    3863             : // In order to avoid a huge monolithic routine, this method actually
    3864             : // calls inner methods to create and assemble the various (macro)pieces
    3865             : //
    3866             : // Input:
    3867             : //         moth : the TGeoVolume owing the volume structure
    3868             : //         mgr  : the GeoManager (default gGeoManager)
    3869             : // Output:
    3870             : //
    3871             : // Created:      14 Dec 2009  Mario Sitta
    3872             : //
    3873             : 
    3874           2 :   SDDCableTraysSideA(moth, mgr);
    3875           1 :   SDDCableTraysSideC(moth, mgr);
    3876             : 
    3877           1 :   return;
    3878             : }
    3879             : 
    3880             : //______________________________________________________________________
    3881             : void AliITSv11GeometrySupport::ServicesCableSupportSSD(TGeoVolume *moth,
    3882             :                                                        TGeoManager *mgr){
    3883             : //
    3884             : // Creates the SSD cable trays which are outside the ITS support cones
    3885             : // but still inside the TPC
    3886             : // In order to avoid a huge monolithic routine, this method actually
    3887             : // calls inner methods to create and assemble the various (macro)pieces
    3888             : //
    3889             : // Input:
    3890             : //         moth : the TGeoVolume owing the volume structure
    3891             : //         mgr  : the GeoManager (default gGeoManager)
    3892             : // Output:
    3893             : //
    3894             : // Created:      15 Nov 2009  Mario Sitta
    3895             : //
    3896             : 
    3897           2 :   SSDCableTraysSideA(moth, mgr);
    3898           1 :   SSDCableTraysSideC(moth, mgr);
    3899             : 
    3900           1 :   return;
    3901             : }
    3902             : 
    3903             : //______________________________________________________________________
    3904             : void AliITSv11GeometrySupport::SPDCableTraysSideA(TGeoVolume *moth,
    3905             :                                             const TGeoManager *mgr){
    3906             : //
    3907             : // Creates the SPD cable trays which are outside the ITS support cones
    3908             : // but still inside the TPC on Side A
    3909             : // (part of this code is taken or anyway inspired to ServicesCableSupport
    3910             : // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    3911             : //
    3912             : // Input:
    3913             : //         moth : the TGeoVolume owing the volume structure
    3914             : //         mgr  : the GeoManager (default gGeoManager)
    3915             : // Output:
    3916             : //
    3917             : // Created:      15 Feb 2010  Mario Sitta
    3918             : // Updated:      10 Jun 2010  Mario Sitta  Freon inside cooling pipes
    3919             : // Updated:      08 Sep 2010  Mario Sitta
    3920             : // Updated:      14 Sep 2010  Mario Sitta  Cables prolonged till cone
    3921             : //
    3922             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    3923             : // drawings and other (oral) information given by F.Tosello and D.Elia
    3924             : // (small differences with blueprints - e.g. -0.07mm in R1Trans and
    3925             : // R2Trans - fix small overlaps; they are then compensated in positioning
    3926             : // the Rear Tray to avoid its own overlaps with the rear supporting ring)
    3927             : // Optical fibers and voltage cables are approximated with mean materials
    3928             : // and square cross sections, but preserving the total material budget.
    3929             : //
    3930             : 
    3931             :   // Overall position and rotation of the A-Side Cable Trays
    3932             :   // (parts of 0872/G/D)
    3933           2 :   const Double_t kTrayAR1Trans           =  396.93 *fgkmm;
    3934           1 :   const Double_t kTrayAR2Trans           =  413.93 *fgkmm;
    3935           1 :   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
    3936             :   const Double_t kTrayAZRot              = (180-169.5);// Degrees
    3937             :   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
    3938             :   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
    3939             : 
    3940           1 :   const Double_t kForwardTrayWide        =   94.00 *fgkmm;//!!!TO BE CHECKED!!!
    3941           1 :   const Double_t kForwardTrayFirstHigh   =   83.00 *fgkmm;//!!!TO BE CHECKED!!!
    3942           1 :   const Double_t kForwardTraySecondHigh  =   52.70 *fgkmm;//!!!TO BE CHECKED!!!
    3943           1 :   const Double_t kForwardTrayTotalLen    =  853.00 *fgkmm;
    3944           1 :   const Double_t kForwardTrayFirstLen    =  435.00 *fgkmm;
    3945           1 :   const Double_t kForwardTrayWingWide    =   16.00 *fgkmm;//!!!TO BE CHECKED!!!
    3946           1 :   const Double_t kForwardTrayInterSpace  =   18.00 *fgkmm;//!!!TO BE CHECKED!!!
    3947           1 :   const Double_t kForwardTrayThick       =    2.00 *fgkmm;
    3948             : 
    3949             :   const Int_t    kForwardSideNpoints     =    6;
    3950             : 
    3951           1 :   const Double_t kExternalTrayLen        = 1200.00 *fgkmm;
    3952             :   const Double_t kExternalTrayWide       = kForwardTrayWide;
    3953             :   const Double_t kExternalTrayHigh       = kForwardTraySecondHigh;
    3954             :   const Double_t kExternalTrayThick      = kForwardTrayThick;
    3955             : 
    3956             :   const Double_t kCoolingTubeRmin        =    2.00 *fgkmm;
    3957           1 :   const Double_t kCoolingTubeRmax        =    3.00 *fgkmm;
    3958             : 
    3959           1 :   const Double_t kOpticalFibersSect      =    8.696*fgkmm;//!!!ESTIMATED!!!
    3960           1 :   const Double_t kLowVoltageCableSectCu  =    7.675*fgkmm;// Computed
    3961             :   const Double_t kLowVoltageCableHighPUR =    1.000*fgkmm;// Computed
    3962           1 :   const Double_t kHiVoltageCableSectCu   =    1.535*fgkmm;// Computed
    3963           1 :   const Double_t kHiVoltageCableHighPUR  =    0.500*fgkmm;// Computed
    3964           1 :   const Double_t kCoaxCableSectCu        =    6.024*fgkmm;// Computed
    3965           1 :   const Double_t kCoaxCableHighMeg       =    5.695*fgkmm;// Computed
    3966             : 
    3967           1 :   const Double_t kTrayCCablesRot         =   75.000*fgkDegree;// Computed
    3968           1 :   const Double_t kTrayCCablesZLenOut     =  227.000*fgkmm;// Computed
    3969             : 
    3970             : 
    3971             :   // Local variables
    3972           1 :   Double_t xprof[kForwardSideNpoints], yprof[kForwardSideNpoints];
    3973             :   Double_t xloc, yloc, zloc, alpharot;
    3974             : 
    3975             : 
    3976             :   // The two tray components as assemblies
    3977             :   TGeoVolumeAssembly *cableTrayAForw =
    3978           1 :     new TGeoVolumeAssembly("ITSsupportSPDTrayAForwRear");
    3979             :   TGeoVolumeAssembly *cableTrayAExt =
    3980           1 :     new TGeoVolumeAssembly("ITSsupportSPDTrayAExt");
    3981             :   
    3982             : 
    3983             :   // First create all needed shapes
    3984             : 
    3985             :   // The lower face of the forward tray: a BBox
    3986           2 :   TGeoBBox *forwTrayLowerFace = new TGeoBBox(kForwardTrayWide/2,
    3987           1 :                                              kForwardTrayThick/2,
    3988           1 :                                              kForwardTrayTotalLen/2);
    3989             : 
    3990             :   // The side face of the forward tray: a Xtru
    3991           1 :   TGeoXtru *forwTraySideFace = new TGeoXtru(2);
    3992           1 :   forwTraySideFace->SetName("ITSsuppSPDForwTraySide");
    3993             : 
    3994           1 :   xprof[0] = 0;
    3995           1 :   yprof[0] = kForwardTrayThick;
    3996           1 :   xprof[1] = kForwardTrayTotalLen;
    3997           1 :   yprof[1] = yprof[0];
    3998           1 :   xprof[2] = xprof[1];
    3999           1 :   yprof[2] = kForwardTraySecondHigh - kForwardTrayThick;
    4000           1 :   xprof[3] = kForwardTrayFirstLen;
    4001           1 :   yprof[3] = yprof[2];
    4002           1 :   xprof[4] = xprof[3];
    4003           1 :   yprof[4] = kForwardTrayFirstHigh - kForwardTrayThick;
    4004           1 :   xprof[5] = xprof[0];
    4005           1 :   yprof[5] = yprof[4];
    4006             : 
    4007           1 :   forwTraySideFace->DefinePolygon(6, xprof, yprof);
    4008           1 :   forwTraySideFace->DefineSection(0, 0);
    4009           1 :   forwTraySideFace->DefineSection(1, kForwardTrayThick);
    4010             : 
    4011             :   // The covers of the forward tray: two BBox's
    4012           2 :   TGeoBBox *forwTrayShortCover = new TGeoBBox(kForwardTrayWide/2,
    4013             :                                               kForwardTrayThick/2,
    4014           1 :                                               kForwardTrayFirstLen/2);
    4015             : 
    4016           2 :   TGeoBBox *forwTrayLongCover = new TGeoBBox(kForwardTrayWide/2,
    4017             :                                              kForwardTrayThick/2,
    4018           1 :                              (kForwardTrayTotalLen - kForwardTrayFirstLen)/2);
    4019             : 
    4020             :   // Each small wing of the forward tray: a BBox
    4021           2 :   TGeoBBox *forwTrayWing = new TGeoBBox(kForwardTrayWingWide/2,
    4022           1 :                              (kForwardTrayFirstHigh-kForwardTraySecondHigh)/2,
    4023             :                                         kForwardTrayThick/2);
    4024             : 
    4025             :   // The internal plane of the forward tray: a BBox
    4026           1 :   TGeoBBox *forwTrayPlane = new TGeoBBox(kForwardTrayWide/2-kForwardTrayThick,
    4027             :                                          kForwardTrayThick/2,
    4028             :                                          kForwardTrayTotalLen/2);
    4029             : 
    4030             :   // The internal wall of the forward tray: a BBox
    4031           2 :   TGeoBBox *forwTrayWall = new TGeoBBox(kForwardTrayThick/2,
    4032           1 :                                  (kForwardTrayInterSpace-kForwardTrayThick)/2,
    4033             :                                         kForwardTrayTotalLen/2);
    4034             : 
    4035             :   // Each horizontal face of the external tray: a BBox
    4036           2 :   TGeoBBox *extTrayHorFace = new TGeoBBox(kExternalTrayWide/2-kExternalTrayThick,
    4037             :                                           kExternalTrayThick/2,
    4038           1 :                                           kExternalTrayLen/2);
    4039             : 
    4040             :   // Each vertical face of the external tray: a BBox
    4041           2 :   TGeoBBox *extTrayVerFace = new TGeoBBox(kExternalTrayThick/2,
    4042           1 :                                           kExternalTrayHigh/2,
    4043             :                                           kExternalTrayLen/2);
    4044             : 
    4045             :   // The internal wall of the external tray: a BBox
    4046           1 :   TGeoBBox *extTrayWall = new TGeoBBox(kExternalTrayThick/2,
    4047             :                                  (kForwardTrayInterSpace-kExternalTrayThick)/2,
    4048             :                                        kExternalTrayLen/2);
    4049             : 
    4050             :   // The cooling tube inside the forward tray: a Tube
    4051           1 :   Double_t zelong = (kForwardTraySecondHigh - 2*kForwardTrayThick
    4052           1 :                 - 2*forwTrayWall->GetDY() - kCoolingTubeRmax)*SinD(kTrayAZRot);
    4053           1 :   Double_t zlen = (zelong + kForwardTrayTotalLen)/2;
    4054           1 :   TGeoTube *coolTubeForw = new TGeoTube(0, kCoolingTubeRmax, zlen);
    4055             : 
    4056             :   // The freon inside the forward tray tubes: a Tube
    4057           1 :   TGeoTube *freonTubeForw = new TGeoTube(0, kCoolingTubeRmin, zlen);
    4058             : 
    4059             :   // The cooling tube inside the external tray: a Ctub
    4060           2 :   TGeoCtub *coolTubeExt = new TGeoCtub(0, kCoolingTubeRmax,
    4061             :                                        kExternalTrayLen/2, 0, 360,
    4062           3 :                                        0, SinD(kTrayAZRot),-CosD(kTrayAZRot),
    4063             :                                        0,                0,               1);
    4064             : 
    4065             :   // The freon inside the forward tray tubes: a Tube
    4066           2 :   TGeoCtub *freonTubeExt = new TGeoCtub(0, kCoolingTubeRmin,
    4067             :                                         kExternalTrayLen/2, 0, 360,
    4068           3 :                                         0, SinD(kTrayAZRot),-CosD(kTrayAZRot),
    4069             :                                         0,                0,               1);
    4070             : 
    4071             :   // The optical fibers inside the forward tray: a Xtru
    4072           1 :   TGeoXtru *optFibsForw = new TGeoXtru(2);
    4073             : 
    4074           1 :   xprof[0] = -kTrayCCablesZLenOut;
    4075           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
    4076           1 :   xprof[1] = 0;
    4077           1 :   yprof[1] = 0;
    4078           1 :   xprof[2] = kForwardTrayTotalLen;
    4079           1 :   yprof[2] = yprof[1];
    4080           1 :   xprof[3] = xprof[2];
    4081           1 :   yprof[3] = yprof[2] + kOpticalFibersSect;
    4082           1 :   xprof[4] = xprof[1];
    4083           1 :   yprof[4] = yprof[3];
    4084           1 :   xprof[5] = xprof[0];
    4085           1 :   yprof[5] = yprof[0] + kOpticalFibersSect;
    4086             : 
    4087           1 :   optFibsForw->DefinePolygon(6, xprof, yprof);
    4088           1 :   optFibsForw->DefineSection(0,-kOpticalFibersSect/2);
    4089           1 :   optFibsForw->DefineSection(1, kOpticalFibersSect/2);
    4090             : 
    4091             :   // The optical fibers inside the external tray: a Xtru
    4092           1 :   TGeoXtru *optFibsExt = new TGeoXtru(2);
    4093           1 :   optFibsExt->SetName("ITSsuppSPDExtTrayOptFibs");
    4094             : 
    4095           2 :   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
    4096           1 :            + 2*forwTrayWall->GetDY();
    4097           1 :   xprof[0] = yprof[0]*TanD(kTrayAZRot);
    4098           1 :   xprof[1] = kExternalTrayLen;
    4099           1 :   yprof[1] = yprof[0];
    4100           1 :   xprof[2] = xprof[1];
    4101           1 :   yprof[2] = yprof[1] + kOpticalFibersSect;
    4102           1 :   yprof[3] = yprof[2];
    4103           1 :   xprof[3] = yprof[2]*TanD(kTrayAZRot);
    4104             : 
    4105           1 :   optFibsExt->DefinePolygon(4, xprof, yprof);
    4106           1 :   optFibsExt->DefineSection(0, 0);
    4107           1 :   optFibsExt->DefineSection(1, kOpticalFibersSect);
    4108             : 
    4109             :   // The Low Voltage cables inside the forward tray: two Xtru
    4110           1 :   TGeoXtru *lowCablesForwCu = new TGeoXtru(2);
    4111             : 
    4112           1 :   xprof[0] = -kTrayCCablesZLenOut;
    4113           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
    4114           1 :   xprof[1] = 0;
    4115           1 :   yprof[1] = 0;
    4116           1 :   xprof[2] = kForwardTrayTotalLen;
    4117           1 :   yprof[2] = yprof[1];
    4118           1 :   xprof[3] = xprof[2];
    4119           1 :   yprof[3] = yprof[2] + kLowVoltageCableSectCu/2;
    4120           1 :   xprof[4] = xprof[1];
    4121           1 :   yprof[4] = yprof[3];
    4122           1 :   xprof[5] = xprof[0];
    4123           1 :   yprof[5] = yprof[0] + kLowVoltageCableSectCu/2;
    4124             : 
    4125           1 :   lowCablesForwCu->DefinePolygon(6, xprof, yprof);
    4126           1 :   lowCablesForwCu->DefineSection(0,-kLowVoltageCableSectCu);
    4127           1 :   lowCablesForwCu->DefineSection(1, kLowVoltageCableSectCu);
    4128             : 
    4129           1 :   TGeoXtru *lowCablesForwPUR = new TGeoXtru(2);
    4130             : 
    4131           1 :   xprof[0] = lowCablesForwCu->GetX(5);
    4132           1 :   yprof[0] = lowCablesForwCu->GetY(5);
    4133           1 :   xprof[1] = lowCablesForwCu->GetX(4);
    4134           1 :   yprof[1] = lowCablesForwCu->GetY(4);
    4135           1 :   xprof[2] = lowCablesForwCu->GetX(3);
    4136           1 :   yprof[2] = lowCablesForwCu->GetY(3);
    4137           1 :   xprof[3] = xprof[2];
    4138           1 :   yprof[3] = yprof[2] + kLowVoltageCableHighPUR/2;
    4139           1 :   xprof[4] = xprof[1];
    4140           1 :   yprof[4] = yprof[3];
    4141           1 :   xprof[5] = xprof[0];
    4142           1 :   yprof[5] = yprof[0] + kLowVoltageCableHighPUR/2;
    4143             : 
    4144           1 :   lowCablesForwPUR->DefinePolygon(6, xprof, yprof);
    4145           1 :   lowCablesForwPUR->DefineSection(0,-kLowVoltageCableSectCu);
    4146           1 :   lowCablesForwPUR->DefineSection(1, kLowVoltageCableSectCu);
    4147             : 
    4148             :   // The Low Voltage inside the external tray: two Xtru
    4149           1 :   TGeoXtru *lowCablesExtCu = new TGeoXtru(2);
    4150           1 :   lowCablesExtCu->SetName("ITSsuppSPDExtTrayLowVoltageCu");
    4151             : 
    4152           1 :   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
    4153           1 :            + 2*forwTrayWall->GetDY();
    4154           1 :   xprof[0] = yprof[0]*TanD(kTrayAZRot);
    4155           1 :   xprof[1] = kExternalTrayLen;
    4156           1 :   yprof[1] = yprof[0];
    4157           1 :   xprof[2] = xprof[1];
    4158           1 :   yprof[2] = yprof[1] + kLowVoltageCableSectCu/2;
    4159           1 :   yprof[3] = yprof[2];
    4160           1 :   xprof[3] = yprof[2]*TanD(kTrayAZRot);
    4161             : 
    4162           1 :   lowCablesExtCu->DefinePolygon(4, xprof, yprof);
    4163           1 :   lowCablesExtCu->DefineSection(0, 0);
    4164           1 :   lowCablesExtCu->DefineSection(1, kLowVoltageCableSectCu*2);
    4165             : 
    4166           1 :   TGeoXtru *lowCablesExtPUR = new TGeoXtru(2);
    4167           1 :   lowCablesExtPUR->SetName("ITSsuppSPDExtTrayLowVoltagePUR");
    4168             : 
    4169           1 :   xprof[0] = lowCablesExtCu->GetX(3);
    4170           1 :   yprof[0] = lowCablesExtCu->GetY(3);
    4171           1 :   xprof[1] = lowCablesExtCu->GetX(2);
    4172           1 :   yprof[1] = lowCablesExtCu->GetY(2);
    4173           1 :   xprof[2] = xprof[1];
    4174           1 :   yprof[2] = yprof[1] + kLowVoltageCableHighPUR/2;
    4175           1 :   yprof[3] = yprof[2];
    4176           1 :   xprof[3] = yprof[2]*TanD(kTrayAZRot);
    4177             : 
    4178           1 :   lowCablesExtPUR->DefinePolygon(4, xprof, yprof);
    4179           1 :   lowCablesExtPUR->DefineSection(0, 0);
    4180           1 :   lowCablesExtPUR->DefineSection(1, kLowVoltageCableSectCu*2);
    4181             : 
    4182             :   // The High Voltage cables inside the forward tray: two Xtru
    4183           1 :   TGeoXtru *hiCablesForwCu = new TGeoXtru(2);
    4184             : 
    4185           1 :   xprof[0] = -kTrayCCablesZLenOut;
    4186           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
    4187           1 :   xprof[1] = 0;
    4188           1 :   yprof[1] = 0;
    4189           1 :   xprof[2] = kForwardTrayTotalLen;
    4190           1 :   yprof[2] = yprof[1];
    4191           1 :   xprof[3] = xprof[2];
    4192           1 :   yprof[3] = yprof[2] + kHiVoltageCableSectCu/2;
    4193           1 :   xprof[4] = xprof[1];
    4194           1 :   yprof[4] = yprof[3];
    4195           1 :   xprof[5] = xprof[0];
    4196           1 :   yprof[5] = yprof[0] + kHiVoltageCableSectCu/2;
    4197             : 
    4198           1 :   hiCablesForwCu->DefinePolygon(6, xprof, yprof);
    4199           1 :   hiCablesForwCu->DefineSection(0,-kHiVoltageCableSectCu);
    4200           1 :   hiCablesForwCu->DefineSection(1, kHiVoltageCableSectCu);
    4201             : 
    4202           1 :   TGeoXtru *hiCablesForwPUR = new TGeoXtru(2);
    4203             : 
    4204           1 :   xprof[0] = hiCablesForwCu->GetX(5);
    4205           1 :   yprof[0] = hiCablesForwCu->GetY(5);
    4206           1 :   xprof[1] = hiCablesForwCu->GetX(4);
    4207           1 :   yprof[1] = hiCablesForwCu->GetY(4);
    4208           1 :   xprof[2] = hiCablesForwCu->GetX(3);
    4209           1 :   yprof[2] = hiCablesForwCu->GetY(3);
    4210           1 :   xprof[3] = xprof[2];
    4211           1 :   yprof[3] = yprof[2] + kHiVoltageCableHighPUR/2;
    4212           1 :   xprof[4] = xprof[1];
    4213           1 :   yprof[4] = yprof[3];
    4214           1 :   xprof[5] = xprof[0];
    4215           1 :   yprof[5] = yprof[0] + kHiVoltageCableHighPUR/2;
    4216             : 
    4217           1 :   hiCablesForwPUR->DefinePolygon(6, xprof, yprof);
    4218           1 :   hiCablesForwPUR->DefineSection(0,-kHiVoltageCableSectCu);
    4219           1 :   hiCablesForwPUR->DefineSection(1, kHiVoltageCableSectCu);
    4220             : 
    4221             :   // The High Voltage inside the external tray: two Xtru
    4222           1 :   TGeoXtru *hiCablesExtCu = new TGeoXtru(2);
    4223           1 :   hiCablesExtCu->SetName("ITSsuppSPDExtTrayHiVoltageCu");
    4224             : 
    4225           1 :   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
    4226           1 :            + 2*forwTrayWall->GetDY();
    4227           1 :   xprof[0] = yprof[0]*TanD(kTrayAZRot);
    4228           1 :   xprof[1] = kExternalTrayLen;
    4229           1 :   yprof[1] = yprof[0];
    4230           1 :   xprof[2] = xprof[1];
    4231           1 :   yprof[2] = yprof[1] + kHiVoltageCableSectCu/2;
    4232           1 :   yprof[3] = yprof[2];
    4233           1 :   xprof[3] = yprof[2]*TanD(kTrayAZRot);
    4234             : 
    4235           1 :   hiCablesExtCu->DefinePolygon(4, xprof, yprof);
    4236           1 :   hiCablesExtCu->DefineSection(0, 0);
    4237           1 :   hiCablesExtCu->DefineSection(1, kHiVoltageCableSectCu*2);
    4238             : 
    4239           1 :   TGeoXtru *hiCablesExtPUR = new TGeoXtru(2);
    4240           1 :   hiCablesExtPUR->SetName("ITSsuppSPDExtTrayHiVoltagePUR");
    4241             : 
    4242           1 :   xprof[0] = hiCablesExtCu->GetX(3);
    4243           1 :   yprof[0] = hiCablesExtCu->GetY(3);
    4244           1 :   xprof[1] = hiCablesExtCu->GetX(2);
    4245           1 :   yprof[1] = hiCablesExtCu->GetY(2);
    4246           1 :   xprof[2] = xprof[1];
    4247           1 :   yprof[2] = yprof[1] + kHiVoltageCableHighPUR/2;
    4248           1 :   yprof[3] = yprof[2];
    4249           1 :   xprof[3] = yprof[2]*TanD(kTrayAZRot);
    4250             : 
    4251           1 :   hiCablesExtPUR->DefinePolygon(4, xprof, yprof);
    4252           1 :   hiCablesExtPUR->DefineSection(0, 0);
    4253           1 :   hiCablesExtPUR->DefineSection(1, kHiVoltageCableSectCu*2);
    4254             : 
    4255             :   // The Coaxial cables inside the forward tray: two Xtru
    4256           1 :   TGeoXtru *coaxCablesForwCu = new TGeoXtru(2);
    4257           1 :   coaxCablesForwCu->SetName("ITSsuppSPDForwTrayCoaxCu");
    4258             : 
    4259           1 :   xprof[0] = -kTrayCCablesZLenOut;
    4260           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
    4261           1 :   xprof[1] = 0;
    4262           1 :   yprof[1] = 0;
    4263           1 :   xprof[2] = kForwardTrayTotalLen;
    4264           1 :   yprof[2] = yprof[1];
    4265           1 :   xprof[3] = xprof[2];
    4266           1 :   yprof[3] = yprof[2] + kCoaxCableSectCu/2;
    4267           1 :   xprof[4] = xprof[1];
    4268           1 :   yprof[4] = yprof[3];
    4269           1 :   xprof[5] = xprof[0];
    4270           1 :   yprof[5] = yprof[0] + kCoaxCableSectCu/2;
    4271             : 
    4272           1 :   coaxCablesForwCu->DefinePolygon(6, xprof, yprof);
    4273           1 :   coaxCablesForwCu->DefineSection(0,-kCoaxCableSectCu);
    4274           1 :   coaxCablesForwCu->DefineSection(1, kCoaxCableSectCu);
    4275             : 
    4276           1 :   TGeoXtru *coaxCablesForwMeg = new TGeoXtru(2);
    4277           1 :   coaxCablesForwMeg->SetName("ITSsuppSPDForwTrayCoaxMeg");
    4278             : 
    4279           1 :   xprof[0] = coaxCablesForwCu->GetX(5);
    4280           1 :   yprof[0] = coaxCablesForwCu->GetY(5);
    4281           1 :   xprof[1] = coaxCablesForwCu->GetX(4);
    4282           1 :   yprof[1] = coaxCablesForwCu->GetY(4);
    4283           1 :   xprof[2] = coaxCablesForwCu->GetX(3);
    4284           1 :   yprof[2] = coaxCablesForwCu->GetY(3);
    4285           1 :   xprof[3] = xprof[2];
    4286           1 :   yprof[3] = yprof[2] + kCoaxCableHighMeg/2;
    4287           1 :   xprof[4] = xprof[1];
    4288           1 :   yprof[4] = yprof[3];
    4289           1 :   xprof[5] = xprof[0];
    4290           1 :   yprof[5] = yprof[0] + kCoaxCableHighMeg/2;
    4291             : 
    4292           1 :   coaxCablesForwMeg->DefinePolygon(6, xprof, yprof);
    4293           1 :   coaxCablesForwMeg->DefineSection(0,-kCoaxCableSectCu);
    4294           1 :   coaxCablesForwMeg->DefineSection(1, kCoaxCableSectCu);
    4295             : 
    4296             :   // The Coaxial inside the external tray: two Xtru
    4297           1 :   TGeoXtru *coaxCablesExtCu = new TGeoXtru(2);
    4298           1 :   coaxCablesExtCu->SetName("ITSsuppSPDExtTrayCoaxCu");
    4299             : 
    4300           1 :   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
    4301           1 :            + 2*forwTrayWall->GetDY();
    4302           1 :   xprof[0] = yprof[0]*TanD(kTrayAZRot);
    4303           1 :   xprof[1] = kExternalTrayLen;
    4304           1 :   yprof[1] = yprof[0];
    4305           1 :   xprof[2] = xprof[1];
    4306           1 :   yprof[2] = yprof[1] + kCoaxCableSectCu/2;
    4307           1 :   yprof[3] = yprof[2];
    4308           1 :   xprof[3] = yprof[2]*TanD(kTrayAZRot);
    4309             : 
    4310           1 :   coaxCablesExtCu->DefinePolygon(4, xprof, yprof);
    4311           1 :   coaxCablesExtCu->DefineSection(0, 0);
    4312           1 :   coaxCablesExtCu->DefineSection(1, kCoaxCableSectCu*2);
    4313             : 
    4314           1 :   TGeoXtru *coaxCablesExtMeg = new TGeoXtru(2);
    4315           1 :   coaxCablesExtMeg->SetName("ITSsuppSPDExtTrayCoaxMeg");
    4316             : 
    4317           1 :   xprof[0] = coaxCablesExtCu->GetX(3);
    4318           1 :   yprof[0] = coaxCablesExtCu->GetY(3);
    4319           1 :   xprof[1] = coaxCablesExtCu->GetX(2);
    4320           1 :   yprof[1] = coaxCablesExtCu->GetY(2);
    4321           1 :   xprof[2] = xprof[1];
    4322           1 :   yprof[2] = yprof[1] + kCoaxCableHighMeg/2;
    4323           1 :   yprof[3] = yprof[2];
    4324           1 :   xprof[3] = yprof[2]*TanD(kTrayAZRot);
    4325             : 
    4326           1 :   coaxCablesExtMeg->DefinePolygon(4, xprof, yprof);
    4327           1 :   coaxCablesExtMeg->DefineSection(0, 0);
    4328           1 :   coaxCablesExtMeg->DefineSection(1, kCoaxCableSectCu*2);
    4329             : 
    4330             : 
    4331             :   // We have all shapes: now create the real volumes
    4332           1 :   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
    4333           1 :   TGeoMedium *medIn    = mgr->GetMedium("ITS_INOX$");
    4334           1 :   TGeoMedium *medFreon = mgr->GetMedium("ITS_GASEOUS FREON$");
    4335           1 :   TGeoMedium *medFibs  = mgr->GetMedium("ITS_SDD OPTICFIB$");//!TO BE CHECKED!
    4336           1 :   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
    4337           1 :   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
    4338           1 :   TGeoMedium *medMeg   = mgr->GetMedium("ITS_MEGOLON$");
    4339             : 
    4340           2 :   TGeoVolume *forwTrayABase = new TGeoVolume("ITSsuppSPDSideAForwTrayABase",
    4341           1 :                                             forwTrayLowerFace, medAl);
    4342             : 
    4343           1 :   forwTrayABase->SetVisibility(kTRUE);
    4344           1 :   forwTrayABase->SetLineColor(6); // Purple
    4345           1 :   forwTrayABase->SetLineWidth(1);
    4346           1 :   forwTrayABase->SetFillColor(forwTrayABase->GetLineColor());
    4347           1 :   forwTrayABase->SetFillStyle(4000); // 0% transparent
    4348             : 
    4349           2 :   TGeoVolume *forwTrayASide = new TGeoVolume("ITSsuppSPDSideAForwTrayASide",
    4350           1 :                                             forwTraySideFace, medAl);
    4351             : 
    4352           1 :   forwTrayASide->SetVisibility(kTRUE);
    4353           1 :   forwTrayASide->SetLineColor(6); // Purple
    4354           1 :   forwTrayASide->SetLineWidth(1);
    4355           1 :   forwTrayASide->SetFillColor(forwTrayASide->GetLineColor());
    4356           1 :   forwTrayASide->SetFillStyle(4000); // 0% transparent
    4357             : 
    4358           2 :   TGeoVolume *forwTrayACoverShort = new TGeoVolume("ITSsuppSPDSideAForwTrayASC",
    4359           1 :                                                   forwTrayShortCover, medAl);
    4360             : 
    4361           1 :   forwTrayACoverShort->SetVisibility(kTRUE);
    4362           1 :   forwTrayACoverShort->SetLineColor(6); // Purple
    4363           1 :   forwTrayACoverShort->SetLineWidth(1);
    4364           1 :   forwTrayACoverShort->SetFillColor(forwTrayACoverShort->GetLineColor());
    4365           1 :   forwTrayACoverShort->SetFillStyle(4000); // 0% transparent
    4366             : 
    4367           2 :   TGeoVolume *forwTrayACoverLong = new TGeoVolume("ITSsuppSPDSideAForwTrayALC",
    4368           1 :                                                  forwTrayLongCover, medAl);
    4369             : 
    4370           1 :   forwTrayACoverLong->SetVisibility(kTRUE);
    4371           1 :   forwTrayACoverLong->SetLineColor(6); // Purple
    4372           1 :   forwTrayACoverLong->SetLineWidth(1);
    4373           1 :   forwTrayACoverLong->SetFillColor(forwTrayACoverLong->GetLineColor());
    4374           1 :   forwTrayACoverLong->SetFillStyle(4000); // 0% transparent
    4375             : 
    4376           2 :   TGeoVolume *forwTrayAWing = new TGeoVolume("ITSsuppSPDSideAForwTrayAWing",
    4377           1 :                                              forwTrayWing, medAl);
    4378             : 
    4379           1 :   forwTrayAWing->SetVisibility(kTRUE);
    4380           1 :   forwTrayAWing->SetLineColor(6); // Purple
    4381           1 :   forwTrayAWing->SetLineWidth(1);
    4382           1 :   forwTrayAWing->SetFillColor(forwTrayAWing->GetLineColor());
    4383           1 :   forwTrayAWing->SetFillStyle(4000); // 0% transparent
    4384             : 
    4385           2 :   TGeoVolume *forwTrayAPlane = new TGeoVolume("ITSsuppSPDSideAForwTrayAPlane",
    4386           1 :                                               forwTrayPlane, medAl);
    4387             : 
    4388           1 :   forwTrayAPlane->SetVisibility(kTRUE);
    4389           1 :   forwTrayAPlane->SetLineColor(6); // Purple
    4390           1 :   forwTrayAPlane->SetLineWidth(1);
    4391           1 :   forwTrayAPlane->SetFillColor(forwTrayAPlane->GetLineColor());
    4392           1 :   forwTrayAPlane->SetFillStyle(4000); // 0% transparent
    4393             : 
    4394           2 :   TGeoVolume *forwTrayAWall = new TGeoVolume("ITSsuppSPDSideAForwTrayAWall",
    4395           1 :                                              forwTrayWall, medAl);
    4396             : 
    4397           1 :   forwTrayAWall->SetVisibility(kTRUE);
    4398           1 :   forwTrayAWall->SetLineColor(6); // Purple
    4399           1 :   forwTrayAWall->SetLineWidth(1);
    4400           1 :   forwTrayAWall->SetFillColor(forwTrayAWall->GetLineColor());
    4401           1 :   forwTrayAWall->SetFillStyle(4000); // 0% transparent
    4402             : 
    4403           2 :   TGeoVolume *extTrayAHorFace = new TGeoVolume("ITSsuppSPDSideAExtTrayHorFace",
    4404           1 :                                                extTrayHorFace, medAl);
    4405             : 
    4406           1 :   extTrayAHorFace->SetVisibility(kTRUE);
    4407           1 :   extTrayAHorFace->SetLineColor(6); // Purple
    4408           1 :   extTrayAHorFace->SetLineWidth(1);
    4409           1 :   extTrayAHorFace->SetFillColor(extTrayAHorFace->GetLineColor());
    4410           1 :   extTrayAHorFace->SetFillStyle(4000); // 0% transparent
    4411             : 
    4412           2 :   TGeoVolume *extTrayAVerFace = new TGeoVolume("ITSsuppSPDSideAExtTrayVerFace",
    4413           1 :                                                extTrayVerFace, medAl);
    4414             : 
    4415           1 :   extTrayAVerFace->SetVisibility(kTRUE);
    4416           1 :   extTrayAVerFace->SetLineColor(6); // Purple
    4417           1 :   extTrayAVerFace->SetLineWidth(1);
    4418           1 :   extTrayAVerFace->SetFillColor(extTrayAVerFace->GetLineColor());
    4419           1 :   extTrayAVerFace->SetFillStyle(4000); // 0% transparent
    4420             : 
    4421           2 :   TGeoVolume *extTrayAWall = new TGeoVolume("ITSsuppSPDSideAExtTrayWall",
    4422           1 :                                             extTrayWall, medAl);
    4423             : 
    4424           1 :   extTrayAWall->SetVisibility(kTRUE);
    4425           1 :   extTrayAWall->SetLineColor(6); // Purple
    4426           1 :   extTrayAWall->SetLineWidth(1);
    4427           1 :   extTrayAWall->SetFillColor(extTrayAWall->GetLineColor());
    4428           1 :   extTrayAWall->SetFillStyle(4000); // 0% transparent
    4429             : 
    4430           2 :   TGeoVolume *forwCoolTube = new TGeoVolume("ITSsuppSPDSideAForwTrayCoolTube",
    4431           1 :                                             coolTubeForw, medIn);
    4432             : 
    4433           1 :   forwCoolTube->SetVisibility(kTRUE);
    4434           1 :   forwCoolTube->SetLineColor(kGray); // as in GeometrySPD
    4435           1 :   forwCoolTube->SetLineWidth(1);
    4436           1 :   forwCoolTube->SetFillColor(forwCoolTube->GetLineColor());
    4437           1 :   forwCoolTube->SetFillStyle(4000); // 0% transparent
    4438             : 
    4439           2 :   TGeoVolume *forwCoolFreon = new TGeoVolume("ITSsuppSPDSideAForwTrayFreon",
    4440           1 :                                              freonTubeForw, medFreon);
    4441             : 
    4442           1 :   forwCoolFreon->SetVisibility(kTRUE);
    4443           1 :   forwCoolFreon->SetLineColor(kBlue); // Blue
    4444           1 :   forwCoolFreon->SetLineWidth(1);
    4445           1 :   forwCoolFreon->SetFillColor(forwCoolFreon->GetLineColor());
    4446           1 :   forwCoolFreon->SetFillStyle(4000); // 0% transparent
    4447             : 
    4448           2 :   TGeoVolume *extCoolTube = new TGeoVolume("ITSsuppSPDSideAExtTrayCoolTube",
    4449           1 :                                            coolTubeExt, medIn);
    4450             : 
    4451           1 :   extCoolTube->SetVisibility(kTRUE);
    4452           1 :   extCoolTube->SetLineColor(kGray); // as in GeometrySPD
    4453           1 :   extCoolTube->SetLineWidth(1);
    4454           1 :   extCoolTube->SetFillColor(extCoolTube->GetLineColor());
    4455           1 :   extCoolTube->SetFillStyle(4000); // 0% transparent
    4456             : 
    4457           2 :   TGeoVolume *extCoolFreon = new TGeoVolume("ITSsuppSPDSideAExtTrayFreon",
    4458           1 :                                             freonTubeExt, medFreon);
    4459             : 
    4460           1 :   extCoolFreon->SetVisibility(kTRUE);
    4461           1 :   extCoolFreon->SetLineColor(kBlue); // Blue
    4462           1 :   extCoolFreon->SetLineWidth(1);
    4463           1 :   extCoolFreon->SetFillColor(extCoolFreon->GetLineColor());
    4464           1 :   extCoolFreon->SetFillStyle(4000); // 0% transparent
    4465             : 
    4466           2 :   TGeoVolume *forwOptFibs = new TGeoVolume("ITSsuppSPDSideAForwTrayOptFibs",
    4467           1 :                                            optFibsForw, medFibs);
    4468             : 
    4469           1 :   forwOptFibs->SetVisibility(kTRUE);
    4470           1 :   forwOptFibs->SetLineColor(kOrange); // Orange
    4471           1 :   forwOptFibs->SetLineWidth(1);
    4472           1 :   forwOptFibs->SetFillColor(forwOptFibs->GetLineColor());
    4473           1 :   forwOptFibs->SetFillStyle(4000); // 0% transparent
    4474             : 
    4475           2 :   TGeoVolume *extOptFibs = new TGeoVolume("ITSsuppSPDSideAExtTrayOptFibs",
    4476           1 :                                           optFibsExt, medFibs);
    4477             : 
    4478           1 :   extOptFibs->SetVisibility(kTRUE);
    4479           1 :   extOptFibs->SetLineColor(kOrange); // Orange
    4480           1 :   extOptFibs->SetLineWidth(1);
    4481           1 :   extOptFibs->SetFillColor(extOptFibs->GetLineColor());
    4482           1 :   extOptFibs->SetFillStyle(4000); // 0% transparent
    4483             : 
    4484           2 :   TGeoVolume *forwLowCabsCu = new TGeoVolume("ITSsuppSPDSideAForwLowCabsCu",
    4485           1 :                                              lowCablesForwCu, medCu);
    4486             : 
    4487           1 :   forwLowCabsCu->SetVisibility(kTRUE);
    4488           1 :   forwLowCabsCu->SetLineColor(kRed); // Red
    4489           1 :   forwLowCabsCu->SetLineWidth(1);
    4490           1 :   forwLowCabsCu->SetFillColor(forwLowCabsCu->GetLineColor());
    4491           1 :   forwLowCabsCu->SetFillStyle(4000); // 0% transparent
    4492             : 
    4493           2 :   TGeoVolume *forwLowCabsPUR = new TGeoVolume("ITSsuppSPDSideAForwLowCabsPUR",
    4494           1 :                                               lowCablesForwPUR, medPUR);
    4495             : 
    4496           1 :   forwLowCabsPUR->SetVisibility(kTRUE);
    4497           1 :   forwLowCabsPUR->SetLineColor(kBlack); // Black
    4498           1 :   forwLowCabsPUR->SetLineWidth(1);
    4499           1 :   forwLowCabsPUR->SetFillColor(forwLowCabsPUR->GetLineColor());
    4500           1 :   forwLowCabsPUR->SetFillStyle(4000); // 0% transparent
    4501             : 
    4502           2 :   TGeoVolume *extLowCabsCu = new TGeoVolume("ITSsuppSPDSideAExtLowCabsCu",
    4503           1 :                                             lowCablesExtCu, medCu);
    4504             : 
    4505           1 :   extLowCabsCu->SetVisibility(kTRUE);
    4506           1 :   extLowCabsCu->SetLineColor(kRed); // Red
    4507           1 :   extLowCabsCu->SetLineWidth(1);
    4508           1 :   extLowCabsCu->SetFillColor(extLowCabsCu->GetLineColor());
    4509           1 :   extLowCabsCu->SetFillStyle(4000); // 0% transparent
    4510             : 
    4511           2 :   TGeoVolume *extLowCabsPUR = new TGeoVolume("ITSsuppSPDSideAExtLowCabsPUR",
    4512           1 :                                              lowCablesExtPUR, medPUR);
    4513             : 
    4514           1 :   extLowCabsPUR->SetVisibility(kTRUE);
    4515           1 :   extLowCabsPUR->SetLineColor(kBlack); // Black
    4516           1 :   extLowCabsPUR->SetLineWidth(1);
    4517           1 :   extLowCabsPUR->SetFillColor(extLowCabsPUR->GetLineColor());
    4518           1 :   extLowCabsPUR->SetFillStyle(4000); // 0% transparent
    4519             : 
    4520           2 :   TGeoVolume *forwHiCabsCu = new TGeoVolume("ITSsuppSPDSideAForwTrayHiCabsCu",
    4521           1 :                                             hiCablesForwCu, medCu);
    4522             : 
    4523           1 :   forwHiCabsCu->SetVisibility(kTRUE);
    4524           1 :   forwHiCabsCu->SetLineColor(kRed); // Red
    4525           1 :   forwHiCabsCu->SetLineWidth(1);
    4526           1 :   forwHiCabsCu->SetFillColor(forwHiCabsCu->GetLineColor());
    4527           1 :   forwHiCabsCu->SetFillStyle(4000); // 0% transparent
    4528             : 
    4529           2 :   TGeoVolume *forwHiCabsPUR = new TGeoVolume("ITSsuppSPDSideAForwTrayHiCabsPUR",
    4530           1 :                                              hiCablesForwPUR, medPUR);
    4531             : 
    4532           1 :   forwHiCabsPUR->SetVisibility(kTRUE);
    4533           1 :   forwHiCabsPUR->SetLineColor(kBlack); // Black
    4534           1 :   forwHiCabsPUR->SetLineWidth(1);
    4535           1 :   forwHiCabsPUR->SetFillColor(forwHiCabsPUR->GetLineColor());
    4536           1 :   forwHiCabsPUR->SetFillStyle(4000); // 0% transparent
    4537             : 
    4538           2 :   TGeoVolume *extHiCabsCu = new TGeoVolume("ITSsuppSPDSideAExtTrayHiCabsCu",
    4539           1 :                                            hiCablesExtCu, medCu);
    4540             : 
    4541           1 :   extHiCabsCu->SetVisibility(kTRUE);
    4542           1 :   extHiCabsCu->SetLineColor(kRed); // Red
    4543           1 :   extHiCabsCu->SetLineWidth(1);
    4544           1 :   extHiCabsCu->SetFillColor(extHiCabsCu->GetLineColor());
    4545           1 :   extHiCabsCu->SetFillStyle(4000); // 0% transparent
    4546             : 
    4547           2 :   TGeoVolume *extHiCabsPUR = new TGeoVolume("ITSsuppSPDSideAExtTrayHiCabsPUR",
    4548           1 :                                             hiCablesExtPUR, medPUR);
    4549             : 
    4550           1 :   extHiCabsPUR->SetVisibility(kTRUE);
    4551           1 :   extHiCabsPUR->SetLineColor(kBlack); // Black
    4552           1 :   extHiCabsPUR->SetLineWidth(1);
    4553           1 :   extHiCabsPUR->SetFillColor(extHiCabsPUR->GetLineColor());
    4554           1 :   extHiCabsPUR->SetFillStyle(4000); // 0% transparent
    4555             : 
    4556           2 :   TGeoVolume *forwCoaxCu = new TGeoVolume("ITSsuppSPDSideAForwTrayCoaxCu",
    4557           1 :                                           coaxCablesForwCu, medCu);
    4558             : 
    4559           1 :   forwCoaxCu->SetVisibility(kTRUE);
    4560           1 :   forwCoaxCu->SetLineColor(kRed); // Red
    4561           1 :   forwCoaxCu->SetLineWidth(1);
    4562           1 :   forwCoaxCu->SetFillColor(forwCoaxCu->GetLineColor());
    4563           1 :   forwCoaxCu->SetFillStyle(4000); // 0% transparent
    4564             : 
    4565           2 :   TGeoVolume *forwCoaxMeg = new TGeoVolume("ITSsuppSPDSideAForwTrayCoaxMeg",
    4566           1 :                                            coaxCablesForwMeg, medMeg);
    4567             : 
    4568           1 :   forwCoaxMeg->SetVisibility(kTRUE);
    4569           1 :   forwCoaxMeg->SetLineColor(kBlack); // Black
    4570           1 :   forwCoaxMeg->SetLineWidth(1);
    4571           1 :   forwCoaxMeg->SetFillColor(forwCoaxMeg->GetLineColor());
    4572           1 :   forwCoaxMeg->SetFillStyle(4000); // 0% transparent
    4573             : 
    4574           2 :   TGeoVolume *extCoaxCu = new TGeoVolume("ITSsuppSPDSideAExtTrayCoaxCu",
    4575           1 :                                          coaxCablesExtCu, medCu);
    4576             : 
    4577           1 :   extCoaxCu->SetVisibility(kTRUE);
    4578           1 :   extCoaxCu->SetLineColor(kRed); // Red
    4579           1 :   extCoaxCu->SetLineWidth(1);
    4580           1 :   extCoaxCu->SetFillColor(extCoaxCu->GetLineColor());
    4581           1 :   extCoaxCu->SetFillStyle(4000); // 0% transparent
    4582             : 
    4583           2 :   TGeoVolume *extCoaxMeg = new TGeoVolume("ITSsuppSPDSideAExtTrayCoaxMeg",
    4584           1 :                                           coaxCablesExtMeg, medMeg);
    4585             : 
    4586           1 :   extCoaxMeg->SetVisibility(kTRUE);
    4587           1 :   extCoaxMeg->SetLineColor(kBlack); // Black
    4588           1 :   extCoaxMeg->SetLineWidth(1);
    4589           1 :   extCoaxMeg->SetFillColor(extCoaxMeg->GetLineColor());
    4590           1 :   extCoaxMeg->SetFillStyle(4000); // 0% transparent
    4591             : 
    4592             : 
    4593             :   // Now build up the trays
    4594           1 :   yloc = forwTrayLowerFace->GetDY();
    4595           1 :   zloc = forwTrayLowerFace->GetDZ();
    4596           2 :   cableTrayAForw->AddNode(forwTrayABase, 1,
    4597           2 :                       new TGeoTranslation(0, yloc, zloc));
    4598             : 
    4599             :   xloc = kForwardTrayWide/2;
    4600           2 :   cableTrayAForw->AddNode(forwTrayASide, 1,
    4601           3 :                       new TGeoCombiTrans( xloc, 0, 0,
    4602           2 :                                          new TGeoRotation("",90,-90,-90)));
    4603           2 :   cableTrayAForw->AddNode(forwTrayASide, 2,
    4604           3 :                       new TGeoCombiTrans(-xloc+kForwardTrayThick, 0, 0,
    4605           2 :                                          new TGeoRotation("",90,-90,-90)));
    4606             : 
    4607           1 :   yloc = kForwardTrayFirstHigh - forwTrayShortCover->GetDY();
    4608           1 :   zloc = forwTrayShortCover->GetDZ();
    4609           2 :   cableTrayAForw->AddNode(forwTrayACoverShort, 1,
    4610           2 :                       new TGeoTranslation(0, yloc, zloc));
    4611             : 
    4612           1 :   yloc = kForwardTraySecondHigh - forwTrayLongCover->GetDY();
    4613           1 :   zloc = kForwardTrayFirstLen + forwTrayLongCover->GetDZ();
    4614           2 :   cableTrayAForw->AddNode(forwTrayACoverLong, 1,
    4615           2 :                       new TGeoTranslation(0, yloc, zloc));
    4616             : 
    4617           1 :   xloc = kForwardTrayWide/2 - kForwardTrayThick - forwTrayWing->GetDX();
    4618           1 :   yloc = kForwardTrayFirstHigh - kForwardTrayThick - forwTrayWing->GetDY();
    4619           1 :   zloc = kForwardTrayFirstLen - forwTrayWing->GetDZ();
    4620           2 :   cableTrayAForw->AddNode(forwTrayAWing, 1,
    4621           2 :                       new TGeoTranslation( xloc, yloc, zloc));
    4622           2 :   cableTrayAForw->AddNode(forwTrayAWing, 2,
    4623           2 :                       new TGeoTranslation(-xloc, yloc, zloc));
    4624             : 
    4625           1 :   yloc = kForwardTrayThick + kForwardTrayInterSpace - forwTrayPlane->GetDY();
    4626           1 :   zloc = forwTrayPlane->GetDZ();
    4627           2 :   cableTrayAForw->AddNode(forwTrayAPlane, 1,
    4628           2 :                       new TGeoTranslation(0, yloc, zloc));
    4629             : 
    4630           1 :   yloc = kForwardTrayThick + forwTrayWall->GetDY();
    4631           1 :   zloc = forwTrayWall->GetDZ();
    4632           2 :   cableTrayAForw->AddNode(forwTrayAWall, 1,
    4633           2 :                       new TGeoTranslation(0, yloc, zloc));
    4634             : 
    4635           1 :   forwCoolTube->AddNode(forwCoolFreon, 1, 0);
    4636             : 
    4637           1 :   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY()
    4638           1 :        + coolTubeForw->GetRmax();
    4639           1 :   zloc = coolTubeForw->GetDz();
    4640           2 :   cableTrayAForw->AddNode(forwCoolTube, 1,
    4641           2 :                       new TGeoTranslation(0, yloc, zloc));
    4642             : 
    4643           1 :   xloc = optFibsForw->GetZ(1) + coolTubeForw->GetRmax();
    4644           1 :   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
    4645           2 :   cableTrayAForw->AddNode(forwOptFibs, 1,
    4646           3 :                       new TGeoCombiTrans( xloc, yloc, 0,
    4647           2 :                                          new TGeoRotation("",-90.,90.,90.)));
    4648             : 
    4649           1 :   xloc = lowCablesForwCu->GetZ(1) + coolTubeForw->GetRmax();
    4650           1 :   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
    4651           2 :   cableTrayAForw->AddNode(forwLowCabsCu, 1,
    4652           3 :                       new TGeoCombiTrans(-xloc, yloc, 0,
    4653           2 :                                          new TGeoRotation("",-90.,90.,90.)));
    4654           2 :   cableTrayAForw->AddNode(forwLowCabsPUR, 1,
    4655           3 :                       new TGeoCombiTrans(-xloc, yloc, 0,
    4656           2 :                                          new TGeoRotation("",-90.,90.,90.)));
    4657             : 
    4658           2 :   xloc = 2*lowCablesForwCu->GetZ(1) +
    4659           2 :          hiCablesForwCu->GetZ(1) + coolTubeForw->GetRmax();
    4660           1 :   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
    4661           2 :   cableTrayAForw->AddNode(forwHiCabsCu, 1,
    4662           3 :                       new TGeoCombiTrans(-xloc, yloc, 0,
    4663           2 :                                          new TGeoRotation("",-90.,90.,90.)));
    4664           2 :   cableTrayAForw->AddNode(forwHiCabsPUR, 1,
    4665           3 :                       new TGeoCombiTrans(-xloc, yloc, 0,
    4666           2 :                                          new TGeoRotation("",-90.,90.,90.)));
    4667             : 
    4668           2 :   xloc = 2*optFibsForw->GetZ(1) + coaxCablesForwCu->GetZ(1) +
    4669           1 :          coolTubeForw->GetRmax();
    4670           1 :   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
    4671           2 :   cableTrayAForw->AddNode(forwCoaxCu, 1,
    4672           3 :                       new TGeoCombiTrans( xloc, yloc, 0,
    4673           2 :                                          new TGeoRotation("",-90.,90.,90.)));
    4674           2 :   cableTrayAForw->AddNode(forwCoaxMeg, 1,
    4675           3 :                       new TGeoCombiTrans( xloc, yloc, 0,
    4676           2 :                                          new TGeoRotation("",-90.,90.,90.)));
    4677             : 
    4678             : 
    4679             :   // To simplify following placement in MARS, origin is on top
    4680           1 :   yloc = -kExternalTrayHigh + kExternalTrayThick/2;
    4681             :   zloc = kExternalTrayLen/2;
    4682           2 :   cableTrayAExt->AddNode(extTrayAHorFace, 1,
    4683           2 :                       new TGeoTranslation( 0, yloc, zloc));
    4684             : 
    4685           1 :   xloc = kExternalTrayWide/2 - kExternalTrayThick/2;
    4686           1 :   yloc = -kExternalTrayHigh/2;
    4687           2 :   cableTrayAExt->AddNode(extTrayAVerFace, 1,
    4688           2 :                       new TGeoTranslation( xloc, yloc, zloc));
    4689           2 :   cableTrayAExt->AddNode(extTrayAVerFace, 2,
    4690           2 :                       new TGeoTranslation(-xloc, yloc, zloc));
    4691             : 
    4692           1 :   yloc = -kExternalTrayThick/2;
    4693           2 :   cableTrayAExt->AddNode(extTrayAHorFace, 2,
    4694           2 :                       new TGeoTranslation( 0, yloc, zloc));
    4695             : 
    4696             :   yloc = -kExternalTrayHigh
    4697           1 :        + kExternalTrayThick + kForwardTrayInterSpace - kExternalTrayThick/2;
    4698           2 :   cableTrayAExt->AddNode(extTrayAHorFace, 3,
    4699           2 :                       new TGeoTranslation( 0, yloc, zloc));
    4700             : 
    4701           1 :   yloc = -kExternalTrayHigh + kExternalTrayThick + extTrayWall->GetDY();
    4702           2 :   cableTrayAExt->AddNode(extTrayAWall, 1,
    4703           2 :                       new TGeoTranslation( 0, yloc, zloc));
    4704             : 
    4705           1 :   extCoolTube->AddNode(extCoolFreon, 1, 0);
    4706             : 
    4707           1 :   yloc = -kExternalTrayHigh + 2*kExternalTrayThick + 2*extTrayWall->GetDY()
    4708           1 :        + coolTubeExt->GetRmax();
    4709           1 :   zloc = coolTubeExt->GetDz();
    4710           2 :   cableTrayAExt->AddNode(extCoolTube, 1,
    4711           2 :                       new TGeoTranslation(0, yloc, zloc));
    4712             : 
    4713           1 :   xloc = optFibsExt->GetZ(1) + coolTubeExt->GetRmax();
    4714           2 :   cableTrayAExt->AddNode(extOptFibs, 1,
    4715           3 :                       new TGeoCombiTrans( xloc, 0, 0,
    4716           2 :                                          new TGeoRotation("",90,-90,-90)));
    4717             : 
    4718           1 :   xloc = coolTubeExt->GetRmax();
    4719           2 :   cableTrayAExt->AddNode(extLowCabsCu, 1,
    4720           3 :                       new TGeoCombiTrans(-xloc, 0, 0,
    4721           2 :                                          new TGeoRotation("",90,-90,-90)));
    4722           2 :   cableTrayAExt->AddNode(extLowCabsPUR, 1,
    4723           3 :                       new TGeoCombiTrans(-xloc, 0, 0,
    4724           2 :                                          new TGeoRotation("",90,-90,-90)));
    4725             : 
    4726           1 :   xloc = lowCablesExtCu->GetZ(1) + coolTubeExt->GetRmax();
    4727           2 :   cableTrayAExt->AddNode(extHiCabsCu, 1,
    4728           3 :                       new TGeoCombiTrans(-xloc, 0, 0,
    4729           2 :                                          new TGeoRotation("",90,-90,-90)));
    4730           2 :   cableTrayAExt->AddNode(extHiCabsPUR, 1,
    4731           3 :                       new TGeoCombiTrans(-xloc, 0, 0,
    4732           2 :                                          new TGeoRotation("",90,-90,-90)));
    4733             : 
    4734           2 :   xloc = coaxCablesExtCu->GetZ(1) + optFibsExt->GetZ(1) +
    4735           1 :          coolTubeExt->GetRmax();
    4736           2 :   cableTrayAExt->AddNode(extCoaxCu, 1,
    4737           3 :                       new TGeoCombiTrans( xloc, 0, 0,
    4738           2 :                                          new TGeoRotation("",90,-90,-90)));
    4739           2 :   cableTrayAExt->AddNode(extCoaxMeg, 1,
    4740           3 :                       new TGeoCombiTrans( xloc, 0, 0,
    4741           2 :                                          new TGeoRotation("",90,-90,-90)));
    4742             : 
    4743           1 :   cableTrayAForw->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    4744           1 :   cableTrayAExt->GetShape()->ComputeBBox(); 
    4745             : 
    4746             :   // Finally put everything in the mother volume
    4747           1 :   Double_t rExtTray = kTrayAR2Trans + kExternalTrayHigh;
    4748             : 
    4749           2 :   moth->AddNode(cableTrayAForw,1,
    4750           2 :                 new TGeoTranslation( 0, kTrayAR1Trans, kTrayAZTrans));
    4751           2 :   moth->AddNode(cableTrayAForw,2,
    4752           3 :                 new TGeoCombiTrans(  0,-kTrayAR1Trans, kTrayAZTrans,
    4753           2 :                                     new TGeoRotation("",180, 0, 0)));
    4754             : 
    4755           1 :   yloc = kTrayAR1Trans + kExternalTrayHigh;
    4756           1 :   zloc = kTrayAZTrans + kForwardTrayTotalLen;
    4757           2 :   moth->AddNode(cableTrayAExt,1,
    4758           3 :                 new TGeoCombiTrans( 0, yloc, zloc,
    4759           2 :                                     new TGeoRotation("",  0,-kTrayAZRot, 0)));
    4760           2 :   moth->AddNode(cableTrayAExt,2,
    4761           3 :                 new TGeoCombiTrans( 0,-yloc, zloc,
    4762           2 :                                     new TGeoRotation("",180,-kTrayAZRot, 0)));
    4763             : 
    4764             :   alpharot = kTrayAFirstRotAng + kTrayASecondRotAng;
    4765           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4766           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4767           2 :   moth->AddNode(cableTrayAForw,3,
    4768           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4769           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4770           1 :   xloc = rExtTray*SinD(alpharot);
    4771           1 :   yloc = rExtTray*CosD(alpharot);
    4772           2 :   moth->AddNode(cableTrayAExt,3,
    4773           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4774           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4775             : 
    4776             :   alpharot += 180;
    4777           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4778           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4779           2 :   moth->AddNode(cableTrayAForw,4,
    4780           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4781           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4782           1 :   xloc = rExtTray*SinD(alpharot);
    4783           1 :   yloc = rExtTray*CosD(alpharot);
    4784           2 :   moth->AddNode(cableTrayAExt,4,
    4785           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4786           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4787             : 
    4788             :   alpharot = - kTrayAFirstRotAng - kTrayASecondRotAng;
    4789           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4790           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4791           2 :   moth->AddNode(cableTrayAForw,5,
    4792           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4793           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4794           1 :   xloc = rExtTray*SinD(alpharot);
    4795           1 :   yloc = rExtTray*CosD(alpharot);
    4796           2 :   moth->AddNode(cableTrayAExt,5,
    4797           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4798           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4799             : 
    4800             :   alpharot += 180;
    4801           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4802           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4803           2 :   moth->AddNode(cableTrayAForw,6,
    4804           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4805           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4806           1 :   xloc = rExtTray*SinD(alpharot);
    4807           1 :   yloc = rExtTray*CosD(alpharot);
    4808           2 :   moth->AddNode(cableTrayAExt,6,
    4809           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4810           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4811             : 
    4812             :   alpharot = kTrayAFirstRotAng + 3*kTrayASecondRotAng;
    4813           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4814           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4815           2 :   moth->AddNode(cableTrayAForw,7,
    4816           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4817           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4818           1 :   xloc = rExtTray*SinD(alpharot);
    4819           1 :   yloc = rExtTray*CosD(alpharot);
    4820           2 :   moth->AddNode(cableTrayAExt,7,
    4821           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4822           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4823             : 
    4824             :   alpharot += 180;
    4825           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4826           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4827           2 :   moth->AddNode(cableTrayAForw,8,
    4828           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4829           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4830           1 :   xloc = rExtTray*SinD(alpharot);
    4831           1 :   yloc = rExtTray*CosD(alpharot);
    4832           2 :   moth->AddNode(cableTrayAExt,8,
    4833           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4834           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4835             : 
    4836             :   alpharot = - kTrayAFirstRotAng - 3*kTrayASecondRotAng;
    4837           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4838           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4839           2 :   moth->AddNode(cableTrayAForw,9,
    4840           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4841           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4842           1 :   xloc = rExtTray*SinD(alpharot);
    4843           1 :   yloc = rExtTray*CosD(alpharot);
    4844           2 :   moth->AddNode(cableTrayAExt,9,
    4845           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4846           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4847             : 
    4848             :   alpharot += 180;
    4849           1 :   xloc = kTrayAR2Trans*SinD(alpharot);
    4850           1 :   yloc = kTrayAR2Trans*CosD(alpharot);
    4851           2 :   moth->AddNode(cableTrayAForw,10,
    4852           3 :                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
    4853           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    4854           1 :   xloc = rExtTray*SinD(alpharot);
    4855           1 :   yloc = rExtTray*CosD(alpharot);
    4856           2 :   moth->AddNode(cableTrayAExt,10,
    4857           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    4858           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    4859             : 
    4860             : 
    4861             :   return;
    4862           1 : }
    4863             : 
    4864             : //______________________________________________________________________
    4865             : void AliITSv11GeometrySupport::SPDCableTraysSideC(TGeoVolume *moth,
    4866             :                                             const TGeoManager *mgr){
    4867             : //
    4868             : // Creates the SPD cable trays which are outside the ITS support cones
    4869             : // but still inside the TPC on Side C
    4870             : // (part of this code is taken or anyway inspired to ServicesCableSupport
    4871             : // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    4872             : //
    4873             : // Input:
    4874             : //         moth : the TGeoVolume owing the volume structure
    4875             : //         mgr  : the GeoManager (default gGeoManager)
    4876             : // Output:
    4877             : //
    4878             : // Return:
    4879             : //
    4880             : // Created:         ???       Bjorn S. Nilsen
    4881             : // Updated:      22 Apr 2010  Mario Sitta
    4882             : // Updated:      10 Jun 2010  Mario Sitta  Freon inside cooling pipes
    4883             : // Updated:      08 Sep 2010  Mario Sitta
    4884             : // Updated:      14 Sep 2010  Mario Sitta  Cables prolonged till cone
    4885             : // Updated:      20 Dec 2011  Mario Sitta  Composite vol to avoid new overlap
    4886             : //
    4887             : // Technical data are taken from AutoCAD drawings and other (oral)
    4888             : // information given by D.Elia
    4889             : // Optical fibers and voltage cables are approximated with mean materials
    4890             : // and square cross sections, but preserving the total material budget.
    4891             : //
    4892             : 
    4893             :   // Dimensions and positions of the C-Side Cable Tray elements
    4894             :   const Int_t    kNumTraysSideC       =   10;
    4895             : 
    4896           2 :   const Double_t kTrayCCablesOutRot   =   75.000 *fgkDegree;// Computed
    4897           1 :   const Double_t kTrayCCablesZLenOut  =  245.000 *fgkmm;// Computed
    4898             : 
    4899           1 :   const Double_t kTrayCHalfWide       =    6.350 *fgkcm;
    4900           1 :   const Double_t kTrayCLength1        =  172.800 *fgkcm;
    4901           1 :   const Double_t kTrayCLength2        =  189.300 *fgkcm;
    4902           1 :   const Double_t kTrayCFirstLen       =  435.000 *fgkmm;
    4903           1 :   const Double_t kTrayCFirstHigh      =   83.000 *fgkmm;//!!!TO BE CHECKED!!!
    4904           1 :   const Double_t kTrayCSecondHigh     =   52.700 *fgkmm;//!!!TO BE CHECKED!!!
    4905           1 :   const Double_t kTrayCThick          =    0.200 *fgkcm;
    4906           1 :   const Double_t kTrayCInterSpace     =   18.000 *fgkmm;//!!!TO BE CHECKED!!!
    4907           1 :   const Double_t kTrayCFoldAngle      =    5.000 *fgkDegree;
    4908             : 
    4909           1 :   const Double_t kCoolingTubeRmin     =    2.000 *fgkmm;
    4910           1 :   const Double_t kCoolingTubeRmax     =    3.000 *fgkmm;
    4911           1 :   const Double_t kOpticalFibersSect   =    8.696 *fgkmm;//!!!ESTIMATED!!!
    4912           1 :   const Double_t kLowVoltCableSectCu  =    7.675 *fgkmm;// Computed
    4913             :   const Double_t kLowVoltCableHighPUR =    1.000 *fgkmm;// Computed
    4914           1 :   const Double_t kHiVoltCableSectCu   =    1.535 *fgkmm;// Computed
    4915           1 :   const Double_t kHiVoltCableHighPUR  =    0.500 *fgkmm;// Computed
    4916           1 :   const Double_t kCoaxCableSectCu     =    6.024 *fgkmm;// Computed
    4917           1 :   const Double_t kCoaxCableHighMeg    =    5.695 *fgkmm;// Computed
    4918             : 
    4919           1 :   const Double_t kCablesYtrans        =    2.500 *fgkmm;// Avoid ovlps
    4920             : 
    4921             :   // Overall position and rotation of the C-Side Cable Trays
    4922           1 :   const Double_t kTraySideCRPos       =   45.300 *fgkcm;
    4923           1 :   const Double_t kTraySideCZPos       = -102.400 *fgkcm;
    4924             :   const Double_t kTraySideCAlphaRot[kNumTraysSideC/2]  =
    4925             :     {    0.0,      41.0,     -41.0,      76.0,      -76.0};
    4926             :   // From position of the other trays
    4927             : 
    4928             : 
    4929             :   // Local variables
    4930           1 :   Double_t xprof[8], yprof[8];
    4931             :   Double_t xloc, yloc, zloc, delta, alpharot;
    4932             : 
    4933             : 
    4934             :   // The single C-Side Cable tray as an assembly
    4935           1 :   TGeoVolumeAssembly *cableTrayC = new TGeoVolumeAssembly("ITSsupportSPDTrayC");
    4936             : 
    4937             :   // First create all needed shapes
    4938             : 
    4939             :   // The Cable Tray lower face: a Xtru
    4940           1 :   TGeoXtru *sideCHorFace = new TGeoXtru(2);
    4941           1 :   sideCHorFace->SetName("ITSsuppSPDTraySideCHor");
    4942             : 
    4943           1 :   xprof[0] = 0.;
    4944           1 :   yprof[0] = 0.;
    4945           1 :   xprof[1] = kTrayCLength1;
    4946           1 :   yprof[1] = 0.;
    4947           1 :   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
    4948           1 :   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
    4949           1 :   xprof[3] = xprof[2] - kTrayCThick*SinD(kTrayCFoldAngle);
    4950           1 :   yprof[3] = yprof[2] + kTrayCThick*CosD(kTrayCFoldAngle);
    4951           2 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    4952           1 :               kTrayCThick , xprof[4], yprof[4]);
    4953           1 :   xprof[5] = 0.;
    4954           1 :   yprof[5] = kTrayCThick;
    4955             : 
    4956           1 :   delta = kTrayCHalfWide - kTrayCThick;
    4957             : 
    4958           1 :   sideCHorFace->DefinePolygon(6, xprof, yprof);
    4959           1 :   sideCHorFace->DefineSection(0,-delta);
    4960           1 :   sideCHorFace->DefineSection(1, delta);
    4961             : 
    4962             :   // The Cable Tray middle face: a Xtru
    4963             :   // (somehow duplicate of HorFace, but in this way avoid an overlap with Wall)
    4964           1 :   TGeoXtru *sideCMidFace = new TGeoXtru(2);
    4965             : 
    4966           1 :   xprof[0] = 0.;
    4967           1 :   yprof[0] = kTrayCInterSpace + kTrayCThick;
    4968           1 :   xprof[1] = kTrayCLength1;
    4969           1 :   yprof[1] = yprof[0];
    4970           1 :   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
    4971           1 :   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
    4972           1 :   xprof[3] = xprof[2] - kTrayCThick*SinD(kTrayCFoldAngle);
    4973           1 :   yprof[3] = yprof[2] + kTrayCThick*CosD(kTrayCFoldAngle);
    4974           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    4975             :               kTrayCThick , xprof[4], yprof[4]);
    4976           1 :   xprof[5] = 0.;
    4977           1 :   yprof[5] = yprof[0] + kTrayCThick;
    4978             : 
    4979             :   delta = kTrayCHalfWide - kTrayCThick;
    4980             : 
    4981           1 :   sideCMidFace->DefinePolygon(6, xprof, yprof);
    4982           1 :   sideCMidFace->DefineSection(0,-delta);
    4983           1 :   sideCMidFace->DefineSection(1, delta);
    4984             : 
    4985             :   // The Cable Tray lower face: a Xtru
    4986           1 :   TGeoXtru *sideCSideFace = new TGeoXtru(2);
    4987             : 
    4988           1 :   xprof[0] = 0.;
    4989           1 :   yprof[0] = 0.;
    4990           1 :   xprof[1] = kTrayCLength1;
    4991           1 :   yprof[1] = 0.;
    4992           1 :   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
    4993           1 :   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
    4994           1 :   xprof[3] = xprof[2] - kTrayCSecondHigh*SinD(kTrayCFoldAngle);
    4995           1 :   yprof[3] = yprof[2] + kTrayCSecondHigh*CosD(kTrayCFoldAngle);
    4996           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    4997             :               kTrayCSecondHigh , xprof[4], yprof[4]);
    4998           1 :   xprof[5] = kTrayCFirstLen;
    4999           1 :   yprof[5] = kTrayCSecondHigh;
    5000           1 :   xprof[6] = xprof[5];
    5001           1 :   yprof[6] = kTrayCFirstHigh;
    5002           1 :   xprof[7] = xprof[0];
    5003           1 :   yprof[7] = yprof[6];
    5004             : 
    5005           1 :   sideCSideFace->DefinePolygon(8, xprof, yprof);
    5006           1 :   sideCSideFace->DefineSection(0, 0);
    5007           1 :   sideCSideFace->DefineSection(1, kTrayCThick);
    5008             : 
    5009             :   // The short cover: a BBox
    5010           2 :   TGeoBBox *sideCShortCover = new TGeoBBox(kTrayCFirstLen/2,
    5011           1 :                                            kTrayCThick/2,
    5012             :                                            kTrayCHalfWide-kTrayCThick);
    5013             : 
    5014             :   // The long cover: a Xtru
    5015           1 :   TGeoXtru *sideCLongCover = new TGeoXtru(2);
    5016             : 
    5017           1 :   xprof[5] = sideCSideFace->GetX(5);
    5018           1 :   yprof[5] = sideCSideFace->GetY(5);
    5019           1 :   xprof[4] = sideCSideFace->GetX(4);
    5020           1 :   yprof[4] = sideCSideFace->GetY(4);
    5021           1 :   xprof[3] = sideCSideFace->GetX(3);
    5022           1 :   yprof[3] = sideCSideFace->GetY(3);
    5023           1 :   xprof[2] = xprof[3] + kTrayCThick*SinD(kTrayCFoldAngle);
    5024           1 :   yprof[2] = yprof[3] - kTrayCThick*CosD(kTrayCFoldAngle);
    5025           2 :   InsidePoint(xprof[5], yprof[5], xprof[4], yprof[4], xprof[3], yprof[3],
    5026           1 :              -kTrayCThick , xprof[1], yprof[1]);
    5027           1 :   xprof[0] = xprof[5];
    5028           1 :   yprof[0] = yprof[5] - kTrayCThick;
    5029             : 
    5030             :   delta = kTrayCHalfWide - kTrayCThick;
    5031             : 
    5032           1 :   sideCLongCover->DefinePolygon(6, xprof, yprof);
    5033           1 :   sideCLongCover->DefineSection(0,-delta);
    5034           1 :   sideCLongCover->DefineSection(1, delta);
    5035             : 
    5036             :   // The internal wall: a Xtru
    5037           1 :   TGeoXtru *intWall = new TGeoXtru(2);
    5038           1 :   intWall->SetName("ITSsuppSPDTraySideCWall");
    5039             : 
    5040           1 :   xprof[0] = sideCHorFace->GetX(5);
    5041           1 :   yprof[0] = sideCHorFace->GetY(5);
    5042           1 :   xprof[1] = sideCHorFace->GetX(4);
    5043           1 :   yprof[1] = sideCHorFace->GetY(4);
    5044           1 :   xprof[2] = sideCHorFace->GetX(3);
    5045           1 :   yprof[2] = sideCHorFace->GetY(3);
    5046           1 :   xprof[3] = sideCMidFace->GetX(2);
    5047           1 :   yprof[3] = sideCMidFace->GetY(2);
    5048           1 :   xprof[4] = sideCMidFace->GetX(1);
    5049           1 :   yprof[4] = sideCMidFace->GetY(1);
    5050           1 :   xprof[5] = sideCMidFace->GetX(0);
    5051           1 :   yprof[5] = sideCMidFace->GetY(0);
    5052             : 
    5053           1 :   intWall->DefinePolygon(6, xprof, yprof);
    5054           1 :   intWall->DefineSection(0,-kTrayCThick/2);
    5055           1 :   intWall->DefineSection(1, kTrayCThick/2);
    5056             : 
    5057             :   // The horizontal part of the cooling tube inside the tray: a Tube
    5058           1 :   delta = sideCMidFace->GetX(4) - sideCMidFace->GetX(5);
    5059           1 :   TGeoTube *horTube = new TGeoTube(0, kCoolingTubeRmax, delta/2);
    5060             : 
    5061             :   // The freon inside the horizontal part of the cooling tube: a Tube
    5062           1 :   TGeoTube *horFreon = new TGeoTube(0, kCoolingTubeRmin, delta/2);
    5063             : 
    5064             :   // The inclined part of the cooling tube inside the tray: a Ctub
    5065             :   Double_t x3, y3, x4, y4;
    5066           1 :   x3 = sideCMidFace->GetX(3);
    5067           1 :   y3 = sideCMidFace->GetY(3);
    5068           1 :   x4 = sideCMidFace->GetX(4);
    5069           1 :   y4 = sideCMidFace->GetY(4);
    5070           3 :   delta = TMath::Sqrt( (x4 - x3 + kCoolingTubeRmax*SinD(kTrayCFoldAngle))*
    5071           2 :                        (x4 - x3 + kCoolingTubeRmax*SinD(kTrayCFoldAngle))    +
    5072           2 :        (y4 + kCoolingTubeRmax - y3 - kCoolingTubeRmax*SinD(kTrayCFoldAngle))*
    5073           1 :        (y4 + kCoolingTubeRmax - y3 - kCoolingTubeRmax*SinD(kTrayCFoldAngle)) );
    5074             : 
    5075           2 :   TGeoCtub *incTube = new TGeoCtub(0, kCoolingTubeRmax, delta/2, 0, 360,
    5076           3 :                                0, SinD(kTrayCFoldAngle),-CosD(kTrayCFoldAngle),
    5077             :                                0,                     0,                    1);
    5078             : 
    5079             :   // The freon inside the inclined part of the cooling tube: a Ctub
    5080           2 :   TGeoCtub *incFreon = new TGeoCtub(0, kCoolingTubeRmin, delta/2, 0, 360,
    5081           3 :                                0, SinD(kTrayCFoldAngle),-CosD(kTrayCFoldAngle),
    5082             :                                0,                     0,                    1);
    5083             : 
    5084             :   // The part of the cooling tube outside the tray: a Ctub
    5085           2 :   TGeoCtub *outTube = new TGeoCtub(0, kCoolingTubeRmax,
    5086           2 :                         0.5*kTrayCCablesZLenOut/SinD(kTrayCCablesOutRot),
    5087             :                         0, 360,
    5088             :                         0,                        0,                      -1,
    5089           2 :                         0,-SinD(kTrayCCablesOutRot), CosD(kTrayCCablesOutRot));
    5090             : 
    5091             :   // The freon inside the part of the cooling tube outside the tray: a Ctub
    5092           2 :   TGeoCtub *outFreon = new TGeoCtub(0, kCoolingTubeRmin,
    5093           1 :                         outTube->GetDz(),
    5094             :                         0, 360,
    5095             :                         0,                        0,                      -1,
    5096           2 :                         0,-SinD(kTrayCCablesOutRot), CosD(kTrayCCablesOutRot));
    5097             : 
    5098             :   // The optical fibers inside the tray: a Xtru
    5099           1 :   TGeoXtru *optFibs = new TGeoXtru(2);
    5100             : 
    5101           1 :   xprof[0] = -kTrayCCablesZLenOut;
    5102           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
    5103           1 :   xprof[1] = sideCMidFace->GetX(5);
    5104           1 :   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
    5105           1 :   xprof[2] = sideCMidFace->GetX(4);
    5106           1 :   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
    5107           1 :   xprof[3] = sideCMidFace->GetX(3);
    5108           1 :   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
    5109           1 :   xprof[4] = xprof[3] - kOpticalFibersSect*SinD(kTrayCFoldAngle);
    5110           1 :   yprof[4] = yprof[3] + kOpticalFibersSect*CosD(kTrayCFoldAngle);
    5111           1 :   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
    5112             :               kOpticalFibersSect , xprof[5], yprof[5]);
    5113           1 :   xprof[6] = 0.;
    5114           1 :   yprof[6] = yprof[1] + kOpticalFibersSect;
    5115           1 :   xprof[7] = xprof[0];
    5116           1 :   yprof[7] = yprof[0] + kOpticalFibersSect;
    5117             : 
    5118           1 :   optFibs->DefinePolygon(8, xprof, yprof);
    5119           1 :   optFibs->DefineSection(0, 0);
    5120           1 :   optFibs->DefineSection(1, kOpticalFibersSect);
    5121             : 
    5122             :   // The low voltage cables inside the tray: two Xtru
    5123           1 :   TGeoXtru *lowCablesCu = new TGeoXtru(2);
    5124             : 
    5125           1 :   xprof[0] = -kTrayCCablesZLenOut;
    5126           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
    5127           1 :   xprof[1] = sideCMidFace->GetX(5);
    5128           1 :   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
    5129           1 :   xprof[2] = sideCMidFace->GetX(4);
    5130           1 :   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
    5131           1 :   xprof[3] = sideCMidFace->GetX(3);
    5132           1 :   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
    5133           1 :   xprof[4] = xprof[3] - kLowVoltCableSectCu*SinD(kTrayCFoldAngle);
    5134           1 :   yprof[4] = yprof[3] + kLowVoltCableSectCu*CosD(kTrayCFoldAngle);
    5135           1 :   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
    5136             :               kLowVoltCableSectCu , xprof[5], yprof[5]);
    5137           1 :   xprof[6] = 0.;
    5138           1 :   yprof[6] = yprof[1] + kLowVoltCableSectCu;
    5139           1 :   xprof[7] = xprof[0];
    5140           1 :   yprof[7] = yprof[0] + kLowVoltCableSectCu;
    5141             : 
    5142           1 :   lowCablesCu->DefinePolygon(8, xprof, yprof);
    5143           1 :   lowCablesCu->DefineSection(0, 0);
    5144           1 :   lowCablesCu->DefineSection(1, kLowVoltCableSectCu);
    5145             : 
    5146           1 :   TGeoXtru *lowCablesPUR = new TGeoXtru(2);
    5147             : 
    5148           1 :   xprof[0] = lowCablesCu->GetX(7);
    5149           1 :   yprof[0] = lowCablesCu->GetY(7);
    5150           1 :   xprof[1] = lowCablesCu->GetX(6);
    5151           1 :   yprof[1] = lowCablesCu->GetY(6);
    5152           1 :   xprof[2] = lowCablesCu->GetX(5);
    5153           1 :   yprof[2] = lowCablesCu->GetY(5);
    5154           1 :   xprof[3] = lowCablesCu->GetX(4);
    5155           1 :   yprof[3] = lowCablesCu->GetY(4);
    5156           1 :   xprof[4] = xprof[3] - kLowVoltCableHighPUR*SinD(kTrayCFoldAngle);
    5157           1 :   yprof[4] = yprof[3] + kLowVoltCableHighPUR*CosD(kTrayCFoldAngle);
    5158           1 :   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
    5159             :               kLowVoltCableHighPUR , xprof[5], yprof[5]);
    5160           1 :   xprof[6] = 0.;
    5161           1 :   yprof[6] = yprof[1] + kLowVoltCableHighPUR;
    5162           1 :   xprof[7] = xprof[0];
    5163           1 :   yprof[7] = yprof[0] + kLowVoltCableHighPUR;
    5164             : 
    5165           1 :   lowCablesPUR->DefinePolygon(8, xprof, yprof);
    5166           1 :   lowCablesPUR->DefineSection(0, 0);
    5167           1 :   lowCablesPUR->DefineSection(1, kLowVoltCableSectCu);
    5168             : 
    5169             :   // The high voltage cables inside the tray: two Xtru
    5170           1 :   TGeoXtru *hiCablesCu = new TGeoXtru(2);
    5171             : 
    5172           1 :   xprof[0] = -kTrayCCablesZLenOut;
    5173           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
    5174           1 :   xprof[1] = sideCMidFace->GetX(5);
    5175           1 :   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
    5176           1 :   xprof[2] = sideCMidFace->GetX(4);
    5177           1 :   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
    5178           1 :   xprof[3] = sideCMidFace->GetX(3);
    5179           1 :   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
    5180           1 :   xprof[4] = xprof[3] - kHiVoltCableSectCu*SinD(kTrayCFoldAngle);
    5181           1 :   yprof[4] = yprof[3] + kHiVoltCableSectCu*CosD(kTrayCFoldAngle);
    5182           1 :   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
    5183             :               kHiVoltCableSectCu , xprof[5], yprof[5]);
    5184           1 :   xprof[6] = 0.;
    5185           1 :   yprof[6] = yprof[1] + kHiVoltCableSectCu;
    5186           1 :   xprof[7] = xprof[0];
    5187           1 :   yprof[7] = yprof[0] + kHiVoltCableSectCu;
    5188             : 
    5189           1 :   hiCablesCu->DefinePolygon(8, xprof, yprof);
    5190           1 :   hiCablesCu->DefineSection(0, 0);
    5191           1 :   hiCablesCu->DefineSection(1, kHiVoltCableSectCu);
    5192             : 
    5193           1 :   TGeoXtru *hiCablesPUR = new TGeoXtru(2);
    5194             : 
    5195           1 :   xprof[0] = hiCablesCu->GetX(7);
    5196           1 :   yprof[0] = hiCablesCu->GetY(7);
    5197           1 :   xprof[1] = hiCablesCu->GetX(6);
    5198           1 :   yprof[1] = hiCablesCu->GetY(6);
    5199           1 :   xprof[2] = hiCablesCu->GetX(5);
    5200           1 :   yprof[2] = hiCablesCu->GetY(5);
    5201           1 :   xprof[3] = hiCablesCu->GetX(4);
    5202           1 :   yprof[3] = hiCablesCu->GetY(4);
    5203           1 :   xprof[4] = xprof[3] - kHiVoltCableHighPUR*SinD(kTrayCFoldAngle);
    5204           1 :   yprof[4] = yprof[3] + kHiVoltCableHighPUR*CosD(kTrayCFoldAngle);
    5205           1 :   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
    5206             :               kHiVoltCableHighPUR , xprof[5], yprof[5]);
    5207           1 :   xprof[6] = 0.;
    5208           1 :   yprof[6] = yprof[1] + kHiVoltCableHighPUR;
    5209           1 :   xprof[7] = xprof[0];
    5210           1 :   yprof[7] = yprof[0] + kHiVoltCableHighPUR;
    5211             : 
    5212           1 :   hiCablesPUR->DefinePolygon(8, xprof, yprof);
    5213           1 :   hiCablesPUR->DefineSection(0, 0);
    5214           1 :   hiCablesPUR->DefineSection(1, kHiVoltCableSectCu);
    5215             : 
    5216             :   // The coaxial cables inside the tray: two Xtru
    5217           1 :   TGeoXtru *coaxCablesCu = new TGeoXtru(2);
    5218             : 
    5219           1 :   xprof[0] = -kTrayCCablesZLenOut;
    5220           1 :   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
    5221           1 :   xprof[1] = sideCMidFace->GetX(5);
    5222           1 :   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
    5223           1 :   xprof[2] = sideCMidFace->GetX(4);
    5224           1 :   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
    5225           1 :   xprof[3] = sideCMidFace->GetX(3);
    5226           1 :   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
    5227           1 :   xprof[4] = xprof[3] - kCoaxCableSectCu*SinD(kTrayCFoldAngle);
    5228           1 :   yprof[4] = yprof[3] + kCoaxCableSectCu*CosD(kTrayCFoldAngle);
    5229           1 :   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
    5230             :               kCoaxCableSectCu , xprof[5], yprof[5]);
    5231           1 :   xprof[6] = 0.;
    5232           1 :   yprof[6] = yprof[1] + kCoaxCableSectCu;
    5233           1 :   xprof[7] = xprof[0];
    5234           1 :   yprof[7] = yprof[0] + kCoaxCableSectCu;
    5235             : 
    5236           1 :   coaxCablesCu->DefinePolygon(8, xprof, yprof);
    5237           1 :   coaxCablesCu->DefineSection(0, 0);
    5238           1 :   coaxCablesCu->DefineSection(1, kCoaxCableSectCu);
    5239             : 
    5240           1 :   TGeoXtru *coaxCablesMeg = new TGeoXtru(2);
    5241             : 
    5242           1 :   xprof[0] = coaxCablesCu->GetX(7);
    5243           1 :   yprof[0] = coaxCablesCu->GetY(7);
    5244           1 :   xprof[1] = coaxCablesCu->GetX(6);
    5245           1 :   yprof[1] = coaxCablesCu->GetY(6);
    5246           1 :   xprof[2] = coaxCablesCu->GetX(5);
    5247           1 :   yprof[2] = coaxCablesCu->GetY(5);
    5248           1 :   xprof[3] = coaxCablesCu->GetX(4);
    5249           1 :   yprof[3] = coaxCablesCu->GetY(4);
    5250           1 :   xprof[4] = xprof[3] - kCoaxCableHighMeg*SinD(kTrayCFoldAngle);
    5251           1 :   yprof[4] = yprof[3] + kCoaxCableHighMeg*CosD(kTrayCFoldAngle);
    5252           1 :   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
    5253             :               kCoaxCableHighMeg , xprof[5], yprof[5]);
    5254           1 :   xprof[6] = 0.;
    5255           1 :   yprof[6] = yprof[1] + kCoaxCableHighMeg;
    5256           1 :   xprof[7] = xprof[0];
    5257           1 :   yprof[7] = yprof[0] + kCoaxCableHighMeg;
    5258             : 
    5259           1 :   coaxCablesMeg->DefinePolygon(8, xprof, yprof);
    5260           1 :   coaxCablesMeg->DefineSection(0, 0);
    5261           1 :   coaxCablesMeg->DefineSection(1, kCoaxCableSectCu);
    5262             : 
    5263             :   // To avoid a newly discovered overlap,
    5264             :   // transform the two overlapping volumes into a Composite Shape
    5265             :   TGeoCompositeShape *trayIntern =
    5266           1 :     new TGeoCompositeShape("ITSSPDInternalTrayC",
    5267             :                            "ITSsuppSPDTraySideCHor+ITSsuppSPDTraySideCWall");
    5268             : 
    5269             :   // We have all shapes: now create the real volumes
    5270           1 :   TGeoMedium *medAl   = mgr->GetMedium("ITS_ALUMINUM$");
    5271           1 :   TGeoMedium *medIn   = mgr->GetMedium("ITS_INOX$");
    5272           1 :   TGeoMedium *medFr   = mgr->GetMedium("ITS_Freon$");
    5273           1 :   TGeoMedium *medFibs = mgr->GetMedium("ITS_SDD OPTICFIB$");//!!TO BE CHECKED!!
    5274           1 :   TGeoMedium *medCu   = mgr->GetMedium("ITS_COPPER$");
    5275           1 :   TGeoMedium *medPUR  = mgr->GetMedium("ITS_POLYURETHANE$");
    5276           1 :   TGeoMedium *medMeg  = mgr->GetMedium("ITS_MEGOLON$");
    5277             : 
    5278           2 :   TGeoVolume *traySideCIntern  = new TGeoVolume("ITSsuppSPDTraySideCInternal",
    5279           1 :                                                 trayIntern, medAl);
    5280             : 
    5281           1 :   traySideCIntern->SetVisibility(kTRUE);
    5282           1 :   traySideCIntern->SetLineColor(6); // Purple
    5283           1 :   traySideCIntern->SetLineWidth(1);
    5284           1 :   traySideCIntern->SetFillColor(traySideCIntern->GetLineColor());
    5285           1 :   traySideCIntern->SetFillStyle(4000); // 0% transparent
    5286             : 
    5287           2 :   TGeoVolume *traySideCMidFace  = new TGeoVolume("ITSsuppSPDTraySideCMid",
    5288           1 :                                                  sideCMidFace, medAl);
    5289             : 
    5290           1 :   traySideCMidFace->SetVisibility(kTRUE);
    5291           1 :   traySideCMidFace->SetLineColor(6); // Purple
    5292           1 :   traySideCMidFace->SetLineWidth(1);
    5293           1 :   traySideCMidFace->SetFillColor(traySideCMidFace->GetLineColor());
    5294           1 :   traySideCMidFace->SetFillStyle(4000); // 0% transparent
    5295             : 
    5296           2 :   TGeoVolume *traySideCSideFace  = new TGeoVolume("ITSsuppSPDTraySideCSide",
    5297           1 :                                                   sideCSideFace, medAl);
    5298             : 
    5299           1 :   traySideCSideFace->SetVisibility(kTRUE);
    5300           1 :   traySideCSideFace->SetLineColor(6); // Purple
    5301           1 :   traySideCSideFace->SetLineWidth(1);
    5302           1 :   traySideCSideFace->SetFillColor(traySideCSideFace->GetLineColor());
    5303           1 :   traySideCSideFace->SetFillStyle(4000); // 0% transparent
    5304             : 
    5305           2 :   TGeoVolume *traySideCShortCover  = new TGeoVolume("ITSsuppSPDTraySideCShCov",
    5306           1 :                                                     sideCShortCover, medAl);
    5307             : 
    5308           1 :   traySideCShortCover->SetVisibility(kTRUE);
    5309           1 :   traySideCShortCover->SetLineColor(6); // Purple
    5310           1 :   traySideCShortCover->SetLineWidth(1);
    5311           1 :   traySideCShortCover->SetFillColor(traySideCShortCover->GetLineColor());
    5312           1 :   traySideCShortCover->SetFillStyle(4000); // 0% transparent
    5313             : 
    5314           2 :   TGeoVolume *traySideCLongCover  = new TGeoVolume("ITSsuppSPDTraySideCLnCov",
    5315           1 :                                                    sideCLongCover, medAl);
    5316             : 
    5317           1 :   traySideCLongCover->SetVisibility(kTRUE);
    5318           1 :   traySideCLongCover->SetLineColor(6); // Purple
    5319           1 :   traySideCLongCover->SetLineWidth(1);
    5320           1 :   traySideCLongCover->SetFillColor(traySideCLongCover->GetLineColor());
    5321           1 :   traySideCLongCover->SetFillStyle(4000); // 0% transparent
    5322             : 
    5323           2 :   TGeoVolume *traySideCHorTube = new TGeoVolume("ITSsuppSPDTraySideCHorTube",
    5324           1 :                                                 horTube, medIn);
    5325             : 
    5326           1 :   traySideCHorTube->SetVisibility(kTRUE);
    5327           1 :   traySideCHorTube->SetLineColor(kGray); // as in GeometrySPD
    5328           1 :   traySideCHorTube->SetLineWidth(1);
    5329           1 :   traySideCHorTube->SetFillColor(traySideCHorTube->GetLineColor());
    5330           1 :   traySideCHorTube->SetFillStyle(4000); // 0% transparent
    5331             : 
    5332           2 :   TGeoVolume *traySideCHorFreon = new TGeoVolume("ITSsuppSPDTraySideCHorFreon",
    5333           1 :                                                  horFreon, medFr);
    5334             : 
    5335           1 :   traySideCHorFreon->SetVisibility(kTRUE);
    5336           1 :   traySideCHorFreon->SetLineColor(kBlue); // Blue
    5337           1 :   traySideCHorFreon->SetLineWidth(1);
    5338           1 :   traySideCHorFreon->SetFillColor(traySideCHorFreon->GetLineColor());
    5339           1 :   traySideCHorFreon->SetFillStyle(4000); // 0% transparent
    5340             : 
    5341           2 :   TGeoVolume *traySideCIncTube = new TGeoVolume("ITSsuppSPDTraySideCIncTube",
    5342           1 :                                                 incTube, medIn);
    5343             : 
    5344           1 :   traySideCIncTube->SetVisibility(kTRUE);
    5345           1 :   traySideCIncTube->SetLineColor(kGray); // as in GeometrySPD
    5346           1 :   traySideCIncTube->SetLineWidth(1);
    5347           1 :   traySideCIncTube->SetFillColor(traySideCIncTube->GetLineColor());
    5348           1 :   traySideCIncTube->SetFillStyle(4000); // 0% transparent
    5349             : 
    5350           2 :   TGeoVolume *traySideCIncFreon = new TGeoVolume("ITSsuppSPDTraySideCIncFreon",
    5351           1 :                                                  incFreon, medFr);
    5352             : 
    5353           1 :   traySideCIncFreon->SetVisibility(kTRUE);
    5354           1 :   traySideCIncFreon->SetLineColor(kBlue); // Blue
    5355           1 :   traySideCIncFreon->SetLineWidth(1);
    5356           1 :   traySideCIncFreon->SetFillColor(traySideCIncFreon->GetLineColor());
    5357           1 :   traySideCIncFreon->SetFillStyle(4000); // 0% transparent
    5358             : 
    5359           2 :   TGeoVolume *traySideCOutTube = new TGeoVolume("ITSsuppSPDTraySideCOutTube",
    5360           1 :                                                 outTube, medIn);
    5361             : 
    5362           1 :   traySideCOutTube->SetVisibility(kTRUE);
    5363           1 :   traySideCOutTube->SetLineColor(kGray); // as in GeometrySPD
    5364           1 :   traySideCOutTube->SetLineWidth(1);
    5365           1 :   traySideCOutTube->SetFillColor(traySideCOutTube->GetLineColor());
    5366           1 :   traySideCOutTube->SetFillStyle(4000); // 0% transparent
    5367             : 
    5368           2 :   TGeoVolume *traySideCOutFreon = new TGeoVolume("ITSsuppSPDTraySideCOutFreon",
    5369           1 :                                                  outFreon, medFr);
    5370             : 
    5371           1 :   traySideCOutFreon->SetVisibility(kTRUE);
    5372           1 :   traySideCOutFreon->SetLineColor(kBlue); // Blue
    5373           1 :   traySideCOutFreon->SetLineWidth(1);
    5374           1 :   traySideCOutFreon->SetFillColor(traySideCOutFreon->GetLineColor());
    5375           1 :   traySideCOutFreon->SetFillStyle(4000); // 0% transparent
    5376             : 
    5377           2 :   TGeoVolume *traySideCOptFibs = new TGeoVolume("ITSsuppSPDTraySideCOptFibs",
    5378           1 :                                                 optFibs, medFibs);
    5379             : 
    5380           1 :   traySideCOptFibs->SetVisibility(kTRUE);
    5381           1 :   traySideCOptFibs->SetLineColor(kOrange); // Orange
    5382           1 :   traySideCOptFibs->SetLineWidth(1);
    5383           1 :   traySideCOptFibs->SetFillColor(traySideCOptFibs->GetLineColor());
    5384           1 :   traySideCOptFibs->SetFillStyle(4000); // 0% transparent
    5385             : 
    5386           2 :   TGeoVolume *traySideCLowCabsCu = new TGeoVolume("ITSsuppSPDTraySideCLVCu",
    5387           1 :                                                   lowCablesCu, medCu);
    5388             : 
    5389           1 :   traySideCLowCabsCu->SetVisibility(kTRUE);
    5390           1 :   traySideCLowCabsCu->SetLineColor(kRed); // Red
    5391           1 :   traySideCLowCabsCu->SetLineWidth(1);
    5392           1 :   traySideCLowCabsCu->SetFillColor(traySideCLowCabsCu->GetLineColor());
    5393           1 :   traySideCLowCabsCu->SetFillStyle(4000); // 0% transparent
    5394             : 
    5395           2 :   TGeoVolume *traySideCLowCabsPUR = new TGeoVolume("ITSsuppSPDTraySideCLVPUR",
    5396           1 :                                                    lowCablesPUR, medPUR);
    5397             : 
    5398           1 :   traySideCLowCabsPUR->SetVisibility(kTRUE);
    5399           1 :   traySideCLowCabsPUR->SetLineColor(kBlack); // Black
    5400           1 :   traySideCLowCabsPUR->SetLineWidth(1);
    5401           1 :   traySideCLowCabsPUR->SetFillColor(traySideCLowCabsPUR->GetLineColor());
    5402           1 :   traySideCLowCabsPUR->SetFillStyle(4000); // 0% transparent
    5403             : 
    5404           2 :   TGeoVolume *traySideCHiCabsCu = new TGeoVolume("ITSsuppSPDTraySideCHVCu",
    5405           1 :                                                  hiCablesCu, medCu);
    5406             : 
    5407           1 :   traySideCHiCabsCu->SetVisibility(kTRUE);
    5408           1 :   traySideCHiCabsCu->SetLineColor(kRed); // Red
    5409           1 :   traySideCHiCabsCu->SetLineWidth(1);
    5410           1 :   traySideCHiCabsCu->SetFillColor(traySideCHiCabsCu->GetLineColor());
    5411           1 :   traySideCHiCabsCu->SetFillStyle(4000); // 0% transparent
    5412             : 
    5413           2 :   TGeoVolume *traySideCHiCabsPUR = new TGeoVolume("ITSsuppSPDTraySideCHVPUR",
    5414           1 :                                                   hiCablesPUR, medPUR);
    5415             : 
    5416           1 :   traySideCHiCabsPUR->SetVisibility(kTRUE);
    5417           1 :   traySideCHiCabsPUR->SetLineColor(kBlack); // Black
    5418           1 :   traySideCHiCabsPUR->SetLineWidth(1);
    5419           1 :   traySideCHiCabsPUR->SetFillColor(traySideCHiCabsPUR->GetLineColor());
    5420           1 :   traySideCHiCabsPUR->SetFillStyle(4000); // 0% transparent
    5421             : 
    5422           2 :   TGeoVolume *traySideCCoaxCu = new TGeoVolume("ITSsuppSPDTraySideCCoaxCu",
    5423           1 :                                                coaxCablesCu, medCu);
    5424             : 
    5425           1 :   traySideCCoaxCu->SetVisibility(kTRUE);
    5426           1 :   traySideCCoaxCu->SetLineColor(kRed); // Red
    5427           1 :   traySideCCoaxCu->SetLineWidth(1);
    5428           1 :   traySideCCoaxCu->SetFillColor(traySideCCoaxCu->GetLineColor());
    5429           1 :   traySideCCoaxCu->SetFillStyle(4000); // 0% transparent
    5430             : 
    5431           2 :   TGeoVolume *traySideCCoaxMeg = new TGeoVolume("ITSsuppSPDTraySideCCoaxMeg",
    5432           1 :                                                 coaxCablesMeg, medMeg);
    5433             : 
    5434           1 :   traySideCCoaxMeg->SetVisibility(kTRUE);
    5435           1 :   traySideCCoaxMeg->SetLineColor(kBlack); // Black
    5436           1 :   traySideCCoaxMeg->SetLineWidth(1);
    5437           1 :   traySideCCoaxMeg->SetFillColor(traySideCCoaxMeg->GetLineColor());
    5438           1 :   traySideCCoaxMeg->SetFillStyle(4000); // 0% transparent
    5439             : 
    5440             : 
    5441             :   // Now build up the trays
    5442           1 :   cableTrayC->AddNode(traySideCIntern,1,0);
    5443             : 
    5444           1 :   cableTrayC->AddNode(traySideCMidFace,1,0);
    5445             : 
    5446             :   zloc = kTrayCHalfWide - kTrayCThick;
    5447           2 :   cableTrayC->AddNode(traySideCSideFace, 1,
    5448           2 :                       new TGeoTranslation( 0, 0, zloc));
    5449           1 :   zloc = -kTrayCHalfWide;
    5450           2 :   cableTrayC->AddNode(traySideCSideFace, 2,
    5451           2 :                       new TGeoTranslation( 0, 0, zloc));
    5452             : 
    5453           1 :   xloc = sideCShortCover->GetDX();
    5454           1 :   yloc = kTrayCFirstHigh - sideCShortCover->GetDY();
    5455           2 :   cableTrayC->AddNode(traySideCShortCover, 1,
    5456           2 :                       new TGeoTranslation( xloc, yloc, 0));
    5457             : 
    5458           1 :   cableTrayC->AddNode(traySideCLongCover,1,0);
    5459             : 
    5460           1 :   traySideCHorTube->AddNode(traySideCHorFreon, 1, 0);
    5461           1 :   traySideCIncTube->AddNode(traySideCIncFreon, 1, 0);
    5462           1 :   traySideCOutTube->AddNode(traySideCOutFreon, 1, 0);
    5463             : 
    5464           1 :   xloc = horTube->GetDz();
    5465           1 :   yloc = sideCMidFace->GetY(5) + horTube->GetRmax();
    5466           2 :   cableTrayC->AddNode(traySideCHorTube, 1,
    5467           3 :                       new TGeoCombiTrans( xloc, yloc, 0,
    5468           2 :                       new TGeoRotation("",-90.,-90.,90.)));
    5469             : 
    5470           1 :   xloc = sideCMidFace->GetX(4) + (incTube->GetDz())*CosD(kTrayCFoldAngle);
    5471           2 :   yloc = sideCMidFace->GetY(4) +  incTube->GetRmax() +
    5472           2 :             (incTube->GetDz())*SinD(kTrayCFoldAngle)+0.005;//Avoid small ovrlp
    5473           2 :   cableTrayC->AddNode(traySideCIncTube, 1,
    5474           3 :                       new TGeoCombiTrans( xloc, yloc, 0,
    5475           2 :                       new TGeoRotation("",-90.+kTrayCFoldAngle,-90.,90.)));
    5476             : 
    5477           1 :   xloc = -kTrayCCablesZLenOut/2 - outTube->GetRmax();
    5478           2 :   yloc = xloc/TanD(kTrayCCablesOutRot) + sideCMidFace->GetY(4) -
    5479           1 :          2*outTube->GetRmax();
    5480           2 :   cableTrayC->AddNode(traySideCOutTube, 1,
    5481           3 :                       new TGeoCombiTrans( xloc, yloc, 0,
    5482           2 :                       new TGeoRotation("",-70.,-90.,90.)));
    5483             : 
    5484           1 :   zloc = horTube->GetRmax();
    5485           2 :   cableTrayC->AddNode(traySideCOptFibs, 1,
    5486           2 :                       new TGeoTranslation( 0, 0, zloc));
    5487             : 
    5488           1 :   zloc = kLowVoltCableSectCu + horTube->GetRmax();
    5489           2 :   cableTrayC->AddNode(traySideCLowCabsCu, 1,
    5490           2 :                       new TGeoTranslation( 0, 0,-zloc));
    5491           2 :   cableTrayC->AddNode(traySideCLowCabsPUR, 1,
    5492           2 :                       new TGeoTranslation( 0, 0,-zloc));
    5493             : 
    5494           1 :   zloc = kHiVoltCableSectCu + kLowVoltCableSectCu + horTube->GetRmax();
    5495           2 :   cableTrayC->AddNode(traySideCHiCabsCu, 1,
    5496           2 :                       new TGeoTranslation( 0, 0,-zloc));
    5497           2 :   cableTrayC->AddNode(traySideCHiCabsPUR, 1,
    5498           2 :                       new TGeoTranslation( 0, 0,-zloc));
    5499             : 
    5500           1 :   zloc = kOpticalFibersSect + kCoaxCableSectCu + horTube->GetRmax();
    5501           2 :   cableTrayC->AddNode(traySideCCoaxCu, 1,
    5502           2 :                       new TGeoTranslation( 0, 0, zloc));
    5503           2 :   cableTrayC->AddNode(traySideCCoaxMeg, 1,
    5504           2 :                       new TGeoTranslation( 0, 0, zloc));
    5505             : 
    5506           1 :   cableTrayC->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    5507             : 
    5508             :   // Finally put everything in the mother volume
    5509          12 :   for (Int_t jt = 0; jt < kNumTraysSideC/2; jt++) {
    5510           5 :     alpharot = kTraySideCAlphaRot[jt];
    5511             : 
    5512           5 :     xloc = kTraySideCRPos*SinD(alpharot);
    5513           5 :     yloc = kTraySideCRPos*CosD(alpharot);
    5514          10 :     moth->AddNode(cableTrayC,2*jt+1,
    5515          15 :                 new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
    5516          10 :                 new TGeoRotation("",-90.+alpharot,-90.,90.+kTrayCFoldAngle)));
    5517           5 :     alpharot += 180;
    5518           5 :     xloc = kTraySideCRPos*SinD(alpharot);
    5519           5 :     yloc = kTraySideCRPos*CosD(alpharot);
    5520          10 :     moth->AddNode(cableTrayC,2*jt+2,
    5521          15 :                 new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
    5522          10 :                 new TGeoRotation("",-90.+alpharot,-90.,90.+kTrayCFoldAngle)));
    5523             :   }
    5524             : 
    5525             : 
    5526             :   return;
    5527           1 : }
    5528             : 
    5529             : //______________________________________________________________________
    5530             : void AliITSv11GeometrySupport::SDDCableTraysSideA(TGeoVolume *moth,
    5531             :                                              const TGeoManager *mgr){
    5532             : //
    5533             : // Creates the SDD cable trays which are outside the ITS support cones
    5534             : // but still inside the TPC on Side A
    5535             : // (part of this code is taken or anyway inspired to ServicesCableSupport
    5536             : // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    5537             : //
    5538             : // Input:
    5539             : //         moth : the TGeoVolume owing the volume structure
    5540             : //         mgr  : the GeoManager (default gGeoManager)
    5541             : // Output:
    5542             : //
    5543             : // Created:         ???       Bjorn S. Nilsen
    5544             : // Updated:       5 Jan 2010  Mario Sitta
    5545             : // Updated:      26 Feb 2010  Mario Sitta
    5546             : // Updated:      06 Sep 2010  Mario Sitta
    5547             : //
    5548             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    5549             : // drawings and other (oral) information given by F.Tosello
    5550             : //
    5551             : 
    5552             :   // Overall position and rotation of the A-Side Cable Trays
    5553             :   // (parts of 0872/G/D)
    5554           2 :   const Double_t kTrayARTrans            =  408.35 *fgkmm;
    5555           1 :   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
    5556           1 :   const Double_t kTrayAZToSupportRing    =  435.00 *fgkmm;
    5557           1 :   const Double_t kExternTrayYTrans       =   96.00 *fgkmm; // Computed
    5558           1 :   const Double_t kExternTrayZTrans       =  823.00 *fgkmm;
    5559           1 :   const Double_t kExternCoverYTrans      =    2.00 *fgkmm;
    5560             :   const Double_t kTrayAZRot              = (180-169.5);// Degrees
    5561             :   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
    5562             :   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
    5563             : 
    5564             :   const Double_t kForwardTrayThick       =    2.00 *fgkmm;
    5565           1 :   const Double_t kForwardTrayTailHeight  =  100.00 *fgkmm; // Computed
    5566           1 :   const Double_t kForwardTrayTotalHeight =  170.00 *fgkmm; // Computed
    5567           1 :   const Double_t kForwardTrayUpperLength =  405.00 *fgkmm; // Computed
    5568           1 :   const Double_t kForwardCoverLength     =  380.00 *fgkmm;
    5569           1 :   const Double_t kForwardCoverWide       =  133.00 *fgkmm;
    5570           1 :   const Double_t kForwardCoverHeight     =   10.00 *fgkmm;
    5571             :   const Double_t kForwardCoverThick      =    1.00 *fgkmm;
    5572             : 
    5573           1 :   const Double_t kExternTrayTotalLen     = 1200.00 *fgkmm;
    5574           1 :   const Double_t kExternTrayTotalHeight  =   52.00 *fgkmm;
    5575             :   const Double_t kExternCoverLen         = kExternTrayTotalLen;
    5576           1 :   const Double_t kExternCoverThick       =    5.00 *fgkmm;
    5577           1 :   const Double_t kExternCoverSideThick   =    3.00 *fgkmm;
    5578             : 
    5579             :   const Int_t    kForwardTrayNpoints     =    8;
    5580             : 
    5581             :   // Dimensions and positions of the Cable Tray elements
    5582           1 :   const Double_t kSideACoolManifWide     =    8.23 *fgkcm;
    5583           1 :   const Double_t kSideACoolManifHigh     =    8.06 *fgkcm;
    5584           1 :   const Double_t kSideACoolManifLen      =    3.90 *fgkcm;
    5585             :   const Double_t kSideACoolManifPOMFrac  =    0.0054;
    5586             :   const Double_t kSideACoolManifSteelFrac=    0.8850;
    5587             :   const Double_t kSideACoolManifWaterFrac=    0.0913;
    5588             :   const Double_t kSideACoolManifAlFrac   =    0.0183;
    5589             : 
    5590           1 :   const Double_t kSideACoolTubesWide     =    9.07 *fgkcm;
    5591           1 :   const Double_t kSideACoolTubesHigh     =    1.88 *fgkcm;
    5592           1 :   const Double_t kSideACoolTubesTrans    =    0.88 *fgkcm;
    5593             :   const Double_t kSideACoolTubesPURFrac  =    0.5897;
    5594             :   const Double_t kSideACoolTubesWaterFrac=    0.4101;
    5595             :   const Double_t kSideACoolTubesAirFrac  =    0.0002;
    5596             : 
    5597           1 :   const Double_t kSideAOptConnWide       =    0.90    *fgkcm;
    5598           1 :   const Double_t kSideAOptConnLen        =    1.37    *fgkcm;
    5599             :   const Double_t kSideAOptConnPBTFrac    =    0.5010;
    5600             :   const Double_t kSideAOptConnSteelFrac  =    0.1784;
    5601             :   const Double_t kSideAOptConnAlFrac     =    0.3206;
    5602             : 
    5603           1 :   const Double_t kSideAOptFibsWide       =    0.71    *fgkcm;
    5604           1 :   const Double_t kSideAOptFibsHigh       =    3.20    *fgkcm;
    5605             : 
    5606           1 :   const Double_t kSideAInputCablesWide   =   12.50    *fgkcm;
    5607           1 :   const Double_t kSideAInputCablesHigh   =    1.24    *fgkcm;
    5608           1 :   const Double_t kSideAInputCablesLen    =   25.20    *fgkcm;
    5609           1 :   const Double_t kSideAInputCablesYTrans =    1.15    *fgkcm;
    5610             :   const Double_t kSideAInputCablesCu     =    0.7404;
    5611             :   const Double_t kSideAInputCablesPlast  =    0.1269;
    5612             :   const Double_t kSideAInputCablesAl     =    0.0057;
    5613             :   const Double_t kSideAInputCablesKapton =    0.0172;
    5614             :   const Double_t kSideAInputCablesPOLYAX =    0.1098;
    5615             : 
    5616           1 :   const Double_t kSideAOutputCablesWide  =    8.30    *fgkcm;
    5617           1 :   const Double_t kSideAOutputCablesHigh  =    1.56    *fgkcm;
    5618             :   const Double_t kSideAOutputCablesCu    =    0.6783;
    5619             :   const Double_t kSideAOutputCablesPlast =    0.1605;
    5620             :   const Double_t kSideAOutputCablesAl    =    0.0078;
    5621             :   const Double_t kSideAOutputCablesKapton=    0.0232;
    5622             :   const Double_t kSideAOutputCablesPOLYAX=    0.1302;
    5623             : 
    5624             :   const Double_t kSideAPCBBoardsWide     =   12.50    *fgkcm;
    5625           1 :   const Double_t kSideAPCBBoardsHigh     =    6.32    *fgkcm;
    5626           1 :   const Double_t kSideAPCBBoardsLen      =   24.00    *fgkcm;
    5627           1 :   const Double_t kSideAPCBBoardsYTrans   =    0.75    *fgkcm;
    5628             :   const Double_t kSideAPCBBoardsCu       =    0.3864;
    5629             :   const Double_t kSideAPCBBoardsEpoxy    =    0.1486;
    5630             :   const Double_t kSideAPCBBoardsPlast    =    0.0578;
    5631             :   const Double_t kSideAPCBBoardsSteel    =    0.1521;
    5632             :   const Double_t kSideAPCBBoardsPPS      =    0.2551;
    5633             : 
    5634             : 
    5635             :   // Local variables
    5636           1 :   Double_t xprof[kForwardTrayNpoints], yprof[kForwardTrayNpoints];
    5637             :   Double_t xloc, yloc, zloc, alpharot, height;
    5638             : 
    5639             : 
    5640             :   // The whole tray as an assembly
    5641           1 :   TGeoVolumeAssembly *cableTrayA = new TGeoVolumeAssembly("ITSsupportSDDTrayA");
    5642             :   
    5643             : 
    5644             :   // First create all needed shapes
    5645             : 
    5646             :   // The forward tray is very complex and deserves a dedicated method
    5647           1 :   CreateSDDForwardTraySideA(cableTrayA,mgr);
    5648             : 
    5649             :   // The forward cover: a Xtru
    5650           1 :   TGeoXtru *forwardCover = new TGeoXtru(2);
    5651           1 :   forwardCover->SetName("ITSsuppSDDForwCover");
    5652             : 
    5653           1 :   xprof[0] = kForwardCoverWide/2;
    5654           1 :   yprof[0] = kForwardCoverHeight;
    5655           1 :   xprof[1] = xprof[0];
    5656           1 :   yprof[1] = 0;
    5657           1 :   xprof[2] = xprof[1] - kForwardCoverThick;
    5658           1 :   yprof[2] = yprof[1];
    5659           1 :   xprof[3] = xprof[2];
    5660           1 :   yprof[3] = yprof[0] - kForwardCoverThick;
    5661             : 
    5662             :   // We did the right side, now reflex on the left side
    5663          10 :   for (Int_t jp = 0; jp < 4; jp++) {
    5664           4 :     xprof[4+jp] = -xprof[3-jp];
    5665           4 :     yprof[4+jp] =  yprof[3-jp];
    5666             :   }
    5667             : 
    5668           1 :   forwardCover->DefinePolygon(8, xprof, yprof);
    5669           1 :   forwardCover->DefineSection(0, 0);
    5670           1 :   forwardCover->DefineSection(1, kForwardCoverLength);
    5671             : 
    5672             :   // The external tray (as 0872/G/D/03): a Xtru
    5673           1 :   TGeoXtru *externalTray = CreateSDDSSDTraysSideA(kExternTrayTotalLen,
    5674             :                                                   kExternTrayTotalHeight);
    5675             : 
    5676             :   // The external covers: a Composite Shape
    5677           1 :   TGeoCompositeShape *externCover = CreateTrayAExternalCover(kExternCoverLen);
    5678             : 
    5679             :   // Now the volumes inside it
    5680             :   // The cooling manifold: four boxes
    5681           2 :   TGeoBBox *coolManifPOM = new TGeoBBox(kSideACoolManifWide/2,
    5682           1 :                  kSideACoolManifPOMFrac*kSideACoolManifHigh/2,
    5683           1 :                                         kSideACoolManifLen/2);
    5684             : 
    5685           2 :   TGeoBBox *coolManifSteel = new TGeoBBox(kSideACoolManifWide/2,
    5686           1 :                  kSideACoolManifSteelFrac*kSideACoolManifHigh/2,
    5687             :                                           kSideACoolManifLen/2);
    5688             : 
    5689           2 :   TGeoBBox *coolManifWater = new TGeoBBox(kSideACoolManifWide/2,
    5690           1 :                  kSideACoolManifWaterFrac*kSideACoolManifHigh/2,
    5691             :                                           kSideACoolManifLen/2);
    5692             : 
    5693           2 :   TGeoBBox *coolManifAl = new TGeoBBox(kSideACoolManifWide/2,
    5694           1 :                  kSideACoolManifAlFrac*kSideACoolManifHigh/2,
    5695             :                                        kSideACoolManifLen/2);
    5696             : 
    5697             :   // The cooling tubes: three Xtru's
    5698           1 :   TGeoXtru *coolTubesPUR = new TGeoXtru(2);
    5699             : 
    5700           1 :   height = kSideACoolTubesHigh*kSideACoolTubesPURFrac;
    5701             : 
    5702           1 :   xprof[0] = kSideACoolManifLen;
    5703           1 :   yprof[0] = kForwardTrayThick + kSideACoolTubesTrans;
    5704           3 :   xprof[2] = kExternTrayZTrans + kForwardTrayTotalHeight*SinD(kTrayAZRot) +
    5705           2 :              kExternTrayTotalLen*CosD(kTrayAZRot) - xprof[0]/2;
    5706           2 :   yprof[2] = kForwardTrayTotalHeight*(1 - CosD(kTrayAZRot)) +
    5707           2 :              kExternTrayYTrans - kExternTrayTotalHeight*CosD(kTrayAZRot) +
    5708           2 :              kExternTrayTotalLen*SinD(kTrayAZRot) + yprof[0];
    5709           2 :   IntersectLines(              0 , xprof[0], yprof[0],
    5710           1 :                  TanD(kTrayAZRot), xprof[2], yprof[2],
    5711             :                                    xprof[1], yprof[1]);
    5712           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5713           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5714           2 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5715           1 :               height, xprof[4], yprof[4]);
    5716           1 :   xprof[5] = xprof[0];
    5717           1 :   yprof[5] = yprof[0] + height;
    5718             : 
    5719           1 :   coolTubesPUR->DefinePolygon(6, xprof, yprof);
    5720           1 :   coolTubesPUR->DefineSection(0,-kSideACoolTubesWide/2);
    5721           1 :   coolTubesPUR->DefineSection(1, kSideACoolTubesWide/2);
    5722             : 
    5723           1 :   TGeoXtru *coolTubesWater = new TGeoXtru(2);
    5724             : 
    5725           1 :   height = kSideACoolTubesHigh*kSideACoolTubesWaterFrac;
    5726             : 
    5727           1 :   xprof[0] = coolTubesPUR->GetX(5);
    5728           1 :   yprof[0] = coolTubesPUR->GetY(5);
    5729           1 :   xprof[1] = coolTubesPUR->GetX(4);
    5730           1 :   yprof[1] = coolTubesPUR->GetY(4);
    5731           1 :   xprof[2] = coolTubesPUR->GetX(3);
    5732           1 :   yprof[2] = coolTubesPUR->GetY(3);
    5733           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5734           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5735           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5736             :               height, xprof[4], yprof[4]);
    5737           1 :   xprof[5] = xprof[0];
    5738           1 :   yprof[5] = yprof[0] + height;
    5739             : 
    5740           1 :   coolTubesWater->DefinePolygon(6, xprof, yprof);
    5741           1 :   coolTubesWater->DefineSection(0,-kSideACoolTubesWide/2);
    5742           1 :   coolTubesWater->DefineSection(1, kSideACoolTubesWide/2);
    5743             : 
    5744           1 :   TGeoXtru *coolTubesAir = new TGeoXtru(2);
    5745             : 
    5746           1 :   height = kSideACoolTubesHigh*kSideACoolTubesAirFrac;
    5747             : 
    5748           1 :   xprof[0] = coolTubesWater->GetX(5);
    5749           1 :   yprof[0] = coolTubesWater->GetY(5);
    5750           1 :   xprof[1] = coolTubesWater->GetX(4);
    5751           1 :   yprof[1] = coolTubesWater->GetY(4);
    5752           1 :   xprof[2] = coolTubesWater->GetX(3);
    5753           1 :   yprof[2] = coolTubesWater->GetY(3);
    5754           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5755           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5756           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5757             :               height, xprof[4], yprof[4]);
    5758           1 :   xprof[5] = xprof[0];
    5759           1 :   yprof[5] = yprof[0] + height;
    5760             : 
    5761           1 :   coolTubesAir->DefinePolygon(6, xprof, yprof);
    5762           1 :   coolTubesAir->DefineSection(0,-kSideACoolTubesWide/2);
    5763           1 :   coolTubesAir->DefineSection(1, kSideACoolTubesWide/2);
    5764             : 
    5765             :   // The optical fiber connectors: three boxes
    5766           2 :   TGeoBBox *optConnPBT = new TGeoBBox(kSideAOptConnWide/2,
    5767           1 :                  kSideAOptConnPBTFrac*kSideACoolManifHigh/2,
    5768           1 :                                       kSideAOptConnLen/2);
    5769             : 
    5770           2 :   TGeoBBox *optConnSteel = new TGeoBBox(kSideAOptConnWide/2,
    5771           1 :                  kSideAOptConnSteelFrac*kSideACoolManifHigh/2,
    5772             :                                         kSideAOptConnLen/2);
    5773             : 
    5774           2 :   TGeoBBox *optConnAl = new TGeoBBox(kSideAOptConnWide/2,
    5775           1 :                  kSideAOptConnAlFrac*kSideACoolManifHigh/2,
    5776             :                                      kSideAOptConnLen/2);
    5777             : 
    5778             :   // The optical fibers: a Xtru
    5779           1 :   TGeoXtru *opticalFibs = new TGeoXtru(2);
    5780             : 
    5781           1 :   xprof[0] = kSideAOptConnLen;
    5782           1 :   yprof[0] = coolTubesPUR->GetY(0);
    5783           1 :   xprof[1] = coolTubesPUR->GetX(1);
    5784           1 :   yprof[1] = coolTubesPUR->GetY(1);
    5785           1 :   xprof[2] = coolTubesPUR->GetX(2);
    5786           1 :   yprof[2] = coolTubesPUR->GetY(2);
    5787           1 :   xprof[3] = xprof[2] - kSideAOptFibsHigh*SinD(kTrayAZRot);
    5788           1 :   yprof[3] = yprof[2] + kSideAOptFibsHigh*CosD(kTrayAZRot);
    5789           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5790             :               kSideAOptFibsHigh, xprof[4], yprof[4]);
    5791           1 :   xprof[5] = xprof[0];
    5792           1 :   yprof[5] = yprof[0] + kSideAOptFibsHigh;
    5793             : 
    5794           1 :   opticalFibs->DefinePolygon(6, xprof, yprof);
    5795           1 :   opticalFibs->DefineSection(0,-kSideAOptFibsWide/2);
    5796           1 :   opticalFibs->DefineSection(1, kSideAOptFibsWide/2);
    5797             : 
    5798             :   // The input cables: five boxes
    5799           2 :   TGeoBBox *inputCabsCu = new TGeoBBox(kSideAInputCablesWide/2,
    5800           1 :                    kSideAInputCablesCu*kSideAInputCablesHigh/2,
    5801           1 :                                        kSideAInputCablesLen/2);
    5802             : 
    5803           2 :   TGeoBBox *inputCabsPlast = new TGeoBBox(kSideAInputCablesWide/2,
    5804           1 :                    kSideAInputCablesPlast*kSideAInputCablesHigh/2,
    5805             :                                           kSideAInputCablesLen/2);
    5806             : 
    5807           2 :   TGeoBBox *inputCabsAl = new TGeoBBox(kSideAInputCablesWide/2,
    5808           1 :                    kSideAInputCablesAl*kSideAInputCablesHigh/2,
    5809             :                                        kSideAInputCablesLen/2);
    5810             : 
    5811           2 :   TGeoBBox *inputCabsKapton = new TGeoBBox(kSideAInputCablesWide/2,
    5812           1 :                    kSideAInputCablesKapton*kSideAInputCablesHigh/2,
    5813             :                                            kSideAInputCablesLen/2);
    5814             : 
    5815           2 :   TGeoBBox *inputCabsPOLYAX = new TGeoBBox(kSideAInputCablesWide/2,
    5816           1 :                    kSideAInputCablesPOLYAX*kSideAInputCablesHigh/2,
    5817             :                                            kSideAInputCablesLen/2);
    5818             : 
    5819             :   // The output cables: five Xtru
    5820           1 :   TGeoXtru *outputCabsCu = new TGeoXtru(2);
    5821             : 
    5822           1 :   height = kSideAOutputCablesCu*kSideAOutputCablesHigh;
    5823             : 
    5824           1 :   xprof[0] = kSideAInputCablesLen/2 + kSideAPCBBoardsLen/2;
    5825           1 :   yprof[0] = coolTubesAir->GetY(5);
    5826           1 :   xprof[1] = coolTubesAir->GetX(4);
    5827           1 :   yprof[1] = coolTubesAir->GetY(4);
    5828           1 :   xprof[2] = coolTubesAir->GetX(3);
    5829           1 :   yprof[2] = coolTubesAir->GetY(3);
    5830           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5831           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5832           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5833             :               height, xprof[4], yprof[4]);
    5834           1 :   xprof[5] = xprof[0];
    5835           1 :   yprof[5] = yprof[0] + height;
    5836             : 
    5837           1 :   outputCabsCu->DefinePolygon(6, xprof, yprof);
    5838           1 :   outputCabsCu->DefineSection(0,-kSideAOutputCablesWide/2);
    5839           1 :   outputCabsCu->DefineSection(1, kSideAOutputCablesWide/2);
    5840             : 
    5841           1 :   TGeoXtru *outputCabsPlast = new TGeoXtru(2);
    5842             : 
    5843           1 :   height = kSideAOutputCablesPlast*kSideAOutputCablesHigh;
    5844             : 
    5845           1 :   xprof[0] = outputCabsCu->GetX(5);
    5846           1 :   yprof[0] = outputCabsCu->GetY(5);
    5847           1 :   xprof[1] = outputCabsCu->GetX(4);
    5848           1 :   yprof[1] = outputCabsCu->GetY(4);
    5849           1 :   xprof[2] = outputCabsCu->GetX(3);
    5850           1 :   yprof[2] = outputCabsCu->GetY(3);
    5851           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5852           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5853           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5854             :               height, xprof[4], yprof[4]);
    5855           1 :   xprof[5] = xprof[0];
    5856           1 :   yprof[5] = yprof[0] + height;
    5857             : 
    5858           1 :   outputCabsPlast->DefinePolygon(6, xprof, yprof);
    5859           1 :   outputCabsPlast->DefineSection(0,-kSideAOutputCablesWide/2);
    5860           1 :   outputCabsPlast->DefineSection(1, kSideAOutputCablesWide/2);
    5861             : 
    5862           1 :   TGeoXtru *outputCabsAl = new TGeoXtru(2);
    5863             : 
    5864           1 :   height = kSideAOutputCablesAl*kSideAOutputCablesHigh;
    5865             : 
    5866           1 :   xprof[0] = outputCabsPlast->GetX(5);
    5867           1 :   yprof[0] = outputCabsPlast->GetY(5);
    5868           1 :   xprof[1] = outputCabsPlast->GetX(4);
    5869           1 :   yprof[1] = outputCabsPlast->GetY(4);
    5870           1 :   xprof[2] = outputCabsPlast->GetX(3);
    5871           1 :   yprof[2] = outputCabsPlast->GetY(3);
    5872           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5873           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5874           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5875             :               height, xprof[4], yprof[4]);
    5876           1 :   xprof[5] = xprof[0];
    5877           1 :   yprof[5] = yprof[0] + height;
    5878             : 
    5879           1 :   outputCabsAl->DefinePolygon(6, xprof, yprof);
    5880           1 :   outputCabsAl->DefineSection(0,-kSideAOutputCablesWide/2);
    5881           1 :   outputCabsAl->DefineSection(1, kSideAOutputCablesWide/2);
    5882             : 
    5883           1 :   TGeoXtru *outputCabsKapton = new TGeoXtru(2);
    5884             : 
    5885           1 :   height = kSideAOutputCablesKapton*kSideAOutputCablesHigh;
    5886             : 
    5887           1 :   xprof[0] = outputCabsAl->GetX(5);
    5888           1 :   yprof[0] = outputCabsAl->GetY(5);
    5889           1 :   xprof[1] = outputCabsAl->GetX(4);
    5890           1 :   yprof[1] = outputCabsAl->GetY(4);
    5891           1 :   xprof[2] = outputCabsAl->GetX(3);
    5892           1 :   yprof[2] = outputCabsAl->GetY(3);
    5893           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5894           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5895           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5896             :               height, xprof[4], yprof[4]);
    5897           1 :   xprof[5] = xprof[0];
    5898           1 :   yprof[5] = yprof[0] + height;
    5899             : 
    5900           1 :   outputCabsKapton->DefinePolygon(6, xprof, yprof);
    5901           1 :   outputCabsKapton->DefineSection(0,-kSideAOutputCablesWide/2);
    5902           1 :   outputCabsKapton->DefineSection(1, kSideAOutputCablesWide/2);
    5903             : 
    5904           1 :   TGeoXtru *outputCabsPOLYAX = new TGeoXtru(2);
    5905             : 
    5906           1 :   height = kSideAOutputCablesPOLYAX*kSideAOutputCablesHigh;
    5907             : 
    5908           1 :   xprof[0] = outputCabsKapton->GetX(5);
    5909           1 :   yprof[0] = outputCabsKapton->GetY(5);
    5910           1 :   xprof[1] = outputCabsKapton->GetX(4);
    5911           1 :   yprof[1] = outputCabsKapton->GetY(4);
    5912           1 :   xprof[2] = outputCabsKapton->GetX(3);
    5913           1 :   yprof[2] = outputCabsKapton->GetY(3);
    5914           1 :   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
    5915           1 :   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
    5916           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    5917             :               height, xprof[4], yprof[4]);
    5918           1 :   xprof[5] = xprof[0];
    5919           1 :   yprof[5] = yprof[0] + height;
    5920             : 
    5921           1 :   outputCabsPOLYAX->DefinePolygon(6, xprof, yprof);
    5922           1 :   outputCabsPOLYAX->DefineSection(0,-kSideAOutputCablesWide/2);
    5923           1 :   outputCabsPOLYAX->DefineSection(1, kSideAOutputCablesWide/2);
    5924             : 
    5925             :   // The PCB boards: five boxes
    5926           2 :   TGeoBBox *pcbBoardsCu = new TGeoBBox(kSideAPCBBoardsWide/2,
    5927           1 :                      kSideAPCBBoardsCu*kSideAPCBBoardsHigh/2,
    5928             :                                        kSideAPCBBoardsLen/2);
    5929             : 
    5930           2 :   TGeoBBox *pcbBoardsEpoxy = new TGeoBBox(kSideAPCBBoardsWide/2,
    5931           1 :                      kSideAPCBBoardsEpoxy*kSideAPCBBoardsHigh/2,
    5932             :                                           kSideAPCBBoardsLen/2);
    5933             : 
    5934           2 :   TGeoBBox *pcbBoardsPlast = new TGeoBBox(kSideAPCBBoardsWide/2,
    5935           1 :                      kSideAPCBBoardsPlast*kSideAPCBBoardsHigh/2,
    5936             :                                           kSideAPCBBoardsLen/2);
    5937             : 
    5938           2 :   TGeoBBox *pcbBoardsSteel = new TGeoBBox(kSideAPCBBoardsWide/2,
    5939           1 :                      kSideAPCBBoardsSteel*kSideAPCBBoardsHigh/2,
    5940             :                                           kSideAPCBBoardsLen/2);
    5941             : 
    5942           2 :   TGeoBBox *pcbBoardsPPS = new TGeoBBox(kSideAPCBBoardsWide/2,
    5943           1 :                      kSideAPCBBoardsPPS*kSideAPCBBoardsHigh/2,
    5944             :                                         kSideAPCBBoardsLen/2);
    5945             : 
    5946             : 
    5947             :   // We have all shapes: now create the real volumes
    5948           1 :   TGeoMedium *medAl     = mgr->GetMedium("ITS_ALUMINUM$");
    5949           1 :   TGeoMedium *medAntic  = mgr->GetMedium("ITS_ANTICORODAL$");
    5950           1 :   TGeoMedium *medPOM    = mgr->GetMedium("ITS_POLYOXYMETHYLENE$");
    5951           1 :   TGeoMedium *medSteel  = mgr->GetMedium("ITS_INOX$");
    5952           1 :   TGeoMedium *medWater  = mgr->GetMedium("ITS_WATER$");
    5953           1 :   TGeoMedium *medPUR    = mgr->GetMedium("ITS_POLYURETHANE$");
    5954           1 :   TGeoMedium *medAir    = mgr->GetMedium("ITS_AIR$");
    5955           1 :   TGeoMedium *medPBT    = mgr->GetMedium("ITS_PBT$");
    5956           1 :   TGeoMedium *medOptFib = mgr->GetMedium("ITS_SDD OPTICFIB$");
    5957           1 :   TGeoMedium *medCu     = mgr->GetMedium("ITS_COPPER$");
    5958           1 :   TGeoMedium *medKapton = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
    5959           1 :   TGeoMedium *medPOLYAX = mgr->GetMedium("ITS_POLYAX$");
    5960           1 :   TGeoMedium *medPPS    = mgr->GetMedium("ITS_PPS$");
    5961           1 :   TGeoMedium *medEpoxy  = mgr->GetMedium("ITS_EPOXY$");
    5962             : 
    5963           2 :   TGeoVolume *forwardTrayCover = new TGeoVolume("ITSsuppSDDSideAForwTrayCover",
    5964           1 :                                                 forwardCover, medAl);
    5965             : 
    5966           1 :   forwardTrayCover->SetVisibility(kTRUE);
    5967           1 :   forwardTrayCover->SetLineColor(kMagenta+1); // Purple
    5968           1 :   forwardTrayCover->SetLineWidth(1);
    5969           1 :   forwardTrayCover->SetFillColor(forwardTrayCover->GetLineColor());
    5970           1 :   forwardTrayCover->SetFillStyle(4000); // 0% transparent
    5971             : 
    5972           2 :   TGeoVolume *externalTraySDD = new TGeoVolume("ITSsuppSDDSideAExternalTray",
    5973           1 :                                                externalTray, medAl);
    5974             : 
    5975           1 :   externalTraySDD->SetVisibility(kTRUE);
    5976           1 :   externalTraySDD->SetLineColor(6); // Purple
    5977           1 :   externalTraySDD->SetLineWidth(1);
    5978           1 :   externalTraySDD->SetFillColor(externalTraySDD->GetLineColor());
    5979           1 :   externalTraySDD->SetFillStyle(4000); // 0% transparent
    5980             : 
    5981           2 :   TGeoVolume *externTrayCover = new TGeoVolume("ITSsuppSDDSideAExtTrayCover",
    5982           1 :                                                externCover, medAntic);
    5983             : 
    5984           1 :   externTrayCover->SetVisibility(kTRUE);
    5985           1 :   externTrayCover->SetLineColor(kMagenta+1); // Purple
    5986           1 :   externTrayCover->SetLineWidth(1);
    5987           1 :   externTrayCover->SetFillColor(externTrayCover->GetLineColor());
    5988           1 :   externTrayCover->SetFillStyle(4000); // 0% transparent
    5989             : 
    5990           2 :   TGeoVolume *pomCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifPOM",
    5991           1 :                                             coolManifPOM, medPOM);
    5992             : 
    5993           1 :   pomCoolManif->SetVisibility(kTRUE);
    5994           1 :   pomCoolManif->SetLineColor(kRed); // Red
    5995           1 :   pomCoolManif->SetLineWidth(1);
    5996           1 :   pomCoolManif->SetFillColor(pomCoolManif->GetLineColor());
    5997           1 :   pomCoolManif->SetFillStyle(4000); // 0% transparent
    5998             : 
    5999           2 :   TGeoVolume *steelCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifSteel",
    6000           1 :                                               coolManifSteel, medSteel);
    6001             : 
    6002           1 :   steelCoolManif->SetVisibility(kTRUE);
    6003           1 :   steelCoolManif->SetLineColor(kBlue); // Blue
    6004           1 :   steelCoolManif->SetLineWidth(1);
    6005           1 :   steelCoolManif->SetFillColor(steelCoolManif->GetLineColor());
    6006           1 :   steelCoolManif->SetFillStyle(4000); // 0% transparent
    6007             : 
    6008           2 :   TGeoVolume *waterCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifWater",
    6009           1 :                                               coolManifWater, medWater);
    6010             : 
    6011           1 :   waterCoolManif->SetVisibility(kTRUE);
    6012           1 :   waterCoolManif->SetLineColor(33); // Light Blue
    6013           1 :   waterCoolManif->SetLineWidth(1);
    6014           1 :   waterCoolManif->SetFillColor(waterCoolManif->GetLineColor());
    6015           1 :   waterCoolManif->SetFillStyle(4000); // 0% transparent
    6016             : 
    6017           2 :   TGeoVolume *alCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifAl",
    6018           1 :                                            coolManifAl, medAl);
    6019             : 
    6020           1 :   alCoolManif->SetVisibility(kTRUE);
    6021           1 :   alCoolManif->SetLineColor(6); // Purple
    6022           1 :   alCoolManif->SetLineWidth(1);
    6023           1 :   alCoolManif->SetFillColor(alCoolManif->GetLineColor());
    6024           1 :   alCoolManif->SetFillStyle(4000); // 0% transparent
    6025             : 
    6026           2 :   TGeoVolume *purCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesPUR",
    6027           1 :                                             coolTubesPUR, medPUR);
    6028             : 
    6029           1 :   purCoolTubes->SetVisibility(kTRUE);
    6030           1 :   purCoolTubes->SetLineColor(kRed); // Red
    6031           1 :   purCoolTubes->SetLineWidth(1);
    6032           1 :   purCoolTubes->SetFillColor(purCoolTubes->GetLineColor());
    6033           1 :   purCoolTubes->SetFillStyle(4000); // 0% transparent
    6034             : 
    6035           2 :   TGeoVolume *waterCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesWater",
    6036           1 :                                               coolTubesWater, medWater);
    6037             : 
    6038           1 :   waterCoolTubes->SetVisibility(kTRUE);
    6039           1 :   waterCoolTubes->SetLineColor(33); // Light Blue
    6040           1 :   waterCoolTubes->SetLineWidth(1);
    6041           1 :   waterCoolTubes->SetFillColor(waterCoolTubes->GetLineColor());
    6042           1 :   waterCoolTubes->SetFillStyle(4000); // 0% transparent
    6043             : 
    6044           2 :   TGeoVolume *airCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesAir",
    6045           1 :                                             coolTubesAir, medAir);
    6046             : 
    6047           1 :   airCoolTubes->SetVisibility(kTRUE);
    6048           1 :   airCoolTubes->SetLineColor(41);
    6049           1 :   airCoolTubes->SetLineWidth(1);
    6050           1 :   airCoolTubes->SetFillColor(airCoolTubes->GetLineColor());
    6051           1 :   airCoolTubes->SetFillStyle(4000); // 0% transparent
    6052             : 
    6053           2 :   TGeoVolume *pbtOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnPBT",
    6054           1 :                                           optConnPBT, medPBT);
    6055             : 
    6056           1 :   pbtOptConn->SetVisibility(kTRUE);
    6057           1 :   pbtOptConn->SetLineColor(kRed); // Red
    6058           1 :   pbtOptConn->SetLineWidth(1);
    6059           1 :   pbtOptConn->SetFillColor(pbtOptConn->GetLineColor());
    6060           1 :   pbtOptConn->SetFillStyle(4000); // 0% transparent
    6061             : 
    6062           2 :   TGeoVolume *steelOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnSteel",
    6063           1 :                                             optConnSteel, medSteel);
    6064             : 
    6065           1 :   steelOptConn->SetVisibility(kTRUE);
    6066           1 :   steelOptConn->SetLineColor(kBlue); // Blue
    6067           1 :   steelOptConn->SetLineWidth(1);
    6068           1 :   steelOptConn->SetFillColor(steelOptConn->GetLineColor());
    6069           1 :   steelOptConn->SetFillStyle(4000); // 0% transparent
    6070             : 
    6071           2 :   TGeoVolume *alOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnAl",
    6072           1 :                                          optConnAl, medAl);
    6073             : 
    6074           1 :   alOptConn->SetVisibility(kTRUE);
    6075           1 :   alOptConn->SetLineColor(6); // Purple
    6076           1 :   alOptConn->SetLineWidth(1);
    6077           1 :   alOptConn->SetFillColor(alOptConn->GetLineColor());
    6078           1 :   alOptConn->SetFillStyle(4000); // 0% transparent
    6079             : 
    6080           2 :   TGeoVolume *optFibs = new TGeoVolume("ITSsuppSDDSideAOptFibs",
    6081           1 :                                        opticalFibs, medOptFib);
    6082             : 
    6083           1 :   optFibs->SetVisibility(kTRUE);
    6084           1 :   optFibs->SetLineColor(kOrange+2); // Orange
    6085           1 :   optFibs->SetLineWidth(1);
    6086           1 :   optFibs->SetFillColor(optFibs->GetLineColor());
    6087           1 :   optFibs->SetFillStyle(4000); // 0% transparent
    6088             : 
    6089           2 :   TGeoVolume *cuInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsCu",
    6090           1 :                                            inputCabsCu, medCu);
    6091             : 
    6092           1 :   cuInputCabs->SetVisibility(kTRUE);
    6093           1 :   cuInputCabs->SetLineColor(kBlack); // Black
    6094           1 :   cuInputCabs->SetLineWidth(1);
    6095           1 :   cuInputCabs->SetFillColor(cuInputCabs->GetLineColor());
    6096           1 :   cuInputCabs->SetFillStyle(4000); // 0% transparent
    6097             : 
    6098           2 :   TGeoVolume *plastInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsPlast",
    6099           1 :                                               inputCabsPlast, medPUR);
    6100             : 
    6101           1 :   plastInputCabs->SetVisibility(kTRUE);
    6102           1 :   plastInputCabs->SetLineColor(kRed); // Red
    6103           1 :   plastInputCabs->SetLineWidth(1);
    6104           1 :   plastInputCabs->SetFillColor(plastInputCabs->GetLineColor());
    6105           1 :   plastInputCabs->SetFillStyle(4000); // 0% transparent
    6106             : 
    6107           2 :   TGeoVolume *alInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsAl",
    6108           1 :                                            inputCabsAl, medAl);
    6109             : 
    6110           1 :   alInputCabs->SetVisibility(kTRUE);
    6111           1 :   alInputCabs->SetLineColor(6); // Purple
    6112           1 :   alInputCabs->SetLineWidth(1);
    6113           1 :   alInputCabs->SetFillColor(alInputCabs->GetLineColor());
    6114           1 :   alInputCabs->SetFillStyle(4000); // 0% transparent
    6115             : 
    6116           2 :   TGeoVolume *kaptonInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsKapton",
    6117           1 :                                                inputCabsKapton, medKapton);
    6118             : 
    6119           1 :   kaptonInputCabs->SetVisibility(kTRUE);
    6120           1 :   kaptonInputCabs->SetLineColor(14); // 
    6121           1 :   kaptonInputCabs->SetLineWidth(1);
    6122           1 :   kaptonInputCabs->SetFillColor(kaptonInputCabs->GetLineColor());
    6123           1 :   kaptonInputCabs->SetFillStyle(4000); // 0% transparent
    6124             : 
    6125           2 :   TGeoVolume *polyaxInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsPOLYAX",
    6126           1 :                                                inputCabsPOLYAX, medPOLYAX);
    6127             : 
    6128           1 :   polyaxInputCabs->SetVisibility(kTRUE);
    6129           1 :   polyaxInputCabs->SetLineColor(34); // 
    6130           1 :   polyaxInputCabs->SetLineWidth(1);
    6131           1 :   polyaxInputCabs->SetFillColor(polyaxInputCabs->GetLineColor());
    6132           1 :   polyaxInputCabs->SetFillStyle(4000); // 0% transparent
    6133             : 
    6134           2 :   TGeoVolume *cuOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsCu",
    6135           1 :                                             outputCabsCu, medCu);
    6136             : 
    6137           1 :   cuOutputCabs->SetVisibility(kTRUE);
    6138           1 :   cuOutputCabs->SetLineColor(kBlack); // Black
    6139           1 :   cuOutputCabs->SetLineWidth(1);
    6140           1 :   cuOutputCabs->SetFillColor(cuOutputCabs->GetLineColor());
    6141           1 :   cuOutputCabs->SetFillStyle(4000); // 0% transparent
    6142             : 
    6143           2 :   TGeoVolume *plastOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsPlast",
    6144           1 :                                                outputCabsPlast, medPUR);
    6145             : 
    6146           1 :   plastOutputCabs->SetVisibility(kTRUE);
    6147           1 :   plastOutputCabs->SetLineColor(kRed); // Red
    6148           1 :   plastOutputCabs->SetLineWidth(1);
    6149           1 :   plastOutputCabs->SetFillColor(plastOutputCabs->GetLineColor());
    6150           1 :   plastOutputCabs->SetFillStyle(4000); // 0% transparent
    6151             : 
    6152           2 :   TGeoVolume *alOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsAl",
    6153           1 :                                             outputCabsAl, medAl);
    6154             : 
    6155           1 :   alOutputCabs->SetVisibility(kTRUE);
    6156           1 :   alOutputCabs->SetLineColor(6); // Purple
    6157           1 :   alOutputCabs->SetLineWidth(1);
    6158           1 :   alOutputCabs->SetFillColor(alOutputCabs->GetLineColor());
    6159           1 :   alOutputCabs->SetFillStyle(4000); // 0% transparent
    6160             : 
    6161           2 :   TGeoVolume *kaptonOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsKapton",
    6162           1 :                                                 outputCabsKapton, medKapton);
    6163             : 
    6164           1 :   kaptonOutputCabs->SetVisibility(kTRUE);
    6165           1 :   kaptonOutputCabs->SetLineColor(14); // 
    6166           1 :   kaptonOutputCabs->SetLineWidth(1);
    6167           1 :   kaptonOutputCabs->SetFillColor(kaptonOutputCabs->GetLineColor());
    6168           1 :   kaptonOutputCabs->SetFillStyle(4000); // 0% transparent
    6169             : 
    6170           2 :   TGeoVolume *polyaxOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsPOLYAX",
    6171           1 :                                                 outputCabsPOLYAX, medPOLYAX);
    6172             : 
    6173           1 :   polyaxOutputCabs->SetVisibility(kTRUE);
    6174           1 :   polyaxOutputCabs->SetLineColor(34); // 
    6175           1 :   polyaxOutputCabs->SetLineWidth(1);
    6176           1 :   polyaxOutputCabs->SetFillColor(polyaxOutputCabs->GetLineColor());
    6177           1 :   polyaxOutputCabs->SetFillStyle(4000); // 0% transparent
    6178             : 
    6179           2 :   TGeoVolume *cuPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsCu",
    6180           1 :                                            pcbBoardsCu, medCu);
    6181             : 
    6182           1 :   cuPCBBoards->SetVisibility(kTRUE);
    6183           1 :   cuPCBBoards->SetLineColor(kBlack); // Black
    6184           1 :   cuPCBBoards->SetLineWidth(1);
    6185           1 :   cuPCBBoards->SetFillColor(cuPCBBoards->GetLineColor());
    6186           1 :   cuPCBBoards->SetFillStyle(4000); // 0% transparent
    6187             : 
    6188           2 :   TGeoVolume *epoxyPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsEpoxy",
    6189           1 :                                               pcbBoardsEpoxy, medEpoxy);
    6190             : 
    6191           1 :   epoxyPCBBoards->SetVisibility(kTRUE);
    6192           1 :   epoxyPCBBoards->SetLineColor(22); //
    6193           1 :   epoxyPCBBoards->SetLineWidth(1);
    6194           1 :   epoxyPCBBoards->SetFillColor(epoxyPCBBoards->GetLineColor());
    6195           1 :   epoxyPCBBoards->SetFillStyle(4000); // 0% transparent
    6196             : 
    6197           2 :   TGeoVolume *plastPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsPlast",
    6198           1 :                                               pcbBoardsPlast, medPUR);
    6199             : 
    6200           1 :   plastPCBBoards->SetVisibility(kTRUE);
    6201           1 :   plastPCBBoards->SetLineColor(kRed); // Red
    6202           1 :   plastPCBBoards->SetLineWidth(1);
    6203           1 :   plastPCBBoards->SetFillColor(plastPCBBoards->GetLineColor());
    6204           1 :   plastPCBBoards->SetFillStyle(4000); // 0% transparent
    6205             : 
    6206           2 :   TGeoVolume *steelPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsSteel",
    6207           1 :                                               pcbBoardsSteel, medSteel);
    6208             : 
    6209           1 :   steelPCBBoards->SetVisibility(kTRUE);
    6210           1 :   steelPCBBoards->SetLineColor(kBlue); // Blue
    6211           1 :   steelPCBBoards->SetLineWidth(1);
    6212           1 :   steelPCBBoards->SetFillColor(steelPCBBoards->GetLineColor());
    6213           1 :   steelPCBBoards->SetFillStyle(4000); // 0% transparent
    6214             : 
    6215           2 :   TGeoVolume *ppsPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsPPS",
    6216           1 :                                             pcbBoardsPPS, medPPS);
    6217             : 
    6218           1 :   ppsPCBBoards->SetVisibility(kTRUE);
    6219           1 :   ppsPCBBoards->SetLineColor(kGreen); // Green
    6220           1 :   ppsPCBBoards->SetLineWidth(1);
    6221           1 :   ppsPCBBoards->SetFillColor(ppsPCBBoards->GetLineColor());
    6222           1 :   ppsPCBBoards->SetFillStyle(4000); // 0% transparent
    6223             : 
    6224             : 
    6225             :   // Now build up the tray
    6226           1 :   yloc = kForwardTrayTotalHeight - forwardCover->GetY(3);
    6227           1 :   zloc = kForwardTrayUpperLength - kForwardCoverLength;
    6228           2 :   cableTrayA->AddNode(forwardTrayCover, 1,
    6229           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6230             : 
    6231           1 :   Double_t totalhi = kExternTrayTotalHeight + kExternCoverThick
    6232           1 :                    - kExternCoverYTrans;
    6233             : 
    6234           2 :   yloc = totalhi*(1 - CosD(kTrayAZRot)) + kExternTrayYTrans -
    6235           1 :          kExternTrayTotalHeight*CosD(kTrayAZRot);
    6236           1 :   zloc = kExternTrayZTrans + totalhi*SinD(kTrayAZRot);
    6237           2 :   cableTrayA->AddNode(externalTraySDD, 1,
    6238           3 :                       new TGeoCombiTrans( 0, yloc, zloc,
    6239           2 :                       new TGeoRotation("", 0,-kTrayAZRot, 0)        ) );
    6240             : 
    6241           2 :   yloc = kExternCoverThick*(1 - CosD(kTrayAZRot)) + kExternTrayYTrans -
    6242           2 :          kExternCoverYTrans*CosD(kTrayAZRot)/2-0.01;
    6243           1 :   zloc = kExternTrayZTrans + kExternCoverThick*SinD(kTrayAZRot);
    6244           2 :   cableTrayA->AddNode(externTrayCover,1,
    6245           3 :                       new TGeoCombiTrans( 0, yloc, zloc,
    6246           2 :                       new TGeoRotation("", 0,-kTrayAZRot, 0)        ) );
    6247             : 
    6248           1 :   yloc = kForwardTrayThick + coolManifPOM->GetDY();
    6249           1 :   zloc = coolManifPOM->GetDZ();
    6250           2 :   cableTrayA->AddNode(pomCoolManif, 1,
    6251           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6252             : 
    6253           1 :   yloc += coolManifPOM->GetDY() + coolManifSteel->GetDY();
    6254           2 :   cableTrayA->AddNode(steelCoolManif, 1,
    6255           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6256             : 
    6257           1 :   yloc += coolManifSteel->GetDY() + coolManifWater->GetDY();
    6258           2 :   cableTrayA->AddNode(waterCoolManif, 1,
    6259           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6260             : 
    6261           1 :   yloc += coolManifWater->GetDY() + coolManifAl->GetDY();
    6262           2 :   cableTrayA->AddNode(alCoolManif, 1,
    6263           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6264             : 
    6265           2 :   cableTrayA->AddNode(purCoolTubes,1,
    6266           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6267           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6268           2 :   cableTrayA->AddNode(waterCoolTubes,1,
    6269           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6270           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6271           2 :   cableTrayA->AddNode(airCoolTubes,1,
    6272           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6273           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6274             : 
    6275           1 :   xloc = coolManifPOM->GetDX() + optConnPBT->GetDX();
    6276           1 :   yloc = kForwardTrayThick + optConnPBT->GetDY();
    6277           1 :   zloc = optConnPBT->GetDZ();
    6278           2 :   cableTrayA->AddNode(pbtOptConn, 1,
    6279           2 :                       new TGeoTranslation( xloc, yloc, zloc) );
    6280           2 :   cableTrayA->AddNode(pbtOptConn, 2,
    6281           2 :                       new TGeoTranslation(-xloc, yloc, zloc) );
    6282             : 
    6283           1 :   yloc += optConnPBT->GetDY() + optConnSteel->GetDY();
    6284           2 :   cableTrayA->AddNode(steelOptConn, 1,
    6285           2 :                       new TGeoTranslation( xloc, yloc, zloc) );
    6286           2 :   cableTrayA->AddNode(steelOptConn, 2,
    6287           2 :                       new TGeoTranslation(-xloc, yloc, zloc) );
    6288             : 
    6289           1 :   yloc += optConnSteel->GetDY() + optConnAl->GetDY();
    6290           2 :   cableTrayA->AddNode(alOptConn, 1,
    6291           2 :                       new TGeoTranslation( xloc, yloc, zloc) );
    6292           2 :   cableTrayA->AddNode(alOptConn, 2,
    6293           2 :                       new TGeoTranslation(-xloc, yloc, zloc) );
    6294             : 
    6295             : 
    6296           1 :   xloc = kSideACoolTubesWide/2 + kSideAOptFibsWide/2;
    6297           2 :   cableTrayA->AddNode(optFibs,1,
    6298           3 :                       new TGeoCombiTrans( xloc, 0, 0,
    6299           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6300           2 :   cableTrayA->AddNode(optFibs,2,
    6301           3 :                       new TGeoCombiTrans(-xloc, 0, 0,
    6302           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6303             : 
    6304           1 :   yloc = kForwardTrayTotalHeight - forwardCover->GetY(3) -
    6305           1 :          kSideAInputCablesYTrans - inputCabsPOLYAX->GetDY();
    6306           1 :   zloc = inputCabsPOLYAX->GetDZ();
    6307           2 :   cableTrayA->AddNode(polyaxInputCabs, 1,
    6308           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6309             : 
    6310           1 :   yloc -= (inputCabsPOLYAX->GetDY() + inputCabsKapton->GetDY());
    6311           2 :   cableTrayA->AddNode(kaptonInputCabs, 1,
    6312           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6313             : 
    6314           1 :   yloc -= (inputCabsKapton->GetDY() + inputCabsAl->GetDY());
    6315           2 :   cableTrayA->AddNode(alInputCabs, 1,
    6316           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6317             : 
    6318           1 :   yloc -= (inputCabsAl->GetDY() + inputCabsPlast->GetDY());
    6319           2 :   cableTrayA->AddNode(plastInputCabs, 1,
    6320           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6321             : 
    6322           1 :   yloc -= (inputCabsPlast->GetDY() + inputCabsCu->GetDY());
    6323           2 :   cableTrayA->AddNode(cuInputCabs, 1,
    6324           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6325             : 
    6326           1 :   yloc -= (inputCabsCu->GetDY()+pcbBoardsPPS->GetDY()+kSideAPCBBoardsYTrans);
    6327           1 :   zloc += pcbBoardsPPS->GetDZ();
    6328           2 :   cableTrayA->AddNode(ppsPCBBoards, 1,
    6329           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6330             : 
    6331           1 :   yloc -= (pcbBoardsPPS->GetDY()+pcbBoardsSteel->GetDY());
    6332           2 :   cableTrayA->AddNode(steelPCBBoards, 1,
    6333           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6334             : 
    6335           1 :   yloc -= (pcbBoardsSteel->GetDY()+pcbBoardsPlast->GetDY());
    6336           2 :   cableTrayA->AddNode(plastPCBBoards, 1,
    6337           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6338             : 
    6339           1 :   yloc -= (pcbBoardsPlast->GetDY()+pcbBoardsEpoxy->GetDY());
    6340           2 :   cableTrayA->AddNode(epoxyPCBBoards, 1,
    6341           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6342             : 
    6343           1 :   yloc -= (pcbBoardsEpoxy->GetDY()+pcbBoardsCu->GetDY());
    6344           2 :   cableTrayA->AddNode(cuPCBBoards, 1,
    6345           2 :                       new TGeoTranslation( 0, yloc, zloc) );
    6346             : 
    6347           2 :   cableTrayA->AddNode(cuOutputCabs,1,
    6348           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6349           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6350           2 :   cableTrayA->AddNode(plastOutputCabs,1,
    6351           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6352           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6353           2 :   cableTrayA->AddNode(alOutputCabs,1,
    6354           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6355           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6356           2 :   cableTrayA->AddNode(kaptonOutputCabs,1,
    6357           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6358           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6359           2 :   cableTrayA->AddNode(polyaxOutputCabs,1,
    6360           3 :                       new TGeoCombiTrans( 0, 0, 0,
    6361           2 :                       new TGeoRotation("",-90, 90, 90)        ) );
    6362             : 
    6363           1 :   cableTrayA->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    6364             : 
    6365             :   // Finally put everything in the mother volume
    6366           1 :   Double_t rforw = kTrayARTrans + kExternTrayTotalHeight +
    6367           1 :                    kExternCoverSideThick -
    6368             :                    kForwardTrayTailHeight;
    6369             : 
    6370             :   alpharot = -kTrayAFirstRotAng;
    6371           1 :   xloc = rforw*SinD(alpharot);
    6372           1 :   yloc = rforw*CosD(alpharot);
    6373           1 :   zloc = kTrayAZTrans + kTrayAZToSupportRing - kForwardTrayUpperLength;
    6374             : 
    6375           2 :   moth->AddNode(cableTrayA,1,
    6376           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    6377           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    6378             : 
    6379             :   alpharot += 180;
    6380           1 :   xloc = rforw*SinD(alpharot);
    6381           1 :   yloc = rforw*CosD(alpharot);
    6382           2 :   moth->AddNode(cableTrayA,2,
    6383           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    6384           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    6385             : 
    6386             :   alpharot = kTrayAFirstRotAng + 2*kTrayASecondRotAng;
    6387           1 :   xloc = rforw*SinD(alpharot);
    6388           1 :   yloc = rforw*CosD(alpharot);
    6389           2 :   moth->AddNode(cableTrayA,3,
    6390           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    6391           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    6392             : 
    6393             :   alpharot += 180;
    6394           1 :   xloc = rforw*SinD(alpharot);
    6395           1 :   yloc = rforw*CosD(alpharot);
    6396           2 :   moth->AddNode(cableTrayA,4,
    6397           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    6398           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    6399             : 
    6400             : 
    6401             :   return;
    6402           1 : }
    6403             : 
    6404             : //______________________________________________________________________
    6405             : void AliITSv11GeometrySupport::SDDCableTraysSideC(TGeoVolume *moth,
    6406             :                                             const TGeoManager *mgr){
    6407             : //
    6408             : // Creates the SDD cable trays which are outside the ITS support cones
    6409             : // but still inside the TPC on Side C
    6410             : // (part of this code is taken or anyway inspired to ServicesCableSupport
    6411             : // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    6412             : //
    6413             : // Input:
    6414             : //         moth : the TGeoVolume owing the volume structure
    6415             : //         mgr  : the GeoManager (default gGeoManager)
    6416             : // Output:
    6417             : //
    6418             : // Created:         ???       Bjorn S. Nilsen
    6419             : // Updated:      17 Apr 2010  Mario Sitta
    6420             : //
    6421             : // Technical data are taken from AutoCAD drawings and other (oral)
    6422             : // information given by F.Tosello
    6423             : //
    6424             : 
    6425             :   // Dimensions and positions of the C-Side Cable Tray
    6426             :   // (Change accordingly to CreateSDDSSDTraysSideC !)
    6427             :   const Int_t    kNumTraySideC           =    4;
    6428             : 
    6429           2 :   const Double_t kSideCHalfThick         =    0.100   *fgkcm;
    6430           1 :   const Double_t kSideCLength1           =  172.800   *fgkcm;
    6431           1 :   const Double_t kSideCLength2           =  189.300   *fgkcm;
    6432           1 :   const Double_t kBarCoolRmax            =    0.4     *fgkcm;
    6433           1 :   const Double_t kXShiftBarCool          =   13.00    *fgkcm;
    6434             : 
    6435           1 :   const Double_t kSideCFoldAngle         =    5.00 *fgkDegree;
    6436             : 
    6437             :   // Dimensions and positions of the Cable Tray elements
    6438           1 :   const Double_t kSideCCoolManifHalfX    =    4.25    *fgkcm;
    6439           1 :   const Double_t kSideCCoolManifHalfY    =    4.03    *fgkcm;
    6440           1 :   const Double_t kSideCCoolManifHalfZ    =    2.17    *fgkcm;
    6441             :   const Double_t kSideCCoolManifPOMFrac  =    0.0051;
    6442             :   const Double_t kSideCCoolManifSteelFrac=    0.8502;
    6443             :   const Double_t kSideCCoolManifWaterFrac=    0.0868;
    6444             :   const Double_t kSideCCoolManifAlFrac   =    0.0579;
    6445             : 
    6446           1 :   const Double_t kSideCCoolTubesHigh     =    1.88    *fgkcm;
    6447           1 :   const Double_t kSideCCoolTubesTrans    =    0.85    *fgkcm;
    6448             :   const Double_t kSideCCoolTubesPURFrac  =    0.5884;
    6449             :   const Double_t kSideCCoolTubesWaterFrac=    0.4114;
    6450             :   const Double_t kSideCCoolTubesAirFrac  =    0.0002;
    6451             : 
    6452           1 :   const Double_t kSideCOptConnHalfX      =    0.90    *fgkcm;
    6453           1 :   const Double_t kSideCOptConnHalfZ      =    1.37    *fgkcm;
    6454             :   const Double_t kSideCOptConnPBTFrac    =    0.6798;
    6455             :   const Double_t kSideCOptConnSteelFrac  =    0.2421;
    6456             :   const Double_t kSideCOptConnAlFrac     =    0.0781;
    6457             : 
    6458           1 :   const Double_t kSideCOptFibsWide       =    0.71    *fgkcm;
    6459           1 :   const Double_t kSideCOptFibsHigh       =    3.20    *fgkcm;
    6460           1 :   const Double_t kSideCOptFibsTrans      =    0.20    *fgkcm;
    6461             : 
    6462           1 :   const Double_t kSideCInputCablesLen    =   31.45    *fgkcm;
    6463           1 :   const Double_t kSideCInputCablesWide   =   12.50    *fgkcm;
    6464           1 :   const Double_t kSideCInputCablesHigh   =    0.95    *fgkcm;
    6465           1 :   const Double_t kSideCInputCablesTrans  =    1.15    *fgkcm;
    6466             :   const Double_t kSideCInputCablesCu     =    0.7405;
    6467             :   const Double_t kSideCInputCablesPlast  =    0.1268;
    6468             :   const Double_t kSideCInputCablesAl     =    0.0057;
    6469             :   const Double_t kSideCInputCablesKapton =    0.0172;
    6470             :   const Double_t kSideCInputCablesPOLYAX =    0.1098;
    6471             : 
    6472           1 :   const Double_t kSideCOutputCablesX0    =   27.40    *fgkcm;
    6473           1 :   const Double_t kSideCOutputCablesWide  =    8.50    *fgkcm;
    6474           1 :   const Double_t kSideCOutputCablesHigh  =    1.18    *fgkcm;
    6475             :   const Double_t kSideCOutputCablesCu    =    0.6775;
    6476             :   const Double_t kSideCOutputCablesPlast =    0.1613;
    6477             :   const Double_t kSideCOutputCablesAl    =    0.0078;
    6478             :   const Double_t kSideCOutputCablesKapton=    0.0234;
    6479             :   const Double_t kSideCOutputCablesPOLYAX=    0.1300;
    6480             : 
    6481           1 :   const Double_t kSideCPCBBoardsHalfX    =    6.30    *fgkcm;
    6482           1 :   const Double_t kSideCPCBBoardsHalfY    =    2.00    *fgkcm;
    6483           1 :   const Double_t kSideCPCBBoardsHalfZ    =   21.93    *fgkcm;
    6484             :   const Double_t kSideCPCBBoardsCu       =    0.3864;
    6485             :   const Double_t kSideCPCBBoardsEpoxy    =    0.1491;
    6486             :   const Double_t kSideCPCBBoardsPlast    =    0.0579;
    6487             :   const Double_t kSideCPCBBoardsSteel    =    0.1517;
    6488             :   const Double_t kSideCPCBBoardsPPS      =    0.2549;
    6489             : 
    6490             :   // Overall position and rotation of the C-Side Cable Trays
    6491           1 :   const Double_t kTraySideCRPos          =   45.30    *fgkcm;
    6492           1 :   const Double_t kTraySideCZPos          = -102.40    *fgkcm;
    6493             :   const Double_t kTraySideCAlphaRot[kNumTraySideC]  = {    -23.0,      59.0,
    6494             :     /* from SSD tray position */                       180.-23.0, 180.+59.0};
    6495             : 
    6496             : 
    6497             :   // Local variables
    6498           1 :   Double_t xprof[6], yprof[6];
    6499             :   Double_t height, xloc, yloc, zloc, alpharot, alphafold;
    6500             : 
    6501             : 
    6502             :   // The assembly holding the metallic structure
    6503           1 :   TGeoVolumeAssembly *trayStructure = CreateSDDSSDTraysSideC("ITSsupportSDDTrayC");
    6504             : 
    6505             :   // Now the volumes inside it
    6506             :   // The cooling manifold: four boxes
    6507             :   // (X and Z are inverted on tray reference system)
    6508           2 :   TGeoBBox *coolManifPOM = new TGeoBBox(kSideCCoolManifHalfZ,
    6509           1 :                  kSideCCoolManifPOMFrac*kSideCCoolManifHalfY,
    6510             :                                         kSideCCoolManifHalfX);
    6511             : 
    6512           2 :   TGeoBBox *coolManifSteel = new TGeoBBox(kSideCCoolManifHalfZ,
    6513           1 :                  kSideCCoolManifSteelFrac*kSideCCoolManifHalfY,
    6514             :                                           kSideCCoolManifHalfX);
    6515             : 
    6516           2 :   TGeoBBox *coolManifWater = new TGeoBBox(kSideCCoolManifHalfZ,
    6517           1 :                  kSideCCoolManifWaterFrac*kSideCCoolManifHalfY,
    6518             :                                           kSideCCoolManifHalfX);
    6519             : 
    6520           2 :   TGeoBBox *coolManifAl = new TGeoBBox(kSideCCoolManifHalfZ,
    6521           1 :                  kSideCCoolManifAlFrac*kSideCCoolManifHalfY,
    6522             :                                        kSideCCoolManifHalfX);
    6523             : 
    6524             :   // The cooling tubes: three Xtru's
    6525           1 :   alpharot = kSideCFoldAngle*TMath::DegToRad();
    6526             : 
    6527           1 :   TGeoXtru *coolTubesPUR = new TGeoXtru(2);
    6528             : 
    6529           1 :   height = kSideCCoolTubesHigh*kSideCCoolTubesPURFrac;
    6530             : 
    6531           1 :   xprof[0] = 2*kSideCCoolManifHalfZ;
    6532           1 :   yprof[0] = 2*kSideCHalfThick + kSideCCoolTubesTrans;
    6533           1 :   xprof[1] = kSideCLength1;
    6534           1 :   yprof[1] = yprof[0];
    6535           1 :   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(alpharot);
    6536           1 :   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(alpharot);
    6537           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6538           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6539           2 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6540           1 :               height, xprof[4], yprof[4]);
    6541           1 :   xprof[5] = xprof[0];
    6542           1 :   yprof[5] = yprof[0] + height;
    6543             : 
    6544           1 :   coolTubesPUR->DefinePolygon(6, xprof, yprof);
    6545           1 :   coolTubesPUR->DefineSection(0,-kSideCCoolManifHalfX);
    6546           1 :   coolTubesPUR->DefineSection(1, kSideCCoolManifHalfX);
    6547             : 
    6548           1 :   TGeoXtru *coolTubesWater = new TGeoXtru(2);
    6549             : 
    6550           1 :   height = kSideCCoolTubesHigh*kSideCCoolTubesWaterFrac;
    6551             : 
    6552           1 :   xprof[0] = coolTubesPUR->GetX(5);
    6553           1 :   yprof[0] = coolTubesPUR->GetY(5);
    6554           1 :   xprof[1] = coolTubesPUR->GetX(4);
    6555           1 :   yprof[1] = coolTubesPUR->GetY(4);
    6556           1 :   xprof[2] = coolTubesPUR->GetX(3);
    6557           1 :   yprof[2] = coolTubesPUR->GetY(3);
    6558           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6559           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6560           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6561             :               height, xprof[4], yprof[4]);
    6562           1 :   xprof[5] = xprof[0];
    6563           1 :   yprof[5] = yprof[0] + height;
    6564             : 
    6565           1 :   coolTubesWater->DefinePolygon(6, xprof, yprof);
    6566           1 :   coolTubesWater->DefineSection(0,-kSideCCoolManifHalfX);
    6567           1 :   coolTubesWater->DefineSection(1, kSideCCoolManifHalfX);
    6568             : 
    6569           1 :   TGeoXtru *coolTubesAir = new TGeoXtru(2);
    6570             : 
    6571           1 :   height = kSideCCoolTubesHigh*kSideCCoolTubesAirFrac;
    6572             : 
    6573           1 :   xprof[0] = coolTubesWater->GetX(5);
    6574           1 :   yprof[0] = coolTubesWater->GetY(5);
    6575           1 :   xprof[1] = coolTubesWater->GetX(4);
    6576           1 :   yprof[1] = coolTubesWater->GetY(4);
    6577           1 :   xprof[2] = coolTubesWater->GetX(3);
    6578           1 :   yprof[2] = coolTubesWater->GetY(3);
    6579           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6580           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6581           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6582             :               height, xprof[4], yprof[4]);
    6583           1 :   xprof[5] = xprof[0];
    6584           1 :   yprof[5] = yprof[0] + height;
    6585             : 
    6586           1 :   coolTubesAir->DefinePolygon(6, xprof, yprof);
    6587           1 :   coolTubesAir->DefineSection(0,-kSideCCoolManifHalfX);
    6588           1 :   coolTubesAir->DefineSection(1, kSideCCoolManifHalfX);
    6589             : 
    6590             :   // The optical fiber connectors: three boxes
    6591             :   // (X and Z are inverted on tray reference system)
    6592           2 :   TGeoBBox *optConnPBT = new TGeoBBox(kSideCOptConnHalfZ,
    6593           1 :                  kSideCOptConnPBTFrac*kSideCCoolManifHalfY,
    6594             :                                       kSideCOptConnHalfX);
    6595             : 
    6596           2 :   TGeoBBox *optConnSteel = new TGeoBBox(kSideCOptConnHalfZ,
    6597           1 :                  kSideCOptConnSteelFrac*kSideCCoolManifHalfY,
    6598             :                                         kSideCOptConnHalfX);
    6599             : 
    6600           2 :   TGeoBBox *optConnAl = new TGeoBBox(kSideCOptConnHalfZ,
    6601           1 :                  kSideCOptConnAlFrac*kSideCCoolManifHalfY,
    6602             :                                      kSideCOptConnHalfX);
    6603             : 
    6604             :   // The optical fibers: a Xtru
    6605           1 :   TGeoXtru *opticalFibs = new TGeoXtru(2);
    6606             : 
    6607           1 :   xprof[0] = 2*kSideCOptConnHalfZ;
    6608           1 :   yprof[0] = 2*kSideCHalfThick + kSideCOptFibsTrans;
    6609           1 :   xprof[1] = kSideCLength1;
    6610           1 :   yprof[1] = yprof[0];
    6611           1 :   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(alpharot);
    6612           1 :   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(alpharot);
    6613           1 :   xprof[3] = xprof[2] - kSideCOptFibsHigh*TMath::Sin(alpharot);
    6614           1 :   yprof[3] = yprof[2] + kSideCOptFibsHigh*TMath::Cos(alpharot);
    6615           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6616             :               kSideCOptFibsHigh, xprof[4], yprof[4]);
    6617           1 :   xprof[5] = xprof[0];
    6618           1 :   yprof[5] = yprof[0] + kSideCOptFibsHigh;
    6619             : 
    6620           1 :   opticalFibs->DefinePolygon(6, xprof, yprof);
    6621           1 :   opticalFibs->DefineSection(0,-kSideCOptFibsWide/2);
    6622           1 :   opticalFibs->DefineSection(1, kSideCOptFibsWide/2);
    6623             : 
    6624             :   // The input cables: five boxes
    6625             :   // (X and Z are inverted on tray reference system)
    6626           2 :   TGeoBBox *inputCabsCu = new TGeoBBox(kSideCInputCablesLen/2,
    6627           1 :                    kSideCInputCablesCu*kSideCInputCablesHigh/2,
    6628           1 :                                        kSideCInputCablesWide/2);
    6629             : 
    6630           2 :   TGeoBBox *inputCabsPlast = new TGeoBBox(kSideCInputCablesLen/2,
    6631           1 :                    kSideCInputCablesPlast*kSideCInputCablesHigh/2,
    6632             :                                           kSideCInputCablesWide/2);
    6633             : 
    6634           2 :   TGeoBBox *inputCabsAl = new TGeoBBox(kSideCInputCablesLen/2,
    6635           1 :                    kSideCInputCablesAl*kSideCInputCablesHigh/2,
    6636             :                                        kSideCInputCablesWide/2);
    6637             : 
    6638           2 :   TGeoBBox *inputCabsKapton = new TGeoBBox(kSideCInputCablesLen/2,
    6639           1 :                    kSideCInputCablesKapton*kSideCInputCablesHigh/2,
    6640             :                                            kSideCInputCablesWide/2);
    6641             : 
    6642           2 :   TGeoBBox *inputCabsPOLYAX = new TGeoBBox(kSideCInputCablesLen/2,
    6643           1 :                    kSideCInputCablesPOLYAX*kSideCInputCablesHigh/2,
    6644             :                                            kSideCInputCablesWide/2);
    6645             : 
    6646             :   // The output cables: five Xtru
    6647           1 :   TGeoXtru *outputCabsCu = new TGeoXtru(2);
    6648             : 
    6649           1 :   height = kSideCOutputCablesCu*kSideCOutputCablesHigh;
    6650             : 
    6651           1 :   xprof[0] = coolTubesAir->GetX(5) + kSideCOutputCablesX0;
    6652           1 :   yprof[0] = coolTubesAir->GetY(5);
    6653           1 :   xprof[1] = coolTubesAir->GetX(4);
    6654           1 :   yprof[1] = coolTubesAir->GetY(4);
    6655           1 :   xprof[2] = coolTubesAir->GetX(3);
    6656           1 :   yprof[2] = coolTubesAir->GetY(3);
    6657           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6658           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6659           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6660             :               height, xprof[4], yprof[4]);
    6661           1 :   xprof[5] = xprof[0];
    6662           1 :   yprof[5] = yprof[0] + height;
    6663             : 
    6664           1 :   outputCabsCu->DefinePolygon(6, xprof, yprof);
    6665           1 :   outputCabsCu->DefineSection(0,-kSideCOutputCablesWide/2);
    6666           1 :   outputCabsCu->DefineSection(1, kSideCOutputCablesWide/2);
    6667             : 
    6668           1 :   TGeoXtru *outputCabsPlast = new TGeoXtru(2);
    6669             : 
    6670           1 :   height = kSideCOutputCablesPlast*kSideCOutputCablesHigh;
    6671             : 
    6672           1 :   xprof[0] = outputCabsCu->GetX(5);
    6673           1 :   yprof[0] = outputCabsCu->GetY(5);
    6674           1 :   xprof[1] = outputCabsCu->GetX(4);
    6675           1 :   yprof[1] = outputCabsCu->GetY(4);
    6676           1 :   xprof[2] = outputCabsCu->GetX(3);
    6677           1 :   yprof[2] = outputCabsCu->GetY(3);
    6678           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6679           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6680           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6681             :               height, xprof[4], yprof[4]);
    6682           1 :   xprof[5] = xprof[0];
    6683           1 :   yprof[5] = yprof[0] + height;
    6684             : 
    6685           1 :   outputCabsPlast->DefinePolygon(6, xprof, yprof);
    6686           1 :   outputCabsPlast->DefineSection(0,-kSideCOutputCablesWide/2);
    6687           1 :   outputCabsPlast->DefineSection(1, kSideCOutputCablesWide/2);
    6688             : 
    6689           1 :   TGeoXtru *outputCabsAl = new TGeoXtru(2);
    6690             : 
    6691           1 :   height = kSideCOutputCablesAl*kSideCOutputCablesHigh;
    6692             : 
    6693           1 :   xprof[0] = outputCabsPlast->GetX(5);
    6694           1 :   yprof[0] = outputCabsPlast->GetY(5);
    6695           1 :   xprof[1] = outputCabsPlast->GetX(4);
    6696           1 :   yprof[1] = outputCabsPlast->GetY(4);
    6697           1 :   xprof[2] = outputCabsPlast->GetX(3);
    6698           1 :   yprof[2] = outputCabsPlast->GetY(3);
    6699           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6700           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6701           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6702             :               height, xprof[4], yprof[4]);
    6703           1 :   xprof[5] = xprof[0];
    6704           1 :   yprof[5] = yprof[0] + height;
    6705             : 
    6706           1 :   outputCabsAl->DefinePolygon(6, xprof, yprof);
    6707           1 :   outputCabsAl->DefineSection(0,-kSideCOutputCablesWide/2);
    6708           1 :   outputCabsAl->DefineSection(1, kSideCOutputCablesWide/2);
    6709             : 
    6710           1 :   TGeoXtru *outputCabsKapton = new TGeoXtru(2);
    6711             : 
    6712           1 :   height = kSideCOutputCablesKapton*kSideCOutputCablesHigh;
    6713             : 
    6714           1 :   xprof[0] = outputCabsAl->GetX(5);
    6715           1 :   yprof[0] = outputCabsAl->GetY(5);
    6716           1 :   xprof[1] = outputCabsAl->GetX(4);
    6717           1 :   yprof[1] = outputCabsAl->GetY(4);
    6718           1 :   xprof[2] = outputCabsAl->GetX(3);
    6719           1 :   yprof[2] = outputCabsAl->GetY(3);
    6720           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6721           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6722           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6723             :               height, xprof[4], yprof[4]);
    6724           1 :   xprof[5] = xprof[0];
    6725           1 :   yprof[5] = yprof[0] + height;
    6726             : 
    6727           1 :   outputCabsKapton->DefinePolygon(6, xprof, yprof);
    6728           1 :   outputCabsKapton->DefineSection(0,-kSideCOutputCablesWide/2);
    6729           1 :   outputCabsKapton->DefineSection(1, kSideCOutputCablesWide/2);
    6730             : 
    6731           1 :   TGeoXtru *outputCabsPOLYAX = new TGeoXtru(2);
    6732             : 
    6733           1 :   height = kSideCOutputCablesPOLYAX*kSideCOutputCablesHigh;
    6734             : 
    6735           1 :   xprof[0] = outputCabsKapton->GetX(5);
    6736           1 :   yprof[0] = outputCabsKapton->GetY(5);
    6737           1 :   xprof[1] = outputCabsKapton->GetX(4);
    6738           1 :   yprof[1] = outputCabsKapton->GetY(4);
    6739           1 :   xprof[2] = outputCabsKapton->GetX(3);
    6740           1 :   yprof[2] = outputCabsKapton->GetY(3);
    6741           1 :   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
    6742           1 :   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
    6743           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    6744             :               height, xprof[4], yprof[4]);
    6745           1 :   xprof[5] = xprof[0];
    6746           1 :   yprof[5] = yprof[0] + height;
    6747             : 
    6748           1 :   outputCabsPOLYAX->DefinePolygon(6, xprof, yprof);
    6749           1 :   outputCabsPOLYAX->DefineSection(0,-kSideCOutputCablesWide/2);
    6750           1 :   outputCabsPOLYAX->DefineSection(1, kSideCOutputCablesWide/2);
    6751             : 
    6752             :   // The PCB boards: five boxes
    6753             :   // (X and Z are inverted on tray reference system)
    6754           2 :   TGeoBBox *pcbBoardsCu = new TGeoBBox(kSideCPCBBoardsHalfZ,
    6755           1 :                      kSideCPCBBoardsCu*kSideCPCBBoardsHalfY,
    6756             :                                        kSideCPCBBoardsHalfX);
    6757             : 
    6758           2 :   TGeoBBox *pcbBoardsEpoxy = new TGeoBBox(kSideCPCBBoardsHalfZ,
    6759           1 :                      kSideCPCBBoardsEpoxy*kSideCPCBBoardsHalfY,
    6760             :                                           kSideCPCBBoardsHalfX);
    6761             : 
    6762           2 :   TGeoBBox *pcbBoardsPlast = new TGeoBBox(kSideCPCBBoardsHalfZ,
    6763           1 :                      kSideCPCBBoardsPlast*kSideCPCBBoardsHalfY,
    6764             :                                           kSideCPCBBoardsHalfX);
    6765             : 
    6766           2 :   TGeoBBox *pcbBoardsSteel = new TGeoBBox(kSideCPCBBoardsHalfZ,
    6767           1 :                      kSideCPCBBoardsSteel*kSideCPCBBoardsHalfY,
    6768             :                                           kSideCPCBBoardsHalfX);
    6769             : 
    6770           2 :   TGeoBBox *pcbBoardsPPS = new TGeoBBox(kSideCPCBBoardsHalfZ,
    6771           1 :                      kSideCPCBBoardsPPS*kSideCPCBBoardsHalfY,
    6772             :                                         kSideCPCBBoardsHalfX);
    6773             : 
    6774             : 
    6775             :   // We have all shapes: now create the real volumes
    6776           1 :   TGeoMedium *medPOM    = mgr->GetMedium("ITS_POLYOXYMETHYLENE$");
    6777           1 :   TGeoMedium *medSteel  = mgr->GetMedium("ITS_INOX$");
    6778           1 :   TGeoMedium *medWater  = mgr->GetMedium("ITS_WATER$");
    6779           1 :   TGeoMedium *medAl     = mgr->GetMedium("ITS_ALUMINUM$");
    6780           1 :   TGeoMedium *medCu     = mgr->GetMedium("ITS_COPPER$");
    6781           1 :   TGeoMedium *medPUR    = mgr->GetMedium("ITS_POLYURETHANE$");
    6782           1 :   TGeoMedium *medPOLYAX = mgr->GetMedium("ITS_POLYAX$");
    6783           1 :   TGeoMedium *medKapton = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
    6784           1 :   TGeoMedium *medAir    = mgr->GetMedium("ITS_AIR$");
    6785           1 :   TGeoMedium *medPBT    = mgr->GetMedium("ITS_PBT$");
    6786           1 :   TGeoMedium *medOptFib = mgr->GetMedium("ITS_SDD OPTICFIB$");
    6787           1 :   TGeoMedium *medPPS    = mgr->GetMedium("ITS_PPS$");
    6788           1 :   TGeoMedium *medEpoxy  = mgr->GetMedium("ITS_EPOXY$");
    6789             : 
    6790           2 :   TGeoVolume *pomCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifPOM",
    6791           1 :                                             coolManifPOM, medPOM);
    6792             : 
    6793           1 :   pomCoolManif->SetVisibility(kTRUE);
    6794           1 :   pomCoolManif->SetLineColor(kRed); // Red
    6795           1 :   pomCoolManif->SetLineWidth(1);
    6796           1 :   pomCoolManif->SetFillColor(pomCoolManif->GetLineColor());
    6797           1 :   pomCoolManif->SetFillStyle(4000); // 0% transparent
    6798             : 
    6799           2 :   TGeoVolume *steelCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifSteel",
    6800           1 :                                               coolManifSteel, medSteel);
    6801             : 
    6802           1 :   steelCoolManif->SetVisibility(kTRUE);
    6803           1 :   steelCoolManif->SetLineColor(kBlue); // Blue
    6804           1 :   steelCoolManif->SetLineWidth(1);
    6805           1 :   steelCoolManif->SetFillColor(steelCoolManif->GetLineColor());
    6806           1 :   steelCoolManif->SetFillStyle(4000); // 0% transparent
    6807             : 
    6808           2 :   TGeoVolume *waterCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifWater",
    6809           1 :                                               coolManifWater, medWater);
    6810             : 
    6811           1 :   waterCoolManif->SetVisibility(kTRUE);
    6812           1 :   waterCoolManif->SetLineColor(33); // Light Blue
    6813           1 :   waterCoolManif->SetLineWidth(1);
    6814           1 :   waterCoolManif->SetFillColor(waterCoolManif->GetLineColor());
    6815           1 :   waterCoolManif->SetFillStyle(4000); // 0% transparent
    6816             : 
    6817           2 :   TGeoVolume *alCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifAl",
    6818           1 :                                            coolManifAl, medAl);
    6819             : 
    6820           1 :   alCoolManif->SetVisibility(kTRUE);
    6821           1 :   alCoolManif->SetLineColor(6); // Purple
    6822           1 :   alCoolManif->SetLineWidth(1);
    6823           1 :   alCoolManif->SetFillColor(alCoolManif->GetLineColor());
    6824           1 :   alCoolManif->SetFillStyle(4000); // 0% transparent
    6825             : 
    6826           2 :   TGeoVolume *purCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesPUR",
    6827           1 :                                             coolTubesPUR, medPUR);
    6828             : 
    6829           1 :   purCoolTubes->SetVisibility(kTRUE);
    6830           1 :   purCoolTubes->SetLineColor(kRed); // Red
    6831           1 :   purCoolTubes->SetLineWidth(1);
    6832           1 :   purCoolTubes->SetFillColor(purCoolTubes->GetLineColor());
    6833           1 :   purCoolTubes->SetFillStyle(4000); // 0% transparent
    6834             : 
    6835           2 :   TGeoVolume *waterCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesWater",
    6836           1 :                                               coolTubesWater, medWater);
    6837             : 
    6838           1 :   waterCoolTubes->SetVisibility(kTRUE);
    6839           1 :   waterCoolTubes->SetLineColor(33); // Light Blue
    6840           1 :   waterCoolTubes->SetLineWidth(1);
    6841           1 :   waterCoolTubes->SetFillColor(waterCoolTubes->GetLineColor());
    6842           1 :   waterCoolTubes->SetFillStyle(4000); // 0% transparent
    6843             : 
    6844           2 :   TGeoVolume *airCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesAir",
    6845           1 :                                             coolTubesAir, medAir);
    6846             : 
    6847           1 :   airCoolTubes->SetVisibility(kTRUE);
    6848           1 :   airCoolTubes->SetLineColor(41);
    6849           1 :   airCoolTubes->SetLineWidth(1);
    6850           1 :   airCoolTubes->SetFillColor(airCoolTubes->GetLineColor());
    6851           1 :   airCoolTubes->SetFillStyle(4000); // 0% transparent
    6852             : 
    6853           2 :   TGeoVolume *pbtOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnPBT",
    6854           1 :                                           optConnPBT, medPBT);
    6855             : 
    6856           1 :   pbtOptConn->SetVisibility(kTRUE);
    6857           1 :   pbtOptConn->SetLineColor(kRed); // Red
    6858           1 :   pbtOptConn->SetLineWidth(1);
    6859           1 :   pbtOptConn->SetFillColor(pbtOptConn->GetLineColor());
    6860           1 :   pbtOptConn->SetFillStyle(4000); // 0% transparent
    6861             : 
    6862           2 :   TGeoVolume *steelOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnSteel",
    6863           1 :                                             optConnSteel, medSteel);
    6864             : 
    6865           1 :   steelOptConn->SetVisibility(kTRUE);
    6866           1 :   steelOptConn->SetLineColor(kBlue); // Blue
    6867           1 :   steelOptConn->SetLineWidth(1);
    6868           1 :   steelOptConn->SetFillColor(steelOptConn->GetLineColor());
    6869           1 :   steelOptConn->SetFillStyle(4000); // 0% transparent
    6870             : 
    6871           2 :   TGeoVolume *alOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnAl",
    6872           1 :                                          optConnAl, medAl);
    6873             : 
    6874           1 :   alOptConn->SetVisibility(kTRUE);
    6875           1 :   alOptConn->SetLineColor(6); // Purple
    6876           1 :   alOptConn->SetLineWidth(1);
    6877           1 :   alOptConn->SetFillColor(alOptConn->GetLineColor());
    6878           1 :   alOptConn->SetFillStyle(4000); // 0% transparent
    6879             : 
    6880           2 :   TGeoVolume *optFibs = new TGeoVolume("ITSsuppSDDSideCOptFibs",
    6881           1 :                                        opticalFibs, medOptFib);
    6882             : 
    6883           1 :   optFibs->SetVisibility(kTRUE);
    6884           1 :   optFibs->SetLineColor(kOrange+2); // Orange
    6885           1 :   optFibs->SetLineWidth(1);
    6886           1 :   optFibs->SetFillColor(optFibs->GetLineColor());
    6887           1 :   optFibs->SetFillStyle(4000); // 0% transparent
    6888             : 
    6889           2 :   TGeoVolume *cuInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsCu",
    6890           1 :                                            inputCabsCu, medCu);
    6891             : 
    6892           1 :   cuInputCabs->SetVisibility(kTRUE);
    6893           1 :   cuInputCabs->SetLineColor(kBlack); // Black
    6894           1 :   cuInputCabs->SetLineWidth(1);
    6895           1 :   cuInputCabs->SetFillColor(cuInputCabs->GetLineColor());
    6896           1 :   cuInputCabs->SetFillStyle(4000); // 0% transparent
    6897             : 
    6898           2 :   TGeoVolume *plastInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsPlast",
    6899           1 :                                               inputCabsPlast, medPUR);
    6900             : 
    6901           1 :   plastInputCabs->SetVisibility(kTRUE);
    6902           1 :   plastInputCabs->SetLineColor(kRed); // Red
    6903           1 :   plastInputCabs->SetLineWidth(1);
    6904           1 :   plastInputCabs->SetFillColor(plastInputCabs->GetLineColor());
    6905           1 :   plastInputCabs->SetFillStyle(4000); // 0% transparent
    6906             : 
    6907           2 :   TGeoVolume *alInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsAl",
    6908           1 :                                            inputCabsAl, medAl);
    6909             : 
    6910           1 :   alInputCabs->SetVisibility(kTRUE);
    6911           1 :   alInputCabs->SetLineColor(6); // Purple
    6912           1 :   alInputCabs->SetLineWidth(1);
    6913           1 :   alInputCabs->SetFillColor(alInputCabs->GetLineColor());
    6914           1 :   alInputCabs->SetFillStyle(4000); // 0% transparent
    6915             : 
    6916           2 :   TGeoVolume *kaptonInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsKapton",
    6917           1 :                                                inputCabsKapton, medKapton);
    6918             : 
    6919           1 :   kaptonInputCabs->SetVisibility(kTRUE);
    6920           1 :   kaptonInputCabs->SetLineColor(14); // 
    6921           1 :   kaptonInputCabs->SetLineWidth(1);
    6922           1 :   kaptonInputCabs->SetFillColor(kaptonInputCabs->GetLineColor());
    6923           1 :   kaptonInputCabs->SetFillStyle(4000); // 0% transparent
    6924             : 
    6925           2 :   TGeoVolume *polyaxInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsPOLYAX",
    6926           1 :                                                inputCabsPOLYAX, medPOLYAX);
    6927             : 
    6928           1 :   polyaxInputCabs->SetVisibility(kTRUE);
    6929           1 :   polyaxInputCabs->SetLineColor(34); // 
    6930           1 :   polyaxInputCabs->SetLineWidth(1);
    6931           1 :   polyaxInputCabs->SetFillColor(polyaxInputCabs->GetLineColor());
    6932           1 :   polyaxInputCabs->SetFillStyle(4000); // 0% transparent
    6933             : 
    6934           2 :   TGeoVolume *cuOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsCu",
    6935           1 :                                             outputCabsCu, medCu);
    6936             : 
    6937           1 :   cuOutputCabs->SetVisibility(kTRUE);
    6938           1 :   cuOutputCabs->SetLineColor(kBlack); // Black
    6939           1 :   cuOutputCabs->SetLineWidth(1);
    6940           1 :   cuOutputCabs->SetFillColor(cuOutputCabs->GetLineColor());
    6941           1 :   cuOutputCabs->SetFillStyle(4000); // 0% transparent
    6942             : 
    6943           2 :   TGeoVolume *plastOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsPlast",
    6944           1 :                                                outputCabsPlast, medPUR);
    6945             : 
    6946           1 :   plastOutputCabs->SetVisibility(kTRUE);
    6947           1 :   plastOutputCabs->SetLineColor(kRed); // Red
    6948           1 :   plastOutputCabs->SetLineWidth(1);
    6949           1 :   plastOutputCabs->SetFillColor(plastOutputCabs->GetLineColor());
    6950           1 :   plastOutputCabs->SetFillStyle(4000); // 0% transparent
    6951             : 
    6952           2 :   TGeoVolume *alOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsAl",
    6953           1 :                                             outputCabsAl, medAl);
    6954             : 
    6955           1 :   alOutputCabs->SetVisibility(kTRUE);
    6956           1 :   alOutputCabs->SetLineColor(6); // Purple
    6957           1 :   alOutputCabs->SetLineWidth(1);
    6958           1 :   alOutputCabs->SetFillColor(alOutputCabs->GetLineColor());
    6959           1 :   alOutputCabs->SetFillStyle(4000); // 0% transparent
    6960             : 
    6961           2 :   TGeoVolume *kaptonOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsKapton",
    6962           1 :                                                 outputCabsKapton, medKapton);
    6963             : 
    6964           1 :   kaptonOutputCabs->SetVisibility(kTRUE);
    6965           1 :   kaptonOutputCabs->SetLineColor(14); // 
    6966           1 :   kaptonOutputCabs->SetLineWidth(1);
    6967           1 :   kaptonOutputCabs->SetFillColor(kaptonOutputCabs->GetLineColor());
    6968           1 :   kaptonOutputCabs->SetFillStyle(4000); // 0% transparent
    6969             : 
    6970           2 :   TGeoVolume *polyaxOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsPOLYAX",
    6971           1 :                                                 outputCabsPOLYAX, medPOLYAX);
    6972             : 
    6973           1 :   polyaxOutputCabs->SetVisibility(kTRUE);
    6974           1 :   polyaxOutputCabs->SetLineColor(34); // 
    6975           1 :   polyaxOutputCabs->SetLineWidth(1);
    6976           1 :   polyaxOutputCabs->SetFillColor(polyaxOutputCabs->GetLineColor());
    6977           1 :   polyaxOutputCabs->SetFillStyle(4000); // 0% transparent
    6978             : 
    6979           2 :   TGeoVolume *cuPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsCu",
    6980           1 :                                            pcbBoardsCu, medCu);
    6981             : 
    6982           1 :   cuPCBBoards->SetVisibility(kTRUE);
    6983           1 :   cuPCBBoards->SetLineColor(kBlack); // Black
    6984           1 :   cuPCBBoards->SetLineWidth(1);
    6985           1 :   cuPCBBoards->SetFillColor(cuPCBBoards->GetLineColor());
    6986           1 :   cuPCBBoards->SetFillStyle(4000); // 0% transparent
    6987             : 
    6988           2 :   TGeoVolume *epoxyPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsEpoxy",
    6989           1 :                                               pcbBoardsEpoxy, medEpoxy);
    6990             : 
    6991           1 :   epoxyPCBBoards->SetVisibility(kTRUE);
    6992           1 :   epoxyPCBBoards->SetLineColor(22); //
    6993           1 :   epoxyPCBBoards->SetLineWidth(1);
    6994           1 :   epoxyPCBBoards->SetFillColor(epoxyPCBBoards->GetLineColor());
    6995           1 :   epoxyPCBBoards->SetFillStyle(4000); // 0% transparent
    6996             : 
    6997           2 :   TGeoVolume *plastPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsPlast",
    6998           1 :                                               pcbBoardsPlast, medPUR);
    6999             : 
    7000           1 :   plastPCBBoards->SetVisibility(kTRUE);
    7001           1 :   plastPCBBoards->SetLineColor(kRed); // Red
    7002           1 :   plastPCBBoards->SetLineWidth(1);
    7003           1 :   plastPCBBoards->SetFillColor(plastPCBBoards->GetLineColor());
    7004           1 :   plastPCBBoards->SetFillStyle(4000); // 0% transparent
    7005             : 
    7006           2 :   TGeoVolume *steelPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsSteel",
    7007           1 :                                               pcbBoardsSteel, medSteel);
    7008             : 
    7009           1 :   steelPCBBoards->SetVisibility(kTRUE);
    7010           1 :   steelPCBBoards->SetLineColor(kBlue); // Blue
    7011           1 :   steelPCBBoards->SetLineWidth(1);
    7012           1 :   steelPCBBoards->SetFillColor(steelPCBBoards->GetLineColor());
    7013           1 :   steelPCBBoards->SetFillStyle(4000); // 0% transparent
    7014             : 
    7015           2 :   TGeoVolume *ppsPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsPPS",
    7016           1 :                                             pcbBoardsPPS, medPPS);
    7017             : 
    7018           1 :   ppsPCBBoards->SetVisibility(kTRUE);
    7019           1 :   ppsPCBBoards->SetLineColor(kGreen); // Green
    7020           1 :   ppsPCBBoards->SetLineWidth(1);
    7021           1 :   ppsPCBBoards->SetFillColor(ppsPCBBoards->GetLineColor());
    7022           1 :   ppsPCBBoards->SetFillStyle(4000); // 0% transparent
    7023             : 
    7024             : 
    7025             :   // Now fill the tray
    7026           1 :   xloc = coolManifPOM->GetDX();
    7027           1 :   yloc = 2*kSideCHalfThick + coolManifPOM->GetDY();
    7028           2 :   trayStructure->AddNode(pomCoolManif, 1,
    7029           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7030             : 
    7031           1 :   yloc += coolManifPOM->GetDY() + coolManifSteel->GetDY();
    7032           2 :   trayStructure->AddNode(steelCoolManif, 1,
    7033           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7034             : 
    7035           1 :   yloc += coolManifSteel->GetDY() + coolManifWater->GetDY();
    7036           2 :   trayStructure->AddNode(waterCoolManif, 1,
    7037           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7038             : 
    7039           1 :   yloc += coolManifWater->GetDY() + coolManifAl->GetDY();
    7040           2 :   trayStructure->AddNode(alCoolManif, 1,
    7041           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7042             : 
    7043           1 :   xloc = inputCabsCu->GetDX();
    7044           2 :   yloc += coolManifWater->GetDY() + inputCabsCu->GetDY()
    7045           1 :         + kSideCInputCablesTrans;
    7046           2 :   trayStructure->AddNode(cuInputCabs, 1,
    7047           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7048             : 
    7049           1 :   yloc += inputCabsCu->GetDY() + inputCabsPlast->GetDY();
    7050           2 :   trayStructure->AddNode(plastInputCabs, 1,
    7051           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7052             : 
    7053           1 :   yloc += inputCabsPlast->GetDY() + inputCabsAl->GetDY();
    7054           2 :   trayStructure->AddNode(alInputCabs, 1,
    7055           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7056             : 
    7057           1 :   yloc += inputCabsAl->GetDY() + inputCabsKapton->GetDY();
    7058           2 :   trayStructure->AddNode(kaptonInputCabs, 1,
    7059           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7060             : 
    7061           1 :   yloc += inputCabsKapton->GetDY() + inputCabsPOLYAX->GetDY();
    7062           2 :   trayStructure->AddNode(polyaxInputCabs, 1,
    7063           2 :                          new TGeoTranslation( xloc, yloc, 0) );
    7064             : 
    7065           1 :   trayStructure->AddNode(purCoolTubes  , 1, 0);
    7066           1 :   trayStructure->AddNode(waterCoolTubes, 1, 0);
    7067           1 :   trayStructure->AddNode(airCoolTubes  , 1, 0);
    7068             : 
    7069           1 :   xloc = optConnPBT->GetDX();
    7070           1 :   yloc = 2*kSideCHalfThick + optConnPBT->GetDY();
    7071           1 :   zloc = coolManifPOM->GetDZ() + optConnPBT->GetDZ();
    7072           2 :   trayStructure->AddNode(pbtOptConn, 1,
    7073           2 :                          new TGeoTranslation( xloc, yloc, zloc) );
    7074           2 :   trayStructure->AddNode(pbtOptConn, 2,
    7075           2 :                          new TGeoTranslation( xloc, yloc,-zloc) );
    7076             : 
    7077           1 :   yloc += optConnPBT->GetDY() + optConnSteel->GetDY();
    7078           2 :   trayStructure->AddNode(steelOptConn, 1,
    7079           2 :                          new TGeoTranslation( xloc, yloc, zloc) );
    7080           2 :   trayStructure->AddNode(steelOptConn, 2,
    7081           2 :                          new TGeoTranslation( xloc, yloc,-zloc) );
    7082             : 
    7083           1 :   yloc += optConnSteel->GetDY() + optConnAl->GetDY();
    7084           2 :   trayStructure->AddNode(alOptConn, 1,
    7085           2 :                          new TGeoTranslation( xloc, yloc, zloc) );
    7086           2 :   trayStructure->AddNode(alOptConn, 2,
    7087           2 :                          new TGeoTranslation( xloc, yloc,-zloc) );
    7088             : 
    7089           2 :   trayStructure->AddNode(optFibs, 1,
    7090           2 :                          new TGeoTranslation( 0, 0, zloc) );
    7091           2 :   trayStructure->AddNode(optFibs, 2,
    7092           2 :                          new TGeoTranslation( 0, 0,-zloc) );
    7093             : 
    7094           1 :   trayStructure->AddNode(cuOutputCabs    , 1, 0);
    7095           1 :   trayStructure->AddNode(plastOutputCabs , 1, 0);
    7096           1 :   trayStructure->AddNode(alOutputCabs    , 1, 0);
    7097           1 :   trayStructure->AddNode(kaptonOutputCabs, 1, 0);
    7098           1 :   trayStructure->AddNode(polyaxOutputCabs, 1, 0);
    7099             : 
    7100           1 :   xloc = kXShiftBarCool + kBarCoolRmax + pcbBoardsCu->GetDX();
    7101           1 :   yloc = outputCabsPOLYAX->GetY(5) + pcbBoardsCu->GetDY();
    7102           2 :   trayStructure->AddNode(cuPCBBoards, 1,
    7103           2 :                          new TGeoTranslation( xloc, yloc , 0) );
    7104             : 
    7105           1 :   yloc += pcbBoardsCu->GetDY() + pcbBoardsEpoxy->GetDY();
    7106           2 :   trayStructure->AddNode(epoxyPCBBoards, 1,
    7107           2 :                          new TGeoTranslation( xloc, yloc , 0) );
    7108             : 
    7109           1 :   yloc += pcbBoardsEpoxy->GetDY() + pcbBoardsPlast->GetDY();
    7110           2 :   trayStructure->AddNode(plastPCBBoards, 1,
    7111           2 :                          new TGeoTranslation( xloc, yloc , 0) );
    7112             : 
    7113           1 :   yloc += pcbBoardsPlast->GetDY() + pcbBoardsSteel->GetDY();
    7114           2 :   trayStructure->AddNode(steelPCBBoards, 1,
    7115           2 :                          new TGeoTranslation( xloc, yloc , 0) );
    7116             : 
    7117           1 :   yloc += pcbBoardsSteel->GetDY() + pcbBoardsPPS->GetDY();
    7118           2 :   trayStructure->AddNode(ppsPCBBoards, 1,
    7119           2 :                          new TGeoTranslation( xloc, yloc , 0) );
    7120             : 
    7121           1 :   trayStructure->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    7122             :   // Finally put everything in the mother volume
    7123             :   alphafold = kSideCFoldAngle;
    7124             : 
    7125          10 :   for (Int_t jt = 0; jt < kNumTraySideC; jt++) {
    7126           4 :     alpharot = kTraySideCAlphaRot[jt];
    7127           4 :     xloc = kTraySideCRPos*SinD(alpharot);
    7128           4 :     yloc = kTraySideCRPos*CosD(alpharot);
    7129           8 :     moth->AddNode(trayStructure,jt+1,
    7130          12 :                        new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
    7131           8 :                        new TGeoRotation("",-90.+alpharot,-90.,90.+alphafold)));
    7132             :   }
    7133             : 
    7134             : 
    7135             :   return;
    7136           1 : }
    7137             : 
    7138             : 
    7139             : //______________________________________________________________________
    7140             : void AliITSv11GeometrySupport::SSDCableTraysSideA(TGeoVolume *moth,
    7141             :                                             const TGeoManager *mgr){
    7142             : //
    7143             : // Creates the SSD cable trays which are outside the ITS support cones
    7144             : // but still inside the TPC on Side A
    7145             : // (part of this code is taken or anyway inspired to ServicesCableSupport
    7146             : // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    7147             : //
    7148             : // Input:
    7149             : //         moth : the TGeoVolume owing the volume structure
    7150             : //         mgr  : the GeoManager (default gGeoManager)
    7151             : // Output:
    7152             : //
    7153             : // Created:         ???       Bjorn S. Nilsen
    7154             : // Updated:      30 Dec 2009  Mario Sitta
    7155             : //
    7156             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    7157             : // drawings and other (oral) information given by F.Tosello and
    7158             : // Ton van den Brink
    7159             : // Cables and cooling tubes are approximated with proper materials and
    7160             : // rectangular cross sections, always preserving the total material budget.
    7161             : //
    7162             : 
    7163             :   // Dimensions and positions of the A-Side Cable Trays
    7164             :   // (parts of 0872/G/D)
    7165           2 :   const Double_t kTrayARTrans            =  408.35 *fgkmm;
    7166           1 :   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
    7167           1 :   const Double_t kForwardSideYTrans      =   12.00 *fgkmm;//!!!TO BE CHECKED!!!
    7168           1 :   const Double_t kCoversYTrans           =    2.00 *fgkmm;
    7169             :   const Double_t kTrayAZRot              = (180-169.5);// Degrees
    7170             :   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
    7171             :   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
    7172             : 
    7173           1 :   const Double_t kTrayTotalHeight        =   52.00 *fgkmm;
    7174           1 :   const Double_t kTrayHeighToBend        =   32.00 *fgkmm;
    7175           1 :   const Double_t kTrayWidth              =  130.00 *fgkmm;
    7176             :   const Double_t kTrayThick              =    2.00 *fgkmm;
    7177             : 
    7178           1 :   const Double_t kTrayBendAngle          =   22.00 *TMath::DegToRad();
    7179             : 
    7180           1 :   const Double_t kForwardTrayTotalLen    =  853.00 *fgkmm;
    7181           1 :   const Double_t kForwardTrayFirstLen    =  350.00 *fgkmm;
    7182           1 :   const Double_t kForwardTrayFirstHeight =   47.00 *fgkmm;
    7183           1 :   const Double_t kForwardCoverLen        =  420.00 *fgkmm;
    7184             : 
    7185             :   const Double_t kForwardSideLength      = kForwardTrayFirstLen;//!!!TO BE CHECKED!!!
    7186           1 :   const Double_t kForwardSideHeight      =   90.00 *fgkmm;//!!!TO BE CHECKED!!!
    7187             :   const Double_t kForwardSideThick       =    1.00 *fgkmm;//!!!TO BE CHECKED!!!
    7188           1 :   const Double_t kForwardCoverHeight     =   10.00 *fgkmm;//!!!TO BE CHECKED!!!
    7189             : 
    7190           1 :   const Double_t kExternalTrayTotalLen   = 1200.00 *fgkmm;
    7191             :   const Double_t kExternalCoverLen       = kExternalTrayTotalLen;
    7192           1 :   const Double_t kExternalCoverThick     =    5.00 *fgkmm;
    7193             : 
    7194             :   const Int_t    kForwardTrayNpoints     =   16;
    7195             : 
    7196           1 :   const Double_t kServicesWidth          =  100.00 *fgkmm;
    7197           1 :   const Double_t kCopperHeight           =   11.20 *fgkmm;// 1120 mm^2
    7198           1 :   const Double_t kCablePlasticHeight     =   11.50 *fgkmm;// 1150 mm^2
    7199           1 :   const Double_t kCoolingWaterHeight     =    2.65 *fgkmm;//  265 mm^2
    7200           1 :   const Double_t kPoliUrethaneHeight     =    4.62 *fgkmm;//  462 mm^2
    7201             : 
    7202             : 
    7203             :   // Local variables
    7204           1 :   Double_t xprof[kForwardTrayNpoints], yprof[kForwardTrayNpoints];
    7205             :   Double_t xloc, yloc, zloc, alpharot, totalhi;
    7206             : 
    7207             : 
    7208             :   // The two tray components as assemblies
    7209             :   TGeoVolumeAssembly *cableTrayAForw =
    7210           1 :     new TGeoVolumeAssembly("ITSsupportSSDTrayAForw");
    7211             :   TGeoVolumeAssembly *cableTrayAExt =
    7212           1 :     new TGeoVolumeAssembly("ITSsupportSSDTrayAExt");
    7213             :   
    7214             : 
    7215             :   // First create all needed shapes
    7216             : 
    7217             :   // The first part of the forward tray (part of 0872/G/D/07): a Xtru
    7218           1 :   TGeoXtru *forwTrayPart1 = new TGeoXtru(2);
    7219             : 
    7220           1 :   xprof[3] = kTrayWidth/2;
    7221           1 :   yprof[3] = kForwardTrayFirstHeight;
    7222           1 :   xprof[2] = xprof[3] - kTrayThick;
    7223           1 :   yprof[2] = yprof[3];
    7224           1 :   xprof[4] = xprof[3];
    7225           1 :   yprof[4] = kTrayTotalHeight - kTrayHeighToBend;
    7226           1 :   xprof[5] = xprof[4] - yprof[4]*TMath::Tan(kTrayBendAngle);
    7227           1 :   yprof[5] = 0;
    7228             : 
    7229           2 :   InsidePoint( xprof[3], yprof[3], xprof[4], yprof[4], xprof[5], yprof[5],
    7230           1 :               -kTrayThick, xprof[1], yprof[1]);
    7231             : 
    7232           1 :   xprof[6] = -xprof[5];
    7233           1 :   yprof[6] =  yprof[5];
    7234             : 
    7235           2 :   InsidePoint( xprof[4], yprof[4], xprof[5], yprof[5], xprof[6], yprof[6],
    7236           1 :               -kTrayThick, xprof[0], yprof[0]);
    7237             : 
    7238             :   // We did the right side, now reflex on the left side
    7239          14 :   for (Int_t jp = 0; jp < 6; jp++) {
    7240           6 :     xprof[6+jp] = -xprof[5-jp];
    7241           6 :     yprof[6+jp] =  yprof[5-jp];
    7242             :   }
    7243             : 
    7244             :   // And now the actual Xtru
    7245           1 :   forwTrayPart1->DefinePolygon(12, xprof, yprof);
    7246           1 :   forwTrayPart1->DefineSection(0, 0);
    7247           1 :   forwTrayPart1->DefineSection(1, kForwardTrayFirstLen);
    7248             : 
    7249             :   // The second part of the forward tray (part of 0872/G/D/07): a Xtru
    7250             :   TGeoXtru *forwTrayPart2 =
    7251           1 :     CreateSDDSSDTraysSideA(kForwardTrayTotalLen - kForwardTrayFirstLen,
    7252             :                            kTrayTotalHeight);
    7253             : 
    7254             :   // The external tray (as 0872/G/D/03): a Xtru with same profile
    7255           1 :   TGeoXtru *externalTray = CreateSDDSSDTraysSideA(kExternalTrayTotalLen,
    7256             :                                                   kTrayTotalHeight);
    7257             : 
    7258             :   // The side wall of the forward tray: a BBox
    7259           2 :   TGeoBBox *forwSide = new TGeoBBox(kForwardSideThick/2,
    7260           1 :                                     kForwardSideHeight/2,
    7261           1 :                                     kForwardSideLength/2);
    7262             : 
    7263             :   // The side cover over the walls: a Xtru
    7264           1 :   TGeoXtru *forwSideCover = new TGeoXtru(2);
    7265           1 :   forwSideCover->SetName("ITSsuppSSDForwCover");
    7266             : 
    7267           1 :   xprof[0] = kTrayWidth/2 + 2*kForwardSideThick;
    7268           1 :   yprof[0] = kForwardCoverHeight;
    7269           1 :   xprof[1] = xprof[0];
    7270           1 :   yprof[1] = 0;
    7271           1 :   xprof[2] = xprof[1] - kForwardSideThick;
    7272           1 :   yprof[2] = yprof[1];
    7273           1 :   xprof[3] = xprof[2];
    7274           1 :   yprof[3] = yprof[0] - kForwardSideThick;
    7275             : 
    7276             :   // We did the right side, now reflex on the left side
    7277          10 :   for (Int_t jp = 0; jp < 4; jp++) {
    7278           4 :     xprof[4+jp] = -xprof[3-jp];
    7279           4 :     yprof[4+jp] =  yprof[3-jp];
    7280             :   }
    7281             : 
    7282           1 :   forwSideCover->DefinePolygon(8, xprof, yprof);
    7283           1 :   forwSideCover->DefineSection(0, 0);
    7284           1 :   forwSideCover->DefineSection(1, kForwardSideLength);
    7285             : 
    7286             :   // The forward and external covers: two Composite Shape's
    7287           1 :   TGeoCompositeShape *forwardCover = CreateTrayAForwardCover(kForwardCoverLen);
    7288             : 
    7289           1 :   TGeoCompositeShape *externCover = CreateTrayAExternalCover(kExternalCoverLen);
    7290             : 
    7291             :   // The cable copper inside the forward tray: a BBox
    7292           2 :   TGeoBBox *forwCopper = new TGeoBBox(kServicesWidth/2,
    7293           1 :                                       kCopperHeight/2,
    7294           1 :                                       kForwardTrayTotalLen/2);
    7295             : 
    7296             :   // The cable copper inside the forward tray: a Xtru
    7297           1 :   TGeoXtru *extCopper = new TGeoXtru(2);
    7298           1 :   extCopper->SetName("ITSsuppSSDExtTrayCopper");
    7299             : 
    7300           1 :   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
    7301           1 :           - kTrayThick;
    7302             : 
    7303           1 :   xprof[0] = -totalhi*TanD(kTrayAZRot);
    7304           1 :   yprof[0] = kTrayThick;
    7305           1 :   xprof[1] = kExternalTrayTotalLen;
    7306           1 :   yprof[1] = yprof[0];
    7307           1 :   xprof[2] = xprof[1];
    7308           1 :   yprof[2] = yprof[1] + kCopperHeight;
    7309           1 :   totalhi -= kCopperHeight;
    7310           1 :   xprof[3] = -totalhi*TanD(kTrayAZRot);
    7311           1 :   yprof[3] = yprof[2];
    7312             : 
    7313           1 :   extCopper->DefinePolygon(4, xprof, yprof);
    7314           1 :   extCopper->DefineSection(0, 0);
    7315           1 :   extCopper->DefineSection(1, kServicesWidth);
    7316             : 
    7317             :   // The cable plastic inside the forward tray: a BBox
    7318           2 :   TGeoBBox *forwPlastic = new TGeoBBox(kServicesWidth/2,
    7319           1 :                                        kCablePlasticHeight/2,
    7320             :                                        kForwardTrayTotalLen/2);
    7321             : 
    7322             :   // The cable plastic inside the forward tray: a Xtru
    7323           1 :   TGeoXtru *extPlastic = new TGeoXtru(2);
    7324           1 :   extPlastic->SetName("ITSsuppSSDExtTrayPlastic");
    7325             : 
    7326             :   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
    7327             :           - kTrayThick - kCopperHeight;
    7328             : 
    7329           1 :   xprof[0] = -totalhi*TanD(kTrayAZRot);
    7330           1 :   yprof[0] = kTrayThick;
    7331           1 :   xprof[1] = kExternalTrayTotalLen;
    7332           1 :   yprof[1] = yprof[0];
    7333           1 :   xprof[2] = xprof[1];
    7334           1 :   yprof[2] = yprof[1] + kCablePlasticHeight;
    7335           1 :   totalhi -= kCablePlasticHeight;
    7336           1 :   xprof[3] = -totalhi*TanD(kTrayAZRot);
    7337           1 :   yprof[3] = yprof[2];
    7338             : 
    7339           1 :   extPlastic->DefinePolygon(4, xprof, yprof);
    7340           1 :   extPlastic->DefineSection(0, 0);
    7341           1 :   extPlastic->DefineSection(1, kServicesWidth);
    7342             : 
    7343             :   // The cooling water inside the forward tray: a BBox
    7344           2 :   TGeoBBox *forwWater = new TGeoBBox(kServicesWidth/2,
    7345           1 :                                      kCoolingWaterHeight/2,
    7346             :                                      kForwardTrayTotalLen/2);
    7347             : 
    7348             :   // The cooling water inside the forward tray: a Xtru
    7349           1 :   TGeoXtru *extWater = new TGeoXtru(2);
    7350           1 :   extWater->SetName("ITSsuppSSDExtTrayWater");
    7351             : 
    7352             :   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
    7353             :           - kTrayThick - kCopperHeight - kCablePlasticHeight;
    7354             : 
    7355           1 :   xprof[0] = -totalhi*TanD(kTrayAZRot);
    7356           1 :   yprof[0] = kTrayThick;
    7357           1 :   xprof[1] = kExternalTrayTotalLen;
    7358           1 :   yprof[1] = yprof[0];
    7359           1 :   xprof[2] = xprof[1];
    7360           1 :   yprof[2] = yprof[1] + kCoolingWaterHeight;
    7361           1 :   totalhi -= kCoolingWaterHeight;
    7362           1 :   xprof[3] = -totalhi*TanD(kTrayAZRot);
    7363           1 :   yprof[3] = yprof[2];
    7364             : 
    7365           1 :   extWater->DefinePolygon(4, xprof, yprof);
    7366           1 :   extWater->DefineSection(0, 0);
    7367           1 :   extWater->DefineSection(1, kServicesWidth);
    7368             : 
    7369             :   // The polyurethane inside the forward tray: a BBox
    7370           2 :   TGeoBBox *forwPUR = new TGeoBBox(kServicesWidth/2,
    7371           1 :                                    kPoliUrethaneHeight/2,
    7372             :                                    kForwardTrayTotalLen/2);
    7373             : 
    7374             :   // The poliurethane inside the forward tray: a Xtru
    7375           1 :   TGeoXtru *extPUR = new TGeoXtru(2);
    7376           1 :   extPUR->SetName("ITSsuppSSDExtTrayPUR");
    7377             : 
    7378             :   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
    7379             :           - kTrayThick - kCopperHeight - kCablePlasticHeight
    7380             :           - kCoolingWaterHeight;
    7381             : 
    7382           1 :   xprof[0] = -totalhi*TanD(kTrayAZRot);
    7383           1 :   yprof[0] = kTrayThick;
    7384           1 :   xprof[1] = kExternalTrayTotalLen;
    7385           1 :   yprof[1] = yprof[0];
    7386           1 :   xprof[2] = xprof[1];
    7387           1 :   yprof[2] = yprof[1] + kPoliUrethaneHeight;
    7388           1 :   totalhi -= kPoliUrethaneHeight;
    7389           1 :   xprof[3] = -totalhi*TanD(kTrayAZRot);
    7390           1 :   yprof[3] = yprof[2];
    7391             : 
    7392           1 :   extPUR->DefinePolygon(4, xprof, yprof);
    7393           1 :   extPUR->DefineSection(0, 0);
    7394           1 :   extPUR->DefineSection(1, kServicesWidth);
    7395             : 
    7396             : 
    7397             :   // We have all shapes: now create the real volumes
    7398           1 :   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
    7399           1 :   TGeoMedium *medAntic = mgr->GetMedium("ITS_ANTICORODAL$");
    7400           1 :   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
    7401           1 :   TGeoMedium *medFEP   = mgr->GetMedium("ITS_SSD FEP$");
    7402           1 :   TGeoMedium *medH2O   = mgr->GetMedium("ITS_WATER$");
    7403           1 :   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
    7404             : 
    7405           2 :   TGeoVolume *forwTrayFirst = new TGeoVolume("ITSsuppSSDSideAForwTrayFirst",
    7406           1 :                                              forwTrayPart1, medAl);
    7407             : 
    7408           1 :   forwTrayFirst->SetVisibility(kTRUE);
    7409           1 :   forwTrayFirst->SetLineColor(6); // Purple
    7410           1 :   forwTrayFirst->SetLineWidth(1);
    7411           1 :   forwTrayFirst->SetFillColor(forwTrayFirst->GetLineColor());
    7412           1 :   forwTrayFirst->SetFillStyle(4000); // 0% transparent
    7413             : 
    7414           2 :   TGeoVolume *forwTraySecond = new TGeoVolume("ITSsuppSSDSideAForwTraySecond",
    7415           1 :                                               forwTrayPart2, medAl);
    7416             : 
    7417           1 :   forwTraySecond->SetVisibility(kTRUE);
    7418           1 :   forwTraySecond->SetLineColor(6); // Purple
    7419           1 :   forwTraySecond->SetLineWidth(1);
    7420           1 :   forwTraySecond->SetFillColor(forwTraySecond->GetLineColor());
    7421           1 :   forwTraySecond->SetFillStyle(4000); // 0% transparent
    7422             : 
    7423           2 :   TGeoVolume *forwTraySide = new TGeoVolume("ITSsuppSSDSideAForwTraySide",
    7424           1 :                                             forwSide, medAl);
    7425             : 
    7426           1 :   forwTraySide->SetVisibility(kTRUE);
    7427           1 :   forwTraySide->SetLineColor(6); // Purple
    7428           1 :   forwTraySide->SetLineWidth(1);
    7429           1 :   forwTraySide->SetFillColor(forwTraySide->GetLineColor());
    7430           1 :   forwTraySide->SetFillStyle(4000); // 0% transparent
    7431             : 
    7432           2 :   TGeoVolume *forwTraySideCover = new TGeoVolume("ITSsuppSSDSideAForwTraySideCover",
    7433           1 :                                             forwSideCover, medAl);
    7434             : 
    7435           1 :   forwTraySideCover->SetVisibility(kTRUE);
    7436           1 :   forwTraySideCover->SetLineColor(6); // Purple
    7437           1 :   forwTraySideCover->SetLineWidth(1);
    7438           1 :   forwTraySideCover->SetFillColor(forwTraySideCover->GetLineColor());
    7439           1 :   forwTraySideCover->SetFillStyle(4000); // 0% transparent
    7440             : 
    7441           2 :   TGeoVolume *externalTraySSD = new TGeoVolume("ITSsuppSSDSideAExternalTray",
    7442           1 :                                                externalTray, medAl);
    7443             : 
    7444           1 :   externalTraySSD->SetVisibility(kTRUE);
    7445           1 :   externalTraySSD->SetLineColor(6); // Purple
    7446           1 :   externalTraySSD->SetLineWidth(1);
    7447           1 :   externalTraySSD->SetFillColor(externalTraySSD->GetLineColor());
    7448           1 :   externalTraySSD->SetFillStyle(4000); // 0% transparent
    7449             : 
    7450           2 :   TGeoVolume *forwardTrayCover = new TGeoVolume("ITSsuppSSDSideAForwTrayCover",
    7451           1 :                                                 forwardCover, medAntic);
    7452             : 
    7453           1 :   forwardTrayCover->SetVisibility(kTRUE);
    7454           1 :   forwardTrayCover->SetLineColor(kMagenta+1); // Purple
    7455           1 :   forwardTrayCover->SetLineWidth(1);
    7456           1 :   forwardTrayCover->SetFillColor(forwardTrayCover->GetLineColor());
    7457           1 :   forwardTrayCover->SetFillStyle(4000); // 0% transparent
    7458             : 
    7459           2 :   TGeoVolume *externTrayCover = new TGeoVolume("ITSsuppSSDSideAExtTrayCover",
    7460           1 :                                                externCover, medAntic);
    7461             : 
    7462           1 :   externTrayCover->SetVisibility(kTRUE);
    7463           1 :   externTrayCover->SetLineColor(kMagenta+1); // Purple
    7464           1 :   externTrayCover->SetLineWidth(1);
    7465           1 :   externTrayCover->SetFillColor(externTrayCover->GetLineColor());
    7466           1 :   externTrayCover->SetFillStyle(4000); // 0% transparent
    7467             : 
    7468           2 :   TGeoVolume *forwCableCu = new TGeoVolume("ITSsuppSSDSideAForwCableCu",
    7469           1 :                                            forwCopper, medCu);
    7470             : 
    7471           1 :   forwCableCu->SetVisibility(kTRUE);
    7472           1 :   forwCableCu->SetLineColor(kRed); // Red
    7473           1 :   forwCableCu->SetLineWidth(1);
    7474           1 :   forwCableCu->SetFillColor(forwCableCu->GetLineColor());
    7475           1 :   forwCableCu->SetFillStyle(4000); // 0% transparent
    7476             : 
    7477           2 :   TGeoVolume *extCableCu = new TGeoVolume("ITSsuppSSDSideAExtCableCu",
    7478           1 :                                           extCopper, medCu);
    7479             : 
    7480           1 :   extCableCu->SetVisibility(kTRUE);
    7481           1 :   extCableCu->SetLineColor(kRed); // Red
    7482           1 :   extCableCu->SetLineWidth(1);
    7483           1 :   extCableCu->SetFillColor(extCableCu->GetLineColor());
    7484           1 :   extCableCu->SetFillStyle(4000); // 0% transparent
    7485             : 
    7486           2 :   TGeoVolume *forwCableFEP = new TGeoVolume("ITSsuppSSDSideAForwCableFEP",
    7487           1 :                                             forwPlastic, medFEP);
    7488             : 
    7489           1 :   forwCableFEP->SetVisibility(kTRUE);
    7490           1 :   forwCableFEP->SetLineColor(kYellow); // Yellow
    7491           1 :   forwCableFEP->SetLineWidth(1);
    7492           1 :   forwCableFEP->SetFillColor(forwCableFEP->GetLineColor());
    7493           1 :   forwCableFEP->SetFillStyle(4000); // 0% transparent
    7494             : 
    7495           2 :   TGeoVolume *extCableFEP = new TGeoVolume("ITSsuppSSDSideAExtCableFEP",
    7496           1 :                                            extPlastic, medFEP);
    7497             : 
    7498           1 :   extCableFEP->SetVisibility(kTRUE);
    7499           1 :   extCableFEP->SetLineColor(kYellow); // Yellow
    7500           1 :   extCableFEP->SetLineWidth(1);
    7501           1 :   extCableFEP->SetFillColor(extCableFEP->GetLineColor());
    7502           1 :   extCableFEP->SetFillStyle(4000); // 0% transparent
    7503             : 
    7504           2 :   TGeoVolume *forwTrayWater = new TGeoVolume("ITSsuppSSDSideAForwTrayWater",
    7505           1 :                                              forwWater, medH2O);
    7506             : 
    7507           1 :   forwTrayWater->SetVisibility(kTRUE);
    7508           1 :   forwTrayWater->SetLineColor(kBlue); // Blue
    7509           1 :   forwTrayWater->SetLineWidth(1);
    7510           1 :   forwTrayWater->SetFillColor(forwTrayWater->GetLineColor());
    7511           1 :   forwTrayWater->SetFillStyle(4000); // 0% transparent
    7512             : 
    7513           2 :   TGeoVolume *extTrayWater = new TGeoVolume("ITSsuppSSDSideAExtTrayWater",
    7514           1 :                                             extWater, medH2O);
    7515             : 
    7516           1 :   extTrayWater->SetVisibility(kTRUE);
    7517           1 :   extTrayWater->SetLineColor(kBlue); // Blue
    7518           1 :   extTrayWater->SetLineWidth(1);
    7519           1 :   extTrayWater->SetFillColor(extTrayWater->GetLineColor());
    7520           1 :   extTrayWater->SetFillStyle(4000); // 0% transparent
    7521             : 
    7522           2 :   TGeoVolume *forwPolyUr = new TGeoVolume("ITSsuppSSDSideAForwPolyUr",
    7523           1 :                                           forwPUR, medPUR);
    7524             : 
    7525           1 :   forwPolyUr->SetVisibility(kTRUE);
    7526           1 :   forwPolyUr->SetLineColor(kGray); // Gray
    7527           1 :   forwPolyUr->SetLineWidth(1);
    7528           1 :   forwPolyUr->SetFillColor(forwPolyUr->GetLineColor());
    7529           1 :   forwPolyUr->SetFillStyle(4000); // 0% transparent
    7530             : 
    7531           2 :   TGeoVolume *extPolyUr = new TGeoVolume("ITSsuppSSDSideAExtPolyUr",
    7532           1 :                                          extPUR, medPUR);
    7533             : 
    7534           1 :   extPolyUr->SetVisibility(kTRUE);
    7535           1 :   extPolyUr->SetLineColor(kGray); // Gray
    7536           1 :   extPolyUr->SetLineWidth(1);
    7537           1 :   extPolyUr->SetFillColor(extPolyUr->GetLineColor());
    7538           1 :   extPolyUr->SetFillStyle(4000); // 0% transparent
    7539             : 
    7540             : 
    7541             :   // Now build up the tray
    7542           1 :   cableTrayAForw->AddNode(forwTrayFirst, 1, 0);
    7543             : 
    7544           2 :   cableTrayAForw->AddNode(forwTraySecond, 1,
    7545           2 :                         new TGeoTranslation(0, 0, kForwardTrayFirstLen) );
    7546             : 
    7547           1 :   xloc = kTrayWidth/2 + kForwardSideThick/2;
    7548           1 :   yloc = kForwardTrayFirstHeight + kForwardSideHeight/2 - kForwardSideYTrans;
    7549             :   zloc = kForwardSideLength/2;
    7550           2 :   cableTrayAForw->AddNode(forwTraySide,1,
    7551           2 :                         new TGeoTranslation( xloc, yloc, zloc) );
    7552           2 :   cableTrayAForw->AddNode(forwTraySide,2,
    7553           2 :                         new TGeoTranslation(-xloc, yloc, zloc) );
    7554             : 
    7555           1 :   yloc = kForwardTrayFirstHeight + kForwardSideHeight - kForwardSideYTrans
    7556           1 :        - kForwardCoverHeight;
    7557           2 :   cableTrayAForw->AddNode(forwTraySideCover,1,
    7558           2 :                         new TGeoTranslation(0, yloc, 0) );
    7559             : 
    7560           1 :   yloc = kTrayTotalHeight - kCoversYTrans;
    7561           1 :   zloc = kForwardTrayTotalLen - kForwardCoverLen;
    7562           2 :   cableTrayAForw->AddNode(forwardTrayCover,1,
    7563           2 :                         new TGeoTranslation(0, yloc, zloc) );
    7564             : 
    7565           1 :   yloc = kTrayThick + forwCopper->GetDY();
    7566           1 :   zloc = forwCopper->GetDZ();
    7567           2 :   cableTrayAForw->AddNode(forwCableCu, 1,
    7568           2 :                         new TGeoTranslation(0, yloc, zloc) );
    7569             : 
    7570           1 :   yloc = kTrayThick + kCopperHeight + forwPlastic->GetDY();
    7571           1 :   zloc = forwPlastic->GetDZ();
    7572           2 :   cableTrayAForw->AddNode(forwCableFEP, 1,
    7573           2 :                         new TGeoTranslation(0, yloc, zloc) );
    7574             : 
    7575           1 :   yloc = kTrayThick + kCopperHeight + kCablePlasticHeight + forwWater->GetDY();
    7576           1 :   zloc = forwWater->GetDZ();
    7577           2 :   cableTrayAForw->AddNode(forwTrayWater, 1,
    7578           2 :                         new TGeoTranslation(0, yloc, zloc) );
    7579             : 
    7580             :   yloc = kTrayThick + kCopperHeight + kCablePlasticHeight
    7581           1 :        + kCoolingWaterHeight + forwPUR->GetDY();
    7582           1 :   zloc = forwPUR->GetDZ();
    7583           2 :   cableTrayAForw->AddNode(forwPolyUr, 1,
    7584           2 :                         new TGeoTranslation(0, yloc, zloc) );
    7585             : 
    7586             :   // To simplify following placement in MARS, origin is on top
    7587             :   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans;
    7588             : 
    7589           1 :   yloc = -totalhi;
    7590           2 :   cableTrayAExt->AddNode(externalTraySSD, 1,
    7591           2 :                         new TGeoTranslation(0, yloc, 0) );
    7592             : 
    7593           1 :   yloc = -totalhi + kTrayTotalHeight - kCoversYTrans;
    7594           2 :   cableTrayAExt->AddNode(externTrayCover,1,
    7595           2 :                         new TGeoTranslation(0, yloc, 0) );
    7596             : 
    7597           1 :   xloc = extCopper->GetDZ();
    7598             :   yloc = -totalhi;
    7599           2 :   cableTrayAExt->AddNode(extCableCu,1,
    7600           3 :                         new TGeoCombiTrans( xloc, yloc, 0,
    7601           2 :                         new TGeoRotation("",-90, 90, 90)        ) );
    7602             : 
    7603           1 :   xloc = extPlastic->GetDZ();
    7604           1 :   yloc = -totalhi + kCopperHeight;
    7605           2 :   cableTrayAExt->AddNode(extCableFEP,1,
    7606           3 :                         new TGeoCombiTrans( xloc, yloc, 0,
    7607           2 :                         new TGeoRotation("",-90, 90, 90)        ) );
    7608             : 
    7609           1 :   xloc = extWater->GetDZ();
    7610           1 :   yloc = -totalhi + kCopperHeight + kCablePlasticHeight;
    7611           2 :   cableTrayAExt->AddNode(extTrayWater,1,
    7612           3 :                         new TGeoCombiTrans( xloc, yloc, 0,
    7613           2 :                         new TGeoRotation("",-90, 90, 90)        ) );
    7614             : 
    7615           1 :   xloc = extPUR->GetDZ();
    7616           1 :   yloc = -totalhi + kCopperHeight + kCablePlasticHeight + kCoolingWaterHeight;
    7617           2 :   cableTrayAExt->AddNode(extPolyUr,1,
    7618           3 :                         new TGeoCombiTrans( xloc, yloc, 0,
    7619           2 :                         new TGeoRotation("",-90, 90, 90)        ) );
    7620             :   
    7621           1 :   cableTrayAForw->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    7622           1 :   cableTrayAExt->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    7623             :   
    7624             : 
    7625             :   // Finally put everything in the mother volume
    7626             :   zloc = kTrayAZTrans;
    7627           1 :   Double_t zlocext = zloc + kForwardTrayTotalLen;
    7628           1 :   Double_t rExtTray = kTrayARTrans + kTrayTotalHeight;
    7629             : 
    7630             :   alpharot = kTrayAFirstRotAng;
    7631           1 :   xloc = kTrayARTrans*SinD(alpharot);
    7632           1 :   yloc = kTrayARTrans*CosD(alpharot);
    7633           2 :   moth->AddNode(cableTrayAForw,1,
    7634           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    7635           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    7636           1 :   xloc = rExtTray*SinD(alpharot);
    7637           1 :   yloc = rExtTray*CosD(alpharot);
    7638           2 :   moth->AddNode(cableTrayAExt,1,
    7639           3 :                             new TGeoCombiTrans( xloc, yloc, zlocext,
    7640           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    7641             : 
    7642             :   alpharot += 180;
    7643           1 :   xloc = kTrayARTrans*SinD(alpharot);
    7644           1 :   yloc = kTrayARTrans*CosD(alpharot);
    7645           2 :   moth->AddNode(cableTrayAForw,2,
    7646           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    7647           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    7648           1 :   xloc = rExtTray*SinD(alpharot);
    7649           1 :   yloc = rExtTray*CosD(alpharot);
    7650           2 :   moth->AddNode(cableTrayAExt,2,
    7651           3 :                             new TGeoCombiTrans( xloc, yloc, zlocext,
    7652           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    7653             : 
    7654             :   alpharot = -kTrayAFirstRotAng - 2*kTrayASecondRotAng;
    7655           1 :   xloc = kTrayARTrans*SinD(alpharot);
    7656           1 :   yloc = kTrayARTrans*CosD(alpharot);
    7657           2 :   moth->AddNode(cableTrayAForw,3,
    7658           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    7659           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    7660           1 :   xloc = rExtTray*SinD(alpharot);
    7661           1 :   yloc = rExtTray*CosD(alpharot);
    7662           2 :   moth->AddNode(cableTrayAExt,3,
    7663           3 :                             new TGeoCombiTrans( xloc, yloc, zlocext,
    7664           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    7665             : 
    7666             :   alpharot += 180;
    7667           1 :   xloc = kTrayARTrans*SinD(alpharot);
    7668           1 :   yloc = kTrayARTrans*CosD(alpharot);
    7669           2 :   moth->AddNode(cableTrayAForw,4,
    7670           3 :                             new TGeoCombiTrans( xloc, yloc, zloc,
    7671           2 :                             new TGeoRotation("",-alpharot,0,0)   )   );
    7672           1 :   xloc = rExtTray*SinD(alpharot);
    7673           1 :   yloc = rExtTray*CosD(alpharot);
    7674           2 :   moth->AddNode(cableTrayAExt,4,
    7675           3 :                             new TGeoCombiTrans( xloc, yloc, zlocext,
    7676           2 :                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
    7677             : 
    7678             : 
    7679             :   return;
    7680           1 : }
    7681             : 
    7682             : //______________________________________________________________________
    7683             : void AliITSv11GeometrySupport::SSDCableTraysSideC(TGeoVolume *moth,
    7684             :                                             const TGeoManager *mgr){
    7685             : //
    7686             : // Creates the SSD cable trays which are outside the ITS support cones
    7687             : // but still inside the TPC on Side C
    7688             : // (part of this code is taken or anyway inspired to ServicesCableSupport
    7689             : // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
    7690             : //
    7691             : // Input:
    7692             : //         moth : the TGeoVolume owing the volume structure
    7693             : //         mgr  : the GeoManager (default gGeoManager)
    7694             : // Output:
    7695             : //
    7696             : // Created:         ???       Bjorn S. Nilsen
    7697             : // Updated:      15 Apr 2010  Mario Sitta
    7698             : //
    7699             : // Technical data are taken from AutoCAD drawings and other (oral)
    7700             : // information given by F.Tosello
    7701             : //
    7702             : 
    7703             :   // Dimensions and positions of the C-Side Cable Tray elements
    7704             :   const Int_t    kNumTraySideC           =    4;
    7705             : 
    7706           2 :   const Double_t kSideCFoldAngle         =    5.00 *fgkDegree;
    7707             : 
    7708           1 :   const Double_t kServicesWidth          =  100.00 *fgkmm;
    7709           1 :   const Double_t kCopperHeight           =   11.20 *fgkmm;// 1120 mm^2
    7710           1 :   const Double_t kCablePlasticHeight     =   11.50 *fgkmm;// 1150 mm^2
    7711           1 :   const Double_t kCoolingWaterHeight     =    2.65 *fgkmm;//  265 mm^2
    7712           1 :   const Double_t kPoliUrethaneHeight     =    4.62 *fgkmm;//  462 mm^2
    7713           1 :   const Double_t kCablesYtrans           =    2.50 *fgkmm;// Avoid ovlps
    7714             : 
    7715             :   // Overall position and rotation of the C-Side Cable Trays
    7716           1 :   const Double_t kTraySideCRPos          =   45.30    *fgkcm;
    7717           1 :   const Double_t kTraySideCZPos          = -102.40    *fgkcm;
    7718             :   const Double_t kTraySideCAlphaRot[kNumTraySideC]  = {     23.0,     -59.0,
    7719             :     /* from Patch panel position */                    180.+23.0, 180.-59.0};
    7720             : 
    7721             : 
    7722             :   // Local variables
    7723           1 :   Double_t xprof[6], yprof[6];
    7724             :   Double_t xloc, yloc, alpharot, alphafold;
    7725             : 
    7726             : 
    7727             :   // The assembly holding the metallic structure
    7728             :   TGeoVolumeAssembly *trayStructure =
    7729           1 :                                 CreateSDDSSDTraysSideC("ITSsupportSSDTrayC");
    7730             : 
    7731             :   // The cable copper inside the tray: a Xtru
    7732           1 :   TGeoXtru *copper = new TGeoXtru(2);
    7733           1 :   copper->SetName("ITSsuppSSDTrayCCopper");
    7734             : 
    7735             :   // Copper lies on the lower plate: get position of its points
    7736           1 :   TGeoXtru *lowerplate = (TGeoXtru*)(mgr->GetVolume("ITSsuppTraySideCLower")->GetShape());
    7737           1 :   xprof[0] = lowerplate->GetX(5);
    7738           1 :   yprof[0] = lowerplate->GetY(5) + kCablesYtrans;
    7739           1 :   xprof[1] = lowerplate->GetX(4);
    7740           1 :   yprof[1] = lowerplate->GetY(4) + kCablesYtrans;
    7741           1 :   xprof[2] = lowerplate->GetX(3);
    7742           1 :   yprof[2] = lowerplate->GetY(3) + kCablesYtrans;
    7743           1 :   xprof[3] = xprof[2] - kCopperHeight*SinD(kSideCFoldAngle);
    7744           1 :   yprof[3] = yprof[2] + kCopperHeight*CosD(kSideCFoldAngle);
    7745           2 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    7746           1 :               kCopperHeight , xprof[4], yprof[4]);
    7747           1 :   xprof[5] = xprof[0];
    7748           1 :   yprof[5] = yprof[0] + kCopperHeight;
    7749             : 
    7750           1 :   copper->DefinePolygon(6, xprof, yprof);
    7751           1 :   copper->DefineSection(0, -kServicesWidth/2);
    7752           1 :   copper->DefineSection(1,  kServicesWidth/2);
    7753             : 
    7754             :   // The cable plastic inside the tray: a Xtru
    7755           1 :   TGeoXtru *plastic = new TGeoXtru(2);
    7756           1 :   plastic->SetName("ITSsuppSSDTrayCPlastic");
    7757             : 
    7758           1 :   xprof[0] = copper->GetX(5);
    7759           1 :   yprof[0] = copper->GetY(5);
    7760           1 :   xprof[1] = copper->GetX(4);
    7761           1 :   yprof[1] = copper->GetY(4);
    7762           1 :   xprof[2] = copper->GetX(3);
    7763           1 :   yprof[2] = copper->GetY(3);
    7764           1 :   xprof[3] = xprof[2] - kCablePlasticHeight*SinD(kSideCFoldAngle);
    7765           1 :   yprof[3] = yprof[2] + kCablePlasticHeight*CosD(kSideCFoldAngle);
    7766           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    7767             :               kCablePlasticHeight , xprof[4], yprof[4]);
    7768           1 :   xprof[5] = xprof[0];
    7769           1 :   yprof[5] = yprof[0] + kCablePlasticHeight;
    7770             : 
    7771           1 :   plastic->DefinePolygon(6, xprof, yprof);
    7772           1 :   plastic->DefineSection(0, -kServicesWidth/2);
    7773           1 :   plastic->DefineSection(1,  kServicesWidth/2);
    7774             : 
    7775             :   // The cooling water inside the tray: a Xtru
    7776           1 :   TGeoXtru *water = new TGeoXtru(2);
    7777           1 :   water->SetName("ITSsuppSSDTrayCWater");
    7778             : 
    7779           1 :   xprof[0] = plastic->GetX(5);
    7780           1 :   yprof[0] = plastic->GetY(5);
    7781           1 :   xprof[1] = plastic->GetX(4);
    7782           1 :   yprof[1] = plastic->GetY(4);
    7783           1 :   xprof[2] = plastic->GetX(3);
    7784           1 :   yprof[2] = plastic->GetY(3);
    7785           1 :   xprof[3] = xprof[2] - kCoolingWaterHeight*SinD(kSideCFoldAngle);
    7786           1 :   yprof[3] = yprof[2] + kCoolingWaterHeight*CosD(kSideCFoldAngle);
    7787           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    7788             :               kCoolingWaterHeight , xprof[4], yprof[4]);
    7789           1 :   xprof[5] = xprof[0];
    7790           1 :   yprof[5] = yprof[0] + kCoolingWaterHeight;
    7791             : 
    7792           1 :   water->DefinePolygon(6, xprof, yprof);
    7793           1 :   water->DefineSection(0, -kServicesWidth/2);
    7794           1 :   water->DefineSection(1,  kServicesWidth/2);
    7795             : 
    7796             :   // The poliurethane inside the tray: a Xtru
    7797           1 :   TGeoXtru *pur = new TGeoXtru(2);
    7798           1 :   pur->SetName("ITSsuppSSDTrayCPUR");
    7799           1 :   xprof[0] = water->GetX(5);
    7800           1 :   yprof[0] = water->GetY(5);
    7801           1 :   xprof[1] = water->GetX(4);
    7802           1 :   yprof[1] = water->GetY(4);
    7803           1 :   xprof[2] = water->GetX(3);
    7804           1 :   yprof[2] = water->GetY(3);
    7805           1 :   xprof[3] = xprof[2] - kPoliUrethaneHeight*SinD(kSideCFoldAngle);
    7806           1 :   yprof[3] = yprof[2] + kPoliUrethaneHeight*CosD(kSideCFoldAngle);
    7807           1 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    7808             :               kPoliUrethaneHeight , xprof[4], yprof[4]);
    7809           1 :   xprof[5] = xprof[0];
    7810           1 :   yprof[5] = yprof[0] + kPoliUrethaneHeight;
    7811             : 
    7812           1 :   pur->DefinePolygon(6, xprof, yprof);
    7813           1 :   pur->DefineSection(0, -kServicesWidth/2);
    7814           1 :   pur->DefineSection(1,  kServicesWidth/2);
    7815             : 
    7816             : 
    7817             :   // We have all shapes: now create the real volumes
    7818           1 :   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
    7819           1 :   TGeoMedium *medFEP   = mgr->GetMedium("ITS_SSD FEP$");
    7820           1 :   TGeoMedium *medH2O   = mgr->GetMedium("ITS_WATER$");
    7821           1 :   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
    7822             : 
    7823           2 :   TGeoVolume *copperCable = new TGeoVolume("ITSsuppSSDSideCCableCu",
    7824           1 :                                            copper, medCu);
    7825             : 
    7826           1 :   copperCable->SetVisibility(kTRUE);
    7827           1 :   copperCable->SetLineColor(kRed); // Red
    7828           1 :   copperCable->SetLineWidth(1);
    7829           1 :   copperCable->SetFillColor(copperCable->GetLineColor());
    7830           1 :   copperCable->SetFillStyle(4000); // 0% transparent
    7831             : 
    7832           2 :   TGeoVolume *cableFEP = new TGeoVolume("ITSsuppSSDSideCCableFEP",
    7833           1 :                                         plastic, medFEP);
    7834             : 
    7835           1 :   cableFEP->SetVisibility(kTRUE);
    7836           1 :   cableFEP->SetLineColor(kYellow); // Yellow
    7837           1 :   cableFEP->SetLineWidth(1);
    7838           1 :   cableFEP->SetFillColor(cableFEP->GetLineColor());
    7839           1 :   cableFEP->SetFillStyle(4000); // 0% transparent
    7840             : 
    7841           2 :   TGeoVolume *trayWater = new TGeoVolume("ITSsuppSSDSideCTrayWater",
    7842           1 :                                          water, medH2O);
    7843             : 
    7844           1 :   trayWater->SetVisibility(kTRUE);
    7845           1 :   trayWater->SetLineColor(kBlue); // Blue
    7846           1 :   trayWater->SetLineWidth(1);
    7847           1 :   trayWater->SetFillColor(trayWater->GetLineColor());
    7848           1 :   trayWater->SetFillStyle(4000); // 0% transparent
    7849             : 
    7850           2 :   TGeoVolume *trayPolyUr = new TGeoVolume("ITSsuppSSDSideCPolyUr",
    7851           1 :                                           pur, medPUR);
    7852             : 
    7853           1 :   trayPolyUr->SetVisibility(kTRUE);
    7854           1 :   trayPolyUr->SetLineColor(kGray); // Gray
    7855           1 :   trayPolyUr->SetLineWidth(1);
    7856           1 :   trayPolyUr->SetFillColor(trayPolyUr->GetLineColor());
    7857           1 :   trayPolyUr->SetFillStyle(4000); // 0% transparent
    7858             : 
    7859             : 
    7860             :   // Now fill in the tray
    7861           1 :   trayStructure->AddNode(copperCable,1,0);
    7862           1 :   trayStructure->AddNode(cableFEP,1,0);
    7863           1 :   trayStructure->AddNode(trayWater,1,0);
    7864           1 :   trayStructure->AddNode(trayPolyUr,1,0);
    7865             : 
    7866           1 :   trayStructure->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    7867             : 
    7868             :   // Finally put everything in the mother volume
    7869             :   alphafold = kSideCFoldAngle;
    7870             : 
    7871          10 :   for (Int_t jt = 0; jt < kNumTraySideC; jt++) {
    7872           4 :     alpharot = kTraySideCAlphaRot[jt];
    7873           4 :     xloc = kTraySideCRPos*SinD(alpharot);
    7874           4 :     yloc = kTraySideCRPos*CosD(alpharot);
    7875           8 :     moth->AddNode(trayStructure,jt+1,
    7876          12 :                        new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
    7877           8 :                        new TGeoRotation("",-90.+alpharot,-90.,90.+alphafold)));
    7878             :   }
    7879             : 
    7880             : 
    7881             :   return;
    7882           1 : }
    7883             : 
    7884             : //______________________________________________________________________
    7885             : void AliITSv11GeometrySupport::CreateSDDForwardTraySideA(TGeoVolumeAssembly *tray,
    7886             :                                                    const TGeoManager *mgr){
    7887             : //
    7888             : // Creates the forward SDD tray on Side A (0872/G/D/01)
    7889             : //
    7890             : // Input:
    7891             : //         tray : the TGeoVolumeAssembly to put the elements in
    7892             : //         mgr  : the GeoManager (used only to get the proper material)
    7893             : //
    7894             : // Output:
    7895             : //
    7896             : // Return:
    7897             : //
    7898             : // Created:      08 Jan 2010  Mario Sitta
    7899             : // Updated:      07 Sep 2010  Mario Sitta
    7900             : //
    7901             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    7902             : // drawings and other (oral) information given by F.Tosello
    7903             : //
    7904             : 
    7905             :   // Dimensions of the A-Side Forward Cable Tray (0872/G/D/01)
    7906           2 :   const Double_t kForwardTrayThick        =    2.00 *fgkmm;
    7907           1 :   const Double_t kForwardTraySideLength   =  823.00 *fgkmm;
    7908           1 :   const Double_t kForwardTrayTailLength   =  212.00 *fgkmm;
    7909           1 :   const Double_t kForwardTrayBaseHalfWide =   55.00 *fgkmm;
    7910           1 :   const Double_t kForwardTrayNotchLength  =   47.20 *fgkmm;
    7911           1 :   const Double_t kForwardTrayNotchHeight  =   25.00 *fgkmm;
    7912           1 :   const Double_t kForwardTrayNotchDown    =   10.00 *fgkmm;
    7913           1 :   const Double_t kForwardTraySide1Height  =   39.00 *fgkmm;
    7914           1 :   const Double_t kForwardTraySide2Height  =   26.00 *fgkmm;
    7915           1 :   const Double_t kForwardTraySide2Expand  =   10.50 *fgkmm;
    7916           1 :   const Double_t kForwardTraySide3TailLen =  418.00 *fgkmm;
    7917           1 :   const Double_t kForwardTraySide3TailHi  =   31.00 *fgkmm;
    7918           1 :   const Double_t kForwardTraySide3HeadLen =  425.00 *fgkmm;
    7919           1 :   const Double_t kForwardTraySide3HeadHi  =   72.00 *fgkmm;
    7920             :   const Double_t kForwardTrayHorWingWide  =   10.50 *fgkmm;
    7921           1 :   const Double_t kForwardTrayVertWingWide =   15.00 *fgkmm;
    7922             : 
    7923             :   const Int_t    kForwardTraySideNpoints  =    9;
    7924             : 
    7925             : 
    7926             :   // Local variables
    7927           1 :   Double_t xprof[kForwardTraySideNpoints], yprof[kForwardTraySideNpoints];
    7928             :   Double_t ylen, zlen;
    7929             :   Double_t xloc, yloc, zloc;
    7930             : 
    7931             : 
    7932             :   // The tray has a very complex shape, so it is made by assembling
    7933             :   // different elements (with some small simplifications)
    7934             : 
    7935             :   // The tray base: a BBox
    7936           1 :   zlen = (kForwardTraySideLength-kForwardTrayTailLength)/2;
    7937           2 :   TGeoBBox *trayBase = new TGeoBBox(kForwardTrayBaseHalfWide,
    7938           1 :                                     kForwardTrayThick/2, zlen);
    7939             : 
    7940             :   // The first part of the side wall: a Xtru
    7941           1 :   TGeoXtru *traySide1 = new TGeoXtru(2);
    7942             : 
    7943           1 :   xprof[0] = 0;
    7944           1 :   yprof[0] = kForwardTrayThick;
    7945           1 :   xprof[1] = kForwardTraySideLength-kForwardTrayTailLength;
    7946           1 :   yprof[1] = yprof[0];
    7947           1 :   xprof[2] = kForwardTraySideLength;
    7948           1 :   yprof[2] = kForwardTraySide1Height + kForwardTrayThick;
    7949           1 :   xprof[3] = 0;
    7950           1 :   yprof[3] = yprof[2];
    7951             : 
    7952           1 :   traySide1->DefinePolygon(4, xprof, yprof);
    7953           1 :   traySide1->DefineSection(0, 0);
    7954           1 :   traySide1->DefineSection(1, kForwardTrayThick);
    7955             : 
    7956             :   // The second part of the side wall: a Xtru
    7957           1 :   TGeoXtru *traySide2 = new TGeoXtru(2);
    7958             : 
    7959           1 :   xprof[0] = kForwardTrayBaseHalfWide - kForwardTrayThick;
    7960           1 :   yprof[0] = traySide1->GetY(2);
    7961           1 :   xprof[1] = kForwardTrayBaseHalfWide;
    7962           1 :   yprof[1] = yprof[0];
    7963           1 :   xprof[2] = xprof[1] + kForwardTraySide2Expand;
    7964           1 :   yprof[2] = yprof[1] + kForwardTraySide2Height;
    7965           1 :   xprof[3] = xprof[2] - kForwardTrayThick;
    7966           1 :   yprof[3] = yprof[2];
    7967             : 
    7968           1 :   traySide2->DefinePolygon(4, xprof, yprof);
    7969           1 :   traySide2->DefineSection(0, 0);
    7970           1 :   traySide2->DefineSection(1, kForwardTraySideLength);
    7971             : 
    7972             :   // The third part of the side wall: a Xtru
    7973           1 :   TGeoXtru *traySide3 = new TGeoXtru(2);
    7974             : 
    7975           1 :   xprof[0] = 0;
    7976           1 :   yprof[0] = traySide2->GetY(2);
    7977           1 :   xprof[1] = kForwardTraySideLength;
    7978           1 :   yprof[1] = yprof[0];
    7979           1 :   xprof[2] = xprof[1];
    7980           1 :   yprof[2] = yprof[1] + kForwardTraySide3TailHi - kForwardTrayThick;
    7981           1 :   xprof[3] = xprof[2] - kForwardTraySide3TailLen - kForwardTrayThick;
    7982           1 :   yprof[3] = yprof[2];
    7983           1 :   xprof[4] = xprof[3];
    7984           1 :   yprof[4] = yprof[3] + kForwardTraySide3HeadHi + kForwardTrayThick;
    7985           1 :   xprof[5] = xprof[4] - kForwardTraySide3HeadLen;
    7986           1 :   yprof[5] = yprof[4];
    7987           1 :   xprof[6] = xprof[5];
    7988           1 :   yprof[6] = yprof[5] - kForwardTrayNotchHeight;
    7989           1 :   xprof[7] = xprof[6] + kForwardTrayNotchLength;
    7990           1 :   yprof[7] = yprof[6];
    7991           1 :   xprof[8] = xprof[7];
    7992           1 :   yprof[8] = yprof[7] - kForwardTrayNotchDown;
    7993             : 
    7994           1 :   traySide3->DefinePolygon(9, xprof, yprof);
    7995           1 :   traySide3->DefineSection(0, 0);
    7996           1 :   traySide3->DefineSection(1, kForwardTrayThick);
    7997             : 
    7998             :   // The horizontal wing: a BBox
    7999           2 :   TGeoBBox *trayHorWing = new TGeoBBox(kForwardTrayHorWingWide/2,
    8000             :                                        kForwardTrayThick/2,
    8001           1 :                                        kForwardTraySide3TailLen/2);
    8002             : 
    8003             :   // The vertical wing: a BBox
    8004           1 :   ylen = (traySide3->GetY(4) - traySide3->GetY(3))/2;
    8005           1 :   TGeoBBox *trayVertWing = new TGeoBBox(kForwardTrayVertWingWide/2,
    8006             :                                         ylen, kForwardTrayThick/2);
    8007             : 
    8008             : 
    8009             :   // We have all shapes: now create the real volumes
    8010           1 :   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
    8011             : 
    8012           2 :   TGeoVolume *forwTrayBase = new TGeoVolume("ITSsuppSDDSideAForwTrayBase",
    8013           1 :                                             trayBase, medAl);
    8014             : 
    8015           1 :   forwTrayBase->SetVisibility(kTRUE);
    8016           1 :   forwTrayBase->SetLineColor(6); // Purple
    8017           1 :   forwTrayBase->SetLineWidth(1);
    8018           1 :   forwTrayBase->SetFillColor(forwTrayBase->GetLineColor());
    8019           1 :   forwTrayBase->SetFillStyle(4000); // 0% transparent
    8020             : 
    8021           2 :   TGeoVolume *forwTraySide1 = new TGeoVolume("ITSsuppSDDSideAForwTraySide1",
    8022           1 :                                             traySide1, medAl);
    8023             : 
    8024           1 :   forwTraySide1->SetVisibility(kTRUE);
    8025           1 :   forwTraySide1->SetLineColor(6); // Purple
    8026           1 :   forwTraySide1->SetLineWidth(1);
    8027           1 :   forwTraySide1->SetFillColor(forwTraySide1->GetLineColor());
    8028           1 :   forwTraySide1->SetFillStyle(4000); // 0% transparent
    8029             : 
    8030           2 :   TGeoVolume *forwTraySide2 = new TGeoVolume("ITSsuppSDDSideAForwTraySide2",
    8031           1 :                                             traySide2, medAl);
    8032             : 
    8033           1 :   forwTraySide2->SetVisibility(kTRUE);
    8034           1 :   forwTraySide2->SetLineColor(6); // Purple
    8035           1 :   forwTraySide2->SetLineWidth(1);
    8036           1 :   forwTraySide2->SetFillColor(forwTraySide2->GetLineColor());
    8037           1 :   forwTraySide2->SetFillStyle(4000); // 0% transparent
    8038             : 
    8039           2 :   TGeoVolume *forwTraySide3 = new TGeoVolume("ITSsuppSDDSideAForwTraySide3",
    8040           1 :                                             traySide3, medAl);
    8041             : 
    8042           1 :   forwTraySide3->SetVisibility(kTRUE);
    8043           1 :   forwTraySide3->SetLineColor(6); // Purple
    8044           1 :   forwTraySide3->SetLineWidth(1);
    8045           1 :   forwTraySide3->SetFillColor(forwTraySide3->GetLineColor());
    8046           1 :   forwTraySide3->SetFillStyle(4000); // 0% transparent
    8047             : 
    8048           2 :   TGeoVolume *forwTrayHWing = new TGeoVolume("ITSsuppSDDSideAForwTrayHorWing",
    8049           1 :                                             trayHorWing, medAl);
    8050             : 
    8051           1 :   forwTrayHWing->SetVisibility(kTRUE);
    8052           1 :   forwTrayHWing->SetLineColor(6); // Purple
    8053           1 :   forwTrayHWing->SetLineWidth(1);
    8054           1 :   forwTrayHWing->SetFillColor(forwTrayHWing->GetLineColor());
    8055           1 :   forwTrayHWing->SetFillStyle(4000); // 0% transparent
    8056             : 
    8057           2 :   TGeoVolume *forwTrayVWing = new TGeoVolume("ITSsuppSDDSideAForwTrayVertWing",
    8058           1 :                                             trayVertWing, medAl);
    8059             : 
    8060           1 :   forwTrayVWing->SetVisibility(kTRUE);
    8061           1 :   forwTrayVWing->SetLineColor(6); // Purple
    8062           1 :   forwTrayVWing->SetLineWidth(1);
    8063           1 :   forwTrayVWing->SetFillColor(forwTrayVWing->GetLineColor());
    8064           1 :   forwTrayVWing->SetFillStyle(4000); // 0% transparent
    8065             : 
    8066             : 
    8067             :   // Now build up the tray
    8068             :   yloc = kForwardTrayThick/2;
    8069             :   zloc = zlen;
    8070           2 :   tray->AddNode(forwTrayBase, 1,
    8071           2 :                 new TGeoTranslation(0, yloc, zloc) );
    8072             : 
    8073             :   xloc = kForwardTrayBaseHalfWide;
    8074           2 :   tray->AddNode(forwTraySide1, 1,
    8075           3 :                 new TGeoCombiTrans(xloc, 0, 0,
    8076           2 :                                    new TGeoRotation("",90,-90,-90)));
    8077           1 :   xloc = -xloc + kForwardTrayThick;
    8078           2 :   tray->AddNode(forwTraySide1, 2,
    8079           3 :                 new TGeoCombiTrans(xloc, 0, 0,
    8080           2 :                                    new TGeoRotation("",90,-90,-90)));
    8081             : 
    8082           1 :   tray->AddNode(forwTraySide2, 1, 0);
    8083             :   zloc = kForwardTraySideLength;
    8084           2 :   tray->AddNode(forwTraySide2, 2,
    8085           3 :                 new TGeoCombiTrans(0, 0, zloc,
    8086           2 :                                    new TGeoRotation("",90,-180,-90)));
    8087             : 
    8088           1 :   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand;
    8089           2 :   tray->AddNode(forwTraySide3, 1,
    8090           3 :                 new TGeoCombiTrans(xloc, 0, 0,
    8091           2 :                                    new TGeoRotation("",90,-90,-90)));
    8092           1 :   xloc = -xloc + kForwardTrayThick;
    8093           2 :   tray->AddNode(forwTraySide3, 2,
    8094           3 :                 new TGeoCombiTrans(xloc, 0, 0,
    8095           2 :                                    new TGeoRotation("",90,-90,-90)));
    8096             : 
    8097             :   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand
    8098           1 :        - kForwardTrayHorWingWide/2;
    8099           1 :   yloc = traySide3->GetY(2) + kForwardTrayThick/2;
    8100           1 :   zloc = kForwardTraySideLength - trayHorWing->GetDZ();
    8101           2 :   tray->AddNode(forwTrayHWing, 1,
    8102           2 :                 new TGeoTranslation( xloc, yloc, zloc) );
    8103           2 :   tray->AddNode(forwTrayHWing, 2,
    8104           2 :                 new TGeoTranslation(-xloc, yloc, zloc) );
    8105             : 
    8106             :   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand
    8107           1 :        - kForwardTrayVertWingWide/2;
    8108           1 :   yloc = traySide3->GetY(2) + trayVertWing->GetDY();
    8109           1 :   zloc = traySide3->GetX(3) + kForwardTrayThick/2;
    8110           2 :   tray->AddNode(forwTrayVWing, 1,
    8111           2 :                 new TGeoTranslation( xloc, yloc, zloc) );
    8112           2 :   tray->AddNode(forwTrayVWing, 2,
    8113           2 :                 new TGeoTranslation(-xloc, yloc, zloc) );
    8114             : 
    8115             : 
    8116             :   return;
    8117           1 : }
    8118             : 
    8119             : //______________________________________________________________________
    8120             : TGeoCompositeShape* AliITSv11GeometrySupport::CreateTrayAForwardCover(const Double_t coverLen){
    8121             : //
    8122             : // Creates the forward cover of the SDD and SSD cable trays on Side A
    8123             : // (0872/G/D/02)
    8124             : //
    8125             : // Input:
    8126             : //             coverLen: the total length of the cover
    8127             : //
    8128             : // Output:
    8129             : //
    8130             : // Return:     a TGeoCompositeShape for the cover
    8131             : //
    8132             : // Created:      03 Jan 2010  Mario Sitta
    8133             : //
    8134             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    8135             : // drawings and other (oral) information given by F.Tosello
    8136             : //
    8137             : 
    8138             :   // Dimensions and positions of the A-Side Cable Tray Forward Cover
    8139             :   // (0872/G/D/02)
    8140           2 :   const Double_t kForwardCoverWide        =  130.00 *fgkmm;
    8141           1 :   const Double_t kForwardCoverSideWide    =   10.00 *fgkmm;
    8142           1 :   const Double_t kForwardCoverHoleLen     =  160.00 *fgkmm;
    8143           1 :   const Double_t kForwardCoverHoleWide    =   90.00 *fgkmm;
    8144             :   const Double_t kForwardCoverHoleR10     =   10.00 *fgkmm;
    8145           1 :   const Double_t kForwardCoverTotalThick  =    5.00 *fgkmm;
    8146           1 :   const Double_t kForwardCoverSideThick   =    3.00 *fgkmm;
    8147           1 :   const Double_t kForwardCoverInternThick =    2.00 *fgkmm;
    8148             : 
    8149           1 :   const Double_t kForwardCoverHoleZTrans  =   40.00 *fgkmm;
    8150             : 
    8151             : 
    8152             :   // Local variables
    8153           1 :   Double_t xprof[16], yprof[16];
    8154             :   Double_t yloc, zloc;
    8155             : 
    8156             : 
    8157             :   // The main shape: a Xtru
    8158           1 :   TGeoXtru *forwCoverMain = new TGeoXtru(2);
    8159           1 :   forwCoverMain->SetName("ITSsuppForwCoverMain");
    8160             : 
    8161           1 :   xprof[0] = kForwardCoverWide/2;
    8162           1 :   yprof[0] = kForwardCoverTotalThick;
    8163           1 :   xprof[1] = xprof[0];
    8164           1 :   yprof[1] = yprof[0] - kForwardCoverSideThick;
    8165           1 :   xprof[2] = xprof[1] - kForwardCoverSideWide;
    8166           1 :   yprof[2] = yprof[1];
    8167           1 :   xprof[3] = xprof[2];
    8168           1 :   yprof[3] = 0;
    8169             : 
    8170             :   // We did the right side, now reflex on the left side
    8171          10 :   for (Int_t jp = 0; jp < 4; jp++) {
    8172           4 :     xprof[4+jp] = -xprof[3-jp];
    8173           4 :     yprof[4+jp] =  yprof[3-jp];
    8174             :   }
    8175             : 
    8176             :   // And now the actual Xtru
    8177           1 :   forwCoverMain->DefinePolygon(8, xprof, yprof);
    8178           1 :   forwCoverMain->DefineSection(0, 0);
    8179           1 :   forwCoverMain->DefineSection(1, coverLen);
    8180             : 
    8181             :   // The hole: another Xtru (rounded corners approximated with segments)
    8182           1 :   TGeoXtru *forwCoverHole = new TGeoXtru(2);
    8183           1 :   forwCoverHole->SetName("ITSsuppForwCoverHole");
    8184             : 
    8185           1 :   CreateTrayACoverHolesShape(kForwardCoverHoleWide, kForwardCoverHoleLen,
    8186             :                              kForwardCoverHoleR10 , xprof, yprof);
    8187             : 
    8188             :   // And now the actual Xtru
    8189           1 :   forwCoverHole->DefinePolygon(16, xprof, yprof);
    8190           1 :   forwCoverHole->DefineSection(0, 0);
    8191           1 :   forwCoverHole->DefineSection(1, kForwardCoverTotalThick-kForwardCoverInternThick);
    8192             : 
    8193             :   // Now the proper rototranslation matrices for the two holes
    8194           1 :   yloc = kForwardCoverTotalThick-kForwardCoverInternThick-0.01;//Precision fix
    8195             :   zloc = kForwardCoverHoleZTrans;
    8196           2 :   TGeoCombiTrans *mf1 = new TGeoCombiTrans(0, yloc, zloc,
    8197           2 :                                            new TGeoRotation("", 0, 90, 0) );
    8198           1 :   mf1->SetName("mf1");
    8199           1 :   mf1->RegisterYourself();
    8200             : 
    8201           1 :   zloc = coverLen - kForwardCoverHoleZTrans - kForwardCoverHoleLen;
    8202           2 :   TGeoCombiTrans *mf2 = new TGeoCombiTrans(0, yloc, zloc,
    8203           2 :                                            new TGeoRotation("", 0, 90, 0) );
    8204           1 :   mf2->SetName("mf2");
    8205           1 :   mf2->RegisterYourself();
    8206             : 
    8207             :   // Finally the actual cover shape
    8208           1 :   TGeoCompositeShape *cover = new TGeoCompositeShape("ITSsuppForwardCoverMain",
    8209             :     "ITSsuppForwCoverMain-ITSsuppForwCoverHole:mf1-ITSsuppForwCoverHole:mf2");
    8210             : 
    8211           1 :   return cover;
    8212           1 : }
    8213             : 
    8214             : //______________________________________________________________________
    8215             : TGeoCompositeShape* AliITSv11GeometrySupport::CreateTrayAExternalCover(const Double_t coverLen){
    8216             : //
    8217             : // Creates the external cover of the SDD and SSD cable trays on Side A
    8218             : // (0872/G/D/04)
    8219             : //
    8220             : // Input:
    8221             : //             coverLen: the total length of the cover
    8222             : //
    8223             : // Output:
    8224             : //
    8225             : // Return:     a TGeoCompositeShape for the cover
    8226             : //
    8227             : // Created:      03 Jan 2010  Mario Sitta
    8228             : //
    8229             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    8230             : // drawings and other (oral) information given by F.Tosello
    8231             : //
    8232             : 
    8233             :   // Dimensions and positions of the A-Side Cable Tray External Cover
    8234             :   // (0872/G/D/04)
    8235           4 :   const Double_t kExternalCoverWide        =  130.00 *fgkmm;
    8236           2 :   const Double_t kExternalCoverSideWide    =   10.00 *fgkmm;
    8237           2 :   const Double_t kExternalCoverHoleLen1    =  262.00 *fgkmm;
    8238           2 :   const Double_t kExternalCoverHoleLen2    =  280.00 *fgkmm;
    8239           2 :   const Double_t kExternalCoverHoleLen3    =  205.00 *fgkmm;
    8240           2 :   const Double_t kExternalCoverHoleLen4    =   55.00 *fgkmm;
    8241           2 :   const Double_t kExternalCoverHoleWide    =   90.00 *fgkmm;
    8242             :   const Double_t kExternalCoverHoleR10     =   10.00 *fgkmm;
    8243           2 :   const Double_t kExternalCoverTotalThick  =    5.00 *fgkmm;
    8244           2 :   const Double_t kExternalCoverSideThick   =    3.00 *fgkmm;
    8245           2 :   const Double_t kExternalCoverInternThick =    2.00 *fgkmm;
    8246             : 
    8247           2 :   const Double_t kExternalCoverHole1ZTrans =   28.00 *fgkmm;
    8248           2 :   const Double_t kExternalCoverHolesZTrans =   20.00 *fgkmm;
    8249             : 
    8250             : 
    8251             :   // Local variables
    8252           2 :   Double_t xprof[16], yprof[16];
    8253             :   Double_t yloc, zloc;
    8254             : 
    8255             : 
    8256             :   // The main shape: a Xtru
    8257           2 :   TGeoXtru *externCoverMain = new TGeoXtru(2);
    8258           2 :   externCoverMain->SetName("ITSsuppExternCoverMain");
    8259             : 
    8260           2 :   xprof[0] = kExternalCoverWide/2;
    8261           2 :   yprof[0] = kExternalCoverTotalThick;
    8262           2 :   xprof[1] = xprof[0];
    8263           2 :   yprof[1] = yprof[0] - kExternalCoverSideThick;
    8264           2 :   xprof[2] = xprof[1] - kExternalCoverSideWide;
    8265           2 :   yprof[2] = yprof[1];
    8266           2 :   xprof[3] = xprof[2];
    8267           2 :   yprof[3] = 0;
    8268             : 
    8269             :   // We did the right side, now reflex on the left side
    8270          20 :   for (Int_t jp = 0; jp < 4; jp++) {
    8271           8 :     xprof[4+jp] = -xprof[3-jp];
    8272           8 :     yprof[4+jp] =  yprof[3-jp];
    8273             :   }
    8274             : 
    8275             :   // And now the actual Xtru
    8276           2 :   externCoverMain->DefinePolygon(8, xprof, yprof);
    8277           2 :   externCoverMain->DefineSection(0, 0);
    8278           2 :   externCoverMain->DefineSection(1, coverLen);
    8279             : 
    8280             :   // The first hole: a Xtru (rounded corners approximated with segments)
    8281           2 :   Double_t holethick = kExternalCoverTotalThick-kExternalCoverInternThick;
    8282             : 
    8283           2 :   TGeoXtru *extCoverHole1 = new TGeoXtru(2);
    8284           2 :   extCoverHole1->SetName("ITSsuppExtCoverHole1");
    8285             : 
    8286           2 :   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen1,
    8287             :                              kExternalCoverHoleR10 , xprof, yprof);
    8288             : 
    8289           2 :   extCoverHole1->DefinePolygon(16, xprof, yprof);
    8290           2 :   extCoverHole1->DefineSection(0, 0);
    8291           2 :   extCoverHole1->DefineSection(1, holethick);
    8292             : 
    8293             :   // The second (and third) hole: another Xtru
    8294           2 :   TGeoXtru *extCoverHole2 = new TGeoXtru(2);
    8295           2 :   extCoverHole2->SetName("ITSsuppExtCoverHole2");
    8296             : 
    8297           2 :   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen2,
    8298             :                              kExternalCoverHoleR10 , xprof, yprof);
    8299             : 
    8300           2 :   extCoverHole2->DefinePolygon(16, xprof, yprof);
    8301           2 :   extCoverHole2->DefineSection(0, 0);
    8302           2 :   extCoverHole2->DefineSection(1, holethick);
    8303             : 
    8304             :   // The fourth hole: another Xtru
    8305           2 :   TGeoXtru *extCoverHole3 = new TGeoXtru(2);
    8306           2 :   extCoverHole3->SetName("ITSsuppExtCoverHole3");
    8307             : 
    8308           2 :   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen3,
    8309             :                              kExternalCoverHoleR10 , xprof, yprof);
    8310             : 
    8311           2 :   extCoverHole3->DefinePolygon(16, xprof, yprof);
    8312           2 :   extCoverHole3->DefineSection(0, 0);
    8313           2 :   extCoverHole3->DefineSection(1, holethick);
    8314             : 
    8315             :   // The fifth and last hole: another Xtru
    8316           2 :   TGeoXtru *extCoverHole4 = new TGeoXtru(2);
    8317           2 :   extCoverHole4->SetName("ITSsuppExtCoverHole4");
    8318             : 
    8319           2 :   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen4,
    8320             :                              kExternalCoverHoleR10 , xprof, yprof);
    8321             : 
    8322           2 :   extCoverHole4->DefinePolygon(16, xprof, yprof);
    8323           2 :   extCoverHole4->DefineSection(0, 0);
    8324           2 :   extCoverHole4->DefineSection(1, holethick);
    8325             : 
    8326             :   // Now the proper rototranslation matrices for the holes
    8327           2 :   yloc = kExternalCoverTotalThick - kExternalCoverInternThick-0.01;
    8328             :   zloc = kExternalCoverHole1ZTrans;
    8329           4 :   TGeoCombiTrans *me1 = new TGeoCombiTrans(0, yloc, zloc,
    8330           4 :                                            new TGeoRotation("", 0, 90, 0) );
    8331           2 :   me1->SetName("me1");
    8332           2 :   me1->RegisterYourself();
    8333             : 
    8334           2 :   zloc += (kExternalCoverHoleLen1 + kExternalCoverHolesZTrans);
    8335           4 :   TGeoCombiTrans *me2 = new TGeoCombiTrans(0, yloc, zloc,
    8336           4 :                                            new TGeoRotation("", 0, 90, 0) );
    8337           2 :   me2->SetName("me2");
    8338           2 :   me2->RegisterYourself();
    8339             : 
    8340           2 :   zloc += (kExternalCoverHoleLen2 + kExternalCoverHolesZTrans);
    8341           4 :   TGeoCombiTrans *me3 = new TGeoCombiTrans(0, yloc, zloc,
    8342           4 :                                            new TGeoRotation("", 0, 90, 0) );
    8343           2 :   me3->SetName("me3");
    8344           2 :   me3->RegisterYourself();
    8345             : 
    8346           2 :   zloc += (kExternalCoverHoleLen2 + kExternalCoverHolesZTrans);
    8347           4 :   TGeoCombiTrans *me4 = new TGeoCombiTrans(0, yloc, zloc,
    8348           4 :                                            new TGeoRotation("", 0, 90, 0) );
    8349           2 :   me4->SetName("me4");
    8350           2 :   me4->RegisterYourself();
    8351             : 
    8352           2 :   zloc += (kExternalCoverHoleLen3 + kExternalCoverHolesZTrans);
    8353           4 :   TGeoCombiTrans *me5 = new TGeoCombiTrans(0, yloc, zloc,
    8354           4 :                                            new TGeoRotation("", 0, 90, 0) );
    8355           2 :   me5->SetName("me5");
    8356           2 :   me5->RegisterYourself();
    8357             : 
    8358             :   // Finally the actual cover shape
    8359           2 :   TGeoCompositeShape *cover = new TGeoCompositeShape("ITSsuppExternCoverMain",
    8360             :     "ITSsuppExternCoverMain-ITSsuppExtCoverHole1:me1-ITSsuppExtCoverHole2:me2-ITSsuppExtCoverHole2:me3-ITSsuppExtCoverHole3:me4-ITSsuppExtCoverHole4:me5");
    8361             : 
    8362           2 :   return cover;
    8363           2 : }
    8364             : 
    8365             : //______________________________________________________________________
    8366             : void AliITSv11GeometrySupport::CreateTrayACoverHolesShape(const Double_t wide,
    8367             :                                const Double_t length, const Double_t r10,
    8368             :                                Double_t *x, Double_t *y){
    8369             : //
    8370             : // Creates the proper sequence of X and Y coordinates to determine
    8371             : // the base XTru polygon for the holes in the SDD and SSD tray covers
    8372             : // (here the rounded corners are approximated with segments)
    8373             : //
    8374             : // Input:
    8375             : //        wide   : the hole wide
    8376             : //        length : the hole length
    8377             : //        r10    : the radius of the rounded corners
    8378             : //
    8379             : // Output:
    8380             : //        x, y : coordinate vectors [16]
    8381             : //
    8382             : // Created:      03 Jan 2010  Mario Sitta
    8383             : //
    8384             : // Caller must guarantee that x and y have the correct dimensions
    8385             : // (but being this a private method it's easy to tell)
    8386             : //
    8387             : 
    8388          18 :   x[0] = wide/2 - r10;
    8389           9 :   y[0] = length;
    8390           9 :   x[1] = x[0] + r10*SinD(30);
    8391           9 :   y[1] = y[0] - r10*(1 - CosD(30));
    8392           9 :   x[2] = x[0] + r10*SinD(60);
    8393           9 :   y[2] = y[0] - r10*(1 - CosD(60));
    8394           9 :   x[3] = x[0] + r10;
    8395           9 :   y[3] = y[0] - r10;
    8396           9 :   x[4] = x[3];
    8397           9 :   y[4] = r10;
    8398           9 :   x[5] = x[4] - r10*(1 - CosD(30));
    8399           9 :   y[5] = y[4] - r10*SinD(30);
    8400           9 :   x[6] = x[4] - r10*(1 - CosD(60));
    8401           9 :   y[6] = y[4] - r10*SinD(60);
    8402           9 :   x[7] = x[4] - r10;
    8403           9 :   y[7] = 0;
    8404             : 
    8405             :   // We did the right side, now reflex on the left side
    8406         162 :   for (Int_t jp = 0; jp < 8; jp++) {
    8407          72 :     x[8+jp] = -x[7-jp];
    8408          72 :     y[8+jp] =  y[7-jp];
    8409             :   }
    8410             : 
    8411           9 :   return;
    8412             : }
    8413             : 
    8414             : //______________________________________________________________________
    8415             : TGeoXtru* AliITSv11GeometrySupport::CreateSDDSSDTraysSideA(
    8416             :                                               const Double_t trayLen,
    8417             :                                               const Double_t trayHi){
    8418             : //
    8419             : // Creates parts of the SDD and SSD Trays on Side A which are identical
    8420             : // (0872/G/D/03, part of 0872/G/D/07, 0872/G/C/11)
    8421             : //
    8422             : // Input:
    8423             : //         trayLen : the length of the tray part
    8424             : //         trayHi  : the height of the tray part
    8425             : //
    8426             : // Output:
    8427             : //
    8428             : // Return:     a TGeoXtru
    8429             : //
    8430             : // Created:      26 Feb 2010  Mario Sitta
    8431             : //
    8432             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    8433             : // drawings and other (oral) information given by F.Tosello
    8434             : //
    8435             : 
    8436             :   // Dimensions and positions of the A-Side Cable Trays
    8437             :   // (parts of 0872/G/C)
    8438           6 :   const Double_t kTrayWidth              =  130.00 *fgkmm;
    8439           3 :   const Double_t kTrayWingWidth          =   10.00 *fgkmm;
    8440           3 :   const Double_t kTrayHeightToBend       =   20.00 *fgkmm;
    8441           3 :   const Double_t kTrayThick              =    2.00 *fgkmm;
    8442             : 
    8443           3 :   const Double_t kTrayBendAngle          =   22.00 *TMath::DegToRad();
    8444             : 
    8445             :   const Int_t    kTrayNpoints            =   16;
    8446             : 
    8447             :   // Local variables
    8448           3 :   Double_t xprof[kTrayNpoints], yprof[kTrayNpoints];
    8449             : 
    8450             : 
    8451             :   // The tray shape: a Xtru
    8452           3 :   TGeoXtru *trayPart = new TGeoXtru(2);
    8453             : 
    8454           3 :   xprof[2] = kTrayWidth/2 - kTrayThick;
    8455           3 :   yprof[2] = trayHi - kTrayThick;
    8456           3 :   xprof[3] = kTrayWidth/2 - kTrayWingWidth;
    8457           3 :   yprof[3] = yprof[2];
    8458           3 :   xprof[4] = xprof[3];
    8459           3 :   yprof[4] = trayHi;
    8460           3 :   xprof[5] = kTrayWidth/2;
    8461           3 :   yprof[5] = yprof[4];
    8462           3 :   xprof[6] = xprof[5];
    8463           3 :   yprof[6] = kTrayHeightToBend;
    8464           3 :   xprof[7] = xprof[6] - yprof[6]*TMath::Tan(kTrayBendAngle);
    8465           3 :   yprof[7] = 0;
    8466             : 
    8467           6 :   InsidePoint( xprof[5], yprof[5], xprof[6], yprof[6], xprof[7], yprof[7],
    8468           3 :               -kTrayThick, xprof[1], yprof[1]);
    8469             : 
    8470           3 :   xprof[8] = -xprof[7];
    8471           3 :   yprof[8] =  yprof[7];
    8472             : 
    8473           6 :   InsidePoint( xprof[6], yprof[6], xprof[7], yprof[7], xprof[8], yprof[8],
    8474           3 :               -kTrayThick, xprof[0], yprof[0]);
    8475             : 
    8476             :   // We did the right side, now reflex on the left side
    8477          54 :   for (Int_t jp = 0; jp < 8; jp++) {
    8478          24 :     xprof[8+jp] = -xprof[7-jp];
    8479          24 :     yprof[8+jp] =  yprof[7-jp];
    8480             :   }
    8481             : 
    8482             :   // And now the actual Xtru
    8483           3 :   trayPart->DefinePolygon(kTrayNpoints, xprof, yprof);
    8484           3 :   trayPart->DefineSection(0, 0);
    8485           3 :   trayPart->DefineSection(1, trayLen);
    8486             : 
    8487             : 
    8488           3 :   return trayPart;
    8489           3 : }
    8490             : 
    8491             : //______________________________________________________________________
    8492             : TGeoVolumeAssembly* AliITSv11GeometrySupport::CreateSDDSSDTraysSideC(
    8493             :                                                        const char *trayName,
    8494             :                                                        const TGeoManager *mgr){
    8495             : 
    8496             : //
    8497             : // Creates the SDD and SSD Trays on Side C which are supposedly identical
    8498             : //
    8499             : // Input:
    8500             : //         trayName : the assembly name
    8501             : //
    8502             : // Output:
    8503             : //
    8504             : // Return:     a TGeoVolumeAssembly
    8505             : //
    8506             : // Created:      16 Apr 2010  Mario Sitta
    8507             : //
    8508             : // Technical data are taken from AutoCAD drawings and other (oral)
    8509             : // information given by F.Tosello
    8510             : //
    8511             : 
    8512           4 :   const Double_t kSideCHalfThick      =    0.100   *fgkcm;
    8513           2 :   const Double_t kSideCFoldAngle      =    5.000   *TMath::DegToRad();
    8514             : 
    8515           2 :   const Double_t kSideCLength1        =  172.800   *fgkcm;
    8516           2 :   const Double_t kSideCLength2        =  189.300   *fgkcm;
    8517           2 :   const Double_t kSideCHalfWide       =    6.350   *fgkcm;
    8518           2 :   const Double_t kSideCHeight1        =   11.800   *fgkcm;
    8519           2 :   const Double_t kSideCHeight2        =    4.300   *fgkcm;
    8520           2 :   const Double_t kSideCSideLength1    =   10.800   *fgkcm;
    8521           2 :   const Double_t kSideCSideLength2    =   63.800   *fgkcm;
    8522           2 :   const Double_t kSideCSideHeight     =    8.800   *fgkcm;
    8523             :   const Int_t    kNPointsLowerFace    =    6;
    8524             :   const Int_t    kNPointsLateralFace  =    9;
    8525             : 
    8526           2 :   const Double_t kSideCWingAHalfLen   =    5.000   *fgkcm;
    8527           2 :   const Double_t kSideCWingBHalfLen   =   30.500   *fgkcm;
    8528           2 :   const Double_t kSideCWingCHalfLen   =    2.000   *fgkcm;
    8529           2 :   const Double_t kSideCWingDHalfLen   =   48.500   *fgkcm;
    8530           2 :   const Double_t kSideCWingEHalfLen   =   83.000   *fgkcm;
    8531           2 :   const Double_t kSideCWingsHalfWide  =    0.450   *fgkcm;
    8532             : 
    8533             :   const Int_t    kNPointsCoverFace    =   12;
    8534             : 
    8535           2 :   const Double_t kPlateHalfLen        =    6.000   *fgkcm;
    8536           2 :   const Double_t kPlateThick          =    0.600   *fgkcm;
    8537           2 :   const Double_t kPlateHeight         =    4.200   *fgkcm;
    8538             :   const Int_t    kNPointsPlate        =    6;
    8539             : 
    8540           2 :   const Double_t kBarCoolRmax         =    0.4     *fgkcm;
    8541             :   const Int_t    kNumBarCool          =    2;
    8542             :   const Double_t kXShiftBarCool[kNumBarCool] = { 8.7, 13.0 };
    8543             :   const Double_t kYShiftBarCool[kNumBarCool] = { 8.5,  5.0 };
    8544             : 
    8545             : 
    8546             :   // Local variables
    8547           2 :   Double_t xprof[12], yprof[12];
    8548             :   Double_t xloc, yloc, zloc, delta, alpharot;
    8549             : 
    8550             :   // The single C-Side Cable tray as an assembly
    8551           2 :   TGeoVolumeAssembly *cableTrayC = new TGeoVolumeAssembly(trayName);
    8552             : 
    8553             :   // First create all needed shapes
    8554             : 
    8555             :   // The Cable Tray lower face: a Xtru
    8556           2 :   TGeoXtru *sideCLowerFace = new TGeoXtru(2);
    8557             : 
    8558           2 :   xprof[0] = 0.;
    8559           2 :   yprof[0] = 0.;
    8560           2 :   xprof[1] = kSideCLength1;
    8561           2 :   yprof[1] = 0.;
    8562           2 :   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(kSideCFoldAngle);
    8563           2 :   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(kSideCFoldAngle);
    8564           2 :   xprof[3] = xprof[2] - 2*kSideCHalfThick*TMath::Sin(kSideCFoldAngle);
    8565           2 :   yprof[3] = yprof[2] + 2*kSideCHalfThick*TMath::Cos(kSideCFoldAngle);
    8566           4 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    8567           2 :               2*kSideCHalfThick , xprof[4], yprof[4]);
    8568           2 :   xprof[5] = 0.;
    8569           2 :   yprof[5] = 2*kSideCHalfThick;
    8570             : 
    8571           2 :   sideCLowerFace->DefinePolygon(kNPointsLowerFace, xprof, yprof);
    8572           2 :   sideCLowerFace->DefineSection(0,-kSideCHalfWide);
    8573           2 :   sideCLowerFace->DefineSection(1, kSideCHalfWide);
    8574             : 
    8575             :   // The Cable Tray lateral face: a Xtru
    8576           2 :   TGeoXtru *sideCLateralFace = new TGeoXtru(2);
    8577             : 
    8578           2 :   xprof[0] = 0.;
    8579           2 :   yprof[0] = 0.;
    8580           2 :   xprof[1] = kSideCLength1;
    8581           2 :   yprof[1] = 0.;
    8582           2 :   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(kSideCFoldAngle);
    8583           2 :   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(kSideCFoldAngle);
    8584           2 :   xprof[3] = xprof[2] - kSideCHeight2*TMath::Sin(kSideCFoldAngle);
    8585           2 :   yprof[3] = yprof[2] + kSideCHeight2*TMath::Cos(kSideCFoldAngle);
    8586           2 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    8587             :               kSideCHeight2, xprof[4], yprof[4]);
    8588           2 :   xprof[5] = kSideCSideLength1 + kSideCSideLength2;
    8589           2 :   yprof[5] = kSideCHeight2;
    8590           2 :   xprof[6] = xprof[5];
    8591           2 :   yprof[6] = kSideCSideHeight;
    8592           2 :   xprof[7] = kSideCSideLength1;
    8593           2 :   yprof[7] = kSideCHeight1;
    8594           2 :   xprof[8] = 0;
    8595           2 :   yprof[8] = yprof[7];
    8596             : 
    8597           2 :   sideCLateralFace->DefinePolygon(kNPointsLateralFace, xprof, yprof);
    8598           2 :   sideCLateralFace->DefineSection(0,-kSideCHalfThick);
    8599           2 :   sideCLateralFace->DefineSection(1, kSideCHalfThick);
    8600             : 
    8601             :   // The lateral wings: four BBox's
    8602           2 :   TGeoBBox *sideCLateralWingA = new TGeoBBox(kSideCWingAHalfLen,
    8603             :                                              kSideCHalfThick,
    8604             :                                              kSideCWingsHalfWide);
    8605             : 
    8606           2 :   TGeoBBox *sideCLateralWingB = new TGeoBBox(kSideCWingBHalfLen,
    8607             :                                              kSideCHalfThick,
    8608             :                                              kSideCWingsHalfWide);
    8609             : 
    8610           2 :   TGeoBBox *sideCLateralWingC = new TGeoBBox(kSideCHalfThick,    // With these
    8611             :                                              kSideCWingCHalfLen, // X,Y avoid
    8612             :                                              kSideCWingsHalfWide);//rotations
    8613             : 
    8614           2 :   TGeoBBox *sideCLateralWingD = new TGeoBBox(kSideCWingDHalfLen,
    8615             :                                              kSideCHalfThick,
    8616             :                                              kSideCWingsHalfWide);
    8617             : 
    8618           2 :   TGeoBBox *sideCLateralWingE = new TGeoBBox(kSideCWingEHalfLen,
    8619             :                                              kSideCHalfThick,
    8620             :                                              kSideCWingsHalfWide);
    8621             : 
    8622             :   // The connecting lower plate: a Xtru
    8623           2 :   TGeoXtru *sideCLowerPlate =  new TGeoXtru(2);
    8624             : 
    8625           2 :   xprof[0] = 0.;
    8626           2 :   yprof[0] = 0.;
    8627           2 :   xprof[1] = kPlateHalfLen;
    8628           2 :   yprof[1] = 0.;
    8629           2 :   xprof[2] = xprof[1] + kPlateHalfLen*TMath::Cos(kSideCFoldAngle);
    8630           2 :   yprof[2] = kPlateHalfLen*TMath::Sin(kSideCFoldAngle);
    8631           2 :   xprof[3] = xprof[2] - kPlateThick*TMath::Sin(kSideCFoldAngle);
    8632           2 :   yprof[3] = yprof[2] + kPlateThick*TMath::Cos(kSideCFoldAngle);
    8633           2 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    8634             :               kPlateThick, xprof[4], yprof[4]);
    8635           2 :   xprof[5] = 0.;
    8636           2 :   yprof[5] = kPlateThick;
    8637             : 
    8638           2 :   sideCLowerPlate->DefinePolygon(kNPointsPlate, xprof, yprof);
    8639           2 :   Double_t zwide = kSideCHalfWide + 2*kSideCHalfThick;
    8640           2 :   sideCLowerPlate->DefineSection(0,-zwide);
    8641           2 :   sideCLowerPlate->DefineSection(1, zwide);
    8642             : 
    8643             :   // The connecting side plate: a Xtru
    8644           2 :   TGeoXtru *sideCLateralPlate = new TGeoXtru(2);
    8645             : 
    8646           2 :   xprof[0] = 0.;
    8647           2 :   yprof[0] = 0.;
    8648           2 :   xprof[1] = kPlateHalfLen;
    8649           2 :   yprof[1] = 0.;
    8650           2 :   xprof[2] = xprof[1] + kPlateHalfLen*TMath::Cos(kSideCFoldAngle);
    8651           2 :   yprof[2] = kPlateHalfLen*TMath::Sin(kSideCFoldAngle);
    8652           2 :   xprof[3] = xprof[2] - kPlateHeight*TMath::Sin(kSideCFoldAngle);
    8653           2 :   yprof[3] = yprof[2] + kPlateHeight*TMath::Cos(kSideCFoldAngle);
    8654           2 :   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
    8655             :               kPlateHeight, xprof[4], yprof[4]); // Avoid small overlap
    8656           2 :   xprof[5] = 0.;
    8657           2 :   yprof[5] = kPlateHeight;
    8658             : 
    8659           2 :   sideCLateralPlate->DefinePolygon(kNPointsPlate, xprof, yprof);
    8660           2 :   sideCLateralPlate->DefineSection(0,-kPlateThick/2);
    8661           2 :   sideCLateralPlate->DefineSection(1, kPlateThick/2);
    8662             : 
    8663             :   // The bar fixing the cooling tubes: a Tube
    8664           2 :   TGeoTube *coolBar = new TGeoTube(0., kBarCoolRmax, kSideCHalfWide);
    8665             : 
    8666             :   // The Cable Tray cover: a (complex) Xtru
    8667           2 :   TGeoXtru *sideCCoverFace = new TGeoXtru(2);
    8668             : 
    8669           2 :   xprof[ 0] = sideCLateralFace->GetX(8);
    8670           2 :   yprof[ 0] = sideCLateralFace->GetY(8);
    8671           2 :   xprof[ 1] = sideCLateralFace->GetX(7);
    8672           2 :   yprof[ 1] = sideCLateralFace->GetY(7);
    8673           2 :   xprof[ 2] = sideCLateralFace->GetX(6);
    8674           2 :   yprof[ 2] = sideCLateralFace->GetY(6);
    8675           2 :   xprof[ 3] = sideCLateralFace->GetX(5);
    8676           2 :   yprof[ 3] = sideCLateralFace->GetY(5);
    8677           2 :   xprof[ 4] = sideCLateralFace->GetX(4);
    8678           2 :   yprof[ 4] = sideCLateralFace->GetY(4);
    8679             : 
    8680           2 :   xloc = (kSideCLength1 + (kSideCSideLength1+kSideCSideLength2))/2;
    8681           2 :   delta  = kSideCLength1 - (xloc + kSideCWingDHalfLen);
    8682           4 :   xprof[ 5] = xprof[4]
    8683           2 :             + (delta + 2*kSideCWingEHalfLen)*TMath::Cos(kSideCFoldAngle);
    8684           4 :   yprof[ 5] = yprof[4]
    8685           2 :             + (delta + 2*kSideCWingEHalfLen)*TMath::Sin(kSideCFoldAngle);
    8686             : 
    8687           2 :   xprof[ 6] = xprof[5] - 2*kSideCHalfThick*TMath::Sin(kSideCFoldAngle);
    8688           2 :   yprof[ 6] = yprof[5] + 2*kSideCHalfThick*TMath::Cos(kSideCFoldAngle);
    8689           2 :   InsidePoint(xprof[3], yprof[3], xprof[4], yprof[4], xprof[5], yprof[5],
    8690             :               2*kSideCHalfThick, xprof[7], yprof[7]);
    8691           2 :   InsidePoint(xprof[2], yprof[2], xprof[3], yprof[3], xprof[4], yprof[4],
    8692             :               2*kSideCHalfThick, xprof[8], yprof[8]);
    8693           2 :   xprof[ 9] = xprof[2] + 2*kSideCHalfThick;
    8694           2 :   yprof[ 9] = yprof[2] + 2*kSideCHalfThick;
    8695           2 :   xprof[10] = xprof[1];
    8696           2 :   yprof[10] = yprof[1] + 2*kSideCHalfThick;
    8697           2 :   xprof[11] = xprof[0];
    8698           2 :   yprof[11] = yprof[0] + 2*kSideCHalfThick;
    8699             : 
    8700           2 :   sideCCoverFace->DefinePolygon(kNPointsCoverFace, xprof, yprof);
    8701           2 :   zloc = kSideCHalfWide + 2*kSideCHalfThick + 2*kSideCWingsHalfWide;
    8702           2 :   sideCCoverFace->DefineSection(0,-zloc);
    8703           2 :   sideCCoverFace->DefineSection(1, zloc);
    8704             : 
    8705             : 
    8706             :   // We have all shapes: now create the real volumes
    8707           2 :   TGeoMedium *medAl      = mgr->GetMedium("ITS_ALUMINUM$");
    8708             : 
    8709           4 :   TGeoVolume *traySideCLowerFace  = new TGeoVolume("ITSsuppTraySideCLower",
    8710           2 :                                                    sideCLowerFace, medAl);
    8711             : 
    8712           2 :   traySideCLowerFace->SetVisibility(kTRUE);
    8713           2 :   traySideCLowerFace->SetLineColor(6); // Purple
    8714           2 :   traySideCLowerFace->SetLineWidth(1);
    8715           2 :   traySideCLowerFace->SetFillColor(traySideCLowerFace->GetLineColor());
    8716           2 :   traySideCLowerFace->SetFillStyle(4000); // 0% transparent
    8717             : 
    8718           4 :   TGeoVolume *traySideCLateralFace  = new TGeoVolume("ITSsuppTraySideCLateral",
    8719           2 :                                                      sideCLateralFace, medAl);
    8720             : 
    8721           2 :   traySideCLateralFace->SetVisibility(kTRUE);
    8722           2 :   traySideCLateralFace->SetLineColor(6); // Purple
    8723           2 :   traySideCLateralFace->SetLineWidth(1);
    8724           2 :   traySideCLateralFace->SetFillColor(traySideCLateralFace->GetLineColor());
    8725           2 :   traySideCLateralFace->SetFillStyle(4000); // 0% transparent
    8726             : 
    8727             :   TGeoVolume *traySideCLateralWingA =
    8728           2 :     new TGeoVolume("ITSsuppTraySideCLateralWingA", sideCLateralWingA,  medAl);
    8729             : 
    8730           2 :   traySideCLateralWingA->SetVisibility(kTRUE);
    8731           2 :   traySideCLateralWingA->SetLineColor(6); // Purple
    8732           2 :   traySideCLateralWingA->SetLineWidth(1);
    8733           2 :   traySideCLateralWingA->SetFillColor(traySideCLateralWingA->GetLineColor());
    8734           2 :   traySideCLateralWingA->SetFillStyle(4000); // 0% transparent
    8735             : 
    8736             :   TGeoVolume *traySideCLateralWingB =
    8737           2 :     new TGeoVolume("ITSsuppTraySideCLateralWingB", sideCLateralWingB,  medAl);
    8738             : 
    8739           2 :   traySideCLateralWingB->SetVisibility(kTRUE);
    8740           2 :   traySideCLateralWingB->SetLineColor(6); // Purple
    8741           2 :   traySideCLateralWingB->SetLineWidth(1);
    8742           2 :   traySideCLateralWingB->SetFillColor(traySideCLateralWingB->GetLineColor());
    8743           2 :   traySideCLateralWingB->SetFillStyle(4000); // 0% transparent
    8744             : 
    8745             :   TGeoVolume *traySideCLateralWingC =
    8746           2 :     new TGeoVolume("ITSsuppTraySideCLateralWingC", sideCLateralWingC,  medAl);
    8747             : 
    8748           2 :   traySideCLateralWingC->SetVisibility(kTRUE);
    8749           2 :   traySideCLateralWingC->SetLineColor(6); // Purple
    8750           2 :   traySideCLateralWingC->SetLineWidth(1);
    8751           2 :   traySideCLateralWingC->SetFillColor(traySideCLateralWingC->GetLineColor());
    8752           2 :   traySideCLateralWingC->SetFillStyle(4000); // 0% transparent
    8753             : 
    8754             :   TGeoVolume *traySideCLateralWingD =
    8755           2 :     new TGeoVolume("ITSsuppTraySideCLateralWingD", sideCLateralWingD,  medAl);
    8756             : 
    8757           2 :   traySideCLateralWingD->SetVisibility(kTRUE);
    8758           2 :   traySideCLateralWingD->SetLineColor(6); // Purple
    8759           2 :   traySideCLateralWingD->SetLineWidth(1);
    8760           2 :   traySideCLateralWingD->SetFillColor(traySideCLateralWingD->GetLineColor());
    8761           2 :   traySideCLateralWingD->SetFillStyle(4000); // 0% transparent
    8762             : 
    8763             :   TGeoVolume *traySideCLateralWingE =
    8764           2 :     new TGeoVolume("ITSsuppTraySideCLateralWingE", sideCLateralWingE,  medAl);
    8765             : 
    8766           2 :   traySideCLateralWingE->SetVisibility(kTRUE);
    8767           2 :   traySideCLateralWingE->SetLineColor(6); // Purple
    8768           2 :   traySideCLateralWingE->SetLineWidth(1);
    8769           2 :   traySideCLateralWingE->SetFillColor(traySideCLateralWingE->GetLineColor());
    8770           2 :   traySideCLateralWingE->SetFillStyle(4000); // 0% transparent
    8771             : 
    8772             :   TGeoVolume *traySideCLowerPlate =
    8773           2 :     new TGeoVolume("ITSsuppTraySideCLowerPlate", sideCLowerPlate,  medAl);
    8774             : 
    8775           2 :   traySideCLowerPlate->SetVisibility(kTRUE);
    8776           2 :   traySideCLowerPlate->SetLineColor(6); // Purple
    8777           2 :   traySideCLowerPlate->SetLineWidth(1);
    8778           2 :   traySideCLowerPlate->SetFillColor(traySideCLowerPlate->GetLineColor());
    8779           2 :   traySideCLowerPlate->SetFillStyle(4000); // 0% transparent
    8780             : 
    8781             :   TGeoVolume *traySideCLateralPlate =
    8782           2 :     new TGeoVolume("ITSsuppTraySideCLateralPlate", sideCLateralPlate,  medAl);
    8783             : 
    8784           2 :   traySideCLateralPlate->SetVisibility(kTRUE);
    8785           2 :   traySideCLateralPlate->SetLineColor(6); // Purple
    8786           2 :   traySideCLateralPlate->SetLineWidth(1);
    8787           2 :   traySideCLateralPlate->SetFillColor(traySideCLateralPlate->GetLineColor());
    8788           2 :   traySideCLateralPlate->SetFillStyle(4000); // 0% transparent
    8789             : 
    8790             :   TGeoVolume *traySideCCoverFace =
    8791           2 :     new TGeoVolume("ITSsuppTraySideCCoverFace", sideCCoverFace,  medAl);
    8792             : 
    8793           2 :   traySideCCoverFace->SetVisibility(kTRUE);
    8794           2 :   traySideCCoverFace->SetLineColor(6); // Purple
    8795           2 :   traySideCCoverFace->SetLineWidth(1);
    8796           2 :   traySideCCoverFace->SetFillColor(traySideCCoverFace->GetLineColor());
    8797           2 :   traySideCCoverFace->SetFillStyle(4000); // 0% transparent
    8798             : 
    8799           4 :   TGeoVolume *coolingTubeBar = new TGeoVolume("ITSsuppTraySideCCoolBar",
    8800           2 :                                               coolBar, medAl);
    8801             : 
    8802           2 :   coolingTubeBar->SetVisibility(kTRUE);
    8803           2 :   coolingTubeBar->SetLineColor(6); // Purple
    8804           2 :   coolingTubeBar->SetLineWidth(1);
    8805           2 :   coolingTubeBar->SetFillColor(coolingTubeBar->GetLineColor());
    8806           2 :   coolingTubeBar->SetFillStyle(4000); // 0% transparent
    8807             : 
    8808             : 
    8809             :   // Now build up the tray
    8810           2 :   cableTrayC->AddNode(traySideCLowerFace,1,0);
    8811             : 
    8812           2 :   zloc = kSideCHalfWide + kSideCHalfThick;
    8813           4 :   cableTrayC->AddNode(traySideCLateralFace,1,
    8814           4 :                             new TGeoTranslation(0., 0., zloc) );
    8815           4 :   cableTrayC->AddNode(traySideCLateralFace,2,
    8816           4 :                             new TGeoTranslation(0., 0.,-zloc) );
    8817             : 
    8818             :   xloc = kSideCWingAHalfLen;
    8819           2 :   yloc = kSideCHeight1 - kSideCHalfThick;
    8820           2 :   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
    8821           4 :   cableTrayC->AddNode(traySideCLateralWingA,1,
    8822           4 :                             new TGeoTranslation(xloc, yloc, zloc) );
    8823           4 :   cableTrayC->AddNode(traySideCLateralWingA,2,
    8824           4 :                             new TGeoTranslation(xloc, yloc,-zloc) );
    8825             : 
    8826           2 :   xloc = kSideCSideLength1 + kSideCSideLength2/2;
    8827           2 :   yloc = Yfrom2Points(kSideCSideLength1,kSideCHeight1,
    8828             :                       kSideCSideLength1+kSideCSideLength2,kSideCSideHeight,
    8829           2 :                       xloc) - kSideCHalfThick -0.0012; // Avoid small overlap
    8830             :   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
    8831           4 :   alpharot = (-(kSideCHeight1 - kSideCSideHeight)/kSideCSideLength2 )*
    8832           2 :                 TMath::RadToDeg();
    8833           4 :   cableTrayC->AddNode(traySideCLateralWingB,1,
    8834           6 :                             new TGeoCombiTrans(xloc, yloc, zloc,
    8835           4 :                                         new TGeoRotation("",alpharot,0,0) ) );
    8836           4 :   cableTrayC->AddNode(traySideCLateralWingB,2,
    8837           6 :                             new TGeoCombiTrans(xloc, yloc,-zloc,
    8838           4 :                                         new TGeoRotation("",alpharot,0,0) ) );
    8839             : 
    8840           2 :   xloc = kSideCSideLength1 + kSideCSideLength2 - kSideCHalfThick;
    8841           2 :   yloc = kSideCSideHeight - kSideCWingCHalfLen;
    8842             :   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
    8843           4 :   cableTrayC->AddNode(traySideCLateralWingC,1,
    8844           4 :                             new TGeoTranslation(xloc, yloc, zloc) );
    8845           4 :   cableTrayC->AddNode(traySideCLateralWingC,2,
    8846           4 :                             new TGeoTranslation(xloc, yloc,-zloc) );
    8847             : 
    8848             :   xloc = (kSideCLength1 + (kSideCSideLength1+kSideCSideLength2))/2;
    8849           2 :   yloc = kSideCHeight2 - kSideCHalfThick;
    8850             :   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
    8851           4 :   cableTrayC->AddNode(traySideCLateralWingD,1,
    8852           4 :                             new TGeoTranslation(xloc, yloc, zloc) );
    8853           4 :   cableTrayC->AddNode(traySideCLateralWingD,2,
    8854           4 :                             new TGeoTranslation(xloc, yloc,-zloc) );
    8855             : 
    8856             :   delta = kSideCLength1 - (xloc + kSideCWingDHalfLen);
    8857           2 :   xloc = kSideCLength1 + delta + kSideCWingEHalfLen;
    8858           4 :   yloc = (xloc - kSideCLength1)*TMath::Tan(kSideCFoldAngle) +
    8859           4 :           kSideCHeight2*TMath::Cos(kSideCFoldAngle) - kSideCHalfThick;
    8860             :   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
    8861           2 :   alpharot = kSideCFoldAngle*TMath::RadToDeg();
    8862           4 :   cableTrayC->AddNode(traySideCLateralWingE,1,
    8863           6 :                             new TGeoCombiTrans(xloc, yloc, zloc,
    8864           4 :                                         new TGeoRotation("",alpharot,0,0) ) );
    8865           4 :   cableTrayC->AddNode(traySideCLateralWingE,2,
    8866           6 :                             new TGeoCombiTrans(xloc, yloc,-zloc,
    8867           4 :                                         new TGeoRotation("",alpharot,0,0) ) );
    8868             : 
    8869           2 :   xloc = kSideCLength1 - kPlateHalfLen;
    8870           2 :   yloc = -kPlateThick -0.0025; // Avoid small overlap
    8871           4 :   cableTrayC->AddNode(traySideCLowerPlate,1,
    8872           4 :                             new TGeoTranslation(xloc, yloc, 0.) );
    8873             : 
    8874             :   xloc = kSideCLength1 - kPlateHalfLen;
    8875             :   yloc = -kPlateThick;
    8876           2 :   zloc = kSideCHalfWide + 2*kSideCHalfThick + kPlateThick/2;
    8877           4 :   cableTrayC->AddNode(traySideCLateralPlate,1,
    8878           4 :                             new TGeoTranslation(xloc, yloc, zloc) );
    8879           4 :   cableTrayC->AddNode(traySideCLateralPlate,2,
    8880           4 :                             new TGeoTranslation(xloc, yloc,-zloc) );
    8881             : 
    8882          12 :   for (Int_t jc = 0; jc <kNumBarCool; jc++) {
    8883           4 :     xloc = kXShiftBarCool[jc];
    8884           4 :     yloc = kYShiftBarCool[jc];
    8885           8 :     cableTrayC->AddNode(coolingTubeBar,jc+1,
    8886           8 :                               new TGeoTranslation(xloc, yloc, 0.) );
    8887             :   }
    8888             : 
    8889           2 :   cableTrayC->AddNode(traySideCCoverFace,1,0);
    8890             : 
    8891             : 
    8892             :   // Finally return what we made up
    8893           2 :   cableTrayC->GetShape()->ComputeBBox(); //RS: enforce recompting of BBox
    8894             : 
    8895           2 :   return cableTrayC;
    8896           2 : }
    8897             : 
    8898             : //______________________________________________________________________
    8899             : void AliITSv11GeometrySupport::ITSTPCSupports(TGeoVolume *moth,
    8900             :                                         const TGeoManager *mgr){
    8901             : //
    8902             : // Creates the elements suspending the ITS to the TPC and other fixed
    8903             : // elements used to hook the rails (0872/C and its daughters)
    8904             : //
    8905             : // Input:
    8906             : //         moth : the TGeoVolume owing the volume structure
    8907             : //         mgr  : the GeoManager (default gGeoManager)
    8908             : // Output:
    8909             : //
    8910             : // Return:
    8911             : //
    8912             : // Created:      28 Oct 2010  Mario Sitta
    8913             : // Updated:      18 Feb 2011  Mario Sitta
    8914             : //
    8915             : // Technical data are taken from AutoCAD drawings, L.Simonetti technical
    8916             : // drawings and other (oral) information given by F.Tosello
    8917             : //
    8918             : 
    8919             :   // Dimensions and positions of the half ring C2/C3 (0872/C/04)
    8920           2 :   const Double_t kRingCZPos           =   733.000*fgkmm;
    8921           1 :   const Double_t kRingCZToTPC         =     5.500*fgkmm;
    8922             : 
    8923           1 :   const Double_t kRingCThick          =    12.000*fgkmm;
    8924           1 :   const Double_t kRingCRmin           =   565.000*fgkmm;
    8925           1 :   const Double_t kRingCRmax           =   592.000*fgkmm;
    8926           1 :   const Double_t kRingCHeight         =   560.000*fgkmm;
    8927           1 :   const Double_t kRingCXToInsert      =   515.000*fgkmm;
    8928           1 :   const Double_t kRingCYToInsert      =   113.000*fgkmm;
    8929             : 
    8930             :   const Int_t kNumberOfRingPoints     =    23; // N.points to approximate arc
    8931             : 
    8932             :   // Dimensions of the forward upper hook (0872/C/09)
    8933           1 :   const Double_t kForwUpHookThick     =    20.000*fgkmm;
    8934           1 :   const Double_t kForwUpHookRext      =   590.000*fgkmm;
    8935             :   const Double_t kForwUpHookRint      =    20.000*fgkmm;
    8936           1 :   const Double_t kForwUpHookHiTot     =    89.000*fgkmm;
    8937           1 :   const Double_t kForwUpHookHiInt     =    59.000*fgkmm;
    8938           1 :   const Double_t kForwUpHookWide      =    96.000*fgkmm;
    8939           1 :   const Double_t kForwUpHookHalfBase  =    25.000*fgkmm;
    8940           1 :   const Double_t kForwUpHookBaseCut   =    10.000*fgkmm;
    8941             :   const Double_t kForwUpHookHoleWide  =    25.000*fgkmm;
    8942           1 :   const Double_t kForwUpHookHoleHi    =    22.500*fgkmm;
    8943           1 :   const Double_t kForwUpHookHoleBase  =     5.000*fgkmm;
    8944             :   const Double_t kForwUpHookHoleR5    =     5.000*fgkmm;
    8945           1 :   const Double_t kForwUpHookHoleY     =     8.000*fgkmm;
    8946           1 :   const Double_t kForwUpHookHollowHi  =    35.000*fgkmm;
    8947             :   const Double_t kForwUpHookHollowWide=     5.000*fgkmm;
    8948             : 
    8949             :   const Int_t kNumberOfForwUpHookPts  =    11;
    8950             :   const Int_t kNumbOfForwUpHookHolePts=     5;
    8951             : 
    8952             :   // Dimensions of the forward lower hook (0872/C/08)
    8953             :   const Double_t kForwLwHookThick     =    20.000*fgkmm;
    8954             :   const Double_t kForwLwHookRext      =   590.000*fgkmm;
    8955             :   const Double_t kForwLwHookRint      =    20.000*fgkmm;
    8956           1 :   const Double_t kForwLwHookHiTot     =    88.500*fgkmm;
    8957             :   const Double_t kForwLwHookWide      =    96.000*fgkmm;
    8958             :   const Double_t kForwLwHookHalfBase  =    25.000*fgkmm;
    8959             :   const Double_t kForwLwHookBaseCut   =    10.000*fgkmm;
    8960           1 :   const Double_t kForwLwHookYToHollow =     3.500*fgkmm;
    8961           1 :   const Double_t kForwLwHookHoleR     =     7.500*fgkmm;
    8962             :   const Double_t kForwLwHookHoleIntHi =    35.000*fgkmm;
    8963           1 :   const Double_t kForwLwHookHoleYPos  =    13.500*fgkmm;
    8964           1 :   const Double_t kForwLwHookHollowHi  =    62.000*fgkmm;
    8965             :   const Double_t kForwLwHookHollowWide=     5.000*fgkmm;
    8966             : 
    8967             :   const Int_t kNumberOfForwLwHookPts  =    11;
    8968             :   const Int_t kNumbOfForwLwHookHolePts=     7;
    8969             : 
    8970             :   // Dimensions of the rear upper hook (0872/C/10)
    8971           1 :   const Double_t kRearUpHookThick     =    15.000*fgkmm;
    8972             :   const Double_t kRearUpHookRext      =   590.000*fgkmm;
    8973             :   const Double_t kRearUpHookRint      =    20.000*fgkmm;
    8974           1 :   const Double_t kRearUpHookHiTot     =    53.500*fgkmm;
    8975           1 :   const Double_t kRearUpHookHiInt     =    23.500*fgkmm;
    8976             :   const Double_t kRearUpHookWide      =    96.000*fgkmm;
    8977             :   const Double_t kRearUpHookHalfBase  =    25.000*fgkmm;
    8978             :   const Double_t kRearUpHookHoleWide  =    25.000*fgkmm;
    8979             :   const Double_t kRearUpHookHoleHi    =    22.500*fgkmm;
    8980             :   const Double_t kRearUpHookHoleBase  =     5.000*fgkmm;
    8981             :   const Double_t kRearUpHookHoleR5    =     5.000*fgkmm;
    8982             :   const Double_t kRearUpHookHoleY     =     8.000*fgkmm;
    8983             : 
    8984             :   const Int_t kNumberOfRearUpHookPts  =    10;
    8985             :   const Int_t kNumbOfRearUpHookHolePts=     5;
    8986             : 
    8987             :   // Dimensions of the forward lower hook (0872/C/11)
    8988             :   const Double_t kRearLwHookThick     =    20.000*fgkmm;
    8989             :   const Double_t kRearLwHookRext      =   590.000*fgkmm;
    8990           1 :   const Double_t kRearLwHookHiTot     =    30.000*fgkmm;
    8991             :   const Double_t kRearLwHookWide      =    96.000*fgkmm;
    8992             : 
    8993             :   const Int_t kNumberOfRearLwHookPts  =     3;
    8994             : 
    8995             :   // Dimensions of the rear lower brackets (0872/C/16)
    8996             :   const Double_t kRearLwBracketThick  =    15.000*fgkmm;
    8997           1 :   const Double_t kRearLwBracketHi1    =    42.000*fgkmm;
    8998             :   const Double_t kRearLwBracketHi2    =    12.000*fgkmm;
    8999           1 :   const Double_t kRearLwBracketWide1  =    34.000*fgkmm;
    9000             :   const Double_t kRearLwBracketWide2  =    10.000*fgkmm;
    9001             : //  const Double_t kRearLwBracketR5     =     5.000*fgkmm
    9002             : 
    9003             :   // Dimensions of the forward webcam supports (0872/C/V/01-03-04)
    9004             :   const Double_t kForwWebSStirrDep    =    20.000*fgkmm;
    9005             :   const Double_t kForwWebSStirrLen1   =    15.000*fgkmm;
    9006           1 :   const Double_t kForwWebSStirrLen2   =    55.000*fgkmm;
    9007             :   const Double_t kForwWebSStirrLen3   =    10.000*fgkmm;
    9008           1 :   const Double_t kForwWebSStirrWide1  =    45.000*fgkmm;
    9009           1 :   const Double_t kForwWebSStirrWide2  =    38.000*fgkmm;
    9010           1 :   const Double_t kForwWebSStirrWide3  =    23.000*fgkmm;
    9011             :   const Double_t kForwWebTStirrThick  =     5.000*fgkmm;
    9012             :   const Double_t kForwWebTStirrWide1  =    30.000*fgkmm;
    9013             :   const Double_t kForwWebTStirrWide2  =    10.000*fgkmm;
    9014           1 :   const Double_t kForwWebTStirrTotLen3=    58.500*fgkmm;
    9015           1 :   const Double_t kForwWebTStirrTotLen4=    36.000*fgkmm;
    9016             :   const Double_t kForwWebTStirrLen1   =    10.000*fgkmm;
    9017             : 
    9018             :   // Dimensions of the forward and rear webcam clamps (0872/C/V/02)
    9019             :   const Double_t kFRWebClampThick     =    10.000*fgkmm;
    9020             :   const Double_t kFRWebClampExtWide   =    30.000*fgkmm;
    9021           1 :   const Double_t kFRWebClampIntWide   =    18.000*fgkmm;
    9022           1 :   const Double_t kFRWebClampExtHi     =    22.000*fgkmm;
    9023           1 :   const Double_t kFRWebClampIntHi     =    17.000*fgkmm;
    9024             : 
    9025             :   // Dimensions of the webcam itself
    9026             :   const Double_t kWebcamLength        =    35.000*fgkmm;//ESTIMATED!!!
    9027             : 
    9028             :   // Dimensions of the rear upper webcam supports (0872/C/V/05-06)
    9029           1 :   const Double_t kRearUpWebStirrWide  =    76.000*fgkmm;
    9030             :   const Double_t kRearUpWebStirrDep   =    15.000*fgkmm;
    9031             :   const Double_t kRearUpWebStirrThick =     5.000*fgkmm;
    9032           1 :   const Double_t kRearUpWebStirrH1    =    27.000*fgkmm;
    9033           1 :   const Double_t kRearUpWebStirrH2    =    32.000*fgkmm;
    9034           1 :   const Double_t kRearUpWebBarLen     =   130.000*fgkmm;
    9035             :   const Double_t kRearUpWebBarHi      =    20.000*fgkmm;
    9036             :   const Double_t kRearUpWebBarThick   =     5.000*fgkmm;
    9037             : 
    9038             :   // Dimensions of the upper wheel slides (0872/C/Z/00-01-02)
    9039           1 :   const Double_t kUpperSlideTotHeight =    93.500*fgkmm;
    9040           1 :   const Double_t kUpperSlideBlockHi   =    62.500*fgkmm;
    9041             :   const Double_t kUpperSlideWidth     =    36.000*fgkmm;
    9042           1 :   const Double_t kUpperSlideTotDepth  =    51.000*fgkmm;
    9043             :   const Double_t kUpperSlideIntDepth  =    36.000*fgkmm;
    9044             :   const Double_t kUpperSlideStubHi    =    15.000*fgkmm;
    9045             :   const Double_t kUpperSlideStubDep   =     8.000*fgkmm;
    9046           1 :   const Double_t kUpperSlideWheelHi   =    18.500*fgkmm;
    9047           1 :   const Double_t kUpperSlideHoleRout  =    11.000*fgkmm;
    9048           1 :   const Double_t kUpperSlideHoleRint1 =     9.000*fgkmm;
    9049           1 :   const Double_t kUpperSlideHoleRint2 =    11.500*fgkmm;
    9050           1 :   const Double_t kUpperSlideHoleH1    =     7.000*fgkmm;
    9051           1 :   const Double_t kUpperSlideHoleH2    =    46.000*fgkmm;
    9052           1 :   const Double_t kUpperSlideHoleH3    =     1.100*fgkmm;
    9053             :   const Double_t kUpperSlideHoleXPos  =    20.000*fgkmm;
    9054           1 :   const Double_t kUpperSlidePinRmin   =     4.000*fgkmm;
    9055           1 :   const Double_t kUpperSlidePinRmax   =     6.000*fgkmm;
    9056             :   const Double_t kUpperSlidePinH1     =     7.000*fgkmm;
    9057             :   const Double_t kUpperSlidePinH2     =    46.000*fgkmm;
    9058           1 :   const Double_t kUpperSlidePinH3     =    25.500*fgkmm;
    9059             : 
    9060             :   // Dimensions of the lower wheel slides (0872/C/W/00-01-02-03)
    9061           1 :   const Double_t kLowerSlideTotHeight =    80.000*fgkmm;
    9062           1 :   const Double_t kLowerSlideBlockHi   =    28.000*fgkmm;
    9063             :   const Double_t kLowerSlideWidth     =    36.000*fgkmm;
    9064           1 :   const Double_t kLowerSlideTotDepth  =    60.000*fgkmm;
    9065           1 :   const Double_t kLowerSlideHoleRout  =     9.500*fgkmm;
    9066           1 :   const Double_t kLowerSlideHoleRint  =     4.700*fgkmm;
    9067             :   const Double_t kLowerSlideHoleH1    =    12.000*fgkmm;
    9068           1 :   const Double_t kLowerSlideNoseBase  =    40.000*fgkmm;
    9069             :   const Double_t kLowerSlideNoseBasHi =     6.000*fgkmm;//Computed
    9070             :   const Double_t kLowerSlideNoseUpWid =    25.000*fgkmm;
    9071             :   const Double_t kLowerSlideNoseDepth =    10.000*fgkmm;
    9072           1 :   const Double_t kLowerSlidePinRmin   =     3.000*fgkmm;
    9073             :   const Double_t kLowerSlidePinRmax   =     4.000*fgkmm;
    9074             :   const Double_t kLowerSlidePinH1     =    12.000*fgkmm;
    9075             :   const Double_t kLowerSlidePinH2     =    10.000*fgkmm;
    9076             : 
    9077             :   // Dimensions and positions of the C1/C2 rail stirrups (0872/C/01-02)
    9078           1 :   const Double_t kStirrCXPos          =   759.000*fgkmm;
    9079           1 :   const Double_t kStirrCZPos          =  1867.000*fgkmm;
    9080             : 
    9081             :   const Double_t kStirrC12Thick       =    15.000*fgkmm;
    9082           1 :   const Double_t kStirrC12TotLen      =   314.000*fgkmm;
    9083           1 :   const Double_t kStirrC12BodyHalfHi  =    95.000*fgkmm;
    9084           1 :   const Double_t kStirrC12BodyLen     =   153.000*fgkmm;
    9085           1 :   const Double_t kStirrC12HeadLen     =    50.000*fgkmm;
    9086           1 :   const Double_t kStirrC12HeadHalfHi  =   165.000*fgkmm;
    9087           1 :   const Double_t kStirrC12HeadIntHi   =   114.000*fgkmm;
    9088             :   const Double_t kStirrC12HeadIntLen  =    45.000*fgkmm;
    9089           1 :   const Double_t kStirrC12TailLen     =    14.000*fgkmm;
    9090           1 :   const Double_t kStirrC12R100        =   100.000*fgkmm;
    9091             :   const Double_t kStirrC12R50         =    50.000*fgkmm;
    9092             :   const Double_t kStirrC12R10         =    10.000*fgkmm;
    9093             :   const Double_t kStirrC12HeadAng     =    40.000; // Degree
    9094             : 
    9095             :   const Int_t kNumberOfStirrCPoints   =    23;
    9096             : 
    9097             :   // Dimensions and positions of the C5 rail stirrups (0872/C/05)
    9098           1 :   const Double_t kStirrC5BodyLen      =   155.000*fgkmm;
    9099             : 
    9100             : 
    9101             :   // Local variables
    9102           1 :   Double_t xprof[2*kNumberOfStirrCPoints+1],yprof[2*kNumberOfStirrCPoints+1];
    9103             :   Double_t xpos, ypos, zpos, alpha;
    9104           1 :   Double_t xdummy, ydummy;
    9105             :   
    9106             : 
    9107             :   // First create all needed shapes
    9108             : 
    9109             :   // The Supporting Ring (0872/C/04): a really complex Xtru
    9110             :   // to approximate the arc with a polyline
    9111           1 :   TGeoXtru *ringC2C3 = new TGeoXtru(2);
    9112             : 
    9113          24 :   for (Int_t j=0; j<11; j++) { // The external arc
    9114          11 :     xprof[j] = kRingCRmax*SinD(90*j/10);
    9115          11 :     yprof[j] = kRingCRmax*CosD(90*j/10);
    9116             :   }
    9117             : 
    9118           1 :   xprof[11] = kRingCRmin;
    9119           1 :   yprof[11] = yprof[10];
    9120             : 
    9121           1 :   alpha = TMath::ASin(kRingCYToInsert/kRingCRmin); // Now the insert
    9122           1 :   xprof[12] = kRingCRmin*TMath::Cos(alpha/2);
    9123           1 :   yprof[12] = kRingCRmin*TMath::Sin(alpha/2);
    9124           1 :   xprof[13] = kRingCRmin*TMath::Cos(alpha);
    9125           1 :   yprof[13] = kRingCRmin*TMath::Sin(alpha);
    9126             : 
    9127           1 :   xprof[14] = kRingCXToInsert;
    9128           1 :   yprof[14] = yprof[13];
    9129             : 
    9130           1 :   alpha = TMath::ACos(kRingCXToInsert/kRingCRmin); // The insert ending angle
    9131           1 :   xprof[15] = kRingCRmin*TMath::Cos(alpha);
    9132           1 :   yprof[15] = kRingCRmin*TMath::Sin(alpha);
    9133             : 
    9134          14 :   for (Int_t j=7; j>1; j--) { // The internal arc
    9135           6 :     xprof[23-j] = kRingCRmin*SinD(90*j/10);
    9136           6 :     yprof[23-j] = kRingCRmin*CosD(90*j/10);
    9137             :   }
    9138             : 
    9139           1 :   alpha = TMath::ASin(kRingCHeight/kRingCRmin);    // The angle till the notch
    9140           1 :   xprof[22] = kRingCRmin*TMath::Cos(alpha);
    9141           1 :   yprof[22] = kRingCRmin*TMath::Sin(alpha);
    9142             : 
    9143           1 :   xprof[23] = xprof[0];
    9144           1 :   yprof[23] = yprof[22];
    9145             : 
    9146             :   // We did the right side, now reflex on the left side
    9147          46 :   for (Int_t jp = 0; jp < 22; jp++) {
    9148          22 :     xprof[24+jp] = -xprof[23-1-jp];
    9149          22 :     yprof[24+jp] =  yprof[23-1-jp];
    9150             :   }
    9151             : 
    9152             :   // wow! now the actual Xtru
    9153           1 :   ringC2C3->DefinePolygon(2*kNumberOfRingPoints, xprof, yprof);
    9154           1 :   ringC2C3->DefineSection(0, 0);
    9155           1 :   ringC2C3->DefineSection(1, kRingCThick);
    9156             : 
    9157             :   // The Forward Upper Hook (0872/C/09): a Composite Shape made of
    9158             :   // a really complex Xtru to approximate the arc with a polyline,
    9159             :   // another Xtru for the hole, and a BBox for the hollow
    9160             :   // The main body
    9161           1 :   TGeoXtru *forwUpHookMainBody = new TGeoXtru(2);
    9162           1 :   forwUpHookMainBody->SetName("ITSforwUpHookMainBody");
    9163             : 
    9164           1 :   xprof[ 0] = kForwUpHookHalfBase - kForwUpHookBaseCut;
    9165           1 :   yprof[ 0] = kForwUpHookRext - kForwUpHookHiTot;
    9166           1 :   xprof[ 1] = kForwUpHookHalfBase;
    9167           1 :   yprof[ 1] = yprof[0] + kForwUpHookBaseCut;
    9168           1 :   xprof[ 2] = xprof[1];
    9169           1 :   yprof[ 2] = yprof[0] + (kForwUpHookHiInt - kForwUpHookRint);
    9170          12 :   for (Int_t j=1; j<6; j++) {
    9171           5 :     xprof[2+j] = xprof[2] + kForwUpHookRint*(1 - CosD(90*j/5));
    9172           5 :     yprof[2+j] = yprof[2] + kForwUpHookRint*SinD(90*j/5);
    9173             :   }
    9174           1 :   xprof[ 8] = kForwUpHookWide/2;
    9175           1 :   yprof[ 8] = yprof[7];
    9176           1 :   xprof[ 9] = xprof[8];
    9177           1 :   alpha = TMath::ASin(0.5*kForwUpHookWide/kForwUpHookRext);
    9178           1 :   yprof[ 9] = kForwUpHookRext*TMath::Cos(alpha);
    9179           1 :   xprof[10] = kForwUpHookRext*TMath::Sin(alpha/2);
    9180           1 :   yprof[10] = kForwUpHookRext*TMath::Cos(alpha/2);
    9181           1 :   xprof[11] = 0;
    9182           1 :   yprof[11] = kForwUpHookRext;
    9183             : 
    9184             :   // We did the right side, now reflex on the left side
    9185          24 :   for (Int_t jp = 0; jp < kNumberOfForwUpHookPts; jp++) {
    9186          11 :     xprof[12+jp] = -xprof[10-jp];
    9187          11 :     yprof[12+jp] =  yprof[10-jp];
    9188             :   }
    9189             : 
    9190             :   // Now the actual Xtru
    9191           1 :   forwUpHookMainBody->DefinePolygon(2*kNumberOfForwUpHookPts+1, xprof, yprof);
    9192           1 :   forwUpHookMainBody->DefineSection(0, 0);
    9193           1 :   forwUpHookMainBody->DefineSection(1, kForwUpHookThick);
    9194             : 
    9195             :   // The hole
    9196           1 :   TGeoXtru *forwUpHookHole = new TGeoXtru(2);
    9197           1 :   forwUpHookHole->SetName("ITSforwUpHookHole");
    9198             : 
    9199           1 :   xprof[0] = kForwUpHookHoleBase/2;
    9200           1 :   yprof[0] = forwUpHookMainBody->GetY(0) + kForwUpHookHoleY;
    9201           1 :   xprof[1] = kForwUpHookHoleWide/2;
    9202           1 :   yprof[1] = yprof[0] + (xprof[1] - xprof[0]); // Go at 45deg
    9203           1 :   xprof[2] = xprof[1];
    9204           1 :   yprof[2] = yprof[0] + kForwUpHookHoleHi - kForwUpHookHoleR5;
    9205           1 :   xprof[3] = xprof[2] - kForwUpHookHoleR5*(1 - CosD(45));
    9206           1 :   yprof[3] = yprof[2] + kForwUpHookHoleR5*SinD(45);
    9207           1 :   xprof[4] = xprof[2] - kForwUpHookHoleR5;
    9208           1 :   yprof[4] = yprof[0] + kForwUpHookHoleHi;
    9209             : 
    9210             :   // We did the right side, now reflex on the left side
    9211          12 :   for (Int_t jp = 0; jp < kNumbOfForwUpHookHolePts; jp++) {
    9212           5 :     xprof[5+jp] = -xprof[4-jp];
    9213           5 :     yprof[5+jp] =  yprof[4-jp];
    9214             :   }
    9215             : 
    9216             :   // Now the actual Xtru
    9217           1 :   forwUpHookHole->DefinePolygon(2*kNumbOfForwUpHookHolePts, xprof, yprof);
    9218           1 :   forwUpHookHole->DefineSection(0, -0.1);
    9219           1 :   forwUpHookHole->DefineSection(1, kForwUpHookThick+0.1);
    9220             : 
    9221             :   // The hollow
    9222           2 :   TGeoBBox *forwUpHookHollow = new TGeoBBox(2.1 *kForwUpHookHalfBase,
    9223           1 :                                             0.55*kForwUpHookHollowHi,
    9224           1 :                                             0.55*kForwUpHookHollowWide);
    9225           1 :   forwUpHookHollow->SetName("ITSforwUpHookHollow");
    9226             : 
    9227           2 :   TGeoTranslation *forwUpHookHollPos = new TGeoTranslation(0.,
    9228           1 :                       forwUpHookMainBody->GetY(0) + 0.5*kForwUpHookHollowHi,
    9229           2 :                       forwUpHookMainBody->GetZ(1) - 0.5*kForwUpHookHollowWide);
    9230           1 :   forwUpHookHollPos->SetName("ITSforwUpHookHollPos");
    9231           1 :   forwUpHookHollPos->RegisterYourself();
    9232             : 
    9233             :   // Finally the actual shape: a CompositeShape
    9234           1 :   TGeoCompositeShape *forwUpHookShape = new TGeoCompositeShape("ITSforwUpHookMainBody-ITSforwUpHookHole-ITSforwUpHookHollow:ITSforwUpHookHollPos");
    9235             : 
    9236             :   // The Forward Lower Hook (0872/C/08): a Composite Shape made of
    9237             :   // a really complex Xtru to approximate the arc with a polyline,
    9238             :   // another Xtru for the hole, and a BBox for the hollow
    9239             :   // The main body
    9240           1 :   TGeoXtru *forwLwHookMainBody = new TGeoXtru(2);
    9241           1 :   forwLwHookMainBody->SetName("ITSforwLwHookMainBody");
    9242             : 
    9243           1 :   xprof[ 0] = kForwLwHookHalfBase - kForwLwHookBaseCut;
    9244           1 :   yprof[ 0] = kForwLwHookRext - kForwLwHookHiTot;
    9245           1 :   xprof[ 1] = kForwLwHookHalfBase;
    9246           1 :   yprof[ 1] = yprof[0] + kForwLwHookBaseCut;
    9247           1 :   xprof[ 2] = xprof[1];
    9248           2 :   yprof[ 2] = yprof[0] + (kForwLwHookHollowHi - kForwLwHookYToHollow
    9249           1 :                           - kForwLwHookRint);
    9250          12 :   for (Int_t j=1; j<6; j++) {
    9251           5 :     xprof[2+j] = xprof[2] + kForwLwHookRint*(1 - CosD(90*j/5));
    9252           5 :     yprof[2+j] = yprof[2] + kForwLwHookRint*SinD(90*j/5);
    9253             :   }
    9254           1 :   xprof[ 8] = kForwLwHookWide/2;
    9255           1 :   yprof[ 8] = yprof[7];
    9256           1 :   xprof[ 9] = xprof[8];
    9257           1 :   alpha = TMath::ASin(0.5*kForwLwHookWide/kForwLwHookRext);
    9258           1 :   yprof[ 9] = kForwLwHookRext*TMath::Cos(alpha);
    9259           1 :   xprof[10] = kForwLwHookRext*TMath::Sin(alpha/2);
    9260           1 :   yprof[10] = kForwLwHookRext*TMath::Cos(alpha/2);
    9261           1 :   xprof[11] = 0;
    9262           1 :   yprof[11] = kForwLwHookRext;
    9263             : 
    9264             :   // We did the right side, now reflex on the left side
    9265          24 :   for (Int_t jp = 0; jp < kNumberOfForwLwHookPts; jp++) {
    9266          11 :     xprof[12+jp] = -xprof[10-jp];
    9267          11 :     yprof[12+jp] =  yprof[10-jp];
    9268             :   }
    9269             : 
    9270             :   // Now the actual Xtru
    9271           1 :   forwLwHookMainBody->DefinePolygon(2*kNumberOfForwLwHookPts+1, xprof, yprof);
    9272           1 :   forwLwHookMainBody->DefineSection(0, 0);
    9273           1 :   forwLwHookMainBody->DefineSection(1, kForwLwHookThick);
    9274             : 
    9275             :   // The hole
    9276           1 :   TGeoXtru *forwLwHookHole = new TGeoXtru(2);
    9277           1 :   forwLwHookHole->SetName("ITSforwLwHookHole");
    9278             : 
    9279           1 :   xprof[0] = 0;
    9280           2 :   yprof[0] = forwLwHookMainBody->GetY(0) + kForwLwHookHoleYPos
    9281           1 :            - kForwLwHookHoleR;
    9282           6 :   for (Int_t j=1; j<3; j++) {
    9283           2 :     xprof[0+j] = xprof[0] + kForwLwHookHoleR*SinD(90*j/3);
    9284           2 :     yprof[0+j] = yprof[0] + kForwLwHookHoleR*(1 - CosD(90*j/3));
    9285             :   }
    9286           1 :   xprof[3] = xprof[0] + kForwLwHookHoleR;
    9287           1 :   yprof[3] = yprof[0] + kForwLwHookHoleR;
    9288           1 :   xprof[4] = xprof[3];
    9289           1 :   yprof[4] = yprof[3] + kForwLwHookHoleIntHi;
    9290           6 :   for (Int_t j=1; j<3; j++) {
    9291           2 :     xprof[4+j] = xprof[4] - kForwLwHookHoleR*(1 - CosD(90*j/3));
    9292           2 :     yprof[4+j] = yprof[4] + kForwLwHookHoleR*SinD(90*j/3);
    9293             :   }
    9294           1 :   xprof[7] = xprof[0];
    9295           1 :   yprof[7] = yprof[4] + kForwLwHookHoleR;
    9296             : 
    9297             :   // We did the right side, now reflex on the left side
    9298          14 :   for (Int_t jp = 0; jp < kNumbOfForwLwHookHolePts-1; jp++) {
    9299           6 :     xprof[8+jp] = -xprof[6-jp];
    9300           6 :     yprof[8+jp] =  yprof[6-jp];
    9301             :   }
    9302             : 
    9303             :   // Now the actual Xtru
    9304           1 :   forwLwHookHole->DefinePolygon(2*kNumbOfForwLwHookHolePts, xprof, yprof);
    9305           1 :   forwLwHookHole->DefineSection(0, -0.1);
    9306           1 :   forwLwHookHole->DefineSection(1, kForwLwHookThick+0.1);
    9307             : 
    9308             :   // The hollow
    9309           2 :   TGeoBBox *forwLwHookHollow = new TGeoBBox(2.1 *kForwLwHookHalfBase,
    9310           1 :                                             0.55*kForwLwHookHollowHi,
    9311             :                                             0.55*kForwLwHookHollowWide);
    9312           1 :   forwLwHookHollow->SetName("ITSforwLwHookHollow");
    9313             : 
    9314           2 :   TGeoTranslation *forwLwHookHollPos = new TGeoTranslation(0.,
    9315           1 :                       forwLwHookMainBody->GetY(0) + 0.5*kForwLwHookHollowHi,
    9316           2 :                       forwLwHookMainBody->GetZ(1) - 0.5*kForwLwHookHollowWide);
    9317           1 :   forwLwHookHollPos->SetName("ITSforwLwHookHollPos");
    9318           1 :   forwLwHookHollPos->RegisterYourself();
    9319             : 
    9320             :   // Finally the actual shape: a CompositeShape
    9321           1 :   TGeoCompositeShape *forwLwHookShape = new TGeoCompositeShape("ITSforwLwHookMainBody-ITSforwLwHookHole-ITSforwLwHookHollow:ITSforwLwHookHollPos");
    9322             : 
    9323             :   // The Rear Upper Hook (0872/C/10): a Composite Shape made of
    9324             :   // a really complex Xtru to approximate the arc with a polyline,
    9325             :   // and another Xtru for the hole
    9326             :   // The main body
    9327           1 :   TGeoXtru *rearUpHookMainBody = new TGeoXtru(2);
    9328           1 :   rearUpHookMainBody->SetName("ITSrearUpHookMainBody");
    9329             : 
    9330           1 :   xprof[0] = kRearUpHookHalfBase;
    9331           1 :   yprof[0] = kRearUpHookRext - kRearUpHookHiTot;
    9332           1 :   xprof[1] = xprof[0];
    9333           1 :   yprof[1] = yprof[0] + (kRearUpHookHiInt - kRearUpHookRint); 
    9334          12 :   for (Int_t j=1; j<6; j++) {
    9335           5 :     xprof[1+j] = xprof[1] + kRearUpHookRint*(1 - CosD(90*j/5));
    9336           5 :     yprof[1+j] = yprof[1] + kRearUpHookRint*SinD(90*j/5);
    9337             :   }
    9338           1 :   xprof[ 7] = kRearUpHookWide/2;
    9339           1 :   yprof[ 7] = yprof[5];
    9340           1 :   xprof[ 8] = xprof[7];
    9341           1 :   alpha = TMath::ASin(0.5*kRearUpHookWide/kRearUpHookRext);
    9342           1 :   yprof[ 8] = kRearUpHookRext*TMath::Cos(alpha);
    9343           1 :   xprof[ 9] = kRearUpHookRext*TMath::Sin(alpha/2);
    9344           1 :   yprof[ 9] = kRearUpHookRext*TMath::Cos(alpha/2);
    9345           1 :   xprof[10] = 0;
    9346           1 :   yprof[10] = kRearUpHookRext;
    9347             : 
    9348             :   // We did the right side, now reflex on the left side
    9349          22 :   for (Int_t jp = 0; jp < kNumberOfRearUpHookPts; jp++) {
    9350          10 :     xprof[11+jp] = -xprof[9-jp];
    9351          10 :     yprof[11+jp] =  yprof[9-jp];
    9352             :   }
    9353             : 
    9354             :   // Now the actual Xtru
    9355           1 :   rearUpHookMainBody->DefinePolygon(2*kNumberOfRearUpHookPts+1, xprof, yprof);
    9356           1 :   rearUpHookMainBody->DefineSection(0, 0);
    9357           1 :   rearUpHookMainBody->DefineSection(1, kRearUpHookThick);
    9358             : 
    9359             :   // The hole
    9360           1 :   TGeoXtru *rearUpHookHole = new TGeoXtru(2);
    9361           1 :   rearUpHookHole->SetName("ITSrearUpHookHole");
    9362             : 
    9363           1 :   xprof[0] = kRearUpHookHoleBase/2;
    9364           1 :   yprof[0] = rearUpHookMainBody->GetY(0) + kRearUpHookHoleY;
    9365           1 :   xprof[1] = kRearUpHookHoleWide/2;
    9366           1 :   yprof[1] = yprof[0] + (xprof[1] - xprof[0]); // Go at 45deg
    9367           1 :   xprof[2] = xprof[1];
    9368           1 :   yprof[2] = yprof[0] + kRearUpHookHoleHi - kRearUpHookHoleR5;
    9369           1 :   xprof[3] = xprof[2] - kRearUpHookHoleR5*(1 - CosD(45));
    9370           1 :   yprof[3] = yprof[2] + kRearUpHookHoleR5*SinD(45);
    9371           1 :   xprof[4] = xprof[2] - kRearUpHookHoleR5;
    9372           1 :   yprof[4] = yprof[0] + kRearUpHookHoleHi;
    9373             : 
    9374             :   // We did the right side, now reflex on the left side
    9375          12 :   for (Int_t jp = 0; jp < kNumbOfRearUpHookHolePts; jp++) {
    9376           5 :     xprof[5+jp] = -xprof[4-jp];
    9377           5 :     yprof[5+jp] =  yprof[4-jp];
    9378             :   }
    9379             : 
    9380             :   // Now the actual Xtru
    9381           1 :   rearUpHookHole->DefinePolygon(2*kNumbOfRearUpHookHolePts, xprof, yprof);
    9382           1 :   rearUpHookHole->DefineSection(0, -0.1);
    9383           1 :   rearUpHookHole->DefineSection(1, kRearUpHookThick+0.1);
    9384             : 
    9385             :   // Finally the actual shape: a CompositeShape
    9386           1 :   TGeoCompositeShape *rearUpHookShape = new TGeoCompositeShape("ITSrearUpHookMainBody-ITSrearUpHookHole");
    9387             : 
    9388             :   // The Rear Lower Hook (0872/C/11): a Xtru
    9389           1 :   TGeoXtru *rearLwHookShape = new TGeoXtru(2);
    9390           1 :   rearLwHookShape->SetName("ITSrearLwHookShape");
    9391             : 
    9392           1 :   xprof[0] = kRearLwHookWide/2;
    9393           1 :   yprof[0] = kRearLwHookRext - kRearLwHookHiTot;
    9394           1 :   xprof[1] = xprof[0];
    9395           1 :   alpha = TMath::ASin(0.5*kRearLwHookWide/kRearLwHookRext);
    9396           1 :   yprof[1] = kRearLwHookRext*TMath::Cos(alpha);
    9397           1 :   xprof[2] = kRearLwHookRext*TMath::Sin(alpha/2);
    9398           1 :   yprof[2] = kRearLwHookRext*TMath::Cos(alpha/2);
    9399           1 :   xprof[3] = 0;
    9400           1 :   yprof[3] = kRearLwHookRext;
    9401             : 
    9402             :   // We did the right side, now reflex on the left side
    9403           8 :   for (Int_t jp = 0; jp < kNumberOfRearLwHookPts; jp++) {
    9404           3 :     xprof[4+jp] = -xprof[2-jp];
    9405           3 :     yprof[4+jp] =  yprof[2-jp];
    9406             :   }
    9407             : 
    9408             :   // Now the actual Xtru
    9409           1 :   rearLwHookShape->DefinePolygon(2*kNumberOfRearLwHookPts+1, xprof, yprof);
    9410           1 :   rearLwHookShape->DefineSection(0, 0);
    9411           1 :   rearLwHookShape->DefineSection(1, kRearLwHookThick);
    9412             : 
    9413             :   // The Rear Lower Bracket (0872/C/16): a Xtru
    9414           1 :   TGeoXtru *rearLwBrackShape = new TGeoXtru(2);
    9415           1 :   rearLwBrackShape->SetName("ITSrearLwBrackShape");
    9416             : 
    9417           1 :   xprof[0] = 0;
    9418           1 :   yprof[0] = 0;
    9419           1 :   xprof[1] = xprof[0] + kRearLwBracketWide1 - kRearLwBracketWide2;
    9420           1 :   yprof[1] = yprof[0];
    9421           1 :   xprof[2] = xprof[1];
    9422           1 :   yprof[2] = yprof[0] + kRearLwBracketHi2;
    9423           1 :   xprof[3] = xprof[2] - kRearLwBracketWide1;
    9424           1 :   yprof[3] = yprof[2];
    9425           1 :   xprof[4] = xprof[3];
    9426           1 :   yprof[4] = yprof[3] - kRearLwBracketHi1;
    9427           1 :   xprof[5] = xprof[0];
    9428           1 :   yprof[5] = yprof[4];
    9429             : 
    9430           1 :   rearLwBrackShape->DefinePolygon(6, xprof, yprof);
    9431           1 :   rearLwBrackShape->DefineSection(0,-kRearLwBracketThick/2);
    9432           1 :   rearLwBrackShape->DefineSection(1, kRearLwBracketThick/2);
    9433             : 
    9434             :   // The Forward S-shaped Stirrup for the webcam (0872/C/V/01): a Xtru
    9435           1 :   TGeoXtru *forwWebSStirrSh = new TGeoXtru(2);
    9436             : 
    9437           1 :   xprof[0] = 0;
    9438           1 :   yprof[0] = 0;
    9439           1 :   xprof[1] = xprof[0] + kForwWebSStirrLen1;
    9440           1 :   yprof[1] = yprof[0];
    9441           1 :   xprof[2] = xprof[1];
    9442           1 :   yprof[2] = yprof[1] + kForwWebSStirrWide1;
    9443           1 :   xprof[3] = xprof[0] - kForwWebSStirrLen2 + kForwWebSStirrLen3;
    9444           1 :   yprof[3] = yprof[2];
    9445           1 :   xprof[4] = xprof[3];
    9446           1 :   yprof[4] = yprof[3] + kForwWebSStirrWide3;
    9447           1 :   xprof[5] = xprof[4] - kForwWebSStirrLen3;
    9448           1 :   yprof[5] = yprof[4];
    9449           1 :   xprof[6] = xprof[5];
    9450           1 :   yprof[6] = yprof[0] + kForwWebSStirrWide2;
    9451           1 :   xprof[7] = xprof[0];
    9452           1 :   yprof[7] = yprof[6];
    9453             : 
    9454           1 :   forwWebSStirrSh->DefinePolygon(8, xprof, yprof);
    9455           1 :   forwWebSStirrSh->DefineSection(0,-kForwWebSStirrDep/2);
    9456           1 :   forwWebSStirrSh->DefineSection(1, kForwWebSStirrDep/2);
    9457             : 
    9458             :   // The Forward T-shaped Stirrups for the webcam (0872/C/V/03-04): two Xtru
    9459           1 :   TGeoXtru *forwWebTStirr3Sh = new TGeoXtru(2);
    9460             : 
    9461           1 :   xprof[0] = -kForwWebTStirrWide2/2;
    9462           1 :   yprof[0] = 0;
    9463           1 :   xprof[1] = -kForwWebTStirrWide1/2;
    9464           1 :   yprof[1] = yprof[0];
    9465           1 :   xprof[2] = xprof[1];
    9466           1 :   yprof[2] = yprof[1] - kForwWebTStirrLen1;
    9467           1 :   xprof[3] =-xprof[2];
    9468           1 :   yprof[3] = yprof[2];
    9469           1 :   xprof[4] = xprof[3];
    9470           1 :   yprof[4] = yprof[1];
    9471           1 :   xprof[5] =-xprof[0];
    9472           1 :   yprof[5] = yprof[4];
    9473           1 :   xprof[6] = xprof[5];
    9474           1 :   yprof[6] = kForwWebTStirrTotLen3 - kForwWebTStirrLen1;
    9475           1 :   xprof[7] = xprof[0];
    9476           1 :   yprof[7] = yprof[6];
    9477             : 
    9478           1 :   forwWebTStirr3Sh->DefinePolygon(8, xprof, yprof);
    9479           1 :   forwWebTStirr3Sh->DefineSection(0, 0);
    9480           1 :   forwWebTStirr3Sh->DefineSection(1, kForwWebTStirrThick);
    9481             : 
    9482           1 :   TGeoXtru *forwWebTStirr4Sh = new TGeoXtru(2);
    9483             : 
    9484           1 :   yprof[6] = kForwWebTStirrTotLen4 - kForwWebTStirrLen1;
    9485           1 :   yprof[7] = yprof[6];
    9486             : 
    9487           1 :   forwWebTStirr4Sh->DefinePolygon(8, xprof, yprof);
    9488           1 :   forwWebTStirr4Sh->DefineSection(0, 0);
    9489           1 :   forwWebTStirr4Sh->DefineSection(1, kForwWebTStirrThick);
    9490             : 
    9491             :   // The Forward and Rear clamp for the webcam (0872/C/V/02): a Xtru
    9492           1 :   TGeoXtru *frWebClampSh = new TGeoXtru(2);
    9493             : 
    9494           1 :   xprof[0] = kFRWebClampIntWide/2;
    9495           1 :   yprof[0] = kFRWebClampIntHi;
    9496           1 :   xprof[1] = xprof[0];
    9497           1 :   yprof[1] = 0;
    9498           1 :   xprof[2] = kFRWebClampExtWide/2;
    9499           1 :   yprof[2] = yprof[1];
    9500           1 :   xprof[3] = xprof[2];
    9501           1 :   yprof[3] = kFRWebClampExtHi;
    9502          10 :   for (Int_t jp = 0; jp < 4; jp++) {
    9503           4 :     xprof[4+jp] = -xprof[3-jp];
    9504           4 :     yprof[4+jp] =  yprof[3-jp];
    9505             :   }
    9506             : 
    9507           1 :   frWebClampSh->DefinePolygon(8, xprof, yprof);
    9508           1 :   frWebClampSh->DefineSection(0,-kFRWebClampThick/2);
    9509           1 :   frWebClampSh->DefineSection(1, kFRWebClampThick/2);
    9510             : 
    9511             :   // The Rear Upper Stirrup for the webcam (0872/C/V/05): a Xtru
    9512           1 :   TGeoXtru *upWebStirrSh = new TGeoXtru(2);
    9513             : 
    9514           1 :   xprof[0] = 0;
    9515           1 :   yprof[0] = 0;
    9516           1 :   xprof[1] = xprof[0] - (kRearUpWebStirrWide - 2*kRearUpWebStirrThick);
    9517           1 :   yprof[1] = yprof[0];
    9518           1 :   xprof[2] = xprof[1];
    9519           1 :   yprof[2] = yprof[1] + (kRearUpWebStirrH1 - kRearUpWebStirrThick);
    9520           1 :   xprof[3] = xprof[2] - kRearUpWebStirrThick;
    9521           1 :   yprof[3] = yprof[2];
    9522           1 :   xprof[4] = xprof[3];
    9523           1 :   yprof[4] = yprof[3] - kRearUpWebStirrH1;
    9524           1 :   xprof[5] = xprof[4] + kRearUpWebStirrWide;
    9525           1 :   yprof[5] = yprof[4];
    9526           1 :   xprof[6] = xprof[5];
    9527           1 :   yprof[6] = yprof[5] + kRearUpWebStirrH2;
    9528           1 :   xprof[7] = xprof[0];
    9529           1 :   yprof[7] = yprof[6];
    9530             : 
    9531           1 :   upWebStirrSh->DefinePolygon(8, xprof, yprof);
    9532           1 :   upWebStirrSh->DefineSection(0,-kRearUpWebStirrDep/2);
    9533           1 :   upWebStirrSh->DefineSection(1, kRearUpWebStirrDep/2);
    9534             : 
    9535             :   // The Rear Upper Bar for the webcam (0872/C/V/06): a BBox
    9536           1 :   TGeoBBox *upRearWebBarSh = new TGeoBBox(kRearUpWebBarLen/2,
    9537             :                                           kRearUpWebBarHi/2,
    9538             :                                           kRearUpWebBarThick/2);
    9539             : 
    9540             :   // The Webcam: a BBox
    9541           2 :   TGeoBBox *webcamShape = new TGeoBBox(kFRWebClampIntWide/2,
    9542           1 :                                        kWebcamLength/2,
    9543           1 :                                        kFRWebClampIntHi/2);
    9544             : 
    9545             :   // The Upper Wheel Slide (0872/C/Z/00-01-02)
    9546             :   // A mother volume of air (to avoid assembly) contains the Alluminum block
    9547             :   // (a Composite Shape: a Xtru and a Pcon for the hole) and the Steel pin
    9548             :   // (a Pcon) (The wheels are approximated as part of the block itself)
    9549             :   // The Air mother volume
    9550           1 :   TGeoXtru *upSlideAirSh = new TGeoXtru(2);
    9551           1 :   upSlideAirSh->SetName("ITSupperSlideAirShape");
    9552             : 
    9553           1 :   xprof[0] = 0;
    9554           1 :   yprof[0] = 0;
    9555           1 :   xprof[1] = xprof[0];
    9556           1 :   yprof[1] = kUpperSlideBlockHi + kUpperSlideStubHi - kUpperSlideWheelHi;
    9557           1 :   xprof[2] = xprof[1] - kUpperSlideIntDepth;
    9558           1 :   yprof[2] = yprof[1];
    9559           1 :   xprof[3] = xprof[2];
    9560           1 :   yprof[3] = yprof[2] - kUpperSlideTotHeight;
    9561           1 :   xprof[4] = xprof[3] + kUpperSlideTotDepth;
    9562           1 :   yprof[4] = yprof[3];
    9563           1 :   xprof[5] = xprof[4];
    9564           1 :   yprof[5] = yprof[0];
    9565             : 
    9566           1 :   upSlideAirSh->DefinePolygon(6, xprof, yprof);
    9567           1 :   upSlideAirSh->DefineSection(0,-kUpperSlideWidth/2);
    9568           1 :   upSlideAirSh->DefineSection(1, kUpperSlideWidth/2);
    9569             : 
    9570             :   // The (filled) Aluminum block: a Xtru
    9571           1 :   TGeoXtru *upSlideAluSh = new TGeoXtru(2);
    9572           1 :   upSlideAluSh->SetName("ITSupperSlideAluShape");
    9573             : 
    9574           1 :   xprof[0] = upSlideAirSh->GetX(0);
    9575           1 :   yprof[0] = upSlideAirSh->GetY(0);
    9576           1 :   xprof[1] = upSlideAirSh->GetX(1);
    9577           1 :   yprof[1] = upSlideAirSh->GetY(1);
    9578           1 :   xprof[2] = xprof[1] - kUpperSlideStubDep;
    9579           1 :   yprof[2] = yprof[1];
    9580           1 :   xprof[3] = xprof[2];
    9581           1 :   yprof[3] = yprof[2] - kUpperSlideStubHi;
    9582           1 :   xprof[4] = upSlideAirSh->GetX(2);
    9583           1 :   yprof[4] = yprof[3];
    9584           1 :   xprof[5] = xprof[4];
    9585           1 :   yprof[5] = yprof[4] - kUpperSlideBlockHi;
    9586           1 :   xprof[6] = upSlideAirSh->GetX(5);
    9587           1 :   yprof[6] = yprof[5];
    9588           1 :   xprof[7] = xprof[6];
    9589           1 :   yprof[7] = yprof[0];
    9590             : 
    9591           1 :   upSlideAluSh->DefinePolygon(8, xprof, yprof);
    9592           1 :   upSlideAluSh->DefineSection(0, upSlideAirSh->GetZ(0));
    9593           1 :   upSlideAluSh->DefineSection(1, upSlideAirSh->GetZ(1));
    9594             : 
    9595             :   // The cylindrical hole in the block; a Pcon
    9596           1 :   TGeoPcon *upSlideHoleSh = new TGeoPcon(0, 360, 10);
    9597           1 :   upSlideHoleSh->SetName("ITSupperSlideHoleShape");
    9598             : 
    9599           1 :   zpos = upSlideAluSh->GetY(5);
    9600           1 :   upSlideHoleSh->DefineSection(0, zpos-0.1, 0, kUpperSlideHoleRout);
    9601           2 :   zpos += (kUpperSlideBlockHi - kUpperSlideHoleH3 - kUpperSlideHoleH2
    9602           1 :         - 2*kUpperSlideHoleH1);
    9603           1 :   upSlideHoleSh->DefineSection(1, zpos, 0, kUpperSlideHoleRout);
    9604           1 :   upSlideHoleSh->DefineSection(2, zpos, 0, kUpperSlideHoleRint2);
    9605           1 :   zpos += kUpperSlideHoleH3;
    9606           1 :   upSlideHoleSh->DefineSection(3, zpos, 0, kUpperSlideHoleRint2);
    9607           1 :   upSlideHoleSh->DefineSection(4, zpos, 0, kUpperSlideHoleRout);
    9608           1 :   zpos += kUpperSlideHoleH1;
    9609           1 :   upSlideHoleSh->DefineSection(5, zpos, 0, kUpperSlideHoleRout);
    9610           1 :   upSlideHoleSh->DefineSection(6, zpos, 0, kUpperSlideHoleRint1);
    9611           1 :   zpos += kUpperSlideHoleH2;
    9612           1 :   upSlideHoleSh->DefineSection(7, zpos, 0, kUpperSlideHoleRint1);
    9613           1 :   upSlideHoleSh->DefineSection(8, zpos, 0, kUpperSlideHoleRout);
    9614           1 :   zpos += kUpperSlideHoleH1;
    9615           1 :   upSlideHoleSh->DefineSection(9, zpos+0.1, 0, kUpperSlideHoleRout);
    9616             : 
    9617           2 :   TGeoCombiTrans *upSlideHolePos = new TGeoCombiTrans(-kUpperSlideHoleXPos,0,0,
    9618           2 :                                    new TGeoRotation("",0,-90,0) );
    9619           1 :   upSlideHolePos->SetName("ITSupperSlideHolePos");
    9620           1 :   upSlideHolePos->RegisterYourself();
    9621             : 
    9622             :   // The actual block: a CompositeShape
    9623           1 :   TGeoCompositeShape *upSlideBlockSh = new TGeoCompositeShape("ITSupperSlideAluShape-ITSupperSlideHoleShape:ITSupperSlideHolePos");
    9624             : 
    9625             :   // The Steel pin in the block; a Pcon
    9626           1 :   TGeoPcon *upSlidePinSh = new TGeoPcon(0, 360, 6);
    9627           1 :   upSlidePinSh->SetName("ITSupperSlidePinShape");
    9628             : 
    9629           2 :   zpos = upSlideAluSh->GetY(5) - (kUpperSlidePinH1 + kUpperSlidePinH2
    9630           1 :        + kUpperSlidePinH3 - kUpperSlideBlockHi);
    9631           1 :   upSlidePinSh->DefineSection(0, zpos, 0, kUpperSlidePinRmin);
    9632           1 :   zpos += kUpperSlidePinH3;
    9633           1 :   upSlidePinSh->DefineSection(1, zpos, 0, kUpperSlidePinRmin);
    9634           1 :   upSlidePinSh->DefineSection(2, zpos, 0, kUpperSlidePinRmax);
    9635           1 :   zpos += kUpperSlidePinH2;
    9636           1 :   upSlidePinSh->DefineSection(3, zpos, 0, kUpperSlidePinRmax);
    9637           1 :   upSlidePinSh->DefineSection(4, zpos, 0, kUpperSlidePinRmin);
    9638           1 :   zpos += kUpperSlidePinH1;
    9639           1 :   upSlidePinSh->DefineSection(5, zpos, 0, kUpperSlidePinRmin);
    9640             : 
    9641             :   // The Lower Wheel Slide (0872/C/W/00-01-02-03)
    9642             :   // A mother volume of air (to avoid assembly) contains the Alluminum block
    9643             :   // (a Composite Shape: a Xtru and a Pcon for the hole), the Alluminum nose
    9644             :   // (a Xtru) and the Steel pin (a Pcon)
    9645             :   // (The wheels are approximated as part of the block itself)
    9646             :   // The Air mother volume
    9647           1 :   TGeoXtru *lwSlideAirSh = new TGeoXtru(2);
    9648           1 :   lwSlideAirSh->SetName("ITSlowerSlideAirShape");
    9649             : 
    9650           1 :   xprof[0] = 0;
    9651           1 :   yprof[0] = 0;
    9652           1 :   xprof[1] = xprof[0] + kLowerSlideTotDepth/2 - kLowerSlideNoseBase/2;
    9653           1 :   yprof[1] = yprof[0];
    9654           1 :   xprof[2] = xprof[1];
    9655           1 :   yprof[2] = yprof[1] - (kLowerSlideBlockHi + kLowerSlidePinH2);
    9656           1 :   xprof[3] = xprof[2] - kLowerSlideTotDepth;
    9657           1 :   yprof[3] = yprof[2];
    9658           1 :   xprof[4] = xprof[3];
    9659           1 :   yprof[4] = yprof[3] + kLowerSlidePinH2 + kLowerSlideTotHeight;
    9660           1 :   xprof[5] = xprof[0];
    9661           1 :   yprof[5] = yprof[4];
    9662             : 
    9663           1 :   lwSlideAirSh->DefinePolygon(6, xprof, yprof);
    9664           1 :   lwSlideAirSh->DefineSection(0,-kLowerSlideWidth/2);
    9665           1 :   lwSlideAirSh->DefineSection(1, kLowerSlideWidth/2);
    9666             : 
    9667             :   // The (filled) Aluminum block: a Xtru
    9668           1 :   TGeoXtru *lwSlideAluSh = new TGeoXtru(2);
    9669           1 :   lwSlideAluSh->SetName("ITSlowerSlideAluShape");
    9670             : 
    9671           1 :   xprof[0] = lwSlideAirSh->GetX(0);
    9672           1 :   yprof[0] = lwSlideAirSh->GetY(0);
    9673           1 :   xprof[1] = lwSlideAirSh->GetX(1);
    9674           1 :   yprof[1] = lwSlideAirSh->GetY(1);
    9675           1 :   xprof[2] = xprof[1];
    9676           1 :   yprof[2] = yprof[1] - kLowerSlideBlockHi;
    9677           1 :   xprof[3] = lwSlideAirSh->GetX(3);
    9678           1 :   yprof[3] = yprof[2];
    9679           1 :   xprof[4] = xprof[3];
    9680           1 :   yprof[4] = yprof[3] + kLowerSlideBlockHi;
    9681           1 :   xprof[5] = xprof[4] + kLowerSlideTotDepth/2;
    9682           1 :   yprof[5] = yprof[4];
    9683           1 :   xprof[6] = xprof[5];
    9684           1 :   yprof[6] = lwSlideAirSh->GetY(4);
    9685           1 :   xprof[7] = xprof[0];
    9686           1 :   yprof[7] = yprof[6];
    9687             : 
    9688           1 :   lwSlideAluSh->DefinePolygon(8, xprof, yprof);
    9689           1 :   lwSlideAluSh->DefineSection(0, lwSlideAirSh->GetZ(0));
    9690           1 :   lwSlideAluSh->DefineSection(1, lwSlideAirSh->GetZ(1));
    9691             : 
    9692             :   // The cylindrical hole in the block; a Pcon
    9693           1 :   TGeoPcon *lwSlideHoleSh = new TGeoPcon(0, 360, 4);
    9694           1 :   lwSlideHoleSh->SetName("ITSlowerSlideHoleShape");
    9695             : 
    9696           1 :   zpos = lwSlideAluSh->GetY(2);
    9697           1 :   lwSlideHoleSh->DefineSection(0, zpos-0.1, 0, kLowerSlideHoleRout);
    9698           1 :   zpos += kLowerSlideHoleH1;
    9699           1 :   lwSlideHoleSh->DefineSection(1, zpos, 0, kLowerSlideHoleRout);
    9700           1 :   lwSlideHoleSh->DefineSection(2, zpos, 0, kLowerSlideHoleRint);
    9701           1 :   zpos = lwSlideAluSh->GetY(4);
    9702           1 :   lwSlideHoleSh->DefineSection(3, zpos, 0, kLowerSlideHoleRint);
    9703             : 
    9704           2 :   TGeoCombiTrans *lwSlideHolePos = new TGeoCombiTrans(lwSlideAluSh->GetX(5),
    9705             :                                                       0, 0,
    9706           2 :                                    new TGeoRotation("",0,-90,0) );
    9707           1 :   lwSlideHolePos->SetName("ITSlowerSlideHolePos");
    9708           1 :   lwSlideHolePos->RegisterYourself();
    9709             : 
    9710             :   // The actual block: a CompositeShape
    9711           1 :   TGeoCompositeShape *lwSlideBlockSh = new TGeoCompositeShape("ITSlowerSlideAluShape-ITSlowerSlideHoleShape:ITSlowerSlideHolePos");
    9712             : 
    9713             :   // The Aluminum nose: a Xtru
    9714           1 :   TGeoXtru *lwSlideNoseSh = new TGeoXtru(2);
    9715           1 :   lwSlideNoseSh->SetName("ITSlowerSlideNoseShape");
    9716             : 
    9717           1 :   xprof[0] = lwSlideAluSh->GetX(5);
    9718           1 :   yprof[0] = lwSlideAluSh->GetY(5);
    9719           1 :   xprof[1] = xprof[0] - kLowerSlideNoseBase/2;
    9720           1 :   yprof[1] = yprof[0];
    9721           1 :   xprof[2] = xprof[1];
    9722           1 :   yprof[2] = yprof[1] + kLowerSlideNoseBasHi;
    9723           1 :   xprof[3] = lwSlideAluSh->GetX(0) - kLowerSlideNoseUpWid;
    9724           1 :   yprof[3] = lwSlideAluSh->GetY(6);
    9725           1 :   xprof[4] = xprof[0];
    9726           1 :   yprof[4] = yprof[3];
    9727             : 
    9728           1 :   lwSlideNoseSh->DefinePolygon(5, xprof, yprof);
    9729           1 :   lwSlideNoseSh->DefineSection(0,-kLowerSlideNoseDepth/2);
    9730           1 :   lwSlideNoseSh->DefineSection(1, kLowerSlideNoseDepth/2);
    9731             : 
    9732             :   // The Steel pin in the block; a Pcon
    9733           1 :   TGeoPcon *lwSlidePinSh = new TGeoPcon(0, 360, 4);
    9734           1 :   lwSlidePinSh->SetName("ITSlowerSlidePinShape");
    9735             : 
    9736           1 :   zpos = lwSlideAirSh->GetY(2);
    9737           1 :   lwSlidePinSh->DefineSection(0, zpos, 0, kLowerSlidePinRmax);
    9738           1 :   zpos += kLowerSlidePinH2;
    9739           1 :   lwSlidePinSh->DefineSection(1, zpos, 0, kLowerSlidePinRmax);
    9740           1 :   lwSlidePinSh->DefineSection(2, zpos, 0, kLowerSlidePinRmin);
    9741           1 :   zpos += kLowerSlidePinH1;
    9742           1 :   lwSlidePinSh->DefineSection(3, zpos, 0, kLowerSlidePinRmin);
    9743             : 
    9744             :   // The Stirrup on the Muon side (0872/C/01-02): a really complex Xtru
    9745             :   // to approximate arcs with polylines
    9746           1 :   TGeoXtru *stirrupC1C2Sh = new TGeoXtru(2);
    9747             : 
    9748          24 :   for (Int_t j=0; j<11; j++) { // The internal arc
    9749          11 :     xprof[j] = kStirrC12R50*(1 - CosD(90*j/10));
    9750          11 :     yprof[j] = kStirrC12R50*SinD(90*j/10);
    9751             :   }
    9752             : 
    9753           1 :   xprof[11] = xprof[10] + kStirrC12TailLen;
    9754           1 :   yprof[11] = yprof[10];
    9755           1 :   xprof[12] = xprof[11];
    9756           1 :   yprof[12] = kStirrC12BodyHalfHi;
    9757           1 :   xprof[13] = xprof[12] - kStirrC12BodyLen;
    9758           1 :   yprof[13] = yprof[12];
    9759             : 
    9760           1 :   xprof[17] = xprof[12] - kStirrC12TotLen + kStirrC12HeadLen;
    9761           1 :   yprof[17] = kStirrC12HeadHalfHi;
    9762           2 :   IntersectCircle(-TanD(kStirrC12HeadAng), xprof[17], yprof[17],
    9763           1 :                   kStirrC12R100, xprof[13], yprof[13]+kStirrC12R100,
    9764           1 :                   xprof[16], yprof[16], xdummy, ydummy);
    9765           1 :   alpha = TMath::ASin((xprof[13]-xprof[16])/kStirrC12R100);
    9766           1 :   xprof[14] = xprof[13] - kStirrC12R100*TMath::Sin(alpha/3);
    9767           1 :   yprof[14] = yprof[13] + kStirrC12R100*(1 - TMath::Cos(alpha/3));
    9768           1 :   xprof[15] = xprof[13] - kStirrC12R100*TMath::Sin(2*alpha/3);
    9769           1 :   yprof[15] = yprof[13] + kStirrC12R100*(1 - TMath::Cos(2*alpha/3));
    9770             : 
    9771           1 :   xprof[18] = xprof[17] - kStirrC12HeadLen;
    9772           1 :   yprof[18] = yprof[17];
    9773           1 :   xprof[19] = xprof[18];
    9774           1 :   yprof[19] = kStirrC12HeadIntHi;
    9775           1 :   xprof[20] = xprof[19] + kStirrC12HeadIntLen - kStirrC12R10;
    9776           1 :   yprof[20] = yprof[19];
    9777           8 :   for (Int_t j=1; j<4; j++) {
    9778           3 :     xprof[20+j] = xprof[20] + kStirrC12R10*SinD(90*j/3);
    9779           3 :     yprof[20+j] = yprof[20] - kStirrC12R10*(1 - CosD(90*j/3));
    9780             :   }
    9781             : 
    9782             :   // We did the up side, now reflex on the bottom side
    9783          48 :   for (Int_t jp = 0; jp < kNumberOfStirrCPoints; jp++) {
    9784          23 :     xprof[24+jp] =  xprof[23-jp];
    9785          23 :     yprof[24+jp] = -yprof[23-jp];
    9786             :   }
    9787             : 
    9788             :   // Now the actual Xtru
    9789           1 :   stirrupC1C2Sh->DefinePolygon(2*kNumberOfStirrCPoints+1, xprof, yprof);
    9790           1 :   stirrupC1C2Sh->DefineSection(0,-kStirrC12Thick/2);
    9791           1 :   stirrupC1C2Sh->DefineSection(1, kStirrC12Thick/2);
    9792             : 
    9793             :   // The first element of the Stirrup on the Forward side (0872/C/05):
    9794             :   // a really complex Xtru (equal to part of the Muon Stirrup)
    9795             :   // (0872/C/06 and 0872/C/07 are dismounted after positioning the TPC to I.P.)
    9796           1 :   TGeoXtru *stirrupC5Sh = new TGeoXtru(2);
    9797             : 
    9798          28 :   for (Int_t j=0; j<13; j++) { // The internal arc and the tail
    9799          13 :     xprof[j] = stirrupC1C2Sh->GetX(j);
    9800          13 :     yprof[j] = stirrupC1C2Sh->GetY(j);
    9801             :   }
    9802             : 
    9803           1 :   xprof[13] = xprof[12] - kStirrC5BodyLen;
    9804           1 :   yprof[13] = yprof[12];
    9805             : 
    9806             :   // We did the up side, now reflex on the bottom side
    9807          28 :   for (Int_t jp = 0; jp < 13; jp++) {
    9808          13 :     xprof[14+jp] =  xprof[13-jp];
    9809          13 :     yprof[14+jp] = -yprof[13-jp];
    9810             :   }
    9811             : 
    9812             :   // Now the actual Xtru
    9813           1 :   stirrupC5Sh->DefinePolygon(27, xprof, yprof);
    9814           1 :   stirrupC5Sh->DefineSection(0,-kStirrC12Thick/2);
    9815           1 :   stirrupC5Sh->DefineSection(1, kStirrC12Thick/2);
    9816             : 
    9817             : 
    9818             :   // We have all shapes: now create the real volumes
    9819           1 :   TGeoMedium *medAlcoa   = mgr->GetMedium("ITS_ALCOAAL$");
    9820           1 :   TGeoMedium *medHokotol = mgr->GetMedium("ITS_HOKOTOL$");
    9821           1 :   TGeoMedium *medAnticor = mgr->GetMedium("ITS_ANTICORODAL$");
    9822           1 :   TGeoMedium *medErgal   = mgr->GetMedium("ITS_ERGAL$");
    9823           1 :   TGeoMedium *medAisi    = mgr->GetMedium("ITS_AISI304L$");
    9824           1 :   TGeoMedium *medAir     = mgr->GetMedium("ITS_AIR$");
    9825           1 :   TGeoMedium *medPlexy   = mgr->GetMedium("ITS_PLEXYGLAS$");
    9826           1 :   TGeoMedium *medPVC     = mgr->GetMedium("ITS_PVC$");
    9827             : 
    9828             : 
    9829           2 :   TGeoVolume *suppRingC2C3  = new TGeoVolume("ITSTPCsupportRingC2C3",
    9830           1 :                                              ringC2C3, medAlcoa);
    9831             : 
    9832           1 :   suppRingC2C3->SetVisibility(kTRUE);
    9833           1 :   suppRingC2C3->SetLineColor(6); // Purple
    9834           1 :   suppRingC2C3->SetLineWidth(1);
    9835           1 :   suppRingC2C3->SetFillColor(suppRingC2C3->GetLineColor());
    9836           1 :   suppRingC2C3->SetFillStyle(4000); // 0% transparent
    9837             : 
    9838           2 :   TGeoVolume *forwUpHook  = new TGeoVolume("ITSTPCsupportForwUpHook",
    9839           1 :                                            forwUpHookShape, medHokotol);
    9840             : 
    9841           1 :   forwUpHook->SetVisibility(kTRUE);
    9842           1 :   forwUpHook->SetLineColor(6); // Purple
    9843           1 :   forwUpHook->SetLineWidth(1);
    9844           1 :   forwUpHook->SetFillColor(forwUpHook->GetLineColor());
    9845           1 :   forwUpHook->SetFillStyle(4000); // 0% transparent
    9846             : 
    9847           2 :   TGeoVolume *forwLwHook  = new TGeoVolume("ITSTPCsupportForwLwHook",
    9848           1 :                                            forwLwHookShape, medHokotol);
    9849             : 
    9850           1 :   forwLwHook->SetVisibility(kTRUE);
    9851           1 :   forwLwHook->SetLineColor(6); // Purple
    9852           1 :   forwLwHook->SetLineWidth(1);
    9853           1 :   forwLwHook->SetFillColor(forwLwHook->GetLineColor());
    9854           1 :   forwLwHook->SetFillStyle(4000); // 0% transparent
    9855             : 
    9856           2 :   TGeoVolume *rearUpHook  = new TGeoVolume("ITSTPCsupportRearUpHook",
    9857           1 :                                            rearUpHookShape, medHokotol);
    9858             : 
    9859           1 :   rearUpHook->SetVisibility(kTRUE);
    9860           1 :   rearUpHook->SetLineColor(6); // Purple
    9861           1 :   rearUpHook->SetLineWidth(1);
    9862           1 :   rearUpHook->SetFillColor(rearUpHook->GetLineColor());
    9863           1 :   rearUpHook->SetFillStyle(4000); // 0% transparent
    9864             : 
    9865           2 :   TGeoVolume *rearLwHook  = new TGeoVolume("ITSTPCsupportRearLwHook",
    9866           1 :                                            rearLwHookShape, medAnticor);
    9867             : 
    9868           1 :   rearLwHook->SetVisibility(kTRUE);
    9869           1 :   rearLwHook->SetLineColor(6); // Purple
    9870           1 :   rearLwHook->SetLineWidth(1);
    9871           1 :   rearLwHook->SetFillColor(rearLwHook->GetLineColor());
    9872           1 :   rearLwHook->SetFillStyle(4000); // 0% transparent
    9873             : 
    9874           2 :   TGeoVolume *rearLwBrack  = new TGeoVolume("ITSTPCsupportRearLwBracket",
    9875           1 :                                             rearLwBrackShape, medAnticor);
    9876             : 
    9877           1 :   rearLwBrack->SetVisibility(kTRUE);
    9878           1 :   rearLwBrack->SetLineColor(6); // Purple
    9879           1 :   rearLwBrack->SetLineWidth(1);
    9880           1 :   rearLwBrack->SetFillColor(rearLwBrack->GetLineColor());
    9881           1 :   rearLwBrack->SetFillStyle(4000); // 0% transparent
    9882             : 
    9883           2 :   TGeoVolume *forwWebSStirrup  = new TGeoVolume("ITSTPCsupportForwWebSStirrup",
    9884           1 :                                                 forwWebSStirrSh, medAnticor);
    9885             : 
    9886           1 :   forwWebSStirrup->SetVisibility(kTRUE);
    9887           1 :   forwWebSStirrup->SetLineColor(6); // Purple
    9888           1 :   forwWebSStirrup->SetLineWidth(1);
    9889           1 :   forwWebSStirrup->SetFillColor(forwWebSStirrup->GetLineColor());
    9890           1 :   forwWebSStirrup->SetFillStyle(4000); // 0% transparent
    9891             : 
    9892           2 :   TGeoVolume *forwWebTStirr3  = new TGeoVolume("ITSTPCsupportForwWebTStirrup3",
    9893           1 :                                                forwWebTStirr3Sh, medAnticor);
    9894             : 
    9895           1 :   forwWebTStirr3->SetVisibility(kTRUE);
    9896           1 :   forwWebTStirr3->SetLineColor(6); // Purple
    9897           1 :   forwWebTStirr3->SetLineWidth(1);
    9898           1 :   forwWebTStirr3->SetFillColor(forwWebTStirr3->GetLineColor());
    9899           1 :   forwWebTStirr3->SetFillStyle(4000); // 0% transparent
    9900             : 
    9901           2 :   TGeoVolume *forwWebTStirr4  = new TGeoVolume("ITSTPCsupportForwWebTStirrup4",
    9902           1 :                                                forwWebTStirr4Sh, medAnticor);
    9903             : 
    9904           1 :   forwWebTStirr4->SetVisibility(kTRUE);
    9905           1 :   forwWebTStirr4->SetLineColor(6); // Purple
    9906           1 :   forwWebTStirr4->SetLineWidth(1);
    9907           1 :   forwWebTStirr4->SetFillColor(forwWebTStirr4->GetLineColor());
    9908           1 :   forwWebTStirr4->SetFillStyle(4000); // 0% transparent
    9909             : 
    9910           2 :   TGeoVolume *frWebClamp  = new TGeoVolume("ITSTPCsupportForwRearWebClamp",
    9911           1 :                                            frWebClampSh, medPlexy);
    9912             : 
    9913           1 :   frWebClamp->SetVisibility(kTRUE);
    9914           1 :   frWebClamp->SetLineColor(kAzure);
    9915           1 :   frWebClamp->SetLineWidth(1);
    9916           1 :   frWebClamp->SetFillColor(frWebClamp->GetLineColor());
    9917           1 :   frWebClamp->SetFillStyle(4000); // 0% transparent
    9918             : 
    9919           2 :   TGeoVolume *upWebStirrup  = new TGeoVolume("ITSTPCsupportUpperWebStirrup",
    9920           1 :                                              upWebStirrSh, medAnticor);
    9921             : 
    9922           1 :   upWebStirrup->SetVisibility(kTRUE);
    9923           1 :   upWebStirrup->SetLineColor(6); // Purple
    9924           1 :   upWebStirrup->SetLineWidth(1);
    9925           1 :   upWebStirrup->SetFillColor(upWebStirrup->GetLineColor());
    9926           1 :   upWebStirrup->SetFillStyle(4000); // 0% transparent
    9927             : 
    9928           2 :   TGeoVolume *upRearWebBar  = new TGeoVolume("ITSTPCsupportUpperRearWebBar",
    9929           1 :                                              upRearWebBarSh, medPlexy);
    9930             : 
    9931           1 :   upRearWebBar->SetVisibility(kTRUE);
    9932           1 :   upRearWebBar->SetLineColor(kAzure);
    9933           1 :   upRearWebBar->SetLineWidth(1);
    9934           1 :   upRearWebBar->SetFillColor(upRearWebBar->GetLineColor());
    9935           1 :   upRearWebBar->SetFillStyle(4000); // 0% transparent
    9936             : 
    9937           2 :   TGeoVolume *webCam  = new TGeoVolume("ITSTPCsupportWebcam",
    9938           1 :                                        webcamShape, medPVC);
    9939             : 
    9940           1 :   webCam->SetVisibility(kTRUE);
    9941           1 :   webCam->SetLineColor(kBlack);
    9942           1 :   webCam->SetLineWidth(1);
    9943           1 :   webCam->SetFillColor(webCam->GetLineColor());
    9944           1 :   webCam->SetFillStyle(4000); // 0% transparent
    9945             : 
    9946           2 :   TGeoVolume *upSlideVol  = new TGeoVolume("ITSTPCsupportUpperSlide",
    9947           1 :                                            upSlideAirSh, medAir);
    9948             : 
    9949           1 :   upSlideVol->SetVisibility(kFALSE);
    9950             : 
    9951           2 :   TGeoVolume *upSlideBlock  = new TGeoVolume("ITSTPCsupportUpperSlideBlock",
    9952           1 :                                              upSlideBlockSh, medAnticor);
    9953             : 
    9954           1 :   upSlideBlock->SetVisibility(kTRUE);
    9955           1 :   upSlideBlock->SetLineColor(6); // Purple
    9956           1 :   upSlideBlock->SetLineWidth(1);
    9957           1 :   upSlideBlock->SetFillColor(upSlideBlock->GetLineColor());
    9958           1 :   upSlideBlock->SetFillStyle(4000); // 0% transparent
    9959             : 
    9960           2 :   TGeoVolume *upSlidePin  = new TGeoVolume("ITSTPCsupportUpperSlidePin",
    9961           1 :                                            upSlidePinSh, medAisi);
    9962             : 
    9963           1 :   upSlidePin->SetVisibility(kTRUE);
    9964           1 :   upSlidePin->SetLineColor(kGray);
    9965           1 :   upSlidePin->SetLineWidth(1);
    9966           1 :   upSlidePin->SetFillColor(upSlidePin->GetLineColor());
    9967           1 :   upSlidePin->SetFillStyle(4000); // 0% transparent
    9968             : 
    9969           2 :   TGeoVolume *lwSlideVol  = new TGeoVolume("ITSTPCsupportLowerSlide",
    9970           1 :                                            lwSlideAirSh, medAir);
    9971             : 
    9972           1 :   lwSlideVol->SetVisibility(kFALSE);
    9973             : 
    9974           2 :   TGeoVolume *lwSlideBlock  = new TGeoVolume("ITSTPCsupportLowerSlideBlock",
    9975           1 :                                              lwSlideBlockSh, medAnticor);
    9976             : 
    9977           1 :   lwSlideBlock->SetVisibility(kTRUE);
    9978           1 :   lwSlideBlock->SetLineColor(6); // Purple
    9979           1 :   lwSlideBlock->SetLineWidth(1);
    9980           1 :   lwSlideBlock->SetFillColor(lwSlideBlock->GetLineColor());
    9981           1 :   lwSlideBlock->SetFillStyle(4000); // 0% transparent
    9982             : 
    9983           2 :   TGeoVolume *lwSlideNose  = new TGeoVolume("ITSTPCsupportLowerSlideNose",
    9984           1 :                                             lwSlideNoseSh, medAnticor);
    9985             : 
    9986           1 :   lwSlideNose->SetVisibility(kTRUE);
    9987           1 :   lwSlideNose->SetLineColor(6); // Purple
    9988           1 :   lwSlideNose->SetLineWidth(1);
    9989           1 :   lwSlideNose->SetFillColor(lwSlideNose->GetLineColor());
    9990           1 :   lwSlideNose->SetFillStyle(4000); // 0% transparent
    9991             : 
    9992           2 :   TGeoVolume *lwSlidePin  = new TGeoVolume("ITSTPCsupportLowerSlidePin",
    9993           1 :                                            lwSlidePinSh, medAisi);
    9994             : 
    9995           1 :   lwSlidePin->SetVisibility(kTRUE);
    9996           1 :   lwSlidePin->SetLineColor(kGray);
    9997           1 :   lwSlidePin->SetLineWidth(1);
    9998           1 :   lwSlidePin->SetFillColor(lwSlidePin->GetLineColor());
    9999           1 :   lwSlidePin->SetFillStyle(4000); // 0% transparent
   10000             : 
   10001           2 :   TGeoVolume *stirrC1C2  = new TGeoVolume("ITSTPCsupportStirrupC1C2",
   10002           1 :                                           stirrupC1C2Sh, medErgal);
   10003             : 
   10004           1 :   stirrC1C2->SetVisibility(kTRUE);
   10005           1 :   stirrC1C2->SetLineColor(6); // Purple
   10006           1 :   stirrC1C2->SetLineWidth(1);
   10007           1 :   stirrC1C2->SetFillColor(stirrC1C2->GetLineColor());
   10008           1 :   stirrC1C2->SetFillStyle(4000); // 0% transparent
   10009             : 
   10010           2 :   TGeoVolume *stirrC5  = new TGeoVolume("ITSTPCsupportStirrupC5",
   10011           1 :                                         stirrupC5Sh, medErgal);
   10012             : 
   10013           1 :   stirrC5->SetVisibility(kTRUE);
   10014           1 :   stirrC5->SetLineColor(6); // Purple
   10015           1 :   stirrC5->SetLineWidth(1);
   10016           1 :   stirrC5->SetFillColor(stirrC5->GetLineColor());
   10017           1 :   stirrC5->SetFillStyle(4000); // 0% transparent
   10018             : 
   10019             : 
   10020             :   // Build up the wheel slides
   10021           1 :   upSlideVol->AddNode(upSlideBlock,1,0);
   10022           2 :   upSlideVol->AddNode(upSlidePin,  1,
   10023           3 :                       new TGeoCombiTrans(-kUpperSlideHoleXPos, 0, 0,
   10024           2 :                                          new TGeoRotation("",0,-90,0) ) );
   10025             : 
   10026           1 :   lwSlideVol->AddNode(lwSlideBlock,1,0);
   10027           1 :   lwSlideVol->AddNode(lwSlideNose ,1,0);
   10028           2 :   lwSlideVol->AddNode(lwSlidePin,  1,
   10029           3 :                       new TGeoCombiTrans(lwSlideAluSh->GetX(5), 0, 0,
   10030           2 :                                          new TGeoRotation("",0,-90,0) ) );
   10031             : 
   10032             : 
   10033             :   // Finally put everything in the mother volume
   10034           2 :   moth->AddNode(suppRingC2C3,1,
   10035           2 :                 new TGeoTranslation(0, 0, kRingCZPos+kRingCZToTPC) );
   10036           2 :   moth->AddNode(suppRingC2C3,2,
   10037           3 :                 new TGeoCombiTrans( 0, 0,-kRingCZPos,
   10038           2 :                                    new TGeoRotation("",0.,180.,0.) ) );
   10039           2 :   moth->AddNode(suppRingC2C3,3,
   10040           3 :                 new TGeoCombiTrans( 0, 0, kRingCZPos+kRingCZToTPC,
   10041           2 :                                    new TGeoRotation("",0.,0.,180.) ) );
   10042           2 :   moth->AddNode(suppRingC2C3,4,
   10043           3 :                 new TGeoCombiTrans( 0, 0,-kRingCZPos,
   10044           2 :                                    new TGeoRotation("",0.,180.,180.) ) );
   10045             : 
   10046           1 :   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
   10047           2 :   moth->AddNode(forwUpHook,1,
   10048           2 :                 new TGeoTranslation( 0, 0, zpos) );
   10049             : 
   10050             :   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
   10051           2 :   moth->AddNode(forwLwHook,1,
   10052           3 :                 new TGeoCombiTrans( 0, 0, zpos,
   10053           2 :                                    new TGeoRotation("",0.,0.,180.) ) );
   10054             : 
   10055           1 :   zpos = kRingCZPos + kRingCThick + kRearUpHookThick;
   10056           2 :   moth->AddNode(rearUpHook,1,
   10057           2 :                 new TGeoTranslation( 0, 0,-zpos) );
   10058             : 
   10059           1 :   zpos = kRingCZPos + kRingCThick + kRearLwHookThick;
   10060           2 :   moth->AddNode(rearLwHook,1,
   10061           3 :                 new TGeoCombiTrans( 0, 0,-zpos,
   10062           2 :                                    new TGeoRotation("",0.,0.,180.) ) );
   10063             : 
   10064           1 :   xpos =  kRearLwHookWide/2 + kRearLwBracketThick/2;
   10065           1 :   ypos = -kRingCHeight;
   10066           2 :   moth->AddNode(rearLwBrack,1,
   10067           3 :                 new TGeoCombiTrans( xpos, ypos,-zpos,
   10068           2 :                                    new TGeoRotation("", 90.,-90.,-90.) ) );
   10069           2 :   moth->AddNode(rearLwBrack,2,
   10070           3 :                 new TGeoCombiTrans(-xpos, ypos,-zpos,
   10071           2 :                                    new TGeoRotation("", 90.,-90.,-90.) ) );
   10072             : 
   10073             :   xpos = kForwUpHookWide/2;
   10074           1 :   ypos = (forwUpHookMainBody->GetY(8) + forwUpHookMainBody->GetY(9))/2;
   10075             :   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
   10076           2 :   moth->AddNode(forwWebSStirrup,1,
   10077           3 :                 new TGeoCombiTrans( xpos, ypos, zpos,
   10078           2 :                                    new TGeoRotation("", 0., 90., 0.) ) );
   10079             :   xpos = kForwLwHookWide/2;
   10080           1 :   ypos = (forwLwHookMainBody->GetY(8) + forwLwHookMainBody->GetY(9))/2;
   10081           2 :   moth->AddNode(forwWebSStirrup,2,
   10082           3 :                 new TGeoCombiTrans( xpos,-ypos, zpos,
   10083           2 :                                    new TGeoRotation("", 0., 90., 0.) ) );
   10084             : 
   10085             :   xpos = kForwUpHookWide/2
   10086           1 :         + (forwWebSStirrSh->GetX(4) + forwWebSStirrSh->GetX(5))/2;
   10087           1 :   ypos = (forwUpHookMainBody->GetY(8) + forwUpHookMainBody->GetY(9))/2
   10088           1 :         +  forwWebSStirrSh->GetZ(1) - forwWebTStirr3Sh->GetY(7);
   10089           1 :   zpos += (forwWebSStirrSh->GetY(4) - forwWebSStirrSh->GetY(0));
   10090           2 :   moth->AddNode(forwWebTStirr3,1,
   10091           2 :                 new TGeoTranslation( xpos, ypos, zpos) );
   10092             : 
   10093           1 :   ypos -= frWebClampSh->GetZ(1);
   10094           2 :   moth->AddNode(frWebClamp,1,
   10095           4 :                 new TGeoCombiTrans( xpos, ypos, zpos+forwWebTStirr3Sh->GetZ(1),
   10096           2 :                                    new TGeoRotation("", 0., 90., 0.) ) );
   10097             : 
   10098           1 :   ypos -= webcamShape->GetDY()/2;
   10099           2 :   moth->AddNode(webCam,1,
   10100           3 :                 new TGeoTranslation( xpos, ypos,
   10101           3 :                      zpos+forwWebTStirr3Sh->GetZ(1)+webcamShape->GetDZ()) );
   10102             : 
   10103             :   xpos = kForwLwHookWide/2
   10104           1 :         + (forwWebSStirrSh->GetX(4) + forwWebSStirrSh->GetX(5))/2;
   10105           1 :   ypos = (forwLwHookMainBody->GetY(8) + forwLwHookMainBody->GetY(9))/2
   10106           1 :         +  forwWebSStirrSh->GetZ(1) - forwWebTStirr4Sh->GetY(7);
   10107           2 :   moth->AddNode(forwWebTStirr4,1,
   10108           3 :                 new TGeoCombiTrans( xpos,-ypos, zpos,
   10109           2 :                                    new TGeoRotation("", 180., 0., 0.) ) );
   10110             : 
   10111           1 :   ypos -= frWebClampSh->GetZ(1);
   10112           2 :   moth->AddNode(frWebClamp,2,
   10113           4 :                 new TGeoCombiTrans( xpos,-ypos, zpos+forwWebTStirr4Sh->GetZ(1),
   10114           2 :                                    new TGeoRotation("", 0., 90., 0.) ) );
   10115             : 
   10116           1 :   ypos -= webcamShape->GetDY()/2;
   10117           2 :   moth->AddNode(webCam,2,
   10118           3 :                 new TGeoTranslation( xpos,-ypos,
   10119           3 :                      zpos+forwWebTStirr4Sh->GetZ(1)+webcamShape->GetDZ()) );
   10120             : 
   10121             :   xpos = kRearUpHookWide/2 + kRearUpWebStirrDep/2;
   10122             :   ypos = kRingCHeight;
   10123             :   zpos = kRingCZPos + kRingCThick;
   10124           2 :   moth->AddNode(upWebStirrup,1,
   10125           3 :                 new TGeoCombiTrans( xpos, ypos,-zpos,
   10126           2 :                                    new TGeoRotation("",-90.,-90., 90.) ) );
   10127           2 :   moth->AddNode(upWebStirrup,2,
   10128           3 :                 new TGeoCombiTrans(-xpos, ypos,-zpos,
   10129           2 :                                    new TGeoRotation("",-90.,-90., 90.) ) );
   10130             : 
   10131           1 :   ypos = kRingCHeight + upWebStirrSh->GetY(2) - upRearWebBarSh->GetDY();
   10132           1 :   zpos = kRingCZPos + kRingCThick + upWebStirrSh->GetX(3)
   10133           1 :        - upRearWebBarSh->GetDZ();
   10134           2 :   moth->AddNode(upRearWebBar,1,
   10135           2 :                 new TGeoTranslation( 0, ypos,-zpos) );
   10136             : 
   10137           1 :   zpos -= upRearWebBarSh->GetDZ();
   10138           2 :   moth->AddNode(frWebClamp,3,
   10139           3 :                 new TGeoCombiTrans( 0, ypos,-zpos,
   10140           2 :                                    new TGeoRotation("", 0., 90., 0.) ) );
   10141             : 
   10142           1 :   ypos -= webcamShape->GetDY()/2;
   10143           1 :   zpos -= webcamShape->GetDZ();
   10144           2 :   moth->AddNode(webCam,3,
   10145           2 :                 new TGeoTranslation( 0, ypos,-zpos) );
   10146             : 
   10147           1 :   xpos = ringC2C3->GetX(14) + kUpperSlideWidth/2;
   10148           1 :   ypos = ringC2C3->GetY(14);
   10149             :   zpos = kRingCZPos + kRingCThick;
   10150           2 :   moth->AddNode(upSlideVol,1,
   10151           3 :                 new TGeoCombiTrans( xpos, ypos, zpos + kRingCZToTPC,
   10152           2 :                                    new TGeoRotation("",-90.,-90., 90.) ) );
   10153           2 :   moth->AddNode(upSlideVol,2,
   10154           3 :                 new TGeoCombiTrans(-xpos, ypos, zpos + kRingCZToTPC,
   10155           2 :                                    new TGeoRotation("",-90.,-90., 90.) ) );
   10156           2 :   moth->AddNode(upSlideVol,3,
   10157           3 :                 new TGeoCombiTrans( xpos, ypos, -zpos,
   10158           2 :                                    new TGeoRotation("", 90.,-90.,-90.) ) );
   10159           2 :   moth->AddNode(upSlideVol,4,
   10160           3 :                 new TGeoCombiTrans(-xpos, ypos, -zpos,
   10161           2 :                                    new TGeoRotation("", 90.,-90.,-90.) ) );
   10162             : 
   10163           2 :   moth->AddNode(lwSlideVol,1,
   10164           3 :                 new TGeoCombiTrans( xpos,-ypos, zpos + kRingCZToTPC,
   10165           2 :                                    new TGeoRotation("", 90.,-90., 90.) ) );
   10166           2 :   moth->AddNode(lwSlideVol,2,
   10167           3 :                 new TGeoCombiTrans(-xpos,-ypos, zpos + kRingCZToTPC,
   10168           2 :                                    new TGeoRotation("", 90.,-90., 90.) ) );
   10169           2 :   moth->AddNode(lwSlideVol,3,
   10170           3 :                 new TGeoCombiTrans( xpos,-ypos,-zpos,
   10171           2 :                                    new TGeoRotation("",-90.,-90.,-90.) ) );
   10172           2 :   moth->AddNode(lwSlideVol,4,
   10173           3 :                 new TGeoCombiTrans(-xpos,-ypos,-zpos,
   10174           2 :                                    new TGeoRotation("",-90.,-90.,-90.) ) );
   10175             : 
   10176             :   xpos = kStirrCXPos;
   10177           1 :   zpos = kRingCZPos + kStirrCZPos + stirrupC1C2Sh->GetZ(1) + kRingCZToTPC;
   10178           2 :   moth->AddNode(stirrC1C2,1,
   10179           2 :                 new TGeoTranslation( xpos, 0, zpos) );
   10180           2 :   moth->AddNode(stirrC1C2,2,
   10181           3 :                 new TGeoCombiTrans(-xpos, 0, zpos,
   10182           2 :                                    new TGeoRotation("", 90.,-180.,-90.) ) );
   10183             : 
   10184           1 :   xpos = kStirrCXPos + stirrupC1C2Sh->GetX(18) + kUpperSlideWidth/2;
   10185           1 :   ypos = ringC2C3->GetY(14); // Slides are all at the same height
   10186           1 :   zpos = kRingCZPos + kStirrCZPos + kStirrC12Thick + kRingCZToTPC;
   10187           2 :   moth->AddNode(upSlideVol,5,
   10188           3 :                 new TGeoCombiTrans( xpos, ypos, zpos,
   10189           2 :                                    new TGeoRotation("",-90.,-90., 90.) ) );
   10190           2 :   moth->AddNode(upSlideVol,6,
   10191           3 :                 new TGeoCombiTrans(-xpos, ypos, zpos,
   10192           2 :                                    new TGeoRotation("",-90.,-90., 90.) ) );
   10193           2 :   moth->AddNode(lwSlideVol,5,
   10194           3 :                 new TGeoCombiTrans( xpos,-ypos, zpos,
   10195           2 :                                    new TGeoRotation("", 90.,-90., 90.) ) );
   10196           2 :   moth->AddNode(lwSlideVol,6,
   10197           3 :                 new TGeoCombiTrans(-xpos,-ypos, zpos,
   10198           2 :                                    new TGeoRotation("", 90.,-90., 90.) ) );
   10199             : 
   10200             :   xpos = kStirrCXPos;
   10201           1 :   zpos = kRingCZPos + kStirrCZPos + stirrupC5Sh->GetZ(1);
   10202           2 :   moth->AddNode(stirrC5,1,
   10203           2 :                 new TGeoTranslation( xpos, 0,-zpos) );
   10204           2 :   moth->AddNode(stirrC5,2,
   10205           3 :                 new TGeoCombiTrans(-xpos, 0,-zpos,
   10206           2 :                                    new TGeoRotation("", 90.,-180.,-90.) ) );
   10207             : 
   10208             : 
   10209             :   return;
   10210           1 : }
   10211             : 

Generated by: LCOV version 1.11