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