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