]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11GeometrySupport.cxx
Initialize at analysis time the geometry matrices and calibration parameters stored...
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySupport.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 // This class Defines the Geometry for the ITS services and support cones
17 // outside of the ceneteral volume (except for the Ceneteral support 
18 // cylinders. Other classes define the rest of the ITS. Specificaly the ITS
19 // The SSD support cone,SSD Support centeral cylinder, SDD support cone,
20 // The SDD cupport centeral cylinder, the SPD Thermal Sheald, The supports
21 // and cable trays on both the RB26 (muon dump) and RB24 sides, and all of
22 // the cabling from the ladders/stave ends out past the TPC. 
23
24 /* $Id$ */
25 // General Root includes
26 #include <TMath.h>
27 // Root Geometry includes
28 //#include <AliLog.h>
29 #include <TGeoManager.h>
30 #include <TGeoVolume.h>
31 #include <TGeoPcon.h>
32 #include <TGeoCone.h>
33 #include <TGeoTube.h> // contaings TGeoTubeSeg
34 #include <TGeoArb8.h>
35 #include <TGeoXtru.h>
36 #include <TGeoCompositeShape.h>
37 #include <TGeoMatrix.h>
38 #include "AliITSv11GeometrySupport.h"
39
40 ClassImp(AliITSv11GeometrySupport)
41
42 #define SQ(A) (A)*(A)
43
44 //______________________________________________________________________
45 void AliITSv11GeometrySupport::SPDCone(TGeoVolume *moth,const TGeoManager *mgr)
46 {
47 //
48 // Creates the SPD thermal shield as a volume assembly
49 // and adds it to the mother volume
50 // (this is actually a merge of the previous SPDThermalSheald method
51 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06 and the
52 // CreateSPDThermalShield method of AliITSv11Hybrid)
53 //
54 // Input:
55 //         moth : the TGeoVolume owing the volume structure
56 //         mgr  : the GeoManager (default gGeoManager)
57 // Output:
58 //
59 // Created:         ???          ???
60 // Updated:      11 Dec 2007  Mario Sitta
61 //
62 // Technical data are taken from:  ALICE-Thermal Screen "Cone transition"
63 // (thermal-screen1_a3.ps), "Cylinder" (thermal-screen2_a3.ps), "Half
64 // assembly" (thermal-screen3_a3.ps), "Flange" (thermal-screen4_a3.ps)
65
66
67   // Dimensions of the Central shield
68   const Double_t kHalfLengthCentral  = 399.9*fgkmm;
69   const Double_t kThicknessCentral   = 0.4*fgkmm;
70   const Double_t kInnerRadiusCentral = 8.1475*fgkcm;
71   const Double_t kOuterRadiusCentral = 9.9255*fgkcm;
72   const Double_t kInnerACentral = 3.1674*fgkcm;
73   const Double_t kInnerBCentral = 2.023 *fgkcm;
74   const Double_t kOuterACentral = 2.4374*fgkcm;
75   const Double_t kOuterBCentral = 3.8162*fgkcm;
76   // Dimensions of the EndCap shield
77   const Double_t kHalfLengthEndCap  = 25.*fgkmm;
78   const Double_t kThicknessEndCap   = 2.0*fgkmm;
79   const Double_t kInnerRadiusEndCap = 8.0775*fgkcm;
80   const Double_t kOuterRadiusEndCap = 9.9955*fgkcm;
81   const Double_t kInnerAEndCap = 3.1453*fgkcm;
82   const Double_t kInnerBEndCap = 2.0009*fgkcm;
83   const Double_t kOuterAEndCap = 2.4596*fgkcm;
84   const Double_t kOuterBEndCap = 3.8384*fgkcm;
85   // Dimensions of the Cone shield
86   const Double_t kHalfLengthCone  = 145.*fgkmm;
87   const Double_t kThicknessCone   = 0.3*fgkmm;
88   const Double_t kInnerRadialCone = 37.3*fgkcm;
89   const Double_t kOuterRadialCone = 39.0*fgkcm;
90   const Double_t kInnerACone = 14.2344*fgkcm;
91   //  const Double_t kInnerBCone =  9.0915*fgkcm;
92   const Double_t kOuterACone =  9.5058*fgkcm;
93   //  const Double_t kOuterBCone = 14.8831*fgkcm;
94   // Dimensions of the Flange's Ring and Wing
95   const Double_t kHalfLengthRing  = 7.5*fgkmm;
96   const Double_t kThicknessRing   = 0.3*fgkmm;
97   const Double_t kInnerRadiusRing = 37.3*fgkcm;
98   const Double_t kOuterRadiusRing = 42.0*fgkcm;
99   const Double_t kOuterRadiusWing = 49.25*fgkcm;
100   const Double_t kWideWing      = 6.0*fgkcm;
101   const Double_t kThetaWing     = 45.0;
102   // Common data
103   const Double_t kTheta = 36.0*TMath::DegToRad();
104   const Double_t kThicknessOmega = 0.3*fgkmm;
105
106   // Local variables
107   Double_t x, y;
108   Double_t zpos;
109   Double_t xshld[24], yshld[24];
110   Double_t xair[24] , yair[24];
111   Double_t xomega[48], yomega[48];
112   //  Double_t *xyarb8;
113
114   // The entire shield is made up of two half central shields
115   // symmetric with respect to the XZ plane, four half end cap
116   // shields, again symmetric with respect to the XZ plane, and four
117   // half cones, symmetric with respect to the XZ plane too.
118
119   TGeoVolumeAssembly *vM = new TGeoVolumeAssembly("ITSspdThermalShield");
120
121   // The central half shield: a half tube of carbon fiber,
122   // a similar but proportionally smaller half tube of air inside it,
123   // and a Omega-shaped carbon fiber insert inside the air.
124   // They are all XTru shapes
125
126   TGeoXtru *centralshape = new TGeoXtru(2);
127
128   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
129                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
130                         kTheta,xshld,yshld);
131
132   centralshape->DefinePolygon(24,xshld,yshld);
133   centralshape->DefineSection(0,-kHalfLengthCentral);
134   centralshape->DefineSection(1, kHalfLengthCentral);
135
136   // Now rescale to get the air volume dimensions
137     InsidePoint(xshld[23], yshld[23],
138                 xshld[ 0], yshld[ 0],
139                 xshld[ 1], yshld[ 1], kThicknessCentral,
140                 xair[0], yair[0]);
141   for (Int_t i=1; i<23; i++) {
142     InsidePoint(xshld[i-1], yshld[i-1],
143                 xshld[ i ], yshld[ i ],
144                 xshld[i+1], yshld[i+1], kThicknessCentral,
145                 xair[i], yair[i]);
146   }
147     InsidePoint(xshld[22], yshld[22],
148                 xshld[23], yshld[23],
149                 xshld[ 0], yshld[ 0], kThicknessCentral,
150                 xair[23], yair[23]);
151
152   // Create the air shape
153   TGeoXtru *centralairshape = new TGeoXtru(2);
154
155   centralairshape->DefinePolygon(24,xair,yair);
156   centralairshape->DefineSection(0,-kHalfLengthCentral);
157   centralairshape->DefineSection(1, kHalfLengthCentral);
158
159   // Create the Omega insert
160   TGeoXtru *centralomegashape = new TGeoXtru(2);
161
162   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
163   // Temporary fix for awkward extrusions seen only with Root v5.32
164   yomega[ 1] += 0.0001;
165   yomega[ 2] += 0.0001;
166   yomega[ 5] += 0.0001;
167   yomega[ 6] += 0.0001;
168   xomega[15] -= 0.0001;
169   xomega[16] -= 0.0001;
170   yomega[28] -= 0.0001;
171   yomega[29] -= 0.0001;
172
173   centralomegashape->DefinePolygon(48,xomega,yomega);
174   centralomegashape->DefineSection(0,-kHalfLengthCentral);
175   centralomegashape->DefineSection(1, kHalfLengthCentral);
176
177   // The end cap half shield: a half tube of carbon fiber,
178   // a similar but proportionally smaller half tube of air inside it,
179   // and a Omega-shaped carbon fiber insert inside the air.
180   // They are all XTru shapes
181
182   TGeoXtru *endcapshape = new TGeoXtru(2);
183
184   CreateSPDThermalShape(kInnerAEndCap,kInnerBEndCap,kInnerRadiusEndCap,
185                         kOuterAEndCap,kOuterBEndCap,kOuterRadiusEndCap,
186                         kTheta,xshld,yshld);
187
188   endcapshape->DefinePolygon(24,xshld,yshld);
189   endcapshape->DefineSection(0,-kHalfLengthEndCap);
190   endcapshape->DefineSection(1, kHalfLengthEndCap);
191
192   // Now rescale to get the air volume dimensions
193     InsidePoint(xshld[23], yshld[23],
194                 xshld[ 0], yshld[ 0],
195                 xshld[ 1], yshld[ 1], kThicknessEndCap,
196                 xair[0], yair[0]);
197   for (Int_t i=1; i<23; i++) {
198     InsidePoint(xshld[i-1], yshld[i-1],
199                 xshld[ i ], yshld[ i ],
200                 xshld[i+1], yshld[i+1], kThicknessEndCap,
201                 xair[i], yair[i]);
202   }
203     InsidePoint(xshld[22], yshld[22],
204                 xshld[23], yshld[23],
205                 xshld[ 0], yshld[ 0], kThicknessEndCap,
206                 xair[23], yair[23]);
207
208   // Create the air shape
209   TGeoXtru *endcapairshape = new TGeoXtru(2);
210
211   endcapairshape->DefinePolygon(24,xair,yair);
212   endcapairshape->DefineSection(0,-kHalfLengthEndCap);
213   endcapairshape->DefineSection(1, kHalfLengthEndCap);
214
215   // Create the Omega insert
216   TGeoXtru *endcapomegashape = new TGeoXtru(2);
217
218   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
219   // Temporary fix for awkward extrusions seen only with Root v5.32
220   yomega[19] -= 0.0001;
221   yomega[20] -= 0.0001;
222   yomega[31] -= 0.0001;
223   yomega[42] += 0.0001;
224   yomega[43] += 0.0001;
225   yomega[46] += 0.0001;
226   yomega[47] += 0.0001;
227
228   endcapomegashape->DefinePolygon(48,xomega,yomega);
229   endcapomegashape->DefineSection(0,-kHalfLengthEndCap);
230   endcapomegashape->DefineSection(1, kHalfLengthEndCap);
231
232   // The cone half shield is more complex since there is no basic
233   // TGeo shape to describe it correctly. So it is made of a series
234   // of TGeoArb8 shapes filled with air, which all together make up the
235   // the cone AND its internal insert. Part of the following code is
236   // adapted from SPDThermalSheald method.
237
238   // Filled portions
239   TGeoArb8 *sC1 = new TGeoArb8(kHalfLengthCone);
240   TGeoArb8 *sC2 = new TGeoArb8(kHalfLengthCone);
241
242   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
243                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
244                         kTheta,xshld,yshld);
245
246   sC1->SetVertex(0,xshld[12],yshld[12]);
247   sC1->SetVertex(1,xshld[11],yshld[11]);
248   sC1->SetVertex(2,xshld[ 0],yshld[ 0]);
249   sC1->SetVertex(3,xshld[23],yshld[23]);
250
251   sC2->SetVertex(0,xshld[11],yshld[11]);
252   sC2->SetVertex(1,xshld[10],yshld[10]);
253   sC2->SetVertex(2,xshld[ 1],yshld[ 1]);
254   sC2->SetVertex(3,xshld[ 0],yshld[ 0]);
255
256   // Drawings give only the radius, convert it to the apothegm
257   Double_t kInnerRadiusCone = TMath::Sqrt(kInnerRadialCone*kInnerRadialCone
258                                           - 0.25*kInnerACone*kInnerACone);
259   Double_t kOuterRadiusCone = TMath::Sqrt(kOuterRadialCone*kOuterRadialCone
260                                           - 0.25*kOuterACone*kOuterACone);
261
262   Double_t xco[4], yco[4], xci[4], yci[4];
263
264   for (Int_t i=0; i<2; i++) {
265     Double_t th = i*kTheta*TMath::RadToDeg();
266     xco[2*i  ] = kOuterRadiusCone*SinD(th) - 0.5*kOuterACone*CosD(th);
267     yco[2*i  ] = kOuterRadiusCone*CosD(th) + 0.5*kOuterACone*SinD(th);
268     xci[2*i  ] = kInnerRadiusCone*SinD(th) - 0.5*kInnerACone*CosD(th);
269     yci[2*i  ] = kInnerRadiusCone*CosD(th) + 0.5*kInnerACone*SinD(th);
270     xco[2*i+1] = kOuterRadiusCone*SinD(th) + 0.5*kOuterACone*CosD(th);
271     yco[2*i+1] = kOuterRadiusCone*CosD(th) - 0.5*kOuterACone*SinD(th);
272     xci[2*i+1] = kInnerRadiusCone*SinD(th) + 0.5*kInnerACone*CosD(th);
273     yci[2*i+1] = kInnerRadiusCone*CosD(th) - 0.5*kInnerACone*SinD(th);
274   }
275
276   sC1->SetVertex(4,xco[0],yco[0]);
277   sC1->SetVertex(5,xco[1],yco[1]);
278   sC1->SetVertex(6,xci[1],yci[1]);
279   sC1->SetVertex(7,xci[0],yci[0]);
280
281   sC2->SetVertex(4,xco[1],yco[1]);
282   sC2->SetVertex(5,xco[2],yco[2]);
283   sC2->SetVertex(6,xci[2],yci[2]);
284   sC2->SetVertex(7,xci[1],yci[1]);
285
286   // Air holes
287   TGeoArb8 *sCh1 = new TGeoArb8(kHalfLengthCone);
288   TGeoArb8 *sCh2 = new TGeoArb8(kHalfLengthCone);
289
290   for(Int_t i=0; i<4; i++){
291     InsidePoint(sC1->GetVertices()[((i+3)%4)*2+0],
292                 sC1->GetVertices()[((i+3)%4)*2+1],
293                 sC1->GetVertices()[i*2+0],
294                 sC1->GetVertices()[i*2+1],
295                 sC1->GetVertices()[((i+1)%4)*2+0],
296                 sC1->GetVertices()[((i+1)%4)*2+1],-kThicknessCone,x,y);
297     sCh1->SetVertex(i,x,y);
298
299     InsidePoint(sC1->GetVertices()[((i+3)%4 +4)*2+0],
300                 sC1->GetVertices()[((i+3)%4 +4)*2+1],
301                 sC1->GetVertices()[(i+4)*2+0],
302                 sC1->GetVertices()[(i+4)*2+1],
303                 sC1->GetVertices()[((i+1)%4 +4)*2+0],
304                 sC1->GetVertices()[((i+1)%4 +4)*2+1],-kThicknessCone,x,y);
305     sCh1->SetVertex(i+4,x,y);
306
307     InsidePoint(sC2->GetVertices()[((i+3)%4)*2+0],
308                 sC2->GetVertices()[((i+3)%4)*2+1],
309                 sC2->GetVertices()[i*2+0],
310                 sC2->GetVertices()[i*2+1],
311                 sC2->GetVertices()[((i+1)%4)*2+0],
312                 sC2->GetVertices()[((i+1)%4)*2+1],-kThicknessCone,x,y);
313     sCh2->SetVertex(i,x,y);
314
315     InsidePoint(sC2->GetVertices()[((i+3)%4 +4)*2+0],
316                 sC2->GetVertices()[((i+3)%4 +4)*2+1],
317                 sC2->GetVertices()[(i+4)*2+0],
318                 sC2->GetVertices()[(i+4)*2+1],
319                 sC2->GetVertices()[((i+1)%4 +4)*2+0],
320                 sC2->GetVertices()[((i+1)%4 +4)*2+1],-kThicknessCone,x,y);
321     sCh2->SetVertex(i+4,x,y);
322   }
323
324   // Finally the carbon fiber Ring with its Wings and their
325   // stesalite inserts. They are Tube and TubeSeg shapes
326
327   TGeoTube *ringshape = new TGeoTube(kInnerRadiusRing,kOuterRadiusRing,
328                                      kHalfLengthRing);
329
330   TGeoTube *ringinsertshape = new TGeoTube(kInnerRadiusRing+kThicknessRing,
331                                            kOuterRadiusRing-kThicknessRing,
332                                            kHalfLengthRing-kThicknessRing);
333
334   Double_t angleWideWing, angleWideWingThickness;
335   angleWideWing = (kWideWing/kOuterRadiusWing)*TMath::RadToDeg();
336   angleWideWingThickness = (kThicknessRing/kOuterRadiusWing)*TMath::RadToDeg();
337
338   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kOuterRadiusRing,kOuterRadiusWing,
339                                            kHalfLengthRing, 0, angleWideWing);
340
341   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kOuterRadiusRing,
342              kOuterRadiusWing-kThicknessRing, kHalfLengthRing-kThicknessRing,
343              angleWideWingThickness, angleWideWing-angleWideWingThickness);
344
345
346   // We have the shapes: now create the real volumes
347
348   TGeoMedium *medSPDcf  = mgr->GetMedium("ITS_SPD shield$");
349   TGeoMedium *medSPDair = mgr->GetMedium("ITS_SPD AIR$");
350   TGeoMedium *medSPDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
351
352   TGeoVolume *centralshield = new TGeoVolume("SPDcentralshield",
353                                              centralshape,medSPDcf);
354   centralshield->SetVisibility(kTRUE);
355   centralshield->SetLineColor(7);
356   centralshield->SetLineWidth(1);
357
358   TGeoVolume *centralairshield = new TGeoVolume("SPDcentralairshield",
359                                                 centralairshape,medSPDair);
360   centralairshield->SetVisibility(kTRUE);
361   centralairshield->SetLineColor(5); // Yellow
362   centralairshield->SetLineWidth(1);
363   centralairshield->SetFillColor(centralairshield->GetLineColor());
364   centralairshield->SetFillStyle(4090); // 90% transparent
365
366   TGeoVolume *centralomega = new TGeoVolume("SPDcentralomega",
367                                              centralomegashape,medSPDcf);
368   centralomega->SetVisibility(kTRUE);
369   centralomega->SetLineColor(7);
370   centralomega->SetLineWidth(1);
371
372   centralairshield->AddNode(centralomega,1,0);
373   centralshield->AddNode(centralairshield,1,0);
374
375   TGeoVolume *endcapshield = new TGeoVolume("SPDendcapshield",
376                                              endcapshape,medSPDcf);
377   endcapshield->SetVisibility(kTRUE);
378   endcapshield->SetLineColor(7);
379   endcapshield->SetLineWidth(1);
380
381   TGeoVolume *endcapairshield = new TGeoVolume("SPDendcapairshield",
382                                                 endcapairshape,medSPDair);
383   endcapairshield->SetVisibility(kTRUE);
384   endcapairshield->SetLineColor(5); // Yellow
385   endcapairshield->SetLineWidth(1);
386   endcapairshield->SetFillColor(endcapairshield->GetLineColor());
387   endcapairshield->SetFillStyle(4090); // 90% transparent
388
389   TGeoVolume *endcapomega = new TGeoVolume("SPDendcapomega",
390                                            endcapomegashape,medSPDcf);
391   endcapomega->SetVisibility(kTRUE);
392   endcapomega->SetLineColor(7);
393   endcapomega->SetLineWidth(1);
394
395   endcapairshield->AddNode(endcapomega,1,0);
396   endcapshield->AddNode(endcapairshield,1,0);
397
398   TGeoVolume *vC1 = new TGeoVolume("SPDconeshieldV1",sC1,medSPDcf);
399   vC1->SetVisibility(kTRUE);
400   vC1->SetLineColor(7);
401   vC1->SetLineWidth(1);
402
403   TGeoVolume *vCh1 = new TGeoVolume("SPDconeshieldH1",sCh1,medSPDair);
404
405   vCh1->SetVisibility(kTRUE);
406   vCh1->SetLineColor(5); // Yellow
407   vCh1->SetLineWidth(1);
408   vCh1->SetFillColor(vCh1->GetLineColor());
409   vCh1->SetFillStyle(4090); // 90% transparent
410
411   vC1->AddNode(vCh1,1,0);
412
413   TGeoVolume *vC2 = new TGeoVolume("SPDconeshieldV2",sC2,medSPDcf);
414
415   vC2->SetVisibility(kTRUE);
416   vC2->SetLineColor(7);
417   vC2->SetLineWidth(1);
418
419   TGeoVolume *vCh2 = new TGeoVolume("SPDconeshieldH2",sCh2,medSPDair);
420
421   vCh2->SetVisibility(kTRUE);
422   vCh2->SetLineColor(5); // Yellow
423   vCh2->SetLineWidth(1);
424   vCh2->SetFillColor(vCh2->GetLineColor());
425   vCh2->SetFillStyle(4090); // 90% transparent
426
427   vC2->AddNode(vCh2,1,0);
428
429   TGeoVolume *ring = new TGeoVolume("SPDshieldring",ringshape,medSPDcf);
430   ring->SetVisibility(kTRUE);
431   ring->SetLineColor(7);
432   ring->SetLineWidth(1);
433
434   TGeoVolume *ringinsert = new TGeoVolume("SPDshieldringinsert",
435                                           ringinsertshape,medSPDste);
436   ringinsert->SetVisibility(kTRUE);
437   ringinsert->SetLineColor(3); // Green
438 //  ringinsert->SetLineWidth(1);
439   ringinsert->SetFillColor(ringinsert->GetLineColor());
440   ringinsert->SetFillStyle(4010); // 10% transparent
441
442   ring->AddNode(ringinsert,1,0);
443
444   TGeoVolume *wing = new TGeoVolume("SPDshieldringwing",wingshape,medSPDcf);
445   wing->SetVisibility(kTRUE);
446   wing->SetLineColor(7);
447   wing->SetLineWidth(1);
448
449   TGeoVolume *winginsert = new TGeoVolume("SPDshieldringinsert",
450                                           winginsertshape,medSPDste);
451   winginsert->SetVisibility(kTRUE);
452   winginsert->SetLineColor(3); // Green
453 //  winginsert->SetLineWidth(1);
454   winginsert->SetFillColor(winginsert->GetLineColor());
455   winginsert->SetFillStyle(4010); // 10% transparent
456
457   wing->AddNode(winginsert,1,0);
458
459
460   // Add all volumes in the assembly
461   const Double_t kLittleZTrans = 0.1*fgkmm;
462   vM->AddNode(centralshield,1,new TGeoTranslation(0,0,-kLittleZTrans));
463   vM->AddNode(centralshield,2,new TGeoCombiTrans( 0,0,-kLittleZTrans,
464                                   new TGeoRotation("",180,0,0)));
465
466   zpos = kHalfLengthCentral+kHalfLengthEndCap;
467   vM->AddNode(endcapshield,1,
468               new TGeoTranslation(0,0, zpos-kLittleZTrans));
469   vM->AddNode(endcapshield,2,
470               new TGeoTranslation(0,0,-zpos-kLittleZTrans));
471   vM->AddNode(endcapshield,3,new TGeoCombiTrans(
472               0, 0, zpos-kLittleZTrans, new TGeoRotation("",180,0,0) ) );
473   vM->AddNode(endcapshield,4,new TGeoCombiTrans(
474               0, 0,-zpos-kLittleZTrans, new TGeoRotation("",180,0,0) ) );
475
476   zpos = kHalfLengthCentral+2*kHalfLengthEndCap+kHalfLengthCone;
477   for (Int_t i=0; i<10; i++) {
478     Double_t thetaC12 = kTheta*TMath::RadToDeg();
479     vM->AddNode(vC1,2*i+1, new TGeoCombiTrans(
480                0, 0,  zpos-kLittleZTrans,
481                new TGeoRotation("",0,  0,i*thetaC12)   ) );
482     vM->AddNode(vC1,2*i+2, new TGeoCombiTrans(
483                0, 0, -zpos-kLittleZTrans,
484                new TGeoRotation("",0,180,i*thetaC12)   ) );
485     vM->AddNode(vC2,2*i+1, new TGeoCombiTrans(
486                0, 0,  zpos-kLittleZTrans,
487                new TGeoRotation("",0,  0,i*thetaC12)   ) );
488     vM->AddNode(vC2,2*i+2, new TGeoCombiTrans(
489                0, 0, -zpos-kLittleZTrans,
490                new TGeoRotation("",0,180,i*thetaC12)   ) );
491   }
492
493   zpos = kHalfLengthCentral+2*kHalfLengthEndCap+2*kHalfLengthCone
494        + kHalfLengthRing;
495   vM->AddNode(ring,1,new TGeoTranslation(0, 0, zpos-kLittleZTrans));
496   vM->AddNode(ring,2,new TGeoTranslation(0, 0,-zpos-kLittleZTrans));
497
498   for (Int_t i=0; i<4; i++) {
499     Double_t thetaW = kThetaWing*(2*i+1) - angleWideWing/2.;
500     vM->AddNode(wing,2*i+1,new TGeoCombiTrans(0, 0, zpos-kLittleZTrans,
501                                new TGeoRotation("",thetaW,0,0) ) );
502     vM->AddNode(wing,2*i+2,new TGeoCombiTrans(0, 0,-zpos-kLittleZTrans,
503                                new TGeoRotation("",thetaW,0,0) ) );
504   }
505
506   // Some debugging if requested
507   if(GetDebug(1)){
508     vM->PrintNodes();
509     vM->InspectShape();
510   }
511
512   // Finally put the entire shield in the mother volume
513   moth->AddNode(vM,1,0);
514
515   return;
516 }
517
518 //______________________________________________________________________
519 void AliITSv11GeometrySupport::CreateSPDThermalShape(
520      Double_t ina, Double_t inb, Double_t inr,
521      Double_t oua, Double_t oub, Double_t our,
522      Double_t   t, Double_t *x , Double_t *y ) const
523 {
524 //
525 // Creates the proper sequence of X and Y coordinates to determine
526 // the base XTru polygon for the SPD thermal shapes
527 //
528 // Input:
529 //        ina, inb : inner shape sides
530 //        inr      : inner radius
531 //        oua, oub : outer shape sides
532 //        our      : outer radius
533 //        t        : theta angle
534 //
535 // Output:
536 //        x, y : coordinate vectors [24]
537 //
538 // Created:      14 Nov 2007  Mario Sitta
539 // Updated:      11 Dec 2007  Mario Sitta
540 //
541   Double_t xlocal[6],ylocal[6];
542
543   //Create the first inner quadrant (X > 0)
544   FillSPDXtruShape(ina,inb,inr,t,xlocal,ylocal);
545   for (Int_t i=0; i<6; i++) {
546     x[i] = xlocal[i];
547     y[i] = ylocal[i];
548   }
549
550   // Then reflex on the second quadrant (X < 0)
551   for (Int_t i=0; i<6; i++) {
552     x[23-i] = -x[i];
553     y[23-i] =  y[i];
554   }
555
556   // Now create the first outer quadrant (X > 0)
557   FillSPDXtruShape(oua,oub,our,t,xlocal,ylocal);
558   for (Int_t i=0; i<6; i++) {
559     x[11-i] = xlocal[i];
560     y[11-i] = ylocal[i];
561   }
562
563   // Finally reflex on the second quadrant (X < 0)
564   for (Int_t i=0; i<6; i++) {
565     x[12+i] = -x[11-i];
566     y[12+i] =  y[11-i];
567   }
568
569   return;
570 }
571
572 //______________________________________________________________________
573 void AliITSv11GeometrySupport::CreateSPDOmegaShape(
574                    const Double_t *xin, const Double_t *yin, Double_t  d,
575                    Double_t   *x, Double_t *y)
576 {
577 //
578 // Creates the proper sequence of X and Y coordinates to determine
579 // the SPD Omega XTru polygon
580 //
581 // Input:
582 //        xin, yin : coordinates of the air volume
583 //        d        : Omega shape thickness
584 //        t        : theta angle
585 //
586 // Output:
587 //        x, y     : coordinate vectors [48]
588 //
589 // Created:      17 Nov 2007  Mario Sitta
590 // Updated:      11 Dec 2007  Mario Sitta
591 // Updated:      20 Feb 2009  Mario Sitta       New algorithm (the old one
592 //                                              gives erroneous vertexes)
593 //
594
595   // This vector contains the index of those points which coincide
596   // with the corresponding points in the air shape
597   Int_t indexAir2Omega[12] = {1, 2, 5, 6, 9, 10, 11, 15, 16, 19, 20, 23};
598
599   // First fill those vertexes corresponding to
600   // the edges aligned to the air shape edges
601   for (Int_t j=0; j<12; j++) {
602     x[*(indexAir2Omega+j)] = xin[j];
603     y[*(indexAir2Omega+j)] = yin[j];
604   }
605
606   // Now get the coordinates of the first inner point
607   PointFromParallelLines(x[23],y[23],x[1],y[1],d,x[0],y[0]);
608
609   // Knowing this, the second internal point can be determined
610   InsidePoint(x[0],y[0],x[1],y[1],x[2],y[2],d,x[22],y[22]);
611
612   // The third point is now computable
613   ReflectPoint(x[1],y[1],x[2],y[2],x[22],y[22],x[21],y[21]);
614
615   // Repeat this logic
616   InsidePoint(x[21],y[21],x[20],y[20],x[19],y[19],-d,x[3],y[3]);
617
618   ReflectPoint(x[20],y[20],x[19],y[19],x[3],y[3],x[4],y[4]);
619
620   InsidePoint(x[4],y[4],x[5],y[5],x[6],y[6],d,x[18],y[18]);
621
622   ReflectPoint(x[5],y[5],x[6],y[6],x[18],y[18],x[17],y[17]);
623
624   InsidePoint(x[17],y[17],x[16],y[16],x[15],y[15],-d,x[7],y[7]);
625
626   ReflectPoint(x[16],y[16],x[15],y[15],x[7],y[7],x[8],y[8]);
627
628   InsidePoint(x[8],y[8],x[9],y[9],x[10],y[10],d,x[14],y[14]);
629
630   // These need to be fixed explicitly
631   x[12] = x[11];
632   y[12] = y[11] + d;
633   x[13] = x[10] + d;
634   y[13] = y[12];
635
636   // Finally reflect on the negative side
637   for (Int_t i=0; i<24; i++) {
638     x[24+i] = -x[23-i];
639     y[24+i] =  y[23-i];
640   }
641
642   // Wow ! We've finished
643   return;
644 }
645
646 //______________________________________________________________________
647 void AliITSv11GeometrySupport::FillSPDXtruShape(Double_t a, Double_t b,
648                                                 Double_t r, Double_t t,
649                                                 Double_t *x, Double_t *y) const
650 {
651 //
652 // Creates the partial sequence of X and Y coordinates to determine
653 // the lateral part of the SPD thermal shield
654 //
655 // Input:
656 //        a, b : shape sides
657 //        r    : radius
658 //        t    : theta angle
659 //
660 // Output:
661 //        x, y : coordinate vectors [6]
662 //
663 // Created:      14 Nov 2007  Mario Sitta
664 //
665   x[0] = a/2;
666   y[0] = r;
667
668   x[1] = x[0] + b * TMath::Cos(t/2);
669   y[1] = y[0] - b * TMath::Sin(t/2);
670
671   x[2] = x[1] + a * TMath::Cos(t);
672   y[2] = y[1] - a * TMath::Sin(t);
673
674   x[3] = x[2] + b * TMath::Cos(3*t/2);
675   y[3] = y[2] - b * TMath::Sin(3*t/2);
676
677   x[4] = x[3] + a * TMath::Cos(2*t);
678   y[4] = y[3] - a * TMath::Sin(2*t);
679
680   x[5] = x[4];
681   y[5] = 0.;
682
683   return;
684 }
685
686 //______________________________________________________________________
687 void AliITSv11GeometrySupport::PointFromParallelLines(Double_t x1, Double_t y1,
688                               Double_t x2, Double_t y2, Double_t d,
689                               Double_t &x, Double_t &y) const
690 {
691 //
692 // Determines the X and Y of the first internal point of the Omega shape
693 // (i.e. the coordinates of a point given two parallel lines passing by
694 // two points and placed at a known distance)
695 //
696 // Input:
697 //        x1, y1 : first point
698 //        x2, y2 : second point
699 //        d      : distance between the two lines
700 //
701 // Output:
702 //        x, y   : coordinate of the point
703 //
704 // Created:      22 Feb 2009  Mario Sitta
705 //
706 //Begin_Html
707 /*
708 <img src="ITS/doc/PointFromParallelLines.gif">
709 */
710 //End_Html
711
712   // The slope of the paralles lines at a distance d
713   Double_t m; 
714
715   // The parameters of the solving equation
716   // a x^2 - 2 b x + c = 0
717   Double_t a = (x1 - x2)*(x1 - x2) - d*d;
718   Double_t b = (x1 - x2)*(y1 - y2);
719   Double_t c = (y1 - y2)*(y1 - y2) - d*d;
720
721   // (delta4 is Delta/4 because we use the reduced formula)
722   Double_t delta4 = b*b - a*c;
723
724   // Compute the slope of the two parallel lines
725   // (one of the two possible slopes, the one with the smaller
726   // absolute value is needed)
727   if (delta4 < 0) { // Should never happen with our data, but just to be sure
728     x = -1;         // x is expected positive, so this flags an error
729     return;
730   } else
731     m = (b + TMath::Sqrt(delta4))/a;  // b is negative with our data
732
733   // Finally compute the coordinates of the point
734   x = x2 + (y1 - y2 - d)/m;
735   y = y1 - d;
736
737   // Done
738   return;
739 }
740
741 //______________________________________________________________________
742 void AliITSv11GeometrySupport::ReflectPoint(Double_t x1, Double_t y1,
743                                             Double_t x2, Double_t y2,
744                                             Double_t x3, Double_t y3,
745                                             Double_t &x, Double_t &y) const
746 {
747 //
748 // Given two points (x1,y1) and (x2,y2), determines the point (x,y)
749 // lying on the line parallel to the line passing by these points,
750 // at a distance d and passing by the point (x3,y3), which is symmetric to
751 // the third point with respect to the axis of the segment delimited by
752 // the two first points.
753 //
754 // Input:
755 //        x1, y1 : first point
756 //        x2, y2 : second point
757 //        x3, y3 : third point
758 //        d      : distance between the two lines
759 //
760 // Output:
761 //        x, y   : coordinate of the reflected point
762 //
763 // Created:      22 Feb 2009  Mario Sitta
764 //
765 //Begin_Html
766 /*
767 <img src="ITS/doc/ReflectPoint.gif">
768 */
769 //End_Html
770
771   // The slope of the line passing by the first two points
772   Double_t k = (y2 - y1)/(x2 - x1);
773
774   // The middle point of the segment 1-2
775   Double_t xK = (x1 + x2)/2.;
776   Double_t yK = (y1 + y2)/2.;
777
778   // The intercept between the axis of the segment 1-2 and the line
779   // passing by 3 and parallel to the line passing by 1-2
780   Double_t xH = (k*k*x3 + k*(yK - y3) + xK)/(k*k + 1);
781   Double_t yH = k*(xH - x3) + y3;
782
783   // The point symmetric to 3 with respect to H
784   x = 2*xH - x3;
785   y = 2*yH - y3;
786
787   // Done
788   return;
789 }
790
791 //______________________________________________________________________
792 void AliITSv11GeometrySupport::SDDCone(TGeoVolume *moth,const TGeoManager *mgr)
793 {
794 //
795 // Creates the SDD support cone and cylinder geometry as a
796 // volume assembly and adds it to the mother volume
797 // (part of this code is taken or anyway inspired to SDDCone method
798 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
799 //
800 // Input:
801 //         moth : the TGeoVolume owing the volume structure
802 //         mgr  : the GeoManager (default gGeoManager)
803 // Output:
804 //
805 // Created:         ???       Bjorn S. Nilsen
806 // Updated:      18 Feb 2008  Mario Sitta
807 // Updated:      25 Jul 2008  Mario Sitta   SDDCarbonFiberCone simpler
808 // Updated:      10 Jun 2010  Mario Sitta   Cables across cone holes added
809 //
810 // Technical data are taken from:  "Supporto Generale Settore SDD"
811 // (technical drawings ALR-0816/1-B), "Supporto Globale Settore SDD"
812 // (technical drawings ALR-0816/2A, ALR-0816/2B, ALR-0816/2C, ALR-0816/2D), 
813 // private communication with B. Giraudo
814
815   // Dimensions of the Central cylinder and flanges
816   const Double_t kCylinderHalfLength = (790.0/2)*fgkmm;
817   const Double_t kCylinderInnerR     = (210.0/2)*fgkmm;
818   const Double_t kCylinderOuterR     = (231.0/2)*fgkmm;
819   const Double_t kFlangeHalfLength   = ( 15.0/2)*fgkmm;
820   const Double_t kFlangeInnerR       = (210.5/2)*fgkmm;
821   const Double_t kFlangeOuterR       = (230.5/2)*fgkmm;
822   const Double_t kInsertoHalfLength  =
823                                      kCylinderHalfLength - 2*kFlangeHalfLength;
824 //  const Double_t kCFThickness        = kFlangeInnerR - kCylinderInnerR;
825   const Double_t kBoltDiameter       =       6.0*fgkmm; // M6 screw
826   const Double_t kBoltDepth          =       6.0*fgkmm; // In the flange
827   const Double_t kBoltRadius         = (220.0/2)*fgkmm; // Radius in flange
828   const Double_t kThetaBolt          =      30.0*fgkDegree;
829   const Int_t    kNBolts             = (Int_t)(360.0/kThetaBolt);
830   // Dimensions of the Cone
831   const Double_t kConeROutMin        = (540.0/2)*fgkmm;
832   const Double_t kConeROutMax        = (560.0/2)*fgkmm;
833   const Double_t kConeRCurv          =      10.0*fgkmm; // Radius of curvature
834   const Double_t kConeRinMin         = (210.0/2)*fgkmm;
835 //  const Double_t kConeRinMax         = (216.0/2)*fgkmm;
836   const Double_t kConeRinCylinder    = (231.0/2)*fgkmm;
837   const Double_t kConeZCylinder      =     192.0*fgkmm;
838   const Double_t kConeZOuterMilled   =      23.0*fgkmm;
839   const Double_t kConeDZin           =      15.0*fgkmm; // ???
840   const Double_t kConeThickness      =      10.0*fgkmm; // Rohacell + Carb.Fib.
841   const Double_t kConeTheta          =      45.0*fgkDegree; // SDD cone angle
842   const Double_t kSinConeTheta       =
843                                      TMath::Sin(kConeTheta*TMath::DegToRad());
844   const Double_t kCosConeTheta       =
845                                      TMath::Cos(kConeTheta*TMath::DegToRad());
846   const Double_t kTanConeTheta       =
847                                      TMath::Tan(kConeTheta*TMath::DegToRad());
848   // Dimensions of the Cone Inserts
849   const Double_t kConeCFThickness    =       1.5*fgkmm;//Carbon fiber thickness
850   // Dimensions of the Cone Holes
851   const Double_t kHole1RMin          = (450.0/2)*fgkmm;
852   const Double_t kHole1RMax          = (530.0/2)*fgkmm;
853   const Double_t kHole2RMin          = (280.0/2)*fgkmm;
854   const Double_t kHole2RMax          = (375.0/2)*fgkmm;
855   const Double_t kHole1Phi           =      25.0*fgkDegree;
856   const Double_t kHole2Phi           =      50.0*fgkDegree;
857   const Double_t kHole3RMin          =     205.0*fgkmm;
858   const Double_t kHole3DeltaR        =        15*fgkmm;
859   const Double_t kHole3Width         =        30*fgkmm;
860   const Int_t    kNHole3             =         6      ;
861   const Double_t kHole4RMin          =     116.0*fgkmm;
862   const Double_t kHole4DeltaR        =        15*fgkmm;
863   const Double_t kHole4Width         =        30*fgkmm;
864   //  const Int_t    kNHole4             =         3      ;
865   // Fraction of materials in holes
866   const Double_t kHolePlasticFrac    =       0.55846;
867   const Double_t kHoleCuFrac         =       0.06319;
868   const Double_t kHoleGlassFrac      =       0.02652;
869
870   // Local variables
871   Double_t x, y, z, t, dza, rmin, rmax;
872
873
874   // Recover the needed materials
875   TGeoMedium *medSDDcf    = mgr->GetMedium("ITS_SDD C (M55J)$");
876   TGeoMedium *medSDDair   = mgr->GetMedium("ITS_SDD AIR$");
877   TGeoMedium *medSDDste   = mgr->GetMedium("ITS_G10FR4$"); // stesalite
878   TGeoMedium *medSDDroh   = mgr->GetMedium("ITS_ROHACELL$");
879   TGeoMedium *medSDDss    = mgr->GetMedium("ITS_INOX$");
880   TGeoMedium *medSDDplast = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
881   TGeoMedium *medSDDCu    = mgr->GetMedium("ITS_COPPER$");
882   TGeoMedium *medSDDglass = mgr->GetMedium("ITS_SDD OPTICFIB$");
883
884   // First define the geometrical shapes
885
886   // Central cylinder with its internal foam and the lateral flanges:
887   // a carbon fiber Tube which contains a rohacell Tube and two
888   // stesalite Tube's
889   TGeoTube *cylindershape = new TGeoTube(kCylinderInnerR,kCylinderOuterR,
890                                          kCylinderHalfLength);
891
892   TGeoTube *insertoshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
893                                         kInsertoHalfLength);
894
895   TGeoTube *flangeshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
896                                        kFlangeHalfLength);
897
898   // The flange bolt: it is a Tube
899   TGeoTube *boltshape = new TGeoTube(0.0, 0.5*kBoltDiameter, 0.5*kBoltDepth);
900
901   // Debug if requested
902   if (GetDebug(1)) {
903     cylindershape->InspectShape();
904     insertoshape->InspectShape();
905     flangeshape->InspectShape();
906     boltshape->InspectShape();
907   }
908
909
910   // We have the shapes: now create the real volumes
911
912   TGeoVolume *cfcylinder = new TGeoVolume("SDDCarbonFiberCylinder",
913                                           cylindershape,medSDDcf);
914   cfcylinder->SetVisibility(kTRUE);
915   cfcylinder->SetLineColor(4); // Blue
916   cfcylinder->SetLineWidth(1);
917   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
918   cfcylinder->SetFillStyle(4000); // 0% transparent
919
920   TGeoVolume *foamcylinder = new TGeoVolume("SDDFoamCylinder",
921                                             insertoshape,medSDDroh);
922   foamcylinder->SetVisibility(kTRUE);
923   foamcylinder->SetLineColor(3); // Green
924   foamcylinder->SetLineWidth(1);
925   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
926   foamcylinder->SetFillStyle(4050); // 50% transparent
927
928   TGeoVolume *flangecylinder = new TGeoVolume("SDDFlangeCylinder",
929                                               flangeshape,medSDDste);
930   flangecylinder->SetVisibility(kTRUE);
931   flangecylinder->SetLineColor(2); // Red
932   flangecylinder->SetLineWidth(1);
933   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
934   flangecylinder->SetFillStyle(4050); // 50% transparent
935
936   TGeoVolume *bolt = new TGeoVolume("SDDFlangeBolt",boltshape,medSDDss);
937   bolt->SetVisibility(kTRUE);
938   bolt->SetLineColor(1);  // Black
939   bolt->SetLineWidth(1);
940   bolt->SetFillColor(bolt->GetLineColor());
941   bolt->SetFillStyle(4050); // 50% transparent
942
943   // Mount up the cylinder
944   for(Int_t i=0; i<kNBolts; i++){
945     t = kThetaBolt*i;
946     x = kBoltRadius*CosD(t);
947     y = kBoltRadius*SinD(t);
948     z = kFlangeHalfLength-kBoltDepth;
949     flangecylinder->AddNode(bolt, i+1, new TGeoTranslation("",x,y,z));
950   }
951
952   cfcylinder->AddNode(foamcylinder,1,0);
953   cfcylinder->AddNode(flangecylinder,1,
954               new TGeoTranslation(0, 0, kInsertoHalfLength+kFlangeHalfLength));
955   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
956               0, 0, -kInsertoHalfLength-kFlangeHalfLength,
957               new TGeoRotation("",0,180,0)     ) );
958
959
960   // SDD Support Cone with its internal inserts: a carbon fiber Pcon
961   // with holes which contains a stesalite Pcon which on turn contains a
962   // rohacell Pcon
963
964   dza = kConeThickness/kSinConeTheta-(kConeROutMax-kConeROutMin)/kTanConeTheta;
965
966   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 10);
967
968   coneshape->Z(0)     = 0.0;
969   coneshape->Rmin(0)  = kConeROutMin;
970   coneshape->Rmax(0)  = kConeROutMax;
971
972   coneshape->Z(1)     = kConeZOuterMilled - dza;
973   coneshape->Rmin(1)  = coneshape->GetRmin(0);
974   coneshape->Rmax(1)  = coneshape->GetRmax(0);
975
976   coneshape->Z(2)     = kConeZOuterMilled;
977   coneshape->Rmax(2)  = coneshape->GetRmax(0);
978
979   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(1),
980                     coneshape->GetRmin(1),kConeTheta,z,rmin);
981   coneshape->Z(3)     = z;
982   coneshape->Rmin(3)  = rmin;
983
984   coneshape->Rmin(2)  = RminFrom2Points(coneshape,3,1,coneshape->GetZ(2));
985
986   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(2),
987                     coneshape->GetRmax(2),kConeTheta,z,rmax);
988   coneshape->Z(4)     = z;
989   coneshape->Rmax(4)  = rmax;
990   coneshape->Rmin(4)  = RminFromZpCone(coneshape,3,kConeTheta,
991                                        coneshape->GetZ(4),0.0);
992
993   coneshape->Rmax(3)  = RmaxFrom2Points(coneshape,4,2,coneshape->GetZ(3));
994
995   coneshape->Z(6)     = kConeZCylinder - kConeDZin;
996
997   RadiusOfCurvature(kConeRCurv,90.0,coneshape->GetZ(6),0.0,
998                     90.0-kConeTheta,z,rmin);
999   coneshape->Z(5)     = z;
1000   coneshape->Rmin(5)  = RminFromZpCone(coneshape,3,kConeTheta,z);
1001   coneshape->Rmax(5)  = RmaxFromZpCone(coneshape,4,kConeTheta,z);
1002
1003   RadiusOfCurvature(kConeRCurv,90.-kConeTheta,
1004                     0.0,coneshape->Rmin(5),90.0,z,rmin);
1005   coneshape->Rmin(6)  = rmin;
1006   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,4,kConeTheta,
1007                                        coneshape->GetZ(6));
1008
1009   coneshape->Z(7)     = coneshape->GetZ(6);
1010   coneshape->Rmin(7)  = kConeRinMin;
1011   coneshape->Rmax(7)  = coneshape->GetRmax(6);
1012
1013   coneshape->Rmin(8)  = kConeRinMin;
1014
1015   RadiusOfCurvature(kConeRCurv,90.0,kConeZCylinder,kConeRinCylinder,
1016                     90.0-kConeTheta,z,rmax);
1017   coneshape->Z(8)     = z;
1018   coneshape->Rmax(8)  = rmax;
1019
1020   coneshape->Z(9)     = kConeZCylinder;
1021   coneshape->Rmin(9)  = kConeRinMin;
1022   coneshape->Rmax(9)  = kConeRinCylinder;
1023
1024
1025   // SDD Cone Insert: another Pcon
1026   Double_t x0, y0, x1, y1, x2, y2;
1027   TGeoPcon *coneinsertshape = new TGeoPcon(0.0, 360.0, 9);
1028
1029   coneinsertshape->Z(0)    = coneshape->GetZ(0) + kConeCFThickness;
1030   coneinsertshape->Rmin(0) = coneshape->GetRmin(0) + kConeCFThickness;
1031   coneinsertshape->Rmax(0) = coneshape->GetRmax(0) - kConeCFThickness;
1032
1033   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
1034   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
1035   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
1036   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1037   coneinsertshape->Z(1)    = z;
1038   coneinsertshape->Rmin(1) = rmin;
1039   coneinsertshape->Rmax(1) = coneinsertshape->GetRmax(0);
1040
1041   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmax(1);
1042   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmax(2);
1043   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmax(3);
1044   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
1045   coneinsertshape->Z(2)    = z;
1046   coneinsertshape->Rmax(2) = rmax;
1047
1048   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
1049   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
1050   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
1051   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1052   coneinsertshape->Z(3)    = z;
1053   coneinsertshape->Rmin(3) = rmin;
1054
1055   x0 = coneinsertshape->GetZ(1); y0 = coneinsertshape->GetRmin(1);
1056   x1 = coneinsertshape->GetZ(3); y1 = coneinsertshape->GetRmin(3);
1057   coneinsertshape->Rmin(2) = Yfrom2Points(x0, y0, x1, y1,
1058                                           coneinsertshape->Z(2));
1059
1060   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
1061   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
1062   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
1063   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
1064   coneinsertshape->Z(4)    = z;
1065   coneinsertshape->Rmax(4) = rmax;
1066
1067   x0 = coneinsertshape->GetZ(2); y0 = coneinsertshape->GetRmax(2);
1068   x1 = coneinsertshape->GetZ(4); y1 = coneinsertshape->GetRmax(4);
1069   coneinsertshape->Rmax(3) = Yfrom2Points(x0, y0, x1, y1,
1070                                           coneinsertshape->Z(3));
1071
1072   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmin(4);
1073   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmin(5);
1074   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmin(6);
1075   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1076   coneinsertshape->Z(5)    = z;
1077   coneinsertshape->Rmin(5) = rmin;
1078   coneinsertshape->Rmax(5) = coneinsertshape->GetRmax(4) -
1079           kTanConeTheta*(coneinsertshape->GetZ(5) - coneinsertshape->GetZ(4));
1080
1081   x0 = coneinsertshape->GetZ(3); y0 = coneinsertshape->GetRmin(3);
1082   x1 = coneinsertshape->GetZ(5); y1 = coneinsertshape->GetRmin(5);
1083   coneinsertshape->Rmin(4) = Yfrom2Points(x0, y0, x1, y1,
1084                                           coneinsertshape->Z(4));
1085
1086   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmin(5);
1087   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmin(6);
1088   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmin(7);
1089   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1090   coneinsertshape->Z(6)    = z;
1091   coneinsertshape->Rmin(6) = rmin;
1092   coneinsertshape->Rmax(6) = coneinsertshape->GetRmax(4) -
1093           kTanConeTheta*(coneinsertshape->GetZ(6) - coneinsertshape->GetZ(4));
1094
1095   coneinsertshape->Z(7)    = coneinsertshape->GetZ(6);
1096   coneinsertshape->Rmin(7) = coneshape->GetRmin(7) + kConeCFThickness;
1097   coneinsertshape->Rmax(7) = coneinsertshape->GetRmax(6);
1098
1099   coneinsertshape->Z(8)    = coneshape->GetZ(9) - kConeCFThickness;
1100   coneinsertshape->Rmin(8) = coneinsertshape->GetRmin(7);
1101   coneinsertshape->Rmax(8) = coneinsertshape->GetRmax(4) -
1102           kTanConeTheta*(coneinsertshape->GetZ(8) - coneinsertshape->GetZ(4));
1103
1104   // SDD Cone Foam: another Pcon
1105   TGeoPcon *conefoamshape = new TGeoPcon(0.0, 360.0, 4);
1106
1107   RadiusOfCurvature(kConeRCurv+kConeCFThickness,0.0,coneinsertshape->GetZ(1),
1108                     coneinsertshape->GetRmin(1),kConeTheta,z,rmin);
1109
1110   conefoamshape->Z(0)    = z;
1111   conefoamshape->Rmin(0) = rmin;
1112   conefoamshape->Rmax(0) = conefoamshape->GetRmin(0);
1113
1114   conefoamshape->Z(1)    = conefoamshape->GetZ(0)+
1115                          (kConeThickness-2.0*kConeCFThickness)/kSinConeTheta;
1116   conefoamshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1117                                           conefoamshape->GetZ(1));
1118   conefoamshape->Rmax(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1119                                           conefoamshape->GetZ(1));
1120
1121   conefoamshape->Z(2)    = coneshape->GetZ(5)-kConeCFThickness;
1122   conefoamshape->Rmin(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1123                                           conefoamshape->GetZ(2));
1124   conefoamshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1125                                           conefoamshape->GetZ(2));
1126
1127   conefoamshape->Z(3)    = coneinsertshape->GetZ(5)+
1128                          (kConeThickness-2.0*kConeCFThickness)*kCosConeTheta;
1129   conefoamshape->Rmax(3) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1130                                           conefoamshape->GetZ(3));
1131   conefoamshape->Rmin(3) = conefoamshape->GetRmax(3);
1132
1133   // SDD Cone Holes: Pcon's
1134   // A single hole volume gives an overlap with coneinsert, so
1135   // three contiguous volumes are created: one to be put in the cone foam
1136   // and two in the cone carbon fiber envelope
1137   TGeoPcon *hole1shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1138
1139   hole1shape->Rmin(0) = kHole1RMax;
1140   hole1shape->Rmax(0) = hole1shape->GetRmin(0);
1141   hole1shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
1142                                        hole1shape->GetRmin(0));
1143
1144   hole1shape->Rmax(1) = hole1shape->GetRmax(0);
1145   hole1shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1146                                        hole1shape->GetRmax(1));
1147   hole1shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
1148                                        hole1shape->GetZ(1));
1149
1150   hole1shape->Rmin(2) = kHole1RMin;
1151   hole1shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1152                                        hole1shape->GetRmin(2));
1153   hole1shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1154                                        hole1shape->GetZ(2));
1155
1156   hole1shape->Rmin(3) = hole1shape->GetRmin(2);
1157   hole1shape->Rmax(3) = hole1shape->GetRmin(3);
1158   hole1shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1159                                        hole1shape->GetRmax(3));
1160
1161   TGeoPcon *hole11shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1162
1163   hole11shape->Rmin(0) = kHole1RMax;
1164   hole11shape->Rmax(0) = hole11shape->GetRmin(0);
1165   hole11shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1166                                         hole11shape->GetRmin(0));
1167
1168   hole11shape->Rmax(1) = hole11shape->GetRmax(0);
1169   hole11shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1170                                         hole11shape->GetRmax(1));
1171   hole11shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1172                                         hole11shape->GetZ(1));
1173
1174   hole11shape->Rmin(2) = kHole1RMin;
1175   hole11shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1176                                         hole11shape->GetRmin(2));
1177   hole11shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1178                                         hole11shape->GetZ(2));
1179
1180   hole11shape->Rmin(3) = hole11shape->GetRmin(2);
1181   hole11shape->Rmax(3) = hole11shape->GetRmin(3);
1182   hole11shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1183                                         hole11shape->GetRmax(3));
1184
1185   TGeoPcon *hole12shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1186
1187   hole12shape->Rmin(0) = kHole1RMax;
1188   hole12shape->Rmax(0) = hole12shape->GetRmin(0);
1189   hole12shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1190                                         hole12shape->GetRmin(0));
1191
1192   hole12shape->Rmax(1) = hole12shape->GetRmax(0);
1193   hole12shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1194                                         hole12shape->GetRmax(1));
1195   hole12shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1196                                         hole12shape->GetZ(1));
1197
1198   hole12shape->Rmin(2) = kHole1RMin;
1199   hole12shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1200                                         hole12shape->GetRmin(2));
1201   hole12shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1202                                         hole12shape->GetZ(2));
1203
1204   hole12shape->Rmin(3) = hole12shape->GetRmin(2);
1205   hole12shape->Rmax(3) = hole12shape->GetRmin(3);
1206   hole12shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1207                                         hole12shape->GetRmax(3));
1208
1209   //
1210   TGeoPcon *hole2shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1211
1212   hole2shape->Rmin(0) = kHole2RMax;
1213   hole2shape->Rmax(0) = hole2shape->GetRmin(0);
1214   hole2shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
1215                                        hole2shape->GetRmin(0));
1216
1217   hole2shape->Rmax(1) = hole2shape->GetRmax(0);
1218   hole2shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1219                                        hole2shape->GetRmax(1));
1220   hole2shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
1221                                        hole2shape->GetZ(1));
1222
1223   hole2shape->Rmin(2) = kHole2RMin;
1224   hole2shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1225                                        hole2shape->GetRmin(2));
1226   hole2shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1227                                        hole2shape->GetZ(2));
1228
1229   hole2shape->Rmin(3) = hole2shape->GetRmin(2);
1230   hole2shape->Rmax(3) = hole2shape->GetRmin(3);
1231   hole2shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1232                                        hole2shape->GetRmax(3));
1233
1234   TGeoPcon *hole21shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1235
1236   hole21shape->Rmin(0) = kHole2RMax;
1237   hole21shape->Rmax(0) = hole21shape->GetRmin(0);
1238   hole21shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1239                                         hole21shape->GetRmin(0));
1240
1241   hole21shape->Rmax(1) = hole21shape->GetRmax(0);
1242   hole21shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1243                                         hole21shape->GetRmax(1));
1244   hole21shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1245                                         hole21shape->GetZ(1));
1246
1247   hole21shape->Rmin(2) = kHole2RMin;
1248   hole21shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1249                                         hole21shape->GetRmin(2));
1250   hole21shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1251                                         hole21shape->GetZ(2));
1252
1253   hole21shape->Rmin(3) = hole21shape->GetRmin(2);
1254   hole21shape->Rmax(3) = hole21shape->GetRmin(3);
1255   hole21shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1256                                         hole21shape->GetRmax(3));
1257
1258   TGeoPcon *hole22shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1259
1260   hole22shape->Rmin(0) = kHole2RMax;
1261   hole22shape->Rmax(0) = hole22shape->GetRmin(0);
1262   hole22shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1263                                         hole22shape->GetRmin(0));
1264
1265   hole22shape->Rmax(1) = hole22shape->GetRmax(0);
1266   hole22shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1267                                         hole22shape->GetRmax(1));
1268   hole22shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1269                                         hole22shape->GetZ(1));
1270
1271   hole22shape->Rmin(2) = kHole2RMin;
1272   hole22shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1273                                         hole22shape->GetRmin(2));
1274   hole22shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1275                                         hole22shape->GetZ(2));
1276
1277   hole22shape->Rmin(3) = hole22shape->GetRmin(2);
1278   hole22shape->Rmax(3) = hole22shape->GetRmin(3);
1279   hole22shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1280                                         hole22shape->GetRmax(3));
1281
1282   //
1283   Double_t holePhi;
1284   holePhi = (kHole3Width/kHole3RMin)*TMath::RadToDeg();
1285
1286   TGeoPcon *hole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1287
1288   hole3shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1289   hole3shape->Rmax(0) = hole3shape->GetRmin(0);
1290   hole3shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
1291                                        hole3shape->GetRmin(0));
1292
1293   hole3shape->Rmax(1) = hole3shape->GetRmax(0);
1294   hole3shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1295                                        hole3shape->GetRmax(1));
1296   hole3shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
1297                                        hole3shape->GetZ(1));
1298
1299   hole3shape->Rmin(2) = kHole3RMin;
1300   hole3shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1301                                        hole3shape->GetRmin(2));
1302   hole3shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1303                                        hole3shape->GetZ(2));
1304
1305   hole3shape->Rmin(3) = hole3shape->GetRmin(2);
1306   hole3shape->Rmax(3) = hole3shape->GetRmin(3);
1307   hole3shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1308                                        hole3shape->GetRmax(3));
1309
1310   TGeoPcon *hole31shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1311
1312   hole31shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1313   hole31shape->Rmax(0) = hole31shape->GetRmin(0);
1314   hole31shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1315                                         hole31shape->GetRmin(0));
1316
1317   hole31shape->Rmax(1) = hole31shape->GetRmax(0);
1318   hole31shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1319                                         hole31shape->GetRmax(1));
1320   hole31shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1321                                         hole31shape->GetZ(1));
1322
1323   hole31shape->Rmin(2) = kHole3RMin;
1324   hole31shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1325                                         hole31shape->GetRmin(2));
1326   hole31shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1327                                         hole31shape->GetZ(2));
1328
1329   hole31shape->Rmin(3) = hole31shape->GetRmin(2);
1330   hole31shape->Rmax(3) = hole31shape->GetRmin(3);
1331   hole31shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1332                                         hole31shape->GetRmax(3));
1333
1334   TGeoPcon *hole32shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1335
1336   hole32shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1337   hole32shape->Rmax(0) = hole32shape->GetRmin(0);
1338   hole32shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1339                                         hole32shape->GetRmin(0));
1340
1341   hole32shape->Rmax(1) = hole32shape->GetRmax(0);
1342   hole32shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1343                                         hole32shape->GetRmax(1));
1344   hole32shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1345                                         hole32shape->GetZ(1));
1346
1347   hole32shape->Rmin(2) = kHole3RMin;
1348   hole32shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1349                                         hole32shape->GetRmin(2));
1350   hole32shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1351                                         hole32shape->GetZ(2));
1352
1353   hole32shape->Rmin(3) = hole32shape->GetRmin(2);
1354   hole32shape->Rmax(3) = hole32shape->GetRmin(3);
1355   hole32shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1356                                         hole32shape->GetRmax(3));
1357
1358   //
1359   holePhi = (kHole4Width/kHole4RMin)*TMath::RadToDeg();
1360
1361   TGeoPcon *hole4shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1362
1363   hole4shape->Rmin(0) = kHole4RMin + kHole4DeltaR;
1364   hole4shape->Rmax(0) = hole4shape->GetRmin(0);
1365   hole4shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1366                                        hole4shape->GetRmin(0));
1367
1368   hole4shape->Rmax(1) = hole4shape->GetRmax(0);
1369   hole4shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1370                                        hole4shape->GetRmax(1));
1371   hole4shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1372                                        hole4shape->GetZ(1));
1373
1374   hole4shape->Rmin(2) = kHole4RMin;
1375   hole4shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1376                                        hole4shape->GetRmin(2));
1377   hole4shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1378                                        hole4shape->GetZ(2));
1379
1380   hole4shape->Rmin(3) = hole4shape->GetRmin(2);
1381   hole4shape->Rmax(3) = hole4shape->GetRmin(3);
1382   hole4shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1383                                        hole4shape->GetRmax(3));
1384
1385   // Cables to be put inside the holes: Pcon's
1386   // (fractions are manually computed from AliITSv11GeometrySDD::SDDCables
1387   TGeoPcon *hole1plastshape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1388
1389   hole1plastshape->Rmin(0) = hole1shape->GetRmin(0);
1390   hole1plastshape->Rmax(0) = hole1shape->GetRmax(0);
1391   hole1plastshape->Z(0)    = hole1shape->GetZ(0);
1392
1393   hole1plastshape->Rmin(1) = hole1shape->GetRmin(1);
1394   hole1plastshape->Rmax(1) = hole1shape->GetRmax(1);
1395   hole1plastshape->Z(1)    = hole1shape->GetZ(1);
1396
1397   dza = hole1plastshape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHolePlasticFrac;
1398
1399   hole1plastshape->Rmin(2) = dza;
1400   hole1plastshape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1401                                             hole1plastshape->GetRmin(2));
1402   hole1plastshape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1403                                             hole1plastshape->GetZ(2));
1404
1405   hole1plastshape->Rmin(3) = hole1plastshape->GetRmin(2);
1406   hole1plastshape->Rmax(3) = hole1plastshape->GetRmin(3);
1407   hole1plastshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1408                                             hole1plastshape->GetRmax(3));
1409
1410   TGeoPcon *hole1Cushape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1411
1412   hole1Cushape->Rmin(0) = hole1plastshape->GetRmin(2);
1413   hole1Cushape->Rmax(0) = hole1Cushape->GetRmin(0);
1414   hole1Cushape->Z(0)    = hole1plastshape->GetZ(2);
1415
1416   dza = hole1Cushape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHoleCuFrac;
1417
1418   hole1Cushape->Rmin(1) = dza;
1419   hole1Cushape->Rmax(1) = hole1Cushape->GetRmax(0);
1420   hole1Cushape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1421                                          hole1Cushape->GetRmin(1));
1422
1423   hole1Cushape->Rmax(2) = hole1Cushape->GetRmax(0);
1424   hole1Cushape->Rmin(2) = hole1Cushape->GetRmin(1);
1425   hole1Cushape->Z(2)    = hole1plastshape->GetZ(3);
1426
1427   hole1Cushape->Rmin(3) = hole1Cushape->GetRmin(1);
1428   hole1Cushape->Rmax(3) = hole1Cushape->GetRmin(3);
1429   hole1Cushape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1430                                          hole1Cushape->GetRmax(3));
1431
1432   TGeoPcon *hole1glassshape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1433
1434   hole1glassshape->Rmin(0) = hole1Cushape->GetRmin(1);
1435   hole1glassshape->Rmax(0) = hole1glassshape->GetRmin(0);
1436   hole1glassshape->Z(0)    = hole1Cushape->GetZ(1);
1437
1438   dza = hole1glassshape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHoleGlassFrac;
1439
1440   hole1glassshape->Rmin(1) = dza;
1441   hole1glassshape->Rmax(1) = hole1glassshape->GetRmax(0);
1442   hole1glassshape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1443                                             hole1glassshape->GetRmin(1));
1444
1445   hole1glassshape->Rmax(2) = hole1glassshape->GetRmax(0);
1446   hole1glassshape->Rmin(2) = hole1glassshape->GetRmin(1);
1447   hole1glassshape->Z(2)    = hole1Cushape->GetZ(3);
1448
1449   hole1glassshape->Rmin(3) = hole1glassshape->GetRmin(1);
1450   hole1glassshape->Rmax(3) = hole1glassshape->GetRmin(3);
1451   hole1glassshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1452                                             hole1glassshape->GetRmax(3));
1453   //
1454   TGeoPcon *hole2plastshape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1455
1456   hole2plastshape->Rmin(0) = hole2shape->GetRmin(0);
1457   hole2plastshape->Rmax(0) = hole2shape->GetRmax(0);
1458   hole2plastshape->Z(0)    = hole2shape->GetZ(0);
1459
1460   hole2plastshape->Rmin(1) = hole2shape->GetRmin(1);
1461   hole2plastshape->Rmax(1) = hole2shape->GetRmax(1);
1462   hole2plastshape->Z(1)    = hole2shape->GetZ(1);
1463
1464   dza = hole2plastshape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHolePlasticFrac;
1465
1466   hole2plastshape->Rmin(2) = dza;
1467   hole2plastshape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1468                                             hole2plastshape->GetRmin(2));
1469   hole2plastshape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1470                                             hole2plastshape->GetZ(2));
1471
1472   hole2plastshape->Rmin(3) = hole2plastshape->GetRmin(2);
1473   hole2plastshape->Rmax(3) = hole2plastshape->GetRmin(3);
1474   hole2plastshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1475                                             hole2plastshape->GetRmax(3));
1476
1477   TGeoPcon *hole2Cushape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1478
1479   hole2Cushape->Rmin(0) = hole2plastshape->GetRmin(2);
1480   hole2Cushape->Rmax(0) = hole2Cushape->GetRmin(0);
1481   hole2Cushape->Z(0)    = hole2plastshape->GetZ(2);
1482
1483   dza = hole2Cushape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHoleCuFrac;
1484
1485   hole2Cushape->Rmin(1) = dza;
1486   hole2Cushape->Rmax(1) = hole2Cushape->GetRmax(0);
1487   hole2Cushape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1488                                          hole2Cushape->GetRmin(1));
1489
1490   hole2Cushape->Rmax(2) = hole2Cushape->GetRmax(0);
1491   hole2Cushape->Rmin(2) = hole2Cushape->GetRmin(1);
1492   hole2Cushape->Z(2)    = hole2plastshape->GetZ(3);
1493
1494   hole2Cushape->Rmin(3) = hole2Cushape->GetRmin(1);
1495   hole2Cushape->Rmax(3) = hole2Cushape->GetRmin(3);
1496   hole2Cushape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1497                                          hole2Cushape->GetRmax(3));
1498
1499   TGeoPcon *hole2glassshape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1500
1501   hole2glassshape->Rmin(0) = hole2Cushape->GetRmin(1);
1502   hole2glassshape->Rmax(0) = hole2glassshape->GetRmin(0);
1503   hole2glassshape->Z(0)    = hole2Cushape->GetZ(1);
1504
1505   dza = hole2glassshape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHoleGlassFrac;
1506
1507   hole2glassshape->Rmin(1) = dza;
1508   hole2glassshape->Rmax(1) = hole2glassshape->GetRmax(0);
1509   hole2glassshape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1510                                             hole2glassshape->GetRmin(1));
1511
1512   hole2glassshape->Rmax(2) = hole2glassshape->GetRmax(0);
1513   hole2glassshape->Rmin(2) = hole2glassshape->GetRmin(1);
1514   hole2glassshape->Z(2)    = hole2Cushape->GetZ(3);
1515
1516   hole2glassshape->Rmin(3) = hole2glassshape->GetRmin(1);
1517   hole2glassshape->Rmax(3) = hole2glassshape->GetRmin(3);
1518   hole2glassshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1519                                             hole2glassshape->GetRmax(3));
1520
1521
1522   // Debug if requested
1523   if (GetDebug(1)) {
1524     coneshape->InspectShape();
1525     coneinsertshape->InspectShape();
1526     conefoamshape->InspectShape();
1527     hole1shape->InspectShape();
1528     hole2shape->InspectShape();
1529     hole3shape->InspectShape();
1530     hole4shape->InspectShape();
1531   }
1532
1533
1534   // We have the shapes: now create the real volumes
1535
1536   TGeoVolume *cfcone = new TGeoVolume("SDDCarbonFiberCone",
1537                                       coneshape,medSDDcf);
1538   cfcone->SetVisibility(kTRUE);
1539   cfcone->SetLineColor(4); // Blue
1540   cfcone->SetLineWidth(1);
1541   cfcone->SetFillColor(cfcone->GetLineColor());
1542   cfcone->SetFillStyle(4000); // 0% transparent
1543
1544   TGeoVolume *cfconeinsert = new TGeoVolume("SDDCarbonFiberConeInsert",
1545                                             coneinsertshape,medSDDste);
1546   cfconeinsert->SetVisibility(kTRUE);
1547   cfconeinsert->SetLineColor(2); // Red
1548   cfconeinsert->SetLineWidth(1);
1549   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
1550   cfconeinsert->SetFillStyle(4050); // 50% transparent
1551
1552   TGeoVolume *cfconefoam = new TGeoVolume("SDDCarbonFiberConeFoam",
1553                                           conefoamshape,medSDDroh);
1554   cfconefoam->SetVisibility(kTRUE);
1555   cfconefoam->SetLineColor(7); // Light blue
1556   cfconefoam->SetLineWidth(1);
1557   cfconefoam->SetFillColor(cfconefoam->GetLineColor());
1558   cfconefoam->SetFillStyle(4050); // 50% transparent
1559
1560   TGeoVolume *hole1 = new TGeoVolume("SDDCableHole1",
1561                                      hole1shape,medSDDair);
1562   hole1->SetVisibility(kTRUE);
1563   hole1->SetLineColor(5); // Yellow
1564   hole1->SetLineWidth(1);
1565   hole1->SetFillColor(hole1->GetLineColor());
1566   hole1->SetFillStyle(4090); // 90% transparent
1567
1568   TGeoVolume *hole11 = new TGeoVolume("SDDCableHole11",
1569                                       hole11shape,medSDDair);
1570   hole11->SetVisibility(kTRUE);
1571   hole11->SetLineColor(5); // Yellow
1572   hole11->SetLineWidth(1);
1573   hole11->SetFillColor(hole11->GetLineColor());
1574   hole11->SetFillStyle(4090); // 90% transparent
1575
1576   TGeoVolume *hole12 = new TGeoVolume("SDDCableHole12",
1577                                       hole12shape,medSDDair);
1578   hole12->SetVisibility(kTRUE);
1579   hole12->SetLineColor(5); // Yellow
1580   hole12->SetLineWidth(1);
1581   hole12->SetFillColor(hole12->GetLineColor());
1582   hole12->SetFillStyle(4090); // 90% transparent
1583
1584   TGeoVolume *hole1plast = new TGeoVolume("SDDCableHole1Plast",
1585                                           hole1plastshape,medSDDplast);
1586   hole1plast->SetVisibility(kTRUE);
1587   hole1plast->SetLineColor(kBlue);
1588   hole1plast->SetLineWidth(1);
1589   hole1plast->SetFillColor(hole1plast->GetLineColor());
1590   hole1plast->SetFillStyle(4090); // 90% transparent
1591
1592   TGeoVolume *hole1Cu = new TGeoVolume("SDDCableHole1Cu",
1593                                        hole1Cushape,medSDDCu);
1594   hole1Cu->SetVisibility(kTRUE);
1595   hole1Cu->SetLineColor(kRed);
1596   hole1Cu->SetLineWidth(1);
1597   hole1Cu->SetFillColor(hole1Cu->GetLineColor());
1598   hole1Cu->SetFillStyle(4090); // 90% transparent
1599
1600   TGeoVolume *hole1glass = new TGeoVolume("SDDCableHole1glass",
1601                                           hole1glassshape,medSDDglass);
1602   hole1glass->SetVisibility(kTRUE);
1603   hole1glass->SetLineColor(kGreen);
1604   hole1glass->SetLineWidth(1);
1605   hole1glass->SetFillColor(hole1glass->GetLineColor());
1606   hole1glass->SetFillStyle(4090); // 90% transparent
1607
1608   TGeoVolume *hole2 = new TGeoVolume("SDDCableHole2",
1609                                      hole2shape,medSDDair);
1610   hole2->SetVisibility(kTRUE);
1611   hole2->SetLineColor(5); // Yellow
1612   hole2->SetLineWidth(1);
1613   hole2->SetFillColor(hole2->GetLineColor());
1614   hole2->SetFillStyle(4090); // 90% transparent
1615
1616   TGeoVolume *hole21 = new TGeoVolume("SDDCableHole21",
1617                                       hole21shape,medSDDair);
1618   hole21->SetVisibility(kTRUE);
1619   hole21->SetLineColor(5); // Yellow
1620   hole21->SetLineWidth(1);
1621   hole21->SetFillColor(hole21->GetLineColor());
1622   hole21->SetFillStyle(4090); // 90% transparent
1623
1624   TGeoVolume *hole22 = new TGeoVolume("SDDCableHole22",
1625                                       hole22shape,medSDDair);
1626   hole22->SetVisibility(kTRUE);
1627   hole22->SetLineColor(5); // Yellow
1628   hole22->SetLineWidth(1);
1629   hole22->SetFillColor(hole22->GetLineColor());
1630   hole22->SetFillStyle(4090); // 90% transparent
1631
1632   TGeoVolume *hole2plast = new TGeoVolume("SDDCableHole2Plast",
1633                                           hole2plastshape,medSDDplast);
1634   hole2plast->SetVisibility(kTRUE);
1635   hole2plast->SetLineColor(kBlue);
1636   hole2plast->SetLineWidth(1);
1637   hole2plast->SetFillColor(hole2plast->GetLineColor());
1638   hole2plast->SetFillStyle(4090); // 90% transparent
1639
1640   TGeoVolume *hole2Cu = new TGeoVolume("SDDCableHole2Cu",
1641                                        hole2Cushape,medSDDCu);
1642   hole2Cu->SetVisibility(kTRUE);
1643   hole2Cu->SetLineColor(kRed);
1644   hole2Cu->SetLineWidth(1);
1645   hole2Cu->SetFillColor(hole2Cu->GetLineColor());
1646   hole2Cu->SetFillStyle(4090); // 90% transparent
1647
1648   TGeoVolume *hole2glass = new TGeoVolume("SDDCableHole2glass",
1649                                           hole2glassshape,medSDDglass);
1650   hole2glass->SetVisibility(kTRUE);
1651   hole2glass->SetLineColor(kGreen);
1652   hole2glass->SetLineWidth(1);
1653   hole2glass->SetFillColor(hole2glass->GetLineColor());
1654   hole2glass->SetFillStyle(4090); // 90% transparent
1655
1656   TGeoVolume *hole3 = new TGeoVolume("SDDCableHole3",
1657                                      hole3shape,medSDDair);
1658   hole3->SetVisibility(kTRUE);
1659   hole3->SetLineColor(5); // Yellow
1660   hole3->SetLineWidth(1);
1661   hole3->SetFillColor(hole3->GetLineColor());
1662   hole3->SetFillStyle(4090); // 90% transparent
1663
1664   TGeoVolume *hole31 = new TGeoVolume("SDDCableHole31",
1665                                       hole31shape,medSDDair);
1666   hole31->SetVisibility(kTRUE);
1667   hole31->SetLineColor(5); // Yellow
1668   hole31->SetLineWidth(1);
1669   hole31->SetFillColor(hole31->GetLineColor());
1670   hole31->SetFillStyle(4090); // 90% transparent
1671
1672   TGeoVolume *hole32 = new TGeoVolume("SDDCableHole32",
1673                                       hole32shape,medSDDair);
1674   hole32->SetVisibility(kTRUE);
1675   hole32->SetLineColor(5); // Yellow
1676   hole32->SetLineWidth(1);
1677   hole32->SetFillColor(hole32->GetLineColor());
1678   hole32->SetFillStyle(4090); // 90% transparent
1679
1680   TGeoVolume *hole4 = new TGeoVolume("SDDCableHole4",
1681                                      hole4shape,medSDDair);
1682   hole4->SetVisibility(kTRUE);
1683   hole4->SetLineColor(5); // Yellow
1684   hole4->SetLineWidth(1);
1685   hole4->SetFillColor(hole4->GetLineColor());
1686   hole4->SetFillStyle(4090); // 90% transparent
1687
1688   // Mount up a cone
1689   cfconeinsert->AddNode(cfconefoam,1,0);
1690
1691   hole1->AddNode(hole1plast, 1, 0);
1692   hole1->AddNode(hole1Cu, 1, 0);
1693   hole1->AddNode(hole1glass, 1, 0);
1694
1695   hole2->AddNode(hole2plast, 1, 0);
1696   hole2->AddNode(hole2Cu, 1, 0);
1697   hole2->AddNode(hole2glass, 1, 0);
1698
1699   for (Int_t i=0; i<12; i++) {
1700     Double_t phiH = i*30.0;
1701     cfconefoam->AddNode(hole1 , i+1, new TGeoRotation("", 0, 0, phiH));
1702         cfcone->AddNode(hole11, i+1, new TGeoRotation("", 0, 0, phiH));
1703         cfcone->AddNode(hole12, i+1, new TGeoRotation("", 0, 0, phiH));
1704   }
1705
1706   for (Int_t i=0; i<6; i++) {
1707     Double_t phiH = i*60.0;
1708     cfconefoam->AddNode(hole2 , i+1, new TGeoRotation("", 0, 0, phiH));
1709         cfcone->AddNode(hole21, i+1, new TGeoRotation("", 0, 0, phiH));
1710         cfcone->AddNode(hole22, i+1, new TGeoRotation("", 0, 0, phiH));
1711   }
1712
1713   for (Int_t i=0; i<kNHole3; i++) {
1714     Double_t phiH0 = 360./(Double_t)kNHole3;
1715     Double_t phiH  = i*phiH0 + 0.5*phiH0;
1716     cfconefoam->AddNode(hole3 , i+1, new TGeoRotation("", phiH, 0, 0));
1717         cfcone->AddNode(hole31, i+1, new TGeoRotation("", phiH, 0, 0));
1718         cfcone->AddNode(hole32, i+1, new TGeoRotation("", phiH, 0, 0));
1719   }
1720
1721   cfcone->AddNode(cfconeinsert,1,0);
1722
1723 /*
1724   for (Int_t i=0; i<kNHole4; i++) {
1725     Double_t phiH0 = 360./(Double_t)kNHole4;
1726     Double_t phiH  = i*phiH0 + 0.25*phiH0;
1727     cfcone->AddNode(hole4, i+1, new TGeoRotation("", phiH, 0, 0));
1728   }
1729 */
1730   // Finally put everything in the mother volume
1731   moth->AddNode(cfcylinder,1,0);
1732
1733   z = coneshape->Z(9);
1734   moth->AddNode(cfcone,1,new TGeoTranslation(0, 0, -z - kCylinderHalfLength));
1735   moth->AddNode(cfcone,2,new TGeoCombiTrans (0, 0,  z + kCylinderHalfLength,
1736                          new TGeoRotation("", 0, 180, 0)                   ));
1737
1738
1739   return;
1740 }
1741
1742 //______________________________________________________________________
1743 void AliITSv11GeometrySupport::SSDCone(TGeoVolume *moth,const TGeoManager *mgr)
1744 {
1745 //
1746 // Creates the SSD support cone and cylinder geometry. as a
1747 // volume assembly and adds it to the mother volume
1748 // (part of this code is taken or anyway inspired to SSDCone method
1749 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
1750 //
1751 // Input:
1752 //         moth : the TGeoVolume owing the volume structure
1753 //         mgr  : the GeoManager (default gGeoManager)
1754 // Output:
1755 //
1756 // Created:         ???       Bjorn S. Nilsen
1757 // Updated:      08 Mar 2008  Mario Sitta
1758 //
1759 // Technical data are taken from:  "ITS Supporto Generale" (technical
1760 // drawings ALR3-0743/1, ALR3-0743/1A and ALR3-0743/1B), "Supporto Generale
1761 // Settore SSD" (technical drawings ALR3-0743/2A and ALR3-0743/2E), private
1762 // communication with B. Giraudo
1763 //
1764 // Updated:      11 Apr 2008  Mario Sitta
1765 // Measures from drawings give overlaps with SPD thermal shield wings,
1766 // so the terminal part of the SSD cone was reduced
1767 //
1768 // Updated:      30 Mar 2010  Mario Sitta
1769 // Following M. van Leeuwen's suggestion on material budget, the thickness
1770 // of the carbon fiber cylinder was increased from 0.6 to 0.625mm
1771
1772   // Dimensions of the Central cylinder and flanges
1773   const Double_t kCylinderHalfLength   = (1143.6/2) *fgkmm;
1774   const Double_t kCylinderOuterRadius  = ( 595.0/2) *fgkmm;
1775   const Double_t kCylinderThickness    =       0.625*fgkmm;
1776   const Double_t kFoamHalfLength       = (1020.0/2) *fgkmm;
1777   const Double_t kFoamThickness        =        5.0 *fgkmm;
1778   const Double_t kFlangeHalfLength     =
1779                                       (kCylinderHalfLength-kFoamHalfLength)/2.;
1780   const Double_t kFlangeInnerRadius    = ( 563.0/2) *fgkmm;
1781   // Dimensions of the Cone
1782   const Double_t kConeROuterMin        = ( 957.0/2) *fgkmm;
1783   const Double_t kConeROuterMax        = ( 997.0/2) *fgkmm;
1784   const Double_t kConeRInnerMin        = ( 564.0/2) *fgkmm;
1785   const Double_t kConeRCurv1           =       10.0 *fgkmm;
1786   const Double_t kConeRCurv2           =       25.0 *fgkmm;
1787   const Double_t kConeCent1RCurv2      = ( 578.0/2) *fgkmm;
1788   const Double_t kConeCent2RCurv2      = ( 592.0/2) *fgkmm;
1789 //  const Double_t kConeZOuterRing       =       47.0 *fgkmm;
1790 //  const Double_t kConeZOuterRingInside =       30.25*fgkmm;
1791 //  const Double_t kConeZInnerRing       =      161.5 *fgkmm;
1792 //  const Double_t kConeZLength          =      176.5 *fgkmm;
1793   const Double_t kConeZOuterRing       =       38.5 *fgkmm;
1794   const Double_t kConeZOuterRingInside =       22.2 *fgkmm;
1795   const Double_t kConeZInnerRing       =      153.0 *fgkmm;
1796   const Double_t kConeZLength          =      168.0 *fgkmm;
1797   const Double_t kConeZPosition        = kConeZLength + kCylinderHalfLength;
1798   const Double_t kConeThickness        =       13.0 *fgkmm; // Cone thickness
1799   const Double_t kConeTheta            =       39.1 *fgkDegree; // Cone angle
1800   const Double_t kSinConeTheta         =
1801                                       TMath::Sin(kConeTheta*TMath::DegToRad());
1802   const Double_t kCosConeTheta         =
1803                                       TMath::Cos(kConeTheta*TMath::DegToRad());
1804   // Dimensions of the Foam cores
1805   const Double_t kConeFoam1Length      =      112.3 *fgkmm;
1806   const Double_t kConeFoam2Length      =       58.4 *fgkmm;
1807   // Dimensions of the Cone Holes
1808   const Double_t kCoolingHoleWidth     =       40.0 *fgkmm;
1809   const Double_t kCoolingHoleHight     =       30.0 *fgkmm;
1810   const Double_t kCoolingHoleRmin      =      350.0 *fgkmm;
1811   const Double_t kCoolingHolePhi       =       45.0 *fgkDegree;
1812   const Double_t kMountingHoleWidth    =       20.0 *fgkmm;
1813   const Double_t kMountingHoleHight    =       20.0 *fgkmm;
1814   const Double_t kMountingHoleRmin     =      317.5 *fgkmm;
1815   const Double_t kMountingHolePhi      =       60.0 *fgkDegree;
1816   const Double_t kCableHoleRin         = ( 800.0/2) *fgkmm;
1817   const Double_t kCableHoleRout        = ( 920.0/2) *fgkmm;
1818   const Double_t kCableHoleWidth       =      200.0 *fgkmm;
1819 //  const Double_t kCableHoleAngle       =       42.0 *fgkDegree;
1820   // Dimensions of the Cone Wings
1821   const Double_t kWingRmax             =      527.5 *fgkmm;
1822   const Double_t kWingWidth            =       70.0 *fgkmm;
1823   const Double_t kWingHalfThick        = (  10.0/2) *fgkmm;
1824   const Double_t kThetaWing            =       45.0 *fgkDegree;
1825   // Dimensions of the SSD-SDD Mounting Brackets
1826   const Double_t kBracketRmin          = ( 541.0/2) *fgkmm;// See SDD ROutMin
1827   const Double_t kBracketRmax          = ( 585.0/2) *fgkmm;
1828   const Double_t kBracketHalfLength    = (   4.0/2) *fgkmm;
1829   const Double_t kBracketPhi           = (70.*fgkmm/kBracketRmax)*fgkRadian;
1830   // Common data
1831   const Double_t kCFThickness          =        0.75*fgkmm; //Carb. fib. thick.
1832
1833
1834   // Local variables
1835   Double_t rmin1, rmin2, rmax, z;
1836
1837   //
1838   //Begin_Html
1839   /*
1840     <img src="picts/ITS/file_name.gif">
1841     <P>
1842     <FONT FACE'"TIMES">
1843     ITS SSD central support and thermal shield cylinder.
1844     </FONT>
1845     </P>
1846   */
1847   //End_Html
1848   //
1849
1850   // Central cylinder with its internal foam and the lateral flanges:
1851   // a carbon fiber Pcon which contains a rohacell Tube and two
1852   // stesalite Cone's
1853   TGeoPcon *externalcylshape = new TGeoPcon(0,360,4);
1854
1855   rmax  = kCylinderOuterRadius;
1856   rmin1 = kFlangeInnerRadius - kCylinderThickness;
1857   rmin2 = rmax - 2*kCylinderThickness - kFoamThickness;
1858   externalcylshape->DefineSection(0,-kCylinderHalfLength,rmin1,rmax);
1859   externalcylshape->DefineSection(1,-kFoamHalfLength    ,rmin2,rmax);
1860   externalcylshape->DefineSection(2, kFoamHalfLength    ,rmin2,rmax);
1861   externalcylshape->DefineSection(3, kCylinderHalfLength,rmin1,rmax);
1862
1863   rmax  = kCylinderOuterRadius - kCylinderThickness;
1864   rmin1 = rmax - kFoamThickness;
1865   TGeoTube *foamshape = new TGeoTube(rmin1,rmax,kFoamHalfLength);
1866
1867   rmax  = kCylinderOuterRadius - kCylinderThickness;
1868   rmin1 = rmax - kFoamThickness;
1869   rmin2 = kFlangeInnerRadius;
1870   TGeoCone *flangeshape = new TGeoCone(kFlangeHalfLength,
1871                                        rmin1,rmax,rmin2,rmax);
1872
1873
1874   // We have the shapes: now create the real volumes
1875
1876   TGeoMedium *medSSDcf  = mgr->GetMedium("ITS_SSD C (M55J)$");
1877   TGeoMedium *medSSDair = mgr->GetMedium("ITS_SSD AIR$");
1878   TGeoMedium *medSSDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
1879   TGeoMedium *medSSDroh = mgr->GetMedium("ITS_ROHACELL$");
1880   TGeoMedium *medSSDal  = mgr->GetMedium("ITS_ALUMINUM$");
1881
1882   TGeoVolume *cfcylinder = new TGeoVolume("SSDexternalcylinder",
1883                                            externalcylshape,medSSDcf);
1884   cfcylinder->SetVisibility(kTRUE);
1885   cfcylinder->SetLineColor(4); // blue
1886   cfcylinder->SetLineWidth(1);
1887   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
1888   cfcylinder->SetFillStyle(4000); // 0% transparent
1889
1890   TGeoVolume *foamcylinder = new TGeoVolume("SSDfoamcylinder",
1891                                             foamshape,medSSDroh);
1892   foamcylinder->SetVisibility(kTRUE);
1893   foamcylinder->SetLineColor(3); // green
1894   foamcylinder->SetLineWidth(1);
1895   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
1896   foamcylinder->SetFillStyle(4050); // 50% transparent
1897
1898   TGeoVolume *flangecylinder = new TGeoVolume("SSDflangecylinder",
1899                                               flangeshape,medSSDste);
1900   flangecylinder->SetVisibility(kTRUE);
1901   flangecylinder->SetLineColor(2); // red
1902   flangecylinder->SetLineWidth(1);
1903   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
1904   flangecylinder->SetFillStyle(4050); // 50% transparent
1905
1906   // Mount up the cylinder
1907   cfcylinder->AddNode(foamcylinder,1,0);
1908   cfcylinder->AddNode(flangecylinder,1,
1909               new TGeoTranslation(0, 0, kFoamHalfLength+kFlangeHalfLength));
1910   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
1911               0, 0, -kFoamHalfLength-kFlangeHalfLength,
1912               new TGeoRotation("",0,180,0)     ) );
1913
1914
1915   // The whole Cone as an assembly
1916   TGeoVolumeAssembly *vC = new TGeoVolumeAssembly("ITSssdCone");
1917
1918
1919   // SSD Support Cone with its internal inserts: a carbon fiber Pcon
1920   // with holes which contains a stesalite Pcon which on turn contains a
1921   // rohacell Pcon
1922   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 12);
1923
1924   coneshape->Z(0)     = 0.0;
1925   coneshape->Rmin(0)  = kConeROuterMin;
1926   coneshape->Rmax(0)  = kConeROuterMax;
1927
1928   coneshape->Z(1)     = kConeZOuterRingInside - kConeRCurv1;
1929   coneshape->Rmin(1)  = coneshape->GetRmin(0);
1930   coneshape->Rmax(1)  = coneshape->GetRmax(0);
1931
1932   coneshape->Z(2)     = kConeZOuterRingInside;
1933   coneshape->Rmin(2)  = coneshape->GetRmin(1) - kConeRCurv1;
1934   coneshape->Rmax(2)  = coneshape->GetRmax(0);
1935
1936   coneshape->Z(3)     = coneshape->GetZ(2);
1937   coneshape->Rmax(3)  = coneshape->GetRmax(0);
1938
1939   coneshape->Z(4)     = kConeZOuterRing - kConeRCurv1;
1940   coneshape->Rmax(4)  = coneshape->GetRmax(0);
1941
1942   coneshape->Z(5)     = kConeZOuterRing;
1943   coneshape->Rmax(5)  = coneshape->GetRmax(4) - kConeRCurv1;
1944
1945   coneshape->Z(6)     = coneshape->GetZ(5);
1946
1947   RadiusOfCurvature(kConeRCurv2,90.0,kConeZInnerRing,kConeCent1RCurv2,
1948                     90.0-kConeTheta,z,rmin1);
1949   coneshape->Z(7)     = z;
1950   coneshape->Rmin(7)  = rmin1;
1951
1952   coneshape->Rmin(3)  = RminFromZpCone(coneshape,7,90.-kConeTheta,
1953                                        coneshape->GetZ(3));
1954
1955   coneshape->Rmin(4)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(4));
1956
1957   coneshape->Rmin(5)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(5));
1958
1959   coneshape->Rmin(6) = coneshape->GetRmin(5);
1960
1961   coneshape->Z(8)     = kConeZInnerRing;
1962   coneshape->Rmin(8)  = kConeCent1RCurv2;
1963
1964   coneshape->Z(9)     = coneshape->GetZ(8);
1965   coneshape->Rmin(9)  = kConeRInnerMin;
1966
1967   RadiusOfCurvature(kConeRCurv2,90.0,kConeZLength,kConeCent2RCurv2,
1968                     90.0-kConeTheta,z,rmax);
1969
1970   coneshape->Z(10)    = z;
1971   coneshape->Rmin(10) = coneshape->GetRmin(9);
1972   coneshape->Rmax(10) = rmax;
1973
1974   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,10,90.-kConeTheta,
1975                                        coneshape->GetZ(6));
1976
1977   coneshape->Rmax(7)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(7));
1978
1979   coneshape->Rmax(8)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(8));
1980
1981   coneshape->Rmax(9)  = coneshape->GetRmax(8);
1982
1983   coneshape->Z(11)    = kConeZLength;
1984   coneshape->Rmin(11) = coneshape->GetRmin(10);
1985   coneshape->Rmax(11) = kConeCent2RCurv2;
1986
1987   // SSD Cone Insert: another Pcon
1988   Double_t x0, y0, x1, y1, x2, y2;
1989   TGeoPcon *coneinsertshape = new TGeoPcon(0.0,360.0,12);
1990
1991   coneinsertshape->Z(0)     = coneshape->GetZ(0) + kCFThickness;
1992   coneinsertshape->Rmin(0)  = coneshape->GetRmin(0) + kCFThickness;
1993   coneinsertshape->Rmax(0)  = coneshape->GetRmax(0) - kCFThickness;
1994
1995   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
1996   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
1997   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
1998   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
1999   coneinsertshape->Z(1)     = z;
2000   coneinsertshape->Rmin(1)  = rmin1;
2001   coneinsertshape->Rmax(1)  = coneinsertshape->GetRmax(0);
2002
2003   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmin(1);
2004   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmin(2);
2005   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmin(3);
2006   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2007   coneinsertshape->Z(2)     = z;
2008   coneinsertshape->Rmin(2)  = rmin1;
2009   coneinsertshape->Rmax(2)  = coneinsertshape->GetRmax(1);
2010
2011   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
2012   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
2013   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
2014   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2015   coneinsertshape->Z(3)     = z;
2016   coneinsertshape->Rmin(3)  = rmin1;
2017   coneinsertshape->Rmax(3)  = coneinsertshape->GetRmax(2);
2018
2019   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
2020   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
2021   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
2022   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2023   coneinsertshape->Z(4)     = z;
2024   coneinsertshape->Rmax(4)  = rmax;
2025
2026   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmax(4);
2027   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmax(5);
2028   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmax(6);
2029   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2030   coneinsertshape->Z(5)     = z;
2031   coneinsertshape->Rmax(5)  = rmax;
2032
2033   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmax(5);
2034   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmax(6);
2035   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmax(7);
2036   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2037   coneinsertshape->Z(6)     = z;
2038   coneinsertshape->Rmax(6)  = rmax;
2039
2040   x0 = coneshape->GetZ(6); y0 = coneshape->GetRmin(6);
2041   x1 = coneshape->GetZ(7); y1 = coneshape->GetRmin(7);
2042   x2 = coneshape->GetZ(8); y2 = coneshape->GetRmin(8);
2043   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2044   coneinsertshape->Z(7)     = z;
2045   coneinsertshape->Rmin(7)  = rmin1;
2046
2047   coneinsertshape->Rmin(4)  = RminFrom2Points(coneinsertshape,3,7,
2048                                               coneinsertshape->GetZ(4));
2049
2050   coneinsertshape->Rmin(5)  = RminFrom2Points(coneinsertshape,3,7,
2051                                               coneinsertshape->GetZ(5));
2052
2053   coneinsertshape->Rmin(6)  = coneinsertshape->GetRmin(5);
2054
2055   x0 = coneshape->GetZ(7); y0 = coneshape->GetRmin(7);
2056   x1 = coneshape->GetZ(8); y1 = coneshape->GetRmin(8);
2057   x2 = coneshape->GetZ(9); y2 = coneshape->GetRmin(9);
2058   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2059   coneinsertshape->Z(8)     = z;
2060   coneinsertshape->Rmin(8)  = rmin1;
2061
2062   x0 = coneshape->GetZ( 8); y0 = coneshape->GetRmin( 8);
2063   x1 = coneshape->GetZ( 9); y1 = coneshape->GetRmin( 9);
2064   x2 = coneshape->GetZ(10); y2 = coneshape->GetRmin(10);
2065   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2066   coneinsertshape->Z(9)     = z;
2067   coneinsertshape->Rmin(9)  = rmin1;
2068
2069   x0 = coneshape->GetZ( 9); y0 = coneshape->GetRmax( 9);
2070   x1 = coneshape->GetZ(10); y1 = coneshape->GetRmax(10);
2071   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmax(11);
2072   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2073   coneinsertshape->Z(10)    = z;
2074   coneinsertshape->Rmax(10) = rmax;
2075   coneinsertshape->Rmin(10) = coneinsertshape->GetRmin(9);
2076
2077   coneinsertshape->Rmax(7)  = RmaxFrom2Points(coneinsertshape,6,10,
2078                                               coneinsertshape->GetZ(7));
2079
2080   coneinsertshape->Rmax(8)  = RmaxFrom2Points(coneinsertshape,6,10,
2081                                               coneinsertshape->GetZ(8));
2082
2083   coneinsertshape->Rmax(9)  = coneinsertshape->GetRmax(8);
2084
2085   x0 = coneshape->GetZ(10); y0 = coneshape->GetRmax(10);
2086   x1 = coneshape->GetZ(11); y1 = coneshape->GetRmax(11);
2087   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmin(11);
2088   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2089   coneinsertshape->Z(11)    = z;
2090   coneinsertshape->Rmax(11) = rmax;
2091   coneinsertshape->Rmin(11) = coneinsertshape->GetRmin(10);
2092
2093   // SSD Cone Foams: two other Pcon's
2094   TGeoPcon *conefoam1shape = new TGeoPcon(0.0, 360.0, 4);
2095
2096   conefoam1shape->Z(0)    = coneinsertshape->GetZ(3);
2097   conefoam1shape->Rmin(0) = coneinsertshape->GetRmin(3);
2098   conefoam1shape->Rmax(0) = conefoam1shape->GetRmin(0);
2099
2100   conefoam1shape->Rmax(1) = conefoam1shape->GetRmax(0);
2101   conefoam1shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2102                                            conefoam1shape->GetRmax(1));
2103   conefoam1shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2104                                            conefoam1shape->GetZ(1));
2105
2106   Double_t t = kConeThickness - 2*kCFThickness;
2107   conefoam1shape->Rmin(2) = conefoam1shape->GetRmax(0) -
2108                            (kConeFoam1Length*kCosConeTheta - t*kSinConeTheta);
2109   conefoam1shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2110                                            conefoam1shape->GetRmin(2));
2111   conefoam1shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2112                                            conefoam1shape->GetZ(2));
2113
2114   conefoam1shape->Rmin(3) = conefoam1shape->GetRmin(2);
2115   conefoam1shape->Rmax(3) = conefoam1shape->GetRmin(3);
2116   conefoam1shape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2117                                            conefoam1shape->GetRmax(3));
2118
2119   TGeoPcon *conefoam2shape = new TGeoPcon(0.0, 360.0, 4);
2120
2121   conefoam2shape->Z(3)    = coneinsertshape->GetZ(10);
2122   conefoam2shape->Rmin(3) = coneinsertshape->GetRmax(10);
2123   conefoam2shape->Rmax(3) = conefoam2shape->GetRmin(3);
2124
2125   conefoam2shape->Rmin(2) = conefoam2shape->GetRmin(3);
2126   conefoam2shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2127                                            conefoam2shape->GetRmin(2));
2128   conefoam2shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2129                                            conefoam2shape->GetZ(2));
2130
2131   conefoam2shape->Rmin(0) = conefoam2shape->GetRmax(2) +
2132                            (kConeFoam2Length*kCosConeTheta - t*kSinConeTheta);
2133   conefoam2shape->Rmax(0) = conefoam2shape->GetRmin(0);
2134   conefoam2shape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2135                                            conefoam2shape->GetRmin(0));
2136
2137   conefoam2shape->Rmax(1) = conefoam2shape->GetRmax(0);
2138   conefoam2shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2139                                            conefoam2shape->GetRmax(1));
2140   conefoam2shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2141                                            conefoam2shape->GetZ(1));
2142
2143   // SSD Cone Holes: Pcon's
2144   // A single hole volume gives an overlap with coneinsert, so
2145   // three contiguous volumes are created: one to be put in coneinsert
2146   // and two in the cone carbon fiber envelope
2147   Double_t holePhi;
2148   holePhi = (kCoolingHoleWidth/kCoolingHoleRmin)*TMath::RadToDeg();
2149
2150   TGeoPcon *coolingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
2151
2152   coolingholeshape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
2153   coolingholeshape->Rmax(0) = coolingholeshape->GetRmin(0);
2154   coolingholeshape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2155                                              coolingholeshape->GetRmin(0));
2156
2157   coolingholeshape->Rmax(1) = coolingholeshape->GetRmax(0);
2158   coolingholeshape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2159                                              coolingholeshape->GetRmax(1));
2160   coolingholeshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2161                                              coolingholeshape->GetZ(1));
2162
2163   coolingholeshape->Rmin(2) = kCoolingHoleRmin;
2164   coolingholeshape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2165                                              coolingholeshape->GetRmin(2));
2166   coolingholeshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2167                                              coolingholeshape->GetZ(2));
2168
2169   coolingholeshape->Rmin(3) = coolingholeshape->GetRmin(2);
2170   coolingholeshape->Rmax(3) = coolingholeshape->GetRmin(3);
2171   coolingholeshape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2172                                              coolingholeshape->GetRmax(3));
2173
2174   TGeoPcon *coolinghole2shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2175
2176   coolinghole2shape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
2177   coolinghole2shape->Rmax(0) = coolinghole2shape->GetRmin(0);
2178   coolinghole2shape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2179                                               coolinghole2shape->GetRmin(0));
2180
2181   coolinghole2shape->Rmax(1) = coolinghole2shape->GetRmax(0);
2182   coolinghole2shape->Z(1)    = coolingholeshape->GetZ(0);
2183   coolinghole2shape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
2184                                               coolinghole2shape->GetZ(1));
2185
2186   coolinghole2shape->Rmin(2) = kCoolingHoleRmin;
2187   coolinghole2shape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2188                                               coolinghole2shape->GetRmin(2));
2189   coolinghole2shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2190                                               coolinghole2shape->GetZ(2));
2191
2192   coolinghole2shape->Rmin(3) = coolinghole2shape->GetRmin(2);
2193   coolinghole2shape->Rmax(3) = coolinghole2shape->GetRmin(3);
2194   coolinghole2shape->Z(3)    = coolingholeshape->GetZ(2);
2195
2196   TGeoPcon *coolinghole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2197
2198   coolinghole3shape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
2199   coolinghole3shape->Rmax(0) = coolinghole3shape->GetRmin(0);
2200   coolinghole3shape->Z(0)    = coolingholeshape->GetZ(1);
2201
2202   coolinghole3shape->Rmax(1) = coolinghole3shape->GetRmax(0);
2203   coolinghole3shape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2204                                               coolinghole3shape->GetRmax(1));
2205   coolinghole3shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2206                                               coolinghole3shape->GetZ(1));
2207
2208   coolinghole3shape->Rmin(2) = kCoolingHoleRmin;
2209   coolinghole3shape->Z(2)    = coolingholeshape->GetZ(3);
2210   coolinghole3shape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
2211                                               coolinghole3shape->GetZ(2));
2212
2213   coolinghole3shape->Rmin(3) = coolinghole3shape->GetRmin(2);
2214   coolinghole3shape->Rmax(3) = coolinghole3shape->GetRmin(3);
2215   coolinghole3shape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2216                                               coolinghole3shape->GetRmax(3));
2217
2218   //
2219   holePhi = (kMountingHoleWidth/kMountingHoleRmin)*TMath::RadToDeg();
2220
2221   TGeoPcon *mountingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
2222
2223   mountingholeshape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
2224   mountingholeshape->Rmax(0) = mountingholeshape->GetRmin(0);
2225   mountingholeshape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2226                                               mountingholeshape->GetRmin(0));
2227
2228   mountingholeshape->Rmin(1) = kMountingHoleRmin;
2229   mountingholeshape->Rmax(1) = mountingholeshape->GetRmax(0);
2230   mountingholeshape->Z(1)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2231                                               mountingholeshape->GetRmin(1));
2232
2233   mountingholeshape->Rmin(2) = mountingholeshape->GetRmin(1);
2234   mountingholeshape->Rmax(2) = mountingholeshape->GetRmax(1);
2235   mountingholeshape->Z(2)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2236                                               mountingholeshape->GetRmax(2));
2237
2238   mountingholeshape->Rmin(3) = mountingholeshape->GetRmin(2);
2239   mountingholeshape->Rmax(3) = mountingholeshape->GetRmin(3);
2240   mountingholeshape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2241                                               mountingholeshape->GetRmax(3));
2242
2243   TGeoPcon *mountinghole2shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2244
2245   mountinghole2shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
2246   mountinghole2shape->Rmax(0) = mountingholeshape->GetRmin(0);
2247   mountinghole2shape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2248                                                mountinghole2shape->GetRmin(0));
2249
2250   mountinghole2shape->Rmax(1) = mountinghole2shape->GetRmax(0);
2251   mountinghole2shape->Z(1)    = mountingholeshape->Z(0);
2252   mountinghole2shape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
2253                                                mountinghole2shape->GetZ(1));
2254
2255   mountinghole2shape->Rmin(2) = kMountingHoleRmin;
2256   mountinghole2shape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2257                                                mountinghole2shape->GetRmin(2));
2258   mountinghole2shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2259                                                mountinghole2shape->GetZ(2));
2260
2261   mountinghole2shape->Rmin(3) = mountinghole2shape->Rmin(2);
2262   mountinghole2shape->Rmax(3) = mountinghole2shape->Rmin(3);
2263   mountinghole2shape->Z(3)    = mountingholeshape->Z(1);
2264
2265   TGeoPcon *mountinghole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2266
2267   mountinghole3shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
2268   mountinghole3shape->Rmax(0) = mountingholeshape->GetRmin(0);
2269   mountinghole3shape->Z(0)    = mountingholeshape->GetZ(2);
2270
2271   mountinghole3shape->Rmax(1) = mountinghole3shape->GetRmax(0);
2272   mountinghole3shape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2273                                                mountinghole3shape->GetRmax(1));
2274   mountinghole3shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2275                                                mountinghole3shape->GetZ(1));
2276
2277   mountinghole3shape->Rmin(2) = kMountingHoleRmin;
2278   mountinghole3shape->Z(2)    = mountingholeshape->Z(3);
2279   mountinghole3shape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
2280                                                mountinghole3shape->GetZ(2));
2281
2282   mountinghole3shape->Rmin(3) = mountinghole3shape->Rmin(2);
2283   mountinghole3shape->Rmax(3) = mountinghole3shape->Rmin(3);
2284   mountinghole3shape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2285                                                mountinghole3shape->GetRmax(3));
2286
2287   // The Cable Hole is even more complicated, a Composite Shape
2288   // is unavoidable here (gosh!)
2289   TGeoPcon *coneshapecopy = new TGeoPcon("conecopy",0.0, 360.0, 12);
2290
2291   for (Int_t i=0; i<12; i++) {
2292     coneshapecopy->Rmin(i) = coneshape->GetRmin(i);
2293     coneshapecopy->Rmax(i) = coneshape->GetRmax(i);
2294     coneshapecopy->Z(i)    = coneshape->GetZ(i);
2295   }
2296
2297   holePhi = (kCableHoleWidth/kCableHoleRout)*TMath::RadToDeg();
2298   TGeoConeSeg *chCS = new TGeoConeSeg("chCS", 0.5*kConeZLength,
2299                                       kCableHoleRin, kCableHoleRout,
2300                                       kCableHoleRin, kCableHoleRout,
2301                                       -0.5*holePhi, 0.5*holePhi);
2302
2303   TGeoCompositeShape *cableholeshape = new TGeoCompositeShape(
2304                                            "SSDCableHoleShape",
2305                                            "conecopy*chCS");
2306
2307   if(GetDebug(1)){
2308     chCS->InspectShape();
2309     cableholeshape->InspectShape();
2310   }
2311
2312   // SSD Cone Wings: Tube and TubeSeg shapes
2313   Double_t angleWideWing, angleWideWingThickness;
2314   angleWideWing = (kWingWidth/kWingRmax)*TMath::RadToDeg();
2315   angleWideWingThickness = (kCFThickness/kWingRmax)*TMath::RadToDeg();
2316
2317   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kConeROuterMax, kWingRmax,
2318                                            kWingHalfThick,
2319                                            0, angleWideWing);
2320
2321   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kConeROuterMax,
2322                                  kWingRmax-kCFThickness,
2323                                  kWingHalfThick-kCFThickness,
2324                                  angleWideWingThickness,
2325                                  angleWideWing-angleWideWingThickness);
2326
2327   // SDD support plate, SSD side (Mounting Bracket): a TubeSeg
2328   TGeoTubeSeg *bracketshape = new TGeoTubeSeg(kBracketRmin, kBracketRmax,
2329                             kBracketHalfLength, -kBracketPhi/2, kBracketPhi/2);
2330
2331
2332   // We have the shapes: now create the real volumes
2333
2334   TGeoVolume *cfcone = new TGeoVolume("SSDCarbonFiberCone",
2335                                       coneshape,medSSDcf);
2336   cfcone->SetVisibility(kTRUE);
2337   cfcone->SetLineColor(4); // Blue
2338   cfcone->SetLineWidth(1);
2339   cfcone->SetFillColor(cfcone->GetLineColor());
2340   cfcone->SetFillStyle(4000); // 0% transparent
2341
2342   TGeoVolume *cfconeinsert = new TGeoVolume("SSDCarbonFiberConeInsert",
2343                                             coneinsertshape,medSSDste);
2344   cfconeinsert->SetVisibility(kTRUE);
2345   cfconeinsert->SetLineColor(2); // Red
2346   cfconeinsert->SetLineWidth(1);
2347   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
2348   cfconeinsert->SetFillStyle(4050); // 50% transparent
2349
2350   TGeoVolume *cfconefoam1 = new TGeoVolume("SSDCarbonFiberConeFoam1",
2351                                             conefoam1shape,medSSDroh);
2352   cfconefoam1->SetVisibility(kTRUE);
2353   cfconefoam1->SetLineColor(3); // Green
2354   cfconefoam1->SetLineWidth(1);
2355   cfconefoam1->SetFillColor(cfconefoam1->GetLineColor());
2356   cfconefoam1->SetFillStyle(4050); // 50% transparent
2357
2358   TGeoVolume *cfconefoam2 = new TGeoVolume("SSDCarbonFiberConeFoam2",
2359                                             conefoam2shape,medSSDroh);
2360   cfconefoam2->SetVisibility(kTRUE);
2361   cfconefoam2->SetLineColor(3); // Green
2362   cfconefoam2->SetLineWidth(1);
2363   cfconefoam2->SetFillColor(cfconefoam2->GetLineColor());
2364   cfconefoam2->SetFillStyle(4050); // 50% transparent
2365
2366   TGeoVolume *coolinghole = new TGeoVolume("SSDCoolingHole",
2367                                            coolingholeshape,medSSDair);
2368   coolinghole->SetVisibility(kTRUE);
2369   coolinghole->SetLineColor(5); // Yellow
2370   coolinghole->SetLineWidth(1);
2371   coolinghole->SetFillColor(coolinghole->GetLineColor());
2372   coolinghole->SetFillStyle(4090); // 90% transparent
2373
2374   TGeoVolume *coolinghole2 = new TGeoVolume("SSDCoolingHole2",
2375                                             coolinghole2shape,medSSDair);
2376   coolinghole2->SetVisibility(kTRUE);
2377   coolinghole2->SetLineColor(5); // Yellow
2378   coolinghole2->SetLineWidth(1);
2379   coolinghole2->SetFillColor(coolinghole2->GetLineColor());
2380   coolinghole2->SetFillStyle(4090); // 90% transparent
2381
2382   TGeoVolume *coolinghole3 = new TGeoVolume("SSDCoolingHole3",
2383                                             coolinghole3shape,medSSDair);
2384   coolinghole3->SetVisibility(kTRUE);
2385   coolinghole3->SetLineColor(5); // Yellow
2386   coolinghole3->SetLineWidth(1);
2387   coolinghole3->SetFillColor(coolinghole3->GetLineColor());
2388   coolinghole3->SetFillStyle(4090); // 90% transparent
2389
2390   TGeoVolume *mountinghole = new TGeoVolume("SSDMountingHole",
2391                                             mountingholeshape,medSSDair);
2392   mountinghole->SetVisibility(kTRUE);
2393   mountinghole->SetLineColor(5); // Yellow
2394   mountinghole->SetLineWidth(1);
2395   mountinghole->SetFillColor(mountinghole->GetLineColor());
2396   mountinghole->SetFillStyle(4090); // 90% transparent
2397
2398   TGeoVolume *mountinghole2 = new TGeoVolume("SSDMountingHole2",
2399                                              mountinghole2shape,medSSDair);
2400   mountinghole2->SetVisibility(kTRUE);
2401   mountinghole2->SetLineColor(5); // Yellow
2402   mountinghole2->SetLineWidth(1);
2403   mountinghole2->SetFillColor(mountinghole2->GetLineColor());
2404   mountinghole2->SetFillStyle(4090); // 90% transparent
2405
2406   TGeoVolume *mountinghole3 = new TGeoVolume("SSDMountingHole3",
2407                                              mountinghole3shape,medSSDair);
2408   mountinghole3->SetVisibility(kTRUE);
2409   mountinghole3->SetLineColor(5); // Yellow
2410   mountinghole3->SetLineWidth(1);
2411   mountinghole3->SetFillColor(mountinghole3->GetLineColor());
2412   mountinghole3->SetFillStyle(4090); // 90% transparent
2413
2414   TGeoVolume *wing = new TGeoVolume("SSDWing",wingshape,medSSDcf);
2415   wing->SetVisibility(kTRUE);
2416   wing->SetLineColor(4); // Blue
2417   wing->SetLineWidth(1);
2418   wing->SetFillColor(wing->GetLineColor());
2419   wing->SetFillStyle(4000); // 0% transparent
2420
2421   TGeoVolume *cablehole = new TGeoVolume("SSDCableHole",
2422                                          cableholeshape,medSSDair);
2423   cablehole->SetVisibility(kTRUE);
2424   cablehole->SetLineColor(5); // Yellow
2425   cablehole->SetLineWidth(1);
2426   cablehole->SetFillColor(cablehole->GetLineColor());
2427   cablehole->SetFillStyle(4090); // 90% transparent
2428
2429   TGeoVolume *winginsert = new TGeoVolume("SSDWingInsert",
2430                                           winginsertshape,medSSDste);
2431   winginsert->SetVisibility(kTRUE);
2432   winginsert->SetLineColor(2); // Red
2433   winginsert->SetLineWidth(1);
2434   winginsert->SetFillColor(winginsert->GetLineColor());
2435   winginsert->SetFillStyle(4050); // 50% transparent
2436
2437   TGeoVolume *bracket = new TGeoVolume("SSDMountingBracket",
2438                                        bracketshape,medSSDal);
2439   bracket->SetVisibility(kTRUE);
2440   bracket->SetLineColor(6); // Purple
2441   bracket->SetLineWidth(1);
2442   bracket->SetFillColor(bracket->GetLineColor());
2443   bracket->SetFillStyle(4000); // 0% transparent
2444
2445   // Mount up a cone
2446   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
2447     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
2448     cfconefoam2->AddNode(mountinghole,i+1, new TGeoRotation("", phiH, 0, 0));
2449   }
2450
2451   for (Int_t i=0; i<(Int_t)(360./kCoolingHolePhi); i++) {
2452     Double_t phiH = i*kCoolingHolePhi + 0.5*kCoolingHolePhi;
2453     cfconeinsert->AddNodeOverlap(coolinghole,i+1, new TGeoRotation("", phiH, 0, 0));
2454   }
2455
2456   cfconeinsert->AddNode(cfconefoam1,1,0);
2457   cfconeinsert->AddNode(cfconefoam2,1,0);
2458
2459   cfcone->AddNode(cfconeinsert,1,0);
2460
2461   for (Int_t i=0; i<(Int_t)(360./kCoolingHolePhi); i++) {
2462     Double_t phiH = i*kCoolingHolePhi + 0.5*kCoolingHolePhi;
2463     cfcone->AddNode(coolinghole2,i+1, new TGeoRotation("", phiH, 0, 0));
2464     cfcone->AddNode(coolinghole3,i+1, new TGeoRotation("", phiH, 0, 0));
2465     cfcone->AddNodeOverlap(cablehole,i+1, new TGeoRotation("", phiH, 0, 0));
2466   }
2467
2468   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
2469     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
2470     cfcone->AddNode(mountinghole2,i+1, new TGeoRotation("", phiH, 0, 0));
2471     cfcone->AddNode(mountinghole3,i+1, new TGeoRotation("", phiH, 0, 0));
2472   }
2473
2474   wing->AddNode(winginsert,1,0);
2475
2476   // Add all volumes in the Cone assembly
2477   vC->AddNode(cfcone,1,new TGeoTranslation(0,0,-kConeZPosition));
2478
2479   for (Int_t i=0; i<4; i++) {
2480     Double_t thetaW = kThetaWing + 90.*i + angleWideWing/2.;
2481     vC->AddNode(wing, i+1, new TGeoCombiTrans(0, 0, -kConeZPosition+kWingHalfThick,
2482                            new TGeoRotation("",thetaW,180,0)));
2483   }
2484
2485   Double_t zBracket = kConeZPosition - coneshape->GetZ(9) +
2486                       2*bracketshape->GetDz();
2487   for (Int_t i=0; i<3; i++) {
2488     Double_t thetaB = 60 + 120.*i;
2489     vC->AddNode(bracket, i+1, new TGeoCombiTrans(0, 0, -zBracket,
2490                               new TGeoRotation("",thetaB,0,0)));
2491   }
2492
2493   // Finally put everything in the mother volume
2494   moth->AddNode(cfcylinder,1,0);
2495
2496   moth->AddNode(vC, 1, 0 );
2497   moth->AddNode(vC, 2, new TGeoRotation("",180, 180, 0) );
2498
2499   // Some debugging if requested
2500   if(GetDebug(1)){
2501     vC->PrintNodes();
2502     vC->InspectShape();
2503   }
2504
2505   return;
2506 }
2507
2508 //______________________________________________________________________
2509 void AliITSv11GeometrySupport::ServicesCableSupport(TGeoVolume *moth,
2510                                                     TGeoManager *mgr){
2511 //
2512 // Creates the cable trays which are outside the ITS support cones
2513 // but still inside the TPC
2514 // This is now a stearing routine, the actual work is done by three
2515 // specialized methods to avoid a really huge unique method
2516 //
2517 // Input:
2518 //         moth : the TGeoVolume owing the volume structure
2519 //         mgr  : the GeoManager (default gGeoManager)
2520 // Output:
2521 //
2522 // Created:      15 Nov 2009  Mario Sitta
2523 //
2524
2525   TraySupportsSideA(moth, mgr);
2526
2527   ServicesCableSupportSPD(moth, mgr);
2528   ServicesCableSupportSDD(moth, mgr);
2529   ServicesCableSupportSSD(moth, mgr);
2530
2531   return;
2532 }
2533
2534 //______________________________________________________________________
2535 void AliITSv11GeometrySupport::TraySupportsSideA(TGeoVolume *moth,
2536                                            const TGeoManager *mgr){
2537 //
2538 // Creates the structure supporting the ITS cable trays on Side A
2539 //
2540 // Input:
2541 //         moth : the TGeoVolume owing the volume structure
2542 //         mgr  : the GeoManager (default gGeoManager)
2543 // Output:
2544 //
2545 // Created:      14 Dec 2009  Mario Sitta
2546 // Updated:      26 Feb 2010  Mario Sitta
2547 //
2548 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
2549 // drawings and other (oral) information given by F.Tosello
2550 //
2551
2552   // Dimensions and positions of the A-Side Cable Tray Support Ring
2553   // (0872/G/A/01)
2554   const Double_t kSuppRingYTrans      =  110.00 *fgkmm;
2555   const Double_t kSuppRingZTrans      =(1011.00+435.00) *fgkmm;
2556   const Double_t kSuppForwYTrans      =  185.00 *fgkmm;
2557
2558   const Double_t kExtSuppRingSpace1   =   33.00 *fgkmm;
2559   const Double_t kExtSuppRingSpace2   =   45.00 *fgkmm;
2560   const Double_t kExtSuppRingSpcAbov  =   30.00 *fgkmm;
2561   const Double_t kExtSuppRingBase     =  491.50 *fgkmm;
2562   const Double_t kExtSuppRingInward   =   35.00 *fgkmm;
2563   const Double_t kExtSuppRingRmax     =  540.00 *fgkmm;
2564   const Double_t kExtSuppRingRint1    =  465.00 *fgkmm;
2565   const Double_t kExtSuppRingRint2    =  467.00 *fgkmm;
2566   const Double_t kExtSuppRingInnerHi  =  450.00 *fgkmm;
2567   const Double_t kExtSuppRingInWide   =  100.00 *fgkmm;
2568   const Double_t kExtSuppRingR7       =    7.00 *fgkmm;
2569   const Double_t kExtSuppRingR5       =    5.00 *fgkmm;
2570   const Double_t kExtSuppRingThick    =   20.00 *fgkmm;
2571
2572   const Double_t kExtSuppRingSpcAng   =   10.50 *TMath::DegToRad();
2573   const Double_t kExtSuppRingPartPhi  =   15.00 *TMath::DegToRad();
2574   const Double_t kExtSuppRingIntAng   =    7.00 *TMath::DegToRad();
2575   const Double_t kExtSuppRingBaseAng  =   75.00 *TMath::DegToRad();
2576   const Double_t kExtSuppRingR7Ang    =  100.00 *TMath::DegToRad(); // Guessed
2577
2578   const Int_t    kExtSuppRingNPtsArc  =   10; // N.points to approximate arc
2579
2580   const Double_t kIntSuppRingThick1   =   15.00 *fgkmm;
2581   const Double_t kIntSuppRingThick2   =   13.00 *fgkmm;
2582   const Double_t kIntSuppRingInward   =   24.00 *fgkmm;
2583   const Double_t kIntSuppRingThick    =   20.00 *fgkmm;
2584
2585   const Double_t kSuppCylHeight       =  340.00 *fgkmm;
2586   const Double_t kSuppCylRint         =  475.00 *fgkmm;
2587   const Double_t kSuppCylRext         =  478.00 *fgkmm;
2588   const Double_t kSuppCylDispl        =  137.70 *fgkmm;
2589
2590   const Double_t kSuppSpacerHeight    =   30.00 *fgkmm;
2591   const Double_t kSuppSpacerThick     =   10.00 *fgkmm;
2592
2593   const Double_t kSuppSpacerAngle     =   15.00;  // Degrees
2594
2595   const Double_t kSuppForwRingRint1   =  500.00 *fgkmm;
2596   const Double_t kSuppForwRingRint2   =  540.00 *fgkmm;
2597   const Double_t kSuppForwRingRext    =  560.00 *fgkmm;
2598   const Double_t kSuppForwRingThikAll =   50.00 *fgkmm;
2599   const Double_t kSuppForwRingThikInt =   20.00 *fgkmm;
2600
2601   // (0872/G/B/01)
2602   const Double_t kSuppForwConeRmin    =  558.00 *fgkmm;
2603   const Double_t kSuppForwConeRmax    =  681.00 *fgkmm;
2604   const Double_t kSuppForwConeLen1    =  318.00 *fgkmm;
2605   const Double_t kSuppForwConeLen2    =  662.00 *fgkmm;
2606   const Double_t kSuppForwConeThick   =    3.00 *fgkmm;
2607
2608   const Double_t kSuppBackRingPlacTop =   90.00 *fgkmm;
2609   const Double_t kSuppBackRingPlacSid =   50.00 *fgkmm;
2610   const Double_t kSuppBackRingHeight  =  760.00 *fgkmm;
2611   const Double_t kSuppBackRingRext    =  760.00 *fgkmm;
2612   const Double_t kSuppBackRingRint    =  685.00 *fgkmm;
2613 //  const Double_t kSuppBackRingRint2   =  675.00 *fgkmm;
2614   const Double_t kSuppBackRingR10     =   10.00 *fgkmm;
2615   const Double_t kSuppBackRingBase    =  739.00 *fgkmm;
2616   const Double_t kSuppBackRingThikAll =   50.00 *fgkmm;
2617   const Double_t kSuppBackRingThick1  =   20.00 *fgkmm;
2618   const Double_t kSuppBackRingThick2  =   20.00 *fgkmm;
2619
2620 //  const Double_t kSuppBackRingPlacAng =   10.00 *TMath::DegToRad();
2621   const Double_t kSuppBackRingPlacAng =   10.25 *TMath::DegToRad();//Fix ovlp.
2622   const Double_t kSuppBackRing2ndAng1 =   78.40 *TMath::DegToRad();
2623   const Double_t kSuppBackRing2ndAng2 =   45.00 *TMath::DegToRad();
2624
2625   const Int_t    kSuppBackRingNPtsArc =   10; // N.points to approximate arc
2626
2627   // (0872/G/C/01)
2628   const Double_t kRearSuppZTransGlob  =(1011.00+9315.00-6040.00) *fgkmm;
2629   const Double_t kBackRodZTrans       = 2420.00 *fgkmm;
2630
2631   const Double_t kBackRodLength       = 1160.00 *fgkmm;
2632   const Double_t kBackRodThickLen     =   20.00 *fgkmm;
2633   const Double_t kBackRodDiameter     =   20.00 *fgkmm;
2634
2635   const Double_t kSuppRearRingRint    =  360.00 *fgkmm;
2636   const Double_t kSuppRearRingRext1   =  410.00 *fgkmm;
2637   const Double_t kSuppRearRingRext2   =  414.00 *fgkmm;
2638   const Double_t kSuppRearRingHeight  =  397.00 *fgkmm;
2639   const Double_t kSuppRearRingTopWide =  111.87 *fgkmm;
2640   const Double_t kSuppRearRingBase    =  451.50 *fgkmm;
2641   const Double_t kSuppRearRingBaseHi  =   58.00 *fgkmm;
2642   const Double_t kSuppRearRingSideHi  =   52.00 *fgkmm;
2643   const Double_t kSuppRearRingInside  =   40.00 *fgkmm;
2644   const Double_t kSuppRearRingInsideHi=   12.00 *fgkmm;
2645   const Double_t kSuppRearRingThick   =   20.00 *fgkmm;
2646   const Double_t kSuppRearRingXRodHole=  441.50 *fgkmm;
2647   const Double_t kSuppRearRingYRodHole=   42.00 *fgkmm;
2648
2649   const Double_t kSuppRearRing1stAng  =   22.00 *TMath::DegToRad();
2650   const Double_t kSuppRearRingStepAng =   15.00 *TMath::DegToRad();
2651
2652   const Int_t    kSuppRearRingNPtsArc =   10; // N.points to approximate arc
2653
2654
2655   // Local variables
2656   Double_t xprof[2*(15+kExtSuppRingNPtsArc)],yprof[2*(15+kExtSuppRingNPtsArc)];
2657   Double_t slp1, slp2, phi, xm, ym;
2658   Double_t xloc, yloc, zloc, rmin, rmax, deltaR;
2659   Int_t npoints;
2660
2661
2662   // The whole support as an assembly
2663   TGeoVolumeAssembly *trayASuppStruct = new TGeoVolumeAssembly("ITSsuppSideAStructure");
2664   
2665
2666   // First create all needed shapes
2667
2668   // The External Ring (part of 0872/G/A/01): a really complex Xtru
2669   TGeoXtru *extSuppRing = new TGeoXtru(2);
2670
2671   // First the upper notch...
2672   xprof[ 0] = kExtSuppRingSpace1;
2673   yprof[ 0] = kExtSuppRingInnerHi + kExtSuppRingSpcAbov;
2674
2675   slp1 = TMath::Tan(TMath::Pi()/2 - kExtSuppRingSpcAng);
2676   IntersectCircle(slp1, xprof[0], yprof[0], kExtSuppRingRmax, 0., 0.,
2677                   xprof[5], yprof[5], xm, ym); // Ignore dummy xm,ym
2678
2679   xprof[ 4] = xprof[5];
2680   yprof[ 4] = yprof[5] - kExtSuppRingR5/TMath::Tan(kExtSuppRingSpcAng);
2681   xprof[ 3] = xprof[4] - kExtSuppRingR5*(1 - TMath::Cos(TMath::Pi()/6));
2682   yprof[ 3] = yprof[4] - kExtSuppRingR5*(    TMath::Sin(TMath::Pi()/6));
2683   xprof[ 2] = xprof[4] - kExtSuppRingR5*(1 - TMath::Cos(TMath::Pi()/3));
2684   yprof[ 2] = yprof[4] - kExtSuppRingR5*(    TMath::Sin(TMath::Pi()/3));
2685   xprof[ 1] = xprof[4] - kExtSuppRingR5;
2686   yprof[ 1] = yprof[4] - kExtSuppRingR5;
2687
2688   Int_t indx = 5+kExtSuppRingNPtsArc;
2689   // ...then the external arc, approximated with segments,...
2690   xprof[indx] = kExtSuppRingBase;
2691   yprof[indx] = TMath::Sqrt(kExtSuppRingRmax*kExtSuppRingRmax -
2692                             kExtSuppRingBase*kExtSuppRingBase);
2693   Double_t alphamin = TMath::ASin(kExtSuppRingSpace2/kExtSuppRingRmax);
2694   Double_t alphamax = TMath::Pi()/2 -
2695                     TMath::ASin(yprof[5+kExtSuppRingNPtsArc]/kExtSuppRingRmax);
2696
2697   for (Int_t jp = 1; jp < kExtSuppRingNPtsArc; jp++) {
2698     Double_t alpha = jp*(alphamax-alphamin)/kExtSuppRingNPtsArc;
2699     xprof[5+jp] = kExtSuppRingRmax*TMath::Sin(alpha);
2700     yprof[5+jp] = kExtSuppRingRmax*TMath::Cos(alpha);
2701   }
2702   // ...and finally the interior profile
2703   xprof[indx+1] = kExtSuppRingBase;
2704   yprof[indx+1] = kSuppRingYTrans;
2705   xprof[indx+2] = xprof[indx+1] - kExtSuppRingInward;
2706   yprof[indx+2] = yprof[indx+1];
2707
2708   phi  = TMath::Pi()/2 - 4*kExtSuppRingPartPhi - kExtSuppRingIntAng;
2709   slp1 = TMath::Tan(TMath::Pi() - kExtSuppRingBaseAng);
2710   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2711   xm   = kExtSuppRingRint2*TMath::Cos(phi);
2712   ym   = kExtSuppRingRint2*TMath::Sin(phi);
2713   IntersectLines(slp1, xprof[indx+2], yprof[indx+2], slp2, xm, ym,
2714                  xprof[indx+3], yprof[indx+3]);
2715
2716   slp1 = slp2;
2717   phi += kExtSuppRingPartPhi;
2718   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2719   xm   = kExtSuppRingRint1*TMath::Cos(phi);
2720   ym   = kExtSuppRingRint1*TMath::Sin(phi);
2721   IntersectLines(slp1, xprof[indx+3], yprof[indx+3], slp2, xm, ym,
2722                  xprof[indx+4], yprof[indx+4]);
2723   
2724   slp1 = slp2;
2725   phi += kExtSuppRingPartPhi;
2726   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2727   xm   = kExtSuppRingRint2*TMath::Cos(phi);
2728   ym   = kExtSuppRingRint2*TMath::Sin(phi);
2729   IntersectLines(slp1, xprof[indx+4], yprof[indx+4], slp2, xm, ym,
2730                  xprof[indx+5], yprof[indx+5]);
2731   
2732   slp1 = slp2;
2733   phi += kExtSuppRingPartPhi;
2734   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2735   xm   = kExtSuppRingRint1*TMath::Cos(phi);
2736   ym   = kExtSuppRingRint1*TMath::Sin(phi);
2737   IntersectLines(slp1, xprof[indx+5], yprof[indx+5], slp2, xm, ym,
2738                  xprof[indx+6], yprof[indx+6]);
2739   
2740   xprof[indx+9] = kExtSuppRingInWide;
2741   yprof[indx+9] = kExtSuppRingInnerHi;
2742   xprof[indx+8] = xprof[indx+9] +
2743                   (1 - TMath::Cos(kExtSuppRingR7Ang/2))*kExtSuppRingR7;
2744   yprof[indx+8] = yprof[indx+9] +
2745                   (    TMath::Sin(kExtSuppRingR7Ang/2))*kExtSuppRingR7;
2746   xprof[indx+7] = xprof[indx+9] +
2747                   (1 + TMath::Cos(kExtSuppRingR7Ang  ))*kExtSuppRingR7;
2748   yprof[indx+7] = yprof[indx+9] +
2749                   (    TMath::Sin(kExtSuppRingR7Ang  ))*kExtSuppRingR7;
2750   // Gosh, we did the right side! now reflex on the left side
2751   npoints = (sizeof(xprof)/sizeof(Double_t))/2;
2752   for (Int_t jp = 0; jp < npoints; jp++) {
2753     xprof[npoints+jp] = -xprof[npoints-1-jp];
2754     yprof[npoints+jp] =  yprof[npoints-1-jp];
2755   }
2756   // wow! now the actual Xtru
2757   extSuppRing->DefinePolygon(2*npoints, xprof, yprof);
2758   extSuppRing->DefineSection(0,0);
2759   extSuppRing->DefineSection(1,kExtSuppRingThick);
2760
2761   // The Internal Ring (part of 0872/G/A/01): another complex Xtru
2762   TGeoXtru *intSuppRing = new TGeoXtru(2);
2763
2764   // First the external profile...
2765   npoints = 0;
2766
2767   slp1 = 0;
2768   phi  = TMath::Pi()/2 - kExtSuppRingPartPhi - kExtSuppRingIntAng;
2769   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2770   xm   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Cos(phi);
2771   ym   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Sin(phi);
2772   IntersectLines(slp1,  0, kExtSuppRingInnerHi+kExtSuppRingSpcAbov,
2773                  slp2, xm, ym,
2774                  xprof[npoints], yprof[npoints]);
2775   npoints++;
2776
2777   slp1 = slp2;
2778   phi -= kExtSuppRingPartPhi;
2779   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2780   xm   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Cos(phi);
2781   ym   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Sin(phi);
2782   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
2783                  slp2, xm, ym,
2784                  xprof[npoints], yprof[npoints]);
2785   npoints++;
2786
2787   slp1 = slp2;
2788   phi -= kExtSuppRingPartPhi;
2789   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2790   xm   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Cos(phi);
2791   ym   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Sin(phi);
2792   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
2793                  slp2, xm, ym,
2794                  xprof[npoints], yprof[npoints]);
2795   npoints++;
2796
2797   slp1 = slp2;
2798   phi -= kExtSuppRingPartPhi;
2799   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
2800   xm   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Cos(phi);
2801   ym   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Sin(phi);
2802   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
2803                  slp2, xm, ym,
2804                  xprof[npoints], yprof[npoints]);
2805   npoints++;
2806
2807   xprof[npoints] = kExtSuppRingBase-kIntSuppRingInward;
2808   yprof[npoints] = Yfrom2Points(xprof[npoints-1], yprof[npoints-1], xm, ym,
2809                                 xprof[npoints]);
2810   npoints++;
2811
2812   xprof[npoints] = xprof[npoints-1];
2813   yprof[npoints] = kSuppRingYTrans;
2814   npoints++;
2815   // ...and then the interior profile, which is identical to extSuppRing one
2816   for (Int_t jp=0; jp < 8; jp++) {
2817     xprof[npoints] = extSuppRing->GetX(17+jp);
2818     yprof[npoints] = extSuppRing->GetY(17+jp);
2819     npoints++;
2820   }
2821   // We did the right side! now reflex on the left side
2822   for (Int_t jp = 0; jp < npoints; jp++) {
2823     xprof[npoints+jp] = -xprof[npoints-1-jp];
2824     yprof[npoints+jp] =  yprof[npoints-1-jp];
2825   }
2826   // And now the actual Xtru
2827   intSuppRing->DefinePolygon(2*npoints, xprof, yprof);
2828   intSuppRing->DefineSection(0,0);
2829   intSuppRing->DefineSection(1,kIntSuppRingThick);
2830
2831   // The intermediate cylinder (0872/G/A/03): a TubeSeg
2832   alphamin = TMath::ASin(kSuppCylDispl/kSuppCylRint)*TMath::RadToDeg();
2833   alphamax = 180 - alphamin;
2834   TGeoTubeSeg *interCylind = new TGeoTubeSeg(kSuppCylRint, kSuppCylRext,
2835                                      kSuppCylHeight/2, alphamin, alphamax);
2836
2837   // The spacer (0872/G/A/03): a simple Xtru
2838   TGeoXtru *suppSpacer = new TGeoXtru(2);
2839
2840   xprof[0] = kSuppSpacerHeight;
2841   yprof[0] = kSuppSpacerThick;
2842   xprof[1] = xprof[0];
2843   yprof[1] = 0;
2844   xprof[2] = 0;
2845   yprof[2] = 0;
2846   xprof[3] = kSuppSpacerThick*SinD(kSuppSpacerAngle);
2847   yprof[3] = yprof[0];
2848
2849   suppSpacer->DefinePolygon(4, xprof, yprof);
2850   suppSpacer->DefineSection(0,-kSuppCylHeight/2);
2851   suppSpacer->DefineSection(1, kSuppCylHeight/2);
2852
2853   // The forward ring (0872/G/B/02): a Pcon (slight oversimplification)
2854   Double_t rmean = (kSuppForwRingRint1+kSuppForwRingRext)/2;
2855   alphamin = TMath::ASin(kSuppForwYTrans/rmean)*TMath::RadToDeg();
2856   alphamax = 180 - alphamin;
2857
2858   TGeoPcon *forwardRing = new TGeoPcon(alphamin,alphamax-alphamin,4);
2859
2860   forwardRing->DefineSection(0,0,
2861                              kSuppForwRingRint1,kSuppForwRingRext);
2862   forwardRing->DefineSection(1,kSuppForwRingThikInt,
2863                              kSuppForwRingRint1,kSuppForwRingRext);
2864   forwardRing->DefineSection(2,kSuppForwRingThikInt,
2865                              kSuppForwRingRint2,kSuppForwRingRext);
2866   forwardRing->DefineSection(3,kSuppForwRingThikAll,
2867                              kSuppForwRingRint2,kSuppForwRingRext);
2868
2869   // The forward cone (0872/G/B/03): a TGeoPcon
2870   TGeoPcon *forwardCone = new TGeoPcon(alphamin,alphamax-alphamin,3);
2871
2872   forwardCone->DefineSection(0,0,
2873                              kSuppForwConeRmin-kSuppForwConeThick,
2874                              kSuppForwConeRmin);
2875   forwardCone->DefineSection(1,kSuppForwConeLen1,
2876                              kSuppForwConeRmin-kSuppForwConeThick,
2877                              kSuppForwConeRmin);
2878   forwardCone->DefineSection(2,kSuppForwConeLen1+kSuppForwConeLen2,
2879                              kSuppForwConeRmax-kSuppForwConeThick,
2880                              kSuppForwConeRmax);
2881
2882   // The first part of the Back Ring (part of 0872/G/B/01): a complex Xtru
2883   TGeoXtru *firstSuppBackRing = new TGeoXtru(2);
2884
2885   // First the external profile... (the arc is approximated with segments)
2886   npoints = 0;
2887
2888   xprof[npoints] = kSuppBackRingPlacTop;
2889   yprof[npoints] = kSuppBackRingHeight;
2890   npoints++;
2891
2892   alphamax = TMath::Pi()/2 - TMath::ASin(kSuppBackRingPlacTop/kSuppBackRingRext);
2893   alphamin = TMath::ASin((kSuppForwYTrans+kSuppBackRingPlacSid)/kSuppBackRingRext);
2894
2895   xprof[npoints] = xprof[npoints-1];
2896   yprof[npoints] = kSuppBackRingRext*TMath::Sin(alphamax);
2897   npoints++;
2898
2899   for (Int_t jp = 1; jp <= kSuppBackRingNPtsArc; jp++) {
2900     Double_t alpha = alphamax - jp*(alphamax-alphamin)/kSuppBackRingNPtsArc;
2901     xprof[npoints] = kSuppBackRingRext*TMath::Cos(alpha);
2902     yprof[npoints] = kSuppBackRingRext*TMath::Sin(alpha);
2903     npoints++;
2904   }
2905
2906   xprof[npoints] = kSuppBackRingBase -
2907                    kSuppBackRingPlacSid*TMath::Tan(kSuppBackRingPlacAng);
2908   yprof[npoints] = yprof[npoints-1];
2909   npoints++;
2910
2911   xprof[npoints] = kSuppBackRingBase;
2912   yprof[npoints] = kSuppForwYTrans;
2913   npoints++;
2914   // ...then the internal profile (the arc is approximated with segments)
2915   alphamin = TMath::ASin(kSuppForwYTrans/kSuppBackRingRint);
2916   alphamax = TMath::Pi()/2;
2917
2918   for (Int_t jp = 0; jp < kSuppBackRingNPtsArc; jp++) {
2919     Double_t alpha = alphamin + jp*(alphamax-alphamin)/kSuppBackRingNPtsArc;
2920     xprof[npoints] = kSuppBackRingRint*TMath::Cos(alpha);
2921     yprof[npoints] = kSuppBackRingRint*TMath::Sin(alpha);
2922     npoints++;
2923   }
2924
2925   xprof[npoints] = 0;
2926   yprof[npoints] = kSuppBackRingRint;
2927   npoints++;
2928   // We did the right side! now reflex on the left side (except last point)
2929   for (Int_t jp = 0; jp < npoints-1; jp++) {
2930     xprof[npoints+jp] = -xprof[npoints-jp-2];
2931     yprof[npoints+jp] =  yprof[npoints-jp-2];
2932   }
2933   // And now the actual Xtru
2934   firstSuppBackRing->DefinePolygon(2*npoints-1, xprof, yprof);
2935   firstSuppBackRing->DefineSection(0,0);
2936   firstSuppBackRing->DefineSection(1,kSuppBackRingThick1);
2937
2938   // The second part of the Back Ring (part of 0872/G/B/01): a Pcon
2939   // (slight oversimplification)
2940   alphamin = TMath::ASin(kSuppForwYTrans/kSuppBackRingRint)*TMath::RadToDeg();
2941   alphamax = 180 - alphamin;
2942
2943   TGeoPcon *secondSuppBackRing = new TGeoPcon(alphamin,alphamax-alphamin,6);
2944
2945   deltaR = kSuppBackRingThick2/TMath::Sin(kSuppBackRing2ndAng1);
2946   rmin = kSuppBackRingRint - kSuppBackRingThick1/TMath::Tan(kSuppBackRing2ndAng1);
2947   rmax = rmin + deltaR + kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1);
2948   secondSuppBackRing->DefineSection(0, 0, rmin, rmax);
2949
2950   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1/3));
2951   rmax -= kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1/3);
2952   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
2953   secondSuppBackRing->DefineSection(1, zloc, rmin, rmax);
2954
2955   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1*2/3));
2956   rmax = secondSuppBackRing->GetRmax(0) - kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1*2/3);
2957   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
2958   secondSuppBackRing->DefineSection(2, zloc, rmin, rmax);
2959
2960   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1));
2961   rmax = secondSuppBackRing->GetRmax(0) - kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1);
2962   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
2963   secondSuppBackRing->DefineSection(3, zloc, rmin, rmax);
2964
2965   slp1 = TMath::Tan(kSuppBackRing2ndAng2);
2966   slp2 = TMath::Tan(TMath::Pi()/2 + kSuppBackRing2ndAng1);
2967   IntersectLines(-slp1,kSuppBackRingThikAll,deltaR/2,
2968                   slp2,kSuppBackRingThikAll,deltaR,
2969                   xm, ym);
2970
2971   zloc = xm - kSuppBackRingThick1;
2972   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
2973   rmax = rmin + deltaR;
2974   secondSuppBackRing->DefineSection(4, zloc, rmin, rmax);
2975
2976   zloc = kSuppBackRingThikAll - kSuppBackRingThick1;
2977   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
2978   rmax = rmin + deltaR/2;
2979   secondSuppBackRing->DefineSection(5, zloc, rmin, rmax);
2980
2981   // The supporting rod: a Tube
2982   TGeoTube *suppRod = new TGeoTube(0, kBackRodDiameter/2,
2983                                    (kBackRodLength - kBackRodThickLen)/2);
2984
2985   // The Back Ring (0872/G/C/01): another complex Xtru
2986   TGeoXtru *suppRearRing = new TGeoXtru(2);
2987
2988   // First the external profile...
2989   npoints = 0;
2990
2991   xprof[npoints] = kSuppRearRingTopWide;
2992   yprof[npoints] = kSuppRearRingHeight;
2993   npoints++;
2994
2995   phi = kSuppRearRing1stAng;
2996   slp1 = TMath::Tan(TMath::Pi() - phi);
2997   phi += kSuppRearRingStepAng;
2998   slp2 = TMath::Tan(TMath::Pi() - phi);
2999   xm = kSuppRearRingRext2*TMath::Sin(phi);
3000   ym = kSuppRearRingRext2*TMath::Cos(phi);
3001   IntersectLines(slp1, kSuppRearRingTopWide, kSuppRearRingHeight,
3002                  slp2, xm, ym,
3003                  xprof[npoints], yprof[npoints]);
3004   npoints++;
3005
3006   slp1 = slp2;
3007   phi += kSuppRearRingStepAng;
3008   slp2 = TMath::Tan(TMath::Pi() - phi);
3009   xm = kSuppRearRingRext1*TMath::Sin(phi);
3010   ym = kSuppRearRingRext1*TMath::Cos(phi);
3011   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3012                  slp2, xm, ym,
3013                  xprof[npoints], yprof[npoints]);
3014   npoints++;
3015
3016   slp1 = slp2;
3017   phi += kSuppRearRingStepAng;
3018   slp2 = TMath::Tan(TMath::Pi() - phi);
3019   xm = kSuppRearRingRext2*TMath::Sin(phi);
3020   ym = kSuppRearRingRext2*TMath::Cos(phi);
3021   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3022                  slp2, xm, ym,
3023                  xprof[npoints], yprof[npoints]);
3024   npoints++;
3025
3026   slp1 = slp2;
3027   slp2 = 0;
3028   xm = kSuppRearRingBase;
3029   ym = kSuppRearRingBaseHi + kSuppRearRingSideHi;
3030   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3031                  slp2, xm, ym,
3032                  xprof[npoints], yprof[npoints]);
3033   npoints++;
3034
3035   xprof[npoints] = kSuppRearRingBase;
3036   yprof[npoints] = kSuppRearRingBaseHi + kSuppRearRingSideHi;
3037   npoints++;
3038   xprof[npoints] = xprof[npoints - 1];
3039   yprof[npoints] = kSuppRearRingBaseHi;
3040   npoints++;
3041   xprof[npoints] = xprof[npoints - 1] - kSuppRearRingInside;
3042   yprof[npoints] = yprof[npoints - 1];
3043   npoints++;
3044   xprof[npoints] = xprof[npoints - 1];
3045   yprof[npoints] = yprof[npoints - 1] + kSuppRearRingInsideHi;
3046   npoints++;
3047   // ...then the internal arc, approximated with segments,...
3048   xprof[npoints] = kSuppRearRingRint;
3049   yprof[npoints] = yprof[npoints - 1];
3050
3051   alphamin = TMath::ASin(kSuppRearRingBaseHi/kSuppRearRingRint);
3052   alphamax = TMath::Pi()/2;
3053
3054   for (Int_t jp = 1; jp < kSuppRearRingNPtsArc; jp++) {
3055     Double_t alpha = alphamin + jp*(alphamax-alphamin)/kSuppRearRingNPtsArc;
3056     xprof[npoints+jp] = kSuppRearRingRint*TMath::Cos(alpha);
3057     yprof[npoints+jp] = kSuppRearRingRint*TMath::Sin(alpha);
3058   }
3059
3060   xprof[npoints+kSuppRearRingNPtsArc] = 0;
3061   yprof[npoints+kSuppRearRingNPtsArc] = kSuppRearRingRint;
3062   // We did the right side! now reflex on the left side
3063   Int_t nTotalPoints = npoints+kSuppRearRingNPtsArc;
3064   for (Int_t jp = 0; jp < nTotalPoints; jp++) {
3065     xprof[nTotalPoints+1+jp] = -xprof[nTotalPoints-1-jp];
3066     yprof[nTotalPoints+1+jp] =  yprof[nTotalPoints-1-jp];
3067   }
3068
3069   // And now the actual Xtru
3070   suppRearRing->DefinePolygon(2*nTotalPoints+1, xprof, yprof);
3071   suppRearRing->DefineSection(0,0);
3072   suppRearRing->DefineSection(1,kSuppRearRingThick);
3073
3074
3075   // We have all shapes: now create the real volumes
3076   TGeoMedium *medAl = mgr->GetMedium("ITS_ANTICORODAL$");
3077
3078   TGeoVolume *sideAExtSuppRing = new TGeoVolume("ITSsuppSideAExtSuppRing",
3079                                                  extSuppRing, medAl);
3080
3081   sideAExtSuppRing->SetVisibility(kTRUE);
3082   sideAExtSuppRing->SetLineColor(kMagenta+1);
3083   sideAExtSuppRing->SetLineWidth(1);
3084   sideAExtSuppRing->SetFillColor(sideAExtSuppRing->GetLineColor());
3085   sideAExtSuppRing->SetFillStyle(4000); // 0% transparent
3086
3087   TGeoVolume *sideAIntSuppRing = new TGeoVolume("ITSsuppSideAIntSuppRing",
3088                                                  intSuppRing, medAl);
3089
3090   sideAIntSuppRing->SetVisibility(kTRUE);
3091   sideAIntSuppRing->SetLineColor(kMagenta+1);
3092   sideAIntSuppRing->SetLineWidth(1);
3093   sideAIntSuppRing->SetFillColor(sideAIntSuppRing->GetLineColor());
3094   sideAIntSuppRing->SetFillStyle(4000); // 0% transparent
3095
3096   TGeoVolume *sideASuppCyl = new TGeoVolume("ITSsuppSideASuppCyl",
3097                                             interCylind, medAl);
3098
3099   sideASuppCyl->SetVisibility(kTRUE);
3100   sideASuppCyl->SetLineColor(kMagenta+1);
3101   sideASuppCyl->SetLineWidth(1);
3102   sideASuppCyl->SetFillColor(sideASuppCyl->GetLineColor());
3103   sideASuppCyl->SetFillStyle(4000); // 0% transparent
3104
3105   TGeoVolume *sideASuppSpacer = new TGeoVolume("ITSsuppSideASuppSpacer",
3106                                                suppSpacer, medAl);
3107
3108   sideASuppSpacer->SetVisibility(kTRUE);
3109   sideASuppSpacer->SetLineColor(kMagenta+1);
3110   sideASuppSpacer->SetLineWidth(1);
3111   sideASuppSpacer->SetFillColor(sideASuppSpacer->GetLineColor());
3112   sideASuppSpacer->SetFillStyle(4000); // 0% transparent
3113
3114   TGeoVolume *sideASuppForwRing = new TGeoVolume("ITSsuppSideASuppForwRing",
3115                                                  forwardRing, medAl);
3116
3117   sideASuppForwRing->SetVisibility(kTRUE);
3118   sideASuppForwRing->SetLineColor(kMagenta+1);
3119   sideASuppForwRing->SetLineWidth(1);
3120   sideASuppForwRing->SetFillColor(sideASuppForwRing->GetLineColor());
3121   sideASuppForwRing->SetFillStyle(4000); // 0% transparent
3122
3123   TGeoVolume *sideASuppForwCone = new TGeoVolume("ITSsuppSideASuppForwCone",
3124                                                  forwardCone, medAl);
3125
3126   sideASuppForwCone->SetVisibility(kTRUE);
3127   sideASuppForwCone->SetLineColor(kMagenta+1);
3128   sideASuppForwCone->SetLineWidth(1);
3129   sideASuppForwCone->SetFillColor(sideASuppForwCone->GetLineColor());
3130   sideASuppForwCone->SetFillStyle(4000); // 0% transparent
3131
3132   TGeoVolume *sideAFirstSuppBackRing = new TGeoVolume("ITSsuppSideAFirstSuppBackRing",
3133                                                      firstSuppBackRing, medAl);
3134
3135   sideAFirstSuppBackRing->SetVisibility(kTRUE);
3136   sideAFirstSuppBackRing->SetLineColor(kMagenta+1);
3137   sideAFirstSuppBackRing->SetLineWidth(1);
3138   sideAFirstSuppBackRing->SetFillColor(sideAFirstSuppBackRing->GetLineColor());
3139   sideAFirstSuppBackRing->SetFillStyle(4000); // 0% transparent
3140
3141   TGeoVolume *sideASecondSuppBackRing = new TGeoVolume("ITSsuppSideASecondSuppBackRing",
3142                                                        secondSuppBackRing, medAl);
3143
3144   sideASecondSuppBackRing->SetVisibility(kTRUE);
3145   sideASecondSuppBackRing->SetLineColor(kMagenta+1);
3146   sideASecondSuppBackRing->SetLineWidth(1);
3147   sideASecondSuppBackRing->SetFillColor(sideASecondSuppBackRing->GetLineColor());
3148   sideASecondSuppBackRing->SetFillStyle(4000); // 0% transparent
3149
3150   TGeoVolume *sideASuppRod = new TGeoVolume("ITSsuppSideASuppRod",
3151                                             suppRod, medAl);
3152
3153   sideASuppRod->SetVisibility(kTRUE);
3154   sideASuppRod->SetLineColor(kMagenta+1);
3155   sideASuppRod->SetLineWidth(1);
3156   sideASuppRod->SetFillColor(sideASuppRod->GetLineColor());
3157   sideASuppRod->SetFillStyle(4000); // 0% transparent
3158
3159   TGeoVolume *sideASuppRearRing = new TGeoVolume("ITSsuppSideASuppRearRing",
3160                                                  suppRearRing, medAl);
3161
3162   sideASuppRearRing->SetVisibility(kTRUE);
3163   sideASuppRearRing->SetLineColor(kMagenta+1);
3164   sideASuppRearRing->SetLineWidth(1);
3165   sideASuppRearRing->SetFillColor(sideASuppRearRing->GetLineColor());
3166   sideASuppRearRing->SetFillStyle(4000); // 0% transparent
3167
3168
3169   // Now build up the support structure
3170   zloc = kSuppRingZTrans;
3171   trayASuppStruct->AddNode(sideAExtSuppRing, 1,
3172                            new TGeoTranslation(0, 0, zloc) );
3173   trayASuppStruct->AddNode(sideAExtSuppRing, 2,
3174                            new TGeoCombiTrans( 0, 0, zloc,
3175                                                new TGeoRotation("",180,0,0)));
3176
3177   zloc += kExtSuppRingThick;
3178   trayASuppStruct->AddNode(sideAIntSuppRing, 1,
3179                            new TGeoTranslation(0, 0, zloc) );
3180   trayASuppStruct->AddNode(sideAIntSuppRing, 2,
3181                            new TGeoCombiTrans( 0, 0, zloc,
3182                                                new TGeoRotation("",180,0,0)));
3183
3184   xloc = kExtSuppRingBase - kIntSuppRingInward;
3185   yloc = kSuppRingYTrans;
3186   zloc += (kIntSuppRingThick + kSuppCylHeight/2);
3187   trayASuppStruct->AddNode(sideASuppCyl, 1,
3188                            new TGeoTranslation(0, 0, zloc) );
3189   trayASuppStruct->AddNode(sideASuppCyl, 2,
3190                            new TGeoCombiTrans( 0, 0, zloc,
3191                                                new TGeoRotation("",180,0,0)));
3192   trayASuppStruct->AddNode(sideASuppSpacer, 1,
3193                            new TGeoCombiTrans( xloc, yloc, zloc,
3194                            new TGeoRotation("",90+kSuppSpacerAngle,0,0)));
3195   trayASuppStruct->AddNode(sideASuppSpacer, 2,
3196                            new TGeoCombiTrans(-xloc, yloc, zloc,
3197                            new TGeoRotation("",0,180,kSuppSpacerAngle-90)));
3198   trayASuppStruct->AddNode(sideASuppSpacer, 3,
3199                            new TGeoCombiTrans( xloc,-yloc, zloc,
3200                            new TGeoRotation("",180,180,kSuppSpacerAngle-90)));
3201   trayASuppStruct->AddNode(sideASuppSpacer, 4,
3202                            new TGeoCombiTrans(-xloc,-yloc, zloc,
3203                            new TGeoRotation("",270+kSuppSpacerAngle,0,0)));
3204
3205
3206   zloc += kSuppCylHeight/2;
3207   trayASuppStruct->AddNode(sideAIntSuppRing, 3,
3208                            new TGeoTranslation(0, 0, zloc) );
3209   trayASuppStruct->AddNode(sideAIntSuppRing, 4,
3210                            new TGeoCombiTrans( 0, 0, zloc,
3211                                                new TGeoRotation("",180,0,0)));
3212
3213   zloc += kIntSuppRingThick;
3214   trayASuppStruct->AddNode(sideAExtSuppRing, 3,
3215                            new TGeoTranslation(0, 0, zloc) );
3216   trayASuppStruct->AddNode(sideAExtSuppRing, 4,
3217                            new TGeoCombiTrans( 0, 0, zloc,
3218                                                new TGeoRotation("",180,0,0)));
3219
3220   zloc += kExtSuppRingThick;
3221   trayASuppStruct->AddNode(sideASuppForwRing, 1,
3222                            new TGeoTranslation(0, 0, zloc) );
3223   trayASuppStruct->AddNode(sideASuppForwRing, 2,
3224                            new TGeoCombiTrans( 0, 0, zloc,
3225                                                new TGeoRotation("",180,0,0)));
3226
3227   zloc += kSuppForwRingThikAll;
3228   trayASuppStruct->AddNode(sideASuppForwCone, 1,
3229                            new TGeoTranslation(0, 0, zloc) );
3230   trayASuppStruct->AddNode(sideASuppForwCone, 2,
3231                            new TGeoCombiTrans( 0, 0, zloc,
3232                                                new TGeoRotation("",180,0,0)));
3233
3234   zloc += (kSuppForwConeLen1+kSuppForwConeLen2);
3235   trayASuppStruct->AddNode(sideAFirstSuppBackRing, 1,
3236                            new TGeoTranslation(0, 0, zloc) );
3237   trayASuppStruct->AddNode(sideAFirstSuppBackRing, 2,
3238                            new TGeoCombiTrans( 0, 0, zloc,
3239                                                new TGeoRotation("",180,0,0)));
3240
3241   zloc += kSuppBackRingThick1;
3242   trayASuppStruct->AddNode(sideASecondSuppBackRing, 1,
3243                            new TGeoTranslation(0, 0, zloc) );
3244   trayASuppStruct->AddNode(sideASecondSuppBackRing, 2,
3245                            new TGeoCombiTrans( 0, 0, zloc,
3246                                                new TGeoRotation("",180,0,0)));
3247
3248   xloc = kSuppRearRingXRodHole;
3249   yloc = kSuppRearRingBaseHi + kSuppRearRingYRodHole;
3250   zloc = kRearSuppZTransGlob - kBackRodZTrans + suppRod->GetDz();
3251   trayASuppStruct->AddNode(sideASuppRod, 1,
3252                            new TGeoTranslation( xloc, yloc, zloc) );
3253   trayASuppStruct->AddNode(sideASuppRod, 2,
3254                            new TGeoTranslation(-xloc, yloc, zloc) );
3255   trayASuppStruct->AddNode(sideASuppRod, 3,
3256                            new TGeoTranslation( xloc,-yloc, zloc) );
3257   trayASuppStruct->AddNode(sideASuppRod, 4,
3258                            new TGeoTranslation(-xloc,-yloc, zloc) );
3259
3260   zloc += suppRod->GetDz();
3261   trayASuppStruct->AddNode(sideASuppRearRing, 1,
3262                            new TGeoTranslation( 0, 0, zloc) );
3263   trayASuppStruct->AddNode(sideASuppRearRing, 2,
3264                            new TGeoCombiTrans( 0, 0, zloc,
3265                                                new TGeoRotation("",180,0,0)));
3266
3267
3268   // Finally put everything in the mother volume
3269   moth->AddNode(trayASuppStruct,1,0);
3270
3271   return;
3272 }
3273
3274 //______________________________________________________________________
3275 void AliITSv11GeometrySupport::ServicesCableSupportSPD(TGeoVolume *moth,
3276                                                        TGeoManager *mgr){
3277 //
3278 // Creates the all SPD cable trays which are outside the ITS support cones
3279 // but still inside the TPC
3280 // In order to avoid a huge monolithic routine, this method actually
3281 // calls inner methods to create and assemble the various (macro)pieces
3282 //
3283 // Input:
3284 //         moth : the TGeoVolume owing the volume structure
3285 //         mgr  : the GeoManager (default gGeoManager)
3286 // Output:
3287 //
3288 // Created:         ???       Bjorn S. Nilsen
3289 // Updated:      15 Nov 2009  Mario Sitta
3290 //
3291 // Technical data are taken from AutoCAD drawings and other (oral)
3292 // information given by F.Tosello
3293 //
3294
3295   SPDCableTraysSideA(moth, mgr);
3296   SPDCableTraysSideC(moth, mgr);
3297
3298 }
3299
3300 //______________________________________________________________________
3301 void AliITSv11GeometrySupport::ServicesCableSupportSDD(TGeoVolume *moth,
3302                                                        TGeoManager *mgr){
3303 //
3304 // Creates the all SDD cable trays which are outside the ITS support cones
3305 // but still inside the TPC
3306 // In order to avoid a huge monolithic routine, this method actually
3307 // calls inner methods to create and assemble the various (macro)pieces
3308 //
3309 // Input:
3310 //         moth : the TGeoVolume owing the volume structure
3311 //         mgr  : the GeoManager (default gGeoManager)
3312 // Output:
3313 //
3314 // Created:      14 Dec 2009  Mario Sitta
3315 //
3316
3317   SDDCableTraysSideA(moth, mgr);
3318   SDDCableTraysSideC(moth, mgr);
3319
3320   return;
3321 }
3322
3323 //______________________________________________________________________
3324 void AliITSv11GeometrySupport::ServicesCableSupportSSD(TGeoVolume *moth,
3325                                                        TGeoManager *mgr){
3326 //
3327 // Creates the SSD cable trays which are outside the ITS support cones
3328 // but still inside the TPC
3329 // In order to avoid a huge monolithic routine, this method actually
3330 // calls inner methods to create and assemble the various (macro)pieces
3331 //
3332 // Input:
3333 //         moth : the TGeoVolume owing the volume structure
3334 //         mgr  : the GeoManager (default gGeoManager)
3335 // Output:
3336 //
3337 // Created:      15 Nov 2009  Mario Sitta
3338 //
3339
3340   SSDCableTraysSideA(moth, mgr);
3341   SSDCableTraysSideC(moth, mgr);
3342
3343   return;
3344 }
3345
3346 //______________________________________________________________________
3347 void AliITSv11GeometrySupport::SPDCableTraysSideA(TGeoVolume *moth,
3348                                             const TGeoManager *mgr){
3349 //
3350 // Creates the SPD cable trays which are outside the ITS support cones
3351 // but still inside the TPC on Side A
3352 // (part of this code is taken or anyway inspired to ServicesCableSupport
3353 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
3354 //
3355 // Input:
3356 //         moth : the TGeoVolume owing the volume structure
3357 //         mgr  : the GeoManager (default gGeoManager)
3358 // Output:
3359 //
3360 // Created:      15 Feb 2010  Mario Sitta
3361 // Updated:      10 Jun 2010  Mario Sitta  Freon inside cooling pipes
3362 // Updated:      08 Sep 2010  Mario Sitta
3363 // Updated:      14 Sep 2010  Mario Sitta  Cables prolonged till cone
3364 //
3365 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
3366 // drawings and other (oral) information given by F.Tosello and D.Elia
3367 // (small differences with blueprints - e.g. -0.07mm in R1Trans and
3368 // R2Trans - fix small overlaps; they are then compensated in positioning
3369 // the Rear Tray to avoid its own overlaps with the rear supporting ring)
3370 // Optical fibers and voltage cables are approximated with mean materials
3371 // and square cross sections, but preserving the total material budget.
3372 //
3373
3374   // Overall position and rotation of the A-Side Cable Trays
3375   // (parts of 0872/G/D)
3376   const Double_t kTrayAR1Trans           =  396.93 *fgkmm;
3377   const Double_t kTrayAR2Trans           =  413.93 *fgkmm;
3378   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
3379   const Double_t kTrayAZRot              = (180-169.5);// Degrees
3380   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
3381   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
3382
3383   const Double_t kForwardTrayWide        =   94.00 *fgkmm;//!!!TO BE CHECKED!!!
3384   const Double_t kForwardTrayFirstHigh   =   83.00 *fgkmm;//!!!TO BE CHECKED!!!
3385   const Double_t kForwardTraySecondHigh  =   52.70 *fgkmm;//!!!TO BE CHECKED!!!
3386   const Double_t kForwardTrayTotalLen    =  853.00 *fgkmm;
3387   const Double_t kForwardTrayFirstLen    =  435.00 *fgkmm;
3388   const Double_t kForwardTrayWingWide    =   16.00 *fgkmm;//!!!TO BE CHECKED!!!
3389   const Double_t kForwardTrayInterSpace  =   18.00 *fgkmm;//!!!TO BE CHECKED!!!
3390   const Double_t kForwardTrayThick       =    2.00 *fgkmm;
3391
3392   const Int_t    kForwardSideNpoints     =    6;
3393
3394   const Double_t kExternalTrayLen        = 1200.00 *fgkmm;
3395   const Double_t kExternalTrayWide       = kForwardTrayWide;
3396   const Double_t kExternalTrayHigh       = kForwardTraySecondHigh;
3397   const Double_t kExternalTrayThick      = kForwardTrayThick;
3398
3399   const Double_t kCoolingTubeRmin        =    2.00 *fgkmm;
3400   const Double_t kCoolingTubeRmax        =    3.00 *fgkmm;
3401
3402   const Double_t kOpticalFibersSect      =    8.696*fgkmm;//!!!ESTIMATED!!!
3403   const Double_t kLowVoltageCableSectCu  =    7.675*fgkmm;// Computed
3404   const Double_t kLowVoltageCableHighPUR =    1.000*fgkmm;// Computed
3405   const Double_t kHiVoltageCableSectCu   =    1.535*fgkmm;// Computed
3406   const Double_t kHiVoltageCableHighPUR  =    0.500*fgkmm;// Computed
3407   const Double_t kCoaxCableSectCu        =    6.024*fgkmm;// Computed
3408   const Double_t kCoaxCableHighMeg       =    5.695*fgkmm;// Computed
3409
3410   const Double_t kTrayCCablesRot         =   75.000*fgkDegree;// Computed
3411   const Double_t kTrayCCablesZLenOut     =  227.000*fgkmm;// Computed
3412
3413
3414   // Local variables
3415   Double_t xprof[kForwardSideNpoints], yprof[kForwardSideNpoints];
3416   Double_t xloc, yloc, zloc, alpharot;
3417
3418
3419   // The two tray components as assemblies
3420   TGeoVolumeAssembly *cableTrayAForw =
3421     new TGeoVolumeAssembly("ITSsupportSPDTrayAForwRear");
3422   TGeoVolumeAssembly *cableTrayAExt =
3423     new TGeoVolumeAssembly("ITSsupportSPDTrayAExt");
3424   
3425
3426   // First create all needed shapes
3427
3428   // The lower face of the forward tray: a BBox
3429   TGeoBBox *forwTrayLowerFace = new TGeoBBox(kForwardTrayWide/2,
3430                                              kForwardTrayThick/2,
3431                                              kForwardTrayTotalLen/2);
3432
3433   // The side face of the forward tray: a Xtru
3434   TGeoXtru *forwTraySideFace = new TGeoXtru(2);
3435   forwTraySideFace->SetName("ITSsuppSPDForwTraySide");
3436
3437   xprof[0] = 0;
3438   yprof[0] = kForwardTrayThick;
3439   xprof[1] = kForwardTrayTotalLen;
3440   yprof[1] = yprof[0];
3441   xprof[2] = xprof[1];
3442   yprof[2] = kForwardTraySecondHigh - kForwardTrayThick;
3443   xprof[3] = kForwardTrayFirstLen;
3444   yprof[3] = yprof[2];
3445   xprof[4] = xprof[3];
3446   yprof[4] = kForwardTrayFirstHigh - kForwardTrayThick;
3447   xprof[5] = xprof[0];
3448   yprof[5] = yprof[4];
3449
3450   forwTraySideFace->DefinePolygon(6, xprof, yprof);
3451   forwTraySideFace->DefineSection(0, 0);
3452   forwTraySideFace->DefineSection(1, kForwardTrayThick);
3453
3454   // The covers of the forward tray: two BBox's
3455   TGeoBBox *forwTrayShortCover = new TGeoBBox(kForwardTrayWide/2,
3456                                               kForwardTrayThick/2,
3457                                               kForwardTrayFirstLen/2);
3458
3459   TGeoBBox *forwTrayLongCover = new TGeoBBox(kForwardTrayWide/2,
3460                                              kForwardTrayThick/2,
3461                              (kForwardTrayTotalLen - kForwardTrayFirstLen)/2);
3462
3463   // Each small wing of the forward tray: a BBox
3464   TGeoBBox *forwTrayWing = new TGeoBBox(kForwardTrayWingWide/2,
3465                              (kForwardTrayFirstHigh-kForwardTraySecondHigh)/2,
3466                                         kForwardTrayThick/2);
3467
3468   // The internal plane of the forward tray: a BBox
3469   TGeoBBox *forwTrayPlane = new TGeoBBox(kForwardTrayWide/2-kForwardTrayThick,
3470                                          kForwardTrayThick/2,
3471                                          kForwardTrayTotalLen/2);
3472
3473   // The internal wall of the forward tray: a BBox
3474   TGeoBBox *forwTrayWall = new TGeoBBox(kForwardTrayThick/2,
3475                                  (kForwardTrayInterSpace-kForwardTrayThick)/2,
3476                                         kForwardTrayTotalLen/2);
3477
3478   // Each horizontal face of the external tray: a BBox
3479   TGeoBBox *extTrayHorFace = new TGeoBBox(kExternalTrayWide/2-kExternalTrayThick,
3480                                           kExternalTrayThick/2,
3481                                           kExternalTrayLen/2);
3482
3483   // Each vertical face of the external tray: a BBox
3484   TGeoBBox *extTrayVerFace = new TGeoBBox(kExternalTrayThick/2,
3485                                           kExternalTrayHigh/2,
3486                                           kExternalTrayLen/2);
3487
3488   // The internal wall of the external tray: a BBox
3489   TGeoBBox *extTrayWall = new TGeoBBox(kExternalTrayThick/2,
3490                                  (kForwardTrayInterSpace-kExternalTrayThick)/2,
3491                                        kExternalTrayLen/2);
3492
3493   // The cooling tube inside the forward tray: a Tube
3494   Double_t zelong = (kForwardTraySecondHigh - 2*kForwardTrayThick
3495                 - 2*forwTrayWall->GetDY() - kCoolingTubeRmax)*SinD(kTrayAZRot);
3496   Double_t zlen = (zelong + kForwardTrayTotalLen)/2;
3497   TGeoTube *coolTubeForw = new TGeoTube(0, kCoolingTubeRmax, zlen);
3498
3499   // The freon inside the forward tray tubes: a Tube
3500   TGeoTube *freonTubeForw = new TGeoTube(0, kCoolingTubeRmin, zlen);
3501
3502   // The cooling tube inside the external tray: a Ctub
3503   TGeoCtub *coolTubeExt = new TGeoCtub(0, kCoolingTubeRmax,
3504                                        kExternalTrayLen/2, 0, 360,
3505                                        0, SinD(kTrayAZRot),-CosD(kTrayAZRot),
3506                                        0,                0,               1);
3507
3508   // The freon inside the forward tray tubes: a Tube
3509   TGeoCtub *freonTubeExt = new TGeoCtub(0, kCoolingTubeRmin,
3510                                         kExternalTrayLen/2, 0, 360,
3511                                         0, SinD(kTrayAZRot),-CosD(kTrayAZRot),
3512                                         0,                0,               1);
3513
3514   // The optical fibers inside the forward tray: a Xtru
3515   TGeoXtru *optFibsForw = new TGeoXtru(2);
3516
3517   xprof[0] = -kTrayCCablesZLenOut;
3518   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
3519   xprof[1] = 0;
3520   yprof[1] = 0;
3521   xprof[2] = kForwardTrayTotalLen;
3522   yprof[2] = yprof[1];
3523   xprof[3] = xprof[2];
3524   yprof[3] = yprof[2] + kOpticalFibersSect;
3525   xprof[4] = xprof[1];
3526   yprof[4] = yprof[3];
3527   xprof[5] = xprof[0];
3528   yprof[5] = yprof[0] + kOpticalFibersSect;
3529
3530   optFibsForw->DefinePolygon(6, xprof, yprof);
3531   optFibsForw->DefineSection(0,-kOpticalFibersSect/2);
3532   optFibsForw->DefineSection(1, kOpticalFibersSect/2);
3533
3534   // The optical fibers inside the external tray: a Xtru
3535   TGeoXtru *optFibsExt = new TGeoXtru(2);
3536   optFibsExt->SetName("ITSsuppSPDExtTrayOptFibs");
3537
3538   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
3539            + 2*forwTrayWall->GetDY();
3540   xprof[0] = yprof[0]*TanD(kTrayAZRot);
3541   xprof[1] = kExternalTrayLen;
3542   yprof[1] = yprof[0];
3543   xprof[2] = xprof[1];
3544   yprof[2] = yprof[1] + kOpticalFibersSect;
3545   yprof[3] = yprof[2];
3546   xprof[3] = yprof[2]*TanD(kTrayAZRot);
3547
3548   optFibsExt->DefinePolygon(4, xprof, yprof);
3549   optFibsExt->DefineSection(0, 0);
3550   optFibsExt->DefineSection(1, kOpticalFibersSect);
3551
3552   // The Low Voltage cables inside the forward tray: two Xtru
3553   TGeoXtru *lowCablesForwCu = new TGeoXtru(2);
3554
3555   xprof[0] = -kTrayCCablesZLenOut;
3556   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
3557   xprof[1] = 0;
3558   yprof[1] = 0;
3559   xprof[2] = kForwardTrayTotalLen;
3560   yprof[2] = yprof[1];
3561   xprof[3] = xprof[2];
3562   yprof[3] = yprof[2] + kLowVoltageCableSectCu/2;
3563   xprof[4] = xprof[1];
3564   yprof[4] = yprof[3];
3565   xprof[5] = xprof[0];
3566   yprof[5] = yprof[0] + kLowVoltageCableSectCu/2;
3567
3568   lowCablesForwCu->DefinePolygon(6, xprof, yprof);
3569   lowCablesForwCu->DefineSection(0,-kLowVoltageCableSectCu);
3570   lowCablesForwCu->DefineSection(1, kLowVoltageCableSectCu);
3571
3572   TGeoXtru *lowCablesForwPUR = new TGeoXtru(2);
3573
3574   xprof[0] = lowCablesForwCu->GetX(5);
3575   yprof[0] = lowCablesForwCu->GetY(5);
3576   xprof[1] = lowCablesForwCu->GetX(4);
3577   yprof[1] = lowCablesForwCu->GetY(4);
3578   xprof[2] = lowCablesForwCu->GetX(3);
3579   yprof[2] = lowCablesForwCu->GetY(3);
3580   xprof[3] = xprof[2];
3581   yprof[3] = yprof[2] + kLowVoltageCableHighPUR/2;
3582   xprof[4] = xprof[1];
3583   yprof[4] = yprof[3];
3584   xprof[5] = xprof[0];
3585   yprof[5] = yprof[0] + kLowVoltageCableHighPUR/2;
3586
3587   lowCablesForwPUR->DefinePolygon(6, xprof, yprof);
3588   lowCablesForwPUR->DefineSection(0,-kLowVoltageCableSectCu);
3589   lowCablesForwPUR->DefineSection(1, kLowVoltageCableSectCu);
3590
3591   // The Low Voltage inside the external tray: two Xtru
3592   TGeoXtru *lowCablesExtCu = new TGeoXtru(2);
3593   lowCablesExtCu->SetName("ITSsuppSPDExtTrayLowVoltageCu");
3594
3595   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
3596            + 2*forwTrayWall->GetDY();
3597   xprof[0] = yprof[0]*TanD(kTrayAZRot);
3598   xprof[1] = kExternalTrayLen;
3599   yprof[1] = yprof[0];
3600   xprof[2] = xprof[1];
3601   yprof[2] = yprof[1] + kLowVoltageCableSectCu/2;
3602   yprof[3] = yprof[2];
3603   xprof[3] = yprof[2]*TanD(kTrayAZRot);
3604
3605   lowCablesExtCu->DefinePolygon(4, xprof, yprof);
3606   lowCablesExtCu->DefineSection(0, 0);
3607   lowCablesExtCu->DefineSection(1, kLowVoltageCableSectCu*2);
3608
3609   TGeoXtru *lowCablesExtPUR = new TGeoXtru(2);
3610   lowCablesExtPUR->SetName("ITSsuppSPDExtTrayLowVoltagePUR");
3611
3612   xprof[0] = lowCablesExtCu->GetX(3);
3613   yprof[0] = lowCablesExtCu->GetY(3);
3614   xprof[1] = lowCablesExtCu->GetX(2);
3615   yprof[1] = lowCablesExtCu->GetY(2);
3616   xprof[2] = xprof[1];
3617   yprof[2] = yprof[1] + kLowVoltageCableHighPUR/2;
3618   yprof[3] = yprof[2];
3619   xprof[3] = yprof[2]*TanD(kTrayAZRot);
3620
3621   lowCablesExtPUR->DefinePolygon(4, xprof, yprof);
3622   lowCablesExtPUR->DefineSection(0, 0);
3623   lowCablesExtPUR->DefineSection(1, kLowVoltageCableSectCu*2);
3624
3625   // The High Voltage cables inside the forward tray: two Xtru
3626   TGeoXtru *hiCablesForwCu = new TGeoXtru(2);
3627
3628   xprof[0] = -kTrayCCablesZLenOut;
3629   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
3630   xprof[1] = 0;
3631   yprof[1] = 0;
3632   xprof[2] = kForwardTrayTotalLen;
3633   yprof[2] = yprof[1];
3634   xprof[3] = xprof[2];
3635   yprof[3] = yprof[2] + kHiVoltageCableSectCu/2;
3636   xprof[4] = xprof[1];
3637   yprof[4] = yprof[3];
3638   xprof[5] = xprof[0];
3639   yprof[5] = yprof[0] + kHiVoltageCableSectCu/2;
3640
3641   hiCablesForwCu->DefinePolygon(6, xprof, yprof);
3642   hiCablesForwCu->DefineSection(0,-kHiVoltageCableSectCu);
3643   hiCablesForwCu->DefineSection(1, kHiVoltageCableSectCu);
3644
3645   TGeoXtru *hiCablesForwPUR = new TGeoXtru(2);
3646
3647   xprof[0] = hiCablesForwCu->GetX(5);
3648   yprof[0] = hiCablesForwCu->GetY(5);
3649   xprof[1] = hiCablesForwCu->GetX(4);
3650   yprof[1] = hiCablesForwCu->GetY(4);
3651   xprof[2] = hiCablesForwCu->GetX(3);
3652   yprof[2] = hiCablesForwCu->GetY(3);
3653   xprof[3] = xprof[2];
3654   yprof[3] = yprof[2] + kHiVoltageCableHighPUR/2;
3655   xprof[4] = xprof[1];
3656   yprof[4] = yprof[3];
3657   xprof[5] = xprof[0];
3658   yprof[5] = yprof[0] + kHiVoltageCableHighPUR/2;
3659
3660   hiCablesForwPUR->DefinePolygon(6, xprof, yprof);
3661   hiCablesForwPUR->DefineSection(0,-kHiVoltageCableSectCu);
3662   hiCablesForwPUR->DefineSection(1, kHiVoltageCableSectCu);
3663
3664   // The High Voltage inside the external tray: two Xtru
3665   TGeoXtru *hiCablesExtCu = new TGeoXtru(2);
3666   hiCablesExtCu->SetName("ITSsuppSPDExtTrayHiVoltageCu");
3667
3668   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
3669            + 2*forwTrayWall->GetDY();
3670   xprof[0] = yprof[0]*TanD(kTrayAZRot);
3671   xprof[1] = kExternalTrayLen;
3672   yprof[1] = yprof[0];
3673   xprof[2] = xprof[1];
3674   yprof[2] = yprof[1] + kHiVoltageCableSectCu/2;
3675   yprof[3] = yprof[2];
3676   xprof[3] = yprof[2]*TanD(kTrayAZRot);
3677
3678   hiCablesExtCu->DefinePolygon(4, xprof, yprof);
3679   hiCablesExtCu->DefineSection(0, 0);
3680   hiCablesExtCu->DefineSection(1, kHiVoltageCableSectCu*2);
3681
3682   TGeoXtru *hiCablesExtPUR = new TGeoXtru(2);
3683   hiCablesExtPUR->SetName("ITSsuppSPDExtTrayHiVoltagePUR");
3684
3685   xprof[0] = hiCablesExtCu->GetX(3);
3686   yprof[0] = hiCablesExtCu->GetY(3);
3687   xprof[1] = hiCablesExtCu->GetX(2);
3688   yprof[1] = hiCablesExtCu->GetY(2);
3689   xprof[2] = xprof[1];
3690   yprof[2] = yprof[1] + kHiVoltageCableHighPUR/2;
3691   yprof[3] = yprof[2];
3692   xprof[3] = yprof[2]*TanD(kTrayAZRot);
3693
3694   hiCablesExtPUR->DefinePolygon(4, xprof, yprof);
3695   hiCablesExtPUR->DefineSection(0, 0);
3696   hiCablesExtPUR->DefineSection(1, kHiVoltageCableSectCu*2);
3697
3698   // The Coaxial cables inside the forward tray: two Xtru
3699   TGeoXtru *coaxCablesForwCu = new TGeoXtru(2);
3700   coaxCablesForwCu->SetName("ITSsuppSPDForwTrayCoaxCu");
3701
3702   xprof[0] = -kTrayCCablesZLenOut;
3703   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
3704   xprof[1] = 0;
3705   yprof[1] = 0;
3706   xprof[2] = kForwardTrayTotalLen;
3707   yprof[2] = yprof[1];
3708   xprof[3] = xprof[2];
3709   yprof[3] = yprof[2] + kCoaxCableSectCu/2;
3710   xprof[4] = xprof[1];
3711   yprof[4] = yprof[3];
3712   xprof[5] = xprof[0];
3713   yprof[5] = yprof[0] + kCoaxCableSectCu/2;
3714
3715   coaxCablesForwCu->DefinePolygon(6, xprof, yprof);
3716   coaxCablesForwCu->DefineSection(0,-kCoaxCableSectCu);
3717   coaxCablesForwCu->DefineSection(1, kCoaxCableSectCu);
3718
3719   TGeoXtru *coaxCablesForwMeg = new TGeoXtru(2);
3720   coaxCablesForwMeg->SetName("ITSsuppSPDForwTrayCoaxMeg");
3721
3722   xprof[0] = coaxCablesForwCu->GetX(5);
3723   yprof[0] = coaxCablesForwCu->GetY(5);
3724   xprof[1] = coaxCablesForwCu->GetX(4);
3725   yprof[1] = coaxCablesForwCu->GetY(4);
3726   xprof[2] = coaxCablesForwCu->GetX(3);
3727   yprof[2] = coaxCablesForwCu->GetY(3);
3728   xprof[3] = xprof[2];
3729   yprof[3] = yprof[2] + kCoaxCableHighMeg/2;
3730   xprof[4] = xprof[1];
3731   yprof[4] = yprof[3];
3732   xprof[5] = xprof[0];
3733   yprof[5] = yprof[0] + kCoaxCableHighMeg/2;
3734
3735   coaxCablesForwMeg->DefinePolygon(6, xprof, yprof);
3736   coaxCablesForwMeg->DefineSection(0,-kCoaxCableSectCu);
3737   coaxCablesForwMeg->DefineSection(1, kCoaxCableSectCu);
3738
3739   // The Coaxial inside the external tray: two Xtru
3740   TGeoXtru *coaxCablesExtCu = new TGeoXtru(2);
3741   coaxCablesExtCu->SetName("ITSsuppSPDExtTrayCoaxCu");
3742
3743   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
3744            + 2*forwTrayWall->GetDY();
3745   xprof[0] = yprof[0]*TanD(kTrayAZRot);
3746   xprof[1] = kExternalTrayLen;
3747   yprof[1] = yprof[0];
3748   xprof[2] = xprof[1];
3749   yprof[2] = yprof[1] + kCoaxCableSectCu/2;
3750   yprof[3] = yprof[2];
3751   xprof[3] = yprof[2]*TanD(kTrayAZRot);
3752
3753   coaxCablesExtCu->DefinePolygon(4, xprof, yprof);
3754   coaxCablesExtCu->DefineSection(0, 0);
3755   coaxCablesExtCu->DefineSection(1, kCoaxCableSectCu*2);
3756
3757   TGeoXtru *coaxCablesExtMeg = new TGeoXtru(2);
3758   coaxCablesExtMeg->SetName("ITSsuppSPDExtTrayCoaxMeg");
3759
3760   xprof[0] = coaxCablesExtCu->GetX(3);
3761   yprof[0] = coaxCablesExtCu->GetY(3);
3762   xprof[1] = coaxCablesExtCu->GetX(2);
3763   yprof[1] = coaxCablesExtCu->GetY(2);
3764   xprof[2] = xprof[1];
3765   yprof[2] = yprof[1] + kCoaxCableHighMeg/2;
3766   yprof[3] = yprof[2];
3767   xprof[3] = yprof[2]*TanD(kTrayAZRot);
3768
3769   coaxCablesExtMeg->DefinePolygon(4, xprof, yprof);
3770   coaxCablesExtMeg->DefineSection(0, 0);
3771   coaxCablesExtMeg->DefineSection(1, kCoaxCableSectCu*2);
3772
3773
3774   // We have all shapes: now create the real volumes
3775   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
3776   TGeoMedium *medIn    = mgr->GetMedium("ITS_INOX$");
3777   TGeoMedium *medFreon = mgr->GetMedium("ITS_GASEOUS FREON$");
3778   TGeoMedium *medFibs  = mgr->GetMedium("ITS_SDD OPTICFIB$");//!TO BE CHECKED!
3779   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
3780   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
3781   TGeoMedium *medMeg   = mgr->GetMedium("ITS_MEGOLON$");
3782
3783   TGeoVolume *forwTrayABase = new TGeoVolume("ITSsuppSPDSideAForwTrayABase",
3784                                             forwTrayLowerFace, medAl);
3785
3786   forwTrayABase->SetVisibility(kTRUE);
3787   forwTrayABase->SetLineColor(6); // Purple
3788   forwTrayABase->SetLineWidth(1);
3789   forwTrayABase->SetFillColor(forwTrayABase->GetLineColor());
3790   forwTrayABase->SetFillStyle(4000); // 0% transparent
3791
3792   TGeoVolume *forwTrayASide = new TGeoVolume("ITSsuppSPDSideAForwTrayASide",
3793                                             forwTraySideFace, medAl);
3794
3795   forwTrayASide->SetVisibility(kTRUE);
3796   forwTrayASide->SetLineColor(6); // Purple
3797   forwTrayASide->SetLineWidth(1);
3798   forwTrayASide->SetFillColor(forwTrayASide->GetLineColor());
3799   forwTrayASide->SetFillStyle(4000); // 0% transparent
3800
3801   TGeoVolume *forwTrayACoverShort = new TGeoVolume("ITSsuppSPDSideAForwTrayASC",
3802                                                   forwTrayShortCover, medAl);
3803
3804   forwTrayACoverShort->SetVisibility(kTRUE);
3805   forwTrayACoverShort->SetLineColor(6); // Purple
3806   forwTrayACoverShort->SetLineWidth(1);
3807   forwTrayACoverShort->SetFillColor(forwTrayACoverShort->GetLineColor());
3808   forwTrayACoverShort->SetFillStyle(4000); // 0% transparent
3809
3810   TGeoVolume *forwTrayACoverLong = new TGeoVolume("ITSsuppSPDSideAForwTrayALC",
3811                                                  forwTrayLongCover, medAl);
3812
3813   forwTrayACoverLong->SetVisibility(kTRUE);
3814   forwTrayACoverLong->SetLineColor(6); // Purple
3815   forwTrayACoverLong->SetLineWidth(1);
3816   forwTrayACoverLong->SetFillColor(forwTrayACoverLong->GetLineColor());
3817   forwTrayACoverLong->SetFillStyle(4000); // 0% transparent
3818
3819   TGeoVolume *forwTrayAWing = new TGeoVolume("ITSsuppSPDSideAForwTrayAWing",
3820                                              forwTrayWing, medAl);
3821
3822   forwTrayAWing->SetVisibility(kTRUE);
3823   forwTrayAWing->SetLineColor(6); // Purple
3824   forwTrayAWing->SetLineWidth(1);
3825   forwTrayAWing->SetFillColor(forwTrayAWing->GetLineColor());
3826   forwTrayAWing->SetFillStyle(4000); // 0% transparent
3827
3828   TGeoVolume *forwTrayAPlane = new TGeoVolume("ITSsuppSPDSideAForwTrayAPlane",
3829                                               forwTrayPlane, medAl);
3830
3831   forwTrayAPlane->SetVisibility(kTRUE);
3832   forwTrayAPlane->SetLineColor(6); // Purple
3833   forwTrayAPlane->SetLineWidth(1);
3834   forwTrayAPlane->SetFillColor(forwTrayAPlane->GetLineColor());
3835   forwTrayAPlane->SetFillStyle(4000); // 0% transparent
3836
3837   TGeoVolume *forwTrayAWall = new TGeoVolume("ITSsuppSPDSideAForwTrayAWall",
3838                                              forwTrayWall, medAl);
3839
3840   forwTrayAWall->SetVisibility(kTRUE);
3841   forwTrayAWall->SetLineColor(6); // Purple
3842   forwTrayAWall->SetLineWidth(1);
3843   forwTrayAWall->SetFillColor(forwTrayAWall->GetLineColor());
3844   forwTrayAWall->SetFillStyle(4000); // 0% transparent
3845
3846   TGeoVolume *extTrayAHorFace = new TGeoVolume("ITSsuppSPDSideAExtTrayHorFace",
3847                                                extTrayHorFace, medAl);
3848
3849   extTrayAHorFace->SetVisibility(kTRUE);
3850   extTrayAHorFace->SetLineColor(6); // Purple
3851   extTrayAHorFace->SetLineWidth(1);
3852   extTrayAHorFace->SetFillColor(extTrayAHorFace->GetLineColor());
3853   extTrayAHorFace->SetFillStyle(4000); // 0% transparent
3854
3855   TGeoVolume *extTrayAVerFace = new TGeoVolume("ITSsuppSPDSideAExtTrayVerFace",
3856                                                extTrayVerFace, medAl);
3857
3858   extTrayAVerFace->SetVisibility(kTRUE);
3859   extTrayAVerFace->SetLineColor(6); // Purple
3860   extTrayAVerFace->SetLineWidth(1);
3861   extTrayAVerFace->SetFillColor(extTrayAVerFace->GetLineColor());
3862   extTrayAVerFace->SetFillStyle(4000); // 0% transparent
3863
3864   TGeoVolume *extTrayAWall = new TGeoVolume("ITSsuppSPDSideAExtTrayWall",
3865                                             extTrayWall, medAl);
3866
3867   extTrayAWall->SetVisibility(kTRUE);
3868   extTrayAWall->SetLineColor(6); // Purple
3869   extTrayAWall->SetLineWidth(1);
3870   extTrayAWall->SetFillColor(extTrayAWall->GetLineColor());
3871   extTrayAWall->SetFillStyle(4000); // 0% transparent
3872
3873   TGeoVolume *forwCoolTube = new TGeoVolume("ITSsuppSPDSideAForwTrayCoolTube",
3874                                             coolTubeForw, medIn);
3875
3876   forwCoolTube->SetVisibility(kTRUE);
3877   forwCoolTube->SetLineColor(kGray); // as in GeometrySPD
3878   forwCoolTube->SetLineWidth(1);
3879   forwCoolTube->SetFillColor(forwCoolTube->GetLineColor());
3880   forwCoolTube->SetFillStyle(4000); // 0% transparent
3881
3882   TGeoVolume *forwCoolFreon = new TGeoVolume("ITSsuppSPDSideAForwTrayFreon",
3883                                              freonTubeForw, medFreon);
3884
3885   forwCoolFreon->SetVisibility(kTRUE);
3886   forwCoolFreon->SetLineColor(kBlue); // Blue
3887   forwCoolFreon->SetLineWidth(1);
3888   forwCoolFreon->SetFillColor(forwCoolFreon->GetLineColor());
3889   forwCoolFreon->SetFillStyle(4000); // 0% transparent
3890
3891   TGeoVolume *extCoolTube = new TGeoVolume("ITSsuppSPDSideAExtTrayCoolTube",
3892                                            coolTubeExt, medIn);
3893
3894   extCoolTube->SetVisibility(kTRUE);
3895   extCoolTube->SetLineColor(kGray); // as in GeometrySPD
3896   extCoolTube->SetLineWidth(1);
3897   extCoolTube->SetFillColor(extCoolTube->GetLineColor());
3898   extCoolTube->SetFillStyle(4000); // 0% transparent
3899
3900   TGeoVolume *extCoolFreon = new TGeoVolume("ITSsuppSPDSideAExtTrayFreon",
3901                                             freonTubeExt, medFreon);
3902
3903   extCoolFreon->SetVisibility(kTRUE);
3904   extCoolFreon->SetLineColor(kBlue); // Blue
3905   extCoolFreon->SetLineWidth(1);
3906   extCoolFreon->SetFillColor(extCoolFreon->GetLineColor());
3907   extCoolFreon->SetFillStyle(4000); // 0% transparent
3908
3909   TGeoVolume *forwOptFibs = new TGeoVolume("ITSsuppSPDSideAForwTrayOptFibs",
3910                                            optFibsForw, medFibs);
3911
3912   forwOptFibs->SetVisibility(kTRUE);
3913   forwOptFibs->SetLineColor(kOrange); // Orange
3914   forwOptFibs->SetLineWidth(1);
3915   forwOptFibs->SetFillColor(forwOptFibs->GetLineColor());
3916   forwOptFibs->SetFillStyle(4000); // 0% transparent
3917
3918   TGeoVolume *extOptFibs = new TGeoVolume("ITSsuppSPDSideAExtTrayOptFibs",
3919                                           optFibsExt, medFibs);
3920
3921   extOptFibs->SetVisibility(kTRUE);
3922   extOptFibs->SetLineColor(kOrange); // Orange
3923   extOptFibs->SetLineWidth(1);
3924   extOptFibs->SetFillColor(extOptFibs->GetLineColor());
3925   extOptFibs->SetFillStyle(4000); // 0% transparent
3926
3927   TGeoVolume *forwLowCabsCu = new TGeoVolume("ITSsuppSPDSideAForwLowCabsCu",
3928                                              lowCablesForwCu, medCu);
3929
3930   forwLowCabsCu->SetVisibility(kTRUE);
3931   forwLowCabsCu->SetLineColor(kRed); // Red
3932   forwLowCabsCu->SetLineWidth(1);
3933   forwLowCabsCu->SetFillColor(forwLowCabsCu->GetLineColor());
3934   forwLowCabsCu->SetFillStyle(4000); // 0% transparent
3935
3936   TGeoVolume *forwLowCabsPUR = new TGeoVolume("ITSsuppSPDSideAForwLowCabsPUR",
3937                                               lowCablesForwPUR, medPUR);
3938
3939   forwLowCabsPUR->SetVisibility(kTRUE);
3940   forwLowCabsPUR->SetLineColor(kBlack); // Black
3941   forwLowCabsPUR->SetLineWidth(1);
3942   forwLowCabsPUR->SetFillColor(forwLowCabsPUR->GetLineColor());
3943   forwLowCabsPUR->SetFillStyle(4000); // 0% transparent
3944
3945   TGeoVolume *extLowCabsCu = new TGeoVolume("ITSsuppSPDSideAExtLowCabsCu",
3946                                             lowCablesExtCu, medCu);
3947
3948   extLowCabsCu->SetVisibility(kTRUE);
3949   extLowCabsCu->SetLineColor(kRed); // Red
3950   extLowCabsCu->SetLineWidth(1);
3951   extLowCabsCu->SetFillColor(extLowCabsCu->GetLineColor());
3952   extLowCabsCu->SetFillStyle(4000); // 0% transparent
3953
3954   TGeoVolume *extLowCabsPUR = new TGeoVolume("ITSsuppSPDSideAExtLowCabsPUR",
3955                                              lowCablesExtPUR, medPUR);
3956
3957   extLowCabsPUR->SetVisibility(kTRUE);
3958   extLowCabsPUR->SetLineColor(kBlack); // Black
3959   extLowCabsPUR->SetLineWidth(1);
3960   extLowCabsPUR->SetFillColor(extLowCabsPUR->GetLineColor());
3961   extLowCabsPUR->SetFillStyle(4000); // 0% transparent
3962
3963   TGeoVolume *forwHiCabsCu = new TGeoVolume("ITSsuppSPDSideAForwTrayHiCabsCu",
3964                                             hiCablesForwCu, medCu);
3965
3966   forwHiCabsCu->SetVisibility(kTRUE);
3967   forwHiCabsCu->SetLineColor(kRed); // Red
3968   forwHiCabsCu->SetLineWidth(1);
3969   forwHiCabsCu->SetFillColor(forwHiCabsCu->GetLineColor());
3970   forwHiCabsCu->SetFillStyle(4000); // 0% transparent
3971
3972   TGeoVolume *forwHiCabsPUR = new TGeoVolume("ITSsuppSPDSideAForwTrayHiCabsPUR",
3973                                              hiCablesForwPUR, medPUR);
3974
3975   forwHiCabsPUR->SetVisibility(kTRUE);
3976   forwHiCabsPUR->SetLineColor(kBlack); // Black
3977   forwHiCabsPUR->SetLineWidth(1);
3978   forwHiCabsPUR->SetFillColor(forwHiCabsPUR->GetLineColor());
3979   forwHiCabsPUR->SetFillStyle(4000); // 0% transparent
3980
3981   TGeoVolume *extHiCabsCu = new TGeoVolume("ITSsuppSPDSideAExtTrayHiCabsCu",
3982                                            hiCablesExtCu, medCu);
3983
3984   extHiCabsCu->SetVisibility(kTRUE);
3985   extHiCabsCu->SetLineColor(kRed); // Red
3986   extHiCabsCu->SetLineWidth(1);
3987   extHiCabsCu->SetFillColor(extHiCabsCu->GetLineColor());
3988   extHiCabsCu->SetFillStyle(4000); // 0% transparent
3989
3990   TGeoVolume *extHiCabsPUR = new TGeoVolume("ITSsuppSPDSideAExtTrayHiCabsPUR",
3991                                             hiCablesExtPUR, medPUR);
3992
3993   extHiCabsPUR->SetVisibility(kTRUE);
3994   extHiCabsPUR->SetLineColor(kBlack); // Black
3995   extHiCabsPUR->SetLineWidth(1);
3996   extHiCabsPUR->SetFillColor(extHiCabsPUR->GetLineColor());
3997   extHiCabsPUR->SetFillStyle(4000); // 0% transparent
3998
3999   TGeoVolume *forwCoaxCu = new TGeoVolume("ITSsuppSPDSideAForwTrayCoaxCu",
4000                                           coaxCablesForwCu, medCu);
4001
4002   forwCoaxCu->SetVisibility(kTRUE);
4003   forwCoaxCu->SetLineColor(kRed); // Red
4004   forwCoaxCu->SetLineWidth(1);
4005   forwCoaxCu->SetFillColor(forwCoaxCu->GetLineColor());
4006   forwCoaxCu->SetFillStyle(4000); // 0% transparent
4007
4008   TGeoVolume *forwCoaxMeg = new TGeoVolume("ITSsuppSPDSideAForwTrayCoaxMeg",
4009                                            coaxCablesForwMeg, medMeg);
4010
4011   forwCoaxMeg->SetVisibility(kTRUE);
4012   forwCoaxMeg->SetLineColor(kBlack); // Black
4013   forwCoaxMeg->SetLineWidth(1);
4014   forwCoaxMeg->SetFillColor(forwCoaxMeg->GetLineColor());
4015   forwCoaxMeg->SetFillStyle(4000); // 0% transparent
4016
4017   TGeoVolume *extCoaxCu = new TGeoVolume("ITSsuppSPDSideAExtTrayCoaxCu",
4018                                          coaxCablesExtCu, medCu);
4019
4020   extCoaxCu->SetVisibility(kTRUE);
4021   extCoaxCu->SetLineColor(kRed); // Red
4022   extCoaxCu->SetLineWidth(1);
4023   extCoaxCu->SetFillColor(extCoaxCu->GetLineColor());
4024   extCoaxCu->SetFillStyle(4000); // 0% transparent
4025
4026   TGeoVolume *extCoaxMeg = new TGeoVolume("ITSsuppSPDSideAExtTrayCoaxMeg",
4027                                           coaxCablesExtMeg, medMeg);
4028
4029   extCoaxMeg->SetVisibility(kTRUE);
4030   extCoaxMeg->SetLineColor(kBlack); // Black
4031   extCoaxMeg->SetLineWidth(1);
4032   extCoaxMeg->SetFillColor(extCoaxMeg->GetLineColor());
4033   extCoaxMeg->SetFillStyle(4000); // 0% transparent
4034
4035
4036   // Now build up the trays
4037   yloc = forwTrayLowerFace->GetDY();
4038   zloc = forwTrayLowerFace->GetDZ();
4039   cableTrayAForw->AddNode(forwTrayABase, 1,
4040                       new TGeoTranslation(0, yloc, zloc));
4041
4042   xloc = kForwardTrayWide/2;
4043   cableTrayAForw->AddNode(forwTrayASide, 1,
4044                       new TGeoCombiTrans( xloc, 0, 0,
4045                                          new TGeoRotation("",90,-90,-90)));
4046   cableTrayAForw->AddNode(forwTrayASide, 2,
4047                       new TGeoCombiTrans(-xloc+kForwardTrayThick, 0, 0,
4048                                          new TGeoRotation("",90,-90,-90)));
4049
4050   yloc = kForwardTrayFirstHigh - forwTrayShortCover->GetDY();
4051   zloc = forwTrayShortCover->GetDZ();
4052   cableTrayAForw->AddNode(forwTrayACoverShort, 1,
4053                       new TGeoTranslation(0, yloc, zloc));
4054
4055   yloc = kForwardTraySecondHigh - forwTrayLongCover->GetDY();
4056   zloc = kForwardTrayFirstLen + forwTrayLongCover->GetDZ();
4057   cableTrayAForw->AddNode(forwTrayACoverLong, 1,
4058                       new TGeoTranslation(0, yloc, zloc));
4059
4060   xloc = kForwardTrayWide/2 - kForwardTrayThick - forwTrayWing->GetDX();
4061   yloc = kForwardTrayFirstHigh - kForwardTrayThick - forwTrayWing->GetDY();
4062   zloc = kForwardTrayFirstLen - forwTrayWing->GetDZ();
4063   cableTrayAForw->AddNode(forwTrayAWing, 1,
4064                       new TGeoTranslation( xloc, yloc, zloc));
4065   cableTrayAForw->AddNode(forwTrayAWing, 2,
4066                       new TGeoTranslation(-xloc, yloc, zloc));
4067
4068   yloc = kForwardTrayThick + kForwardTrayInterSpace - forwTrayPlane->GetDY();
4069   zloc = forwTrayPlane->GetDZ();
4070   cableTrayAForw->AddNode(forwTrayAPlane, 1,
4071                       new TGeoTranslation(0, yloc, zloc));
4072
4073   yloc = kForwardTrayThick + forwTrayWall->GetDY();
4074   zloc = forwTrayWall->GetDZ();
4075   cableTrayAForw->AddNode(forwTrayAWall, 1,
4076                       new TGeoTranslation(0, yloc, zloc));
4077
4078   forwCoolTube->AddNode(forwCoolFreon, 1, 0);
4079
4080   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY()
4081        + coolTubeForw->GetRmax();
4082   zloc = coolTubeForw->GetDz();
4083   cableTrayAForw->AddNode(forwCoolTube, 1,
4084                       new TGeoTranslation(0, yloc, zloc));
4085
4086   xloc = optFibsForw->GetZ(1) + coolTubeForw->GetRmax();
4087   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4088   cableTrayAForw->AddNode(forwOptFibs, 1,
4089                       new TGeoCombiTrans( xloc, yloc, 0,
4090                                          new TGeoRotation("",-90.,90.,90.)));
4091
4092   xloc = lowCablesForwCu->GetZ(1) + coolTubeForw->GetRmax();
4093   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4094   cableTrayAForw->AddNode(forwLowCabsCu, 1,
4095                       new TGeoCombiTrans(-xloc, yloc, 0,
4096                                          new TGeoRotation("",-90.,90.,90.)));
4097   cableTrayAForw->AddNode(forwLowCabsPUR, 1,
4098                       new TGeoCombiTrans(-xloc, yloc, 0,
4099                                          new TGeoRotation("",-90.,90.,90.)));
4100
4101   xloc = 2*lowCablesForwCu->GetZ(1) +
4102          hiCablesForwCu->GetZ(1) + coolTubeForw->GetRmax();
4103   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4104   cableTrayAForw->AddNode(forwHiCabsCu, 1,
4105                       new TGeoCombiTrans(-xloc, yloc, 0,
4106                                          new TGeoRotation("",-90.,90.,90.)));
4107   cableTrayAForw->AddNode(forwHiCabsPUR, 1,
4108                       new TGeoCombiTrans(-xloc, yloc, 0,
4109                                          new TGeoRotation("",-90.,90.,90.)));
4110
4111   xloc = 2*optFibsForw->GetZ(1) + coaxCablesForwCu->GetZ(1) +
4112          coolTubeForw->GetRmax();
4113   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4114   cableTrayAForw->AddNode(forwCoaxCu, 1,
4115                       new TGeoCombiTrans( xloc, yloc, 0,
4116                                          new TGeoRotation("",-90.,90.,90.)));
4117   cableTrayAForw->AddNode(forwCoaxMeg, 1,
4118                       new TGeoCombiTrans( xloc, yloc, 0,
4119                                          new TGeoRotation("",-90.,90.,90.)));
4120
4121   // To simplify following placement in MARS, origin is on top
4122   yloc = -kExternalTrayHigh + kExternalTrayThick/2;
4123   zloc = kExternalTrayLen/2;
4124   cableTrayAExt->AddNode(extTrayAHorFace, 1,
4125                       new TGeoTranslation( 0, yloc, zloc));
4126
4127   xloc = kExternalTrayWide/2 - kExternalTrayThick/2;
4128   yloc = -kExternalTrayHigh/2;
4129   cableTrayAExt->AddNode(extTrayAVerFace, 1,
4130                       new TGeoTranslation( xloc, yloc, zloc));
4131   cableTrayAExt->AddNode(extTrayAVerFace, 2,
4132                       new TGeoTranslation(-xloc, yloc, zloc));
4133
4134   yloc = -kExternalTrayThick/2;
4135   cableTrayAExt->AddNode(extTrayAHorFace, 2,
4136                       new TGeoTranslation( 0, yloc, zloc));
4137
4138   yloc = -kExternalTrayHigh
4139        + kExternalTrayThick + kForwardTrayInterSpace - kExternalTrayThick/2;
4140   cableTrayAExt->AddNode(extTrayAHorFace, 3,
4141                       new TGeoTranslation( 0, yloc, zloc));
4142
4143   yloc = -kExternalTrayHigh + kExternalTrayThick + extTrayWall->GetDY();
4144   cableTrayAExt->AddNode(extTrayAWall, 1,
4145                       new TGeoTranslation( 0, yloc, zloc));
4146
4147   extCoolTube->AddNode(extCoolFreon, 1, 0);
4148
4149   yloc = -kExternalTrayHigh + 2*kExternalTrayThick + 2*extTrayWall->GetDY()
4150        + coolTubeExt->GetRmax();
4151   zloc = coolTubeExt->GetDz();
4152   cableTrayAExt->AddNode(extCoolTube, 1,
4153                       new TGeoTranslation(0, yloc, zloc));
4154
4155   xloc = optFibsExt->GetZ(1) + coolTubeExt->GetRmax();
4156   cableTrayAExt->AddNode(extOptFibs, 1,
4157                       new TGeoCombiTrans( xloc, 0, 0,
4158                                          new TGeoRotation("",90,-90,-90)));
4159
4160   xloc = coolTubeExt->GetRmax();
4161   cableTrayAExt->AddNode(extLowCabsCu, 1,
4162                       new TGeoCombiTrans(-xloc, 0, 0,
4163                                          new TGeoRotation("",90,-90,-90)));
4164   cableTrayAExt->AddNode(extLowCabsPUR, 1,
4165                       new TGeoCombiTrans(-xloc, 0, 0,
4166                                          new TGeoRotation("",90,-90,-90)));
4167
4168   xloc = lowCablesExtCu->GetZ(1) + coolTubeExt->GetRmax();
4169   cableTrayAExt->AddNode(extHiCabsCu, 1,
4170                       new TGeoCombiTrans(-xloc, 0, 0,
4171                                          new TGeoRotation("",90,-90,-90)));
4172   cableTrayAExt->AddNode(extHiCabsPUR, 1,
4173                       new TGeoCombiTrans(-xloc, 0, 0,
4174                                          new TGeoRotation("",90,-90,-90)));
4175
4176   xloc = coaxCablesExtCu->GetZ(1) + optFibsExt->GetZ(1) +
4177          coolTubeExt->GetRmax();
4178   cableTrayAExt->AddNode(extCoaxCu, 1,
4179                       new TGeoCombiTrans( xloc, 0, 0,
4180                                          new TGeoRotation("",90,-90,-90)));
4181   cableTrayAExt->AddNode(extCoaxMeg, 1,
4182                       new TGeoCombiTrans( xloc, 0, 0,
4183                                          new TGeoRotation("",90,-90,-90)));
4184
4185
4186   // Finally put everything in the mother volume
4187   Double_t rExtTray = kTrayAR2Trans + kExternalTrayHigh;
4188
4189   moth->AddNode(cableTrayAForw,1,
4190                 new TGeoTranslation( 0, kTrayAR1Trans, kTrayAZTrans));
4191   moth->AddNode(cableTrayAForw,2,
4192                 new TGeoCombiTrans(  0,-kTrayAR1Trans, kTrayAZTrans,
4193                                     new TGeoRotation("",180, 0, 0)));
4194
4195   yloc = kTrayAR1Trans + kExternalTrayHigh;
4196   zloc = kTrayAZTrans + kForwardTrayTotalLen;
4197   moth->AddNode(cableTrayAExt,1,
4198                 new TGeoCombiTrans( 0, yloc, zloc,
4199                                     new TGeoRotation("",  0,-kTrayAZRot, 0)));
4200   moth->AddNode(cableTrayAExt,2,
4201                 new TGeoCombiTrans( 0,-yloc, zloc,
4202                                     new TGeoRotation("",180,-kTrayAZRot, 0)));
4203
4204   alpharot = kTrayAFirstRotAng + kTrayASecondRotAng;
4205   xloc = kTrayAR2Trans*SinD(alpharot);
4206   yloc = kTrayAR2Trans*CosD(alpharot);
4207   moth->AddNode(cableTrayAForw,3,
4208                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4209                             new TGeoRotation("",-alpharot,0,0)   )   );
4210   xloc = rExtTray*SinD(alpharot);
4211   yloc = rExtTray*CosD(alpharot);
4212   moth->AddNode(cableTrayAExt,3,
4213                             new TGeoCombiTrans( xloc, yloc, zloc,
4214                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4215
4216   alpharot += 180;
4217   xloc = kTrayAR2Trans*SinD(alpharot);
4218   yloc = kTrayAR2Trans*CosD(alpharot);
4219   moth->AddNode(cableTrayAForw,4,
4220                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4221                             new TGeoRotation("",-alpharot,0,0)   )   );
4222   xloc = rExtTray*SinD(alpharot);
4223   yloc = rExtTray*CosD(alpharot);
4224   moth->AddNode(cableTrayAExt,4,
4225                             new TGeoCombiTrans( xloc, yloc, zloc,
4226                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4227
4228   alpharot = - kTrayAFirstRotAng - kTrayASecondRotAng;
4229   xloc = kTrayAR2Trans*SinD(alpharot);
4230   yloc = kTrayAR2Trans*CosD(alpharot);
4231   moth->AddNode(cableTrayAForw,5,
4232                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4233                             new TGeoRotation("",-alpharot,0,0)   )   );
4234   xloc = rExtTray*SinD(alpharot);
4235   yloc = rExtTray*CosD(alpharot);
4236   moth->AddNode(cableTrayAExt,5,
4237                             new TGeoCombiTrans( xloc, yloc, zloc,
4238                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4239
4240   alpharot += 180;
4241   xloc = kTrayAR2Trans*SinD(alpharot);
4242   yloc = kTrayAR2Trans*CosD(alpharot);
4243   moth->AddNode(cableTrayAForw,6,
4244                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4245                             new TGeoRotation("",-alpharot,0,0)   )   );
4246   xloc = rExtTray*SinD(alpharot);
4247   yloc = rExtTray*CosD(alpharot);
4248   moth->AddNode(cableTrayAExt,6,
4249                             new TGeoCombiTrans( xloc, yloc, zloc,
4250                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4251
4252   alpharot = kTrayAFirstRotAng + 3*kTrayASecondRotAng;
4253   xloc = kTrayAR2Trans*SinD(alpharot);
4254   yloc = kTrayAR2Trans*CosD(alpharot);
4255   moth->AddNode(cableTrayAForw,7,
4256                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4257                             new TGeoRotation("",-alpharot,0,0)   )   );
4258   xloc = rExtTray*SinD(alpharot);
4259   yloc = rExtTray*CosD(alpharot);
4260   moth->AddNode(cableTrayAExt,7,
4261                             new TGeoCombiTrans( xloc, yloc, zloc,
4262                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4263
4264   alpharot += 180;
4265   xloc = kTrayAR2Trans*SinD(alpharot);
4266   yloc = kTrayAR2Trans*CosD(alpharot);
4267   moth->AddNode(cableTrayAForw,8,
4268                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4269                             new TGeoRotation("",-alpharot,0,0)   )   );
4270   xloc = rExtTray*SinD(alpharot);
4271   yloc = rExtTray*CosD(alpharot);
4272   moth->AddNode(cableTrayAExt,8,
4273                             new TGeoCombiTrans( xloc, yloc, zloc,
4274                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4275
4276   alpharot = - kTrayAFirstRotAng - 3*kTrayASecondRotAng;
4277   xloc = kTrayAR2Trans*SinD(alpharot);
4278   yloc = kTrayAR2Trans*CosD(alpharot);
4279   moth->AddNode(cableTrayAForw,9,
4280                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4281                             new TGeoRotation("",-alpharot,0,0)   )   );
4282   xloc = rExtTray*SinD(alpharot);
4283   yloc = rExtTray*CosD(alpharot);
4284   moth->AddNode(cableTrayAExt,9,
4285                             new TGeoCombiTrans( xloc, yloc, zloc,
4286                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4287
4288   alpharot += 180;
4289   xloc = kTrayAR2Trans*SinD(alpharot);
4290   yloc = kTrayAR2Trans*CosD(alpharot);
4291   moth->AddNode(cableTrayAForw,10,
4292                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4293                             new TGeoRotation("",-alpharot,0,0)   )   );
4294   xloc = rExtTray*SinD(alpharot);
4295   yloc = rExtTray*CosD(alpharot);
4296   moth->AddNode(cableTrayAExt,10,
4297                             new TGeoCombiTrans( xloc, yloc, zloc,
4298                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4299
4300
4301   return;
4302 }
4303
4304 //______________________________________________________________________
4305 void AliITSv11GeometrySupport::SPDCableTraysSideC(TGeoVolume *moth,
4306                                             const TGeoManager *mgr){
4307 //
4308 // Creates the SPD cable trays which are outside the ITS support cones
4309 // but still inside the TPC on Side C
4310 // (part of this code is taken or anyway inspired to ServicesCableSupport
4311 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
4312 //
4313 // Input:
4314 //         moth : the TGeoVolume owing the volume structure
4315 //         mgr  : the GeoManager (default gGeoManager)
4316 // Output:
4317 //
4318 // Return:
4319 //
4320 // Created:         ???       Bjorn S. Nilsen
4321 // Updated:      22 Apr 2010  Mario Sitta
4322 // Updated:      10 Jun 2010  Mario Sitta  Freon inside cooling pipes
4323 // Updated:      08 Sep 2010  Mario Sitta
4324 // Updated:      14 Sep 2010  Mario Sitta  Cables prolonged till cone
4325 // Updated:      20 Dec 2011  Mario Sitta  Composite vol to avoid new overlap
4326 //
4327 // Technical data are taken from AutoCAD drawings and other (oral)
4328 // information given by D.Elia
4329 // Optical fibers and voltage cables are approximated with mean materials
4330 // and square cross sections, but preserving the total material budget.
4331 //
4332
4333   // Dimensions and positions of the C-Side Cable Tray elements
4334   const Int_t    kNumTraysSideC       =   10;
4335
4336   const Double_t kTrayCCablesOutRot   =   75.000 *fgkDegree;// Computed
4337   const Double_t kTrayCCablesZLenOut  =  245.000 *fgkmm;// Computed
4338
4339   const Double_t kTrayCHalfWide       =    6.350 *fgkcm;
4340   const Double_t kTrayCLength1        =  172.800 *fgkcm;
4341   const Double_t kTrayCLength2        =  189.300 *fgkcm;
4342   const Double_t kTrayCFirstLen       =  435.000 *fgkmm;
4343   const Double_t kTrayCFirstHigh      =   83.000 *fgkmm;//!!!TO BE CHECKED!!!
4344   const Double_t kTrayCSecondHigh     =   52.700 *fgkmm;//!!!TO BE CHECKED!!!
4345   const Double_t kTrayCThick          =    0.200 *fgkcm;
4346   const Double_t kTrayCInterSpace     =   18.000 *fgkmm;//!!!TO BE CHECKED!!!
4347   const Double_t kTrayCFoldAngle      =    5.000 *fgkDegree;
4348
4349   const Double_t kCoolingTubeRmin     =    2.000 *fgkmm;
4350   const Double_t kCoolingTubeRmax     =    3.000 *fgkmm;
4351   const Double_t kOpticalFibersSect   =    8.696 *fgkmm;//!!!ESTIMATED!!!
4352   const Double_t kLowVoltCableSectCu  =    7.675 *fgkmm;// Computed
4353   const Double_t kLowVoltCableHighPUR =    1.000 *fgkmm;// Computed
4354   const Double_t kHiVoltCableSectCu   =    1.535 *fgkmm;// Computed
4355   const Double_t kHiVoltCableHighPUR  =    0.500 *fgkmm;// Computed
4356   const Double_t kCoaxCableSectCu     =    6.024 *fgkmm;// Computed
4357   const Double_t kCoaxCableHighMeg    =    5.695 *fgkmm;// Computed
4358
4359   const Double_t kCablesYtrans        =    2.500 *fgkmm;// Avoid ovlps
4360
4361   // Overall position and rotation of the C-Side Cable Trays
4362   const Double_t kTraySideCRPos       =   45.300 *fgkcm;
4363   const Double_t kTraySideCZPos       = -102.400 *fgkcm;
4364   const Double_t kTraySideCAlphaRot[kNumTraysSideC/2]  =
4365     {    0.0,      41.0,     -41.0,      76.0,      -76.0};
4366   // From position of the other trays
4367
4368
4369   // Local variables
4370   Double_t xprof[8], yprof[8];
4371   Double_t xloc, yloc, zloc, delta, alpharot;
4372
4373
4374   // The single C-Side Cable tray as an assembly
4375   TGeoVolumeAssembly *cableTrayC = new TGeoVolumeAssembly("ITSsupportSPDTrayC");
4376
4377   // First create all needed shapes
4378
4379   // The Cable Tray lower face: a Xtru
4380   TGeoXtru *sideCHorFace = new TGeoXtru(2);
4381   sideCHorFace->SetName("ITSsuppSPDTraySideCHor");
4382
4383   xprof[0] = 0.;
4384   yprof[0] = 0.;
4385   xprof[1] = kTrayCLength1;
4386   yprof[1] = 0.;
4387   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
4388   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
4389   xprof[3] = xprof[2] - kTrayCThick*SinD(kTrayCFoldAngle);
4390   yprof[3] = yprof[2] + kTrayCThick*CosD(kTrayCFoldAngle);
4391   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
4392               kTrayCThick , xprof[4], yprof[4]);
4393   xprof[5] = 0.;
4394   yprof[5] = kTrayCThick;
4395
4396   delta = kTrayCHalfWide - kTrayCThick;
4397
4398   sideCHorFace->DefinePolygon(6, xprof, yprof);
4399   sideCHorFace->DefineSection(0,-delta);
4400   sideCHorFace->DefineSection(1, delta);
4401
4402   // The Cable Tray middle face: a Xtru
4403   // (somehow duplicate of HorFace, but in this way avoid an overlap with Wall)
4404   TGeoXtru *sideCMidFace = new TGeoXtru(2);
4405
4406   xprof[0] = 0.;
4407   yprof[0] = kTrayCInterSpace + kTrayCThick;
4408   xprof[1] = kTrayCLength1;
4409   yprof[1] = yprof[0];
4410   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
4411   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
4412   xprof[3] = xprof[2] - kTrayCThick*SinD(kTrayCFoldAngle);
4413   yprof[3] = yprof[2] + kTrayCThick*CosD(kTrayCFoldAngle);
4414   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
4415               kTrayCThick , xprof[4], yprof[4]);
4416   xprof[5] = 0.;
4417   yprof[5] = yprof[0] + kTrayCThick;
4418
4419   delta = kTrayCHalfWide - kTrayCThick;
4420
4421   sideCMidFace->DefinePolygon(6, xprof, yprof);
4422   sideCMidFace->DefineSection(0,-delta);
4423   sideCMidFace->DefineSection(1, delta);
4424
4425   // The Cable Tray lower face: a Xtru
4426   TGeoXtru *sideCSideFace = new TGeoXtru(2);
4427
4428   xprof[0] = 0.;
4429   yprof[0] = 0.;
4430   xprof[1] = kTrayCLength1;
4431   yprof[1] = 0.;
4432   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
4433   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
4434   xprof[3] = xprof[2] - kTrayCSecondHigh*SinD(kTrayCFoldAngle);
4435   yprof[3] = yprof[2] + kTrayCSecondHigh*CosD(kTrayCFoldAngle);
4436   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
4437               kTrayCSecondHigh , xprof[4], yprof[4]);
4438   xprof[5] = kTrayCFirstLen;
4439   yprof[5] = kTrayCSecondHigh;
4440   xprof[6] = xprof[5];
4441   yprof[6] = kTrayCFirstHigh;
4442   xprof[7] = xprof[0];
4443   yprof[7] = yprof[6];
4444
4445   sideCSideFace->DefinePolygon(8, xprof, yprof);
4446   sideCSideFace->DefineSection(0, 0);
4447   sideCSideFace->DefineSection(1, kTrayCThick);
4448
4449   // The short cover: a BBox
4450   TGeoBBox *sideCShortCover = new TGeoBBox(kTrayCFirstLen/2,
4451                                            kTrayCThick/2,
4452                                            kTrayCHalfWide-kTrayCThick);
4453
4454   // The long cover: a Xtru
4455   TGeoXtru *sideCLongCover = new TGeoXtru(2);
4456
4457   xprof[5] = sideCSideFace->GetX(5);
4458   yprof[5] = sideCSideFace->GetY(5);
4459   xprof[4] = sideCSideFace->GetX(4);
4460   yprof[4] = sideCSideFace->GetY(4);
4461   xprof[3] = sideCSideFace->GetX(3);
4462   yprof[3] = sideCSideFace->GetY(3);
4463   xprof[2] = xprof[3] + kTrayCThick*SinD(kTrayCFoldAngle);
4464   yprof[2] = yprof[3] - kTrayCThick*CosD(kTrayCFoldAngle);
4465   InsidePoint(xprof[5], yprof[5], xprof[4], yprof[4], xprof[3], yprof[3],
4466              -kTrayCThick , xprof[1], yprof[1]);
4467   xprof[0] = xprof[5];
4468   yprof[0] = yprof[5] - kTrayCThick;
4469
4470   delta = kTrayCHalfWide - kTrayCThick;
4471
4472   sideCLongCover->DefinePolygon(6, xprof, yprof);
4473   sideCLongCover->DefineSection(0,-delta);
4474   sideCLongCover->DefineSection(1, delta);
4475
4476   // The internal wall: a Xtru
4477   TGeoXtru *intWall = new TGeoXtru(2);
4478   intWall->SetName("ITSsuppSPDTraySideCWall");
4479
4480   xprof[0] = sideCHorFace->GetX(5);
4481   yprof[0] = sideCHorFace->GetY(5);
4482   xprof[1] = sideCHorFace->GetX(4);
4483   yprof[1] = sideCHorFace->GetY(4);
4484   xprof[2] = sideCHorFace->GetX(3);
4485   yprof[2] = sideCHorFace->GetY(3);
4486   xprof[3] = sideCMidFace->GetX(2);
4487   yprof[3] = sideCMidFace->GetY(2);
4488   xprof[4] = sideCMidFace->GetX(1);
4489   yprof[4] = sideCMidFace->GetY(1);
4490   xprof[5] = sideCMidFace->GetX(0);
4491   yprof[5] = sideCMidFace->GetY(0);
4492
4493   intWall->DefinePolygon(6, xprof, yprof);
4494   intWall->DefineSection(0,-kTrayCThick/2);
4495   intWall->DefineSection(1, kTrayCThick/2);
4496
4497   // The horizontal part of the cooling tube inside the tray: a Tube
4498   delta = sideCMidFace->GetX(4) - sideCMidFace->GetX(5);
4499   TGeoTube *horTube = new TGeoTube(0, kCoolingTubeRmax, delta/2);
4500
4501   // The freon inside the horizontal part of the cooling tube: a Tube
4502   TGeoTube *horFreon = new TGeoTube(0, kCoolingTubeRmin, delta/2);
4503
4504   // The inclined part of the cooling tube inside the tray: a Ctub
4505   Double_t x3, y3, x4, y4;
4506   x3 = sideCMidFace->GetX(3);
4507   y3 = sideCMidFace->GetY(3);
4508   x4 = sideCMidFace->GetX(4);
4509   y4 = sideCMidFace->GetY(4);
4510   delta = TMath::Sqrt( (x4 - x3 + kCoolingTubeRmax*SinD(kTrayCFoldAngle))*
4511                        (x4 - x3 + kCoolingTubeRmax*SinD(kTrayCFoldAngle))    +
4512        (y4 + kCoolingTubeRmax - y3 - kCoolingTubeRmax*SinD(kTrayCFoldAngle))*
4513        (y4 + kCoolingTubeRmax - y3 - kCoolingTubeRmax*SinD(kTrayCFoldAngle)) );
4514
4515   TGeoCtub *incTube = new TGeoCtub(0, kCoolingTubeRmax, delta/2, 0, 360,
4516                                0, SinD(kTrayCFoldAngle),-CosD(kTrayCFoldAngle),
4517                                0,                     0,                    1);
4518
4519   // The freon inside the inclined part of the cooling tube: a Ctub
4520   TGeoCtub *incFreon = new TGeoCtub(0, kCoolingTubeRmin, delta/2, 0, 360,
4521                                0, SinD(kTrayCFoldAngle),-CosD(kTrayCFoldAngle),
4522                                0,                     0,                    1);
4523
4524   // The part of the cooling tube outside the tray: a Ctub
4525   TGeoCtub *outTube = new TGeoCtub(0, kCoolingTubeRmax,
4526                         0.5*kTrayCCablesZLenOut/SinD(kTrayCCablesOutRot),
4527                         0, 360,
4528                         0,                        0,                      -1,
4529                         0,-SinD(kTrayCCablesOutRot), CosD(kTrayCCablesOutRot));
4530
4531   // The freon inside the part of the cooling tube outside the tray: a Ctub
4532   TGeoCtub *outFreon = new TGeoCtub(0, kCoolingTubeRmin,
4533                         outTube->GetDz(),
4534                         0, 360,
4535                         0,                        0,                      -1,
4536                         0,-SinD(kTrayCCablesOutRot), CosD(kTrayCCablesOutRot));
4537
4538   // The optical fibers inside the tray: a Xtru
4539   TGeoXtru *optFibs = new TGeoXtru(2);
4540
4541   xprof[0] = -kTrayCCablesZLenOut;
4542   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
4543   xprof[1] = sideCMidFace->GetX(5);
4544   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
4545   xprof[2] = sideCMidFace->GetX(4);
4546   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
4547   xprof[3] = sideCMidFace->GetX(3);
4548   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
4549   xprof[4] = xprof[3] - kOpticalFibersSect*SinD(kTrayCFoldAngle);
4550   yprof[4] = yprof[3] + kOpticalFibersSect*CosD(kTrayCFoldAngle);
4551   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
4552               kOpticalFibersSect , xprof[5], yprof[5]);
4553   xprof[6] = 0.;
4554   yprof[6] = yprof[1] + kOpticalFibersSect;
4555   xprof[7] = xprof[0];
4556   yprof[7] = yprof[0] + kOpticalFibersSect;
4557
4558   optFibs->DefinePolygon(8, xprof, yprof);
4559   optFibs->DefineSection(0, 0);
4560   optFibs->DefineSection(1, kOpticalFibersSect);
4561
4562   // The low voltage cables inside the tray: two Xtru
4563   TGeoXtru *lowCablesCu = new TGeoXtru(2);
4564
4565   xprof[0] = -kTrayCCablesZLenOut;
4566   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
4567   xprof[1] = sideCMidFace->GetX(5);
4568   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
4569   xprof[2] = sideCMidFace->GetX(4);
4570   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
4571   xprof[3] = sideCMidFace->GetX(3);
4572   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
4573   xprof[4] = xprof[3] - kLowVoltCableSectCu*SinD(kTrayCFoldAngle);
4574   yprof[4] = yprof[3] + kLowVoltCableSectCu*CosD(kTrayCFoldAngle);
4575   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
4576               kLowVoltCableSectCu , xprof[5], yprof[5]);
4577   xprof[6] = 0.;
4578   yprof[6] = yprof[1] + kLowVoltCableSectCu;
4579   xprof[7] = xprof[0];
4580   yprof[7] = yprof[0] + kLowVoltCableSectCu;
4581
4582   lowCablesCu->DefinePolygon(8, xprof, yprof);
4583   lowCablesCu->DefineSection(0, 0);
4584   lowCablesCu->DefineSection(1, kLowVoltCableSectCu);
4585
4586   TGeoXtru *lowCablesPUR = new TGeoXtru(2);
4587
4588   xprof[0] = lowCablesCu->GetX(7);
4589   yprof[0] = lowCablesCu->GetY(7);
4590   xprof[1] = lowCablesCu->GetX(6);
4591   yprof[1] = lowCablesCu->GetY(6);
4592   xprof[2] = lowCablesCu->GetX(5);
4593   yprof[2] = lowCablesCu->GetY(5);
4594   xprof[3] = lowCablesCu->GetX(4);
4595   yprof[3] = lowCablesCu->GetY(4);
4596   xprof[4] = xprof[3] - kLowVoltCableHighPUR*SinD(kTrayCFoldAngle);
4597   yprof[4] = yprof[3] + kLowVoltCableHighPUR*CosD(kTrayCFoldAngle);
4598   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
4599               kLowVoltCableHighPUR , xprof[5], yprof[5]);
4600   xprof[6] = 0.;
4601   yprof[6] = yprof[1] + kLowVoltCableHighPUR;
4602   xprof[7] = xprof[0];
4603   yprof[7] = yprof[0] + kLowVoltCableHighPUR;
4604
4605   lowCablesPUR->DefinePolygon(8, xprof, yprof);
4606   lowCablesPUR->DefineSection(0, 0);
4607   lowCablesPUR->DefineSection(1, kLowVoltCableSectCu);
4608
4609   // The high voltage cables inside the tray: two Xtru
4610   TGeoXtru *hiCablesCu = new TGeoXtru(2);
4611
4612   xprof[0] = -kTrayCCablesZLenOut;
4613   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
4614   xprof[1] = sideCMidFace->GetX(5);
4615   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
4616   xprof[2] = sideCMidFace->GetX(4);
4617   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
4618   xprof[3] = sideCMidFace->GetX(3);
4619   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
4620   xprof[4] = xprof[3] - kHiVoltCableSectCu*SinD(kTrayCFoldAngle);
4621   yprof[4] = yprof[3] + kHiVoltCableSectCu*CosD(kTrayCFoldAngle);
4622   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
4623               kHiVoltCableSectCu , xprof[5], yprof[5]);
4624   xprof[6] = 0.;
4625   yprof[6] = yprof[1] + kHiVoltCableSectCu;
4626   xprof[7] = xprof[0];
4627   yprof[7] = yprof[0] + kHiVoltCableSectCu;
4628
4629   hiCablesCu->DefinePolygon(8, xprof, yprof);
4630   hiCablesCu->DefineSection(0, 0);
4631   hiCablesCu->DefineSection(1, kHiVoltCableSectCu);
4632
4633   TGeoXtru *hiCablesPUR = new TGeoXtru(2);
4634
4635   xprof[0] = hiCablesCu->GetX(7);
4636   yprof[0] = hiCablesCu->GetY(7);
4637   xprof[1] = hiCablesCu->GetX(6);
4638   yprof[1] = hiCablesCu->GetY(6);
4639   xprof[2] = hiCablesCu->GetX(5);
4640   yprof[2] = hiCablesCu->GetY(5);
4641   xprof[3] = hiCablesCu->GetX(4);
4642   yprof[3] = hiCablesCu->GetY(4);
4643   xprof[4] = xprof[3] - kHiVoltCableHighPUR*SinD(kTrayCFoldAngle);
4644   yprof[4] = yprof[3] + kHiVoltCableHighPUR*CosD(kTrayCFoldAngle);
4645   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
4646               kHiVoltCableHighPUR , xprof[5], yprof[5]);
4647   xprof[6] = 0.;
4648   yprof[6] = yprof[1] + kHiVoltCableHighPUR;
4649   xprof[7] = xprof[0];
4650   yprof[7] = yprof[0] + kHiVoltCableHighPUR;
4651
4652   hiCablesPUR->DefinePolygon(8, xprof, yprof);
4653   hiCablesPUR->DefineSection(0, 0);
4654   hiCablesPUR->DefineSection(1, kHiVoltCableSectCu);
4655
4656   // The coaxial cables inside the tray: two Xtru
4657   TGeoXtru *coaxCablesCu = new TGeoXtru(2);
4658
4659   xprof[0] = -kTrayCCablesZLenOut;
4660   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
4661   xprof[1] = sideCMidFace->GetX(5);
4662   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
4663   xprof[2] = sideCMidFace->GetX(4);
4664   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
4665   xprof[3] = sideCMidFace->GetX(3);
4666   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
4667   xprof[4] = xprof[3] - kCoaxCableSectCu*SinD(kTrayCFoldAngle);
4668   yprof[4] = yprof[3] + kCoaxCableSectCu*CosD(kTrayCFoldAngle);
4669   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
4670               kCoaxCableSectCu , xprof[5], yprof[5]);
4671   xprof[6] = 0.;
4672   yprof[6] = yprof[1] + kCoaxCableSectCu;
4673   xprof[7] = xprof[0];
4674   yprof[7] = yprof[0] + kCoaxCableSectCu;
4675
4676   coaxCablesCu->DefinePolygon(8, xprof, yprof);
4677   coaxCablesCu->DefineSection(0, 0);
4678   coaxCablesCu->DefineSection(1, kCoaxCableSectCu);
4679
4680   TGeoXtru *coaxCablesMeg = new TGeoXtru(2);
4681
4682   xprof[0] = coaxCablesCu->GetX(7);
4683   yprof[0] = coaxCablesCu->GetY(7);
4684   xprof[1] = coaxCablesCu->GetX(6);
4685   yprof[1] = coaxCablesCu->GetY(6);
4686   xprof[2] = coaxCablesCu->GetX(5);
4687   yprof[2] = coaxCablesCu->GetY(5);
4688   xprof[3] = coaxCablesCu->GetX(4);
4689   yprof[3] = coaxCablesCu->GetY(4);
4690   xprof[4] = xprof[3] - kCoaxCableHighMeg*SinD(kTrayCFoldAngle);
4691   yprof[4] = yprof[3] + kCoaxCableHighMeg*CosD(kTrayCFoldAngle);
4692   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
4693               kCoaxCableHighMeg , xprof[5], yprof[5]);
4694   xprof[6] = 0.;
4695   yprof[6] = yprof[1] + kCoaxCableHighMeg;
4696   xprof[7] = xprof[0];
4697   yprof[7] = yprof[0] + kCoaxCableHighMeg;
4698
4699   coaxCablesMeg->DefinePolygon(8, xprof, yprof);
4700   coaxCablesMeg->DefineSection(0, 0);
4701   coaxCablesMeg->DefineSection(1, kCoaxCableSectCu);
4702
4703   // To avoid a newly discovered overlap,
4704   // transform the two overlapping volumes into a Composite Shape
4705   TGeoCompositeShape *trayIntern =
4706     new TGeoCompositeShape("ITSSPDInternalTrayC",
4707                            "ITSsuppSPDTraySideCHor+ITSsuppSPDTraySideCWall");
4708
4709   // We have all shapes: now create the real volumes
4710   TGeoMedium *medAl   = mgr->GetMedium("ITS_ALUMINUM$");
4711   TGeoMedium *medIn   = mgr->GetMedium("ITS_INOX$");
4712   TGeoMedium *medFr   = mgr->GetMedium("ITS_Freon$");
4713   TGeoMedium *medFibs = mgr->GetMedium("ITS_SDD OPTICFIB$");//!!TO BE CHECKED!!
4714   TGeoMedium *medCu   = mgr->GetMedium("ITS_COPPER$");
4715   TGeoMedium *medPUR  = mgr->GetMedium("ITS_POLYURETHANE$");
4716   TGeoMedium *medMeg  = mgr->GetMedium("ITS_MEGOLON$");
4717
4718   TGeoVolume *traySideCIntern  = new TGeoVolume("ITSsuppSPDTraySideCInternal",
4719                                                 trayIntern, medAl);
4720
4721   traySideCIntern->SetVisibility(kTRUE);
4722   traySideCIntern->SetLineColor(6); // Purple
4723   traySideCIntern->SetLineWidth(1);
4724   traySideCIntern->SetFillColor(traySideCIntern->GetLineColor());
4725   traySideCIntern->SetFillStyle(4000); // 0% transparent
4726
4727   TGeoVolume *traySideCMidFace  = new TGeoVolume("ITSsuppSPDTraySideCMid",
4728                                                  sideCMidFace, medAl);
4729
4730   traySideCMidFace->SetVisibility(kTRUE);
4731   traySideCMidFace->SetLineColor(6); // Purple
4732   traySideCMidFace->SetLineWidth(1);
4733   traySideCMidFace->SetFillColor(traySideCMidFace->GetLineColor());
4734   traySideCMidFace->SetFillStyle(4000); // 0% transparent
4735
4736   TGeoVolume *traySideCSideFace  = new TGeoVolume("ITSsuppSPDTraySideCSide",
4737                                                   sideCSideFace, medAl);
4738
4739   traySideCSideFace->SetVisibility(kTRUE);
4740   traySideCSideFace->SetLineColor(6); // Purple
4741   traySideCSideFace->SetLineWidth(1);
4742   traySideCSideFace->SetFillColor(traySideCSideFace->GetLineColor());
4743   traySideCSideFace->SetFillStyle(4000); // 0% transparent
4744
4745   TGeoVolume *traySideCShortCover  = new TGeoVolume("ITSsuppSPDTraySideCShCov",
4746                                                     sideCShortCover, medAl);
4747
4748   traySideCShortCover->SetVisibility(kTRUE);
4749   traySideCShortCover->SetLineColor(6); // Purple
4750   traySideCShortCover->SetLineWidth(1);
4751   traySideCShortCover->SetFillColor(traySideCShortCover->GetLineColor());
4752   traySideCShortCover->SetFillStyle(4000); // 0% transparent
4753
4754   TGeoVolume *traySideCLongCover  = new TGeoVolume("ITSsuppSPDTraySideCLnCov",
4755                                                    sideCLongCover, medAl);
4756
4757   traySideCLongCover->SetVisibility(kTRUE);
4758   traySideCLongCover->SetLineColor(6); // Purple
4759   traySideCLongCover->SetLineWidth(1);
4760   traySideCLongCover->SetFillColor(traySideCLongCover->GetLineColor());
4761   traySideCLongCover->SetFillStyle(4000); // 0% transparent
4762
4763   TGeoVolume *traySideCHorTube = new TGeoVolume("ITSsuppSPDTraySideCHorTube",
4764                                                 horTube, medIn);
4765
4766   traySideCHorTube->SetVisibility(kTRUE);
4767   traySideCHorTube->SetLineColor(kGray); // as in GeometrySPD
4768   traySideCHorTube->SetLineWidth(1);
4769   traySideCHorTube->SetFillColor(traySideCHorTube->GetLineColor());
4770   traySideCHorTube->SetFillStyle(4000); // 0% transparent
4771
4772   TGeoVolume *traySideCHorFreon = new TGeoVolume("ITSsuppSPDTraySideCHorFreon",
4773                                                  horFreon, medFr);
4774
4775   traySideCHorFreon->SetVisibility(kTRUE);
4776   traySideCHorFreon->SetLineColor(kBlue); // Blue
4777   traySideCHorFreon->SetLineWidth(1);
4778   traySideCHorFreon->SetFillColor(traySideCHorFreon->GetLineColor());
4779   traySideCHorFreon->SetFillStyle(4000); // 0% transparent
4780
4781   TGeoVolume *traySideCIncTube = new TGeoVolume("ITSsuppSPDTraySideCIncTube",
4782                                                 incTube, medIn);
4783
4784   traySideCIncTube->SetVisibility(kTRUE);
4785   traySideCIncTube->SetLineColor(kGray); // as in GeometrySPD
4786   traySideCIncTube->SetLineWidth(1);
4787   traySideCIncTube->SetFillColor(traySideCIncTube->GetLineColor());
4788   traySideCIncTube->SetFillStyle(4000); // 0% transparent
4789
4790   TGeoVolume *traySideCIncFreon = new TGeoVolume("ITSsuppSPDTraySideCIncFreon",
4791                                                  incFreon, medFr);
4792
4793   traySideCIncFreon->SetVisibility(kTRUE);
4794   traySideCIncFreon->SetLineColor(kBlue); // Blue
4795   traySideCIncFreon->SetLineWidth(1);
4796   traySideCIncFreon->SetFillColor(traySideCIncFreon->GetLineColor());
4797   traySideCIncFreon->SetFillStyle(4000); // 0% transparent
4798
4799   TGeoVolume *traySideCOutTube = new TGeoVolume("ITSsuppSPDTraySideCOutTube",
4800                                                 outTube, medIn);
4801
4802   traySideCOutTube->SetVisibility(kTRUE);
4803   traySideCOutTube->SetLineColor(kGray); // as in GeometrySPD
4804   traySideCOutTube->SetLineWidth(1);
4805   traySideCOutTube->SetFillColor(traySideCOutTube->GetLineColor());
4806   traySideCOutTube->SetFillStyle(4000); // 0% transparent
4807
4808   TGeoVolume *traySideCOutFreon = new TGeoVolume("ITSsuppSPDTraySideCOutFreon",
4809                                                  outFreon, medFr);
4810
4811   traySideCOutFreon->SetVisibility(kTRUE);
4812   traySideCOutFreon->SetLineColor(kBlue); // Blue
4813   traySideCOutFreon->SetLineWidth(1);
4814   traySideCOutFreon->SetFillColor(traySideCOutFreon->GetLineColor());
4815   traySideCOutFreon->SetFillStyle(4000); // 0% transparent
4816
4817   TGeoVolume *traySideCOptFibs = new TGeoVolume("ITSsuppSPDTraySideCOptFibs",
4818                                                 optFibs, medFibs);
4819
4820   traySideCOptFibs->SetVisibility(kTRUE);
4821   traySideCOptFibs->SetLineColor(kOrange); // Orange
4822   traySideCOptFibs->SetLineWidth(1);
4823   traySideCOptFibs->SetFillColor(traySideCOptFibs->GetLineColor());
4824   traySideCOptFibs->SetFillStyle(4000); // 0% transparent
4825
4826   TGeoVolume *traySideCLowCabsCu = new TGeoVolume("ITSsuppSPDTraySideCLVCu",
4827                                                   lowCablesCu, medCu);
4828
4829   traySideCLowCabsCu->SetVisibility(kTRUE);
4830   traySideCLowCabsCu->SetLineColor(kRed); // Red
4831   traySideCLowCabsCu->SetLineWidth(1);
4832   traySideCLowCabsCu->SetFillColor(traySideCLowCabsCu->GetLineColor());
4833   traySideCLowCabsCu->SetFillStyle(4000); // 0% transparent
4834
4835   TGeoVolume *traySideCLowCabsPUR = new TGeoVolume("ITSsuppSPDTraySideCLVPUR",
4836                                                    lowCablesPUR, medPUR);
4837
4838   traySideCLowCabsPUR->SetVisibility(kTRUE);
4839   traySideCLowCabsPUR->SetLineColor(kBlack); // Black
4840   traySideCLowCabsPUR->SetLineWidth(1);
4841   traySideCLowCabsPUR->SetFillColor(traySideCLowCabsPUR->GetLineColor());
4842   traySideCLowCabsPUR->SetFillStyle(4000); // 0% transparent
4843
4844   TGeoVolume *traySideCHiCabsCu = new TGeoVolume("ITSsuppSPDTraySideCHVCu",
4845                                                  hiCablesCu, medCu);
4846
4847   traySideCHiCabsCu->SetVisibility(kTRUE);
4848   traySideCHiCabsCu->SetLineColor(kRed); // Red
4849   traySideCHiCabsCu->SetLineWidth(1);
4850   traySideCHiCabsCu->SetFillColor(traySideCHiCabsCu->GetLineColor());
4851   traySideCHiCabsCu->SetFillStyle(4000); // 0% transparent
4852
4853   TGeoVolume *traySideCHiCabsPUR = new TGeoVolume("ITSsuppSPDTraySideCHVPUR",
4854                                                   hiCablesPUR, medPUR);
4855
4856   traySideCHiCabsPUR->SetVisibility(kTRUE);
4857   traySideCHiCabsPUR->SetLineColor(kBlack); // Black
4858   traySideCHiCabsPUR->SetLineWidth(1);
4859   traySideCHiCabsPUR->SetFillColor(traySideCHiCabsPUR->GetLineColor());
4860   traySideCHiCabsPUR->SetFillStyle(4000); // 0% transparent
4861
4862   TGeoVolume *traySideCCoaxCu = new TGeoVolume("ITSsuppSPDTraySideCCoaxCu",
4863                                                coaxCablesCu, medCu);
4864
4865   traySideCCoaxCu->SetVisibility(kTRUE);
4866   traySideCCoaxCu->SetLineColor(kRed); // Red
4867   traySideCCoaxCu->SetLineWidth(1);
4868   traySideCCoaxCu->SetFillColor(traySideCCoaxCu->GetLineColor());
4869   traySideCCoaxCu->SetFillStyle(4000); // 0% transparent
4870
4871   TGeoVolume *traySideCCoaxMeg = new TGeoVolume("ITSsuppSPDTraySideCCoaxMeg",
4872                                                 coaxCablesMeg, medMeg);
4873
4874   traySideCCoaxMeg->SetVisibility(kTRUE);
4875   traySideCCoaxMeg->SetLineColor(kBlack); // Black
4876   traySideCCoaxMeg->SetLineWidth(1);
4877   traySideCCoaxMeg->SetFillColor(traySideCCoaxMeg->GetLineColor());
4878   traySideCCoaxMeg->SetFillStyle(4000); // 0% transparent
4879
4880
4881   // Now build up the trays
4882   cableTrayC->AddNode(traySideCIntern,1,0);
4883
4884   cableTrayC->AddNode(traySideCMidFace,1,0);
4885
4886   zloc = kTrayCHalfWide - kTrayCThick;
4887   cableTrayC->AddNode(traySideCSideFace, 1,
4888                       new TGeoTranslation( 0, 0, zloc));
4889   zloc = -kTrayCHalfWide;
4890   cableTrayC->AddNode(traySideCSideFace, 2,
4891                       new TGeoTranslation( 0, 0, zloc));
4892
4893   xloc = sideCShortCover->GetDX();
4894   yloc = kTrayCFirstHigh - sideCShortCover->GetDY();
4895   cableTrayC->AddNode(traySideCShortCover, 1,
4896                       new TGeoTranslation( xloc, yloc, 0));
4897
4898   cableTrayC->AddNode(traySideCLongCover,1,0);
4899
4900   traySideCHorTube->AddNode(traySideCHorFreon, 1, 0);
4901   traySideCIncTube->AddNode(traySideCIncFreon, 1, 0);
4902   traySideCOutTube->AddNode(traySideCOutFreon, 1, 0);
4903
4904   xloc = horTube->GetDz();
4905   yloc = sideCMidFace->GetY(5) + horTube->GetRmax();
4906   cableTrayC->AddNode(traySideCHorTube, 1,
4907                       new TGeoCombiTrans( xloc, yloc, 0,
4908                       new TGeoRotation("",-90.,-90.,90.)));
4909
4910   xloc = sideCMidFace->GetX(4) + (incTube->GetDz())*CosD(kTrayCFoldAngle);
4911   yloc = sideCMidFace->GetY(4) +  incTube->GetRmax() +
4912             (incTube->GetDz())*SinD(kTrayCFoldAngle)+0.005;//Avoid small ovrlp
4913   cableTrayC->AddNode(traySideCIncTube, 1,
4914                       new TGeoCombiTrans( xloc, yloc, 0,
4915                       new TGeoRotation("",-90.+kTrayCFoldAngle,-90.,90.)));
4916
4917   xloc = -kTrayCCablesZLenOut/2 - outTube->GetRmax();
4918   yloc = xloc/TanD(kTrayCCablesOutRot) + sideCMidFace->GetY(4) -
4919          2*outTube->GetRmax();
4920   cableTrayC->AddNode(traySideCOutTube, 1,
4921                       new TGeoCombiTrans( xloc, yloc, 0,
4922                       new TGeoRotation("",-70.,-90.,90.)));
4923
4924   zloc = horTube->GetRmax();
4925   cableTrayC->AddNode(traySideCOptFibs, 1,
4926                       new TGeoTranslation( 0, 0, zloc));
4927
4928   zloc = kLowVoltCableSectCu + horTube->GetRmax();
4929   cableTrayC->AddNode(traySideCLowCabsCu, 1,
4930                       new TGeoTranslation( 0, 0,-zloc));
4931   cableTrayC->AddNode(traySideCLowCabsPUR, 1,
4932                       new TGeoTranslation( 0, 0,-zloc));
4933
4934   zloc = kHiVoltCableSectCu + kLowVoltCableSectCu + horTube->GetRmax();
4935   cableTrayC->AddNode(traySideCHiCabsCu, 1,
4936                       new TGeoTranslation( 0, 0,-zloc));
4937   cableTrayC->AddNode(traySideCHiCabsPUR, 1,
4938                       new TGeoTranslation( 0, 0,-zloc));
4939
4940   zloc = kOpticalFibersSect + kCoaxCableSectCu + horTube->GetRmax();
4941   cableTrayC->AddNode(traySideCCoaxCu, 1,
4942                       new TGeoTranslation( 0, 0, zloc));
4943   cableTrayC->AddNode(traySideCCoaxMeg, 1,
4944                       new TGeoTranslation( 0, 0, zloc));
4945
4946
4947   // Finally put everything in the mother volume
4948   for (Int_t jt = 0; jt < kNumTraysSideC/2; jt++) {
4949     alpharot = kTraySideCAlphaRot[jt];
4950
4951     xloc = kTraySideCRPos*SinD(alpharot);
4952     yloc = kTraySideCRPos*CosD(alpharot);
4953     moth->AddNode(cableTrayC,2*jt+1,
4954                 new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
4955                 new TGeoRotation("",-90.+alpharot,-90.,90.+kTrayCFoldAngle)));
4956     alpharot += 180;
4957     xloc = kTraySideCRPos*SinD(alpharot);
4958     yloc = kTraySideCRPos*CosD(alpharot);
4959     moth->AddNode(cableTrayC,2*jt+2,
4960                 new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
4961                 new TGeoRotation("",-90.+alpharot,-90.,90.+kTrayCFoldAngle)));
4962   }
4963
4964
4965   return;
4966 }
4967
4968 //______________________________________________________________________
4969 void AliITSv11GeometrySupport::SDDCableTraysSideA(TGeoVolume *moth,
4970                                              const TGeoManager *mgr){
4971 //
4972 // Creates the SDD cable trays which are outside the ITS support cones
4973 // but still inside the TPC on Side A
4974 // (part of this code is taken or anyway inspired to ServicesCableSupport
4975 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
4976 //
4977 // Input:
4978 //         moth : the TGeoVolume owing the volume structure
4979 //         mgr  : the GeoManager (default gGeoManager)
4980 // Output:
4981 //
4982 // Created:         ???       Bjorn S. Nilsen
4983 // Updated:       5 Jan 2010  Mario Sitta
4984 // Updated:      26 Feb 2010  Mario Sitta
4985 // Updated:      06 Sep 2010  Mario Sitta
4986 //
4987 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
4988 // drawings and other (oral) information given by F.Tosello
4989 //
4990
4991   // Overall position and rotation of the A-Side Cable Trays
4992   // (parts of 0872/G/D)
4993   const Double_t kTrayARTrans            =  408.35 *fgkmm;
4994   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
4995   const Double_t kTrayAZToSupportRing    =  435.00 *fgkmm;
4996   const Double_t kExternTrayYTrans       =   96.00 *fgkmm; // Computed
4997   const Double_t kExternTrayZTrans       =  823.00 *fgkmm;
4998   const Double_t kExternCoverYTrans      =    2.00 *fgkmm;
4999   const Double_t kTrayAZRot              = (180-169.5);// Degrees
5000   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
5001   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
5002
5003   const Double_t kForwardTrayThick       =    2.00 *fgkmm;
5004   const Double_t kForwardTrayTailHeight  =  100.00 *fgkmm; // Computed
5005   const Double_t kForwardTrayTotalHeight =  170.00 *fgkmm; // Computed
5006   const Double_t kForwardTrayUpperLength =  405.00 *fgkmm; // Computed
5007   const Double_t kForwardCoverLength     =  380.00 *fgkmm;
5008   const Double_t kForwardCoverWide       =  133.00 *fgkmm;
5009   const Double_t kForwardCoverHeight     =   10.00 *fgkmm;
5010   const Double_t kForwardCoverThick      =    1.00 *fgkmm;
5011
5012   const Double_t kExternTrayTotalLen     = 1200.00 *fgkmm;
5013   const Double_t kExternTrayTotalHeight  =   52.00 *fgkmm;
5014   const Double_t kExternCoverLen         = kExternTrayTotalLen;
5015   const Double_t kExternCoverThick       =    5.00 *fgkmm;
5016   const Double_t kExternCoverSideThick   =    3.00 *fgkmm;
5017
5018   const Int_t    kForwardTrayNpoints     =    8;
5019
5020   // Dimensions and positions of the Cable Tray elements
5021   const Double_t kSideACoolManifWide     =    8.23 *fgkcm;
5022   const Double_t kSideACoolManifHigh     =    8.06 *fgkcm;
5023   const Double_t kSideACoolManifLen      =    3.90 *fgkcm;
5024   const Double_t kSideACoolManifPOMFrac  =    0.0054;
5025   const Double_t kSideACoolManifSteelFrac=    0.8850;
5026   const Double_t kSideACoolManifWaterFrac=    0.0913;
5027   const Double_t kSideACoolManifAlFrac   =    0.0183;
5028
5029   const Double_t kSideACoolTubesWide     =    9.07 *fgkcm;
5030   const Double_t kSideACoolTubesHigh     =    1.88 *fgkcm;
5031   const Double_t kSideACoolTubesTrans    =    0.88 *fgkcm;
5032   const Double_t kSideACoolTubesPURFrac  =    0.5897;
5033   const Double_t kSideACoolTubesWaterFrac=    0.4101;
5034   const Double_t kSideACoolTubesAirFrac  =    0.0002;
5035
5036   const Double_t kSideAOptConnWide       =    0.90    *fgkcm;
5037   const Double_t kSideAOptConnLen        =    1.37    *fgkcm;
5038   const Double_t kSideAOptConnPBTFrac    =    0.5010;
5039   const Double_t kSideAOptConnSteelFrac  =    0.1784;
5040   const Double_t kSideAOptConnAlFrac     =    0.3206;
5041
5042   const Double_t kSideAOptFibsWide       =    0.71    *fgkcm;
5043   const Double_t kSideAOptFibsHigh       =    3.20    *fgkcm;
5044
5045   const Double_t kSideAInputCablesWide   =   12.50    *fgkcm;
5046   const Double_t kSideAInputCablesHigh   =    1.24    *fgkcm;
5047   const Double_t kSideAInputCablesLen    =   25.20    *fgkcm;
5048   const Double_t kSideAInputCablesYTrans =    1.15    *fgkcm;
5049   const Double_t kSideAInputCablesCu     =    0.7404;
5050   const Double_t kSideAInputCablesPlast  =    0.1269;
5051   const Double_t kSideAInputCablesAl     =    0.0057;
5052   const Double_t kSideAInputCablesKapton =    0.0172;
5053   const Double_t kSideAInputCablesPOLYAX =    0.1098;
5054
5055   const Double_t kSideAOutputCablesWide  =    8.30    *fgkcm;
5056   const Double_t kSideAOutputCablesHigh  =    1.56    *fgkcm;
5057   const Double_t kSideAOutputCablesCu    =    0.6783;
5058   const Double_t kSideAOutputCablesPlast =    0.1605;
5059   const Double_t kSideAOutputCablesAl    =    0.0078;
5060   const Double_t kSideAOutputCablesKapton=    0.0232;
5061   const Double_t kSideAOutputCablesPOLYAX=    0.1302;
5062
5063   const Double_t kSideAPCBBoardsWide     =   12.50    *fgkcm;
5064   const Double_t kSideAPCBBoardsHigh     =    6.32    *fgkcm;
5065   const Double_t kSideAPCBBoardsLen      =   24.00    *fgkcm;
5066   const Double_t kSideAPCBBoardsYTrans   =    0.75    *fgkcm;
5067   const Double_t kSideAPCBBoardsCu       =    0.3864;
5068   const Double_t kSideAPCBBoardsEpoxy    =    0.1486;
5069   const Double_t kSideAPCBBoardsPlast    =    0.0578;
5070   const Double_t kSideAPCBBoardsSteel    =    0.1521;
5071   const Double_t kSideAPCBBoardsPPS      =    0.2551;
5072
5073
5074   // Local variables
5075   Double_t xprof[kForwardTrayNpoints], yprof[kForwardTrayNpoints];
5076   Double_t xloc, yloc, zloc, alpharot, height;
5077
5078
5079   // The whole tray as an assembly
5080   TGeoVolumeAssembly *cableTrayA = new TGeoVolumeAssembly("ITSsupportSDDTrayA");
5081   
5082
5083   // First create all needed shapes
5084
5085   // The forward tray is very complex and deserves a dedicated method
5086   CreateSDDForwardTraySideA(cableTrayA,mgr);
5087
5088   // The forward cover: a Xtru
5089   TGeoXtru *forwardCover = new TGeoXtru(2);
5090   forwardCover->SetName("ITSsuppSDDForwCover");
5091
5092   xprof[0] = kForwardCoverWide/2;
5093   yprof[0] = kForwardCoverHeight;
5094   xprof[1] = xprof[0];
5095   yprof[1] = 0;
5096   xprof[2] = xprof[1] - kForwardCoverThick;
5097   yprof[2] = yprof[1];
5098   xprof[3] = xprof[2];
5099   yprof[3] = yprof[0] - kForwardCoverThick;
5100
5101   // We did the right side, now reflex on the left side
5102   for (Int_t jp = 0; jp < 4; jp++) {
5103     xprof[4+jp] = -xprof[3-jp];
5104     yprof[4+jp] =  yprof[3-jp];
5105   }
5106
5107   forwardCover->DefinePolygon(8, xprof, yprof);
5108   forwardCover->DefineSection(0, 0);
5109   forwardCover->DefineSection(1, kForwardCoverLength);
5110
5111   // The external tray (as 0872/G/D/03): a Xtru
5112   TGeoXtru *externalTray = CreateSDDSSDTraysSideA(kExternTrayTotalLen,
5113                                                   kExternTrayTotalHeight);
5114
5115   // The external covers: a Composite Shape
5116   TGeoCompositeShape *externCover = CreateTrayAExternalCover(kExternCoverLen);
5117
5118   // Now the volumes inside it
5119   // The cooling manifold: four boxes
5120   TGeoBBox *coolManifPOM = new TGeoBBox(kSideACoolManifWide/2,
5121                  kSideACoolManifPOMFrac*kSideACoolManifHigh/2,
5122                                         kSideACoolManifLen/2);
5123
5124   TGeoBBox *coolManifSteel = new TGeoBBox(kSideACoolManifWide/2,
5125                  kSideACoolManifSteelFrac*kSideACoolManifHigh/2,
5126                                           kSideACoolManifLen/2);
5127
5128   TGeoBBox *coolManifWater = new TGeoBBox(kSideACoolManifWide/2,
5129                  kSideACoolManifWaterFrac*kSideACoolManifHigh/2,
5130                                           kSideACoolManifLen/2);
5131
5132   TGeoBBox *coolManifAl = new TGeoBBox(kSideACoolManifWide/2,
5133                  kSideACoolManifAlFrac*kSideACoolManifHigh/2,
5134                                        kSideACoolManifLen/2);
5135
5136   // The cooling tubes: three Xtru's
5137   TGeoXtru *coolTubesPUR = new TGeoXtru(2);
5138
5139   height = kSideACoolTubesHigh*kSideACoolTubesPURFrac;
5140
5141   xprof[0] = kSideACoolManifLen;
5142   yprof[0] = kForwardTrayThick + kSideACoolTubesTrans;
5143   xprof[2] = kExternTrayZTrans + kForwardTrayTotalHeight*SinD(kTrayAZRot) +
5144              kExternTrayTotalLen*CosD(kTrayAZRot) - xprof[0]/2;
5145   yprof[2] = kForwardTrayTotalHeight*(1 - CosD(kTrayAZRot)) +
5146              kExternTrayYTrans - kExternTrayTotalHeight*CosD(kTrayAZRot) +
5147              kExternTrayTotalLen*SinD(kTrayAZRot) + yprof[0];
5148   IntersectLines(              0 , xprof[0], yprof[0],
5149                  TanD(kTrayAZRot), xprof[2], yprof[2],
5150                                    xprof[1], yprof[1]);
5151   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5152   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5153   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5154               height, xprof[4], yprof[4]);
5155   xprof[5] = xprof[0];
5156   yprof[5] = yprof[0] + height;
5157
5158   coolTubesPUR->DefinePolygon(6, xprof, yprof);
5159   coolTubesPUR->DefineSection(0,-kSideACoolTubesWide/2);
5160   coolTubesPUR->DefineSection(1, kSideACoolTubesWide/2);
5161
5162   TGeoXtru *coolTubesWater = new TGeoXtru(2);
5163
5164   height = kSideACoolTubesHigh*kSideACoolTubesWaterFrac;
5165
5166   xprof[0] = coolTubesPUR->GetX(5);
5167   yprof[0] = coolTubesPUR->GetY(5);
5168   xprof[1] = coolTubesPUR->GetX(4);
5169   yprof[1] = coolTubesPUR->GetY(4);
5170   xprof[2] = coolTubesPUR->GetX(3);
5171   yprof[2] = coolTubesPUR->GetY(3);
5172   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5173   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5174   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5175               height, xprof[4], yprof[4]);
5176   xprof[5] = xprof[0];
5177   yprof[5] = yprof[0] + height;
5178
5179   coolTubesWater->DefinePolygon(6, xprof, yprof);
5180   coolTubesWater->DefineSection(0,-kSideACoolTubesWide/2);
5181   coolTubesWater->DefineSection(1, kSideACoolTubesWide/2);
5182
5183   TGeoXtru *coolTubesAir = new TGeoXtru(2);
5184
5185   height = kSideACoolTubesHigh*kSideACoolTubesAirFrac;
5186
5187   xprof[0] = coolTubesWater->GetX(5);
5188   yprof[0] = coolTubesWater->GetY(5);
5189   xprof[1] = coolTubesWater->GetX(4);
5190   yprof[1] = coolTubesWater->GetY(4);
5191   xprof[2] = coolTubesWater->GetX(3);
5192   yprof[2] = coolTubesWater->GetY(3);
5193   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5194   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5195   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5196               height, xprof[4], yprof[4]);
5197   xprof[5] = xprof[0];
5198   yprof[5] = yprof[0] + height;
5199
5200   coolTubesAir->DefinePolygon(6, xprof, yprof);
5201   coolTubesAir->DefineSection(0,-kSideACoolTubesWide/2);
5202   coolTubesAir->DefineSection(1, kSideACoolTubesWide/2);
5203
5204   // The optical fiber connectors: three boxes
5205   TGeoBBox *optConnPBT = new TGeoBBox(kSideAOptConnWide/2,
5206                  kSideAOptConnPBTFrac*kSideACoolManifHigh/2,
5207                                       kSideAOptConnLen/2);
5208
5209   TGeoBBox *optConnSteel = new TGeoBBox(kSideAOptConnWide/2,
5210                  kSideAOptConnSteelFrac*kSideACoolManifHigh/2,
5211                                         kSideAOptConnLen/2);
5212
5213   TGeoBBox *optConnAl = new TGeoBBox(kSideAOptConnWide/2,
5214                  kSideAOptConnAlFrac*kSideACoolManifHigh/2,
5215                                      kSideAOptConnLen/2);
5216
5217   // The optical fibers: a Xtru
5218   TGeoXtru *opticalFibs = new TGeoXtru(2);
5219
5220   xprof[0] = kSideAOptConnLen;
5221   yprof[0] = coolTubesPUR->GetY(0);
5222   xprof[1] = coolTubesPUR->GetX(1);
5223   yprof[1] = coolTubesPUR->GetY(1);
5224   xprof[2] = coolTubesPUR->GetX(2);
5225   yprof[2] = coolTubesPUR->GetY(2);
5226   xprof[3] = xprof[2] - kSideAOptFibsHigh*SinD(kTrayAZRot);
5227   yprof[3] = yprof[2] + kSideAOptFibsHigh*CosD(kTrayAZRot);
5228   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5229               kSideAOptFibsHigh, xprof[4], yprof[4]);
5230   xprof[5] = xprof[0];
5231   yprof[5] = yprof[0] + kSideAOptFibsHigh;
5232
5233   opticalFibs->DefinePolygon(6, xprof, yprof);
5234   opticalFibs->DefineSection(0,-kSideAOptFibsWide/2);
5235   opticalFibs->DefineSection(1, kSideAOptFibsWide/2);
5236
5237   // The input cables: five boxes
5238   TGeoBBox *inputCabsCu = new TGeoBBox(kSideAInputCablesWide/2,
5239                    kSideAInputCablesCu*kSideAInputCablesHigh/2,
5240                                        kSideAInputCablesLen/2);
5241
5242   TGeoBBox *inputCabsPlast = new TGeoBBox(kSideAInputCablesWide/2,
5243                    kSideAInputCablesPlast*kSideAInputCablesHigh/2,
5244                                           kSideAInputCablesLen/2);
5245
5246   TGeoBBox *inputCabsAl = new TGeoBBox(kSideAInputCablesWide/2,
5247                    kSideAInputCablesAl*kSideAInputCablesHigh/2,
5248                                        kSideAInputCablesLen/2);
5249
5250   TGeoBBox *inputCabsKapton = new TGeoBBox(kSideAInputCablesWide/2,
5251                    kSideAInputCablesKapton*kSideAInputCablesHigh/2,
5252                                            kSideAInputCablesLen/2);
5253
5254   TGeoBBox *inputCabsPOLYAX = new TGeoBBox(kSideAInputCablesWide/2,
5255                    kSideAInputCablesPOLYAX*kSideAInputCablesHigh/2,
5256                                            kSideAInputCablesLen/2);
5257
5258   // The output cables: five Xtru
5259   TGeoXtru *outputCabsCu = new TGeoXtru(2);
5260
5261   height = kSideAOutputCablesCu*kSideAOutputCablesHigh;
5262
5263   xprof[0] = kSideAInputCablesLen/2 + kSideAPCBBoardsLen/2;
5264   yprof[0] = coolTubesAir->GetY(5);
5265   xprof[1] = coolTubesAir->GetX(4);
5266   yprof[1] = coolTubesAir->GetY(4);
5267   xprof[2] = coolTubesAir->GetX(3);
5268   yprof[2] = coolTubesAir->GetY(3);
5269   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5270   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5271   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5272               height, xprof[4], yprof[4]);
5273   xprof[5] = xprof[0];
5274   yprof[5] = yprof[0] + height;
5275
5276   outputCabsCu->DefinePolygon(6, xprof, yprof);
5277   outputCabsCu->DefineSection(0,-kSideAOutputCablesWide/2);
5278   outputCabsCu->DefineSection(1, kSideAOutputCablesWide/2);
5279
5280   TGeoXtru *outputCabsPlast = new TGeoXtru(2);
5281
5282   height = kSideAOutputCablesPlast*kSideAOutputCablesHigh;
5283
5284   xprof[0] = outputCabsCu->GetX(5);
5285   yprof[0] = outputCabsCu->GetY(5);
5286   xprof[1] = outputCabsCu->GetX(4);
5287   yprof[1] = outputCabsCu->GetY(4);
5288   xprof[2] = outputCabsCu->GetX(3);
5289   yprof[2] = outputCabsCu->GetY(3);
5290   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5291   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5292   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5293               height, xprof[4], yprof[4]);
5294   xprof[5] = xprof[0];
5295   yprof[5] = yprof[0] + height;
5296
5297   outputCabsPlast->DefinePolygon(6, xprof, yprof);
5298   outputCabsPlast->DefineSection(0,-kSideAOutputCablesWide/2);
5299   outputCabsPlast->DefineSection(1, kSideAOutputCablesWide/2);
5300
5301   TGeoXtru *outputCabsAl = new TGeoXtru(2);
5302
5303   height = kSideAOutputCablesAl*kSideAOutputCablesHigh;
5304
5305   xprof[0] = outputCabsPlast->GetX(5);
5306   yprof[0] = outputCabsPlast->GetY(5);
5307   xprof[1] = outputCabsPlast->GetX(4);
5308   yprof[1] = outputCabsPlast->GetY(4);
5309   xprof[2] = outputCabsPlast->GetX(3);
5310   yprof[2] = outputCabsPlast->GetY(3);
5311   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5312   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5313   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5314               height, xprof[4], yprof[4]);
5315   xprof[5] = xprof[0];
5316   yprof[5] = yprof[0] + height;
5317
5318   outputCabsAl->DefinePolygon(6, xprof, yprof);
5319   outputCabsAl->DefineSection(0,-kSideAOutputCablesWide/2);
5320   outputCabsAl->DefineSection(1, kSideAOutputCablesWide/2);
5321
5322   TGeoXtru *outputCabsKapton = new TGeoXtru(2);
5323
5324   height = kSideAOutputCablesKapton*kSideAOutputCablesHigh;
5325
5326   xprof[0] = outputCabsAl->GetX(5);
5327   yprof[0] = outputCabsAl->GetY(5);
5328   xprof[1] = outputCabsAl->GetX(4);
5329   yprof[1] = outputCabsAl->GetY(4);
5330   xprof[2] = outputCabsAl->GetX(3);
5331   yprof[2] = outputCabsAl->GetY(3);
5332   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5333   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5334   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5335               height, xprof[4], yprof[4]);
5336   xprof[5] = xprof[0];
5337   yprof[5] = yprof[0] + height;
5338
5339   outputCabsKapton->DefinePolygon(6, xprof, yprof);
5340   outputCabsKapton->DefineSection(0,-kSideAOutputCablesWide/2);
5341   outputCabsKapton->DefineSection(1, kSideAOutputCablesWide/2);
5342
5343   TGeoXtru *outputCabsPOLYAX = new TGeoXtru(2);
5344
5345   height = kSideAOutputCablesPOLYAX*kSideAOutputCablesHigh;
5346
5347   xprof[0] = outputCabsKapton->GetX(5);
5348   yprof[0] = outputCabsKapton->GetY(5);
5349   xprof[1] = outputCabsKapton->GetX(4);
5350   yprof[1] = outputCabsKapton->GetY(4);
5351   xprof[2] = outputCabsKapton->GetX(3);
5352   yprof[2] = outputCabsKapton->GetY(3);
5353   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5354   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5355   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5356               height, xprof[4], yprof[4]);
5357   xprof[5] = xprof[0];
5358   yprof[5] = yprof[0] + height;
5359
5360   outputCabsPOLYAX->DefinePolygon(6, xprof, yprof);
5361   outputCabsPOLYAX->DefineSection(0,-kSideAOutputCablesWide/2);
5362   outputCabsPOLYAX->DefineSection(1, kSideAOutputCablesWide/2);
5363
5364   // The PCB boards: five boxes
5365   TGeoBBox *pcbBoardsCu = new TGeoBBox(kSideAPCBBoardsWide/2,
5366                      kSideAPCBBoardsCu*kSideAPCBBoardsHigh/2,
5367                                        kSideAPCBBoardsLen/2);
5368
5369   TGeoBBox *pcbBoardsEpoxy = new TGeoBBox(kSideAPCBBoardsWide/2,
5370                      kSideAPCBBoardsEpoxy*kSideAPCBBoardsHigh/2,
5371                                           kSideAPCBBoardsLen/2);
5372
5373   TGeoBBox *pcbBoardsPlast = new TGeoBBox(kSideAPCBBoardsWide/2,
5374                      kSideAPCBBoardsPlast*kSideAPCBBoardsHigh/2,
5375                                           kSideAPCBBoardsLen/2);
5376
5377   TGeoBBox *pcbBoardsSteel = new TGeoBBox(kSideAPCBBoardsWide/2,
5378                      kSideAPCBBoardsSteel*kSideAPCBBoardsHigh/2,
5379                                           kSideAPCBBoardsLen/2);
5380
5381   TGeoBBox *pcbBoardsPPS = new TGeoBBox(kSideAPCBBoardsWide/2,
5382                      kSideAPCBBoardsPPS*kSideAPCBBoardsHigh/2,
5383                                         kSideAPCBBoardsLen/2);
5384
5385
5386   // We have all shapes: now create the real volumes
5387   TGeoMedium *medAl     = mgr->GetMedium("ITS_ALUMINUM$");
5388   TGeoMedium *medAntic  = mgr->GetMedium("ITS_ANTICORODAL$");
5389   TGeoMedium *medPOM    = mgr->GetMedium("ITS_POLYOXYMETHYLENE$");
5390   TGeoMedium *medSteel  = mgr->GetMedium("ITS_INOX$");
5391   TGeoMedium *medWater  = mgr->GetMedium("ITS_WATER$");
5392   TGeoMedium *medPUR    = mgr->GetMedium("ITS_POLYURETHANE$");
5393   TGeoMedium *medAir    = mgr->GetMedium("ITS_AIR$");
5394   TGeoMedium *medPBT    = mgr->GetMedium("ITS_PBT$");
5395   TGeoMedium *medOptFib = mgr->GetMedium("ITS_SDD OPTICFIB$");
5396   TGeoMedium *medCu     = mgr->GetMedium("ITS_COPPER$");
5397   TGeoMedium *medKapton = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
5398   TGeoMedium *medPOLYAX = mgr->GetMedium("ITS_POLYAX$");
5399   TGeoMedium *medPPS    = mgr->GetMedium("ITS_PPS$");
5400   TGeoMedium *medEpoxy  = mgr->GetMedium("ITS_EPOXY$");
5401
5402   TGeoVolume *forwardTrayCover = new TGeoVolume("ITSsuppSDDSideAForwTrayCover",
5403                                                 forwardCover, medAl);
5404
5405   forwardTrayCover->SetVisibility(kTRUE);
5406   forwardTrayCover->SetLineColor(kMagenta+1); // Purple
5407   forwardTrayCover->SetLineWidth(1);
5408   forwardTrayCover->SetFillColor(forwardTrayCover->GetLineColor());
5409   forwardTrayCover->SetFillStyle(4000); // 0% transparent
5410
5411   TGeoVolume *externalTraySDD = new TGeoVolume("ITSsuppSDDSideAExternalTray",
5412                                                externalTray, medAl);
5413
5414   externalTraySDD->SetVisibility(kTRUE);
5415   externalTraySDD->SetLineColor(6); // Purple
5416   externalTraySDD->SetLineWidth(1);
5417   externalTraySDD->SetFillColor(externalTraySDD->GetLineColor());
5418   externalTraySDD->SetFillStyle(4000); // 0% transparent
5419
5420   TGeoVolume *externTrayCover = new TGeoVolume("ITSsuppSDDSideAExtTrayCover",
5421                                                externCover, medAntic);
5422
5423   externTrayCover->SetVisibility(kTRUE);
5424   externTrayCover->SetLineColor(kMagenta+1); // Purple
5425   externTrayCover->SetLineWidth(1);
5426   externTrayCover->SetFillColor(externTrayCover->GetLineColor());
5427   externTrayCover->SetFillStyle(4000); // 0% transparent
5428
5429   TGeoVolume *pomCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifPOM",
5430                                             coolManifPOM, medPOM);
5431
5432   pomCoolManif->SetVisibility(kTRUE);
5433   pomCoolManif->SetLineColor(kRed); // Red
5434   pomCoolManif->SetLineWidth(1);
5435   pomCoolManif->SetFillColor(pomCoolManif->GetLineColor());
5436   pomCoolManif->SetFillStyle(4000); // 0% transparent
5437
5438   TGeoVolume *steelCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifSteel",
5439                                               coolManifSteel, medSteel);
5440
5441   steelCoolManif->SetVisibility(kTRUE);
5442   steelCoolManif->SetLineColor(kBlue); // Blue
5443   steelCoolManif->SetLineWidth(1);
5444   steelCoolManif->SetFillColor(steelCoolManif->GetLineColor());
5445   steelCoolManif->SetFillStyle(4000); // 0% transparent
5446
5447   TGeoVolume *waterCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifWater",
5448                                               coolManifWater, medWater);
5449
5450   waterCoolManif->SetVisibility(kTRUE);
5451   waterCoolManif->SetLineColor(33); // Light Blue
5452   waterCoolManif->SetLineWidth(1);
5453   waterCoolManif->SetFillColor(waterCoolManif->GetLineColor());
5454   waterCoolManif->SetFillStyle(4000); // 0% transparent
5455
5456   TGeoVolume *alCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifAl",
5457                                            coolManifAl, medAl);
5458
5459   alCoolManif->SetVisibility(kTRUE);
5460   alCoolManif->SetLineColor(6); // Purple
5461   alCoolManif->SetLineWidth(1);
5462   alCoolManif->SetFillColor(alCoolManif->GetLineColor());
5463   alCoolManif->SetFillStyle(4000); // 0% transparent
5464
5465   TGeoVolume *purCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesPUR",
5466                                             coolTubesPUR, medPUR);
5467
5468   purCoolTubes->SetVisibility(kTRUE);
5469   purCoolTubes->SetLineColor(kRed); // Red
5470   purCoolTubes->SetLineWidth(1);
5471   purCoolTubes->SetFillColor(purCoolTubes->GetLineColor());
5472   purCoolTubes->SetFillStyle(4000); // 0% transparent
5473
5474   TGeoVolume *waterCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesWater",
5475                                               coolTubesWater, medWater);
5476
5477   waterCoolTubes->SetVisibility(kTRUE);
5478   waterCoolTubes->SetLineColor(33); // Light Blue
5479   waterCoolTubes->SetLineWidth(1);
5480   waterCoolTubes->SetFillColor(waterCoolTubes->GetLineColor());
5481   waterCoolTubes->SetFillStyle(4000); // 0% transparent
5482
5483   TGeoVolume *airCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesAir",
5484                                             coolTubesAir, medAir);
5485
5486   airCoolTubes->SetVisibility(kTRUE);
5487   airCoolTubes->SetLineColor(41);
5488   airCoolTubes->SetLineWidth(1);
5489   airCoolTubes->SetFillColor(airCoolTubes->GetLineColor());
5490   airCoolTubes->SetFillStyle(4000); // 0% transparent
5491
5492   TGeoVolume *pbtOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnPBT",
5493                                           optConnPBT, medPBT);
5494
5495   pbtOptConn->SetVisibility(kTRUE);
5496   pbtOptConn->SetLineColor(kRed); // Red
5497   pbtOptConn->SetLineWidth(1);
5498   pbtOptConn->SetFillColor(pbtOptConn->GetLineColor());
5499   pbtOptConn->SetFillStyle(4000); // 0% transparent
5500
5501   TGeoVolume *steelOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnSteel",
5502                                             optConnSteel, medSteel);
5503
5504   steelOptConn->SetVisibility(kTRUE);
5505   steelOptConn->SetLineColor(kBlue); // Blue
5506   steelOptConn->SetLineWidth(1);
5507   steelOptConn->SetFillColor(steelOptConn->GetLineColor());
5508   steelOptConn->SetFillStyle(4000); // 0% transparent
5509
5510   TGeoVolume *alOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnAl",
5511                                          optConnAl, medAl);
5512
5513   alOptConn->SetVisibility(kTRUE);
5514   alOptConn->SetLineColor(6); // Purple
5515   alOptConn->SetLineWidth(1);
5516   alOptConn->SetFillColor(alOptConn->GetLineColor());
5517   alOptConn->SetFillStyle(4000); // 0% transparent
5518
5519   TGeoVolume *optFibs = new TGeoVolume("ITSsuppSDDSideAOptFibs",
5520                                        opticalFibs, medOptFib);
5521
5522   optFibs->SetVisibility(kTRUE);
5523   optFibs->SetLineColor(kOrange+2); // Orange
5524   optFibs->SetLineWidth(1);
5525   optFibs->SetFillColor(optFibs->GetLineColor());
5526   optFibs->SetFillStyle(4000); // 0% transparent
5527
5528   TGeoVolume *cuInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsCu",
5529                                            inputCabsCu, medCu);
5530
5531   cuInputCabs->SetVisibility(kTRUE);
5532   cuInputCabs->SetLineColor(kBlack); // Black
5533   cuInputCabs->SetLineWidth(1);
5534   cuInputCabs->SetFillColor(cuInputCabs->GetLineColor());
5535   cuInputCabs->SetFillStyle(4000); // 0% transparent
5536
5537   TGeoVolume *plastInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsPlast",
5538                                               inputCabsPlast, medPUR);
5539
5540   plastInputCabs->SetVisibility(kTRUE);
5541   plastInputCabs->SetLineColor(kRed); // Red
5542   plastInputCabs->SetLineWidth(1);
5543   plastInputCabs->SetFillColor(plastInputCabs->GetLineColor());
5544   plastInputCabs->SetFillStyle(4000); // 0% transparent
5545
5546   TGeoVolume *alInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsAl",
5547                                            inputCabsAl, medAl);
5548
5549   alInputCabs->SetVisibility(kTRUE);
5550   alInputCabs->SetLineColor(6); // Purple
5551   alInputCabs->SetLineWidth(1);
5552   alInputCabs->SetFillColor(alInputCabs->GetLineColor());
5553   alInputCabs->SetFillStyle(4000); // 0% transparent
5554
5555   TGeoVolume *kaptonInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsKapton",
5556                                                inputCabsKapton, medKapton);
5557
5558   kaptonInputCabs->SetVisibility(kTRUE);
5559   kaptonInputCabs->SetLineColor(14); // 
5560   kaptonInputCabs->SetLineWidth(1);
5561   kaptonInputCabs->SetFillColor(kaptonInputCabs->GetLineColor());
5562   kaptonInputCabs->SetFillStyle(4000); // 0% transparent
5563
5564   TGeoVolume *polyaxInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsPOLYAX",
5565                                                inputCabsPOLYAX, medPOLYAX);
5566
5567   polyaxInputCabs->SetVisibility(kTRUE);
5568   polyaxInputCabs->SetLineColor(34); // 
5569   polyaxInputCabs->SetLineWidth(1);
5570   polyaxInputCabs->SetFillColor(polyaxInputCabs->GetLineColor());
5571   polyaxInputCabs->SetFillStyle(4000); // 0% transparent
5572
5573   TGeoVolume *cuOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsCu",
5574                                             outputCabsCu, medCu);
5575
5576   cuOutputCabs->SetVisibility(kTRUE);
5577   cuOutputCabs->SetLineColor(kBlack); // Black
5578   cuOutputCabs->SetLineWidth(1);
5579   cuOutputCabs->SetFillColor(cuOutputCabs->GetLineColor());
5580   cuOutputCabs->SetFillStyle(4000); // 0% transparent
5581
5582   TGeoVolume *plastOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsPlast",
5583                                                outputCabsPlast, medPUR);
5584
5585   plastOutputCabs->SetVisibility(kTRUE);
5586   plastOutputCabs->SetLineColor(kRed); // Red
5587   plastOutputCabs->SetLineWidth(1);
5588   plastOutputCabs->SetFillColor(plastOutputCabs->GetLineColor());
5589   plastOutputCabs->SetFillStyle(4000); // 0% transparent
5590
5591   TGeoVolume *alOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsAl",
5592                                             outputCabsAl, medAl);
5593
5594   alOutputCabs->SetVisibility(kTRUE);
5595   alOutputCabs->SetLineColor(6); // Purple
5596   alOutputCabs->SetLineWidth(1);
5597   alOutputCabs->SetFillColor(alOutputCabs->GetLineColor());
5598   alOutputCabs->SetFillStyle(4000); // 0% transparent
5599
5600   TGeoVolume *kaptonOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsKapton",
5601                                                 outputCabsKapton, medKapton);
5602
5603   kaptonOutputCabs->SetVisibility(kTRUE);
5604   kaptonOutputCabs->SetLineColor(14); // 
5605   kaptonOutputCabs->SetLineWidth(1);
5606   kaptonOutputCabs->SetFillColor(kaptonOutputCabs->GetLineColor());
5607   kaptonOutputCabs->SetFillStyle(4000); // 0% transparent
5608
5609   TGeoVolume *polyaxOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsPOLYAX",
5610                                                 outputCabsPOLYAX, medPOLYAX);
5611
5612   polyaxOutputCabs->SetVisibility(kTRUE);
5613   polyaxOutputCabs->SetLineColor(34); // 
5614   polyaxOutputCabs->SetLineWidth(1);
5615   polyaxOutputCabs->SetFillColor(polyaxOutputCabs->GetLineColor());
5616   polyaxOutputCabs->SetFillStyle(4000); // 0% transparent
5617
5618   TGeoVolume *cuPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsCu",
5619                                            pcbBoardsCu, medCu);
5620
5621   cuPCBBoards->SetVisibility(kTRUE);
5622   cuPCBBoards->SetLineColor(kBlack); // Black
5623   cuPCBBoards->SetLineWidth(1);
5624   cuPCBBoards->SetFillColor(cuPCBBoards->GetLineColor());
5625   cuPCBBoards->SetFillStyle(4000); // 0% transparent
5626
5627   TGeoVolume *epoxyPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsEpoxy",
5628                                               pcbBoardsEpoxy, medEpoxy);
5629
5630   epoxyPCBBoards->SetVisibility(kTRUE);
5631   epoxyPCBBoards->SetLineColor(22); //
5632   epoxyPCBBoards->SetLineWidth(1);
5633   epoxyPCBBoards->SetFillColor(epoxyPCBBoards->GetLineColor());
5634   epoxyPCBBoards->SetFillStyle(4000); // 0% transparent
5635
5636   TGeoVolume *plastPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsPlast",
5637                                               pcbBoardsPlast, medPUR);
5638
5639   plastPCBBoards->SetVisibility(kTRUE);
5640   plastPCBBoards->SetLineColor(kRed); // Red
5641   plastPCBBoards->SetLineWidth(1);
5642   plastPCBBoards->SetFillColor(plastPCBBoards->GetLineColor());
5643   plastPCBBoards->SetFillStyle(4000); // 0% transparent
5644
5645   TGeoVolume *steelPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsSteel",
5646                                               pcbBoardsSteel, medSteel);
5647
5648   steelPCBBoards->SetVisibility(kTRUE);
5649   steelPCBBoards->SetLineColor(kBlue); // Blue
5650   steelPCBBoards->SetLineWidth(1);
5651   steelPCBBoards->SetFillColor(steelPCBBoards->GetLineColor());
5652   steelPCBBoards->SetFillStyle(4000); // 0% transparent
5653
5654   TGeoVolume *ppsPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsPPS",
5655                                             pcbBoardsPPS, medPPS);
5656
5657   ppsPCBBoards->SetVisibility(kTRUE);
5658   ppsPCBBoards->SetLineColor(kGreen); // Green
5659   ppsPCBBoards->SetLineWidth(1);
5660   ppsPCBBoards->SetFillColor(ppsPCBBoards->GetLineColor());
5661   ppsPCBBoards->SetFillStyle(4000); // 0% transparent
5662
5663
5664   // Now build up the tray
5665   yloc = kForwardTrayTotalHeight - forwardCover->GetY(3);
5666   zloc = kForwardTrayUpperLength - kForwardCoverLength;
5667   cableTrayA->AddNode(forwardTrayCover, 1,
5668                       new TGeoTranslation( 0, yloc, zloc) );
5669
5670   Double_t totalhi = kExternTrayTotalHeight + kExternCoverThick
5671                    - kExternCoverYTrans;
5672
5673   yloc = totalhi*(1 - CosD(kTrayAZRot)) + kExternTrayYTrans -
5674          kExternTrayTotalHeight*CosD(kTrayAZRot);
5675   zloc = kExternTrayZTrans + totalhi*SinD(kTrayAZRot);
5676   cableTrayA->AddNode(externalTraySDD, 1,
5677                       new TGeoCombiTrans( 0, yloc, zloc,
5678                       new TGeoRotation("", 0,-kTrayAZRot, 0)        ) );
5679
5680   yloc = kExternCoverThick*(1 - CosD(kTrayAZRot)) + kExternTrayYTrans -
5681          kExternCoverYTrans*CosD(kTrayAZRot)/2-0.01;
5682   zloc = kExternTrayZTrans + kExternCoverThick*SinD(kTrayAZRot);
5683   cableTrayA->AddNode(externTrayCover,1,
5684                       new TGeoCombiTrans( 0, yloc, zloc,
5685                       new TGeoRotation("", 0,-kTrayAZRot, 0)        ) );
5686
5687   yloc = kForwardTrayThick + coolManifPOM->GetDY();
5688   zloc = coolManifPOM->GetDZ();
5689   cableTrayA->AddNode(pomCoolManif, 1,
5690                       new TGeoTranslation( 0, yloc, zloc) );
5691
5692   yloc += coolManifPOM->GetDY() + coolManifSteel->GetDY();
5693   cableTrayA->AddNode(steelCoolManif, 1,
5694                       new TGeoTranslation( 0, yloc, zloc) );
5695
5696   yloc += coolManifSteel->GetDY() + coolManifWater->GetDY();
5697   cableTrayA->AddNode(waterCoolManif, 1,
5698                       new TGeoTranslation( 0, yloc, zloc) );
5699
5700   yloc += coolManifWater->GetDY() + coolManifAl->GetDY();
5701   cableTrayA->AddNode(alCoolManif, 1,
5702                       new TGeoTranslation( 0, yloc, zloc) );
5703
5704   cableTrayA->AddNode(purCoolTubes,1,
5705                       new TGeoCombiTrans( 0, 0, 0,
5706                       new TGeoRotation("",-90, 90, 90)        ) );
5707   cableTrayA->AddNode(waterCoolTubes,1,
5708                       new TGeoCombiTrans( 0, 0, 0,
5709                       new TGeoRotation("",-90, 90, 90)        ) );
5710   cableTrayA->AddNode(airCoolTubes,1,
5711                       new TGeoCombiTrans( 0, 0, 0,
5712                       new TGeoRotation("",-90, 90, 90)        ) );
5713
5714   xloc = coolManifPOM->GetDX() + optConnPBT->GetDX();
5715   yloc = kForwardTrayThick + optConnPBT->GetDY();
5716   zloc = optConnPBT->GetDZ();
5717   cableTrayA->AddNode(pbtOptConn, 1,
5718                       new TGeoTranslation( xloc, yloc, zloc) );
5719   cableTrayA->AddNode(pbtOptConn, 2,
5720                       new TGeoTranslation(-xloc, yloc, zloc) );
5721
5722   yloc += optConnPBT->GetDY() + optConnSteel->GetDY();
5723   cableTrayA->AddNode(steelOptConn, 1,
5724                       new TGeoTranslation( xloc, yloc, zloc) );
5725   cableTrayA->AddNode(steelOptConn, 2,
5726                       new TGeoTranslation(-xloc, yloc, zloc) );
5727
5728   yloc += optConnSteel->GetDY() + optConnAl->GetDY();
5729   cableTrayA->AddNode(alOptConn, 1,
5730                       new TGeoTranslation( xloc, yloc, zloc) );
5731   cableTrayA->AddNode(alOptConn, 2,
5732                       new TGeoTranslation(-xloc, yloc, zloc) );
5733
5734
5735   xloc = kSideACoolTubesWide/2 + kSideAOptFibsWide/2;
5736   cableTrayA->AddNode(optFibs,1,
5737                       new TGeoCombiTrans( xloc, 0, 0,
5738                       new TGeoRotation("",-90, 90, 90)        ) );
5739   cableTrayA->AddNode(optFibs,2,
5740                       new TGeoCombiTrans(-xloc, 0, 0,
5741                       new TGeoRotation("",-90, 90, 90)        ) );
5742
5743   yloc = kForwardTrayTotalHeight - forwardCover->GetY(3) -
5744          kSideAInputCablesYTrans - inputCabsPOLYAX->GetDY();
5745   zloc = inputCabsPOLYAX->GetDZ();
5746   cableTrayA->AddNode(polyaxInputCabs, 1,
5747                       new TGeoTranslation( 0, yloc, zloc) );
5748
5749   yloc -= (inputCabsPOLYAX->GetDY() + inputCabsKapton->GetDY());
5750   cableTrayA->AddNode(kaptonInputCabs, 1,
5751                       new TGeoTranslation( 0, yloc, zloc) );
5752
5753   yloc -= (inputCabsKapton->GetDY() + inputCabsAl->GetDY());
5754   cableTrayA->AddNode(alInputCabs, 1,
5755                       new TGeoTranslation( 0, yloc, zloc) );
5756
5757   yloc -= (inputCabsAl->GetDY() + inputCabsPlast->GetDY());
5758   cableTrayA->AddNode(plastInputCabs, 1,
5759                       new TGeoTranslation( 0, yloc, zloc) );
5760
5761   yloc -= (inputCabsPlast->GetDY() + inputCabsCu->GetDY());
5762   cableTrayA->AddNode(cuInputCabs, 1,
5763                       new TGeoTranslation( 0, yloc, zloc) );
5764
5765   yloc -= (inputCabsCu->GetDY()+pcbBoardsPPS->GetDY()+kSideAPCBBoardsYTrans);
5766   zloc += pcbBoardsPPS->GetDZ();
5767   cableTrayA->AddNode(ppsPCBBoards, 1,
5768                       new TGeoTranslation( 0, yloc, zloc) );
5769
5770   yloc -= (pcbBoardsPPS->GetDY()+pcbBoardsSteel->GetDY());
5771   cableTrayA->AddNode(steelPCBBoards, 1,
5772                       new TGeoTranslation( 0, yloc, zloc) );
5773
5774   yloc -= (pcbBoardsSteel->GetDY()+pcbBoardsPlast->GetDY());
5775   cableTrayA->AddNode(plastPCBBoards, 1,
5776                       new TGeoTranslation( 0, yloc, zloc) );
5777
5778   yloc -= (pcbBoardsPlast->GetDY()+pcbBoardsEpoxy->GetDY());
5779   cableTrayA->AddNode(epoxyPCBBoards, 1,
5780                       new TGeoTranslation( 0, yloc, zloc) );
5781
5782   yloc -= (pcbBoardsEpoxy->GetDY()+pcbBoardsCu->GetDY());
5783   cableTrayA->AddNode(cuPCBBoards, 1,
5784                       new TGeoTranslation( 0, yloc, zloc) );
5785
5786   cableTrayA->AddNode(cuOutputCabs,1,
5787                       new TGeoCombiTrans( 0, 0, 0,
5788                       new TGeoRotation("",-90, 90, 90)        ) );
5789   cableTrayA->AddNode(plastOutputCabs,1,
5790                       new TGeoCombiTrans( 0, 0, 0,
5791                       new TGeoRotation("",-90, 90, 90)        ) );
5792   cableTrayA->AddNode(alOutputCabs,1,
5793                       new TGeoCombiTrans( 0, 0, 0,
5794                       new TGeoRotation("",-90, 90, 90)        ) );
5795   cableTrayA->AddNode(kaptonOutputCabs,1,
5796                       new TGeoCombiTrans( 0, 0, 0,
5797                       new TGeoRotation("",-90, 90, 90)        ) );
5798   cableTrayA->AddNode(polyaxOutputCabs,1,
5799                       new TGeoCombiTrans( 0, 0, 0,
5800                       new TGeoRotation("",-90, 90, 90)        ) );
5801
5802
5803   // Finally put everything in the mother volume
5804   Double_t rforw = kTrayARTrans + kExternTrayTotalHeight +
5805                    kExternCoverSideThick -
5806                    kForwardTrayTailHeight;
5807
5808   alpharot = -kTrayAFirstRotAng;
5809   xloc = rforw*SinD(alpharot);
5810   yloc = rforw*CosD(alpharot);
5811   zloc = kTrayAZTrans + kTrayAZToSupportRing - kForwardTrayUpperLength;
5812
5813   moth->AddNode(cableTrayA,1,
5814                             new TGeoCombiTrans( xloc, yloc, zloc,
5815                             new TGeoRotation("",-alpharot,0,0)   )   );
5816
5817   alpharot += 180;
5818   xloc = rforw*SinD(alpharot);
5819   yloc = rforw*CosD(alpharot);
5820   moth->AddNode(cableTrayA,2,
5821                             new TGeoCombiTrans( xloc, yloc, zloc,
5822                             new TGeoRotation("",-alpharot,0,0)   )   );
5823
5824   alpharot = kTrayAFirstRotAng + 2*kTrayASecondRotAng;
5825   xloc = rforw*SinD(alpharot);
5826   yloc = rforw*CosD(alpharot);
5827   moth->AddNode(cableTrayA,3,
5828                             new TGeoCombiTrans( xloc, yloc, zloc,
5829                             new TGeoRotation("",-alpharot,0,0)   )   );
5830
5831   alpharot += 180;
5832   xloc = rforw*SinD(alpharot);
5833   yloc = rforw*CosD(alpharot);
5834   moth->AddNode(cableTrayA,4,
5835                             new TGeoCombiTrans( xloc, yloc, zloc,
5836                             new TGeoRotation("",-alpharot,0,0)   )   );
5837
5838
5839   return;
5840 }
5841
5842 //______________________________________________________________________
5843 void AliITSv11GeometrySupport::SDDCableTraysSideC(TGeoVolume *moth,
5844                                             const TGeoManager *mgr){
5845 //
5846 // Creates the SDD cable trays which are outside the ITS support cones
5847 // but still inside the TPC on Side C
5848 // (part of this code is taken or anyway inspired to ServicesCableSupport
5849 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
5850 //
5851 // Input:
5852 //         moth : the TGeoVolume owing the volume structure
5853 //         mgr  : the GeoManager (default gGeoManager)
5854 // Output:
5855 //
5856 // Created:         ???       Bjorn S. Nilsen
5857 // Updated:      17 Apr 2010  Mario Sitta
5858 //
5859 // Technical data are taken from AutoCAD drawings and other (oral)
5860 // information given by F.Tosello
5861 //
5862
5863   // Dimensions and positions of the C-Side Cable Tray
5864   // (Change accordingly to CreateSDDSSDTraysSideC !)
5865   const Int_t    kNumTraySideC           =    4;
5866
5867   const Double_t kSideCHalfThick         =    0.100   *fgkcm;
5868   const Double_t kSideCLength1           =  172.800   *fgkcm;
5869   const Double_t kSideCLength2           =  189.300   *fgkcm;
5870   const Double_t kBarCoolRmax            =    0.4     *fgkcm;
5871   const Double_t kXShiftBarCool          =   13.00    *fgkcm;
5872
5873   const Double_t kSideCFoldAngle         =    5.00 *fgkDegree;
5874
5875   // Dimensions and positions of the Cable Tray elements
5876   const Double_t kSideCCoolManifHalfX    =    4.25    *fgkcm;
5877   const Double_t kSideCCoolManifHalfY    =    4.03    *fgkcm;
5878   const Double_t kSideCCoolManifHalfZ    =    2.17    *fgkcm;
5879   const Double_t kSideCCoolManifPOMFrac  =    0.0051;
5880   const Double_t kSideCCoolManifSteelFrac=    0.8502;
5881   const Double_t kSideCCoolManifWaterFrac=    0.0868;
5882   const Double_t kSideCCoolManifAlFrac   =    0.0579;
5883
5884   const Double_t kSideCCoolTubesHigh     =    1.88    *fgkcm;
5885   const Double_t kSideCCoolTubesTrans    =    0.85    *fgkcm;
5886   const Double_t kSideCCoolTubesPURFrac  =    0.5884;
5887   const Double_t kSideCCoolTubesWaterFrac=    0.4114;
5888   const Double_t kSideCCoolTubesAirFrac  =    0.0002;
5889
5890   const Double_t kSideCOptConnHalfX      =    0.90    *fgkcm;
5891   const Double_t kSideCOptConnHalfZ      =    1.37    *fgkcm;
5892   const Double_t kSideCOptConnPBTFrac    =    0.6798;
5893   const Double_t kSideCOptConnSteelFrac  =    0.2421;
5894   const Double_t kSideCOptConnAlFrac     =    0.0781;
5895
5896   const Double_t kSideCOptFibsWide       =    0.71    *fgkcm;
5897   const Double_t kSideCOptFibsHigh       =    3.20    *fgkcm;
5898   const Double_t kSideCOptFibsTrans      =    0.20    *fgkcm;
5899
5900   const Double_t kSideCInputCablesLen    =   31.45    *fgkcm;
5901   const Double_t kSideCInputCablesWide   =   12.50    *fgkcm;
5902   const Double_t kSideCInputCablesHigh   =    0.95    *fgkcm;
5903   const Double_t kSideCInputCablesTrans  =    1.15    *fgkcm;
5904   const Double_t kSideCInputCablesCu     =    0.7405;
5905   const Double_t kSideCInputCablesPlast  =    0.1268;
5906   const Double_t kSideCInputCablesAl     =    0.0057;
5907   const Double_t kSideCInputCablesKapton =    0.0172;
5908   const Double_t kSideCInputCablesPOLYAX =    0.1098;
5909
5910   const Double_t kSideCOutputCablesX0    =   27.40    *fgkcm;
5911   const Double_t kSideCOutputCablesWide  =    8.50    *fgkcm;
5912   const Double_t kSideCOutputCablesHigh  =    1.18    *fgkcm;
5913   const Double_t kSideCOutputCablesCu    =    0.6775;
5914   const Double_t kSideCOutputCablesPlast =    0.1613;
5915   const Double_t kSideCOutputCablesAl    =    0.0078;
5916   const Double_t kSideCOutputCablesKapton=    0.0234;
5917   const Double_t kSideCOutputCablesPOLYAX=    0.1300;
5918
5919   const Double_t kSideCPCBBoardsHalfX    =    6.30    *fgkcm;
5920   const Double_t kSideCPCBBoardsHalfY    =    2.00    *fgkcm;
5921   const Double_t kSideCPCBBoardsHalfZ    =   21.93    *fgkcm;
5922   const Double_t kSideCPCBBoardsCu       =    0.3864;
5923   const Double_t kSideCPCBBoardsEpoxy    =    0.1491;
5924   const Double_t kSideCPCBBoardsPlast    =    0.0579;
5925   const Double_t kSideCPCBBoardsSteel    =    0.1517;
5926   const Double_t kSideCPCBBoardsPPS      =    0.2549;
5927
5928   // Overall position and rotation of the C-Side Cable Trays
5929   const Double_t kTraySideCRPos          =   45.30    *fgkcm;
5930   const Double_t kTraySideCZPos          = -102.40    *fgkcm;
5931   const Double_t kTraySideCAlphaRot[kNumTraySideC]  = {    -23.0,      59.0,
5932     /* from SSD tray position */                       180.-23.0, 180.+59.0};
5933
5934
5935   // Local variables
5936   Double_t xprof[6], yprof[6];
5937   Double_t height, xloc, yloc, zloc, alpharot, alphafold;
5938
5939
5940   // The assembly holding the metallic structure
5941   TGeoVolumeAssembly *trayStructure = CreateSDDSSDTraysSideC("ITSsupportSDDTrayC");
5942
5943   // Now the volumes inside it
5944   // The cooling manifold: four boxes
5945   // (X and Z are inverted on tray reference system)
5946   TGeoBBox *coolManifPOM = new TGeoBBox(kSideCCoolManifHalfZ,
5947                  kSideCCoolManifPOMFrac*kSideCCoolManifHalfY,
5948                                         kSideCCoolManifHalfX);
5949
5950   TGeoBBox *coolManifSteel = new TGeoBBox(kSideCCoolManifHalfZ,
5951                  kSideCCoolManifSteelFrac*kSideCCoolManifHalfY,
5952                                           kSideCCoolManifHalfX);
5953
5954   TGeoBBox *coolManifWater = new TGeoBBox(kSideCCoolManifHalfZ,
5955                  kSideCCoolManifWaterFrac*kSideCCoolManifHalfY,
5956                                           kSideCCoolManifHalfX);
5957
5958   TGeoBBox *coolManifAl = new TGeoBBox(kSideCCoolManifHalfZ,
5959                  kSideCCoolManifAlFrac*kSideCCoolManifHalfY,
5960                                        kSideCCoolManifHalfX);
5961
5962   // The cooling tubes: three Xtru's
5963   alpharot = kSideCFoldAngle*TMath::DegToRad();
5964
5965   TGeoXtru *coolTubesPUR = new TGeoXtru(2);
5966
5967   height = kSideCCoolTubesHigh*kSideCCoolTubesPURFrac;
5968
5969   xprof[0] = 2*kSideCCoolManifHalfZ;
5970   yprof[0] = 2*kSideCHalfThick + kSideCCoolTubesTrans;
5971   xprof[1] = kSideCLength1;
5972   yprof[1] = yprof[0];
5973   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(alpharot);
5974   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(alpharot);
5975   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
5976   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
5977   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5978               height, xprof[4], yprof[4]);
5979   xprof[5] = xprof[0];
5980   yprof[5] = yprof[0] + height;
5981
5982   coolTubesPUR->DefinePolygon(6, xprof, yprof);
5983   coolTubesPUR->DefineSection(0,-kSideCCoolManifHalfX);
5984   coolTubesPUR->DefineSection(1, kSideCCoolManifHalfX);
5985
5986   TGeoXtru *coolTubesWater = new TGeoXtru(2);
5987
5988   height = kSideCCoolTubesHigh*kSideCCoolTubesWaterFrac;
5989
5990   xprof[0] = coolTubesPUR->GetX(5);
5991   yprof[0] = coolTubesPUR->GetY(5);
5992   xprof[1] = coolTubesPUR->GetX(4);
5993   yprof[1] = coolTubesPUR->GetY(4);
5994   xprof[2] = coolTubesPUR->GetX(3);
5995   yprof[2] = coolTubesPUR->GetY(3);
5996   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
5997   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
5998   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5999               height, xprof[4], yprof[4]);
6000   xprof[5] = xprof[0];
6001   yprof[5] = yprof[0] + height;
6002
6003   coolTubesWater->DefinePolygon(6, xprof, yprof);
6004   coolTubesWater->DefineSection(0,-kSideCCoolManifHalfX);
6005   coolTubesWater->DefineSection(1, kSideCCoolManifHalfX);
6006
6007   TGeoXtru *coolTubesAir = new TGeoXtru(2);
6008
6009   height = kSideCCoolTubesHigh*kSideCCoolTubesAirFrac;
6010
6011   xprof[0] = coolTubesWater->GetX(5);
6012   yprof[0] = coolTubesWater->GetY(5);
6013   xprof[1] = coolTubesWater->GetX(4);
6014   yprof[1] = coolTubesWater->GetY(4);
6015   xprof[2] = coolTubesWater->GetX(3);
6016   yprof[2] = coolTubesWater->GetY(3);
6017   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6018   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6019   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6020               height, xprof[4], yprof[4]);
6021   xprof[5] = xprof[0];
6022   yprof[5] = yprof[0] + height;
6023
6024   coolTubesAir->DefinePolygon(6, xprof, yprof);
6025   coolTubesAir->DefineSection(0,-kSideCCoolManifHalfX);
6026   coolTubesAir->DefineSection(1, kSideCCoolManifHalfX);
6027
6028   // The optical fiber connectors: three boxes
6029   // (X and Z are inverted on tray reference system)
6030   TGeoBBox *optConnPBT = new TGeoBBox(kSideCOptConnHalfZ,
6031                  kSideCOptConnPBTFrac*kSideCCoolManifHalfY,
6032                                       kSideCOptConnHalfX);
6033
6034   TGeoBBox *optConnSteel = new TGeoBBox(kSideCOptConnHalfZ,
6035                  kSideCOptConnSteelFrac*kSideCCoolManifHalfY,
6036                                         kSideCOptConnHalfX);
6037
6038   TGeoBBox *optConnAl = new TGeoBBox(kSideCOptConnHalfZ,
6039                  kSideCOptConnAlFrac*kSideCCoolManifHalfY,
6040                                      kSideCOptConnHalfX);
6041
6042   // The optical fibers: a Xtru
6043   TGeoXtru *opticalFibs = new TGeoXtru(2);
6044
6045   xprof[0] = 2*kSideCOptConnHalfZ;
6046   yprof[0] = 2*kSideCHalfThick + kSideCOptFibsTrans;
6047   xprof[1] = kSideCLength1;
6048   yprof[1] = yprof[0];
6049   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(alpharot);
6050   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(alpharot);
6051   xprof[3] = xprof[2] - kSideCOptFibsHigh*TMath::Sin(alpharot);
6052   yprof[3] = yprof[2] + kSideCOptFibsHigh*TMath::Cos(alpharot);
6053   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6054               kSideCOptFibsHigh, xprof[4], yprof[4]);
6055   xprof[5] = xprof[0];
6056   yprof[5] = yprof[0] + kSideCOptFibsHigh;
6057
6058   opticalFibs->DefinePolygon(6, xprof, yprof);
6059   opticalFibs->DefineSection(0,-kSideCOptFibsWide/2);
6060   opticalFibs->DefineSection(1, kSideCOptFibsWide/2);
6061
6062   // The input cables: five boxes
6063   // (X and Z are inverted on tray reference system)
6064   TGeoBBox *inputCabsCu = new TGeoBBox(kSideCInputCablesLen/2,
6065                    kSideCInputCablesCu*kSideCInputCablesHigh/2,
6066                                        kSideCInputCablesWide/2);
6067
6068   TGeoBBox *inputCabsPlast = new TGeoBBox(kSideCInputCablesLen/2,
6069                    kSideCInputCablesPlast*kSideCInputCablesHigh/2,
6070                                           kSideCInputCablesWide/2);
6071
6072   TGeoBBox *inputCabsAl = new TGeoBBox(kSideCInputCablesLen/2,
6073                    kSideCInputCablesAl*kSideCInputCablesHigh/2,
6074                                        kSideCInputCablesWide/2);
6075
6076   TGeoBBox *inputCabsKapton = new TGeoBBox(kSideCInputCablesLen/2,
6077                    kSideCInputCablesKapton*kSideCInputCablesHigh/2,
6078                                            kSideCInputCablesWide/2);
6079
6080   TGeoBBox *inputCabsPOLYAX = new TGeoBBox(kSideCInputCablesLen/2,
6081                    kSideCInputCablesPOLYAX*kSideCInputCablesHigh/2,
6082                                            kSideCInputCablesWide/2);
6083
6084   // The output cables: five Xtru
6085   TGeoXtru *outputCabsCu = new TGeoXtru(2);
6086
6087   height = kSideCOutputCablesCu*kSideCOutputCablesHigh;
6088
6089   xprof[0] = coolTubesAir->GetX(5) + kSideCOutputCablesX0;
6090   yprof[0] = coolTubesAir->GetY(5);
6091   xprof[1] = coolTubesAir->GetX(4);
6092   yprof[1] = coolTubesAir->GetY(4);
6093   xprof[2] = coolTubesAir->GetX(3);
6094   yprof[2] = coolTubesAir->GetY(3);
6095   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6096   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6097   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6098               height, xprof[4], yprof[4]);
6099   xprof[5] = xprof[0];
6100   yprof[5] = yprof[0] + height;
6101
6102   outputCabsCu->DefinePolygon(6, xprof, yprof);
6103   outputCabsCu->DefineSection(0,-kSideCOutputCablesWide/2);
6104   outputCabsCu->DefineSection(1, kSideCOutputCablesWide/2);
6105
6106   TGeoXtru *outputCabsPlast = new TGeoXtru(2);
6107
6108   height = kSideCOutputCablesPlast*kSideCOutputCablesHigh;
6109
6110   xprof[0] = outputCabsCu->GetX(5);
6111   yprof[0] = outputCabsCu->GetY(5);
6112   xprof[1] = outputCabsCu->GetX(4);
6113   yprof[1] = outputCabsCu->GetY(4);
6114   xprof[2] = outputCabsCu->GetX(3);
6115   yprof[2] = outputCabsCu->GetY(3);
6116   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6117   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6118   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6119               height, xprof[4], yprof[4]);
6120   xprof[5] = xprof[0];
6121   yprof[5] = yprof[0] + height;
6122
6123   outputCabsPlast->DefinePolygon(6, xprof, yprof);
6124   outputCabsPlast->DefineSection(0,-kSideCOutputCablesWide/2);
6125   outputCabsPlast->DefineSection(1, kSideCOutputCablesWide/2);
6126
6127   TGeoXtru *outputCabsAl = new TGeoXtru(2);
6128
6129   height = kSideCOutputCablesAl*kSideCOutputCablesHigh;
6130
6131   xprof[0] = outputCabsPlast->GetX(5);
6132   yprof[0] = outputCabsPlast->GetY(5);
6133   xprof[1] = outputCabsPlast->GetX(4);
6134   yprof[1] = outputCabsPlast->GetY(4);
6135   xprof[2] = outputCabsPlast->GetX(3);
6136   yprof[2] = outputCabsPlast->GetY(3);
6137   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6138   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6139   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6140               height, xprof[4], yprof[4]);
6141   xprof[5] = xprof[0];
6142   yprof[5] = yprof[0] + height;
6143
6144   outputCabsAl->DefinePolygon(6, xprof, yprof);
6145   outputCabsAl->DefineSection(0,-kSideCOutputCablesWide/2);
6146   outputCabsAl->DefineSection(1, kSideCOutputCablesWide/2);
6147
6148   TGeoXtru *outputCabsKapton = new TGeoXtru(2);
6149
6150   height = kSideCOutputCablesKapton*kSideCOutputCablesHigh;
6151
6152   xprof[0] = outputCabsAl->GetX(5);
6153   yprof[0] = outputCabsAl->GetY(5);
6154   xprof[1] = outputCabsAl->GetX(4);
6155   yprof[1] = outputCabsAl->GetY(4);
6156   xprof[2] = outputCabsAl->GetX(3);
6157   yprof[2] = outputCabsAl->GetY(3);
6158   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6159   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6160   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6161               height, xprof[4], yprof[4]);
6162   xprof[5] = xprof[0];
6163   yprof[5] = yprof[0] + height;
6164
6165   outputCabsKapton->DefinePolygon(6, xprof, yprof);
6166   outputCabsKapton->DefineSection(0,-kSideCOutputCablesWide/2);
6167   outputCabsKapton->DefineSection(1, kSideCOutputCablesWide/2);
6168
6169   TGeoXtru *outputCabsPOLYAX = new TGeoXtru(2);
6170
6171   height = kSideCOutputCablesPOLYAX*kSideCOutputCablesHigh;
6172
6173   xprof[0] = outputCabsKapton->GetX(5);
6174   yprof[0] = outputCabsKapton->GetY(5);
6175   xprof[1] = outputCabsKapton->GetX(4);
6176   yprof[1] = outputCabsKapton->GetY(4);
6177   xprof[2] = outputCabsKapton->GetX(3);
6178   yprof[2] = outputCabsKapton->GetY(3);
6179   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6180   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6181   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6182               height, xprof[4], yprof[4]);
6183   xprof[5] = xprof[0];
6184   yprof[5] = yprof[0] + height;
6185
6186   outputCabsPOLYAX->DefinePolygon(6, xprof, yprof);
6187   outputCabsPOLYAX->DefineSection(0,-kSideCOutputCablesWide/2);
6188   outputCabsPOLYAX->DefineSection(1, kSideCOutputCablesWide/2);
6189
6190   // The PCB boards: five boxes
6191   // (X and Z are inverted on tray reference system)
6192   TGeoBBox *pcbBoardsCu = new TGeoBBox(kSideCPCBBoardsHalfZ,
6193                      kSideCPCBBoardsCu*kSideCPCBBoardsHalfY,
6194                                        kSideCPCBBoardsHalfX);
6195
6196   TGeoBBox *pcbBoardsEpoxy = new TGeoBBox(kSideCPCBBoardsHalfZ,
6197                      kSideCPCBBoardsEpoxy*kSideCPCBBoardsHalfY,
6198                                           kSideCPCBBoardsHalfX);
6199
6200   TGeoBBox *pcbBoardsPlast = new TGeoBBox(kSideCPCBBoardsHalfZ,
6201                      kSideCPCBBoardsPlast*kSideCPCBBoardsHalfY,
6202                                           kSideCPCBBoardsHalfX);
6203
6204   TGeoBBox *pcbBoardsSteel = new TGeoBBox(kSideCPCBBoardsHalfZ,
6205                      kSideCPCBBoardsSteel*kSideCPCBBoardsHalfY,
6206                                           kSideCPCBBoardsHalfX);
6207
6208   TGeoBBox *pcbBoardsPPS = new TGeoBBox(kSideCPCBBoardsHalfZ,
6209                      kSideCPCBBoardsPPS*kSideCPCBBoardsHalfY,
6210                                         kSideCPCBBoardsHalfX);
6211
6212
6213   // We have all shapes: now create the real volumes
6214   TGeoMedium *medPOM    = mgr->GetMedium("ITS_POLYOXYMETHYLENE$");
6215   TGeoMedium *medSteel  = mgr->GetMedium("ITS_INOX$");
6216   TGeoMedium *medWater  = mgr->GetMedium("ITS_WATER$");
6217   TGeoMedium *medAl     = mgr->GetMedium("ITS_ALUMINUM$");
6218   TGeoMedium *medCu     = mgr->GetMedium("ITS_COPPER$");
6219   TGeoMedium *medPUR    = mgr->GetMedium("ITS_POLYURETHANE$");
6220   TGeoMedium *medPOLYAX = mgr->GetMedium("ITS_POLYAX$");
6221   TGeoMedium *medKapton = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
6222   TGeoMedium *medAir    = mgr->GetMedium("ITS_AIR$");
6223   TGeoMedium *medPBT    = mgr->GetMedium("ITS_PBT$");
6224   TGeoMedium *medOptFib = mgr->GetMedium("ITS_SDD OPTICFIB$");
6225   TGeoMedium *medPPS    = mgr->GetMedium("ITS_PPS$");
6226   TGeoMedium *medEpoxy  = mgr->GetMedium("ITS_EPOXY$");
6227
6228   TGeoVolume *pomCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifPOM",
6229                                             coolManifPOM, medPOM);
6230
6231   pomCoolManif->SetVisibility(kTRUE);
6232   pomCoolManif->SetLineColor(kRed); // Red
6233   pomCoolManif->SetLineWidth(1);
6234   pomCoolManif->SetFillColor(pomCoolManif->GetLineColor());
6235   pomCoolManif->SetFillStyle(4000); // 0% transparent
6236
6237   TGeoVolume *steelCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifSteel",
6238                                               coolManifSteel, medSteel);
6239
6240   steelCoolManif->SetVisibility(kTRUE);
6241   steelCoolManif->SetLineColor(kBlue); // Blue
6242   steelCoolManif->SetLineWidth(1);
6243   steelCoolManif->SetFillColor(steelCoolManif->GetLineColor());
6244   steelCoolManif->SetFillStyle(4000); // 0% transparent
6245
6246   TGeoVolume *waterCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifWater",
6247                                               coolManifWater, medWater);
6248
6249   waterCoolManif->SetVisibility(kTRUE);
6250   waterCoolManif->SetLineColor(33); // Light Blue
6251   waterCoolManif->SetLineWidth(1);
6252   waterCoolManif->SetFillColor(waterCoolManif->GetLineColor());
6253   waterCoolManif->SetFillStyle(4000); // 0% transparent
6254
6255   TGeoVolume *alCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifAl",
6256                                            coolManifAl, medAl);
6257
6258   alCoolManif->SetVisibility(kTRUE);
6259   alCoolManif->SetLineColor(6); // Purple
6260   alCoolManif->SetLineWidth(1);
6261   alCoolManif->SetFillColor(alCoolManif->GetLineColor());
6262   alCoolManif->SetFillStyle(4000); // 0% transparent
6263
6264   TGeoVolume *purCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesPUR",
6265                                             coolTubesPUR, medPUR);
6266
6267   purCoolTubes->SetVisibility(kTRUE);
6268   purCoolTubes->SetLineColor(kRed); // Red
6269   purCoolTubes->SetLineWidth(1);
6270   purCoolTubes->SetFillColor(purCoolTubes->GetLineColor());
6271   purCoolTubes->SetFillStyle(4000); // 0% transparent
6272
6273   TGeoVolume *waterCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesWater",
6274                                               coolTubesWater, medWater);
6275
6276   waterCoolTubes->SetVisibility(kTRUE);
6277   waterCoolTubes->SetLineColor(33); // Light Blue
6278   waterCoolTubes->SetLineWidth(1);
6279   waterCoolTubes->SetFillColor(waterCoolTubes->GetLineColor());
6280   waterCoolTubes->SetFillStyle(4000); // 0% transparent
6281
6282   TGeoVolume *airCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesAir",
6283                                             coolTubesAir, medAir);
6284
6285   airCoolTubes->SetVisibility(kTRUE);
6286   airCoolTubes->SetLineColor(41);
6287   airCoolTubes->SetLineWidth(1);
6288   airCoolTubes->SetFillColor(airCoolTubes->GetLineColor());
6289   airCoolTubes->SetFillStyle(4000); // 0% transparent
6290
6291   TGeoVolume *pbtOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnPBT",
6292                                           optConnPBT, medPBT);
6293
6294   pbtOptConn->SetVisibility(kTRUE);
6295   pbtOptConn->SetLineColor(kRed); // Red
6296   pbtOptConn->SetLineWidth(1);
6297   pbtOptConn->SetFillColor(pbtOptConn->GetLineColor());
6298   pbtOptConn->SetFillStyle(4000); // 0% transparent
6299
6300   TGeoVolume *steelOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnSteel",
6301                                             optConnSteel, medSteel);
6302
6303   steelOptConn->SetVisibility(kTRUE);
6304   steelOptConn->SetLineColor(kBlue); // Blue
6305   steelOptConn->SetLineWidth(1);
6306   steelOptConn->SetFillColor(steelOptConn->GetLineColor());
6307   steelOptConn->SetFillStyle(4000); // 0% transparent
6308
6309   TGeoVolume *alOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnAl",
6310                                          optConnAl, medAl);
6311
6312   alOptConn->SetVisibility(kTRUE);
6313   alOptConn->SetLineColor(6); // Purple
6314   alOptConn->SetLineWidth(1);
6315   alOptConn->SetFillColor(alOptConn->GetLineColor());
6316   alOptConn->SetFillStyle(4000); // 0% transparent
6317
6318   TGeoVolume *optFibs = new TGeoVolume("ITSsuppSDDSideCOptFibs",
6319                                        opticalFibs, medOptFib);
6320
6321   optFibs->SetVisibility(kTRUE);
6322   optFibs->SetLineColor(kOrange+2); // Orange
6323   optFibs->SetLineWidth(1);
6324   optFibs->SetFillColor(optFibs->GetLineColor());
6325   optFibs->SetFillStyle(4000); // 0% transparent
6326
6327   TGeoVolume *cuInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsCu",
6328                                            inputCabsCu, medCu);
6329
6330   cuInputCabs->SetVisibility(kTRUE);
6331   cuInputCabs->SetLineColor(kBlack); // Black
6332   cuInputCabs->SetLineWidth(1);
6333   cuInputCabs->SetFillColor(cuInputCabs->GetLineColor());
6334   cuInputCabs->SetFillStyle(4000); // 0% transparent
6335
6336   TGeoVolume *plastInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsPlast",
6337                                               inputCabsPlast, medPUR);
6338
6339   plastInputCabs->SetVisibility(kTRUE);
6340   plastInputCabs->SetLineColor(kRed); // Red
6341   plastInputCabs->SetLineWidth(1);
6342   plastInputCabs->SetFillColor(plastInputCabs->GetLineColor());
6343   plastInputCabs->SetFillStyle(4000); // 0% transparent
6344
6345   TGeoVolume *alInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsAl",
6346                                            inputCabsAl, medAl);
6347
6348   alInputCabs->SetVisibility(kTRUE);
6349   alInputCabs->SetLineColor(6); // Purple
6350   alInputCabs->SetLineWidth(1);
6351   alInputCabs->SetFillColor(alInputCabs->GetLineColor());
6352   alInputCabs->SetFillStyle(4000); // 0% transparent
6353
6354   TGeoVolume *kaptonInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsKapton",
6355                                                inputCabsKapton, medKapton);
6356
6357   kaptonInputCabs->SetVisibility(kTRUE);
6358   kaptonInputCabs->SetLineColor(14); // 
6359   kaptonInputCabs->SetLineWidth(1);
6360   kaptonInputCabs->SetFillColor(kaptonInputCabs->GetLineColor());
6361   kaptonInputCabs->SetFillStyle(4000); // 0% transparent
6362
6363   TGeoVolume *polyaxInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsPOLYAX",
6364                                                inputCabsPOLYAX, medPOLYAX);
6365
6366   polyaxInputCabs->SetVisibility(kTRUE);
6367   polyaxInputCabs->SetLineColor(34); // 
6368   polyaxInputCabs->SetLineWidth(1);
6369   polyaxInputCabs->SetFillColor(polyaxInputCabs->GetLineColor());
6370   polyaxInputCabs->SetFillStyle(4000); // 0% transparent
6371
6372   TGeoVolume *cuOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsCu",
6373                                             outputCabsCu, medCu);
6374
6375   cuOutputCabs->SetVisibility(kTRUE);
6376   cuOutputCabs->SetLineColor(kBlack); // Black
6377   cuOutputCabs->SetLineWidth(1);
6378   cuOutputCabs->SetFillColor(cuOutputCabs->GetLineColor());
6379   cuOutputCabs->SetFillStyle(4000); // 0% transparent
6380
6381   TGeoVolume *plastOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsPlast",
6382                                                outputCabsPlast, medPUR);
6383
6384   plastOutputCabs->SetVisibility(kTRUE);
6385   plastOutputCabs->SetLineColor(kRed); // Red
6386   plastOutputCabs->SetLineWidth(1);
6387   plastOutputCabs->SetFillColor(plastOutputCabs->GetLineColor());
6388   plastOutputCabs->SetFillStyle(4000); // 0% transparent
6389
6390   TGeoVolume *alOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsAl",
6391                                             outputCabsAl, medAl);
6392
6393   alOutputCabs->SetVisibility(kTRUE);
6394   alOutputCabs->SetLineColor(6); // Purple
6395   alOutputCabs->SetLineWidth(1);
6396   alOutputCabs->SetFillColor(alOutputCabs->GetLineColor());
6397   alOutputCabs->SetFillStyle(4000); // 0% transparent
6398
6399   TGeoVolume *kaptonOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsKapton",
6400                                                 outputCabsKapton, medKapton);
6401
6402   kaptonOutputCabs->SetVisibility(kTRUE);
6403   kaptonOutputCabs->SetLineColor(14); // 
6404   kaptonOutputCabs->SetLineWidth(1);
6405   kaptonOutputCabs->SetFillColor(kaptonOutputCabs->GetLineColor());
6406   kaptonOutputCabs->SetFillStyle(4000); // 0% transparent
6407
6408   TGeoVolume *polyaxOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsPOLYAX",
6409                                                 outputCabsPOLYAX, medPOLYAX);
6410
6411   polyaxOutputCabs->SetVisibility(kTRUE);
6412   polyaxOutputCabs->SetLineColor(34); // 
6413   polyaxOutputCabs->SetLineWidth(1);
6414   polyaxOutputCabs->SetFillColor(polyaxOutputCabs->GetLineColor());
6415   polyaxOutputCabs->SetFillStyle(4000); // 0% transparent
6416
6417   TGeoVolume *cuPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsCu",
6418                                            pcbBoardsCu, medCu);
6419
6420   cuPCBBoards->SetVisibility(kTRUE);
6421   cuPCBBoards->SetLineColor(kBlack); // Black
6422   cuPCBBoards->SetLineWidth(1);
6423   cuPCBBoards->SetFillColor(cuPCBBoards->GetLineColor());
6424   cuPCBBoards->SetFillStyle(4000); // 0% transparent
6425
6426   TGeoVolume *epoxyPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsEpoxy",
6427                                               pcbBoardsEpoxy, medEpoxy);
6428
6429   epoxyPCBBoards->SetVisibility(kTRUE);
6430   epoxyPCBBoards->SetLineColor(22); //
6431   epoxyPCBBoards->SetLineWidth(1);
6432   epoxyPCBBoards->SetFillColor(epoxyPCBBoards->GetLineColor());
6433   epoxyPCBBoards->SetFillStyle(4000); // 0% transparent
6434
6435   TGeoVolume *plastPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsPlast",
6436                                               pcbBoardsPlast, medPUR);
6437
6438   plastPCBBoards->SetVisibility(kTRUE);
6439   plastPCBBoards->SetLineColor(kRed); // Red
6440   plastPCBBoards->SetLineWidth(1);
6441   plastPCBBoards->SetFillColor(plastPCBBoards->GetLineColor());
6442   plastPCBBoards->SetFillStyle(4000); // 0% transparent
6443
6444   TGeoVolume *steelPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsSteel",
6445                                               pcbBoardsSteel, medSteel);
6446
6447   steelPCBBoards->SetVisibility(kTRUE);
6448   steelPCBBoards->SetLineColor(kBlue); // Blue
6449   steelPCBBoards->SetLineWidth(1);
6450   steelPCBBoards->SetFillColor(steelPCBBoards->GetLineColor());
6451   steelPCBBoards->SetFillStyle(4000); // 0% transparent
6452
6453   TGeoVolume *ppsPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsPPS",
6454                                             pcbBoardsPPS, medPPS);
6455
6456   ppsPCBBoards->SetVisibility(kTRUE);
6457   ppsPCBBoards->SetLineColor(kGreen); // Green
6458   ppsPCBBoards->SetLineWidth(1);
6459   ppsPCBBoards->SetFillColor(ppsPCBBoards->GetLineColor());
6460   ppsPCBBoards->SetFillStyle(4000); // 0% transparent
6461
6462
6463   // Now fill the tray
6464   xloc = coolManifPOM->GetDX();
6465   yloc = 2*kSideCHalfThick + coolManifPOM->GetDY();
6466   trayStructure->AddNode(pomCoolManif, 1,
6467                          new TGeoTranslation( xloc, yloc, 0) );
6468
6469   yloc += coolManifPOM->GetDY() + coolManifSteel->GetDY();
6470   trayStructure->AddNode(steelCoolManif, 1,
6471                          new TGeoTranslation( xloc, yloc, 0) );
6472
6473   yloc += coolManifSteel->GetDY() + coolManifWater->GetDY();
6474   trayStructure->AddNode(waterCoolManif, 1,
6475                          new TGeoTranslation( xloc, yloc, 0) );
6476
6477   yloc += coolManifWater->GetDY() + coolManifAl->GetDY();
6478   trayStructure->AddNode(alCoolManif, 1,
6479                          new TGeoTranslation( xloc, yloc, 0) );
6480
6481   xloc = inputCabsCu->GetDX();
6482   yloc += coolManifWater->GetDY() + inputCabsCu->GetDY()
6483         + kSideCInputCablesTrans;
6484   trayStructure->AddNode(cuInputCabs, 1,
6485                          new TGeoTranslation( xloc, yloc, 0) );
6486
6487   yloc += inputCabsCu->GetDY() + inputCabsPlast->GetDY();
6488   trayStructure->AddNode(plastInputCabs, 1,
6489                          new TGeoTranslation( xloc, yloc, 0) );
6490
6491   yloc += inputCabsPlast->GetDY() + inputCabsAl->GetDY();
6492   trayStructure->AddNode(alInputCabs, 1,
6493                          new TGeoTranslation( xloc, yloc, 0) );
6494
6495   yloc += inputCabsAl->GetDY() + inputCabsKapton->GetDY();
6496   trayStructure->AddNode(kaptonInputCabs, 1,
6497                          new TGeoTranslation( xloc, yloc, 0) );
6498
6499   yloc += inputCabsKapton->GetDY() + inputCabsPOLYAX->GetDY();
6500   trayStructure->AddNode(polyaxInputCabs, 1,
6501                          new TGeoTranslation( xloc, yloc, 0) );
6502
6503   trayStructure->AddNode(purCoolTubes  , 1, 0);
6504   trayStructure->AddNode(waterCoolTubes, 1, 0);
6505   trayStructure->AddNode(airCoolTubes  , 1, 0);
6506
6507   xloc = optConnPBT->GetDX();
6508   yloc = 2*kSideCHalfThick + optConnPBT->GetDY();
6509   zloc = coolManifPOM->GetDZ() + optConnPBT->GetDZ();
6510   trayStructure->AddNode(pbtOptConn, 1,
6511                          new TGeoTranslation( xloc, yloc, zloc) );
6512   trayStructure->AddNode(pbtOptConn, 2,
6513                          new TGeoTranslation( xloc, yloc,-zloc) );
6514
6515   yloc += optConnPBT->GetDY() + optConnSteel->GetDY();
6516   trayStructure->AddNode(steelOptConn, 1,
6517                          new TGeoTranslation( xloc, yloc, zloc) );
6518   trayStructure->AddNode(steelOptConn, 2,
6519                          new TGeoTranslation( xloc, yloc,-zloc) );
6520
6521   yloc += optConnSteel->GetDY() + optConnAl->GetDY();
6522   trayStructure->AddNode(alOptConn, 1,
6523                          new TGeoTranslation( xloc, yloc, zloc) );
6524   trayStructure->AddNode(alOptConn, 2,
6525                          new TGeoTranslation( xloc, yloc,-zloc) );
6526
6527   trayStructure->AddNode(optFibs, 1,
6528                          new TGeoTranslation( 0, 0, zloc) );
6529   trayStructure->AddNode(optFibs, 2,
6530                          new TGeoTranslation( 0, 0,-zloc) );
6531
6532   trayStructure->AddNode(cuOutputCabs    , 1, 0);
6533   trayStructure->AddNode(plastOutputCabs , 1, 0);
6534   trayStructure->AddNode(alOutputCabs    , 1, 0);
6535   trayStructure->AddNode(kaptonOutputCabs, 1, 0);
6536   trayStructure->AddNode(polyaxOutputCabs, 1, 0);
6537
6538   xloc = kXShiftBarCool + kBarCoolRmax + pcbBoardsCu->GetDX();
6539   yloc = outputCabsPOLYAX->GetY(5) + pcbBoardsCu->GetDY();
6540   trayStructure->AddNode(cuPCBBoards, 1,
6541                          new TGeoTranslation( xloc, yloc , 0) );
6542
6543   yloc += pcbBoardsCu->GetDY() + pcbBoardsEpoxy->GetDY();
6544   trayStructure->AddNode(epoxyPCBBoards, 1,
6545                          new TGeoTranslation( xloc, yloc , 0) );
6546
6547   yloc += pcbBoardsEpoxy->GetDY() + pcbBoardsPlast->GetDY();
6548   trayStructure->AddNode(plastPCBBoards, 1,
6549                          new TGeoTranslation( xloc, yloc , 0) );
6550
6551   yloc += pcbBoardsPlast->GetDY() + pcbBoardsSteel->GetDY();
6552   trayStructure->AddNode(steelPCBBoards, 1,
6553                          new TGeoTranslation( xloc, yloc , 0) );
6554
6555   yloc += pcbBoardsSteel->GetDY() + pcbBoardsPPS->GetDY();
6556   trayStructure->AddNode(ppsPCBBoards, 1,
6557                          new TGeoTranslation( xloc, yloc , 0) );
6558
6559
6560   // Finally put everything in the mother volume
6561   alphafold = kSideCFoldAngle;
6562
6563   for (Int_t jt = 0; jt < kNumTraySideC; jt++) {
6564     alpharot = kTraySideCAlphaRot[jt];
6565     xloc = kTraySideCRPos*SinD(alpharot);
6566     yloc = kTraySideCRPos*CosD(alpharot);
6567     moth->AddNode(trayStructure,jt+1,
6568                        new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
6569                        new TGeoRotation("",-90.+alpharot,-90.,90.+alphafold)));
6570   }
6571
6572
6573   return;
6574 }
6575
6576
6577 //______________________________________________________________________
6578 void AliITSv11GeometrySupport::SSDCableTraysSideA(TGeoVolume *moth,
6579                                             const TGeoManager *mgr){
6580 //
6581 // Creates the SSD cable trays which are outside the ITS support cones
6582 // but still inside the TPC on Side A
6583 // (part of this code is taken or anyway inspired to ServicesCableSupport
6584 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
6585 //
6586 // Input:
6587 //         moth : the TGeoVolume owing the volume structure
6588 //         mgr  : the GeoManager (default gGeoManager)
6589 // Output:
6590 //
6591 // Created:         ???       Bjorn S. Nilsen
6592 // Updated:      30 Dec 2009  Mario Sitta
6593 //
6594 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
6595 // drawings and other (oral) information given by F.Tosello and
6596 // Ton van den Brink
6597 // Cables and cooling tubes are approximated with proper materials and
6598 // rectangular cross sections, always preserving the total material budget.
6599 //
6600
6601   // Dimensions and positions of the A-Side Cable Trays
6602   // (parts of 0872/G/D)
6603   const Double_t kTrayARTrans            =  408.35 *fgkmm;
6604   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
6605   const Double_t kForwardSideYTrans      =   12.00 *fgkmm;//!!!TO BE CHECKED!!!
6606   const Double_t kCoversYTrans           =    2.00 *fgkmm;
6607   const Double_t kTrayAZRot              = (180-169.5);// Degrees
6608   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
6609   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
6610
6611   const Double_t kTrayTotalHeight        =   52.00 *fgkmm;
6612   const Double_t kTrayHeighToBend        =   32.00 *fgkmm;
6613   const Double_t kTrayWidth              =  130.00 *fgkmm;
6614   const Double_t kTrayThick              =    2.00 *fgkmm;
6615
6616   const Double_t kTrayBendAngle          =   22.00 *TMath::DegToRad();
6617
6618   const Double_t kForwardTrayTotalLen    =  853.00 *fgkmm;
6619   const Double_t kForwardTrayFirstLen    =  350.00 *fgkmm;
6620   const Double_t kForwardTrayFirstHeight =   47.00 *fgkmm;
6621   const Double_t kForwardCoverLen        =  420.00 *fgkmm;
6622
6623   const Double_t kForwardSideLength      = kForwardTrayFirstLen;//!!!TO BE CHECKED!!!
6624   const Double_t kForwardSideHeight      =   90.00 *fgkmm;//!!!TO BE CHECKED!!!
6625   const Double_t kForwardSideThick       =    1.00 *fgkmm;//!!!TO BE CHECKED!!!
6626   const Double_t kForwardCoverHeight     =   10.00 *fgkmm;//!!!TO BE CHECKED!!!
6627
6628   const Double_t kExternalTrayTotalLen   = 1200.00 *fgkmm;
6629   const Double_t kExternalCoverLen       = kExternalTrayTotalLen;
6630   const Double_t kExternalCoverThick     =    5.00 *fgkmm;
6631
6632   const Int_t    kForwardTrayNpoints     =   16;
6633
6634   const Double_t kServicesWidth          =  100.00 *fgkmm;
6635   const Double_t kCopperHeight           =   11.20 *fgkmm;// 1120 mm^2
6636   const Double_t kCablePlasticHeight     =   11.50 *fgkmm;// 1150 mm^2
6637   const Double_t kCoolingWaterHeight     =    2.65 *fgkmm;//  265 mm^2
6638   const Double_t kPoliUrethaneHeight     =    4.62 *fgkmm;//  462 mm^2
6639
6640
6641   // Local variables
6642   Double_t xprof[kForwardTrayNpoints], yprof[kForwardTrayNpoints];
6643   Double_t xloc, yloc, zloc, alpharot, totalhi;
6644
6645
6646   // The two tray components as assemblies
6647   TGeoVolumeAssembly *cableTrayAForw =
6648     new TGeoVolumeAssembly("ITSsupportSSDTrayAForw");
6649   TGeoVolumeAssembly *cableTrayAExt =
6650     new TGeoVolumeAssembly("ITSsupportSSDTrayAExt");
6651   
6652
6653   // First create all needed shapes
6654
6655   // The first part of the forward tray (part of 0872/G/D/07): a Xtru
6656   TGeoXtru *forwTrayPart1 = new TGeoXtru(2);
6657
6658   xprof[3] = kTrayWidth/2;
6659   yprof[3] = kForwardTrayFirstHeight;
6660   xprof[2] = xprof[3] - kTrayThick;
6661   yprof[2] = yprof[3];
6662   xprof[4] = xprof[3];
6663   yprof[4] = kTrayTotalHeight - kTrayHeighToBend;
6664   xprof[5] = xprof[4] - yprof[4]*TMath::Tan(kTrayBendAngle);
6665   yprof[5] = 0;
6666
6667   InsidePoint( xprof[3], yprof[3], xprof[4], yprof[4], xprof[5], yprof[5],
6668               -kTrayThick, xprof[1], yprof[1]);
6669
6670   xprof[6] = -xprof[5];
6671   yprof[6] =  yprof[5];
6672
6673   InsidePoint( xprof[4], yprof[4], xprof[5], yprof[5], xprof[6], yprof[6],
6674               -kTrayThick, xprof[0], yprof[0]);
6675
6676   // We did the right side, now reflex on the left side
6677   for (Int_t jp = 0; jp < 6; jp++) {
6678     xprof[6+jp] = -xprof[5-jp];
6679     yprof[6+jp] =  yprof[5-jp];
6680   }
6681
6682   // And now the actual Xtru
6683   forwTrayPart1->DefinePolygon(12, xprof, yprof);
6684   forwTrayPart1->DefineSection(0, 0);
6685   forwTrayPart1->DefineSection(1, kForwardTrayFirstLen);
6686
6687   // The second part of the forward tray (part of 0872/G/D/07): a Xtru
6688   TGeoXtru *forwTrayPart2 =
6689     CreateSDDSSDTraysSideA(kForwardTrayTotalLen - kForwardTrayFirstLen,
6690                            kTrayTotalHeight);
6691
6692   // The external tray (as 0872/G/D/03): a Xtru with same profile
6693   TGeoXtru *externalTray = CreateSDDSSDTraysSideA(kExternalTrayTotalLen,
6694                                                   kTrayTotalHeight);
6695
6696   // The side wall of the forward tray: a BBox
6697   TGeoBBox *forwSide = new TGeoBBox(kForwardSideThick/2,
6698                                     kForwardSideHeight/2,
6699                                     kForwardSideLength/2);
6700
6701   // The side cover over the walls: a Xtru
6702   TGeoXtru *forwSideCover = new TGeoXtru(2);
6703   forwSideCover->SetName("ITSsuppSSDForwCover");
6704
6705   xprof[0] = kTrayWidth/2 + 2*kForwardSideThick;
6706   yprof[0] = kForwardCoverHeight;
6707   xprof[1] = xprof[0];
6708   yprof[1] = 0;
6709   xprof[2] = xprof[1] - kForwardSideThick;
6710   yprof[2] = yprof[1];
6711   xprof[3] = xprof[2];
6712   yprof[3] = yprof[0] - kForwardSideThick;
6713
6714   // We did the right side, now reflex on the left side
6715   for (Int_t jp = 0; jp < 4; jp++) {
6716     xprof[4+jp] = -xprof[3-jp];
6717     yprof[4+jp] =  yprof[3-jp];
6718   }
6719
6720   forwSideCover->DefinePolygon(8, xprof, yprof);
6721   forwSideCover->DefineSection(0, 0);
6722   forwSideCover->DefineSection(1, kForwardSideLength);
6723
6724   // The forward and external covers: two Composite Shape's
6725   TGeoCompositeShape *forwardCover = CreateTrayAForwardCover(kForwardCoverLen);
6726
6727   TGeoCompositeShape *externCover = CreateTrayAExternalCover(kExternalCoverLen);
6728
6729   // The cable copper inside the forward tray: a BBox
6730   TGeoBBox *forwCopper = new TGeoBBox(kServicesWidth/2,
6731                                       kCopperHeight/2,
6732                                       kForwardTrayTotalLen/2);
6733
6734   // The cable copper inside the forward tray: a Xtru
6735   TGeoXtru *extCopper = new TGeoXtru(2);
6736   extCopper->SetName("ITSsuppSSDExtTrayCopper");
6737
6738   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
6739           - kTrayThick;
6740
6741   xprof[0] = -totalhi*TanD(kTrayAZRot);
6742   yprof[0] = kTrayThick;
6743   xprof[1] = kExternalTrayTotalLen;
6744   yprof[1] = yprof[0];
6745   xprof[2] = xprof[1];
6746   yprof[2] = yprof[1] + kCopperHeight;
6747   totalhi -= kCopperHeight;
6748   xprof[3] = -totalhi*TanD(kTrayAZRot);
6749   yprof[3] = yprof[2];
6750
6751   extCopper->DefinePolygon(4, xprof, yprof);
6752   extCopper->DefineSection(0, 0);
6753   extCopper->DefineSection(1, kServicesWidth);
6754
6755   // The cable plastic inside the forward tray: a BBox
6756   TGeoBBox *forwPlastic = new TGeoBBox(kServicesWidth/2,
6757                                        kCablePlasticHeight/2,
6758                                        kForwardTrayTotalLen/2);
6759
6760   // The cable plastic inside the forward tray: a Xtru
6761   TGeoXtru *extPlastic = new TGeoXtru(2);
6762   extPlastic->SetName("ITSsuppSSDExtTrayPlastic");
6763
6764   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
6765           - kTrayThick - kCopperHeight;
6766
6767   xprof[0] = -totalhi*TanD(kTrayAZRot);
6768   yprof[0] = kTrayThick;
6769   xprof[1] = kExternalTrayTotalLen;
6770   yprof[1] = yprof[0];
6771   xprof[2] = xprof[1];
6772   yprof[2] = yprof[1] + kCablePlasticHeight;
6773   totalhi -= kCablePlasticHeight;
6774   xprof[3] = -totalhi*TanD(kTrayAZRot);
6775   yprof[3] = yprof[2];
6776
6777   extPlastic->DefinePolygon(4, xprof, yprof);
6778   extPlastic->DefineSection(0, 0);
6779   extPlastic->DefineSection(1, kServicesWidth);
6780
6781   // The cooling water inside the forward tray: a BBox
6782   TGeoBBox *forwWater = new TGeoBBox(kServicesWidth/2,
6783                                      kCoolingWaterHeight/2,
6784                                      kForwardTrayTotalLen/2);
6785
6786   // The cooling water inside the forward tray: a Xtru
6787   TGeoXtru *extWater = new TGeoXtru(2);
6788   extWater->SetName("ITSsuppSSDExtTrayWater");
6789
6790   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
6791           - kTrayThick - kCopperHeight - kCablePlasticHeight;
6792
6793   xprof[0] = -totalhi*TanD(kTrayAZRot);
6794   yprof[0] = kTrayThick;
6795   xprof[1] = kExternalTrayTotalLen;
6796   yprof[1] = yprof[0];
6797   xprof[2] = xprof[1];
6798   yprof[2] = yprof[1] + kCoolingWaterHeight;
6799   totalhi -= kCoolingWaterHeight;
6800   xprof[3] = -totalhi*TanD(kTrayAZRot);
6801   yprof[3] = yprof[2];
6802
6803   extWater->DefinePolygon(4, xprof, yprof);
6804   extWater->DefineSection(0, 0);
6805   extWater->DefineSection(1, kServicesWidth);
6806
6807   // The polyurethane inside the forward tray: a BBox
6808   TGeoBBox *forwPUR = new TGeoBBox(kServicesWidth/2,
6809                                    kPoliUrethaneHeight/2,
6810                                    kForwardTrayTotalLen/2);
6811
6812   // The poliurethane inside the forward tray: a Xtru
6813   TGeoXtru *extPUR = new TGeoXtru(2);
6814   extPUR->SetName("ITSsuppSSDExtTrayPUR");
6815
6816   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
6817           - kTrayThick - kCopperHeight - kCablePlasticHeight
6818           - kCoolingWaterHeight;
6819
6820   xprof[0] = -totalhi*TanD(kTrayAZRot);
6821   yprof[0] = kTrayThick;
6822   xprof[1] = kExternalTrayTotalLen;
6823   yprof[1] = yprof[0];
6824   xprof[2] = xprof[1];
6825   yprof[2] = yprof[1] + kPoliUrethaneHeight;
6826   totalhi -= kPoliUrethaneHeight;
6827   xprof[3] = -totalhi*TanD(kTrayAZRot);
6828   yprof[3] = yprof[2];
6829
6830   extPUR->DefinePolygon(4, xprof, yprof);
6831   extPUR->DefineSection(0, 0);
6832   extPUR->DefineSection(1, kServicesWidth);
6833
6834
6835   // We have all shapes: now create the real volumes
6836   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
6837   TGeoMedium *medAntic = mgr->GetMedium("ITS_ANTICORODAL$");
6838   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
6839   TGeoMedium *medFEP   = mgr->GetMedium("ITS_SSD FEP$");
6840   TGeoMedium *medH2O   = mgr->GetMedium("ITS_WATER$");
6841   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
6842
6843   TGeoVolume *forwTrayFirst = new TGeoVolume("ITSsuppSSDSideAForwTrayFirst",
6844                                              forwTrayPart1, medAl);
6845
6846   forwTrayFirst->SetVisibility(kTRUE);
6847   forwTrayFirst->SetLineColor(6); // Purple
6848   forwTrayFirst->SetLineWidth(1);
6849   forwTrayFirst->SetFillColor(forwTrayFirst->GetLineColor());
6850   forwTrayFirst->SetFillStyle(4000); // 0% transparent
6851
6852   TGeoVolume *forwTraySecond = new TGeoVolume("ITSsuppSSDSideAForwTraySecond",
6853                                               forwTrayPart2, medAl);
6854
6855   forwTraySecond->SetVisibility(kTRUE);
6856   forwTraySecond->SetLineColor(6); // Purple
6857   forwTraySecond->SetLineWidth(1);
6858   forwTraySecond->SetFillColor(forwTraySecond->GetLineColor());
6859   forwTraySecond->SetFillStyle(4000); // 0% transparent
6860
6861   TGeoVolume *forwTraySide = new TGeoVolume("ITSsuppSSDSideAForwTraySide",
6862                                             forwSide, medAl);
6863
6864   forwTraySide->SetVisibility(kTRUE);
6865   forwTraySide->SetLineColor(6); // Purple
6866   forwTraySide->SetLineWidth(1);
6867   forwTraySide->SetFillColor(forwTraySide->GetLineColor());
6868   forwTraySide->SetFillStyle(4000); // 0% transparent
6869
6870   TGeoVolume *forwTraySideCover = new TGeoVolume("ITSsuppSSDSideAForwTraySideCover",
6871                                             forwSideCover, medAl);
6872
6873   forwTraySideCover->SetVisibility(kTRUE);
6874   forwTraySideCover->SetLineColor(6); // Purple
6875   forwTraySideCover->SetLineWidth(1);
6876   forwTraySideCover->SetFillColor(forwTraySideCover->GetLineColor());
6877   forwTraySideCover->SetFillStyle(4000); // 0% transparent
6878
6879   TGeoVolume *externalTraySSD = new TGeoVolume("ITSsuppSSDSideAExternalTray",
6880                                                externalTray, medAl);
6881
6882   externalTraySSD->SetVisibility(kTRUE);
6883   externalTraySSD->SetLineColor(6); // Purple
6884   externalTraySSD->SetLineWidth(1);
6885   externalTraySSD->SetFillColor(externalTraySSD->GetLineColor());
6886   externalTraySSD->SetFillStyle(4000); // 0% transparent
6887
6888   TGeoVolume *forwardTrayCover = new TGeoVolume("ITSsuppSSDSideAForwTrayCover",
6889                                                 forwardCover, medAntic);
6890
6891   forwardTrayCover->SetVisibility(kTRUE);
6892   forwardTrayCover->SetLineColor(kMagenta+1); // Purple
6893   forwardTrayCover->SetLineWidth(1);
6894   forwardTrayCover->SetFillColor(forwardTrayCover->GetLineColor());
6895   forwardTrayCover->SetFillStyle(4000); // 0% transparent
6896
6897   TGeoVolume *externTrayCover = new TGeoVolume("ITSsuppSSDSideAExtTrayCover",
6898                                                externCover, medAntic);
6899
6900   externTrayCover->SetVisibility(kTRUE);
6901   externTrayCover->SetLineColor(kMagenta+1); // Purple
6902   externTrayCover->SetLineWidth(1);
6903   externTrayCover->SetFillColor(externTrayCover->GetLineColor());
6904   externTrayCover->SetFillStyle(4000); // 0% transparent
6905
6906   TGeoVolume *forwCableCu = new TGeoVolume("ITSsuppSSDSideAForwCableCu",
6907                                            forwCopper, medCu);
6908
6909   forwCableCu->SetVisibility(kTRUE);
6910   forwCableCu->SetLineColor(kRed); // Red
6911   forwCableCu->SetLineWidth(1);
6912   forwCableCu->SetFillColor(forwCableCu->GetLineColor());
6913   forwCableCu->SetFillStyle(4000); // 0% transparent
6914
6915   TGeoVolume *extCableCu = new TGeoVolume("ITSsuppSSDSideAExtCableCu",
6916                                           extCopper, medCu);
6917
6918   extCableCu->SetVisibility(kTRUE);
6919   extCableCu->SetLineColor(kRed); // Red
6920   extCableCu->SetLineWidth(1);
6921   extCableCu->SetFillColor(extCableCu->GetLineColor());
6922   extCableCu->SetFillStyle(4000); // 0% transparent
6923
6924   TGeoVolume *forwCableFEP = new TGeoVolume("ITSsuppSSDSideAForwCableFEP",
6925                                             forwPlastic, medFEP);
6926
6927   forwCableFEP->SetVisibility(kTRUE);
6928   forwCableFEP->SetLineColor(kYellow); // Yellow
6929   forwCableFEP->SetLineWidth(1);
6930   forwCableFEP->SetFillColor(forwCableFEP->GetLineColor());
6931   forwCableFEP->SetFillStyle(4000); // 0% transparent
6932
6933   TGeoVolume *extCableFEP = new TGeoVolume("ITSsuppSSDSideAExtCableFEP",
6934                                            extPlastic, medFEP);
6935
6936   extCableFEP->SetVisibility(kTRUE);
6937   extCableFEP->SetLineColor(kYellow); // Yellow
6938   extCableFEP->SetLineWidth(1);
6939   extCableFEP->SetFillColor(extCableFEP->GetLineColor());
6940   extCableFEP->SetFillStyle(4000); // 0% transparent
6941
6942   TGeoVolume *forwTrayWater = new TGeoVolume("ITSsuppSSDSideAForwTrayWater",
6943                                              forwWater, medH2O);
6944
6945   forwTrayWater->SetVisibility(kTRUE);
6946   forwTrayWater->SetLineColor(kBlue); // Blue
6947   forwTrayWater->SetLineWidth(1);
6948   forwTrayWater->SetFillColor(forwTrayWater->GetLineColor());
6949   forwTrayWater->SetFillStyle(4000); // 0% transparent
6950
6951   TGeoVolume *extTrayWater = new TGeoVolume("ITSsuppSSDSideAExtTrayWater",
6952                                             extWater, medH2O);
6953
6954   extTrayWater->SetVisibility(kTRUE);
6955   extTrayWater->SetLineColor(kBlue); // Blue
6956   extTrayWater->SetLineWidth(1);
6957   extTrayWater->SetFillColor(extTrayWater->GetLineColor());
6958   extTrayWater->SetFillStyle(4000); // 0% transparent
6959
6960   TGeoVolume *forwPolyUr = new TGeoVolume("ITSsuppSSDSideAForwPolyUr",
6961                                           forwPUR, medPUR);
6962
6963   forwPolyUr->SetVisibility(kTRUE);
6964   forwPolyUr->SetLineColor(kGray); // Gray
6965   forwPolyUr->SetLineWidth(1);
6966   forwPolyUr->SetFillColor(forwPolyUr->GetLineColor());
6967   forwPolyUr->SetFillStyle(4000); // 0% transparent
6968
6969   TGeoVolume *extPolyUr = new TGeoVolume("ITSsuppSSDSideAExtPolyUr",
6970                                          extPUR, medPUR);
6971
6972   extPolyUr->SetVisibility(kTRUE);
6973   extPolyUr->SetLineColor(kGray); // Gray
6974   extPolyUr->SetLineWidth(1);
6975   extPolyUr->SetFillColor(extPolyUr->GetLineColor());
6976   extPolyUr->SetFillStyle(4000); // 0% transparent
6977
6978
6979   // Now build up the tray
6980   cableTrayAForw->AddNode(forwTrayFirst, 1, 0);
6981
6982   cableTrayAForw->AddNode(forwTraySecond, 1,
6983                         new TGeoTranslation(0, 0, kForwardTrayFirstLen) );
6984
6985   xloc = kTrayWidth/2 + kForwardSideThick/2;
6986   yloc = kForwardTrayFirstHeight + kForwardSideHeight/2 - kForwardSideYTrans;
6987   zloc = kForwardSideLength/2;
6988   cableTrayAForw->AddNode(forwTraySide,1,
6989                         new TGeoTranslation( xloc, yloc, zloc) );
6990   cableTrayAForw->AddNode(forwTraySide,2,
6991                         new TGeoTranslation(-xloc, yloc, zloc) );
6992
6993   yloc = kForwardTrayFirstHeight + kForwardSideHeight - kForwardSideYTrans
6994        - kForwardCoverHeight;
6995   cableTrayAForw->AddNode(forwTraySideCover,1,
6996                         new TGeoTranslation(0, yloc, 0) );
6997
6998   yloc = kTrayTotalHeight - kCoversYTrans;
6999   zloc = kForwardTrayTotalLen - kForwardCoverLen;
7000   cableTrayAForw->AddNode(forwardTrayCover,1,
7001                         new TGeoTranslation(0, yloc, zloc) );
7002
7003   yloc = kTrayThick + forwCopper->GetDY();
7004   zloc = forwCopper->GetDZ();
7005   cableTrayAForw->AddNode(forwCableCu, 1,
7006                         new TGeoTranslation(0, yloc, zloc) );
7007
7008   yloc = kTrayThick + kCopperHeight + forwPlastic->GetDY();
7009   zloc = forwPlastic->GetDZ();
7010   cableTrayAForw->AddNode(forwCableFEP, 1,
7011                         new TGeoTranslation(0, yloc, zloc) );
7012
7013   yloc = kTrayThick + kCopperHeight + kCablePlasticHeight + forwWater->GetDY();
7014   zloc = forwWater->GetDZ();
7015   cableTrayAForw->AddNode(forwTrayWater, 1,
7016                         new TGeoTranslation(0, yloc, zloc) );
7017
7018   yloc = kTrayThick + kCopperHeight + kCablePlasticHeight
7019        + kCoolingWaterHeight + forwPUR->GetDY();
7020   zloc = forwPUR->GetDZ();
7021   cableTrayAForw->AddNode(forwPolyUr, 1,
7022                         new TGeoTranslation(0, yloc, zloc) );
7023
7024   // To simplify following placement in MARS, origin is on top
7025   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans;
7026
7027   yloc = -totalhi;
7028   cableTrayAExt->AddNode(externalTraySSD, 1,
7029                         new TGeoTranslation(0, yloc, 0) );
7030
7031   yloc = -totalhi + kTrayTotalHeight - kCoversYTrans;
7032   cableTrayAExt->AddNode(externTrayCover,1,
7033                         new TGeoTranslation(0, yloc, 0) );
7034
7035   xloc = extCopper->GetDZ();
7036   yloc = -totalhi;
7037   cableTrayAExt->AddNode(extCableCu,1,
7038                         new TGeoCombiTrans( xloc, yloc, 0,
7039                         new TGeoRotation("",-90, 90, 90)        ) );
7040
7041   xloc = extPlastic->GetDZ();
7042   yloc = -totalhi + kCopperHeight;
7043   cableTrayAExt->AddNode(extCableFEP,1,
7044                         new TGeoCombiTrans( xloc, yloc, 0,
7045                         new TGeoRotation("",-90, 90, 90)        ) );
7046
7047   xloc = extWater->GetDZ();
7048   yloc = -totalhi + kCopperHeight + kCablePlasticHeight;
7049   cableTrayAExt->AddNode(extTrayWater,1,
7050                         new TGeoCombiTrans( xloc, yloc, 0,
7051                         new TGeoRotation("",-90, 90, 90)        ) );
7052
7053   xloc = extPUR->GetDZ();
7054   yloc = -totalhi + kCopperHeight + kCablePlasticHeight + kCoolingWaterHeight;
7055   cableTrayAExt->AddNode(extPolyUr,1,
7056                         new TGeoCombiTrans( xloc, yloc, 0,
7057                         new TGeoRotation("",-90, 90, 90)        ) );
7058
7059
7060   // Finally put everything in the mother volume
7061   zloc = kTrayAZTrans;
7062   Double_t zlocext = zloc + kForwardTrayTotalLen;
7063   Double_t rExtTray = kTrayARTrans + kTrayTotalHeight;
7064
7065   alpharot = kTrayAFirstRotAng;
7066   xloc = kTrayARTrans*SinD(alpharot);
7067   yloc = kTrayARTrans*CosD(alpharot);
7068   moth->AddNode(cableTrayAForw,1,
7069                             new TGeoCombiTrans( xloc, yloc, zloc,
7070                             new TGeoRotation("",-alpharot,0,0)   )   );
7071   xloc = rExtTray*SinD(alpharot);
7072   yloc = rExtTray*CosD(alpharot);
7073   moth->AddNode(cableTrayAExt,1,
7074                             new TGeoCombiTrans( xloc, yloc, zlocext,
7075                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7076
7077   alpharot += 180;
7078   xloc = kTrayARTrans*SinD(alpharot);
7079   yloc = kTrayARTrans*CosD(alpharot);
7080   moth->AddNode(cableTrayAForw,2,
7081                             new TGeoCombiTrans( xloc, yloc, zloc,
7082                             new TGeoRotation("",-alpharot,0,0)   )   );
7083   xloc = rExtTray*SinD(alpharot);
7084   yloc = rExtTray*CosD(alpharot);
7085   moth->AddNode(cableTrayAExt,2,
7086                             new TGeoCombiTrans( xloc, yloc, zlocext,
7087                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7088
7089   alpharot = -kTrayAFirstRotAng - 2*kTrayASecondRotAng;
7090   xloc = kTrayARTrans*SinD(alpharot);
7091   yloc = kTrayARTrans*CosD(alpharot);
7092   moth->AddNode(cableTrayAForw,3,
7093                             new TGeoCombiTrans( xloc, yloc, zloc,
7094                             new TGeoRotation("",-alpharot,0,0)   )   );
7095   xloc = rExtTray*SinD(alpharot);
7096   yloc = rExtTray*CosD(alpharot);
7097   moth->AddNode(cableTrayAExt,3,
7098                             new TGeoCombiTrans( xloc, yloc, zlocext,
7099                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7100
7101   alpharot += 180;
7102   xloc = kTrayARTrans*SinD(alpharot);
7103   yloc = kTrayARTrans*CosD(alpharot);
7104   moth->AddNode(cableTrayAForw,4,
7105                             new TGeoCombiTrans( xloc, yloc, zloc,
7106                             new TGeoRotation("",-alpharot,0,0)   )   );
7107   xloc = rExtTray*SinD(alpharot);
7108   yloc = rExtTray*CosD(alpharot);
7109   moth->AddNode(cableTrayAExt,4,
7110                             new TGeoCombiTrans( xloc, yloc, zlocext,
7111                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7112
7113
7114   return;
7115 }
7116
7117 //______________________________________________________________________
7118 void AliITSv11GeometrySupport::SSDCableTraysSideC(TGeoVolume *moth,
7119                                             const TGeoManager *mgr){
7120 //
7121 // Creates the SSD cable trays which are outside the ITS support cones
7122 // but still inside the TPC on Side C
7123 // (part of this code is taken or anyway inspired to ServicesCableSupport
7124 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
7125 //
7126 // Input:
7127 //         moth : the TGeoVolume owing the volume structure
7128 //         mgr  : the GeoManager (default gGeoManager)
7129 // Output:
7130 //
7131 // Created:         ???       Bjorn S. Nilsen
7132 // Updated:      15 Apr 2010  Mario Sitta
7133 //
7134 // Technical data are taken from AutoCAD drawings and other (oral)
7135 // information given by F.Tosello
7136 //
7137
7138   // Dimensions and positions of the C-Side Cable Tray elements
7139   const Int_t    kNumTraySideC           =    4;
7140
7141   const Double_t kSideCFoldAngle         =    5.00 *fgkDegree;
7142
7143   const Double_t kServicesWidth          =  100.00 *fgkmm;
7144   const Double_t kCopperHeight           =   11.20 *fgkmm;// 1120 mm^2
7145   const Double_t kCablePlasticHeight     =   11.50 *fgkmm;// 1150 mm^2
7146   const Double_t kCoolingWaterHeight     =    2.65 *fgkmm;//  265 mm^2
7147   const Double_t kPoliUrethaneHeight     =    4.62 *fgkmm;//  462 mm^2
7148   const Double_t kCablesYtrans           =    2.50 *fgkmm;// Avoid ovlps
7149
7150   // Overall position and rotation of the C-Side Cable Trays
7151   const Double_t kTraySideCRPos          =   45.30    *fgkcm;
7152   const Double_t kTraySideCZPos          = -102.40    *fgkcm;
7153   const Double_t kTraySideCAlphaRot[kNumTraySideC]  = {     23.0,     -59.0,
7154     /* from Patch panel position */                    180.+23.0, 180.-59.0};
7155
7156
7157   // Local variables
7158   Double_t xprof[6], yprof[6];
7159   Double_t xloc, yloc, alpharot, alphafold;
7160
7161
7162   // The assembly holding the metallic structure
7163   TGeoVolumeAssembly *trayStructure =
7164                                 CreateSDDSSDTraysSideC("ITSsupportSSDTrayC");
7165
7166   // The cable copper inside the tray: a Xtru
7167   TGeoXtru *copper = new TGeoXtru(2);
7168   copper->SetName("ITSsuppSSDTrayCCopper");
7169
7170   // Copper lies on the lower plate: get position of its points
7171   TGeoXtru *lowerplate = (TGeoXtru*)(mgr->GetVolume("ITSsuppTraySideCLower")->GetShape());
7172   xprof[0] = lowerplate->GetX(5);
7173   yprof[0] = lowerplate->GetY(5) + kCablesYtrans;
7174   xprof[1] = lowerplate->GetX(4);
7175   yprof[1] = lowerplate->GetY(4) + kCablesYtrans;
7176   xprof[2] = lowerplate->GetX(3);
7177   yprof[2] = lowerplate->GetY(3) + kCablesYtrans;
7178   xprof[3] = xprof[2] - kCopperHeight*SinD(kSideCFoldAngle);
7179   yprof[3] = yprof[2] + kCopperHeight*CosD(kSideCFoldAngle);
7180   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7181               kCopperHeight , xprof[4], yprof[4]);
7182   xprof[5] = xprof[0];
7183   yprof[5] = yprof[0] + kCopperHeight;
7184
7185   copper->DefinePolygon(6, xprof, yprof);
7186   copper->DefineSection(0, -kServicesWidth/2);
7187   copper->DefineSection(1,  kServicesWidth/2);
7188
7189   // The cable plastic inside the tray: a Xtru
7190   TGeoXtru *plastic = new TGeoXtru(2);
7191   plastic->SetName("ITSsuppSSDTrayCPlastic");
7192
7193   xprof[0] = copper->GetX(5);
7194   yprof[0] = copper->GetY(5);
7195   xprof[1] = copper->GetX(4);
7196   yprof[1] = copper->GetY(4);
7197   xprof[2] = copper->GetX(3);
7198   yprof[2] = copper->GetY(3);
7199   xprof[3] = xprof[2] - kCablePlasticHeight*SinD(kSideCFoldAngle);
7200   yprof[3] = yprof[2] + kCablePlasticHeight*CosD(kSideCFoldAngle);
7201   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7202               kCablePlasticHeight , xprof[4], yprof[4]);
7203   xprof[5] = xprof[0];
7204   yprof[5] = yprof[0] + kCablePlasticHeight;
7205
7206   plastic->DefinePolygon(6, xprof, yprof);
7207   plastic->DefineSection(0, -kServicesWidth/2);
7208   plastic->DefineSection(1,  kServicesWidth/2);
7209
7210   // The cooling water inside the tray: a Xtru
7211   TGeoXtru *water = new TGeoXtru(2);
7212   water->SetName("ITSsuppSSDTrayCWater");
7213
7214   xprof[0] = plastic->GetX(5);
7215   yprof[0] = plastic->GetY(5);
7216   xprof[1] = plastic->GetX(4);
7217   yprof[1] = plastic->GetY(4);
7218   xprof[2] = plastic->GetX(3);
7219   yprof[2] = plastic->GetY(3);
7220   xprof[3] = xprof[2] - kCoolingWaterHeight*SinD(kSideCFoldAngle);
7221   yprof[3] = yprof[2] + kCoolingWaterHeight*CosD(kSideCFoldAngle);
7222   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7223               kCoolingWaterHeight , xprof[4], yprof[4]);
7224   xprof[5] = xprof[0];
7225   yprof[5] = yprof[0] + kCoolingWaterHeight;
7226
7227   water->DefinePolygon(6, xprof, yprof);
7228   water->DefineSection(0, -kServicesWidth/2);
7229   water->DefineSection(1,  kServicesWidth/2);
7230
7231   // The poliurethane inside the tray: a Xtru
7232   TGeoXtru *pur = new TGeoXtru(2);
7233   pur->SetName("ITSsuppSSDTrayCPUR");
7234   xprof[0] = water->GetX(5);
7235   yprof[0] = water->GetY(5);
7236   xprof[1] = water->GetX(4);
7237   yprof[1] = water->GetY(4);
7238   xprof[2] = water->GetX(3);
7239   yprof[2] = water->GetY(3);
7240   xprof[3] = xprof[2] - kPoliUrethaneHeight*SinD(kSideCFoldAngle);
7241   yprof[3] = yprof[2] + kPoliUrethaneHeight*CosD(kSideCFoldAngle);
7242   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7243               kPoliUrethaneHeight , xprof[4], yprof[4]);
7244   xprof[5] = xprof[0];
7245   yprof[5] = yprof[0] + kPoliUrethaneHeight;
7246
7247   pur->DefinePolygon(6, xprof, yprof);
7248   pur->DefineSection(0, -kServicesWidth/2);
7249   pur->DefineSection(1,  kServicesWidth/2);
7250
7251
7252   // We have all shapes: now create the real volumes
7253   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
7254   TGeoMedium *medFEP   = mgr->GetMedium("ITS_SSD FEP$");
7255   TGeoMedium *medH2O   = mgr->GetMedium("ITS_WATER$");
7256   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
7257
7258   TGeoVolume *copperCable = new TGeoVolume("ITSsuppSSDSideCCableCu",
7259                                            copper, medCu);
7260
7261   copperCable->SetVisibility(kTRUE);
7262   copperCable->SetLineColor(kRed); // Red
7263   copperCable->SetLineWidth(1);
7264   copperCable->SetFillColor(copperCable->GetLineColor());
7265   copperCable->SetFillStyle(4000); // 0% transparent
7266
7267   TGeoVolume *cableFEP = new TGeoVolume("ITSsuppSSDSideCCableFEP",
7268                                         plastic, medFEP);
7269
7270   cableFEP->SetVisibility(kTRUE);
7271   cableFEP->SetLineColor(kYellow); // Yellow
7272   cableFEP->SetLineWidth(1);
7273   cableFEP->SetFillColor(cableFEP->GetLineColor());
7274   cableFEP->SetFillStyle(4000); // 0% transparent
7275
7276   TGeoVolume *trayWater = new TGeoVolume("ITSsuppSSDSideCTrayWater",
7277                                          water, medH2O);
7278
7279   trayWater->SetVisibility(kTRUE);
7280   trayWater->SetLineColor(kBlue); // Blue
7281   trayWater->SetLineWidth(1);
7282   trayWater->SetFillColor(trayWater->GetLineColor());
7283   trayWater->SetFillStyle(4000); // 0% transparent
7284
7285   TGeoVolume *trayPolyUr = new TGeoVolume("ITSsuppSSDSideCPolyUr",
7286                                           pur, medPUR);
7287
7288   trayPolyUr->SetVisibility(kTRUE);
7289   trayPolyUr->SetLineColor(kGray); // Gray
7290   trayPolyUr->SetLineWidth(1);
7291   trayPolyUr->SetFillColor(trayPolyUr->GetLineColor());
7292   trayPolyUr->SetFillStyle(4000); // 0% transparent
7293
7294
7295   // Now fill in the tray
7296   trayStructure->AddNode(copperCable,1,0);
7297   trayStructure->AddNode(cableFEP,1,0);
7298   trayStructure->AddNode(trayWater,1,0);
7299   trayStructure->AddNode(trayPolyUr,1,0);
7300
7301
7302   // Finally put everything in the mother volume
7303   alphafold = kSideCFoldAngle;
7304
7305   for (Int_t jt = 0; jt < kNumTraySideC; jt++) {
7306     alpharot = kTraySideCAlphaRot[jt];
7307     xloc = kTraySideCRPos*SinD(alpharot);
7308     yloc = kTraySideCRPos*CosD(alpharot);
7309     moth->AddNode(trayStructure,jt+1,
7310                        new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
7311                        new TGeoRotation("",-90.+alpharot,-90.,90.+alphafold)));
7312   }
7313
7314
7315   return;
7316 }
7317
7318 //______________________________________________________________________
7319 void AliITSv11GeometrySupport::CreateSDDForwardTraySideA(TGeoVolumeAssembly *tray,
7320                                                    const TGeoManager *mgr){
7321 //
7322 // Creates the forward SDD tray on Side A (0872/G/D/01)
7323 //
7324 // Input:
7325 //         tray : the TGeoVolumeAssembly to put the elements in
7326 //         mgr  : the GeoManager (used only to get the proper material)
7327 //
7328 // Output:
7329 //
7330 // Return:
7331 //
7332 // Created:      08 Jan 2010  Mario Sitta
7333 // Updated:      07 Sep 2010  Mario Sitta
7334 //
7335 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
7336 // drawings and other (oral) information given by F.Tosello
7337 //
7338
7339   // Dimensions of the A-Side Forward Cable Tray (0872/G/D/01)
7340   const Double_t kForwardTrayThick        =    2.00 *fgkmm;
7341   const Double_t kForwardTraySideLength   =  823.00 *fgkmm;
7342   const Double_t kForwardTrayTailLength   =  212.00 *fgkmm;
7343   const Double_t kForwardTrayBaseHalfWide =   55.00 *fgkmm;
7344   const Double_t kForwardTrayNotchLength  =   47.20 *fgkmm;
7345   const Double_t kForwardTrayNotchHeight  =   25.00 *fgkmm;
7346   const Double_t kForwardTrayNotchDown    =   10.00 *fgkmm;
7347   const Double_t kForwardTraySide1Height  =   39.00 *fgkmm;
7348   const Double_t kForwardTraySide2Height  =   26.00 *fgkmm;
7349   const Double_t kForwardTraySide2Expand  =   10.50 *fgkmm;
7350   const Double_t kForwardTraySide3TailLen =  418.00 *fgkmm;
7351   const Double_t kForwardTraySide3TailHi  =   31.00 *fgkmm;
7352   const Double_t kForwardTraySide3HeadLen =  425.00 *fgkmm;
7353   const Double_t kForwardTraySide3HeadHi  =   72.00 *fgkmm;
7354   const Double_t kForwardTrayHorWingWide  =   10.50 *fgkmm;
7355   const Double_t kForwardTrayVertWingWide =   15.00 *fgkmm;
7356
7357   const Int_t    kForwardTraySideNpoints  =    9;
7358
7359
7360   // Local variables
7361   Double_t xprof[kForwardTraySideNpoints], yprof[kForwardTraySideNpoints];
7362   Double_t ylen, zlen;
7363   Double_t xloc, yloc, zloc;
7364
7365
7366   // The tray has a very complex shape, so it is made by assembling
7367   // different elements (with some small simplifications)
7368
7369   // The tray base: a BBox
7370   zlen = (kForwardTraySideLength-kForwardTrayTailLength)/2;
7371   TGeoBBox *trayBase = new TGeoBBox(kForwardTrayBaseHalfWide,
7372                                     kForwardTrayThick/2, zlen);
7373
7374   // The first part of the side wall: a Xtru
7375   TGeoXtru *traySide1 = new TGeoXtru(2);
7376
7377   xprof[0] = 0;
7378   yprof[0] = kForwardTrayThick;
7379   xprof[1] = kForwardTraySideLength-kForwardTrayTailLength;
7380   yprof[1] = yprof[0];
7381   xprof[2] = kForwardTraySideLength;
7382   yprof[2] = kForwardTraySide1Height + kForwardTrayThick;
7383   xprof[3] = 0;
7384   yprof[3] = yprof[2];
7385
7386   traySide1->DefinePolygon(4, xprof, yprof);
7387   traySide1->DefineSection(0, 0);
7388   traySide1->DefineSection(1, kForwardTrayThick);
7389
7390   // The second part of the side wall: a Xtru
7391   TGeoXtru *traySide2 = new TGeoXtru(2);
7392
7393   xprof[0] = kForwardTrayBaseHalfWide - kForwardTrayThick;
7394   yprof[0] = traySide1->GetY(2);
7395   xprof[1] = kForwardTrayBaseHalfWide;
7396   yprof[1] = yprof[0];
7397   xprof[2] = xprof[1] + kForwardTraySide2Expand;
7398   yprof[2] = yprof[1] + kForwardTraySide2Height;
7399   xprof[3] = xprof[2] - kForwardTrayThick;
7400   yprof[3] = yprof[2];
7401
7402   traySide2->DefinePolygon(4, xprof, yprof);
7403   traySide2->DefineSection(0, 0);
7404   traySide2->DefineSection(1, kForwardTraySideLength);
7405
7406   // The third part of the side wall: a Xtru
7407   TGeoXtru *traySide3 = new TGeoXtru(2);
7408
7409   xprof[0] = 0;
7410   yprof[0] = traySide2->GetY(2);
7411   xprof[1] = kForwardTraySideLength;
7412   yprof[1] = yprof[0];
7413   xprof[2] = xprof[1];
7414   yprof[2] = yprof[1] + kForwardTraySide3TailHi - kForwardTrayThick;
7415   xprof[3] = xprof[2] - kForwardTraySide3TailLen - kForwardTrayThick;
7416   yprof[3] = yprof[2];
7417   xprof[4] = xprof[3];
7418   yprof[4] = yprof[3] + kForwardTraySide3HeadHi + kForwardTrayThick;
7419   xprof[5] = xprof[4] - kForwardTraySide3HeadLen;
7420   yprof[5] = yprof[4];
7421   xprof[6] = xprof[5];
7422   yprof[6] = yprof[5] - kForwardTrayNotchHeight;
7423   xprof[7] = xprof[6] + kForwardTrayNotchLength;
7424   yprof[7] = yprof[6];
7425   xprof[8] = xprof[7];
7426   yprof[8] = yprof[7] - kForwardTrayNotchDown;
7427
7428   traySide3->DefinePolygon(9, xprof, yprof);
7429   traySide3->DefineSection(0, 0);
7430   traySide3->DefineSection(1, kForwardTrayThick);
7431
7432   // The horizontal wing: a BBox
7433   TGeoBBox *trayHorWing = new TGeoBBox(kForwardTrayHorWingWide/2,
7434                                        kForwardTrayThick/2,
7435                                        kForwardTraySide3TailLen/2);
7436
7437   // The vertical wing: a BBox
7438   ylen = (traySide3->GetY(4) - traySide3->GetY(3))/2;
7439   TGeoBBox *trayVertWing = new TGeoBBox(kForwardTrayVertWingWide/2,
7440                                         ylen, kForwardTrayThick/2);
7441
7442
7443   // We have all shapes: now create the real volumes
7444   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
7445
7446   TGeoVolume *forwTrayBase = new TGeoVolume("ITSsuppSDDSideAForwTrayBase",
7447                                             trayBase, medAl);
7448
7449   forwTrayBase->SetVisibility(kTRUE);
7450   forwTrayBase->SetLineColor(6); // Purple
7451   forwTrayBase->SetLineWidth(1);
7452   forwTrayBase->SetFillColor(forwTrayBase->GetLineColor());
7453   forwTrayBase->SetFillStyle(4000); // 0% transparent
7454
7455   TGeoVolume *forwTraySide1 = new TGeoVolume("ITSsuppSDDSideAForwTraySide1",
7456                                             traySide1, medAl);
7457
7458   forwTraySide1->SetVisibility(kTRUE);
7459   forwTraySide1->SetLineColor(6); // Purple
7460   forwTraySide1->SetLineWidth(1);
7461   forwTraySide1->SetFillColor(forwTraySide1->GetLineColor());
7462   forwTraySide1->SetFillStyle(4000); // 0% transparent
7463
7464   TGeoVolume *forwTraySide2 = new TGeoVolume("ITSsuppSDDSideAForwTraySide2",
7465                                             traySide2, medAl);
7466
7467   forwTraySide2->SetVisibility(kTRUE);
7468   forwTraySide2->SetLineColor(6); // Purple
7469   forwTraySide2->SetLineWidth(1);
7470   forwTraySide2->SetFillColor(forwTraySide2->GetLineColor());
7471   forwTraySide2->SetFillStyle(4000); // 0% transparent
7472
7473   TGeoVolume *forwTraySide3 = new TGeoVolume("ITSsuppSDDSideAForwTraySide3",
7474                                             traySide3, medAl);
7475
7476   forwTraySide3->SetVisibility(kTRUE);
7477   forwTraySide3->SetLineColor(6); // Purple
7478   forwTraySide3->SetLineWidth(1);
7479   forwTraySide3->SetFillColor(forwTraySide3->GetLineColor());
7480   forwTraySide3->SetFillStyle(4000); // 0% transparent
7481
7482   TGeoVolume *forwTrayHWing = new TGeoVolume("ITSsuppSDDSideAForwTrayHorWing",
7483                                             trayHorWing, medAl);
7484
7485   forwTrayHWing->SetVisibility(kTRUE);
7486   forwTrayHWing->SetLineColor(6); // Purple
7487   forwTrayHWing->SetLineWidth(1);
7488   forwTrayHWing->SetFillColor(forwTrayHWing->GetLineColor());
7489   forwTrayHWing->SetFillStyle(4000); // 0% transparent
7490
7491   TGeoVolume *forwTrayVWing = new TGeoVolume("ITSsuppSDDSideAForwTrayVertWing",
7492                                             trayVertWing, medAl);
7493
7494   forwTrayVWing->SetVisibility(kTRUE);
7495   forwTrayVWing->SetLineColor(6); // Purple
7496   forwTrayVWing->SetLineWidth(1);
7497   forwTrayVWing->SetFillColor(forwTrayVWing->GetLineColor());
7498   forwTrayVWing->SetFillStyle(4000); // 0% transparent
7499
7500
7501   // Now build up the tray
7502   yloc = kForwardTrayThick/2;
7503   zloc = zlen;
7504   tray->AddNode(forwTrayBase, 1,
7505                 new TGeoTranslation(0, yloc, zloc) );
7506
7507   xloc = kForwardTrayBaseHalfWide;
7508   tray->AddNode(forwTraySide1, 1,
7509                 new TGeoCombiTrans(xloc, 0, 0,
7510                                    new TGeoRotation("",90,-90,-90)));
7511   xloc = -xloc + kForwardTrayThick;
7512   tray->AddNode(forwTraySide1, 2,
7513                 new TGeoCombiTrans(xloc, 0, 0,
7514                                    new TGeoRotation("",90,-90,-90)));
7515
7516   tray->AddNode(forwTraySide2, 1, 0);
7517   zloc = kForwardTraySideLength;
7518   tray->AddNode(forwTraySide2, 2,
7519                 new TGeoCombiTrans(0, 0, zloc,
7520                                    new TGeoRotation("",90,-180,-90)));
7521
7522   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand;
7523   tray->AddNode(forwTraySide3, 1,
7524                 new TGeoCombiTrans(xloc, 0, 0,
7525                                    new TGeoRotation("",90,-90,-90)));
7526   xloc = -xloc + kForwardTrayThick;
7527   tray->AddNode(forwTraySide3, 2,
7528                 new TGeoCombiTrans(xloc, 0, 0,
7529                                    new TGeoRotation("",90,-90,-90)));
7530
7531   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand
7532        - kForwardTrayHorWingWide/2;
7533   yloc = traySide3->GetY(2) + kForwardTrayThick/2;
7534   zloc = kForwardTraySideLength - trayHorWing->GetDZ();
7535   tray->AddNode(forwTrayHWing, 1,
7536                 new TGeoTranslation( xloc, yloc, zloc) );
7537   tray->AddNode(forwTrayHWing, 2,
7538                 new TGeoTranslation(-xloc, yloc, zloc) );
7539
7540   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand
7541        - kForwardTrayVertWingWide/2;
7542   yloc = traySide3->GetY(2) + trayVertWing->GetDY();
7543   zloc = traySide3->GetX(3) + kForwardTrayThick/2;
7544   tray->AddNode(forwTrayVWing, 1,
7545                 new TGeoTranslation( xloc, yloc, zloc) );
7546   tray->AddNode(forwTrayVWing, 2,
7547                 new TGeoTranslation(-xloc, yloc, zloc) );
7548
7549
7550   return;
7551 }
7552
7553 //______________________________________________________________________
7554 TGeoCompositeShape* AliITSv11GeometrySupport::CreateTrayAForwardCover(const Double_t coverLen){
7555 //
7556 // Creates the forward cover of the SDD and SSD cable trays on Side A
7557 // (0872/G/D/02)
7558 //
7559 // Input:
7560 //             coverLen: the total length of the cover
7561 //
7562 // Output:
7563 //
7564 // Return:     a TGeoCompositeShape for the cover
7565 //
7566 // Created:      03 Jan 2010  Mario Sitta
7567 //
7568 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
7569 // drawings and other (oral) information given by F.Tosello
7570 //
7571
7572   // Dimensions and positions of the A-Side Cable Tray Forward Cover
7573   // (0872/G/D/02)
7574   const Double_t kForwardCoverWide        =  130.00 *fgkmm;
7575   const Double_t kForwardCoverSideWide    =   10.00 *fgkmm;
7576   const Double_t kForwardCoverHoleLen     =  160.00 *fgkmm;
7577   const Double_t kForwardCoverHoleWide    =   90.00 *fgkmm;
7578   const Double_t kForwardCoverHoleR10     =   10.00 *fgkmm;
7579   const Double_t kForwardCoverTotalThick  =    5.00 *fgkmm;
7580   const Double_t kForwardCoverSideThick   =    3.00 *fgkmm;
7581   const Double_t kForwardCoverInternThick =    2.00 *fgkmm;
7582
7583   const Double_t kForwardCoverHoleZTrans  =   40.00 *fgkmm;
7584
7585
7586   // Local variables
7587   Double_t xprof[16], yprof[16];
7588   Double_t yloc, zloc;
7589
7590
7591   // The main shape: a Xtru
7592   TGeoXtru *forwCoverMain = new TGeoXtru(2);
7593   forwCoverMain->SetName("ITSsuppForwCoverMain");
7594
7595   xprof[0] = kForwardCoverWide/2;
7596   yprof[0] = kForwardCoverTotalThick;
7597   xprof[1] = xprof[0];
7598   yprof[1] = yprof[0] - kForwardCoverSideThick;
7599   xprof[2] = xprof[1] - kForwardCoverSideWide;
7600   yprof[2] = yprof[1];
7601   xprof[3] = xprof[2];
7602   yprof[3] = 0;
7603
7604   // We did the right side, now reflex on the left side
7605   for (Int_t jp = 0; jp < 4; jp++) {
7606     xprof[4+jp] = -xprof[3-jp];
7607     yprof[4+jp] =  yprof[3-jp];
7608   }
7609
7610   // And now the actual Xtru
7611   forwCoverMain->DefinePolygon(8, xprof, yprof);
7612   forwCoverMain->DefineSection(0, 0);
7613   forwCoverMain->DefineSection(1, coverLen);
7614
7615   // The hole: another Xtru (rounded corners approximated with segments)
7616   TGeoXtru *forwCoverHole = new TGeoXtru(2);
7617   forwCoverHole->SetName("ITSsuppForwCoverHole");
7618
7619   CreateTrayACoverHolesShape(kForwardCoverHoleWide, kForwardCoverHoleLen,
7620                              kForwardCoverHoleR10 , xprof, yprof);
7621
7622   // And now the actual Xtru
7623   forwCoverHole->DefinePolygon(16, xprof, yprof);
7624   forwCoverHole->DefineSection(0, 0);
7625   forwCoverHole->DefineSection(1, kForwardCoverTotalThick-kForwardCoverInternThick);
7626
7627   // Now the proper rototranslation matrices for the two holes
7628   yloc = kForwardCoverTotalThick-kForwardCoverInternThick-0.01;//Precision fix
7629   zloc = kForwardCoverHoleZTrans;
7630   TGeoCombiTrans *mf1 = new TGeoCombiTrans(0, yloc, zloc,
7631                                            new TGeoRotation("", 0, 90, 0) );
7632   mf1->SetName("mf1");
7633   mf1->RegisterYourself();
7634
7635   zloc = coverLen - kForwardCoverHoleZTrans - kForwardCoverHoleLen;
7636   TGeoCombiTrans *mf2 = new TGeoCombiTrans(0, yloc, zloc,
7637                                            new TGeoRotation("", 0, 90, 0) );
7638   mf2->SetName("mf2");
7639   mf2->RegisterYourself();
7640
7641   // Finally the actual cover shape
7642   TGeoCompositeShape *cover = new TGeoCompositeShape("ITSsuppForwardCoverMain",
7643     "ITSsuppForwCoverMain-ITSsuppForwCoverHole:mf1-ITSsuppForwCoverHole:mf2");
7644
7645   return cover;
7646 }
7647
7648 //______________________________________________________________________
7649 TGeoCompositeShape* AliITSv11GeometrySupport::CreateTrayAExternalCover(const Double_t coverLen){
7650 //
7651 // Creates the external cover of the SDD and SSD cable trays on Side A
7652 // (0872/G/D/04)
7653 //
7654 // Input:
7655 //             coverLen: the total length of the cover
7656 //
7657 // Output:
7658 //
7659 // Return:     a TGeoCompositeShape for the cover
7660 //
7661 // Created:      03 Jan 2010  Mario Sitta
7662 //
7663 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
7664 // drawings and other (oral) information given by F.Tosello
7665 //
7666
7667   // Dimensions and positions of the A-Side Cable Tray External Cover
7668   // (0872/G/D/04)
7669   const Double_t kExternalCoverWide        =  130.00 *fgkmm;
7670   const Double_t kExternalCoverSideWide    =   10.00 *fgkmm;
7671   const Double_t kExternalCoverHoleLen1    =  262.00 *fgkmm;
7672   const Double_t kExternalCoverHoleLen2    =  280.00 *fgkmm;
7673   const Double_t kExternalCoverHoleLen3    =  205.00 *fgkmm;
7674   const Double_t kExternalCoverHoleLen4    =   55.00 *fgkmm;
7675   const Double_t kExternalCoverHoleWide    =   90.00 *fgkmm;
7676   const Double_t kExternalCoverHoleR10     =   10.00 *fgkmm;
7677   const Double_t kExternalCoverTotalThick  =    5.00 *fgkmm;
7678   const Double_t kExternalCoverSideThick   =    3.00 *fgkmm;
7679   const Double_t kExternalCoverInternThick =    2.00 *fgkmm;
7680
7681   const Double_t kExternalCoverHole1ZTrans =   28.00 *fgkmm;
7682   const Double_t kExternalCoverHolesZTrans =   20.00 *fgkmm;
7683
7684
7685   // Local variables
7686   Double_t xprof[16], yprof[16];
7687   Double_t yloc, zloc;
7688
7689
7690   // The main shape: a Xtru
7691   TGeoXtru *externCoverMain = new TGeoXtru(2);
7692   externCoverMain->SetName("ITSsuppExternCoverMain");
7693
7694   xprof[0] = kExternalCoverWide/2;
7695   yprof[0] = kExternalCoverTotalThick;
7696   xprof[1] = xprof[0];
7697   yprof[1] = yprof[0] - kExternalCoverSideThick;
7698   xprof[2] = xprof[1] - kExternalCoverSideWide;
7699   yprof[2] = yprof[1];
7700   xprof[3] = xprof[2];
7701   yprof[3] = 0;
7702
7703   // We did the right side, now reflex on the left side
7704   for (Int_t jp = 0; jp < 4; jp++) {
7705     xprof[4+jp] = -xprof[3-jp];
7706     yprof[4+jp] =  yprof[3-jp];
7707   }
7708
7709   // And now the actual Xtru
7710   externCoverMain->DefinePolygon(8, xprof, yprof);
7711   externCoverMain->DefineSection(0, 0);
7712   externCoverMain->DefineSection(1, coverLen);
7713
7714   // The first hole: a Xtru (rounded corners approximated with segments)
7715   Double_t holethick = kExternalCoverTotalThick-kExternalCoverInternThick;
7716
7717   TGeoXtru *extCoverHole1 = new TGeoXtru(2);
7718   extCoverHole1->SetName("ITSsuppExtCoverHole1");
7719
7720   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen1,
7721                              kExternalCoverHoleR10 , xprof, yprof);
7722
7723   extCoverHole1->DefinePolygon(16, xprof, yprof);
7724   extCoverHole1->DefineSection(0, 0);
7725   extCoverHole1->DefineSection(1, holethick);
7726
7727   // The second (and third) hole: another Xtru
7728   TGeoXtru *extCoverHole2 = new TGeoXtru(2);
7729   extCoverHole2->SetName("ITSsuppExtCoverHole2");
7730
7731   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen2,
7732                              kExternalCoverHoleR10 , xprof, yprof);
7733
7734   extCoverHole2->DefinePolygon(16, xprof, yprof);
7735   extCoverHole2->DefineSection(0, 0);
7736   extCoverHole2->DefineSection(1, holethick);
7737
7738   // The fourth hole: another Xtru
7739   TGeoXtru *extCoverHole3 = new TGeoXtru(2);
7740   extCoverHole3->SetName("ITSsuppExtCoverHole3");
7741
7742   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen3,
7743                              kExternalCoverHoleR10 , xprof, yprof);
7744
7745   extCoverHole3->DefinePolygon(16, xprof, yprof);
7746   extCoverHole3->DefineSection(0, 0);
7747   extCoverHole3->DefineSection(1, holethick);
7748
7749   // The fifth and last hole: another Xtru
7750   TGeoXtru *extCoverHole4 = new TGeoXtru(2);
7751   extCoverHole4->SetName("ITSsuppExtCoverHole4");
7752
7753   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen4,
7754                              kExternalCoverHoleR10 , xprof, yprof);
7755
7756   extCoverHole4->DefinePolygon(16, xprof, yprof);
7757   extCoverHole4->DefineSection(0, 0);
7758   extCoverHole4->DefineSection(1, holethick);
7759
7760   // Now the proper rototranslation matrices for the holes
7761   yloc = kExternalCoverTotalThick - kExternalCoverInternThick-0.01;
7762   zloc = kExternalCoverHole1ZTrans;
7763   TGeoCombiTrans *me1 = new TGeoCombiTrans(0, yloc, zloc,
7764                                            new TGeoRotation("", 0, 90, 0) );
7765   me1->SetName("me1");
7766   me1->RegisterYourself();
7767
7768   zloc += (kExternalCoverHoleLen1 + kExternalCoverHolesZTrans);
7769   TGeoCombiTrans *me2 = new TGeoCombiTrans(0, yloc, zloc,
7770                                            new TGeoRotation("", 0, 90, 0) );
7771   me2->SetName("me2");
7772   me2->RegisterYourself();
7773
7774   zloc += (kExternalCoverHoleLen2 + kExternalCoverHolesZTrans);
7775   TGeoCombiTrans *me3 = new TGeoCombiTrans(0, yloc, zloc,
7776                                            new TGeoRotation("", 0, 90, 0) );
7777   me3->SetName("me3");
7778   me3->RegisterYourself();
7779
7780   zloc += (kExternalCoverHoleLen2 + kExternalCoverHolesZTrans);
7781   TGeoCombiTrans *me4 = new TGeoCombiTrans(0, yloc, zloc,
7782                                            new TGeoRotation("", 0, 90, 0) );
7783   me4->SetName("me4");
7784   me4->RegisterYourself();
7785
7786   zloc += (kExternalCoverHoleLen3 + kExternalCoverHolesZTrans);
7787   TGeoCombiTrans *me5 = new TGeoCombiTrans(0, yloc, zloc,
7788                                            new TGeoRotation("", 0, 90, 0) );
7789   me5->SetName("me5");
7790   me5->RegisterYourself();
7791
7792   // Finally the actual cover shape
7793   TGeoCompositeShape *cover = new TGeoCompositeShape("ITSsuppExternCoverMain",
7794     "ITSsuppExternCoverMain-ITSsuppExtCoverHole1:me1-ITSsuppExtCoverHole2:me2-ITSsuppExtCoverHole2:me3-ITSsuppExtCoverHole3:me4-ITSsuppExtCoverHole4:me5");
7795
7796   return cover;
7797 }
7798
7799 //______________________________________________________________________
7800 void AliITSv11GeometrySupport::CreateTrayACoverHolesShape(const Double_t wide,
7801                                const Double_t length, const Double_t r10,
7802                                Double_t *x, Double_t *y){
7803 //
7804 // Creates the proper sequence of X and Y coordinates to determine
7805 // the base XTru polygon for the holes in the SDD and SSD tray covers
7806 // (here the rounded corners are approximated with segments)
7807 //
7808 // Input:
7809 //        wide   : the hole wide
7810 //        length : the hole length
7811 //        r10    : the radius of the rounded corners
7812 //
7813 // Output:
7814 //        x, y : coordinate vectors [16]
7815 //
7816 // Created:      03 Jan 2010  Mario Sitta
7817 //
7818 // Caller must guarantee that x and y have the correct dimensions
7819 // (but being this a private method it's easy to tell)
7820 //
7821
7822   x[0] = wide/2 - r10;
7823   y[0] = length;
7824   x[1] = x[0] + r10*SinD(30);
7825   y[1] = y[0] - r10*(1 - CosD(30));
7826   x[2] = x[0] + r10*SinD(60);
7827   y[2] = y[0] - r10*(1 - CosD(60));
7828   x[3] = x[0] + r10;
7829   y[3] = y[0] - r10;
7830   x[4] = x[3];
7831   y[4] = r10;
7832   x[5] = x[4] - r10*(1 - CosD(30));
7833   y[5] = y[4] - r10*SinD(30);
7834   x[6] = x[4] - r10*(1 - CosD(60));
7835   y[6] = y[4] - r10*SinD(60);
7836   x[7] = x[4] - r10;
7837   y[7] = 0;
7838
7839   // We did the right side, now reflex on the left side
7840   for (Int_t jp = 0; jp < 8; jp++) {
7841     x[8+jp] = -x[7-jp];
7842     y[8+jp] =  y[7-jp];
7843   }
7844
7845   return;
7846 }
7847
7848 //______________________________________________________________________
7849 TGeoXtru* AliITSv11GeometrySupport::CreateSDDSSDTraysSideA(
7850                                               const Double_t trayLen,
7851                                               const Double_t trayHi){
7852 //
7853 // Creates parts of the SDD and SSD Trays on Side A which are identical
7854 // (0872/G/D/03, part of 0872/G/D/07, 0872/G/C/11)
7855 //
7856 // Input:
7857 //         trayLen : the length of the tray part
7858 //         trayHi  : the height of the tray part
7859 //
7860 // Output:
7861 //
7862 // Return:     a TGeoXtru
7863 //
7864 // Created:      26 Feb 2010  Mario Sitta
7865 //
7866 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
7867 // drawings and other (oral) information given by F.Tosello
7868 //
7869
7870   // Dimensions and positions of the A-Side Cable Trays
7871   // (parts of 0872/G/C)
7872   const Double_t kTrayWidth              =  130.00 *fgkmm;
7873   const Double_t kTrayWingWidth          =   10.00 *fgkmm;
7874   const Double_t kTrayHeightToBend       =   20.00 *fgkmm;
7875   const Double_t kTrayThick              =    2.00 *fgkmm;
7876
7877   const Double_t kTrayBendAngle          =   22.00 *TMath::DegToRad();
7878
7879   const Int_t    kTrayNpoints            =   16;
7880
7881   // Local variables
7882   Double_t xprof[kTrayNpoints], yprof[kTrayNpoints];
7883
7884
7885   // The tray shape: a Xtru
7886   TGeoXtru *trayPart = new TGeoXtru(2);
7887
7888   xprof[2] = kTrayWidth/2 - kTrayThick;
7889   yprof[2] = trayHi - kTrayThick;
7890   xprof[3] = kTrayWidth/2 - kTrayWingWidth;
7891   yprof[3] = yprof[2];
7892   xprof[4] = xprof[3];
7893   yprof[4] = trayHi;
7894   xprof[5] = kTrayWidth/2;
7895   yprof[5] = yprof[4];
7896   xprof[6] = xprof[5];
7897   yprof[6] = kTrayHeightToBend;
7898   xprof[7] = xprof[6] - yprof[6]*TMath::Tan(kTrayBendAngle);
7899   yprof[7] = 0;
7900
7901   InsidePoint( xprof[5], yprof[5], xprof[6], yprof[6], xprof[7], yprof[7],
7902               -kTrayThick, xprof[1], yprof[1]);
7903
7904   xprof[8] = -xprof[7];
7905   yprof[8] =  yprof[7];
7906
7907   InsidePoint( xprof[6], yprof[6], xprof[7], yprof[7], xprof[8], yprof[8],
7908               -kTrayThick, xprof[0], yprof[0]);
7909
7910   // We did the right side, now reflex on the left side
7911   for (Int_t jp = 0; jp < 8; jp++) {
7912     xprof[8+jp] = -xprof[7-jp];
7913     yprof[8+jp] =  yprof[7-jp];
7914   }
7915
7916   // And now the actual Xtru
7917   trayPart->DefinePolygon(kTrayNpoints, xprof, yprof);
7918   trayPart->DefineSection(0, 0);
7919   trayPart->DefineSection(1, trayLen);
7920
7921
7922   return trayPart;
7923 }
7924
7925 //______________________________________________________________________
7926 TGeoVolumeAssembly* AliITSv11GeometrySupport::CreateSDDSSDTraysSideC(
7927                                                        const char *trayName,
7928                                                        const TGeoManager *mgr){
7929
7930 //
7931 // Creates the SDD and SSD Trays on Side C which are supposedly identical
7932 //
7933 // Input:
7934 //         trayName : the assembly name
7935 //
7936 // Output:
7937 //
7938 // Return:     a TGeoVolumeAssembly
7939 //
7940 // Created:      16 Apr 2010  Mario Sitta
7941 //
7942 // Technical data are taken from AutoCAD drawings and other (oral)
7943 // information given by F.Tosello
7944 //
7945
7946   const Double_t kSideCHalfThick      =    0.100   *fgkcm;
7947   const Double_t kSideCFoldAngle      =    5.000   *TMath::DegToRad();
7948
7949   const Double_t kSideCLength1        =  172.800   *fgkcm;
7950   const Double_t kSideCLength2        =  189.300   *fgkcm;
7951   const Double_t kSideCHalfWide       =    6.350   *fgkcm;
7952   const Double_t kSideCHeight1        =   11.800   *fgkcm;
7953   const Double_t kSideCHeight2        =    4.300   *fgkcm;
7954   const Double_t kSideCSideLength1    =   10.800   *fgkcm;
7955   const Double_t kSideCSideLength2    =   63.800   *fgkcm;
7956   const Double_t kSideCSideHeight     =    8.800   *fgkcm;
7957   const Int_t    kNPointsLowerFace    =    6;
7958   const Int_t    kNPointsLateralFace  =    9;
7959
7960   const Double_t kSideCWingAHalfLen   =    5.000   *fgkcm;
7961   const Double_t kSideCWingBHalfLen   =   30.500   *fgkcm;
7962   const Double_t kSideCWingCHalfLen   =    2.000   *fgkcm;
7963   const Double_t kSideCWingDHalfLen   =   48.500   *fgkcm;
7964   const Double_t kSideCWingEHalfLen   =   83.000   *fgkcm;
7965   const Double_t kSideCWingsHalfWide  =    0.450   *fgkcm;
7966
7967   const Int_t    kNPointsCoverFace    =   12;
7968
7969   const Double_t kPlateHalfLen        =    6.000   *fgkcm;
7970   const Double_t kPlateThick          =    0.600   *fgkcm;
7971   const Double_t kPlateHeight         =    4.200   *fgkcm;
7972   const Int_t    kNPointsPlate        =    6;
7973
7974   const Double_t kBarCoolRmax         =    0.4     *fgkcm;
7975   const Int_t    kNumBarCool          =    2;
7976   const Double_t kXShiftBarCool[kNumBarCool] = { 8.7, 13.0 };
7977   const Double_t kYShiftBarCool[kNumBarCool] = { 8.5,  5.0 };
7978
7979
7980   // Local variables
7981   Double_t xprof[12], yprof[12];
7982   Double_t xloc, yloc, zloc, delta, alpharot;
7983
7984   // The single C-Side Cable tray as an assembly
7985   TGeoVolumeAssembly *cableTrayC = new TGeoVolumeAssembly(trayName);
7986
7987   // First create all needed shapes
7988
7989   // The Cable Tray lower face: a Xtru
7990   TGeoXtru *sideCLowerFace = new TGeoXtru(2);
7991
7992   xprof[0] = 0.;
7993   yprof[0] = 0.;
7994   xprof[1] = kSideCLength1;
7995   yprof[1] = 0.;
7996   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(kSideCFoldAngle);
7997   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(kSideCFoldAngle);
7998   xprof[3] = xprof[2] - 2*kSideCHalfThick*TMath::Sin(kSideCFoldAngle);
7999   yprof[3] = yprof[2] + 2*kSideCHalfThick*TMath::Cos(kSideCFoldAngle);
8000   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8001               2*kSideCHalfThick , xprof[4], yprof[4]);
8002   xprof[5] = 0.;
8003   yprof[5] = 2*kSideCHalfThick;
8004
8005   sideCLowerFace->DefinePolygon(kNPointsLowerFace, xprof, yprof);
8006   sideCLowerFace->DefineSection(0,-kSideCHalfWide);
8007   sideCLowerFace->DefineSection(1, kSideCHalfWide);
8008
8009   // The Cable Tray lateral face: a Xtru
8010   TGeoXtru *sideCLateralFace = new TGeoXtru(2);
8011
8012   xprof[0] = 0.;
8013   yprof[0] = 0.;
8014   xprof[1] = kSideCLength1;
8015   yprof[1] = 0.;
8016   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(kSideCFoldAngle);
8017   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(kSideCFoldAngle);
8018   xprof[3] = xprof[2] - kSideCHeight2*TMath::Sin(kSideCFoldAngle);
8019   yprof[3] = yprof[2] + kSideCHeight2*TMath::Cos(kSideCFoldAngle);
8020   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8021               kSideCHeight2, xprof[4], yprof[4]);
8022   xprof[5] = kSideCSideLength1 + kSideCSideLength2;
8023   yprof[5] = kSideCHeight2;
8024   xprof[6] = xprof[5];
8025   yprof[6] = kSideCSideHeight;
8026   xprof[7] = kSideCSideLength1;
8027   yprof[7] = kSideCHeight1;
8028   xprof[8] = 0;
8029   yprof[8] = yprof[7];
8030
8031   sideCLateralFace->DefinePolygon(kNPointsLateralFace, xprof, yprof);
8032   sideCLateralFace->DefineSection(0,-kSideCHalfThick);
8033   sideCLateralFace->DefineSection(1, kSideCHalfThick);
8034
8035   // The lateral wings: four BBox's
8036   TGeoBBox *sideCLateralWingA = new TGeoBBox(kSideCWingAHalfLen,
8037                                              kSideCHalfThick,
8038                                              kSideCWingsHalfWide);
8039
8040   TGeoBBox *sideCLateralWingB = new TGeoBBox(kSideCWingBHalfLen,
8041                                              kSideCHalfThick,
8042                                              kSideCWingsHalfWide);
8043
8044   TGeoBBox *sideCLateralWingC = new TGeoBBox(kSideCHalfThick,    // With these
8045                                              kSideCWingCHalfLen, // X,Y avoid
8046                                              kSideCWingsHalfWide);//rotations
8047
8048   TGeoBBox *sideCLateralWingD = new TGeoBBox(kSideCWingDHalfLen,
8049                                              kSideCHalfThick,
8050                                              kSideCWingsHalfWide);
8051
8052   TGeoBBox *sideCLateralWingE = new TGeoBBox(kSideCWingEHalfLen,
8053                                              kSideCHalfThick,
8054                                              kSideCWingsHalfWide);
8055
8056   // The connecting lower plate: a Xtru
8057   TGeoXtru *sideCLowerPlate =  new TGeoXtru(2);
8058
8059   xprof[0] = 0.;
8060   yprof[0] = 0.;
8061   xprof[1] = kPlateHalfLen;
8062   yprof[1] = 0.;
8063   xprof[2] = xprof[1] + kPlateHalfLen*TMath::Cos(kSideCFoldAngle);
8064   yprof[2] = kPlateHalfLen*TMath::Sin(kSideCFoldAngle);
8065   xprof[3] = xprof[2] - kPlateThick*TMath::Sin(kSideCFoldAngle);
8066   yprof[3] = yprof[2] + kPlateThick*TMath::Cos(kSideCFoldAngle);
8067   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8068               kPlateThick, xprof[4], yprof[4]);
8069   xprof[5] = 0.;
8070   yprof[5] = kPlateThick;
8071
8072   sideCLowerPlate->DefinePolygon(kNPointsPlate, xprof, yprof);
8073   Double_t zwide = kSideCHalfWide + 2*kSideCHalfThick;
8074   sideCLowerPlate->DefineSection(0,-zwide);
8075   sideCLowerPlate->DefineSection(1, zwide);
8076
8077   // The connecting side plate: a Xtru
8078   TGeoXtru *sideCLateralPlate = new TGeoXtru(2);
8079
8080   xprof[0] = 0.;
8081   yprof[0] = 0.;
8082   xprof[1] = kPlateHalfLen;
8083   yprof[1] = 0.;
8084   xprof[2] = xprof[1] + kPlateHalfLen*TMath::Cos(kSideCFoldAngle);
8085   yprof[2] = kPlateHalfLen*TMath::Sin(kSideCFoldAngle);
8086   xprof[3] = xprof[2] - kPlateHeight*TMath::Sin(kSideCFoldAngle);
8087   yprof[3] = yprof[2] + kPlateHeight*TMath::Cos(kSideCFoldAngle);
8088   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8089               kPlateHeight, xprof[4], yprof[4]); // Avoid small overlap
8090   xprof[5] = 0.;
8091   yprof[5] = kPlateHeight;
8092
8093   sideCLateralPlate->DefinePolygon(kNPointsPlate, xprof, yprof);
8094   sideCLateralPlate->DefineSection(0,-kPlateThick/2);
8095   sideCLateralPlate->DefineSection(1, kPlateThick/2);
8096
8097   // The bar fixing the cooling tubes: a Tube
8098   TGeoTube *coolBar = new TGeoTube(0., kBarCoolRmax, kSideCHalfWide);
8099
8100   // The Cable Tray cover: a (complex) Xtru
8101   TGeoXtru *sideCCoverFace = new TGeoXtru(2);
8102
8103   xprof[ 0] = sideCLateralFace->GetX(8);
8104   yprof[ 0] = sideCLateralFace->GetY(8);
8105   xprof[ 1] = sideCLateralFace->GetX(7);
8106   yprof[ 1] = sideCLateralFace->GetY(7);
8107   xprof[ 2] = sideCLateralFace->GetX(6);
8108   yprof[ 2] = sideCLateralFace->GetY(6);
8109   xprof[ 3] = sideCLateralFace->GetX(5);
8110   yprof[ 3] = sideCLateralFace->GetY(5);
8111   xprof[ 4] = sideCLateralFace->GetX(4);
8112   yprof[ 4] = sideCLateralFace->GetY(4);
8113
8114   xloc = (kSideCLength1 + (kSideCSideLength1+kSideCSideLength2))/2;
8115   delta  = kSideCLength1 - (xloc + kSideCWingDHalfLen);
8116   xprof[ 5] = xprof[4]
8117             + (delta + 2*kSideCWingEHalfLen)*TMath::Cos(kSideCFoldAngle);
8118   yprof[ 5] = yprof[4]
8119             + (delta + 2*kSideCWingEHalfLen)*TMath::Sin(kSideCFoldAngle);
8120
8121   xprof[ 6] = xprof[5] - 2*kSideCHalfThick*TMath::Sin(kSideCFoldAngle);
8122   yprof[ 6] = yprof[5] + 2*kSideCHalfThick*TMath::Cos(kSideCFoldAngle);
8123   InsidePoint(xprof[3], yprof[3], xprof[4], yprof[4], xprof[5], yprof[5],
8124               2*kSideCHalfThick, xprof[7], yprof[7]);
8125   InsidePoint(xprof[2], yprof[2], xprof[3], yprof[3], xprof[4], yprof[4],
8126               2*kSideCHalfThick, xprof[8], yprof[8]);
8127   xprof[ 9] = xprof[2] + 2*kSideCHalfThick;
8128   yprof[ 9] = yprof[2] + 2*kSideCHalfThick;
8129   xprof[10] = xprof[1];
8130   yprof[10] = yprof[1] + 2*kSideCHalfThick;
8131   xprof[11] = xprof[0];
8132   yprof[11] = yprof[0] + 2*kSideCHalfThick;
8133
8134   sideCCoverFace->DefinePolygon(kNPointsCoverFace, xprof, yprof);
8135   zloc = kSideCHalfWide + 2*kSideCHalfThick + 2*kSideCWingsHalfWide;
8136   sideCCoverFace->DefineSection(0,-zloc);
8137   sideCCoverFace->DefineSection(1, zloc);
8138
8139
8140   // We have all shapes: now create the real volumes
8141   TGeoMedium *medAl      = mgr->GetMedium("ITS_ALUMINUM$");
8142
8143   TGeoVolume *traySideCLowerFace  = new TGeoVolume("ITSsuppTraySideCLower",
8144                                                    sideCLowerFace, medAl);
8145
8146   traySideCLowerFace->SetVisibility(kTRUE);
8147   traySideCLowerFace->SetLineColor(6); // Purple
8148   traySideCLowerFace->SetLineWidth(1);
8149   traySideCLowerFace->SetFillColor(traySideCLowerFace->GetLineColor());
8150   traySideCLowerFace->SetFillStyle(4000); // 0% transparent
8151
8152   TGeoVolume *traySideCLateralFace  = new TGeoVolume("ITSsuppTraySideCLateral",
8153                                                      sideCLateralFace, medAl);
8154
8155   traySideCLateralFace->SetVisibility(kTRUE);
8156   traySideCLateralFace->SetLineColor(6); // Purple
8157   traySideCLateralFace->SetLineWidth(1);
8158   traySideCLateralFace->SetFillColor(traySideCLateralFace->GetLineColor());
8159   traySideCLateralFace->SetFillStyle(4000); // 0% transparent
8160
8161   TGeoVolume *traySideCLateralWingA =
8162     new TGeoVolume("ITSsuppTraySideCLateralWingA", sideCLateralWingA,  medAl);
8163
8164   traySideCLateralWingA->SetVisibility(kTRUE);
8165   traySideCLateralWingA->SetLineColor(6); // Purple
8166   traySideCLateralWingA->SetLineWidth(1);
8167   traySideCLateralWingA->SetFillColor(traySideCLateralWingA->GetLineColor());
8168   traySideCLateralWingA->SetFillStyle(4000); // 0% transparent
8169
8170   TGeoVolume *traySideCLateralWingB =
8171     new TGeoVolume("ITSsuppTraySideCLateralWingB", sideCLateralWingB,  medAl);
8172
8173   traySideCLateralWingB->SetVisibility(kTRUE);
8174   traySideCLateralWingB->SetLineColor(6); // Purple
8175   traySideCLateralWingB->SetLineWidth(1);
8176   traySideCLateralWingB->SetFillColor(traySideCLateralWingB->GetLineColor());
8177   traySideCLateralWingB->SetFillStyle(4000); // 0% transparent
8178
8179   TGeoVolume *traySideCLateralWingC =
8180     new TGeoVolume("ITSsuppTraySideCLateralWingC", sideCLateralWingC,  medAl);
8181
8182   traySideCLateralWingC->SetVisibility(kTRUE);
8183   traySideCLateralWingC->SetLineColor(6); // Purple
8184   traySideCLateralWingC->SetLineWidth(1);
8185   traySideCLateralWingC->SetFillColor(traySideCLateralWingC->GetLineColor());
8186   traySideCLateralWingC->SetFillStyle(4000); // 0% transparent
8187
8188   TGeoVolume *traySideCLateralWingD =
8189     new TGeoVolume("ITSsuppTraySideCLateralWingD", sideCLateralWingD,  medAl);
8190
8191   traySideCLateralWingD->SetVisibility(kTRUE);
8192   traySideCLateralWingD->SetLineColor(6); // Purple
8193   traySideCLateralWingD->SetLineWidth(1);
8194   traySideCLateralWingD->SetFillColor(traySideCLateralWingD->GetLineColor());
8195   traySideCLateralWingD->SetFillStyle(4000); // 0% transparent
8196
8197   TGeoVolume *traySideCLateralWingE =
8198     new TGeoVolume("ITSsuppTraySideCLateralWingE", sideCLateralWingE,  medAl);
8199
8200   traySideCLateralWingE->SetVisibility(kTRUE);
8201   traySideCLateralWingE->SetLineColor(6); // Purple
8202   traySideCLateralWingE->SetLineWidth(1);
8203   traySideCLateralWingE->SetFillColor(traySideCLateralWingE->GetLineColor());
8204   traySideCLateralWingE->SetFillStyle(4000); // 0% transparent
8205
8206   TGeoVolume *traySideCLowerPlate =
8207     new TGeoVolume("ITSsuppTraySideCLowerPlate", sideCLowerPlate,  medAl);
8208
8209   traySideCLowerPlate->SetVisibility(kTRUE);
8210   traySideCLowerPlate->SetLineColor(6); // Purple
8211   traySideCLowerPlate->SetLineWidth(1);
8212   traySideCLowerPlate->SetFillColor(traySideCLowerPlate->GetLineColor());
8213   traySideCLowerPlate->SetFillStyle(4000); // 0% transparent
8214
8215   TGeoVolume *traySideCLateralPlate =
8216     new TGeoVolume("ITSsuppTraySideCLateralPlate", sideCLateralPlate,  medAl);
8217
8218   traySideCLateralPlate->SetVisibility(kTRUE);
8219   traySideCLateralPlate->SetLineColor(6); // Purple
8220   traySideCLateralPlate->SetLineWidth(1);
8221   traySideCLateralPlate->SetFillColor(traySideCLateralPlate->GetLineColor());
8222   traySideCLateralPlate->SetFillStyle(4000); // 0% transparent
8223
8224   TGeoVolume *traySideCCoverFace =
8225     new TGeoVolume("ITSsuppTraySideCCoverFace", sideCCoverFace,  medAl);
8226
8227   traySideCCoverFace->SetVisibility(kTRUE);
8228   traySideCCoverFace->SetLineColor(6); // Purple
8229   traySideCCoverFace->SetLineWidth(1);
8230   traySideCCoverFace->SetFillColor(traySideCCoverFace->GetLineColor());
8231   traySideCCoverFace->SetFillStyle(4000); // 0% transparent
8232
8233   TGeoVolume *coolingTubeBar = new TGeoVolume("ITSsuppTraySideCCoolBar",
8234                                               coolBar, medAl);
8235
8236   coolingTubeBar->SetVisibility(kTRUE);
8237   coolingTubeBar->SetLineColor(6); // Purple
8238   coolingTubeBar->SetLineWidth(1);
8239   coolingTubeBar->SetFillColor(coolingTubeBar->GetLineColor());
8240   coolingTubeBar->SetFillStyle(4000); // 0% transparent
8241
8242
8243   // Now build up the tray
8244   cableTrayC->AddNode(traySideCLowerFace,1,0);
8245
8246   zloc = kSideCHalfWide + kSideCHalfThick;
8247   cableTrayC->AddNode(traySideCLateralFace,1,
8248                             new TGeoTranslation(0., 0., zloc) );
8249   cableTrayC->AddNode(traySideCLateralFace,2,
8250                             new TGeoTranslation(0., 0.,-zloc) );
8251
8252   xloc = kSideCWingAHalfLen;
8253   yloc = kSideCHeight1 - kSideCHalfThick;
8254   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8255   cableTrayC->AddNode(traySideCLateralWingA,1,
8256                             new TGeoTranslation(xloc, yloc, zloc) );
8257   cableTrayC->AddNode(traySideCLateralWingA,2,
8258                             new TGeoTranslation(xloc, yloc,-zloc) );
8259
8260   xloc = kSideCSideLength1 + kSideCSideLength2/2;
8261   yloc = Yfrom2Points(kSideCSideLength1,kSideCHeight1,
8262                       kSideCSideLength1+kSideCSideLength2,kSideCSideHeight,
8263                       xloc) - kSideCHalfThick -0.0012; // Avoid small overlap
8264   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8265   alpharot = (-(kSideCHeight1 - kSideCSideHeight)/kSideCSideLength2 )*
8266                 TMath::RadToDeg();
8267   cableTrayC->AddNode(traySideCLateralWingB,1,
8268                             new TGeoCombiTrans(xloc, yloc, zloc,
8269                                         new TGeoRotation("",alpharot,0,0) ) );
8270   cableTrayC->AddNode(traySideCLateralWingB,2,
8271                             new TGeoCombiTrans(xloc, yloc,-zloc,
8272                                         new TGeoRotation("",alpharot,0,0) ) );
8273
8274   xloc = kSideCSideLength1 + kSideCSideLength2 - kSideCHalfThick;
8275   yloc = kSideCSideHeight - kSideCWingCHalfLen;
8276   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8277   cableTrayC->AddNode(traySideCLateralWingC,1,
8278                             new TGeoTranslation(xloc, yloc, zloc) );
8279   cableTrayC->AddNode(traySideCLateralWingC,2,
8280                             new TGeoTranslation(xloc, yloc,-zloc) );
8281
8282   xloc = (kSideCLength1 + (kSideCSideLength1+kSideCSideLength2))/2;
8283   yloc = kSideCHeight2 - kSideCHalfThick;
8284   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8285   cableTrayC->AddNode(traySideCLateralWingD,1,
8286                             new TGeoTranslation(xloc, yloc, zloc) );
8287   cableTrayC->AddNode(traySideCLateralWingD,2,
8288                             new TGeoTranslation(xloc, yloc,-zloc) );
8289
8290   delta = kSideCLength1 - (xloc + kSideCWingDHalfLen);
8291   xloc = kSideCLength1 + delta + kSideCWingEHalfLen;
8292   yloc = (xloc - kSideCLength1)*TMath::Tan(kSideCFoldAngle) +
8293           kSideCHeight2*TMath::Cos(kSideCFoldAngle) - kSideCHalfThick;
8294   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8295   alpharot = kSideCFoldAngle*TMath::RadToDeg();
8296   cableTrayC->AddNode(traySideCLateralWingE,1,
8297                             new TGeoCombiTrans(xloc, yloc, zloc,
8298                                         new TGeoRotation("",alpharot,0,0) ) );
8299   cableTrayC->AddNode(traySideCLateralWingE,2,
8300                             new TGeoCombiTrans(xloc, yloc,-zloc,
8301                                         new TGeoRotation("",alpharot,0,0) ) );
8302
8303   xloc = kSideCLength1 - kPlateHalfLen;
8304   yloc = -kPlateThick -0.0025; // Avoid small overlap
8305   cableTrayC->AddNode(traySideCLowerPlate,1,
8306                             new TGeoTranslation(xloc, yloc, 0.) );
8307
8308   xloc = kSideCLength1 - kPlateHalfLen;
8309   yloc = -kPlateThick;
8310   zloc = kSideCHalfWide + 2*kSideCHalfThick + kPlateThick/2;
8311   cableTrayC->AddNode(traySideCLateralPlate,1,
8312                             new TGeoTranslation(xloc, yloc, zloc) );
8313   cableTrayC->AddNode(traySideCLateralPlate,2,
8314                             new TGeoTranslation(xloc, yloc,-zloc) );
8315
8316   for (Int_t jc = 0; jc <kNumBarCool; jc++) {
8317     xloc = kXShiftBarCool[jc];
8318     yloc = kYShiftBarCool[jc];
8319     cableTrayC->AddNode(coolingTubeBar,jc+1,
8320                               new TGeoTranslation(xloc, yloc, 0.) );
8321   }
8322
8323   cableTrayC->AddNode(traySideCCoverFace,1,0);
8324
8325
8326   // Finally return what we made up
8327
8328   return cableTrayC;
8329 }
8330
8331 //______________________________________________________________________
8332 void AliITSv11GeometrySupport::ITSTPCSupports(TGeoVolume *moth,
8333                                         const TGeoManager *mgr){
8334 //
8335 // Creates the elements suspending the ITS to the TPC and other fixed
8336 // elements used to hook the rails (0872/C and its daughters)
8337 //
8338 // Input:
8339 //         moth : the TGeoVolume owing the volume structure
8340 //         mgr  : the GeoManager (default gGeoManager)
8341 // Output:
8342 //
8343 // Return:
8344 //
8345 // Created:      28 Oct 2010  Mario Sitta
8346 // Updated:      18 Feb 2011  Mario Sitta
8347 //
8348 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
8349 // drawings and other (oral) information given by F.Tosello
8350 //
8351
8352   // Dimensions and positions of the half ring C2/C3 (0872/C/04)
8353   const Double_t kRingCZPos           =   733.000*fgkmm;
8354   const Double_t kRingCZToTPC         =     5.500*fgkmm;
8355
8356   const Double_t kRingCThick          =    12.000*fgkmm;
8357   const Double_t kRingCRmin           =   565.000*fgkmm;
8358   const Double_t kRingCRmax           =   592.000*fgkmm;
8359   const Double_t kRingCHeight         =   560.000*fgkmm;
8360   const Double_t kRingCXToInsert      =   515.000*fgkmm;
8361   const Double_t kRingCYToInsert      =   113.000*fgkmm;
8362
8363   const Int_t kNumberOfRingPoints     =    23; // N.points to approximate arc
8364
8365   // Dimensions of the forward upper hook (0872/C/09)
8366   const Double_t kForwUpHookThick     =    20.000*fgkmm;
8367   const Double_t kForwUpHookRext      =   590.000*fgkmm;
8368   const Double_t kForwUpHookRint      =    20.000*fgkmm;
8369   const Double_t kForwUpHookHiTot     =    89.000*fgkmm;
8370   const Double_t kForwUpHookHiInt     =    59.000*fgkmm;
8371   const Double_t kForwUpHookWide      =    96.000*fgkmm;
8372   const Double_t kForwUpHookHalfBase  =    25.000*fgkmm;
8373   const Double_t kForwUpHookBaseCut   =    10.000*fgkmm;
8374   const Double_t kForwUpHookHoleWide  =    25.000*fgkmm;
8375   const Double_t kForwUpHookHoleHi    =    22.500*fgkmm;
8376   const Double_t kForwUpHookHoleBase  =     5.000*fgkmm;
8377   const Double_t kForwUpHookHoleR5    =     5.000*fgkmm;
8378   const Double_t kForwUpHookHoleY     =     8.000*fgkmm;
8379   const Double_t kForwUpHookHollowHi  =    35.000*fgkmm;
8380   const Double_t kForwUpHookHollowWide=     5.000*fgkmm;
8381
8382   const Int_t kNumberOfForwUpHookPts  =    11;
8383   const Int_t kNumbOfForwUpHookHolePts=     5;
8384
8385   // Dimensions of the forward lower hook (0872/C/08)
8386   const Double_t kForwLwHookThick     =    20.000*fgkmm;
8387   const Double_t kForwLwHookRext      =   590.000*fgkmm;
8388   const Double_t kForwLwHookRint      =    20.000*fgkmm;
8389   const Double_t kForwLwHookHiTot     =    88.500*fgkmm;
8390   const Double_t kForwLwHookWide      =    96.000*fgkmm;
8391   const Double_t kForwLwHookHalfBase  =    25.000*fgkmm;
8392   const Double_t kForwLwHookBaseCut   =    10.000*fgkmm;
8393   const Double_t kForwLwHookYToHollow =     3.500*fgkmm;
8394   const Double_t kForwLwHookHoleR     =     7.500*fgkmm;
8395   const Double_t kForwLwHookHoleIntHi =    35.000*fgkmm;
8396   const Double_t kForwLwHookHoleYPos  =    13.500*fgkmm;
8397   const Double_t kForwLwHookHollowHi  =    62.000*fgkmm;
8398   const Double_t kForwLwHookHollowWide=     5.000*fgkmm;
8399
8400   const Int_t kNumberOfForwLwHookPts  =    11;
8401   const Int_t kNumbOfForwLwHookHolePts=     7;
8402
8403   // Dimensions of the rear upper hook (0872/C/10)
8404   const Double_t kRearUpHookThick     =    15.000*fgkmm;
8405   const Double_t kRearUpHookRext      =   590.000*fgkmm;
8406   const Double_t kRearUpHookRint      =    20.000*fgkmm;
8407   const Double_t kRearUpHookHiTot     =    53.500*fgkmm;
8408   const Double_t kRearUpHookHiInt     =    23.500*fgkmm;
8409   const Double_t kRearUpHookWide      =    96.000*fgkmm;
8410   const Double_t kRearUpHookHalfBase  =    25.000*fgkmm;
8411   const Double_t kRearUpHookHoleWide  =    25.000*fgkmm;
8412   const Double_t kRearUpHookHoleHi    =    22.500*fgkmm;
8413   const Double_t kRearUpHookHoleBase  =     5.000*fgkmm;
8414   const Double_t kRearUpHookHoleR5    =     5.000*fgkmm;
8415   const Double_t kRearUpHookHoleY     =     8.000*fgkmm;
8416
8417   const Int_t kNumberOfRearUpHookPts  =    10;
8418   const Int_t kNumbOfRearUpHookHolePts=     5;
8419
8420   // Dimensions of the forward lower hook (0872/C/11)
8421   const Double_t kRearLwHookThick     =    20.000*fgkmm;
8422   const Double_t kRearLwHookRext      =   590.000*fgkmm;
8423   const Double_t kRearLwHookHiTot     =    30.000*fgkmm;
8424   const Double_t kRearLwHookWide      =    96.000*fgkmm;
8425
8426   const Int_t kNumberOfRearLwHookPts  =     3;
8427
8428   // Dimensions of the rear lower brackets (0872/C/16)
8429   const Double_t kRearLwBracketThick  =    15.000*fgkmm;
8430   const Double_t kRearLwBracketHi1    =    42.000*fgkmm;
8431   const Double_t kRearLwBracketHi2    =    12.000*fgkmm;
8432   const Double_t kRearLwBracketWide1  =    34.000*fgkmm;
8433   const Double_t kRearLwBracketWide2  =    10.000*fgkmm;
8434 //  const Double_t kRearLwBracketR5     =     5.000*fgkmm
8435
8436   // Dimensions of the forward webcam supports (0872/C/V/01-03-04)
8437   const Double_t kForwWebSStirrDep    =    20.000*fgkmm;
8438   const Double_t kForwWebSStirrLen1   =    15.000*fgkmm;
8439   const Double_t kForwWebSStirrLen2   =    55.000*fgkmm;
8440   const Double_t kForwWebSStirrLen3   =    10.000*fgkmm;
8441   const Double_t kForwWebSStirrWide1  =    45.000*fgkmm;
8442   const Double_t kForwWebSStirrWide2  =    38.000*fgkmm;
8443   const Double_t kForwWebSStirrWide3  =    23.000*fgkmm;
8444   const Double_t kForwWebTStirrThick  =     5.000*fgkmm;
8445   const Double_t kForwWebTStirrWide1  =    30.000*fgkmm;
8446   const Double_t kForwWebTStirrWide2  =    10.000*fgkmm;
8447   const Double_t kForwWebTStirrTotLen3=    58.500*fgkmm;
8448   const Double_t kForwWebTStirrTotLen4=    36.000*fgkmm;
8449   const Double_t kForwWebTStirrLen1   =    10.000*fgkmm;
8450
8451   // Dimensions of the forward and rear webcam clamps (0872/C/V/02)
8452   const Double_t kFRWebClampThick     =    10.000*fgkmm;
8453   const Double_t kFRWebClampExtWide   =    30.000*fgkmm;
8454   const Double_t kFRWebClampIntWide   =    18.000*fgkmm;
8455   const Double_t kFRWebClampExtHi     =    22.000*fgkmm;
8456   const Double_t kFRWebClampIntHi     =    17.000*fgkmm;
8457
8458   // Dimensions of the webcam itself
8459   const Double_t kWebcamLength        =    35.000*fgkmm;//ESTIMATED!!!
8460
8461   // Dimensions of the rear upper webcam supports (0872/C/V/05-06)
8462   const Double_t kRearUpWebStirrWide  =    76.000*fgkmm;
8463   const Double_t kRearUpWebStirrDep   =    15.000*fgkmm;
8464   const Double_t kRearUpWebStirrThick =     5.000*fgkmm;
8465   const Double_t kRearUpWebStirrH1    =    27.000*fgkmm;
8466   const Double_t kRearUpWebStirrH2    =    32.000*fgkmm;
8467   const Double_t kRearUpWebBarLen     =   130.000*fgkmm;
8468   const Double_t kRearUpWebBarHi      =    20.000*fgkmm;
8469   const Double_t kRearUpWebBarThick   =     5.000*fgkmm;
8470
8471   // Dimensions of the upper wheel slides (0872/C/Z/00-01-02)
8472   const Double_t kUpperSlideTotHeight =    93.500*fgkmm;
8473   const Double_t kUpperSlideBlockHi   =    62.500*fgkmm;
8474   const Double_t kUpperSlideWidth     =    36.000*fgkmm;
8475   const Double_t kUpperSlideTotDepth  =    51.000*fgkmm;
8476   const Double_t kUpperSlideIntDepth  =    36.000*fgkmm;
8477   const Double_t kUpperSlideStubHi    =    15.000*fgkmm;
8478   const Double_t kUpperSlideStubDep   =     8.000*fgkmm;
8479   const Double_t kUpperSlideWheelHi   =    18.500*fgkmm;
8480   const Double_t kUpperSlideHoleRout  =    11.000*fgkmm;
8481   const Double_t kUpperSlideHoleRint1 =     9.000*fgkmm;
8482   const Double_t kUpperSlideHoleRint2 =    11.500*fgkmm;
8483   const Double_t kUpperSlideHoleH1    =     7.000*fgkmm;
8484   const Double_t kUpperSlideHoleH2    =    46.000*fgkmm;
8485   const Double_t kUpperSlideHoleH3    =     1.100*fgkmm;
8486   const Double_t kUpperSlideHoleXPos  =    20.000*fgkmm;
8487   const Double_t kUpperSlidePinRmin   =     4.000*fgkmm;
8488   const Double_t kUpperSlidePinRmax   =     6.000*fgkmm;
8489   const Double_t kUpperSlidePinH1     =     7.000*fgkmm;
8490   const Double_t kUpperSlidePinH2     =    46.000*fgkmm;
8491   const Double_t kUpperSlidePinH3     =    25.500*fgkmm;
8492
8493   // Dimensions of the lower wheel slides (0872/C/W/00-01-02-03)
8494   const Double_t kLowerSlideTotHeight =    80.000*fgkmm;
8495   const Double_t kLowerSlideBlockHi   =    28.000*fgkmm;
8496   const Double_t kLowerSlideWidth     =    36.000*fgkmm;
8497   const Double_t kLowerSlideTotDepth  =    60.000*fgkmm;
8498   const Double_t kLowerSlideHoleRout  =     9.500*fgkmm;
8499   const Double_t kLowerSlideHoleRint  =     4.700*fgkmm;
8500   const Double_t kLowerSlideHoleH1    =    12.000*fgkmm;
8501   const Double_t kLowerSlideNoseBase  =    40.000*fgkmm;
8502   const Double_t kLowerSlideNoseBasHi =     6.000*fgkmm;//Computed
8503   const Double_t kLowerSlideNoseUpWid =    25.000*fgkmm;
8504   const Double_t kLowerSlideNoseDepth =    10.000*fgkmm;
8505   const Double_t kLowerSlidePinRmin   =     3.000*fgkmm;
8506   const Double_t kLowerSlidePinRmax   =     4.000*fgkmm;
8507   const Double_t kLowerSlidePinH1     =    12.000*fgkmm;
8508   const Double_t kLowerSlidePinH2     =    10.000*fgkmm;
8509
8510   // Dimensions and positions of the C1/C2 rail stirrups (0872/C/01-02)
8511   const Double_t kStirrCXPos          =   759.000*fgkmm;
8512   const Double_t kStirrCZPos          =  1867.000*fgkmm;
8513
8514   const Double_t kStirrC12Thick       =    15.000*fgkmm;
8515   const Double_t kStirrC12TotLen      =   314.000*fgkmm;
8516   const Double_t kStirrC12BodyHalfHi  =    95.000*fgkmm;
8517   const Double_t kStirrC12BodyLen     =   153.000*fgkmm;
8518   const Double_t kStirrC12HeadLen     =    50.000*fgkmm;
8519   const Double_t kStirrC12HeadHalfHi  =   165.000*fgkmm;
8520   const Double_t kStirrC12HeadIntHi   =   114.000*fgkmm;
8521   const Double_t kStirrC12HeadIntLen  =    45.000*fgkmm;
8522   const Double_t kStirrC12TailLen     =    14.000*fgkmm;
8523   const Double_t kStirrC12R100        =   100.000*fgkmm;
8524   const Double_t kStirrC12R50         =    50.000*fgkmm;
8525   const Double_t kStirrC12R10         =    10.000*fgkmm;
8526   const Double_t kStirrC12HeadAng     =    40.000; // Degree
8527
8528   const Int_t kNumberOfStirrCPoints   =    23;
8529
8530   // Dimensions and positions of the C5 rail stirrups (0872/C/05)
8531   const Double_t kStirrC5BodyLen      =   155.000*fgkmm;
8532
8533
8534   // Local variables
8535   Double_t xprof[2*kNumberOfStirrCPoints+1],yprof[2*kNumberOfStirrCPoints+1];
8536   Double_t xpos, ypos, zpos, alpha;
8537   Double_t xdummy, ydummy;
8538   
8539
8540   // First create all needed shapes
8541
8542   // The Supporting Ring (0872/C/04): a really complex Xtru
8543   // to approximate the arc with a polyline
8544   TGeoXtru *ringC2C3 = new TGeoXtru(2);
8545
8546   for (Int_t j=0; j<11; j++) { // The external arc
8547     xprof[j] = kRingCRmax*SinD(90*j/10);
8548     yprof[j] = kRingCRmax*CosD(90*j/10);
8549   }
8550
8551   xprof[11] = kRingCRmin;
8552   yprof[11] = yprof[10];
8553
8554   alpha = TMath::ASin(kRingCYToInsert/kRingCRmin); // Now the insert
8555   xprof[12] = kRingCRmin*TMath::Cos(alpha/2);
8556   yprof[12] = kRingCRmin*TMath::Sin(alpha/2);
8557   xprof[13] = kRingCRmin*TMath::Cos(alpha);
8558   yprof[13] = kRingCRmin*TMath::Sin(alpha);
8559
8560   xprof[14] = kRingCXToInsert;
8561   yprof[14] = yprof[13];
8562
8563   alpha = TMath::ACos(kRingCXToInsert/kRingCRmin); // The insert ending angle
8564   xprof[15] = kRingCRmin*TMath::Cos(alpha);
8565   yprof[15] = kRingCRmin*TMath::Sin(alpha);
8566
8567   for (Int_t j=7; j>1; j--) { // The internal arc
8568     xprof[23-j] = kRingCRmin*SinD(90*j/10);
8569     yprof[23-j] = kRingCRmin*CosD(90*j/10);
8570   }
8571
8572   alpha = TMath::ASin(kRingCHeight/kRingCRmin);    // The angle till the notch
8573   xprof[22] = kRingCRmin*TMath::Cos(alpha);
8574   yprof[22] = kRingCRmin*TMath::Sin(alpha);
8575
8576   xprof[23] = xprof[0];
8577   yprof[23] = yprof[22];
8578
8579   // We did the right side, now reflex on the left side
8580   for (Int_t jp = 0; jp < 22; jp++) {
8581     xprof[24+jp] = -xprof[23-1-jp];
8582     yprof[24+jp] =  yprof[23-1-jp];
8583   }
8584
8585   // wow! now the actual Xtru
8586   ringC2C3->DefinePolygon(2*kNumberOfRingPoints, xprof, yprof);
8587   ringC2C3->DefineSection(0, 0);
8588   ringC2C3->DefineSection(1, kRingCThick);
8589
8590   // The Forward Upper Hook (0872/C/09): a Composite Shape made of
8591   // a really complex Xtru to approximate the arc with a polyline,
8592   // another Xtru for the hole, and a BBox for the hollow
8593   // The main body
8594   TGeoXtru *forwUpHookMainBody = new TGeoXtru(2);
8595   forwUpHookMainBody->SetName("ITSforwUpHookMainBody");
8596
8597   xprof[ 0] = kForwUpHookHalfBase - kForwUpHookBaseCut;
8598   yprof[ 0] = kForwUpHookRext - kForwUpHookHiTot;
8599   xprof[ 1] = kForwUpHookHalfBase;
8600   yprof[ 1] = yprof[0] + kForwUpHookBaseCut;
8601   xprof[ 2] = xprof[1];
8602   yprof[ 2] = yprof[0] + (kForwUpHookHiInt - kForwUpHookRint);
8603   for (Int_t j=1; j<6; j++) {
8604     xprof[2+j] = xprof[2] + kForwUpHookRint*(1 - CosD(90*j/5));
8605     yprof[2+j] = yprof[2] + kForwUpHookRint*SinD(90*j/5);
8606   }
8607   xprof[ 8] = kForwUpHookWide/2;
8608   yprof[ 8] = yprof[7];
8609   xprof[ 9] = xprof[8];
8610   alpha = TMath::ASin(0.5*kForwUpHookWide/kForwUpHookRext);
8611   yprof[ 9] = kForwUpHookRext*TMath::Cos(alpha);
8612   xprof[10] = kForwUpHookRext*TMath::Sin(alpha/2);
8613   yprof[10] = kForwUpHookRext*TMath::Cos(alpha/2);
8614   xprof[11] = 0;
8615   yprof[11] = kForwUpHookRext;
8616
8617   // We did the right side, now reflex on the left side
8618   for (Int_t jp = 0; jp < kNumberOfForwUpHookPts; jp++) {
8619     xprof[12+jp] = -xprof[10-jp];
8620     yprof[12+jp] =  yprof[10-jp];
8621   }
8622
8623   // Now the actual Xtru
8624   forwUpHookMainBody->DefinePolygon(2*kNumberOfForwUpHookPts+1, xprof, yprof);
8625   forwUpHookMainBody->DefineSection(0, 0);
8626   forwUpHookMainBody->DefineSection(1, kForwUpHookThick);
8627
8628   // The hole
8629   TGeoXtru *forwUpHookHole = new TGeoXtru(2);
8630   forwUpHookHole->SetName("ITSforwUpHookHole");
8631
8632   xprof[0] = kForwUpHookHoleBase/2;
8633   yprof[0] = forwUpHookMainBody->GetY(0) + kForwUpHookHoleY;
8634   xprof[1] = kForwUpHookHoleWide/2;
8635   yprof[1] = yprof[0] + (xprof[1] - xprof[0]); // Go at 45deg
8636   xprof[2] = xprof[1];
8637   yprof[2] = yprof[0] + kForwUpHookHoleHi - kForwUpHookHoleR5;
8638   xprof[3] = xprof[2] - kForwUpHookHoleR5*(1 - CosD(45));
8639   yprof[3] = yprof[2] + kForwUpHookHoleR5*SinD(45);
8640   xprof[4] = xprof[2] - kForwUpHookHoleR5;
8641   yprof[4] = yprof[0] + kForwUpHookHoleHi;
8642
8643   // We did the right side, now reflex on the left side
8644   for (Int_t jp = 0; jp < kNumbOfForwUpHookHolePts; jp++) {
8645     xprof[5+jp] = -xprof[4-jp];
8646     yprof[5+jp] =  yprof[4-jp];
8647   }
8648
8649   // Now the actual Xtru
8650   forwUpHookHole->DefinePolygon(2*kNumbOfForwUpHookHolePts, xprof, yprof);
8651   forwUpHookHole->DefineSection(0, -0.1);
8652   forwUpHookHole->DefineSection(1, kForwUpHookThick+0.1);
8653
8654   // The hollow
8655   TGeoBBox *forwUpHookHollow = new TGeoBBox(2.1 *kForwUpHookHalfBase,
8656                                             0.55*kForwUpHookHollowHi,
8657                                             0.55*kForwUpHookHollowWide);
8658   forwUpHookHollow->SetName("ITSforwUpHookHollow");
8659
8660   TGeoTranslation *forwUpHookHollPos = new TGeoTranslation(0.,
8661                       forwUpHookMainBody->GetY(0) + 0.5*kForwUpHookHollowHi,
8662                       forwUpHookMainBody->GetZ(1) - 0.5*kForwUpHookHollowWide);
8663   forwUpHookHollPos->SetName("ITSforwUpHookHollPos");
8664   forwUpHookHollPos->RegisterYourself();
8665
8666   // Finally the actual shape: a CompositeShape
8667   TGeoCompositeShape *forwUpHookShape = new TGeoCompositeShape("ITSforwUpHookMainBody-ITSforwUpHookHole-ITSforwUpHookHollow:ITSforwUpHookHollPos");
8668
8669   // The Forward Lower Hook (0872/C/08): a Composite Shape made of
8670   // a really complex Xtru to approximate the arc with a polyline,
8671   // another Xtru for the hole, and a BBox for the hollow
8672   // The main body
8673   TGeoXtru *forwLwHookMainBody = new TGeoXtru(2);
8674   forwLwHookMainBody->SetName("ITSforwLwHookMainBody");
8675
8676   xprof[ 0] = kForwLwHookHalfBase - kForwLwHookBaseCut;
8677   yprof[ 0] = kForwLwHookRext - kForwLwHookHiTot;
8678   xprof[ 1] = kForwLwHookHalfBase;
8679   yprof[ 1] = yprof[0] + kForwLwHookBaseCut;
8680   xprof[ 2] = xprof[1];
8681   yprof[ 2] = yprof[0] + (kForwLwHookHollowHi - kForwLwHookYToHollow
8682                           - kForwLwHookRint);
8683   for (Int_t j=1; j<6; j++) {
8684     xprof[2+j] = xprof[2] + kForwLwHookRint*(1 - CosD(90*j/5));
8685     yprof[2+j] = yprof[2] + kForwLwHookRint*SinD(90*j/5);
8686   }
8687   xprof[ 8] = kForwLwHookWide/2;
8688   yprof[ 8] = yprof[7];
8689   xprof[ 9] = xprof[8];
8690   alpha = TMath::ASin(0.5*kForwLwHookWide/kForwLwHookRext);
8691   yprof[ 9] = kForwLwHookRext*TMath::Cos(alpha);
8692   xprof[10] = kForwLwHookRext*TMath::Sin(alpha/2);
8693   yprof[10] = kForwLwHookRext*TMath::Cos(alpha/2);
8694   xprof[11] = 0;
8695   yprof[11] = kForwLwHookRext;
8696
8697   // We did the right side, now reflex on the left side
8698   for (Int_t jp = 0; jp < kNumberOfForwLwHookPts; jp++) {
8699     xprof[12+jp] = -xprof[10-jp];
8700     yprof[12+jp] =  yprof[10-jp];
8701   }
8702
8703   // Now the actual Xtru
8704   forwLwHookMainBody->DefinePolygon(2*kNumberOfForwLwHookPts+1, xprof, yprof);
8705   forwLwHookMainBody->DefineSection(0, 0);
8706   forwLwHookMainBody->DefineSection(1, kForwLwHookThick);
8707
8708   // The hole
8709   TGeoXtru *forwLwHookHole = new TGeoXtru(2);
8710   forwLwHookHole->SetName("ITSforwLwHookHole");
8711
8712   xprof[0] = 0;
8713   yprof[0] = forwLwHookMainBody->GetY(0) + kForwLwHookHoleYPos
8714            - kForwLwHookHoleR;
8715   for (Int_t j=1; j<3; j++) {
8716     xprof[0+j] = xprof[0] + kForwLwHookHoleR*SinD(90*j/3);
8717     yprof[0+j] = yprof[0] + kForwLwHookHoleR*(1 - CosD(90*j/3));
8718   }
8719   xprof[3] = xprof[0] + kForwLwHookHoleR;
8720   yprof[3] = yprof[0] + kForwLwHookHoleR;
8721   xprof[4] = xprof[3];
8722   yprof[4] = yprof[3] + kForwLwHookHoleIntHi;
8723   for (Int_t j=1; j<3; j++) {
8724     xprof[4+j] = xprof[4] - kForwLwHookHoleR*(1 - CosD(90*j/3));
8725     yprof[4+j] = yprof[4] + kForwLwHookHoleR*SinD(90*j/3);
8726   }
8727   xprof[7] = xprof[0];
8728   yprof[7] = yprof[4] + kForwLwHookHoleR;
8729
8730   // We did the right side, now reflex on the left side
8731   for (Int_t jp = 0; jp < kNumbOfForwLwHookHolePts-1; jp++) {
8732     xprof[8+jp] = -xprof[6-jp];
8733     yprof[8+jp] =  yprof[6-jp];
8734   }
8735
8736   // Now the actual Xtru
8737   forwLwHookHole->DefinePolygon(2*kNumbOfForwLwHookHolePts, xprof, yprof);
8738   forwLwHookHole->DefineSection(0, -0.1);
8739   forwLwHookHole->DefineSection(1, kForwLwHookThick+0.1);
8740
8741   // The hollow
8742   TGeoBBox *forwLwHookHollow = new TGeoBBox(2.1 *kForwLwHookHalfBase,
8743                                             0.55*kForwLwHookHollowHi,
8744                                             0.55*kForwLwHookHollowWide);
8745   forwLwHookHollow->SetName("ITSforwLwHookHollow");
8746
8747   TGeoTranslation *forwLwHookHollPos = new TGeoTranslation(0.,
8748                       forwLwHookMainBody->GetY(0) + 0.5*kForwLwHookHollowHi,
8749                       forwLwHookMainBody->GetZ(1) - 0.5*kForwLwHookHollowWide);
8750   forwLwHookHollPos->SetName("ITSforwLwHookHollPos");
8751   forwLwHookHollPos->RegisterYourself();
8752
8753   // Finally the actual shape: a CompositeShape
8754   TGeoCompositeShape *forwLwHookShape = new TGeoCompositeShape("ITSforwLwHookMainBody-ITSforwLwHookHole-ITSforwLwHookHollow:ITSforwLwHookHollPos");
8755
8756   // The Rear Upper Hook (0872/C/10): a Composite Shape made of
8757   // a really complex Xtru to approximate the arc with a polyline,
8758   // and another Xtru for the hole
8759   // The main body
8760   TGeoXtru *rearUpHookMainBody = new TGeoXtru(2);
8761   rearUpHookMainBody->SetName("ITSrearUpHookMainBody");
8762
8763   xprof[0] = kRearUpHookHalfBase;
8764   yprof[0] = kRearUpHookRext - kRearUpHookHiTot;
8765   xprof[1] = xprof[0];
8766   yprof[1] = yprof[0] + (kRearUpHookHiInt - kRearUpHookRint); 
8767   for (Int_t j=1; j<6; j++) {
8768     xprof[1+j] = xprof[1] + kRearUpHookRint*(1 - CosD(90*j/5));
8769     yprof[1+j] = yprof[1] + kRearUpHookRint*SinD(90*j/5);
8770   }
8771   xprof[ 7] = kRearUpHookWide/2;
8772   yprof[ 7] = yprof[5];
8773   xprof[ 8] = xprof[7];
8774   alpha = TMath::ASin(0.5*kRearUpHookWide/kRearUpHookRext);
8775   yprof[ 8] = kRearUpHookRext*TMath::Cos(alpha);
8776   xprof[ 9] = kRearUpHookRext*TMath::Sin(alpha/2);
8777   yprof[ 9] = kRearUpHookRext*TMath::Cos(alpha/2);
8778   xprof[10] = 0;
8779   yprof[10] = kRearUpHookRext;
8780
8781   // We did the right side, now reflex on the left side
8782   for (Int_t jp = 0; jp < kNumberOfRearUpHookPts; jp++) {
8783     xprof[11+jp] = -xprof[9-jp];
8784     yprof[11+jp] =  yprof[9-jp];
8785   }
8786
8787   // Now the actual Xtru
8788   rearUpHookMainBody->DefinePolygon(2*kNumberOfRearUpHookPts+1, xprof, yprof);
8789   rearUpHookMainBody->DefineSection(0, 0);
8790   rearUpHookMainBody->DefineSection(1, kRearUpHookThick);
8791
8792   // The hole
8793   TGeoXtru *rearUpHookHole = new TGeoXtru(2);
8794   rearUpHookHole->SetName("ITSrearUpHookHole");
8795
8796   xprof[0] = kRearUpHookHoleBase/2;
8797   yprof[0] = rearUpHookMainBody->GetY(0) + kRearUpHookHoleY;
8798   xprof[1] = kRearUpHookHoleWide/2;
8799   yprof[1] = yprof[0] + (xprof[1] - xprof[0]); // Go at 45deg
8800   xprof[2] = xprof[1];
8801   yprof[2] = yprof[0] + kRearUpHookHoleHi - kRearUpHookHoleR5;
8802   xprof[3] = xprof[2] - kRearUpHookHoleR5*(1 - CosD(45));
8803   yprof[3] = yprof[2] + kRearUpHookHoleR5*SinD(45);
8804   xprof[4] = xprof[2] - kRearUpHookHoleR5;
8805   yprof[4] = yprof[0] + kRearUpHookHoleHi;
8806
8807   // We did the right side, now reflex on the left side
8808   for (Int_t jp = 0; jp < kNumbOfRearUpHookHolePts; jp++) {
8809     xprof[5+jp] = -xprof[4-jp];
8810     yprof[5+jp] =  yprof[4-jp];
8811   }
8812
8813   // Now the actual Xtru
8814   rearUpHookHole->DefinePolygon(2*kNumbOfRearUpHookHolePts, xprof, yprof);
8815   rearUpHookHole->DefineSection(0, -0.1);
8816   rearUpHookHole->DefineSection(1, kRearUpHookThick+0.1);
8817
8818   // Finally the actual shape: a CompositeShape
8819   TGeoCompositeShape *rearUpHookShape = new TGeoCompositeShape("ITSrearUpHookMainBody-ITSrearUpHookHole");
8820
8821   // The Rear Lower Hook (0872/C/11): a Xtru
8822   TGeoXtru *rearLwHookShape = new TGeoXtru(2);
8823   rearLwHookShape->SetName("ITSrearLwHookShape");
8824
8825   xprof[0] = kRearLwHookWide/2;
8826   yprof[0] = kRearLwHookRext - kRearLwHookHiTot;
8827   xprof[1] = xprof[0];
8828   alpha = TMath::ASin(0.5*kRearLwHookWide/kRearLwHookRext);
8829   yprof[1] = kRearLwHookRext*TMath::Cos(alpha);
8830   xprof[2] = kRearLwHookRext*TMath::Sin(alpha/2);
8831   yprof[2] = kRearLwHookRext*TMath::Cos(alpha/2);
8832   xprof[3] = 0;
8833   yprof[3] = kRearLwHookRext;
8834
8835   // We did the right side, now reflex on the left side
8836   for (Int_t jp = 0; jp < kNumberOfRearLwHookPts; jp++) {
8837     xprof[4+jp] = -xprof[2-jp];
8838     yprof[4+jp] =  yprof[2-jp];
8839   }
8840
8841   // Now the actual Xtru
8842   rearLwHookShape->DefinePolygon(2*kNumberOfRearLwHookPts+1, xprof, yprof);
8843   rearLwHookShape->DefineSection(0, 0);
8844   rearLwHookShape->DefineSection(1, kRearLwHookThick);
8845
8846   // The Rear Lower Bracket (0872/C/16): a Xtru
8847   TGeoXtru *rearLwBrackShape = new TGeoXtru(2);
8848   rearLwBrackShape->SetName("ITSrearLwBrackShape");
8849
8850   xprof[0] = 0;
8851   yprof[0] = 0;
8852   xprof[1] = xprof[0] + kRearLwBracketWide1 - kRearLwBracketWide2;
8853   yprof[1] = yprof[0];
8854   xprof[2] = xprof[1];
8855   yprof[2] = yprof[0] + kRearLwBracketHi2;
8856   xprof[3] = xprof[2] - kRearLwBracketWide1;
8857   yprof[3] = yprof[2];
8858   xprof[4] = xprof[3];
8859   yprof[4] = yprof[3] - kRearLwBracketHi1;
8860   xprof[5] = xprof[0];
8861   yprof[5] = yprof[4];
8862
8863   rearLwBrackShape->DefinePolygon(6, xprof, yprof);
8864   rearLwBrackShape->DefineSection(0,-kRearLwBracketThick/2);
8865   rearLwBrackShape->DefineSection(1, kRearLwBracketThick/2);
8866
8867   // The Forward S-shaped Stirrup for the webcam (0872/C/V/01): a Xtru
8868   TGeoXtru *forwWebSStirrSh = new TGeoXtru(2);
8869
8870   xprof[0] = 0;
8871   yprof[0] = 0;
8872   xprof[1] = xprof[0] + kForwWebSStirrLen1;
8873   yprof[1] = yprof[0];
8874   xprof[2] = xprof[1];
8875   yprof[2] = yprof[1] + kForwWebSStirrWide1;
8876   xprof[3] = xprof[0] - kForwWebSStirrLen2 + kForwWebSStirrLen3;
8877   yprof[3] = yprof[2];
8878   xprof[4] = xprof[3];
8879   yprof[4] = yprof[3] + kForwWebSStirrWide3;
8880   xprof[5] = xprof[4] - kForwWebSStirrLen3;
8881   yprof[5] = yprof[4];
8882   xprof[6] = xprof[5];
8883   yprof[6] = yprof[0] + kForwWebSStirrWide2;
8884   xprof[7] = xprof[0];
8885   yprof[7] = yprof[6];
8886
8887   forwWebSStirrSh->DefinePolygon(8, xprof, yprof);
8888   forwWebSStirrSh->DefineSection(0,-kForwWebSStirrDep/2);
8889   forwWebSStirrSh->DefineSection(1, kForwWebSStirrDep/2);
8890
8891   // The Forward T-shaped Stirrups for the webcam (0872/C/V/03-04): two Xtru
8892   TGeoXtru *forwWebTStirr3Sh = new TGeoXtru(2);
8893
8894   xprof[0] = -kForwWebTStirrWide2/2;
8895   yprof[0] = 0;
8896   xprof[1] = -kForwWebTStirrWide1/2;
8897   yprof[1] = yprof[0];
8898   xprof[2] = xprof[1];
8899   yprof[2] = yprof[1] - kForwWebTStirrLen1;
8900   xprof[3] =-xprof[2];
8901   yprof[3] = yprof[2];
8902   xprof[4] = xprof[3];
8903   yprof[4] = yprof[1];
8904   xprof[5] =-xprof[0];
8905   yprof[5] = yprof[4];
8906   xprof[6] = xprof[5];
8907   yprof[6] = kForwWebTStirrTotLen3 - kForwWebTStirrLen1;
8908   xprof[7] = xprof[0];
8909   yprof[7] = yprof[6];
8910
8911   forwWebTStirr3Sh->DefinePolygon(8, xprof, yprof);
8912   forwWebTStirr3Sh->DefineSection(0, 0);
8913   forwWebTStirr3Sh->DefineSection(1, kForwWebTStirrThick);
8914
8915   TGeoXtru *forwWebTStirr4Sh = new TGeoXtru(2);
8916
8917   yprof[6] = kForwWebTStirrTotLen4 - kForwWebTStirrLen1;
8918   yprof[7] = yprof[6];
8919
8920   forwWebTStirr4Sh->DefinePolygon(8, xprof, yprof);
8921   forwWebTStirr4Sh->DefineSection(0, 0);
8922   forwWebTStirr4Sh->DefineSection(1, kForwWebTStirrThick);
8923
8924   // The Forward and Rear clamp for the webcam (0872/C/V/02): a Xtru
8925   TGeoXtru *frWebClampSh = new TGeoXtru(2);
8926
8927   xprof[0] = kFRWebClampIntWide/2;
8928   yprof[0] = kFRWebClampIntHi;
8929   xprof[1] = xprof[0];
8930   yprof[1] = 0;
8931   xprof[2] = kFRWebClampExtWide/2;
8932   yprof[2] = yprof[1];
8933   xprof[3] = xprof[2];
8934   yprof[3] = kFRWebClampExtHi;
8935   for (Int_t jp = 0; jp < 4; jp++) {
8936     xprof[4+jp] = -xprof[3-jp];
8937     yprof[4+jp] =  yprof[3-jp];
8938   }
8939
8940   frWebClampSh->DefinePolygon(8, xprof, yprof);
8941   frWebClampSh->DefineSection(0,-kFRWebClampThick/2);
8942   frWebClampSh->DefineSection(1, kFRWebClampThick/2);
8943
8944   // The Rear Upper Stirrup for the webcam (0872/C/V/05): a Xtru
8945   TGeoXtru *upWebStirrSh = new TGeoXtru(2);
8946
8947   xprof[0] = 0;
8948   yprof[0] = 0;
8949   xprof[1] = xprof[0] - (kRearUpWebStirrWide - 2*kRearUpWebStirrThick);
8950   yprof[1] = yprof[0];
8951   xprof[2] = xprof[1];
8952   yprof[2] = yprof[1] + (kRearUpWebStirrH1 - kRearUpWebStirrThick);
8953   xprof[3] = xprof[2] - kRearUpWebStirrThick;
8954   yprof[3] = yprof[2];
8955   xprof[4] = xprof[3];
8956   yprof[4] = yprof[3] - kRearUpWebStirrH1;
8957   xprof[5] = xprof[4] + kRearUpWebStirrWide;
8958   yprof[5] = yprof[4];
8959   xprof[6] = xprof[5];
8960   yprof[6] = yprof[5] + kRearUpWebStirrH2;
8961   xprof[7] = xprof[0];
8962   yprof[7] = yprof[6];
8963
8964   upWebStirrSh->DefinePolygon(8, xprof, yprof);
8965   upWebStirrSh->DefineSection(0,-kRearUpWebStirrDep/2);
8966   upWebStirrSh->DefineSection(1, kRearUpWebStirrDep/2);
8967
8968   // The Rear Upper Bar for the webcam (0872/C/V/06): a BBox
8969   TGeoBBox *upRearWebBarSh = new TGeoBBox(kRearUpWebBarLen/2,
8970                                           kRearUpWebBarHi/2,
8971                                           kRearUpWebBarThick/2);
8972
8973   // The Webcam: a BBox
8974   TGeoBBox *webcamShape = new TGeoBBox(kFRWebClampIntWide/2,
8975                                        kWebcamLength/2,
8976                                        kFRWebClampIntHi/2);
8977
8978   // The Upper Wheel Slide (0872/C/Z/00-01-02)
8979   // A mother volume of air (to avoid assembly) contains the Alluminum block
8980   // (a Composite Shape: a Xtru and a Pcon for the hole) and the Steel pin
8981   // (a Pcon) (The wheels are approximated as part of the block itself)
8982   // The Air mother volume
8983   TGeoXtru *upSlideAirSh = new TGeoXtru(2);
8984   upSlideAirSh->SetName("ITSupperSlideAirShape");
8985
8986   xprof[0] = 0;
8987   yprof[0] = 0;
8988   xprof[1] = xprof[0];
8989   yprof[1] = kUpperSlideBlockHi + kUpperSlideStubHi - kUpperSlideWheelHi;
8990   xprof[2] = xprof[1] - kUpperSlideIntDepth;
8991   yprof[2] = yprof[1];
8992   xprof[3] = xprof[2];
8993   yprof[3] = yprof[2] - kUpperSlideTotHeight;
8994   xprof[4] = xprof[3] + kUpperSlideTotDepth;
8995   yprof[4] = yprof[3];
8996   xprof[5] = xprof[4];
8997   yprof[5] = yprof[0];
8998
8999   upSlideAirSh->DefinePolygon(6, xprof, yprof);
9000   upSlideAirSh->DefineSection(0,-kUpperSlideWidth/2);
9001   upSlideAirSh->DefineSection(1, kUpperSlideWidth/2);
9002
9003   // The (filled) Aluminum block: a Xtru
9004   TGeoXtru *upSlideAluSh = new TGeoXtru(2);
9005   upSlideAluSh->SetName("ITSupperSlideAluShape");
9006
9007   xprof[0] = upSlideAirSh->GetX(0);
9008   yprof[0] = upSlideAirSh->GetY(0);
9009   xprof[1] = upSlideAirSh->GetX(1);
9010   yprof[1] = upSlideAirSh->GetY(1);
9011   xprof[2] = xprof[1] - kUpperSlideStubDep;
9012   yprof[2] = yprof[1];
9013   xprof[3] = xprof[2];
9014   yprof[3] = yprof[2] - kUpperSlideStubHi;
9015   xprof[4] = upSlideAirSh->GetX(2);
9016   yprof[4] = yprof[3];
9017   xprof[5] = xprof[4];
9018   yprof[5] = yprof[4] - kUpperSlideBlockHi;
9019   xprof[6] = upSlideAirSh->GetX(5);
9020   yprof[6] = yprof[5];
9021   xprof[7] = xprof[6];
9022   yprof[7] = yprof[0];
9023
9024   upSlideAluSh->DefinePolygon(8, xprof, yprof);
9025   upSlideAluSh->DefineSection(0, upSlideAirSh->GetZ(0));
9026   upSlideAluSh->DefineSection(1, upSlideAirSh->GetZ(1));
9027
9028   // The cylindrical hole in the block; a Pcon
9029   TGeoPcon *upSlideHoleSh = new TGeoPcon(0, 360, 10);
9030   upSlideHoleSh->SetName("ITSupperSlideHoleShape");
9031
9032   zpos = upSlideAluSh->GetY(5);
9033   upSlideHoleSh->DefineSection(0, zpos-0.1, 0, kUpperSlideHoleRout);
9034   zpos += (kUpperSlideBlockHi - kUpperSlideHoleH3 - kUpperSlideHoleH2
9035         - 2*kUpperSlideHoleH1);
9036   upSlideHoleSh->DefineSection(1, zpos, 0, kUpperSlideHoleRout);
9037   upSlideHoleSh->DefineSection(2, zpos, 0, kUpperSlideHoleRint2);
9038   zpos += kUpperSlideHoleH3;
9039   upSlideHoleSh->DefineSection(3, zpos, 0, kUpperSlideHoleRint2);
9040   upSlideHoleSh->DefineSection(4, zpos, 0, kUpperSlideHoleRout);
9041   zpos += kUpperSlideHoleH1;
9042   upSlideHoleSh->DefineSection(5, zpos, 0, kUpperSlideHoleRout);
9043   upSlideHoleSh->DefineSection(6, zpos, 0, kUpperSlideHoleRint1);
9044   zpos += kUpperSlideHoleH2;
9045   upSlideHoleSh->DefineSection(7, zpos, 0, kUpperSlideHoleRint1);
9046   upSlideHoleSh->DefineSection(8, zpos, 0, kUpperSlideHoleRout);
9047   zpos += kUpperSlideHoleH1;
9048   upSlideHoleSh->DefineSection(9, zpos+0.1, 0, kUpperSlideHoleRout);
9049
9050   TGeoCombiTrans *upSlideHolePos = new TGeoCombiTrans(-kUpperSlideHoleXPos,0,0,
9051                                    new TGeoRotation("",0,-90,0) );
9052   upSlideHolePos->SetName("ITSupperSlideHolePos");
9053   upSlideHolePos->RegisterYourself();
9054
9055   // The actual block: a CompositeShape
9056   TGeoCompositeShape *upSlideBlockSh = new TGeoCompositeShape("ITSupperSlideAluShape-ITSupperSlideHoleShape:ITSupperSlideHolePos");
9057
9058   // The Steel pin in the block; a Pcon
9059   TGeoPcon *upSlidePinSh = new TGeoPcon(0, 360, 6);
9060   upSlidePinSh->SetName("ITSupperSlidePinShape");
9061
9062   zpos = upSlideAluSh->GetY(5) - (kUpperSlidePinH1 + kUpperSlidePinH2
9063        + kUpperSlidePinH3 - kUpperSlideBlockHi);
9064   upSlidePinSh->DefineSection(0, zpos, 0, kUpperSlidePinRmin);
9065   zpos += kUpperSlidePinH3;
9066   upSlidePinSh->DefineSection(1, zpos, 0, kUpperSlidePinRmin);
9067   upSlidePinSh->DefineSection(2, zpos, 0, kUpperSlidePinRmax);
9068   zpos += kUpperSlidePinH2;
9069   upSlidePinSh->DefineSection(3, zpos, 0, kUpperSlidePinRmax);
9070   upSlidePinSh->DefineSection(4, zpos, 0, kUpperSlidePinRmin);
9071   zpos += kUpperSlidePinH1;
9072   upSlidePinSh->DefineSection(5, zpos, 0, kUpperSlidePinRmin);
9073
9074   // The Lower Wheel Slide (0872/C/W/00-01-02-03)
9075   // A mother volume of air (to avoid assembly) contains the Alluminum block
9076   // (a Composite Shape: a Xtru and a Pcon for the hole), the Alluminum nose
9077   // (a Xtru) and the Steel pin (a Pcon)
9078   // (The wheels are approximated as part of the block itself)
9079   // The Air mother volume
9080   TGeoXtru *lwSlideAirSh = new TGeoXtru(2);
9081   lwSlideAirSh->SetName("ITSlowerSlideAirShape");
9082
9083   xprof[0] = 0;
9084   yprof[0] = 0;
9085   xprof[1] = xprof[0] + kLowerSlideTotDepth/2 - kLowerSlideNoseBase/2;
9086   yprof[1] = yprof[0];
9087   xprof[2] = xprof[1];
9088   yprof[2] = yprof[1] - (kLowerSlideBlockHi + kLowerSlidePinH2);
9089   xprof[3] = xprof[2] - kLowerSlideTotDepth;
9090   yprof[3] = yprof[2];
9091   xprof[4] = xprof[3];
9092   yprof[4] = yprof[3] + kLowerSlidePinH2 + kLowerSlideTotHeight;
9093   xprof[5] = xprof[0];
9094   yprof[5] = yprof[4];
9095
9096   lwSlideAirSh->DefinePolygon(6, xprof, yprof);
9097   lwSlideAirSh->DefineSection(0,-kLowerSlideWidth/2);
9098   lwSlideAirSh->DefineSection(1, kLowerSlideWidth/2);
9099
9100   // The (filled) Aluminum block: a Xtru
9101   TGeoXtru *lwSlideAluSh = new TGeoXtru(2);
9102   lwSlideAluSh->SetName("ITSlowerSlideAluShape");
9103
9104   xprof[0] = lwSlideAirSh->GetX(0);
9105   yprof[0] = lwSlideAirSh->GetY(0);
9106   xprof[1] = lwSlideAirSh->GetX(1);
9107   yprof[1] = lwSlideAirSh->GetY(1);
9108   xprof[2] = xprof[1];
9109   yprof[2] = yprof[1] - kLowerSlideBlockHi;
9110   xprof[3] = lwSlideAirSh->GetX(3);
9111   yprof[3] = yprof[2];
9112   xprof[4] = xprof[3];
9113   yprof[4] = yprof[3] + kLowerSlideBlockHi;
9114   xprof[5] = xprof[4] + kLowerSlideTotDepth/2;
9115   yprof[5] = yprof[4];
9116   xprof[6] = xprof[5];
9117   yprof[6] = lwSlideAirSh->GetY(4);
9118   xprof[7] = xprof[0];
9119   yprof[7] = yprof[6];
9120
9121   lwSlideAluSh->DefinePolygon(8, xprof, yprof);
9122   lwSlideAluSh->DefineSection(0, lwSlideAirSh->GetZ(0));
9123   lwSlideAluSh->DefineSection(1, lwSlideAirSh->GetZ(1));
9124
9125   // The cylindrical hole in the block; a Pcon
9126   TGeoPcon *lwSlideHoleSh = new TGeoPcon(0, 360, 4);
9127   lwSlideHoleSh->SetName("ITSlowerSlideHoleShape");
9128
9129   zpos = lwSlideAluSh->GetY(2);
9130   lwSlideHoleSh->DefineSection(0, zpos-0.1, 0, kLowerSlideHoleRout);
9131   zpos += kLowerSlideHoleH1;
9132   lwSlideHoleSh->DefineSection(1, zpos, 0, kLowerSlideHoleRout);
9133   lwSlideHoleSh->DefineSection(2, zpos, 0, kLowerSlideHoleRint);
9134   zpos = lwSlideAluSh->GetY(4);
9135   lwSlideHoleSh->DefineSection(3, zpos, 0, kLowerSlideHoleRint);
9136
9137   TGeoCombiTrans *lwSlideHolePos = new TGeoCombiTrans(lwSlideAluSh->GetX(5),
9138                                                       0, 0,
9139                                    new TGeoRotation("",0,-90,0) );
9140   lwSlideHolePos->SetName("ITSlowerSlideHolePos");
9141   lwSlideHolePos->RegisterYourself();
9142
9143   // The actual block: a CompositeShape
9144   TGeoCompositeShape *lwSlideBlockSh = new TGeoCompositeShape("ITSlowerSlideAluShape-ITSlowerSlideHoleShape:ITSlowerSlideHolePos");
9145
9146   // The Aluminum nose: a Xtru
9147   TGeoXtru *lwSlideNoseSh = new TGeoXtru(2);
9148   lwSlideNoseSh->SetName("ITSlowerSlideNoseShape");
9149
9150   xprof[0] = lwSlideAluSh->GetX(5);
9151   yprof[0] = lwSlideAluSh->GetY(5);
9152   xprof[1] = xprof[0] - kLowerSlideNoseBase/2;
9153   yprof[1] = yprof[0];
9154   xprof[2] = xprof[1];
9155   yprof[2] = yprof[1] + kLowerSlideNoseBasHi;
9156   xprof[3] = lwSlideAluSh->GetX(0) - kLowerSlideNoseUpWid;
9157   yprof[3] = lwSlideAluSh->GetY(6);
9158   xprof[4] = xprof[0];
9159   yprof[4] = yprof[3];
9160
9161   lwSlideNoseSh->DefinePolygon(5, xprof, yprof);
9162   lwSlideNoseSh->DefineSection(0,-kLowerSlideNoseDepth/2);
9163   lwSlideNoseSh->DefineSection(1, kLowerSlideNoseDepth/2);
9164
9165   // The Steel pin in the block; a Pcon
9166   TGeoPcon *lwSlidePinSh = new TGeoPcon(0, 360, 4);
9167   lwSlidePinSh->SetName("ITSlowerSlidePinShape");
9168
9169   zpos = lwSlideAirSh->GetY(2);
9170   lwSlidePinSh->DefineSection(0, zpos, 0, kLowerSlidePinRmax);
9171   zpos += kLowerSlidePinH2;
9172   lwSlidePinSh->DefineSection(1, zpos, 0, kLowerSlidePinRmax);
9173   lwSlidePinSh->DefineSection(2, zpos, 0, kLowerSlidePinRmin);
9174   zpos += kLowerSlidePinH1;
9175   lwSlidePinSh->DefineSection(3, zpos, 0, kLowerSlidePinRmin);
9176
9177   // The Stirrup on the Muon side (0872/C/01-02): a really complex Xtru
9178   // to approximate arcs with polylines
9179   TGeoXtru *stirrupC1C2Sh = new TGeoXtru(2);
9180
9181   for (Int_t j=0; j<11; j++) { // The internal arc
9182     xprof[j] = kStirrC12R50*(1 - CosD(90*j/10));
9183     yprof[j] = kStirrC12R50*SinD(90*j/10);
9184   }
9185
9186   xprof[11] = xprof[10] + kStirrC12TailLen;
9187   yprof[11] = yprof[10];
9188   xprof[12] = xprof[11];
9189   yprof[12] = kStirrC12BodyHalfHi;
9190   xprof[13] = xprof[12] - kStirrC12BodyLen;
9191   yprof[13] = yprof[12];
9192
9193   xprof[17] = xprof[12] - kStirrC12TotLen + kStirrC12HeadLen;
9194   yprof[17] = kStirrC12HeadHalfHi;
9195   IntersectCircle(-TanD(kStirrC12HeadAng), xprof[17], yprof[17],
9196                   kStirrC12R100, xprof[13], yprof[13]+kStirrC12R100,
9197                   xprof[16], yprof[16], xdummy, ydummy);
9198   alpha = TMath::ASin((xprof[13]-xprof[16])/kStirrC12R100);
9199   xprof[14] = xprof[13] - kStirrC12R100*TMath::Sin(alpha/3);
9200   yprof[14] = yprof[13] + kStirrC12R100*(1 - TMath::Cos(alpha/3));
9201   xprof[15] = xprof[13] - kStirrC12R100*TMath::Sin(2*alpha/3);
9202   yprof[15] = yprof[13] + kStirrC12R100*(1 - TMath::Cos(2*alpha/3));
9203
9204   xprof[18] = xprof[17] - kStirrC12HeadLen;
9205   yprof[18] = yprof[17];
9206   xprof[19] = xprof[18];
9207   yprof[19] = kStirrC12HeadIntHi;
9208   xprof[20] = xprof[19] + kStirrC12HeadIntLen - kStirrC12R10;
9209   yprof[20] = yprof[19];
9210   for (Int_t j=1; j<4; j++) {
9211     xprof[20+j] = xprof[20] + kStirrC12R10*SinD(90*j/3);
9212     yprof[20+j] = yprof[20] - kStirrC12R10*(1 - CosD(90*j/3));
9213   }
9214
9215   // We did the up side, now reflex on the bottom side
9216   for (Int_t jp = 0; jp < kNumberOfStirrCPoints; jp++) {
9217     xprof[24+jp] =  xprof[23-jp];
9218     yprof[24+jp] = -yprof[23-jp];
9219   }
9220
9221   // Now the actual Xtru
9222   stirrupC1C2Sh->DefinePolygon(2*kNumberOfStirrCPoints+1, xprof, yprof);
9223   stirrupC1C2Sh->DefineSection(0,-kStirrC12Thick/2);
9224   stirrupC1C2Sh->DefineSection(1, kStirrC12Thick/2);
9225
9226   // The first element of the Stirrup on the Forward side (0872/C/05):
9227   // a really complex Xtru (equal to part of the Muon Stirrup)
9228   // (0872/C/06 and 0872/C/07 are dismounted after positioning the TPC to I.P.)
9229   TGeoXtru *stirrupC5Sh = new TGeoXtru(2);
9230
9231   for (Int_t j=0; j<13; j++) { // The internal arc and the tail
9232     xprof[j] = stirrupC1C2Sh->GetX(j);
9233     yprof[j] = stirrupC1C2Sh->GetY(j);
9234   }
9235
9236   xprof[13] = xprof[12] - kStirrC5BodyLen;
9237   yprof[13] = yprof[12];
9238
9239   // We did the up side, now reflex on the bottom side
9240   for (Int_t jp = 0; jp < 13; jp++) {
9241     xprof[14+jp] =  xprof[13-jp];
9242     yprof[14+jp] = -yprof[13-jp];
9243   }
9244
9245   // Now the actual Xtru
9246   stirrupC5Sh->DefinePolygon(27, xprof, yprof);
9247   stirrupC5Sh->DefineSection(0,-kStirrC12Thick/2);
9248   stirrupC5Sh->DefineSection(1, kStirrC12Thick/2);
9249
9250
9251   // We have all shapes: now create the real volumes
9252   TGeoMedium *medAlcoa   = mgr->GetMedium("ITS_ALUMINUM$"); // To code!!!!!!
9253   TGeoMedium *medHokotol = mgr->GetMedium("ITS_HOKOTOL$");
9254   TGeoMedium *medAnticor = mgr->GetMedium("ITS_ANTICORODAL$");
9255   TGeoMedium *medErgal   = mgr->GetMedium("ITS_ERGAL$");
9256   TGeoMedium *medAisi    = mgr->GetMedium("ITS_AISI304L$");
9257   TGeoMedium *medAir     = mgr->GetMedium("ITS_AIR$");
9258   TGeoMedium *medPlexy   = mgr->GetMedium("ITS_PLEXYGLAS$");
9259   TGeoMedium *medPVC     = mgr->GetMedium("ITS_PVC$");
9260
9261
9262   TGeoVolume *suppRingC2C3  = new TGeoVolume("ITSTPCsupportRingC2C3",
9263                                              ringC2C3, medAlcoa);
9264
9265   suppRingC2C3->SetVisibility(kTRUE);
9266   suppRingC2C3->SetLineColor(6); // Purple
9267   suppRingC2C3->SetLineWidth(1);
9268   suppRingC2C3->SetFillColor(suppRingC2C3->GetLineColor());
9269   suppRingC2C3->SetFillStyle(4000); // 0% transparent
9270
9271   TGeoVolume *forwUpHook  = new TGeoVolume("ITSTPCsupportForwUpHook",
9272                                            forwUpHookShape, medHokotol);
9273
9274   forwUpHook->SetVisibility(kTRUE);
9275   forwUpHook->SetLineColor(6); // Purple
9276   forwUpHook->SetLineWidth(1);
9277   forwUpHook->SetFillColor(forwUpHook->GetLineColor());
9278   forwUpHook->SetFillStyle(4000); // 0% transparent
9279
9280   TGeoVolume *forwLwHook  = new TGeoVolume("ITSTPCsupportForwLwHook",
9281                                            forwLwHookShape, medHokotol);
9282
9283   forwLwHook->SetVisibility(kTRUE);
9284   forwLwHook->SetLineColor(6); // Purple
9285   forwLwHook->SetLineWidth(1);
9286   forwLwHook->SetFillColor(forwLwHook->GetLineColor());
9287   forwLwHook->SetFillStyle(4000); // 0% transparent
9288
9289   TGeoVolume *rearUpHook  = new TGeoVolume("ITSTPCsupportRearUpHook",
9290                                            rearUpHookShape, medHokotol);
9291
9292   rearUpHook->SetVisibility(kTRUE);
9293   rearUpHook->SetLineColor(6); // Purple
9294   rearUpHook->SetLineWidth(1);
9295   rearUpHook->SetFillColor(rearUpHook->GetLineColor());
9296   rearUpHook->SetFillStyle(4000); // 0% transparent
9297
9298   TGeoVolume *rearLwHook  = new TGeoVolume("ITSTPCsupportRearLwHook",
9299                                            rearLwHookShape, medAnticor);
9300
9301   rearLwHook->SetVisibility(kTRUE);
9302   rearLwHook->SetLineColor(6); // Purple
9303   rearLwHook->SetLineWidth(1);
9304   rearLwHook->SetFillColor(rearLwHook->GetLineColor());
9305   rearLwHook->SetFillStyle(4000); // 0% transparent
9306
9307   TGeoVolume *rearLwBrack  = new TGeoVolume("ITSTPCsupportRearLwBracket",
9308                                             rearLwBrackShape, medAnticor);
9309
9310   rearLwBrack->SetVisibility(kTRUE);
9311   rearLwBrack->SetLineColor(6); // Purple
9312   rearLwBrack->SetLineWidth(1);
9313   rearLwBrack->SetFillColor(rearLwBrack->GetLineColor());
9314   rearLwBrack->SetFillStyle(4000); // 0% transparent
9315
9316   TGeoVolume *forwWebSStirrup  = new TGeoVolume("ITSTPCsupportForwWebSStirrup",
9317                                                 forwWebSStirrSh, medAnticor);
9318
9319   forwWebSStirrup->SetVisibility(kTRUE);
9320   forwWebSStirrup->SetLineColor(6); // Purple
9321   forwWebSStirrup->SetLineWidth(1);
9322   forwWebSStirrup->SetFillColor(forwWebSStirrup->GetLineColor());
9323   forwWebSStirrup->SetFillStyle(4000); // 0% transparent
9324
9325   TGeoVolume *forwWebTStirr3  = new TGeoVolume("ITSTPCsupportForwWebTStirrup3",
9326                                                forwWebTStirr3Sh, medAnticor);
9327
9328   forwWebTStirr3->SetVisibility(kTRUE);
9329   forwWebTStirr3->SetLineColor(6); // Purple
9330   forwWebTStirr3->SetLineWidth(1);
9331   forwWebTStirr3->SetFillColor(forwWebTStirr3->GetLineColor());
9332   forwWebTStirr3->SetFillStyle(4000); // 0% transparent
9333
9334   TGeoVolume *forwWebTStirr4  = new TGeoVolume("ITSTPCsupportForwWebTStirrup4",
9335                                                forwWebTStirr4Sh, medAnticor);
9336
9337   forwWebTStirr4->SetVisibility(kTRUE);
9338   forwWebTStirr4->SetLineColor(6); // Purple
9339   forwWebTStirr4->SetLineWidth(1);
9340   forwWebTStirr4->SetFillColor(forwWebTStirr4->GetLineColor());
9341   forwWebTStirr4->SetFillStyle(4000); // 0% transparent
9342
9343   TGeoVolume *frWebClamp  = new TGeoVolume("ITSTPCsupportForwRearWebClamp",
9344                                            frWebClampSh, medPlexy);
9345
9346   frWebClamp->SetVisibility(kTRUE);
9347   frWebClamp->SetLineColor(kAzure);
9348   frWebClamp->SetLineWidth(1);
9349   frWebClamp->SetFillColor(frWebClamp->GetLineColor());
9350   frWebClamp->SetFillStyle(4000); // 0% transparent
9351
9352   TGeoVolume *upWebStirrup  = new TGeoVolume("ITSTPCsupportUpperWebStirrup",
9353                                              upWebStirrSh, medAnticor);
9354
9355   upWebStirrup->SetVisibility(kTRUE);
9356   upWebStirrup->SetLineColor(6); // Purple
9357   upWebStirrup->SetLineWidth(1);
9358   upWebStirrup->SetFillColor(upWebStirrup->GetLineColor());
9359   upWebStirrup->SetFillStyle(4000); // 0% transparent
9360
9361   TGeoVolume *upRearWebBar  = new TGeoVolume("ITSTPCsupportUpperRearWebBar",
9362                                              upRearWebBarSh, medPlexy);
9363
9364   upRearWebBar->SetVisibility(kTRUE);
9365   upRearWebBar->SetLineColor(kAzure);
9366   upRearWebBar->SetLineWidth(1);
9367   upRearWebBar->SetFillColor(upRearWebBar->GetLineColor());
9368   upRearWebBar->SetFillStyle(4000); // 0% transparent
9369
9370   TGeoVolume *webCam  = new TGeoVolume("ITSTPCsupportWebcam",
9371                                        webcamShape, medPVC);
9372
9373   webCam->SetVisibility(kTRUE);
9374   webCam->SetLineColor(kBlack);
9375   webCam->SetLineWidth(1);
9376   webCam->SetFillColor(webCam->GetLineColor());
9377   webCam->SetFillStyle(4000); // 0% transparent
9378
9379   TGeoVolume *upSlideVol  = new TGeoVolume("ITSTPCsupportUpperSlide",
9380                                            upSlideAirSh, medAir);
9381
9382   upSlideVol->SetVisibility(kFALSE);
9383
9384   TGeoVolume *upSlideBlock  = new TGeoVolume("ITSTPCsupportUpperSlideBlock",
9385                                              upSlideBlockSh, medAnticor);
9386
9387   upSlideBlock->SetVisibility(kTRUE);
9388   upSlideBlock->SetLineColor(6); // Purple
9389   upSlideBlock->SetLineWidth(1);
9390   upSlideBlock->SetFillColor(upSlideBlock->GetLineColor());
9391   upSlideBlock->SetFillStyle(4000); // 0% transparent
9392
9393   TGeoVolume *upSlidePin  = new TGeoVolume("ITSTPCsupportUpperSlidePin",
9394                                            upSlidePinSh, medAisi);
9395
9396   upSlidePin->SetVisibility(kTRUE);
9397   upSlidePin->SetLineColor(kGray);
9398   upSlidePin->SetLineWidth(1);
9399   upSlidePin->SetFillColor(upSlidePin->GetLineColor());
9400   upSlidePin->SetFillStyle(4000); // 0% transparent
9401
9402   TGeoVolume *lwSlideVol  = new TGeoVolume("ITSTPCsupportLowerSlide",
9403                                            lwSlideAirSh, medAir);
9404
9405   lwSlideVol->SetVisibility(kFALSE);
9406
9407   TGeoVolume *lwSlideBlock  = new TGeoVolume("ITSTPCsupportLowerSlideBlock",
9408                                              lwSlideBlockSh, medAnticor);
9409
9410   lwSlideBlock->SetVisibility(kTRUE);
9411   lwSlideBlock->SetLineColor(6); // Purple
9412   lwSlideBlock->SetLineWidth(1);
9413   lwSlideBlock->SetFillColor(lwSlideBlock->GetLineColor());
9414   lwSlideBlock->SetFillStyle(4000); // 0% transparent
9415
9416   TGeoVolume *lwSlideNose  = new TGeoVolume("ITSTPCsupportLowerSlideNose",
9417                                             lwSlideNoseSh, medAnticor);
9418
9419   lwSlideNose->SetVisibility(kTRUE);
9420   lwSlideNose->SetLineColor(6); // Purple
9421   lwSlideNose->SetLineWidth(1);
9422   lwSlideNose->SetFillColor(lwSlideNose->GetLineColor());
9423   lwSlideNose->SetFillStyle(4000); // 0% transparent
9424
9425   TGeoVolume *lwSlidePin  = new TGeoVolume("ITSTPCsupportLowerSlidePin",
9426                                            lwSlidePinSh, medAisi);
9427
9428   lwSlidePin->SetVisibility(kTRUE);
9429   lwSlidePin->SetLineColor(kGray);
9430   lwSlidePin->SetLineWidth(1);
9431   lwSlidePin->SetFillColor(lwSlidePin->GetLineColor());
9432   lwSlidePin->SetFillStyle(4000); // 0% transparent
9433
9434   TGeoVolume *stirrC1C2  = new TGeoVolume("ITSTPCsupportStirrupC1C2",
9435                                           stirrupC1C2Sh, medErgal);
9436
9437   stirrC1C2->SetVisibility(kTRUE);
9438   stirrC1C2->SetLineColor(6); // Purple
9439   stirrC1C2->SetLineWidth(1);
9440   stirrC1C2->SetFillColor(stirrC1C2->GetLineColor());
9441   stirrC1C2->SetFillStyle(4000); // 0% transparent
9442
9443   TGeoVolume *stirrC5  = new TGeoVolume("ITSTPCsupportStirrupC5",
9444                                         stirrupC5Sh, medErgal);
9445
9446   stirrC5->SetVisibility(kTRUE);
9447   stirrC5->SetLineColor(6); // Purple
9448   stirrC5->SetLineWidth(1);
9449   stirrC5->SetFillColor(stirrC5->GetLineColor());
9450   stirrC5->SetFillStyle(4000); // 0% transparent
9451
9452
9453   // Build up the wheel slides
9454   upSlideVol->AddNode(upSlideBlock,1,0);
9455   upSlideVol->AddNode(upSlidePin,  1,
9456                       new TGeoCombiTrans(-kUpperSlideHoleXPos, 0, 0,
9457                                          new TGeoRotation("",0,-90,0) ) );
9458
9459   lwSlideVol->AddNode(lwSlideBlock,1,0);
9460   lwSlideVol->AddNode(lwSlideNose ,1,0);
9461   lwSlideVol->AddNode(lwSlidePin,  1,
9462                       new TGeoCombiTrans(lwSlideAluSh->GetX(5), 0, 0,
9463                                          new TGeoRotation("",0,-90,0) ) );
9464
9465
9466   // Finally put everything in the mother volume
9467   moth->AddNode(suppRingC2C3,1,
9468                 new TGeoTranslation(0, 0, kRingCZPos+kRingCZToTPC) );
9469   moth->AddNode(suppRingC2C3,2,
9470                 new TGeoCombiTrans( 0, 0,-kRingCZPos,
9471                                    new TGeoRotation("",0.,180.,0.) ) );
9472   moth->AddNode(suppRingC2C3,3,
9473                 new TGeoCombiTrans( 0, 0, kRingCZPos+kRingCZToTPC,
9474                                    new TGeoRotation("",0.,0.,180.) ) );
9475   moth->AddNode(suppRingC2C3,4,
9476                 new TGeoCombiTrans( 0, 0,-kRingCZPos,
9477                                    new TGeoRotation("",0.,180.,180.) ) );
9478
9479   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
9480   moth->AddNode(forwUpHook,1,
9481                 new TGeoTranslation( 0, 0, zpos) );
9482
9483   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
9484   moth->AddNode(forwLwHook,1,
9485                 new TGeoCombiTrans( 0, 0, zpos,
9486                                    new TGeoRotation("",0.,0.,180.) ) );
9487
9488   zpos = kRingCZPos + kRingCThick + kRearUpHookThick;
9489   moth->AddNode(rearUpHook,1,
9490                 new TGeoTranslation( 0, 0,-zpos) );
9491
9492   zpos = kRingCZPos + kRingCThick + kRearLwHookThick;
9493   moth->AddNode(rearLwHook,1,
9494                 new TGeoCombiTrans( 0, 0,-zpos,
9495                                    new TGeoRotation("",0.,0.,180.) ) );
9496
9497   xpos =  kRearLwHookWide/2 + kRearLwBracketThick/2;
9498   ypos = -kRingCHeight;
9499   moth->AddNode(rearLwBrack,1,
9500                 new TGeoCombiTrans( xpos, ypos,-zpos,
9501                                    new TGeoRotation("", 90.,-90.,-90.) ) );
9502   moth->AddNode(rearLwBrack,2,
9503                 new TGeoCombiTrans(-xpos, ypos,-zpos,
9504                                    new TGeoRotation("", 90.,-90.,-90.) ) );
9505
9506   xpos = kForwUpHookWide/2;
9507   ypos = (forwUpHookMainBody->GetY(8) + forwUpHookMainBody->GetY(9))/2;
9508   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
9509   moth->AddNode(forwWebSStirrup,1,
9510                 new TGeoCombiTrans( xpos, ypos, zpos,
9511                                    new TGeoRotation("", 0., 90., 0.) ) );
9512   xpos = kForwLwHookWide/2;
9513   ypos = (forwLwHookMainBody->GetY(8) + forwLwHookMainBody->GetY(9))/2;
9514   moth->AddNode(forwWebSStirrup,2,
9515                 new TGeoCombiTrans( xpos,-ypos, zpos,
9516                                    new TGeoRotation("", 0., 90., 0.) ) );
9517
9518   xpos = kForwUpHookWide/2
9519         + (forwWebSStirrSh->GetX(4) + forwWebSStirrSh->GetX(5))/2;
9520   ypos = (forwUpHookMainBody->GetY(8) + forwUpHookMainBody->GetY(9))/2
9521         +  forwWebSStirrSh->GetZ(1) - forwWebTStirr3Sh->GetY(7);
9522   zpos += (forwWebSStirrSh->GetY(4) - forwWebSStirrSh->GetY(0));
9523   moth->AddNode(forwWebTStirr3,1,
9524                 new TGeoTranslation( xpos, ypos, zpos) );
9525
9526   ypos -= frWebClampSh->GetZ(1);
9527   moth->AddNode(frWebClamp,1,
9528                 new TGeoCombiTrans( xpos, ypos, zpos+forwWebTStirr3Sh->GetZ(1),
9529                                    new TGeoRotation("", 0., 90., 0.) ) );
9530
9531   ypos -= webcamShape->GetDY()/2;
9532   moth->AddNode(webCam,1,
9533                 new TGeoTranslation( xpos, ypos,
9534                      zpos+forwWebTStirr3Sh->GetZ(1)+webcamShape->GetDZ()) );
9535
9536   xpos = kForwLwHookWide/2
9537         + (forwWebSStirrSh->GetX(4) + forwWebSStirrSh->GetX(5))/2;
9538   ypos = (forwLwHookMainBody->GetY(8) + forwLwHookMainBody->GetY(9))/2
9539         +  forwWebSStirrSh->GetZ(1) - forwWebTStirr4Sh->GetY(7);
9540   moth->AddNode(forwWebTStirr4,1,
9541                 new TGeoCombiTrans( xpos,-ypos, zpos,
9542                                    new TGeoRotation("", 180., 0., 0.) ) );
9543
9544   ypos -= frWebClampSh->GetZ(1);
9545   moth->AddNode(frWebClamp,2,
9546                 new TGeoCombiTrans( xpos,-ypos, zpos+forwWebTStirr4Sh->GetZ(1),
9547                                    new TGeoRotation("", 0., 90., 0.) ) );
9548
9549   ypos -= webcamShape->GetDY()/2;
9550   moth->AddNode(webCam,2,
9551                 new TGeoTranslation( xpos,-ypos,
9552                      zpos+forwWebTStirr4Sh->GetZ(1)+webcamShape->GetDZ()) );
9553
9554   xpos = kRearUpHookWide/2 + kRearUpWebStirrDep/2;
9555   ypos = kRingCHeight;
9556   zpos = kRingCZPos + kRingCThick;
9557   moth->AddNode(upWebStirrup,1,
9558                 new TGeoCombiTrans( xpos, ypos,-zpos,
9559                                    new TGeoRotation("",-90.,-90., 90.) ) );
9560   moth->AddNode(upWebStirrup,2,
9561                 new TGeoCombiTrans(-xpos, ypos,-zpos,
9562                                    new TGeoRotation("",-90.,-90., 90.) ) );
9563
9564   ypos = kRingCHeight + upWebStirrSh->GetY(2) - upRearWebBarSh->GetDY();
9565   zpos = kRingCZPos + kRingCThick + upWebStirrSh->GetX(3)
9566        - upRearWebBarSh->GetDZ();
9567   moth->AddNode(upRearWebBar,1,
9568                 new TGeoTranslation( 0, ypos,-zpos) );
9569
9570   zpos -= upRearWebBarSh->GetDZ();
9571   moth->AddNode(frWebClamp,3,
9572                 new TGeoCombiTrans( 0, ypos,-zpos,
9573                                    new TGeoRotation("", 0., 90., 0.) ) );
9574
9575   ypos -= webcamShape->GetDY()/2;
9576   zpos -= webcamShape->GetDZ();
9577   moth->AddNode(webCam,3,
9578                 new TGeoTranslation( 0, ypos,-zpos) );
9579
9580   xpos = ringC2C3->GetX(14) + kUpperSlideWidth/2;
9581   ypos = ringC2C3->GetY(14);
9582   zpos = kRingCZPos + kRingCThick;
9583   moth->AddNode(upSlideVol,1,
9584                 new TGeoCombiTrans( xpos, ypos, zpos + kRingCZToTPC,
9585                                    new TGeoRotation("",-90.,-90., 90.) ) );
9586   moth->AddNode(upSlideVol,2,
9587                 new TGeoCombiTrans(-xpos, ypos, zpos + kRingCZToTPC,
9588                                    new TGeoRotation("",-90.,-90., 90.) ) );
9589   moth->AddNode(upSlideVol,3,
9590                 new TGeoCombiTrans( xpos, ypos, -zpos,
9591                                    new TGeoRotation("", 90.,-90.,-90.) ) );
9592   moth->AddNode(upSlideVol,4,
9593                 new TGeoCombiTrans(-xpos, ypos, -zpos,
9594                                    new TGeoRotation("", 90.,-90.,-90.) ) );
9595
9596   moth->AddNode(lwSlideVol,1,
9597                 new TGeoCombiTrans( xpos,-ypos, zpos + kRingCZToTPC,
9598                                    new TGeoRotation("", 90.,-90., 90.) ) );
9599   moth->AddNode(lwSlideVol,2,
9600                 new TGeoCombiTrans(-xpos,-ypos, zpos + kRingCZToTPC,
9601                                    new TGeoRotation("", 90.,-90., 90.) ) );
9602   moth->AddNode(lwSlideVol,3,
9603                 new TGeoCombiTrans( xpos,-ypos,-zpos,
9604                                    new TGeoRotation("",-90.,-90.,-90.) ) );
9605   moth->AddNode(lwSlideVol,4,
9606                 new TGeoCombiTrans(-xpos,-ypos,-zpos,
9607                                    new TGeoRotation("",-90.,-90.,-90.) ) );
9608
9609   xpos = kStirrCXPos;
9610   zpos = kRingCZPos + kStirrCZPos + stirrupC1C2Sh->GetZ(1) + kRingCZToTPC;
9611   moth->AddNode(stirrC1C2,1,
9612                 new TGeoTranslation( xpos, 0, zpos) );
9613   moth->AddNode(stirrC1C2,2,
9614                 new TGeoCombiTrans(-xpos, 0, zpos,
9615                                    new TGeoRotation("", 90.,-180.,-90.) ) );
9616
9617   xpos = kStirrCXPos + stirrupC1C2Sh->GetX(18) + kUpperSlideWidth/2;
9618   ypos = ringC2C3->GetY(14); // Slides are all at the same height
9619   zpos = kRingCZPos + kStirrCZPos + kStirrC12Thick + kRingCZToTPC;
9620   moth->AddNode(upSlideVol,5,
9621                 new TGeoCombiTrans( xpos, ypos, zpos,
9622                                    new TGeoRotation("",-90.,-90., 90.) ) );
9623   moth->AddNode(upSlideVol,6,
9624                 new TGeoCombiTrans(-xpos, ypos, zpos,
9625                                    new TGeoRotation("",-90.,-90., 90.) ) );
9626   moth->AddNode(lwSlideVol,5,
9627                 new TGeoCombiTrans( xpos,-ypos, zpos,
9628                                    new TGeoRotation("", 90.,-90., 90.) ) );
9629   moth->AddNode(lwSlideVol,6,
9630                 new TGeoCombiTrans(-xpos,-ypos, zpos,
9631                                    new TGeoRotation("", 90.,-90., 90.) ) );
9632
9633   xpos = kStirrCXPos;
9634   zpos = kRingCZPos + kStirrCZPos + stirrupC5Sh->GetZ(1);
9635   moth->AddNode(stirrC5,1,
9636                 new TGeoTranslation( xpos, 0,-zpos) );
9637   moth->AddNode(stirrC5,2,
9638                 new TGeoCombiTrans(-xpos, 0,-zpos,
9639                                    new TGeoRotation("", 90.,-180.,-90.) ) );
9640
9641
9642   return;
9643 }
9644