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