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