8239600729128aa64ed72c85dd099ac5ec6f3050
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySSD.cxx
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
17 //*************************************************************************
18 // SSD geometry, based on ROOT geometrical modeler
19 //
20 // Enrico Cattaruzza                                    ecattar@ts.infn.it
21 //*************************************************************************
22 #include "TMath.h"
23 #include "TGeoVolume.h"
24 #include "TGeoMedium.h"
25 #include "TGeoMatrix.h"
26 #include <TGeoManager.h>
27 #include "AliITSv11GeometrySSD.h"
28 #include "TVector3.h"
29 #include "TGeoArb8.h"
30 #include "TList.h"
31 #include "TGeoMatrix.h"
32 #include "TGeoCompositeShape.h"
33 #include "TGeoTube.h"
34 #include "TGeoBBox.h"
35 #include "TGeoTrd1.h"
36 #include <iostream>
37 using namespace std;
38 /////////////////////////////////////////////////////////////////////////////////
39 //Parameters for SSD Geometry
40 /////////////////////////////////////////////////////////////////////////////////
41 // Layer5 (lengths are in mm and angles in degrees)
42 /////////////////////////////////////////////////////////////////////////////////
43 const Double_t AliITSv11GeometrySSD::fgkSSDLay5LadderLength      = 950.7;
44 const Int_t AliITSv11GeometrySSD::fgkSSDLay5SensorsNumber        =  22;
45 const Int_t AliITSv11GeometrySSD::fgkSSDLay5LadderNumber         =  34;
46 const Double_t AliITSv11GeometrySSD::fgkSSDLay5RadiusMin         = 378.0;
47 const Double_t AliITSv11GeometrySSD::fgkSSDLay5RadiusMax         = 384.0;
48 const Double_t AliITSv11GeometrySSD::fgkLay5CenterITSPosition    = 467.85;
49 /////////////////////////////////////////////////////////////////////////////////
50 // Layer6 (lengths are in mm and angles in degrees)
51 /////////////////////////////////////////////////////////////////////////////////
52 const Double_t AliITSv11GeometrySSD::fgkSSDLay6LadderLength      = 1068.0;
53 const Int_t AliITSv11GeometrySSD::fgkSSDLay6SensorsNumber        =   25;
54 const Int_t AliITSv11GeometrySSD::fgkSSDLay6LadderNumber         =   38;
55 const Double_t AliITSv11GeometrySSD::fgkSSDLay6RadiusMin         =  428.0;
56 const Double_t AliITSv11GeometrySSD::fgkSSDLay6RadiusMax         =  434.0;
57 const Double_t AliITSv11GeometrySSD::fgkLay6CenterITSPosition    = 526.50;
58 /////////////////////////////////////////////////////////////////////////////////
59 // SSD Chips and Hybrid (lengths are in mm and angles in degrees)
60 /////////////////////////////////////////////////////////////////////////////////
61 const Int_t AliITSv11GeometrySSD::fgkSSDChipNumber               =   6;
62 const Double_t AliITSv11GeometrySSD::fgkSSDChipLength            =  11.100; 
63 const Double_t AliITSv11GeometrySSD::fgkSSDChipWidth             =   3.850;
64 const Double_t AliITSv11GeometrySSD::fgkSSDChipHeight            =   0.180;
65 const Double_t AliITSv11GeometrySSD::fgkSSDChipSeparationLength  =   1.000;
66 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueLength        =   fgkSSDChipLength;
67 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueWidth         =   fgkSSDChipWidth;
68 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueHeight        =   0.030;
69 /////////////////////////////////////////////////////////////////////////////////
70 // Stiffener (lengths are in mm and angles in degrees)
71 /////////////////////////////////////////////////////////////////////////////////
72 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerLength       =  73.000;
73 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerWidth        =   6.500;
74 //const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerHeight       =   3.315;
75 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerHeight       =   0.315;
76 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerToChipDist   =   2.500;
77 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Length   =   1.600;
78 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Width    =   0.870;
79 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Height   =   0.800;
80 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Length   =   4.600;
81 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Width    =   3.400;
82 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Height   =   1.400;
83 const Double_t AliITSv11GeometrySSD::fgkSSDWireLength            =  30.000;
84 const Double_t AliITSv11GeometrySSD::fgkSSDWireRadius            =   0.185;
85 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorPosition[2]  = {44.32, 0.33};
86 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorSeparation   = 0.44;
87 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorLength       = 2.16;
88 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorWidth        = 3.60;
89 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorHeight       = 
90                                                                                                           0.25*fgkSSDStiffenerHeight;
91 /////////////////////////////////////////////////////////////////////////////////
92 // Cooling Block (lengths are in mm and angles in degrees)
93 /////////////////////////////////////////////////////////////////////////////////
94 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockLength    =   3.000;
95 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockWidth     =   4.000;
96 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHeight[3] = 
97                                                                                                          {1.950, 0.240, 0.300};
98 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleRadius[2] = 
99                                                                                                                     {1.000, 0.120};
100 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleLength[2] = 
101                                                                                                                         {1.900, 0.400};
102 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleCenter    =  
103                                                                                                                                          1.500;
104 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleHeight    =  
105                                                                                                                                          0.300;
106 /////////////////////////////////////////////////////////////////////////////////
107 // SSD Sensor (lengths are in mm and angles in degrees)
108 /////////////////////////////////////////////////////////////////////////////////
109 const char*  AliITSv11GeometrySSD::fgkSSDSensitiveVolName       = 
110                                                           "SSDSensorSensitiveVol";
111 const Double_t AliITSv11GeometrySSD::fgkSSDSensorLength          =  42.000;
112 const Double_t AliITSv11GeometrySSD::fgkSSDSensorHeight          =   0.300;
113 const Double_t AliITSv11GeometrySSD::fgkSSDSensorWidth           =  75.000;
114 const Double_t AliITSv11GeometrySSD::fgkSSDSensorOverlap         = 
115                                                                                                    fgkSSDSensorLength-39.1;
116 const Double_t AliITSv11GeometrySSD::fgkSSDSensorInsensitiveLength      = 1.; 
117 const Double_t AliITSv11GeometrySSD::fgkSSDSensorInsensitiveWidth       = 1.;
118 /////////////////////////////////////////////////////////////////////////////////
119 // Flex (lengths are in mm and angles in degrees)
120 /////////////////////////////////////////////////////////////////////////////////
121 const Double_t AliITSv11GeometrySSD::fgkSSDFlexFullLength       =  106.000; 
122 const Double_t AliITSv11GeometrySSD::fgkSSDFlexLength[4]        = 
123                         {0.5*(fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
124                                                 +(fgkSSDChipNumber-1)*fgkSSDChipSeparationLength),
125                          0.5*(fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
126                                                 +(fgkSSDChipNumber-1)*fgkSSDChipSeparationLength)-4.000,
127                                                   9.500, 10.000};
128 const Double_t AliITSv11GeometrySSD::fgkSSDFlexWidth[2]         = 
129                                                                                                                  {  9.340,  5.380};
130 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHeight[2]        =
131                                                                                                                  {  0.030,  0.020};      
132 const Double_t AliITSv11GeometrySSD::fgkSSDFlexAngle            =   30.000;
133 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHoleLength       =    1.430;
134 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHoleWidth        =    3.000;
135 const Double_t AliITSv11GeometrySSD::fgkSSDEndFlexCompLength[6] = 
136                                                                                    {3.30,4.12,4.22,1.70,0.75,7.18};
137 const Double_t AliITSv11GeometrySSD:: fgkSSDEndFlexCompWidth[3] =
138                                                                                                            {15.03,23.48,12.28};
139 /////////////////////////////////////////////////////////////////////////////////
140 // SSD Ladder Cable (lengths are in mm and angles in degrees)
141 /////////////////////////////////////////////////////////////////////////////////
142 const Double_t AliITSv11GeometrySSD::fgkSSDLadderCableWidth     =   23.5;
143 const Double_t AliITSv11GeometrySSD::fgkSSDEndLadderCableLength =   50.000; /////to be modified
144 /////////////////////////////////////////////////////////////////////////////////
145 // SSD Module (lengths are in mm and angles in degrees)
146 /////////////////////////////////////////////////////////////////////////////////
147 const Double_t AliITSv11GeometrySSD::fgkSSDModuleStiffenerPosition[2]  = 
148                                                                                                                    { 1.000, 3.900};
149 const Double_t AliITSv11GeometrySSD::fgkSSDModuleSensorSupportDistance =  
150                                                                                                                                         45.600;
151 const Double_t AliITSv11GeometrySSD::fgkSSDModuleCoolingBlockToSensor  =  
152                                                                                                                                          5.075;
153 /////////////////////////////////////////////////////////////////////////////////
154 // Sensor Support (lengths are in mm and angles in degrees)
155 /////////////////////////////////////////////////////////////////////////////////
156 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportLength                 = 
157                                                                                                                                            5.800;
158 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportWidth          =  
159                                                                                                                                            2.000;
160 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportHeight[2]      =
161                                                                                                                      { 4.620, 5.180};
162 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportThickness[2] = 
163                                                                                                                      { 0.450, 0.450};
164 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportPosition       =  
165                                                                           0.5*(fgkSSDModuleSensorSupportDistance
166                                                                +    fgkSSDSensorSideSupportThickness[0])
167                                                                    -           fgkSSDSensorSideSupportLength;
168 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportLength       =  
169                                                                                                                                            5.250;
170 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportWidth        =
171                                                                                                                                        1.680;
172 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportHeight[2]    =
173            {fgkSSDSensorSideSupportHeight[0]+fgkSSDSensorSideSupportThickness[0],
174            fgkSSDSensorSideSupportHeight[1]+fgkSSDSensorSideSupportThickness[1]};
175 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportThickness[2] =
176    {fgkSSDSensorSideSupportThickness[0],fgkSSDSensorSideSupportThickness[1]};
177 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportPosition     = 
178                                                                                                                                       19.000;
179 /////////////////////////////////////////////////////////////////////////////////
180 // Chip Cables (lengths are in mm and angles in degrees)
181 /////////////////////////////////////////////////////////////////////////////////
182 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesLength[2]   = 
183                                                  {73.12/fgkSSDChipNumber,fgkSSDChipLength+2.*0.19};
184 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesHeight[4]   = 
185                                                 {  0.014,  0.010, fgkSSDModuleCoolingBlockToSensor
186   -  (fgkSSDSensorSideSupportHeight[1]-fgkSSDSensorSideSupportHeight[0])
187   -   fgkSSDCoolingBlockHoleCenter-fgkSSDStiffenerHeight
188   -   fgkSSDChipHeight-fgkSSDSensorHeight,
189       fgkSSDModuleCoolingBlockToSensor
190   -   fgkSSDCoolingBlockHoleCenter-fgkSSDStiffenerHeight
191   -   fgkSSDChipHeight-fgkSSDSensorHeight};
192 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesWidth[3]    = 
193                                                                                                  { 11.000,  0.800,  0.600};
194 /////////////////////////////////////////////////////////////////////////////////
195 // Carbon Fiber Junction Parameters (lengths are in mm and angles in degrees)
196 /////////////////////////////////////////////////////////////////////////////////
197 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionLength          = 
198                                                                                                                                            3.820;
199 //const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionLength          = 
200 //                                                                                                                                         3.780;
201 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionWidth           = 
202                                                                           fgkSSDSensorLength-fgkSSDSensorOverlap;
203 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionEdge[2]         = 
204                                                                                                                          {  0.86,  0.30};
205 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionAngle[2]        = 
206                                                                                                                          { 30.00, 90.00};
207 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionToSensorSupport = 
208                                                                                                                                             1.78;
209 /////////////////////////////////////////////////////////////////////////////////
210 //Carbon Fiber Parameters (lengths are in mm and angles in degrees)
211 /////////////////////////////////////////////////////////////////////////////////
212 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberTriangleLength          = 
213   fgkSSDModuleSensorSupportDistance-2.*fgkCarbonFiberJunctionToSensorSupport;  
214 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberTriangleAngle           = 
215                                                                                                                                            60.00;
216 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportTopEdgeDist[2]   = 
217                                                                                                                    {  0.751,  0.482};
218 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportEdgeLength       =  
219                                                                                                                                            1.630;
220 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportWidth            = 
221                                                                                                                                            0.950;
222 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportXAxisLength      = 
223              fgkCarbonFiberTriangleLength-0.5*fgkCarbonFiberSupportTopEdgeDist[1]
224                      / TMath::Cos(fgkCarbonFiberTriangleAngle*TMath::DegToRad());
225 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportYAxisLength      = 
226                                   0.5*(fgkCarbonFiberJunctionWidth-fgkCarbonFiberSupportWidth)
227                          - fgkCarbonFiberSupportTopEdgeDist[0]-fgkCarbonFiberSupportWidth;
228 /////////////////////////////////////////////////////////////////////////////////
229 // Carbon Fiber Lower Support Parameters (lengths are in mm)
230 /////////////////////////////////////////////////////////////////////////////////
231 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportWidth             
232                                                                                                                                           =  0.950;
233 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportLowerLenght       
234                                                                                                                                           =  1.600;
235 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportHeight            
236                                                                                                                                           =  0.830;
237 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportVolumeSeparation  
238                                                                                           = 0.5*fgkCarbonFiberSupportWidth;
239 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportTransverseWidth   
240                                                                  = fgkCarbonFiberJunctionWidth
241                                  - 2.*(fgkCarbonFiberLowerSupportWidth
242                                                                  + fgkCarbonFiberLowerSupportVolumeSeparation);
243 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportVolumePosition[2] 
244                                                                  = {fgkCarbonFiberLowerSupportWidth
245                                                                  +  fgkCarbonFiberLowerSupportVolumeSeparation,
246                                                                         fgkCarbonFiberLowerSupportWidth
247                                                                  +  fgkCarbonFiberLowerSupportVolumeSeparation                                                  
248                                                                  +  fgkCarbonFiberLowerSupportTransverseWidth};
249 /////////////////////////////////////////////////////////////////////////////////
250 // End Ladder Carbon Fiber Junction Parameters (lengths are in mm and angles in degrees)
251 /////////////////////////////////////////////////////////////////////////////////
252 const Double_t AliITSv11GeometrySSD::fgkEndLadderCarbonFiberLowerJunctionLength[2] = 
253   {0.5*(fgkSSDLay5LadderLength
254           -fgkSSDLay5SensorsNumber*fgkCarbonFiberJunctionWidth
255           -fgkCarbonFiberLowerSupportWidth),
256        0.5*(fgkSSDLay5LadderLength
257           -fgkSSDLay5SensorsNumber*fgkCarbonFiberJunctionWidth
258           +fgkCarbonFiberLowerSupportWidth)};
259 const Double_t AliITSv11GeometrySSD::fgkEndLadderCarbonFiberUpperJunctionLength[2] = 
260                 {fgkEndLadderCarbonFiberLowerJunctionLength[0]-20.4,
261                  fgkEndLadderCarbonFiberLowerJunctionLength[1]-20.6};
262 const Double_t AliITSv11GeometrySSD::fgkEndLadderMountingBlockPosition[2] = 
263                                                    {fgkEndLadderCarbonFiberLowerJunctionLength[0]-16.50,
264                                                    fgkEndLadderCarbonFiberLowerJunctionLength[1]-31.50};
265 /////////////////////////////////////////////////////////////////////////////////
266 // Cooling Tube Support (lengths are in mm and angles in degrees)
267 /////////////////////////////////////////////////////////////////////////////////
268 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportRmax          =  1.45;
269 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportRmin          
270                                                                                           = fgkSSDCoolingBlockHoleRadius[0];
271 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportLength        =  8.55;
272 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportHeight        =  0.85;
273 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportWidth         =  2.00;
274 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportSeparation    = 
275                                       fgkSSDSensorLength-2.*fgkSSDSensorOverlap;
276 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportToCarbonFiber = 11.70;
277 /////////////////////////////////////////////////////////////////////////////////
278 // Cooling Tube (lengths are in mm and angles in degrees)
279 /////////////////////////////////////////////////////////////////////////////////
280 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeRmax       = 
281                                                                                                           fgkCoolingTubeSupportRmin;
282 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeRmin       =  0.96;
283 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeLength     = 
284                                                                                                         fgkCarbonFiberJunctionWidth;
285 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSeparation = 
286                                         fgkSSDModuleSensorSupportDistance+fgkSSDCoolingBlockLength;
287 //const Double_t AliITSv11GeometrySSD_ct::fgkCoolingTubeLength               =  39.1;
288 /////////////////////////////////////////////////////////////////////////////////
289 // SSD Mounting Block Parameters (lengths are in mm and angles in degrees)
290 /////////////////////////////////////////////////////////////////////////////////
291 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockLength[3]            = 
292                                                                                                                         { 60.0, 42.2, 34.0};
293 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHeight[4]            =
294                                                                                                           {  4.0,  8.0,  5.0,  0.2};
295 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockWidth                =   
296                                                                                                                                                    20.0;
297 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidAngle   =   
298                                                                                                                                                    40.0;
299 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidHeight  = 
300                    0.30*(fgkSSDMountingBlockHeight[1]-fgkSSDMountingBlockHeight[2]);
301 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidUpBasis =    
302                                                                                                                                                         2.5;
303 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTubeLength[2]    = 
304                                                                                                                                   { 56.0, 12.0}; 
305 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTubeWidth[2]     = 
306                                                                                                                                   {  5.0,  2.9}; 
307 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleRadius           = 
308                                                                                                                                                         1.0;
309 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleEdge        =   
310                                                                                                                                                         6.0;
311 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleHeigth      =  
312                                                                                                                                                         4.0;
313 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleRadius[2]   =
314                                                                         {  1.5,fgkSSDMountingBlockScrewHoleEdge/6.};
315 /////////////////////////////////////////////////////////////////////////////////
316 AliITSv11GeometrySSD::AliITSv11GeometrySSD(){           
317   ///////////////////////////////// 
318   // Standard Default Constructor
319   ///////////////////////////////// 
320   // Initializing display colors  
321   ////////////////////////////// 
322   fColorCarbonFiber =  4;
323   fColorRyton       =  5;
324   fColorPhynox      =  5;
325   fColorSilicon     =  3;
326   fColorAl          =  7;
327   fColorKapton      =  6;
328   fColorPolyhamide  =  5;
329   fColorStiffener   =  9;
330   fColorEpoxy       = 30;
331   CreateMaterials();
332 }
333 /////////////////////////////////////////////////////////////////////////////////
334 // Setting the transformation Matrices
335 /////////////////////////////////////////////////////////////////////////////////
336 void AliITSv11GeometrySSD::SetSSDSensorSupportCombiTransMatrix(){
337   ////////////////////////////////////////////////////////
338   //Translation Parameters SSDSensorSupportAssembly:
339   ////////////////////////////////////////////////////////
340   const Double_t SSDSensorSupportTransX[3] = {-0.5*fgkSSDSensorSideSupportWidth,
341                                                                    0.5*fgkSSDSensorSideSupportWidth,
342                                                            0.5*fgkSSDSensorCenterSupportThickness[0]
343                                                                           -    fgkSSDSensorCenterSupportPosition}; 
344   const Double_t SSDSensorSupportTransY[3] = 
345                                                                            {0.5*fgkSSDSensorSideSupportThickness[0],
346                                                            -0.5*fgkSSDSensorSideSupportThickness[0]
347                                                                -fgkSSDModuleSensorSupportDistance,
348                                                             0.5*fgkSSDSensorCenterSupportWidth
349                                                                            -0.5*fgkSSDModuleSensorSupportDistance}; 
350   const Double_t SSDSensorSupportTransZ[3] = {0.,0.,
351                                                                                 fgkSSDSensorCenterSupportThickness[0]}; 
352   ////////////////////////////////////////////////////////
353   //Rotational Parameters SSDSensorSupportAssembly:
354   ////////////////////////////////////////////////////////  
355   const Double_t SSDSensorSupportRotPhi[3]   = {   0., 180., 270.};
356   const Double_t SSDSensorSupportRotTheta[3] = {  90.,  90.,  90.};
357   const Double_t SSDSensorSupportRotPsi[3]   = {- 90.,- 90.,- 90.};
358   ////////////////////////////////////////////////////////////////
359   //Name of CombiTrans Transformation of SSDSensorSupportAssembly:
360   ////////////////////////////////////////////////////////////////
361   char SSDSensorSupportCombiTransName[40];
362   char SSDSensorSupportRotName[40];
363   TGeoCombiTrans *SSDSensorSupportLocalMatrix[fgkSSDSensorSupportCombiTransNumber];
364   for(Int_t i=0; i<fgkSSDSensorSupportCombiTransNumber; i++){ 
365                 sprintf(SSDSensorSupportCombiTransName,"SSDSensorSupportCombiTrans%i",i);
366                 sprintf(SSDSensorSupportRotName,"SSDSensorSupportRot%i",i);
367                 SSDSensorSupportLocalMatrix[i] =
368                                  new TGeoCombiTrans(SSDSensorSupportCombiTransName,
369                                                                         SSDSensorSupportTransX[i],
370                                                                         SSDSensorSupportTransY[i],
371                                                                         SSDSensorSupportTransZ[i],
372                                                                         new TGeoRotation(SSDSensorSupportRotName,
373                                                                                                           SSDSensorSupportRotPhi[i],
374                                                                                                         SSDSensorSupportRotTheta[i],
375                                                                                                     SSDSensorSupportRotPsi[i]));
376            SSDSensorSupportCombiTransMatrix[i] = SSDSensorSupportLocalMatrix[i];
377   }
378 }
379 /////////////////////////////////////////////////////////////////////////////////
380 void AliITSv11GeometrySSD::SetSSDModuleCombiTransMatrix(Double_t SSDChipCablesHeigth){
381 /////////////////////////////////////////////////////////////////////////////////
382 //Translation Parameters SSDModuleAssembly:
383 ////////////////////////////////////////////////////////
384   const Double_t SSDModuleTransX[7] = {0.5*fgkSSDStiffenerLength,
385                                                  0.5*fgkSSDChipLength+0.5*(fgkSSDStiffenerLength
386                                        - (fgkSSDChipNumber*fgkSSDChipLength+(fgkSSDChipNumber-1)
387                                            * fgkSSDChipSeparationLength)),
388                                        - fgkSSDModuleStiffenerPosition[0]+0.5*fgkSSDSensorWidth,
389                                    0.5*(fgkSSDStiffenerLength-fgkSSDChipNumber*fgkSSDChipLength
390                                            -       (fgkSSDChipNumber-1)*fgkSSDChipSeparationLength),
391                                 0.5*fgkSSDStiffenerLength-0.5*fgkSSDModuleSensorSupportDistance
392                            - fgkSSDCoolingBlockLength,
393                                 0.5*(fgkSSDStiffenerLength+fgkSSDChipCablesLength[1]
394                            + (fgkSSDChipNumber-1)*fgkSSDChipCablesLength[0]),
395                                 0.5*(fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
396                            +(fgkSSDChipNumber-1)*fgkSSDChipSeparationLength)}; 
397   const Double_t SSDModuleTransY[7] = {0.5*fgkSSDStiffenerWidth,
398                                        0.5*fgkSSDChipWidth+(fgkSSDStiffenerWidth
399                                          - fgkSSDStiffenerToChipDist-fgkSSDChipWidth),
400                                      - fgkSSDModuleStiffenerPosition[1]+0.5*fgkSSDSensorLength,
401                                        fgkSSDStiffenerWidth,
402                                        0.,
403                                        fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
404                                          - fgkSSDStiffenerWidth
405                                      + fgkSSDStiffenerToChipDist+fgkSSDChipWidth,
406                                        fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
407                                          - fgkSSDStiffenerWidth}; 
408   const Double_t SSDModuleTransZ[7] = {0.5*fgkSSDStiffenerHeight,
409                                      - 0.5*fgkSSDChipHeight,
410                                        0.5*fgkSSDSensorHeight-fgkSSDStiffenerHeight-fgkSSDChipHeight
411                                          - SSDChipCablesHeigth,
412                                      - 0.5*fgkSSDFlexHeight[0],
413                                        fgkSSDStiffenerHeight,
414                                      - fgkSSDChipHeight,
415                                      - 0.5*fgkSSDChipHeight}; 
416   ////////////////////////////////////////////////////////
417   //Rotational Parameters SSDModuleAssembly:
418   ////////////////////////////////////////////////////////  
419   const Double_t SSDModuleRotPhi[7]   = {   0.,   0.,  90.,   0.,   0.,  90., 180.};
420   const Double_t SSDModuleRotTheta[7] = {   0.,   0.,   0.,   0.,   0.,   0.,   0.};
421   const Double_t SSDModuleRotPsi[7]   = {   0.,   0.,   0.,   0.,   0.,   0.,   0.};
422   ////////////////////////////////////////////////////////  
423   //Name of CombiTrans Transformation of SSDModuleAssembly:
424   ////////////////////////////////////////////////////////  
425   const char* SSDModuleCombiTransName[7] = {"SSDStiffenerCombiTrans",
426                                                                                              "SSDChipCombiTrans",
427                                                                                            "SSDSensorCombiTrans",
428                                                                                             "SSDFlex0CombiTrans",
429                                                                                  "SSDCoolingBlockCombiTrans",
430                                                                                    "SSDChipCablesCombiTrans",
431                                                                                         "SSDFlex1CombiTrans"};
432   const char* SSDModuleRotName[7] = {"SSDStiffenerRotName",
433                                                                                   "SSDChipRotName",
434                                                                                 "SSDSensorRotName",
435                                                                                  "SSDFlex0RotName",
436                                                                   "SSDCoolingBlockRotName",
437                                                                         "SSDChipCablesRotName",
438                                                                                 "SSDFlex1RotName"};
439   TGeoCombiTrans *SSDModuleLocalMatrix[fgkSSDModuleCombiTransNumber];
440   for(Int_t i=0; i<fgkSSDModuleCombiTransNumber; i++){ 
441                                         SSDModuleLocalMatrix[i] =
442                                         new TGeoCombiTrans(SSDModuleCombiTransName[i],
443                                                                            SSDModuleTransX[i],
444                                                                            SSDModuleTransY[i],
445                                                                            SSDModuleTransZ[i],
446                                                                            new TGeoRotation(SSDModuleRotName[i],
447                                                                                                                 SSDModuleRotPhi[i],
448                                                                                                         SSDModuleRotTheta[i],
449                                                                                                         SSDModuleRotPsi[i]));
450     SSDModuleCombiTransMatrix[i] = SSDModuleLocalMatrix[i];
451   }
452 }
453 /////////////////////////////////////////////////////////////////////////////////
454 void AliITSv11GeometrySSD::SetCarbonFiberJunctionCombiTransMatrix(){
455 /////////////////////////////////////////////////////////////////////////////////
456   //Translation Parameters CarbonFiberJunction:
457   ////////////////////////////////////////////////////////
458   const Double_t CarbonFiberJunctionTransX[3] = 
459                                 {  0.0,fgkCarbonFiberTriangleLength,fgkCarbonFiberTriangleLength
460                                  * TMath::Cos(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
461   const Double_t CarbonFiberJunctionTransY[3] = 
462                                                                           {  0.0, 0.0,fgkCarbonFiberTriangleLength
463                                  *   TMath::Sin(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
464   const Double_t CarbonFiberJunctionTransZ[3] = {  0.0,  0.0,  0.0};
465   ////////////////////////////////////////////////////////
466   //Rotational Parameters CarbonFiberJunction:
467   ////////////////////////////////////////////////////////
468   const Double_t CarbonFiberJunctionRotPhi[3]   = {   0., 120., 240.};
469   const Double_t CarbonFiberJunctionRotTheta[3] = {   0.,   0.,   0.};
470   const Double_t CarbonFiberJunctionRotPsi[3]   = {   0.,   0.,   0.};
471   ///////////////////////////////////////////////////////////
472   //Name of CombiTrans Transformation of CarbonFiberJunction:
473   ///////////////////////////////////////////////////////////
474   char CarbonFiberJunctionCombiTransName[40];
475   char CarbonFiberJunctionRotName[40];
476   TGeoCombiTrans *CarbonFiberJunctionLocalMatrix[fgkCarbonFiberJunctionCombiTransNumber];
477   for(Int_t i=0; i<fgkCarbonFiberJunctionCombiTransNumber; i++) {
478                 sprintf(CarbonFiberJunctionCombiTransName,"CarbonFiberJunctionCombiTrans%i",i);
479                 sprintf(CarbonFiberJunctionRotName,"CarbonFiberJunctionRot%i",i);
480                 CarbonFiberJunctionLocalMatrix[i] =
481                                         new TGeoCombiTrans(CarbonFiberJunctionCombiTransName,
482                                                                            CarbonFiberJunctionTransX[i],
483                                                                            CarbonFiberJunctionTransY[i],
484                                                                            CarbonFiberJunctionTransZ[i],
485                                                                 new TGeoRotation(CarbonFiberJunctionRotName,
486                                                                                                 CarbonFiberJunctionRotPhi[i],
487                                                                                                 CarbonFiberJunctionRotTheta[i],
488                                                                                                 CarbonFiberJunctionRotPsi[i]));
489     CarbonFiberJunctionCombiTransMatrix[i] = CarbonFiberJunctionLocalMatrix[i];
490   }
491 }
492 /////////////////////////////////////////////////////////////////////////////////
493 void AliITSv11GeometrySSD::SetEndLadderCarbonFiberJunctionCombiTransMatrix(Int_t i){
494 /////////////////////////////////////////////////////////////////////////////////
495   //Translation Parameters EndLadderCarbonFiberJunction:
496   ////////////////////////////////////////////////////////
497   const Double_t EndLadderCarbonFiberJunctionTransX[3] = 
498                                 {  0.0,fgkCarbonFiberTriangleLength,fgkCarbonFiberTriangleLength
499                 *            TMath::Cos(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
500   const Double_t EndLadderCarbonFiberJunctionTransY[3] = 
501                                                                                 {  0.0, 0.0,fgkCarbonFiberTriangleLength
502                 *            TMath::Sin(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
503   const Double_t EndLadderCarbonFiberJunctionTransZ[3] = {  0.0,  0.0,  
504                                                    0.5*(fgkEndLadderCarbonFiberLowerJunctionLength[i]
505                                                            -fgkEndLadderCarbonFiberUpperJunctionLength[i])};
506   ////////////////////////////////////////////////////////
507   //Rotational Parameters EndLadderCarbonFiberJunction:
508   ////////////////////////////////////////////////////////
509   const Double_t EndLadderCarbonFiberJunctionRotPhi[3]   = {   0., 120., 240.};
510   const Double_t EndLadderCarbonFiberJunctionRotTheta[3] = {   0.,   0.,   0.};
511   const Double_t EndLadderCarbonFiberJunctionRotPsi[3]   = {   0.,   0.,   0.};
512   ///////////////////////////////////////////////////////////
513   //Name of CombiTrans Transformation of CarbonFiberJunction:
514   ///////////////////////////////////////////////////////////
515   char EndLadderCarbonFiberJunctionCombiTransName[40];
516   char EndLadderCarbonFiberJunctionRotName[40];
517   TGeoCombiTrans *EndLadderCarbonFiberJunctionLocalMatrix[fgkEndLadderCarbonFiberJunctionCombiTransNumber];
518   for(Int_t i=0; i<fgkEndLadderCarbonFiberJunctionCombiTransNumber; i++) {
519         sprintf(EndLadderCarbonFiberJunctionCombiTransName,"EndLadderCarbonFiberJunctionCombiTrans%i",i);
520         sprintf(EndLadderCarbonFiberJunctionRotName,"EndLadderCarbonFiberJunctionRot%i",i);
521         EndLadderCarbonFiberJunctionLocalMatrix[i] =
522         new TGeoCombiTrans(EndLadderCarbonFiberJunctionCombiTransName,
523                                                                                   EndLadderCarbonFiberJunctionTransX[i],
524                                                                                   EndLadderCarbonFiberJunctionTransY[i],
525                                                                                   EndLadderCarbonFiberJunctionTransZ[i],
526                                                 new TGeoRotation(EndLadderCarbonFiberJunctionRotName,
527                                                                                   EndLadderCarbonFiberJunctionRotPhi[i],
528                                                                                 EndLadderCarbonFiberJunctionRotTheta[i],
529                                                                             EndLadderCarbonFiberJunctionRotPsi[i]));
530     EndLadderCarbonFiberJunctionCombiTransMatrix[i] = 
531                                                                          EndLadderCarbonFiberJunctionLocalMatrix[i];
532   }
533 }
534 ////////////////////////////////////////////////////////////////////////////////
535 void AliITSv11GeometrySSD::SetCarbonFiberAssemblyCombiTransMatrix(){
536 /////////////////////////////////////////////////////////////////////////////////
537   //Translation Parameters CarbonFiberAssembly:
538   ////////////////////////////////////////////////////////
539   const Double_t CarbonFiberAssemblyTransX[3] = {  0.0,  0.0,  0.0};
540   const Double_t CarbonFiberAssemblyTransY[3] = 
541                                                                                 {  0.5*fgkCarbonFiberJunctionWidth, 0.0, 
542                                         fgkCarbonFiberJunctionWidth-fgkCarbonFiberLowerSupportWidth
543                            -    fgkCarbonFiberLowerSupportVolumePosition[0]
544                            -    fgkCarbonFiberLowerSupportVolumePosition[1]};
545   const Double_t CarbonFiberAssemblyTransZ[3] = 
546                                                   {  0.0,  0.0,-  0.5*fgkCarbonFiberLowerSupportHeight};
547   ////////////////////////////////////////////////////////
548   //Rotational Parameters CarbonFiberAssembly:
549   ////////////////////////////////////////////////////////
550   const Double_t CarbonFiberAssemblyRotPhi[3]   = {   0.,  90.,   0.};
551   const Double_t CarbonFiberAssemblyRotTheta[3] = {  90.,
552                                                                                         -fgkCarbonFiberTriangleAngle,   0.};
553   const Double_t CarbonFiberAssemblyRotPsi[3]   = {   0.,- 90.,   0.};
554   ///////////////////////////////////////////////////////////
555   //Name of CombiTrans Transformation of CarbonFiberAssembly:
556   ///////////////////////////////////////////////////////////
557   char CarbonFiberAssemblyCombiTransName[30];
558   char CarbonFiberAssemblyRotName[30];
559   TGeoCombiTrans *CarbonFiberAssemblyLocalMatrix[fgkCarbonFiberAssemblyCombiTransNumber];
560   for(Int_t i=0; i<fgkCarbonFiberAssemblyCombiTransNumber; i++) {
561         sprintf(CarbonFiberAssemblyCombiTransName,"CarbonFiberAssemblyCombiTrans%i",i);
562         sprintf(CarbonFiberAssemblyRotName,"CarbonFiberAssemblyRot%i",i);
563         CarbonFiberAssemblyLocalMatrix[i] =
564                                                 new TGeoCombiTrans(CarbonFiberAssemblyCombiTransName,
565                                                                                    CarbonFiberAssemblyTransX[i],
566                                                                                    CarbonFiberAssemblyTransY[i],
567                                                                                    CarbonFiberAssemblyTransZ[i],
568                                                  new TGeoRotation(CarbonFiberAssemblyRotName,
569                                                                                    CarbonFiberAssemblyRotPhi[i],
570                                                                                    CarbonFiberAssemblyRotTheta[i],
571                                                                                    CarbonFiberAssemblyRotPsi[i]));
572     CarbonFiberAssemblyCombiTransMatrix[i] = CarbonFiberAssemblyLocalMatrix[i];
573   }
574 }
575 /////////////////////////////////////////////////////////////////////////////////
576 void AliITSv11GeometrySSD::SetCoolingTubeSupportCombiTransMatrix(){
577   ////////////////////////////////////////////////////////
578   //Translation Parameters CoolingTubeSupport:
579   ////////////////////////////////////////////////////////
580   Double_t Phi = TMath::ASin(0.5*fgkCoolingTubeSupportHeight
581                                                                                                         /fgkCoolingTubeSupportRmax);
582   const Double_t CoolingTubeSupportTransX[2] = 
583                                                   {0.,2.*fgkCoolingTubeSupportRmax*TMath::Cos(Phi)
584                                                 +  2.*(fgkCoolingTubeSupportLength
585                                                 -  fgkCoolingTubeSupportRmax*(1.+TMath::Cos(Phi)))
586                                                 +  fgkCarbonFiberTriangleLength
587                                                 -  2.0*fgkCarbonFiberJunctionLength};
588   const Double_t CoolingTubeSupportTransY[2] = {  0.0,  0.0};
589   const Double_t CoolingTubeSupportTransZ[2] = {  0.0,  0.0};
590   ////////////////////////////////////////////////////////
591   //Rotational Parameters CoolingTubeSupport:
592   ////////////////////////////////////////////////////////
593   const Double_t CoolingTubeSupportRotPhi[2]   = {   0., 180.};
594   const Double_t CoolingTubeSupportRotTheta[2] = {   0.,   0.};
595   const Double_t CoolingTubeSupportRotPsi[2]   = {   0.,   0.};
596   ///////////////////////////////////////////////////////////
597   //Name of CombiTrans Transformation of CarbonFiberJunction:
598   ///////////////////////////////////////////////////////////
599   char CoolingTubeSupportCombiTransName[40];
600   char CoolingTubeSupportRotName[40];
601   TGeoCombiTrans *CoolingTubeSupportLocalMatrix[fgkCoolingTubeSupportCombiTransNumber];
602   for(Int_t i=0; i<fgkCoolingTubeSupportCombiTransNumber; i++) {
603         sprintf(CoolingTubeSupportCombiTransName,"CoolingTubeSupportCombiTrans%i",i);
604         sprintf(CoolingTubeSupportRotName,"CoolingTubeSupportRot%i",i);
605         CoolingTubeSupportLocalMatrix[i] =
606                         new TGeoCombiTrans(CoolingTubeSupportCombiTransName,
607                                                            CoolingTubeSupportTransX[i],
608                                                            CoolingTubeSupportTransY[i],
609                                                            CoolingTubeSupportTransZ[i],
610                                                            new TGeoRotation(CoolingTubeSupportRotName,
611                                                                                                 CoolingTubeSupportRotPhi[i],
612                                                                                                 CoolingTubeSupportRotTheta[i],
613                                                                                                 CoolingTubeSupportRotPsi[i]));
614     CoolingTubeSupportCombiTransMatrix[i] = CoolingTubeSupportLocalMatrix[i];
615   }
616 }
617 /////////////////////////////////////////////////////////////////////////////////
618 void AliITSv11GeometrySSD::SetCoolingTubeCombiTransMatrix(){
619   ////////////////////////////////////////////////////////
620   //Translation Parameters CoolingTube:
621   ////////////////////////////////////////////////////////
622   const Double_t CoolingTubeTransX[2] = {  0.,  fgkCoolingTubeSeparation};
623   const Double_t CoolingTubeTransY[2] = {  fgkCoolingTubeLength/2.0, fgkCoolingTubeLength/2.0};
624   const Double_t CoolingTubeTransZ[2] = {  0.0,  0.};
625   ////////////////////////////////////////////////////////
626   //Rotational Parameters CoolingTube:
627   ////////////////////////////////////////////////////////
628   const Double_t CoolingTubeRotPhi[2]   = {   0.,   0.};
629   const Double_t CoolingTubeRotTheta[2] = {  90.,  90.};
630   const Double_t CoolingTubeRotPsi[2]   = {   0.,   0.};
631   ///////////////////////////////////////////////////////////
632   //Name of CombiTrans Transformation of CarbonFiberJunction:
633   ///////////////////////////////////////////////////////////
634   const char* CoolingTubeCombiTransName[fgkCoolingTubeCombiTransNumber] = 
635                                                         {"CoolingTubeCombiTrans0","CoolingTubeCombiTrans1"};
636   const char* CoolingTubeRorationName[fgkCoolingTubeCombiTransNumber] = 
637                                                                 {"CoolingTubeRotation0","CoolingTubeRotation1"};
638   TGeoCombiTrans *CoolingTubeLocalMatrix[fgkCoolingTubeCombiTransNumber];
639   for(Int_t i=0; i<fgkCoolingTubeCombiTransNumber; i++) {
640         CoolingTubeLocalMatrix[i] =
641                         new TGeoCombiTrans(CoolingTubeCombiTransName[i],
642                                                            CoolingTubeTransX[i],
643                                                            CoolingTubeTransY[i],
644                                                            CoolingTubeTransZ[i], 
645                                                            new TGeoRotation(CoolingTubeRorationName[i],
646                                                                             CoolingTubeRotPhi[i],
647                                                                             CoolingTubeRotTheta[i],
648                                                                             CoolingTubeRotPsi[i]    ) );
649     CoolingTubeTransMatrix[i] = CoolingTubeLocalMatrix[i];
650   }
651 }
652 /////////////////////////////////////////////////////////////////////////////////
653 void AliITSv11GeometrySSD::SetLadderSegmentCombiTransMatrix(){
654 /////////////////////////////////////////////////////////////////////////////////
655   //Translation Parameters LadderSegment:
656   ////////////////////////////////////////////////////////
657         const Double_t LadderSegmentTransX[fgkLadderSegmentCombiTransNumber] = {  0.,
658          -  0.5*(fgkSSDSensorWidth-fgkCarbonFiberTriangleLength),
659                          fgkCarbonFiberTriangleLength+fgkCarbonFiberJunctionToSensorSupport,
660                          fgkCarbonFiberJunctionLength-(fgkCoolingTubeSupportLength
661          -       fgkCoolingTubeSupportRmax),
662                 0.5*(fgkCarbonFiberTriangleLength-fgkCoolingTubeSeparation)}; 
663         const Double_t LadderSegmentTransY[fgkLadderSegmentCombiTransNumber] = {  0.,
664          -      (2.*fgkSSDSensorLength-fgkSSDSensorOverlap)+
665                          fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
666          +               0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
667          -               0.5*(fgkCarbonFiberLowerSupportWidth+fgkSSDSensorCenterSupportLength
668          -            fgkSSDSensorCenterSupportThickness[0]),
669                                   fgkCarbonFiberJunctionWidth-0.5*(fgkCarbonFiberLowerSupportWidth
670          +            fgkSSDSensorCenterSupportLength
671          -            fgkSSDSensorCenterSupportThickness[0])
672          -                        fgkSSDSensorCenterSupportPosition,
673                                   fgkCarbonFiberJunctionWidth-fgkCarbonFiberLowerSupportWidth
674          -                        fgkCoolingTubeSupportToCarbonFiber,
675                                                                                                  0.0};
676         const Double_t LadderSegmentTransZ[fgkLadderSegmentCombiTransNumber] = {  0.,
677          -        (fgkSSDModuleCoolingBlockToSensor+0.5*fgkCoolingTubeSupportHeight
678          -         fgkSSDSensorHeight-fgkSSDChipCablesHeight[3]-fgkSSDChipHeight),
679                                                                                                                                                          0.,
680          -     0.5*fgkCoolingTubeSupportHeight,
681          -     0.5*fgkCoolingTubeSupportHeight};
682 //////////////////////////////////////////////////
683   //Rotational Parameters LadderSegment:
684   ////////////////////////////////////////////////////////
685   const Double_t LadderSegmentRotPhi[fgkLadderSegmentCombiTransNumber]   =
686                                                                                                           {   0.,   0.,- 90.,   0.,  0.};
687   const Double_t LadderSegmentRotTheta[fgkLadderSegmentCombiTransNumber] = 
688                                                                                                           {   0.,   0.,   0.,  90.,  0.};
689   const Double_t LadderSegmentRotPsi[fgkLadderSegmentCombiTransNumber]   = 
690                                                                                                           {   0.,   0.,   0.,   0.,  0.};
691   //////////////////////////////////////////////////////
692   //Name of CombiTrans Transformation of LadderSegment:
693   //////////////////////////////////////////////////////
694   char LadderSegmentCombiTransName[40];
695   char LadderSegmentRotName[40];
696   TGeoCombiTrans *LadderSegmentLocalMatrix[fgkLadderSegmentCombiTransNumber];
697   for(Int_t i=0; i<fgkLadderSegmentCombiTransNumber; i++) {
698                 sprintf(LadderSegmentCombiTransName,"LadderSegmentCombiTrans%i",i);
699                 sprintf(LadderSegmentRotName,"LadderSegmentRot%i",i);
700                 LadderSegmentLocalMatrix[i] =
701                                         new TGeoCombiTrans(LadderSegmentCombiTransName,
702                                                                            LadderSegmentTransX[i],
703                                                                            LadderSegmentTransY[i],
704                                                                            LadderSegmentTransZ[i],
705                                                                            new TGeoRotation(LadderSegmentRotName,
706                                                                                                                 LadderSegmentRotPhi[i],
707                                                                                                                 LadderSegmentRotTheta[i],
708                                                                                                                 LadderSegmentRotPsi[i]));
709     LadderSegmentCombiTransMatrix[i] = LadderSegmentLocalMatrix[i];
710   }
711 }
712 /////////////////////////////////////////////////////////////////////////////////
713 void AliITSv11GeometrySSD::SetEndLadderSegmentCombiTransMatrix(Int_t i){
714 /////////////////////////////////////////////////////////////////////////////////
715   //Translation Parameters EndLadderSegment:
716   ////////////////////////////////////////////////////////
717   const Double_t EndLadderSegmentTransX[4] = {0.0,
718                                                                                           0.0,
719                  -  0.25*(fgkSSDMountingBlockLength[0]
720                          +      fgkSSDMountingBlockLength[1])
721                          +  0.5*fgkCarbonFiberTriangleLength,
722                                                                                           0.0}; 
723   const Double_t EndLadderSegmentTransY[4] = 
724                                                          {0.5*fgkEndLadderCarbonFiberLowerJunctionLength[i],
725                                                   i==0 ? 0. : fgkCarbonFiberLowerSupportWidth,
726                                                          fgkEndLadderMountingBlockPosition[i],
727                                                    (1-i)*(fgkEndLadderMountingBlockPosition[i]
728                                                                                  +  0.5*fgkSSDMountingBlockWidth)}; 
729   const Double_t EndLadderSegmentTransZ[4] = {0.0,
730                                                                                           0.0,
731                                                                                 -  fgkSSDMountingBlockHeight[1]
732                                                                                 +  0.5*fgkSSDMountingBlockHeight[0],
733                                                                             -  0.5*fgkCarbonFiberLowerSupportHeight}; 
734   ////////////////////////////////////////////////////////
735   //Rotational Parameters EndLadderSegment:
736   ////////////////////////////////////////////////////////  
737   const Double_t EndLadderSegmentRotPhi[4]   = {   0.,  90.,   0.,   0.};
738   const Double_t EndLadderSegmentRotTheta[4] = {  90.,-fgkCarbonFiberTriangleAngle,
739                                                                                                    0.,   0.};
740   const Double_t EndLadderSegmentRotPsi[4]   = {   0.,- 90.,   0.,   0.};
741   ////////////////////////////////////////////////////////
742   //Name of CombiTrans Transformation of EndLadderSegment:
743   ////////////////////////////////////////////////////////
744   char EndLadderSegmentCombiTransName[30];
745   char EndLadderSegmentRotName[30];
746   TGeoCombiTrans *EndLadderSegmentLocalMatrix[fgkEndLadderSegmentCombiTransNumber];
747   for(Int_t i=0; i<fgkEndLadderSegmentCombiTransNumber; i++){ 
748                 sprintf(EndLadderSegmentCombiTransName,"EndLadderSegmentCombiTrans%i",i);
749                 sprintf(EndLadderSegmentRotName,"EndLadderSegmentRot%i",i);
750                 EndLadderSegmentLocalMatrix[i] =
751                                 new TGeoCombiTrans(EndLadderSegmentCombiTransName,
752                                                                    EndLadderSegmentTransX[i],
753                                                                    EndLadderSegmentTransY[i],
754                                                                    EndLadderSegmentTransZ[i],
755                                                                    new TGeoRotation(EndLadderSegmentRotName,
756                                                                                                         EndLadderSegmentRotPhi[i],
757                                                                                                         EndLadderSegmentRotTheta[i],
758                                                                                                         EndLadderSegmentRotPsi[i]));
759     EndLadderSegmentCombiTransMatrix[i] = EndLadderSegmentLocalMatrix[i];
760   }
761 }
762 /////////////////////////////////////////////////////////////////////////////////
763 void AliITSv11GeometrySSD::SetLadderCableCombiTransMatrix(Int_t iLayer){
764 ////////////////////////////////////////////////////////////////////////////////
765 // Translation Parameters for LadderCable
766 /////////////////////////////////////////
767   Double_t SSDFlexRadius = fgkSSDStiffenerHeight+2*fgkSSDFlexHeight[0]
768                                              + fgkSSDFlexHeight[1];  
769   Double_t SSDFlexRadiusMax = (fgkSSDFlexLength[3]-fgkSSDFlexLength[2])
770                                                         /  TMath::Tan(fgkSSDFlexAngle*TMath::DegToRad());
771   Double_t SSDLadderCableTransX[3];
772   SSDLadderCableTransX[0] = (SSDFlexRadiusMax-fgkSSDFlexHeight[1]-SSDFlexRadius)
773                                                   *   TMath::Sin(2.*fgkSSDFlexAngle*TMath::DegToRad())
774                                                   *       TMath::Cos(2.*fgkSSDFlexAngle*TMath::DegToRad());
775   SSDLadderCableTransX[1] = ((SSDFlexRadiusMax-fgkSSDFlexHeight[1]-SSDFlexRadius)
776                                                   -     SSDLadderCableTransX[0]
777                                                   /     TMath::Sin(2.*fgkSSDFlexAngle*TMath::DegToRad()))
778                                                   *     TMath::Cos(fgkSSDFlexAngle*TMath::DegToRad());                                          
779   SSDLadderCableTransX[2] = (fgkSSDFlexFullLength-2.*fgkSSDFlexAngle
780                                                   *       TMath::DegToRad()*SSDFlexRadiusMax
781                                                   -     fgkSSDFlexLength[2]-TMath::Pi()
782                                                   *       fgkSSDStiffenerHeight-fgkSSDFlexLength[0]
783                                                   -       fgkSSDLadderCableWidth)
784                                                   *       TMath::Cos(2.*fgkSSDFlexAngle*TMath::DegToRad());
785   Double_t SSDLadderCableTransZ[3] = {SSDLadderCableTransX[0]
786                                                   *     TMath::Tan(2.*fgkSSDFlexAngle*TMath::DegToRad()),
787                                                         SSDLadderCableTransX[1]
788                                                   *     TMath::Tan(fgkSSDFlexAngle*TMath::DegToRad()),
789                                                         SSDLadderCableTransX[2]
790                                                   *     TMath::Tan(2.*fgkSSDFlexAngle*TMath::DegToRad())};      
791   TGeoRotation* LocalLadderCableRot[3]; 
792   LocalLadderCableRot[0] = new TGeoRotation("LocalLadderCableRot0",90.,0.,0.);
793   LocalLadderCableRot[1] = new TGeoRotation("LocalLadderCableRot1",90.,60.,-90.);
794   LocalLadderCableRot[2] = new TGeoRotation("LocalLadderCableRot2");
795   LocalLadderCableRot[2]->SetRotation((*LocalLadderCableRot[1])
796                                                  *                        (*LocalLadderCableRot[0]));
797 ////////////////////////////////////////////
798 // LocalLadderCableCombiTransMatrix
799 ////////////////////////////////////////////
800   const Int_t LocalLadderSideCablesNumber = 2;
801   const Int_t LocalLadderCombiTransNumber = 5;
802   TGeoCombiTrans** LocalLadderCableCombiTransMatrix[LocalLadderSideCablesNumber];
803   for(Int_t i=0; i<LocalLadderSideCablesNumber; i++) 
804         LocalLadderCableCombiTransMatrix[i] = 
805                                                            new TGeoCombiTrans*[LocalLadderCombiTransNumber];
806 ///////////////////////////////////////////
807 // Left Side Ladder Cables Transformations
808 ///////////////////////////////////////////
809   LocalLadderCableCombiTransMatrix[0][0]  =
810                                                 new TGeoCombiTrans(-0.5*fgkCarbonFiberTriangleLength,
811                                                 0.,0.,NULL);
812   LocalLadderCableCombiTransMatrix[0][1] = LadderSegmentCombiTransMatrix[1];
813   LocalLadderCableCombiTransMatrix[0][2] = 
814                                                 new TGeoCombiTrans(fgkSSDModuleStiffenerPosition[0],
815                                                                                    fgkSSDModuleStiffenerPosition[1],0.,0);
816   LocalLadderCableCombiTransMatrix[0][3] = SSDModuleCombiTransMatrix[6];
817   LocalLadderCableCombiTransMatrix[0][4] = 
818                                                 new TGeoCombiTrans(-SSDLadderCableTransX[0]
819                                                 -     SSDLadderCableTransX[1]-SSDLadderCableTransX[2]
820                                                 +     fgkSSDFlexLength[0]-fgkSSDFlexLength[2],
821                                                           0.,
822                                                           0.5*fgkSSDFlexHeight[0]+2.*(fgkSSDFlexHeight[0]
823                                                 +         fgkSSDFlexHeight[1])+2.*fgkSSDStiffenerHeight
824                                                 +     SSDLadderCableTransZ[0]-SSDLadderCableTransZ[1]
825                                                 +         SSDLadderCableTransZ[2],LocalLadderCableRot[2]);
826 ///////////////////////////////////////////
827 // Rigth Side Ladder Cables Transformations
828 ///////////////////////////////////////////
829  for(Int_t i=0; i<LocalLadderCombiTransNumber; i++)
830    LocalLadderCableCombiTransMatrix[1][i] = 
831                         (i!=3 ? LocalLadderCableCombiTransMatrix[0][i]:
832                                         SSDModuleCombiTransMatrix[3]);  
833 ///////////////////////////////////////////
834 // Setting LadderCableCombiTransMatrix
835 ///////////////////////////////////////////
836 Int_t BeamAxisTrans[3] = {0,0,0};
837 switch(iLayer){
838 case 5: 
839         BeamAxisTrans[0] = fgkSSDLay5SensorsNumber/2;
840         BeamAxisTrans[1] = BeamAxisTrans[0]+1;
841         BeamAxisTrans[2] = BeamAxisTrans[0]-1;
842         break;
843 case 6:
844         BeamAxisTrans[0] = (fgkSSDLay6SensorsNumber-1)/2;
845         BeamAxisTrans[1] = BeamAxisTrans[0]+1;
846         BeamAxisTrans[2] = BeamAxisTrans[0];
847         break;
848 }
849  TGeoHMatrix* LocalLadderCableHMatrix[LocalLadderSideCablesNumber];
850  TGeoRotation* LadderCableRot;
851  TGeoTranslation* LadderCableTrans;
852  for(Int_t i=0; i<LocalLadderSideCablesNumber; i++){
853         LocalLadderCableHMatrix[i] = new TGeoHMatrix();
854         for(Int_t j=0; j<LocalLadderCombiTransNumber; j++){
855                   LocalLadderCableHMatrix[i]->MultiplyLeft(
856                   LocalLadderCableCombiTransMatrix[i][LocalLadderCombiTransNumber-j-1]);
857         }
858         LadderCableRot = new TGeoRotation();
859         LadderCableRot->SetMatrix(LocalLadderCableHMatrix[i]->GetRotationMatrix());
860     LadderCableTrans = new TGeoTranslation();
861     Double_t* LadderCableTransVector = LocalLadderCableHMatrix[i]->GetTranslation();
862     LadderCableTrans->SetTranslation(LadderCableTransVector[0],
863                                                                          LadderCableTransVector[1]
864                                         +                (i==0 ? BeamAxisTrans[0] : 0.)
865                                         *                                fgkCarbonFiberJunctionWidth,
866                                                                          LadderCableTransVector[2]);     
867         LadderCableCombiTransMatrix[i] = new TGeoCombiTrans(*LadderCableTrans,
868                                                                                                    *LadderCableRot);
869         } 
870         LadderCableCombiTransMatrix[2] = 
871                                         AddTranslationToCombiTrans(LadderCableCombiTransMatrix[1],0.,
872                                         BeamAxisTrans[1]*fgkCarbonFiberJunctionWidth,0.);
873         LadderCableCombiTransMatrix[3] = 
874                                         AddTranslationToCombiTrans(LadderCableCombiTransMatrix[0],0.,
875                                         BeamAxisTrans[2]*fgkCarbonFiberJunctionWidth,0.);
876  }
877 /////////////////////////////////////////////////////////////////////////////////
878 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensorSupportShape(Double_t length, 
879                                                         Double_t height,Double_t width,Double_t* thickness){
880 ////////////////////////////////////////////////////////////////////////////////
881   const Int_t VertexNumber = 4;
882   const Int_t ShapesNumber = 2;
883   Double_t Width[2] = {width,width};
884   TVector3** VertexPosition[ShapesNumber];
885   for(Int_t i = 0; i<ShapesNumber; i++) VertexPosition[i] = 
886                                                                                                         new TVector3*[VertexNumber];
887   //First Shape Vertex Positioning
888   VertexPosition[0][0] = new TVector3();
889   VertexPosition[0][1] = new TVector3(height);
890   VertexPosition[0][2] = new TVector3(thickness[0]);
891   VertexPosition[0][3] = new TVector3(*VertexPosition[0][1]);
892   //Second Shape Vertex Positioning
893   VertexPosition[1][0] = new TVector3(*VertexPosition[0][0]);
894   VertexPosition[1][1] = new TVector3(length);
895   VertexPosition[1][2] = new TVector3(thickness[1]);
896   VertexPosition[1][3] = new TVector3(VertexPosition[1][1]->X());
897   char* SSDSensorSupportShapeName[ShapesNumber] = 
898                                                         {"SSDSensorSupportShape1","SSDSensorSupportShape2"};
899   TGeoArb8* SSDSensorSupportShape[ShapesNumber];
900   for(Int_t i = 0; i< ShapesNumber; i++) SSDSensorSupportShape[i] = 
901                                            GetArbShape(VertexPosition[i],Width,i==0 ? 
902                                                                                                          thickness[1]: thickness[0],
903                                                                                                   SSDSensorSupportShapeName[i]);
904   /////////////////////////////////////
905   //Setting Translations and Rotations: 
906   /////////////////////////////////////
907   TGeoRotation* SSDSensorSupportShapeRot[2];
908   SSDSensorSupportShapeRot[0] = 
909                                          new TGeoRotation("SSDSensorSupportShapeRot1",180.,0.,0.);
910   SSDSensorSupportShapeRot[1] = 
911                                          new TGeoRotation("SSDSensorSupportShapeRot2",90.,90.,-90.);
912   TGeoTranslation* SSDSensorSupportShapeTrans = 
913                                          new TGeoTranslation("SSDSensorSupportShapeTrans",0.,0.,
914                                                                                                                           0.5*thickness[0]);
915   TGeoCombiTrans* SSDSensorSupportCombiTrans = 
916           new TGeoCombiTrans("SSDSensorSupportCombiTrans",0.5*thickness[0],width,0.,
917                                                   new TGeoRotation((*SSDSensorSupportShapeRot[1])
918                                                 *                  (*SSDSensorSupportShapeRot[0])));
919   TGeoVolume* SSDSensorSupportCompVolume = 
920                                                   new TGeoVolumeAssembly("SSDSensorSupportCompVolume");
921   SSDSensorSupportCompVolume->AddNode(new TGeoVolume("SSDSensorSupportVolume1",
922                                                         SSDSensorSupportShape[0],fgkSSDSensorSupportMedium),1,
923                                                         SSDSensorSupportShapeTrans);
924   SSDSensorSupportCompVolume->AddNode(new TGeoVolume("SSDSensorSupportVolume2",
925                                                         SSDSensorSupportShape[1],fgkSSDSensorSupportMedium),1,
926                                                         SSDSensorSupportCombiTrans);
927   return SSDSensorSupportCompVolume;
928 }
929 /////////////////////////////////////////////////////////////////////////////////
930 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensorSupport(Int_t VolumeKind, Int_t n){
931 ////////////////////////////////////////////////////////////////////////////////
932   TGeoVolume* SSDSensorSupport;
933   Double_t SideSupportThickness[2] = {fgkSSDSensorSideSupportThickness[0],
934                                                                                    fgkSSDSensorSideSupportThickness[1]};
935   VolumeKind == 0 ? SSDSensorSupport = GetSSDSensorSupportShape(
936                                                                 fgkSSDSensorSideSupportLength,
937                                                                 fgkSSDSensorSideSupportHeight[(n==0 ? 0 : 1)],
938                                                                 fgkSSDSensorSideSupportWidth,
939                                                                 SideSupportThickness) :
940     SSDSensorSupport = GetSSDSensorSupportShape(fgkSSDSensorCenterSupportLength,
941                                                         fgkSSDSensorCenterSupportHeight[(n==0 ? 0 : 1)],
942                                                             fgkSSDSensorCenterSupportWidth,
943                                                             SideSupportThickness);
944   return SSDSensorSupport;
945 }
946 /////////////////////////////////////////////////////////////////////////////////
947 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensorSupportAssembly(Int_t n){
948 ////////////////////////////////////////////////////////////////////////////////
949   TGeoVolume* SSDSensorSupportAssembly = 
950                                                          new TGeoVolumeAssembly("SSDSensorSupportAssembly");
951   const Int_t VolumeNumber = 2;
952   TGeoVolume* SSDSensorSupport[VolumeNumber];
953   for(Int_t i=0; i<VolumeNumber; i++) SSDSensorSupport[i] = 
954                                                                                                                 GetSSDSensorSupport(i,n);
955   SetSSDSensorSupportCombiTransMatrix();
956   for(Int_t i=0; i<fgkSSDSensorSupportCombiTransNumber; i++) 
957         SSDSensorSupportAssembly->AddNode((i<2 ? SSDSensorSupport[0]:
958                                                                                          SSDSensorSupport[1]),
959                                                                                  i+1,SSDSensorSupportCombiTransMatrix[i]);
960   return SSDSensorSupportAssembly;
961 }
962 /////////////////////////////////////////////////////////////////////////////////
963 TGeoVolume* AliITSv11GeometrySSD::GetSSDModule(Int_t iChipCablesHeight){
964 ////////////////////////////////////////////////////////////////////////////////
965   TGeoVolume* SSDModuleVolume[fgkSSDModuleCombiTransNumber-1];
966   SSDModuleVolume[0] = GetSSDStiffenerAssembly();
967   SSDModuleVolume[1] = GetSSDChipAssembly();
968   SSDModuleVolume[2] = GetSSDSensor();
969   SSDModuleVolume[3] = GetSSDFlexAssembly();
970   SSDModuleVolume[4] = GetSSDCoolingBlockAssembly();
971   SSDModuleVolume[5] = GetSSDChipCablesAssembly(fgkSSDChipCablesHeight[iChipCablesHeight+2]);
972   SetSSDModuleCombiTransMatrix(fgkSSDChipCablesHeight[iChipCablesHeight+2]);
973   TGeoCombiTrans* SSDModuleGlobalCombiTrans = 
974                                                                    new TGeoCombiTrans("SSDModuleGlobalCombiTrans",
975                                                                            fgkSSDModuleStiffenerPosition[0],
976                                                                            fgkSSDModuleStiffenerPosition[1],0.,NULL);
977   TGeoHMatrix* SSDModuleHMatrix[fgkSSDModuleCombiTransNumber];
978   TGeoVolume* SSDModule = new TGeoVolumeAssembly("SSDModule");
979   for(Int_t i=0; i<fgkSSDModuleCombiTransNumber; i++){ 
980         SSDModuleHMatrix[i] = new TGeoHMatrix((*SSDModuleGlobalCombiTrans)
981                                                 *                                 (*SSDModuleCombiTransMatrix[i]));
982         SSDModule->AddNode(i==fgkSSDModuleCombiTransNumber-1 ? SSDModuleVolume[3] : 
983                                                   SSDModuleVolume[i],i!=fgkSSDModuleCombiTransNumber-1?1:2,
984                                                   SSDModuleHMatrix[i]);
985   }
986   return SSDModule;
987 }
988 /////////////////////////////////////////////////////////////////////////////////
989 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensor(){
990 ////////////////////////////////////////////////////////////////////////////////
991   Double_t fgkSSDSensorSensitiveLength = fgkSSDSensorLength-2.*fgkSSDSensorInsensitiveLength;
992   Double_t fgkSSDSensorSensitiveWidth  = fgkSSDSensorWidth-2.*fgkSSDSensorInsensitiveWidth;
993   TGeoBBox* SSDSensorSensitiveShape = new TGeoBBox("SSDSensorSensitiveShape",
994                                                 0.5*fgkSSDSensorSensitiveLength,
995                                                 0.5*fgkSSDSensorSensitiveWidth,
996                                                 0.5*fgkSSDSensorHeight);
997   TGeoVolume* SSDSensorSensitive = 
998       new TGeoVolume(fgkSSDSensitiveVolName,SSDSensorSensitiveShape,fgkSSDSensorMedium);
999   SSDSensorSensitive->SetLineColor(fColorSilicon);
1000   TGeoBBox* SSDSensorInsensitiveShape[2];
1001   SSDSensorInsensitiveShape[0] = new TGeoBBox("SSDSensorInSensitiveShape1",
1002                                                 0.5*fgkSSDSensorLength,
1003                                                 0.5*fgkSSDSensorInsensitiveWidth,
1004                                                 0.5*fgkSSDSensorHeight);
1005   SSDSensorInsensitiveShape[1] = new TGeoBBox("SSDSensorInSensitiveShape2",
1006                                                 0.5*fgkSSDSensorInsensitiveWidth,
1007                                                 0.5*fgkSSDSensorSensitiveWidth,
1008                                                 0.5*fgkSSDSensorHeight);
1009   const char* SSDSensorInsensitiveName[2] = {"SSDSensorInsensitive1",
1010                                              "SSDSensorInsensitive2"};
1011   TGeoVolume* SSDSensorInsensitive[2];
1012   for(Int_t i=0; i<2; i++){ SSDSensorInsensitive[i] = 
1013       new TGeoVolume(SSDSensorInsensitiveName[i],SSDSensorInsensitiveShape[i],
1014                      fgkSSDSensorMedium);
1015       SSDSensorInsensitive[i]->SetLineColor(fColorCarbonFiber);
1016   }
1017   TGeoVolume* SSDSensorInsensitiveVol = 
1018                               new TGeoVolumeAssembly("SSDSensorInsensitiveVol");
1019   for(Int_t i=0; i<4; i++) 
1020             SSDSensorInsensitiveVol->AddNode(i%2==0 ? SSDSensorInsensitive[0]:
1021             SSDSensorInsensitive[1],i<2?1:2,
1022                   new TGeoTranslation(0.5*(1.-TMath::Power(-1.,i))*(i==1? 1.:-1.)
1023       *     (SSDSensorSensitiveShape->GetDX()+SSDSensorInsensitiveShape[1]->GetDX()),
1024                         0.5*(1.+TMath::Power(-1.,i))*(i==0?-1.: 1.)
1025       *     (SSDSensorSensitiveShape->GetDY()+SSDSensorInsensitiveShape[0]->GetDY()),0.));            
1026   TGeoVolume* SSDSensor = new TGeoVolumeAssembly("SSDSensor");
1027   SSDSensor->AddNode(SSDSensorSensitive,1),SSDSensor->AddNode(SSDSensorInsensitiveVol,1);
1028   return SSDSensor;
1029 }
1030 /////////////////////////////////////////////////////////////////////////////////
1031 TGeoVolume* AliITSv11GeometrySSD::GetSSDChipAssembly(){
1032 ////////////////////////////////////////////////////////////////////////////////
1033   const Int_t SSDChipRowNumber = 2;
1034   TGeoBBox* SSDChipCompShape[2];
1035   SSDChipCompShape[0] =  new TGeoBBox("SSDChipCompShape",
1036                                                                                 0.5*fgkSSDChipLength,
1037                                                                                 0.5*fgkSSDChipWidth,
1038                                                                                 0.5*(fgkSSDChipHeight-fgkSSDChipGlueHeight));
1039   SSDChipCompShape[1] =  new TGeoBBox("SSDChipGlueCompShape",
1040                                                                                 0.5*fgkSSDChipLength,
1041                                                                                 0.5*fgkSSDChipWidth,
1042                                                                                 0.5*fgkSSDChipGlueHeight);
1043   TGeoVolume* SSDChipComp[2];
1044   SSDChipComp[0] = new TGeoVolume("SSDChipComp",SSDChipCompShape[0],fgkSSDChipMedium);
1045   SSDChipComp[1] = new TGeoVolume("SSDChipGlueComp",SSDChipCompShape[1],
1046                                                                   fgkSSDChipGlueMedium);
1047   SSDChipComp[0]->SetLineColor(fColorSilicon);  
1048   SSDChipComp[1]->SetLineColor(fColorEpoxy);
1049   TGeoTranslation* SSDChipCompTrans[2];
1050   SSDChipCompTrans[0] = new TGeoTranslation(0.,0.,-SSDChipCompShape[1]->GetDZ());
1051   SSDChipCompTrans[1] = new TGeoTranslation(0.,0.,SSDChipCompShape[0]->GetDZ());
1052   TGeoVolume* SSDChip = new TGeoVolumeAssembly("SSDChip");  
1053   for(Int_t i=0; i<2; i++) SSDChip->AddNode(SSDChipComp[i],1,SSDChipCompTrans[i]);
1054   Double_t SSDChipSeparation[2] = {fgkSSDChipLength+fgkSSDChipSeparationLength,
1055                                                   fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
1056                                    -  2.*(fgkSSDStiffenerWidth-fgkSSDStiffenerToChipDist
1057                                    -  0.5*fgkSSDChipWidth)};
1058   TGeoVolume* SSDChipAssembly = new TGeoVolumeAssembly("SSDChipAssembly"); 
1059   for(Int_t i=0; i<SSDChipRowNumber; i++)
1060     for(Int_t j=0; j<fgkSSDChipNumber; j++) 
1061                 SSDChipAssembly->AddNode(SSDChip,fgkSSDChipNumber*i+j+1,
1062                 new TGeoTranslation(j*SSDChipSeparation[0],i*SSDChipSeparation[1],0.));
1063   return SSDChipAssembly;
1064 }
1065 /////////////////////////////////////////////////////////////////////////////////
1066 TGeoVolume* AliITSv11GeometrySSD::GetSSDStiffenerAssembly(){
1067 ////////////////////////////////////////////////////////////////////////////////
1068   const Int_t SSDStiffenerNumber = 2;
1069   Double_t SSDStiffenerSeparation = fgkSSDSensorLength
1070                                                                   - 2.*fgkSSDModuleStiffenerPosition[1]
1071                                                                   -    fgkSSDStiffenerWidth;
1072   TGeoVolume* SSDStiffener = new TGeoVolumeAssembly("SSDStiffener");
1073 ////////////////////////////
1074 // Stiffener Volumes
1075 ///////////////////////////
1076   const Int_t StiffenerBoxNumber = 6;
1077   TGeoBBox* SSDStiffenerBoxShapes[StiffenerBoxNumber];
1078   SSDStiffenerBoxShapes[0] = new TGeoBBox("SSDStiffenerBoxShape1",
1079                                                                                   0.5* fgkSSDStiffenerLength,
1080                                                                                   0.5* fgkSSDStiffenerWidth,
1081                                                                                   0.5*(fgkSSDStiffenerHeight
1082                                                    -                   fgkSSDConnectorHeight));
1083   SSDStiffenerBoxShapes[1] = new TGeoBBox("SSDStiffenerBoxShape2",
1084                                                                                   0.5*(fgkSSDConnectorPosition[0]
1085                                                    -              2.0* fgkSSDConnectorLength
1086                                                    -                               fgkSSDConnectorSeparation),
1087                                                                                   0.5* fgkSSDStiffenerWidth,
1088                                                                                   0.5* fgkSSDConnectorHeight);
1089   SSDStiffenerBoxShapes[2] = new TGeoBBox("SSDStiffenerBoxShape3",
1090                                                                                   0.5*(fgkSSDConnectorSeparation
1091                                                    +              2.*  fgkSSDConnectorLength),
1092                                                                                   0.5* fgkSSDConnectorPosition[1],
1093                                                                                   0.5* fgkSSDConnectorHeight);
1094   SSDStiffenerBoxShapes[3] = new TGeoBBox("SSDStiffenerBoxShape4",
1095                                                                                         SSDStiffenerBoxShapes[2]->GetDX(),
1096                                                                                   0.5*(fgkSSDStiffenerWidth
1097                                                    -                   fgkSSDConnectorPosition[1]
1098                                                    -                   fgkSSDConnectorWidth),
1099                                                                                   0.5* fgkSSDConnectorHeight);
1100    SSDStiffenerBoxShapes[4] = new TGeoBBox("SSDStiffenerBoxShape5",
1101                                                                                   0.5* fgkSSDConnectorSeparation,
1102                                                                                   0.5* fgkSSDConnectorWidth,
1103                                                                                   0.5* fgkSSDConnectorHeight);
1104    SSDStiffenerBoxShapes[5] = new TGeoBBox("SSDStiffenerBoxShape6",
1105                                                                                   0.5*(fgkSSDStiffenerLength
1106                                                          -                                 fgkSSDConnectorPosition[0]),
1107                                                                                   0.5* fgkSSDStiffenerWidth,
1108                                                                                   0.5* fgkSSDConnectorHeight);
1109   TGeoVolume* SSDStiffenerBox[StiffenerBoxNumber];
1110   char SSDStiffenerBoxName[30];
1111   for(Int_t i=0; i<StiffenerBoxNumber; i++){ 
1112         sprintf(SSDStiffenerBoxName,"SSDStiffenerBox%i",i+1);
1113     SSDStiffenerBox[i] = new TGeoVolume(SSDStiffenerBoxName,SSDStiffenerBoxShapes[i],
1114                                                                           fgkSSDStiffenerMedium);
1115         SSDStiffenerBox[i]->SetLineColor(fColorStiffener);
1116   }
1117 ////////////////////////////
1118 // Connector 
1119 ///////////////////////////
1120   TGeoBBox* SSDConnectorShape =  new TGeoBBox("SSDConnectorShape",
1121                                                                                          0.5*fgkSSDConnectorLength,
1122                                                                                          0.5*fgkSSDConnectorWidth,
1123                                                                                          0.5*fgkSSDConnectorHeight);
1124   TGeoVolume* SSDConnector    = new TGeoVolume("SSDConnector",SSDConnectorShape,
1125                                                                                                 fgkSSDStiffenerConnectorMedium); 
1126   SSDConnector->SetLineColor(fColorAl);
1127   const Int_t SSDConnectorNumber = 2;
1128   TGeoTranslation* SSDConnectorTrans[SSDConnectorNumber];
1129   SSDConnectorTrans[0] = new TGeoTranslation("SSDConnectorTrans1",
1130         -  SSDStiffenerBoxShapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1131                 -  fgkSSDConnectorSeparation-1.5*fgkSSDConnectorLength,
1132                    SSDStiffenerBoxShapes[0]->GetDY()-fgkSSDConnectorPosition[1]
1133                 -  SSDConnectorShape->GetDY(),
1134                    SSDStiffenerBoxShapes[0]->GetDZ()+SSDConnectorShape->GetDZ());       
1135   SSDConnectorTrans[1] = new TGeoTranslation("SSDConnectorTrans2",
1136         -  SSDStiffenerBoxShapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1137         -  0.5*fgkSSDConnectorLength,
1138            SSDStiffenerBoxShapes[0]->GetDY()-fgkSSDConnectorPosition[1]
1139                 -  SSDConnectorShape->GetDY(),
1140                    SSDStiffenerBoxShapes[0]->GetDZ()+SSDConnectorShape->GetDZ());
1141   for(Int_t i=0; i<SSDConnectorNumber; i++)
1142                         SSDStiffener->AddNode(SSDConnector,i+1,SSDConnectorTrans[i]);   
1143 //////////////////////////////////////
1144 // TGeoTranslation for Stiffener Boxes
1145 //////////////////////////////////////
1146   TGeoTranslation* SSDStiffenerBoxTrans[StiffenerBoxNumber];
1147   SSDStiffenerBoxTrans[0] = new TGeoTranslation("SSDStiffenerBoxTrans1",0.,0.,0.);
1148   SSDStiffenerBoxTrans[1] = new TGeoTranslation("SSDStiffenerBoxTrans2",
1149                  - (SSDStiffenerBoxShapes[0]->GetDX()-SSDStiffenerBoxShapes[1]->GetDX()),
1150                     0.,
1151                         SSDStiffenerBoxShapes[0]->GetDZ()+SSDStiffenerBoxShapes[1]->GetDZ());
1152   SSDStiffenerBoxTrans[2] = new TGeoTranslation("SSDStiffenerBoxTrans3",
1153          - SSDStiffenerBoxShapes[0]->GetDX()-SSDStiffenerBoxShapes[2]->GetDX()
1154                  + fgkSSDConnectorPosition[0],
1155                    SSDStiffenerBoxShapes[0]->GetDY()-SSDStiffenerBoxShapes[2]->GetDY(),
1156                    SSDStiffenerBoxShapes[0]->GetDZ()+SSDStiffenerBoxShapes[2]->GetDZ());
1157   SSDStiffenerBoxTrans[3] = new TGeoTranslation("SSDStiffenerBoxTrans4",
1158          - SSDStiffenerBoxShapes[0]->GetDX()-SSDStiffenerBoxShapes[3]->GetDX()
1159                  + fgkSSDConnectorPosition[0],
1160                  - SSDStiffenerBoxShapes[0]->GetDY()+SSDStiffenerBoxShapes[3]->GetDY(),
1161                    SSDStiffenerBoxShapes[0]->GetDZ()+SSDStiffenerBoxShapes[3]->GetDZ());
1162   SSDStiffenerBoxTrans[4] = new TGeoTranslation("SSDStiffenerBoxTrans5",
1163                  - SSDStiffenerBoxShapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1164                  - 0.5*fgkSSDConnectorSeparation-2.*SSDConnectorShape->GetDX(),
1165                    SSDStiffenerBoxShapes[0]->GetDY()-fgkSSDConnectorPosition[1]
1166                  - SSDConnectorShape->GetDY(),
1167                    SSDStiffenerBoxShapes[0]->GetDZ()+SSDConnectorShape->GetDZ());
1168   SSDStiffenerBoxTrans[5] = new TGeoTranslation("SSDStiffenerBoxTrans6",
1169          - SSDStiffenerBoxShapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1170                  + SSDStiffenerBoxShapes[5]->GetDX(),
1171                    0.,
1172                    SSDStiffenerBoxShapes[0]->GetDZ()+SSDStiffenerBoxShapes[5]->GetDZ());
1173   for(Int_t i=0; i<StiffenerBoxNumber; i++) 
1174                 SSDStiffener->AddNode(SSDStiffenerBox[i],1,SSDStiffenerBoxTrans[i]);    
1175   TGeoCombiTrans* SSDStiffenerCombiTrans[SSDStiffenerNumber];
1176   char SSDStiffenerCombiTransName[30];
1177     for(Int_t i=0; i<SSDStiffenerNumber; i++){ 
1178         sprintf(SSDStiffenerCombiTransName,"SSDStiffenerCombiTrans%i",i+1);
1179     SSDStiffenerCombiTrans[i] = new TGeoCombiTrans(SSDStiffenerCombiTransName,
1180                         0.,i*SSDStiffenerSeparation,0.,new TGeoRotation("",180*(1-i),0.,0.));
1181   }
1182 ////////////////////////////
1183 // Capacitor 0603-2200 nF
1184 ///////////////////////////
1185   const Int_t Capacitor0603Number = 5;
1186   TGeoBBox* Capacitor0603Shape =  new TGeoBBox("Capacitor0603Shape",
1187                                                                                          0.5*fgkSSDCapacitor0603Length,
1188                                                                                          0.5*fgkSSDCapacitor0603Width,
1189                                                                                          0.5*fgkSSDCapacitor0603Height);
1190   TGeoVolume* Capacitor0603 = new TGeoVolume("Capacitor0603",Capacitor0603Shape,
1191                                              fgkSSDStiffener0603CapacitorMedium); 
1192   Capacitor0603->SetLineColor(fColorAl);
1193 ////////////////////////////
1194 // Capacitor 1812-330 nF
1195 ///////////////////////////
1196   TGeoBBox* Capacitor1812Shape =  new TGeoBBox("Capacitor1812Shape",
1197                                                                                          0.5*fgkSSDCapacitor1812Length,
1198                                                                                          0.5*fgkSSDCapacitor1812Width,
1199                                                                                          0.5*fgkSSDCapacitor1812Height);
1200   TGeoVolume* Capacitor1812 = new TGeoVolume("Capacitor1812",Capacitor1812Shape,
1201                                              fgkSSDStiffener1812CapacitorMedium); 
1202   Capacitor1812->SetLineColor(fColorAl);
1203   TGeoTranslation* Capacitor1812Trans = new TGeoTranslation("Capacitor1812Trans",
1204                           0.,
1205                           0.5*fgkSSDStiffenerWidth+SSDStiffenerSeparation
1206                -  Capacitor1812Shape->GetDY()-fgkSSDConnectorPosition[1],
1207                           SSDStiffenerBoxShapes[0]->GetDZ()+fgkSSDConnectorHeight
1208                    +  0.5*fgkSSDCapacitor1812Height);
1209 ////////////////////////////
1210 //Hybrid Wire
1211 ////////////////////////////
1212   Double_t WireX = 2.*(fgkSSDConnectorPosition[0]-0.5*fgkSSDStiffenerLength
1213                                  - 0.5*fgkSSDConnectorLength)-fgkSSDConnectorLength
1214                                  - fgkSSDConnectorSeparation;
1215   Double_t WireY = SSDStiffenerSeparation+fgkSSDStiffenerWidth
1216                                  - 2.*fgkSSDConnectorPosition[1]-fgkSSDConnectorWidth;
1217   Double_t SSDWireRadius = TMath::Sqrt(TMath::Power(WireX,2.)
1218                                          + TMath::Power(WireY,2));
1219   Double_t WireAngle = TMath::ATan(WireX/WireY);
1220   TGeoTube *HybridWireShape = new TGeoTube("HybridWireShape", 0., 
1221                                                 fgkSSDWireRadius, 0.5*SSDWireRadius);
1222   TGeoVolume* HybridWire = new TGeoVolume("HybridWire",HybridWireShape,
1223                                              fgkSSDStiffenerHybridWireMedium); 
1224   HybridWire->SetLineColor(fColorPhynox);
1225   TGeoCombiTrans* HybridWireCombiTrans[2];
1226   HybridWireCombiTrans[0] = new TGeoCombiTrans("HybridWireCombiTrans1",
1227                    0.5*fgkSSDStiffenerLength-fgkSSDConnectorPosition[0]
1228                                  + 1.5*fgkSSDConnectorLength+fgkSSDConnectorSeparation,
1229                    0.5*SSDWireRadius-0.5*fgkSSDStiffenerWidth
1230                                  + fgkSSDConnectorPosition[1]+0.5*fgkSSDConnectorWidth,
1231                                    SSDStiffenerBoxShapes[0]->GetDZ()+fgkSSDConnectorHeight
1232                                  + fgkSSDWireRadius,
1233                    new TGeoRotation("HybridWireRot1",0.,90.,0.));
1234   HybridWireCombiTrans[1] = new TGeoCombiTrans("HybridWireCombiTrans2",
1235                                    0.,
1236                                  - 0.5*fgkSSDConnectorWidth+fgkSSDWireRadius,
1237                                    0.,  
1238                    new TGeoRotation("HybridWireRot2",
1239                                  -                  WireAngle*TMath::RadToDeg(),0.,0.));
1240   TGeoHMatrix* HybridWireMatrix = new TGeoHMatrix();
1241   HybridWireMatrix->MultiplyLeft(HybridWireCombiTrans[0]);
1242   HybridWireMatrix->MultiplyLeft(HybridWireCombiTrans[1]);
1243 ////////////////////////////
1244 // Stiffener Assembly
1245 ///////////////////////////
1246   TGeoVolume* SSDStiffenerAssembly = 
1247                                                                 new TGeoVolumeAssembly("SSDStiffenerAssembly");
1248   SSDStiffenerAssembly->AddNode(HybridWire,1,HybridWireMatrix);
1249   for(Int_t i=0; i<SSDStiffenerNumber; i++) {
1250         SSDStiffenerAssembly->AddNode(SSDStiffener,i+1,SSDStiffenerCombiTrans[i]);
1251         for(Int_t j=1; j<Capacitor0603Number+1; j++){
1252     SSDStiffenerAssembly->AddNode(Capacitor0603,Capacitor0603Number*i+j,new TGeoTranslation("",(j-3.
1253         )/6*fgkSSDStiffenerLength,
1254                                         i*SSDStiffenerSeparation+
1255                                         0.5*((i==0? 1:-1)*fgkSSDStiffenerWidth
1256                                         +(i==0? -1:+1)*fgkSSDCapacitor0603Width),
1257                                         -0.5*(fgkSSDStiffenerHeight+fgkSSDCapacitor0603Height)));
1258         }
1259         if(i==1) SSDStiffenerAssembly->AddNode(Capacitor1812,1,Capacitor1812Trans);
1260 }
1261   return SSDStiffenerAssembly;
1262 }
1263 /////////////////////////////////////////////////////////////////////////////////
1264 TGeoVolume* AliITSv11GeometrySSD::GetSSDChipCables(Double_t SSDChipCablesHeigth, 
1265                                                                                                                                         char* side){
1266 ////////////////////////////////////////////////////////////////////////////////
1267   const Int_t SSDChipCablesLayNumber = 2;
1268   Int_t SSDChipCablesColor[2] = {fColorAl,fColorPolyhamide};
1269   Double_t SSDChipCablesRadius[2];
1270   SSDChipCablesRadius[0] = 0.25*(SSDChipCablesHeigth
1271                                                  -  fgkSSDChipCablesHeight[0]
1272                                                  -  fgkSSDChipCablesHeight[1]);
1273   SSDChipCablesRadius[1] = SSDChipCablesRadius[0]-fgkSSDChipCablesHeight[0];
1274   Double_t SSDChipCablesPieceLength = 0.5*(fgkSSDChipCablesWidth[0]
1275                                                                     - 2.*TMath::Pi()*SSDChipCablesRadius[0]
1276                                                                         - SSDChipCablesRadius[0]
1277                                                                         - fgkSSDChipCablesWidth[1]
1278                                                                         - fgkSSDChipCablesWidth[2]
1279                                                                         - (side=="Right" ? 0 : 
1280                                                                           fgkSSDModuleStiffenerPosition[1]
1281                                                                         + TMath::Pi()*(0.5*fgkSSDSensorHeight
1282                                                                         + fgkSSDChipCablesHeight[0]
1283                                                                         + fgkSSDChipCablesHeight[1])));
1284   //////////////////////////
1285   //Box and Tube Seg Shapes
1286   //////////////////////////
1287   char* SSDChipCablesBoxShapeName[2*SSDChipCablesLayNumber] = 
1288                                           {"SSDChipCablesBoxLay0Shape0","SSDChipCablesBoxLay0Shape1",
1289                                            "SSDChipCablesBoxLay1Shape0","SSDChipCablesBoxLay1Shape1"};
1290   char* SSDChipCablesTubeSegShapeName[2*SSDChipCablesLayNumber] = 
1291                           {"SSDChipCablesTubeSegLay0Shape0","SSDChipCablesTubeSegLay0Shape1",
1292                            "SSDChipCablesTubeSegLay1Shape0","SSDChipCablesTubeSegLay1Shape1"};
1293   TGeoBBox** SSDChipCablesBoxShape[SSDChipCablesLayNumber];
1294   TGeoTubeSeg** SSDChipCablesTubeSegShape[SSDChipCablesLayNumber];
1295   for(Int_t i=0; i<SSDChipCablesLayNumber; i++){
1296     SSDChipCablesBoxShape[i]        = new TGeoBBox*[2];
1297     SSDChipCablesTubeSegShape[i]    = new TGeoTubeSeg*[2+(side=="Right" ? 0 : 1)];
1298     SSDChipCablesBoxShape[i][0]     = new TGeoBBox(SSDChipCablesBoxShapeName[2*i],
1299                                                                                                    0.5*SSDChipCablesPieceLength,
1300                                                                                                    0.5*fgkSSDChipCablesLength[1],
1301                                                                                                    0.5*fgkSSDChipCablesHeight[i]);
1302     SSDChipCablesBoxShape[i][1]     = new TGeoBBox(SSDChipCablesBoxShapeName[2*i+1],
1303                                                    0.5*(SSDChipCablesPieceLength+SSDChipCablesRadius[0]
1304                                          + (side=="Right" ? 0. : fgkSSDModuleStiffenerPosition[1])),            
1305                                     0.5*fgkSSDChipCablesLength[1],0.5*fgkSSDChipCablesHeight[i]);
1306     SSDChipCablesTubeSegShape[i][0] = 
1307                                            new TGeoTubeSeg(SSDChipCablesTubeSegShapeName[2*i],                                          
1308                                                    SSDChipCablesRadius[1]-i*fgkSSDChipCablesHeight[1],
1309                                                    SSDChipCablesRadius[i],0.5*fgkSSDChipCablesLength[1],
1310                                                    0.,180.);
1311     SSDChipCablesTubeSegShape[i][1] = 
1312                                            new TGeoTubeSeg(SSDChipCablesTubeSegShapeName[2*i+1],
1313                                                  SSDChipCablesRadius[0]+i*fgkSSDChipCablesHeight[0],
1314                                                          SSDChipCablesRadius[0]+fgkSSDChipCablesHeight[0]
1315                                          +               i*fgkSSDChipCablesHeight[1],
1316                                                          0.5*fgkSSDChipCablesLength[1],0.,180.);
1317     if(side!="Right") SSDChipCablesTubeSegShape[i][2] = 
1318                                          new TGeoTubeSeg(SSDChipCablesTubeSegShapeName[2*i],
1319                                                  0.5*fgkSSDSensorHeight+(1-i)*fgkSSDChipCablesHeight[1],
1320                                                  0.5*fgkSSDSensorHeight+(1-i)*fgkSSDChipCablesHeight[0]
1321                                          +   fgkSSDChipCablesHeight[1],
1322                                                  0.5*fgkSSDChipCablesLength[1],0.,180.);
1323   }
1324   //////////////////////////
1325   //Box under Chip
1326   //////////////////////////
1327   char SSDUnderChipCablesBoxShapeName[30];
1328   char SSDUnderChipCablesBoxName[30];   
1329   char SSDUnderChipCablesBoxTransName[30];      
1330   TGeoBBox* SSDUnderChipCablesBoxShape[SSDChipCablesLayNumber];
1331   TGeoVolume* SSDUnderChipCablesBox[SSDChipCablesLayNumber]; 
1332   TGeoTranslation* SSDUnderChipCablesBoxTrans[SSDChipCablesLayNumber];
1333   for(Int_t i=0; i<SSDChipCablesLayNumber; i++){ 
1334                 sprintf(SSDUnderChipCablesBoxShapeName,"SSDUnderChipCablesBoxShape%i",i+1);
1335                 sprintf(SSDUnderChipCablesBoxName,"SSDUnderChipCablesBox%i",i+1);
1336                 sprintf(SSDUnderChipCablesBoxTransName,"SSDUnderChipCablesBoxTrans%i",i+1);
1337                 SSDUnderChipCablesBoxShape[i] = 
1338                                                                    new TGeoBBox(SSDUnderChipCablesBoxShapeName,
1339                                                                    0.5*fgkSSDChipWidth,
1340                                                                    0.5*fgkSSDChipCablesLength[1],
1341                                                                    0.5*fgkSSDChipCablesHeight[i]);
1342                 SSDUnderChipCablesBox[i] = new TGeoVolume(SSDUnderChipCablesBoxName,
1343                                                                         SSDUnderChipCablesBoxShape[i],
1344                                                                         (i==0?fgkSSDAlTraceChipCableMedium:fgkSSDKaptonChipCableMedium));               
1345         SSDUnderChipCablesBox[i]->SetLineColor(SSDChipCablesColor[i]);
1346                 SSDUnderChipCablesBoxTrans[i] = 
1347                                                 new TGeoTranslation(SSDUnderChipCablesBoxTransName,
1348                                                 (side=="Right"?-1.:1.)*0.5*fgkSSDChipWidth,
1349                                                 0.5*(fgkSSDChipCablesLength[0]-fgkSSDChipCablesLength[1])
1350                                                 +0.5*fgkSSDChipCablesLength[1],
1351                                                 (i==0?1.:-1.)*0.5*fgkSSDChipCablesHeight[1-i]);
1352   }
1353   //////////////////
1354   //Trapezoid Shapes
1355   //////////////////
1356   const Int_t SSDChipCablesVertexNumber = 2;
1357   const Int_t SSDChipCablesTrapezoidNumber = 2;
1358   TVector3** SSDChipCablesTrapezoidVertex[SSDChipCablesVertexNumber];
1359   for(Int_t i = 0; i< SSDChipCablesTrapezoidNumber; i++) 
1360          SSDChipCablesTrapezoidVertex[i] = new TVector3*[SSDChipCablesVertexNumber];
1361   //First Shape Vertex Positioning
1362   SSDChipCablesTrapezoidVertex[0][0] = new TVector3();
1363   SSDChipCablesTrapezoidVertex[0][1] = 
1364                 new TVector3(0.5*(fgkSSDChipCablesLength[0]-fgkSSDChipCablesLength[1]));
1365   //Second Shape Vertex Positioning
1366   SSDChipCablesTrapezoidVertex[1][0] = 
1367                                                           new TVector3(*SSDChipCablesTrapezoidVertex[0][0]);
1368   SSDChipCablesTrapezoidVertex[1][1] = 
1369                                                           new TVector3(*SSDChipCablesTrapezoidVertex[0][1]);
1370   //Setting the names of shapes and volumes
1371   char* SSDChipCablesTrapezoidBoxShapeName[SSDChipCablesTrapezoidNumber] = 
1372                   {"SSDChipCablesTrapezoidBoxShape1","SSDChipCablesTrapezoidBoxShape2"};
1373   char* SSDChipCablesTrapezoidShapeName[SSDChipCablesTrapezoidNumber] = 
1374                   {"SSDChipCablesTrapezoidShape1","SSDChipCablesTrapezoidShape2"};
1375   char* SSDChipCablesTrapezoidBoxName[SSDChipCablesTrapezoidNumber] = 
1376                   {"SSDChipCablesTrapezoidBox1","SSDChipCablesTrapezoidBox2"};
1377   char* SSDChipCablesTrapezoidName[SSDChipCablesTrapezoidNumber] = 
1378                   {"SSDChipCablesTrapezoid1","SSDChipCablesTrapezoid2"};
1379   char* SSDChipCablesTrapezoidAssemblyName[SSDChipCablesTrapezoidNumber] = 
1380                   {"SSDChipCablesTrapezoidAssembly1","SSDChipCablesTrapezoidAssembly2"};
1381   //Setting the Shapes
1382   TGeoBBox* SSDChipCablesTrapezoidBoxShape[SSDChipCablesTrapezoidNumber]; 
1383   TGeoArb8* SSDChipCablesTrapezoidShape[SSDChipCablesTrapezoidNumber];
1384   //Setting the Volumes
1385   TGeoVolume* SSDChipCablesTrapezoidBox[SSDChipCablesTrapezoidNumber];
1386   TGeoVolume* SSDChipCablesTrapezoid[SSDChipCablesTrapezoidNumber];
1387   TGeoVolume* SSDChipCablesTrapezoidAssembly[SSDChipCablesTrapezoidNumber]; 
1388   Double_t SSDChipCablesTrapezoidWidth[SSDChipCablesVertexNumber] = 
1389    {fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2],fgkSSDChipCablesWidth[1]};
1390   for(Int_t i=0; i<SSDChipCablesTrapezoidNumber; i++){
1391     SSDChipCablesTrapezoidBoxShape[i] = 
1392                                         new TGeoBBox(SSDChipCablesTrapezoidBoxShapeName[i],
1393                                                 0.5*fgkSSDChipCablesLength[1],
1394                                             0.5*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2]),
1395                                                 0.5*fgkSSDChipCablesHeight[i]);
1396     SSDChipCablesTrapezoidShape[i] = 
1397                                                           GetTrapezoidShape(SSDChipCablesTrapezoidVertex[i],
1398                                                           SSDChipCablesTrapezoidWidth,
1399                                                           fgkSSDChipCablesHeight[i],
1400                                                           SSDChipCablesTrapezoidShapeName[i]);
1401     SSDChipCablesTrapezoidBox[i] = 
1402                                                 new TGeoVolume(SSDChipCablesTrapezoidBoxName[i],
1403                                                                            SSDChipCablesTrapezoidBoxShape[i],
1404                                                                            (i==0?fgkSSDAlTraceChipCableMedium:fgkSSDKaptonChipCableMedium));
1405     SSDChipCablesTrapezoid[i] = new TGeoVolume(SSDChipCablesTrapezoidName[i],
1406                                                                                            SSDChipCablesTrapezoidShape[i],
1407                                                                                            (i==0?fgkSSDAlTraceChipCableMedium:fgkSSDKaptonChipCableMedium));
1408     SSDChipCablesTrapezoidBox[i]->SetLineColor(SSDChipCablesColor[i]);
1409     SSDChipCablesTrapezoid[i]->SetLineColor(SSDChipCablesColor[i]);
1410     SSDChipCablesTrapezoidAssembly[i] = 
1411                                 new TGeoVolumeAssembly(SSDChipCablesTrapezoidAssemblyName[i]);
1412     SSDChipCablesTrapezoidAssembly[i]->AddNode(SSDChipCablesTrapezoidBox[i],1,
1413                                 new TGeoTranslation(0.5*fgkSSDChipCablesLength[1],
1414                                    0.5*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2]),0.));
1415     SSDChipCablesTrapezoidAssembly[i]->AddNode(SSDChipCablesTrapezoid[i],0,
1416                         new TGeoCombiTrans(0.,0.,0.,new TGeoRotation("",90.,180.,-90.)));
1417     SSDChipCablesTrapezoidAssembly[i]->AddNode(SSDChipCablesTrapezoid[i],1,
1418                         new TGeoTranslation(fgkSSDChipCablesLength[1],0.,0.));
1419   }
1420   /////////////////////////////
1421   //Box and Tube Seg CombiTrans
1422   /////////////////////////////
1423   TGeoTranslation* SSDChipCablesBoxTrans[2*SSDChipCablesLayNumber];
1424   SSDChipCablesBoxTrans[0] = 
1425                                         new TGeoTranslation("SSDChipCablesLay1Box1Trans",0.,0.,0.);
1426   SSDChipCablesBoxTrans[1] = 
1427                                         new TGeoTranslation("SSDChipCablesLay1Box2Trans",
1428                                                                                  SSDChipCablesBoxShape[0][1]->GetDX()
1429                                                    -             0.5*SSDChipCablesPieceLength,
1430                        0.0,
1431                                                    -             2.*SSDChipCablesRadius[0]
1432                                                    -             fgkSSDChipCablesHeight[0]);
1433   SSDChipCablesBoxTrans[2] = new TGeoTranslation("SSDChipCablesLay2Box1Trans",
1434                                                                                  0.0,
1435                                                                                  0.0,
1436                                                                                  0.5*(fgkSSDChipCablesHeight[0]
1437                                                    +                     fgkSSDChipCablesHeight[1]));
1438   SSDChipCablesBoxTrans[3] = 
1439                                                          new TGeoTranslation("SSDChipCablesLay2Box2Trans",
1440                                                                                  SSDChipCablesBoxShape[1][1]->GetDX()
1441                                                    -                     0.5*SSDChipCablesPieceLength,
1442                                                                                  0.0,
1443                                                    -                     2.*SSDChipCablesRadius[0]
1444                                                    -                     0.5*fgkSSDChipCablesHeight[1]
1445                                                    -                     1.5*fgkSSDChipCablesHeight[0]);
1446   TGeoRotation* SSDChipCablesRot[3];
1447   SSDChipCablesRot[0] = new TGeoRotation("SSDChipCablesRot1",0.,90.,0.);
1448   SSDChipCablesRot[1] = new TGeoRotation("SSDChipCablesRot2",90.,90.,-90.);
1449   SSDChipCablesRot[2] = new TGeoRotation("SSDChipCablesRot3",90.,-90.,-90.);
1450   TGeoCombiTrans* SSDChipCablesTubeSegCombiTrans[2*(SSDChipCablesLayNumber+
1451                                                                                                           (side=="Right" ? 0 : 1))];
1452   SSDChipCablesTubeSegCombiTrans[0] = 
1453                                 new TGeoCombiTrans("SSDChipCablesLay1TubeSeg1CombiTrans",
1454                                 0.5*SSDChipCablesPieceLength,
1455                                 0.0,
1456                                 SSDChipCablesRadius[0]
1457                         -   0.5*fgkSSDChipCablesHeight[0],
1458                                 new TGeoRotation((*SSDChipCablesRot[1])*(*SSDChipCablesRot[0])));
1459   SSDChipCablesTubeSegCombiTrans[1] = 
1460                                 new TGeoCombiTrans("SSDChipCablesLay1TubeSeg2CombiTrans",
1461                         -   0.5*SSDChipCablesPieceLength,
1462                                 0.0,
1463                         -   SSDChipCablesRadius[0]-0.5*fgkSSDChipCablesHeight[0],
1464                                 new TGeoRotation((*SSDChipCablesRot[2])*(*SSDChipCablesRot[0])));
1465   SSDChipCablesTubeSegCombiTrans[2] = 
1466   new TGeoCombiTrans("SSDChipCablesLay2TubeSeg1CombiTrans",
1467                                 0.5*SSDChipCablesPieceLength,
1468                                 0.0,
1469                                 SSDChipCablesRadius[0]-0.5*fgkSSDChipCablesHeight[0],
1470                                 new TGeoRotation((*SSDChipCablesRot[1])*(*SSDChipCablesRot[0])));
1471   SSDChipCablesTubeSegCombiTrans[3] = 
1472                                 new TGeoCombiTrans("SSDChipCablesLay2TubeSeg2CombiTrans",
1473                         -       0.5*SSDChipCablesPieceLength,
1474                                 0.0,
1475                         -       SSDChipCablesRadius[0]+0.5*fgkSSDChipCablesHeight[0]
1476                         -   fgkSSDChipCablesHeight[0],
1477                                 new TGeoRotation((*SSDChipCablesRot[2])*(*SSDChipCablesRot[0])));
1478   SSDChipCablesTubeSegCombiTrans[4] = 
1479                                 new TGeoCombiTrans("SSDChipCablesLay1TubeSeg4CombiTrans",
1480                                 0.5*SSDChipCablesPieceLength+SSDChipCablesRadius[0]
1481                         +   fgkSSDModuleStiffenerPosition[1],
1482                                 0.0,
1483                         -       2.*SSDChipCablesRadius[0]-0.5*fgkSSDChipCablesHeight[0]
1484                         -   (0.5*fgkSSDSensorHeight+fgkSSDChipCablesHeight[0]
1485                         +       fgkSSDChipCablesHeight[1]),
1486                         new TGeoRotation((*SSDChipCablesRot[1])*(*SSDChipCablesRot[0])));
1487   SSDChipCablesTubeSegCombiTrans[5] = 
1488                         new TGeoCombiTrans("SSDChipCablesLay2TubeSeg5CombiTrans",
1489                                 0.5*SSDChipCablesPieceLength+SSDChipCablesRadius[0]
1490                         +       fgkSSDModuleStiffenerPosition[1],
1491                                 0.0,
1492                         -       2.*SSDChipCablesRadius[0]-0.5*fgkSSDChipCablesHeight[0]
1493                         -       (0.5*fgkSSDSensorHeight+fgkSSDChipCablesHeight[0]
1494                         +       fgkSSDChipCablesHeight[1]),
1495                         new TGeoRotation((*SSDChipCablesRot[1])*(*SSDChipCablesRot[0])));
1496   TGeoCombiTrans* SSDChipCablesTrapezoidCombiTrans[SSDChipCablesLayNumber];
1497   SSDChipCablesTrapezoidCombiTrans[0] = (side=="Right" ? 
1498                         new TGeoCombiTrans("SSDChipCableLay1TrapezoidRightCombiTrans",
1499                                 0.5*SSDChipCablesPieceLength+SSDChipCablesTrapezoidWidth[0]
1500                         +       SSDChipCablesRadius[0],
1501                         -       0.5*fgkSSDChipCablesLength[1],
1502                         -       fgkSSDChipCablesHeight[0]-2.*SSDChipCablesRadius[0],
1503                         new TGeoRotation("",90.,0.,0.)) :
1504                         new TGeoCombiTrans("SSDChipCableLay1TrapezoidLeftCombiTrans",
1505                         -       2.*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2])
1506                         +       0.5*SSDChipCablesPieceLength+SSDChipCablesTrapezoidWidth[0]
1507                         +       SSDChipCablesRadius[0]+fgkSSDModuleStiffenerPosition[1],
1508                                 0.5*fgkSSDChipCablesLength[1],
1509                         -       2.*(fgkSSDChipCablesHeight[0]+fgkSSDChipCablesHeight[1])
1510                         -       2.*SSDChipCablesRadius[0]-fgkSSDSensorHeight,
1511                         new TGeoRotation("",-90.,0.,0.)));
1512   SSDChipCablesTrapezoidCombiTrans[1] = (side=="Right" ? 
1513                         new TGeoCombiTrans("SSDChipCableLay2TrapezoidRightCombiTrans",
1514                                 0.5*SSDChipCablesPieceLength+SSDChipCablesTrapezoidWidth[0]
1515                         +       SSDChipCablesRadius[0],
1516                         -       0.5*fgkSSDChipCablesLength[1],
1517                         -       0.5*(fgkSSDChipCablesHeight[0]+fgkSSDChipCablesHeight[1])
1518                         -       fgkSSDChipCablesHeight[0]-2.*SSDChipCablesRadius[0],
1519                                 new TGeoRotation("",90.,0.,0.)) :
1520                                 new TGeoCombiTrans("SSDChipCableLay2TrapezoidLeftCombiTrans",
1521                         -       2.*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2])
1522                         +       0.5*SSDChipCablesPieceLength+SSDChipCablesTrapezoidWidth[0]
1523                         +       SSDChipCablesRadius[0]+fgkSSDModuleStiffenerPosition[1],
1524                                 0.5*fgkSSDChipCablesLength[1],-0.5*(fgkSSDChipCablesHeight[0]
1525                         +       fgkSSDChipCablesHeight[1])-fgkSSDChipCablesHeight[1]
1526                         -       fgkSSDChipCablesHeight[0]-2.*SSDChipCablesRadius[0]
1527                         -       fgkSSDSensorHeight,new TGeoRotation("",-90.,0.,0.)));  
1528   //////////////////////////
1529   //Box and Tube Seg Volumes
1530   //////////////////////////
1531   char* SSDChipCablesBoxName[2*SSDChipCablesLayNumber] = 
1532                                                          {"SSDChipCablesLay1Box1","SSDChipCablesLay1Box2",
1533                                                           "SSDChipCablesLay2Box1","SSDChipCablesLay2Box2"};
1534   char* SSDChipRightCablesTubeSegName[2*SSDChipCablesLayNumber] = 
1535                           {"SSDChipRightCablesLay1TubeSeg1","SSDChipRightCablesLay1TubeSeg2",
1536                            "SSDChipRightCablesLay2TubeSeg1","SSDChipRightCablesLay2TubeSeg2"};
1537   char* SSDChipLeftCablesTubeSegName[2*SSDChipCablesLayNumber] = 
1538                           {"SSDChipLeftCablesLay1TubeSeg1","SSDChipLeftCablesLay1TubeSeg2",
1539                            "SSDChipLeftCablesLay2TubeSeg1","SSDChipLeftCablesLay2TubeSeg2"};
1540   char* SSDChipCablesLayAssemblyName[SSDChipCablesLayNumber] = 
1541                           {"SSDChipCablesLay1","SSDChipCablesLay2"};
1542   TGeoVolume** SSDChipCablesBox[SSDChipCablesLayNumber];
1543   TGeoVolume** SSDChipCablesTubeSeg[SSDChipCablesLayNumber];
1544   TGeoVolume* SSDChipCablesLayAssembly[SSDChipCablesLayNumber];
1545   for(Int_t i=0; i<SSDChipCablesLayNumber; i++){
1546     TGeoMedium* SSDChipCablesLayMed = 
1547             (i==0?fgkSSDAlTraceChipCableMedium:fgkSSDKaptonChipCableMedium);
1548     SSDChipCablesBox[i] = new TGeoVolume*[2];
1549     SSDChipCablesTubeSeg[i] = new TGeoVolume*[2+(side=="Right" ? 0 : 1)];
1550     SSDChipCablesBox[i][0] = new TGeoVolume(SSDChipCablesBoxName[2*i],
1551                                            SSDChipCablesBoxShape[i][0],SSDChipCablesLayMed);
1552     SSDChipCablesBox[i][1] = new TGeoVolume(SSDChipCablesBoxName[2*i+1],
1553                                            SSDChipCablesBoxShape[i][1],SSDChipCablesLayMed);
1554     SSDChipCablesTubeSeg[i][0] = new TGeoVolume(SSDChipRightCablesTubeSegName[2*i],
1555                                            SSDChipCablesTubeSegShape[i][0],SSDChipCablesLayMed);
1556     SSDChipCablesTubeSeg[i][1] = new TGeoVolume(SSDChipRightCablesTubeSegName[2*i+1],
1557                                            SSDChipCablesTubeSegShape[i][1],SSDChipCablesLayMed);
1558     SSDChipCablesBox[i][0]->SetLineColor(SSDChipCablesColor[i]);
1559     SSDChipCablesBox[i][1]->SetLineColor(SSDChipCablesColor[i]);
1560     SSDChipCablesTubeSeg[i][0]->SetLineColor(SSDChipCablesColor[i]);
1561     SSDChipCablesTubeSeg[i][1]->SetLineColor(SSDChipCablesColor[i]);
1562     SSDChipCablesLayAssembly[i] = new TGeoVolumeAssembly(SSDChipCablesLayAssemblyName[i]);
1563     SSDChipCablesLayAssembly[i]->AddNode(SSDChipCablesBox[i][0],1,
1564                                                                                  SSDChipCablesBoxTrans[2*i]);
1565     SSDChipCablesLayAssembly[i]->AddNode(SSDChipCablesBox[i][1],1,
1566                                                                                  SSDChipCablesBoxTrans[2*i+1]);
1567     SSDChipCablesLayAssembly[i]->AddNode(SSDChipCablesTubeSeg[i][0],1,
1568                                                                                  SSDChipCablesTubeSegCombiTrans[2*i]);
1569     SSDChipCablesLayAssembly[i]->AddNode(SSDChipCablesTubeSeg[i][1],1,
1570                                                                                  SSDChipCablesTubeSegCombiTrans[2*i+1]);
1571     if(side!="Right"){
1572       SSDChipCablesTubeSeg[i][2] = new TGeoVolume(SSDChipLeftCablesTubeSegName[2*i],
1573                                                                                                   SSDChipCablesTubeSegShape[i][2],
1574                                                                                                   SSDChipCablesLayMed);
1575       SSDChipCablesTubeSeg[i][2]->SetLineColor(SSDChipCablesColor[i]);
1576       SSDChipCablesLayAssembly[i]->AddNode(SSDChipCablesTubeSeg[i][2],1,
1577                                                                                    SSDChipCablesTubeSegCombiTrans[4+i]);
1578     }
1579     SSDChipCablesLayAssembly[i]->AddNode(SSDChipCablesTrapezoidAssembly[i],1,
1580                                                                                  SSDChipCablesTrapezoidCombiTrans[i]);
1581   }
1582   TGeoCombiTrans* SSDChipCablesCombiTrans[SSDChipCablesLayNumber];
1583   SSDChipCablesCombiTrans[0] = new TGeoCombiTrans("SSDChipCablesCombiTrans1",
1584                                            (side=="Right" ? -1 : 1)*0.5*SSDChipCablesPieceLength,
1585                                                 0.5*fgkSSDChipCablesLength[0],
1586                                         -       (2.*SSDChipCablesRadius[0]-fgkSSDChipCablesHeight[0]
1587                                         -       0.5*fgkSSDChipCablesHeight[1]),
1588                                                 new TGeoRotation("",(side=="Right" ? 0 : 1)*180.,0.,0.));
1589   SSDChipCablesCombiTrans[1] = new TGeoCombiTrans("SSDChipCablesCombiTrans2",
1590                                                 (side=="Right" ? -1 : 1)*0.5*SSDChipCablesPieceLength,
1591                                                 0.5*fgkSSDChipCablesLength[0],
1592                                         -       (2.*SSDChipCablesRadius[0]-fgkSSDChipCablesHeight[0]
1593                                         -       0.5*fgkSSDChipCablesHeight[1]),
1594                                                 new TGeoRotation("",(side=="Right" ? 0 : 1)*180.,0.,0.));
1595   TGeoVolume* SSDChipCablesAssembly = 
1596                                                 new TGeoVolumeAssembly("SSDChipCables");
1597   for(Int_t i=0; i<SSDChipCablesLayNumber; i++){ 
1598                 SSDChipCablesAssembly->AddNode(SSDChipCablesLayAssembly[i],1,
1599                                                                                                         SSDChipCablesCombiTrans[i]);
1600                 SSDChipCablesAssembly->AddNode(SSDUnderChipCablesBox[i],1,SSDUnderChipCablesBoxTrans[i]);
1601   }
1602   return SSDChipCablesAssembly;
1603 }
1604 /////////////////////////////////////////////////////////////////////////////////
1605 TGeoVolume* AliITSv11GeometrySSD::GetSSDChipCablesAssembly(Double_t SSDChipCablesHeigth){
1606 ////////////////////////////////////////////////////////////////////////////////
1607   const Int_t ChipCablesNumber = 2;
1608   Double_t ChipCablesTransVector = fgkSSDSensorLength
1609                                                                  - 2.*fgkSSDModuleStiffenerPosition[1]
1610                                                                  - 2.*(fgkSSDStiffenerWidth
1611                                                                  - fgkSSDStiffenerToChipDist-fgkSSDChipWidth);
1612   char* SSDChipCablesName[ChipCablesNumber] = {"Right","Left"};
1613   TGeoVolume* SSDChipCables[ChipCablesNumber];  
1614   TGeoVolume* SSDChipCablesAssembly = 
1615                                          new TGeoVolumeAssembly("SSDChipCablesAssembly");
1616   for(Int_t i=0; i<ChipCablesNumber; i++) SSDChipCables[i] = 
1617                                          GetSSDChipCables(SSDChipCablesHeigth,SSDChipCablesName[i]);
1618   for(Int_t i=0; i<ChipCablesNumber; i++)
1619     for(Int_t j=0; j<fgkSSDChipNumber; j++)
1620       SSDChipCablesAssembly->AddNode(SSDChipCables[i],fgkSSDChipNumber*i+j+1,
1621                         new TGeoTranslation(-(SSDChipCablesName[i]=="Left" ? 1. : 0.)
1622                 *       ChipCablesTransVector,(j-0.5)*fgkSSDChipCablesLength[0]
1623                 +       0.5*fgkSSDChipCablesLength[1],0.));
1624   return SSDChipCablesAssembly;
1625 }
1626 /////////////////////////////////////////////////////////////////////////////////
1627 TGeoVolume* AliITSv11GeometrySSD::GetSSDFlex(Double_t SSDFlexRadius, Double_t SSDFlexHeigth){
1628 ////////////////////////////////////////////////////////////////////////////////  
1629   const Int_t SSDFlexVolumeNumber = 3;
1630   TGeoVolume* SSDFlexVolume[SSDFlexVolumeNumber];
1631   ////////////////////////
1632   // Setting Display Color
1633   ////////////////////////
1634   Int_t SSDFlexColor;
1635   SSDFlexColor = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fColorAl: fColorPolyhamide);
1636   TGeoMedium* SSDFlexMed = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fgkSSDAlTraceFlexMedium :
1637                             fgkSSDKaptonFlexMedium);
1638   ////////////////////////
1639   // SSDFlexTrapezoidShape
1640   ////////////////////////
1641   const Int_t SSDFlexVertexNumber = 2;
1642   Double_t SSDFlexWidth[SSDFlexVertexNumber] = {fgkSSDFlexWidth[1],
1643                                                                                                 fgkSSDFlexWidth[0]};
1644   TVector3* SSDFlexVertex[SSDFlexVertexNumber];
1645   SSDFlexVertex[0] = new TVector3();
1646   SSDFlexVertex[1] = new TVector3(fgkSSDFlexLength[0]-fgkSSDFlexLength[1]);
1647   TGeoArb8* SSDFlexTrapezoidShape = GetTrapezoidShape(SSDFlexVertex,
1648                                                                                                           SSDFlexWidth,SSDFlexHeigth,
1649                                                                                                           "SSDFlexTrapezoidShape");
1650   SSDFlexVolume[0] = new TGeoVolume("SSDFlexTrapezoid",SSDFlexTrapezoidShape,SSDFlexMed);
1651   SSDFlexVolume[0]->SetLineColor(SSDFlexColor);
1652   /////////////////////////
1653   //SSDFlexTubeSeg Assembly
1654   /////////////////////////
1655   const Int_t SSDFlexTubeSegNumber = 2;
1656   TGeoTubeSeg* SSDFlexTubeSegShape[SSDFlexTubeSegNumber];
1657   Double_t SSDFlexRadiusMax = (fgkSSDFlexLength[3]-fgkSSDFlexLength[2])
1658                                                         /  TMath::Tan(fgkSSDFlexAngle*TMath::DegToRad());
1659   SSDFlexTubeSegShape[0] = new TGeoTubeSeg("SSDFlexTubeSegShape1",
1660                                                    SSDFlexRadius,SSDFlexRadius+SSDFlexHeigth,
1661                                                    0.5*fgkSSDFlexWidth[0],0.,180.);
1662   SSDFlexTubeSegShape[1] = new TGeoTubeSeg("SSDFlexTubeSegShape2",
1663                                                    SSDFlexRadiusMax-SSDFlexRadius-SSDFlexHeigth,
1664                                                    SSDFlexRadiusMax-SSDFlexRadius,0.5*fgkSSDFlexWidth[0],
1665                                                    0.,2.*fgkSSDFlexAngle);
1666   TGeoRotation** SSDFlexTubSegRot[SSDFlexTubeSegNumber];
1667   for(Int_t i = 0; i<SSDFlexTubeSegNumber; i++) 
1668                                                                           SSDFlexTubSegRot[i] = new TGeoRotation*[2]; 
1669   SSDFlexTubSegRot[0][0] = new TGeoRotation("SSDFlexTubeSeg1Rot1", 0., 90.,  0.);
1670   SSDFlexTubSegRot[0][1] = new TGeoRotation("SSDFlexTubeSeg1Rot2",90., 90.,-90.);
1671   SSDFlexTubSegRot[1][0] = new TGeoRotation("SSDFlexTubeSeg2Rot1", 0.,-90.,  0.);
1672   SSDFlexTubSegRot[1][1] = new TGeoRotation("SSDFlexTubeSeg2Rot2",90., 90.,-90.);
1673   TGeoCombiTrans* SSDFlexTubeSegCombiTrans[SSDFlexTubeSegNumber];
1674   SSDFlexTubeSegCombiTrans[0] = new TGeoCombiTrans("SSDFlexTubeSegCombiTrans1",
1675                                                                 fgkSSDFlexLength[0],0.5*fgkSSDFlexWidth[0],
1676                                                                 SSDFlexRadius+0.5*SSDFlexHeigth,
1677                                                                 new TGeoRotation((*SSDFlexTubSegRot[0][1])
1678                                                         *       (*SSDFlexTubSegRot[0][0])));
1679   SSDFlexTubeSegCombiTrans[1] = new TGeoCombiTrans("SSDFlexTubeSegCombiTrans2",
1680                                                                 fgkSSDFlexLength[0]-fgkSSDFlexLength[2],
1681                                                                 0.5*fgkSSDFlexWidth[0],
1682                                                                 SSDFlexRadiusMax+0.5*SSDFlexHeigth+SSDFlexRadius,
1683                                                                 new TGeoRotation((*SSDFlexTubSegRot[1][1])
1684                                                         *       (*SSDFlexTubSegRot[1][0])));
1685   SSDFlexVolume[1] = new TGeoVolumeAssembly("SSDFlexTubeSegAssembly");
1686   TGeoVolume* SSDFlexTubeSeg[SSDFlexTubeSegNumber];
1687   char SSDFlexTubeSegName[30];
1688   for(Int_t i=0; i<SSDFlexTubeSegNumber; i++){ 
1689                 sprintf(SSDFlexTubeSegName,"SSDFlexTubeSeg%i",i+1);
1690                 SSDFlexTubeSeg[i] = new TGeoVolume(SSDFlexTubeSegName,SSDFlexTubeSegShape[i],
1691                                      SSDFlexMed);
1692                 SSDFlexTubeSeg[i]->SetLineColor(SSDFlexColor);
1693         SSDFlexVolume[1]->AddNode(SSDFlexTubeSeg[i],1,SSDFlexTubeSegCombiTrans[i]);
1694   }
1695   ///////////
1696   //Box Shape 
1697   ///////////
1698   const Int_t SSDFlexBoxNumber = 7;
1699   Double_t SSDFlexBoxLength[SSDFlexBoxNumber];
1700   SSDFlexBoxLength[0] = 0.5*(fgkSSDChipNumber
1701                                           *     fgkSSDChipLength+(fgkSSDChipNumber-1)
1702                                           *     fgkSSDChipSeparationLength
1703                                           - fgkSSDModuleSensorSupportDistance-fgkSSDFlexHoleLength)
1704                                           - (fgkSSDFlexLength[0]-fgkSSDFlexLength[1]);
1705   SSDFlexBoxLength[1] = fgkSSDModuleSensorSupportDistance+fgkSSDFlexHoleLength;
1706   SSDFlexBoxLength[2] = 0.5*(fgkSSDModuleSensorSupportDistance
1707                                           -     fgkSSDFlexHoleLength-fgkSSDFlexHoleWidth);      
1708   SSDFlexBoxLength[3] = fgkSSDFlexHoleWidth;    
1709   SSDFlexBoxLength[4] = fgkSSDFlexLength[1]-SSDFlexBoxLength[0]
1710                                           -     SSDFlexBoxLength[1];
1711   SSDFlexBoxLength[5] = fgkSSDFlexLength[2];    
1712   SSDFlexBoxLength[6] = fgkSSDFlexFullLength-2.*fgkSSDFlexAngle
1713                                           *     TMath::DegToRad()*SSDFlexRadiusMax
1714                                           - fgkSSDFlexLength[2]-TMath::Pi()
1715                                           *     fgkSSDStiffenerHeight-fgkSSDFlexLength[0];      
1716   Double_t SSDFlexBoxWidth[SSDFlexBoxNumber];
1717   SSDFlexBoxWidth[0] = fgkSSDFlexWidth[0];
1718   SSDFlexBoxWidth[1] = fgkSSDFlexWidth[0]-fgkSSDFlexHoleWidth;
1719   SSDFlexBoxWidth[2] = fgkSSDFlexHoleWidth;
1720   SSDFlexBoxWidth[3] = SSDFlexBoxWidth[2]-fgkSSDFlexHoleLength;
1721   SSDFlexBoxWidth[4] = fgkSSDFlexWidth[0];
1722   SSDFlexBoxWidth[5] = fgkSSDFlexWidth[0];
1723   SSDFlexBoxWidth[6] = fgkSSDFlexWidth[0];
1724   TGeoBBox* SSDFlexBoxShape[SSDFlexBoxNumber+1];
1725   for(Int_t i=0; i<SSDFlexBoxNumber+1; i++) SSDFlexBoxShape[i] = 
1726                                                 (i!= SSDFlexBoxNumber ? new TGeoBBox("SSDFlexBoxShape",
1727                                                                 0.5*SSDFlexBoxLength[i],
1728                                                                 0.5*SSDFlexBoxWidth[i],0.5*SSDFlexHeigth) : 
1729                                                                 SSDFlexBoxShape[2]);
1730   //////////////////////////////
1731   //SSDFlex Box Shape CombiTrans 
1732   //////////////////////////////
1733   TGeoCombiTrans* SSDFlexBoxCombiTrans[SSDFlexBoxNumber+1];
1734   SSDFlexBoxCombiTrans[0] = new TGeoCombiTrans("SSDFlexBoxCombiTrans0",
1735                                                                 SSDFlexVertex[1]->X()+0.5*SSDFlexBoxLength[0],
1736                                                                 0.5*fgkSSDFlexWidth[0],0.,0);
1737   SSDFlexBoxCombiTrans[1] = new TGeoCombiTrans("SSDFlexBoxCombiTrans1",
1738                                                                 SSDFlexVertex[1]->X()+SSDFlexBoxLength[0]
1739                                                         +       0.5*SSDFlexBoxLength[1],
1740                                                                 fgkSSDFlexHoleWidth+0.5*SSDFlexBoxWidth[1],0.,0);
1741   SSDFlexBoxCombiTrans[2] = new TGeoCombiTrans("SSDFlexBoxCombiTrans2",
1742                                                                 SSDFlexVertex[1]->X()+SSDFlexBoxLength[0]
1743                                                         +       fgkSSDFlexHoleLength+0.5*SSDFlexBoxLength[2],
1744                                                                 0.5*SSDFlexBoxWidth[2],0.,0);
1745   SSDFlexBoxCombiTrans[3] = new TGeoCombiTrans("SSDFlexBoxCombiTrans3",
1746                                                                 SSDFlexVertex[1]->X()+SSDFlexBoxLength[0]
1747                                                         +       fgkSSDFlexHoleLength+SSDFlexBoxLength[2]
1748                                                         +       0.5*fgkSSDFlexHoleWidth,
1749                                                                 fgkSSDFlexHoleLength+0.5*SSDFlexBoxWidth[3],0.,0);
1750   SSDFlexBoxCombiTrans[4] = new TGeoCombiTrans("SSDFlexBoxCombiTrans4",
1751                                                                 SSDFlexVertex[1]->X()+SSDFlexBoxLength[0]
1752                                                         +       SSDFlexBoxLength[1]+0.5*SSDFlexBoxLength[4],
1753                                                                 0.5*fgkSSDFlexWidth[0],0.,0);
1754   SSDFlexBoxCombiTrans[5] = new TGeoCombiTrans("SSDFlexBoxCombiTrans5",
1755                                                         -       0.5*fgkSSDFlexLength[2]+fgkSSDFlexLength[0],
1756                                                                 0.5*fgkSSDFlexWidth[0],
1757                                                                 2.*SSDFlexRadius+SSDFlexHeigth,0);
1758   SSDFlexBoxCombiTrans[6] = new TGeoCombiTrans("SSDFlexBoxCombiTrans6",
1759                                                         -       SSDFlexBoxShape[6]->GetDX()
1760                                                         +       SSDFlexBoxShape[6]->GetDX()
1761                                                         *       TMath::Cos(2.*fgkSSDFlexAngle*TMath::DegToRad())
1762                                                         +       fgkSSDFlexLength[0]-fgkSSDFlexLength[2]
1763                                                         -       (SSDFlexRadiusMax-SSDFlexRadius-0.5*SSDFlexHeigth)
1764                                                         *       TMath::Cos(fgkSSDFlexAngle*TMath::DegToRad()),
1765                                                                 0.5*fgkSSDFlexWidth[0],SSDFlexBoxShape[6]->GetDX()
1766                                                                 *TMath::Sin(2.*fgkSSDFlexAngle*TMath::DegToRad())
1767                                                         +       SSDFlexHeigth+2.*SSDFlexRadius+(SSDFlexRadiusMax
1768                                                         -       SSDFlexRadius-0.5*SSDFlexHeigth)
1769                                                         *       TMath::Sin(fgkSSDFlexAngle*TMath::DegToRad()),
1770                                                                 new TGeoRotation("",90.,2.*fgkSSDFlexAngle,-90.));
1771   SSDFlexBoxCombiTrans[7] = new TGeoCombiTrans("SSDFlexBoxCombiTrans7",
1772                                                                 SSDFlexVertex[1]->X()+SSDFlexBoxLength[0]
1773                                                         +       fgkSSDFlexHoleLength+1.5*SSDFlexBoxLength[2]
1774                                                         +       SSDFlexBoxLength[3],
1775                                                                 0.5*SSDFlexBoxWidth[2],0.,0);
1776   ////////////////////////////
1777   //SSDFlex Box Shape Assembly 
1778   ////////////////////////////
1779   SSDFlexVolume[2] = new TGeoVolumeAssembly("SSDFlexBoxAssembly");
1780   TGeoVolume* SSDFlexBox[SSDFlexBoxNumber+1];
1781   TGeoVolume* SSDEndFlex = GetSSDEndFlex(SSDFlexBoxLength[6],SSDFlexHeigth);
1782   TGeoHMatrix* SSDEndFlexHMatrix = new TGeoHMatrix();
1783   TGeoRotation* SSDEndFlexRot= new TGeoRotation("SSDEndFlexRot",180.,0.,0);
1784   SSDEndFlexHMatrix->MultiplyLeft(SSDEndFlexRot);
1785   SSDEndFlexHMatrix->MultiplyLeft(SSDFlexBoxCombiTrans[6]);
1786   char SSDFlexBoxName[30];
1787   for(Int_t i=0; i<SSDFlexBoxNumber+1; i++){
1788         sprintf(SSDFlexBoxName,"SSDFlexBox%i",i!=SSDFlexBoxNumber?i+1:7);
1789         if(i==6){SSDFlexVolume[2]->AddNode(SSDEndFlex,1,SSDEndFlexHMatrix);}
1790         else{
1791     SSDFlexBox[i] = new TGeoVolume(SSDFlexBoxName,SSDFlexBoxShape[i],
1792                                    SSDFlexMed);
1793         SSDFlexBox[i]->SetLineColor(SSDFlexColor);
1794         SSDFlexVolume[2]->AddNode(SSDFlexBox[i],1,SSDFlexBoxCombiTrans[i]);}
1795  }
1796   //////////////////////
1797   //SSDFlex Construction
1798   //////////////////////
1799   TGeoVolume* SSDFlex = new TGeoVolumeAssembly("SSDFlex");
1800   for(Int_t i =0; i<SSDFlexVolumeNumber; i++) SSDFlex->AddNode(SSDFlexVolume[i],1);
1801   return SSDFlex;
1802 }
1803 /////////////////////////////////////////////////////////////////////////////////
1804 TGeoVolume* AliITSv11GeometrySSD::GetSSDEndFlex(Double_t SSDEndFlexLength, 
1805                                                                                                                 Double_t SSDFlexHeigth){
1806   /////////////////////////////////////////
1807   // Setting Display Color, Media and Index
1808   /////////////////////////////////////////
1809   Int_t SSDFlexColor;
1810   SSDFlexColor = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fColorAl: fColorPolyhamide);
1811   TGeoMedium* SSDFlexMed = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fgkSSDAlTraceFlexMedium :
1812                             fgkSSDKaptonFlexMedium);
1813   ////////////////////////
1814   const Int_t SSDEndFlexBoxNumber = 5;
1815   TGeoBBox* SSDEndFlexBBoxShape[SSDEndFlexBoxNumber];
1816   SSDEndFlexBBoxShape[0] = new TGeoBBox("SSDFlexBoxShape1",
1817                                                                    0.5*SSDEndFlexLength,0.5*fgkSSDFlexWidth[0],
1818                                                                    0.5*SSDFlexHeigth);
1819   SSDEndFlexBBoxShape[1] = new TGeoBBox("SSDFlexBoxShape2",
1820                                     0.5*fgkSSDEndFlexCompLength[1],
1821                                         0.5*(fgkSSDEndFlexCompWidth[0]-fgkSSDFlexWidth[0])/2,
1822                                         0.5*SSDFlexHeigth);
1823   SSDEndFlexBBoxShape[2] = new TGeoBBox("SSDFlexBoxShape3",
1824                                     0.5*fgkSSDEndFlexCompLength[2],
1825                                         0.5*(fgkSSDEndFlexCompWidth[1]-fgkSSDFlexWidth[0])/2,
1826                                         0.5*SSDFlexHeigth);
1827   SSDEndFlexBBoxShape[3] = new TGeoBBox("SSDFlexBoxShape4",
1828                                     0.5*fgkSSDEndFlexCompLength[3],
1829                                         0.5*(fgkSSDEndFlexCompWidth[0]-fgkSSDFlexWidth[0])/2,
1830                                         0.5*SSDFlexHeigth);
1831   SSDEndFlexBBoxShape[4] = new TGeoBBox("SSDFlexBoxShape5",
1832                                     0.5*(fgkSSDEndFlexCompLength[4]+fgkSSDEndFlexCompLength[5]),
1833                                         0.25*(fgkSSDEndFlexCompWidth[2]-fgkSSDFlexWidth[0])/2,
1834                                         0.5*SSDFlexHeigth);
1835   TGeoVolume* SSDEndFlexBBox[SSDEndFlexBoxNumber];  
1836   char SSDEndFlexBBoxName[30];
1837   for(Int_t i=0; i<SSDEndFlexBoxNumber; i++){
1838         sprintf(SSDEndFlexBBoxName,"SSDEndFlexBBox%i",i+1);
1839         SSDEndFlexBBox[i] = new TGeoVolume(SSDEndFlexBBoxName,
1840                      SSDEndFlexBBoxShape[i],
1841                      SSDFlexMed);
1842         SSDEndFlexBBox[i]->SetLineColor(SSDFlexColor);
1843   }
1844   TGeoVolume* SSDEndFlex = new TGeoVolumeAssembly("SSDEndFlex");
1845   Double_t PartialSumLength = 0.;
1846   for(Int_t i=0; i<SSDEndFlexBoxNumber+1; i++) PartialSumLength += fgkSSDEndFlexCompLength[i];
1847   Double_t ReferenceLength = SSDEndFlexLength-PartialSumLength;
1848   SSDEndFlex->AddNode(SSDEndFlexBBox[0],1);
1849   SSDEndFlex->AddNode(SSDEndFlexBBox[1],1,new TGeoTranslation(
1850                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1851                                         +  0.5*fgkSSDEndFlexCompLength[1],
1852                                            0.5*fgkSSDFlexWidth[0]+SSDEndFlexBBoxShape[1]->GetDY(),
1853                                            0.));
1854   SSDEndFlex->AddNode(SSDEndFlexBBox[1],2,new TGeoTranslation(
1855                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1856                                         +  0.5*fgkSSDEndFlexCompLength[1],
1857                                         -  0.5*fgkSSDFlexWidth[0]-SSDEndFlexBBoxShape[1]->GetDY(),
1858                                            0.));
1859   SSDEndFlex->AddNode(SSDEndFlexBBox[2],1,new TGeoTranslation(
1860                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1861                                         +  fgkSSDEndFlexCompLength[1]+0.5*fgkSSDEndFlexCompLength[2],
1862                                         +  0.5*fgkSSDFlexWidth[0]+SSDEndFlexBBoxShape[2]->GetDY(),
1863                                            0.));
1864   SSDEndFlex->AddNode(SSDEndFlexBBox[2],2,new TGeoTranslation(
1865                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1866                                         +  fgkSSDEndFlexCompLength[1]+0.5*fgkSSDEndFlexCompLength[2],
1867                                         -  0.5*fgkSSDFlexWidth[0]-SSDEndFlexBBoxShape[2]->GetDY(),
1868                                            0.));
1869   SSDEndFlex->AddNode(SSDEndFlexBBox[3],1,new TGeoTranslation(
1870                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1871                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
1872                                         +  0.5*fgkSSDEndFlexCompLength[3],
1873                                         +  0.5*fgkSSDFlexWidth[0]+SSDEndFlexBBoxShape[3]->GetDY(),
1874                                            0.));
1875   SSDEndFlex->AddNode(SSDEndFlexBBox[3],2,new TGeoTranslation(
1876                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1877                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
1878                                         +  0.5*fgkSSDEndFlexCompLength[3],
1879                                         -  0.5*fgkSSDFlexWidth[0]-SSDEndFlexBBoxShape[3]->GetDY(),
1880                                            0.));
1881   SSDEndFlex->AddNode(SSDEndFlexBBox[4],1,new TGeoTranslation(
1882                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1883                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
1884                                         +  fgkSSDEndFlexCompLength[3]+0.5*(fgkSSDEndFlexCompLength[4]+fgkSSDEndFlexCompLength[5]),
1885                                         +  0.5*fgkSSDFlexWidth[0]+SSDEndFlexBBoxShape[4]->GetDY(),
1886                                            0.));
1887   SSDEndFlex->AddNode(SSDEndFlexBBox[4],2,new TGeoTranslation(
1888                                         -  0.5*SSDEndFlexLength+ReferenceLength+fgkSSDEndFlexCompLength[0]
1889                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
1890                                         +  fgkSSDEndFlexCompLength[3]+0.5*(fgkSSDEndFlexCompLength[4]
1891                                         +  fgkSSDEndFlexCompLength[5]),
1892                                         -  0.5*fgkSSDFlexWidth[0]-SSDEndFlexBBoxShape[4]->GetDY(),
1893                                            0.));
1894   return SSDEndFlex;
1895 }
1896 /////////////////////////////////////////////////////////////////////////////////
1897 TGeoVolume* AliITSv11GeometrySSD::GetSSDFlexAssembly(){
1898 ////////////////////////////////////////////////////////////////////////////////
1899   TGeoVolume* SSDFlexAssembly = new TGeoVolumeAssembly("SSDFlexAssembly");
1900   const Int_t SSDFlexLayerNumber = 4;
1901   Double_t SSDFlexHeight[SSDFlexLayerNumber];
1902   Double_t SSDFlexRadius[SSDFlexLayerNumber];
1903   TGeoTranslation* SSDFlexTrans[SSDFlexLayerNumber];
1904   for(Int_t i=0; i<SSDFlexLayerNumber; i++){ 
1905     SSDFlexHeight[i] = (i%2==0 ? fgkSSDFlexHeight[0] : fgkSSDFlexHeight[1]);
1906     SSDFlexRadius[i] = (i==0 ? fgkSSDStiffenerHeight : SSDFlexRadius[i-1]
1907                                          +                                         SSDFlexHeight[i-1]);
1908     SSDFlexTrans[i]  = new TGeoTranslation(0.,0.,-0.5*i*(SSDFlexHeight[0]
1909                                          +                                         SSDFlexHeight[1])); 
1910     SSDFlexAssembly->AddNode(GetSSDFlex(SSDFlexRadius[i],SSDFlexHeight[i]),i+1,
1911                                                                                    SSDFlexTrans[i]);   
1912   }
1913   return SSDFlexAssembly;
1914 }
1915 /////////////////////////////////////////////////////////////////////////////////
1916 TGeoVolume* AliITSv11GeometrySSD::GetSSDCoolingBlockAssembly(){
1917 ////////////////////////////////////////////////////////////////////////////////
1918   const Int_t SSDCoolingBlockTransNumber = 2;
1919   Double_t SSDCoolingBlockTransVector[SSDCoolingBlockTransNumber] = 
1920                                         {fgkSSDModuleSensorSupportDistance+fgkSSDCoolingBlockLength,
1921                                          fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
1922                                 -        fgkSSDCoolingBlockWidth};
1923   TGeoVolume* SSDCoolingBlock = GetSSDCoolingBlock();
1924   TGeoVolume* SSDCoolingBlockAssembly = 
1925                                                           new TGeoVolumeAssembly("SSDCoolingBlockAssembly");
1926   for(Int_t i=0; i<SSDCoolingBlockTransNumber; i++)
1927     for(Int_t j=0; j<SSDCoolingBlockTransNumber; j++) 
1928                 SSDCoolingBlockAssembly->AddNode(SSDCoolingBlock,
1929                                                   SSDCoolingBlockTransNumber*i+j+1,
1930                                                   new TGeoTranslation(i*SSDCoolingBlockTransVector[0],
1931                                                   j*SSDCoolingBlockTransVector[1],0.));
1932   return SSDCoolingBlockAssembly;
1933 }
1934 /////////////////////////////////////////////////////////////////////////////////
1935 TGeoVolume* AliITSv11GeometrySSD::GetSSDCoolingBlock(){
1936 /////////////////////////////////////////////////////////////////////////////////
1937   // Center Cooling Block Hole
1938   ////////////////////////////
1939   Double_t CoolingBlockHoleAngle = TMath::ACos(0.5*fgkSSDCoolingBlockHoleLength[0]
1940                                                         /fgkSSDCoolingBlockHoleRadius[0])*TMath::RadToDeg();
1941   Double_t CoolingBlockHoleWidth = fgkSSDCoolingBlockWidth;
1942   /*TGeoTubeSeg* CoolingBlockHoleShape = */ new TGeoTubeSeg("CoolingBlockHoleShape",
1943                                                 0.,
1944                                                 fgkSSDCoolingBlockHoleRadius[0],
1945                                                 0.5*CoolingBlockHoleWidth,
1946                                                 180.-CoolingBlockHoleAngle,360.+CoolingBlockHoleAngle);
1947   TVector3* CoolingBlockHoleVertex[3];
1948   CoolingBlockHoleVertex[0] = new TVector3();
1949   CoolingBlockHoleVertex[1] = new TVector3(fgkSSDCoolingBlockHoleRadius[0]
1950                                         *       TMath::Cos((90.-CoolingBlockHoleAngle)*TMath::DegToRad()),
1951                                                 fgkSSDCoolingBlockHoleRadius[0]
1952                                         *       TMath::Sin((90.-CoolingBlockHoleAngle)*TMath::DegToRad()));
1953   CoolingBlockHoleVertex[2] = new TVector3(CoolingBlockHoleVertex[1]->X(),
1954                                         -       CoolingBlockHoleVertex[1]->Y());
1955   /* TGeoArb8* CoolingBlockTriangleHoleShape = */
1956                                                 GetTriangleShape(CoolingBlockHoleVertex,
1957                                                 CoolingBlockHoleWidth,"CoolingBlockTriangleHoleShape");
1958   TGeoRotation* CoolingBlockHoleRot = 
1959                                                           new TGeoRotation("CoolingBlockHoleRot",90,0.,0.);
1960   CoolingBlockHoleRot->RegisterYourself();
1961   /* TGeoCompositeShape* CoolingTubeHoleShape  = */ 
1962                               new TGeoCompositeShape("CoolingTubeHoleShape",
1963                                                           "CoolingBlockTriangleHoleShape:CoolingBlockHoleRot+"
1964                                                           "CoolingBlockHoleShape");
1965   ///////////////////////////
1966   // Cooling Block Trapezoids
1967   ///////////////////////////
1968   const Int_t VertexNumber = 4;
1969   const Int_t TrapezoidNumber = 2;
1970   TVector3** CoolingBlockTrapezoidVertex[TrapezoidNumber];
1971   for(Int_t i = 0; i<TrapezoidNumber; i++) CoolingBlockTrapezoidVertex[i] = 
1972                                                 new TVector3*[VertexNumber]; 
1973   Double_t CoolingBlockComponentHeight    = fgkSSDCoolingBlockHeight[0]
1974                                     -   fgkSSDCoolingBlockHoleCenter
1975                                         -       fgkSSDCoolingBlockHoleRadius[0]
1976                                         *       TMath::Sin(CoolingBlockHoleAngle*TMath::DegToRad());
1977   Double_t CoolingBlockTrapezoidLength[TrapezoidNumber] = 
1978                                         {       fgkSSDCoolingBlockLength,
1979                                                 0.5*(fgkSSDCoolingBlockLength-2.
1980                                         *       (fgkSSDCoolingBlockHoleLength[1]
1981                                         -       fgkSSDCoolingBlockHoleRadius[1])
1982                                         -       fgkSSDCoolingBlockHoleLength[0])}; 
1983   Double_t CoolingBlockTrapezoidHeigth[TrapezoidNumber] = 
1984                                         {       fgkSSDCoolingBlockHeight[0]-CoolingBlockComponentHeight
1985                                         -       fgkSSDCoolingBlockHeight[1]-fgkSSDCoolingBlockHeight[2]
1986                                         -       fgkSSDCoolingBlockHoleRadius[1],
1987                                                 CoolingBlockComponentHeight};
1988   Double_t CoolingBlockTrapezoidWidth[TrapezoidNumber]  = 
1989                                                 {fgkSSDCoolingBlockWidth,fgkSSDCoolingBlockWidth};
1990   //////////////////////////
1991   //Vertex Positioning Shape 
1992   //////////////////////////
1993   CoolingBlockTrapezoidVertex[0][0] = new TVector3();
1994   CoolingBlockTrapezoidVertex[0][1] = new TVector3(CoolingBlockTrapezoidLength[0]);
1995   CoolingBlockTrapezoidVertex[0][2] = new TVector3(
1996                                                 0.5*(CoolingBlockTrapezoidVertex[0][1]->X()
1997                                         -       2.*CoolingBlockTrapezoidLength[1]
1998                                         -       fgkSSDCoolingBlockHoleLength[0]));
1999   CoolingBlockTrapezoidVertex[0][3] = 
2000                                                 new TVector3(CoolingBlockTrapezoidVertex[0][1]->X()
2001                                         -       CoolingBlockTrapezoidVertex[0][2]->X());
2002   CoolingBlockTrapezoidVertex[1][0] = new TVector3(); 
2003   CoolingBlockTrapezoidVertex[1][1] = new TVector3(CoolingBlockTrapezoidLength[1]);
2004   CoolingBlockTrapezoidVertex[1][2] = 
2005                                                 new TVector3(CoolingBlockTrapezoidHeigth[1]
2006                                         /                                CoolingBlockTrapezoidHeigth[0]
2007                                         *       CoolingBlockTrapezoidVertex[0][2]->X());
2008   CoolingBlockTrapezoidVertex[1][3] = 
2009                                                 new TVector3(CoolingBlockTrapezoidVertex[1][1]->X());
2010   char* CoolingBlockTrapezoidShapeName[TrapezoidNumber] = 
2011                                         {"CoolingBlockTrapezoidShape0","CoolingBlockTrapezoidShape1"};
2012   TGeoArb8* CoolingBlockTrapezoidShape[TrapezoidNumber];
2013   for(Int_t i = 0; i< TrapezoidNumber; i++) CoolingBlockTrapezoidShape[i] = 
2014                                                 GetArbShape(CoolingBlockTrapezoidVertex[i],
2015                                                 CoolingBlockTrapezoidWidth,
2016                                                 CoolingBlockTrapezoidHeigth[i],
2017                                                 CoolingBlockTrapezoidShapeName[i]);
2018   TGeoTranslation* CoolingBlockTrapezoidTrans = 
2019                                                 new TGeoTranslation("CoolingBlockTrapezoidTrans",
2020                                                 CoolingBlockTrapezoidVertex[0][2]->X(),
2021                                                 0.0,
2022                                                 0.5*(CoolingBlockTrapezoidHeigth[0]
2023                                         +       CoolingBlockTrapezoidHeigth[1]));
2024   CoolingBlockTrapezoidTrans->RegisterYourself();
2025   TGeoCombiTrans* CoolingBlockTrapezoidCombiTrans = 
2026                                                 new TGeoCombiTrans("CoolingBlockTrapezoidCombiTrans",
2027                                                 CoolingBlockTrapezoidVertex[0][3]->X(),
2028                                                 fgkSSDCoolingBlockWidth,
2029                                                 0.5*(CoolingBlockTrapezoidHeigth[0]
2030                                         +       CoolingBlockTrapezoidHeigth[1]),
2031                                                 new TGeoRotation("",180.,0.,0.));
2032   CoolingBlockTrapezoidCombiTrans->RegisterYourself();
2033   /* TGeoCompositeShape* CoolingBlockTrapezoidCompositeShape = */ 
2034         new TGeoCompositeShape("CoolingBlockTrapezoidCompositeShape",
2035         "CoolingBlockTrapezoidShape0+CoolingBlockTrapezoidShape1:CoolingBlockTrapezoidTrans+"
2036         "CoolingBlockTrapezoidShape1:CoolingBlockTrapezoidCombiTrans"); 
2037   /////////////////////////////
2038   // Cooling Block Boxes Shapes
2039   /////////////////////////////
2040   const Int_t BoxNumber = 3;
2041   TGeoBBox* CoolingBlockBoxShape[BoxNumber];
2042   CoolingBlockBoxShape[0] = new TGeoBBox("CoolingBlockBoxShape0",
2043                                                 0.5*fgkSSDCoolingBlockLength,
2044                                                 0.5*fgkSSDCoolingBlockWidth,
2045                                                 0.5*fgkSSDCoolingBlockHoleRadius[1]);
2046   CoolingBlockBoxShape[1] = new TGeoBBox("CoolingBlockBoxShape1",
2047                                                 0.5*(fgkSSDCoolingBlockLength
2048                                         -       2.*fgkSSDCoolingBlockHoleLength[1]),
2049                                                 0.5*fgkSSDCoolingBlockWidth,
2050                                                 0.5*fgkSSDCoolingBlockHeight[2]);
2051   CoolingBlockBoxShape[2] = new TGeoBBox("CoolingBlockBoxShape2",
2052                                                 0.5*fgkSSDCoolingBlockLength,
2053                                                 0.5*fgkSSDCoolingBlockWidth,
2054                                                 0.5*fgkSSDCoolingBlockHeight[1]);
2055   TGeoTranslation* CoolingBlockBoxTrans[BoxNumber-1];
2056   CoolingBlockBoxTrans[0] = new TGeoTranslation("CoolingBlockBoxTrans0",0.,0.,
2057                                                 0.5*(fgkSSDCoolingBlockHeight[1]
2058                                         +       fgkSSDCoolingBlockHoleRadius[1])
2059                                         +       fgkSSDCoolingBlockHeight[2]);
2060   CoolingBlockBoxTrans[1] = new TGeoTranslation("CoolingBlockBoxTrans1",
2061                                                 0.0,
2062                                                 0.0,
2063                                                 0.5*(fgkSSDCoolingBlockHeight[1]
2064                                         +       fgkSSDCoolingBlockHeight[2]));
2065   for(Int_t i=0; i<BoxNumber-1; i++) CoolingBlockBoxTrans[i]->RegisterYourself();
2066   /* TGeoCompositeShape* CoolingBlockBoxCompositeShape = */
2067         new TGeoCompositeShape("CoolingBlockBoxCompositeShape",
2068                                                    "CoolingBlockBoxShape0:CoolingBlockBoxTrans0+"
2069          "CoolingBlockBoxShape1:CoolingBlockBoxTrans1+CoolingBlockBoxShape2");
2070   ///////////////////////
2071   // Cooling Block Shape
2072   //////////////////////
2073   TGeoCombiTrans* CoolingTubeHoleShapeCombiTrans = 
2074                                                 new TGeoCombiTrans("CoolingTubeHoleShapeCombiTrans",
2075                                                 0.5*fgkSSDCoolingBlockLength,
2076                                                 0.5*fgkSSDCoolingBlockWidth,
2077                                                 fgkSSDCoolingBlockHoleCenter,
2078                                                 new TGeoRotation("",0.,90.,0.));
2079   CoolingTubeHoleShapeCombiTrans->RegisterYourself();
2080   TGeoTranslation* CoolingBlockTrapezoidCompositeShapeTrans = 
2081                                                 new TGeoTranslation("CoolingBlockTrapezoidCompositeShapeTrans",
2082                                                 0.0,
2083                                                 0.0,
2084                                                 0.5*CoolingBlockTrapezoidHeigth[0]+fgkSSDCoolingBlockHeight[1]+
2085                                                 fgkSSDCoolingBlockHeight[2]+fgkSSDCoolingBlockHoleRadius[1]);
2086   CoolingBlockTrapezoidCompositeShapeTrans->RegisterYourself();
2087   TGeoTranslation* CoolingBlockBoxCompositeShapeTrans = 
2088                                                 new TGeoTranslation("CoolingBlockBoxCompositeShapeTrans",
2089                                                 0.5*fgkSSDCoolingBlockLength,
2090                                                 0.5*fgkSSDCoolingBlockWidth,
2091                                                 0.5*fgkSSDCoolingBlockHeight[1]);
2092   CoolingBlockBoxCompositeShapeTrans->RegisterYourself();
2093   TGeoCompositeShape* SSDCoolingBlockShape = 
2094                 new TGeoCompositeShape("SSDCoolingBlockShape",  
2095                 "CoolingBlockBoxCompositeShape:CoolingBlockBoxCompositeShapeTrans+"
2096                 "CoolingBlockTrapezoidCompositeShape:CoolingBlockTrapezoidCompositeShapeTrans-"
2097                 "CoolingTubeHoleShape:CoolingTubeHoleShapeCombiTrans");
2098   TGeoVolume* SSDCoolingBlock = new TGeoVolume("SSDCoolingBlock",
2099                 SSDCoolingBlockShape,fgkSSDAlCoolBlockMedium);
2100   return SSDCoolingBlock;
2101 }
2102 /////////////////////////////////////////////////////////////////////////////////
2103 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberJunction(Double_t width){
2104 ////////////////////////////////////////////////////////////////////////////////
2105   const Int_t VertexNumber = 4;
2106   TVector3* Vertex[VertexNumber];
2107   Vertex[0] = new TVector3();
2108   Vertex[1] = new TVector3(fgkCarbonFiberJunctionLength,0.);
2109   Vertex[2] = new TVector3(fgkCarbonFiberJunctionLength
2110                 -         fgkCarbonFiberJunctionEdge[1]
2111                         *         TMath::Cos(fgkCarbonFiberJunctionAngle[1]*TMath::DegToRad()),
2112                                   fgkCarbonFiberJunctionEdge[1]*TMath::Sin(fgkCarbonFiberJunctionAngle[1]
2113                         *     TMath::DegToRad()));
2114   Vertex[3] = new TVector3(fgkCarbonFiberJunctionEdge[0]
2115                         *         TMath::Cos(fgkCarbonFiberJunctionAngle[0]*TMath::DegToRad()),
2116                                   fgkCarbonFiberJunctionEdge[0]
2117                         *         TMath::Sin(fgkCarbonFiberJunctionAngle[0]*TMath::DegToRad()));
2118   TGeoArb8* CarbonFiberJunctionShapePiece = 
2119                                                 new TGeoArb8("CarbonFiberJunctionShapePiece",0.5*width);
2120   //////////////////////////////////
2121   //Setting the vertices in TGeoArb8
2122   //////////////////////////////////
2123   for(Int_t i = 0; i<2*VertexNumber; i++)
2124         CarbonFiberJunctionShapePiece->SetVertex(i,
2125                                                         Vertex[(i < VertexNumber ? i: i-VertexNumber)]->X(),
2126                                                         Vertex[(i < VertexNumber ? i : i-VertexNumber)]->Y());
2127   TGeoRotation* CarbonFiberJunctionRot = 
2128                                                 new TGeoRotation("CarbonFiberJunctionRot",
2129                                                                                   180.,
2130                                                                                   180.,
2131                                                                                   180-2.*fgkCarbonFiberJunctionAngle[0]); 
2132   TGeoVolume* CarbonFiberJunctionPiece = 
2133                                                 new TGeoVolume("CarbonFiberJunctionPiece",
2134                                                 CarbonFiberJunctionShapePiece,fgkSSDCarbonFiberMedium);
2135   TGeoVolume* CarbonFiberJunction = 
2136                                                 new TGeoVolumeAssembly("CarbonFiberJunction");
2137   CarbonFiberJunctionPiece->SetLineColor(fColorCarbonFiber);
2138   CarbonFiberJunction->AddNode(CarbonFiberJunctionPiece,1);
2139   CarbonFiberJunction->AddNode(CarbonFiberJunctionPiece,2,CarbonFiberJunctionRot);
2140   return CarbonFiberJunction;
2141 }
2142 /////////////////////////////////////////////////////////////////////////////////
2143 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberJunctionAssembly(){
2144 ////////////////////////////////////////////////////////////////////////////////
2145   SetCarbonFiberJunctionCombiTransMatrix();
2146   TGeoVolume* CarbonFiberJunctionAssembly = 
2147                                                   new TGeoVolumeAssembly("CarbonFiberJunctionAssembly");
2148   TGeoVolume* CarbonFiberJunction = 
2149                                                   GetCarbonFiberJunction(fgkCarbonFiberJunctionWidth);
2150   for(Int_t i=0; i<fgkCarbonFiberJunctionCombiTransNumber;i++) 
2151     CarbonFiberJunctionAssembly->AddNode(CarbonFiberJunction,i+1,
2152                                                                                  CarbonFiberJunctionCombiTransMatrix[i]);
2153   return CarbonFiberJunctionAssembly;
2154 }
2155 /////////////////////////////////////////////////////////////////////////////////
2156 TList* AliITSv11GeometrySSD::GetLadderCableSegment(Double_t SSDEndLadderCableLength){
2157 /////////////////////////////////////////////////////////////////////////////////
2158 const Int_t LadderCableSegmentNumber = 2;
2159 /////////////////////////////////////////
2160 // LadderSegmentBBox Volume
2161 /////////////////////////////////////////
2162   TGeoBBox* LadderCableSegmentBBoxShape[LadderCableSegmentNumber];
2163   const char* LadderCableSegmentBBoxShapeName[LadderCableSegmentNumber] = 
2164                                 {"LadderCableSegmentBBoxShape1","LadderCableSegmentBBoxShape2"};
2165   for(Int_t i=0; i<LadderCableSegmentNumber; i++) LadderCableSegmentBBoxShape[i] = 
2166                                                   new TGeoBBox(LadderCableSegmentBBoxShapeName[i],
2167                                                                            0.5*fgkSSDFlexWidth[0],
2168                                                                            0.5*fgkSSDLadderCableWidth,
2169                                                                            0.5*fgkSSDFlexHeight[i]); 
2170   const char* LadderCableSegmentBBoxName[LadderCableSegmentNumber] = 
2171                                                   {"LadderCableSegmentBBox1","LadderCableSegmentBBox2"};
2172   TGeoVolume* LadderCableSegmentBBox[LadderCableSegmentNumber];
2173   for(Int_t i=0; i<LadderCableSegmentNumber; i++){ 
2174                         LadderCableSegmentBBox[i] =
2175                                                   new TGeoVolume(LadderCableSegmentBBoxName[i],
2176                                                                                  LadderCableSegmentBBoxShape[i],
2177                                                                                  (i==0?fgkSSDAlTraceLadderCableMedium:
2178             fgkSSDKaptonLadderCableMedium));
2179                         LadderCableSegmentBBox[i]->SetLineColor(i==0 ? fColorAl : 
2180                                                                                                                    fColorPolyhamide);
2181   }
2182   TGeoTranslation* LadderCableSegmentBBoxTrans[LadderCableSegmentNumber];                                                                                 
2183   LadderCableSegmentBBoxTrans[0] = 
2184                                                    new TGeoTranslation("LadderCableSegmentBBoxTrans1",
2185                                                                                            0.5*fgkSSDFlexWidth[0],
2186                                                                                            0.5*fgkSSDLadderCableWidth,
2187                                                                                            0.5*fgkSSDFlexHeight[0]);
2188   LadderCableSegmentBBoxTrans[1] = 
2189                                                    new TGeoTranslation("LadderCableSegmentBBoxTrans2",
2190                                                                                            0.5*fgkSSDFlexWidth[0],
2191                                                                                            0.5*fgkSSDLadderCableWidth,
2192                                                                                            fgkSSDFlexHeight[0]
2193                                                                                            +0.5*fgkSSDFlexHeight[1]);
2194   TGeoVolume* LadderCableSegmentBBoxAssembly = 
2195                                                    new TGeoVolumeAssembly("LadderCableSegmentBBoxAssembly"); 
2196   for(Int_t i=0; i<LadderCableSegmentNumber; i++)  
2197                 LadderCableSegmentBBoxAssembly->AddNode(LadderCableSegmentBBox[i],1,
2198                                                                                             LadderCableSegmentBBoxTrans[i]);
2199 /////////////////////////////////////////
2200 // LadderSegmentArb8 Volume
2201 /////////////////////////////////////////
2202   const Int_t VertexNumber = 4;
2203   TVector3** LadderCableSegmentVertexPosition[LadderCableSegmentNumber];
2204   for(Int_t i = 0; i<LadderCableSegmentNumber; i++) LadderCableSegmentVertexPosition[i] = 
2205                                                                                                   new TVector3*[VertexNumber];
2206 //Shape Vertex Positioning
2207   for(Int_t i=0; i<LadderCableSegmentNumber; i++){
2208         LadderCableSegmentVertexPosition[i][0] = new TVector3(0.,i*fgkSSDFlexHeight[0]);
2209         LadderCableSegmentVertexPosition[i][1] = new TVector3(fgkSSDLadderCableWidth,
2210                                                                                                                   i*fgkSSDFlexHeight[0]);
2211         LadderCableSegmentVertexPosition[i][2] = new TVector3(0.,fgkSSDFlexHeight[0]
2212                                                                                    +                         fgkSSDFlexHeight[1]
2213                                                                                    +                      i*fgkSSDFlexHeight[0]);
2214         LadderCableSegmentVertexPosition[i][3] = 
2215                                                    new TVector3(LadderCableSegmentVertexPosition[i][1]->X(),
2216                                                                                 LadderCableSegmentVertexPosition[i][2]->Y());
2217   }
2218   Double_t LadderCableSegmentWidth[2][2] = {{fgkSSDFlexHeight[0],fgkSSDFlexHeight[0]},
2219                                                                             {fgkSSDFlexHeight[1],fgkSSDFlexHeight[1]}}; 
2220   char* LadderCableSegmentArbShapeName[LadderCableSegmentNumber] = 
2221                                         {"LadderCableSegmentArbShape1","LadderCableSegmentArbShape2"};
2222   TGeoArb8* LadderCableSegmentArbShape[LadderCableSegmentNumber];
2223   for(Int_t i = 0; i< LadderCableSegmentNumber; i++) LadderCableSegmentArbShape[i] = 
2224                                         GetArbShape(LadderCableSegmentVertexPosition[i],
2225                                                                 LadderCableSegmentWidth[i],
2226                                                                 fgkCarbonFiberJunctionWidth-fgkSSDFlexWidth[0],
2227                                                                 LadderCableSegmentArbShapeName[i]);
2228   const char* LadderCableSegmentArbName[LadderCableSegmentNumber] = 
2229                                                   {"LadderCableSegmentArb1","LadderCableSegmentArb2"};
2230   TGeoVolume* LadderCableSegmentArb[LadderCableSegmentNumber];
2231   for(Int_t i=0; i<LadderCableSegmentNumber; i++){
2232                          LadderCableSegmentArb[i] =
2233                                                    new TGeoVolume(LadderCableSegmentArbName[i],
2234                                                                                   LadderCableSegmentArbShape[i],
2235                                                                                   (i==0?fgkSSDAlTraceLadderCableMedium:
2236             fgkSSDKaptonLadderCableMedium)); 
2237                          LadderCableSegmentArb[i]->SetLineColor(i==0 ? fColorAl : 
2238                                                                                                                    fColorPolyhamide);
2239 }
2240   TGeoRotation* LadderCableSegmentArbRot[LadderCableSegmentNumber];
2241   LadderCableSegmentArbRot[0] = new TGeoRotation("LadderCableSegmentArbRot1",
2242                                                                                                  90.,90,-90.);   
2243   LadderCableSegmentArbRot[1] = new TGeoRotation("LadderCableSegmentArbRot2",
2244                                                                                                   0.,90.,0.);    
2245   TGeoCombiTrans* LadderCableSegmentArbCombiTrans =  
2246                                                    new TGeoCombiTrans("LadderCableSegmentArbCombiTrans",
2247                                                            0.5*(fgkCarbonFiberJunctionWidth-fgkSSDFlexWidth[0])
2248                                                          + fgkSSDFlexWidth[0],0.,0.,
2249                                                    new TGeoRotation((*LadderCableSegmentArbRot[1])
2250                                                      *(*LadderCableSegmentArbRot[0])));
2251   TGeoVolume* LadderCableSegmentArbAssembly = 
2252                                                    new TGeoVolumeAssembly("LadderCableSegmentArbAssembly"); 
2253   for(Int_t i=0; i<LadderCableSegmentNumber; i++)
2254   LadderCableSegmentArbAssembly->AddNode(LadderCableSegmentArb[i],1,
2255                                                                                    LadderCableSegmentArbCombiTrans);
2256 /////////////////////////////////////////
2257 // End Ladder Cable Volume
2258 /////////////////////////////////////////
2259   TGeoBBox* LadderEndCableSegmentBBoxShape[LadderCableSegmentNumber];
2260   const char* LadderEndCableSegmentBBoxShapeName[LadderCableSegmentNumber] = 
2261                                 {"LadderEndCableSegmentBBoxShape1","LadderEndCableSegmentBBoxShape2"};
2262   for(Int_t i=0; i<LadderCableSegmentNumber; i++) LadderEndCableSegmentBBoxShape[i] = 
2263                                                   new TGeoBBox(LadderEndCableSegmentBBoxShapeName[i],
2264                                                                            0.5*SSDEndLadderCableLength,
2265                                                                            0.5*fgkSSDLadderCableWidth,
2266                                                                            0.5*fgkSSDFlexHeight[i]);
2267   const char* LadderEndCableSegmentBBoxName[LadderCableSegmentNumber] = 
2268                                                   {"LadderEndCableSegmentBBox1","LadderEndCableSegmentBBox2"};
2269   TGeoVolume* LadderEndCableSegmentBBox[LadderCableSegmentNumber];
2270   for(Int_t i=0; i<LadderCableSegmentNumber; i++){ 
2271                         LadderEndCableSegmentBBox[i] =
2272                                                   new TGeoVolume(LadderEndCableSegmentBBoxName[i],
2273                                                                                  LadderEndCableSegmentBBoxShape[i],
2274                                                                                  (i==0?fgkSSDAlTraceLadderCableMedium:
2275             fgkSSDKaptonLadderCableMedium));
2276                         LadderEndCableSegmentBBox[i]->SetLineColor(i==0 ? fColorAl : 
2277                                                                                                                    fColorPolyhamide);
2278   }
2279   TGeoTranslation* LadderEndCableSegmentBBoxTrans[LadderCableSegmentNumber];                                                                              
2280   LadderEndCableSegmentBBoxTrans[0] = 
2281                                                    new TGeoTranslation("LadderEndCableSegmentBBoxTrans0",
2282                                                                                            0.5*SSDEndLadderCableLength,
2283                                                                                            0.5*fgkSSDLadderCableWidth,
2284                                                                                            0.5*fgkSSDFlexHeight[0]);
2285   LadderEndCableSegmentBBoxTrans[1] = 
2286                                                    new TGeoTranslation("LadderEndCableSegmentBBoxTrans1",
2287                                                                                            0.5*SSDEndLadderCableLength,
2288                                                                                            0.5*fgkSSDLadderCableWidth,
2289                                                                                            fgkSSDFlexHeight[0]
2290                                                                                            +0.5*fgkSSDFlexHeight[1]);
2291   TGeoVolume* LadderEndCableSegmentBBoxAssembly = 
2292                                                    new TGeoVolumeAssembly("LadderEndCableSegmentBBoxAssembly"); 
2293   for(Int_t i=0; i<LadderCableSegmentNumber; i++)  
2294                 LadderEndCableSegmentBBoxAssembly->AddNode(LadderEndCableSegmentBBox[i],1,
2295                                                                                             LadderEndCableSegmentBBoxTrans[i]);
2296 /////////////////////////////////////////
2297   TList* LadderCableSegmentList = new TList();
2298   LadderCableSegmentList->Add(LadderCableSegmentBBoxAssembly);
2299   LadderCableSegmentList->Add(LadderCableSegmentArbAssembly);
2300   LadderCableSegmentList->Add(LadderEndCableSegmentBBoxAssembly);
2301   return LadderCableSegmentList;
2302   }
2303 /////////////////////////////////////////////////////////////////////////////////
2304 TGeoVolume* AliITSv11GeometrySSD::GetLadderCable(Int_t n, Double_t SSDEndLadderCableLength){
2305 /////////////////////////////////////////////////////////////////////////////////
2306   TList* LadderCableSegmentList = GetLadderCableSegment(SSDEndLadderCableLength);
2307   TGeoVolume* LadderCable = new TGeoVolumeAssembly("LadderCable"); 
2308   for(Int_t i=0; i<n; i++){
2309         TGeoTranslation* LadderCableTrans = new TGeoTranslation(
2310                                                         i*(fgkCarbonFiberJunctionWidth),
2311                                                         fgkSSDLadderCableWidth-fgkSSDFlexWidth[0],
2312                                                         i*(fgkSSDFlexHeight[0]+fgkSSDFlexHeight[1]));
2313     LadderCable->AddNode((TGeoVolume*)LadderCableSegmentList->At(0),i+1,LadderCableTrans);  
2314         if(i!=n-1) LadderCable->AddNode((TGeoVolume*)LadderCableSegmentList->At(1),i+1,LadderCableTrans);  
2315   }
2316   TGeoTranslation* EndLadderCableTrans = new TGeoTranslation("EndLadderCableTrans",
2317                                           (n-1)*fgkCarbonFiberJunctionWidth+fgkSSDFlexWidth[0],
2318                                                                  fgkSSDLadderCableWidth-fgkSSDFlexWidth[0],
2319                                           (n-1)*(fgkSSDFlexHeight[0]+fgkSSDFlexHeight[1]));
2320   LadderCable->AddNode((TGeoVolume*)LadderCableSegmentList->At(2),1,EndLadderCableTrans);
2321   return LadderCable;
2322 }
2323 /////////////////////////////////////////////////////////////////////////////////
2324 TGeoVolume* AliITSv11GeometrySSD::GetLadderCableAssembly(Int_t n, Double_t SSDEndLadderCableLength){
2325 /////////////////////////////////////////////////////////////////////////////////
2326   TGeoVolume* LadderCableAssembly = new TGeoVolumeAssembly("LadderCableAssembly");
2327   char LadderCableTransName[30];
2328   for(Int_t i=0; i<n; i++){ 
2329         sprintf(LadderCableTransName,"LadderCableTrans%i",i+1);
2330     LadderCableAssembly->AddNode(GetLadderCable(n-i,SSDEndLadderCableLength),i+1,
2331         new TGeoTranslation(LadderCableTransName,i*fgkCarbonFiberJunctionWidth,0.,0.));
2332   }
2333   return LadderCableAssembly;
2334 }
2335 /////////////////////////////////////////////////////////////////////////////////
2336 TList* AliITSv11GeometrySSD::GetLadderCableAssemblyList(Int_t n, Double_t SSDEndLadderCableLength){
2337 /////////////////////////////////////////////////////////////////////////////////
2338   const Int_t LadderCableAssemblyNumber = 2;
2339   TGeoVolume* LadderCableAssembly = GetLadderCableAssembly(n,SSDEndLadderCableLength);
2340   TGeoVolume* LadderCable[LadderCableAssemblyNumber];
2341   char LadderCableAssemblyName[30];
2342   TList* LadderCableAssemblyList = new TList();
2343   for(Int_t i=0; i<LadderCableAssemblyNumber; i++){ 
2344         sprintf(LadderCableAssemblyName,"LadderCableAssembly%i",i+1);
2345         LadderCable[i] = new TGeoVolumeAssembly(LadderCableAssemblyName);
2346         LadderCable[i]->AddNode(LadderCableAssembly,i+1,i==0 ? NULL :
2347                                          new TGeoCombiTrans((n-1)
2348                                          *       fgkCarbonFiberJunctionWidth+fgkSSDFlexWidth[0],
2349                                              2.*fgkSSDLadderCableWidth+0.5*fgkSSDFlexWidth[0],
2350                                                                                         0.,new TGeoRotation("",180,0.,0.)));
2351         LadderCableAssemblyList->Add(LadderCable[i]);
2352 }
2353   return LadderCableAssemblyList;
2354 }
2355 /////////////////////////////////////////////////////////////////////////////////
2356 TList* AliITSv11GeometrySSD::GetEndLadderCarbonFiberJunctionAssembly(){
2357 ////////////////////////////////////////////////////////////////////////////////
2358   const Int_t EndLabberCarbonFiberJunctionNumber = 2;
2359   TGeoVolume* EndLadderCarbonFiberJunctionAssembly[EndLabberCarbonFiberJunctionNumber];
2360   EndLadderCarbonFiberJunctionAssembly[0] = 
2361                                 new TGeoVolumeAssembly("EndLadderCarbonFiberJunctionAssembly1");
2362   EndLadderCarbonFiberJunctionAssembly[1] = 
2363                                 new TGeoVolumeAssembly("EndLadderCarbonFiberJunctionAssembly2");
2364   TGeoVolume** EndLadderCarbonFiberJunction[EndLabberCarbonFiberJunctionNumber];
2365   for(Int_t i=0; i<EndLabberCarbonFiberJunctionNumber; i++) 
2366                                                    EndLadderCarbonFiberJunction[i] = new TGeoVolume*[2];
2367   for(Int_t i=0; i<EndLabberCarbonFiberJunctionNumber; i++){
2368     EndLadderCarbonFiberJunction[i][0] = 
2369                   GetCarbonFiberJunction(fgkEndLadderCarbonFiberLowerJunctionLength[i]);
2370     EndLadderCarbonFiberJunction[i][1] = 
2371                   GetCarbonFiberJunction(fgkEndLadderCarbonFiberUpperJunctionLength[i]);
2372   }
2373   TList* EndLadderCarbonFiberJunctionList = new TList();
2374   for(Int_t i=0; i<EndLabberCarbonFiberJunctionNumber; i++){
2375     SetEndLadderCarbonFiberJunctionCombiTransMatrix(i);
2376     for(Int_t j=0; j<fgkCarbonFiberJunctionCombiTransNumber; j++)
2377       EndLadderCarbonFiberJunctionAssembly[i]->AddNode(j==2 ? 
2378                                                  EndLadderCarbonFiberJunction[i][1] : 
2379                                                  EndLadderCarbonFiberJunction[i][0],
2380                                                  j+1,EndLadderCarbonFiberJunctionCombiTransMatrix[j]);
2381     EndLadderCarbonFiberJunctionList->Add(EndLadderCarbonFiberJunctionAssembly[i]);
2382   }
2383   return EndLadderCarbonFiberJunctionList;
2384 }
2385 ////////////////////////////////////////////////////////////////////////////////
2386 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberSupport(){
2387 ////////////////////////////////////////////////////////////////////////////////
2388   const Int_t VertexNumber = 4;
2389   const Int_t ShapesNumber = 2;
2390   TVector3** VertexPosition[ShapesNumber];
2391   for(Int_t i=0; i<ShapesNumber; i++) VertexPosition[i] = new TVector3*[VertexNumber];
2392   Double_t CarbonFiberSupportXAxisEdgeProj = 
2393                 fgkCarbonFiberSupportEdgeLength*TMath::Cos(fgkCarbonFiberJunctionAngle[0]
2394         *       TMath::DegToRad());
2395   Double_t Theta = TMath::ATan(fgkCarbonFiberSupportYAxisLength
2396                                  /                         fgkCarbonFiberSupportXAxisLength);
2397   /////////////////////
2398   //Vertex Positioning
2399   ////////////////////
2400   VertexPosition[0][0] = new TVector3();
2401   VertexPosition[0][1] = new TVector3(fgkCarbonFiberSupportXAxisLength,
2402                                                                           fgkCarbonFiberSupportYAxisLength);
2403   VertexPosition[0][2] = new TVector3(CarbonFiberSupportXAxisEdgeProj,
2404                                                                           CarbonFiberSupportXAxisEdgeProj
2405                                            *                      TMath::Tan(Theta));
2406   VertexPosition[0][3] = new TVector3(fgkCarbonFiberSupportXAxisLength
2407                                            -                      CarbonFiberSupportXAxisEdgeProj,
2408                                                                           fgkCarbonFiberSupportYAxisLength
2409                                            -                      VertexPosition[0][2]->Y());
2410   ////////////////////////////////////////////////////
2411   //Setting the parameters for Isometry Transformation
2412   ////////////////////////////////////////////////////
2413   Double_t SymmetryPlanePosition = (fgkCarbonFiberSupportYAxisLength
2414                                                                  +      fgkCarbonFiberSupportTopEdgeDist[0]
2415                                                                  +      fgkCarbonFiberSupportWidth);
2416   Double_t* param = new Double_t[4]; 
2417   param[0] = 0., param[1] = 1., param[2] = 0., param[3] = -SymmetryPlanePosition;
2418   for(Int_t j=0; j<VertexNumber; j++) VertexPosition[1][j] = 
2419                                   new TVector3((GetReflection(VertexPosition[0][j],param))->X(),
2420                                                           (GetReflection(VertexPosition[0][j],param))->Y());
2421   char* CarbonFiberSupportShapeName[ShapesNumber] = 
2422                                                 {"CarbonFiberSupportShape1","CarbonFiberSupportShape2"};
2423   TGeoArb8* CarbonFiberSupportShape[ShapesNumber]; 
2424   Double_t Width[2] = {fgkCarbonFiberSupportWidth,fgkCarbonFiberSupportWidth};
2425   Double_t CarbonFiberSupportHeight = 
2426           CarbonFiberSupportXAxisEdgeProj*TMath::Tan(fgkCarbonFiberJunctionAngle[0]
2427           *TMath::DegToRad());
2428   for(Int_t i = 0; i< ShapesNumber; i++) CarbonFiberSupportShape[i] = 
2429                                         GetArbShape(VertexPosition[i],Width,CarbonFiberSupportHeight,
2430                                                                         CarbonFiberSupportShapeName[i],i==0 ? 1: -1);
2431   /////////////////////////////////////
2432   //Setting Translations and Rotations: 
2433   /////////////////////////////////////
2434   TGeoTranslation* CarbonFiberSupportTrans = 
2435                                                   new TGeoTranslation("CarbonFiberSupportTrans",
2436                                                                                           0.0,0.0,0.5*CarbonFiberSupportHeight);
2437   CarbonFiberSupportTrans->RegisterYourself();
2438   TGeoRotation* CarbonFiberCompShapeRot[2];
2439   CarbonFiberCompShapeRot[0] = new TGeoRotation("CarbonFiberCompShapeRot1",
2440                                                                                           0.0,180.0,0.0);
2441   CarbonFiberCompShapeRot[1] = new TGeoRotation("CarbonFiberCompShapeRot2",
2442                                                                                   90.,-fgkCarbonFiberTriangleAngle,-90.);
2443   Double_t TransVector[3] = {fgkCarbonFiberTriangleLength
2444                                                   *  TMath::Cos(fgkCarbonFiberTriangleAngle
2445                                                   *      TMath::DegToRad()),0.,-fgkCarbonFiberTriangleLength
2446                                                   *      TMath::Sin(fgkCarbonFiberTriangleAngle
2447                                                   *      TMath::DegToRad())};
2448   TGeoCombiTrans* CarbonFiberSupportCombiTrans = 
2449                                                            new TGeoCombiTrans("CarbonFiberSupportCombiTrans",
2450                                                            TransVector[0],2.*SymmetryPlanePosition
2451                                                   +        TransVector[1],TransVector[2],
2452                                                            new TGeoRotation((*CarbonFiberCompShapeRot[1])
2453                                                   *        (*CarbonFiberCompShapeRot[0])));
2454   CarbonFiberSupportCombiTrans->RegisterYourself();
2455 ////////////////////////////////////////////////////////////////////////////////
2456   TGeoCompositeShape* CarbonFiberSupportCompShape = 
2457                                                         new TGeoCompositeShape("CarbonFiberSupportCompShape",
2458                                                         "CarbonFiberSupportShape1:CarbonFiberSupportTrans+"
2459                                                         "CarbonFiberSupportShape2:CarbonFiberSupportTrans");
2460   TGeoVolume* CarbonFiberSupport = new TGeoVolume("CarbonFiberSupport",
2461                                                    CarbonFiberSupportCompShape,fgkSSDCarbonFiberMedium);
2462   CarbonFiberSupport->SetLineColor(fColorCarbonFiber);
2463   TGeoVolume* CarbonFiberSupportAssembly = 
2464                                                     new TGeoVolumeAssembly("CarbonFiberSupportAssembly");
2465   CarbonFiberSupportAssembly->AddNode(CarbonFiberSupport,1);
2466   CarbonFiberSupportAssembly->AddNode(CarbonFiberSupport,2,
2467                                                                           CarbonFiberSupportCombiTrans);
2468   return CarbonFiberSupportAssembly;
2469 }
2470 ////////////////////////////////////////////////////////////////////////////////
2471 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberLowerSupport(Int_t ikind, Bool_t EndLadder){
2472 ////////////////////////////////////////////////////////////////////////////////
2473   const Int_t VertexNumber = 4;
2474   const Int_t ShapesNumber = 2;
2475   Double_t Width[2] = {fgkCarbonFiberLowerSupportWidth,
2476                                                                 fgkCarbonFiberLowerSupportWidth};
2477   TVector3** VertexPosition[ShapesNumber];
2478   for(Int_t i = 0; i<ShapesNumber; i++) VertexPosition[i] = 
2479                                                  new TVector3*[VertexNumber];
2480   //First Shape Vertex Positioning
2481   VertexPosition[0][0] = new TVector3(fgkCarbonFiberLowerSupportLowerLenght);
2482   VertexPosition[0][1] = new TVector3(fgkCarbonFiberTriangleLength
2483                                            -            fgkCarbonFiberLowerSupportLowerLenght);
2484   VertexPosition[0][2] = new TVector3();
2485   VertexPosition[0][3] = new TVector3(fgkCarbonFiberTriangleLength);
2486   //Second Shape Vertex Positioning
2487   Double_t Theta = TMath::ATan((fgkCarbonFiberLowerSupportVolumePosition[1]
2488                                  -                              fgkCarbonFiberLowerSupportVolumePosition[0])
2489                                  /                              fgkCarbonFiberTriangleLength);
2490   VertexPosition[1][0] = new TVector3(VertexPosition[0][0]->X(),
2491                                                                 VertexPosition[0][0]->X()*TMath::Tan(Theta)
2492                                  +                              fgkCarbonFiberLowerSupportVolumePosition[0]);
2493   VertexPosition[1][1] = new TVector3(VertexPosition[0][1]->X(),
2494                                                                 VertexPosition[0][1]->X()*TMath::Tan(Theta)
2495                                  +                              fgkCarbonFiberLowerSupportVolumePosition[0]);
2496   VertexPosition[1][2] = new TVector3(0.,fgkCarbonFiberLowerSupportVolumePosition[0]);
2497   VertexPosition[1][3] = new TVector3(fgkCarbonFiberTriangleLength,
2498                                                                 fgkCarbonFiberLowerSupportVolumePosition[1]);
2499   char* CarbonFiberLowerSupportName[ShapesNumber] = 
2500                           {"CarbonFiberLowerSupportShape1","CarbonFiberLowerSupportShape2"};
2501   TGeoArb8* CarbonFiberLowerSupportShape[ShapesNumber];
2502   for(Int_t i = 0; i< ShapesNumber; i++) CarbonFiberLowerSupportShape[i] = 
2503                                                                 GetArbShape(VertexPosition[i],Width,
2504                                                                                         fgkCarbonFiberLowerSupportHeight,
2505                                                                                         CarbonFiberLowerSupportName[i]);
2506   ///////////////////////////////////////////////////////
2507   TGeoTranslation* CarbonFiberLowerSupportTrans[ShapesNumber];
2508   CarbonFiberLowerSupportTrans[0] = 
2509                                                 new TGeoTranslation("CarbonFiberLowerSupportTrans1",
2510                                                 0.0,
2511                                                 VertexPosition[1][3]->Y()+VertexPosition[1][2]->Y(),
2512                                                 0.0);
2513   CarbonFiberLowerSupportTrans[1] = 
2514                                                 new TGeoTranslation("CarbonFiberLowerSupportTrans2",
2515                                                 0.0,
2516                                 -               VertexPosition[1][3]->Y()-VertexPosition[1][2]->Y(),
2517                                                 0.0);
2518   for(Int_t i = 0; i< ShapesNumber; i++) 
2519                                                 CarbonFiberLowerSupportTrans[i]->RegisterYourself(); 
2520   ///////////////////////////////////////////////////////
2521   TGeoCompositeShape* CarbonFiberLowerSupportCompShape; 
2522   if(EndLadder==false)
2523     CarbonFiberLowerSupportCompShape = 
2524                                 new TGeoCompositeShape("CarbonFiberLowerSupportCompShape",
2525                                 "CarbonFiberLowerSupportShape2+"
2526                                 "CarbonFiberLowerSupportShape1:CarbonFiberLowerSupportTrans1");
2527   else
2528     if(ikind==0)
2529       CarbonFiberLowerSupportCompShape = 
2530                                                   (TGeoCompositeShape*)CarbonFiberLowerSupportShape[0];
2531     else
2532       CarbonFiberLowerSupportCompShape = 
2533         new TGeoCompositeShape("CarbonFiberLowerSupportCompShape",
2534                                  "CarbonFiberLowerSupportShape1+"
2535                                  "CarbonFiberLowerSupportShape1:CarbonFiberLowerSupportTrans1"); 
2536   TGeoVolume* CarbonFiberLowerSupport = new TGeoVolume("CarbonFiberLowerSupport",
2537                                           CarbonFiberLowerSupportCompShape,fgkSSDCarbonFiberMedium);
2538   CarbonFiberLowerSupport->SetLineColor(fColorCarbonFiber);
2539   return CarbonFiberLowerSupport;
2540 }
2541 ////////////////////////////////////////////////////////////////////////////////
2542 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberAssemblySupport(){
2543 ////////////////////////////////////////////////////////////////////////////////
2544   SetCarbonFiberAssemblyCombiTransMatrix();
2545   TGeoVolume* CarbonFiberAssemblySupport = 
2546                                                 new TGeoVolumeAssembly("CarbonFiberAssembly");
2547   TGeoVolume* CarbonFiberAssemblyVolumes[fgkCarbonFiberAssemblyCombiTransNumber];
2548   CarbonFiberAssemblyVolumes[0] = GetCarbonFiberJunctionAssembly();
2549   CarbonFiberAssemblyVolumes[1] = GetCarbonFiberSupport();
2550   CarbonFiberAssemblyVolumes[2] = GetCarbonFiberLowerSupport();
2551   for(Int_t i=0; i<fgkCarbonFiberAssemblyCombiTransNumber;i++) 
2552     CarbonFiberAssemblySupport->AddNode(CarbonFiberAssemblyVolumes[i],1,
2553                                                 CarbonFiberAssemblyCombiTransMatrix[i]);
2554   return CarbonFiberAssemblySupport;
2555 }
2556 ////////////////////////////////////////////////////////////////////////////////
2557 TGeoVolume* AliITSv11GeometrySSD::GetCoolingTubeSupport(){
2558 ////////////////////////////////////////////////////////////////////////////////
2559   const Int_t VertexNumber = 3;
2560   Double_t Phi = TMath::ASin(0.5*fgkCoolingTubeSupportHeight
2561                            /                     fgkCoolingTubeSupportRmax)*TMath::RadToDeg();
2562   /* TGeoTubeSeg* CoolingTubeSegShape =  */ 
2563                                                 new TGeoTubeSeg("CoolingTubeSegShape",0.0,
2564                                                         fgkCoolingTubeSupportRmax,
2565                                                         0.5*fgkCoolingTubeSupportWidth,Phi,
2566                                                         360-Phi);
2567   /* TGeoTube* CoolingTubeHoleShape =  */
2568                                                 new TGeoTube("CoolingTubeHoleShape",0.0,
2569                                                         fgkCoolingTubeSupportRmin,
2570                                                         0.5*fgkCoolingTubeSupportWidth);
2571   TVector3* VertexPosition[VertexNumber];
2572   ///////////////////////////
2573   //Shape Vertex Positioning
2574   ///////////////////////////
2575   VertexPosition[0] = new TVector3();
2576   VertexPosition[1] = new TVector3(fgkCoolingTubeSupportRmax
2577                                         *               TMath::Cos(Phi*TMath::DegToRad()),
2578                                                         fgkCoolingTubeSupportRmax
2579                                         *               TMath::Sin(Phi*TMath::DegToRad()));
2580   VertexPosition[2] = new TVector3(VertexPosition[1]->X(),
2581                                         -                          VertexPosition[1]->Y());
2582   /* TGeoArb8* CoolingTubeTriangleShape = */ GetTriangleShape(VertexPosition,
2583                                                                            fgkCoolingTubeSupportWidth,
2584                                                                            "CoolingTubeTriangleShape");
2585   Double_t* BoxOrigin = new Double_t[3];
2586   Double_t BoxLength = fgkCoolingTubeSupportLength-fgkCoolingTubeSupportRmax
2587                                          - VertexPosition[1]->X();
2588   BoxOrigin[0] = VertexPosition[1]->X()+0.5*BoxLength, BoxOrigin[1] = BoxOrigin[2] = 0.;
2589   /* TGeoBBox* CoolingTubeBoxShape = */
2590                                                 new TGeoBBox("CoolingTubeBoxShape",0.5*BoxLength,
2591                                                         0.5*fgkCoolingTubeSupportHeight,
2592                                                         0.5*fgkCoolingTubeSupportWidth,BoxOrigin);
2593   TGeoCompositeShape* CoolingTubeSupportShape = 
2594                                                 new TGeoCompositeShape("CoolingTubeSupportShape",
2595                                                  "(CoolingTubeSegShape+CoolingTubeTriangleShape"
2596                                                  "+CoolingTubeBoxShape)-CoolingTubeHoleShape"); 
2597   TGeoVolume* CoolingTubeSupport = new TGeoVolume("CoolingTubeSupport",
2598                                                  CoolingTubeSupportShape,fgkSSDTubeHolderMedium);
2599   return CoolingTubeSupport;
2600 }
2601 ////////////////////////////////////////////////////////////////////////////////
2602 TGeoVolume* AliITSv11GeometrySSD::GetCoolingTubeSupportAssembly(){
2603 ////////////////////////////////////////////////////////////////////////////////
2604   TGeoVolume* CoolingTubeSupportAssembly = 
2605                                                    new TGeoVolumeAssembly("CoolingTubeSupportAssembly");
2606   TGeoVolume* CoolingTubeSupport = GetCoolingTubeSupport();
2607   SetCoolingTubeSupportCombiTransMatrix();
2608   for(Int_t i=0; i<fgkCoolingTubeSupportCombiTransNumber;i++) 
2609     CoolingTubeSupportAssembly->AddNode(CoolingTubeSupport,i+1,
2610                                                                                  CoolingTubeSupportCombiTransMatrix[i]);
2611   return CoolingTubeSupportAssembly;
2612 }
2613 ////////////////////////////////////////////////////////////////////////////////
2614 TGeoVolume* AliITSv11GeometrySSD::GetCoolingTube(){
2615 ////////////////////////////////////////////////////////////////////////////////
2616   TGeoVolume* CoolingTubeAssembly = new TGeoVolumeAssembly("CoolingTubeAssembly");
2617   TGeoTube *CoolingTubeShape = new TGeoTube("CoolingTubeShape", fgkCoolingTubeRmin, 
2618                                                 fgkCoolingTubeRmax, fgkCoolingTubeLength/2.0);
2619   TGeoVolume* CoolingTube = new TGeoVolume("CoolingTube",
2620                                                  CoolingTubeShape,fgkSSDCoolingTubePhynox);
2621   TGeoTube *CoolingTubeInteriorShape = new TGeoTube("CoolingTubeInteriorShape", 
2622                                                 0, fgkCoolingTubeRmin, 
2623                                                 fgkCoolingTubeLength/2.0);
2624   TGeoVolume *CoolingTubeInterior = new TGeoVolume("CoolingTubeInterior",
2625                                                    CoolingTubeInteriorShape,fgkSSDCoolingTubeWater);
2626   CoolingTubeAssembly->AddNode(CoolingTube,1);
2627   CoolingTubeAssembly->AddNode(CoolingTubeInterior,2);
2628   return CoolingTubeAssembly;
2629 }  
2630 ////////////////////////////////////////////////////////////////////////////////
2631 TGeoVolume* AliITSv11GeometrySSD::GetCoolingTubeAssembly(){
2632 ////////////////////////////////////////////////////////////////////////////////
2633   TGeoVolume* CoolingTubeAssembly =   new TGeoVolumeAssembly("CoolingTubeAssembly");
2634   TGeoVolume* CoolingTube = GetCoolingTube();
2635   SetCoolingTubeCombiTransMatrix();
2636   for(Int_t i=0; i<fgkCoolingTubeCombiTransNumber;i++) 
2637     CoolingTubeAssembly->AddNode(CoolingTube,i+1,CoolingTubeTransMatrix[i]);
2638   return CoolingTubeAssembly;
2639 }
2640 ////////////////////////////////////////////////////////////////////////////////