1d8abc903061d2c27c4cca58fd981628dffcb556
[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 /* $Id$ */
17
18 //*************************************************************************
19 // SSD geometry, based on ROOT geometrical modeler
20 //
21 // Enrico Cattaruzza                                    ecattar@ts.infn.it
22 //*************************************************************************
23 #include "TMath.h"
24 #include "TGeoVolume.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 "TGeoBoolNode.h"
33 #include "TGeoTube.h"
34 #include "TGeoBBox.h"
35 #include "TGeoXtru.h"
36 #include "TGeoTorus.h"
37 #include "TGeoPgon.h"
38 #include "TGeoPcon.h"
39 #include "TRotation.h"
40 #include "AliITSv11GeometrySSD.h"
41 /////////////////////////////////////////////////////////////////////////////////
42 // Names of the Sensitive Volumes of Layer 5 and Layer 6
43 /////////////////////////////////////////////////////////////////////////////////
44 const char* AliITSv11GeometrySSD::fgSSDsensitiveVolName5 = "ITSssdSensitivL5";
45 const char* AliITSv11GeometrySSD::fgSSDsensitiveVolName6 = "ITSssdSensitivL6";
46 /////////////////////////////////////////////////////////////////////////////////
47 //Parameters for SSD Geometry
48 /////////////////////////////////////////////////////////////////////////////////
49 // Variable for Vertical Disalignement of Modules
50 /////////////////////////////////////////////////////////////////////////////////
51 const Double_t AliITSv11GeometrySSD::fgkSSDTolerance = 0.0001*fgkmm;
52 const Double_t AliITSv11GeometrySSD::fgkSSDModuleVerticalDisalignment = 0.2*fgkmm;
53 const Double_t AliITSv11GeometrySSD::fgkSSDModuleSideDisalignment     = 0.2*fgkmm;
54 /////////////////////////////////////////////////////////////////////////////////
55 // Layer5 (lengths are in mm and angles in degrees)
56 /////////////////////////////////////////////////////////////////////////////////
57 const Double_t AliITSv11GeometrySSD::fgkSSDLay5LadderLength      = 950.7*fgkmm;
58 const Int_t AliITSv11GeometrySSD::fgkSSDLay5SensorsNumber        =  22;
59 const Int_t AliITSv11GeometrySSD::fgkSSDLay5LadderNumber         =  34;
60 const Double_t AliITSv11GeometrySSD::fgkSSDLay5RadiusMin         = 378.0*fgkmm;
61 const Double_t AliITSv11GeometrySSD::fgkSSDLay5RadiusMax         = 384.0*fgkmm;
62 const Double_t AliITSv11GeometrySSD::fgkLay5CenterITSPosition    = 467.85*fgkmm;
63 /////////////////////////////////////////////////////////////////////////////////
64 // Layer6 (lengths are in mm and angles in degrees)
65 /////////////////////////////////////////////////////////////////////////////////
66 const Double_t AliITSv11GeometrySSD::fgkSSDLay6LadderLength      = 1068.0*fgkmm;
67 const Int_t AliITSv11GeometrySSD::fgkSSDLay6SensorsNumber        =   25;
68 const Int_t AliITSv11GeometrySSD::fgkSSDLay6LadderNumber         =   38;
69 const Double_t AliITSv11GeometrySSD::fgkSSDLay6RadiusMin         =  428.0*fgkmm;
70 const Double_t AliITSv11GeometrySSD::fgkSSDLay6RadiusMax         =  434.0*fgkmm;
71 const Double_t AliITSv11GeometrySSD::fgkLay6CenterITSPosition    = 526.50*fgkmm;
72 /////////////////////////////////////////////////////////////////////////////////
73 // SSD Chips and Hybrid (lengths are in mm and angles in degrees)
74 /////////////////////////////////////////////////////////////////////////////////
75 const Int_t AliITSv11GeometrySSD::fgkSSDChipNumber               =   6;
76 const Double_t AliITSv11GeometrySSD::fgkSSDChipLength            =  11.100*fgkmm; 
77 const Double_t AliITSv11GeometrySSD::fgkSSDChipWidth             =   3.850*fgkmm;
78 const Double_t AliITSv11GeometrySSD::fgkSSDChipHeight            =   0.180*fgkmm;
79 const Double_t AliITSv11GeometrySSD::fgkSSDChipSeparationLength  =   1.000*fgkmm;
80 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueLength     = fgkSSDChipLength;
81 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueWidth      =  fgkSSDChipWidth;
82 const Double_t AliITSv11GeometrySSD::fgkSSDChipGlueHeight        =   0.030*fgkmm;
83 /////////////////////////////////////////////////////////////////////////////////
84 // Stiffener (lengths are in mm and angles in degrees)
85 /////////////////////////////////////////////////////////////////////////////////
86 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerLength       =  73.000*fgkmm;
87 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerWidth        =   6.500*fgkmm;
88 //const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerHeight       =   3.315;
89 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerHeight       =   0.315*fgkmm;
90 const Double_t AliITSv11GeometrySSD::fgkSSDStiffenerToChipDist   =   2.500*fgkmm;
91 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Length   = 1.600*fgkmm; 
92 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Width    =   0.870*fgkmm;
93 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor0603Height   =   0.800*fgkmm;
94 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Length   =   4.600*fgkmm;
95 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Width    =   3.400*fgkmm;
96 const Double_t AliITSv11GeometrySSD::fgkSSDCapacitor1812Height   =   0.700*fgkmm; // multiplied by 0.5  
97 const Double_t AliITSv11GeometrySSD::fgkSSDWireLength            =  30.000*fgkmm;
98 const Double_t AliITSv11GeometrySSD::fgkSSDWireRadius            =   0.185*fgkmm;
99 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorPosition[2]  = 
100                                                                                                            {44.32*fgkmm, 0.33*fgkmm};
101 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorSeparation   =        0.44*fgkmm;
102 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorLength       =        2.16*fgkmm;
103 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorWidth        =        3.60*fgkmm;
104 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorHeight       = 
105                                                                                                           0.25*fgkSSDStiffenerHeight;
106 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorAlHeight     =       0.030*fgkmm;
107 const Double_t AliITSv11GeometrySSD::fgkSSDConnectorNiHeight     =   0.002*fgkmm;
108 /////////////////////////////////////////////////////////////////////////////////
109 // Cooling Block (lengths are in mm and angles in degrees)
110 /////////////////////////////////////////////////////////////////////////////////
111 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockLength    =   3.000*fgkmm;
112 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockWidth     =   4.000*fgkmm;
113 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHeight[3] =  
114                                                                                  {1.950*fgkmm, 0.240*fgkmm, 0.300*fgkmm};
115 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleRadius[2] = 
116                                                                                                           {1.000*fgkmm, 0.120*fgkmm};
117 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleLength[2] = 
118                                                                                                           {1.900*fgkmm, 0.400*fgkmm};
119 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleCenter    =  
120                                                                                                                                          1.500*fgkmm;
121 const Double_t AliITSv11GeometrySSD::fgkSSDCoolingBlockHoleHeight    =  
122                                                                                                                                          0.300*fgkmm;
123 /////////////////////////////////////////////////////////////////////////////////
124 // SSD Sensor (lengths are in mm and angles in degrees)
125 /////////////////////////////////////////////////////////////////////////////////
126 const char*  AliITSv11GeometrySSD::fgkSSDSensitiveVolName       = 
127                                                                                                                  "SSDSensorSensitiveVol";
128 const Double_t AliITSv11GeometrySSD::fgkSSDSensorLength          =  42.000*fgkmm;
129 const Double_t AliITSv11GeometrySSD::fgkSSDSensorHeight          =   0.300*fgkmm;
130 const Double_t AliITSv11GeometrySSD::fgkSSDSensorWidth           =  75.000*fgkmm;
131 const Double_t AliITSv11GeometrySSD::fgkSSDSensorOverlap         = 
132                                                                                                    fgkSSDSensorLength-39.1*fgkmm;
133 const Double_t AliITSv11GeometrySSD::fgkSSDSensorInsensitiveLength    = 1.*fgkmm; 
134 const Double_t AliITSv11GeometrySSD::fgkSSDSensorInsensitiveWidth     = 1.*fgkmm;
135 /////////////////////////////////////////////////////////////////////////////////
136 // Flex (lengths are in mm and angles in degrees)
137 /////////////////////////////////////////////////////////////////////////////////
138 const Double_t AliITSv11GeometrySSD::fgkSSDFlexFullLength       =  106.000*fgkmm; 
139 const Double_t AliITSv11GeometrySSD::fgkSSDFlexLength[4]        = 
140                         {0.5 * (fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
141                                  + (fgkSSDChipNumber-1)*fgkSSDChipSeparationLength),
142                          0.5 * (fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
143                                  + (fgkSSDChipNumber-1)*fgkSSDChipSeparationLength)
144                                                                            - 4.000*fgkmm, 9.500*fgkmm, 10.000*fgkmm};
145 const Double_t AliITSv11GeometrySSD::fgkSSDFlexWidth[2]         = 
146                                                                                                    {  9.340*fgkmm,  5.380*fgkmm};
147 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHeight[2]        =
148                                                                                                    {  0.030*fgkmm,  0.020*fgkmm};      
149 const Double_t AliITSv11GeometrySSD::fgkSSDFlexAngle            =   30.000;
150 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHoleLength       =    1.430*fgkmm;
151 const Double_t AliITSv11GeometrySSD::fgkSSDFlexHoleWidth        =    3.000*fgkmm;
152 const Double_t AliITSv11GeometrySSD::fgkSSDEndFlexCompLength[6] = 
153                          {3.30*fgkmm,4.12*fgkmm,4.22*fgkmm,1.70*fgkmm,0.75*fgkmm,7.18*fgkmm};
154 const Double_t AliITSv11GeometrySSD:: fgkSSDEndFlexCompWidth[3] =
155                                                                                    {15.03*fgkmm,23.48*fgkmm,12.28*fgkmm};
156 /////////////////////////////////////////////////////////////////////////////////
157 // SSD Ladder Cable (lengths are in mm and angles in degrees)
158 /////////////////////////////////////////////////////////////////////////////////
159 const Double_t AliITSv11GeometrySSD::fgkSSDLadderCableWidth     =     23.5*fgkmm;
160 /////////////////////////////////////////////////////////////////////////////////
161 // SSD Module (lengths are in mm and angles in degrees)
162 /////////////////////////////////////////////////////////////////////////////////
163 const Double_t AliITSv11GeometrySSD::fgkSSDModuleStiffenerPosition[2]  = 
164                                                                                                          { 1.000*fgkmm, 3.900*fgkmm};
165 const Double_t AliITSv11GeometrySSD::fgkSSDModuleSensorSupportDistance =  
166                                                                                                                                         45.600*fgkmm;
167 const Double_t AliITSv11GeometrySSD::fgkSSDModuleCoolingBlockToSensor  =  
168                                                                                                                                          5.075*fgkmm;
169 /////////////////////////////////////////////////////////////////////////////////
170 // Sensor Support (lengths are in mm and angles in degrees)
171 /////////////////////////////////////////////////////////////////////////////////
172 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportLength                     = 
173                                                                                                                                          5.800*fgkmm;
174 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportWidth          =  
175                                                                                                                                          2.000*fgkmm;
176 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportHeight[2]      =
177                                                                                                      { 4.620*fgkmm-fgkSSDModuleVerticalDisalignment, 
178                                                                                                        5.220*fgkmm-fgkSSDModuleVerticalDisalignment};
179 //const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportHeight[2]      =
180 //                                                                                                   { 4.520*fgkmm, 5.130*fgkmm};
181 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportThickness[2]   = 
182                                                                                                          { 0.450*fgkmm, 0.450*fgkmm};
183 const Double_t AliITSv11GeometrySSD::fgkSSDSensorSideSupportPosition       
184                                                                 = 0.5 * (fgkSSDModuleSensorSupportDistance
185                                                             +  fgkSSDSensorSideSupportThickness[0])
186                                                                 -  fgkSSDSensorSideSupportLength;
187 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportLength       =  
188                                                                                                                                     5.250*fgkmm;
189 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportWidth        =
190                                                                                                                                         1.680*fgkmm;
191 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportHeight[2]    
192                                                                   = {fgkSSDSensorSideSupportHeight[0]
193                                                                   +  fgkSSDSensorSideSupportThickness[0],
194                                                                          fgkSSDSensorSideSupportHeight[1]
195                                                                   +  fgkSSDSensorSideSupportThickness[1]};
196 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportThickness[2] 
197                                                                   =  {fgkSSDSensorSideSupportThickness[0],
198                                                                           fgkSSDSensorSideSupportThickness[1]};
199 const Double_t AliITSv11GeometrySSD::fgkSSDSensorCenterSupportPosition     = 
200                                                                                                                                    19.000*fgkmm;
201 /////////////////////////////////////////////////////////////////////////////////
202 // Chip Cables (lengths are in mm and angles in degrees)
203 /////////////////////////////////////////////////////////////////////////////////
204 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesLength[2]   = 
205                                   {73.12/fgkSSDChipNumber*fgkmm,fgkSSDChipLength+2.*0.19*fgkmm};
206 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesHeight[4]   = 
207                                   {  0.014*fgkmm,  0.010*fgkmm, fgkSSDModuleCoolingBlockToSensor
208                                                                   -  (fgkSSDSensorSideSupportHeight[1]
209                                                                   -   fgkSSDSensorSideSupportHeight[0])
210                                                                   -   fgkSSDModuleVerticalDisalignment
211                                                                   -   fgkSSDCoolingBlockHoleCenter
212                                                                   -   fgkSSDStiffenerHeight
213                                                                   -   fgkSSDChipHeight-fgkSSDSensorHeight,
214                                                                           fgkSSDModuleCoolingBlockToSensor
215                                                                   -   fgkSSDModuleVerticalDisalignment  
216                                                                   -   fgkSSDCoolingBlockHoleCenter
217                                                                   -       fgkSSDStiffenerHeight
218                                                                   -   fgkSSDChipHeight-fgkSSDSensorHeight};
219 const Double_t AliITSv11GeometrySSD::fgkSSDChipCablesWidth[3]    = 
220                                             { 11.000*fgkmm,  0.800*fgkmm,  0.600*fgkmm};
221 /////////////////////////////////////////////////////////////////////////////////
222 // Carbon Fiber Junction Parameters (lengths are in mm and angles in degrees)
223 /////////////////////////////////////////////////////////////////////////////////
224 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionLength          = 
225                                                                                                                                         3.820*fgkmm;
226 //const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionLength          = 
227 //                                                                                                                                         3.780;
228 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionWidth           = 
229                                                                                  fgkSSDSensorLength-fgkSSDSensorOverlap;
230 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionEdge[2]         = 
231                                                                                                         {  0.86*fgkmm,  0.30*fgkmm};
232 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionAngle[2]        = 
233                                                                                                                                 { 30.00, 90.00};
234 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberJunctionToSensorSupport = 
235                                                                                                                                          1.78*fgkmm;
236 /////////////////////////////////////////////////////////////////////////////////
237 //Carbon Fiber Parameters (lengths are in mm and angles in degrees)
238 /////////////////////////////////////////////////////////////////////////////////
239 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberTriangleLength          
240                                                                    = fgkSSDModuleSensorSupportDistance
241                                                                    - 2. * fgkCarbonFiberJunctionToSensorSupport;  
242 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberTriangleAngle = 60.00;
243 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportTopEdgeDist[2]   = 
244                                                                                                   {  0.751*fgkmm,  0.482*fgkmm};
245 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportEdgeLength  = 
246                                                                                                                                         1.630*fgkmm;
247 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportWidth =   0.950*fgkmm;
248 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportXAxisLength      
249                                                                         = fgkCarbonFiberTriangleLength
250                                                                         - 0.5*fgkCarbonFiberSupportTopEdgeDist[1]
251                                                                         / TMath::Cos(fgkCarbonFiberTriangleAngle
252                                                                         * TMath::DegToRad());
253 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberSupportYAxisLength      
254                                                                         = 0.5*(fgkCarbonFiberJunctionWidth
255                                                                         - fgkCarbonFiberSupportWidth)
256                                                                         - fgkCarbonFiberSupportTopEdgeDist[0]
257                                                                         - fgkCarbonFiberSupportWidth;
258 /////////////////////////////////////////////////////////////////////////////////
259 // Carbon Fiber Lower Support Parameters (lengths are in mm)
260 /////////////////////////////////////////////////////////////////////////////////
261 const Double_t AliITSv11GeometrySSD::fgkLowerSupportToSensorZ           = 11.575*fgkmm;  
262 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportWidth             
263                                                                                                                                           =  0.950*fgkmm;
264 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportLowerLenght       
265                                                                                                                                           =  1.600*fgkmm;
266 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportHeight            
267                                                                                                                                           =  0.830*fgkmm;
268 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportVolumeSeparation  
269                                                                                           = 0.5*fgkCarbonFiberSupportWidth;
270 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportTransverseWidth   
271                                                                         = fgkCarbonFiberJunctionWidth
272                                                                         - 2. * (fgkCarbonFiberLowerSupportWidth
273                                                                         + fgkCarbonFiberLowerSupportVolumeSeparation);
274 const Double_t AliITSv11GeometrySSD::fgkCarbonFiberLowerSupportVolumePosition[2] 
275                                                                         = {fgkCarbonFiberLowerSupportWidth
276                                                                         +  fgkCarbonFiberLowerSupportVolumeSeparation,
277                                                                            fgkCarbonFiberLowerSupportWidth
278                                                                         +  fgkCarbonFiberLowerSupportVolumeSeparation                                                   
279                                                                         +  fgkCarbonFiberLowerSupportTransverseWidth};
280 /////////////////////////////////////////////////////////////////////////////////
281 // End Ladder Carbon Fiber Junction Parameters (lengths are in mm and angles in degrees)
282 /////////////////////////////////////////////////////////////////////////////////
283 const Double_t AliITSv11GeometrySSD::fgkEndLadderCarbonFiberLowerJunctionLength[2] = 
284                                                            {0.5 * (fgkSSDLay5LadderLength
285                                                                         -  fgkSSDLay5SensorsNumber
286                                                                         *  fgkCarbonFiberJunctionWidth
287                                                                         -  fgkCarbonFiberLowerSupportWidth),
288                                                                 0.5 * (fgkSSDLay5LadderLength
289                                                                         -  fgkSSDLay5SensorsNumber
290                                                                         *  fgkCarbonFiberJunctionWidth
291                                                                         +  fgkCarbonFiberLowerSupportWidth)};
292 const Double_t AliITSv11GeometrySSD::fgkEndLadderCarbonFiberUpperJunctionLength[2] = 
293                                                 {fgkEndLadderCarbonFiberLowerJunctionLength[0]-20.4*fgkmm,
294                                                  fgkEndLadderCarbonFiberLowerJunctionLength[1]-20.6*fgkmm};
295 const Double_t AliITSv11GeometrySSD::fgkEndLadderMountingBlockPosition[2] = 
296                                                 {fgkEndLadderCarbonFiberLowerJunctionLength[0]-16.50*fgkmm,
297                                                  fgkEndLadderCarbonFiberLowerJunctionLength[1]-31.50*fgkmm};
298 const Double_t AliITSv11GeometrySSD::fgkendladdercoolingsupportdistance[3] = 
299                                                                                         {15.0*fgkmm, 13.5*fgkmm, 14.5*fgkmm};
300 /////////////////////////////////////////////////////////////////////////////////
301 // Cooling Tube Support (lengths are in mm and angles in degrees)
302 /////////////////////////////////////////////////////////////////////////////////
303 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportRmax      =  1.45*fgkmm;
304 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportRmin          
305                                                                                           = fgkSSDCoolingBlockHoleRadius[0];
306 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportLength    =  8.55*fgkmm;
307 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportHeight    =  0.85*fgkmm;
308 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportWidth     =  2.00*fgkmm;
309 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportSeparation    = 
310                                         fgkSSDSensorLength-2.*fgkSSDSensorOverlap;
311 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSupportToCarbonFiber = 
312                                                                                                                                           11.70*fgkmm;
313 /////////////////////////////////////////////////////////////////////////////////
314 // Cooling Tube (lengths are in mm and angles in degrees)
315 /////////////////////////////////////////////////////////////////////////////////
316 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeRmax = fgkCoolingTubeSupportRmin;
317 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeRmin =  0.96*fgkmm;
318 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeLength = 
319                                                                                                         fgkCarbonFiberJunctionWidth;
320 const Double_t AliITSv11GeometrySSD::fgkCoolingTubeSeparation = 
321                                                                          fgkSSDModuleSensorSupportDistance
322                                                                   +      fgkSSDCoolingBlockLength;
323 const Double_t AliITSv11GeometrySSD::fgkMountingBlockToSensorSupport = 30.7*fgkmm;
324 /////////////////////////////////////////////////////////////////////////////////
325 // SSD Mounting Block Parameters (lengths are in mm and angles in degrees)
326 /////////////////////////////////////////////////////////////////////////////////
327 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockLength[3]            = 
328                                                                                    { 60.0*fgkmm, 42.2*fgkmm, 34.0*fgkmm};
329 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHeight[4]            =
330                                                            {  4.0*fgkmm,  8.0*fgkmm,  5.0*fgkmm,  0.2*fgkmm};
331 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockWidth                =   
332                                                                                                                                           20.0*fgkmm;
333 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidAngle   =   
334                                                                                                                                                     40.0;
335 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidHeight  = 
336                    0.30*(fgkSSDMountingBlockHeight[1]-fgkSSDMountingBlockHeight[2]);
337 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTrapezoidUpBasis =    
338                                                                                                                                           2.5*fgkmm;
339 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTubeLength[2]    = 
340                                                                                                           { 56.0*fgkmm, 12.0*fgkmm}; 
341 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleTubeWidth[2]     = 
342                                                                                                       {  5.0*fgkmm,  2.9*fgkmm}; 
343 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockHoleRadius           = 
344                                                                                                                                           1.0*fgkmm;
345 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleEdge        =   
346                                                                                                                                           6.0*fgkmm;
347 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleHeigth      =  
348                                                                                                                                           4.0*fgkmm;
349 const Double_t AliITSv11GeometrySSD::fgkSSDMountingBlockScrewHoleRadius[2]   =
350                                                           {  1.5*fgkmm,fgkSSDMountingBlockScrewHoleEdge/6.};
351 /////////////////////////////////////////////////////////////////////////////////
352 // SSD Mounting Block Clip Parameters (lengths are in mm and angles in degrees)
353 /////////////////////////////////////////////////////////////////////////////////
354 const Double_t AliITSv11GeometrySSD::fgkMountingBlockClipLength        = 15.1*fgkmm;
355 const Double_t AliITSv11GeometrySSD::fgkMountingBlockClipThickness     = 0.3*fgkmm;
356 const Double_t AliITSv11GeometrySSD::fgkMountingBlockClibScrewRadius   = 1.6*fgkmm;
357 const Double_t AliITSv11GeometrySSD::fgkMountingBlockClibScrewPosition = 4.0*fgkmm;
358 const Double_t AliITSv11GeometrySSD::fgkMountingBlockClibWidth         = 9.0*fgkmm;
359 /////////////////////////////////////////////////////////////////////////////////
360 // SSD Mounting Block Support Parameters (lengths are in mm and angles in degrees)
361 /////////////////////////////////////////////////////////////////////////////////
362 const Double_t AliITSv11GeometrySSD::fgkMountingBlockSupportWidth[2] = {9.5*fgkmm,10.0*fgkmm}; 
363 const Double_t AliITSv11GeometrySSD::fgkMountingBlockSupportDownHeight   = 4.0*fgkmm;
364 const Double_t AliITSv11GeometrySSD::fgkMountingBlockSupportRadius[2] = {fgkSSDLay5RadiusMin
365                                                                                                   -  fgkSSDMountingBlockHeight[1]
366                                                                                                   +  0.5*fgkCoolingTubeSupportHeight
367                                                                                                   +      fgkSSDModuleCoolingBlockToSensor
368                                                                                                   -      fgkMountingBlockSupportDownHeight,
369                                                                                                          fgkSSDLay6RadiusMin
370                                                                                                   -  fgkSSDMountingBlockHeight[1]
371                                                                                                   +  0.5*fgkCoolingTubeSupportHeight
372                                                                                                   +      fgkSSDModuleCoolingBlockToSensor
373                                                                                                   -      fgkMountingBlockSupportDownHeight}; 
374 const Double_t AliITSv11GeometrySSD::fgkMountingBlockSupportUpHeight[2] = {fgkSSDLay5RadiusMax
375                                                                                                     -  fgkSSDMountingBlockHeight[1]
376                                                                                                     +  0.5*fgkCoolingTubeSupportHeight
377                                                                                                     +  fgkSSDModuleCoolingBlockToSensor
378                                                                                                         -  fgkMountingBlockSupportRadius[0],
379                                                                                                            fgkSSDLay6RadiusMax
380                                                                                                     -  fgkSSDMountingBlockHeight[1]
381                                                                                                     +  0.5*fgkCoolingTubeSupportHeight
382                                                                                                     +  fgkSSDModuleCoolingBlockToSensor
383                                                                                                         -  fgkMountingBlockSupportRadius[1]};
384 const Double_t AliITSv11GeometrySSD::fgkLadderSupportHeigth = 10.0*fgkmm; // To be verified
385 const Double_t AliITSv11GeometrySSD::fgkLadderSupportRingLay5Position = 451.35*fgkmm;
386 const Double_t AliITSv11GeometrySSD::fgkLadderSupportRingLay6Position = 510.00*fgkmm;
387 /////////////////////////////////////////////////////////////////////////////////
388 // SSD End Cap Cover Plate Parameters (lengths are in mm and angles in degrees)
389 /////////////////////////////////////////////////////////////////////////////////
390 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateSmallHoleRadius = 1.25*fgkmm;
391 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateBigHoleRadius = 2.45*fgkmm;
392 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateThickness = 0.5*fgkmm;
393 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateSmallHoleSeparation[3] =
394                                                                                                 {16.5*fgkmm,22.0*fgkmm,7.*fgkmm};
395 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateLength[6] = 
396                                   {7.*fgkmm,55.*fgkmm,8.0*fgkmm,53.*fgkmm,61.0*fgkmm,25.5*fgkmm};
397 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateWidth[3] = 
398                                                                                            {68.5*fgkmm,75.5*fgkmm,6.5*fgkmm};
399 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateScrewRadiusMin = 0.750*fgkmm;  
400 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateScrewRadiusMax = 2.*fgkmm;  
401 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateClipLength = 10.4*fgkmm;
402 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateClipWidth = 6.0*fgkmm;
403 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateDownClipLength = 5.7*fgkmm;
404 const Double_t AliITSv11GeometrySSD::fgkEndCapCoverPlateDownClipWidth = 5.0*fgkmm;
405 /////////////////////////////////////////////////////////////////////////////////
406 // SSD End Cap Kapton Foil Parameters (lengths are in mm and angles in degrees)
407 /////////////////////////////////////////////////////////////////////////////////
408 const Double_t AliITSv11GeometrySSD::fgkEndCapKaptonFoilThickness = 0.4*fgkmm;
409 const Double_t AliITSv11GeometrySSD::fgkEndCapKaptonFoilLength = 68.0*fgkmm;
410 const Double_t AliITSv11GeometrySSD::fgkEndCapKaptonFoilWidth = 75.0*fgkmm;
411 /////////////////////////////////////////////////////////////////////////////////
412 // SSD End Cap Cooling Tube Parameters (lengths are in mm and angles in degrees)
413 /////////////////////////////////////////////////////////////////////////////////
414 const Double_t AliITSv11GeometrySSD::fgkEndCapCoolingTubeAxialRadius[2] =
415                                                                                                                 {10.5*fgkmm,9.25*fgkmm}; 
416 const Double_t AliITSv11GeometrySSD::fgkEndCapCoolingTubeRadiusMin = 1.3*fgkmm; 
417 const Double_t AliITSv11GeometrySSD::fgkEndCapCoolingTubeRadiusMax = 1.5*fgkmm; 
418 const Double_t AliITSv11GeometrySSD::fgkEndCapCoolingTubeAngle[5] =
419                                                                                                         {182.3,177.9,84.4,70.0,35.0}; 
420 const Double_t AliITSv11GeometrySSD::fgkEndCapCoolingTubeLength[5] = 
421                                                                         {49.5*fgkmm,41.7*fgkmm,47.6*fgkmm,5.0*fgkmm};
422 const Double_t AliITSv11GeometrySSD::fgkEndCapCoolingTubeToCoverSide = 13.0*fgkmm;
423 /////////////////////////////////////////////////////////////////////////////////
424 // SSD End Cap Cover Side Parameters (lengths are in mm and angles in degrees)
425 /////////////////////////////////////////////////////////////////////////////////
426 const Double_t AliITSv11GeometrySSD::fgkEndCapSideCoverLength[5] = {3.5*fgkmm,
427                                                                           6.5*fgkmm,75.0*fgkmm,8.0*fgkmm,2.0*fgkmm};
428 const Double_t AliITSv11GeometrySSD::fgkEndCapSideCoverWidth[7] = {30.9*fgkmm,
429                                                                           47.5*fgkmm,12.6*fgkmm,5.6*fgkmm,
430                                                                           20.0*fgkmm,7.0*fgkmm,5.9*fgkmm};
431 const Double_t AliITSv11GeometrySSD::fgkEndCapSideCoverThickness = 0.4*fgkmm; 
432 /////////////////////////////////////////////////////////////////////////////////
433 // SSD End Cap Cards Parameters (lengths are in mm and angles in degrees)
434 /////////////////////////////////////////////////////////////////////////////////
435 const Double_t AliITSv11GeometrySSD::fgkEndCapCardElectBoardBackLength[3] = 
436                                                                                                            {62.0*fgkmm,21.87*fgkmm};
437 const Double_t AliITSv11GeometrySSD::fgkEndCapCardElectBoardBackWidth[2] = 
438                                                                                                             {47.0*fgkmm,0.35*fgkmm};
439 const Double_t AliITSv11GeometrySSD::fgkEndCapCardElectBoardBackThickness = 
440                                                                                                                                           1.0*fgkmm;
441 const Double_t AliITSv11GeometrySSD::fgkEndCapCardElectBoardLength = 61.8*fgkmm;
442 const Double_t AliITSv11GeometrySSD::fgkEndCapCardElectBoardLayerWidth[2] =
443                                                                                                            {43.5*fgkmm, 0.70*fgkmm};
444 const Double_t AliITSv11GeometrySSD::fgkEndCapCardElectBoardLayerThickness = 
445                                                                                                                                          0.15*fgkmm;
446 const Double_t AliITSv11GeometrySSD::fgkEndCapCardJMDConnectorThickness = 
447                                                                                                                                          19.0*fgkmm;
448 const Double_t AliITSv11GeometrySSD::fgkEndCapCardJMDConnectorLength[2] = 
449                                                                                                                  {4.80*fgkmm,1.1*fgkmm};
450 const Double_t AliITSv11GeometrySSD::fgkEndCapCardJMDConnectorWidth[2] =
451                                                                                                                  {3.3*fgkmm,1.10*fgkmm};
452 const Double_t AliITSv11GeometrySSD::fgkEndCapCardJMDConnectorToLayer = 
453                                                                                                                                           2.1*fgkmm;
454 const Double_t AliITSv11GeometrySSD::fgkEndCapCardCableConnectorLength[3] =
455                                                                                                 {5.2*fgkmm,3.5*fgkmm,1.2*fgkmm}; 
456 const Double_t AliITSv11GeometrySSD::fgkEndCapCardCableConnectorWidth[2] =
457                                                                                                                  {1.9*fgkmm,0.15*fgkmm}; 
458 const Double_t AliITSv11GeometrySSD::fgkEndCapCardCableConnectorThickness = 
459                                                                                                                                            19*fgkmm; 
460 const Double_t AliITSv11GeometrySSD::fgkEndCapCardCableConnectorDistance = 
461                                                                                                                                           1.0*fgkmm;
462 const Double_t AliITSv11GeometrySSD::fgkEndCapCardCableConnectorToLayer = 
463                                                                                                                                           3.6*fgkmm;
464 const Double_t AliITSv11GeometrySSD::fgkEndCapStripConnectionLength = 
465                                                                                                                                          61.0*fgkmm; 
466 const Double_t AliITSv11GeometrySSD::fgkEndCapStripConnectionThickness =
467                                                                                                                                          5.97*fgkmm; 
468 const Double_t AliITSv11GeometrySSD::fgkEndCapStripConnectionWidth = 3.0*fgkmm; 
469 const Double_t AliITSv11GeometrySSD::fgkEndCapInterfaceCardBLength[7] = 
470                                                                                                 {3.1*fgkmm,68.0*fgkmm,3.6*fgkmm,
471                                                                           1.9*fgkmm,2.5*fgkmm,14.2*fgkmm,1.5*fgkmm};
472 const Double_t AliITSv11GeometrySSD::fgkEndCapInterfaceCardBWidth[5] = 
473                                                   {17.0*fgkmm,10.0*fgkmm,5.9*fgkmm,6.4*fgkmm,3.9*fgkmm};
474 const Double_t AliITSv11GeometrySSD::fgkEndCapInterfaceCardBThickness = 
475                                                                                                                                           1.0*fgkmm; 
476 const Double_t AliITSv11GeometrySSD::fgkEndCapInterfaceElectBoardCardBThickness 
477                                                                                                                                    = 0.15*fgkmm; 
478 const Double_t AliITSv11GeometrySSD::fgkEndCapInterfaceCardBJMDConnectorSeparation = 
479                                                                                                                                          20.0*fgkmm;
480 const Double_t AliITSv11GeometrySSD::fgkEndCapStiffenerLength = 68.0*fgkmm;
481 const Double_t AliITSv11GeometrySSD::fgkEndCapStiffenerWidth = 5.0*fgkmm;
482 const Double_t AliITSv11GeometrySSD::fgkEndCapStiffenerThickness = 5.0*fgkmm;
483 const Double_t AliITSv11GeometrySSD::fgkEndCapEffectiveCableRadiusMin = 1.25*fgkmm; // To Be Checked
484 const Double_t AliITSv11GeometrySSD::fgkEndCapEffectiveCableRadiusMax = 1.575*fgkmm; // To Be Checked
485 /////////////////////////////////////////////////////////////////////////////////
486 // SSD End Cap SupportLayer5/6 Side Parameters (lengths are in mm and angles in degrees)
487 /////////////////////////////////////////////////////////////////////////////////
488 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportLength[2] = {70.424*fgkmm,72.919*fgkmm};
489 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportMiddleRadius[2] = {377.0*fgkmm,437.0*fgkmm};
490 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportLowRadius[2] = {375.0*fgkmm,435.0*fgkmm};
491 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportHighWidth = 20.0*fgkmm;
492 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportLowWidth[2] = {3.0*fgkmm,3.0*fgkmm};
493 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportCenterLay5ITSPosition = 625.0*fgkmm;
494 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportCenterLay5Position = 2.5*fgkmm;
495 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportCenterLay6ITSPosition = 635.0*fgkmm;
496 const Double_t AliITSv11GeometrySSD::fgkEndCapSupportCenterLay6Position = 2.5*fgkmm;
497 /////////////////////////////////////////////////////////////////////////////////
498 // SSD Cone Parameters (lengths are in mm and angles in degrees)
499 /////////////////////////////////////////////////////////////////////////////////
500 const Double_t AliITSv11GeometrySSD::fgkSSDLowerPConeRadius = 296.5*fgkmm;
501 const Double_t AliITSv11GeometrySSD::fgkSSDPConeAngle = 39.0; 
502 const Double_t AliITSv11GeometrySSD::fgkSSDPConeZLength[2] = {168.0*fgkmm,153.0*fgkmm};
503 const Double_t AliITSv11GeometrySSD::fgkSSDPConeLittleHoleRadius = 317.5*fgkmm;
504 const Double_t AliITSv11GeometrySSD::fgkSSDPConeLittleHoleLength = 20.*fgkmm;   
505 const Double_t AliITSv11GeometrySSD::fgkSSDConeMiddleRadius = 350.*fgkmm;
506 const Double_t AliITSv11GeometrySSD::fgkSSDPConeMiddleLength = 30.*fgkmm;
507 const Double_t AliITSv11GeometrySSD::fgkSSDPConeMiddleWidth = 40.*fgkmm;
508 const Double_t AliITSv11GeometrySSD::fgkSSDPConeUpRadius = 400.*fgkmm;
509 const Double_t AliITSv11GeometrySSD::fgkSSDPConeUpMaxRadius = 459.*fgkmm;
510 const Double_t AliITSv11GeometrySSD::fgkSSDPConeUpMiddleRadius = 472.5*fgkmm;
511 const Double_t AliITSv11GeometrySSD::fgkSSDPConeDownRadius = 282.0*fgkmm;
512 const Double_t AliITSv11GeometrySSD::fgkSSDPConeTrapezoidAngle = 42.0;
513 const Double_t AliITSv11GeometrySSD::fgkSSDPConeTrapezoidBasis = 200.0*fgkmm;
514 const Double_t AliITSv11GeometrySSD::fgkSSDPConeExternalRadius = 492.5*fgkmm;
515 const Double_t AliITSv11GeometrySSD::fgkSSDPConeRadiusWidth = 16.75*fgkmm;
516 const Double_t AliITSv11GeometrySSD::fgkSSDPConeLength = 168.0*fgkmm;
517 const Double_t AliITSv11GeometrySSD::fgkSSDCentralSupportLength = 1020.*fgkmm;
518 const Double_t AliITSv11GeometrySSD::fgkSSDCentralSupportRadius = 297.5*fgkmm;  
519 const Double_t AliITSv11GeometrySSD::fgkSSDCentralSupportWidth = 6.28*fgkmm;
520 const Double_t AliITSv11GeometrySSD::fgkSSDCentralAL3SupportLength = 60.0*fgkmm;
521 const Double_t AliITSv11GeometrySSD::fgkSSDCentralAL3SupportWidth = 2.5*fgkSSDCentralSupportWidth;
522 /////////////////////////////////////////////////////////////////////////////////
523 // SSD Cables Parameters (lengths are in mm and angles in degrees)
524 /////////////////////////////////////////////////////////////////////////////////
525 const Double_t AliITSv11GeometrySSD::fgkSSDCablesLay5TubeRadiusMin = 11.9*fgkmm;
526 const Double_t AliITSv11GeometrySSD::fgkSSDCablesLay6TubeRadiusMin = 11.9*fgkmm;
527 const Double_t AliITSv11GeometrySSD::fgkSSDCablesLay5RightSideHeight = 7.*fgkmm;  // to be fixed in order to reproduce material budget
528 const Double_t AliITSv11GeometrySSD::fgkSSDCablesLay6RightSideHeight = 7.*fgkmm;  // to be fixed in order to reproduce material budget
529 const Double_t AliITSv11GeometrySSD::fgkSSDCableAngle = 22.5;
530 const Double_t AliITSv11GeometrySSD::fgkSSDCablesLay5RightSideWaterHeight = 2.5*fgkmm;  // to be fixed in order to reproduce material budget
531 const Double_t AliITSv11GeometrySSD::fgkSSDCablesPatchPanel2RB26Angle[2] = {25.0,53.2};
532 const Double_t AliITSv11GeometrySSD::fgkSSDCablesPatchPanel2RB24Angle[2] = {23.0,53.6};
533 const Double_t AliITSv11GeometrySSD::fgkSSDPatchPanel2RB26ITSDistance = 975.0*fgkmm;
534 const Double_t AliITSv11GeometrySSD::fgkSSDPatchPanel2RB24ITSDistance = 1020.0*fgkmm;
535 const Double_t AliITSv11GeometrySSD::fgkSSDPatchPanel2RB26Radius = 451.3*fgkmm;
536 const Double_t AliITSv11GeometrySSD::fgkSSDPatchPanel2RB24Radius = 451.3*fgkmm;
537 const Double_t AliITSv11GeometrySSD::fgkSSDPatchPanelHeigth = 87.5*fgkmm;
538 const Double_t AliITSv11GeometrySSD::fgkSSDCableMaterialBudgetHeight = 20.0*fgkmm;
539 //const Double_t AliITSv11GeometrySSD::fgkSSDPatchPanel2RB26Radius = fgkSSDPConeExternalRadius;
540 //const Double_t AliITSv11GeometrySSD::fgkSSDPatchPanel2RB24Radius = fgkSSDPConeExternalRadius;
541 /////////////////////////////////////////////////////////////////////////////////
542 ClassImp(AliITSv11GeometrySSD)
543 /////////////////////////////////////////////////////////////////////////////////
544 AliITSv11GeometrySSD::AliITSv11GeometrySSD(): 
545   AliITSv11Geometry(),
546   fSSDChipMedium(),
547   fSSDChipGlueMedium(),
548   fSSDStiffenerMedium(),
549   fSSDStiffenerConnectorMedium(),
550   fSSDStiffener0603CapacitorMedium(),
551   fSSDStiffener1812CapacitorMedium(),
552   fSSDStiffenerHybridWireMedium(),
553   fSSDKaptonFlexMedium(),
554   fSSDAlTraceFlexMedium(),
555   fSSDAlTraceLadderCableMedium(),
556   fSSDKaptonLadderCableMedium(),
557   fSSDKaptonChipCableMedium(),
558   fSSDAlTraceChipCableMedium(),
559   fSSDAlCoolBlockMedium(),
560   fSSDSensorMedium(),
561   fSSDSensorSupportMedium(),
562   fSSDCarbonFiberMedium(),
563   fSSDTubeHolderMedium(),
564   fSSDCoolingTubeWater(),
565   fSSDCoolingTubePhynox(),
566   fSSDSupportRingAl(),
567   fSSDMountingBlockMedium(),
568   fSSDRohaCellCone(),
569   fSSDAir(),
570   fSSDCopper(),
571   fCreateMaterials(kFALSE),
572   fTransformationMatrices(kFALSE),
573   fBasicObjects(kFALSE),
574   fcarbonfiberjunction(),
575   fcoolingtubesupport(),
576   fhybridmatrix(),
577   fssdcoolingblocksystem(),
578   fcoolingblocksystematrix(),
579   fssdstiffenerflex(),
580   fssdendflex(),
581   fendladdercoolingtubesupportmatrix(),
582   fendladdermountingblock(),
583   fendladdermountingblockclip(),
584   fSSDSensor5(),
585   fSSDSensor6(),
586   fSSDLayer5(), 
587   fSSDLayer6(),
588   fMotherVol(),
589   fLay5LadderSupportRing(),
590   fLay6LadderSupportRing(),
591   fgkEndCapSupportSystem(),
592   fSSDCone(),
593   fColorCarbonFiber(4),
594   fColorRyton(5),
595   fColorPhynox(14),
596   fColorSilicon(3),
597   fColorAl(38),
598   fColorKapton(6),
599   fColorPolyhamide(5),
600   fColorStiffener(9),
601   fColorEpoxy(30),
602   fColorWater(7),
603   fColorG10(41)
604 {
605   ////////////////////////
606   // Standard constructor
607   ////////////////////////
608 }
609 /////////////////////////////////////////////////////////////////////////////////
610 AliITSv11GeometrySSD::AliITSv11GeometrySSD(const AliITSv11GeometrySSD &s):
611   AliITSv11Geometry(s.GetDebug()),
612   fSSDChipMedium(s.fSSDChipMedium),
613   fSSDChipGlueMedium(s.fSSDChipGlueMedium),
614   fSSDStiffenerMedium(s.fSSDStiffenerMedium),
615   fSSDStiffenerConnectorMedium(s.fSSDStiffenerConnectorMedium),
616   fSSDStiffener0603CapacitorMedium(s.fSSDStiffener0603CapacitorMedium),
617   fSSDStiffener1812CapacitorMedium(s.fSSDStiffener1812CapacitorMedium),
618   fSSDStiffenerHybridWireMedium(s.fSSDStiffenerHybridWireMedium),
619   fSSDKaptonFlexMedium(s.fSSDKaptonFlexMedium),
620   fSSDAlTraceFlexMedium(s.fSSDAlTraceFlexMedium),
621   fSSDAlTraceLadderCableMedium(s.fSSDAlTraceLadderCableMedium),
622   fSSDKaptonLadderCableMedium(s.fSSDKaptonLadderCableMedium),
623   fSSDKaptonChipCableMedium(s.fSSDKaptonChipCableMedium),
624   fSSDAlTraceChipCableMedium(s.fSSDAlTraceChipCableMedium),
625   fSSDAlCoolBlockMedium(s.fSSDAlCoolBlockMedium),
626   fSSDSensorMedium(s.fSSDSensorMedium),
627   fSSDSensorSupportMedium(s.fSSDSensorSupportMedium),
628   fSSDCarbonFiberMedium(s.fSSDCarbonFiberMedium),
629   fSSDTubeHolderMedium(s.fSSDTubeHolderMedium),
630   fSSDCoolingTubeWater(s.fSSDCoolingTubeWater),
631   fSSDCoolingTubePhynox(s.fSSDCoolingTubePhynox),
632   fSSDSupportRingAl(s.fSSDSupportRingAl),
633   fSSDMountingBlockMedium(s.fSSDMountingBlockMedium),
634   fSSDRohaCellCone(s.fSSDRohaCellCone),
635   fSSDAir(s.fSSDAir),
636   fSSDCopper(s.fSSDCopper),
637   fCreateMaterials(s.fCreateMaterials),
638   fTransformationMatrices(s.fTransformationMatrices),
639   fBasicObjects(s.fBasicObjects),
640   fcarbonfiberjunction(s.fcarbonfiberjunction),
641   fcoolingtubesupport(s.fcoolingtubesupport),
642   fhybridmatrix(s.fhybridmatrix),
643   fssdcoolingblocksystem(s.fssdcoolingblocksystem),
644   fcoolingblocksystematrix(s.fcoolingblocksystematrix),
645   fssdstiffenerflex(s.fssdstiffenerflex),
646   fssdendflex(s.fssdendflex),
647   fendladdercoolingtubesupportmatrix(s.fendladdercoolingtubesupportmatrix),
648   fendladdermountingblock(s.fendladdermountingblock),
649   fendladdermountingblockclip(s.fendladdermountingblockclip),
650   fSSDSensor5(s.fSSDSensor5),
651   fSSDSensor6(s.fSSDSensor6),
652   fSSDLayer5(s.fSSDLayer5),     
653   fSSDLayer6(s.fSSDLayer6),
654   fMotherVol(s.fMotherVol),
655   fLay5LadderSupportRing(s.fLay5LadderSupportRing),
656   fLay6LadderSupportRing(s.fLay6LadderSupportRing),
657   fgkEndCapSupportSystem(s.fgkEndCapSupportSystem),
658   fSSDCone(s.fSSDCone),
659   fColorCarbonFiber(s.fColorCarbonFiber),
660   fColorRyton(s.fColorRyton),
661   fColorPhynox(s.fColorPhynox),
662   fColorSilicon(s.fColorSilicon),
663   fColorAl(s.fColorAl),
664   fColorKapton(s.fColorKapton),
665   fColorPolyhamide(s.fColorPolyhamide),
666   fColorStiffener(s.fColorStiffener),
667   fColorEpoxy(s.fColorEpoxy),
668   fColorWater(s.fColorWater),
669   fColorG10(s.fColorG10)
670 {
671   ////////////////////////
672   // Copy Constructor
673   ////////////////////////
674 }
675 /////////////////////////////////////////////////////////////////////////////////
676 AliITSv11GeometrySSD& AliITSv11GeometrySSD::
677 operator=(const AliITSv11GeometrySSD &s){
678   ////////////////////////
679   // Assignment operator
680   ////////////////////////
681   this->~AliITSv11GeometrySSD();
682   new(this) AliITSv11GeometrySSD(s); 
683   return *this;
684 /*      
685   if(&s == this) return *this;
686   fMotherVol = s.fMotherVol;
687   return *this;
688  */
689 }
690 ///////////////////////////////////////////////////////////////////////////////
691 void AliITSv11GeometrySSD::CreateTransformationMatrices(){
692   ///////////////////////////////////////////////////////////////////////  
693   // Method generating the trasformation matrix for the whole SSD Geometry   
694   ///////////////////////////////////////////////////////////////////////  
695   // Setting some variables for Carbon Fiber Supportmatrix creation
696   //////////////////////////////////////////////////////////////////////
697   Double_t carbonfibersupportxaxisEdgeproj = fgkCarbonFiberSupportEdgeLength
698                                                                                    * CosD(fgkCarbonFiberJunctionAngle[0]);
699   Double_t symmetryplaneposition = (fgkCarbonFiberSupportYAxisLength
700                                                                  +      fgkCarbonFiberSupportTopEdgeDist[0]
701                                                                  +      fgkCarbonFiberSupportWidth);
702   Double_t carbonfibersupportheight = carbonfibersupportxaxisEdgeproj
703                                                                         * TanD(fgkCarbonFiberJunctionAngle[0]);
704   TGeoRotation* carbonfiberot[3];
705   for(Int_t i=0; i<3; i++) carbonfiberot[i] = new TGeoRotation();
706   carbonfiberot[0]->SetAngles(0.0,180.0,0.0);
707   carbonfiberot[1]->SetAngles(90.,-fgkCarbonFiberTriangleAngle,-90.);
708   carbonfiberot[2]->SetRotation((*carbonfiberot[1])*(*carbonfiberot[0]));
709   Double_t transvector[3] = {fgkCarbonFiberTriangleLength
710                                                   *  CosD(fgkCarbonFiberTriangleAngle),0.,
711                                                   -  fgkCarbonFiberTriangleLength
712                                                   *      SinD(fgkCarbonFiberTriangleAngle)};
713   ///////////////////////////////////////////
714   //Setting Local Translations and Rotations: 
715   ///////////////////////////////////////////
716   TGeoCombiTrans* localcarbonfibersupportmatrix[3]; 
717   localcarbonfibersupportmatrix[0] = new TGeoCombiTrans(0.0,0.0,
718                                                                          0.5*carbonfibersupportheight,NULL);    
719   localcarbonfibersupportmatrix[1] = new TGeoCombiTrans(transvector[0],
720                                                                          2.*symmetryplaneposition+transvector[1],
721                                                                          transvector[2], carbonfiberot[2]);
722   localcarbonfibersupportmatrix[2] = new TGeoCombiTrans(*carbonfiberot[1]);
723   /////////////////////////////////////////////////////////////
724   // Carbon Fiber Support Transformations
725   /////////////////////////////////////////////////////////////
726   const Int_t kcarbonfibersupportmatrixnumber[2] = {2,3};
727   for(Int_t i=0; i<fgkcarbonfibersupportnumber; i++){ 
728                 fcarbonfibersupportmatrix[i] = new TGeoHMatrix();
729                 for(Int_t j=0; j<kcarbonfibersupportmatrixnumber[i]; j++)
730                         fcarbonfibersupportmatrix[i]->MultiplyLeft(localcarbonfibersupportmatrix[i==0?2*j:j]);
731   }             
732   /////////////////////////////////////////////////////////////
733   // Carbon Fiber Junction Transformation
734   /////////////////////////////////////////////////////////////
735   const Int_t kcarbonfiberjunctionmatrixnumber = 2;
736   TGeoCombiTrans** localcarbonfiberjunctionmatrix[fgkcarbonfiberjunctionumber];
737   TGeoRotation** localcarbonfiberjunctionrot[fgkcarbonfiberjunctionumber];
738   TGeoTranslation** localcarbonfiberjunctiontrans[fgkcarbonfiberjunctionumber];
739   for(Int_t i=0; i<fgkcarbonfiberjunctionumber; i++){ 
740         localcarbonfiberjunctionmatrix[i] = 
741                                                 new TGeoCombiTrans*[kcarbonfiberjunctionmatrixnumber];
742         localcarbonfiberjunctionrot[i] = 
743                                                 new TGeoRotation*[kcarbonfiberjunctionmatrixnumber];
744         localcarbonfiberjunctiontrans[i] = 
745                                                 new TGeoTranslation*[kcarbonfiberjunctionmatrixnumber];
746   }
747   ///////////////////////
748   // Setting Translations
749   ///////////////////////
750   localcarbonfiberjunctiontrans[0][0] = new TGeoTranslation(0.,0.,0.);
751   localcarbonfiberjunctiontrans[1][0] = 
752                                  new TGeoTranslation(fgkCarbonFiberTriangleLength,0.0,0.0);
753   localcarbonfiberjunctiontrans[2][0] = 
754                                  new TGeoTranslation(fgkCarbonFiberTriangleLength
755                                  * TMath::Cos(fgkCarbonFiberTriangleAngle*TMath::DegToRad()),
756                                  fgkCarbonFiberTriangleLength
757                                  * TMath::Sin(fgkCarbonFiberTriangleAngle*TMath::DegToRad()),0.0);
758   localcarbonfiberjunctiontrans[0][1] = 
759                                  new TGeoTranslation(0.0,0.5*fgkCarbonFiberJunctionWidth,0.0);
760   localcarbonfiberjunctiontrans[1][1] = 
761                                  new TGeoTranslation(*localcarbonfiberjunctiontrans[0][1]);
762   localcarbonfiberjunctiontrans[2][1] = 
763                                  new TGeoTranslation(*localcarbonfiberjunctiontrans[0][1]);
764   ////////////////////
765   // Setting Rotations
766   ////////////////////
767   for(Int_t i=0; i<fgkcarbonfiberjunctionumber; i++)
768                 for(Int_t j=0; j<kcarbonfiberjunctionmatrixnumber; j++)
769                         localcarbonfiberjunctionrot[i][j] = new TGeoRotation();
770   for(Int_t i=0; i<fgkcarbonfiberjunctionumber; i++)
771         localcarbonfiberjunctionrot[i][0]->SetAngles(120.*i,0.0,0.0);
772   localcarbonfiberjunctionrot[0][1]->SetAngles(0.0,90.0,0.0);
773   localcarbonfiberjunctionrot[1][1]->SetRotation(*localcarbonfiberjunctionrot[0][1]);
774   localcarbonfiberjunctionrot[2][1]->SetRotation(*localcarbonfiberjunctionrot[0][1]);
775   ////////////////////////////////////////
776   // Setting Carbon Fiber Junction matrix 
777   ////////////////////////////////////////
778   for(Int_t i=0; i<fgkcarbonfiberjunctionumber; i++){
779                 fcarbonfiberjunctionmatrix[i] = new TGeoHMatrix();
780                 for(Int_t j=0; j<kcarbonfiberjunctionmatrixnumber; j++){
781                         localcarbonfiberjunctionmatrix[i][j] = 
782                         new TGeoCombiTrans(*localcarbonfiberjunctiontrans[i][j],
783                                                            *localcarbonfiberjunctionrot[i][j]);
784                     fcarbonfiberjunctionmatrix[i]->MultiplyLeft(localcarbonfiberjunctionmatrix[i][j]);
785          }
786   }
787   /////////////////////////////////////////////////////////////
788   // Carbon Fiber Lower Support Transformations
789   /////////////////////////////////////////////////////////////
790   TGeoTranslation* localcarbonfiberlowersupportrans[2];
791   localcarbonfiberlowersupportrans[0] = new TGeoTranslation(0.0,
792                                                                          fgkCarbonFiberLowerSupportVolumePosition[1]
793                                                                 +    fgkCarbonFiberLowerSupportVolumePosition[0],
794                                                                          0.0);
795   localcarbonfiberlowersupportrans[1] = new TGeoTranslation(0.0,
796                                                                          fgkCarbonFiberJunctionWidth
797                                                                 -    fgkCarbonFiberLowerSupportWidth
798                                                                 -    fgkCarbonFiberLowerSupportVolumePosition[0]
799                                                                 -    fgkCarbonFiberLowerSupportVolumePosition[1],
800                                                                 -    0.5*fgkCarbonFiberLowerSupportHeight);
801    localcarbonfiberlowersupportrans[0]->Add(localcarbonfiberlowersupportrans[1]);
802    fcarbonfiberlowersupportrans[0] = 
803                                                 new TGeoTranslation(*localcarbonfiberlowersupportrans[0]);
804    fcarbonfiberlowersupportrans[1] = 
805                                                 new TGeoTranslation(*localcarbonfiberlowersupportrans[1]);
806   /////////////////////////////////////////////////////////////
807   // SSD Sensor Support Transformations
808   /////////////////////////////////////////////////////////////
809   const Int_t kssdsensorsupportmatrixnumber = 3;
810   TGeoCombiTrans** localssdsensorsupportmatrix[fgkssdsensorsupportnumber];
811   TGeoRotation** localssdsensorsupportrot[fgkssdsensorsupportnumber];
812   TGeoTranslation** localssdsensorsupportrans[fgkssdsensorsupportnumber];
813   for(Int_t i=0; i<fgkssdsensorsupportnumber; i++){ 
814         localssdsensorsupportmatrix[i] = 
815                                                 new TGeoCombiTrans*[kssdsensorsupportmatrixnumber];
816         localssdsensorsupportrot[i] = 
817                                                 new TGeoRotation*[kssdsensorsupportmatrixnumber];
818         localssdsensorsupportrans[i] = 
819                                                 new TGeoTranslation*[kssdsensorsupportmatrixnumber];
820   }
821   ///////////////////////
822   // Setting Translations
823   ///////////////////////
824   localssdsensorsupportrans[0][0] = new TGeoTranslation(0.0,
825                                                                           0.5*fgkSSDSensorSideSupportWidth,
826                                                                           0.0);
827   localssdsensorsupportrans[1][0] = 
828                                                  new TGeoTranslation(*localssdsensorsupportrans[0][0]);
829   localssdsensorsupportrans[2][0] = 
830                                                  new TGeoTranslation(*localssdsensorsupportrans[0][0]);
831   localssdsensorsupportrans[0][1] = 
832                                                  new TGeoTranslation(-0.5*fgkSSDSensorSideSupportWidth,
833                                                                                 0.5*fgkSSDSensorSideSupportThickness[0],
834                                                                                 0.0);
835   localssdsensorsupportrans[1][1] = 
836                                                  new TGeoTranslation(0.5*fgkSSDSensorSideSupportWidth,
837                                                                         -   0.5*fgkSSDSensorSideSupportThickness[0]
838                                                                     -   fgkSSDModuleSensorSupportDistance,
839                                                                                 0.0);
840   localssdsensorsupportrans[2][1] = 
841                                                  new TGeoTranslation(0.5*fgkSSDSensorCenterSupportThickness[0]
842                                                                         -    fgkSSDSensorCenterSupportPosition,
843                                                                                  0.5*fgkSSDSensorCenterSupportWidth
844                                                                         -    0.5*fgkSSDModuleSensorSupportDistance,
845                                                                                  fgkSSDSensorCenterSupportThickness[0]);
846   localssdsensorsupportrans[0][2] = 
847                                                  new TGeoTranslation(fgkCarbonFiberTriangleLength
848                                                                         +    fgkCarbonFiberJunctionToSensorSupport,
849                                                                                  fgkCarbonFiberJunctionWidth
850                                                                     -    0.5*(fgkCarbonFiberLowerSupportWidth
851                                                                         +    fgkSSDSensorCenterSupportLength
852                                                                         -    fgkSSDSensorCenterSupportThickness[0])
853                                                                         -    fgkSSDSensorCenterSupportPosition,
854                                                                              0.0);
855   localssdsensorsupportrans[1][2] = 
856                                                 new TGeoTranslation(*localssdsensorsupportrans[0][2]);
857   localssdsensorsupportrans[2][2] = 
858                                                 new TGeoTranslation(*localssdsensorsupportrans[0][2]);
859   ////////////////////
860   // Setting Rotations
861   ////////////////////
862   for(Int_t i=0; i<fgkssdsensorsupportnumber; i++)
863                 for(Int_t j=0; j<kssdsensorsupportmatrixnumber; j++)
864                         localssdsensorsupportrot[i][j] = new TGeoRotation();
865   for(Int_t i=0; i<fgkssdsensorsupportnumber; i++){
866         localssdsensorsupportrot[i][0]->SetAngles(0.0,90.0,0.0);
867         localssdsensorsupportrot[i][2]->SetAngles(-90.0,0.0,0.0);
868   }
869   localssdsensorsupportrot[0][1]->SetAngles(0.0,90.0,-90.0);
870   localssdsensorsupportrot[1][1]->SetAngles(180.0,90.0,-90.0);
871   localssdsensorsupportrot[2][1]->SetAngles(270.0,90.0,-90.0);
872   ////////////////////////////////////////
873   // SSD Sensor Support matrix 
874   ////////////////////////////////////////
875   for(Int_t i=0; i<fgkssdsensorsupportnumber; i++){
876                 fssdsensorsupportmatrix[i] = new TGeoHMatrix();
877                 for(Int_t j=0; j<kssdsensorsupportmatrixnumber; j++){
878                         localssdsensorsupportmatrix[i][j] = 
879                         new TGeoCombiTrans(*localssdsensorsupportrans[i][j],
880                                                            *localssdsensorsupportrot[i][j]);
881                     fssdsensorsupportmatrix[i]->MultiplyLeft(localssdsensorsupportmatrix[i][j]);
882          }
883   }
884   /////////////////////////////////////////////////////////////
885   // SSD Cooling Tube Support Transformations
886   /////////////////////////////////////////////////////////////
887   const Int_t kcoolingtubesupportmatrixnumber = 2;
888   TGeoCombiTrans* localcoolingtubesupportmatrix[kcoolingtubesupportmatrixnumber];
889   TGeoTranslation* localcoolingtubesupportrans[kcoolingtubesupportmatrixnumber];
890   TGeoRotation* localcoolingtubesupportrot[kcoolingtubesupportmatrixnumber];
891   Double_t phi = TMath::ASin(0.5*fgkCoolingTubeSupportHeight
892                                                                                                         /fgkCoolingTubeSupportRmax);
893   localcoolingtubesupportrans[0] = 
894                         new TGeoTranslation(2.*fgkCoolingTubeSupportRmax*TMath::Cos(phi)
895                                                 +  2.*(fgkCoolingTubeSupportLength
896                                                 -  fgkCoolingTubeSupportRmax*(1.+TMath::Cos(phi)))
897                                                 +  fgkCarbonFiberTriangleLength
898                                                 -  2.0*fgkCarbonFiberJunctionLength,0.0,0.0);
899   localcoolingtubesupportrans[1] = 
900                         new TGeoTranslation(fgkCarbonFiberJunctionLength
901                                         - (fgkCoolingTubeSupportLength-fgkCoolingTubeSupportRmax),
902                                         - (2.0*fgkSSDSensorLength-fgkSSDSensorOverlap)+
903                                                    fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
904                     +  0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
905                     -  0.5*(fgkCarbonFiberLowerSupportWidth
906                                         +          fgkSSDSensorCenterSupportLength
907                     -      fgkSSDSensorCenterSupportThickness[0])
908                                         +  0.5*fgkSSDSensorLength,
909                                         -  0.5*fgkCoolingTubeSupportHeight);  
910   for(Int_t i=0; i<kcoolingtubesupportmatrixnumber; i++)     
911   localcoolingtubesupportrot[i] = new TGeoRotation();
912   localcoolingtubesupportrot[0]->SetAngles(180.0,0.0,0.0);
913   localcoolingtubesupportrot[1]->SetAngles(0.0,90.0,0.0);
914   for(Int_t i=0; i<kcoolingtubesupportmatrixnumber; i++)
915         localcoolingtubesupportmatrix[i] = 
916                 new TGeoCombiTrans(*localcoolingtubesupportrans[i],
917                                                    *localcoolingtubesupportrot[i]);
918   fcoolingtubesupportmatrix[0] = new TGeoHMatrix(*localcoolingtubesupportmatrix[1]);
919   fcoolingtubesupportmatrix[1] = new TGeoHMatrix((*localcoolingtubesupportmatrix[1])*
920                                                                 (*localcoolingtubesupportmatrix[0]));
921   /////////////////////////////////////////////////////////////
922   // End Ladder SSD Cooling Tube Support Transformations
923   /////////////////////////////////////////////////////////////
924   TGeoTranslation** localendladdercooltubetrans[2];
925   localendladdercooltubetrans[0] = new TGeoTranslation*[4];
926   localendladdercooltubetrans[1] = new TGeoTranslation*[2];
927   for(Int_t i=0; i<4; i++) localendladdercooltubetrans[0][i] = new TGeoTranslation();
928   localendladdercooltubetrans[0][0]->SetTranslation(fgkCarbonFiberJunctionLength
929                                                                                         -          (fgkCoolingTubeSupportLength
930                                                                                         -               fgkCoolingTubeSupportRmax),
931                                                                                                         fgkEndLadderMountingBlockPosition[0]
932                                                                                         -               fgkendladdercoolingsupportdistance[0]
933                                                                                         +   0.5*fgkCoolingTubeSupportWidth,
934                                                                                         -   0.5*fgkCoolingTubeSupportHeight);
935   localendladdercooltubetrans[0][1]->SetTranslation(fgkCarbonFiberJunctionLength
936                                                                                         -          (fgkCoolingTubeSupportLength
937                                                                                         -               fgkCoolingTubeSupportRmax),
938                                                                                                         fgkEndLadderMountingBlockPosition[0]
939                                                                                         +               fgkendladdercoolingsupportdistance[1]
940                                                                                         +   0.5*fgkCoolingTubeSupportWidth,
941                                                                                         -   0.5*fgkCoolingTubeSupportHeight);
942   localendladdercooltubetrans[0][2]->SetTranslation(2*(fgkCoolingTubeSupportLength
943                                                                                         -       fgkCoolingTubeSupportRmax)
944                                                                                         +               fgkCarbonFiberTriangleLength
945                                                                                         -   2.0*fgkCarbonFiberJunctionLength,
946                                                                                                 0.0,
947                                                                                                 0.0);
948   localendladdercooltubetrans[0][3]->SetTranslation(0.0,
949                                                                                                         fgkendladdercoolingsupportdistance[0]
950                                                                                         +               fgkendladdercoolingsupportdistance[1],
951                                                                                                         0.0);
952   for(Int_t i=0; i<2; i++) localendladdercooltubetrans[1][i] = new TGeoTranslation();
953   localendladdercooltubetrans[1][0]->SetTranslation(fgkCoolingTubeSupportRmax
954                                                                                         +               fgkCarbonFiberJunctionLength
955                                                                                         -               fgkCoolingTubeSupportLength,
956                                                                                                         fgkEndLadderCarbonFiberLowerJunctionLength[1]
957                                                                                         -       0.5*fgkCoolingTubeSupportWidth
958                                                                                                    -fgkendladdercoolingsupportdistance[2],
959                                                                                         -   0.5*fgkCoolingTubeSupportHeight);
960   localendladdercooltubetrans[1][1]->SetTranslation(fgkCarbonFiberTriangleLength
961                                                                                         +               fgkCoolingTubeSupportLength
962                                                                                         -               fgkCoolingTubeSupportRmax
963                                                                                         -               fgkCarbonFiberJunctionLength,
964                                                                                                         fgkEndLadderCarbonFiberLowerJunctionLength[1]
965                                                                                         -       0.5*fgkCoolingTubeSupportWidth
966                                                                                         -               fgkendladdercoolingsupportdistance[2],
967                                                                                         -   0.5*fgkCoolingTubeSupportHeight);
968   fendladdercoolingtubesupportmatrix = new TGeoHMatrix**[kcoolingtubesupportmatrixnumber];
969   fendladdercoolingtubesupportmatrix[0] = new TGeoHMatrix*[4];
970   fendladdercoolingtubesupportmatrix[1] = new TGeoHMatrix*[2];
971   fendladdercoolingtubesupportmatrix[0][0] = new TGeoHMatrix((*localendladdercooltubetrans[0][0])*
972   (*localcoolingtubesupportrot[1]));
973   fendladdercoolingtubesupportmatrix[0][1] = new TGeoHMatrix((*localendladdercooltubetrans[0][1])*
974   (*localcoolingtubesupportrot[1]));
975   fendladdercoolingtubesupportmatrix[0][2] = new TGeoHMatrix(*fendladdercoolingtubesupportmatrix[0][0]);
976   fendladdercoolingtubesupportmatrix[0][2]->Multiply(localcoolingtubesupportrot[0]);
977   fendladdercoolingtubesupportmatrix[0][2]->MultiplyLeft(localendladdercooltubetrans[0][2]);
978   fendladdercoolingtubesupportmatrix[0][3] = new TGeoHMatrix(*fendladdercoolingtubesupportmatrix[0][2]);
979   fendladdercoolingtubesupportmatrix[0][3]->MultiplyLeft(localendladdercooltubetrans[0][3]);
980
981   fendladdercoolingtubesupportmatrix[1][0] =    
982                                                         new TGeoHMatrix((*localendladdercooltubetrans[1][0])
983                                                                                    *(*localcoolingtubesupportrot[1]));
984   fendladdercoolingtubesupportmatrix[1][1] = new TGeoHMatrix(*localcoolingtubesupportrot[1]);
985   fendladdercoolingtubesupportmatrix[1][1]->Multiply(localcoolingtubesupportrot[0]);
986   fendladdercoolingtubesupportmatrix[1][1]->MultiplyLeft(localendladdercooltubetrans[1][1]);
987   /////////////////////////////////////////////////////////////
988   // SSD Cooling Tube Transformations
989   /////////////////////////////////////////////////////////////
990   TGeoRotation* localcoolingtuberot = new TGeoRotation();       
991   localcoolingtuberot->SetAngles(0.,90.,0.);
992   TGeoTranslation** localcoolingtubetrans[4];
993   TVector3** localcoolingtubevect[4];
994   for(Int_t i=0; i<4; i++){
995         localcoolingtubevect[i] = new TVector3*[2];
996         localcoolingtubetrans[i] = new TGeoTranslation*[2];
997         fcoolingtubematrix[i] = new TGeoHMatrix*[2];
998   }
999   localcoolingtubevect[0][0] = new TVector3(-0.5*(fgkCoolingTubeSeparation
1000                                                   -fgkCarbonFiberTriangleLength),
1001                                                   - (2.0*fgkSSDSensorLength-fgkSSDSensorOverlap)+
1002                                                                  fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
1003                                                   +      0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
1004                                                   -      0.5*(fgkCarbonFiberLowerSupportWidth
1005                                                   +      fgkSSDSensorCenterSupportLength
1006                                                   -      fgkSSDSensorCenterSupportThickness[0])+
1007                                                          0.5*fgkSSDSensorLength-0.25*(fgkSSDSensorLength
1008                                                   -  2.0*fgkSSDModuleStiffenerPosition[1]
1009                                                   -      2.0*fgkSSDCoolingBlockWidth-fgkCoolingTubeSupportWidth)
1010                                                   -  0.5*fgkCoolingTubeSupportWidth,
1011                                                   -  0.5*fgkCoolingTubeSupportHeight);  
1012   localcoolingtubevect[0][1] = new TVector3(localcoolingtubevect[0][0]->X(),
1013                                                         localcoolingtubevect[0][0]->Y()+0.5*(fgkSSDSensorLength
1014                                                   -  2.0*fgkSSDModuleStiffenerPosition[1]
1015                                                   -      2.0*fgkSSDCoolingBlockWidth-fgkCoolingTubeSupportWidth)
1016                                                   +  fgkCoolingTubeSupportWidth,
1017                                                   localcoolingtubevect[0][0]->Z());     
1018   localcoolingtubevect[1][0] = new TVector3(-localcoolingtubevect[0][0]->X()
1019                                                          +                               fgkCarbonFiberTriangleLength,
1020                                                                                          localcoolingtubevect[0][0]->Y(),
1021                                                                                          localcoolingtubevect[0][0]->Z());
1022   localcoolingtubevect[1][1] = new TVector3(-localcoolingtubevect[0][1]->X()
1023                                                          +                               fgkCarbonFiberTriangleLength,
1024                                                                                          localcoolingtubevect[0][1]->Y(),
1025                                                                                          localcoolingtubevect[0][1]->Z());
1026   localcoolingtubevect[2][0] = new TVector3(-0.5*(fgkCoolingTubeSeparation
1027                                                   -     fgkCarbonFiberTriangleLength),
1028                                                   - (2.0*fgkSSDSensorLength-fgkSSDSensorOverlap)+
1029                                                                  fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
1030                                                   +      0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
1031                                                   -      0.5*(fgkCarbonFiberLowerSupportWidth
1032                                                   +      fgkSSDSensorCenterSupportLength
1033                                                   -      fgkSSDSensorCenterSupportThickness[0])
1034                                                   +  fgkSSDModuleStiffenerPosition[1]
1035                                                   -  0.5*(fgkSSDModuleStiffenerPosition[1]-fgkSSDSensorOverlap),
1036                                                   -  0.5*fgkCoolingTubeSupportHeight);  
1037   localcoolingtubevect[2][1] = new TVector3(-localcoolingtubevect[2][0]->X()
1038                                                          +                               fgkCarbonFiberTriangleLength,
1039                                                                                          localcoolingtubevect[2][0]->Y(),
1040                                                                                          localcoolingtubevect[2][0]->Z());      
1041   localcoolingtubevect[3][0] = new TVector3(-0.5*(fgkCoolingTubeSeparation
1042                                                   -     fgkCarbonFiberTriangleLength),
1043                                                   - (2.0*fgkSSDSensorLength-fgkSSDSensorOverlap)+
1044                                                                  fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
1045                                                   +      0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
1046                                                   -      0.5*(fgkCarbonFiberLowerSupportWidth
1047                                                   +      fgkSSDSensorCenterSupportLength
1048                                                   -      fgkSSDSensorCenterSupportThickness[0])
1049                                                   +      fgkSSDSensorLength
1050                                                   -      0.5*fgkSSDModuleStiffenerPosition[1],
1051                                                   -  0.5*fgkCoolingTubeSupportHeight);  
1052   localcoolingtubevect[3][1] = new TVector3(-localcoolingtubevect[3][0]->X()
1053                                                   + fgkCarbonFiberTriangleLength,
1054                                                         localcoolingtubevect[3][0]->Y(),
1055                                                   - 0.5*fgkCoolingTubeSupportHeight);   
1056   for(Int_t i=0; i<4; i++) 
1057         for(Int_t j=0; j<2; j++){
1058                 localcoolingtubetrans[i][j] = 
1059                         new TGeoTranslation(localcoolingtubevect[i][j]->X(),
1060                                                                 localcoolingtubevect[i][j]->Y(),
1061                                                                 localcoolingtubevect[i][j]->Z());
1062                 fcoolingtubematrix[i][j] = new TGeoHMatrix((*localcoolingtubetrans[i][j])
1063                                                           *                                     (*localcoolingtuberot));
1064         }
1065   /////////////////////////////////////////////////////////////
1066   // SSD End Ladder Cooling Tube Transformations
1067   /////////////////////////////////////////////////////////////
1068   TGeoRotation* localendlladdercoolingtuberot = new TGeoRotation();     
1069   localendlladdercoolingtuberot->SetAngles(0.,90.,0.);
1070   TGeoTranslation** localendlladdercoolingtubetrans[2];
1071   localendlladdercoolingtubetrans[0] = new TGeoTranslation*[6];
1072   localendlladdercoolingtubetrans[1] = new TGeoTranslation*[4];
1073   for(Int_t i=0; i<2; i++)      
1074         for(Int_t j=0; j<(i==0?6:4); j++)       
1075                 localendlladdercoolingtubetrans[i][j] = new TGeoTranslation();
1076   localendlladdercoolingtubetrans[0][0]->SetTranslation(-(fgkCoolingTubeSupportLength
1077                                                                         -        fgkCoolingTubeSupportRmax)
1078                                                                         +        fgkCarbonFiberJunctionLength,
1079                                                                           0.5*(fgkEndLadderMountingBlockPosition[0]
1080                                                                         -    fgkendladdercoolingsupportdistance[0]),
1081                                                                         - 0.5*fgkCoolingTubeSupportHeight);
1082   localendlladdercoolingtubetrans[0][1]->SetTranslation((fgkCoolingTubeSupportLength
1083                                                                         -        fgkCoolingTubeSupportRmax)
1084                                                                         -        fgkCarbonFiberJunctionLength
1085                                                                         +    fgkCarbonFiberTriangleLength,
1086                                                                           0.5*(fgkEndLadderMountingBlockPosition[0]
1087                                                                         -    fgkendladdercoolingsupportdistance[0]),
1088                                                                         - 0.5*fgkCoolingTubeSupportHeight);
1089   localendlladdercoolingtubetrans[0][2]->SetTranslation(-(fgkCoolingTubeSupportLength
1090                                                                         -   fgkCoolingTubeSupportRmax)
1091                                                                         +       fgkCarbonFiberJunctionLength,
1092                                                                            fgkEndLadderMountingBlockPosition[0]
1093                                                                         -   fgkendladdercoolingsupportdistance[0]
1094                                                   +                0.5*(fgkendladdercoolingsupportdistance[0]
1095                                                   +                             fgkendladdercoolingsupportdistance[1]
1096                                                   +                             fgkCoolingTubeSupportWidth),
1097                                                                         - 0.5*fgkCoolingTubeSupportHeight);     
1098   localendlladdercoolingtubetrans[0][3]->SetTranslation((fgkCoolingTubeSupportLength
1099                                                                         -        fgkCoolingTubeSupportRmax)
1100                                                                         -        fgkCarbonFiberJunctionLength
1101                                                                         +    fgkCarbonFiberTriangleLength,
1102                                                                            fgkEndLadderMountingBlockPosition[0]
1103                                                                         -   fgkendladdercoolingsupportdistance[0]
1104                                                   +                0.5*(fgkendladdercoolingsupportdistance[0]
1105                                                   +                             fgkendladdercoolingsupportdistance[1]
1106                                                   +                             fgkCoolingTubeSupportWidth),
1107                                                                         - 0.5*fgkCoolingTubeSupportHeight);     
1108   localendlladdercoolingtubetrans[0][4]->SetTranslation(-(fgkCoolingTubeSupportLength
1109                                                                         -   fgkCoolingTubeSupportRmax)
1110                                                                         +       fgkCarbonFiberJunctionLength,
1111                                                                         fgkEndLadderCarbonFiberLowerJunctionLength[0]
1112                                                   - 0.50 * (fgkEndLadderCarbonFiberLowerJunctionLength[0]
1113                                                   -                     fgkEndLadderMountingBlockPosition[0]
1114                                                   -                     fgkendladdercoolingsupportdistance[1]           
1115                                                   -                     fgkCoolingTubeSupportWidth),
1116                                                                         - 0.5*fgkCoolingTubeSupportHeight);      
1117   localendlladdercoolingtubetrans[0][5]->SetTranslation((fgkCoolingTubeSupportLength
1118                                                                         -        fgkCoolingTubeSupportRmax)
1119                                                                         -        fgkCarbonFiberJunctionLength
1120                                                                         +    fgkCarbonFiberTriangleLength,
1121                                                                         fgkEndLadderCarbonFiberLowerJunctionLength[0]
1122                                                   - 0.50 * (fgkEndLadderCarbonFiberLowerJunctionLength[0]
1123                                                   -                     fgkEndLadderMountingBlockPosition[0]
1124                                                   -                     fgkendladdercoolingsupportdistance[1]           
1125                                                   -                     fgkCoolingTubeSupportWidth),
1126                                                                         - 0.5*fgkCoolingTubeSupportHeight);      
1127   localendlladdercoolingtubetrans[1][0]->SetTranslation(-(fgkCoolingTubeSupportLength
1128                                                                         -   fgkCoolingTubeSupportRmax)
1129                                                                         +       fgkCarbonFiberJunctionLength,
1130                                                         - 0.50 * (fgkMountingBlockToSensorSupport
1131                                                         - 0.50 * (fgkSSDFlexHoleWidth-fgkSSDSensorSideSupportWidth)
1132                                                         -                 fgkSSDStiffenerWidth-fgkSSDModuleStiffenerPosition[1]
1133                                                         +                 fgkSSDSensorOverlap
1134                                                         +                 fgkEndLadderCarbonFiberLowerJunctionLength[1]
1135                                                         -                 fgkendladdercoolingsupportdistance[2]
1136                                                         -                 fgkEndLadderMountingBlockPosition[1]
1137                                                         -                 fgkCoolingTubeSupportWidth)
1138                                                         +                 fgkEndLadderCarbonFiberLowerJunctionLength[1]
1139                                                         -                 fgkendladdercoolingsupportdistance[2]
1140                                                         -                 fgkCoolingTubeSupportWidth,
1141                                                   -             0.5*fgkCoolingTubeSupportHeight);        
1142   localendlladdercoolingtubetrans[1][1]->SetTranslation((fgkCoolingTubeSupportLength
1143                                                   -      fgkCoolingTubeSupportRmax)
1144                                                   -      fgkCarbonFiberJunctionLength
1145                                                   +    fgkCarbonFiberTriangleLength,
1146                                                   - 0.50 * (fgkMountingBlockToSensorSupport
1147                                                         - 0.50 * (fgkSSDFlexHoleWidth-fgkSSDSensorSideSupportWidth)
1148                                                         -                 fgkSSDStiffenerWidth-fgkSSDModuleStiffenerPosition[1]
1149                                                         +                 fgkSSDSensorOverlap
1150                                                         +                 fgkEndLadderCarbonFiberLowerJunctionLength[1]
1151                                                         -                 fgkendladdercoolingsupportdistance[2]
1152                                                         -                 fgkEndLadderMountingBlockPosition[1]
1153                                                         -                 fgkCoolingTubeSupportWidth)
1154                                                         +                 fgkEndLadderCarbonFiberLowerJunctionLength[1]
1155                                                         -                 fgkendladdercoolingsupportdistance[2]
1156                                                         -                 fgkCoolingTubeSupportWidth,
1157                                                   -             0.5*fgkCoolingTubeSupportHeight);        
1158   localendlladdercoolingtubetrans[1][2]->SetTranslation(-(fgkCoolingTubeSupportLength
1159                                                                         -   fgkCoolingTubeSupportRmax)
1160                                                                         +       fgkCarbonFiberJunctionLength,
1161                                                                                 fgkEndLadderCarbonFiberLowerJunctionLength[1]
1162                                                                         - 0.5*fgkendladdercoolingsupportdistance[2],
1163                                                                         - 0.5*fgkCoolingTubeSupportHeight);      
1164   localendlladdercoolingtubetrans[1][3]->SetTranslation((fgkCoolingTubeSupportLength
1165                                                                         -        fgkCoolingTubeSupportRmax)
1166                                                                         -        fgkCarbonFiberJunctionLength
1167                                                                         +    fgkCarbonFiberTriangleLength,
1168                                                                                 fgkEndLadderCarbonFiberLowerJunctionLength[1]
1169                                                                         - 0.5*fgkendladdercoolingsupportdistance[2],
1170                                                                         - 0.5*fgkCoolingTubeSupportHeight);      
1171   fendladdercoolingtubematrix[0] = new TGeoHMatrix*[6]; 
1172   fendladdercoolingtubematrix[1] = new TGeoHMatrix*[4]; 
1173   for(Int_t i=0; i<2; i++)
1174         for(Int_t j=0; j<(i==0?6:4); j++){
1175                 fendladdercoolingtubematrix[i][j] = new TGeoHMatrix(*localendlladdercoolingtuberot);
1176                 fendladdercoolingtubematrix[i][j]->MultiplyLeft(localendlladdercoolingtubetrans[i][j]); 
1177         }
1178   /////////////////////////////////////////////////////////////
1179   // SSD Hybrid Components Transformations
1180   /////////////////////////////////////////////////////////////
1181   const Int_t khybridmatrixnumber = 3;
1182   TGeoTranslation* localhybridtrans[khybridmatrixnumber];
1183   localhybridtrans[0] = new TGeoTranslation(0.5*fgkSSDStiffenerLength,
1184                                             0.5*fgkSSDStiffenerWidth,
1185                                             0.5*fgkSSDStiffenerHeight);
1186   localhybridtrans[1] = new TGeoTranslation(fgkSSDModuleStiffenerPosition[0],
1187                                             fgkSSDModuleStiffenerPosition[1],0.0);
1188
1189   localhybridtrans[2] = new TGeoTranslation(
1190                       -  0.5*(fgkSSDSensorWidth-fgkCarbonFiberTriangleLength),
1191                       -      (2.*fgkSSDSensorLength-fgkSSDSensorOverlap)+
1192                               fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
1193                       +         0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
1194                       -         0.5*(fgkCarbonFiberLowerSupportWidth+fgkSSDSensorCenterSupportLength
1195                       -       fgkSSDSensorCenterSupportThickness[0]),
1196                       -      (fgkSSDModuleCoolingBlockToSensor+0.5*fgkCoolingTubeSupportHeight
1197                       -       fgkSSDSensorHeight-fgkSSDChipCablesHeight[3]-fgkSSDChipHeight
1198                                           -       fgkSSDModuleVerticalDisalignment)); 
1199   fhybridmatrix = new TGeoHMatrix();
1200   for(Int_t i=0; i<khybridmatrixnumber; i++) fhybridmatrix->MultiplyLeft(localhybridtrans[i]);
1201   /////////////////////////////////////////////////////////////
1202   // SSD Cooling Block Transformations
1203   /////////////////////////////////////////////////////////////
1204   const Int_t kcoolingblockmatrixnumber = 4;    
1205   TGeoTranslation* localcoolingblocktrans[kcoolingblockmatrixnumber];
1206   localcoolingblocktrans[0] = new TGeoTranslation(-2.*(fgkCoolingTubeSupportRmax
1207                             -  fgkCoolingTubeSupportRmin),0.0,
1208                                0.5*(fgkSSDCoolingBlockHoleCenter+fgkCoolingTubeRmax));
1209   localcoolingblocktrans[1] = new TGeoTranslation(0.5*fgkSSDStiffenerLength
1210                             -  0.5*fgkSSDModuleSensorSupportDistance-fgkSSDCoolingBlockLength,
1211                                0.0,fgkSSDStiffenerHeight);
1212   localcoolingblocktrans[2] = new TGeoTranslation(*localhybridtrans[1]);
1213   localcoolingblocktrans[3] = new TGeoTranslation(*localhybridtrans[2]);
1214   fcoolingblocksystematrix = new TGeoHMatrix();
1215   for(Int_t i=0; i<kcoolingblockmatrixnumber; i++)
1216       fcoolingblocksystematrix->MultiplyLeft(localcoolingblocktrans[i]);
1217   /////////////////////////////////////////////////////////////
1218   // SSD Stiffener Flex Transformations
1219   /////////////////////////////////////////////////////////////
1220   const Int_t klocalflexmatrixnumber = 4;
1221   TGeoCombiTrans** localflexmatrix[fgkflexnumber];
1222   for(Int_t i=0; i<fgkflexnumber; i++)    
1223       localflexmatrix[i] = new TGeoCombiTrans*[klocalflexmatrixnumber];
1224   for(Int_t i=0; i<fgkflexnumber; i++)
1225       for(Int_t j =0; j<klocalflexmatrixnumber; j++) 
1226             localflexmatrix[i][j] = new TGeoCombiTrans();
1227   Double_t ssdstiffenerseparation = fgkSSDSensorLength
1228                                                                   - 2.*fgkSSDModuleStiffenerPosition[1]
1229                                                                   -    fgkSSDStiffenerWidth;
1230   localflexmatrix[0][0]->SetTranslation(-fgkSSDFlexLength[0]
1231                                         +0.5*fgkSSDStiffenerLength,
1232                                          0.5*fgkSSDStiffenerWidth,
1233                                         -0.5*fgkSSDStiffenerHeight
1234                                         -0.5*fgkSSDFlexHeight[0]);
1235   localflexmatrix[1][0]->SetTranslation(-(fgkSSDStiffenerLength-fgkSSDFlexLength[0])
1236                                         +0.5*fgkSSDStiffenerLength,ssdstiffenerseparation
1237                                         -0.5*fgkSSDStiffenerWidth,
1238                                         -0.5*fgkSSDStiffenerHeight
1239                                         -0.5*fgkSSDFlexHeight[0]);
1240   TGeoRotation* localflexrot = new TGeoRotation();
1241   localflexrot->SetAngles(180.,0.,0.);    
1242   localflexmatrix[1][0]->SetRotation(localflexrot);
1243   for(Int_t i=0; i<fgkflexnumber; i++)
1244       for(Int_t j =1; j<klocalflexmatrixnumber; j++) 
1245             localflexmatrix[i][j]->SetTranslation(*localhybridtrans[j-1]);
1246   for(Int_t i=0; i<fgkflexnumber; i++){
1247       fstiffenerflexmatrix[i] = new TGeoHMatrix();
1248       for(Int_t j =0; j<klocalflexmatrixnumber; j++)   
1249             fstiffenerflexmatrix[i]->MultiplyLeft(localflexmatrix[i][j]);
1250   }
1251   /////////////////////////////////////////////////////////////
1252   // SSD End Flex Transformations
1253   /////////////////////////////////////////////////////////////
1254   TGeoRotation* localendflexrot = new TGeoRotation();
1255   localendflexrot->SetAngles(0.0,90.0,0.0);
1256   TGeoCombiTrans* localendflexmatrix = new TGeoCombiTrans();
1257   Double_t ssdflexradiusmax = (fgkSSDFlexLength[3]-fgkSSDFlexLength[2])
1258                             /  TMath::Tan(fgkSSDFlexAngle*TMath::DegToRad());
1259   Double_t ssdflexboxlength = fgkSSDFlexFullLength-2.*fgkSSDFlexAngle
1260                             * TMath::DegToRad()*ssdflexradiusmax
1261                                                                - fgkSSDFlexLength[2]-TMath::Pi()
1262                                                                * fgkSSDStiffenerHeight-fgkSSDFlexLength[0]
1263                                                                                    - 0.1*fgkSSDFlexFullLength;
1264   Double_t trans = ssdflexboxlength*CosD(2.*fgkSSDFlexAngle)
1265                             + (ssdflexradiusmax-fgkSSDStiffenerHeight)*SinD(2.*fgkSSDFlexAngle)
1266                             +      fgkSSDFlexLength[2];
1267   localendflexmatrix->SetTranslation(fgkSSDFlexLength[0]-trans,
1268                               0.5*fgkSSDFlexWidth[0],
1269                               2.*fgkSSDStiffenerHeight
1270                             + 0.5*fgkSSDFlexHeight[0]);      
1271   localendflexmatrix->SetRotation(localendflexrot);
1272   for(Int_t i=0; i<fgkflexnumber; i++) 
1273       fendflexmatrix[i] = new TGeoHMatrix((*fstiffenerflexmatrix[i])*(*localendflexmatrix));
1274   /////////////////////////////////////////////////////////////
1275   // End Ladder Carbon Fiber Junction
1276   /////////////////////////////////////////////////////////////
1277   TGeoCombiTrans** localendladdercarbonfiberjunctionmatrix[fgkendlabbercarbonfiberjunctionumber];
1278   TGeoRotation** localendladdercarbonfiberjunctionrot[fgkendlabbercarbonfiberjunctionumber];    
1279   TGeoTranslation** localendladdercarbonfiberjunctiontrans[fgkendlabbercarbonfiberjunctionumber];    
1280   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++){
1281       localendladdercarbonfiberjunctionmatrix[i] 
1282             = new TGeoCombiTrans*[fgkendladdercabonfiberjunctionmatrixnumber];
1283       localendladdercarbonfiberjunctionrot[i] 
1284             = new TGeoRotation*[fgkendladdercabonfiberjunctionmatrixnumber];
1285       localendladdercarbonfiberjunctiontrans[i] 
1286             = new TGeoTranslation*[fgkendladdercabonfiberjunctionmatrixnumber];
1287       fendladdercarbonfiberjunctionmatrix[i]
1288             = new TGeoHMatrix*[fgkendladdercabonfiberjunctionmatrixnumber];
1289   }
1290   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++)    
1291       for(Int_t j=0; j<fgkendladdercabonfiberjunctionmatrixnumber; j++){
1292             localendladdercarbonfiberjunctionrot[i][j] = new TGeoRotation();
1293             localendladdercarbonfiberjunctiontrans[i][j] = new TGeoTranslation();
1294       }
1295   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++)     
1296       for(Int_t j=0; j<fgkendladdercabonfiberjunctionmatrixnumber; j++)
1297           localendladdercarbonfiberjunctionrot[i][j]->SetAngles(120.*j,0.,0.);
1298   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++){
1299       localendladdercarbonfiberjunctiontrans[i][1]->SetTranslation(fgkCarbonFiberTriangleLength,
1300                               0.0,0.0);
1301       localendladdercarbonfiberjunctiontrans[i][2]->SetTranslation(fgkCarbonFiberTriangleLength
1302                 *                     CosD(fgkCarbonFiberTriangleAngle),fgkCarbonFiberTriangleLength
1303                 *                     SinD(fgkCarbonFiberTriangleAngle),
1304                         0.5*(fgkEndLadderCarbonFiberLowerJunctionLength[i]
1305   -                          fgkEndLadderCarbonFiberUpperJunctionLength[i]));
1306   }
1307   TGeoCombiTrans* localendladdercarbonfiberjunctionglobalmatrix[fgkendlabbercarbonfiberjunctionumber];
1308   TGeoRotation* localendladdercarbonfiberjunctionglobalrot[fgkendlabbercarbonfiberjunctionumber];
1309   TGeoTranslation* localendladdercarbonfiberjunctionglobaltrans[fgkendlabbercarbonfiberjunctionumber];
1310   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++){
1311       localendladdercarbonfiberjunctionglobalrot[i] = new TGeoRotation();
1312       localendladdercarbonfiberjunctionglobaltrans[i] = new TGeoTranslation();
1313       localendladdercarbonfiberjunctionglobalrot[i]->SetAngles(0.0,90.0,0.0);
1314       localendladdercarbonfiberjunctionglobaltrans[i]->SetTranslation(0.0,
1315             0.5*fgkEndLadderCarbonFiberLowerJunctionLength[i],0.0);
1316       localendladdercarbonfiberjunctionglobalmatrix[i] = 
1317             new TGeoCombiTrans(*localendladdercarbonfiberjunctionglobaltrans[i],
1318                                *localendladdercarbonfiberjunctionglobalrot[i]);
1319   }
1320   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++)    
1321       for(Int_t j=0; j<fgkendladdercabonfiberjunctionmatrixnumber; j++){
1322             localendladdercarbonfiberjunctionmatrix[i][j] = 
1323                   new TGeoCombiTrans(*localendladdercarbonfiberjunctiontrans[i][j],
1324                                      *localendladdercarbonfiberjunctionrot[i][j]);
1325            fendladdercarbonfiberjunctionmatrix[i][j] =
1326             new TGeoHMatrix((*localendladdercarbonfiberjunctionglobalmatrix[i])
1327             *               (*localendladdercarbonfiberjunctionmatrix[i][j])); 
1328       }  
1329   /////////////////////////////////////////////////////////////
1330   // End Ladder Carbon Fiber Support
1331   /////////////////////////////////////////////////////////////
1332   TGeoTranslation* localendladdercarbonfibertrans[fgkendladdercarbonfibermatrixnumber];
1333   for(Int_t i=0; i<fgkendladdercarbonfibermatrixnumber; i++){
1334       localendladdercarbonfibertrans[i] = new TGeoTranslation();
1335       localendladdercarbonfibertrans[i]->SetTranslation(0.0,
1336             i==0 ? 0.0 :fgkCarbonFiberLowerSupportWidth,0.0);
1337       fendladdercarbonfibermatrix[i] = new TGeoHMatrix*[fgkcarbonfibersupportnumber];
1338   }
1339   for(Int_t i=0; i<fgkendladdercarbonfibermatrixnumber; i++)
1340       for(Int_t j=0; j<fgkcarbonfibersupportnumber; j++)
1341             fendladdercarbonfibermatrix[i][j] = 
1342             new TGeoHMatrix((*localendladdercarbonfibertrans[i])
1343             *(*fcarbonfibersupportmatrix[j]));
1344   /////////////////////////////////////////////////////////////
1345   // End Ladder SSD Mounting Block
1346   /////////////////////////////////////////////////////////////
1347   for(Int_t i=0; i<fgkendladdermountingblocknumber; i++)
1348       fendladdermountingblockcombitrans[i] = new TGeoCombiTrans();
1349   for(Int_t i=0; i<fgkendladdermountingblocknumber; i++)
1350       fendladdermountingblockcombitrans[i]->SetTranslation(-  0.25*(fgkSSDMountingBlockLength[0]
1351                                 +        fgkSSDMountingBlockLength[1])
1352                                 +  0.5*fgkCarbonFiberTriangleLength,
1353                                 fgkEndLadderMountingBlockPosition[i],
1354                                 -  fgkSSDMountingBlockHeight[1]
1355                                 +  0.5*fgkSSDMountingBlockHeight[0]);
1356   TGeoRotation* endladdermountingblockrot = new TGeoRotation();
1357   endladdermountingblockrot->SetAngles(0.,90.,0.);
1358   for(Int_t i=0; i<fgkendladdermountingblocknumber; i++)
1359         fendladdermountingblockcombitrans[i]->SetRotation(*endladdermountingblockrot);
1360   /////////////////////////////////////////////////////////////
1361   // End Ladder SSD Mounting Block Clip Matrix 
1362   /////////////////////////////////////////////////////////////
1363   for(Int_t i=0; i<fgkendladdermountingblocknumber; i++) 
1364         fendladdermountingblockclipmatrix[i] = new TGeoHMatrix*[2];
1365   
1366   TGeoRotation* localendladdercliprot = new TGeoRotation();
1367   TGeoTranslation* localendladdercliptrans = new TGeoTranslation();
1368   localendladdercliptrans->SetTranslation(-0.5*(fgkSSDMountingBlockLength[0]
1369                                                                                   -     fgkSSDMountingBlockLength[1])
1370                                                                                   + fgkSSDMountingBlockLength[0],0.,0.);
1371   localendladdercliprot->SetAngles(90.,180.,-90.);
1372   TGeoCombiTrans* localendladderclipcombitrans = 
1373                         new TGeoCombiTrans(*localendladdercliptrans,*localendladdercliprot);
1374   for(Int_t i=0; i<fgkendladdermountingblocknumber; i++)
1375         for(Int_t j=0; j<2; j++){
1376                 fendladdermountingblockclipmatrix[i][j] = 
1377                                                 new TGeoHMatrix(*fendladdermountingblockcombitrans[i]);
1378                 if(j!=0) fendladdermountingblockclipmatrix[i][j]->Multiply(localendladderclipcombitrans);
1379         }
1380   /////////////////////////////////////////////////////////////
1381   // End Ladder Carbon Fiber Lower Support
1382   /////////////////////////////////////////////////////////////
1383   for(Int_t i=0; i<fgkendladderlowersuppnumber; i++)
1384       fendladderlowersupptrans[i] = 
1385             new TGeoTranslation(0.0,(1-i)*(fgkEndLadderMountingBlockPosition[i]
1386                         +  0.5*fgkSSDMountingBlockWidth),
1387                         -  0.5*fgkCarbonFiberLowerSupportHeight);
1388   fendladderlowersupptrans[2] = new TGeoTranslation(0.0,
1389                                                                          fgkCarbonFiberLowerSupportVolumePosition[1]
1390                                                                 +    fgkCarbonFiberLowerSupportVolumePosition[0],
1391                                                                          0.0);
1392   fendladderlowersupptrans[2]->Add(fendladderlowersupptrans[1]);
1393  /////////////////////////////////////////////////////////////
1394   // Matrix for positioning Ladder into mother volume
1395   /////////////////////////////////////////////////////////////
1396   TGeoHMatrix** ladderglobalmatrix[fgkladdernumber];
1397   for(Int_t i=0; i<fgkladdernumber; i++) 
1398         ladderglobalmatrix[i] = new TGeoHMatrix*[fgkladdernumber];
1399   TGeoRotation* localladdermotherrot = new TGeoRotation();
1400   localladdermotherrot->SetAngles(0.,90.,0.);  
1401   TGeoTranslation* localladdermothertrans[fgkladdernumber];
1402   TGeoCombiTrans* localladdermothercombitrans[fgkladdernumber];
1403   for(Int_t i=0; i<fgkladdernumber; i++){
1404         localladdermothertrans[i] = new TGeoTranslation(0.,
1405                                                           - fgkEndLadderCarbonFiberLowerJunctionLength[1]
1406                                                           + fgkEndLadderCarbonFiberLowerJunctionLength[0]
1407                                                           + (i==0?fgkSSDLay5SensorsNumber:fgkSSDLay6SensorsNumber)
1408                                                           * fgkCarbonFiberJunctionWidth,0.);
1409         localladdermothercombitrans[i] = new TGeoCombiTrans(*localladdermothertrans[i],
1410                                                                                                                 *localladdermotherrot);
1411         ladderglobalmatrix[0][i] = new TGeoHMatrix(*localladdermothercombitrans[i]);
1412         ladderglobalmatrix[1][i] = new TGeoHMatrix(ladderglobalmatrix[0][i]->Inverse());
1413   }
1414   /////////////////////////////////////////////////////////////
1415   // Ladder Cables Matrices
1416   /////////////////////////////////////////////////////////////
1417   Double_t ssdflexradius = fgkSSDStiffenerHeight+2*fgkSSDFlexHeight[0]
1418                                              + fgkSSDFlexHeight[1];  
1419   Double_t ssdladdercabletransx[3];
1420   ssdladdercabletransx[0] = (ssdflexradiusmax-fgkSSDFlexHeight[1]-ssdflexradius)
1421                                                   *   SinD(2.*fgkSSDFlexAngle)
1422                                                   *       CosD(2.*fgkSSDFlexAngle);
1423   ssdladdercabletransx[1] = ((ssdflexradiusmax-fgkSSDFlexHeight[1]-ssdflexradius)
1424                                                   -     ssdladdercabletransx[0]
1425                                                   /     SinD(2.*fgkSSDFlexAngle))
1426                                                   *     CosD(fgkSSDFlexAngle);                                          
1427   ssdladdercabletransx[2] = (fgkSSDFlexFullLength-2.*fgkSSDFlexAngle
1428                                                   *       TMath::DegToRad()*ssdflexradiusmax
1429                                                   -     fgkSSDFlexLength[2]-TMath::Pi()
1430                                                   *       fgkSSDStiffenerHeight-fgkSSDFlexLength[0]
1431                                                   -       fgkSSDLadderCableWidth)
1432                                                   *       CosD(2.*fgkSSDFlexAngle);
1433   Double_t ssdladdercabletransz[3] = {ssdladdercabletransx[0]
1434                                                   *     TanD(2.*fgkSSDFlexAngle),
1435                                                         ssdladdercabletransx[1]
1436                                                   *     TanD(fgkSSDFlexAngle),
1437                                                         ssdladdercabletransx[2]
1438                                                   *     TanD(2.*fgkSSDFlexAngle)};      
1439   TGeoRotation* localladdercablerot[3]; 
1440   for(Int_t i=0; i<3; i++) localladdercablerot[i] = new TGeoRotation();
1441   localladdercablerot[0]->SetAngles(90.,0.,0.);
1442   localladdercablerot[1]->SetAngles(90.,60.,-90.);
1443   localladdercablerot[2]->SetRotation((*localladdercablerot[1])
1444                                                  *                        (*localladdercablerot[0]));
1445   ////////////////////////////////////////////
1446   // LocalLadderCableCombiTransMatrix
1447   ////////////////////////////////////////////
1448   const Int_t klocalladdersidecablesnumber = 2;
1449   const Int_t klocalladdercombitransnumber = 5;
1450   TGeoCombiTrans** localladdercablecombitransmatrix[klocalladdersidecablesnumber];
1451   for(Int_t i=0; i<klocalladdersidecablesnumber; i++) 
1452          localladdercablecombitransmatrix[i] = 
1453                                                            new TGeoCombiTrans*[klocalladdercombitransnumber];
1454   ///////////////////////////////////////////
1455   // Left Side Ladder Cables Transformations
1456   ///////////////////////////////////////////
1457   localladdercablecombitransmatrix[0][0]  =
1458                                                 new TGeoCombiTrans(-0.5*fgkCarbonFiberTriangleLength,
1459                                                 0.,0.,NULL);
1460   localladdercablecombitransmatrix[0][1] = 
1461         new TGeoCombiTrans(-0.5*(fgkSSDSensorWidth-fgkCarbonFiberTriangleLength),
1462                                            - (2.*fgkSSDSensorLength-fgkSSDSensorOverlap)+
1463                                                  fgkSSDModuleStiffenerPosition[1]+fgkSSDStiffenerWidth
1464                                            + 0.5*fgkSSDFlexHoleLength+2.*fgkCarbonFiberJunctionWidth
1465                                            - 0.5*(fgkCarbonFiberLowerSupportWidth
1466                                            + fgkSSDSensorCenterSupportLength
1467                                            - fgkSSDSensorCenterSupportThickness[0]),
1468                                            - (fgkSSDModuleCoolingBlockToSensor
1469                                            + 0.5*fgkCoolingTubeSupportHeight
1470                                            - fgkSSDSensorHeight-fgkSSDChipCablesHeight[3]
1471                                            - fgkSSDChipHeight),NULL);
1472   localladdercablecombitransmatrix[0][2] = 
1473                                                 new TGeoCombiTrans(fgkSSDModuleStiffenerPosition[0],
1474                                                                                    fgkSSDModuleStiffenerPosition[1],0.,0);
1475   localladdercablecombitransmatrix[0][3] = new TGeoCombiTrans(
1476                                         0.5*(fgkSSDStiffenerLength+fgkSSDChipNumber*fgkSSDChipLength
1477                                    +(fgkSSDChipNumber-1)*fgkSSDChipSeparationLength),
1478                                    fgkSSDSensorLength-2.*fgkSSDModuleStiffenerPosition[1]
1479                                          - fgkSSDStiffenerWidth,- 0.5*fgkSSDChipHeight,
1480                                                                                                 new TGeoRotation("",180.,0.,0.));
1481   localladdercablecombitransmatrix[0][4] = 
1482                                                 new TGeoCombiTrans(-ssdladdercabletransx[0]
1483                                                 -     ssdladdercabletransx[1]-ssdladdercabletransx[2]
1484                                                 +     fgkSSDFlexLength[0]-fgkSSDFlexLength[2],
1485                                                           0.,
1486                                                           0.5*fgkSSDFlexHeight[0]+2.*(fgkSSDFlexHeight[0]
1487                                                 +         fgkSSDFlexHeight[1])+2.*fgkSSDStiffenerHeight
1488                                                 +     ssdladdercabletransz[0]-ssdladdercabletransz[1]
1489                                                 +         ssdladdercabletransz[2],localladdercablerot[2]);
1490   ///////////////////////////////////////////
1491   // Rigth Side Ladder Cables Transformations
1492   ///////////////////////////////////////////
1493   TGeoCombiTrans* localladdercablessdmodulematrix = 
1494         new TGeoCombiTrans(0.5*(fgkSSDStiffenerLength-fgkSSDChipNumber*fgkSSDChipLength
1495                                                                   - (fgkSSDChipNumber-1)*fgkSSDChipSeparationLength),
1496                                                                          fgkSSDStiffenerWidth,
1497                                                                   - 0.5*fgkSSDFlexHeight[0],NULL);
1498   for(Int_t i=0; i<klocalladdercombitransnumber; i++)
1499    localladdercablecombitransmatrix[1][i] = 
1500                         (i!=3 ? new TGeoCombiTrans(*localladdercablecombitransmatrix[0][i]):
1501                                         new TGeoCombiTrans(*localladdercablessdmodulematrix));  
1502   ///////////////////////////////////////////
1503   // Setting LadderCableHMatrix
1504   ///////////////////////////////////////////
1505   Int_t beamaxistrans[2][3];
1506   beamaxistrans[0][0] = fgkSSDLay5SensorsNumber/2; 
1507   beamaxistrans[0][1] = beamaxistrans[0][0]+1;
1508   beamaxistrans[0][2] = beamaxistrans[0][0]-1;
1509   beamaxistrans[1][0] = (fgkSSDLay6SensorsNumber-1)/2;
1510   beamaxistrans[1][1] = beamaxistrans[1][0]+1;
1511   beamaxistrans[1][2] = beamaxistrans[1][0];
1512   TGeoHMatrix** localladdercablehmatrix[fgkladdercablesnumber];
1513   TGeoRotation* laddercablerot = new TGeoRotation();
1514   TGeoTranslation* laddercabletrans = new TGeoTranslation();
1515   TGeoCombiTrans* laddercablecombitrans = new TGeoCombiTrans();
1516   Double_t* laddercabletransvector;     
1517   for(Int_t i=0; i<fgkladdercablesnumber; i++){ 
1518         localladdercablehmatrix[i] = new TGeoHMatrix*[klocalladdersidecablesnumber];
1519         fladdercablematrix[i] = new TGeoHMatrix*[fgkladdercablematrixnumber];
1520   }
1521   for(Int_t i=0; i<fgkladdercablesnumber; i++){
1522         for(Int_t j=0; j<klocalladdersidecablesnumber; j++){
1523                 localladdercablehmatrix[i][j] = new TGeoHMatrix();
1524                 for(Int_t k=0; k<klocalladdercombitransnumber; k++){
1525                         localladdercablehmatrix[i][j]->MultiplyLeft(
1526                         localladdercablecombitransmatrix[j][klocalladdercombitransnumber-k-1]);
1527         }
1528                 laddercablerot->SetMatrix(localladdercablehmatrix[i][j]->GetRotationMatrix());
1529                 laddercabletransvector = localladdercablehmatrix[i][j]->GetTranslation();
1530                 laddercabletrans->SetTranslation(laddercabletransvector[0],
1531                                                                          laddercabletransvector[1]
1532                                         +                (j==0 ? beamaxistrans[i][0] : 0.)
1533                                         *                                fgkCarbonFiberJunctionWidth,
1534                                                                          laddercabletransvector[2]);
1535                 laddercablecombitrans->SetRotation(*laddercablerot);
1536                 laddercablecombitrans->SetTranslation(*laddercabletrans);       
1537                 fladdercablematrix[i][j] = new TGeoHMatrix(*laddercablecombitrans);
1538         }
1539     fladdercablematrix[i][2] = 
1540                                         AddTranslationToHMatrix(fladdercablematrix[i][1],0.,
1541                                         beamaxistrans[i][1]*fgkCarbonFiberJunctionWidth,0.);
1542         fladdercablematrix[i][3] = 
1543                                         AddTranslationToHMatrix(fladdercablematrix[i][0],0.,
1544                                         beamaxistrans[i][2]*fgkCarbonFiberJunctionWidth,0.);
1545   }
1546   for(Int_t i=0; i<fgkladdercablesnumber; i++)
1547         for(Int_t j=0; j<klocalladdercombitransnumber-1; j++)
1548                 fladdercablematrix[i][j]->MultiplyLeft(ladderglobalmatrix[1][i]);
1549   ///////////////////////////////////////////
1550   // Setting Ladder HMatrix
1551   ///////////////////////////////////////////
1552   Int_t ssdlaysensorsnumber[fgkladdernumber] = {fgkSSDLay5SensorsNumber,
1553                                                                                                 fgkSSDLay6SensorsNumber};
1554   for(Int_t i=0; i<fgkladdernumber; i++){
1555         fladdermatrix[i] = new TGeoHMatrix*[ssdlaysensorsnumber[i]];
1556         for(Int_t j=0; j<ssdlaysensorsnumber[i]; j++){
1557                 fladdermatrix[i][j] = new TGeoHMatrix();
1558                 fladdermatrix[i][j]->SetDx(-0.5*fgkCarbonFiberTriangleLength);
1559                 fladdermatrix[i][j]->SetDy(fgkCarbonFiberJunctionWidth*j);
1560                 fladdermatrix[i][j]->MultiplyLeft(ladderglobalmatrix[1][i]);
1561         }
1562   }
1563   ///////////////////////////////////////////
1564   // Setting SSD Sensor Matrix 
1565   ///////////////////////////////////////////
1566   TGeoCombiTrans* localssdsensorcombitrans[2];
1567   TGeoRotation* localssdsensorrot = new TGeoRotation(); 
1568   localssdsensorrot->SetAngles(0.,90.,0.);      
1569   TGeoTranslation* localssdsensortrans[2];
1570   for(Int_t i=0; i<2; i++) localssdsensortrans[i] = new TGeoTranslation();
1571   localssdsensortrans[0]->SetTranslation(0.5*fgkCarbonFiberTriangleLength,
1572                                          fgkCarbonFiberJunctionWidth 
1573                                          - fgkCarbonFiberLowerSupportWidth 
1574                                          - fgkLowerSupportToSensorZ,
1575                                                         0.5*fgkSSDSensorHeight-0.5*fgkCoolingTubeSupportHeight
1576                                           -             fgkSSDModuleCoolingBlockToSensor
1577                                           +    (fgkSSDSensorSideSupportHeight[1]
1578                                           -             fgkSSDSensorSideSupportHeight[0]));
1579   localssdsensortrans[1]->SetTranslation(0.5*fgkCarbonFiberTriangleLength,
1580                                          fgkCarbonFiberJunctionWidth 
1581                                          - fgkCarbonFiberLowerSupportWidth 
1582                                          - fgkLowerSupportToSensorZ,
1583                                                     0.5*fgkSSDSensorHeight-0.5*fgkCoolingTubeSupportHeight
1584                                                         -fgkSSDModuleCoolingBlockToSensor);
1585   for(Int_t i=0; i<2; i++) 
1586         localssdsensorcombitrans[i] = new TGeoCombiTrans(*localssdsensortrans[i],
1587                                                                                                          *localssdsensorrot);   
1588     for(Int_t i=0; i<fgkladdernumber; i++){
1589         fssdsensormatrix[i] = new TGeoHMatrix*[ssdlaysensorsnumber[i]];
1590         for(Int_t j=0; j<ssdlaysensorsnumber[i]; j++){
1591                 switch(i){
1592                         case 0: //Ladder of Layer5  
1593                         fssdsensormatrix[i][j] = new TGeoHMatrix((*fladdermatrix[i][j])
1594                                                                    * ((j%2==0 ? *localssdsensorcombitrans[0] :
1595                                                                                                 *localssdsensorcombitrans[1])));
1596                         break;
1597                         case 1: //Ladder of Layer6 
1598                         fssdsensormatrix[i][j] = new TGeoHMatrix((*fladdermatrix[i][j])
1599                                                                    * ((j%2==0 ? *localssdsensorcombitrans[1] :
1600                                                                                                 *localssdsensorcombitrans[0])));
1601                 break;
1602                 }
1603           }
1604   }     
1605   //////////////////////////
1606   // Setting SSD End Ladder  
1607   //////////////////////////
1608   for(Int_t i=0; i<2; i++) fendladdersegmentmatrix[i] = new TGeoHMatrix*[2];
1609   for(Int_t i=0; i<2; i++){
1610         fendladdersegmentmatrix[0][i] = new TGeoHMatrix();
1611         fendladdersegmentmatrix[0][i]->SetDx(-0.5*fgkCarbonFiberTriangleLength);
1612         fendladdersegmentmatrix[0][i]->SetDy(fgkCarbonFiberJunctionWidth*ssdlaysensorsnumber[i]);
1613         fendladdersegmentmatrix[0][i]->MultiplyLeft(ladderglobalmatrix[1][i]);
1614         fendladdersegmentmatrix[1][i] = new TGeoHMatrix();
1615         fendladdersegmentmatrix[1][i]->SetDx(-0.5*fgkCarbonFiberTriangleLength);
1616         fendladdersegmentmatrix[1][i]->RotateZ(180.0);
1617         fendladdersegmentmatrix[1][i]->MultiplyLeft(ladderglobalmatrix[1][i]);
1618    }
1619   /////////////////////////////////////////////////////
1620   // Setting the CombiTransformation to pass ITS center 
1621   /////////////////////////////////////////////////////
1622   Double_t itscentertransz[fgklayernumber];
1623   itscentertransz[0] = fgkSSDLay5LadderLength
1624                                          - fgkLay5CenterITSPosition;
1625   itscentertransz[1] = fgkSSDLay6LadderLength
1626                                          - fgkLay6CenterITSPosition;
1627   Double_t itssensortransy = fgkSSDModuleCoolingBlockToSensor
1628                                                    + 0.5*fgkCoolingTubeSupportHeight;
1629   TGeoRotation* itscenterrot[3];
1630   for(Int_t i=0; i<fgklayernumber; i++) itscenterrot[i] = new TGeoRotation();
1631   itscenterrot[0]->SetAngles(90.,180.,-90.);
1632   itscenterrot[1]->SetAngles(0.,90.,0.);
1633   itscenterrot[2] = new TGeoRotation((*itscenterrot[1])*(*itscenterrot[0]));
1634   TGeoCombiTrans* itscentercombitrans[fgklayernumber];
1635   for(Int_t i=0; i<fgklayernumber; i++) 
1636         itscentercombitrans[i] = new TGeoCombiTrans(0.,
1637                                                          itssensortransy,
1638                                                          fgkEndLadderCarbonFiberLowerJunctionLength[1]
1639                                                    - itscentertransz[i],itscenterrot[2]);
1640   TGeoRotation** locallayerrot[fgklayernumber];
1641   TGeoTranslation** locallayertrans[fgklayernumber];    
1642   TGeoCombiTrans** locallayercombitrans[fgklayernumber];
1643   TGeoTranslation* localbeamaxistrans[fgklayernumber];
1644   localbeamaxistrans[0] = new TGeoTranslation(0.,0.,0.5*fgkSSDLay5LadderLength
1645                                          - fgkLay5CenterITSPosition);
1646   localbeamaxistrans[1] = new TGeoTranslation(0.,0.,0.5*fgkSSDLay6LadderLength
1647                                          - fgkLay6CenterITSPosition);
1648   const Int_t kssdlayladdernumber[fgklayernumber] = 
1649                         {fgkSSDLay5LadderNumber,fgkSSDLay6LadderNumber};
1650   for(Int_t i=0; i<fgklayernumber; i++){
1651     locallayerrot[i] = new TGeoRotation*[kssdlayladdernumber[i]];
1652     locallayertrans[i] = new TGeoTranslation*[kssdlayladdernumber[i]];
1653         locallayercombitrans[i] = new TGeoCombiTrans*[kssdlayladdernumber[i]];
1654         flayermatrix[i] = new TGeoHMatrix*[kssdlayladdernumber[i]];
1655   }
1656   Double_t layerladderangleposition[fgklayernumber] = 
1657                 {360./fgkSSDLay5LadderNumber,360./fgkSSDLay6LadderNumber};
1658   Double_t layerradius = 0.;
1659   for(Int_t i=0; i<fgklayernumber; i++){        
1660         for(Int_t j=0; j<kssdlayladdernumber[i]; j++){
1661                 switch(i){
1662                         case 0: //Ladder of Layer5  
1663                         layerradius = (j%2==0 ? fgkSSDLay5RadiusMin: fgkSSDLay5RadiusMax);
1664                         break;
1665                         case 1: //Ladder of Layer6 
1666                         layerradius = (j%2==0 ? fgkSSDLay6RadiusMin: fgkSSDLay6RadiusMax);
1667                 break;
1668                 }
1669                 locallayerrot[i][j] = new TGeoRotation();
1670                 locallayertrans[i][j] = new TGeoTranslation();
1671                 locallayerrot[i][j]->SetAngles(j*layerladderangleposition[i],0.,0.);
1672                 locallayertrans[i][j]->SetTranslation(layerradius 
1673                                                           *     CosD(90.0+j*layerladderangleposition[i]),
1674                                                             layerradius 
1675                                                           * SinD(90.0+j*layerladderangleposition[i]),0.);
1676                 locallayercombitrans[i][j] = new TGeoCombiTrans(*locallayertrans[i][j],
1677                                                                          *locallayerrot[i][j]);
1678                 flayermatrix[i][j] = new TGeoHMatrix((*locallayercombitrans[i][j])*(*itscentercombitrans[i]));
1679                 flayermatrix[i][j]->Multiply(ladderglobalmatrix[0][i]);
1680                 flayermatrix[i][j]->MultiplyLeft(localbeamaxistrans[i]);
1681         }
1682   }
1683   /////////////////////////////////////////////////////////////
1684   // Deallocating memory
1685   /////////////////////////////////////////////////////////////
1686   for(Int_t i=0; i< kcarbonfibersupportmatrixnumber[1]; i++){
1687         delete carbonfiberot[i];
1688         delete localcarbonfibersupportmatrix[i];
1689   }
1690   for(Int_t i=0; i< fgkcarbonfiberjunctionumber; i++){
1691      for(Int_t j=0; j< kcarbonfiberjunctionmatrixnumber; j++){
1692        delete localcarbonfiberjunctionmatrix[i][j];
1693            delete localcarbonfiberjunctionrot[i][j];
1694            delete localcarbonfiberjunctiontrans[i][j];
1695            }
1696        delete [] localcarbonfiberjunctionmatrix[i];
1697        delete [] localcarbonfiberjunctionrot[i];
1698        delete [] localcarbonfiberjunctiontrans[i];
1699   }
1700   for(Int_t i=0; i<fgkcarbonfiberlowersupportnumber; i++) 
1701            delete localcarbonfiberlowersupportrans[i];
1702   for(Int_t i=0; i< fgkssdsensorsupportnumber; i++){
1703      for(Int_t j=0; j< kssdsensorsupportmatrixnumber; j++){
1704        delete localssdsensorsupportmatrix[i][j];
1705            delete localssdsensorsupportrot[i][j];
1706            delete localssdsensorsupportrans[i][j];
1707            }
1708        delete [] localssdsensorsupportmatrix[i];
1709        delete [] localssdsensorsupportrot[i];
1710        delete [] localssdsensorsupportrans[i];
1711   }
1712   for(Int_t i=0; i<kcoolingtubesupportmatrixnumber; i++){
1713         delete localcoolingtubesupportmatrix[i];
1714         delete localcoolingtubesupportrot[i];
1715         delete localcoolingtubesupportrans[i];
1716   }
1717   for(Int_t i=0; i<4; i++){
1718         for(Int_t j=0; j<2; j++){
1719                 delete localcoolingtubevect[i][j];
1720                 delete localcoolingtubetrans[i][j];
1721         }
1722         delete [] localcoolingtubevect[i];
1723         delete [] localcoolingtubetrans[i];
1724   }
1725  delete endladdermountingblockrot;
1726  for(Int_t i=0; i<khybridmatrixnumber; i++) delete localhybridtrans[i];
1727  for(Int_t i=0; i<kcoolingblockmatrixnumber; i++) delete localcoolingblocktrans[i];
1728  for(Int_t i=0; i<fgkflexnumber; i++){
1729       for(Int_t j=1; j<klocalflexmatrixnumber; j++) 
1730             delete localflexmatrix[i][j];
1731       delete [] localflexmatrix[i];
1732  }
1733  delete localendlladdercoolingtuberot;
1734  for(Int_t i=0; i<2; i++){
1735         for(Int_t j=0; j<(i==0?6:4); j++)
1736                 delete localendlladdercoolingtubetrans[i][j];
1737         delete [] localendlladdercoolingtubetrans[i];
1738   }
1739
1740  delete localflexrot;
1741  delete localendflexrot;
1742  delete localendflexmatrix;
1743  for(Int_t i=0; i<fgkladdernumber; i++){ 
1744         delete localladdermothertrans[i];
1745         delete localladdermothercombitrans[i];
1746   }
1747  delete localladdermotherrot;
1748  for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++){    
1749       for(Int_t j=0; j<fgkendladdercabonfiberjunctionmatrixnumber; j++){
1750             delete localendladdercarbonfiberjunctionmatrix[i][j];
1751             delete localendladdercarbonfiberjunctionrot[i][j];
1752             delete localendladdercarbonfiberjunctiontrans[i][j];
1753       }
1754       delete [] localendladdercarbonfiberjunctionmatrix[i];
1755       delete [] localendladdercarbonfiberjunctionrot[i];
1756       delete [] localendladdercarbonfiberjunctiontrans[i];
1757       delete localendladdercarbonfiberjunctionglobalrot[i];
1758       delete localendladdercarbonfiberjunctionglobaltrans[i];
1759       delete localendladdercarbonfiberjunctionglobalmatrix[i];
1760  }
1761   for(Int_t i=0; i<2; i++){
1762         for(Int_t j=0; j<(i==0?4:2); j++) delete localendladdercooltubetrans[i][j];
1763         delete [] localendladdercooltubetrans[i];
1764   }
1765   for(Int_t i=0; i<fgkendladdercarbonfibermatrixnumber; i++)
1766       delete localendladdercarbonfibertrans[i];
1767   for(Int_t i=0; i<3; i++) delete localladdercablerot[i];
1768   for(Int_t i=0; i<klocalladdersidecablesnumber; i++){
1769         for(Int_t j=0; j<klocalladdercombitransnumber; j++)
1770                 delete localladdercablecombitransmatrix[i][j];
1771                 delete []localladdercablecombitransmatrix[i];
1772   }
1773   delete localendladdercliprot;
1774   delete localendladdercliptrans;
1775   for(Int_t i=0; i<fgkladdercablesnumber; i++){
1776         for(Int_t j=0; j<klocalladdersidecablesnumber; j++)
1777                 delete localladdercablehmatrix[i][j];
1778         delete []localladdercablehmatrix[i];
1779   }
1780   delete laddercablerot;
1781   delete laddercabletrans;
1782   delete laddercablecombitrans;
1783   delete localladdercablessdmodulematrix;
1784   delete localssdsensorrot;     
1785   for(Int_t i=0; i<2; i++){
1786         delete localssdsensortrans[i];
1787         delete localssdsensorcombitrans[i];
1788   }
1789   for(Int_t i=0; i<fgklayernumber; i++){
1790         for(Int_t j=0; j<kssdlayladdernumber[i]; j++){
1791                 delete locallayerrot[i][j];
1792                 delete locallayertrans[i][j];
1793                 delete locallayercombitrans[i][j];
1794     }
1795         delete [] locallayerrot[i];
1796         delete [] locallayertrans[i];
1797         delete [] locallayercombitrans[i];
1798         delete localbeamaxistrans[i];
1799   }
1800   for(Int_t i=0; i<3; i++) delete itscenterrot[i];
1801   for(Int_t i=0; i<fgkladdernumber; i++){
1802         for(Int_t j=0; j<fgkladdernumber; j++)
1803                 delete ladderglobalmatrix[i][j];
1804         delete [] ladderglobalmatrix[i];
1805   }
1806   /////////////////////////////////////////////////////////////
1807   fTransformationMatrices = kTRUE;      
1808 }
1809 ///////////////////////////////////////////////////////////////////////////////
1810 void AliITSv11GeometrySSD::CreateBasicObjects(){
1811   /////////////////////////////////////////////////////////////  
1812   // Method generating the Objects of SSD Geometry    
1813   /////////////////////////////////////////////////////////////
1814   // SSD Sensor
1815   ///////////////////////////////////
1816   SetSSDSensor();
1817   /////////////////////////////////////////////////////////////  
1818   // Carbon Fiber Support    
1819   /////////////////////////////////////////////////////////////  
1820   TList* carbonfibersupportlist = GetCarbonFiberSupportList();  
1821   for(Int_t i=0; i<fgkcarbonfibersupportnumber; i++) 
1822       fcarbonfibersupport[i] = (TGeoVolume*)carbonfibersupportlist->At(i);
1823   /////////////////////////////////////////////////////////////
1824   // Carbon Fiber Junction 
1825   /////////////////////////////////////////////////////////////
1826   fcarbonfiberjunction = GetCarbonFiberJunction(fgkCarbonFiberJunctionWidth-fgkSSDTolerance);
1827   /////////////////////////////////////////////////////////////
1828   // Carbon Fiber Lower Support
1829   /////////////////////////////////////////////////////////////
1830   TList* carbonfiberlowersupportlist = GetCarbonFiberLowerSupportList();
1831   for(Int_t i=0; i<fgkcarbonfiberlowersupportnumber; i++)
1832         fcarbonfiberlowersupport[i] = (TGeoVolume*)carbonfiberlowersupportlist->At(i);
1833   /////////////////////////////
1834   // SSD Sensor Support
1835   /////////////////////////////
1836   for(Int_t i=0; i<fgkvolumekind; i++) fssdsensorsupport[i] = 
1837                                                                                 new TGeoVolume*[fgkssdsensorsupportnumber]; 
1838   Double_t sidesupporthickness[2] = {fgkSSDSensorSideSupportThickness[0],
1839                                                                          fgkSSDSensorSideSupportThickness[1]};
1840   for(Int_t i=0; i<fgkssdsensorsupportnumber-1; i++){
1841         fssdsensorsupport[0][i] = GetSSDSensorSupport(fgkSSDSensorSideSupportLength,
1842                                                                                            fgkSSDSensorSideSupportHeight[i],
1843                                                                                            fgkSSDSensorSideSupportWidth,
1844                                                                                            sidesupporthickness);  
1845         fssdsensorsupport[1][i] = GetSSDSensorSupport(fgkSSDSensorCenterSupportLength,
1846                                                                                            fgkSSDSensorCenterSupportHeight[i],
1847                                                                                            fgkSSDSensorCenterSupportWidth,
1848                                                                                            sidesupporthickness);
1849   }
1850   /////////////////////////////////////////////////////////////
1851   // SSD Cooling Tube Support
1852   /////////////////////////////////////////////////////////////
1853   Int_t edgesnumber = 16;
1854   fcoolingtubesupport = GetCoolingTubeSupport(edgesnumber);       
1855   /////////////////////////////////////////////////////////////
1856   // SSD Hybrid
1857   /////////////////////////////////////////////////////////////
1858   TList* ssdhybridcomponentslist = GetSSDHybridParts();
1859   for(Int_t i=0; i<fgkhybridcompnumber; i++) 
1860         fssdhybridcomponent[i] = (TGeoVolume*)ssdhybridcomponentslist->At(i);
1861   /////////////////////////////////////////////////////////////
1862   // SSD Cooling Block System
1863   /////////////////////////////////////////////////////////////
1864   fssdcoolingblocksystem = GetCoolingBlockSystem();
1865    /////////////////////////////////////////////////////////////
1866   // SSD Cooling Tube
1867   /////////////////////////////////////////////////////////////
1868   TList* coolingtubelist = GetCoolingTubeList();        
1869   for(Int_t i=0; i<fgkcoolingtubenumber; i++)   
1870         fcoolingtube[i] = (TGeoVolume*)coolingtubelist->At(i);
1871   for(Int_t i=0; i<fgkendladdercoolingtubenumber; i++)  
1872         fendladdercoolingtube[i] = 
1873                         (TGeoVolume*)coolingtubelist->At(fgkcoolingtubenumber+i);
1874   /////////////////////////////////////////////////////////////
1875   // SSD Flex  
1876   /////////////////////////////////////////////////////////////
1877   fssdstiffenerflex = GetSSDStiffenerFlex();
1878   fssdendflex = GetSSDEndFlex();
1879   ///////////////////////////////////
1880   // End Ladder Carbon Fiber Junction
1881   ///////////////////////////////////
1882   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++) 
1883                                                    fendladdercarbonfiberjunction[i] = 
1884                                                    new TGeoVolume*[fgkendlabbercarbonfiberjunctionumber];
1885   for(Int_t i=0; i<fgkendlabbercarbonfiberjunctionumber; i++){
1886     fendladdercarbonfiberjunction[i][0] = 
1887                   GetCarbonFiberJunction(fgkEndLadderCarbonFiberLowerJunctionLength[i]-fgkSSDTolerance);
1888     fendladdercarbonfiberjunction[i][1] = 
1889                   GetCarbonFiberJunction(fgkEndLadderCarbonFiberUpperJunctionLength[i]-fgkSSDTolerance);
1890   }
1891   ///////////////////////////////////
1892   // End Ladder Mounting Block
1893   ///////////////////////////////////
1894   fendladdermountingblock = GetSSDMountingBlock();
1895   ///////////////////////////////////
1896   // End Ladder Mounting Block
1897   ///////////////////////////////////
1898   fendladdermountingblockclip = GetMountingBlockClip();
1899   ///////////////////////////////////
1900   // Ladder Support 
1901   ///////////////////////////////////
1902   TList* laddersupportlist = GetMountingBlockSupport(20);
1903   fLay5LadderSupport[0] = (TGeoVolume*)laddersupportlist->At(0);
1904   fLay5LadderSupport[1] = (TGeoVolume*)laddersupportlist->At(1);
1905   fLay6LadderSupport[0] = (TGeoVolume*)laddersupportlist->At(2);
1906   fLay6LadderSupport[1] = (TGeoVolume*)laddersupportlist->At(3);
1907   /////////////////////////////////////////////////////////////
1908   // Deallocating memory
1909   /////////////////////////////////////////////////////////////
1910   delete carbonfibersupportlist;
1911   delete carbonfiberlowersupportlist;
1912   delete ssdhybridcomponentslist;
1913   delete laddersupportlist;
1914   /////////////////////////////////////////////////////////////
1915   fBasicObjects = kTRUE;
1916 }
1917 /////////////////////////////////////////////////////////////////////////////////
1918 void AliITSv11GeometrySSD::SetSSDSensor(){
1919   ////////////////////////////////////////////////////////////////
1920   // Method generating SSD Sensors: it sets the private variables
1921   // fSSDSensor5, fSSDSensor6  
1922   ////////////////////////////////////////////////////////////////
1923   Double_t ssdsensitivelength = fgkSSDSensorLength-2.*fgkSSDSensorInsensitiveLength;
1924   Double_t ssdsensitivewidth  = fgkSSDSensorWidth-2.*fgkSSDSensorInsensitiveWidth;
1925   TGeoBBox* ssdsensorsensitiveshape = new TGeoBBox("SSDSensorSensitiveShape",
1926                                                 0.5*ssdsensitivewidth,
1927                                                 0.5*fgkSSDSensorHeight,
1928                                                 0.5*ssdsensitivelength);
1929   TGeoVolume* ssdsensorsensitiveLay5 = 
1930         new TGeoVolume(fgSSDsensitiveVolName5,ssdsensorsensitiveshape,fSSDSensorMedium);
1931   TGeoVolume* ssdsensorsensitiveLay6 = 
1932         new TGeoVolume(fgSSDsensitiveVolName6,ssdsensorsensitiveshape,fSSDSensorMedium);
1933   ssdsensorsensitiveLay5->SetLineColor(fColorSilicon);
1934   ssdsensorsensitiveLay6->SetLineColor(fColorSilicon);
1935   TGeoBBox* ssdsensorinsensitiveshape[2];
1936   ssdsensorinsensitiveshape[0] = new TGeoBBox("SSDSensorInsensitiveShape1",
1937                                                 0.5*fgkSSDSensorInsensitiveWidth,
1938                                                 0.5*fgkSSDSensorHeight,
1939                                                 0.5*fgkSSDSensorLength);
1940   ssdsensorinsensitiveshape[1] = new TGeoBBox("SSDSensorInsensitiveShape2",
1941                                                 0.5*ssdsensitivewidth,
1942                                                 0.5*fgkSSDSensorHeight,
1943                                                 0.5*fgkSSDSensorInsensitiveWidth);
1944   const char* ssdsensorinsensitivename[2] = {"SSDSensorInsensitive1",
1945                                              "SSDSensorInsensitive2"};
1946   TGeoVolume* ssdsensorinsensitive[2];
1947   for(Int_t i=0; i<2; i++){ ssdsensorinsensitive[i] = 
1948       new TGeoVolume(ssdsensorinsensitivename[i],ssdsensorinsensitiveshape[i],
1949                      fSSDSensorMedium);
1950       ssdsensorinsensitive[i]->SetLineColor(fColorCarbonFiber);
1951   }
1952   /////////////////////////////////////////////////////////////
1953   // Virtual Volume containing SSD Sensor  
1954   /////////////////////////////////////////////////////////////
1955   TGeoBBox* virtualSSDSensorShape = new TGeoBBox("SSDSensorShape",
1956                                                                                              0.5*fgkSSDSensorWidth,
1957                                                                                              0.5*fgkSSDSensorHeight,
1958                                                                                              0.5*fgkSSDSensorLength);
1959   fSSDSensor5 = new TGeoVolume("ITSssdSensor5",virtualSSDSensorShape,
1960                                                                                  fSSDAir);      
1961   fSSDSensor6 = new TGeoVolume("ITSssdSensor6",virtualSSDSensorShape,
1962                                                                                  fSSDAir);      
1963   /////////////////////////////////////////////////////////////
1964   for(Int_t i=0; i<4; i++){ 
1965             fSSDSensor5->AddNode(i%2==0 ? ssdsensorinsensitive[0]:
1966             ssdsensorinsensitive[1],i<2?1:2,
1967                         new TGeoTranslation(
1968                          0.5*(1.+TMath::Power(-1.,i))*(i==0?-1.: 1.)
1969       *   (ssdsensorsensitiveshape->GetDX()+ssdsensorinsensitiveshape[0]->GetDX()),0.,                  
1970                         0.5*(1.-TMath::Power(-1.,i))*(i==1? 1.:-1.)
1971       *   (ssdsensorsensitiveshape->GetDZ()+ssdsensorinsensitiveshape[1]->GetDZ())));    
1972             fSSDSensor6->AddNode(i%2==0 ? ssdsensorinsensitive[0]:
1973             ssdsensorinsensitive[1],i<2?1:2,
1974                         new TGeoTranslation(
1975                          0.5*(1.+TMath::Power(-1.,i))*(i==0?-1.: 1.)
1976       *   (ssdsensorsensitiveshape->GetDX()+ssdsensorinsensitiveshape[0]->GetDX()),0.,                  
1977                         0.5*(1.-TMath::Power(-1.,i))*(i==1? 1.:-1.)
1978       *   (ssdsensorsensitiveshape->GetDZ()+ssdsensorinsensitiveshape[1]->GetDZ())));    
1979   }
1980     fSSDSensor5->AddNode(ssdsensorsensitiveLay5,1);
1981     fSSDSensor6->AddNode(ssdsensorsensitiveLay6,1);
1982 }
1983 ///////////////////////////////////////////////////////////////////////////////
1984 TList* AliITSv11GeometrySSD::GetCarbonFiberSupportList(){
1985   /////////////////////////////////////////////////////////////  
1986   // Method generating the Carbon Fiber Support   
1987   /////////////////////////////////////////////////////////////  
1988   const Int_t kvertexnumber = 4;
1989   const Int_t kshapesnumber = 2;
1990   TVector3** vertexposition[kshapesnumber];
1991   for(Int_t i=0; i<kshapesnumber; i++) vertexposition[i] = new TVector3*[kvertexnumber];
1992   Double_t carbonfibersupportxaxisEdgeproj = 
1993                 fgkCarbonFiberSupportEdgeLength*TMath::Cos(fgkCarbonFiberJunctionAngle[0]
1994         *       TMath::DegToRad());
1995   Double_t theta = TMath::ATan(fgkCarbonFiberSupportYAxisLength
1996                                  /                         fgkCarbonFiberSupportXAxisLength);
1997   /////////////////////
1998   //Vertex Positioning
1999   ////////////////////
2000   vertexposition[0][0] = new TVector3();
2001   vertexposition[0][1] = new TVector3(fgkCarbonFiberSupportXAxisLength,
2002                                                                           fgkCarbonFiberSupportYAxisLength);
2003   vertexposition[0][2] = new TVector3(carbonfibersupportxaxisEdgeproj,
2004                                                                           carbonfibersupportxaxisEdgeproj
2005                                            *                      TMath::Tan(theta));
2006   vertexposition[0][3] = new TVector3(fgkCarbonFiberSupportXAxisLength
2007                                            -                      carbonfibersupportxaxisEdgeproj,
2008                                                                           fgkCarbonFiberSupportYAxisLength
2009                                            -                      vertexposition[0][2]->Y());
2010   ////////////////////////////////////////////////////
2011   //Setting the parameters for Isometry Transformation
2012   ////////////////////////////////////////////////////
2013   Double_t symmetryplaneposition = (fgkCarbonFiberSupportYAxisLength
2014                                                                  +      fgkCarbonFiberSupportTopEdgeDist[0]
2015                                                                  +      fgkCarbonFiberSupportWidth);
2016   Double_t* param = new Double_t[4]; 
2017   param[0] = 0., param[1] = 1., param[2] = 0., param[3] = -symmetryplaneposition;
2018   for(Int_t j=0; j<kvertexnumber; j++) vertexposition[1][j] = 
2019                                   new TVector3((GetReflection(vertexposition[0][j],param))->X(),
2020                                                           (GetReflection(vertexposition[0][j],param))->Y());
2021   const char* carbonfibersupportshapename[kshapesnumber] = 
2022                                                 {"CarbonFiberSupportShape1","CarbonFiberSupportShape2"};
2023   const char* carbonfibersupportname[kshapesnumber] = 
2024                                                 {"CarbonFiberSupport1","CarbonFiberSupport2"};
2025   TGeoArb8* carbonfibersupportshape[kshapesnumber]; 
2026   TGeoVolume* carbonfibersupport[kshapesnumber];
2027   TList* carbonfibersupportlist = new TList();
2028   Double_t width[2] = {fgkCarbonFiberSupportWidth,fgkCarbonFiberSupportWidth};
2029   Double_t carbonfibersupportheight = 
2030           carbonfibersupportxaxisEdgeproj*TMath::Tan(fgkCarbonFiberJunctionAngle[0]
2031           *TMath::DegToRad());
2032   for(Int_t i = 0; i< kshapesnumber; i++){
2033    carbonfibersupportshape[i] = 
2034                                         GetArbShape(vertexposition[i],width,carbonfibersupportheight,
2035                                                                 carbonfibersupportshapename[i],i==0 ? 1: -1);
2036    carbonfibersupport[i] = new TGeoVolume(carbonfibersupportname[i],
2037                                                    carbonfibersupportshape[i],fSSDCarbonFiberMedium);
2038    carbonfibersupport[i]->SetLineColor(fColorCarbonFiber);
2039    carbonfibersupportlist->Add(carbonfibersupport[i]);  
2040    }
2041   /////////////////////////////////////////////////////////////
2042   // Deallocating memory
2043   /////////////////////////////////////////////////////////////
2044   for(Int_t i=0; i< kshapesnumber; i++){
2045      for(Int_t j=0; j< kvertexnumber; j++)
2046            delete vertexposition[i][j];
2047        delete [] vertexposition[i];
2048   }
2049   delete [] param;
2050   /////////////////////////////////////////////////////////////
2051    return carbonfibersupportlist;
2052 }
2053 /////////////////////////////////////////////////////////////////////////////////
2054 TGeoVolume* AliITSv11GeometrySSD::GetCarbonFiberJunction(Double_t width){
2055   /////////////////////////////////////////////////////////////
2056   // Method generating SSD Carbon Fiber Junction
2057   /////////////////////////////////////////////////////////////
2058   const Int_t kvertexnumber = 6;
2059   TGeoXtru* carbonfiberjunctionshape = new TGeoXtru(2);
2060   Double_t reflectionparam[3] = {TMath::Tan(fgkCarbonFiberJunctionAngle[0]
2061                                                           *  TMath::DegToRad()),-1.,0.};
2062   TVector3* vertex[kvertexnumber];
2063   vertex[0] = new TVector3();
2064   vertex[3] = new TVector3(fgkCarbonFiberJunctionEdge[0]
2065                         *                         TMath::Cos(fgkCarbonFiberJunctionAngle[0]
2066                         *                         TMath::DegToRad()),
2067                                                   fgkCarbonFiberJunctionEdge[0]
2068                         *                         TMath::Sin(fgkCarbonFiberJunctionAngle[0]
2069                         *                         TMath::DegToRad()));
2070   vertex[4] = new TVector3(fgkCarbonFiberJunctionLength,
2071                                                    fgkCarbonFiberJunctionEdge[1]);
2072   vertex[5] = new TVector3(fgkCarbonFiberJunctionLength); 
2073   vertex[1] = GetReflection(vertex[5],reflectionparam); 
2074   vertex[2] = GetReflection(vertex[4],reflectionparam); 
2075   Double_t xvertexpoints[6], yvertexpoints[6];
2076   for(Int_t i=0; i<kvertexnumber; i++) 
2077           xvertexpoints[i] = vertex[i]->X(), yvertexpoints[i] = vertex[i]->Y();
2078   carbonfiberjunctionshape->DefinePolygon(kvertexnumber,xvertexpoints,yvertexpoints);
2079   carbonfiberjunctionshape->DefineSection(0,-0.5*width);
2080   carbonfiberjunctionshape->DefineSection(1,0.5*width);
2081   TGeoVolume* carbonfiberjunction = new TGeoVolume("CarbonFiberJunction",
2082                                                                 carbonfiberjunctionshape,fSSDCarbonFiberMedium);
2083   carbonfiberjunction->SetLineColor(fColorCarbonFiber);
2084   /////////////////////////////////////////////////////////////
2085   // Deallocating memory
2086   /////////////////////////////////////////////////////////////
2087   for (Int_t i=0; i<kvertexnumber; i++) delete vertex[i];
2088   ///////////////////////////////////////////////////////////// 
2089   return carbonfiberjunction;
2090 }
2091 ////////////////////////////////////////////////////////////////////////////////
2092 TList* AliITSv11GeometrySSD::GetCarbonFiberLowerSupportList(){
2093   /////////////////////////////////////////////////////////////
2094   // Method generating the Carbon Fiber Lower Support   
2095   /////////////////////////////////////////////////////////////  
2096   const Int_t kvertexnumber = 4;
2097   const Int_t kshapesnumber = 2;
2098   Double_t width[2] = {fgkCarbonFiberLowerSupportWidth,
2099                                                                 fgkCarbonFiberLowerSupportWidth};
2100   TVector3** vertexposition[kshapesnumber];
2101   for(Int_t i = 0; i<kshapesnumber; i++) vertexposition[i] = 
2102                                                  new TVector3*[kvertexnumber];
2103   //First Shape Vertex Positioning
2104   vertexposition[0][0] = new TVector3(fgkCarbonFiberLowerSupportLowerLenght);
2105   vertexposition[0][1] = new TVector3(fgkCarbonFiberTriangleLength
2106                                            -            fgkCarbonFiberLowerSupportLowerLenght);
2107   vertexposition[0][2] = new TVector3();
2108   vertexposition[0][3] = new TVector3(fgkCarbonFiberTriangleLength);
2109   //Second Shape Vertex Positioning
2110   Double_t theta = TMath::ATan((fgkCarbonFiberLowerSupportVolumePosition[1]
2111                                  -                              fgkCarbonFiberLowerSupportVolumePosition[0])
2112                                  /                              fgkCarbonFiberTriangleLength);
2113   vertexposition[1][0] = new TVector3(vertexposition[0][0]->X(),
2114                                                                 vertexposition[0][0]->X()*TMath::Tan(theta)
2115                                  +                              fgkCarbonFiberLowerSupportVolumePosition[0]);
2116   vertexposition[1][1] = new TVector3(vertexposition[0][1]->X(),
2117                                                                 vertexposition[0][1]->X()*TMath::Tan(theta)
2118                                  +                              fgkCarbonFiberLowerSupportVolumePosition[0]);
2119   vertexposition[1][2] = new TVector3(0.,fgkCarbonFiberLowerSupportVolumePosition[0]);
2120   vertexposition[1][3] = new TVector3(fgkCarbonFiberTriangleLength,
2121                                                                 fgkCarbonFiberLowerSupportVolumePosition[1]);
2122   const char* carbonfiberlowersupportshapename[kshapesnumber] = 
2123                           {"CarbonFiberLowerSupportShape1","CarbonFiberLowerSupportShape2"};
2124   const char* carbonfiberlowersupportname[kshapesnumber] = 
2125                           {"CarbonFiberLowerSupport1","CarbonFiberLowerSupport2"};
2126   TGeoArb8* carbonfiberlowersupportshape[kshapesnumber];
2127   TGeoVolume* carbonfiberlowersupport[kshapesnumber];
2128   TList* carbonfiberlowersupportlist = new TList();
2129   for(Int_t i = 0; i< kshapesnumber; i++){ 
2130         carbonfiberlowersupportshape[i] = 
2131                                                                 GetArbShape(vertexposition[i],width,
2132                                                                                         fgkCarbonFiberLowerSupportHeight,
2133                                                                                         carbonfiberlowersupportshapename[i]);
2134     carbonfiberlowersupport[i] = new TGeoVolume(carbonfiberlowersupportname[i],
2135                                                 carbonfiberlowersupportshape[i],fSSDCarbonFiberMedium);
2136         carbonfiberlowersupport[i]->SetLineColor(fColorCarbonFiber);
2137     carbonfiberlowersupportlist->Add(carbonfiberlowersupport[i]);
2138   }
2139   /////////////////////////////////////////////////////////////
2140   // Deallocating memory
2141   /////////////////////////////////////////////////////////////
2142   for(Int_t i=0; i< kshapesnumber; i++){
2143      for(Int_t j=0; j< kvertexnumber; j++)
2144            delete vertexposition[i][j];
2145        delete [] vertexposition[i];
2146   }
2147   /////////////////////////////////////////////////////////////
2148   return carbonfiberlowersupportlist;
2149 }
2150 ///////////////////////////////////////////////////////////////////////////////
2151 TGeoVolume* AliITSv11GeometrySSD::GetSSDSensorSupport(Double_t length, Double_t height, 
2152                                                                  Double_t width, Double_t* thickness)const{
2153   /////////////////////////////////////////////////////////////
2154   // Method generating the Sensor Support   
2155   /////////////////////////////////////////////////////////////  
2156         const Int_t kvertexnumber = 6;
2157         TGeoXtru* ssdsensorsupportshape = new TGeoXtru(2);      
2158     TVector3* vertexposition[kvertexnumber];
2159         vertexposition[0] = new TVector3();     
2160         vertexposition[1] = new TVector3(0.0,length);   
2161         vertexposition[2] = new TVector3(thickness[1],vertexposition[1]->Y());  
2162         vertexposition[3] = new TVector3(vertexposition[2]->X(),thickness[0]);  
2163         vertexposition[4] = new TVector3(height,vertexposition[3]->Y());        
2164         vertexposition[5] = new TVector3(vertexposition[4]->X());       
2165         Double_t xvertexpoints[6], yvertexpoints[6];
2166         for(Int_t i=0; i<kvertexnumber; i++) 
2167                 xvertexpoints[i] = vertexposition[i]->X(), 
2168                 yvertexpoints[i] = vertexposition[i]->Y();
2169     ssdsensorsupportshape->DefinePolygon(kvertexnumber,xvertexpoints,yvertexpoints);
2170     ssdsensorsupportshape->DefineSection(0,-0.5*width);
2171     ssdsensorsupportshape->DefineSection(1,0.5*width);
2172     TGeoVolume* ssdsensorsupport = new TGeoVolume("SSDSensorSupport",
2173                                                                  ssdsensorsupportshape,fSSDSensorSupportMedium);
2174   /////////////////////////////////////////////////////////////
2175   // Deallocating memory
2176   /////////////////////////////////////////////////////////////
2177         for (Int_t i=0; i<kvertexnumber; i++)
2178                 delete vertexposition[i];
2179   /////////////////////////////////////////////////////////////
2180     return ssdsensorsupport;
2181 }
2182 ////////////////////////////////////////////////////////////////////////////////
2183 TGeoVolume* AliITSv11GeometrySSD::GetCoolingTubeSupport(Int_t nedges){
2184   /////////////////////////////////////////////////////////////
2185   // Method generating the Cooling Tube Support
2186   /////////////////////////////////////////////////////////////
2187   if(nedges%2!=0) nedges--;     
2188   const Int_t kvertexnumber = nedges+5;
2189   Double_t phi = TMath::ASin(0.5*fgkCoolingTubeSupportHeight
2190                            /                     fgkCoolingTubeSupportRmax)*TMath::RadToDeg();
2191   Double_t angle = 90.+phi;
2192   Double_t psi = 90.-phi;
2193   ///////////////////////////////////////
2194   // Vertex Positioning for TGeoXTru
2195   ///////////////////////////////////////
2196   TVector3** vertexposition = new TVector3*[kvertexnumber];
2197   vertexposition[0] = new TVector3(fgkCoolingTubeSupportRmin*CosD(angle),
2198                                                                    fgkCoolingTubeSupportRmin*SinD(angle));
2199   vertexposition[1] = new TVector3(fgkCoolingTubeSupportRmax*CosD(angle),
2200                                                                    fgkCoolingTubeSupportRmax*SinD(angle));
2201   vertexposition[2] = new TVector3(vertexposition[1]->X(),
2202                                                                    fgkCoolingTubeSupportRmax);
2203   vertexposition[3] = new TVector3(-vertexposition[1]->X(),
2204                                                                    fgkCoolingTubeSupportRmax);
2205   vertexposition[4] = new TVector3(-vertexposition[1]->X(),
2206                                                                     vertexposition[1]->Y());
2207   for(Int_t i=0; i<nedges; i++)
2208         vertexposition[i+5] = 
2209                 new TVector3(fgkCoolingTubeSupportRmin*CosD(psi+i*(2.*phi/nedges)),
2210                                          fgkCoolingTubeSupportRmin*SinD(psi+i*(2.*phi/nedges)));
2211   ///////////////////////////////////////////////////////////////////////
2212   // TGeoXTru Volume definition for Cooling Tube Support Arc Part
2213   ///////////////////////////////////////////////////////////////////////
2214   TGeoXtru* coolingtubesupportarcshape = new TGeoXtru(2);       
2215   Double_t* xvertexpoints = new Double_t[kvertexnumber];        
2216   Double_t* yvertexpoints = new Double_t[kvertexnumber];        
2217   for(Int_t i=0; i<kvertexnumber; i++){
2218         xvertexpoints[i] = vertexposition[i]->X();
2219         yvertexpoints[i] = vertexposition[i]->Y();
2220   } 
2221   coolingtubesupportarcshape->DefinePolygon(kvertexnumber,xvertexpoints,
2222                                                                                         yvertexpoints);
2223   coolingtubesupportarcshape->DefineSection(0,-0.5*fgkCoolingTubeSupportWidth);
2224   coolingtubesupportarcshape->DefineSection(1,0.5*fgkCoolingTubeSupportWidth);
2225   TGeoVolume* coolingtubesupportarc = new TGeoVolume("CoolingTubeSupportArc",
2226                                                                           coolingtubesupportarcshape,
2227                                                                                   fSSDTubeHolderMedium);
2228   coolingtubesupportarc->SetLineColor(fColorG10);
2229   //////////////////////////////////////////////////////////////////////////
2230   // TGeoTubeSeg Volume definition for Cooling Tube Support TGeoTubeSeg Part
2231   //////////////////////////////////////////////////////////////////////////
2232   TGeoTubeSeg* coolingtubesupportsegshape = 
2233                                                         new TGeoTubeSeg(fgkCoolingTubeSupportRmin,
2234                                                                                         fgkCoolingTubeSupportRmax,
2235                                                                                         0.5*fgkCoolingTubeSupportWidth,
2236                                                                                         phi,360-phi);
2237   TGeoVolume* coolingtubesupportseg = new TGeoVolume("CoolingTubeSupportSeg",
2238                                                                                         coolingtubesupportsegshape,
2239                                                                                         fSSDTubeHolderMedium);
2240   coolingtubesupportseg->SetLineColor(fColorG10);
2241   //////////////////////////////////////////////////////////////////////////
2242   // TGeoBBox Volume definition for Cooling Tube Support Box Part
2243   //////////////////////////////////////////////////////////////////////////
2244   Double_t* boxorigin = new Double_t[3];
2245   Double_t boxlength = fgkCoolingTubeSupportLength-2.*fgkCoolingTubeSupportRmax;
2246   boxorigin[0] = fgkCoolingTubeSupportRmax+0.5*boxlength, boxorigin[1] = boxorigin[2] = 0.;
2247   TGeoBBox* coolingtubesupportboxshape = new TGeoBBox(0.5*boxlength,
2248                                                                                  0.5*fgkCoolingTubeSupportHeight,
2249                                                                                  0.5*fgkCoolingTubeSupportWidth,boxorigin);
2250   TGeoVolume* coolingtubesupportbox = new TGeoVolume("CoolingTubeSupportBox",
2251                                coolingtubesupportboxshape,fSSDTubeHolderMedium);
2252   coolingtubesupportbox->SetLineColor(fColorG10);
2253   //////////////////////////////////////////////////////////////////////////
2254   // Cooling Tube for Cooling Tube Support 
2255   //////////////////////////////////////////////////////////////////////////
2256   TGeoXtru* coolingtubearcshape[2];
2257   coolingtubearcshape[0] = new TGeoXtru(2);     
2258   Double_t* xvert = new Double_t[nedges+2];
2259   Double_t* yvert = new Double_t[nedges+2];
2260   Double_t ratio = fgkCoolingTubeRmin/fgkCoolingTubeSupportRmin;
2261   ////////////////////////////////////////
2262   // Positioning the vertices for TGeoXTru
2263   ////////////////////////////////////////
2264   xvert[0] = 0., yvert[0] = 0.;
2265   xvert[1] = vertexposition[0]->X()*ratio,  yvert[1] = vertexposition[0]->Y()*ratio;
2266   for(Int_t i=0; i< nedges; i++)
2267                 xvert[i+2] = vertexposition[kvertexnumber-i-1]->X()*ratio,
2268                 yvert[i+2] = vertexposition[kvertexnumber-i-1]->Y()*ratio;
2269   ////////////////////////////////////////
2270   // Defining TGeoXTru PolyGone
2271   ////////////////////////////////////////
2272   coolingtubearcshape[0]->DefinePolygon(nedges+2,xvert,yvert);
2273   coolingtubearcshape[0]->DefineSection(0,-0.5*fgkCoolingTubeSupportWidth);
2274   coolingtubearcshape[0]->DefineSection(1,0.5*fgkCoolingTubeSupportWidth);
2275   coolingtubearcshape[1] = GetArcShape(2.*phi,fgkCoolingTubeRmin,
2276                 fgkCoolingTubeRmax,nedges,fgkCoolingTubeSupportWidth);
2277   TGeoVolume* coolingtubearc[2];
2278   coolingtubearc[0] = new TGeoVolume("CoolingTubeWaterArcPart",
2279                                                                   coolingtubearcshape[0],fSSDCoolingTubeWater);
2280   coolingtubearc[1] = new TGeoVolume("CoolingTubePhynoxArcPart",
2281                                                                   coolingtubearcshape[1],fSSDCoolingTubePhynox);
2282   coolingtubearc[0]->SetLineColor(fColorWater);
2283   coolingtubearc[1]->SetLineColor(fColorPhynox);
2284   ////////////////////////////////////////////
2285   // Defining TGeoTubeSeg Part of Cooling Tube
2286   ////////////////////////////////////////////
2287   TGeoTubeSeg* coolingtubesegshape[2];
2288   coolingtubesegshape[0] = new TGeoTubeSeg(fgkCoolingTubeRmin,fgkCoolingTubeRmax,
2289                                                         0.5*fgkCoolingTubeSupportWidth,phi,360-phi);
2290   coolingtubesegshape[1] = new TGeoTubeSeg(0.,fgkCoolingTubeRmin,
2291                                                         0.5*fgkCoolingTubeSupportWidth,phi,360-phi);
2292   TGeoVolume* coolingtubeseg[2];
2293   coolingtubeseg[0] = new TGeoVolume("CoolingTubePhynoxPart",
2294                                                                  coolingtubesegshape[0],fSSDCoolingTubePhynox);
2295   coolingtubeseg[1] = new TGeoVolume("CoolingTubeWaterPart",
2296                                                                  coolingtubesegshape[1],fSSDCoolingTubeWater);
2297   coolingtubeseg[0]->SetLineColor(fColorPhynox);
2298   coolingtubeseg[1]->SetLineColor(fColorWater);
2299   /////////////////////////////////////////////////////////////
2300   // Virtual Volume containing Cooling Tube Support  
2301   /////////////////////////////////////////////////////////////
2302   TGeoXtru* virtualCoolingTubeSupportShape = new TGeoXtru(2);
2303   const Int_t kvirtualvertexnumber = 8;
2304   TVector3* virtualvertex[kvirtualvertexnumber];
2305    ////////////////////////////////////////
2306   // Positioning the vertices for TGeoXTru
2307   ////////////////////////////////////////
2308   virtualvertex[0] = new TVector3(-fgkCoolingTubeSupportRmax,-fgkCoolingTubeSupportRmax); 
2309   virtualvertex[1] = new TVector3(virtualvertex[0]->X(),-virtualvertex[0]->Y());
2310   virtualvertex[2] = new TVector3(-virtualvertex[0]->X(),virtualvertex[1]->Y());
2311   virtualvertex[3] = new TVector3(virtualvertex[2]->X(),0.5*fgkCoolingTubeSupportHeight);
2312   virtualvertex[4] = new TVector3(virtualvertex[3]->X()+boxlength,virtualvertex[3]->Y());
2313   virtualvertex[5] = new TVector3(virtualvertex[4]->X(),-virtualvertex[4]->Y());
2314   virtualvertex[6] = new TVector3(virtualvertex[3]->X(),-virtualvertex[3]->Y());
2315   virtualvertex[7] = new TVector3(virtualvertex[2]->X(),-virtualvertex[2]->Y());
2316   Double_t xmothervertex[kvirtualvertexnumber], ymothervertex[kvirtualvertexnumber];
2317   for(Int_t i=0; i< kvirtualvertexnumber; i++)
2318         xmothervertex[i] = virtualvertex[i]->X(),
2319         ymothervertex[i] = virtualvertex[i]->Y();
2320   ////////////////////////////////////////
2321   // Defining TGeoXTru PolyGone
2322   ////////////////////////////////////////
2323   virtualCoolingTubeSupportShape->DefinePolygon(kvirtualvertexnumber,xmothervertex,
2324                                                                                                                                          ymothervertex);
2325   virtualCoolingTubeSupportShape->DefineSection(0,-0.5*fgkCoolingTubeSupportWidth);
2326   virtualCoolingTubeSupportShape->DefineSection(1,0.5*fgkCoolingTubeSupportWidth);
2327   TGeoVolume* virtualcoolingtubesupport = new TGeoVolume("CoolingTubeSupport",
2328                                                                  virtualCoolingTubeSupportShape,fSSDAir);
2329   ////////////////////////////////////////
2330   // Positioning Volumes in Virtual Volume
2331   ////////////////////////////////////////
2332   TGeoRotation* coolingtubesupportrot = new TGeoRotation(); 
2333   coolingtubesupportrot->SetAngles(-90.0,0.0,0.0);
2334   virtualcoolingtubesupport->AddNode(coolingtubesupportarc,1,coolingtubesupportrot);
2335   virtualcoolingtubesupport->AddNode(coolingtubesupportbox,1);
2336   virtualcoolingtubesupport->AddNode(coolingtubesupportseg,1);
2337   virtualcoolingtubesupport->AddNode(coolingtubearc[0],1,coolingtubesupportrot);
2338   virtualcoolingtubesupport->AddNode(coolingtubearc[1],1,coolingtubesupportrot);
2339   virtualcoolingtubesupport->AddNode(coolingtubeseg[0],1);
2340   virtualcoolingtubesupport->AddNode(coolingtubeseg[1],1);
2341   /////////////////////////////////////////////////////////////
2342   // Deallocating memory
2343   /////////////////////////////////////////////////////////////
2344   delete [] vertexposition;
2345   delete xvertexpoints;
2346   delete yvertexpoints;
2347   delete xvert;
2348   delete yvert;
2349   for(Int_t i=0; i< kvirtualvertexnumber; i++)
2350         delete virtualvertex[i];
2351   /////////////////////////////////////////////////////////////
2352         return virtualcoolingtubesupport;
2353 }
2354 /////////////////////////////////////////////////////////////////////////////////
2355 TList* AliITSv11GeometrySSD::GetSSDHybridParts(){
2356   /////////////////////////////////////////////////////////////
2357   // Method generating List containing SSD Hybrid Components   
2358   /////////////////////////////////////////////////////////////
2359   TList* ssdhybridlist = new TList();
2360   const Int_t kssdstiffenernumber = 2;
2361   Double_t ssdstiffenerseparation = fgkSSDSensorLength
2362                                                                   - 2.*fgkSSDModuleStiffenerPosition[1]
2363                                                                   -    fgkSSDStiffenerWidth;
2364   Double_t ssdchipcablesradius[kssdstiffenernumber];
2365   for(Int_t i=0; i<kssdstiffenernumber; i++)
2366           ssdchipcablesradius[i] = 0.25*(fgkSSDChipCablesHeight[i+2]
2367                                -  fgkSSDChipCablesHeight[0]
2368                                -  fgkSSDChipCablesHeight[1]);
2369   /////////////////////////////////////////////////////////////
2370   // Mother Volumes Containers 
2371   /////////////////////////////////////////////////////////////
2372   const Int_t kmothernumber = 2;
2373   const Int_t kmothervertexnumber = 12;
2374   Double_t xmothervertex[kmothernumber][kmothervertexnumber]; 
2375   Double_t ymothervertex[kmothernumber][kmothervertexnumber]; 
2376   ///////////////////////
2377   // Setting the vertices 
2378   ///////////////////////
2379   xmothervertex[0][0]  = -0.5*fgkSSDStiffenerLength;
2380   xmothervertex[0][1]  = xmothervertex[0][0]; 
2381   xmothervertex[0][2]  = fgkSSDFlexLength[0]-0.5*fgkSSDStiffenerLength;
2382   xmothervertex[0][3]  = xmothervertex[0][2];
2383   xmothervertex[0][4]  = xmothervertex[0][0];
2384   xmothervertex[0][5]  = xmothervertex[0][4];
2385   xmothervertex[0][6]  = -xmothervertex[0][0];
2386   xmothervertex[0][7]  = xmothervertex[0][6];
2387   xmothervertex[0][8]  = -xmothervertex[0][2];
2388   xmothervertex[0][9]  = xmothervertex[0][8];
2389   xmothervertex[0][10] = xmothervertex[0][7];
2390   xmothervertex[0][11] = xmothervertex[0][10];
2391   for(Int_t i=0; i<kmothervertexnumber; i++) xmothervertex[1][i] = xmothervertex[0][i];
2392   for(Int_t i = 0; i<kmothernumber; i++){
2393       ymothervertex[i][0]  = -(fgkSSDChipWidth-(0.5*fgkSSDStiffenerWidth-fgkSSDStiffenerToChipDist)
2394                            + ssdchipcablesradius[i]+fgkSSDChipCablesWidth[1]+fgkSSDChipCablesWidth[2]);
2395       ymothervertex[i][1]  = ssdstiffenerseparation-0.5*fgkSSDStiffenerWidth-fgkSSDFlexWidth[0];
2396       ymothervertex[i][2]  = ymothervertex[i][1];
2397       ymothervertex[i][3]  = ssdstiffenerseparation-0.5*fgkSSDStiffenerWidth;
2398       ymothervertex[i][4]  = ymothervertex[i][3];
2399       ymothervertex[i][5]  = ymothervertex[i][4]+0.5*fgkSSDStiffenerWidth-ymothervertex[i][0];
2400       ymothervertex[i][6]  = ymothervertex[i][5];
2401       ymothervertex[i][7]  = 0.5*fgkSSDStiffenerWidth+fgkSSDFlexWidth[0];
2402       ymothervertex[i][8]  = ymothervertex[i][7];
2403       ymothervertex[i][9]  = 0.5*fgkSSDStiffenerWidth;
2404       ymothervertex[i][10] = ymothervertex[i][9];
2405       ymothervertex[i][11] = ymothervertex[i][0];
2406   }
2407   TGeoXtru* ssdhybridmothershape[kmothernumber];
2408 //  TGeoVolume* ssdhybridmother[kmothernumber];
2409   TGeoVolumeAssembly* ssdhybridmother[kmothernumber];
2410   const char* ssdhybridmothername[kmothernumber] = {"SSDHybridMother1","SSDHybridMother2"};
2411   for(Int_t i=0; i<kmothernumber; i++){
2412       ssdhybridmothershape[i] = new TGeoXtru(2);
2413       ssdhybridmothershape[i]->DefinePolygon(kmothervertexnumber,xmothervertex[i],
2414                                           ymothervertex[i]);
2415       ssdhybridmothershape[i]->DefineSection(0,-0.5*fgkSSDStiffenerHeight-fgkSSDChipHeight      
2416                                                -fgkSSDChipCablesHeight[i+2]);
2417       ssdhybridmothershape[i]->DefineSection(1, 0.5*fgkSSDStiffenerHeight);
2418 //      ssdhybridmother[i] = new TGeoVolume(ssdhybridmothername[i],ssdhybridmothershape[i],
2419 //                                          fSSDAir);
2420       ssdhybridmother[i] = new TGeoVolumeAssembly(ssdhybridmothername[i]);
2421    }   
2422   /////////////////////////////////////////////////////////////
2423   // SSD Stiffener   
2424   /////////////////////////////////////////////////////////////
2425   TGeoBBox* ssdstiffenershape = new TGeoBBox("SSDStiffenerShape",
2426                                              0.5*fgkSSDStiffenerLength,
2427                                              0.5*(fgkSSDStiffenerWidth-fgkSSDTolerance),
2428                                              0.5*fgkSSDStiffenerHeight);
2429   TGeoVolume* ssdstiffener = new TGeoVolume("SSDStiffener",ssdstiffenershape,
2430                                             fSSDStiffenerMedium);  
2431   ssdstiffener->SetLineColor(fColorStiffener); 
2432   TGeoTranslation* ssdstiffenertrans[kssdstiffenernumber];
2433   for(Int_t i=0; i<kssdstiffenernumber; i++) 
2434       ssdstiffenertrans[i] = new TGeoTranslation(0.,i*ssdstiffenerseparation,0.);
2435   /////////////////////////////////////////////////////////////
2436   // SSD Chip System    
2437   /////////////////////////////////////////////////////////////
2438   TList* ssdchipsystemlist = GetSSDChipSystem(); 
2439   Double_t ssdchipseparation = fgkSSDSensorLength
2440                              - 2.*fgkSSDModuleStiffenerPosition[1]
2441                              - 2.*(fgkSSDStiffenerWidth-fgkSSDStiffenerToChipDist
2442                              - 0.5*fgkSSDChipWidth);
2443   Double_t ssdchipsystemlength = (fgkSSDChipNumber-1)*(fgkSSDChipLength 
2444                                +  fgkSSDChipSeparationLength)+fgkSSDChipCablesLength[1];
2445   TGeoTranslation* ssdchipsystemtrans = new TGeoTranslation(0.5*fgkSSDChipCablesLength[1]
2446                                       - 0.5*ssdchipsystemlength,
2447                                         0.5*(ssdstiffenerseparation-ssdchipseparation),
2448                                       - 0.5*(fgkSSDChipHeight+fgkSSDStiffenerHeight));  
2449 ////////////////////////////
2450 // Capacitor 0603-2200 nF
2451 ///////////////////////////
2452   const Int_t knapacitor0603number = 5;
2453   TGeoBBox* capacitor0603shape =  new TGeoBBox("Capacitor0603Shape",
2454                                                                                          0.5*fgkSSDCapacitor0603Length,
2455                                                                                          0.5*(fgkSSDCapacitor0603Width),
2456                                                                                          0.5*fgkSSDCapacitor0603Height);
2457   TGeoVolume* capacitor0603 = new TGeoVolume("Capacitor0603",capacitor0603shape,
2458                                              fSSDStiffener0603CapacitorMedium); 
2459   capacitor0603->SetLineColor(fColorAl);
2460   for(Int_t i=0; i<kmothernumber; i++){
2461       for(Int_t j=0; j<kssdstiffenernumber; j++){
2462             ssdhybridmother[i]->AddNode(ssdstiffener,j+1,ssdstiffenertrans[j]);
2463             for(Int_t k=1; k<knapacitor0603number+1; k++){
2464                   ssdhybridmother[i]->AddNode(capacitor0603,knapacitor0603number*j+k,
2465                         new TGeoTranslation((k-3.)/6*fgkSSDStiffenerLength,
2466                                            j*ssdstiffenerseparation
2467                         +                    0.5*((j==0? 1:-1)*fgkSSDStiffenerWidth
2468                         +                    (j==0? -1:+1)*fgkSSDCapacitor0603Width),
2469                         -                    0.5*(fgkSSDStiffenerHeight+fgkSSDCapacitor0603Height)));
2470             }
2471       } 
2472       ssdhybridmother[i]->AddNode((TGeoVolume*)ssdchipsystemlist->At(i),i+1,ssdchipsystemtrans);
2473       ssdhybridlist->Add(ssdhybridmother[i]);
2474   }    
2475 /////////////////////////////////////////////////////////////
2476 // Mother Volume Containing Capacitor Part 
2477 /////////////////////////////////////////////////////////////
2478   const Int_t kcapacitormothernumber = 8;
2479   Double_t xcapacitorvertex[kcapacitormothernumber];
2480   Double_t ycapacitorvertex[kcapacitormothernumber];  
2481   ///////////////////////
2482   // Setting the vertices 
2483   ///////////////////////
2484   xcapacitorvertex[0] = -fgkSSDConnectorPosition[0]+ssdstiffenershape->GetDX();    
2485   xcapacitorvertex[1] = xcapacitorvertex[0];   
2486   xcapacitorvertex[2] = 0.5*fgkSSDFlexHoleWidth;   
2487   xcapacitorvertex[3] = xcapacitorvertex[2];   
2488   xcapacitorvertex[4] = xcapacitorvertex[0];   
2489   xcapacitorvertex[5] = xcapacitorvertex[0];   
2490   xcapacitorvertex[6] = -xcapacitorvertex[0];   
2491   xcapacitorvertex[7] = xcapacitorvertex[6];   
2492   ycapacitorvertex[0] = -0.5*fgkSSDStiffenerWidth;    
2493   ycapacitorvertex[1] = ssdstiffenerseparation-0.5*fgkSSDStiffenerWidth-fgkSSDFlexHoleLength;   
2494   ycapacitorvertex[2] = ycapacitorvertex[1];   
2495   ycapacitorvertex[3] = ycapacitorvertex[2]+fgkSSDFlexHoleLength;   
2496   ycapacitorvertex[4] = ycapacitorvertex[3];   
2497   ycapacitorvertex[5] = ycapacitorvertex[4]+fgkSSDStiffenerWidth;   
2498   ycapacitorvertex[6] = ycapacitorvertex[5];   
2499   ycapacitorvertex[7] = ycapacitorvertex[0];   
2500   TGeoXtru* ssdhybridcapacitormothershape = new TGeoXtru(2);
2501   ssdhybridcapacitormothershape->DefinePolygon(kcapacitormothernumber,xcapacitorvertex,
2502                                               ycapacitorvertex);
2503   ssdhybridcapacitormothershape->DefineSection(0,0.5*fgkSSDStiffenerHeight);
2504   ssdhybridcapacitormothershape->DefineSection(1, 0.5*fgkSSDStiffenerHeight+fgkSSDCapacitor1812Height);
2505 //  TGeoVolume* ssdhybridcapacitormother = new TGeoVolume("SSDHybridCapacitorMother",ssdhybridcapacitormothershape,
2506 //                                          fSSDAir);
2507   TGeoVolumeAssembly* ssdhybridcapacitormother = new TGeoVolumeAssembly("SSDHybridCapacitorMother");
2508 ////////////////////////////
2509 // Connector 
2510 ///////////////////////////
2511   const Int_t kssdconnectornumber = 2;
2512   TGeoBBox* ssdconnectorshape[kssdconnectornumber];
2513   Double_t ssdAlconnectororigin[3] = {0.0,0.0,0.5*(fgkSSDStiffenerHeight+fgkSSDConnectorAlHeight)};    
2514   Double_t ssdNiconnectororigin[3] = {0.0,0.0,0.5*(fgkSSDStiffenerHeight+fgkSSDConnectorNiHeight)
2515                                    +  fgkSSDConnectorAlHeight};  
2516   const char* ssdconnectorname[kssdconnectornumber] = {"SSDConnectorAl","SSDConnectorNi"};
2517   TGeoVolume* ssdconnector[kssdconnectornumber];
2518   for(Int_t i=0; i<kssdconnectornumber; i++){
2519       ssdconnectorshape[i] = new TGeoBBox(0.5*fgkSSDConnectorLength,
2520                                           0.5*fgkSSDConnectorWidth,
2521                                           0.5*((1-i)*fgkSSDConnectorAlHeight
2522                            +              i*fgkSSDConnectorNiHeight),
2523                              i==0? ssdAlconnectororigin : ssdNiconnectororigin);
2524       ssdconnector[i] = new TGeoVolume(ssdconnectorname[i],ssdconnectorshape[i],
2525                                        i==0 ? fSSDAlTraceFlexMedium 
2526                                             : fSSDStiffenerConnectorMedium);      
2527       ssdconnector[i]->SetLineColor(i==0 ? fColorAl : fColorPhynox);
2528   }
2529   TGeoTranslation* ssdconnectortrans[2*kssdconnectornumber];
2530   ssdconnectortrans[0] = new TGeoTranslation(-ssdstiffenershape->GetDX()
2531                        +  fgkSSDConnectorPosition[0]
2532                        -  fgkSSDConnectorSeparation
2533                        -  1.5*fgkSSDConnectorLength,
2534                           ssdstiffenerseparation+ssdstiffenershape->GetDY()
2535                        -  fgkSSDConnectorPosition[1]
2536                        -  ssdconnectorshape[0]->GetDY(),0.0);   
2537   ssdconnectortrans[1] = new TGeoTranslation(
2538                        -  ssdstiffenershape->GetDX()
2539                        +  fgkSSDConnectorPosition[0]
2540                        -  0.5*fgkSSDConnectorLength,
2541                           ssdstiffenerseparation+ssdstiffenershape->GetDY()
2542                        -  fgkSSDConnectorPosition[1]
2543                        -  ssdconnectorshape[0]->GetDY(),0.0);
2544   ssdconnectortrans[2] = new TGeoTranslation(+ssdstiffenershape->GetDX()
2545                        -  fgkSSDConnectorPosition[0]
2546                        +  fgkSSDConnectorSeparation
2547                        +  1.5*fgkSSDConnectorLength,
2548                           -(ssdstiffenershape->GetDY()
2549                        -  fgkSSDConnectorPosition[1]
2550                        -  ssdconnectorshape[0]->GetDY()),0.0);  
2551   ssdconnectortrans[3] = new TGeoTranslation(+ssdstiffenershape->GetDX()
2552                        -  fgkSSDConnectorPosition[0]
2553                        +  0.5*fgkSSDConnectorLength,
2554                           -(ssdstiffenershape->GetDY()
2555                        -  fgkSSDConnectorPosition[1]
2556                        -  ssdconnectorshape[0]->GetDY()),0.0);
2557   for(Int_t i=0; i<2*kssdconnectornumber; i++)
2558       for(Int_t j=0; j<kssdconnectornumber; j++)
2559             ssdhybridcapacitormother->AddNode(ssdconnector[j],i+1,ssdconnectortrans[i]);      
2560 ////////////////////////////
2561 // Capacitor 1812-330 nF
2562 /////////////////////////// 
2563   Double_t ssdcapacitor1812origin[3] = {0.0,0.0,0.5*(fgkSSDStiffenerHeight+fgkSSDCapacitor1812Height)};    
2564   TGeoBBox* capacitor1812shape =  new TGeoBBox("Capacitor1812Shape",
2565                                                                                          0.5*fgkSSDCapacitor1812Length,
2566                                                                                          0.5*fgkSSDCapacitor1812Width,
2567                                                                                          0.5*fgkSSDCapacitor1812Height,
2568             ssdcapacitor1812origin);
2569   TGeoVolume* capacitor1812 = new TGeoVolume("Capacitor1812",capacitor1812shape,
2570                                              fSSDStiffener1812CapacitorMedium); 
2571   capacitor1812->SetLineColor(fColorAl);
2572   TGeoTranslation* capacitor1812trans = new TGeoTranslation(0.0,
2573                                         0.5*fgkSSDStiffenerWidth+ssdstiffenerseparation
2574                                       - capacitor1812shape->GetDY()-fgkSSDConnectorPosition[1],0.0);
2575   ssdhybridcapacitormother->AddNode(capacitor1812,1,capacitor1812trans);
2576 ////////////////////////////
2577 //Hybrid Wire
2578 ////////////////////////////
2579   Double_t wirex = 2.*(fgkSSDConnectorPosition[0]-0.5*fgkSSDStiffenerLength
2580                                  - 0.5*fgkSSDConnectorLength)-fgkSSDConnectorLength
2581                                  - fgkSSDConnectorSeparation;
2582   Double_t wirey = ssdstiffenerseparation+fgkSSDStiffenerWidth
2583                                  - 2.*fgkSSDConnectorPosition[1]-fgkSSDConnectorWidth;
2584   Double_t ssdwireradius = TMath::Sqrt(TMath::Power(wirex,2.)
2585                                          + TMath::Power(wirey,2));
2586   Double_t wireangle = TMath::ATan(wirex/wirey);
2587   TGeoTube *hybridwireshape = new TGeoTube("HybridWireShape", 0., 
2588                                                 fgkSSDWireRadius, 0.5*ssdwireradius);
2589   TGeoVolume* hybridwire = new TGeoVolume("HybridWire",hybridwireshape,
2590                                              fSSDStiffenerHybridWireMedium); 
2591   hybridwire->SetLineColor(fColorPhynox);
2592   TGeoCombiTrans* hybridwirecombitrans[2];
2593   hybridwirecombitrans[0] = new TGeoCombiTrans("HybridWireCombiTrans1",
2594                    0.5*fgkSSDStiffenerLength-fgkSSDConnectorPosition[0]
2595                                  + 1.5*fgkSSDConnectorLength+fgkSSDConnectorSeparation,
2596                    0.5*ssdwireradius-0.5*fgkSSDStiffenerWidth
2597                                  + fgkSSDConnectorPosition[1]+0.5*fgkSSDConnectorWidth,
2598                                    ssdstiffenershape->GetDZ()
2599                                  + fgkSSDWireRadius+fgkSSDConnectorAlHeight+fgkSSDConnectorNiHeight,
2600                    new TGeoRotation("HybridWireRot1",0.,90.,0.));
2601   hybridwirecombitrans[1] = new TGeoCombiTrans("HybridWireCombiTrans2",
2602                             0.0,
2603                           - 0.5*fgkSSDConnectorWidth+fgkSSDWireRadius,
2604                             0.0,        
2605                             new TGeoRotation("HybridWireRot2",
2606                           - wireangle*TMath::RadToDeg(),0.,0.));
2607   TGeoHMatrix* hybridwirematrix = new TGeoHMatrix();
2608   hybridwirematrix->MultiplyLeft(hybridwirecombitrans[0]);
2609   hybridwirematrix->MultiplyLeft(hybridwirecombitrans[1]);
2610   ssdhybridcapacitormother->AddNode(hybridwire,1,hybridwirematrix);
2611   ssdhybridlist->Add(ssdhybridcapacitormother);
2612   /////////////////////////////////////////////////////////////
2613   // Deallocating memory
2614   /////////////////////////////////////////////////////////////
2615   delete hybridwirecombitrans[0];
2616   delete hybridwirecombitrans[1];
2617   delete ssdchipsystemlist;
2618   return ssdhybridlist;
2619   /////////////////////////////////////////////////////////////
2620 }
2621 ///////////////////////////////////////////////////////////////////////////////
2622 TGeoVolume* AliITSv11GeometrySSD::GetCoolingBlockSystem(){
2623   /////////////////////////////////////////////////////////////
2624   // SSD Cooling Block System
2625   /////////////////////////////////////////////////////////////
2626   // SSD Cooling Block and Cooling Tube Transformations
2627   /////////////////////////////////////////////////////////////
2628   TGeoRotation* localcoolingblockrot = new TGeoRotation();
2629   localcoolingblockrot->SetAngles(0.,90.,0.);
2630   TGeoCombiTrans localcoolingblockmatrix(0.,0.5*fgkSSDCoolingBlockWidth,0.,localcoolingblockrot);
2631   TVector3* coolingblocktransvector;
2632   coolingblocktransvector = new TVector3(fgkSSDModuleSensorSupportDistance
2633                                                                 + fgkSSDCoolingBlockLength,
2634                                                                   fgkSSDSensorLength
2635                                                                 - 2.*fgkSSDModuleStiffenerPosition[1]
2636                                                                 - fgkSSDCoolingBlockWidth);
2637   const Int_t kcoolingblocktransnumber = 2;
2638   const Int_t kcoolingblocknumber = 4;
2639   TGeoHMatrix* coolingblockmatrix[kcoolingblocknumber];
2640   TGeoHMatrix* coolingtubematrix[kcoolingblocknumber];
2641   TGeoRotation* localcoolingtuberot = new TGeoRotation();
2642   localcoolingtuberot->SetAngles(0.0,90.0,0.0);
2643   TGeoTranslation* localcoolingtubetrans = new TGeoTranslation();
2644   localcoolingtubetrans->SetTranslation(0.5*fgkSSDCoolingBlockLength,
2645                                         0.5*fgkSSDCoolingBlockWidth,
2646                                         fgkSSDCoolingBlockHoleCenter);
2647   TGeoCombiTrans localcoolingtubematrix (*localcoolingtubetrans,*localcoolingtuberot);
2648   Double_t coolingtubedistance = fgkCoolingTubeSupportRmax-fgkCoolingTubeSupportRmin;
2649   for(Int_t i=0; i<kcoolingblocktransnumber; i++){
2650     for(Int_t j=0; j<kcoolingblocktransnumber; j++){
2651       TGeoTranslation localcoolingblocktrans(i*coolingblocktransvector->X()+2*coolingtubedistance,
2652                                              j*coolingblocktransvector->Y(),
2653                                              - 0.5*(fgkSSDCoolingBlockHoleCenter
2654                                                     + fgkCoolingTubeRmax));
2655       coolingblockmatrix[2*i+j] = new TGeoHMatrix(localcoolingblocktrans*localcoolingblockmatrix);
2656       coolingtubematrix[2*i+j] = new TGeoHMatrix(localcoolingblocktrans*localcoolingtubematrix);
2657     }
2658   }
2659   /////////////////////////////////////////////////////////////
2660   // Virtual Volume containing CoolingBlock System   
2661   /////////////////////////////////////////////////////////////
2662   TGeoXtru* coolingsystemothershape = new TGeoXtru(2);
2663   const Int_t kmothervertexnumber = 16;  
2664   Double_t xmothervertex[kmothervertexnumber];
2665   Double_t ymothervertex[kmothervertexnumber];
2666   ///////////////////////
2667   // Setting the vertices 
2668   ///////////////////////fgkCoolingTubeSupportRmax
2669   xmothervertex[0] = 0.0,ymothervertex[0] = 0.0;
2670   xmothervertex[1] = xmothervertex[0], ymothervertex[1] = coolingblocktransvector->Y()
2671                                    + fgkSSDCoolingBlockWidth;
2672   xmothervertex[2] = coolingblocktransvector->X()
2673                                    + fgkSSDCoolingBlockLength
2674                                    + 4*coolingtubedistance;
2675   ymothervertex[2] = ymothervertex[1];
2676   xmothervertex[3] = xmothervertex[2], ymothervertex[3] = ymothervertex[0];
2677   xmothervertex[4] = xmothervertex[3]-2.*coolingtubedistance-fgkSSDCoolingBlockLength;
2678   ymothervertex[4] = ymothervertex[0];
2679   xmothervertex[5] = xmothervertex[4], ymothervertex[5] = fgkSSDCoolingBlockWidth;
2680   xmothervertex[6] = xmothervertex[3]-coolingtubedistance; 
2681   ymothervertex[6] = ymothervertex[5]; 
2682   xmothervertex[7] = xmothervertex[6], ymothervertex[7] = ymothervertex[2]
2683                                    - fgkSSDCoolingBlockWidth; 
2684   xmothervertex[8] = xmothervertex[5], ymothervertex[8] = ymothervertex[7];
2685   xmothervertex[9] = xmothervertex[8], ymothervertex[9] = ymothervertex[2]
2686                                    - coolingtubedistance;
2687   xmothervertex[10] = fgkSSDCoolingBlockLength+2.*coolingtubedistance;
2688   ymothervertex[10] = ymothervertex[9];
2689   xmothervertex[11] = xmothervertex[10], ymothervertex[11] = ymothervertex[8];
2690   xmothervertex[12] = coolingtubedistance, ymothervertex[12] = ymothervertex[11];
2691   xmothervertex[13] = xmothervertex[12], ymothervertex[13] = fgkSSDCoolingBlockWidth;
2692   xmothervertex[14] = 2.*coolingtubedistance+fgkSSDCoolingBlockLength;
2693   ymothervertex[14] = ymothervertex[13];
2694   xmothervertex[15] = xmothervertex[14], ymothervertex[15] = ymothervertex[0];
2695   //////////////////////////////////////////////////////////
2696   coolingsystemothershape->DefinePolygon(kmothervertexnumber,
2697                                                                         xmothervertex,ymothervertex);
2698   coolingsystemothershape->DefineSection(0,-0.5*(fgkSSDCoolingBlockHoleCenter
2699                                                                                            + fgkCoolingTubeRmax));
2700   coolingsystemothershape->DefineSection(1, 0.5*(fgkSSDCoolingBlockHoleCenter
2701                                                                                            + fgkCoolingTubeRmax));
2702   TGeoVolume* coolingsystemother = new TGeoVolumeAssembly("CoolingBlockSystem");
2703 //  TGeoVolume* coolingsystemother = new TGeoVolume("CoolingBlockSystem",
2704 //                                                        coolingsystemothershape,fSSDAir);
2705   /////////////////////////////////////////////////////////////
2706   // SSD Cooling Tube Part 
2707   /////////////////////////////////////////////////////////////
2708   TGeoTube* coolingtubeshape[fgkcoolingtubenumber];
2709   coolingtubeshape[0] = new TGeoTube(fgkCoolingTubeRmin,fgkCoolingTubeRmax,
2710                                                                                  0.5*(fgkSSDCoolingBlockWidth-fgkSSDTolerance)); 
2711   coolingtubeshape[1] = new TGeoTube(0.0,fgkCoolingTubeRmin,
2712                                                                          0.5*(fgkSSDCoolingBlockWidth-fgkSSDTolerance));
2713   TGeoVolume* coolingtube[fgkcoolingtubenumber];
2714   coolingtube[0] = new TGeoVolume("OuterCoolingTube",coolingtubeshape[0],
2715                                                                         fSSDCoolingTubePhynox);
2716   coolingtube[1] = new TGeoVolume("InnerCoolingTube",coolingtubeshape[1],
2717                                                                         fSSDCoolingTubeWater);
2718   coolingtube[0]->SetLineColor(fColorPhynox);
2719   coolingtube[1]->SetLineColor(fColorWater);
2720   TGeoVolume* ssdcoolingblock = GetSSDCoolingBlock(30);
2721   /////////////////////////////////////////////////////////////
2722   // Adding Cooling block to mother volume
2723   /////////////////////////////////////////////////////////////
2724    for(Int_t i=0; i<kcoolingblocknumber; i++){ 
2725         coolingsystemother->AddNode(ssdcoolingblock,i+1,coolingblockmatrix[i]);
2726         coolingsystemother->AddNode(coolingtube[0],i+1,coolingtubematrix[i]);
2727         coolingsystemother->AddNode(coolingtube[1],i+1,coolingtubematrix[i]);
2728   }
2729   /////////////////////////////////////////////////////////////
2730   // Deallocating memory
2731   /////////////////////////////////////////////////////////////
2732         delete coolingblocktransvector;
2733         delete localcoolingblockrot;
2734         delete localcoolingtubetrans;
2735         delete localcoolingtuberot;
2736   /////////////////////////////////////////////////////////////
2737   // Checking overlaps  
2738   /////////////////////////////////////////////////////////////
2739         //coolingsystemother->CheckOverlaps(0.01);
2740   /////////////////////////////////////////////////////////////
2741         return coolingsystemother;
2742 }
2743 /////////////////////////////////////////////////////////////////////////////////
2744 TGeoVolume* AliITSv11GeometrySSD::GetSSDStiffenerFlex()const{
2745   /////////////////////////////////////////////////////////////
2746   // SSD Flex
2747   /////////////////////////////////////////////////////////////
2748   const Int_t kssdflexlayernumber = 2;
2749   TGeoXtru* ssdflexshape[kssdflexlayernumber];
2750   for(Int_t i=0; i<kssdflexlayernumber; i++) ssdflexshape[i] = new TGeoXtru(2);
2751   const Int_t kmothervertexnumber = 17; 
2752   Double_t xmothervertex[kmothervertexnumber];
2753   Double_t ymothervertex[kmothervertexnumber];
2754   /////////////////////////////////////////////
2755   // Auxiliary variables for vertex positioning
2756   /////////////////////////////////////////////
2757   const Int_t kssdflexboxnumber = 5;
2758   Double_t ssdflexboxlength[kssdflexboxnumber];
2759   ssdflexboxlength[0] = 0.5*(fgkSSDChipNumber
2760                                           *     fgkSSDChipLength+(fgkSSDChipNumber-1)
2761                                           *     fgkSSDChipSeparationLength
2762                                           - fgkSSDModuleSensorSupportDistance-fgkSSDFlexHoleLength)
2763                                           - (fgkSSDFlexLength[0]-fgkSSDFlexLength[1]);
2764   ssdflexboxlength[1] = fgkSSDModuleSensorSupportDistance+fgkSSDFlexHoleLength;
2765   ssdflexboxlength[2] = 0.5*(fgkSSDModuleSensorSupportDistance
2766                                           -     fgkSSDFlexHoleLength-fgkSSDFlexHoleWidth);      
2767   ssdflexboxlength[3] = fgkSSDFlexHoleWidth;    
2768   ssdflexboxlength[4] = fgkSSDFlexLength[1]-ssdflexboxlength[0]
2769                                           -     ssdflexboxlength[1];
2770   Double_t ssdflexboxwidth[kssdflexboxnumber];
2771   ssdflexboxwidth[0] = fgkSSDFlexWidth[0];
2772   ssdflexboxwidth[1] = fgkSSDFlexWidth[0]-fgkSSDFlexHoleWidth;
2773   ssdflexboxwidth[2] = fgkSSDFlexHoleWidth;
2774   ssdflexboxwidth[3] = ssdflexboxwidth[2]-fgkSSDFlexHoleLength;
2775   ssdflexboxwidth[4] = fgkSSDFlexWidth[0];
2776   ///////////////////////
2777   // Setting the vertices 
2778   ///////////////////////
2779   xmothervertex[0]  = 0.0;
2780   xmothervertex[1]  = xmothervertex[0];
2781   xmothervertex[2]  = fgkSSDFlexLength[0]-fgkSSDFlexLength[1];
2782   xmothervertex[3]  = xmothervertex[2]+ssdflexboxlength[0]+ssdflexboxlength[1]
2783                                         + ssdflexboxlength[4];
2784   xmothervertex[4]  = xmothervertex[3];
2785   xmothervertex[5]  = xmothervertex[4]-ssdflexboxlength[4];
2786   xmothervertex[6]  = xmothervertex[5];
2787   xmothervertex[7]  = xmothervertex[6]-fgkSSDFlexHoleLength;
2788   xmothervertex[8]  = xmothervertex[7];
2789   xmothervertex[9]  = xmothervertex[8]-ssdflexboxlength[2];
2790   xmothervertex[10] = xmothervertex[9]; 
2791   xmothervertex[11] = xmothervertex[10]-ssdflexboxlength[3];
2792   xmothervertex[12] = xmothervertex[11];
2793   xmothervertex[13] = xmothervertex[12]-ssdflexboxlength[2];
2794   xmothervertex[14] = xmothervertex[13];
2795   xmothervertex[15] = xmothervertex[14]-fgkSSDFlexHoleLength;
2796   xmothervertex[16] = xmothervertex[15];
2797   ymothervertex[0]  = 0.0;
2798   ymothervertex[1]  = fgkSSDFlexWidth[1];
2799   ymothervertex[2]  = fgkSSDFlexWidth[0];
2800   ymothervertex[3]  = ymothervertex[2];
2801   ymothervertex[4]  = ymothervertex[0];
2802   ymothervertex[5]  = ymothervertex[4];
2803   ymothervertex[6]  = ssdflexboxwidth[2];
2804   ymothervertex[7]  = ymothervertex[6];
2805   ymothervertex[8]  = ymothervertex[0];
2806   ymothervertex[9]  = ymothervertex[8];
2807   ymothervertex[10] = ssdflexboxwidth[2]-ssdflexboxwidth[3];
2808   ymothervertex[11] = ymothervertex[10];
2809   ymothervertex[12] = ymothervertex[0];
2810   ymothervertex[13] = ymothervertex[12];
2811   ymothervertex[14] = ymothervertex[7];
2812   ymothervertex[15] = ymothervertex[14];
2813   ymothervertex[16] = ymothervertex[0];
2814   /////////////////////////////////////////////////////////////
2815   // First Mother Volume containing SSDFlex
2816   /////////////////////////////////////////////////////////////
2817   TGeoXtru* ssdflexmothershape = new TGeoXtru(2);
2818   ssdflexmothershape->DefinePolygon(kmothervertexnumber,xmothervertex,
2819                                                                     ymothervertex);
2820   ssdflexmothershape->DefineSection(0,-1.5*fgkSSDFlexHeight[0]-2.*fgkSSDFlexHeight[1]);
2821   ssdflexmothershape->DefineSection(1, 0.5*fgkSSDFlexHeight[0]);
2822   TGeoVolumeAssembly* ssdflexmother = new TGeoVolumeAssembly("SSDFlexMother");
2823 //  TGeoVolume* ssdflexmother = new TGeoVolume("SSDFlexMother",ssdflexmothershape,
2824 //                                                                                       fSSDAir);
2825   /////////////////////////////////////////////////////////////
2826   // SSDFlex Layer Shapes
2827   /////////////////////////////////////////////////////////////
2828   for(Int_t i=0; i<kssdflexlayernumber; i++){
2829         ssdflexshape[i]->DefinePolygon(kmothervertexnumber,xmothervertex,
2830                                                                    ymothervertex);
2831     ssdflexshape[i]->DefineSection(0,-0.5*fgkSSDFlexHeight[i]);
2832         ssdflexshape[i]->DefineSection(1, 0.5*fgkSSDFlexHeight[i]);
2833   }
2834   /////////////////////////////////////
2835   // Setting Layers into Mother Volume
2836   /////////////////////////////////////
2837   Int_t ssdflexcolor[kssdflexlayernumber] = {fColorAl,fColorPolyhamide};
2838   TGeoMedium* ssdflexmed[kssdflexlayernumber] = {fSSDAlTraceFlexMedium,
2839                                                                                                  fSSDKaptonFlexMedium};
2840   const char* ssdflexname[2*kssdflexlayernumber] = {"AlFlexLay1","KaptonFlexLay1",