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