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