AliIT
[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 "TVector3.h"
28 #include "TGeoArb8.h"
29 #include "TList.h"
30 #include "TGeoMatrix.h"
31 #include "TGeoCompositeShape.h"
32 #include "TGeoTube.h"
33 #include "TGeoBBox.h"
34 #include "AliITSv11GeometrySSD.h"
35 /////////////////////////////////////////////////////////////////////////////////
36 //Parameters for SSD Geometry
37 /////////////////////////////////////////////////////////////////////////////////
38 // Layer5 (lengths are in mm and angles in degrees)
39 /////////////////////////////////////////////////////////////////////////////////
40 const Double_t AliITSv11GeometrySSD::fgkSSDLay5LadderLength      = 950.7;
41 const Int_t AliITSv11GeometrySSD::fgkSSDLay5SensorsNumber        =  22;
42 const Int_t AliITSv11GeometrySSD::fgkSSDLay5LadderNumber         =  34;
43 const Double_t AliITSv11GeometrySSD::fgkSSDLay5RadiusMin         = 378.0;
44 const Double_t AliITSv11GeometrySSD::fgkSSDLay5RadiusMax         = 384.0;
45 const Double_t AliITSv11GeometrySSD::fgkLay5CenterITSPosition    = 467.85;
46 /////////////////////////////////////////////////////////////////////////////////
47 // Layer6 (lengths are in mm and angles in degrees)
48 /////////////////////////////////////////////////////////////////////////////////
49 const Double_t AliITSv11GeometrySSD::fgkSSDLay6LadderLength      = 1068.0;
50 const Int_t AliITSv11GeometrySSD::fgkSSDLay6SensorsNumber        =   25;
51 const Int_t AliITSv11GeometrySSD::fgkSSDLay6LadderNumber         =   38;
52 const Double_t AliITSv11GeometrySSD::fgkSSDLay6RadiusMin         =  428.0;
53 const Double_t AliITSv11GeometrySSD::fgkSSDLay6RadiusMax         =  434.0;
54 const Double_t AliITSv11GeometrySSD::fgkLay6CenterITSPosition    = 526.50;
55 /////////////////////////////////////////////////////////////////////////////////
56 // SSD Chips and Hybrid (lengths are in mm and angles in degrees)
57 /////////////////////////////////////////////////////////////////////////////////
58 const Int_t AliITSv11GeometrySSD::fgkSSDChipNumber               =   6;
59 const Double_t AliITSv11GeometrySSD::fgkSSDChipLength            =  11.100; 
60 const Double_t AliITSv11GeometrySSD::fgkSSDChipWidth             =   3.850;
61 const Double_t AliITSv11GeometrySSD::fgkSSDChipHeight            =   0.180;
62 const Double_t AliITSv11GeometrySSD::fgkSSDChipSeparationLength  =   1.000;
63 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueLength        =   fgkSSDChipLength;
64 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueWidth         =   fgkSSDChipWidth;
65 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueHeight        =   0.030;
66 /////////////////////////////////////////////////////////////////////////////////
67 // Stiffener (lengths are in mm and angles in degrees)
68 /////////////////////////////////////////////////////////////////////////////////
69 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerLength       =  73.000;
70 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerWidth        =   6.500;
71 //const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerHeight       =   3.315;
72 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerHeight       =   0.315;
73 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerToChipDist   =   2.500;
74 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Length   =   1.600;
75 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Width    =   0.870;
76 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Height   =   0.800;
77 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Length   =   4.600;
78 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Width    =   3.400;
79 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Height   =   1.400;
80 const Double_t AliITSv11GeometrySSD::fgkSSDWireLength            =  30.000;
81 const Double_t AliITSv11GeometrySSD::fgkSSDWireRadius            =   0.185;
82 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorPosition[2]  = {44.32, 0.33};
83 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorSeparation   = 0.44;
84 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorLength       = 2.16;
85 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorWidth        = 3.60;
86 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorHeight       = 
87                                                                                                           0.25*fgkSSDStiffenerHeight;
88 /////////////////////////////////////////////////////////////////////////////////
89 // Cooling Block (lengths are in mm and angles in degrees)
90 /////////////////////////////////////////////////////////////////////////////////
91 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockLength    =   3.000;
92 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockWidth     =   4.000;
93 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHeight[3] = 
94                                                                                                          {1.950, 0.240, 0.300};
95 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleRadius[2] = 
96                                                                                                                     {1.000, 0.120};
97 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleLength[2] = 
98                                                                                                                         {1.900, 0.400};
99 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleCenter    =  
100                                                                                                                                          1.500;
101 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleHeight    =  
102                                                                                                                                          0.300;
103 /////////////////////////////////////////////////////////////////////////////////
104 // SSD Sensor (lengths are in mm and angles in degrees)
105 /////////////////////////////////////////////////////////////////////////////////
106 const char*  AliITSv11GeometrySSD::fgkSSDSensitiveVolName       = 
107                                                           "SSDSensorSensitiveVol";
108 const Double_t AliITSv11GeometrySSD::fgkSSDSensorLength          =  42.000;
109 const Double_t AliITSv11GeometrySSD::fgkSSDSensorHeight          =   0.300;
110 const Double_t AliITSv11GeometrySSD::fgkSSDSensorWidth           =  75.000;
111 const Double_t AliITSv11GeometrySSD::fgkSSDSensorOverlap         = 
112                                                                                                    fgkSSDSensorLength-39.1;
113 const Double_t AliITSv11GeometrySSD::fgkSSDSensorInsensitiveLength      = 1.; 
114 const Double_t AliITSv11GeometrySSD::fgkSSDSensorInsensitiveWidth       = 1.;
115 /////////////////////////////////////////////////////////////////////////////////
116 // Flex (lengths are in mm and angles in degrees)
117 /////////////////////////////////////////////////////////////////////////////////
118 const Double_t AliITSv11GeometrySSD::fgkSSDFlexFullLength       =  106.000; 
119 const Double_t AliITSv11GeometrySSD::fgkSSDFlexLength[4]        = 
120                         {0.5*(fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
121                                                 +(fgkSSDChipNumber-1)*fgkSSDChipSeparationLength),
122                          0.5*(fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
123                                                 +(fgkSSDChipNumber-1)*fgkSSDChipSeparationLength)-4.000,
124                                                   9.500, 10.000};
125 const Double_t AliITSv11GeometrySSD::fgkSSDFlexWidth[2]         = 
126                                                                                                                  {  9.340,  5.380};
127 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHeight[2]        =
128                                                                                                                  {  0.030,  0.020};      
129 const Double_t AliITSv11GeometrySSD::fgkSSDFlexAngle            =   30.000;
130 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHoleLength       =    1.430;
131 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHoleWidth        =    3.000;
132 const Double_t AliITSv11GeometrySSD::fgkSSDEndFlexCompLength[6] = 
133                                                                                    {3.30,4.12,4.22,1.70,0.75,7.18};
134 const Double_t AliITSv11GeometrySSD:: fgkSSDEndFlexCompWidth[3] =
135                                                                                                            {15.03,23.48,12.28};
136 /////////////////////////////////////////////////////////////////////////////////
137 // SSD Ladder Cable (lengths are in mm and angles in degrees)
138 /////////////////////////////////////////////////////////////////////////////////
139 const Double_t AliITSv11GeometrySSD::fgkSSDLadderCableWidth     =   23.5;
140 /////////////////////////////////////////////////////////////////////////////////
141 // SSD Module (lengths are in mm and angles in degrees)
142 /////////////////////////////////////////////////////////////////////////////////
143 const Double_t AliITSv11GeometrySSD::fgkSSDModuleStiffenerPosition[2]  = 
144                                                                                                                    { 1.000, 3.900};
145 const Double_t AliITSv11GeometrySSD::fgkSSDModuleSensorSupportDistance =  
146                                                                                                                                         45.600;
147 const Double_t AliITSv11GeometrySSD::fgkSSDModuleCoolingBlockToSensor  =  
148                                                                                                                                          5.075;
149 /////////////////////////////////////////////////////////////////////////////////
150 // Sensor Support (lengths are in mm and angles in degrees)
151 /////////////////////////////////////////////////////////////////////////////////
152 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportLength                 = 
153                                                                                                                                            5.800;
154 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportWidth          =  
155                                                                                                                                            2.000;
156 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportHeight[2]      =
157                                                                                                                      { 4.620, 5.180};
158 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportThickness[2] = 
159                                                                                                                      { 0.450, 0.450};
160 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportPosition       =  
161                                                                           0.5*(fgkSSDModuleSensorSupportDistance
162                                                                +    fgkSSDSensorSideSupportThickness[0])
163                                                                    -           fgkSSDSensorSideSupportLength;
164 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportLength       =  
165                                                                                                                                            5.250;
166 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportWidth        =
167                                                                                                                                        1.680;
168 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportHeight[2]    =
169            {fgkSSDSensorSideSupportHeight[0]+fgkSSDSensorSideSupportThickness[0],
170            fgkSSDSensorSideSupportHeight[1]+fgkSSDSensorSideSupportThickness[1]};
171 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportThickness[2] =
172    {fgkSSDSensorSideSupportThickness[0],fgkSSDSensorSideSupportThickness[1]};
173 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportPosition     = 
174                                                                                                                                       19.000;
175 /////////////////////////////////////////////////////////////////////////////////
176 // Chip Cables (lengths are in mm and angles in degrees)
177 /////////////////////////////////////////////////////////////////////////////////
178 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesLength[2]   = 
179                                                  {73.12/fgkSSDChipNumber,fgkSSDChipLength+2.*0.19};
180 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesHeight[4]   = 
181                                                 {  0.014,  0.010, fgkSSDModuleCoolingBlockToSensor
182   -  (fgkSSDSensorSideSupportHeight[1]-fgkSSDSensorSideSupportHeight[0])
183   -   fgkSSDCoolingBlockHoleCenter-fgkSSDStiffenerHeight
184   -   fgkSSDChipHeight-fgkSSDSensorHeight,
185       fgkSSDModuleCoolingBlockToSensor
186   -   fgkSSDCoolingBlockHoleCenter-fgkSSDStiffenerHeight
187   -   fgkSSDChipHeight-fgkSSDSensorHeight};
188 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesWidth[3]    = 
189                                                                                                  { 11.000,  0.800,  0.600};
190 /////////////////////////////////////////////////////////////////////////////////
191 // Carbon Fiber Junction Parameters (lengths are in mm and angles in degrees)
192 /////////////////////////////////////////////////////////////////////////////////
193 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionLength          = 
194                                                                                                                                            3.820;
195 //const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionLength          = 
196 //                                                                                                                                         3.780;
197 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionWidth           = 
198                                                                           fgkSSDSensorLength-fgkSSDSensorOverlap;
199 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionEdge[2]         = 
200                                                                                                                          {  0.86,  0.30};
201 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionAngle[2]        = 
202                                                                                                                          { 30.00, 90.00};
203 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionToSensorSupport = 
204                                                                                                                                             1.78;
205 /////////////////////////////////////////////////////////////////////////////////
206 //Carbon Fiber Parameters (lengths are in mm and angles in degrees)
207 /////////////////////////////////////////////////////////////////////////////////
208 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberTriangleLength          = 
209   fgkSSDModuleSensorSupportDistance-2.*fgkCarbonFiberJunctionToSensorSupport;  
210 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberTriangleAngle           = 
211                                                                                                                                            60.00;
212 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportTopEdgeDist[2]   = 
213                                                                                                                    {  0.751,  0.482};
214 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportEdgeLength       =  
215                                                                                                                                            1.630;
216 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportWidth            = 
217                                                                                                                                            0.950;
218 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportXAxisLength      = 
219              fgkCarbonFiberTriangleLength-0.5*fgkCarbonFiberSupportTopEdgeDist[1]
220                      / TMath::Cos(fgkCarbonFiberTriangleAngle*TMath::DegToRad());
221 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportYAxisLength      = 
222                                   0.5*(fgkCarbonFiberJunctionWidth-fgkCarbonFiberSupportWidth)
223                          - fgkCarbonFiberSupportTopEdgeDist[0]-fgkCarbonFiberSupportWidth;
224 /////////////////////////////////////////////////////////////////////////////////
225 // Carbon Fiber Lower Support Parameters (lengths are in mm)
226 /////////////////////////////////////////////////////////////////////////////////
227 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportWidth             
228                                                                                                                                           =  0.950;
229 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportLowerLenght       
230                                                                                                                                           =  1.600;
231 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportHeight            
232                                                                                                                                           =  0.830;
233 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportVolumeSeparation  
234                                                                                           = 0.5*fgkCarbonFiberSupportWidth;
235 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportTransverseWidth   
236                                                                  = fgkCarbonFiberJunctionWidth
237                                  - 2.*(fgkCarbonFiberLowerSupportWidth
238                                                                  + fgkCarbonFiberLowerSupportVolumeSeparation);
239 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportVolumePosition[2] 
240                                                                  = {fgkCarbonFiberLowerSupportWidth
241                                                                  +  fgkCarbonFiberLowerSupportVolumeSeparation,
242                                                                         fgkCarbonFiberLowerSupportWidth
243                                                                  +  fgkCarbonFiberLowerSupportVolumeSeparation                                                  
244                                                                  +  fgkCarbonFiberLowerSupportTransverseWidth};
245 /////////////////////////////////////////////////////////////////////////////////
246 // End Ladder Carbon Fiber Junction Parameters (lengths are in mm and angles in degrees)
247 /////////////////////////////////////////////////////////////////////////////////
248 const Double_t AliITSv11GeometrySSD::fgkEndLadderCarbonFiberLowerJunctionLength[2] = 
249   {0.5*(fgkSSDLay5LadderLength
250           -fgkSSDLay5SensorsNumber*fgkCarbonFiberJunctionWidth
251           -fgkCarbonFiberLowerSupportWidth),
252        0.5*(fgkSSDLay5LadderLength
253           -fgkSSDLay5SensorsNumber*fgkCarbonFiberJunctionWidth
254           +fgkCarbonFiberLowerSupportWidth)};
255 const Double_t AliITSv11GeometrySSD::fgkEndLadderCarbonFiberUpperJunctionLength[2] = 
256                 {fgkEndLadderCarbonFiberLowerJunctionLength[0]-20.4,
257                  fgkEndLadderCarbonFiberLowerJunctionLength[1]-20.6};
258 const Double_t AliITSv11GeometrySSD::fgkEndLadderMountingBlockPosition[2] = 
259                                                    {fgkEndLadderCarbonFiberLowerJunctionLength[0]-16.50,
260                                                    fgkEndLadderCarbonFiberLowerJunctionLength[1]-31.50};
261 /////////////////////////////////////////////////////////////////////////////////
262 // Cooling Tube Support (lengths are in mm and angles in degrees)
263 /////////////////////////////////////////////////////////////////////////////////
264 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportRmax          =  1.45;
265 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportRmin          
266                                                                                           = fgkSSDCoolingBlockHoleRadius[0];
267 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportLength        =  8.55;
268 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportHeight        =  0.85;
269 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportWidth         =  2.00;
270 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportSeparation    = 
271                                       fgkSSDSensorLength-2.*fgkSSDSensorOverlap;
272 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportToCarbonFiber = 11.70;
273 /////////////////////////////////////////////////////////////////////////////////
274 // Cooling Tube (lengths are in mm and angles in degrees)
275 /////////////////////////////////////////////////////////////////////////////////
276 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeRmax       = 
277                                                                                                           fgkCoolingTubeSupportRmin;
278 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeRmin       =  0.96;
279 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeLength     = 
280                                                                                                         fgkCarbonFiberJunctionWidth;
281 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSeparation = 
282                                         fgkSSDModuleSensorSupportDistance+fgkSSDCoolingBlockLength;
283 //const Double_t AliITSv11GeometrySSD_ct::fgkCoolingTubeLength               =  39.1;
284 /////////////////////////////////////////////////////////////////////////////////
285 // SSD Mounting Block Parameters (lengths are in mm and angles in degrees)
286 /////////////////////////////////////////////////////////////////////////////////
287 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockLength[3]            = 
288                                                                                                                         { 60.0, 42.2, 34.0};
289 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHeight[4]            =
290                                                                                                           {  4.0,  8.0,  5.0,  0.2};
291 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockWidth                =   
292                                                                                                                                                    20.0;
293 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidAngle   =   
294                                                                                                                                                    40.0;
295 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidHeight  = 
296                    0.30*(fgkSSDMountingBlockHeight[1]-fgkSSDMountingBlockHeight[2]);
297 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidUpBasis =    
298                                                                                                                                                         2.5;
299 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTubeLength[2]    = 
300                                                                                                                                   { 56.0, 12.0}; 
301 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTubeWidth[2]     = 
302                                                                                                                                   {  5.0,  2.9}; 
303 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleRadius           = 
304                                                                                                                                                         1.0;
305 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleEdge        =   
306                                                                                                                                                         6.0;
307 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleHeigth      =  
308                                                                                                                                                         4.0;
309 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleRadius[2]   =
310                                                                         {  1.5,fgkSSDMountingBlockScrewHoleEdge/6.};
311 /////////////////////////////////////////////////////////////////////////////////
312 ClassImp(AliITSv11GeometrySSD)
313 /////////////////////////////////////////////////////////////////////////////////
314 AliITSv11GeometrySSD::AliITSv11GeometrySSD(): TObject(),
315   fSSDChipMedium(),
316   fSSDChipGlueMedium(),
317   fSSDStiffenerMedium(),
318   fSSDStiffenerConnectorMedium(),
319   fSSDStiffener0603CapacitorMedium(),
320   fSSDStiffener1812CapacitorMedium(),
321   fSSDStiffenerHybridWireMedium(),
322   fSSDKaptonFlexMedium(),
323   fSSDAlTraceFlexMedium(),
324   fSSDAlTraceLadderCableMedium(),
325   fSSDKaptonLadderCableMedium(),
326   fSSDKaptonChipCableMedium(),
327   fSSDAlTraceChipCableMedium(),
328   fSSDAlCoolBlockMedium(),
329   fSSDSensorMedium(),
330   fSSDSensorSupportMedium(),
331   fSSDCarbonFiberMedium(),
332   fSSDTubeHolderMedium(),
333   fSSDCoolingTubeWater(),
334   fSSDCoolingTubePhynox(),
335   fSSDMountingBlockMedium(),
336   fMotherVol(0),
337   fColorCarbonFiber(4),
338   fColorRyton(5),
339   fColorPhynox(5),
340   fColorSilicon(3),
341   fColorAl(7),
342   fColorKapton(6),
343   fColorPolyhamide(5),
344   fColorStiffener(9),
345   fColorEpoxy(30)
346 {
347   ////////////////////////
348   // Standard constructor
349   ////////////////////////
350   CreateMaterials();
351 }
352 /////////////////////////////////////////////////////////////////////////////////
353 AliITSv11GeometrySSD::AliITSv11GeometrySSD(const AliITSv11GeometrySSD &s):
354   TObject(s),
355   fSSDChipMedium(s.fSSDChipMedium),
356   fSSDChipGlueMedium(s.fSSDChipGlueMedium),
357   fSSDStiffenerMedium(s.fSSDStiffenerMedium),
358   fSSDStiffenerConnectorMedium(s.fSSDStiffenerConnectorMedium),
359   fSSDStiffener0603CapacitorMedium(s.fSSDStiffener0603CapacitorMedium),
360   fSSDStiffener1812CapacitorMedium(s.fSSDStiffener1812CapacitorMedium),
361   fSSDStiffenerHybridWireMedium(s.fSSDStiffenerHybridWireMedium),
362   fSSDKaptonFlexMedium(s.fSSDKaptonFlexMedium),
363   fSSDAlTraceFlexMedium(s.fSSDAlTraceFlexMedium),
364   fSSDAlTraceLadderCableMedium(s.fSSDAlTraceLadderCableMedium),
365   fSSDKaptonLadderCableMedium(s.fSSDKaptonLadderCableMedium),
366   fSSDKaptonChipCableMedium(s.fSSDKaptonChipCableMedium),
367   fSSDAlTraceChipCableMedium(s.fSSDAlTraceChipCableMedium),
368   fSSDAlCoolBlockMedium(s.fSSDAlCoolBlockMedium),
369   fSSDSensorMedium(s.fSSDSensorMedium),
370   fSSDSensorSupportMedium(s.fSSDSensorSupportMedium),
371   fSSDCarbonFiberMedium(s.fSSDCarbonFiberMedium),
372   fSSDTubeHolderMedium(s.fSSDTubeHolderMedium),
373   fSSDCoolingTubeWater(s.fSSDCoolingTubeWater),
374   fSSDCoolingTubePhynox(s.fSSDCoolingTubePhynox),
375   fSSDMountingBlockMedium(s.fSSDMountingBlockMedium),
376   fMotherVol(s.fMotherVol),
377   fColorCarbonFiber(s.fColorCarbonFiber),
378   fColorRyton(s.fColorRyton),
379   fColorPhynox(s.fColorPhynox),
380   fColorSilicon(s.fColorSilicon),
381   fColorAl(s.fColorAl),
382   fColorKapton(s.fColorKapton),
383   fColorPolyhamide(s.fColorPolyhamide),
384   fColorStiffener(s.fColorStiffener),
385   fColorEpoxy(s.fColorEpoxy)
386 {
387   ////////////////////////
388   // Copy Constructor
389   ////////////////////////
390   CreateMaterials();
391 }
392 /////////////////////////////////////////////////////////////////////////////////
393 AliITSv11GeometrySSD& AliITSv11GeometrySSD::
394 operator=(const AliITSv11GeometrySSD &s){
395   ////////////////////////
396   // Assignment operator
397   ////////////////////////
398   this->~AliITSv11GeometrySSD();
399   new(this) AliITSv11GeometrySSD(s); 
400   return *this;
401 /*      
402   if(&s == this) return *this;
403   fMotherVol = s.fMotherVol;
404   return *this;
405  */
406 }
407 /////////////////////////////////////////////////////////////////////////////////
408 // Setting the transformation Matrices
409 /////////////////////////////////////////////////////////////////////////////////
410 void AliITSv11GeometrySSD::SetSSDSensorSupportCombiTransMatrix(){
411   /////////////////////////////////////////////////////////////
412   // Method generating CombiTrans Matrix for SSD Sensor Support   
413   /////////////////////////////////////////////////////////////
414   //Translation Parameters SSDSensorSupportAssembly:
415   ////////////////////////////////////////////////////////
416   const Double_t kssdsensorsupporttransx[3] = {-0.5*fgkSSDSensorSideSupportWidth,
417                                                                    0.5*fgkSSDSensorSideSupportWidth,
418                                                            0.5*fgkSSDSensorCenterSupportThickness[0]
419                                                                           -    fgkSSDSensorCenterSupportPosition}; 
420   const Double_t kssdsensorsupporttransy[3] = 
421                                                                            {0.5*fgkSSDSensorSideSupportThickness[0],
422                                                            -0.5*fgkSSDSensorSideSupportThickness[0]
423                                                                -fgkSSDModuleSensorSupportDistance,
424                                                             0.5*fgkSSDSensorCenterSupportWidth
425                                                                            -0.5*fgkSSDModuleSensorSupportDistance}; 
426   const Double_t kssdsensorsupporttransz[3] = {0.,0.,
427                                                                                 fgkSSDSensorCenterSupportThickness[0]}; 
428   ////////////////////////////////////////////////////////
429   //Rotational Parameters SSDSensorSupportAssembly:
430   ////////////////////////////////////////////////////////  
431   const Double_t kssdsensorsupportrotphi[3]   = {   0., 180., 270.};
432   const Double_t kssdsensorsupportrottheta[3] = {  90.,  90.,  90.};
433   const Double_t kssdsensorsupportrotpsi[3]   = {- 90.,- 90.,- 90.};
434   ////////////////////////////////////////////////////////////////
435   //Name of CombiTrans Transformation of SSDSensorSupportAssembly:
436   ////////////////////////////////////////////////////////////////
437   char ssdsensorsupportcombitransname[40];
438   char ssdsensorsupportrotname[40];
439   TGeoCombiTrans *ssdsensorsupportlocalmatrix[fgkSSDSensorSupportCombiTransNumber];
440   for(Int_t i=0; i<fgkSSDSensorSupportCombiTransNumber; i++){ 
441                 sprintf(ssdsensorsupportcombitransname,"SSDSensorSupportCombiTrans%i",i);
442                 sprintf(ssdsensorsupportrotname,"SSDSensorSupportRot%i",i);
443                 ssdsensorsupportlocalmatrix[i] =
444                                  new TGeoCombiTrans(ssdsensorsupportcombitransname,
445                                                                         kssdsensorsupporttransx[i],
446                                                                         kssdsensorsupporttransy[i],
447                                                                         kssdsensorsupporttransz[i],
448                                                                         new TGeoRotation(ssdsensorsupportrotname,
449                                                                                                            kssdsensorsupportrotphi[i],
450                                                                                                            kssdsensorsupportrottheta[i],
451                                                                                                     kssdsensorsupportrotpsi[i]));
452            fSSDSensorSupportCombiTransMatrix[i] = ssdsensorsupportlocalmatrix[i];
453   }
454 }
455 /////////////////////////////////////////////////////////////////////////////////
456 void AliITSv11GeometrySSD::SetSSDModuleCombiTransMatrix(Double_t SSDChipCablesHeigth){
457   /////////////////////////////////////////////////////////////
458   // Method generating CombiTrans Matrix for SSD Module   
459   /////////////////////////////////////////////////////////////
460   //Translation Parameters SSDModuleAssembly:
461   ////////////////////////////////////////////////////////
462   const Double_t kssdmoduletransx[7] = {0.5*fgkSSDStiffenerLength,
463                                                  0.5*fgkSSDChipLength+0.5*(fgkSSDStiffenerLength
464                                        - (fgkSSDChipNumber*fgkSSDChipLength+(fgkSSDChipNumber-1)
465                                            * fgkSSDChipSeparationLength)),
466                                        - fgkSSDModuleStiffenerPosition[0]+0.5*fgkSSDSensorWidth,
467                                    0.5*(fgkSSDStiffenerLength-fgkSSDChipNumber*fgkSSDChipLength
468                                            -       (fgkSSDChipNumber-1)*fgkSSDChipSeparationLength),
469                                 0.5*fgkSSDStiffenerLength-0.5*fgkSSDModuleSensorSupportDistance
470                            - fgkSSDCoolingBlockLength,
471                                 0.5*(fgkSSDStiffenerLength+fgkSSDChipCablesLength[1]
472                            + (fgkSSDChipNumber-1)*fgkSSDChipCablesLength[0]),
473                                 0.5*(fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
474                            +(fgkSSDChipNumber-1)*fgkSSDChipSeparationLength)}; 
475   const Double_t kssdmoduletransy[7] = {0.5*fgkSSDStiffenerWidth,
476                                        0.5*fgkSSDChipWidth+(fgkSSDStiffenerWidth
477                                          - fgkSSDStiffenerToChipDist-fgkSSDChipWidth),
478                                      - fgkSSDModuleStiffenerPosition[1]+0.5*fgkSSDSensorLength,
479                                        fgkSSDStiffenerWidth,
480                                        0.,
481                                        fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
482                                          - fgkSSDStiffenerWidth
483                                      + fgkSSDStiffenerToChipDist+fgkSSDChipWidth,
484                                        fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
485                                          - fgkSSDStiffenerWidth}; 
486   const Double_t kssdmoduletransz[7] = {0.5*fgkSSDStiffenerHeight,
487                                      - 0.5*fgkSSDChipHeight,
488                                        0.5*fgkSSDSensorHeight-fgkSSDStiffenerHeight-fgkSSDChipHeight
489                                          - SSDChipCablesHeigth,
490                                      - 0.5*fgkSSDFlexHeight[0],
491                                        fgkSSDStiffenerHeight,
492                                      - fgkSSDChipHeight,
493                                      - 0.5*fgkSSDChipHeight}; 
494   ////////////////////////////////////////////////////////
495   //Rotational Parameters SSDModuleAssembly:
496   ////////////////////////////////////////////////////////  
497   const Double_t kssdmodulerotphi[7]   = {   0.,   0.,  90.,   0.,   0.,  90., 180.};
498   const Double_t kssdmodulerottheta[7] = {   0.,   0.,   0.,   0.,   0.,   0.,   0.};
499   const Double_t kssdmodulerotpsi[7]   = {   0.,   0.,   0.,   0.,   0.,   0.,   0.};
500   ////////////////////////////////////////////////////////  
501   //Name of CombiTrans Transformation of SSDModuleAssembly:
502   ////////////////////////////////////////////////////////  
503   const char* ssdmodulecombitransname[7] = {"SSDStiffenerCombiTrans",
504                                                                                              "SSDChipCombiTrans",
505                                                                                            "SSDSensorCombiTrans",
506                                                                                             "SSDFlex0CombiTrans",
507                                                                                  "SSDCoolingBlockCombiTrans",
508                                                                                    "SSDChipCablesCombiTrans",
509                                                                                         "SSDFlex1CombiTrans"};
510   const char* ssdmodulerotname[7] = {"SSDStiffenerRotName",
511                                                                                   "SSDChipRotName",
512                                                                                 "SSDSensorRotName",
513                                                                                  "SSDFlex0RotName",
514                                                                   "SSDCoolingBlockRotName",
515                                                                         "SSDChipCablesRotName",
516                                                                                 "SSDFlex1RotName"};
517   TGeoCombiTrans *ssdmodulelocalmatrix[fgkSSDModuleCombiTransNumber];
518   for(Int_t i=0; i<fgkSSDModuleCombiTransNumber; i++){ 
519                                         ssdmodulelocalmatrix[i] =
520                                         new TGeoCombiTrans(ssdmodulecombitransname[i],
521                                                                            kssdmoduletransx[i],
522                                                                            kssdmoduletransy[i],
523                                                                            kssdmoduletransz[i],
524                                                                            new TGeoRotation(ssdmodulerotname[i],
525                                                                                                                       kssdmodulerotphi[i],
526                                                                                                         kssdmodulerottheta[i],
527                                                                                                         kssdmodulerotpsi[i]));
528     fSSDModuleCombiTransMatrix[i] = ssdmodulelocalmatrix[i];
529   }
530 }
531 /////////////////////////////////////////////////////////////////////////////////
532 void AliITSv11GeometrySSD::SetCarbonFiberJunctionCombiTransMatrix(){
533   /////////////////////////////////////////////////////////////
534   // Method generating CombiTrans Matrix for Carbon Fiber Junction   
535   /////////////////////////////////////////////////////////////
536   //Translation Parameters CarbonFiberJunction:
537   ////////////////////////////////////////////////////////
538   const Double_t kcarbonfiberjunctiontransx[3] = 
539                                 {  0.0,fgkCarbonFiberTriangleLength,fgkCarbonFiberTriangleLength
540                                  * TMath::Cos(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
541   const Double_t kcarbonfiberjunctiontransy[3] = 
542                                                                           {  0.0, 0.0,fgkCarbonFiberTriangleLength
543                                  *   TMath::Sin(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
544   const Double_t kcarbonfiberjunctiontransz[3] = {  0.0,  0.0,  0.0};
545   ////////////////////////////////////////////////////////
546   //Rotational Parameters CarbonFiberJunction:
547   ////////////////////////////////////////////////////////
548   const Double_t kcarbonfiberjunctionrotphi[3]   = {   0., 120., 240.};
549   const Double_t kcarbonfiberjunctionrottheta[3] = {   0.,   0.,   0.};
550   const Double_t kcarbonfiberjunctionrotpsi[3]   = {   0.,   0.,   0.};
551   ///////////////////////////////////////////////////////////
552   //Name of CombiTrans Transformation of CarbonFiberJunction:
553   ///////////////////////////////////////////////////////////
554   char carbonfiberjunctioncombitransname[40];
555   char carbonfiberjunctionrotname[40];
556   TGeoCombiTrans *carbonfiberjunctionlocalmatrix[fgkCarbonFiberJunctionCombiTransNumber];
557   for(Int_t i=0; i<fgkCarbonFiberJunctionCombiTransNumber; i++) {
558                 sprintf(carbonfiberjunctioncombitransname,"CarbonFiberJunctionCombiTrans%i",i);
559                 sprintf(carbonfiberjunctionrotname,"CarbonFiberJunctionRot%i",i);
560                 carbonfiberjunctionlocalmatrix[i] =
561                                         new TGeoCombiTrans(carbonfiberjunctioncombitransname,
562                                                                            kcarbonfiberjunctiontransx[i],
563                                                                            kcarbonfiberjunctiontransy[i],
564                                                                            kcarbonfiberjunctiontransz[i],
565                                                                 new TGeoRotation(carbonfiberjunctionrotname,
566                                                                                                 kcarbonfiberjunctionrotphi[i],
567                                                                                                 kcarbonfiberjunctionrottheta[i],
568                                                                                                 kcarbonfiberjunctionrotpsi[i]));
569     fCarbonFiberJunctionCombiTransMatrix[i] = carbonfiberjunctionlocalmatrix[i];
570   }
571 }
572 /////////////////////////////////////////////////////////////////////////////////
573 void AliITSv11GeometrySSD::SetEndLadderCarbonFiberJunctionCombiTransMatrix(Int_t i){
574   /////////////////////////////////////////////////////////////
575   // Method generating CombiTrans Matrix for End Ladder Carbon Fiber Junction   
576   /////////////////////////////////////////////////////////////
577   //Translation Parameters EndLadderCarbonFiberJunction:
578   ////////////////////////////////////////////////////////
579   const Double_t kendladdercarbonfiberjunctiontransx[3] = 
580                                 {  0.0,fgkCarbonFiberTriangleLength,fgkCarbonFiberTriangleLength
581                 *            TMath::Cos(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
582   const Double_t kendladdercarbonfiberjunctiontransy[3] = 
583                                                                                 {  0.0, 0.0,fgkCarbonFiberTriangleLength
584                 *            TMath::Sin(fgkCarbonFiberTriangleAngle*TMath::DegToRad())};
585   const Double_t kendladdercarbonfiberjunctiontransz[3] = {  0.0,  0.0,  
586                                                    0.5*(fgkEndLadderCarbonFiberLowerJunctionLength[i]
587                                                            -fgkEndLadderCarbonFiberUpperJunctionLength[i])};
588   ////////////////////////////////////////////////////////
589   //Rotational Parameters EndLadderCarbonFiberJunction:
590   ////////////////////////////////////////////////////////
591   const Double_t kendladdercarbonfiberjunctionrotphi[3]   = {   0., 120., 240.};
592   const Double_t kendladdercarbonfiberjunctionrottheta[3] = {   0.,   0.,   0.};
593   const Double_t kendladdercarbonfiberjunctionrotpsi[3]   = {   0.,   0.,   0.};
594   ///////////////////////////////////////////////////////////
595   //Name of CombiTrans Transformation of CarbonFiberJunction:
596   ///////////////////////////////////////////////////////////
597   char endladdercarbonfiberjunctioncombitransname[40];
598   char endladdercarbonfiberjunctionrotname[40];
599   TGeoCombiTrans *endladdercarbonfiberjunctionlocalmatrix[fgkEndLadderCarbonFiberJunctionCombiTransNumber];
600   for(Int_t i=0; i<fgkEndLadderCarbonFiberJunctionCombiTransNumber; i++) {
601         sprintf(endladdercarbonfiberjunctioncombitransname,"EndLadderCarbonFiberJunctionCombiTrans%i",i);
602         sprintf(endladdercarbonfiberjunctionrotname,"EndLadderCarbonFiberJunctionRot%i",i);
603         endladdercarbonfiberjunctionlocalmatrix[i] =
604         new TGeoCombiTrans(endladdercarbonfiberjunctioncombitransname,
605                                                                                   kendladdercarbonfiberjunctiontransx[i],
606                                                                                   kendladdercarbonfiberjunctiontransy[i],
607                                                                                   kendladdercarbonfiberjunctiontransz[i],
608                                                 new TGeoRotation(endladdercarbonfiberjunctionrotname,
609                                                                                   kendladdercarbonfiberjunctionrotphi[i],
610                                                                                     kendladdercarbonfiberjunctionrottheta[i],
611                                                                              kendladdercarbonfiberjunctionrotpsi[i]));
612     fEndLadderCarbonFiberJunctionCombiTransMatrix[i] = 
613                                                                          endladdercarbonfiberjunctionlocalmatrix[i];
614   }
615 }
616 ////////////////////////////////////////////////////////////////////////////////
617 void AliITSv11GeometrySSD::SetCarbonFiberAssemblyCombiTransMatrix(){
618   /////////////////////////////////////////////////////////////
619   // Method generating CombiTrans Matrix for Carbon fiber Assembly   
620   /////////////////////////////////////////////////////////////
621   //Translation Parameters CarbonFiberAssembly:
622   ////////////////////////////////////////////////////////
623   const Double_t kcarbonfiberassemblytransx[3] = {  0.0,  0.0,  0.0};
624   const Double_t kcarbonfiberassemblytransy[3] = 
625                                                                                 {  0.5*fgkCarbonFiberJunctionWidth, 0.0, 
626                                         fgkCarbonFiberJunctionWidth-fgkCarbonFiberLowerSupportWidth
627                            -    fgkCarbonFiberLowerSupportVolumePosition[0]
628                            -    fgkCarbonFiberLowerSupportVolumePosition[1]};
629   const Double_t kcarbonfiberassemblytransz[3] = 
630                                                   {  0.0,  0.0,-  0.5*fgkCarbonFiberLowerSupportHeight};
631   ////////////////////////////////////////////////////////
632   //Rotational Parameters CarbonFiberAssembly:
633   ////////////////////////////////////////////////////////
634   const Double_t kcarbonfiberassemblyrotphi[3]   = {   0.,  90.,   0.};
635   const Double_t kcarbonfiberassemblyrottheta[3] = {  90.,
636                                                                                         -fgkCarbonFiberTriangleAngle,   0.};
637   const Double_t kcarbonfiberassemblyrotpsi[3]   = {   0.,- 90.,   0.};
638   ///////////////////////////////////////////////////////////
639   //Name of CombiTrans Transformation of CarbonFiberAssembly:
640   ///////////////////////////////////////////////////////////
641   char carbonfiberassemblycombitransname[30];
642   char carbonfiberassemblyrotname[30];
643   TGeoCombiTrans *carbonfiberassemblylocalmatrix[fgkCarbonFiberAssemblyCombiTransNumber];
644   for(Int_t i=0; i<fgkCarbonFiberAssemblyCombiTransNumber; i++) {
645         sprintf(carbonfiberassemblycombitransname,"CarbonFiberAssemblyCombiTrans%i",i);
646         sprintf(carbonfiberassemblyrotname,"CarbonFiberAssemblyRot%i",i);
647         carbonfiberassemblylocalmatrix[i] =
648                                                 new TGeoCombiTrans(carbonfiberassemblycombitransname,
649                                                                                    kcarbonfiberassemblytransx[i],
650                                                                                    kcarbonfiberassemblytransy[i],
651                                                                                    kcarbonfiberassemblytransz[i],
652                                                  new TGeoRotation(carbonfiberassemblyrotname,
653                                                                                    kcarbonfiberassemblyrotphi[i],
654                                                                                    kcarbonfiberassemblyrottheta[i],
655                                                                                    kcarbonfiberassemblyrotpsi[i]));
656     fCarbonFiberAssemblyCombiTransMatrix[i] = carbonfiberassemblylocalmatrix[i];
657   }
658 }
659 /////////////////////////////////////////////////////////////////////////////////
660 void AliITSv11GeometrySSD::SetCoolingTubeSupportCombiTransMatrix(){
661   /////////////////////////////////////////////////////////////
662   // Method generating CombiTrans Matrix for Cooling Tube Support   
663   /////////////////////////////////////////////////////////////
664   //Translation Parameters CoolingTubeSupport:
665   ////////////////////////////////////////////////////////
666   Double_t phi = TMath::ASin(0.5*fgkCoolingTubeSupportHeight
667                                                                                                         /fgkCoolingTubeSupportRmax);
668   const Double_t kcoolingtubesupporttransx[2] = 
669                                                   {0.,2.*fgkCoolingTubeSupportRmax*TMath::Cos(phi)
670                                                 +  2.*(fgkCoolingTubeSupportLength
671                                                 -  fgkCoolingTubeSupportRmax*(1.+TMath::Cos(phi)))
672                                                 +  fgkCarbonFiberTriangleLength
673                                                 -  2.0*fgkCarbonFiberJunctionLength};
674   const Double_t kcoolingtubesupporttransy[2] = {  0.0,  0.0};
675   const Double_t kcoolingtubesupporttransz[2] = {  0.0,  0.0};
676   ////////////////////////////////////////////////////////
677   //Rotational Parameters CoolingTubeSupport:
678   ////////////////////////////////////////////////////////
679   const Double_t kcoolingsubesupportrotphi[2]   = {   0., 180.};
680   const Double_t kcoolingsubesupportrottheta[2] = {   0.,   0.};
681   const Double_t kcoolingsubesupportrotpsi[2]   = {   0.,   0.};
682   ///////////////////////////////////////////////////////////
683   //Name of CombiTrans Transformation of CarbonFiberJunction:
684   ///////////////////////////////////////////////////////////
685   char coolingtubesupportcombitransname[40];
686   char coolingtubesupportrotname[40];
687   TGeoCombiTrans *coolingtubesupportlocalmatrix[fgkCoolingTubeSupportCombiTransNumber];
688   for(Int_t i=0; i<fgkCoolingTubeSupportCombiTransNumber; i++) {
689         sprintf(coolingtubesupportcombitransname,"CoolingTubeSupportCombiTrans%i",i);
690         sprintf(coolingtubesupportrotname,"CoolingTubeSupportRot%i",i);
691         coolingtubesupportlocalmatrix[i] =
692                         new TGeoCombiTrans(coolingtubesupportcombitransname,
693                                                            kcoolingtubesupporttransx[i],
694                                                            kcoolingtubesupporttransy[i],
695                                                            kcoolingtubesupporttransz[i],
696                                                            new TGeoRotation(coolingtubesupportrotname,
697                                                                                                 kcoolingsubesupportrotphi[i],
698                                                                                                 kcoolingsubesupportrottheta[i],
699                                                                                                 kcoolingsubesupportrotpsi[i]));
700     fCoolingTubeSupportCombiTransMatrix[i] = coolingtubesupportlocalmatrix[i];
701   }
702 }
703 /////////////////////////////////////////////////////////////////////////////////
704 void AliITSv11GeometrySSD::SetCoolingTubeCombiTransMatrix(){
705   /////////////////////////////////////////////////////////////
706   // Method generating CombiTrans Matrix for Cooling Tube  
707   /////////////////////////////////////////////////////////////
708   //Translation Parameters CoolingTube:
709   ////////////////////////////////////////////////////////
710   const Double_t kcoolingtubetransx[2] = {  0.,  fgkCoolingTubeSeparation};
711   const Double_t kcoolingtubetransy[2] = {  fgkCoolingTubeLength/2.0, fgkCoolingTubeLength/2.0};
712   const Double_t kcoolingtubetransz[2] = {  0.0,  0.};
713   ////////////////////////////////////////////////////////
714   //Rotational Parameters CoolingTube:
715   ////////////////////////////////////////////////////////
716   const Double_t kcoolingtuberotphi[2]   = {   0.,   0.};
717   const Double_t kcoolingtuberottheta[2] = {  90.,  90.};
718   const Double_t kcoolingtuberotpsi[2]   = {   0.,   0.};
719   ///////////////////////////////////////////////////////////
720   //Name of CombiTrans Transformation of CarbonFiberJunction:
721   ///////////////////////////////////////////////////////////
722   const char* coolingtubecombitransname[fgkCoolingTubeCombiTransNumber] = 
723                                                         {"CoolingTubeCombiTrans0","CoolingTubeCombiTrans1"};
724   const char* coolingtuberotationname[fgkCoolingTubeCombiTransNumber] = 
725                                                                 {"CoolingTubeRotation0","CoolingTubeRotation1"};
726   TGeoCombiTrans *coolingtubelocalmatrix[fgkCoolingTubeCombiTransNumber];
727   for(Int_t i=0; i<fgkCoolingTubeCombiTransNumber; i++) {
728          coolingtubelocalmatrix[i] =
729                         new TGeoCombiTrans(coolingtubecombitransname[i],
730                                                            kcoolingtubetransx[i],
731                                                            kcoolingtubetransy[i],
732                                                            kcoolingtubetransz[i], 
733                                                            new TGeoRotation(coolingtuberotationname[i],
734                                                                             kcoolingtuberotphi[i],
735                                                                             kcoolingtuberottheta[i],
736                            kcoolingtuberotpsi[i]) );
737     fCoolingTubeTransMatrix[i] = coolingtubelocalmatrix[i];
738   }
739 }
740 /////////////////////////////////////////////////////////////////////////////////
741 void AliITSv11GeometrySSD::SetLadderSegmentCombiTransMatrix(){
742   /////////////////////////////////////////////////////////////
743   // Method generating CombiTrans Matrix for SSD Ladder Segment   
744   /////////////////////////////////////////////////////////////
745   //Translation Parameters LadderSegment:
746   ////////////////////////////////////////////////////////
747         const Double_t kladdersegmenttransx[fgkLadderSegmentCombiTransNumber] = {  0.,
748          -  0.5*(fgkSSDSensorWidth-fgkCarbonFiberTriangleLength),
749                          fgkCarbonFiberTriangleLength+fgkCarbonFiberJunctionToSensorSupport,
750                          fgkCarbonFiberJunctionLength-(fgkCoolingTubeSupportLength
751          -       fgkCoolingTubeSupportRmax),
752                 0.5*(fgkCarbonFiberTriangleLength-fgkCoolingTubeSeparation)}; 
753         const Double_t kladdersegmenttransy[fgkLadderSegmentCombiTransNumber] = {  0.,
754          -      (2.*fgkSSDSensorLength-fgkSSDSensorOverlap)+
755                          fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
756          +               0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
757          -               0.5*(fgkCarbonFiberLowerSupportWidth+fgkSSDSensorCenterSupportLength
758          -            fgkSSDSensorCenterSupportThickness[0]),
759                                   fgkCarbonFiberJunctionWidth-0.5*(fgkCarbonFiberLowerSupportWidth
760          +            fgkSSDSensorCenterSupportLength
761          -            fgkSSDSensorCenterSupportThickness[0])
762          -                        fgkSSDSensorCenterSupportPosition,
763                                   fgkCarbonFiberJunctionWidth-fgkCarbonFiberLowerSupportWidth
764          -                        fgkCoolingTubeSupportToCarbonFiber,
765                                                                                                  0.0};
766         const Double_t kladdersegmenttransz[fgkLadderSegmentCombiTransNumber] = {  0.,
767          -        (fgkSSDModuleCoolingBlockToSensor+0.5*fgkCoolingTubeSupportHeight
768          -         fgkSSDSensorHeight-fgkSSDChipCablesHeight[3]-fgkSSDChipHeight),
769                                                                                                                                                          0.,
770          -     0.5*fgkCoolingTubeSupportHeight,
771          -     0.5*fgkCoolingTubeSupportHeight};
772 //////////////////////////////////////////////////
773   //Rotational Parameters LadderSegment:
774   ////////////////////////////////////////////////////////
775   const Double_t kladdersegmentrotphi[fgkLadderSegmentCombiTransNumber]   =
776                                                                                                           {   0.,   0.,- 90.,   0.,  0.};
777   const Double_t kladdersegmentrottheta[fgkLadderSegmentCombiTransNumber] = 
778                                                                                                           {   0.,   0.,   0.,  90.,  0.};
779   const Double_t kladdersegmentrotpsi[fgkLadderSegmentCombiTransNumber]   = 
780                                                                                                           {   0.,   0.,   0.,   0.,  0.};
781   //////////////////////////////////////////////////////
782   //Name of CombiTrans Transformation of LadderSegment:
783   //////////////////////////////////////////////////////
784   char laddersegmentcombitransname[40];
785   char laddersegmentrotname[40];
786   TGeoCombiTrans *laddersegmentlocalmatrix[fgkLadderSegmentCombiTransNumber];
787   for(Int_t i=0; i<fgkLadderSegmentCombiTransNumber; i++) {
788                 sprintf(laddersegmentcombitransname,"LadderSegmentCombiTrans%i",i);
789                 sprintf(laddersegmentrotname,"LadderSegmentRot%i",i);
790                 laddersegmentlocalmatrix[i] =
791                                         new TGeoCombiTrans(laddersegmentcombitransname,
792                                                                            kladdersegmenttransx[i],
793                                                                            kladdersegmenttransy[i],
794                                                                            kladdersegmenttransz[i],
795                                                                            new TGeoRotation(laddersegmentrotname,
796                                                                                                                 kladdersegmentrotphi[i],
797                                                                                                                 kladdersegmentrottheta[i],
798                                                                                                                 kladdersegmentrotpsi[i]));
799     fLadderSegmentCombiTransMatrix[i] = laddersegmentlocalmatrix[i];
800   }
801 }
802 /////////////////////////////////////////////////////////////////////////////////
803 void AliITSv11GeometrySSD::SetEndLadderSegmentCombiTransMatrix(Int_t i){
804   /////////////////////////////////////////////////////////////
805   // Method generating CombiTrans Matrix for SSD End Ladder Segment   
806   /////////////////////////////////////////////////////////////
807   //Translation Parameters EndLadderSegment:
808   ////////////////////////////////////////////////////////
809   const Double_t kendladdersegmenttransx[fgkEndLadderSegmentCombiTransNumber] =
810             {0.0,
811                                                                                           0.0,
812           -  0.25*(fgkSSDMountingBlockLength[0]
813                                +         fgkSSDMountingBlockLength[1])
814           +  0.5*fgkCarbonFiberTriangleLength,
815                                                                                           0.0}; 
816   const Double_t kendladdersegmenttransy[fgkEndLadderSegmentCombiTransNumber] = 
817                                                          {0.5*fgkEndLadderCarbonFiberLowerJunctionLength[i],
818             i==0 ? 0. : fgkCarbonFiberLowerSupportWidth,
819                         fgkEndLadderMountingBlockPosition[i],
820                                                    (1-i)*(fgkEndLadderMountingBlockPosition[i]
821                                                                                  +  0.5*fgkSSDMountingBlockWidth)}; 
822   const Double_t kendladdersegmenttransz[fgkEndLadderSegmentCombiTransNumber] = 
823             {0.0,
824                                                                                           0.0,
825                                                                                 -  fgkSSDMountingBlockHeight[1]
826                                                                                 +  0.5*fgkSSDMountingBlockHeight[0],
827           -  0.5*fgkCarbonFiberLowerSupportHeight}; 
828   ////////////////////////////////////////////////////////
829   //Rotational Parameters EndLadderSegment:
830   ////////////////////////////////////////////////////////  
831   const Double_t kendladdersegmentrotphi[fgkEndLadderSegmentCombiTransNumber] =  
832             {   0.,  90.,   0.,   0.};
833   const Double_t kendladdersegmentrottheta[fgkEndLadderSegmentCombiTransNumber] = 
834             {  90.,-fgkCarbonFiberTriangleAngle, 0.,   0.};
835   const Double_t kendladdersegmentrotpsi[fgkEndLadderSegmentCombiTransNumber] = 
836             {   0.,- 90.,   0.,   0.};
837   ////////////////////////////////////////////////////////
838   //Name of CombiTrans Transformation of EndLadderSegment:
839   ////////////////////////////////////////////////////////
840   char endladdersegmentcombitransname[30];
841   char endladdersegmentrotname[30];
842   TGeoCombiTrans *endladdersegmentlocalmatrix[fgkEndLadderSegmentCombiTransNumber];
843   for(Int_t i=0; i<fgkEndLadderSegmentCombiTransNumber; i++){ 
844                 sprintf(endladdersegmentcombitransname,"EndLadderSegmentCombiTrans%i",i);
845                 sprintf(endladdersegmentrotname,"EndLadderSegmentRot%i",i);
846                 endladdersegmentlocalmatrix[i] =
847                                 new TGeoCombiTrans(endladdersegmentcombitransname,
848                                                                    kendladdersegmenttransx[i],
849                                                                    kendladdersegmenttransy[i],
850                                                                    kendladdersegmenttransz[i],
851                                                                    new TGeoRotation(endladdersegmentrotname,
852                                                                                                         kendladdersegmentrotphi[i],
853                                                                                                         kendladdersegmentrottheta[i],
854                                                                                                         kendladdersegmentrotpsi[i]));
855     fEndLadderSegmentCombiTransMatrix[i] = endladdersegmentlocalmatrix[i];
856   }
857 }
858 /////////////////////////////////////////////////////////////////////////////////
859 void AliITSv11GeometrySSD::SetLadderCableCombiTransMatrix(Int_t iLayer){
860   /////////////////////////////////////////////////////////////
861   // Method generating CombiTrans Matrix for SSD Ladder Cable   
862   /////////////////////////////////////////////////////////////
863   // Translation Parameters for LadderCable
864   /////////////////////////////////////////
865   Double_t ssdflexradius = fgkSSDStiffenerHeight+2*fgkSSDFlexHeight[0]
866                                              + fgkSSDFlexHeight[1];  
867   Double_t ssdflexradiusmax = (fgkSSDFlexLength[3]-fgkSSDFlexLength[2])
868                                                         /  TMath::Tan(fgkSSDFlexAngle*TMath::DegToRad());
869   Double_t ssdladdercabletransx[3];
870   ssdladdercabletransx[0] = (ssdflexradiusmax-fgkSSDFlexHeight[1]-ssdflexradius)
871                                                   *   TMath::Sin(2.*fgkSSDFlexAngle*TMath::DegToRad())
872                                                   *       TMath::Cos(2.*fgkSSDFlexAngle*TMath::DegToRad());
873   ssdladdercabletransx[1] = ((ssdflexradiusmax-fgkSSDFlexHeight[1]-ssdflexradius)
874                                                   -     ssdladdercabletransx[0]
875                                                   /     TMath::Sin(2.*fgkSSDFlexAngle*TMath::DegToRad()))
876                                                   *     TMath::Cos(fgkSSDFlexAngle*TMath::DegToRad());                                          
877   ssdladdercabletransx[2] = (fgkSSDFlexFullLength-2.*fgkSSDFlexAngle
878                                                   *       TMath::DegToRad()*ssdflexradiusmax
879                                                   -     fgkSSDFlexLength[2]-TMath::Pi()
880                                                   *       fgkSSDStiffenerHeight-fgkSSDFlexLength[0]
881                                                   -       fgkSSDLadderCableWidth)
882                                                   *       TMath::Cos(2.*fgkSSDFlexAngle*TMath::DegToRad());
883   Double_t ssdladdercabletransz[3] = {ssdladdercabletransx[0]
884                                                   *     TMath::Tan(2.*fgkSSDFlexAngle*TMath::DegToRad()),
885                                                         ssdladdercabletransx[1]
886                                                   *     TMath::Tan(fgkSSDFlexAngle*TMath::DegToRad()),
887                                                         ssdladdercabletransx[2]
888                                                   *     TMath::Tan(2.*fgkSSDFlexAngle*TMath::DegToRad())};      
889   TGeoRotation* localladdercablerot[3]; 
890   localladdercablerot[0] = new TGeoRotation("LocalLadderCableRot0",90.,0.,0.);
891   localladdercablerot[1] = new TGeoRotation("LocalLadderCableRot1",90.,60.,-90.);
892   localladdercablerot[2] = new TGeoRotation("LocalLadderCableRot2");
893   localladdercablerot[2]->SetRotation((*localladdercablerot[1])
894                                                  *                        (*localladdercablerot[0]));
895   ////////////////////////////////////////////
896   // LocalLadderCableCombiTransMatrix
897   ////////////////////////////////////////////
898   const Int_t klocalladdersidecablesnumber = 2;
899   const Int_t klocalladdercombitransnumber = 5;
900   TGeoCombiTrans** localladdercablecombitransmatrix[klocalladdersidecablesnumber];
901   for(Int_t i=0; i<klocalladdersidecablesnumber; i++) 
902          localladdercablecombitransmatrix[i] = 
903                                                            new TGeoCombiTrans*[klocalladdercombitransnumber];
904   ///////////////////////////////////////////
905   // Left Side Ladder Cables Transformations
906   ///////////////////////////////////////////
907   localladdercablecombitransmatrix[0][0]  =
908                                                 new TGeoCombiTrans(-0.5*fgkCarbonFiberTriangleLength,
909                                                 0.,0.,NULL);
910   localladdercablecombitransmatrix[0][1] = fLadderSegmentCombiTransMatrix[1];
911   localladdercablecombitransmatrix[0][2] = 
912                                                 new TGeoCombiTrans(fgkSSDModuleStiffenerPosition[0],
913                                                                                    fgkSSDModuleStiffenerPosition[1],0.,0);
914   localladdercablecombitransmatrix[0][3] = fSSDModuleCombiTransMatrix[6];
915   localladdercablecombitransmatrix[0][4] = 
916                                                 new TGeoCombiTrans(-ssdladdercabletransx[0]
917                                                 -     ssdladdercabletransx[1]-ssdladdercabletransx[2]
918                                                 +     fgkSSDFlexLength[0]-fgkSSDFlexLength[2],
919                                                           0.,
920                                                           0.5*fgkSSDFlexHeight[0]+2.*(fgkSSDFlexHeight[0]
921                                                 +         fgkSSDFlexHeight[1])+2.*fgkSSDStiffenerHeight
922                                                 +     ssdladdercabletransz[0]-ssdladdercabletransz[1]
923                                                 +         ssdladdercabletransz[2],localladdercablerot[2]);
924   ///////////////////////////////////////////
925   // Rigth Side Ladder Cables Transformations
926   ///////////////////////////////////////////
927   for(Int_t i=0; i<klocalladdercombitransnumber; i++)
928    localladdercablecombitransmatrix[1][i] = 
929                         (i!=3 ? localladdercablecombitransmatrix[0][i]:
930                                         fSSDModuleCombiTransMatrix[3]);         
931   ///////////////////////////////////////////
932   // Setting LadderCableCombiTransMatrix
933   ///////////////////////////////////////////
934   Int_t beamaxistrans[3] = {0,0,0};
935   switch(iLayer){
936   case 5: 
937           beamaxistrans[0] = fgkSSDLay5SensorsNumber/2;
938           beamaxistrans[1] = beamaxistrans[0]+1;
939           beamaxistrans[2] = beamaxistrans[0]-1;
940   break;
941   case 6:
942           beamaxistrans[0] = (fgkSSDLay6SensorsNumber-1)/2;
943         beamaxistrans[1] = beamaxistrans[0]+1;
944         beamaxistrans[2] = beamaxistrans[0];
945           break;
946   }
947   TGeoHMatrix* localladdercablehmatrix[klocalladdersidecablesnumber];
948   TGeoRotation* laddercablerot;
949   TGeoTranslation* laddercabletrans;
950   for(Int_t i=0; i<klocalladdersidecablesnumber; i++){
951          localladdercablehmatrix[i] = new TGeoHMatrix();
952          for(Int_t j=0; j<klocalladdercombitransnumber; j++){
953                    localladdercablehmatrix[i]->MultiplyLeft(
954                    localladdercablecombitransmatrix[i][klocalladdercombitransnumber-j-1]);
955          }
956          laddercablerot = new TGeoRotation();
957          laddercablerot->SetMatrix(localladdercablehmatrix[i]->GetRotationMatrix());
958   laddercabletrans = new TGeoTranslation();
959   Double_t* laddercabletransvector = localladdercablehmatrix[i]->GetTranslation();
960   laddercabletrans->SetTranslation(laddercabletransvector[0],
961                                                                          laddercabletransvector[1]
962                                         +                (i==0 ? beamaxistrans[0] : 0.)
963                                         *                                fgkCarbonFiberJunctionWidth,
964                                                                          laddercabletransvector[2]);     
965          fLadderCableCombiTransMatrix[i] = new TGeoCombiTrans(*laddercabletrans,
966                                                                                                    *laddercablerot);
967         } 
968         fLadderCableCombiTransMatrix[2] = 
969                                         AddTranslationToCombiTrans(fLadderCableCombiTransMatrix[1],0.,
970                                         beamaxistrans[1]*fgkCarbonFiberJunctionWidth,0.);
971         fLadderCableCombiTransMatrix[3] = 
972                                         AddTranslationToCombiTrans(fLadderCableCombiTransMatrix[0],0.,
973                                         beamaxistrans[2]*fgkCarbonFiberJunctionWidth,0.);
974 }
975 /////////////////////////////////////////////////////////////////////////////////
976 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensorSupportShape(Double_t length, 
977                                                         Double_t height,Double_t width,Double_t* thickness){
978   /////////////////////////////////////////////////////////////
979   // Method generating SSD Sensor Support Shape   
980   /////////////////////////////////////////////////////////////
981   const Int_t kvertexnumber = 4;
982   const Int_t kshapesnumber = 2;
983   Double_t shapewidth[2] = {width,width};
984   TVector3** vertexposition[kshapesnumber];
985   for(Int_t i = 0; i<kshapesnumber; i++) vertexposition[i] = 
986                                                                                                         new TVector3*[kvertexnumber];
987   //First Shape Vertex Positioning
988   vertexposition[0][0] = new TVector3();
989   vertexposition[0][1] = new TVector3(height);
990   vertexposition[0][2] = new TVector3(thickness[0]);
991   vertexposition[0][3] = new TVector3(*vertexposition[0][1]);
992   //Second Shape Vertex Positioning
993   vertexposition[1][0] = new TVector3(*vertexposition[0][0]);
994   vertexposition[1][1] = new TVector3(length);
995   vertexposition[1][2] = new TVector3(thickness[1]);
996   vertexposition[1][3] = new TVector3(vertexposition[1][1]->X());
997   char* ssdsensorsupportshapename[kshapesnumber] = 
998                                                         {"SSDSensorSupportShape1","SSDSensorSupportShape2"};
999   TGeoArb8* lSSDSensorSupportShape[kshapesnumber];
1000   for(Int_t i = 0; i< kshapesnumber; i++) lSSDSensorSupportShape[i] = 
1001                                            GetArbShape(vertexposition[i],shapewidth,i==0 ? 
1002                                                                                                          thickness[1]: thickness[0],
1003                                                                                                   ssdsensorsupportshapename[i]);
1004   /////////////////////////////////////
1005   //Setting Translations and Rotations: 
1006   /////////////////////////////////////
1007   TGeoRotation* ssdsensorsupportshaperot[2];
1008   ssdsensorsupportshaperot[0] = 
1009                                          new TGeoRotation("SSDSensorSupportShapeRot1",180.,0.,0.);
1010   ssdsensorsupportshaperot[1] = 
1011                                          new TGeoRotation("SSDSensorSupportShapeRot2",90.,90.,-90.);
1012   TGeoTranslation* ssdsensorsupportshapetrans = 
1013                                          new TGeoTranslation("SSDSensorSupportShapeTrans",0.,0.,
1014                                                                                                                           0.5*thickness[0]);
1015   TGeoCombiTrans* ssdsensorsupportcombitrans = 
1016           new TGeoCombiTrans("SSDSensorSupportCombiTrans",0.5*thickness[0],width,0.,
1017                                                   new TGeoRotation((*ssdsensorsupportshaperot[1])
1018                                                 *                  (*ssdsensorsupportshaperot[0])));
1019   TGeoVolume* ssdsensorsupportcompvolume = 
1020                                                   new TGeoVolumeAssembly("SSDSensorSupportCompVolume");
1021   ssdsensorsupportcompvolume->AddNode(new TGeoVolume("SSDSensorSupportVolume1",
1022                                                         lSSDSensorSupportShape[0],fSSDSensorSupportMedium),1,
1023                                                         ssdsensorsupportshapetrans);
1024   ssdsensorsupportcompvolume->AddNode(new TGeoVolume("SSDSensorSupportVolume2",
1025                                                         lSSDSensorSupportShape[1],fSSDSensorSupportMedium),1,
1026                                                         ssdsensorsupportcombitrans);
1027   return ssdsensorsupportcompvolume;
1028 }
1029 /////////////////////////////////////////////////////////////////////////////////
1030 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensorSupport(Int_t VolumeKind, Int_t n){
1031   /////////////////////////////////////////////////////////////
1032   // Method generating SSD Sensor Support    
1033   /////////////////////////////////////////////////////////////
1034   TGeoVolume* ssdsensorsupport;
1035   Double_t sidesupporthickness[2] = {fgkSSDSensorSideSupportThickness[0],
1036                                                                                    fgkSSDSensorSideSupportThickness[1]};
1037   VolumeKind == 0 ? ssdsensorsupport = GetSSDSensorSupportShape(
1038                                                                 fgkSSDSensorSideSupportLength,
1039                                                                 fgkSSDSensorSideSupportHeight[(n==0 ? 0 : 1)],
1040                                                                 fgkSSDSensorSideSupportWidth,
1041                                                                 sidesupporthickness) :
1042     ssdsensorsupport = GetSSDSensorSupportShape(fgkSSDSensorCenterSupportLength,
1043                                                         fgkSSDSensorCenterSupportHeight[(n==0 ? 0 : 1)],
1044                                                             fgkSSDSensorCenterSupportWidth,
1045                                                             sidesupporthickness);
1046   return ssdsensorsupport;
1047 }
1048 /////////////////////////////////////////////////////////////////////////////////
1049 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensorSupportAssembly(Int_t n){
1050   /////////////////////////////////////////////////////////////
1051   // Method generating SSD Sensor Support Assembly   
1052   /////////////////////////////////////////////////////////////
1053   TGeoVolume* ssdsensorsupportassembly = 
1054                                                          new TGeoVolumeAssembly("SSDSensorSupportAssembly");
1055   const Int_t kvolumenumber = 2;
1056   TGeoVolume* ssdsensorsupport[kvolumenumber];
1057   for(Int_t i=0; i<kvolumenumber; i++) ssdsensorsupport[i] = 
1058                                                                                                                 GetSSDSensorSupport(i,n);
1059   SetSSDSensorSupportCombiTransMatrix();
1060   for(Int_t i=0; i<fgkSSDSensorSupportCombiTransNumber; i++) 
1061         ssdsensorsupportassembly->AddNode((i<2 ? ssdsensorsupport[0]:
1062                                                                                          ssdsensorsupport[1]),
1063                                                                                  i+1,fSSDSensorSupportCombiTransMatrix[i]);
1064   return ssdsensorsupportassembly;
1065 }
1066 /////////////////////////////////////////////////////////////////////////////////
1067 TGeoVolume* AliITSv11GeometrySSD::GetSSDModule(Int_t iChipCablesHeight){
1068   /////////////////////////////////////////////////////////////
1069   // Method generating SSD Sensor Module    
1070   /////////////////////////////////////////////////////////////
1071   TGeoVolume* ssdmodulevolume[fgkSSDModuleCombiTransNumber-1];
1072   ssdmodulevolume[0] = GetSSDStiffenerAssembly();
1073   ssdmodulevolume[1] = GetSSDChipAssembly();
1074   ssdmodulevolume[2] = GetSSDSensor();
1075   ssdmodulevolume[3] = GetSSDFlexAssembly();
1076   ssdmodulevolume[4] = GetSSDCoolingBlockAssembly();
1077   ssdmodulevolume[5] = GetSSDChipCablesAssembly(fgkSSDChipCablesHeight[iChipCablesHeight+2]);
1078   SetSSDModuleCombiTransMatrix(fgkSSDChipCablesHeight[iChipCablesHeight+2]);
1079   TGeoCombiTrans* ssdmoduleglobalcombitrans = 
1080                                                                    new TGeoCombiTrans("SSDModuleGlobalCombiTrans",
1081                                                                            fgkSSDModuleStiffenerPosition[0],
1082                                                                            fgkSSDModuleStiffenerPosition[1],0.,NULL);
1083   TGeoHMatrix* ssdmodulehmatrix[fgkSSDModuleCombiTransNumber];
1084   TGeoVolume* ssdmodule = new TGeoVolumeAssembly("SSDModule");
1085   for(Int_t i=0; i<fgkSSDModuleCombiTransNumber; i++){ 
1086         ssdmodulehmatrix[i] = new TGeoHMatrix((*ssdmoduleglobalcombitrans)
1087                                                 *                                 (*fSSDModuleCombiTransMatrix[i]));
1088         ssdmodule->AddNode(i==fgkSSDModuleCombiTransNumber-1 ? ssdmodulevolume[3] : 
1089                                                   ssdmodulevolume[i],i!=fgkSSDModuleCombiTransNumber-1?1:2,
1090                                                   ssdmodulehmatrix[i]);
1091   }
1092   return ssdmodule;
1093 }
1094 /////////////////////////////////////////////////////////////////////////////////
1095 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensor(){
1096   /////////////////////////////////////////////////////////////
1097   // Method generating SSD Sensor  
1098   /////////////////////////////////////////////////////////////
1099   Double_t ssdsensitivelength = fgkSSDSensorLength-2.*fgkSSDSensorInsensitiveLength;
1100   Double_t ssdsensitivewidth  = fgkSSDSensorWidth-2.*fgkSSDSensorInsensitiveWidth;
1101   TGeoBBox* ssdsensorsensitiveshape = new TGeoBBox("SSDSensorSensitiveShape",
1102                                                 0.5*ssdsensitivelength,
1103                                                 0.5*ssdsensitivewidth,
1104                                                 0.5*fgkSSDSensorHeight);
1105   TGeoVolume* ssdsensorsensitive = 
1106       new TGeoVolume(fgkSSDSensitiveVolName,ssdsensorsensitiveshape,fSSDSensorMedium);
1107   ssdsensorsensitive->SetLineColor(fColorSilicon);
1108   TGeoBBox* ssdsensorinsensitiveshape[2];
1109   ssdsensorinsensitiveshape[0] = new TGeoBBox("SSDSensorInsensitiveShape1",
1110                                                 0.5*fgkSSDSensorLength,
1111                                                 0.5*fgkSSDSensorInsensitiveWidth,
1112                                                 0.5*fgkSSDSensorHeight);
1113   ssdsensorinsensitiveshape[1] = new TGeoBBox("SSDSensorInsensitiveShape2",
1114                                                 0.5*fgkSSDSensorInsensitiveWidth,
1115                                                 0.5*ssdsensitivewidth,
1116                                                 0.5*fgkSSDSensorHeight);
1117   const char* ssdsensorinsensitivename[2] = {"SSDSensorInsensitive1",
1118                                              "SSDSensorInsensitive2"};
1119   TGeoVolume* ssdsensorinsensitive[2];
1120   for(Int_t i=0; i<2; i++){ ssdsensorinsensitive[i] = 
1121       new TGeoVolume(ssdsensorinsensitivename[i],ssdsensorinsensitiveshape[i],
1122                      fSSDSensorMedium);
1123       ssdsensorinsensitive[i]->SetLineColor(fColorCarbonFiber);
1124   }
1125   TGeoVolume* ssdsensorinsensitivevol = 
1126                               new TGeoVolumeAssembly("SSDSensorInsensitiveVol");
1127   for(Int_t i=0; i<4; i++) 
1128             ssdsensorinsensitivevol->AddNode(i%2==0 ? ssdsensorinsensitive[0]:
1129             ssdsensorinsensitive[1],i<2?1:2,
1130                   new TGeoTranslation(0.5*(1.-TMath::Power(-1.,i))*(i==1? 1.:-1.)
1131       *     (ssdsensorsensitiveshape->GetDX()+ssdsensorinsensitiveshape[1]->GetDX()),
1132                         0.5*(1.+TMath::Power(-1.,i))*(i==0?-1.: 1.)
1133       *     (ssdsensorsensitiveshape->GetDY()+ssdsensorinsensitiveshape[0]->GetDY()),0.));            
1134   TGeoVolume* ssdsensor = new TGeoVolumeAssembly("SSDSensor");
1135   ssdsensor->AddNode(ssdsensorsensitive,1),ssdsensor->AddNode(ssdsensorinsensitivevol,1);
1136   return ssdsensor;
1137 }
1138 /////////////////////////////////////////////////////////////////////////////////
1139 TGeoVolume* AliITSv11GeometrySSD::GetSSDChipAssembly() const{
1140   /////////////////////////////////////////////////////////////
1141   // Method generating SSD Chip Assembly    
1142   /////////////////////////////////////////////////////////////
1143   const Int_t kssdchiprownumber = 2;
1144   TGeoBBox* ssdchipcompshape[2];
1145   ssdchipcompshape[0] =  new TGeoBBox("SSDChipCompShape",
1146                                                                                 0.5*fgkSSDChipLength,
1147                                                                                 0.5*fgkSSDChipWidth,
1148                                                                                 0.5*(fgkSSDChipHeight-fgkSSDChipGlueHeight));
1149   ssdchipcompshape[1] =  new TGeoBBox("SSDChipGlueCompShape",
1150                                                                                 0.5*fgkSSDChipLength,
1151                                                                                 0.5*fgkSSDChipWidth,
1152                                                                                 0.5*fgkSSDChipGlueHeight);
1153   TGeoVolume* ssdchipcomp[2];
1154   ssdchipcomp[0] = new TGeoVolume("SSDChipComp",ssdchipcompshape[0],fSSDChipMedium);
1155   ssdchipcomp[1] = new TGeoVolume("SSDChipGlueComp",ssdchipcompshape[1],
1156                                                                   fSSDChipGlueMedium);
1157   ssdchipcomp[0]->SetLineColor(fColorSilicon);  
1158   ssdchipcomp[1]->SetLineColor(fColorEpoxy);
1159   TGeoTranslation* ssdchipcomptrans[2];
1160   ssdchipcomptrans[0] = new TGeoTranslation(0.,0.,-ssdchipcompshape[1]->GetDZ());
1161   ssdchipcomptrans[1] = new TGeoTranslation(0.,0.,ssdchipcompshape[0]->GetDZ());
1162   TGeoVolume* ssdchip = new TGeoVolumeAssembly("SSDChip");  
1163   for(Int_t i=0; i<2; i++) ssdchip->AddNode(ssdchipcomp[i],1,ssdchipcomptrans[i]);
1164   Double_t ssdchipseparation[2] = {fgkSSDChipLength+fgkSSDChipSeparationLength,
1165                                                   fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
1166                                    -  2.*(fgkSSDStiffenerWidth-fgkSSDStiffenerToChipDist
1167                                    -  0.5*fgkSSDChipWidth)};
1168   TGeoVolume* ssdchipassembly = new TGeoVolumeAssembly("SSDChipAssembly"); 
1169   for(Int_t i=0; i<kssdchiprownumber; i++)
1170     for(Int_t j=0; j<fgkSSDChipNumber; j++) 
1171                 ssdchipassembly->AddNode(ssdchip,fgkSSDChipNumber*i+j+1,
1172                 new TGeoTranslation(j*ssdchipseparation[0],i*ssdchipseparation[1],0.));
1173   return ssdchipassembly;
1174 }
1175 /////////////////////////////////////////////////////////////////////////////////
1176 TGeoVolume* AliITSv11GeometrySSD::GetSSDStiffenerAssembly(){
1177   /////////////////////////////////////////////////////////////
1178   // Method generating SSD Stiffener Assembly    
1179   /////////////////////////////////////////////////////////////
1180   const Int_t kssdstiffenernumber = 2;
1181   Double_t ssdstiffenerseparation = fgkSSDSensorLength
1182                                                                   - 2.*fgkSSDModuleStiffenerPosition[1]
1183                                                                   -    fgkSSDStiffenerWidth;
1184   TGeoVolume* ssdstiffener = new TGeoVolumeAssembly("SSDStiffener");
1185 ////////////////////////////
1186 // Stiffener Volumes
1187 ///////////////////////////
1188   const Int_t kstiffenerboxnumber = 6;
1189   TGeoBBox* ssdstiffenerboxshapes[kstiffenerboxnumber];
1190   ssdstiffenerboxshapes[0] = new TGeoBBox("SSDStiffenerBoxShape1",
1191                                                                                   0.5* fgkSSDStiffenerLength,
1192                                                                                   0.5* fgkSSDStiffenerWidth,
1193                                                                                   0.5*(fgkSSDStiffenerHeight
1194                                                    -                   fgkSSDConnectorHeight));
1195   ssdstiffenerboxshapes[1] = new TGeoBBox("SSDStiffenerBoxShape2",
1196                                                                                   0.5*(fgkSSDConnectorPosition[0]
1197                                                    -              2.0* fgkSSDConnectorLength
1198                                                    -                               fgkSSDConnectorSeparation),
1199                                                                                   0.5* fgkSSDStiffenerWidth,
1200                                                                                   0.5* fgkSSDConnectorHeight);
1201   ssdstiffenerboxshapes[2] = new TGeoBBox("SSDStiffenerBoxShape3",
1202                                                                                   0.5*(fgkSSDConnectorSeparation
1203                                                    +              2.*  fgkSSDConnectorLength),
1204                                                                                   0.5* fgkSSDConnectorPosition[1],
1205                                                                                   0.5* fgkSSDConnectorHeight);
1206   ssdstiffenerboxshapes[3] = new TGeoBBox("SSDStiffenerBoxShape4",
1207                                                                                         ssdstiffenerboxshapes[2]->GetDX(),
1208                                                                                   0.5*(fgkSSDStiffenerWidth
1209                                                    -                   fgkSSDConnectorPosition[1]
1210                                                    -                   fgkSSDConnectorWidth),
1211                                                                                   0.5* fgkSSDConnectorHeight);
1212    ssdstiffenerboxshapes[4] = new TGeoBBox("SSDStiffenerBoxShape5",
1213                                                                                   0.5* fgkSSDConnectorSeparation,
1214                                                                                   0.5* fgkSSDConnectorWidth,
1215                                                                                   0.5* fgkSSDConnectorHeight);
1216    ssdstiffenerboxshapes[5] = new TGeoBBox("SSDStiffenerBoxShape6",
1217                                                                                   0.5*(fgkSSDStiffenerLength
1218                                                          -                                 fgkSSDConnectorPosition[0]),
1219                                                                                   0.5* fgkSSDStiffenerWidth,
1220                                                                                   0.5* fgkSSDConnectorHeight);
1221   TGeoVolume* ssdstiffenerbox[kstiffenerboxnumber];
1222   char ssdtiffenerboxname[30];
1223   for(Int_t i=0; i<kstiffenerboxnumber; i++){ 
1224          sprintf(ssdtiffenerboxname,"SSDStiffenerBox%i",i+1);
1225     ssdstiffenerbox[i] = new TGeoVolume(ssdtiffenerboxname,ssdstiffenerboxshapes[i],
1226                                                                           fSSDStiffenerMedium);
1227         ssdstiffenerbox[i]->SetLineColor(fColorStiffener);
1228   }
1229 ////////////////////////////
1230 // Connector 
1231 ///////////////////////////
1232   TGeoBBox* ssdconnectorshape =  new TGeoBBox("SSDConnectorShape",
1233                                                                                          0.5*fgkSSDConnectorLength,
1234                                                                                          0.5*fgkSSDConnectorWidth,
1235                                                                                          0.5*fgkSSDConnectorHeight);
1236   TGeoVolume* ssdconnector    = new TGeoVolume("SSDConnector",ssdconnectorshape,
1237                                                                                                 fSSDStiffenerConnectorMedium); 
1238   ssdconnector->SetLineColor(fColorAl);
1239   const Int_t kssdconnectornumber = 2;
1240   TGeoTranslation* ssdconnectortrans[kssdconnectornumber];
1241   ssdconnectortrans[0] = new TGeoTranslation("SSDConnectorTrans1",
1242         -  ssdstiffenerboxshapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1243                 -  fgkSSDConnectorSeparation-1.5*fgkSSDConnectorLength,
1244                    ssdstiffenerboxshapes[0]->GetDY()-fgkSSDConnectorPosition[1]
1245                 -  ssdconnectorshape->GetDY(),
1246                    ssdstiffenerboxshapes[0]->GetDZ()+ssdconnectorshape->GetDZ());       
1247   ssdconnectortrans[1] = new TGeoTranslation("SSDConnectorTrans2",
1248         -  ssdstiffenerboxshapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1249         -  0.5*fgkSSDConnectorLength,
1250            ssdstiffenerboxshapes[0]->GetDY()-fgkSSDConnectorPosition[1]
1251                 -  ssdconnectorshape->GetDY(),
1252                    ssdstiffenerboxshapes[0]->GetDZ()+ssdconnectorshape->GetDZ());
1253   for(Int_t i=0; i<kssdconnectornumber; i++)
1254                         ssdstiffener->AddNode(ssdconnector,i+1,ssdconnectortrans[i]);   
1255 //////////////////////////////////////
1256 // TGeoTranslation for Stiffener Boxes
1257 //////////////////////////////////////
1258   TGeoTranslation* ssdstiffenerboxtrans[kstiffenerboxnumber];
1259   ssdstiffenerboxtrans[0] = new TGeoTranslation("SSDStiffenerBoxTrans1",0.,0.,0.);
1260   ssdstiffenerboxtrans[1] = new TGeoTranslation("SSDStiffenerBoxTrans2",
1261                  - (ssdstiffenerboxshapes[0]->GetDX()-ssdstiffenerboxshapes[1]->GetDX()),
1262                     0.,
1263                         ssdstiffenerboxshapes[0]->GetDZ()+ssdstiffenerboxshapes[1]->GetDZ());
1264   ssdstiffenerboxtrans[2] = new TGeoTranslation("SSDStiffenerBoxTrans3",
1265          - ssdstiffenerboxshapes[0]->GetDX()-ssdstiffenerboxshapes[2]->GetDX()
1266                  + fgkSSDConnectorPosition[0],
1267                    ssdstiffenerboxshapes[0]->GetDY()-ssdstiffenerboxshapes[2]->GetDY(),
1268                    ssdstiffenerboxshapes[0]->GetDZ()+ssdstiffenerboxshapes[2]->GetDZ());
1269   ssdstiffenerboxtrans[3] = new TGeoTranslation("SSDStiffenerBoxTrans4",
1270          - ssdstiffenerboxshapes[0]->GetDX()-ssdstiffenerboxshapes[3]->GetDX()
1271                  + fgkSSDConnectorPosition[0],
1272                  - ssdstiffenerboxshapes[0]->GetDY()+ssdstiffenerboxshapes[3]->GetDY(),
1273                    ssdstiffenerboxshapes[0]->GetDZ()+ssdstiffenerboxshapes[3]->GetDZ());
1274   ssdstiffenerboxtrans[4] = new TGeoTranslation("SSDStiffenerBoxTrans5",
1275                  - ssdstiffenerboxshapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1276                  - 0.5*fgkSSDConnectorSeparation-2.*ssdconnectorshape->GetDX(),
1277                    ssdstiffenerboxshapes[0]->GetDY()-fgkSSDConnectorPosition[1]
1278                  - ssdconnectorshape->GetDY(),
1279                    ssdstiffenerboxshapes[0]->GetDZ()+ssdconnectorshape->GetDZ());
1280   ssdstiffenerboxtrans[5] = new TGeoTranslation("SSDStiffenerBoxTrans6",
1281          - ssdstiffenerboxshapes[0]->GetDX()+fgkSSDConnectorPosition[0]
1282                  + ssdstiffenerboxshapes[5]->GetDX(),
1283                    0.,
1284                    ssdstiffenerboxshapes[0]->GetDZ()+ssdstiffenerboxshapes[5]->GetDZ());
1285   for(Int_t i=0; i<kstiffenerboxnumber; i++) 
1286                 ssdstiffener->AddNode(ssdstiffenerbox[i],1,ssdstiffenerboxtrans[i]);    
1287   TGeoCombiTrans* ssdstiffenercombitrans[kssdstiffenernumber];
1288   char ssdstiffenercombitransname[30];
1289     for(Int_t i=0; i<kssdstiffenernumber; i++){ 
1290         sprintf(ssdstiffenercombitransname,"SSDStiffenerCombiTrans%i",i+1);
1291     ssdstiffenercombitrans[i] = new TGeoCombiTrans(ssdstiffenercombitransname,
1292                         0.,i*ssdstiffenerseparation,0.,new TGeoRotation("",180*(1-i),0.,0.));
1293   }
1294 ////////////////////////////
1295 // Capacitor 0603-2200 nF
1296 ///////////////////////////
1297   const Int_t knapacitor0603number = 5;
1298   TGeoBBox* capacitor0603shape =  new TGeoBBox("Capacitor0603Shape",
1299                                                                                          0.5*fgkSSDCapacitor0603Length,
1300                                                                                          0.5*fgkSSDCapacitor0603Width,
1301                                                                                          0.5*fgkSSDCapacitor0603Height);
1302   TGeoVolume* capacitor0603 = new TGeoVolume("Capacitor0603",capacitor0603shape,
1303                                              fSSDStiffener0603CapacitorMedium); 
1304   capacitor0603->SetLineColor(fColorAl);
1305 ////////////////////////////
1306 // Capacitor 1812-330 nF
1307 ///////////////////////////
1308   TGeoBBox* capacitor1812shape =  new TGeoBBox("Capacitor1812Shape",
1309                                                                                          0.5*fgkSSDCapacitor1812Length,
1310                                                                                          0.5*fgkSSDCapacitor1812Width,
1311                                                                                          0.5*fgkSSDCapacitor1812Height);
1312   TGeoVolume* capacitor1812 = new TGeoVolume("Capacitor1812",capacitor1812shape,
1313                                              fSSDStiffener1812CapacitorMedium); 
1314   capacitor1812->SetLineColor(fColorAl);
1315   TGeoTranslation* capacitor1812trans = new TGeoTranslation("Capacitor1812Trans",
1316                           0.,
1317                           0.5*fgkSSDStiffenerWidth+ssdstiffenerseparation
1318                -  capacitor1812shape->GetDY()-fgkSSDConnectorPosition[1],
1319                           ssdstiffenerboxshapes[0]->GetDZ()+fgkSSDConnectorHeight
1320                    +  0.5*fgkSSDCapacitor1812Height);
1321 ////////////////////////////
1322 //Hybrid Wire
1323 ////////////////////////////
1324   Double_t wirex = 2.*(fgkSSDConnectorPosition[0]-0.5*fgkSSDStiffenerLength
1325                                  - 0.5*fgkSSDConnectorLength)-fgkSSDConnectorLength
1326                                  - fgkSSDConnectorSeparation;
1327   Double_t wirey = ssdstiffenerseparation+fgkSSDStiffenerWidth
1328                                  - 2.*fgkSSDConnectorPosition[1]-fgkSSDConnectorWidth;
1329   Double_t ssdwireradius = TMath::Sqrt(TMath::Power(wirex,2.)
1330                                          + TMath::Power(wirey,2));
1331   Double_t wireangle = TMath::ATan(wirex/wirey);
1332   TGeoTube *hybridwireshape = new TGeoTube("HybridWireShape", 0., 
1333                                                 fgkSSDWireRadius, 0.5*ssdwireradius);
1334   TGeoVolume* hybridwire = new TGeoVolume("HybridWire",hybridwireshape,
1335                                              fSSDStiffenerHybridWireMedium); 
1336   hybridwire->SetLineColor(fColorPhynox);
1337   TGeoCombiTrans* hybridwirecombitrans[2];
1338   hybridwirecombitrans[0] = new TGeoCombiTrans("HybridWireCombiTrans1",
1339                    0.5*fgkSSDStiffenerLength-fgkSSDConnectorPosition[0]
1340                                  + 1.5*fgkSSDConnectorLength+fgkSSDConnectorSeparation,
1341                    0.5*ssdwireradius-0.5*fgkSSDStiffenerWidth
1342                                  + fgkSSDConnectorPosition[1]+0.5*fgkSSDConnectorWidth,
1343                                    ssdstiffenerboxshapes[0]->GetDZ()+fgkSSDConnectorHeight
1344                                  + fgkSSDWireRadius,
1345                    new TGeoRotation("HybridWireRot1",0.,90.,0.));
1346   hybridwirecombitrans[1] = new TGeoCombiTrans("HybridWireCombiTrans2",
1347                                    0.,
1348                                  - 0.5*fgkSSDConnectorWidth+fgkSSDWireRadius,
1349                                    0.,  
1350                    new TGeoRotation("HybridWireRot2",
1351                                  -                  wireangle*TMath::RadToDeg(),0.,0.));
1352   TGeoHMatrix* hybridwirematrix = new TGeoHMatrix();
1353   hybridwirematrix->MultiplyLeft(hybridwirecombitrans[0]);
1354   hybridwirematrix->MultiplyLeft(hybridwirecombitrans[1]);
1355 ////////////////////////////
1356 // Stiffener Assembly
1357 ///////////////////////////
1358   TGeoVolume* ssdstiffenerassembly = 
1359                                                                 new TGeoVolumeAssembly("SSDStiffenerAssembly");
1360   ssdstiffenerassembly->AddNode(hybridwire,1,hybridwirematrix);
1361   for(Int_t i=0; i<kssdstiffenernumber; i++) {
1362         ssdstiffenerassembly->AddNode(ssdstiffener,i+1,ssdstiffenercombitrans[i]);
1363         for(Int_t j=1; j<knapacitor0603number+1; j++){
1364     ssdstiffenerassembly->AddNode(capacitor0603,knapacitor0603number*i+j,new TGeoTranslation("",(j-3.
1365         )/6*fgkSSDStiffenerLength,
1366                                         i*ssdstiffenerseparation+
1367                                         0.5*((i==0? 1:-1)*fgkSSDStiffenerWidth
1368                                         +(i==0? -1:+1)*fgkSSDCapacitor0603Width),
1369                                         -0.5*(fgkSSDStiffenerHeight+fgkSSDCapacitor0603Height)));
1370         }
1371         if(i==1) ssdstiffenerassembly->AddNode(capacitor1812,1,capacitor1812trans);
1372 }
1373   return ssdstiffenerassembly;
1374 }
1375 /////////////////////////////////////////////////////////////////////////////////
1376 TGeoVolume* AliITSv11GeometrySSD::GetSSDChipCables(Double_t SSDChipCablesHeigth, 
1377                                                                                                                                         char* side){
1378   /////////////////////////////////////////////////////////////
1379   // Method generating SSD Chip Cables    
1380   /////////////////////////////////////////////////////////////
1381   const Int_t kssdchipcableslaynumber = 2;
1382   Int_t ssdchipcablescolor[2] = {fColorAl,fColorPolyhamide};
1383   Double_t ssdchipcablesradius[2];
1384   ssdchipcablesradius[0] = 0.25*(SSDChipCablesHeigth
1385                                                  -  fgkSSDChipCablesHeight[0]
1386                                                  -  fgkSSDChipCablesHeight[1]);
1387   ssdchipcablesradius[1] = ssdchipcablesradius[0]-fgkSSDChipCablesHeight[0];
1388   Double_t ssdchipcablespiecelength = 0.5*(fgkSSDChipCablesWidth[0]
1389                                                                     - 2.*TMath::Pi()*ssdchipcablesradius[0]
1390                                                                         - ssdchipcablesradius[0]
1391                                                                         - fgkSSDChipCablesWidth[1]
1392                                                                         - fgkSSDChipCablesWidth[2]
1393                                                                         - (side=="Right" ? 0 : 
1394                                                                           fgkSSDModuleStiffenerPosition[1]
1395                                                                         + TMath::Pi()*(0.5*fgkSSDSensorHeight
1396                                                                         + fgkSSDChipCablesHeight[0]
1397                                                                         + fgkSSDChipCablesHeight[1])));
1398   //////////////////////////
1399   //Box and Tube Seg Shapes
1400   //////////////////////////
1401   char* ssdchipcablesboxshapename[2*kssdchipcableslaynumber] = 
1402                                           {"SSDChipCablesBoxLay0Shape0","SSDChipCablesBoxLay0Shape1",
1403                                            "SSDChipCablesBoxLay1Shape0","SSDChipCablesBoxLay1Shape1"};
1404   char* ssdchipcablestubesegshapename[2*kssdchipcableslaynumber] = 
1405                           {"SSDChipCablesTubeSegLay0Shape0","SSDChipCablesTubeSegLay0Shape1",
1406                            "SSDChipCablesTubeSegLay1Shape0","SSDChipCablesTubeSegLay1Shape1"};
1407   TGeoBBox** ssdchipcablesboxshape[kssdchipcableslaynumber];
1408   TGeoTubeSeg** ssdchipcablestubesegshape[kssdchipcableslaynumber];
1409   for(Int_t i=0; i<kssdchipcableslaynumber; i++){
1410     ssdchipcablesboxshape[i]        = new TGeoBBox*[2];
1411     ssdchipcablestubesegshape[i]    = new TGeoTubeSeg*[2+(side=="Right" ? 0 : 1)];
1412     ssdchipcablesboxshape[i][0]     = new TGeoBBox(ssdchipcablesboxshapename[2*i],
1413                                                                                                    0.5*ssdchipcablespiecelength,
1414                                                                                                    0.5*fgkSSDChipCablesLength[1],
1415                                                                                                    0.5*fgkSSDChipCablesHeight[i]);
1416     ssdchipcablesboxshape[i][1]     = new TGeoBBox(ssdchipcablesboxshapename[2*i+1],
1417                                                    0.5*(ssdchipcablespiecelength+ssdchipcablesradius[0]
1418                                          + (side=="Right" ? 0. : fgkSSDModuleStiffenerPosition[1])),            
1419                                     0.5*fgkSSDChipCablesLength[1],0.5*fgkSSDChipCablesHeight[i]);
1420     ssdchipcablestubesegshape[i][0] = 
1421                                            new TGeoTubeSeg(ssdchipcablestubesegshapename[2*i],                                          
1422                                                    ssdchipcablesradius[1]-i*fgkSSDChipCablesHeight[1],
1423                                                    ssdchipcablesradius[i],0.5*fgkSSDChipCablesLength[1],
1424                                                    0.,180.);
1425     ssdchipcablestubesegshape[i][1] = 
1426                                            new TGeoTubeSeg(ssdchipcablestubesegshapename[2*i+1],
1427                                                  ssdchipcablesradius[0]+i*fgkSSDChipCablesHeight[0],
1428                                                          ssdchipcablesradius[0]+fgkSSDChipCablesHeight[0]
1429                                          +               i*fgkSSDChipCablesHeight[1],
1430                                                          0.5*fgkSSDChipCablesLength[1],0.,180.);
1431     if(side!="Right") ssdchipcablestubesegshape[i][2] = 
1432                                          new TGeoTubeSeg(ssdchipcablestubesegshapename[2*i],
1433                                                  0.5*fgkSSDSensorHeight+(1-i)*fgkSSDChipCablesHeight[1],
1434                                                  0.5*fgkSSDSensorHeight+(1-i)*fgkSSDChipCablesHeight[0]
1435                                          +   fgkSSDChipCablesHeight[1],
1436                                                  0.5*fgkSSDChipCablesLength[1],0.,180.);
1437   }
1438   //////////////////////////
1439   //Box under Chip
1440   //////////////////////////
1441   char ssdunderchipcablesboxshapename[30];
1442   char ssdunderchipcablesboxname[30];   
1443   char ssdunderchipcablesboxtransname[30];      
1444   TGeoBBox* ssdunderchipcablesboxshape[kssdchipcableslaynumber];
1445   TGeoVolume* ssdunderchipcablesbox[kssdchipcableslaynumber]; 
1446   TGeoTranslation* ssdunderchipcablesboxtrans[kssdchipcableslaynumber];
1447   for(Int_t i=0; i<kssdchipcableslaynumber; i++){ 
1448                 sprintf(ssdunderchipcablesboxshapename,"SSDUnderChipCablesBoxShape%i",i+1);
1449                 sprintf(ssdunderchipcablesboxname,"SSDUnderChipCablesBox%i",i+1);
1450                 sprintf(ssdunderchipcablesboxtransname,"SSDUnderChipCablesBoxTrans%i",i+1);
1451                 ssdunderchipcablesboxshape[i] = 
1452                                                                    new TGeoBBox(ssdunderchipcablesboxshapename,
1453                                                                    0.5*fgkSSDChipWidth,
1454                                                                    0.5*fgkSSDChipCablesLength[1],
1455                                                                    0.5*fgkSSDChipCablesHeight[i]);
1456                 ssdunderchipcablesbox[i] = new TGeoVolume(ssdunderchipcablesboxname,
1457                                                                         ssdunderchipcablesboxshape[i],
1458                                                                         (i==0?fSSDAlTraceChipCableMedium:fSSDKaptonChipCableMedium));           
1459         ssdunderchipcablesbox[i]->SetLineColor(ssdchipcablescolor[i]);
1460                 ssdunderchipcablesboxtrans[i] = 
1461                                                 new TGeoTranslation(ssdunderchipcablesboxtransname,
1462                                                 (side=="Right"?-1.:1.)*0.5*fgkSSDChipWidth,
1463                                                 0.5*(fgkSSDChipCablesLength[0]-fgkSSDChipCablesLength[1])
1464                                                 +0.5*fgkSSDChipCablesLength[1],
1465                                                 (i==0?1.:-1.)*0.5*fgkSSDChipCablesHeight[1-i]);
1466   }
1467   //////////////////
1468   //Trapezoid Shapes
1469   //////////////////
1470   const Int_t kssdchipcablesvertexnumber = 2;
1471   const Int_t kssdchipcablestrapezoidnumber = 2;
1472   TVector3** ssdchipcablestrapezoidvertex[kssdchipcablesvertexnumber];
1473   for(Int_t i = 0; i< kssdchipcablestrapezoidnumber; i++) 
1474          ssdchipcablestrapezoidvertex[i] = new TVector3*[kssdchipcablesvertexnumber];
1475   //First Shape Vertex Positioning
1476   ssdchipcablestrapezoidvertex[0][0] = new TVector3();
1477   ssdchipcablestrapezoidvertex[0][1] = 
1478                 new TVector3(0.5*(fgkSSDChipCablesLength[0]-fgkSSDChipCablesLength[1]));
1479   //Second Shape Vertex Positioning
1480   ssdchipcablestrapezoidvertex[1][0] = 
1481                                                           new TVector3(*ssdchipcablestrapezoidvertex[0][0]);
1482   ssdchipcablestrapezoidvertex[1][1] = 
1483                                                           new TVector3(*ssdchipcablestrapezoidvertex[0][1]);
1484   //Setting the names of shapes and volumes
1485   char* ssdchipcablestrapezoidboxshapename[kssdchipcablestrapezoidnumber] = 
1486                   {"SSDChipCablesTrapezoidBoxShape1","SSDChipCablesTrapezoidBoxShape2"};
1487   char* ssdchipcablestrapezoidshapename[kssdchipcablestrapezoidnumber] = 
1488                   {"SSDChipCablesTrapezoidShape1","SSDChipCablesTrapezoidShape2"};
1489   char* ssdchipcablestrapezoidboxname[kssdchipcablestrapezoidnumber] = 
1490                   {"SSDChipCablesTrapezoidBox1","SSDChipCablesTrapezoidBox2"};
1491   char* ssdhipcablestrapezoidname[kssdchipcablestrapezoidnumber] = 
1492                   {"SSDChipCablesTrapezoid1","SSDChipCablesTrapezoid2"};
1493   char* ssdchipcablestrapezoidassemblyname[kssdchipcablestrapezoidnumber] = 
1494                   {"SSDChipCablesTrapezoidAssembly1","SSDChipCablesTrapezoidAssembly2"};
1495   //Setting the Shapes
1496   TGeoBBox* ssdchipcablestrapezoidboxshape[kssdchipcablestrapezoidnumber]; 
1497   TGeoArb8* ssdchipcablestrapezoidshape[kssdchipcablestrapezoidnumber];
1498   //Setting the Volumes
1499   TGeoVolume* ssdchipcablestrapezoidbox[kssdchipcablestrapezoidnumber];
1500   TGeoVolume* ssdchipcablestrapezoid[kssdchipcablestrapezoidnumber];
1501   TGeoVolume* ssdchipcablestrapezoidassembly[kssdchipcablestrapezoidnumber]; 
1502   Double_t ssdchipcablestrapezoidwidth[kssdchipcablesvertexnumber] = 
1503    {fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2],fgkSSDChipCablesWidth[1]};
1504   for(Int_t i=0; i<kssdchipcablestrapezoidnumber; i++){
1505     ssdchipcablestrapezoidboxshape[i] = 
1506                                         new TGeoBBox(ssdchipcablestrapezoidboxshapename[i],
1507                                                 0.5*fgkSSDChipCablesLength[1],
1508                                             0.5*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2]),
1509                                                 0.5*fgkSSDChipCablesHeight[i]);
1510     ssdchipcablestrapezoidshape[i] = 
1511                                                           GetTrapezoidShape(ssdchipcablestrapezoidvertex[i],
1512                                                           ssdchipcablestrapezoidwidth,
1513                                                           fgkSSDChipCablesHeight[i],
1514                                                           ssdchipcablestrapezoidshapename[i]);
1515     ssdchipcablestrapezoidbox[i] = 
1516                                                 new TGeoVolume(ssdchipcablestrapezoidboxname[i],
1517                                                                            ssdchipcablestrapezoidboxshape[i],
1518                                                                            (i==0?fSSDAlTraceChipCableMedium:fSSDKaptonChipCableMedium));
1519     ssdchipcablestrapezoid[i] = new TGeoVolume(ssdhipcablestrapezoidname[i],
1520                                                                                            ssdchipcablestrapezoidshape[i],
1521                                                                                            (i==0?fSSDAlTraceChipCableMedium:fSSDKaptonChipCableMedium));
1522     ssdchipcablestrapezoidbox[i]->SetLineColor(ssdchipcablescolor[i]);
1523     ssdchipcablestrapezoid[i]->SetLineColor(ssdchipcablescolor[i]);
1524     ssdchipcablestrapezoidassembly[i] = 
1525                                 new TGeoVolumeAssembly(ssdchipcablestrapezoidassemblyname[i]);
1526     ssdchipcablestrapezoidassembly[i]->AddNode(ssdchipcablestrapezoidbox[i],1,
1527                                 new TGeoTranslation(0.5*fgkSSDChipCablesLength[1],
1528                                    0.5*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2]),0.));
1529     ssdchipcablestrapezoidassembly[i]->AddNode(ssdchipcablestrapezoid[i],0,
1530                         new TGeoCombiTrans(0.,0.,0.,new TGeoRotation("",90.,180.,-90.)));
1531     ssdchipcablestrapezoidassembly[i]->AddNode(ssdchipcablestrapezoid[i],1,
1532                         new TGeoTranslation(fgkSSDChipCablesLength[1],0.,0.));
1533   }
1534   /////////////////////////////
1535   //Box and Tube Seg CombiTrans
1536   /////////////////////////////
1537   TGeoTranslation* ssdchipcablesboxtrans[2*kssdchipcableslaynumber];
1538   ssdchipcablesboxtrans[0] = 
1539                                         new TGeoTranslation("SSDChipCablesLay1Box1Trans",0.,0.,0.);
1540   ssdchipcablesboxtrans[1] = 
1541                                         new TGeoTranslation("SSDChipCablesLay1Box2Trans",
1542                                                                                  ssdchipcablesboxshape[0][1]->GetDX()
1543                                                    -             0.5*ssdchipcablespiecelength,
1544                        0.0,
1545                                                    -             2.*ssdchipcablesradius[0]
1546                                                    -             fgkSSDChipCablesHeight[0]);
1547   ssdchipcablesboxtrans[2] = new TGeoTranslation("SSDChipCablesLay2Box1Trans",
1548                                                                                  0.0,
1549                                                                                  0.0,
1550                                                                                  0.5*(fgkSSDChipCablesHeight[0]
1551                                                    +                     fgkSSDChipCablesHeight[1]));
1552   ssdchipcablesboxtrans[3] = 
1553                                                          new TGeoTranslation("SSDChipCablesLay2Box2Trans",
1554                                                                                  ssdchipcablesboxshape[1][1]->GetDX()
1555                                                    -                     0.5*ssdchipcablespiecelength,
1556                                                                                  0.0,
1557                                                    -                     2.*ssdchipcablesradius[0]
1558                                                    -                     0.5*fgkSSDChipCablesHeight[1]
1559                                                    -                     1.5*fgkSSDChipCablesHeight[0]);
1560   TGeoRotation* ssdchipcablesrot[3];
1561   ssdchipcablesrot[0] = new TGeoRotation("SSDChipCablesRot1",0.,90.,0.);
1562   ssdchipcablesrot[1] = new TGeoRotation("SSDChipCablesRot2",90.,90.,-90.);
1563   ssdchipcablesrot[2] = new TGeoRotation("SSDChipCablesRot3",90.,-90.,-90.);
1564   TGeoCombiTrans* ssdchipcablestubesegcombitrans[2*(kssdchipcableslaynumber+1)];    
1565 //  TGeoCombiTrans* SSDChipCablesTubeSegCombiTrans[2*(SSDChipCablesLayNumber+
1566 //                                                                                                        (side=="Right" ? 0 : 1))];
1567   ssdchipcablestubesegcombitrans[0] = 
1568                                 new TGeoCombiTrans("SSDChipCablesLay1TubeSeg1CombiTrans",
1569                                 0.5*ssdchipcablespiecelength,
1570                                 0.0,
1571                                 ssdchipcablesradius[0]
1572                         -   0.5*fgkSSDChipCablesHeight[0],
1573                                 new TGeoRotation((*ssdchipcablesrot[1])*(*ssdchipcablesrot[0])));
1574   ssdchipcablestubesegcombitrans[1] = 
1575                                 new TGeoCombiTrans("SSDChipCablesLay1TubeSeg2CombiTrans",
1576                         -   0.5*ssdchipcablespiecelength,
1577                                 0.0,
1578                         -   ssdchipcablesradius[0]-0.5*fgkSSDChipCablesHeight[0],
1579                                 new TGeoRotation((*ssdchipcablesrot[2])*(*ssdchipcablesrot[0])));
1580   ssdchipcablestubesegcombitrans[2] = 
1581   new TGeoCombiTrans("SSDChipCablesLay2TubeSeg1CombiTrans",
1582                                 0.5*ssdchipcablespiecelength,
1583                                 0.0,
1584                                 ssdchipcablesradius[0]-0.5*fgkSSDChipCablesHeight[0],
1585                                 new TGeoRotation((*ssdchipcablesrot[1])*(*ssdchipcablesrot[0])));
1586   ssdchipcablestubesegcombitrans[3] = 
1587                                 new TGeoCombiTrans("SSDChipCablesLay2TubeSeg2CombiTrans",
1588                         -       0.5*ssdchipcablespiecelength,
1589                                 0.0,
1590                         -       ssdchipcablesradius[0]+0.5*fgkSSDChipCablesHeight[0]
1591                         -   fgkSSDChipCablesHeight[0],
1592                                 new TGeoRotation((*ssdchipcablesrot[2])*(*ssdchipcablesrot[0])));
1593   ssdchipcablestubesegcombitrans[4] = 
1594                                 new TGeoCombiTrans("SSDChipCablesLay1TubeSeg4CombiTrans",
1595                                 0.5*ssdchipcablespiecelength+ssdchipcablesradius[0]
1596                         +   fgkSSDModuleStiffenerPosition[1],
1597                                 0.0,
1598                         -       2.*ssdchipcablesradius[0]-0.5*fgkSSDChipCablesHeight[0]
1599                         -   (0.5*fgkSSDSensorHeight+fgkSSDChipCablesHeight[0]
1600                         +       fgkSSDChipCablesHeight[1]),
1601                         new TGeoRotation((*ssdchipcablesrot[1])*(*ssdchipcablesrot[0])));
1602   ssdchipcablestubesegcombitrans[5] = 
1603                         new TGeoCombiTrans("SSDChipCablesLay2TubeSeg5CombiTrans",
1604                                 0.5*ssdchipcablespiecelength+ssdchipcablesradius[0]
1605                         +       fgkSSDModuleStiffenerPosition[1],
1606                                 0.0,
1607                         -       2.*ssdchipcablesradius[0]-0.5*fgkSSDChipCablesHeight[0]
1608                         -       (0.5*fgkSSDSensorHeight+fgkSSDChipCablesHeight[0]
1609                         +       fgkSSDChipCablesHeight[1]),
1610                         new TGeoRotation((*ssdchipcablesrot[1])*(*ssdchipcablesrot[0])));
1611   TGeoCombiTrans* ssdchipcablestrapezoidcombitrans[kssdchipcableslaynumber];
1612   ssdchipcablestrapezoidcombitrans[0] = (side=="Right" ? 
1613                         new TGeoCombiTrans("SSDChipCableLay1TrapezoidRightCombiTrans",
1614                                 0.5*ssdchipcablespiecelength+ssdchipcablestrapezoidwidth[0]
1615                         +       ssdchipcablesradius[0],
1616                         -       0.5*fgkSSDChipCablesLength[1],
1617                         -       fgkSSDChipCablesHeight[0]-2.*ssdchipcablesradius[0],
1618                         new TGeoRotation("",90.,0.,0.)) :
1619                         new TGeoCombiTrans("SSDChipCableLay1TrapezoidLeftCombiTrans",
1620                         -       2.*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2])
1621                         +       0.5*ssdchipcablespiecelength+ssdchipcablestrapezoidwidth[0]
1622                         +       ssdchipcablesradius[0]+fgkSSDModuleStiffenerPosition[1],
1623                                 0.5*fgkSSDChipCablesLength[1],
1624                         -       2.*(fgkSSDChipCablesHeight[0]+fgkSSDChipCablesHeight[1])
1625                         -       2.*ssdchipcablesradius[0]-fgkSSDSensorHeight,
1626                         new TGeoRotation("",-90.,0.,0.)));
1627   ssdchipcablestrapezoidcombitrans[1] = (side=="Right" ? 
1628                         new TGeoCombiTrans("SSDChipCableLay2TrapezoidRightCombiTrans",
1629                                 0.5*ssdchipcablespiecelength+ssdchipcablestrapezoidwidth[0]
1630                         +       ssdchipcablesradius[0],
1631                         -       0.5*fgkSSDChipCablesLength[1],
1632                         -       0.5*(fgkSSDChipCablesHeight[0]+fgkSSDChipCablesHeight[1])
1633                         -       fgkSSDChipCablesHeight[0]-2.*ssdchipcablesradius[0],
1634                                 new TGeoRotation("",90.,0.,0.)) :
1635                                 new TGeoCombiTrans("SSDChipCableLay2TrapezoidLeftCombiTrans",
1636                         -       2.*(fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2])
1637                         +       0.5*ssdchipcablespiecelength+ssdchipcablestrapezoidwidth[0]
1638                         +       ssdchipcablesradius[0]+fgkSSDModuleStiffenerPosition[1],
1639                                 0.5*fgkSSDChipCablesLength[1],-0.5*(fgkSSDChipCablesHeight[0]
1640                         +       fgkSSDChipCablesHeight[1])-fgkSSDChipCablesHeight[1]
1641                         -       fgkSSDChipCablesHeight[0]-2.*ssdchipcablesradius[0]
1642                         -       fgkSSDSensorHeight,new TGeoRotation("",-90.,0.,0.)));  
1643   //////////////////////////
1644   //Box and Tube Seg Volumes
1645   //////////////////////////
1646   char* ssdchipcablesboxname[2*kssdchipcableslaynumber] = 
1647                                                          {"SSDChipCablesLay1Box1","SSDChipCablesLay1Box2",
1648                                                           "SSDChipCablesLay2Box1","SSDChipCablesLay2Box2"};
1649   char* ssdchiprightcablestubesegname[2*kssdchipcableslaynumber] = 
1650                           {"SSDChipRightCablesLay1TubeSeg1","SSDChipRightCablesLay1TubeSeg2",
1651                            "SSDChipRightCablesLay2TubeSeg1","SSDChipRightCablesLay2TubeSeg2"};
1652   char* ssdchipLeftcablestubesegname[2*kssdchipcableslaynumber] = 
1653                           {"SSDChipLeftCablesLay1TubeSeg1","SSDChipLeftCablesLay1TubeSeg2",
1654                            "SSDChipLeftCablesLay2TubeSeg1","SSDChipLeftCablesLay2TubeSeg2"};
1655   char* ssdchipcableslayassemblyname[kssdchipcableslaynumber] = 
1656                           {"SSDChipCablesLay1","SSDChipCablesLay2"};
1657   TGeoVolume** ssdchipcablesbox[kssdchipcableslaynumber];
1658   TGeoVolume** ssdchipcablestubeseg[kssdchipcableslaynumber];
1659   TGeoVolume* ssdchipcableslayassembly[kssdchipcableslaynumber];
1660   for(Int_t i=0; i<kssdchipcableslaynumber; i++){
1661     TGeoMedium* ssdchipcableslaymed = 
1662             (i==0?fSSDAlTraceChipCableMedium:fSSDKaptonChipCableMedium);
1663     ssdchipcablesbox[i] = new TGeoVolume*[2];
1664     ssdchipcablestubeseg[i] = new TGeoVolume*[2+(side=="Right" ? 0 : 1)];
1665     ssdchipcablesbox[i][0] = new TGeoVolume(ssdchipcablesboxname[2*i],
1666                                            ssdchipcablesboxshape[i][0],ssdchipcableslaymed);
1667     ssdchipcablesbox[i][1] = new TGeoVolume(ssdchipcablesboxname[2*i+1],
1668                                            ssdchipcablesboxshape[i][1],ssdchipcableslaymed);
1669     ssdchipcablestubeseg[i][0] = new TGeoVolume(ssdchiprightcablestubesegname[2*i],
1670                                            ssdchipcablestubesegshape[i][0],ssdchipcableslaymed);
1671     ssdchipcablestubeseg[i][1] = new TGeoVolume(ssdchiprightcablestubesegname[2*i+1],
1672                                            ssdchipcablestubesegshape[i][1],ssdchipcableslaymed);
1673     ssdchipcablesbox[i][0]->SetLineColor(ssdchipcablescolor[i]);
1674     ssdchipcablesbox[i][1]->SetLineColor(ssdchipcablescolor[i]);
1675     ssdchipcablestubeseg[i][0]->SetLineColor(ssdchipcablescolor[i]);
1676     ssdchipcablestubeseg[i][1]->SetLineColor(ssdchipcablescolor[i]);
1677     ssdchipcableslayassembly[i] = new TGeoVolumeAssembly(ssdchipcableslayassemblyname[i]);
1678     ssdchipcableslayassembly[i]->AddNode(ssdchipcablesbox[i][0],1,
1679                                                                                  ssdchipcablesboxtrans[2*i]);
1680     ssdchipcableslayassembly[i]->AddNode(ssdchipcablesbox[i][1],1,
1681                                                                                  ssdchipcablesboxtrans[2*i+1]);
1682     ssdchipcableslayassembly[i]->AddNode(ssdchipcablestubeseg[i][0],1,
1683                                                                                  ssdchipcablestubesegcombitrans[2*i]);
1684     ssdchipcableslayassembly[i]->AddNode(ssdchipcablestubeseg[i][1],1,
1685                                                                                  ssdchipcablestubesegcombitrans[2*i+1]);
1686     if(side!="Right"){
1687       ssdchipcablestubeseg[i][2] = new TGeoVolume(ssdchipLeftcablestubesegname[2*i],
1688                                                                                                   ssdchipcablestubesegshape[i][2],
1689                                                                                                   ssdchipcableslaymed);
1690       ssdchipcablestubeseg[i][2]->SetLineColor(ssdchipcablescolor[i]);
1691       ssdchipcableslayassembly[i]->AddNode(ssdchipcablestubeseg[i][2],1,
1692                                                                                    ssdchipcablestubesegcombitrans[4+i]);
1693     }
1694     ssdchipcableslayassembly[i]->AddNode(ssdchipcablestrapezoidassembly[i],1,
1695                                                                                  ssdchipcablestrapezoidcombitrans[i]);
1696   }
1697   TGeoCombiTrans* ssdchipcablescombitrans[kssdchipcableslaynumber];
1698   ssdchipcablescombitrans[0] = new TGeoCombiTrans("SSDChipCablesCombiTrans1",
1699                                            (side=="Right" ? -1 : 1)*0.5*ssdchipcablespiecelength,
1700                                                 0.5*fgkSSDChipCablesLength[0],
1701                                         -       (2.*ssdchipcablesradius[0]-fgkSSDChipCablesHeight[0]
1702                                         -       0.5*fgkSSDChipCablesHeight[1]),
1703                                                 new TGeoRotation("",(side=="Right" ? 0 : 1)*180.,0.,0.));
1704   ssdchipcablescombitrans[1] = new TGeoCombiTrans("SSDChipCablesCombiTrans2",
1705                                                 (side=="Right" ? -1 : 1)*0.5*ssdchipcablespiecelength,
1706                                                 0.5*fgkSSDChipCablesLength[0],
1707                                         -       (2.*ssdchipcablesradius[0]-fgkSSDChipCablesHeight[0]
1708                                         -       0.5*fgkSSDChipCablesHeight[1]),
1709                                                 new TGeoRotation("",(side=="Right" ? 0 : 1)*180.,0.,0.));
1710   TGeoVolume* ssdchipcablesassembly = 
1711                                                 new TGeoVolumeAssembly("SSDChipCables");
1712   for(Int_t i=0; i<kssdchipcableslaynumber; i++){ 
1713                 ssdchipcablesassembly->AddNode(ssdchipcableslayassembly[i],1,
1714                                                                                                         ssdchipcablescombitrans[i]);
1715                 ssdchipcablesassembly->AddNode(ssdunderchipcablesbox[i],1,ssdunderchipcablesboxtrans[i]);
1716   }
1717   return ssdchipcablesassembly;
1718 }
1719 /////////////////////////////////////////////////////////////////////////////////
1720 TGeoVolume* AliITSv11GeometrySSD::GetSSDChipCablesAssembly(Double_t SSDChipCablesHeigth){
1721   /////////////////////////////////////////////////////////////
1722   // Method generating SSD Chip Cables Assembly    
1723   /////////////////////////////////////////////////////////////
1724   const Int_t kchipcablesnumber = 2;
1725   Double_t chipcablestransvector = fgkSSDSensorLength
1726                                                                  - 2.*fgkSSDModuleStiffenerPosition[1]
1727                                                                  - 2.*(fgkSSDStiffenerWidth
1728                                                                  - fgkSSDStiffenerToChipDist-fgkSSDChipWidth);
1729   char* ssdchipcablesname[kchipcablesnumber] = {"Right","Left"};
1730   TGeoVolume* ssdchipcables[kchipcablesnumber];  
1731   TGeoVolume* ssdchipcablesassembly = 
1732                                          new TGeoVolumeAssembly("SSDChipCablesAssembly");
1733   for(Int_t i=0; i<kchipcablesnumber; i++) ssdchipcables[i] = 
1734                                          GetSSDChipCables(SSDChipCablesHeigth,ssdchipcablesname[i]);
1735   for(Int_t i=0; i<kchipcablesnumber; i++)
1736     for(Int_t j=0; j<fgkSSDChipNumber; j++)
1737       ssdchipcablesassembly->AddNode(ssdchipcables[i],fgkSSDChipNumber*i+j+1,
1738                         new TGeoTranslation(-(ssdchipcablesname[i]=="Left" ? 1. : 0.)
1739                 *       chipcablestransvector,(j-0.5)*fgkSSDChipCablesLength[0]
1740                 +       0.5*fgkSSDChipCablesLength[1],0.));
1741   return ssdchipcablesassembly;
1742 }
1743 /////////////////////////////////////////////////////////////////////////////////
1744 TGeoVolume* AliITSv11GeometrySSD::GetSSDFlex(Double_t ssdflexradius, Double_t SSDFlexHeigth){
1745   /////////////////////////////////////////////////////////////
1746   // Method generating SSD Flex    
1747   /////////////////////////////////////////////////////////////
1748   const Int_t kssdflexvolumenumber = 3;
1749   TGeoVolume* ssdflexvolume[kssdflexvolumenumber];
1750   ////////////////////////
1751   // Setting Display Color
1752   ////////////////////////
1753   Int_t ssdflexcolor;
1754   ssdflexcolor = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fColorAl: fColorPolyhamide);
1755   TGeoMedium* ssdflexmed = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fSSDAlTraceFlexMedium :
1756                             fSSDKaptonFlexMedium);
1757   ////////////////////////
1758   // SSDFlexTrapezoidShape
1759   ////////////////////////
1760   const Int_t kssdflexvertexnumber = 2;
1761   Double_t ssdflexwidth[kssdflexvertexnumber] = {fgkSSDFlexWidth[1],
1762                                                                                                 fgkSSDFlexWidth[0]};
1763   TVector3* ssdflexvertex[kssdflexvertexnumber];
1764   ssdflexvertex[0] = new TVector3();
1765   ssdflexvertex[1] = new TVector3(fgkSSDFlexLength[0]-fgkSSDFlexLength[1]);
1766   TGeoArb8* ssdflextrapezoidshape = GetTrapezoidShape(ssdflexvertex,
1767                                                                                                           ssdflexwidth,SSDFlexHeigth,
1768                                                                                                           "SSDFlexTrapezoidShape");
1769   ssdflexvolume[0] = new TGeoVolume("SSDFlexTrapezoid",ssdflextrapezoidshape,ssdflexmed);
1770   ssdflexvolume[0]->SetLineColor(ssdflexcolor);
1771   /////////////////////////
1772   //SSDFlexTubeSeg Assembly
1773   /////////////////////////
1774   const Int_t kssdflextubesegnumber = 2;
1775   TGeoTubeSeg* ssdflextubesegshape[kssdflextubesegnumber];
1776   Double_t ssdflexradiusmax = (fgkSSDFlexLength[3]-fgkSSDFlexLength[2])
1777                                                         /  TMath::Tan(fgkSSDFlexAngle*TMath::DegToRad());
1778   ssdflextubesegshape[0] = new TGeoTubeSeg("SSDFlexTubeSegShape1",
1779                                                    ssdflexradius,ssdflexradius+SSDFlexHeigth,
1780                                                    0.5*fgkSSDFlexWidth[0],0.,180.);
1781   ssdflextubesegshape[1] = new TGeoTubeSeg("SSDFlexTubeSegShape2",
1782                                                    ssdflexradiusmax-ssdflexradius-SSDFlexHeigth,
1783                                                    ssdflexradiusmax-ssdflexradius,0.5*fgkSSDFlexWidth[0],
1784                                                    0.,2.*fgkSSDFlexAngle);
1785   TGeoRotation** ssdflextubsegrot[kssdflextubesegnumber];
1786   for(Int_t i = 0; i<kssdflextubesegnumber; i++) 
1787                                                                           ssdflextubsegrot[i] = new TGeoRotation*[2]; 
1788   ssdflextubsegrot[0][0] = new TGeoRotation("SSDFlexTubeSeg1Rot1", 0., 90.,  0.);
1789   ssdflextubsegrot[0][1] = new TGeoRotation("SSDFlexTubeSeg1Rot2",90., 90.,-90.);
1790   ssdflextubsegrot[1][0] = new TGeoRotation("SSDFlexTubeSeg2Rot1", 0.,-90.,  0.);
1791   ssdflextubsegrot[1][1] = new TGeoRotation("SSDFlexTubeSeg2Rot2",90., 90.,-90.);
1792   TGeoCombiTrans* ssdflextubesegcombitrans[kssdflextubesegnumber];
1793   ssdflextubesegcombitrans[0] = new TGeoCombiTrans("SSDFlexTubeSegCombiTrans1",
1794                                                                 fgkSSDFlexLength[0],0.5*fgkSSDFlexWidth[0],
1795                                                                 ssdflexradius+0.5*SSDFlexHeigth,
1796                                                                 new TGeoRotation((*ssdflextubsegrot[0][1])
1797                                                         *       (*ssdflextubsegrot[0][0])));
1798   ssdflextubesegcombitrans[1] = new TGeoCombiTrans("SSDFlexTubeSegCombiTrans2",
1799                                                                 fgkSSDFlexLength[0]-fgkSSDFlexLength[2],
1800                                                                 0.5*fgkSSDFlexWidth[0],
1801                                                                 ssdflexradiusmax+0.5*SSDFlexHeigth+ssdflexradius,
1802                                                                 new TGeoRotation((*ssdflextubsegrot[1][1])
1803                                                         *       (*ssdflextubsegrot[1][0])));
1804   ssdflexvolume[1] = new TGeoVolumeAssembly("SSDFlexTubeSegAssembly");
1805   TGeoVolume* ssdflextubeseg[kssdflextubesegnumber];
1806   char ssdflextubesegname[30];
1807   for(Int_t i=0; i<kssdflextubesegnumber; i++){ 
1808                 sprintf(ssdflextubesegname,"SSDFlexTubeSeg%i",i+1);
1809                 ssdflextubeseg[i] = new TGeoVolume(ssdflextubesegname,ssdflextubesegshape[i],
1810                                      ssdflexmed);
1811                 ssdflextubeseg[i]->SetLineColor(ssdflexcolor);
1812         ssdflexvolume[1]->AddNode(ssdflextubeseg[i],1,ssdflextubesegcombitrans[i]);
1813   }
1814   ///////////
1815   //Box Shape 
1816   ///////////
1817   const Int_t kssdflexboxnumber = 7;
1818   Double_t ssdflexboxlength[kssdflexboxnumber];
1819   ssdflexboxlength[0] = 0.5*(fgkSSDChipNumber
1820                                           *     fgkSSDChipLength+(fgkSSDChipNumber-1)
1821                                           *     fgkSSDChipSeparationLength
1822                                           - fgkSSDModuleSensorSupportDistance-fgkSSDFlexHoleLength)
1823                                           - (fgkSSDFlexLength[0]-fgkSSDFlexLength[1]);
1824   ssdflexboxlength[1] = fgkSSDModuleSensorSupportDistance+fgkSSDFlexHoleLength;
1825   ssdflexboxlength[2] = 0.5*(fgkSSDModuleSensorSupportDistance
1826                                           -     fgkSSDFlexHoleLength-fgkSSDFlexHoleWidth);      
1827   ssdflexboxlength[3] = fgkSSDFlexHoleWidth;    
1828   ssdflexboxlength[4] = fgkSSDFlexLength[1]-ssdflexboxlength[0]
1829                                           -     ssdflexboxlength[1];
1830   ssdflexboxlength[5] = fgkSSDFlexLength[2];    
1831   ssdflexboxlength[6] = fgkSSDFlexFullLength-2.*fgkSSDFlexAngle
1832                                           *     TMath::DegToRad()*ssdflexradiusmax
1833                                           - fgkSSDFlexLength[2]-TMath::Pi()
1834                                           *     fgkSSDStiffenerHeight-fgkSSDFlexLength[0];      
1835   Double_t ssdflexboxwidth[kssdflexboxnumber];
1836   ssdflexboxwidth[0] = fgkSSDFlexWidth[0];
1837   ssdflexboxwidth[1] = fgkSSDFlexWidth[0]-fgkSSDFlexHoleWidth;
1838   ssdflexboxwidth[2] = fgkSSDFlexHoleWidth;
1839   ssdflexboxwidth[3] = ssdflexboxwidth[2]-fgkSSDFlexHoleLength;
1840   ssdflexboxwidth[4] = fgkSSDFlexWidth[0];
1841   ssdflexboxwidth[5] = fgkSSDFlexWidth[0];
1842   ssdflexboxwidth[6] = fgkSSDFlexWidth[0];
1843   TGeoBBox* ssdflexboxshape[kssdflexboxnumber+1];
1844   for(Int_t i=0; i<kssdflexboxnumber+1; i++) ssdflexboxshape[i] = 
1845                                                 (i!= kssdflexboxnumber ? new TGeoBBox("SSDFlexBoxShape",
1846                                                                 0.5*ssdflexboxlength[i],
1847                                                                 0.5*ssdflexboxwidth[i],0.5*SSDFlexHeigth) : 
1848                                                                 ssdflexboxshape[2]);
1849   //////////////////////////////
1850   //SSDFlex Box Shape CombiTrans 
1851   //////////////////////////////
1852   TGeoCombiTrans* ssdflexboxcombitrans[kssdflexboxnumber+1];
1853   ssdflexboxcombitrans[0] = new TGeoCombiTrans("SSDFlexBoxCombiTrans0",
1854                                                                 ssdflexvertex[1]->X()+0.5*ssdflexboxlength[0],
1855                                                                 0.5*fgkSSDFlexWidth[0],0.,0);
1856   ssdflexboxcombitrans[1] = new TGeoCombiTrans("SSDFlexBoxCombiTrans1",
1857                                                                 ssdflexvertex[1]->X()+ssdflexboxlength[0]
1858                                                         +       0.5*ssdflexboxlength[1],
1859                                                                 fgkSSDFlexHoleWidth+0.5*ssdflexboxwidth[1],0.,0);
1860   ssdflexboxcombitrans[2] = new TGeoCombiTrans("SSDFlexBoxCombiTrans2",
1861                                                                 ssdflexvertex[1]->X()+ssdflexboxlength[0]
1862                                                         +       fgkSSDFlexHoleLength+0.5*ssdflexboxlength[2],
1863                                                                 0.5*ssdflexboxwidth[2],0.,0);
1864   ssdflexboxcombitrans[3] = new TGeoCombiTrans("SSDFlexBoxCombiTrans3",
1865                                                                 ssdflexvertex[1]->X()+ssdflexboxlength[0]
1866                                                         +       fgkSSDFlexHoleLength+ssdflexboxlength[2]
1867                                                         +       0.5*fgkSSDFlexHoleWidth,
1868                                                                 fgkSSDFlexHoleLength+0.5*ssdflexboxwidth[3],0.,0);
1869   ssdflexboxcombitrans[4] = new TGeoCombiTrans("SSDFlexBoxCombiTrans4",
1870                                                                 ssdflexvertex[1]->X()+ssdflexboxlength[0]
1871                                                         +       ssdflexboxlength[1]+0.5*ssdflexboxlength[4],
1872                                                                 0.5*fgkSSDFlexWidth[0],0.,0);
1873   ssdflexboxcombitrans[5] = new TGeoCombiTrans("SSDFlexBoxCombiTrans5",
1874                                                         -       0.5*fgkSSDFlexLength[2]+fgkSSDFlexLength[0],
1875                                                                 0.5*fgkSSDFlexWidth[0],
1876                                                                 2.*ssdflexradius+SSDFlexHeigth,0);
1877   ssdflexboxcombitrans[6] = new TGeoCombiTrans("SSDFlexBoxCombiTrans6",
1878                                                         -       ssdflexboxshape[6]->GetDX()
1879                                                         +       ssdflexboxshape[6]->GetDX()
1880                                                         *       TMath::Cos(2.*fgkSSDFlexAngle*TMath::DegToRad())
1881                                                         +       fgkSSDFlexLength[0]-fgkSSDFlexLength[2]
1882                                                         -       (ssdflexradiusmax-ssdflexradius-0.5*SSDFlexHeigth)
1883                                                         *       TMath::Cos(fgkSSDFlexAngle*TMath::DegToRad()),
1884                                                                 0.5*fgkSSDFlexWidth[0],ssdflexboxshape[6]->GetDX()
1885                                                                 *TMath::Sin(2.*fgkSSDFlexAngle*TMath::DegToRad())
1886                                                         +       SSDFlexHeigth+2.*ssdflexradius+(ssdflexradiusmax
1887                                                         -       ssdflexradius-0.5*SSDFlexHeigth)
1888                                                         *       TMath::Sin(fgkSSDFlexAngle*TMath::DegToRad()),
1889                                                                 new TGeoRotation("",90.,2.*fgkSSDFlexAngle,-90.));
1890   ssdflexboxcombitrans[7] = new TGeoCombiTrans("SSDFlexBoxCombiTrans7",
1891                                                                 ssdflexvertex[1]->X()+ssdflexboxlength[0]
1892                                                         +       fgkSSDFlexHoleLength+1.5*ssdflexboxlength[2]
1893                                                         +       ssdflexboxlength[3],
1894                                                                 0.5*ssdflexboxwidth[2],0.,0);
1895   ////////////////////////////
1896   //SSDFlex Box Shape Assembly 
1897   ////////////////////////////
1898   ssdflexvolume[2] = new TGeoVolumeAssembly("SSDFlexBoxAssembly");
1899   TGeoVolume* ssdflexbox[kssdflexboxnumber+1];
1900   TGeoVolume* ssdendflex = GetSSDEndFlex(ssdflexboxlength[6],SSDFlexHeigth);
1901   TGeoHMatrix* ssdendflexhmatrix = new TGeoHMatrix();
1902   TGeoRotation* ssdendflexrot = new TGeoRotation("SSDEndFlexRot",180.,0.,0);
1903   ssdendflexhmatrix->MultiplyLeft(ssdendflexrot);
1904   ssdendflexhmatrix->MultiplyLeft(ssdflexboxcombitrans[6]);
1905   char ssdflexboxname[30];
1906   for(Int_t i=0; i<kssdflexboxnumber+1; i++){
1907         sprintf(ssdflexboxname,"SSDFlexBox%i",i!=kssdflexboxnumber?i+1:7);
1908         if(i==6){ssdflexvolume[2]->AddNode(ssdendflex,1,ssdendflexhmatrix);}
1909         else{
1910     ssdflexbox[i] = new TGeoVolume(ssdflexboxname,ssdflexboxshape[i],
1911                                    ssdflexmed);
1912         ssdflexbox[i]->SetLineColor(ssdflexcolor);
1913         ssdflexvolume[2]->AddNode(ssdflexbox[i],1,ssdflexboxcombitrans[i]);}
1914  }
1915   //////////////////////
1916   //SSDFlex Construction
1917   //////////////////////
1918   TGeoVolume* ssdflex = new TGeoVolumeAssembly("SSDFlex");
1919   for(Int_t i =0; i<kssdflexvolumenumber; i++) ssdflex->AddNode(ssdflexvolume[i],1);
1920   return ssdflex;
1921 }
1922 /////////////////////////////////////////////////////////////////////////////////
1923 TGeoVolume* AliITSv11GeometrySSD::GetSSDEndFlex(Double_t SSDEndFlexLength, 
1924                                                                                                                 Double_t SSDFlexHeigth){
1925   /////////////////////////////////////////////////////////////
1926   // Method generating SSD End Flex   
1927   /////////////////////////////////////////
1928   // Setting Display Color, Media and Index
1929   /////////////////////////////////////////
1930   Int_t ssdflexcolor;
1931   ssdflexcolor = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fColorAl: fColorPolyhamide);
1932   TGeoMedium* ssdflexmed = (SSDFlexHeigth == fgkSSDFlexHeight[0] ? fSSDAlTraceFlexMedium :
1933                             fSSDKaptonFlexMedium);
1934   ////////////////////////
1935   const Int_t kssdendflexboxnumber = 5;
1936   TGeoBBox* ssdendflexbboxshape[kssdendflexboxnumber];
1937   ssdendflexbboxshape[0] = new TGeoBBox("SSDFlexBoxShape1",
1938                                                                    0.5*SSDEndFlexLength,0.5*fgkSSDFlexWidth[0],
1939                                                                    0.5*SSDFlexHeigth);
1940   ssdendflexbboxshape[1] = new TGeoBBox("SSDFlexBoxShape2",
1941                                     0.5*fgkSSDEndFlexCompLength[1],
1942                                         0.5*(fgkSSDEndFlexCompWidth[0]-fgkSSDFlexWidth[0])/2,
1943                                         0.5*SSDFlexHeigth);
1944   ssdendflexbboxshape[2] = new TGeoBBox("SSDFlexBoxShape3",
1945                                     0.5*fgkSSDEndFlexCompLength[2],
1946                                         0.5*(fgkSSDEndFlexCompWidth[1]-fgkSSDFlexWidth[0])/2,
1947                                         0.5*SSDFlexHeigth);
1948   ssdendflexbboxshape[3] = new TGeoBBox("SSDFlexBoxShape4",
1949                                     0.5*fgkSSDEndFlexCompLength[3],
1950                                         0.5*(fgkSSDEndFlexCompWidth[0]-fgkSSDFlexWidth[0])/2,
1951                                         0.5*SSDFlexHeigth);
1952   ssdendflexbboxshape[4] = new TGeoBBox("SSDFlexBoxShape5",
1953                                     0.5*(fgkSSDEndFlexCompLength[4]+fgkSSDEndFlexCompLength[5]),
1954                                         0.25*(fgkSSDEndFlexCompWidth[2]-fgkSSDFlexWidth[0])/2,
1955                                         0.5*SSDFlexHeigth);
1956   TGeoVolume* ssdendflexbbox[kssdendflexboxnumber];  
1957   char ssdendflexbboxname[30];
1958   for(Int_t i=0; i<kssdendflexboxnumber; i++){
1959         sprintf(ssdendflexbboxname,"SSDEndFlexBBox%i",i+1);
1960         ssdendflexbbox[i] = new TGeoVolume(ssdendflexbboxname,
1961                      ssdendflexbboxshape[i],
1962                      ssdflexmed);
1963         ssdendflexbbox[i]->SetLineColor(ssdflexcolor);
1964   }
1965   TGeoVolume* ssdendflex = new TGeoVolumeAssembly("SSDEndFlex");
1966   Double_t partialsumlength = 0.;
1967   for(Int_t i=0; i<kssdendflexboxnumber+1; i++) partialsumlength += fgkSSDEndFlexCompLength[i];
1968   Double_t referencelength = SSDEndFlexLength-partialsumlength;
1969   ssdendflex->AddNode(ssdendflexbbox[0],1);
1970   ssdendflex->AddNode(ssdendflexbbox[1],1,new TGeoTranslation(
1971                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
1972                                         +  0.5*fgkSSDEndFlexCompLength[1],
1973                                            0.5*fgkSSDFlexWidth[0]+ssdendflexbboxshape[1]->GetDY(),
1974                                            0.));
1975   ssdendflex->AddNode(ssdendflexbbox[1],2,new TGeoTranslation(
1976                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
1977                                         +  0.5*fgkSSDEndFlexCompLength[1],
1978                                         -  0.5*fgkSSDFlexWidth[0]-ssdendflexbboxshape[1]->GetDY(),
1979                                            0.));
1980   ssdendflex->AddNode(ssdendflexbbox[2],1,new TGeoTranslation(
1981                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
1982                                         +  fgkSSDEndFlexCompLength[1]+0.5*fgkSSDEndFlexCompLength[2],
1983                                         +  0.5*fgkSSDFlexWidth[0]+ssdendflexbboxshape[2]->GetDY(),
1984                                            0.));
1985   ssdendflex->AddNode(ssdendflexbbox[2],2,new TGeoTranslation(
1986                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
1987                                         +  fgkSSDEndFlexCompLength[1]+0.5*fgkSSDEndFlexCompLength[2],
1988                                         -  0.5*fgkSSDFlexWidth[0]-ssdendflexbboxshape[2]->GetDY(),
1989                                            0.));
1990   ssdendflex->AddNode(ssdendflexbbox[3],1,new TGeoTranslation(
1991                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
1992                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
1993                                         +  0.5*fgkSSDEndFlexCompLength[3],
1994                                         +  0.5*fgkSSDFlexWidth[0]+ssdendflexbboxshape[3]->GetDY(),
1995                                            0.));
1996   ssdendflex->AddNode(ssdendflexbbox[3],2,new TGeoTranslation(
1997                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
1998                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
1999                                         +  0.5*fgkSSDEndFlexCompLength[3],
2000                                         -  0.5*fgkSSDFlexWidth[0]-ssdendflexbboxshape[3]->GetDY(),
2001                                            0.));
2002   ssdendflex->AddNode(ssdendflexbbox[4],1,new TGeoTranslation(
2003                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
2004                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
2005                                         +  fgkSSDEndFlexCompLength[3]+0.5*(fgkSSDEndFlexCompLength[4]+fgkSSDEndFlexCompLength[5]),
2006                                         +  0.5*fgkSSDFlexWidth[0]+ssdendflexbboxshape[4]->GetDY(),
2007                                            0.));
2008   ssdendflex->AddNode(ssdendflexbbox[4],2,new TGeoTranslation(
2009                                         -  0.5*SSDEndFlexLength+referencelength+fgkSSDEndFlexCompLength[0]
2010                                         +  fgkSSDEndFlexCompLength[1]+fgkSSDEndFlexCompLength[2]
2011                                         +  fgkSSDEndFlexCompLength[3]+0.5*(fgkSSDEndFlexCompLength[4]
2012                                         +  fgkSSDEndFlexCompLength[5]),
2013                                         -  0.5*fgkSSDFlexWidth[0]-ssdendflexbboxshape[4]->GetDY(),
2014                                            0.));
2015   return ssdendflex;
2016 }
2017 /////////////////////////////////////////////////////////////////////////////////
2018 TGeoVolume* AliITSv11GeometrySSD::GetSSDFlexAssembly(){
2019   /////////////////////////////////////////////////////////////
2020   // Method generating SSD Flex Assembly    
2021   /////////////////////////////////////////////////////////////
2022   TGeoVolume* ssdflexassembly = new TGeoVolumeAssembly("SSDFlexAssembly");
2023   const Int_t kssdflexlayernumber = 4;
2024   Double_t ssdflexheight[kssdflexlayernumber];
2025   Double_t ssdflexradius[kssdflexlayernumber];
2026   TGeoTranslation* ssdflextrans[kssdflexlayernumber];
2027   for(Int_t i=0; i<kssdflexlayernumber; i++){ 
2028     ssdflexheight[i] = (i%2==0 ? fgkSSDFlexHeight[0] : fgkSSDFlexHeight[1]);
2029     ssdflexradius[i] = (i==0 ? fgkSSDStiffenerHeight : ssdflexradius[i-1]
2030                                          +                                         ssdflexheight[i-1]);
2031     ssdflextrans[i]  = new TGeoTranslation(0.,0.,-0.5*i*(ssdflexheight[0]
2032                                          +                                         ssdflexheight[1])); 
2033     ssdflexassembly->AddNode(GetSSDFlex(ssdflexradius[i],ssdflexheight[i]),i+1,
2034                                                                                    ssdflextrans[i]);   
2035   }
2036   return ssdflexassembly;
2037 }
2038 /////////////////////////////////////////////////////////////////////////////////
2039 TGeoVolume* AliITSv11GeometrySSD::GetSSDCoolingBlockAssembly(){
2040   /////////////////////////////////////////////////////////////
2041   // Method generating SSD Cooling Block Assembly    
2042   /////////////////////////////////////////////////////////////
2043   const Int_t kssdcoolingblocktransnumber = 2;
2044   Double_t ssdcoolingblocktransvector[kssdcoolingblocktransnumber] = 
2045                                         {fgkSSDModuleSensorSupportDistance+fgkSSDCoolingBlockLength,
2046                                          fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
2047                                 -        fgkSSDCoolingBlockWidth};
2048   TGeoVolume* ssdcoolingblock = GetSSDCoolingBlock();
2049   TGeoVolume* ssdcoolingblockassembly = 
2050                                                           new TGeoVolumeAssembly("SSDCoolingBlockAssembly");
2051   for(Int_t i=0; i<kssdcoolingblocktransnumber; i++)
2052     for(Int_t j=0; j<kssdcoolingblocktransnumber; j++) 
2053                 ssdcoolingblockassembly->AddNode(ssdcoolingblock,
2054                                                   kssdcoolingblocktransnumber*i+j+1,
2055                                                   new TGeoTranslation(i*ssdcoolingblocktransvector[0],
2056                                                   j*ssdcoolingblocktransvector[1],0.));
2057   return ssdcoolingblockassembly;
2058 }
2059 /////////////////////////////////////////////////////////////////////////////////
2060 TGeoVolume* AliITSv11GeometrySSD::GetSSDCoolingBlock(){
2061   /////////////////////////////////////////////////////////////
2062   // Method generating SSD Cooling Block    
2063   /////////////////////////////////////////////////////////////
2064   // Center Cooling Block Hole
2065   ////////////////////////////
2066   Double_t coolingblockholeangle = TMath::ACos(0.5*fgkSSDCoolingBlockHoleLength[0]
2067                                                         /fgkSSDCoolingBlockHoleRadius[0])*TMath::RadToDeg();
2068   Double_t coolingblockholewidth = fgkSSDCoolingBlockWidth;
2069   new TGeoTubeSeg("CoolingBlockHoleShape",
2070                                                 0.,
2071                                                 fgkSSDCoolingBlockHoleRadius[0],
2072                                                 0.5*coolingblockholewidth,
2073                                                 180.-coolingblockholeangle,360.+coolingblockholeangle);
2074   TVector3* coolingblockholevertex[3];
2075   coolingblockholevertex[0] = new TVector3();
2076   coolingblockholevertex[1] = new TVector3(fgkSSDCoolingBlockHoleRadius[0]
2077                                         *       TMath::Cos((90.-coolingblockholeangle)*TMath::DegToRad()),
2078                                                 fgkSSDCoolingBlockHoleRadius[0]
2079                                         *       TMath::Sin((90.-coolingblockholeangle)*TMath::DegToRad()));
2080   coolingblockholevertex[2] = new TVector3(coolingblockholevertex[1]->X(),
2081                                         -       coolingblockholevertex[1]->Y());
2082                                                 GetTriangleShape(coolingblockholevertex,
2083                                                 coolingblockholewidth,"CoolingBlockTriangleHoleShape");
2084   TGeoRotation* coolingblockholerot = 
2085                                                           new TGeoRotation("CoolingBlockHoleRot",90,0.,0.);
2086   coolingblockholerot->RegisterYourself();
2087     new TGeoCompositeShape("CoolingTubeHoleShape",
2088                                                           "CoolingBlockTriangleHoleShape:CoolingBlockHoleRot+"
2089                                                           "CoolingBlockHoleShape");
2090   ///////////////////////////
2091   // Cooling Block Trapezoids
2092   ///////////////////////////
2093   const Int_t kvertexnumber = 4;
2094   const Int_t ktrapezoidnumber = 2;
2095   TVector3** coolingblocktrapezoidvertex[ktrapezoidnumber];
2096   for(Int_t i = 0; i<ktrapezoidnumber; i++) coolingblocktrapezoidvertex[i] = 
2097                                                 new TVector3*[kvertexnumber]; 
2098   Double_t coolingblockcomponentheight = fgkSSDCoolingBlockHeight[0]
2099                                     -   fgkSSDCoolingBlockHoleCenter
2100                                         -       fgkSSDCoolingBlockHoleRadius[0]
2101                                         *       TMath::Sin(coolingblockholeangle*TMath::DegToRad());
2102   Double_t coolingblocktrapezoidlength[ktrapezoidnumber] = 
2103                                         {       fgkSSDCoolingBlockLength,
2104                                                 0.5*(fgkSSDCoolingBlockLength-2.
2105                                         *       (fgkSSDCoolingBlockHoleLength[1]
2106                                         -       fgkSSDCoolingBlockHoleRadius[1])
2107                                         -       fgkSSDCoolingBlockHoleLength[0])}; 
2108   Double_t coolingblocktrapezoidheigth[ktrapezoidnumber] = 
2109                                         {       fgkSSDCoolingBlockHeight[0]-coolingblockcomponentheight
2110                                         -       fgkSSDCoolingBlockHeight[1]-fgkSSDCoolingBlockHeight[2]
2111                                         -       fgkSSDCoolingBlockHoleRadius[1],
2112                                                 coolingblockcomponentheight};
2113   Double_t coolingblocktrapezoidwidth[ktrapezoidnumber]  = 
2114                                                 {fgkSSDCoolingBlockWidth,fgkSSDCoolingBlockWidth};
2115   //////////////////////////
2116   //Vertex Positioning Shape 
2117   //////////////////////////
2118   coolingblocktrapezoidvertex[0][0] = new TVector3();
2119   coolingblocktrapezoidvertex[0][1] = new TVector3(coolingblocktrapezoidlength[0]);
2120   coolingblocktrapezoidvertex[0][2] = new TVector3(
2121                                                 0.5*(coolingblocktrapezoidvertex[0][1]->X()
2122                                         -       2.*coolingblocktrapezoidlength[1]
2123                                         -       fgkSSDCoolingBlockHoleLength[0]));
2124   coolingblocktrapezoidvertex[0][3] = 
2125                                                 new TVector3(coolingblocktrapezoidvertex[0][1]->X()
2126                                         -       coolingblocktrapezoidvertex[0][2]->X());
2127   coolingblocktrapezoidvertex[1][0] = new TVector3(); 
2128   coolingblocktrapezoidvertex[1][1] = new TVector3(coolingblocktrapezoidlength[1]);
2129   coolingblocktrapezoidvertex[1][2] = 
2130                                                 new TVector3(coolingblocktrapezoidheigth[1]
2131                                         /                                coolingblocktrapezoidheigth[0]
2132                                         *       coolingblocktrapezoidvertex[0][2]->X());
2133   coolingblocktrapezoidvertex[1][3] = 
2134                                                 new TVector3(coolingblocktrapezoidvertex[1][1]->X());
2135   char* coolingblocktrapezoidshapename[ktrapezoidnumber] = 
2136                                         {"CoolingBlockTrapezoidShape0","CoolingBlockTrapezoidShape1"};
2137   TGeoArb8* coolingblocktrapezoidshape[ktrapezoidnumber];
2138   for(Int_t i = 0; i< ktrapezoidnumber; i++) coolingblocktrapezoidshape[i] = 
2139                                                 GetArbShape(coolingblocktrapezoidvertex[i],
2140                                                 coolingblocktrapezoidwidth,
2141                                                 coolingblocktrapezoidheigth[i],
2142                                                 coolingblocktrapezoidshapename[i]);
2143   TGeoTranslation* coolingblocktrapezoidtrans = 
2144                                                 new TGeoTranslation("CoolingBlockTrapezoidTrans",
2145                                                 coolingblocktrapezoidvertex[0][2]->X(),
2146                                                 0.0,
2147                                                 0.5*(coolingblocktrapezoidheigth[0]
2148                                         +       coolingblocktrapezoidheigth[1]));
2149   coolingblocktrapezoidtrans->RegisterYourself();
2150   TGeoCombiTrans* coolingblocktrapezoidcombitrans = 
2151                                                 new TGeoCombiTrans("CoolingBlockTrapezoidCombiTrans",
2152                                                 coolingblocktrapezoidvertex[0][3]->X(),
2153                                                 fgkSSDCoolingBlockWidth,
2154                                                 0.5*(coolingblocktrapezoidheigth[0]
2155                                         +       coolingblocktrapezoidheigth[1]),
2156                                                 new TGeoRotation("",180.,0.,0.));
2157   coolingblocktrapezoidcombitrans->RegisterYourself();
2158         new TGeoCompositeShape("CoolingBlockTrapezoidCompositeShape",
2159         "CoolingBlockTrapezoidShape0+CoolingBlockTrapezoidShape1:CoolingBlockTrapezoidTrans+"
2160         "CoolingBlockTrapezoidShape1:CoolingBlockTrapezoidCombiTrans"); 
2161   /////////////////////////////
2162   // Cooling Block Boxes Shapes
2163   /////////////////////////////
2164   const Int_t kboxnumber = 3;
2165   TGeoBBox* coolingblockboxshape[kboxnumber];
2166   coolingblockboxshape[0] = new TGeoBBox("CoolingBlockBoxShape0",
2167                                                 0.5*fgkSSDCoolingBlockLength,
2168                                                 0.5*fgkSSDCoolingBlockWidth,
2169                                                 0.5*fgkSSDCoolingBlockHoleRadius[1]);
2170   coolingblockboxshape[1] = new TGeoBBox("CoolingBlockBoxShape1",
2171                                                 0.5*(fgkSSDCoolingBlockLength
2172                                         -       2.*fgkSSDCoolingBlockHoleLength[1]),
2173                                                 0.5*fgkSSDCoolingBlockWidth,
2174                                                 0.5*fgkSSDCoolingBlockHeight[2]);
2175   coolingblockboxshape[2] = new TGeoBBox("CoolingBlockBoxShape2",
2176                                                 0.5*fgkSSDCoolingBlockLength,
2177                                                 0.5*fgkSSDCoolingBlockWidth,
2178                                                 0.5*fgkSSDCoolingBlockHeight[1]);
2179   TGeoTranslation* coolingblockboxtrans[kboxnumber-1];
2180   coolingblockboxtrans[0] = new TGeoTranslation("CoolingBlockBoxTrans0",0.,0.,
2181                                                 0.5*(fgkSSDCoolingBlockHeight[1]
2182                                         +       fgkSSDCoolingBlockHoleRadius[1])
2183                                         +       fgkSSDCoolingBlockHeight[2]);
2184   coolingblockboxtrans[1] = new TGeoTranslation("CoolingBlockBoxTrans1",
2185                                                 0.0,
2186                                                 0.0,
2187                                                 0.5*(fgkSSDCoolingBlockHeight[1]
2188                                         +       fgkSSDCoolingBlockHeight[2]));
2189   for(Int_t i=0; i<kboxnumber-1; i++) coolingblockboxtrans[i]->RegisterYourself();
2190         new TGeoCompositeShape("CoolingBlockBoxCompositeShape",
2191                                                    "CoolingBlockBoxShape0:CoolingBlockBoxTrans0+"
2192          "CoolingBlockBoxShape1:CoolingBlockBoxTrans1+CoolingBlockBoxShape2");
2193   ///////////////////////
2194   // Cooling Block Shape
2195   //////////////////////
2196   TGeoCombiTrans* coolingtubeholeshapecombitrans = 
2197                                                 new TGeoCombiTrans("CoolingTubeHoleShapeCombiTrans",
2198                                                 0.5*fgkSSDCoolingBlockLength,
2199                                                 0.5*fgkSSDCoolingBlockWidth,
2200                                                 fgkSSDCoolingBlockHoleCenter,
2201                                                 new TGeoRotation("",0.,90.,0.));
2202   coolingtubeholeshapecombitrans->RegisterYourself();
2203   TGeoTranslation* coolingblocktrapezoidcompositeshapetrans = 
2204                                                 new TGeoTranslation("CoolingBlockTrapezoidCompositeShapeTrans",
2205                                                 0.0,
2206                                                 0.0,
2207                                                 0.5*coolingblocktrapezoidheigth[0]+fgkSSDCoolingBlockHeight[1]+
2208                                                 fgkSSDCoolingBlockHeight[2]+fgkSSDCoolingBlockHoleRadius[1]);
2209   coolingblocktrapezoidcompositeshapetrans->RegisterYourself();
2210   TGeoTranslation* coolingblockboxcompositeshapetrans = 
2211                                                 new TGeoTranslation("CoolingBlockBoxCompositeShapeTrans",
2212                                                 0.5*fgkSSDCoolingBlockLength,
2213                                                 0.5*fgkSSDCoolingBlockWidth,
2214                                                 0.5*fgkSSDCoolingBlockHeight[1]);
2215   coolingblockboxcompositeshapetrans->RegisterYourself();
2216   TGeoCompositeShape* ssdoolingblockshape = 
2217                 new TGeoCompositeShape("SSDCoolingBlockShape",  
2218                 "CoolingBlockBoxCompositeShape:CoolingBlockBoxCompositeShapeTrans+"
2219                 "CoolingBlockTrapezoidCompositeShape:CoolingBlockTrapezoidCompositeShapeTrans-"
2220                 "CoolingTubeHoleShape:CoolingTubeHoleShapeCombiTrans");
2221   TGeoVolume* ssdcoolingblock = new TGeoVolume("SSDCoolingBlock",
2222                 ssdoolingblockshape,fSSDAlCoolBlockMedium);
2223   return ssdcoolingblock;
2224 }
2225 /////////////////////////////////////////////////////////////////////////////////
2226 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberJunction(Double_t width){
2227   /////////////////////////////////////////////////////////////
2228   // Method generating SSD Carbon Fiber Junction
2229   /////////////////////////////////////////////////////////////
2230   const Int_t kvertexnumber = 4;
2231   TVector3* vertex[kvertexnumber];
2232   vertex[0] = new TVector3();
2233   vertex[1] = new TVector3(fgkCarbonFiberJunctionLength,0.);
2234   vertex[2] = new TVector3(fgkCarbonFiberJunctionLength
2235                 -         fgkCarbonFiberJunctionEdge[1]
2236                         *         TMath::Cos(fgkCarbonFiberJunctionAngle[1]*TMath::DegToRad()),
2237                                   fgkCarbonFiberJunctionEdge[1]*TMath::Sin(fgkCarbonFiberJunctionAngle[1]
2238                         *     TMath::DegToRad()));
2239   vertex[3] = new TVector3(fgkCarbonFiberJunctionEdge[0]
2240                         *         TMath::Cos(fgkCarbonFiberJunctionAngle[0]*TMath::DegToRad()),
2241                                   fgkCarbonFiberJunctionEdge[0]
2242                         *         TMath::Sin(fgkCarbonFiberJunctionAngle[0]*TMath::DegToRad()));
2243   TGeoArb8* carbonfiberjunctionshapepiece = 
2244                                                 new TGeoArb8("CarbonFiberJunctionShapePiece",0.5*width);
2245   //////////////////////////////////
2246   //Setting the vertices in TGeoArb8
2247   //////////////////////////////////
2248   for(Int_t i = 0; i<2*kvertexnumber; i++)
2249         carbonfiberjunctionshapepiece->SetVertex(i,
2250                                                         vertex[(i < kvertexnumber ? i: i-kvertexnumber)]->X(),
2251                                                         vertex[(i < kvertexnumber ? i : i-kvertexnumber)]->Y());
2252   TGeoRotation* carbonfiberjunctionrot = 
2253                                                 new TGeoRotation("CarbonFiberJunctionRot",
2254                                                                                   180.,
2255                                                                                   180.,
2256                                                                                   180-2.*fgkCarbonFiberJunctionAngle[0]); 
2257   TGeoVolume* carbonfiberjunctionpiece = 
2258                                                 new TGeoVolume("CarbonFiberJunctionPiece",
2259                                                 carbonfiberjunctionshapepiece,fSSDCarbonFiberMedium);
2260   TGeoVolume* carbonfiberjunction = 
2261                                                 new TGeoVolumeAssembly("CarbonFiberJunction");
2262   carbonfiberjunctionpiece->SetLineColor(fColorCarbonFiber);
2263   carbonfiberjunction->AddNode(carbonfiberjunctionpiece,1);
2264   carbonfiberjunction->AddNode(carbonfiberjunctionpiece,2,carbonfiberjunctionrot);
2265   return carbonfiberjunction;
2266 }
2267 /////////////////////////////////////////////////////////////////////////////////
2268 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberJunctionAssembly(){
2269   /////////////////////////////////////////////////////////////
2270   // Method generating SSD Carbon Fiber Junction Assembly    
2271   /////////////////////////////////////////////////////////////
2272   SetCarbonFiberJunctionCombiTransMatrix();
2273   TGeoVolume* carbonfiberjunctionassembly = 
2274                                                   new TGeoVolumeAssembly("CarbonFiberJunctionAssembly");
2275   TGeoVolume* carbonfiberjunction = 
2276                                                   GetCarbonFiberJunction(fgkCarbonFiberJunctionWidth);
2277   for(Int_t i=0; i<fgkCarbonFiberJunctionCombiTransNumber;i++) 
2278     carbonfiberjunctionassembly->AddNode(carbonfiberjunction,i+1,
2279                                                                                  fCarbonFiberJunctionCombiTransMatrix[i]);
2280   return carbonfiberjunctionassembly;
2281 }
2282 /////////////////////////////////////////////////////////////////////////////////
2283 TList* AliITSv11GeometrySSD::GetLadderCableSegment(Double_t ssdendladdercablelength){
2284   /////////////////////////////////////////////////////////////
2285   // Method returning a List containing pointers to Ladder Cable Volumes    
2286   /////////////////////////////////////////////////////////////
2287   const Int_t kladdercablesegmentnumber = 2;
2288   /////////////////////////////////////////
2289   // LadderSegmentBBox Volume
2290   /////////////////////////////////////////
2291   TGeoBBox* laddercablesegmentbboxshape[kladdercablesegmentnumber];
2292   const char* laddercablesegmentbboxshapename[kladdercablesegmentnumber] = 
2293                                 {"LadderCableSegmentBBoxShape1","LadderCableSegmentBBoxShape2"};
2294   for(Int_t i=0; i<kladdercablesegmentnumber; i++) laddercablesegmentbboxshape[i] = 
2295                                                   new TGeoBBox(laddercablesegmentbboxshapename[i],
2296                                                                            0.5*fgkSSDFlexWidth[0],
2297                                                                            0.5*fgkSSDLadderCableWidth,
2298                                                                            0.5*fgkSSDFlexHeight[i]); 
2299   const char* laddercablesegmentbboxname[kladdercablesegmentnumber] = 
2300                                                   {"LadderCableSegmentBBox1","LadderCableSegmentBBox2"};
2301   TGeoVolume* laddercablesegmentbbox[kladdercablesegmentnumber];
2302   for(Int_t i=0; i<kladdercablesegmentnumber; i++){ 
2303                         laddercablesegmentbbox[i] =
2304                                                   new TGeoVolume(laddercablesegmentbboxname[i],
2305                                                                                  laddercablesegmentbboxshape[i],
2306                                                                                  (i==0?fSSDAlTraceLadderCableMedium:
2307             fSSDKaptonLadderCableMedium));
2308                         laddercablesegmentbbox[i]->SetLineColor(i==0 ? fColorAl : 
2309                                                                                                                    fColorPolyhamide);
2310   }
2311   TGeoTranslation* laddercablesegmentbboxtrans[kladdercablesegmentnumber];                                                                                
2312   laddercablesegmentbboxtrans[0] = 
2313                                                    new TGeoTranslation("LadderCableSegmentBBoxTrans1",
2314                                                                                            0.5*fgkSSDFlexWidth[0],
2315                                                                                            0.5*fgkSSDLadderCableWidth,
2316                                                                                            0.5*fgkSSDFlexHeight[0]);
2317   laddercablesegmentbboxtrans[1] = 
2318                                                    new TGeoTranslation("LadderCableSegmentBBoxTrans2",
2319                                                                                            0.5*fgkSSDFlexWidth[0],
2320                                                                                            0.5*fgkSSDLadderCableWidth,
2321                                                                                            fgkSSDFlexHeight[0]
2322                                                                                            +0.5*fgkSSDFlexHeight[1]);
2323   TGeoVolume* laddercablesegmentbboxassembly = 
2324                                                    new TGeoVolumeAssembly("LadderCableSegmentBBoxAssembly"); 
2325   for(Int_t i=0; i<kladdercablesegmentnumber; i++)  
2326                 laddercablesegmentbboxassembly->AddNode(laddercablesegmentbbox[i],1,
2327                                                                                             laddercablesegmentbboxtrans[i]);
2328 /////////////////////////////////////////
2329 // LadderSegmentArb8 Volume
2330 /////////////////////////////////////////
2331   const Int_t kvertexnumber = 4;
2332   TVector3** laddercablesegmentvertexposition[kladdercablesegmentnumber];
2333   for(Int_t i = 0; i<kladdercablesegmentnumber; i++) laddercablesegmentvertexposition[i] = 
2334                                                                                                   new TVector3*[kvertexnumber];
2335 //Shape Vertex Positioning
2336   for(Int_t i=0; i<kladdercablesegmentnumber; i++){
2337         laddercablesegmentvertexposition[i][0] = new TVector3(0.,i*fgkSSDFlexHeight[0]);
2338         laddercablesegmentvertexposition[i][1] = new TVector3(fgkSSDLadderCableWidth,
2339                                                                                                                   i*fgkSSDFlexHeight[0]);
2340         laddercablesegmentvertexposition[i][2] = new TVector3(0.,fgkSSDFlexHeight[0]
2341                                                                                    +                         fgkSSDFlexHeight[1]
2342                                                                                    +                      i*fgkSSDFlexHeight[0]);
2343         laddercablesegmentvertexposition[i][3] = 
2344                                                    new TVector3(laddercablesegmentvertexposition[i][1]->X(),
2345                                                                                 laddercablesegmentvertexposition[i][2]->Y());
2346   }
2347   Double_t laddercablesegmentwidth[2][2] = {{fgkSSDFlexHeight[0],fgkSSDFlexHeight[0]},
2348                                                                             {fgkSSDFlexHeight[1],fgkSSDFlexHeight[1]}}; 
2349   char* laddercablesegmentarbshapename[kladdercablesegmentnumber] = 
2350                                         {"LadderCableSegmentArbShape1","LadderCableSegmentArbShape2"};
2351   TGeoArb8* laddercablesegmentarbshape[kladdercablesegmentnumber];
2352   for(Int_t i = 0; i< kladdercablesegmentnumber; i++) laddercablesegmentarbshape[i] = 
2353                                         GetArbShape(laddercablesegmentvertexposition[i],
2354                                                                 laddercablesegmentwidth[i],
2355                                                                 fgkCarbonFiberJunctionWidth-fgkSSDFlexWidth[0],
2356                                                                 laddercablesegmentarbshapename[i]);
2357   const char* laddercablesegmentarbname[kladdercablesegmentnumber] = 
2358                                                   {"LadderCableSegmentArb1","LadderCableSegmentArb2"};
2359   TGeoVolume* laddercablesegmentarb[kladdercablesegmentnumber];
2360   for(Int_t i=0; i<kladdercablesegmentnumber; i++){
2361                          laddercablesegmentarb[i] =
2362                                                    new TGeoVolume(laddercablesegmentarbname[i],
2363                                                                                   laddercablesegmentarbshape[i],
2364                                                                                   (i==0?fSSDAlTraceLadderCableMedium:
2365             fSSDKaptonLadderCableMedium)); 
2366                          laddercablesegmentarb[i]->SetLineColor(i==0 ? fColorAl : 
2367                                                                                                                    fColorPolyhamide);
2368 }
2369   TGeoRotation* laddercablesegmentarbrot[kladdercablesegmentnumber];
2370   laddercablesegmentarbrot[0] = new TGeoRotation("LadderCableSegmentArbRot1",
2371                                                                                                  90.,90,-90.);   
2372   laddercablesegmentarbrot[1] = new TGeoRotation("LadderCableSegmentArbRot2",
2373                                                                                                   0.,90.,0.);    
2374   TGeoCombiTrans* laddercablesegmentarbcombitrans =  
2375                                                    new TGeoCombiTrans("LadderCableSegmentArbCombiTrans",
2376                                                            0.5*(fgkCarbonFiberJunctionWidth-fgkSSDFlexWidth[0])
2377                                                          + fgkSSDFlexWidth[0],0.,0.,
2378                                                    new TGeoRotation((*laddercablesegmentarbrot[1])
2379                                                      *(*laddercablesegmentarbrot[0])));
2380   TGeoVolume* laddercablesegmentarbassembly = 
2381                                                    new TGeoVolumeAssembly("LadderCableSegmentArbAssembly"); 
2382   for(Int_t i=0; i<kladdercablesegmentnumber; i++)
2383   laddercablesegmentarbassembly->AddNode(laddercablesegmentarb[i],1,
2384                                                                                    laddercablesegmentarbcombitrans);
2385 /////////////////////////////////////////
2386 // End Ladder Cable Volume
2387 /////////////////////////////////////////
2388   TGeoBBox* ladderendcablesegmentbboxshape[kladdercablesegmentnumber];
2389   const char* ladderendcablesegmentbboxshapename[kladdercablesegmentnumber] = 
2390                                 {"LadderEndCableSegmentBBoxShape1","LadderEndCableSegmentBBoxShape2"};
2391   for(Int_t i=0; i<kladdercablesegmentnumber; i++) ladderendcablesegmentbboxshape[i] = 
2392                                                   new TGeoBBox(ladderendcablesegmentbboxshapename[i],
2393                                                                            0.5*ssdendladdercablelength,
2394                                                                            0.5*fgkSSDLadderCableWidth,
2395                                                                            0.5*fgkSSDFlexHeight[i]);
2396   const char* ladderendcablesegmentbboxname[kladdercablesegmentnumber] = 
2397                                                   {"LadderEndCableSegmentBBox1","LadderEndCableSegmentBBox2"};
2398   TGeoVolume* ladderendcablesegmentbbox[kladdercablesegmentnumber];
2399   for(Int_t i=0; i<kladdercablesegmentnumber; i++){ 
2400            &n