]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11GeometrySupport.cxx
Extrusions of thermal shield on SPD cone removed (M.Sitta)
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySupport.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // This class Defines the Geometry for the ITS services and support cones
17 // outside of the ceneteral volume (except for the Ceneteral support 
18 // cylinders. Other classes define the rest of the ITS. Specificaly the ITS
19 // The SSD support cone,SSD Support centeral cylinder, SDD support cone,
20 // The SDD cupport centeral cylinder, the SPD Thermal Sheald, The supports
21 // and cable trays on both the RB26 (muon dump) and RB24 sides, and all of
22 // the cabling from the ladders/stave ends out past the TPC. 
23
24 /* $Id$ */
25 // General Root includes
26 #include <TMath.h>
27 // Root Geometry includes
28 //#include <AliLog.h>
29 #include <TGeoManager.h>
30 #include <TGeoVolume.h>
31 #include <TGeoPcon.h>
32 #include <TGeoCone.h>
33 #include <TGeoTube.h> // contaings TGeoTubeSeg
34 #include <TGeoArb8.h>
35 #include <TGeoXtru.h>
36 #include <TGeoCompositeShape.h>
37 #include <TGeoMatrix.h>
38 #include "AliITSv11GeometrySupport.h"
39
40 ClassImp(AliITSv11GeometrySupport)
41
42 #define SQ(A) (A)*(A)
43
44 //______________________________________________________________________
45 void AliITSv11GeometrySupport::SPDCone(TGeoVolume *moth,const TGeoManager *mgr)
46 {
47 //
48 // Creates the SPD thermal shield as a volume assembly
49 // and adds it to the mother volume
50 // (this is actually a merge of the previous SPDThermalSheald method
51 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06 and the
52 // CreateSPDThermalShield method of AliITSv11Hybrid)
53 //
54 // Input:
55 //         moth : the TGeoVolume owing the volume structure
56 //         mgr  : the GeoManager (default gGeoManager)
57 // Output:
58 //
59 // Created:         ???          ???
60 // Updated:      11 Dec 2007  Mario Sitta
61 // Updated:      20 Mar 2011  Mario Sitta  Reimplemented with simpler shapes
62 //
63 // Technical data are taken from:  ALICE-Thermal Screen "Cone transition"
64 // (thermal-screen1_a3.ps), "Cylinder" (thermal-screen2_a3.ps), "Half
65 // assembly" (thermal-screen3_a3.ps), "Flange" (thermal-screen4_a3.ps)
66
67
68   // Dimensions of the Central shield
69   const Double_t kHalfLengthCentral  = 399.9*fgkmm;
70   const Double_t kThicknessCentral   = 0.4*fgkmm;
71   const Double_t kInnerRadiusCentral = 8.1475*fgkcm;
72   const Double_t kOuterRadiusCentral = 9.9255*fgkcm;
73   const Double_t kInnerACentral = 3.1674*fgkcm;
74   const Double_t kInnerBCentral = 2.023 *fgkcm;
75   const Double_t kOuterACentral = 2.4374*fgkcm;
76   const Double_t kOuterBCentral = 3.8162*fgkcm;
77   // Dimensions of the EndCap shield
78   const Double_t kHalfLengthEndCap  = 25.*fgkmm;
79   const Double_t kThicknessEndCap   = 2.0*fgkmm;
80   const Double_t kInnerRadiusEndCap = 8.0775*fgkcm;
81   const Double_t kOuterRadiusEndCap = 9.9955*fgkcm;
82   const Double_t kInnerAEndCap = 3.1453*fgkcm;
83   const Double_t kInnerBEndCap = 2.0009*fgkcm;
84   const Double_t kOuterAEndCap = 2.4596*fgkcm;
85   const Double_t kOuterBEndCap = 3.8384*fgkcm;
86   // Dimensions of the Cone shield
87   const Double_t kHalfLengthCone  = 145.*fgkmm;
88   const Double_t kThicknessCone   = 0.3*fgkmm;
89   const Double_t kInnerRadialCone = 37.3*fgkcm;
90   const Double_t kOuterRadialCone = 39.0*fgkcm;
91   const Double_t kInnerACone = 14.2344*fgkcm;
92   const Double_t kInnerBCone =  9.0915*fgkcm;
93   const Double_t kOuterACone =  9.5058*fgkcm;
94   const Double_t kOuterBCone = 14.8831*fgkcm;
95   // Dimensions of the Flange's Ring and Wing
96   const Double_t kHalfLengthRing  = 7.5*fgkmm;
97   const Double_t kThicknessRing   = 0.3*fgkmm;
98   const Double_t kInnerRadiusRing = 37.3*fgkcm;
99   const Double_t kOuterRadiusRing = 42.0*fgkcm;
100   const Double_t kOuterRadiusWing = 49.25*fgkcm;
101   const Double_t kWideWing      = 6.0*fgkcm;
102   const Double_t kThetaWing     = 45.0;
103   // Common data
104   const Double_t kTheta = 36.0*TMath::DegToRad();
105   const Double_t kThicknessOmega = 0.3*fgkmm;
106
107   // Local variables
108   Double_t zpos;
109   Double_t xshld[24], yshld[24];
110   Double_t xair[24] , yair[24];  // Coord. of whole air shape
111   Double_t xair1[4] , yair1[4];  // Coord. of every single air volume
112   Double_t xomega[48], yomega[48];
113   //  Double_t *xyarb8;
114
115   // The entire shield is made up of two half central shields
116   // symmetric with respect to the XZ plane, four half end cap
117   // shields, again symmetric with respect to the XZ plane, and four
118   // half cones, symmetric with respect to the XZ plane too.
119
120   TGeoVolumeAssembly *vM = new TGeoVolumeAssembly("ITSspdThermalShield");
121
122   // The central half shield: a half tube of carbon fiber,
123   // filled with air volumes, which together make the whole shield
124   // (i.e. the tube and the Omega-shaped insert).
125   // They are all XTru shapes
126
127   TGeoXtru *centralshape = new TGeoXtru(2);
128
129   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
130                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
131                         kTheta,xshld,yshld);
132
133   centralshape->DefinePolygon(24,xshld,yshld);
134   centralshape->DefineSection(0,-kHalfLengthCentral);
135   centralshape->DefineSection(1, kHalfLengthCentral);
136
137   // Now rescale to get the air volume dimensions
138     InsidePoint(xshld[23], yshld[23],
139                 xshld[ 0], yshld[ 0],
140                 xshld[ 1], yshld[ 1], kThicknessCentral,
141                 xair[0], yair[0]);
142   for (Int_t i=1; i<23; i++) {
143     InsidePoint(xshld[i-1], yshld[i-1],
144                 xshld[ i ], yshld[ i ],
145                 xshld[i+1], yshld[i+1], kThicknessCentral,
146                 xair[i], yair[i]);
147   }
148     InsidePoint(xshld[22], yshld[22],
149                 xshld[23], yshld[23],
150                 xshld[ 0], yshld[ 0], kThicknessCentral,
151                 xair[23], yair[23]);
152
153   // Then use them to determine the Omega shape points
154   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
155
156   // Finally create the single air volumes
157   TGeoXtru *centralair1shape = new TGeoXtru(2);
158
159   xair1[0] = xomega[1];
160   yair1[0] = yomega[1];
161   xair1[1] = xomega[0];
162   yair1[1] = yomega[0];
163   xair1[2] = -xair1[1];
164   yair1[2] =  yair1[1];
165   xair1[3] = -xair1[0];
166   yair1[3] =  yair1[0];
167
168   centralair1shape->DefinePolygon(4,xair1,yair1);
169   centralair1shape->DefineSection(0,-kHalfLengthCentral);
170   centralair1shape->DefineSection(1, kHalfLengthCentral);
171
172   TGeoXtru *centralair2shape = new TGeoXtru(2);
173
174   xair1[0] = xomega[21];
175   yair1[0] = yomega[21];
176   xair1[1] = xomega[20];
177   yair1[1] = yomega[20];
178   xair1[2] = xomega[23];
179   yair1[2] = yomega[23];
180   xair1[3] = xomega[22];
181   yair1[3] = yomega[22];
182
183   centralair2shape->DefinePolygon(4,xair1,yair1);
184   centralair2shape->DefineSection(0,-kHalfLengthCentral);
185   centralair2shape->DefineSection(1, kHalfLengthCentral);
186
187   TGeoXtru *centralair3shape = new TGeoXtru(2);
188
189   xair1[0] = xomega[2];
190   yair1[0] = yomega[2];
191   xair1[1] = xomega[3];
192   yair1[1] = yomega[3];
193   xair1[2] = xomega[4];
194   yair1[2] = yomega[4];
195   xair1[3] = xomega[5];
196   yair1[3] = yomega[5];
197
198   centralair3shape->DefinePolygon(4,xair1,yair1);
199   centralair3shape->DefineSection(0,-kHalfLengthCentral);
200   centralair3shape->DefineSection(1, kHalfLengthCentral);
201
202   TGeoXtru *centralair4shape = new TGeoXtru(2);
203
204   xair1[0] = xomega[16];
205   yair1[0] = yomega[16];
206   xair1[1] = xomega[17];
207   yair1[1] = yomega[17];
208   xair1[2] = xomega[18];
209   yair1[2] = yomega[18];
210   xair1[3] = xomega[19];
211   yair1[3] = yomega[19];
212
213   centralair4shape->DefinePolygon(4,xair1,yair1);
214   centralair4shape->DefineSection(0,-kHalfLengthCentral);
215   centralair4shape->DefineSection(1, kHalfLengthCentral);
216
217   TGeoXtru *centralair5shape = new TGeoXtru(2);
218
219   xair1[0] = xomega[6];
220   yair1[0] = yomega[6];
221   xair1[1] = xomega[7];
222   yair1[1] = yomega[7];
223   xair1[2] = xomega[8];
224   yair1[2] = yomega[8];
225   xair1[3] = xomega[9];
226   yair1[3] = yomega[9];
227
228   centralair5shape->DefinePolygon(4,xair1,yair1);
229   centralair5shape->DefineSection(0,-kHalfLengthCentral);
230   centralair5shape->DefineSection(1, kHalfLengthCentral);
231
232   TGeoXtru *centralair6shape = new TGeoXtru(2);
233
234   xair1[0] = xomega[12];
235   yair1[0] = yomega[12];
236   xair1[1] = xomega[13];
237   yair1[1] = yomega[13];
238   xair1[2] = xomega[14];
239   yair1[2] = yomega[14];
240   xair1[3] = xomega[15];
241   yair1[3] = yomega[15];
242
243   centralair6shape->DefinePolygon(4,xair1,yair1);
244   centralair6shape->DefineSection(0,-kHalfLengthCentral);
245   centralair6shape->DefineSection(1, kHalfLengthCentral);
246
247
248   // The end cap half shield: a half tube of carbon fiber,
249   // filled with air volumes, which together make the whole shield
250   // (i.e. the tube and the Omega-shaped insert).
251   // They are all XTru shapes
252
253   TGeoXtru *endcapshape = new TGeoXtru(2);
254
255   CreateSPDThermalShape(kInnerAEndCap,kInnerBEndCap,kInnerRadiusEndCap,
256                         kOuterAEndCap,kOuterBEndCap,kOuterRadiusEndCap,
257                         kTheta,xshld,yshld);
258
259   endcapshape->DefinePolygon(24,xshld,yshld);
260   endcapshape->DefineSection(0,-kHalfLengthEndCap);
261   endcapshape->DefineSection(1, kHalfLengthEndCap);
262
263   // Now rescale to get the air volume dimensions
264     InsidePoint(xshld[23], yshld[23],
265                 xshld[ 0], yshld[ 0],
266                 xshld[ 1], yshld[ 1], kThicknessEndCap,
267                 xair[0], yair[0]);
268   for (Int_t i=1; i<23; i++) {
269     InsidePoint(xshld[i-1], yshld[i-1],
270                 xshld[ i ], yshld[ i ],
271                 xshld[i+1], yshld[i+1], kThicknessEndCap,
272                 xair[i], yair[i]);
273   }
274     InsidePoint(xshld[22], yshld[22],
275                 xshld[23], yshld[23],
276                 xshld[ 0], yshld[ 0], kThicknessEndCap,
277                 xair[23], yair[23]);
278
279   // Then use them to determine the Omega shape points
280   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
281
282   // Finally create the single air volumes
283   TGeoXtru *endcapair1shape = new TGeoXtru(2);
284
285   xair1[0] = xomega[1];
286   yair1[0] = yomega[1];
287   xair1[1] = xomega[0];
288   yair1[1] = yomega[0];
289   xair1[2] = -xair1[1];
290   yair1[2] =  yair1[1];
291   xair1[3] = -xair1[0];
292   yair1[3] =  yair1[0];
293
294   endcapair1shape->DefinePolygon(4,xair1,yair1);
295   endcapair1shape->DefineSection(0,-kHalfLengthEndCap);
296   endcapair1shape->DefineSection(1, kHalfLengthEndCap);
297
298   TGeoXtru *endcapair2shape = new TGeoXtru(2);
299
300   xair1[0] = xomega[21];
301   yair1[0] = yomega[21];
302   xair1[1] = xomega[20];
303   yair1[1] = yomega[20];
304   xair1[2] = xomega[23];
305   yair1[2] = yomega[23];
306   xair1[3] = xomega[22];
307   yair1[3] = yomega[22];
308
309   endcapair2shape->DefinePolygon(4,xair1,yair1);
310   endcapair2shape->DefineSection(0,-kHalfLengthEndCap);
311   endcapair2shape->DefineSection(1, kHalfLengthEndCap);
312
313   TGeoXtru *endcapair3shape = new TGeoXtru(2);
314
315   xair1[0] = xomega[2];
316   yair1[0] = yomega[2];
317   xair1[1] = xomega[3];
318   yair1[1] = yomega[3];
319   xair1[2] = xomega[4];
320   yair1[2] = yomega[4];
321   xair1[3] = xomega[5];
322   yair1[3] = yomega[5];
323
324   endcapair3shape->DefinePolygon(4,xair1,yair1);
325   endcapair3shape->DefineSection(0,-kHalfLengthEndCap);
326   endcapair3shape->DefineSection(1, kHalfLengthEndCap);
327
328   TGeoXtru *endcapair4shape = new TGeoXtru(2);
329
330   xair1[0] = xomega[16];
331   yair1[0] = yomega[16];
332   xair1[1] = xomega[17];
333   yair1[1] = yomega[17];
334   xair1[2] = xomega[18];
335   yair1[2] = yomega[18];
336   xair1[3] = xomega[19];
337   yair1[3] = yomega[19];
338
339   endcapair4shape->DefinePolygon(4,xair1,yair1);
340   endcapair4shape->DefineSection(0,-kHalfLengthEndCap);
341   endcapair4shape->DefineSection(1, kHalfLengthEndCap);
342
343   TGeoXtru *endcapair5shape = new TGeoXtru(2);
344
345   xair1[0] = xomega[6];
346   yair1[0] = yomega[6];
347   xair1[1] = xomega[7];
348   yair1[1] = yomega[7];
349   xair1[2] = xomega[8];
350   yair1[2] = yomega[8];
351   xair1[3] = xomega[9];
352   yair1[3] = yomega[9];
353
354   endcapair5shape->DefinePolygon(4,xair1,yair1);
355   endcapair5shape->DefineSection(0,-kHalfLengthEndCap);
356   endcapair5shape->DefineSection(1, kHalfLengthEndCap);
357
358   TGeoXtru *endcapair6shape = new TGeoXtru(2);
359
360   xair1[0] = xomega[12];
361   yair1[0] = yomega[12];
362   xair1[1] = xomega[13];
363   yair1[1] = yomega[13];
364   xair1[2] = xomega[14];
365   yair1[2] = yomega[14];
366   xair1[3] = xomega[15];
367   yair1[3] = yomega[15];
368
369   endcapair6shape->DefinePolygon(4,xair1,yair1);
370   endcapair6shape->DefineSection(0,-kHalfLengthEndCap);
371   endcapair6shape->DefineSection(1, kHalfLengthEndCap);
372
373   // The cone half shield is more complex since there is no basic
374   // TGeo shape to describe it correctly. So it is a Composite Shape
375   // of a series of TGeoArb8 shapes, in which TGeoArb8 shapes filled
376   // with air are placed, which all together make up the cone AND
377   // its internal insert. Part of the following code is adapted from
378   // old SPDThermalSheald method.
379
380   // sCn : Filled portions, sChn : Air holes
381   TGeoArb8 *sC1  = new TGeoArb8(kHalfLengthCone);
382   TGeoArb8 *sC2  = new TGeoArb8(kHalfLengthCone);
383   TGeoArb8 *sC3  = new TGeoArb8(kHalfLengthCone);
384   TGeoArb8 *sC4  = new TGeoArb8(kHalfLengthCone);
385   TGeoArb8 *sC5  = new TGeoArb8(kHalfLengthCone);
386   TGeoArb8 *sC6  = new TGeoArb8(kHalfLengthCone);
387   TGeoArb8 *sC7  = new TGeoArb8(kHalfLengthCone);
388   TGeoArb8 *sC8  = new TGeoArb8(kHalfLengthCone);
389   TGeoArb8 *sC9  = new TGeoArb8(kHalfLengthCone);
390   TGeoArb8 *sC10 = new TGeoArb8(kHalfLengthCone);
391   TGeoArb8 *sC11 = new TGeoArb8(kHalfLengthCone);
392
393   sC1->SetName("sC1");
394   sC2->SetName("sC2");
395   sC3->SetName("sC3");
396   sC4->SetName("sC4");
397   sC5->SetName("sC5");
398   sC6->SetName("sC6");
399   sC7->SetName("sC7");
400   sC8->SetName("sC8");
401   sC9->SetName("sC9");
402   sC10->SetName("sC10");
403   sC11->SetName("sC11");
404
405   TGeoArb8 *sCh1  = new TGeoArb8(kHalfLengthCone);
406   TGeoArb8 *sCh2  = new TGeoArb8(kHalfLengthCone);
407   TGeoArb8 *sCh3  = new TGeoArb8(kHalfLengthCone);
408   TGeoArb8 *sCh4  = new TGeoArb8(kHalfLengthCone);
409   TGeoArb8 *sCh5  = new TGeoArb8(kHalfLengthCone);
410   TGeoArb8 *sCh6  = new TGeoArb8(kHalfLengthCone);
411   TGeoArb8 *sCh7  = new TGeoArb8(kHalfLengthCone);
412   TGeoArb8 *sCh8  = new TGeoArb8(kHalfLengthCone);
413   TGeoArb8 *sCh9  = new TGeoArb8(kHalfLengthCone);
414   TGeoArb8 *sCh10 = new TGeoArb8(kHalfLengthCone);
415   TGeoArb8 *sCh11 = new TGeoArb8(kHalfLengthCone);
416
417   sCh1->SetName("sCh1");
418   sCh2->SetName("sCh2");
419   sCh3->SetName("sCh3");
420   sCh4->SetName("sCh4");
421   sCh5->SetName("sCh5");
422   sCh6->SetName("sCh6");
423   sCh7->SetName("sCh7");
424   sCh8->SetName("sCh8");
425   sCh9->SetName("sCh9");
426   sCh10->SetName("sCh10");
427   sCh11->SetName("sCh11");
428
429   // Smaller end: determine the coordinates of the points of carbon fiber
430   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
431                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
432                         kTheta,xshld,yshld);
433
434   sC1->SetVertex(0, xshld[12], yshld[12]);
435   sC1->SetVertex(1, xshld[11], yshld[11]);
436   sC1->SetVertex(2, xshld[ 0], yshld[ 0]);
437   sC1->SetVertex(3, xshld[23], yshld[23]);
438
439   sC2->SetVertex(0, xshld[11], yshld[11]);
440   sC2->SetVertex(1, xshld[10], yshld[10]);
441   sC2->SetVertex(2, xshld[ 1], yshld[ 1]);
442   sC2->SetVertex(3, xshld[ 0], yshld[ 0]);
443
444   sC3->SetVertex(0, xshld[10], yshld[10]);
445   sC3->SetVertex(1, xshld[ 9], yshld[ 9]);
446   sC3->SetVertex(2, xshld[ 2], yshld[ 2]);
447   sC3->SetVertex(3, xshld[ 1], yshld[ 1]);
448
449   sC4->SetVertex(0, xshld[ 9], yshld[ 9]);
450   sC4->SetVertex(1, xshld[ 8], yshld[ 8]);
451   sC4->SetVertex(2, xshld[ 3], yshld[ 3]);
452   sC4->SetVertex(3, xshld[ 2], yshld[ 2]);
453
454   sC5->SetVertex(0, xshld[ 8], yshld[ 8]);
455   sC5->SetVertex(1, xshld[ 7], yshld[ 7]);
456   sC5->SetVertex(2, xshld[ 4], yshld[ 4]);
457   sC5->SetVertex(3, xshld[ 3], yshld[ 3]);
458
459   sC6->SetVertex(0, xshld[ 7], yshld[ 7]);
460   sC6->SetVertex(1, xshld[ 6], yshld[ 6]);
461   sC6->SetVertex(2, xshld[ 5], yshld[ 5]);
462   sC6->SetVertex(3, xshld[ 4], yshld[ 4]);
463
464   sC7->SetVertex(0,-xshld[10], yshld[10]);
465   sC7->SetVertex(1,-xshld[11], yshld[11]);
466   sC7->SetVertex(2,-xshld[ 0], yshld[ 0]);
467   sC7->SetVertex(3,-xshld[ 1], yshld[ 1]);
468
469   sC8->SetVertex(0,-xshld[ 9], yshld[ 9]);
470   sC8->SetVertex(1,-xshld[10], yshld[10]);
471   sC8->SetVertex(2,-xshld[ 1], yshld[ 1]);
472   sC8->SetVertex(3,-xshld[ 2], yshld[ 2]);
473
474   sC9->SetVertex(0,-xshld[ 8], yshld[ 8]);
475   sC9->SetVertex(1,-xshld[ 9], yshld[ 9]);
476   sC9->SetVertex(2,-xshld[ 2], yshld[ 2]);
477   sC9->SetVertex(3,-xshld[ 3], yshld[ 3]);
478
479   sC10->SetVertex(0,-xshld[ 7], yshld[ 7]);
480   sC10->SetVertex(1,-xshld[ 8], yshld[ 8]);
481   sC10->SetVertex(2,-xshld[ 3], yshld[ 3]);
482   sC10->SetVertex(3,-xshld[ 4], yshld[ 4]);
483
484   sC11->SetVertex(0,-xshld[ 6], yshld[ 6]);
485   sC11->SetVertex(1,-xshld[ 7], yshld[ 7]);
486   sC11->SetVertex(2,-xshld[ 4], yshld[ 4]);
487   sC11->SetVertex(3,-xshld[ 5], yshld[ 5]);
488
489   // Then rescale to get the air volume dimensions
490     InsidePoint(xshld[23], yshld[23],
491                 xshld[ 0], yshld[ 0],
492                 xshld[ 1], yshld[ 1], kThicknessCone,
493                 xair[0], yair[0]);
494   for (Int_t i=1; i<23; i++) {
495     InsidePoint(xshld[i-1], yshld[i-1],
496                 xshld[ i ], yshld[ i ],
497                 xshld[i+1], yshld[i+1], kThicknessCone,
498                 xair[i], yair[i]);
499   }
500     InsidePoint(xshld[22], yshld[22],
501                 xshld[23], yshld[23],
502                 xshld[ 0], yshld[ 0], kThicknessCone,
503                 xair[23], yair[23]);
504
505   // Then use them to determine the Omega shape points
506   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
507
508   // Finally fill the small end coordinates of the air shapes
509   sCh1->SetVertex(0, xomega[ 0], yomega[ 0]);
510   sCh1->SetVertex(1, xomega[ 1], yomega[ 1]);
511   sCh1->SetVertex(2,-xomega[ 1], yomega[ 1]);
512   sCh1->SetVertex(3,-xomega[ 0], yomega[ 0]);
513
514   sCh2->SetVertex(0, xomega[20], yomega[20]);
515   sCh2->SetVertex(1, xomega[21], yomega[21]);
516   sCh2->SetVertex(2, xomega[22], yomega[22]);
517   sCh2->SetVertex(3, xomega[23], yomega[23]);
518
519   sCh3->SetVertex(0, xomega[ 2], yomega[ 2]);
520   sCh3->SetVertex(1, xomega[ 3], yomega[ 3]);
521   sCh3->SetVertex(2, xomega[ 4], yomega[ 4]);
522   sCh3->SetVertex(3, xomega[ 5], yomega[ 5]);
523
524   sCh4->SetVertex(0, xomega[16], yomega[16]);
525   sCh4->SetVertex(1, xomega[17], yomega[17]);
526   sCh4->SetVertex(2, xomega[18], yomega[18]);
527   sCh4->SetVertex(3, xomega[19], yomega[19]);
528
529   sCh5->SetVertex(0, xomega[ 6], yomega[ 6]);
530   sCh5->SetVertex(1, xomega[ 7], yomega[ 7]);
531   sCh5->SetVertex(2, xomega[ 8], yomega[ 8]);
532   sCh5->SetVertex(3, xomega[ 9], yomega[ 9]);
533
534   sCh6->SetVertex(0, xomega[12], yomega[12]);
535   sCh6->SetVertex(1, xomega[13], yomega[13]);
536   sCh6->SetVertex(2, xomega[14], yomega[14]);
537   sCh6->SetVertex(3, xomega[15], yomega[15]);
538
539   sCh7->SetVertex(0,-xomega[21], yomega[21]);
540   sCh7->SetVertex(1,-xomega[20], yomega[20]);
541   sCh7->SetVertex(2,-xomega[23], yomega[23]);
542   sCh7->SetVertex(3,-xomega[22], yomega[22]);
543
544   sCh8->SetVertex(0,-xomega[ 3], yomega[ 3]);
545   sCh8->SetVertex(1,-xomega[ 2], yomega[ 2]);
546   sCh8->SetVertex(2,-xomega[ 5], yomega[ 5]);
547   sCh8->SetVertex(3,-xomega[ 4], yomega[ 4]);
548
549   sCh9->SetVertex(0,-xomega[17], yomega[17]);
550   sCh9->SetVertex(1,-xomega[16], yomega[16]);
551   sCh9->SetVertex(2,-xomega[19], yomega[19]);
552   sCh9->SetVertex(3,-xomega[18], yomega[18]);
553
554   sCh10->SetVertex(0,-xomega[ 7], yomega[ 7]);
555   sCh10->SetVertex(1,-xomega[ 6], yomega[ 6]);
556   sCh10->SetVertex(2,-xomega[ 9], yomega[ 9]);
557   sCh10->SetVertex(3,-xomega[ 8], yomega[ 8]);
558
559   sCh11->SetVertex(0,-xomega[13], yomega[13]);
560   sCh11->SetVertex(1,-xomega[12], yomega[12]);
561   sCh11->SetVertex(2,-xomega[15], yomega[15]);
562   sCh11->SetVertex(3,-xomega[14], yomega[14]);
563
564   // Bigger end: determine the coordinates of the points of carbon fiber
565
566   // Drawings give only the radius, convert it to the apothegm
567   Double_t kInnerRadiusCone = TMath::Sqrt(kInnerRadialCone*kInnerRadialCone
568                                           - 0.25*kInnerACone*kInnerACone);
569   Double_t kOuterRadiusCone = TMath::Sqrt(kOuterRadialCone*kOuterRadialCone
570                                           - 0.25*kOuterACone*kOuterACone);
571
572   CreateSPDThermalShape(kInnerACone,kInnerBCone,kInnerRadiusCone,
573                         kOuterACone,kOuterBCone,kOuterRadiusCone,
574                         kTheta,xshld,yshld);
575
576   sC1->SetVertex(4, xshld[12], yshld[12]);
577   sC1->SetVertex(5, xshld[11], yshld[11]);
578   sC1->SetVertex(6, xshld[ 0], yshld[ 0]);
579   sC1->SetVertex(7, xshld[23], yshld[23]);
580
581   sC2->SetVertex(4, xshld[11], yshld[11]);
582   sC2->SetVertex(5, xshld[10], yshld[10]);
583   sC2->SetVertex(6, xshld[ 1], yshld[ 1]);
584   sC2->SetVertex(7, xshld[ 0], yshld[ 0]);
585
586   sC3->SetVertex(4, xshld[10], yshld[10]);
587   sC3->SetVertex(5, xshld[ 9], yshld[ 9]);
588   sC3->SetVertex(6, xshld[ 2], yshld[ 2]);
589   sC3->SetVertex(7, xshld[ 1], yshld[ 1]);
590
591   sC4->SetVertex(4, xshld[ 9], yshld[ 9]);
592   sC4->SetVertex(5, xshld[ 8], yshld[ 8]);
593   sC4->SetVertex(6, xshld[ 3], yshld[ 3]);
594   sC4->SetVertex(7, xshld[ 2], yshld[ 2]);
595
596   sC5->SetVertex(4, xshld[ 8], yshld[ 8]);
597   sC5->SetVertex(5, xshld[ 7], yshld[ 7]);
598   sC5->SetVertex(6, xshld[ 4], yshld[ 4]);
599   sC5->SetVertex(7, xshld[ 3], yshld[ 3]);
600
601   sC6->SetVertex(4, xshld[ 7], yshld[ 7]);
602   sC6->SetVertex(5, xshld[ 6], yshld[ 6]);
603   sC6->SetVertex(6, xshld[ 5], yshld[ 5]);
604   sC6->SetVertex(7, xshld[ 4], yshld[ 4]);
605
606   sC7->SetVertex(4,-xshld[10], yshld[10]);
607   sC7->SetVertex(5,-xshld[11], yshld[11]);
608   sC7->SetVertex(6,-xshld[ 0], yshld[ 0]);
609   sC7->SetVertex(7,-xshld[ 1], yshld[ 1]);
610
611   sC8->SetVertex(4,-xshld[ 9], yshld[ 9]);
612   sC8->SetVertex(5,-xshld[10], yshld[10]);
613   sC8->SetVertex(6,-xshld[ 1], yshld[ 1]);
614   sC8->SetVertex(7,-xshld[ 2], yshld[ 2]);
615
616   sC9->SetVertex(4,-xshld[ 8], yshld[ 8]);
617   sC9->SetVertex(5,-xshld[ 9], yshld[ 9]);
618   sC9->SetVertex(6,-xshld[ 2], yshld[ 2]);
619   sC9->SetVertex(7,-xshld[ 3], yshld[ 3]);
620
621   sC10->SetVertex(4,-xshld[ 7], yshld[ 7]);
622   sC10->SetVertex(5,-xshld[ 8], yshld[ 8]);
623   sC10->SetVertex(6,-xshld[ 3], yshld[ 3]);
624   sC10->SetVertex(7,-xshld[ 4], yshld[ 4]);
625
626   sC11->SetVertex(4,-xshld[ 6], yshld[ 6]);
627   sC11->SetVertex(5,-xshld[ 7], yshld[ 7]);
628   sC11->SetVertex(6,-xshld[ 4], yshld[ 4]);
629   sC11->SetVertex(7,-xshld[ 5], yshld[ 5]);
630
631   // Then rescale to get the air volume dimensions
632     InsidePoint(xshld[23], yshld[23],
633                 xshld[ 0], yshld[ 0],
634                 xshld[ 1], yshld[ 1], kThicknessCone,
635                 xair[0], yair[0]);
636   for (Int_t i=1; i<23; i++) {
637     InsidePoint(xshld[i-1], yshld[i-1],
638                 xshld[ i ], yshld[ i ],
639                 xshld[i+1], yshld[i+1], kThicknessCone,
640                 xair[i], yair[i]);
641   }
642     InsidePoint(xshld[22], yshld[22],
643                 xshld[23], yshld[23],
644                 xshld[ 0], yshld[ 0], kThicknessCone,
645                 xair[23], yair[23]);
646
647   // Then use them to determine the Omega shape points
648   CreateSPDOmegaShape(xair,yair,kThicknessOmega,xomega,yomega);
649
650   // Finally fill the big end coordinates of the air shapes
651   sCh1->SetVertex(4, xomega[ 0], yomega[ 0]);
652   sCh1->SetVertex(5, xomega[ 1], yomega[ 1]);
653   sCh1->SetVertex(6,-xomega[ 1], yomega[ 1]);
654   sCh1->SetVertex(7,-xomega[ 0], yomega[ 0]);
655
656   sCh2->SetVertex(4, xomega[20], yomega[20]);
657   sCh2->SetVertex(5, xomega[21], yomega[21]);
658   sCh2->SetVertex(6, xomega[22], yomega[22]);
659   sCh2->SetVertex(7, xomega[23], yomega[23]);
660
661   sCh3->SetVertex(4, xomega[ 2], yomega[ 2]);
662   sCh3->SetVertex(5, xomega[ 3], yomega[ 3]);
663   sCh3->SetVertex(6, xomega[ 4], yomega[ 4]);
664   sCh3->SetVertex(7, xomega[ 5], yomega[ 5]);
665
666   sCh4->SetVertex(4, xomega[16], yomega[16]);
667   sCh4->SetVertex(5, xomega[17], yomega[17]);
668   sCh4->SetVertex(6, xomega[18], yomega[18]);
669   sCh4->SetVertex(7, xomega[19], yomega[19]);
670
671   sCh5->SetVertex(4, xomega[ 6], yomega[ 6]);
672   sCh5->SetVertex(5, xomega[ 7], yomega[ 7]);
673   sCh5->SetVertex(6, xomega[ 8], yomega[ 8]);
674   sCh5->SetVertex(7, xomega[ 9], yomega[ 9]);
675
676   sCh6->SetVertex(4, xomega[12], yomega[12]);
677   sCh6->SetVertex(5, xomega[13], yomega[13]);
678   sCh6->SetVertex(6, xomega[14], yomega[14]);
679   sCh6->SetVertex(7, xomega[15], yomega[15]);
680
681   sCh7->SetVertex(4,-xomega[21], yomega[21]);
682   sCh7->SetVertex(5,-xomega[20], yomega[20]);
683   sCh7->SetVertex(6,-xomega[23], yomega[23]);
684   sCh7->SetVertex(7,-xomega[22], yomega[22]);
685
686   sCh8->SetVertex(4,-xomega[ 3], yomega[ 3]);
687   sCh8->SetVertex(5,-xomega[ 2], yomega[ 2]);
688   sCh8->SetVertex(6,-xomega[ 5], yomega[ 5]);
689   sCh8->SetVertex(7,-xomega[ 4], yomega[ 4]);
690
691   sCh9->SetVertex(4,-xomega[17], yomega[17]);
692   sCh9->SetVertex(5,-xomega[16], yomega[16]);
693   sCh9->SetVertex(6,-xomega[19], yomega[19]);
694   sCh9->SetVertex(7,-xomega[18], yomega[18]);
695
696   sCh10->SetVertex(4,-xomega[ 7], yomega[ 7]);
697   sCh10->SetVertex(5,-xomega[ 6], yomega[ 6]);
698   sCh10->SetVertex(6,-xomega[ 9], yomega[ 9]);
699   sCh10->SetVertex(7,-xomega[ 8], yomega[ 8]);
700
701   sCh11->SetVertex(4,-xomega[13], yomega[13]);
702   sCh11->SetVertex(5,-xomega[12], yomega[12]);
703   sCh11->SetVertex(6,-xomega[15], yomega[15]);
704   sCh11->SetVertex(7,-xomega[14], yomega[14]);
705
706   // Now the actual carbon fiber cone: a CompositeShape
707   TGeoCompositeShape *sCone = new TGeoCompositeShape("sCone",
708                             "sC1+sC2+sC3+sC4+sC5+sC6+sC7+sC8+sC9+sC10+sC11");
709
710   // Finally the carbon fiber Ring with its Wings and their
711   // stesalite inserts. They are Tube and TubeSeg shapes
712
713   TGeoTube *ringshape = new TGeoTube(kInnerRadiusRing,kOuterRadiusRing,
714                                      kHalfLengthRing);
715
716   TGeoTube *ringinsertshape = new TGeoTube(kInnerRadiusRing+kThicknessRing,
717                                            kOuterRadiusRing-kThicknessRing,
718                                            kHalfLengthRing-kThicknessRing);
719
720   Double_t angleWideWing, angleWideWingThickness;
721   angleWideWing = (kWideWing/kOuterRadiusWing)*TMath::RadToDeg();
722   angleWideWingThickness = (kThicknessRing/kOuterRadiusWing)*TMath::RadToDeg();
723
724   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kOuterRadiusRing,kOuterRadiusWing,
725                                            kHalfLengthRing, 0, angleWideWing);
726
727   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kOuterRadiusRing,
728              kOuterRadiusWing-kThicknessRing, kHalfLengthRing-kThicknessRing,
729              angleWideWingThickness, angleWideWing-angleWideWingThickness);
730
731
732   // We have the shapes: now create the real volumes
733
734   TGeoMedium *medSPDcf  = mgr->GetMedium("ITS_SPD shield$");
735   TGeoMedium *medSPDair = mgr->GetMedium("ITS_SPD AIR$");
736   TGeoMedium *medSPDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
737
738   TGeoVolume *centralshield = new TGeoVolume("SPDcentralshield",
739                                              centralshape,medSPDcf);
740   centralshield->SetVisibility(kTRUE);
741   centralshield->SetLineColor(7);
742   centralshield->SetLineWidth(1);
743   centralshield->SetFillColor(centralshield->GetLineColor());
744   centralshield->SetFillStyle(4090); // 90% transparent
745
746   TGeoVolume *centralair1 = new TGeoVolume("SPDcentralair1shield",
747                                            centralair1shape,medSPDair);
748   centralair1->SetVisibility(kTRUE);
749   centralair1->SetLineColor(5); // Yellow
750   centralair1->SetLineWidth(1);
751   centralair1->SetFillColor(centralair1->GetLineColor());
752   centralair1->SetFillStyle(4090); // 90% transparent
753
754   TGeoVolume *centralair2 = new TGeoVolume("SPDcentralair2shield",
755                                            centralair2shape,medSPDair);
756   centralair2->SetVisibility(kTRUE);
757   centralair2->SetLineColor(5); // Yellow
758   centralair2->SetLineWidth(1);
759   centralair2->SetFillColor(centralair2->GetLineColor());
760   centralair2->SetFillStyle(4090); // 90% transparent
761
762   TGeoVolume *centralair3 = new TGeoVolume("SPDcentralair3shield",
763                                            centralair3shape,medSPDair);
764   centralair3->SetVisibility(kTRUE);
765   centralair3->SetLineColor(5); // Yellow
766   centralair3->SetLineWidth(1);
767   centralair3->SetFillColor(centralair3->GetLineColor());
768   centralair3->SetFillStyle(4090); // 90% transparent
769
770   TGeoVolume *centralair4 = new TGeoVolume("SPDcentralair4shield",
771                                            centralair4shape,medSPDair);
772   centralair4->SetVisibility(kTRUE);
773   centralair4->SetLineColor(5); // Yellow
774   centralair4->SetLineWidth(1);
775   centralair4->SetFillColor(centralair4->GetLineColor());
776   centralair4->SetFillStyle(4090); // 90% transparent
777
778   TGeoVolume *centralair5 = new TGeoVolume("SPDcentralair5shield",
779                                            centralair5shape,medSPDair);
780   centralair5->SetVisibility(kTRUE);
781   centralair5->SetLineColor(5); // Yellow
782   centralair5->SetLineWidth(1);
783   centralair5->SetFillColor(centralair5->GetLineColor());
784   centralair5->SetFillStyle(4090); // 90% transparent
785
786   TGeoVolume *centralair6 = new TGeoVolume("SPDcentralair6shield",
787                                            centralair6shape,medSPDair);
788   centralair6->SetVisibility(kTRUE);
789   centralair6->SetLineColor(5); // Yellow
790   centralair6->SetLineWidth(1);
791   centralair6->SetFillColor(centralair6->GetLineColor());
792   centralair6->SetFillStyle(4090); // 90% transparent
793
794   centralshield->AddNode(centralair1,1,0);
795   centralshield->AddNode(centralair2,1,0);
796   centralshield->AddNode(centralair2,2,new TGeoRotation("",90,180,-90));
797   centralshield->AddNode(centralair3,1,0);
798   centralshield->AddNode(centralair3,2,new TGeoRotation("",90,180,-90));
799   centralshield->AddNode(centralair4,1,0);
800   centralshield->AddNode(centralair4,2,new TGeoRotation("",90,180,-90));
801   centralshield->AddNode(centralair5,1,0);
802   centralshield->AddNode(centralair5,2,new TGeoRotation("",90,180,-90));
803   centralshield->AddNode(centralair6,1,0);
804   centralshield->AddNode(centralair6,2,new TGeoRotation("",90,180,-90));
805
806   TGeoVolume *endcapshield = new TGeoVolume("SPDendcapshield",
807                                              endcapshape,medSPDcf);
808   endcapshield->SetVisibility(kTRUE);
809   endcapshield->SetLineColor(7);
810   endcapshield->SetLineWidth(1);
811
812   TGeoVolume *endcapair1 = new TGeoVolume("SPDendcapair1shield",
813                                           endcapair1shape,medSPDair);
814   endcapair1->SetVisibility(kTRUE);
815   endcapair1->SetLineColor(5); // Yellow
816   endcapair1->SetLineWidth(1);
817   endcapair1->SetFillColor(endcapair1->GetLineColor());
818   endcapair1->SetFillStyle(4090); // 90% transparent
819
820   TGeoVolume *endcapair2 = new TGeoVolume("SPDendcapair2shield",
821                                           endcapair2shape,medSPDair);
822   endcapair2->SetVisibility(kTRUE);
823   endcapair2->SetLineColor(5); // Yellow
824   endcapair2->SetLineWidth(1);
825   endcapair2->SetFillColor(endcapair2->GetLineColor());
826   endcapair2->SetFillStyle(4090); // 90% transparent
827
828   TGeoVolume *endcapair3 = new TGeoVolume("SPDendcapair3shield",
829                                           endcapair3shape,medSPDair);
830   endcapair3->SetVisibility(kTRUE);
831   endcapair3->SetLineColor(5); // Yellow
832   endcapair3->SetLineWidth(1);
833   endcapair3->SetFillColor(endcapair3->GetLineColor());
834   endcapair3->SetFillStyle(4090); // 90% transparent
835
836   TGeoVolume *endcapair4 = new TGeoVolume("SPDendcapair4shield",
837                                           endcapair4shape,medSPDair);
838   endcapair4->SetVisibility(kTRUE);
839   endcapair4->SetLineColor(5); // Yellow
840   endcapair4->SetLineWidth(1);
841   endcapair4->SetFillColor(endcapair4->GetLineColor());
842   endcapair4->SetFillStyle(4090); // 90% transparent
843
844   TGeoVolume *endcapair5 = new TGeoVolume("SPDendcapair5shield",
845                                           endcapair5shape,medSPDair);
846   endcapair5->SetVisibility(kTRUE);
847   endcapair5->SetLineColor(5); // Yellow
848   endcapair5->SetLineWidth(1);
849   endcapair5->SetFillColor(endcapair5->GetLineColor());
850   endcapair5->SetFillStyle(4090); // 90% transparent
851
852   TGeoVolume *endcapair6 = new TGeoVolume("SPDendcapair6shield",
853                                           endcapair6shape,medSPDair);
854   endcapair6->SetVisibility(kTRUE);
855   endcapair6->SetLineColor(5); // Yellow
856   endcapair6->SetLineWidth(1);
857   endcapair6->SetFillColor(endcapair6->GetLineColor());
858   endcapair6->SetFillStyle(4090); // 90% transparent
859
860   endcapshield->AddNode(endcapair1,1,0);
861   endcapshield->AddNode(endcapair2,1,0);
862   endcapshield->AddNode(endcapair2,2,new TGeoRotation("",90,180,-90));
863   endcapshield->AddNode(endcapair3,1,0);
864   endcapshield->AddNode(endcapair3,2,new TGeoRotation("",90,180,-90));
865   endcapshield->AddNode(endcapair4,1,0);
866   endcapshield->AddNode(endcapair4,2,new TGeoRotation("",90,180,-90));
867   endcapshield->AddNode(endcapair5,1,0);
868   endcapshield->AddNode(endcapair5,2,new TGeoRotation("",90,180,-90));
869   endcapshield->AddNode(endcapair6,1,0);
870   endcapshield->AddNode(endcapair6,2,new TGeoRotation("",90,180,-90));
871
872   TGeoVolume *vCone = new TGeoVolume("SPDconeshield",sCone,medSPDcf);
873   vCone->SetVisibility(kTRUE);
874   vCone->SetLineColor(7);
875   vCone->SetLineWidth(1);
876   vCone->SetFillColor(vCone->GetLineColor());
877   vCone->SetFillStyle(4090); // 90% transparent
878
879   TGeoVolume *vCh1 = new TGeoVolume("SPDconeshieldH1",sCh1,medSPDair);
880   vCh1->SetVisibility(kTRUE);
881   vCh1->SetLineColor(5); // Yellow
882   vCh1->SetLineWidth(1);
883   vCh1->SetFillColor(vCh1->GetLineColor());
884   vCh1->SetFillStyle(4090); // 90% transparent
885
886   TGeoVolume *vCh2 = new TGeoVolume("SPDconeshieldH2",sCh2,medSPDair);
887   vCh2->SetVisibility(kTRUE);
888   vCh2->SetLineColor(5); // Yellow
889   vCh2->SetLineWidth(1);
890   vCh2->SetFillColor(vCh2->GetLineColor());
891   vCh2->SetFillStyle(4090); // 90% transparent
892
893   TGeoVolume *vCh3 = new TGeoVolume("SPDconeshieldH3",sCh3,medSPDair);
894   vCh3->SetVisibility(kTRUE);
895   vCh3->SetLineColor(5); // Yellow
896   vCh3->SetLineWidth(1);
897   vCh3->SetFillColor(vCh3->GetLineColor());
898   vCh3->SetFillStyle(4090); // 90% transparent
899
900   TGeoVolume *vCh4 = new TGeoVolume("SPDconeshieldH4",sCh4,medSPDair);
901   vCh4->SetVisibility(kTRUE);
902   vCh4->SetLineColor(5); // Yellow
903   vCh4->SetLineWidth(1);
904   vCh4->SetFillColor(vCh4->GetLineColor());
905   vCh4->SetFillStyle(4090); // 90% transparent
906
907   TGeoVolume *vCh5 = new TGeoVolume("SPDconeshieldH5",sCh5,medSPDair);
908   vCh5->SetVisibility(kTRUE);
909   vCh5->SetLineColor(5); // Yellow
910   vCh5->SetLineWidth(1);
911   vCh5->SetFillColor(vCh5->GetLineColor());
912   vCh5->SetFillStyle(4090); // 90% transparent
913
914   TGeoVolume *vCh6 = new TGeoVolume("SPDconeshieldH6",sCh6,medSPDair);
915   vCh6->SetVisibility(kTRUE);
916   vCh6->SetLineColor(5); // Yellow
917   vCh6->SetLineWidth(1);
918   vCh6->SetFillColor(vCh6->GetLineColor());
919   vCh6->SetFillStyle(4090); // 90% transparent
920
921   TGeoVolume *vCh7 = new TGeoVolume("SPDconeshieldH7",sCh7,medSPDair);
922   vCh7->SetVisibility(kTRUE);
923   vCh7->SetLineColor(5); // Yellow
924   vCh7->SetLineWidth(1);
925   vCh7->SetFillColor(vCh7->GetLineColor());
926   vCh7->SetFillStyle(4090); // 90% transparent
927
928   TGeoVolume *vCh8 = new TGeoVolume("SPDconeshieldH8",sCh8,medSPDair);
929   vCh8->SetVisibility(kTRUE);
930   vCh8->SetLineColor(5); // Yellow
931   vCh8->SetLineWidth(1);
932   vCh8->SetFillColor(vCh8->GetLineColor());
933   vCh8->SetFillStyle(4090); // 90% transparent
934
935   TGeoVolume *vCh9 = new TGeoVolume("SPDconeshieldH9",sCh9,medSPDair);
936   vCh9->SetVisibility(kTRUE);
937   vCh9->SetLineColor(5); // Yellow
938   vCh9->SetLineWidth(1);
939   vCh9->SetFillColor(vCh9->GetLineColor());
940   vCh9->SetFillStyle(4090); // 90% transparent
941
942   TGeoVolume *vCh10 = new TGeoVolume("SPDconeshieldH10",sCh10,medSPDair);
943   vCh10->SetVisibility(kTRUE);
944   vCh10->SetLineColor(5); // Yellow
945   vCh10->SetLineWidth(1);
946   vCh10->SetFillColor(vCh10->GetLineColor());
947   vCh10->SetFillStyle(4090); // 90% transparent
948
949   TGeoVolume *vCh11 = new TGeoVolume("SPDconeshieldH11",sCh11,medSPDair);
950   vCh11->SetVisibility(kTRUE);
951   vCh11->SetLineColor(5); // Yellow
952   vCh11->SetLineWidth(1);
953   vCh11->SetFillColor(vCh11->GetLineColor());
954   vCh11->SetFillStyle(4090); // 90% transparent
955
956   vCone->AddNode(vCh1 ,1,0);
957   vCone->AddNode(vCh2 ,1,0);
958   vCone->AddNode(vCh3 ,1,0);
959   vCone->AddNode(vCh4 ,1,0);
960   vCone->AddNode(vCh5 ,1,0);
961   vCone->AddNode(vCh6 ,1,0);
962   vCone->AddNode(vCh7 ,1,0);
963   vCone->AddNode(vCh8 ,1,0);
964   vCone->AddNode(vCh9 ,1,0);
965   vCone->AddNode(vCh10,1,0);
966   vCone->AddNode(vCh11,1,0);
967
968   TGeoVolume *ring = new TGeoVolume("SPDshieldring",ringshape,medSPDcf);
969   ring->SetVisibility(kTRUE);
970   ring->SetLineColor(7);
971   ring->SetLineWidth(1);
972
973   TGeoVolume *ringinsert = new TGeoVolume("SPDshieldringinsert",
974                                           ringinsertshape,medSPDste);
975   ringinsert->SetVisibility(kTRUE);
976   ringinsert->SetLineColor(3); // Green
977 //  ringinsert->SetLineWidth(1);
978   ringinsert->SetFillColor(ringinsert->GetLineColor());
979   ringinsert->SetFillStyle(4010); // 10% transparent
980
981   ring->AddNode(ringinsert,1,0);
982
983   TGeoVolume *wing = new TGeoVolume("SPDshieldringwing",wingshape,medSPDcf);
984   wing->SetVisibility(kTRUE);
985   wing->SetLineColor(7);
986   wing->SetLineWidth(1);
987
988   TGeoVolume *winginsert = new TGeoVolume("SPDshieldwinginsert",
989                                           winginsertshape,medSPDste);
990   winginsert->SetVisibility(kTRUE);
991   winginsert->SetLineColor(3); // Green
992 //  winginsert->SetLineWidth(1);
993   winginsert->SetFillColor(winginsert->GetLineColor());
994   winginsert->SetFillStyle(4010); // 10% transparent
995
996   wing->AddNode(winginsert,1,0);
997
998
999   // Add all volumes in the assembly
1000   const Double_t kLittleZTrans = 0.1*fgkmm;
1001   vM->AddNode(centralshield,1,new TGeoTranslation(0,0,-kLittleZTrans));
1002   vM->AddNode(centralshield,2,new TGeoCombiTrans( 0,0,-kLittleZTrans,
1003                                   new TGeoRotation("",180,0,0)));
1004
1005   zpos = kHalfLengthCentral+kHalfLengthEndCap;
1006   vM->AddNode(endcapshield,1,
1007               new TGeoTranslation(0,0, zpos-kLittleZTrans));
1008   vM->AddNode(endcapshield,2,
1009               new TGeoTranslation(0,0,-zpos-kLittleZTrans));
1010   vM->AddNode(endcapshield,3,new TGeoCombiTrans(
1011               0, 0, zpos-kLittleZTrans, new TGeoRotation("",180,0,0) ) );
1012   vM->AddNode(endcapshield,4,new TGeoCombiTrans(
1013               0, 0,-zpos-kLittleZTrans, new TGeoRotation("",180,0,0) ) );
1014
1015   zpos = kHalfLengthCentral+2*kHalfLengthEndCap+kHalfLengthCone;
1016   vM->AddNode(vCone ,1, new TGeoTranslation(0, 0,  zpos-kLittleZTrans));
1017
1018   vM->AddNode(vCone ,2, new TGeoCombiTrans(0, 0,  zpos-kLittleZTrans,
1019                                 new TGeoRotation("", 0, 0, 180)   ));
1020
1021   vM->AddNode(vCone ,3, new TGeoCombiTrans(0, 0, -zpos-kLittleZTrans,
1022                                 new TGeoRotation("", 0, 180, 0)   ));
1023
1024   vM->AddNode(vCone ,4, new TGeoCombiTrans(0, 0, -zpos-kLittleZTrans,
1025                                 new TGeoRotation("", 0, 180, 180)   ));
1026
1027   zpos = kHalfLengthCentral+2*kHalfLengthEndCap+2*kHalfLengthCone
1028        + kHalfLengthRing;
1029   vM->AddNode(ring,1,new TGeoTranslation(0, 0, zpos-kLittleZTrans));
1030   vM->AddNode(ring,2,new TGeoTranslation(0, 0,-zpos-kLittleZTrans));
1031
1032   for (Int_t i=0; i<4; i++) {
1033     Double_t thetaW = kThetaWing*(2*i+1) - angleWideWing/2.;
1034     vM->AddNode(wing,2*i+1,new TGeoCombiTrans(0, 0, zpos-kLittleZTrans,
1035                                new TGeoRotation("",thetaW,0,0) ) );
1036     vM->AddNode(wing,2*i+2,new TGeoCombiTrans(0, 0,-zpos-kLittleZTrans,
1037                                new TGeoRotation("",thetaW,0,0) ) );
1038   }
1039
1040   // Some debugging if requested
1041   if(GetDebug(1)){
1042     vM->PrintNodes();
1043     vM->InspectShape();
1044   }
1045
1046   // Finally put the entire shield in the mother volume
1047   moth->AddNode(vM,1,0);
1048
1049   return;
1050 }
1051
1052 //______________________________________________________________________
1053 void AliITSv11GeometrySupport::CreateSPDThermalShape(
1054      Double_t ina, Double_t inb, Double_t inr,
1055      Double_t oua, Double_t oub, Double_t our,
1056      Double_t   t, Double_t *x , Double_t *y ) const
1057 {
1058 //
1059 // Creates the proper sequence of X and Y coordinates to determine
1060 // the base XTru polygon for the SPD thermal shapes
1061 //
1062 // Input:
1063 //        ina, inb : inner shape sides
1064 //        inr      : inner radius
1065 //        oua, oub : outer shape sides
1066 //        our      : outer radius
1067 //        t        : theta angle
1068 //
1069 // Output:
1070 //        x, y : coordinate vectors [24]
1071 //
1072 // Created:      14 Nov 2007  Mario Sitta
1073 // Updated:      11 Dec 2007  Mario Sitta
1074 //
1075   Double_t xlocal[6],ylocal[6];
1076
1077   //Create the first inner quadrant (X > 0)
1078   FillSPDXtruShape(ina,inb,inr,t,xlocal,ylocal);
1079   for (Int_t i=0; i<6; i++) {
1080     x[i] = xlocal[i];
1081     y[i] = ylocal[i];
1082   }
1083
1084   // Then reflex on the second quadrant (X < 0)
1085   for (Int_t i=0; i<6; i++) {
1086     x[23-i] = -x[i];
1087     y[23-i] =  y[i];
1088   }
1089
1090   // Now create the first outer quadrant (X > 0)
1091   FillSPDXtruShape(oua,oub,our,t,xlocal,ylocal);
1092   for (Int_t i=0; i<6; i++) {
1093     x[11-i] = xlocal[i];
1094     y[11-i] = ylocal[i];
1095   }
1096
1097   // Finally reflex on the second quadrant (X < 0)
1098   for (Int_t i=0; i<6; i++) {
1099     x[12+i] = -x[11-i];
1100     y[12+i] =  y[11-i];
1101   }
1102
1103   return;
1104 }
1105
1106 //______________________________________________________________________
1107 void AliITSv11GeometrySupport::CreateSPDOmegaShape(
1108                    const Double_t *xin, const Double_t *yin, Double_t  d,
1109                    Double_t   *x, Double_t *y)
1110 {
1111 //
1112 // Creates the proper sequence of X and Y coordinates to determine
1113 // the SPD Omega XTru polygon
1114 //
1115 // Input:
1116 //        xin, yin : coordinates of the air volume
1117 //        d        : Omega shape thickness
1118 //        t        : theta angle
1119 //
1120 // Output:
1121 //        x, y     : coordinate vectors [48]
1122 //
1123 // Created:      17 Nov 2007  Mario Sitta
1124 // Updated:      11 Dec 2007  Mario Sitta
1125 // Updated:      20 Feb 2009  Mario Sitta       New algorithm (the old one
1126 //                                              gives erroneous vertexes)
1127 //
1128
1129   // This vector contains the index of those points which coincide
1130   // with the corresponding points in the air shape
1131   Int_t indexAir2Omega[12] = {1, 2, 5, 6, 9, 10, 11, 15, 16, 19, 20, 23};
1132
1133   // First fill those vertexes corresponding to
1134   // the edges aligned to the air shape edges
1135   for (Int_t j=0; j<12; j++) {
1136     x[*(indexAir2Omega+j)] = xin[j];
1137     y[*(indexAir2Omega+j)] = yin[j];
1138   }
1139
1140   // Now get the coordinates of the first inner point
1141   PointFromParallelLines(x[23],y[23],x[1],y[1],d,x[0],y[0]);
1142
1143   // Knowing this, the second internal point can be determined
1144   InsidePoint(x[0],y[0],x[1],y[1],x[2],y[2],d,x[22],y[22]);
1145
1146   // The third point is now computable
1147   ReflectPoint(x[1],y[1],x[2],y[2],x[22],y[22],x[21],y[21]);
1148
1149   // Repeat this logic
1150   InsidePoint(x[21],y[21],x[20],y[20],x[19],y[19],-d,x[3],y[3]);
1151
1152   ReflectPoint(x[20],y[20],x[19],y[19],x[3],y[3],x[4],y[4]);
1153
1154   InsidePoint(x[4],y[4],x[5],y[5],x[6],y[6],d,x[18],y[18]);
1155
1156   ReflectPoint(x[5],y[5],x[6],y[6],x[18],y[18],x[17],y[17]);
1157
1158   InsidePoint(x[17],y[17],x[16],y[16],x[15],y[15],-d,x[7],y[7]);
1159
1160   ReflectPoint(x[16],y[16],x[15],y[15],x[7],y[7],x[8],y[8]);
1161
1162   InsidePoint(x[8],y[8],x[9],y[9],x[10],y[10],d,x[14],y[14]);
1163
1164   // These need to be fixed explicitly
1165   x[12] = x[11];
1166   y[12] = y[11] + d;
1167   x[13] = x[10] + d;
1168   y[13] = y[12];
1169
1170   // Finally reflect on the negative side
1171   for (Int_t i=0; i<24; i++) {
1172     x[24+i] = -x[23-i];
1173     y[24+i] =  y[23-i];
1174   }
1175
1176   // Wow ! We've finished
1177   return;
1178 }
1179
1180 //______________________________________________________________________
1181 void AliITSv11GeometrySupport::FillSPDXtruShape(Double_t a, Double_t b,
1182                                                 Double_t r, Double_t t,
1183                                                 Double_t *x, Double_t *y) const
1184 {
1185 //
1186 // Creates the partial sequence of X and Y coordinates to determine
1187 // the lateral part of the SPD thermal shield
1188 //
1189 // Input:
1190 //        a, b : shape sides
1191 //        r    : radius
1192 //        t    : theta angle
1193 //
1194 // Output:
1195 //        x, y : coordinate vectors [6]
1196 //
1197 // Created:      14 Nov 2007  Mario Sitta
1198 //
1199   x[0] = a/2;
1200   y[0] = r;
1201
1202   x[1] = x[0] + b * TMath::Cos(t/2);
1203   y[1] = y[0] - b * TMath::Sin(t/2);
1204
1205   x[2] = x[1] + a * TMath::Cos(t);
1206   y[2] = y[1] - a * TMath::Sin(t);
1207
1208   x[3] = x[2] + b * TMath::Cos(3*t/2);
1209   y[3] = y[2] - b * TMath::Sin(3*t/2);
1210
1211   x[4] = x[3] + a * TMath::Cos(2*t);
1212   y[4] = y[3] - a * TMath::Sin(2*t);
1213
1214   x[5] = x[4];
1215   y[5] = 0.;
1216
1217   return;
1218 }
1219
1220 //______________________________________________________________________
1221 void AliITSv11GeometrySupport::PointFromParallelLines(Double_t x1, Double_t y1,
1222                               Double_t x2, Double_t y2, Double_t d,
1223                               Double_t &x, Double_t &y) const
1224 {
1225 //
1226 // Determines the X and Y of the first internal point of the Omega shape
1227 // (i.e. the coordinates of a point given two parallel lines passing by
1228 // two points and placed at a known distance)
1229 //
1230 // Input:
1231 //        x1, y1 : first point
1232 //        x2, y2 : second point
1233 //        d      : distance between the two lines
1234 //
1235 // Output:
1236 //        x, y   : coordinate of the point
1237 //
1238 // Created:      22 Feb 2009  Mario Sitta
1239 //
1240 //Begin_Html
1241 /*
1242 <img src="ITS/doc/PointFromParallelLines.gif">
1243 */
1244 //End_Html
1245
1246   // The slope of the paralles lines at a distance d
1247   Double_t m; 
1248
1249   // The parameters of the solving equation
1250   // a x^2 - 2 b x + c = 0
1251   Double_t a = (x1 - x2)*(x1 - x2) - d*d;
1252   Double_t b = (x1 - x2)*(y1 - y2);
1253   Double_t c = (y1 - y2)*(y1 - y2) - d*d;
1254
1255   // (delta4 is Delta/4 because we use the reduced formula)
1256   Double_t delta4 = b*b - a*c;
1257
1258   // Compute the slope of the two parallel lines
1259   // (one of the two possible slopes, the one with the smaller
1260   // absolute value is needed)
1261   if (delta4 < 0) { // Should never happen with our data, but just to be sure
1262     x = -1;         // x is expected positive, so this flags an error
1263     return;
1264   } else
1265     m = (b + TMath::Sqrt(delta4))/a;  // b is negative with our data
1266
1267   // Finally compute the coordinates of the point
1268   x = x2 + (y1 - y2 - d)/m;
1269   y = y1 - d;
1270
1271   // Done
1272   return;
1273 }
1274
1275 //______________________________________________________________________
1276 void AliITSv11GeometrySupport::ReflectPoint(Double_t x1, Double_t y1,
1277                                             Double_t x2, Double_t y2,
1278                                             Double_t x3, Double_t y3,
1279                                             Double_t &x, Double_t &y) const
1280 {
1281 //
1282 // Given two points (x1,y1) and (x2,y2), determines the point (x,y)
1283 // lying on the line parallel to the line passing by these points,
1284 // at a distance d and passing by the point (x3,y3), which is symmetric to
1285 // the third point with respect to the axis of the segment delimited by
1286 // the two first points.
1287 //
1288 // Input:
1289 //        x1, y1 : first point
1290 //        x2, y2 : second point
1291 //        x3, y3 : third point
1292 //        d      : distance between the two lines
1293 //
1294 // Output:
1295 //        x, y   : coordinate of the reflected point
1296 //
1297 // Created:      22 Feb 2009  Mario Sitta
1298 //
1299 //Begin_Html
1300 /*
1301 <img src="ITS/doc/ReflectPoint.gif">
1302 */
1303 //End_Html
1304
1305   // The slope of the line passing by the first two points
1306   Double_t k = (y2 - y1)/(x2 - x1);
1307
1308   // The middle point of the segment 1-2
1309   Double_t xK = (x1 + x2)/2.;
1310   Double_t yK = (y1 + y2)/2.;
1311
1312   // The intercept between the axis of the segment 1-2 and the line
1313   // passing by 3 and parallel to the line passing by 1-2
1314   Double_t xH = (k*k*x3 + k*(yK - y3) + xK)/(k*k + 1);
1315   Double_t yH = k*(xH - x3) + y3;
1316
1317   // The point symmetric to 3 with respect to H
1318   x = 2*xH - x3;
1319   y = 2*yH - y3;
1320
1321   // Done
1322   return;
1323 }
1324
1325 //______________________________________________________________________
1326 void AliITSv11GeometrySupport::SDDCone(TGeoVolume *moth,const TGeoManager *mgr)
1327 {
1328 //
1329 // Creates the SDD support cone and cylinder geometry as a
1330 // volume assembly and adds it to the mother volume
1331 // (part of this code is taken or anyway inspired to SDDCone method
1332 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
1333 //
1334 // Input:
1335 //         moth : the TGeoVolume owing the volume structure
1336 //         mgr  : the GeoManager (default gGeoManager)
1337 // Output:
1338 //
1339 // Created:         ???       Bjorn S. Nilsen
1340 // Updated:      18 Feb 2008  Mario Sitta
1341 // Updated:      25 Jul 2008  Mario Sitta   SDDCarbonFiberCone simpler
1342 // Updated:      10 Jun 2010  Mario Sitta   Cables across cone holes added
1343 //
1344 // Technical data are taken from:  "Supporto Generale Settore SDD"
1345 // (technical drawings ALR-0816/1-B), "Supporto Globale Settore SDD"
1346 // (technical drawings ALR-0816/2A, ALR-0816/2B, ALR-0816/2C, ALR-0816/2D), 
1347 // private communication with B. Giraudo
1348
1349   // Dimensions of the Central cylinder and flanges
1350   const Double_t kCylinderHalfLength = (790.0/2)*fgkmm;
1351   const Double_t kCylinderInnerR     = (210.0/2)*fgkmm;
1352   const Double_t kCylinderOuterR     = (231.0/2)*fgkmm;
1353   const Double_t kFlangeHalfLength   = ( 15.0/2)*fgkmm;
1354   const Double_t kFlangeInnerR       = (210.5/2)*fgkmm;
1355   const Double_t kFlangeOuterR       = (230.5/2)*fgkmm;
1356   const Double_t kInsertoHalfLength  =
1357                                      kCylinderHalfLength - 2*kFlangeHalfLength;
1358 //  const Double_t kCFThickness        = kFlangeInnerR - kCylinderInnerR;
1359   const Double_t kBoltDiameter       =       6.0*fgkmm; // M6 screw
1360   const Double_t kBoltDepth          =       6.0*fgkmm; // In the flange
1361   const Double_t kBoltRadius         = (220.0/2)*fgkmm; // Radius in flange
1362   const Double_t kThetaBolt          =      30.0*fgkDegree;
1363   const Int_t    kNBolts             = (Int_t)(360.0/kThetaBolt);
1364   // Dimensions of the Cone
1365   const Double_t kConeROutMin        = (540.0/2)*fgkmm;
1366   const Double_t kConeROutMax        = (560.0/2)*fgkmm;
1367   const Double_t kConeRCurv          =      10.0*fgkmm; // Radius of curvature
1368   const Double_t kConeRinMin         = (210.0/2)*fgkmm;
1369 //  const Double_t kConeRinMax         = (216.0/2)*fgkmm;
1370   const Double_t kConeRinCylinder    = (231.0/2)*fgkmm;
1371   const Double_t kConeZCylinder      =     192.0*fgkmm;
1372   const Double_t kConeZOuterMilled   =      23.0*fgkmm;
1373   const Double_t kConeDZin           =      15.0*fgkmm; // ???
1374   const Double_t kConeThickness      =      10.0*fgkmm; // Rohacell + Carb.Fib.
1375   const Double_t kConeTheta          =      45.0*fgkDegree; // SDD cone angle
1376   const Double_t kSinConeTheta       =
1377                                      TMath::Sin(kConeTheta*TMath::DegToRad());
1378   const Double_t kCosConeTheta       =
1379                                      TMath::Cos(kConeTheta*TMath::DegToRad());
1380   const Double_t kTanConeTheta       =
1381                                      TMath::Tan(kConeTheta*TMath::DegToRad());
1382   // Dimensions of the Cone Inserts
1383   const Double_t kConeCFThickness    =       1.5*fgkmm;//Carbon fiber thickness
1384   // Dimensions of the Cone Holes
1385   const Double_t kHole1RMin          = (450.0/2)*fgkmm;
1386   const Double_t kHole1RMax          = (530.0/2)*fgkmm;
1387   const Double_t kHole2RMin          = (280.0/2)*fgkmm;
1388   const Double_t kHole2RMax          = (375.0/2)*fgkmm;
1389   const Double_t kHole1Phi           =      25.0*fgkDegree;
1390   const Double_t kHole2Phi           =      50.0*fgkDegree;
1391   const Double_t kHole3RMin          =     205.0*fgkmm;
1392   const Double_t kHole3DeltaR        =        15*fgkmm;
1393   const Double_t kHole3Width         =        30*fgkmm;
1394   const Int_t    kNHole3             =         6      ;
1395   const Double_t kHole4RMin          =     116.0*fgkmm;
1396   const Double_t kHole4DeltaR        =        15*fgkmm;
1397   const Double_t kHole4Width         =        30*fgkmm;
1398   //  const Int_t    kNHole4             =         3      ;
1399   // Fraction of materials in holes
1400   const Double_t kHolePlasticFrac    =       0.55846;
1401   const Double_t kHoleCuFrac         =       0.06319;
1402   const Double_t kHoleGlassFrac      =       0.02652;
1403
1404   // Local variables
1405   Double_t x, y, z, t, dza, rmin, rmax;
1406
1407
1408   // Recover the needed materials
1409   TGeoMedium *medSDDcf    = mgr->GetMedium("ITS_SDD C (M55J)$");
1410   TGeoMedium *medSDDair   = mgr->GetMedium("ITS_SDD AIR$");
1411   TGeoMedium *medSDDste   = mgr->GetMedium("ITS_G10FR4$"); // stesalite
1412   TGeoMedium *medSDDroh   = mgr->GetMedium("ITS_ROHACELL$");
1413   TGeoMedium *medSDDss    = mgr->GetMedium("ITS_INOX$");
1414   TGeoMedium *medSDDplast = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
1415   TGeoMedium *medSDDCu    = mgr->GetMedium("ITS_COPPER$");
1416   TGeoMedium *medSDDglass = mgr->GetMedium("ITS_SDD OPTICFIB$");
1417
1418   // First define the geometrical shapes
1419
1420   // Central cylinder with its internal foam and the lateral flanges:
1421   // a carbon fiber Tube which contains a rohacell Tube and two
1422   // stesalite Tube's
1423   TGeoTube *cylindershape = new TGeoTube(kCylinderInnerR,kCylinderOuterR,
1424                                          kCylinderHalfLength);
1425
1426   TGeoTube *insertoshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
1427                                         kInsertoHalfLength);
1428
1429   TGeoTube *flangeshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
1430                                        kFlangeHalfLength);
1431
1432   // The flange bolt: it is a Tube
1433   TGeoTube *boltshape = new TGeoTube(0.0, 0.5*kBoltDiameter, 0.5*kBoltDepth);
1434
1435   // Debug if requested
1436   if (GetDebug(1)) {
1437     cylindershape->InspectShape();
1438     insertoshape->InspectShape();
1439     flangeshape->InspectShape();
1440     boltshape->InspectShape();
1441   }
1442
1443
1444   // We have the shapes: now create the real volumes
1445
1446   TGeoVolume *cfcylinder = new TGeoVolume("SDDCarbonFiberCylinder",
1447                                           cylindershape,medSDDcf);
1448   cfcylinder->SetVisibility(kTRUE);
1449   cfcylinder->SetLineColor(4); // Blue
1450   cfcylinder->SetLineWidth(1);
1451   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
1452   cfcylinder->SetFillStyle(4000); // 0% transparent
1453
1454   TGeoVolume *foamcylinder = new TGeoVolume("SDDFoamCylinder",
1455                                             insertoshape,medSDDroh);
1456   foamcylinder->SetVisibility(kTRUE);
1457   foamcylinder->SetLineColor(3); // Green
1458   foamcylinder->SetLineWidth(1);
1459   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
1460   foamcylinder->SetFillStyle(4050); // 50% transparent
1461
1462   TGeoVolume *flangecylinder = new TGeoVolume("SDDFlangeCylinder",
1463                                               flangeshape,medSDDste);
1464   flangecylinder->SetVisibility(kTRUE);
1465   flangecylinder->SetLineColor(2); // Red
1466   flangecylinder->SetLineWidth(1);
1467   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
1468   flangecylinder->SetFillStyle(4050); // 50% transparent
1469
1470   TGeoVolume *bolt = new TGeoVolume("SDDFlangeBolt",boltshape,medSDDss);
1471   bolt->SetVisibility(kTRUE);
1472   bolt->SetLineColor(1);  // Black
1473   bolt->SetLineWidth(1);
1474   bolt->SetFillColor(bolt->GetLineColor());
1475   bolt->SetFillStyle(4050); // 50% transparent
1476
1477   // Mount up the cylinder
1478   for(Int_t i=0; i<kNBolts; i++){
1479     t = kThetaBolt*i;
1480     x = kBoltRadius*CosD(t);
1481     y = kBoltRadius*SinD(t);
1482     z = kFlangeHalfLength-kBoltDepth;
1483     flangecylinder->AddNode(bolt, i+1, new TGeoTranslation("",x,y,z));
1484   }
1485
1486   cfcylinder->AddNode(foamcylinder,1,0);
1487   cfcylinder->AddNode(flangecylinder,1,
1488               new TGeoTranslation(0, 0, kInsertoHalfLength+kFlangeHalfLength));
1489   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
1490               0, 0, -kInsertoHalfLength-kFlangeHalfLength,
1491               new TGeoRotation("",0,180,0)     ) );
1492
1493
1494   // SDD Support Cone with its internal inserts: a carbon fiber Pcon
1495   // with holes which contains a stesalite Pcon which on turn contains a
1496   // rohacell Pcon
1497
1498   dza = kConeThickness/kSinConeTheta-(kConeROutMax-kConeROutMin)/kTanConeTheta;
1499
1500   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 10);
1501
1502   coneshape->Z(0)     = 0.0;
1503   coneshape->Rmin(0)  = kConeROutMin;
1504   coneshape->Rmax(0)  = kConeROutMax;
1505
1506   coneshape->Z(1)     = kConeZOuterMilled - dza;
1507   coneshape->Rmin(1)  = coneshape->GetRmin(0);
1508   coneshape->Rmax(1)  = coneshape->GetRmax(0);
1509
1510   coneshape->Z(2)     = kConeZOuterMilled;
1511   coneshape->Rmax(2)  = coneshape->GetRmax(0);
1512
1513   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(1),
1514                     coneshape->GetRmin(1),kConeTheta,z,rmin);
1515   coneshape->Z(3)     = z;
1516   coneshape->Rmin(3)  = rmin;
1517
1518   coneshape->Rmin(2)  = RminFrom2Points(coneshape,3,1,coneshape->GetZ(2));
1519
1520   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(2),
1521                     coneshape->GetRmax(2),kConeTheta,z,rmax);
1522   coneshape->Z(4)     = z;
1523   coneshape->Rmax(4)  = rmax;
1524   coneshape->Rmin(4)  = RminFromZpCone(coneshape,3,kConeTheta,
1525                                        coneshape->GetZ(4),0.0);
1526
1527   coneshape->Rmax(3)  = RmaxFrom2Points(coneshape,4,2,coneshape->GetZ(3));
1528
1529   coneshape->Z(6)     = kConeZCylinder - kConeDZin;
1530
1531   RadiusOfCurvature(kConeRCurv,90.0,coneshape->GetZ(6),0.0,
1532                     90.0-kConeTheta,z,rmin);
1533   coneshape->Z(5)     = z;
1534   coneshape->Rmin(5)  = RminFromZpCone(coneshape,3,kConeTheta,z);
1535   coneshape->Rmax(5)  = RmaxFromZpCone(coneshape,4,kConeTheta,z);
1536
1537   RadiusOfCurvature(kConeRCurv,90.-kConeTheta,
1538                     0.0,coneshape->Rmin(5),90.0,z,rmin);
1539   coneshape->Rmin(6)  = rmin;
1540   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,4,kConeTheta,
1541                                        coneshape->GetZ(6));
1542
1543   coneshape->Z(7)     = coneshape->GetZ(6);
1544   coneshape->Rmin(7)  = kConeRinMin;
1545   coneshape->Rmax(7)  = coneshape->GetRmax(6);
1546
1547   coneshape->Rmin(8)  = kConeRinMin;
1548
1549   RadiusOfCurvature(kConeRCurv,90.0,kConeZCylinder,kConeRinCylinder,
1550                     90.0-kConeTheta,z,rmax);
1551   coneshape->Z(8)     = z;
1552   coneshape->Rmax(8)  = rmax;
1553
1554   coneshape->Z(9)     = kConeZCylinder;
1555   coneshape->Rmin(9)  = kConeRinMin;
1556   coneshape->Rmax(9)  = kConeRinCylinder;
1557
1558
1559   // SDD Cone Insert: another Pcon
1560   Double_t x0, y0, x1, y1, x2, y2;
1561   TGeoPcon *coneinsertshape = new TGeoPcon(0.0, 360.0, 9);
1562
1563   coneinsertshape->Z(0)    = coneshape->GetZ(0) + kConeCFThickness;
1564   coneinsertshape->Rmin(0) = coneshape->GetRmin(0) + kConeCFThickness;
1565   coneinsertshape->Rmax(0) = coneshape->GetRmax(0) - kConeCFThickness;
1566
1567   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
1568   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
1569   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
1570   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1571   coneinsertshape->Z(1)    = z;
1572   coneinsertshape->Rmin(1) = rmin;
1573   coneinsertshape->Rmax(1) = coneinsertshape->GetRmax(0);
1574
1575   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmax(1);
1576   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmax(2);
1577   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmax(3);
1578   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
1579   coneinsertshape->Z(2)    = z;
1580   coneinsertshape->Rmax(2) = rmax;
1581
1582   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
1583   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
1584   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
1585   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1586   coneinsertshape->Z(3)    = z;
1587   coneinsertshape->Rmin(3) = rmin;
1588
1589   x0 = coneinsertshape->GetZ(1); y0 = coneinsertshape->GetRmin(1);
1590   x1 = coneinsertshape->GetZ(3); y1 = coneinsertshape->GetRmin(3);
1591   coneinsertshape->Rmin(2) = Yfrom2Points(x0, y0, x1, y1,
1592                                           coneinsertshape->Z(2));
1593
1594   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
1595   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
1596   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
1597   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
1598   coneinsertshape->Z(4)    = z;
1599   coneinsertshape->Rmax(4) = rmax;
1600
1601   x0 = coneinsertshape->GetZ(2); y0 = coneinsertshape->GetRmax(2);
1602   x1 = coneinsertshape->GetZ(4); y1 = coneinsertshape->GetRmax(4);
1603   coneinsertshape->Rmax(3) = Yfrom2Points(x0, y0, x1, y1,
1604                                           coneinsertshape->Z(3));
1605
1606   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmin(4);
1607   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmin(5);
1608   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmin(6);
1609   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1610   coneinsertshape->Z(5)    = z;
1611   coneinsertshape->Rmin(5) = rmin;
1612   coneinsertshape->Rmax(5) = coneinsertshape->GetRmax(4) -
1613           kTanConeTheta*(coneinsertshape->GetZ(5) - coneinsertshape->GetZ(4));
1614
1615   x0 = coneinsertshape->GetZ(3); y0 = coneinsertshape->GetRmin(3);
1616   x1 = coneinsertshape->GetZ(5); y1 = coneinsertshape->GetRmin(5);
1617   coneinsertshape->Rmin(4) = Yfrom2Points(x0, y0, x1, y1,
1618                                           coneinsertshape->Z(4));
1619
1620   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmin(5);
1621   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmin(6);
1622   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmin(7);
1623   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1624   coneinsertshape->Z(6)    = z;
1625   coneinsertshape->Rmin(6) = rmin;
1626   coneinsertshape->Rmax(6) = coneinsertshape->GetRmax(4) -
1627           kTanConeTheta*(coneinsertshape->GetZ(6) - coneinsertshape->GetZ(4));
1628
1629   coneinsertshape->Z(7)    = coneinsertshape->GetZ(6);
1630   coneinsertshape->Rmin(7) = coneshape->GetRmin(7) + kConeCFThickness;
1631   coneinsertshape->Rmax(7) = coneinsertshape->GetRmax(6);
1632
1633   coneinsertshape->Z(8)    = coneshape->GetZ(9) - kConeCFThickness;
1634   coneinsertshape->Rmin(8) = coneinsertshape->GetRmin(7);
1635   coneinsertshape->Rmax(8) = coneinsertshape->GetRmax(4) -
1636           kTanConeTheta*(coneinsertshape->GetZ(8) - coneinsertshape->GetZ(4));
1637
1638   // SDD Cone Foam: another Pcon
1639   TGeoPcon *conefoamshape = new TGeoPcon(0.0, 360.0, 4);
1640
1641   RadiusOfCurvature(kConeRCurv+kConeCFThickness,0.0,coneinsertshape->GetZ(1),
1642                     coneinsertshape->GetRmin(1),kConeTheta,z,rmin);
1643
1644   conefoamshape->Z(0)    = z;
1645   conefoamshape->Rmin(0) = rmin;
1646   conefoamshape->Rmax(0) = conefoamshape->GetRmin(0);
1647
1648   conefoamshape->Z(1)    = conefoamshape->GetZ(0)+
1649                          (kConeThickness-2.0*kConeCFThickness)/kSinConeTheta;
1650   conefoamshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1651                                           conefoamshape->GetZ(1));
1652   conefoamshape->Rmax(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1653                                           conefoamshape->GetZ(1));
1654
1655   conefoamshape->Z(2)    = coneshape->GetZ(5)-kConeCFThickness;
1656   conefoamshape->Rmin(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1657                                           conefoamshape->GetZ(2));
1658   conefoamshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1659                                           conefoamshape->GetZ(2));
1660
1661   conefoamshape->Z(3)    = coneinsertshape->GetZ(5)+
1662                          (kConeThickness-2.0*kConeCFThickness)*kCosConeTheta;
1663   conefoamshape->Rmax(3) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1664                                           conefoamshape->GetZ(3));
1665   conefoamshape->Rmin(3) = conefoamshape->GetRmax(3);
1666
1667   // SDD Cone Holes: Pcon's
1668   // A single hole volume gives an overlap with coneinsert, so
1669   // three contiguous volumes are created: one to be put in the cone foam
1670   // and two in the cone carbon fiber envelope
1671   TGeoPcon *hole1shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1672
1673   hole1shape->Rmin(0) = kHole1RMax;
1674   hole1shape->Rmax(0) = hole1shape->GetRmin(0);
1675   hole1shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
1676                                        hole1shape->GetRmin(0));
1677
1678   hole1shape->Rmax(1) = hole1shape->GetRmax(0);
1679   hole1shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1680                                        hole1shape->GetRmax(1));
1681   hole1shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
1682                                        hole1shape->GetZ(1));
1683
1684   hole1shape->Rmin(2) = kHole1RMin;
1685   hole1shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1686                                        hole1shape->GetRmin(2));
1687   hole1shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1688                                        hole1shape->GetZ(2));
1689
1690   hole1shape->Rmin(3) = hole1shape->GetRmin(2);
1691   hole1shape->Rmax(3) = hole1shape->GetRmin(3);
1692   hole1shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1693                                        hole1shape->GetRmax(3));
1694
1695   TGeoPcon *hole11shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1696
1697   hole11shape->Rmin(0) = kHole1RMax;
1698   hole11shape->Rmax(0) = hole11shape->GetRmin(0);
1699   hole11shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1700                                         hole11shape->GetRmin(0));
1701
1702   hole11shape->Rmax(1) = hole11shape->GetRmax(0);
1703   hole11shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1704                                         hole11shape->GetRmax(1));
1705   hole11shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1706                                         hole11shape->GetZ(1));
1707
1708   hole11shape->Rmin(2) = kHole1RMin;
1709   hole11shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1710                                         hole11shape->GetRmin(2));
1711   hole11shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1712                                         hole11shape->GetZ(2));
1713
1714   hole11shape->Rmin(3) = hole11shape->GetRmin(2);
1715   hole11shape->Rmax(3) = hole11shape->GetRmin(3);
1716   hole11shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1717                                         hole11shape->GetRmax(3));
1718
1719   TGeoPcon *hole12shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1720
1721   hole12shape->Rmin(0) = kHole1RMax;
1722   hole12shape->Rmax(0) = hole12shape->GetRmin(0);
1723   hole12shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1724                                         hole12shape->GetRmin(0));
1725
1726   hole12shape->Rmax(1) = hole12shape->GetRmax(0);
1727   hole12shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1728                                         hole12shape->GetRmax(1));
1729   hole12shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1730                                         hole12shape->GetZ(1));
1731
1732   hole12shape->Rmin(2) = kHole1RMin;
1733   hole12shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1734                                         hole12shape->GetRmin(2));
1735   hole12shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1736                                         hole12shape->GetZ(2));
1737
1738   hole12shape->Rmin(3) = hole12shape->GetRmin(2);
1739   hole12shape->Rmax(3) = hole12shape->GetRmin(3);
1740   hole12shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1741                                         hole12shape->GetRmax(3));
1742
1743   //
1744   TGeoPcon *hole2shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1745
1746   hole2shape->Rmin(0) = kHole2RMax;
1747   hole2shape->Rmax(0) = hole2shape->GetRmin(0);
1748   hole2shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
1749                                        hole2shape->GetRmin(0));
1750
1751   hole2shape->Rmax(1) = hole2shape->GetRmax(0);
1752   hole2shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1753                                        hole2shape->GetRmax(1));
1754   hole2shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
1755                                        hole2shape->GetZ(1));
1756
1757   hole2shape->Rmin(2) = kHole2RMin;
1758   hole2shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1759                                        hole2shape->GetRmin(2));
1760   hole2shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1761                                        hole2shape->GetZ(2));
1762
1763   hole2shape->Rmin(3) = hole2shape->GetRmin(2);
1764   hole2shape->Rmax(3) = hole2shape->GetRmin(3);
1765   hole2shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1766                                        hole2shape->GetRmax(3));
1767
1768   TGeoPcon *hole21shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1769
1770   hole21shape->Rmin(0) = kHole2RMax;
1771   hole21shape->Rmax(0) = hole21shape->GetRmin(0);
1772   hole21shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1773                                         hole21shape->GetRmin(0));
1774
1775   hole21shape->Rmax(1) = hole21shape->GetRmax(0);
1776   hole21shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1777                                         hole21shape->GetRmax(1));
1778   hole21shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1779                                         hole21shape->GetZ(1));
1780
1781   hole21shape->Rmin(2) = kHole2RMin;
1782   hole21shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1783                                         hole21shape->GetRmin(2));
1784   hole21shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1785                                         hole21shape->GetZ(2));
1786
1787   hole21shape->Rmin(3) = hole21shape->GetRmin(2);
1788   hole21shape->Rmax(3) = hole21shape->GetRmin(3);
1789   hole21shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1790                                         hole21shape->GetRmax(3));
1791
1792   TGeoPcon *hole22shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1793
1794   hole22shape->Rmin(0) = kHole2RMax;
1795   hole22shape->Rmax(0) = hole22shape->GetRmin(0);
1796   hole22shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1797                                         hole22shape->GetRmin(0));
1798
1799   hole22shape->Rmax(1) = hole22shape->GetRmax(0);
1800   hole22shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1801                                         hole22shape->GetRmax(1));
1802   hole22shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1803                                         hole22shape->GetZ(1));
1804
1805   hole22shape->Rmin(2) = kHole2RMin;
1806   hole22shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1807                                         hole22shape->GetRmin(2));
1808   hole22shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1809                                         hole22shape->GetZ(2));
1810
1811   hole22shape->Rmin(3) = hole22shape->GetRmin(2);
1812   hole22shape->Rmax(3) = hole22shape->GetRmin(3);
1813   hole22shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1814                                         hole22shape->GetRmax(3));
1815
1816   //
1817   Double_t holePhi;
1818   holePhi = (kHole3Width/kHole3RMin)*TMath::RadToDeg();
1819
1820   TGeoPcon *hole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1821
1822   hole3shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1823   hole3shape->Rmax(0) = hole3shape->GetRmin(0);
1824   hole3shape->Z(0)    = ZFromRminpCone(conefoamshape,0,kConeTheta,
1825                                        hole3shape->GetRmin(0));
1826
1827   hole3shape->Rmax(1) = hole3shape->GetRmax(0);
1828   hole3shape->Z(1)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1829                                        hole3shape->GetRmax(1));
1830   hole3shape->Rmin(1) = RminFromZpCone(conefoamshape,1,kConeTheta,
1831                                        hole3shape->GetZ(1));
1832
1833   hole3shape->Rmin(2) = kHole3RMin;
1834   hole3shape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1835                                        hole3shape->GetRmin(2));
1836   hole3shape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1837                                        hole3shape->GetZ(2));
1838
1839   hole3shape->Rmin(3) = hole3shape->GetRmin(2);
1840   hole3shape->Rmax(3) = hole3shape->GetRmin(3);
1841   hole3shape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1842                                        hole3shape->GetRmax(3));
1843
1844   TGeoPcon *hole31shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1845
1846   hole31shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1847   hole31shape->Rmax(0) = hole31shape->GetRmin(0);
1848   hole31shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1849                                         hole31shape->GetRmin(0));
1850
1851   hole31shape->Rmax(1) = hole31shape->GetRmax(0);
1852   hole31shape->Z(1)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1853                                         hole31shape->GetRmax(1));
1854   hole31shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1855                                         hole31shape->GetZ(1));
1856
1857   hole31shape->Rmin(2) = kHole3RMin;
1858   hole31shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1859                                         hole31shape->GetRmin(2));
1860   hole31shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1861                                         hole31shape->GetZ(2));
1862
1863   hole31shape->Rmin(3) = hole31shape->GetRmin(2);
1864   hole31shape->Rmax(3) = hole31shape->GetRmin(3);
1865   hole31shape->Z(3)    = ZFromRminpCone(coneinsertshape,3,kConeTheta,
1866                                         hole31shape->GetRmax(3));
1867
1868   TGeoPcon *hole32shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1869
1870   hole32shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1871   hole32shape->Rmax(0) = hole32shape->GetRmin(0);
1872   hole32shape->Z(0)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1873                                         hole32shape->GetRmin(0));
1874
1875   hole32shape->Rmax(1) = hole32shape->GetRmax(0);
1876   hole32shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1877                                         hole32shape->GetRmax(1));
1878   hole32shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1879                                         hole32shape->GetZ(1));
1880
1881   hole32shape->Rmin(2) = kHole3RMin;
1882   hole32shape->Z(2)    = ZFromRmaxpCone(coneinsertshape,4,kConeTheta,
1883                                         hole32shape->GetRmin(2));
1884   hole32shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1885                                         hole32shape->GetZ(2));
1886
1887   hole32shape->Rmin(3) = hole32shape->GetRmin(2);
1888   hole32shape->Rmax(3) = hole32shape->GetRmin(3);
1889   hole32shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1890                                         hole32shape->GetRmax(3));
1891
1892   //
1893   holePhi = (kHole4Width/kHole4RMin)*TMath::RadToDeg();
1894
1895   TGeoPcon *hole4shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1896
1897   hole4shape->Rmin(0) = kHole4RMin + kHole4DeltaR;
1898   hole4shape->Rmax(0) = hole4shape->GetRmin(0);
1899   hole4shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1900                                        hole4shape->GetRmin(0));
1901
1902   hole4shape->Rmax(1) = hole4shape->GetRmax(0);
1903   hole4shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1904                                        hole4shape->GetRmax(1));
1905   hole4shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1906                                        hole4shape->GetZ(1));
1907
1908   hole4shape->Rmin(2) = kHole4RMin;
1909   hole4shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1910                                        hole4shape->GetRmin(2));
1911   hole4shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1912                                        hole4shape->GetZ(2));
1913
1914   hole4shape->Rmin(3) = hole4shape->GetRmin(2);
1915   hole4shape->Rmax(3) = hole4shape->GetRmin(3);
1916   hole4shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1917                                        hole4shape->GetRmax(3));
1918
1919   // Cables to be put inside the holes: Pcon's
1920   // (fractions are manually computed from AliITSv11GeometrySDD::SDDCables
1921   TGeoPcon *hole1plastshape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1922
1923   hole1plastshape->Rmin(0) = hole1shape->GetRmin(0);
1924   hole1plastshape->Rmax(0) = hole1shape->GetRmax(0);
1925   hole1plastshape->Z(0)    = hole1shape->GetZ(0);
1926
1927   hole1plastshape->Rmin(1) = hole1shape->GetRmin(1);
1928   hole1plastshape->Rmax(1) = hole1shape->GetRmax(1);
1929   hole1plastshape->Z(1)    = hole1shape->GetZ(1);
1930
1931   dza = hole1plastshape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHolePlasticFrac;
1932
1933   hole1plastshape->Rmin(2) = dza;
1934   hole1plastshape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1935                                             hole1plastshape->GetRmin(2));
1936   hole1plastshape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
1937                                             hole1plastshape->GetZ(2));
1938
1939   hole1plastshape->Rmin(3) = hole1plastshape->GetRmin(2);
1940   hole1plastshape->Rmax(3) = hole1plastshape->GetRmin(3);
1941   hole1plastshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1942                                             hole1plastshape->GetRmax(3));
1943
1944   TGeoPcon *hole1Cushape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1945
1946   hole1Cushape->Rmin(0) = hole1plastshape->GetRmin(2);
1947   hole1Cushape->Rmax(0) = hole1Cushape->GetRmin(0);
1948   hole1Cushape->Z(0)    = hole1plastshape->GetZ(2);
1949
1950   dza = hole1Cushape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHoleCuFrac;
1951
1952   hole1Cushape->Rmin(1) = dza;
1953   hole1Cushape->Rmax(1) = hole1Cushape->GetRmax(0);
1954   hole1Cushape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1955                                          hole1Cushape->GetRmin(1));
1956
1957   hole1Cushape->Rmax(2) = hole1Cushape->GetRmax(0);
1958   hole1Cushape->Rmin(2) = hole1Cushape->GetRmin(1);
1959   hole1Cushape->Z(2)    = hole1plastshape->GetZ(3);
1960
1961   hole1Cushape->Rmin(3) = hole1Cushape->GetRmin(1);
1962   hole1Cushape->Rmax(3) = hole1Cushape->GetRmin(3);
1963   hole1Cushape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1964                                          hole1Cushape->GetRmax(3));
1965
1966   TGeoPcon *hole1glassshape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1967
1968   hole1glassshape->Rmin(0) = hole1Cushape->GetRmin(1);
1969   hole1glassshape->Rmax(0) = hole1glassshape->GetRmin(0);
1970   hole1glassshape->Z(0)    = hole1Cushape->GetZ(1);
1971
1972   dza = hole1glassshape->GetRmax(0) - (kHole1RMax-kHole1RMin)*kHoleGlassFrac;
1973
1974   hole1glassshape->Rmin(1) = dza;
1975   hole1glassshape->Rmax(1) = hole1glassshape->GetRmax(0);
1976   hole1glassshape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
1977                                             hole1glassshape->GetRmin(1));
1978
1979   hole1glassshape->Rmax(2) = hole1glassshape->GetRmax(0);
1980   hole1glassshape->Rmin(2) = hole1glassshape->GetRmin(1);
1981   hole1glassshape->Z(2)    = hole1Cushape->GetZ(3);
1982
1983   hole1glassshape->Rmin(3) = hole1glassshape->GetRmin(1);
1984   hole1glassshape->Rmax(3) = hole1glassshape->GetRmin(3);
1985   hole1glassshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
1986                                             hole1glassshape->GetRmax(3));
1987   //
1988   TGeoPcon *hole2plastshape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1989
1990   hole2plastshape->Rmin(0) = hole2shape->GetRmin(0);
1991   hole2plastshape->Rmax(0) = hole2shape->GetRmax(0);
1992   hole2plastshape->Z(0)    = hole2shape->GetZ(0);
1993
1994   hole2plastshape->Rmin(1) = hole2shape->GetRmin(1);
1995   hole2plastshape->Rmax(1) = hole2shape->GetRmax(1);
1996   hole2plastshape->Z(1)    = hole2shape->GetZ(1);
1997
1998   dza = hole2plastshape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHolePlasticFrac;
1999
2000   hole2plastshape->Rmin(2) = dza;
2001   hole2plastshape->Z(2)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
2002                                             hole2plastshape->GetRmin(2));
2003   hole2plastshape->Rmax(2) = RmaxFromZpCone(conefoamshape,3,kConeTheta,
2004                                             hole2plastshape->GetZ(2));
2005
2006   hole2plastshape->Rmin(3) = hole2plastshape->GetRmin(2);
2007   hole2plastshape->Rmax(3) = hole2plastshape->GetRmin(3);
2008   hole2plastshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
2009                                             hole2plastshape->GetRmax(3));
2010
2011   TGeoPcon *hole2Cushape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
2012
2013   hole2Cushape->Rmin(0) = hole2plastshape->GetRmin(2);
2014   hole2Cushape->Rmax(0) = hole2Cushape->GetRmin(0);
2015   hole2Cushape->Z(0)    = hole2plastshape->GetZ(2);
2016
2017   dza = hole2Cushape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHoleCuFrac;
2018
2019   hole2Cushape->Rmin(1) = dza;
2020   hole2Cushape->Rmax(1) = hole2Cushape->GetRmax(0);
2021   hole2Cushape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
2022                                          hole2Cushape->GetRmin(1));
2023
2024   hole2Cushape->Rmax(2) = hole2Cushape->GetRmax(0);
2025   hole2Cushape->Rmin(2) = hole2Cushape->GetRmin(1);
2026   hole2Cushape->Z(2)    = hole2plastshape->GetZ(3);
2027
2028   hole2Cushape->Rmin(3) = hole2Cushape->GetRmin(1);
2029   hole2Cushape->Rmax(3) = hole2Cushape->GetRmin(3);
2030   hole2Cushape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
2031                                          hole2Cushape->GetRmax(3));
2032
2033   TGeoPcon *hole2glassshape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
2034
2035   hole2glassshape->Rmin(0) = hole2Cushape->GetRmin(1);
2036   hole2glassshape->Rmax(0) = hole2glassshape->GetRmin(0);
2037   hole2glassshape->Z(0)    = hole2Cushape->GetZ(1);
2038
2039   dza = hole2glassshape->GetRmax(0) - (kHole2RMax-kHole2RMin)*kHoleGlassFrac;
2040
2041   hole2glassshape->Rmin(1) = dza;
2042   hole2glassshape->Rmax(1) = hole2glassshape->GetRmax(0);
2043   hole2glassshape->Z(1)    = ZFromRminpCone(conefoamshape,1,kConeTheta,
2044                                             hole2glassshape->GetRmin(1));
2045
2046   hole2glassshape->Rmax(2) = hole2glassshape->GetRmax(0);
2047   hole2glassshape->Rmin(2) = hole2glassshape->GetRmin(1);
2048   hole2glassshape->Z(2)    = hole2Cushape->GetZ(3);
2049
2050   hole2glassshape->Rmin(3) = hole2glassshape->GetRmin(1);
2051   hole2glassshape->Rmax(3) = hole2glassshape->GetRmin(3);
2052   hole2glassshape->Z(3)    = ZFromRmaxpCone(conefoamshape,3,kConeTheta,
2053                                             hole2glassshape->GetRmax(3));
2054
2055
2056   // Debug if requested
2057   if (GetDebug(1)) {
2058     coneshape->InspectShape();
2059     coneinsertshape->InspectShape();
2060     conefoamshape->InspectShape();
2061     hole1shape->InspectShape();
2062     hole2shape->InspectShape();
2063     hole3shape->InspectShape();
2064     hole4shape->InspectShape();
2065   }
2066
2067
2068   // We have the shapes: now create the real volumes
2069
2070   TGeoVolume *cfcone = new TGeoVolume("SDDCarbonFiberCone",
2071                                       coneshape,medSDDcf);
2072   cfcone->SetVisibility(kTRUE);
2073   cfcone->SetLineColor(4); // Blue
2074   cfcone->SetLineWidth(1);
2075   cfcone->SetFillColor(cfcone->GetLineColor());
2076   cfcone->SetFillStyle(4000); // 0% transparent
2077
2078   TGeoVolume *cfconeinsert = new TGeoVolume("SDDCarbonFiberConeInsert",
2079                                             coneinsertshape,medSDDste);
2080   cfconeinsert->SetVisibility(kTRUE);
2081   cfconeinsert->SetLineColor(2); // Red
2082   cfconeinsert->SetLineWidth(1);
2083   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
2084   cfconeinsert->SetFillStyle(4050); // 50% transparent
2085
2086   TGeoVolume *cfconefoam = new TGeoVolume("SDDCarbonFiberConeFoam",
2087                                           conefoamshape,medSDDroh);
2088   cfconefoam->SetVisibility(kTRUE);
2089   cfconefoam->SetLineColor(7); // Light blue
2090   cfconefoam->SetLineWidth(1);
2091   cfconefoam->SetFillColor(cfconefoam->GetLineColor());
2092   cfconefoam->SetFillStyle(4050); // 50% transparent
2093
2094   TGeoVolume *hole1 = new TGeoVolume("SDDCableHole1",
2095                                      hole1shape,medSDDair);
2096   hole1->SetVisibility(kTRUE);
2097   hole1->SetLineColor(5); // Yellow
2098   hole1->SetLineWidth(1);
2099   hole1->SetFillColor(hole1->GetLineColor());
2100   hole1->SetFillStyle(4090); // 90% transparent
2101
2102   TGeoVolume *hole11 = new TGeoVolume("SDDCableHole11",
2103                                       hole11shape,medSDDair);
2104   hole11->SetVisibility(kTRUE);
2105   hole11->SetLineColor(5); // Yellow
2106   hole11->SetLineWidth(1);
2107   hole11->SetFillColor(hole11->GetLineColor());
2108   hole11->SetFillStyle(4090); // 90% transparent
2109
2110   TGeoVolume *hole12 = new TGeoVolume("SDDCableHole12",
2111                                       hole12shape,medSDDair);
2112   hole12->SetVisibility(kTRUE);
2113   hole12->SetLineColor(5); // Yellow
2114   hole12->SetLineWidth(1);
2115   hole12->SetFillColor(hole12->GetLineColor());
2116   hole12->SetFillStyle(4090); // 90% transparent
2117
2118   TGeoVolume *hole1plast = new TGeoVolume("SDDCableHole1Plast",
2119                                           hole1plastshape,medSDDplast);
2120   hole1plast->SetVisibility(kTRUE);
2121   hole1plast->SetLineColor(kBlue);
2122   hole1plast->SetLineWidth(1);
2123   hole1plast->SetFillColor(hole1plast->GetLineColor());
2124   hole1plast->SetFillStyle(4090); // 90% transparent
2125
2126   TGeoVolume *hole1Cu = new TGeoVolume("SDDCableHole1Cu",
2127                                        hole1Cushape,medSDDCu);
2128   hole1Cu->SetVisibility(kTRUE);
2129   hole1Cu->SetLineColor(kRed);
2130   hole1Cu->SetLineWidth(1);
2131   hole1Cu->SetFillColor(hole1Cu->GetLineColor());
2132   hole1Cu->SetFillStyle(4090); // 90% transparent
2133
2134   TGeoVolume *hole1glass = new TGeoVolume("SDDCableHole1glass",
2135                                           hole1glassshape,medSDDglass);
2136   hole1glass->SetVisibility(kTRUE);
2137   hole1glass->SetLineColor(kGreen);
2138   hole1glass->SetLineWidth(1);
2139   hole1glass->SetFillColor(hole1glass->GetLineColor());
2140   hole1glass->SetFillStyle(4090); // 90% transparent
2141
2142   TGeoVolume *hole2 = new TGeoVolume("SDDCableHole2",
2143                                      hole2shape,medSDDair);
2144   hole2->SetVisibility(kTRUE);
2145   hole2->SetLineColor(5); // Yellow
2146   hole2->SetLineWidth(1);
2147   hole2->SetFillColor(hole2->GetLineColor());
2148   hole2->SetFillStyle(4090); // 90% transparent
2149
2150   TGeoVolume *hole21 = new TGeoVolume("SDDCableHole21",
2151                                       hole21shape,medSDDair);
2152   hole21->SetVisibility(kTRUE);
2153   hole21->SetLineColor(5); // Yellow
2154   hole21->SetLineWidth(1);
2155   hole21->SetFillColor(hole21->GetLineColor());
2156   hole21->SetFillStyle(4090); // 90% transparent
2157
2158   TGeoVolume *hole22 = new TGeoVolume("SDDCableHole22",
2159                                       hole22shape,medSDDair);
2160   hole22->SetVisibility(kTRUE);
2161   hole22->SetLineColor(5); // Yellow
2162   hole22->SetLineWidth(1);
2163   hole22->SetFillColor(hole22->GetLineColor());
2164   hole22->SetFillStyle(4090); // 90% transparent
2165
2166   TGeoVolume *hole2plast = new TGeoVolume("SDDCableHole2Plast",
2167                                           hole2plastshape,medSDDplast);
2168   hole2plast->SetVisibility(kTRUE);
2169   hole2plast->SetLineColor(kBlue);
2170   hole2plast->SetLineWidth(1);
2171   hole2plast->SetFillColor(hole2plast->GetLineColor());
2172   hole2plast->SetFillStyle(4090); // 90% transparent
2173
2174   TGeoVolume *hole2Cu = new TGeoVolume("SDDCableHole2Cu",
2175                                        hole2Cushape,medSDDCu);
2176   hole2Cu->SetVisibility(kTRUE);
2177   hole2Cu->SetLineColor(kRed);
2178   hole2Cu->SetLineWidth(1);
2179   hole2Cu->SetFillColor(hole2Cu->GetLineColor());
2180   hole2Cu->SetFillStyle(4090); // 90% transparent
2181
2182   TGeoVolume *hole2glass = new TGeoVolume("SDDCableHole2glass",
2183                                           hole2glassshape,medSDDglass);
2184   hole2glass->SetVisibility(kTRUE);
2185   hole2glass->SetLineColor(kGreen);
2186   hole2glass->SetLineWidth(1);
2187   hole2glass->SetFillColor(hole2glass->GetLineColor());
2188   hole2glass->SetFillStyle(4090); // 90% transparent
2189
2190   TGeoVolume *hole3 = new TGeoVolume("SDDCableHole3",
2191                                      hole3shape,medSDDair);
2192   hole3->SetVisibility(kTRUE);
2193   hole3->SetLineColor(5); // Yellow
2194   hole3->SetLineWidth(1);
2195   hole3->SetFillColor(hole3->GetLineColor());
2196   hole3->SetFillStyle(4090); // 90% transparent
2197
2198   TGeoVolume *hole31 = new TGeoVolume("SDDCableHole31",
2199                                       hole31shape,medSDDair);
2200   hole31->SetVisibility(kTRUE);
2201   hole31->SetLineColor(5); // Yellow
2202   hole31->SetLineWidth(1);
2203   hole31->SetFillColor(hole31->GetLineColor());
2204   hole31->SetFillStyle(4090); // 90% transparent
2205
2206   TGeoVolume *hole32 = new TGeoVolume("SDDCableHole32",
2207                                       hole32shape,medSDDair);
2208   hole32->SetVisibility(kTRUE);
2209   hole32->SetLineColor(5); // Yellow
2210   hole32->SetLineWidth(1);
2211   hole32->SetFillColor(hole32->GetLineColor());
2212   hole32->SetFillStyle(4090); // 90% transparent
2213
2214   TGeoVolume *hole4 = new TGeoVolume("SDDCableHole4",
2215                                      hole4shape,medSDDair);
2216   hole4->SetVisibility(kTRUE);
2217   hole4->SetLineColor(5); // Yellow
2218   hole4->SetLineWidth(1);
2219   hole4->SetFillColor(hole4->GetLineColor());
2220   hole4->SetFillStyle(4090); // 90% transparent
2221
2222   // Mount up a cone
2223   cfconeinsert->AddNode(cfconefoam,1,0);
2224
2225   hole1->AddNode(hole1plast, 1, 0);
2226   hole1->AddNode(hole1Cu, 1, 0);
2227   hole1->AddNode(hole1glass, 1, 0);
2228
2229   hole2->AddNode(hole2plast, 1, 0);
2230   hole2->AddNode(hole2Cu, 1, 0);
2231   hole2->AddNode(hole2glass, 1, 0);
2232
2233   for (Int_t i=0; i<12; i++) {
2234     Double_t phiH = i*30.0;
2235     cfconefoam->AddNode(hole1 , i+1, new TGeoRotation("", 0, 0, phiH));
2236         cfcone->AddNode(hole11, i+1, new TGeoRotation("", 0, 0, phiH));
2237         cfcone->AddNode(hole12, i+1, new TGeoRotation("", 0, 0, phiH));
2238   }
2239
2240   for (Int_t i=0; i<6; i++) {
2241     Double_t phiH = i*60.0;
2242     cfconefoam->AddNode(hole2 , i+1, new TGeoRotation("", 0, 0, phiH));
2243         cfcone->AddNode(hole21, i+1, new TGeoRotation("", 0, 0, phiH));
2244         cfcone->AddNode(hole22, i+1, new TGeoRotation("", 0, 0, phiH));
2245   }
2246
2247   for (Int_t i=0; i<kNHole3; i++) {
2248     Double_t phiH0 = 360./(Double_t)kNHole3;
2249     Double_t phiH  = i*phiH0 + 0.5*phiH0;
2250     cfconefoam->AddNode(hole3 , i+1, new TGeoRotation("", phiH, 0, 0));
2251         cfcone->AddNode(hole31, i+1, new TGeoRotation("", phiH, 0, 0));
2252         cfcone->AddNode(hole32, i+1, new TGeoRotation("", phiH, 0, 0));
2253   }
2254
2255   cfcone->AddNode(cfconeinsert,1,0);
2256
2257 /*
2258   for (Int_t i=0; i<kNHole4; i++) {
2259     Double_t phiH0 = 360./(Double_t)kNHole4;
2260     Double_t phiH  = i*phiH0 + 0.25*phiH0;
2261     cfcone->AddNode(hole4, i+1, new TGeoRotation("", phiH, 0, 0));
2262   }
2263 */
2264   // Finally put everything in the mother volume
2265   moth->AddNode(cfcylinder,1,0);
2266
2267   z = coneshape->Z(9);
2268   moth->AddNode(cfcone,1,new TGeoTranslation(0, 0, -z - kCylinderHalfLength));
2269   moth->AddNode(cfcone,2,new TGeoCombiTrans (0, 0,  z + kCylinderHalfLength,
2270                          new TGeoRotation("", 0, 180, 0)                   ));
2271
2272
2273   return;
2274 }
2275
2276 //______________________________________________________________________
2277 void AliITSv11GeometrySupport::SSDCone(TGeoVolume *moth,const TGeoManager *mgr)
2278 {
2279 //
2280 // Creates the SSD support cone and cylinder geometry. as a
2281 // volume assembly and adds it to the mother volume
2282 // (part of this code is taken or anyway inspired to SSDCone method
2283 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
2284 //
2285 // Input:
2286 //         moth : the TGeoVolume owing the volume structure
2287 //         mgr  : the GeoManager (default gGeoManager)
2288 // Output:
2289 //
2290 // Created:         ???       Bjorn S. Nilsen
2291 // Updated:      08 Mar 2008  Mario Sitta
2292 //
2293 // Technical data are taken from:  "ITS Supporto Generale" (technical
2294 // drawings ALR3-0743/1, ALR3-0743/1A and ALR3-0743/1B), "Supporto Generale
2295 // Settore SSD" (technical drawings ALR3-0743/2A and ALR3-0743/2E), private
2296 // communication with B. Giraudo
2297 //
2298 // Updated:      11 Apr 2008  Mario Sitta
2299 // Measures from drawings give overlaps with SPD thermal shield wings,
2300 // so the terminal part of the SSD cone was reduced
2301 //
2302 // Updated:      30 Mar 2010  Mario Sitta
2303 // Following M. van Leeuwen's suggestion on material budget, the thickness
2304 // of the carbon fiber cylinder was increased from 0.6 to 0.625mm
2305
2306   // Dimensions of the Central cylinder and flanges
2307   const Double_t kCylinderHalfLength   = (1143.6/2) *fgkmm;
2308   const Double_t kCylinderOuterRadius  = ( 595.0/2) *fgkmm;
2309   const Double_t kCylinderThickness    =       0.625*fgkmm;
2310   const Double_t kFoamHalfLength       = (1020.0/2) *fgkmm;
2311   const Double_t kFoamThickness        =        5.0 *fgkmm;
2312   const Double_t kFlangeHalfLength     =
2313                                       (kCylinderHalfLength-kFoamHalfLength)/2.;
2314   const Double_t kFlangeInnerRadius    = ( 563.0/2) *fgkmm;
2315   // Dimensions of the Cone
2316   const Double_t kConeROuterMin        = ( 957.0/2) *fgkmm;
2317   const Double_t kConeROuterMax        = ( 997.0/2) *fgkmm;
2318   const Double_t kConeRInnerMin        = ( 564.0/2) *fgkmm;
2319   const Double_t kConeRCurv1           =       10.0 *fgkmm;
2320   const Double_t kConeRCurv2           =       25.0 *fgkmm;
2321   const Double_t kConeCent1RCurv2      = ( 578.0/2) *fgkmm;
2322   const Double_t kConeCent2RCurv2      = ( 592.0/2) *fgkmm;
2323 //  const Double_t kConeZOuterRing       =       47.0 *fgkmm;
2324 //  const Double_t kConeZOuterRingInside =       30.25*fgkmm;
2325 //  const Double_t kConeZInnerRing       =      161.5 *fgkmm;
2326 //  const Double_t kConeZLength          =      176.5 *fgkmm;
2327   const Double_t kConeZOuterRing       =       38.5 *fgkmm;
2328   const Double_t kConeZOuterRingInside =       22.2 *fgkmm;
2329   const Double_t kConeZInnerRing       =      153.0 *fgkmm;
2330   const Double_t kConeZLength          =      168.0 *fgkmm;
2331   const Double_t kConeZPosition        = kConeZLength + kCylinderHalfLength;
2332   const Double_t kConeThickness        =       13.0 *fgkmm; // Cone thickness
2333   const Double_t kConeTheta            =       39.1 *fgkDegree; // Cone angle
2334   const Double_t kSinConeTheta         =
2335                                       TMath::Sin(kConeTheta*TMath::DegToRad());
2336   const Double_t kCosConeTheta         =
2337                                       TMath::Cos(kConeTheta*TMath::DegToRad());
2338   // Dimensions of the Foam cores
2339   const Double_t kConeFoam1Length      =      112.3 *fgkmm;
2340   const Double_t kConeFoam2Length      =       58.4 *fgkmm;
2341   // Dimensions of the Cone Holes
2342   const Double_t kCoolingHoleWidth     =       40.0 *fgkmm;
2343   const Double_t kCoolingHoleHight     =       30.0 *fgkmm;
2344   const Double_t kCoolingHoleRmin      =      350.0 *fgkmm;
2345   const Double_t kCoolingHolePhi       =       45.0 *fgkDegree;
2346   const Double_t kMountingHoleWidth    =       20.0 *fgkmm;
2347   const Double_t kMountingHoleHight    =       20.0 *fgkmm;
2348   const Double_t kMountingHoleRmin     =      317.5 *fgkmm;
2349   const Double_t kMountingHolePhi      =       60.0 *fgkDegree;
2350   const Double_t kCableHoleRin         = ( 800.0/2) *fgkmm;
2351   const Double_t kCableHoleRout        = ( 920.0/2) *fgkmm;
2352   const Double_t kCableHoleWidth       =      200.0 *fgkmm;
2353 //  const Double_t kCableHoleAngle       =       42.0 *fgkDegree;
2354   // Dimensions of the Cone Wings
2355   const Double_t kWingRmax             =      527.5 *fgkmm;
2356   const Double_t kWingWidth            =       70.0 *fgkmm;
2357   const Double_t kWingHalfThick        = (  10.0/2) *fgkmm;
2358   const Double_t kThetaWing            =       45.0 *fgkDegree;
2359   // Dimensions of the SSD-SDD Mounting Brackets
2360   const Double_t kBracketRmin          = ( 541.0/2) *fgkmm;// See SDD ROutMin
2361   const Double_t kBracketRmax          = ( 585.0/2) *fgkmm;
2362   const Double_t kBracketHalfLength    = (   4.0/2) *fgkmm;
2363   const Double_t kBracketPhi           = (70.*fgkmm/kBracketRmax)*fgkRadian;
2364   // Common data
2365   const Double_t kCFThickness          =        0.75*fgkmm; //Carb. fib. thick.
2366
2367
2368   // Local variables
2369   Double_t rmin1, rmin2, rmax, z;
2370
2371   //
2372   //Begin_Html
2373   /*
2374     <img src="picts/ITS/file_name.gif">
2375     <P>
2376     <FONT FACE'"TIMES">
2377     ITS SSD central support and thermal shield cylinder.
2378     </FONT>
2379     </P>
2380   */
2381   //End_Html
2382   //
2383
2384   // Central cylinder with its internal foam and the lateral flanges:
2385   // a carbon fiber Pcon which contains a rohacell Tube and two
2386   // stesalite Cone's
2387   TGeoPcon *externalcylshape = new TGeoPcon(0,360,4);
2388
2389   rmax  = kCylinderOuterRadius;
2390   rmin1 = kFlangeInnerRadius - kCylinderThickness;
2391   rmin2 = rmax - 2*kCylinderThickness - kFoamThickness;
2392   externalcylshape->DefineSection(0,-kCylinderHalfLength,rmin1,rmax);
2393   externalcylshape->DefineSection(1,-kFoamHalfLength    ,rmin2,rmax);
2394   externalcylshape->DefineSection(2, kFoamHalfLength    ,rmin2,rmax);
2395   externalcylshape->DefineSection(3, kCylinderHalfLength,rmin1,rmax);
2396
2397   rmax  = kCylinderOuterRadius - kCylinderThickness;
2398   rmin1 = rmax - kFoamThickness;
2399   TGeoTube *foamshape = new TGeoTube(rmin1,rmax,kFoamHalfLength);
2400
2401   rmax  = kCylinderOuterRadius - kCylinderThickness;
2402   rmin1 = rmax - kFoamThickness;
2403   rmin2 = kFlangeInnerRadius;
2404   TGeoCone *flangeshape = new TGeoCone(kFlangeHalfLength,
2405                                        rmin1,rmax,rmin2,rmax);
2406
2407
2408   // We have the shapes: now create the real volumes
2409
2410   TGeoMedium *medSSDcf  = mgr->GetMedium("ITS_SSD C (M55J)$");
2411   TGeoMedium *medSSDair = mgr->GetMedium("ITS_SSD AIR$");
2412   TGeoMedium *medSSDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
2413   TGeoMedium *medSSDroh = mgr->GetMedium("ITS_ROHACELL$");
2414   TGeoMedium *medSSDal  = mgr->GetMedium("ITS_ALUMINUM$");
2415
2416   TGeoVolume *cfcylinder = new TGeoVolume("SSDexternalcylinder",
2417                                            externalcylshape,medSSDcf);
2418   cfcylinder->SetVisibility(kTRUE);
2419   cfcylinder->SetLineColor(4); // blue
2420   cfcylinder->SetLineWidth(1);
2421   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
2422   cfcylinder->SetFillStyle(4000); // 0% transparent
2423
2424   TGeoVolume *foamcylinder = new TGeoVolume("SSDfoamcylinder",
2425                                             foamshape,medSSDroh);
2426   foamcylinder->SetVisibility(kTRUE);
2427   foamcylinder->SetLineColor(3); // green
2428   foamcylinder->SetLineWidth(1);
2429   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
2430   foamcylinder->SetFillStyle(4050); // 50% transparent
2431
2432   TGeoVolume *flangecylinder = new TGeoVolume("SSDflangecylinder",
2433                                               flangeshape,medSSDste);
2434   flangecylinder->SetVisibility(kTRUE);
2435   flangecylinder->SetLineColor(2); // red
2436   flangecylinder->SetLineWidth(1);
2437   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
2438   flangecylinder->SetFillStyle(4050); // 50% transparent
2439
2440   // Mount up the cylinder
2441   cfcylinder->AddNode(foamcylinder,1,0);
2442   cfcylinder->AddNode(flangecylinder,1,
2443               new TGeoTranslation(0, 0, kFoamHalfLength+kFlangeHalfLength));
2444   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
2445               0, 0, -kFoamHalfLength-kFlangeHalfLength,
2446               new TGeoRotation("",0,180,0)     ) );
2447
2448
2449   // The whole Cone as an assembly
2450   TGeoVolumeAssembly *vC = new TGeoVolumeAssembly("ITSssdCone");
2451
2452
2453   // SSD Support Cone with its internal inserts: a carbon fiber Pcon
2454   // with holes which contains a stesalite Pcon which on turn contains a
2455   // rohacell Pcon
2456   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 12);
2457
2458   coneshape->Z(0)     = 0.0;
2459   coneshape->Rmin(0)  = kConeROuterMin;
2460   coneshape->Rmax(0)  = kConeROuterMax;
2461
2462   coneshape->Z(1)     = kConeZOuterRingInside - kConeRCurv1;
2463   coneshape->Rmin(1)  = coneshape->GetRmin(0);
2464   coneshape->Rmax(1)  = coneshape->GetRmax(0);
2465
2466   coneshape->Z(2)     = kConeZOuterRingInside;
2467   coneshape->Rmin(2)  = coneshape->GetRmin(1) - kConeRCurv1;
2468   coneshape->Rmax(2)  = coneshape->GetRmax(0);
2469
2470   coneshape->Z(3)     = coneshape->GetZ(2);
2471   coneshape->Rmax(3)  = coneshape->GetRmax(0);
2472
2473   coneshape->Z(4)     = kConeZOuterRing - kConeRCurv1;
2474   coneshape->Rmax(4)  = coneshape->GetRmax(0);
2475
2476   coneshape->Z(5)     = kConeZOuterRing;
2477   coneshape->Rmax(5)  = coneshape->GetRmax(4) - kConeRCurv1;
2478
2479   coneshape->Z(6)     = coneshape->GetZ(5);
2480
2481   RadiusOfCurvature(kConeRCurv2,90.0,kConeZInnerRing,kConeCent1RCurv2,
2482                     90.0-kConeTheta,z,rmin1);
2483   coneshape->Z(7)     = z;
2484   coneshape->Rmin(7)  = rmin1;
2485
2486   coneshape->Rmin(3)  = RminFromZpCone(coneshape,7,90.-kConeTheta,
2487                                        coneshape->GetZ(3));
2488
2489   coneshape->Rmin(4)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(4));
2490
2491   coneshape->Rmin(5)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(5));
2492
2493   coneshape->Rmin(6) = coneshape->GetRmin(5);
2494
2495   coneshape->Z(8)     = kConeZInnerRing;
2496   coneshape->Rmin(8)  = kConeCent1RCurv2;
2497
2498   coneshape->Z(9)     = coneshape->GetZ(8);
2499   coneshape->Rmin(9)  = kConeRInnerMin;
2500
2501   RadiusOfCurvature(kConeRCurv2,90.0,kConeZLength,kConeCent2RCurv2,
2502                     90.0-kConeTheta,z,rmax);
2503
2504   coneshape->Z(10)    = z;
2505   coneshape->Rmin(10) = coneshape->GetRmin(9);
2506   coneshape->Rmax(10) = rmax;
2507
2508   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,10,90.-kConeTheta,
2509                                        coneshape->GetZ(6));
2510
2511   coneshape->Rmax(7)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(7));
2512
2513   coneshape->Rmax(8)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(8));
2514
2515   coneshape->Rmax(9)  = coneshape->GetRmax(8);
2516
2517   coneshape->Z(11)    = kConeZLength;
2518   coneshape->Rmin(11) = coneshape->GetRmin(10);
2519   coneshape->Rmax(11) = kConeCent2RCurv2;
2520
2521   // SSD Cone Insert: another Pcon
2522   Double_t x0, y0, x1, y1, x2, y2;
2523   TGeoPcon *coneinsertshape = new TGeoPcon(0.0,360.0,12);
2524
2525   coneinsertshape->Z(0)     = coneshape->GetZ(0) + kCFThickness;
2526   coneinsertshape->Rmin(0)  = coneshape->GetRmin(0) + kCFThickness;
2527   coneinsertshape->Rmax(0)  = coneshape->GetRmax(0) - kCFThickness;
2528
2529   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
2530   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
2531   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
2532   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2533   coneinsertshape->Z(1)     = z;
2534   coneinsertshape->Rmin(1)  = rmin1;
2535   coneinsertshape->Rmax(1)  = coneinsertshape->GetRmax(0);
2536
2537   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmin(1);
2538   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmin(2);
2539   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmin(3);
2540   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2541   coneinsertshape->Z(2)     = z;
2542   coneinsertshape->Rmin(2)  = rmin1;
2543   coneinsertshape->Rmax(2)  = coneinsertshape->GetRmax(1);
2544
2545   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
2546   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
2547   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
2548   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2549   coneinsertshape->Z(3)     = z;
2550   coneinsertshape->Rmin(3)  = rmin1;
2551   coneinsertshape->Rmax(3)  = coneinsertshape->GetRmax(2);
2552
2553   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
2554   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
2555   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
2556   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2557   coneinsertshape->Z(4)     = z;
2558   coneinsertshape->Rmax(4)  = rmax;
2559
2560   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmax(4);
2561   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmax(5);
2562   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmax(6);
2563   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2564   coneinsertshape->Z(5)     = z;
2565   coneinsertshape->Rmax(5)  = rmax;
2566
2567   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmax(5);
2568   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmax(6);
2569   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmax(7);
2570   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2571   coneinsertshape->Z(6)     = z;
2572   coneinsertshape->Rmax(6)  = rmax;
2573
2574   x0 = coneshape->GetZ(6); y0 = coneshape->GetRmin(6);
2575   x1 = coneshape->GetZ(7); y1 = coneshape->GetRmin(7);
2576   x2 = coneshape->GetZ(8); y2 = coneshape->GetRmin(8);
2577   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2578   coneinsertshape->Z(7)     = z;
2579   coneinsertshape->Rmin(7)  = rmin1;
2580
2581   coneinsertshape->Rmin(4)  = RminFrom2Points(coneinsertshape,3,7,
2582                                               coneinsertshape->GetZ(4));
2583
2584   coneinsertshape->Rmin(5)  = RminFrom2Points(coneinsertshape,3,7,
2585                                               coneinsertshape->GetZ(5));
2586
2587   coneinsertshape->Rmin(6)  = coneinsertshape->GetRmin(5);
2588
2589   x0 = coneshape->GetZ(7); y0 = coneshape->GetRmin(7);
2590   x1 = coneshape->GetZ(8); y1 = coneshape->GetRmin(8);
2591   x2 = coneshape->GetZ(9); y2 = coneshape->GetRmin(9);
2592   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2593   coneinsertshape->Z(8)     = z;
2594   coneinsertshape->Rmin(8)  = rmin1;
2595
2596   x0 = coneshape->GetZ( 8); y0 = coneshape->GetRmin( 8);
2597   x1 = coneshape->GetZ( 9); y1 = coneshape->GetRmin( 9);
2598   x2 = coneshape->GetZ(10); y2 = coneshape->GetRmin(10);
2599   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
2600   coneinsertshape->Z(9)     = z;
2601   coneinsertshape->Rmin(9)  = rmin1;
2602
2603   x0 = coneshape->GetZ( 9); y0 = coneshape->GetRmax( 9);
2604   x1 = coneshape->GetZ(10); y1 = coneshape->GetRmax(10);
2605   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmax(11);
2606   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2607   coneinsertshape->Z(10)    = z;
2608   coneinsertshape->Rmax(10) = rmax;
2609   coneinsertshape->Rmin(10) = coneinsertshape->GetRmin(9);
2610
2611   coneinsertshape->Rmax(7)  = RmaxFrom2Points(coneinsertshape,6,10,
2612                                               coneinsertshape->GetZ(7));
2613
2614   coneinsertshape->Rmax(8)  = RmaxFrom2Points(coneinsertshape,6,10,
2615                                               coneinsertshape->GetZ(8));
2616
2617   coneinsertshape->Rmax(9)  = coneinsertshape->GetRmax(8);
2618
2619   x0 = coneshape->GetZ(10); y0 = coneshape->GetRmax(10);
2620   x1 = coneshape->GetZ(11); y1 = coneshape->GetRmax(11);
2621   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmin(11);
2622   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
2623   coneinsertshape->Z(11)    = z;
2624   coneinsertshape->Rmax(11) = rmax;
2625   coneinsertshape->Rmin(11) = coneinsertshape->GetRmin(10);
2626
2627   // SSD Cone Foams: two other Pcon's
2628   TGeoPcon *conefoam1shape = new TGeoPcon(0.0, 360.0, 4);
2629
2630   conefoam1shape->Z(0)    = coneinsertshape->GetZ(3);
2631   conefoam1shape->Rmin(0) = coneinsertshape->GetRmin(3);
2632   conefoam1shape->Rmax(0) = conefoam1shape->GetRmin(0);
2633
2634   conefoam1shape->Rmax(1) = conefoam1shape->GetRmax(0);
2635   conefoam1shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2636                                            conefoam1shape->GetRmax(1));
2637   conefoam1shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2638                                            conefoam1shape->GetZ(1));
2639
2640   Double_t t = kConeThickness - 2*kCFThickness;
2641   conefoam1shape->Rmin(2) = conefoam1shape->GetRmax(0) -
2642                            (kConeFoam1Length*kCosConeTheta - t*kSinConeTheta);
2643   conefoam1shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2644                                            conefoam1shape->GetRmin(2));
2645   conefoam1shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2646                                            conefoam1shape->GetZ(2));
2647
2648   conefoam1shape->Rmin(3) = conefoam1shape->GetRmin(2);
2649   conefoam1shape->Rmax(3) = conefoam1shape->GetRmin(3);
2650   conefoam1shape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2651                                            conefoam1shape->GetRmax(3));
2652
2653   TGeoPcon *conefoam2shape = new TGeoPcon(0.0, 360.0, 4);
2654
2655   conefoam2shape->Z(3)    = coneinsertshape->GetZ(10);
2656   conefoam2shape->Rmin(3) = coneinsertshape->GetRmax(10);
2657   conefoam2shape->Rmax(3) = conefoam2shape->GetRmin(3);
2658
2659   conefoam2shape->Rmin(2) = conefoam2shape->GetRmin(3);
2660   conefoam2shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2661                                            conefoam2shape->GetRmin(2));
2662   conefoam2shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2663                                            conefoam2shape->GetZ(2));
2664
2665   conefoam2shape->Rmin(0) = conefoam2shape->GetRmax(2) +
2666                            (kConeFoam2Length*kCosConeTheta - t*kSinConeTheta);
2667   conefoam2shape->Rmax(0) = conefoam2shape->GetRmin(0);
2668   conefoam2shape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2669                                            conefoam2shape->GetRmin(0));
2670
2671   conefoam2shape->Rmax(1) = conefoam2shape->GetRmax(0);
2672   conefoam2shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2673                                            conefoam2shape->GetRmax(1));
2674   conefoam2shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2675                                            conefoam2shape->GetZ(1));
2676
2677   // SSD Cone Holes: Pcon's
2678   // A single hole volume gives an overlap with coneinsert, so
2679   // three contiguous volumes are created: one to be put in coneinsert
2680   // and two in the cone carbon fiber envelope
2681   Double_t holePhi;
2682   holePhi = (kCoolingHoleWidth/kCoolingHoleRmin)*TMath::RadToDeg();
2683
2684   TGeoPcon *coolingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
2685
2686   coolingholeshape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
2687   coolingholeshape->Rmax(0) = coolingholeshape->GetRmin(0);
2688   coolingholeshape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2689                                              coolingholeshape->GetRmin(0));
2690
2691   coolingholeshape->Rmax(1) = coolingholeshape->GetRmax(0);
2692   coolingholeshape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2693                                              coolingholeshape->GetRmax(1));
2694   coolingholeshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2695                                              coolingholeshape->GetZ(1));
2696
2697   coolingholeshape->Rmin(2) = kCoolingHoleRmin;
2698   coolingholeshape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2699                                              coolingholeshape->GetRmin(2));
2700   coolingholeshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2701                                              coolingholeshape->GetZ(2));
2702
2703   coolingholeshape->Rmin(3) = coolingholeshape->GetRmin(2);
2704   coolingholeshape->Rmax(3) = coolingholeshape->GetRmin(3);
2705   coolingholeshape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2706                                              coolingholeshape->GetRmax(3));
2707
2708   TGeoPcon *coolinghole2shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2709
2710   coolinghole2shape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
2711   coolinghole2shape->Rmax(0) = coolinghole2shape->GetRmin(0);
2712   coolinghole2shape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2713                                               coolinghole2shape->GetRmin(0));
2714
2715   coolinghole2shape->Rmax(1) = coolinghole2shape->GetRmax(0);
2716   coolinghole2shape->Z(1)    = coolingholeshape->GetZ(0);
2717   coolinghole2shape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
2718                                               coolinghole2shape->GetZ(1));
2719
2720   coolinghole2shape->Rmin(2) = kCoolingHoleRmin;
2721   coolinghole2shape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2722                                               coolinghole2shape->GetRmin(2));
2723   coolinghole2shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2724                                               coolinghole2shape->GetZ(2));
2725
2726   coolinghole2shape->Rmin(3) = coolinghole2shape->GetRmin(2);
2727   coolinghole2shape->Rmax(3) = coolinghole2shape->GetRmin(3);
2728   coolinghole2shape->Z(3)    = coolingholeshape->GetZ(2);
2729
2730   TGeoPcon *coolinghole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2731
2732   coolinghole3shape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
2733   coolinghole3shape->Rmax(0) = coolinghole3shape->GetRmin(0);
2734   coolinghole3shape->Z(0)    = coolingholeshape->GetZ(1);
2735
2736   coolinghole3shape->Rmax(1) = coolinghole3shape->GetRmax(0);
2737   coolinghole3shape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2738                                               coolinghole3shape->GetRmax(1));
2739   coolinghole3shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2740                                               coolinghole3shape->GetZ(1));
2741
2742   coolinghole3shape->Rmin(2) = kCoolingHoleRmin;
2743   coolinghole3shape->Z(2)    = coolingholeshape->GetZ(3);
2744   coolinghole3shape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
2745                                               coolinghole3shape->GetZ(2));
2746
2747   coolinghole3shape->Rmin(3) = coolinghole3shape->GetRmin(2);
2748   coolinghole3shape->Rmax(3) = coolinghole3shape->GetRmin(3);
2749   coolinghole3shape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2750                                               coolinghole3shape->GetRmax(3));
2751
2752   //
2753   holePhi = (kMountingHoleWidth/kMountingHoleRmin)*TMath::RadToDeg();
2754
2755   TGeoPcon *mountingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
2756
2757   mountingholeshape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
2758   mountingholeshape->Rmax(0) = mountingholeshape->GetRmin(0);
2759   mountingholeshape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2760                                               mountingholeshape->GetRmin(0));
2761
2762   mountingholeshape->Rmin(1) = kMountingHoleRmin;
2763   mountingholeshape->Rmax(1) = mountingholeshape->GetRmax(0);
2764   mountingholeshape->Z(1)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
2765                                               mountingholeshape->GetRmin(1));
2766
2767   mountingholeshape->Rmin(2) = mountingholeshape->GetRmin(1);
2768   mountingholeshape->Rmax(2) = mountingholeshape->GetRmax(1);
2769   mountingholeshape->Z(2)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2770                                               mountingholeshape->GetRmax(2));
2771
2772   mountingholeshape->Rmin(3) = mountingholeshape->GetRmin(2);
2773   mountingholeshape->Rmax(3) = mountingholeshape->GetRmin(3);
2774   mountingholeshape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
2775                                               mountingholeshape->GetRmax(3));
2776
2777   TGeoPcon *mountinghole2shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2778
2779   mountinghole2shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
2780   mountinghole2shape->Rmax(0) = mountingholeshape->GetRmin(0);
2781   mountinghole2shape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2782                                                mountinghole2shape->GetRmin(0));
2783
2784   mountinghole2shape->Rmax(1) = mountinghole2shape->GetRmax(0);
2785   mountinghole2shape->Z(1)    = mountingholeshape->Z(0);
2786   mountinghole2shape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
2787                                                mountinghole2shape->GetZ(1));
2788
2789   mountinghole2shape->Rmin(2) = kMountingHoleRmin;
2790   mountinghole2shape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
2791                                                mountinghole2shape->GetRmin(2));
2792   mountinghole2shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
2793                                                mountinghole2shape->GetZ(2));
2794
2795   mountinghole2shape->Rmin(3) = mountinghole2shape->Rmin(2);
2796   mountinghole2shape->Rmax(3) = mountinghole2shape->Rmin(3);
2797   mountinghole2shape->Z(3)    = mountingholeshape->Z(1);
2798
2799   TGeoPcon *mountinghole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
2800
2801   mountinghole3shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
2802   mountinghole3shape->Rmax(0) = mountingholeshape->GetRmin(0);
2803   mountinghole3shape->Z(0)    = mountingholeshape->GetZ(2);
2804
2805   mountinghole3shape->Rmax(1) = mountinghole3shape->GetRmax(0);
2806   mountinghole3shape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2807                                                mountinghole3shape->GetRmax(1));
2808   mountinghole3shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
2809                                                mountinghole3shape->GetZ(1));
2810
2811   mountinghole3shape->Rmin(2) = kMountingHoleRmin;
2812   mountinghole3shape->Z(2)    = mountingholeshape->Z(3);
2813   mountinghole3shape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
2814                                                mountinghole3shape->GetZ(2));
2815
2816   mountinghole3shape->Rmin(3) = mountinghole3shape->Rmin(2);
2817   mountinghole3shape->Rmax(3) = mountinghole3shape->Rmin(3);
2818   mountinghole3shape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
2819                                                mountinghole3shape->GetRmax(3));
2820
2821   // The Cable Hole is even more complicated, a Composite Shape
2822   // is unavoidable here (gosh!)
2823   TGeoPcon *coneshapecopy = new TGeoPcon("conecopy",0.0, 360.0, 12);
2824
2825   for (Int_t i=0; i<12; i++) {
2826     coneshapecopy->Rmin(i) = coneshape->GetRmin(i);
2827     coneshapecopy->Rmax(i) = coneshape->GetRmax(i);
2828     coneshapecopy->Z(i)    = coneshape->GetZ(i);
2829   }
2830
2831   holePhi = (kCableHoleWidth/kCableHoleRout)*TMath::RadToDeg();
2832   TGeoConeSeg *chCS = new TGeoConeSeg("chCS", 0.5*kConeZLength,
2833                                       kCableHoleRin, kCableHoleRout,
2834                                       kCableHoleRin, kCableHoleRout,
2835                                       -0.5*holePhi, 0.5*holePhi);
2836
2837   TGeoCompositeShape *cableholeshape = new TGeoCompositeShape(
2838                                            "SSDCableHoleShape",
2839                                            "conecopy*chCS");
2840
2841   if(GetDebug(1)){
2842     chCS->InspectShape();
2843     cableholeshape->InspectShape();
2844   }
2845
2846   // SSD Cone Wings: Tube and TubeSeg shapes
2847   Double_t angleWideWing, angleWideWingThickness;
2848   angleWideWing = (kWingWidth/kWingRmax)*TMath::RadToDeg();
2849   angleWideWingThickness = (kCFThickness/kWingRmax)*TMath::RadToDeg();
2850
2851   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kConeROuterMax, kWingRmax,
2852                                            kWingHalfThick,
2853                                            0, angleWideWing);
2854
2855   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kConeROuterMax,
2856                                  kWingRmax-kCFThickness,
2857                                  kWingHalfThick-kCFThickness,
2858                                  angleWideWingThickness,
2859                                  angleWideWing-angleWideWingThickness);
2860
2861   // SDD support plate, SSD side (Mounting Bracket): a TubeSeg
2862   TGeoTubeSeg *bracketshape = new TGeoTubeSeg(kBracketRmin, kBracketRmax,
2863                             kBracketHalfLength, -kBracketPhi/2, kBracketPhi/2);
2864
2865
2866   // We have the shapes: now create the real volumes
2867
2868   TGeoVolume *cfcone = new TGeoVolume("SSDCarbonFiberCone",
2869                                       coneshape,medSSDcf);
2870   cfcone->SetVisibility(kTRUE);
2871   cfcone->SetLineColor(4); // Blue
2872   cfcone->SetLineWidth(1);
2873   cfcone->SetFillColor(cfcone->GetLineColor());
2874   cfcone->SetFillStyle(4000); // 0% transparent
2875
2876   TGeoVolume *cfconeinsert = new TGeoVolume("SSDCarbonFiberConeInsert",
2877                                             coneinsertshape,medSSDste);
2878   cfconeinsert->SetVisibility(kTRUE);
2879   cfconeinsert->SetLineColor(2); // Red
2880   cfconeinsert->SetLineWidth(1);
2881   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
2882   cfconeinsert->SetFillStyle(4050); // 50% transparent
2883
2884   TGeoVolume *cfconefoam1 = new TGeoVolume("SSDCarbonFiberConeFoam1",
2885                                             conefoam1shape,medSSDroh);
2886   cfconefoam1->SetVisibility(kTRUE);
2887   cfconefoam1->SetLineColor(3); // Green
2888   cfconefoam1->SetLineWidth(1);
2889   cfconefoam1->SetFillColor(cfconefoam1->GetLineColor());
2890   cfconefoam1->SetFillStyle(4050); // 50% transparent
2891
2892   TGeoVolume *cfconefoam2 = new TGeoVolume("SSDCarbonFiberConeFoam2",
2893                                             conefoam2shape,medSSDroh);
2894   cfconefoam2->SetVisibility(kTRUE);
2895   cfconefoam2->SetLineColor(3); // Green
2896   cfconefoam2->SetLineWidth(1);
2897   cfconefoam2->SetFillColor(cfconefoam2->GetLineColor());
2898   cfconefoam2->SetFillStyle(4050); // 50% transparent
2899
2900   TGeoVolume *coolinghole = new TGeoVolume("SSDCoolingHole",
2901                                            coolingholeshape,medSSDair);
2902   coolinghole->SetVisibility(kTRUE);
2903   coolinghole->SetLineColor(5); // Yellow
2904   coolinghole->SetLineWidth(1);
2905   coolinghole->SetFillColor(coolinghole->GetLineColor());
2906   coolinghole->SetFillStyle(4090); // 90% transparent
2907
2908   TGeoVolume *coolinghole2 = new TGeoVolume("SSDCoolingHole2",
2909                                             coolinghole2shape,medSSDair);
2910   coolinghole2->SetVisibility(kTRUE);
2911   coolinghole2->SetLineColor(5); // Yellow
2912   coolinghole2->SetLineWidth(1);
2913   coolinghole2->SetFillColor(coolinghole2->GetLineColor());
2914   coolinghole2->SetFillStyle(4090); // 90% transparent
2915
2916   TGeoVolume *coolinghole3 = new TGeoVolume("SSDCoolingHole3",
2917                                             coolinghole3shape,medSSDair);
2918   coolinghole3->SetVisibility(kTRUE);
2919   coolinghole3->SetLineColor(5); // Yellow
2920   coolinghole3->SetLineWidth(1);
2921   coolinghole3->SetFillColor(coolinghole3->GetLineColor());
2922   coolinghole3->SetFillStyle(4090); // 90% transparent
2923
2924   TGeoVolume *mountinghole = new TGeoVolume("SSDMountingHole",
2925                                             mountingholeshape,medSSDair);
2926   mountinghole->SetVisibility(kTRUE);
2927   mountinghole->SetLineColor(5); // Yellow
2928   mountinghole->SetLineWidth(1);
2929   mountinghole->SetFillColor(mountinghole->GetLineColor());
2930   mountinghole->SetFillStyle(4090); // 90% transparent
2931
2932   TGeoVolume *mountinghole2 = new TGeoVolume("SSDMountingHole2",
2933                                              mountinghole2shape,medSSDair);
2934   mountinghole2->SetVisibility(kTRUE);
2935   mountinghole2->SetLineColor(5); // Yellow
2936   mountinghole2->SetLineWidth(1);
2937   mountinghole2->SetFillColor(mountinghole2->GetLineColor());
2938   mountinghole2->SetFillStyle(4090); // 90% transparent
2939
2940   TGeoVolume *mountinghole3 = new TGeoVolume("SSDMountingHole3",
2941                                              mountinghole3shape,medSSDair);
2942   mountinghole3->SetVisibility(kTRUE);
2943   mountinghole3->SetLineColor(5); // Yellow
2944   mountinghole3->SetLineWidth(1);
2945   mountinghole3->SetFillColor(mountinghole3->GetLineColor());
2946   mountinghole3->SetFillStyle(4090); // 90% transparent
2947
2948   TGeoVolume *wing = new TGeoVolume("SSDWing",wingshape,medSSDcf);
2949   wing->SetVisibility(kTRUE);
2950   wing->SetLineColor(4); // Blue
2951   wing->SetLineWidth(1);
2952   wing->SetFillColor(wing->GetLineColor());
2953   wing->SetFillStyle(4000); // 0% transparent
2954
2955   TGeoVolume *cablehole = new TGeoVolume("SSDCableHole",
2956                                          cableholeshape,medSSDair);
2957   cablehole->SetVisibility(kTRUE);
2958   cablehole->SetLineColor(5); // Yellow
2959   cablehole->SetLineWidth(1);
2960   cablehole->SetFillColor(cablehole->GetLineColor());
2961   cablehole->SetFillStyle(4090); // 90% transparent
2962
2963   TGeoVolume *winginsert = new TGeoVolume("SSDWingInsert",
2964                                           winginsertshape,medSSDste);
2965   winginsert->SetVisibility(kTRUE);
2966   winginsert->SetLineColor(2); // Red
2967   winginsert->SetLineWidth(1);
2968   winginsert->SetFillColor(winginsert->GetLineColor());
2969   winginsert->SetFillStyle(4050); // 50% transparent
2970
2971   TGeoVolume *bracket = new TGeoVolume("SSDMountingBracket",
2972                                        bracketshape,medSSDal);
2973   bracket->SetVisibility(kTRUE);
2974   bracket->SetLineColor(6); // Purple
2975   bracket->SetLineWidth(1);
2976   bracket->SetFillColor(bracket->GetLineColor());
2977   bracket->SetFillStyle(4000); // 0% transparent
2978
2979   // Mount up a cone
2980   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
2981     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
2982     cfconefoam2->AddNode(mountinghole,i+1, new TGeoRotation("", phiH, 0, 0));
2983   }
2984
2985   for (Int_t i=0; i<(Int_t)(360./kCoolingHolePhi); i++) {
2986     Double_t phiH = i*kCoolingHolePhi + 0.5*kCoolingHolePhi;
2987     cfconeinsert->AddNodeOverlap(coolinghole,i+1, new TGeoRotation("", phiH, 0, 0));
2988   }
2989
2990   cfconeinsert->AddNode(cfconefoam1,1,0);
2991   cfconeinsert->AddNode(cfconefoam2,1,0);
2992
2993   cfcone->AddNode(cfconeinsert,1,0);
2994
2995   for (Int_t i=0; i<(Int_t)(360./kCoolingHolePhi); i++) {
2996     Double_t phiH = i*kCoolingHolePhi + 0.5*kCoolingHolePhi;
2997     cfcone->AddNode(coolinghole2,i+1, new TGeoRotation("", phiH, 0, 0));
2998     cfcone->AddNode(coolinghole3,i+1, new TGeoRotation("", phiH, 0, 0));
2999     cfcone->AddNodeOverlap(cablehole,i+1, new TGeoRotation("", phiH, 0, 0));
3000   }
3001
3002   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
3003     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
3004     cfcone->AddNode(mountinghole2,i+1, new TGeoRotation("", phiH, 0, 0));
3005     cfcone->AddNode(mountinghole3,i+1, new TGeoRotation("", phiH, 0, 0));
3006   }
3007
3008   wing->AddNode(winginsert,1,0);
3009
3010   // Add all volumes in the Cone assembly
3011   vC->AddNode(cfcone,1,new TGeoTranslation(0,0,-kConeZPosition));
3012
3013   for (Int_t i=0; i<4; i++) {
3014     Double_t thetaW = kThetaWing + 90.*i + angleWideWing/2.;
3015     vC->AddNode(wing, i+1, new TGeoCombiTrans(0, 0, -kConeZPosition+kWingHalfThick,
3016                            new TGeoRotation("",thetaW,180,0)));
3017   }
3018
3019   Double_t zBracket = kConeZPosition - coneshape->GetZ(9) +
3020                       2*bracketshape->GetDz();
3021   for (Int_t i=0; i<3; i++) {
3022     Double_t thetaB = 60 + 120.*i;
3023     vC->AddNode(bracket, i+1, new TGeoCombiTrans(0, 0, -zBracket,
3024                               new TGeoRotation("",thetaB,0,0)));
3025   }
3026
3027   // Finally put everything in the mother volume
3028   moth->AddNode(cfcylinder,1,0);
3029
3030   moth->AddNode(vC, 1, 0 );
3031   moth->AddNode(vC, 2, new TGeoRotation("",180, 180, 0) );
3032
3033   // Some debugging if requested
3034   if(GetDebug(1)){
3035     vC->PrintNodes();
3036     vC->InspectShape();
3037   }
3038
3039   return;
3040 }
3041
3042 //______________________________________________________________________
3043 void AliITSv11GeometrySupport::ServicesCableSupport(TGeoVolume *moth,
3044                                                     TGeoManager *mgr){
3045 //
3046 // Creates the cable trays which are outside the ITS support cones
3047 // but still inside the TPC
3048 // This is now a stearing routine, the actual work is done by three
3049 // specialized methods to avoid a really huge unique method
3050 //
3051 // Input:
3052 //         moth : the TGeoVolume owing the volume structure
3053 //         mgr  : the GeoManager (default gGeoManager)
3054 // Output:
3055 //
3056 // Created:      15 Nov 2009  Mario Sitta
3057 //
3058
3059   TraySupportsSideA(moth, mgr);
3060
3061   ServicesCableSupportSPD(moth, mgr);
3062   ServicesCableSupportSDD(moth, mgr);
3063   ServicesCableSupportSSD(moth, mgr);
3064
3065   return;
3066 }
3067
3068 //______________________________________________________________________
3069 void AliITSv11GeometrySupport::TraySupportsSideA(TGeoVolume *moth,
3070                                            const TGeoManager *mgr){
3071 //
3072 // Creates the structure supporting the ITS cable trays on Side A
3073 //
3074 // Input:
3075 //         moth : the TGeoVolume owing the volume structure
3076 //         mgr  : the GeoManager (default gGeoManager)
3077 // Output:
3078 //
3079 // Created:      14 Dec 2009  Mario Sitta
3080 // Updated:      26 Feb 2010  Mario Sitta
3081 //
3082 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
3083 // drawings and other (oral) information given by F.Tosello
3084 //
3085
3086   // Dimensions and positions of the A-Side Cable Tray Support Ring
3087   // (0872/G/A/01)
3088   const Double_t kSuppRingYTrans      =  110.00 *fgkmm;
3089   const Double_t kSuppRingZTrans      =(1011.00+435.00) *fgkmm;
3090   const Double_t kSuppForwYTrans      =  185.00 *fgkmm;
3091
3092   const Double_t kExtSuppRingSpace1   =   33.00 *fgkmm;
3093   const Double_t kExtSuppRingSpace2   =   45.00 *fgkmm;
3094   const Double_t kExtSuppRingSpcAbov  =   30.00 *fgkmm;
3095   const Double_t kExtSuppRingBase     =  491.50 *fgkmm;
3096   const Double_t kExtSuppRingInward   =   35.00 *fgkmm;
3097   const Double_t kExtSuppRingRmax     =  540.00 *fgkmm;
3098   const Double_t kExtSuppRingRint1    =  465.00 *fgkmm;
3099   const Double_t kExtSuppRingRint2    =  467.00 *fgkmm;
3100   const Double_t kExtSuppRingInnerHi  =  450.00 *fgkmm;
3101   const Double_t kExtSuppRingInWide   =  100.00 *fgkmm;
3102   const Double_t kExtSuppRingR7       =    7.00 *fgkmm;
3103   const Double_t kExtSuppRingR5       =    5.00 *fgkmm;
3104   const Double_t kExtSuppRingThick    =   20.00 *fgkmm;
3105
3106   const Double_t kExtSuppRingSpcAng   =   10.50 *TMath::DegToRad();
3107   const Double_t kExtSuppRingPartPhi  =   15.00 *TMath::DegToRad();
3108   const Double_t kExtSuppRingIntAng   =    7.00 *TMath::DegToRad();
3109   const Double_t kExtSuppRingBaseAng  =   75.00 *TMath::DegToRad();
3110   const Double_t kExtSuppRingR7Ang    =  100.00 *TMath::DegToRad(); // Guessed
3111
3112   const Int_t    kExtSuppRingNPtsArc  =   10; // N.points to approximate arc
3113
3114   const Double_t kIntSuppRingThick1   =   15.00 *fgkmm;
3115   const Double_t kIntSuppRingThick2   =   13.00 *fgkmm;
3116   const Double_t kIntSuppRingInward   =   24.00 *fgkmm;
3117   const Double_t kIntSuppRingThick    =   20.00 *fgkmm;
3118
3119   const Double_t kSuppCylHeight       =  340.00 *fgkmm;
3120   const Double_t kSuppCylRint         =  475.00 *fgkmm;
3121   const Double_t kSuppCylRext         =  478.00 *fgkmm;
3122   const Double_t kSuppCylDispl        =  137.70 *fgkmm;
3123
3124   const Double_t kSuppSpacerHeight    =   30.00 *fgkmm;
3125   const Double_t kSuppSpacerThick     =   10.00 *fgkmm;
3126
3127   const Double_t kSuppSpacerAngle     =   15.00;  // Degrees
3128
3129   const Double_t kSuppForwRingRint1   =  500.00 *fgkmm;
3130   const Double_t kSuppForwRingRint2   =  540.00 *fgkmm;
3131   const Double_t kSuppForwRingRext    =  560.00 *fgkmm;
3132   const Double_t kSuppForwRingThikAll =   50.00 *fgkmm;
3133   const Double_t kSuppForwRingThikInt =   20.00 *fgkmm;
3134
3135   // (0872/G/B/01)
3136   const Double_t kSuppForwConeRmin    =  558.00 *fgkmm;
3137   const Double_t kSuppForwConeRmax    =  681.00 *fgkmm;
3138   const Double_t kSuppForwConeLen1    =  318.00 *fgkmm;
3139   const Double_t kSuppForwConeLen2    =  662.00 *fgkmm;
3140   const Double_t kSuppForwConeThick   =    3.00 *fgkmm;
3141
3142   const Double_t kSuppBackRingPlacTop =   90.00 *fgkmm;
3143   const Double_t kSuppBackRingPlacSid =   50.00 *fgkmm;
3144   const Double_t kSuppBackRingHeight  =  760.00 *fgkmm;
3145   const Double_t kSuppBackRingRext    =  760.00 *fgkmm;
3146   const Double_t kSuppBackRingRint    =  685.00 *fgkmm;
3147 //  const Double_t kSuppBackRingRint2   =  675.00 *fgkmm;
3148   const Double_t kSuppBackRingR10     =   10.00 *fgkmm;
3149   const Double_t kSuppBackRingBase    =  739.00 *fgkmm;
3150   const Double_t kSuppBackRingThikAll =   50.00 *fgkmm;
3151   const Double_t kSuppBackRingThick1  =   20.00 *fgkmm;
3152   const Double_t kSuppBackRingThick2  =   20.00 *fgkmm;
3153
3154 //  const Double_t kSuppBackRingPlacAng =   10.00 *TMath::DegToRad();
3155   const Double_t kSuppBackRingPlacAng =   10.25 *TMath::DegToRad();//Fix ovlp.
3156   const Double_t kSuppBackRing2ndAng1 =   78.40 *TMath::DegToRad();
3157   const Double_t kSuppBackRing2ndAng2 =   45.00 *TMath::DegToRad();
3158
3159   const Int_t    kSuppBackRingNPtsArc =   10; // N.points to approximate arc
3160
3161   // (0872/G/C/01)
3162   const Double_t kRearSuppZTransGlob  =(1011.00+9315.00-6040.00) *fgkmm;
3163   const Double_t kBackRodZTrans       = 2420.00 *fgkmm;
3164
3165   const Double_t kBackRodLength       = 1160.00 *fgkmm;
3166   const Double_t kBackRodThickLen     =   20.00 *fgkmm;
3167   const Double_t kBackRodDiameter     =   20.00 *fgkmm;
3168
3169   const Double_t kSuppRearRingRint    =  360.00 *fgkmm;
3170   const Double_t kSuppRearRingRext1   =  410.00 *fgkmm;
3171   const Double_t kSuppRearRingRext2   =  414.00 *fgkmm;
3172   const Double_t kSuppRearRingHeight  =  397.00 *fgkmm;
3173   const Double_t kSuppRearRingTopWide =  111.87 *fgkmm;
3174   const Double_t kSuppRearRingBase    =  451.50 *fgkmm;
3175   const Double_t kSuppRearRingBaseHi  =   58.00 *fgkmm;
3176   const Double_t kSuppRearRingSideHi  =   52.00 *fgkmm;
3177   const Double_t kSuppRearRingInside  =   40.00 *fgkmm;
3178   const Double_t kSuppRearRingInsideHi=   12.00 *fgkmm;
3179   const Double_t kSuppRearRingThick   =   20.00 *fgkmm;
3180   const Double_t kSuppRearRingXRodHole=  441.50 *fgkmm;
3181   const Double_t kSuppRearRingYRodHole=   42.00 *fgkmm;
3182
3183   const Double_t kSuppRearRing1stAng  =   22.00 *TMath::DegToRad();
3184   const Double_t kSuppRearRingStepAng =   15.00 *TMath::DegToRad();
3185
3186   const Int_t    kSuppRearRingNPtsArc =   10; // N.points to approximate arc
3187
3188
3189   // Local variables
3190   Double_t xprof[2*(15+kExtSuppRingNPtsArc)],yprof[2*(15+kExtSuppRingNPtsArc)];
3191   Double_t slp1, slp2, phi, xm, ym;
3192   Double_t xloc, yloc, zloc, rmin, rmax, deltaR;
3193   Int_t npoints;
3194
3195
3196   // The whole support as an assembly
3197   TGeoVolumeAssembly *trayASuppStruct = new TGeoVolumeAssembly("ITSsuppSideAStructure");
3198   
3199
3200   // First create all needed shapes
3201
3202   // The External Ring (part of 0872/G/A/01): a really complex Xtru
3203   TGeoXtru *extSuppRing = new TGeoXtru(2);
3204
3205   // First the upper notch...
3206   xprof[ 0] = kExtSuppRingSpace1;
3207   yprof[ 0] = kExtSuppRingInnerHi + kExtSuppRingSpcAbov;
3208
3209   slp1 = TMath::Tan(TMath::Pi()/2 - kExtSuppRingSpcAng);
3210   IntersectCircle(slp1, xprof[0], yprof[0], kExtSuppRingRmax, 0., 0.,
3211                   xprof[5], yprof[5], xm, ym); // Ignore dummy xm,ym
3212
3213   xprof[ 4] = xprof[5];
3214   yprof[ 4] = yprof[5] - kExtSuppRingR5/TMath::Tan(kExtSuppRingSpcAng);
3215   xprof[ 3] = xprof[4] - kExtSuppRingR5*(1 - TMath::Cos(TMath::Pi()/6));
3216   yprof[ 3] = yprof[4] - kExtSuppRingR5*(    TMath::Sin(TMath::Pi()/6));
3217   xprof[ 2] = xprof[4] - kExtSuppRingR5*(1 - TMath::Cos(TMath::Pi()/3));
3218   yprof[ 2] = yprof[4] - kExtSuppRingR5*(    TMath::Sin(TMath::Pi()/3));
3219   xprof[ 1] = xprof[4] - kExtSuppRingR5;
3220   yprof[ 1] = yprof[4] - kExtSuppRingR5;
3221
3222   Int_t indx = 5+kExtSuppRingNPtsArc;
3223   // ...then the external arc, approximated with segments,...
3224   xprof[indx] = kExtSuppRingBase;
3225   yprof[indx] = TMath::Sqrt(kExtSuppRingRmax*kExtSuppRingRmax -
3226                             kExtSuppRingBase*kExtSuppRingBase);
3227   Double_t alphamin = TMath::ASin(kExtSuppRingSpace2/kExtSuppRingRmax);
3228   Double_t alphamax = TMath::Pi()/2 -
3229                     TMath::ASin(yprof[5+kExtSuppRingNPtsArc]/kExtSuppRingRmax);
3230
3231   for (Int_t jp = 1; jp < kExtSuppRingNPtsArc; jp++) {
3232     Double_t alpha = jp*(alphamax-alphamin)/kExtSuppRingNPtsArc;
3233     xprof[5+jp] = kExtSuppRingRmax*TMath::Sin(alpha);
3234     yprof[5+jp] = kExtSuppRingRmax*TMath::Cos(alpha);
3235   }
3236   // ...and finally the interior profile
3237   xprof[indx+1] = kExtSuppRingBase;
3238   yprof[indx+1] = kSuppRingYTrans;
3239   xprof[indx+2] = xprof[indx+1] - kExtSuppRingInward;
3240   yprof[indx+2] = yprof[indx+1];
3241
3242   phi  = TMath::Pi()/2 - 4*kExtSuppRingPartPhi - kExtSuppRingIntAng;
3243   slp1 = TMath::Tan(TMath::Pi() - kExtSuppRingBaseAng);
3244   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3245   xm   = kExtSuppRingRint2*TMath::Cos(phi);
3246   ym   = kExtSuppRingRint2*TMath::Sin(phi);
3247   IntersectLines(slp1, xprof[indx+2], yprof[indx+2], slp2, xm, ym,
3248                  xprof[indx+3], yprof[indx+3]);
3249
3250   slp1 = slp2;
3251   phi += kExtSuppRingPartPhi;
3252   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3253   xm   = kExtSuppRingRint1*TMath::Cos(phi);
3254   ym   = kExtSuppRingRint1*TMath::Sin(phi);
3255   IntersectLines(slp1, xprof[indx+3], yprof[indx+3], slp2, xm, ym,
3256                  xprof[indx+4], yprof[indx+4]);
3257   
3258   slp1 = slp2;
3259   phi += kExtSuppRingPartPhi;
3260   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3261   xm   = kExtSuppRingRint2*TMath::Cos(phi);
3262   ym   = kExtSuppRingRint2*TMath::Sin(phi);
3263   IntersectLines(slp1, xprof[indx+4], yprof[indx+4], slp2, xm, ym,
3264                  xprof[indx+5], yprof[indx+5]);
3265   
3266   slp1 = slp2;
3267   phi += kExtSuppRingPartPhi;
3268   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3269   xm   = kExtSuppRingRint1*TMath::Cos(phi);
3270   ym   = kExtSuppRingRint1*TMath::Sin(phi);
3271   IntersectLines(slp1, xprof[indx+5], yprof[indx+5], slp2, xm, ym,
3272                  xprof[indx+6], yprof[indx+6]);
3273   
3274   xprof[indx+9] = kExtSuppRingInWide;
3275   yprof[indx+9] = kExtSuppRingInnerHi;
3276   xprof[indx+8] = xprof[indx+9] +
3277                   (1 - TMath::Cos(kExtSuppRingR7Ang/2))*kExtSuppRingR7;
3278   yprof[indx+8] = yprof[indx+9] +
3279                   (    TMath::Sin(kExtSuppRingR7Ang/2))*kExtSuppRingR7;
3280   xprof[indx+7] = xprof[indx+9] +
3281                   (1 + TMath::Cos(kExtSuppRingR7Ang  ))*kExtSuppRingR7;
3282   yprof[indx+7] = yprof[indx+9] +
3283                   (    TMath::Sin(kExtSuppRingR7Ang  ))*kExtSuppRingR7;
3284   // Gosh, we did the right side! now reflex on the left side
3285   npoints = (sizeof(xprof)/sizeof(Double_t))/2;
3286   for (Int_t jp = 0; jp < npoints; jp++) {
3287     xprof[npoints+jp] = -xprof[npoints-1-jp];
3288     yprof[npoints+jp] =  yprof[npoints-1-jp];
3289   }
3290   // wow! now the actual Xtru
3291   extSuppRing->DefinePolygon(2*npoints, xprof, yprof);
3292   extSuppRing->DefineSection(0,0);
3293   extSuppRing->DefineSection(1,kExtSuppRingThick);
3294
3295   // The Internal Ring (part of 0872/G/A/01): another complex Xtru
3296   TGeoXtru *intSuppRing = new TGeoXtru(2);
3297
3298   // First the external profile...
3299   npoints = 0;
3300
3301   slp1 = 0;
3302   phi  = TMath::Pi()/2 - kExtSuppRingPartPhi - kExtSuppRingIntAng;
3303   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3304   xm   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Cos(phi);
3305   ym   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Sin(phi);
3306   IntersectLines(slp1,  0, kExtSuppRingInnerHi+kExtSuppRingSpcAbov,
3307                  slp2, xm, ym,
3308                  xprof[npoints], yprof[npoints]);
3309   npoints++;
3310
3311   slp1 = slp2;
3312   phi -= kExtSuppRingPartPhi;
3313   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3314   xm   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Cos(phi);
3315   ym   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Sin(phi);
3316   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3317                  slp2, xm, ym,
3318                  xprof[npoints], yprof[npoints]);
3319   npoints++;
3320
3321   slp1 = slp2;
3322   phi -= kExtSuppRingPartPhi;
3323   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3324   xm   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Cos(phi);
3325   ym   = (kExtSuppRingRint1+kIntSuppRingThick1)*TMath::Sin(phi);
3326   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3327                  slp2, xm, ym,
3328                  xprof[npoints], yprof[npoints]);
3329   npoints++;
3330
3331   slp1 = slp2;
3332   phi -= kExtSuppRingPartPhi;
3333   slp2 = TMath::Tan(TMath::Pi()/2 + phi);
3334   xm   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Cos(phi);
3335   ym   = (kExtSuppRingRint2+kIntSuppRingThick2)*TMath::Sin(phi);
3336   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3337                  slp2, xm, ym,
3338                  xprof[npoints], yprof[npoints]);
3339   npoints++;
3340
3341   xprof[npoints] = kExtSuppRingBase-kIntSuppRingInward;
3342   yprof[npoints] = Yfrom2Points(xprof[npoints-1], yprof[npoints-1], xm, ym,
3343                                 xprof[npoints]);
3344   npoints++;
3345
3346   xprof[npoints] = xprof[npoints-1];
3347   yprof[npoints] = kSuppRingYTrans;
3348   npoints++;
3349   // ...and then the interior profile, which is identical to extSuppRing one
3350   for (Int_t jp=0; jp < 8; jp++) {
3351     xprof[npoints] = extSuppRing->GetX(17+jp);
3352     yprof[npoints] = extSuppRing->GetY(17+jp);
3353     npoints++;
3354   }
3355   // We did the right side! now reflex on the left side
3356   for (Int_t jp = 0; jp < npoints; jp++) {
3357     xprof[npoints+jp] = -xprof[npoints-1-jp];
3358     yprof[npoints+jp] =  yprof[npoints-1-jp];
3359   }
3360   // And now the actual Xtru
3361   intSuppRing->DefinePolygon(2*npoints, xprof, yprof);
3362   intSuppRing->DefineSection(0,0);
3363   intSuppRing->DefineSection(1,kIntSuppRingThick);
3364
3365   // The intermediate cylinder (0872/G/A/03): a TubeSeg
3366   alphamin = TMath::ASin(kSuppCylDispl/kSuppCylRint)*TMath::RadToDeg();
3367   alphamax = 180 - alphamin;
3368   TGeoTubeSeg *interCylind = new TGeoTubeSeg(kSuppCylRint, kSuppCylRext,
3369                                      kSuppCylHeight/2, alphamin, alphamax);
3370
3371   // The spacer (0872/G/A/03): a simple Xtru
3372   TGeoXtru *suppSpacer = new TGeoXtru(2);
3373
3374   xprof[0] = kSuppSpacerHeight;
3375   yprof[0] = kSuppSpacerThick;
3376   xprof[1] = xprof[0];
3377   yprof[1] = 0;
3378   xprof[2] = 0;
3379   yprof[2] = 0;
3380   xprof[3] = kSuppSpacerThick*SinD(kSuppSpacerAngle);
3381   yprof[3] = yprof[0];
3382
3383   suppSpacer->DefinePolygon(4, xprof, yprof);
3384   suppSpacer->DefineSection(0,-kSuppCylHeight/2);
3385   suppSpacer->DefineSection(1, kSuppCylHeight/2);
3386
3387   // The forward ring (0872/G/B/02): a Pcon (slight oversimplification)
3388   Double_t rmean = (kSuppForwRingRint1+kSuppForwRingRext)/2;
3389   alphamin = TMath::ASin(kSuppForwYTrans/rmean)*TMath::RadToDeg();
3390   alphamax = 180 - alphamin;
3391
3392   TGeoPcon *forwardRing = new TGeoPcon(alphamin,alphamax-alphamin,4);
3393
3394   forwardRing->DefineSection(0,0,
3395                              kSuppForwRingRint1,kSuppForwRingRext);
3396   forwardRing->DefineSection(1,kSuppForwRingThikInt,
3397                              kSuppForwRingRint1,kSuppForwRingRext);
3398   forwardRing->DefineSection(2,kSuppForwRingThikInt,
3399                              kSuppForwRingRint2,kSuppForwRingRext);
3400   forwardRing->DefineSection(3,kSuppForwRingThikAll,
3401                              kSuppForwRingRint2,kSuppForwRingRext);
3402
3403   // The forward cone (0872/G/B/03): a TGeoPcon
3404   TGeoPcon *forwardCone = new TGeoPcon(alphamin,alphamax-alphamin,3);
3405
3406   forwardCone->DefineSection(0,0,
3407                              kSuppForwConeRmin-kSuppForwConeThick,
3408                              kSuppForwConeRmin);
3409   forwardCone->DefineSection(1,kSuppForwConeLen1,
3410                              kSuppForwConeRmin-kSuppForwConeThick,
3411                              kSuppForwConeRmin);
3412   forwardCone->DefineSection(2,kSuppForwConeLen1+kSuppForwConeLen2,
3413                              kSuppForwConeRmax-kSuppForwConeThick,
3414                              kSuppForwConeRmax);
3415
3416   // The first part of the Back Ring (part of 0872/G/B/01): a complex Xtru
3417   TGeoXtru *firstSuppBackRing = new TGeoXtru(2);
3418
3419   // First the external profile... (the arc is approximated with segments)
3420   npoints = 0;
3421
3422   xprof[npoints] = kSuppBackRingPlacTop;
3423   yprof[npoints] = kSuppBackRingHeight;
3424   npoints++;
3425
3426   alphamax = TMath::Pi()/2 - TMath::ASin(kSuppBackRingPlacTop/kSuppBackRingRext);
3427   alphamin = TMath::ASin((kSuppForwYTrans+kSuppBackRingPlacSid)/kSuppBackRingRext);
3428
3429   xprof[npoints] = xprof[npoints-1];
3430   yprof[npoints] = kSuppBackRingRext*TMath::Sin(alphamax);
3431   npoints++;
3432
3433   for (Int_t jp = 1; jp <= kSuppBackRingNPtsArc; jp++) {
3434     Double_t alpha = alphamax - jp*(alphamax-alphamin)/kSuppBackRingNPtsArc;
3435     xprof[npoints] = kSuppBackRingRext*TMath::Cos(alpha);
3436     yprof[npoints] = kSuppBackRingRext*TMath::Sin(alpha);
3437     npoints++;
3438   }
3439
3440   xprof[npoints] = kSuppBackRingBase -
3441                    kSuppBackRingPlacSid*TMath::Tan(kSuppBackRingPlacAng);
3442   yprof[npoints] = yprof[npoints-1];
3443   npoints++;
3444
3445   xprof[npoints] = kSuppBackRingBase;
3446   yprof[npoints] = kSuppForwYTrans;
3447   npoints++;
3448   // ...then the internal profile (the arc is approximated with segments)
3449   alphamin = TMath::ASin(kSuppForwYTrans/kSuppBackRingRint);
3450   alphamax = TMath::Pi()/2;
3451
3452   for (Int_t jp = 0; jp < kSuppBackRingNPtsArc; jp++) {
3453     Double_t alpha = alphamin + jp*(alphamax-alphamin)/kSuppBackRingNPtsArc;
3454     xprof[npoints] = kSuppBackRingRint*TMath::Cos(alpha);
3455     yprof[npoints] = kSuppBackRingRint*TMath::Sin(alpha);
3456     npoints++;
3457   }
3458
3459   xprof[npoints] = 0;
3460   yprof[npoints] = kSuppBackRingRint;
3461   npoints++;
3462   // We did the right side! now reflex on the left side (except last point)
3463   for (Int_t jp = 0; jp < npoints-1; jp++) {
3464     xprof[npoints+jp] = -xprof[npoints-jp-2];
3465     yprof[npoints+jp] =  yprof[npoints-jp-2];
3466   }
3467   // And now the actual Xtru
3468   firstSuppBackRing->DefinePolygon(2*npoints-1, xprof, yprof);
3469   firstSuppBackRing->DefineSection(0,0);
3470   firstSuppBackRing->DefineSection(1,kSuppBackRingThick1);
3471
3472   // The second part of the Back Ring (part of 0872/G/B/01): a Pcon
3473   // (slight oversimplification)
3474   alphamin = TMath::ASin(kSuppForwYTrans/kSuppBackRingRint)*TMath::RadToDeg();
3475   alphamax = 180 - alphamin;
3476
3477   TGeoPcon *secondSuppBackRing = new TGeoPcon(alphamin,alphamax-alphamin,6);
3478
3479   deltaR = kSuppBackRingThick2/TMath::Sin(kSuppBackRing2ndAng1);
3480   rmin = kSuppBackRingRint - kSuppBackRingThick1/TMath::Tan(kSuppBackRing2ndAng1);
3481   rmax = rmin + deltaR + kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1);
3482   secondSuppBackRing->DefineSection(0, 0, rmin, rmax);
3483
3484   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1/3));
3485   rmax -= kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1/3);
3486   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
3487   secondSuppBackRing->DefineSection(1, zloc, rmin, rmax);
3488
3489   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1*2/3));
3490   rmax = secondSuppBackRing->GetRmax(0) - kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1*2/3);
3491   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
3492   secondSuppBackRing->DefineSection(2, zloc, rmin, rmax);
3493
3494   zloc = kSuppBackRingR10*(1 - TMath::Cos(kSuppBackRing2ndAng1));
3495   rmax = secondSuppBackRing->GetRmax(0) - kSuppBackRingR10*TMath::Sin(kSuppBackRing2ndAng1);
3496   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
3497   secondSuppBackRing->DefineSection(3, zloc, rmin, rmax);
3498
3499   slp1 = TMath::Tan(kSuppBackRing2ndAng2);
3500   slp2 = TMath::Tan(TMath::Pi()/2 + kSuppBackRing2ndAng1);
3501   IntersectLines(-slp1,kSuppBackRingThikAll,deltaR/2,
3502                   slp2,kSuppBackRingThikAll,deltaR,
3503                   xm, ym);
3504
3505   zloc = xm - kSuppBackRingThick1;
3506   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
3507   rmax = rmin + deltaR;
3508   secondSuppBackRing->DefineSection(4, zloc, rmin, rmax);
3509
3510   zloc = kSuppBackRingThikAll - kSuppBackRingThick1;
3511   rmin = secondSuppBackRing->GetRmin(0) - zloc/TMath::Tan(kSuppBackRing2ndAng1);
3512   rmax = rmin + deltaR/2;
3513   secondSuppBackRing->DefineSection(5, zloc, rmin, rmax);
3514
3515   // The supporting rod: a Tube
3516   TGeoTube *suppRod = new TGeoTube(0, kBackRodDiameter/2,
3517                                    (kBackRodLength - kBackRodThickLen)/2);
3518
3519   // The Back Ring (0872/G/C/01): another complex Xtru
3520   TGeoXtru *suppRearRing = new TGeoXtru(2);
3521
3522   // First the external profile...
3523   npoints = 0;
3524
3525   xprof[npoints] = kSuppRearRingTopWide;
3526   yprof[npoints] = kSuppRearRingHeight;
3527   npoints++;
3528
3529   phi = kSuppRearRing1stAng;
3530   slp1 = TMath::Tan(TMath::Pi() - phi);
3531   phi += kSuppRearRingStepAng;
3532   slp2 = TMath::Tan(TMath::Pi() - phi);
3533   xm = kSuppRearRingRext2*TMath::Sin(phi);
3534   ym = kSuppRearRingRext2*TMath::Cos(phi);
3535   IntersectLines(slp1, kSuppRearRingTopWide, kSuppRearRingHeight,
3536                  slp2, xm, ym,
3537                  xprof[npoints], yprof[npoints]);
3538   npoints++;
3539
3540   slp1 = slp2;
3541   phi += kSuppRearRingStepAng;
3542   slp2 = TMath::Tan(TMath::Pi() - phi);
3543   xm = kSuppRearRingRext1*TMath::Sin(phi);
3544   ym = kSuppRearRingRext1*TMath::Cos(phi);
3545   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3546                  slp2, xm, ym,
3547                  xprof[npoints], yprof[npoints]);
3548   npoints++;
3549
3550   slp1 = slp2;
3551   phi += kSuppRearRingStepAng;
3552   slp2 = TMath::Tan(TMath::Pi() - phi);
3553   xm = kSuppRearRingRext2*TMath::Sin(phi);
3554   ym = kSuppRearRingRext2*TMath::Cos(phi);
3555   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3556                  slp2, xm, ym,
3557                  xprof[npoints], yprof[npoints]);
3558   npoints++;
3559
3560   slp1 = slp2;
3561   slp2 = 0;
3562   xm = kSuppRearRingBase;
3563   ym = kSuppRearRingBaseHi + kSuppRearRingSideHi;
3564   IntersectLines(slp1, xprof[npoints-1], yprof[npoints-1],
3565                  slp2, xm, ym,
3566                  xprof[npoints], yprof[npoints]);
3567   npoints++;
3568
3569   xprof[npoints] = kSuppRearRingBase;
3570   yprof[npoints] = kSuppRearRingBaseHi + kSuppRearRingSideHi;
3571   npoints++;
3572   xprof[npoints] = xprof[npoints - 1];
3573   yprof[npoints] = kSuppRearRingBaseHi;
3574   npoints++;
3575   xprof[npoints] = xprof[npoints - 1] - kSuppRearRingInside;
3576   yprof[npoints] = yprof[npoints - 1];
3577   npoints++;
3578   xprof[npoints] = xprof[npoints - 1];
3579   yprof[npoints] = yprof[npoints - 1] + kSuppRearRingInsideHi;
3580   npoints++;
3581   // ...then the internal arc, approximated with segments,...
3582   xprof[npoints] = kSuppRearRingRint;
3583   yprof[npoints] = yprof[npoints - 1];
3584
3585   alphamin = TMath::ASin(kSuppRearRingBaseHi/kSuppRearRingRint);
3586   alphamax = TMath::Pi()/2;
3587
3588   for (Int_t jp = 1; jp < kSuppRearRingNPtsArc; jp++) {
3589     Double_t alpha = alphamin + jp*(alphamax-alphamin)/kSuppRearRingNPtsArc;
3590     xprof[npoints+jp] = kSuppRearRingRint*TMath::Cos(alpha);
3591     yprof[npoints+jp] = kSuppRearRingRint*TMath::Sin(alpha);
3592   }
3593
3594   xprof[npoints+kSuppRearRingNPtsArc] = 0;
3595   yprof[npoints+kSuppRearRingNPtsArc] = kSuppRearRingRint;
3596   // We did the right side! now reflex on the left side
3597   Int_t nTotalPoints = npoints+kSuppRearRingNPtsArc;
3598   for (Int_t jp = 0; jp < nTotalPoints; jp++) {
3599     xprof[nTotalPoints+1+jp] = -xprof[nTotalPoints-1-jp];
3600     yprof[nTotalPoints+1+jp] =  yprof[nTotalPoints-1-jp];
3601   }
3602
3603   // And now the actual Xtru
3604   suppRearRing->DefinePolygon(2*nTotalPoints+1, xprof, yprof);
3605   suppRearRing->DefineSection(0,0);
3606   suppRearRing->DefineSection(1,kSuppRearRingThick);
3607
3608
3609   // We have all shapes: now create the real volumes
3610   TGeoMedium *medAl = mgr->GetMedium("ITS_ANTICORODAL$");
3611
3612   TGeoVolume *sideAExtSuppRing = new TGeoVolume("ITSsuppSideAExtSuppRing",
3613                                                  extSuppRing, medAl);
3614
3615   sideAExtSuppRing->SetVisibility(kTRUE);
3616   sideAExtSuppRing->SetLineColor(kMagenta+1);
3617   sideAExtSuppRing->SetLineWidth(1);
3618   sideAExtSuppRing->SetFillColor(sideAExtSuppRing->GetLineColor());
3619   sideAExtSuppRing->SetFillStyle(4000); // 0% transparent
3620
3621   TGeoVolume *sideAIntSuppRing = new TGeoVolume("ITSsuppSideAIntSuppRing",
3622                                                  intSuppRing, medAl);
3623
3624   sideAIntSuppRing->SetVisibility(kTRUE);
3625   sideAIntSuppRing->SetLineColor(kMagenta+1);
3626   sideAIntSuppRing->SetLineWidth(1);
3627   sideAIntSuppRing->SetFillColor(sideAIntSuppRing->GetLineColor());
3628   sideAIntSuppRing->SetFillStyle(4000); // 0% transparent
3629
3630   TGeoVolume *sideASuppCyl = new TGeoVolume("ITSsuppSideASuppCyl",
3631                                             interCylind, medAl);
3632
3633   sideASuppCyl->SetVisibility(kTRUE);
3634   sideASuppCyl->SetLineColor(kMagenta+1);
3635   sideASuppCyl->SetLineWidth(1);
3636   sideASuppCyl->SetFillColor(sideASuppCyl->GetLineColor());
3637   sideASuppCyl->SetFillStyle(4000); // 0% transparent
3638
3639   TGeoVolume *sideASuppSpacer = new TGeoVolume("ITSsuppSideASuppSpacer",
3640                                                suppSpacer, medAl);
3641
3642   sideASuppSpacer->SetVisibility(kTRUE);
3643   sideASuppSpacer->SetLineColor(kMagenta+1);
3644   sideASuppSpacer->SetLineWidth(1);
3645   sideASuppSpacer->SetFillColor(sideASuppSpacer->GetLineColor());
3646   sideASuppSpacer->SetFillStyle(4000); // 0% transparent
3647
3648   TGeoVolume *sideASuppForwRing = new TGeoVolume("ITSsuppSideASuppForwRing",
3649                                                  forwardRing, medAl);
3650
3651   sideASuppForwRing->SetVisibility(kTRUE);
3652   sideASuppForwRing->SetLineColor(kMagenta+1);
3653   sideASuppForwRing->SetLineWidth(1);
3654   sideASuppForwRing->SetFillColor(sideASuppForwRing->GetLineColor());
3655   sideASuppForwRing->SetFillStyle(4000); // 0% transparent
3656
3657   TGeoVolume *sideASuppForwCone = new TGeoVolume("ITSsuppSideASuppForwCone",
3658                                                  forwardCone, medAl);
3659
3660   sideASuppForwCone->SetVisibility(kTRUE);
3661   sideASuppForwCone->SetLineColor(kMagenta+1);
3662   sideASuppForwCone->SetLineWidth(1);
3663   sideASuppForwCone->SetFillColor(sideASuppForwCone->GetLineColor());
3664   sideASuppForwCone->SetFillStyle(4000); // 0% transparent
3665
3666   TGeoVolume *sideAFirstSuppBackRing = new TGeoVolume("ITSsuppSideAFirstSuppBackRing",
3667                                                      firstSuppBackRing, medAl);
3668
3669   sideAFirstSuppBackRing->SetVisibility(kTRUE);
3670   sideAFirstSuppBackRing->SetLineColor(kMagenta+1);
3671   sideAFirstSuppBackRing->SetLineWidth(1);
3672   sideAFirstSuppBackRing->SetFillColor(sideAFirstSuppBackRing->GetLineColor());
3673   sideAFirstSuppBackRing->SetFillStyle(4000); // 0% transparent
3674
3675   TGeoVolume *sideASecondSuppBackRing = new TGeoVolume("ITSsuppSideASecondSuppBackRing",
3676                                                        secondSuppBackRing, medAl);
3677
3678   sideASecondSuppBackRing->SetVisibility(kTRUE);
3679   sideASecondSuppBackRing->SetLineColor(kMagenta+1);
3680   sideASecondSuppBackRing->SetLineWidth(1);
3681   sideASecondSuppBackRing->SetFillColor(sideASecondSuppBackRing->GetLineColor());
3682   sideASecondSuppBackRing->SetFillStyle(4000); // 0% transparent
3683
3684   TGeoVolume *sideASuppRod = new TGeoVolume("ITSsuppSideASuppRod",
3685                                             suppRod, medAl);
3686
3687   sideASuppRod->SetVisibility(kTRUE);
3688   sideASuppRod->SetLineColor(kMagenta+1);
3689   sideASuppRod->SetLineWidth(1);
3690   sideASuppRod->SetFillColor(sideASuppRod->GetLineColor());
3691   sideASuppRod->SetFillStyle(4000); // 0% transparent
3692
3693   TGeoVolume *sideASuppRearRing = new TGeoVolume("ITSsuppSideASuppRearRing",
3694                                                  suppRearRing, medAl);
3695
3696   sideASuppRearRing->SetVisibility(kTRUE);
3697   sideASuppRearRing->SetLineColor(kMagenta+1);
3698   sideASuppRearRing->SetLineWidth(1);
3699   sideASuppRearRing->SetFillColor(sideASuppRearRing->GetLineColor());
3700   sideASuppRearRing->SetFillStyle(4000); // 0% transparent
3701
3702
3703   // Now build up the support structure
3704   zloc = kSuppRingZTrans;
3705   trayASuppStruct->AddNode(sideAExtSuppRing, 1,
3706                            new TGeoTranslation(0, 0, zloc) );
3707   trayASuppStruct->AddNode(sideAExtSuppRing, 2,
3708                            new TGeoCombiTrans( 0, 0, zloc,
3709                                                new TGeoRotation("",180,0,0)));
3710
3711   zloc += kExtSuppRingThick;
3712   trayASuppStruct->AddNode(sideAIntSuppRing, 1,
3713                            new TGeoTranslation(0, 0, zloc) );
3714   trayASuppStruct->AddNode(sideAIntSuppRing, 2,
3715                            new TGeoCombiTrans( 0, 0, zloc,
3716                                                new TGeoRotation("",180,0,0)));
3717
3718   xloc = kExtSuppRingBase - kIntSuppRingInward;
3719   yloc = kSuppRingYTrans;
3720   zloc += (kIntSuppRingThick + kSuppCylHeight/2);
3721   trayASuppStruct->AddNode(sideASuppCyl, 1,
3722                            new TGeoTranslation(0, 0, zloc) );
3723   trayASuppStruct->AddNode(sideASuppCyl, 2,
3724                            new TGeoCombiTrans( 0, 0, zloc,
3725                                                new TGeoRotation("",180,0,0)));
3726   trayASuppStruct->AddNode(sideASuppSpacer, 1,
3727                            new TGeoCombiTrans( xloc, yloc, zloc,
3728                            new TGeoRotation("",90+kSuppSpacerAngle,0,0)));
3729   trayASuppStruct->AddNode(sideASuppSpacer, 2,
3730                            new TGeoCombiTrans(-xloc, yloc, zloc,
3731                            new TGeoRotation("",0,180,kSuppSpacerAngle-90)));
3732   trayASuppStruct->AddNode(sideASuppSpacer, 3,
3733                            new TGeoCombiTrans( xloc,-yloc, zloc,
3734                            new TGeoRotation("",180,180,kSuppSpacerAngle-90)));
3735   trayASuppStruct->AddNode(sideASuppSpacer, 4,
3736                            new TGeoCombiTrans(-xloc,-yloc, zloc,
3737                            new TGeoRotation("",270+kSuppSpacerAngle,0,0)));
3738
3739
3740   zloc += kSuppCylHeight/2;
3741   trayASuppStruct->AddNode(sideAIntSuppRing, 3,
3742                            new TGeoTranslation(0, 0, zloc) );
3743   trayASuppStruct->AddNode(sideAIntSuppRing, 4,
3744                            new TGeoCombiTrans( 0, 0, zloc,
3745                                                new TGeoRotation("",180,0,0)));
3746
3747   zloc += kIntSuppRingThick;
3748   trayASuppStruct->AddNode(sideAExtSuppRing, 3,
3749                            new TGeoTranslation(0, 0, zloc) );
3750   trayASuppStruct->AddNode(sideAExtSuppRing, 4,
3751                            new TGeoCombiTrans( 0, 0, zloc,
3752                                                new TGeoRotation("",180,0,0)));
3753
3754   zloc += kExtSuppRingThick;
3755   trayASuppStruct->AddNode(sideASuppForwRing, 1,
3756                            new TGeoTranslation(0, 0, zloc) );
3757   trayASuppStruct->AddNode(sideASuppForwRing, 2,
3758                            new TGeoCombiTrans( 0, 0, zloc,
3759                                                new TGeoRotation("",180,0,0)));
3760
3761   zloc += kSuppForwRingThikAll;
3762   trayASuppStruct->AddNode(sideASuppForwCone, 1,
3763                            new TGeoTranslation(0, 0, zloc) );
3764   trayASuppStruct->AddNode(sideASuppForwCone, 2,
3765                            new TGeoCombiTrans( 0, 0, zloc,
3766                                                new TGeoRotation("",180,0,0)));
3767
3768   zloc += (kSuppForwConeLen1+kSuppForwConeLen2);
3769   trayASuppStruct->AddNode(sideAFirstSuppBackRing, 1,
3770                            new TGeoTranslation(0, 0, zloc) );
3771   trayASuppStruct->AddNode(sideAFirstSuppBackRing, 2,
3772                            new TGeoCombiTrans( 0, 0, zloc,
3773                                                new TGeoRotation("",180,0,0)));
3774
3775   zloc += kSuppBackRingThick1;
3776   trayASuppStruct->AddNode(sideASecondSuppBackRing, 1,
3777                            new TGeoTranslation(0, 0, zloc) );
3778   trayASuppStruct->AddNode(sideASecondSuppBackRing, 2,
3779                            new TGeoCombiTrans( 0, 0, zloc,
3780                                                new TGeoRotation("",180,0,0)));
3781
3782   xloc = kSuppRearRingXRodHole;
3783   yloc = kSuppRearRingBaseHi + kSuppRearRingYRodHole;
3784   zloc = kRearSuppZTransGlob - kBackRodZTrans + suppRod->GetDz();
3785   trayASuppStruct->AddNode(sideASuppRod, 1,
3786                            new TGeoTranslation( xloc, yloc, zloc) );
3787   trayASuppStruct->AddNode(sideASuppRod, 2,
3788                            new TGeoTranslation(-xloc, yloc, zloc) );
3789   trayASuppStruct->AddNode(sideASuppRod, 3,
3790                            new TGeoTranslation( xloc,-yloc, zloc) );
3791   trayASuppStruct->AddNode(sideASuppRod, 4,
3792                            new TGeoTranslation(-xloc,-yloc, zloc) );
3793
3794   zloc += suppRod->GetDz();
3795   trayASuppStruct->AddNode(sideASuppRearRing, 1,
3796                            new TGeoTranslation( 0, 0, zloc) );
3797   trayASuppStruct->AddNode(sideASuppRearRing, 2,
3798                            new TGeoCombiTrans( 0, 0, zloc,
3799                                                new TGeoRotation("",180,0,0)));
3800
3801
3802   // Finally put everything in the mother volume
3803   moth->AddNode(trayASuppStruct,1,0);
3804
3805   return;
3806 }
3807
3808 //______________________________________________________________________
3809 void AliITSv11GeometrySupport::ServicesCableSupportSPD(TGeoVolume *moth,
3810                                                        TGeoManager *mgr){
3811 //
3812 // Creates the all SPD cable trays which are outside the ITS support cones
3813 // but still inside the TPC
3814 // In order to avoid a huge monolithic routine, this method actually
3815 // calls inner methods to create and assemble the various (macro)pieces
3816 //
3817 // Input:
3818 //         moth : the TGeoVolume owing the volume structure
3819 //         mgr  : the GeoManager (default gGeoManager)
3820 // Output:
3821 //
3822 // Created:         ???       Bjorn S. Nilsen
3823 // Updated:      15 Nov 2009  Mario Sitta
3824 //
3825 // Technical data are taken from AutoCAD drawings and other (oral)
3826 // information given by F.Tosello
3827 //
3828
3829   SPDCableTraysSideA(moth, mgr);
3830   SPDCableTraysSideC(moth, mgr);
3831
3832 }
3833
3834 //______________________________________________________________________
3835 void AliITSv11GeometrySupport::ServicesCableSupportSDD(TGeoVolume *moth,
3836                                                        TGeoManager *mgr){
3837 //
3838 // Creates the all SDD cable trays which are outside the ITS support cones
3839 // but still inside the TPC
3840 // In order to avoid a huge monolithic routine, this method actually
3841 // calls inner methods to create and assemble the various (macro)pieces
3842 //
3843 // Input:
3844 //         moth : the TGeoVolume owing the volume structure
3845 //         mgr  : the GeoManager (default gGeoManager)
3846 // Output:
3847 //
3848 // Created:      14 Dec 2009  Mario Sitta
3849 //
3850
3851   SDDCableTraysSideA(moth, mgr);
3852   SDDCableTraysSideC(moth, mgr);
3853
3854   return;
3855 }
3856
3857 //______________________________________________________________________
3858 void AliITSv11GeometrySupport::ServicesCableSupportSSD(TGeoVolume *moth,
3859                                                        TGeoManager *mgr){
3860 //
3861 // Creates the SSD cable trays which are outside the ITS support cones
3862 // but still inside the TPC
3863 // In order to avoid a huge monolithic routine, this method actually
3864 // calls inner methods to create and assemble the various (macro)pieces
3865 //
3866 // Input:
3867 //         moth : the TGeoVolume owing the volume structure
3868 //         mgr  : the GeoManager (default gGeoManager)
3869 // Output:
3870 //
3871 // Created:      15 Nov 2009  Mario Sitta
3872 //
3873
3874   SSDCableTraysSideA(moth, mgr);
3875   SSDCableTraysSideC(moth, mgr);
3876
3877   return;
3878 }
3879
3880 //______________________________________________________________________
3881 void AliITSv11GeometrySupport::SPDCableTraysSideA(TGeoVolume *moth,
3882                                             const TGeoManager *mgr){
3883 //
3884 // Creates the SPD cable trays which are outside the ITS support cones
3885 // but still inside the TPC on Side A
3886 // (part of this code is taken or anyway inspired to ServicesCableSupport
3887 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
3888 //
3889 // Input:
3890 //         moth : the TGeoVolume owing the volume structure
3891 //         mgr  : the GeoManager (default gGeoManager)
3892 // Output:
3893 //
3894 // Created:      15 Feb 2010  Mario Sitta
3895 // Updated:      10 Jun 2010  Mario Sitta  Freon inside cooling pipes
3896 // Updated:      08 Sep 2010  Mario Sitta
3897 // Updated:      14 Sep 2010  Mario Sitta  Cables prolonged till cone
3898 //
3899 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
3900 // drawings and other (oral) information given by F.Tosello and D.Elia
3901 // (small differences with blueprints - e.g. -0.07mm in R1Trans and
3902 // R2Trans - fix small overlaps; they are then compensated in positioning
3903 // the Rear Tray to avoid its own overlaps with the rear supporting ring)
3904 // Optical fibers and voltage cables are approximated with mean materials
3905 // and square cross sections, but preserving the total material budget.
3906 //
3907
3908   // Overall position and rotation of the A-Side Cable Trays
3909   // (parts of 0872/G/D)
3910   const Double_t kTrayAR1Trans           =  396.93 *fgkmm;
3911   const Double_t kTrayAR2Trans           =  413.93 *fgkmm;
3912   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
3913   const Double_t kTrayAZRot              = (180-169.5);// Degrees
3914   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
3915   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
3916
3917   const Double_t kForwardTrayWide        =   94.00 *fgkmm;//!!!TO BE CHECKED!!!
3918   const Double_t kForwardTrayFirstHigh   =   83.00 *fgkmm;//!!!TO BE CHECKED!!!
3919   const Double_t kForwardTraySecondHigh  =   52.70 *fgkmm;//!!!TO BE CHECKED!!!
3920   const Double_t kForwardTrayTotalLen    =  853.00 *fgkmm;
3921   const Double_t kForwardTrayFirstLen    =  435.00 *fgkmm;
3922   const Double_t kForwardTrayWingWide    =   16.00 *fgkmm;//!!!TO BE CHECKED!!!
3923   const Double_t kForwardTrayInterSpace  =   18.00 *fgkmm;//!!!TO BE CHECKED!!!
3924   const Double_t kForwardTrayThick       =    2.00 *fgkmm;
3925
3926   const Int_t    kForwardSideNpoints     =    6;
3927
3928   const Double_t kExternalTrayLen        = 1200.00 *fgkmm;
3929   const Double_t kExternalTrayWide       = kForwardTrayWide;
3930   const Double_t kExternalTrayHigh       = kForwardTraySecondHigh;
3931   const Double_t kExternalTrayThick      = kForwardTrayThick;
3932
3933   const Double_t kCoolingTubeRmin        =    2.00 *fgkmm;
3934   const Double_t kCoolingTubeRmax        =    3.00 *fgkmm;
3935
3936   const Double_t kOpticalFibersSect      =    8.696*fgkmm;//!!!ESTIMATED!!!
3937   const Double_t kLowVoltageCableSectCu  =    7.675*fgkmm;// Computed
3938   const Double_t kLowVoltageCableHighPUR =    1.000*fgkmm;// Computed
3939   const Double_t kHiVoltageCableSectCu   =    1.535*fgkmm;// Computed
3940   const Double_t kHiVoltageCableHighPUR  =    0.500*fgkmm;// Computed
3941   const Double_t kCoaxCableSectCu        =    6.024*fgkmm;// Computed
3942   const Double_t kCoaxCableHighMeg       =    5.695*fgkmm;// Computed
3943
3944   const Double_t kTrayCCablesRot         =   75.000*fgkDegree;// Computed
3945   const Double_t kTrayCCablesZLenOut     =  227.000*fgkmm;// Computed
3946
3947
3948   // Local variables
3949   Double_t xprof[kForwardSideNpoints], yprof[kForwardSideNpoints];
3950   Double_t xloc, yloc, zloc, alpharot;
3951
3952
3953   // The two tray components as assemblies
3954   TGeoVolumeAssembly *cableTrayAForw =
3955     new TGeoVolumeAssembly("ITSsupportSPDTrayAForwRear");
3956   TGeoVolumeAssembly *cableTrayAExt =
3957     new TGeoVolumeAssembly("ITSsupportSPDTrayAExt");
3958   
3959
3960   // First create all needed shapes
3961
3962   // The lower face of the forward tray: a BBox
3963   TGeoBBox *forwTrayLowerFace = new TGeoBBox(kForwardTrayWide/2,
3964                                              kForwardTrayThick/2,
3965                                              kForwardTrayTotalLen/2);
3966
3967   // The side face of the forward tray: a Xtru
3968   TGeoXtru *forwTraySideFace = new TGeoXtru(2);
3969   forwTraySideFace->SetName("ITSsuppSPDForwTraySide");
3970
3971   xprof[0] = 0;
3972   yprof[0] = kForwardTrayThick;
3973   xprof[1] = kForwardTrayTotalLen;
3974   yprof[1] = yprof[0];
3975   xprof[2] = xprof[1];
3976   yprof[2] = kForwardTraySecondHigh - kForwardTrayThick;
3977   xprof[3] = kForwardTrayFirstLen;
3978   yprof[3] = yprof[2];
3979   xprof[4] = xprof[3];
3980   yprof[4] = kForwardTrayFirstHigh - kForwardTrayThick;
3981   xprof[5] = xprof[0];
3982   yprof[5] = yprof[4];
3983
3984   forwTraySideFace->DefinePolygon(6, xprof, yprof);
3985   forwTraySideFace->DefineSection(0, 0);
3986   forwTraySideFace->DefineSection(1, kForwardTrayThick);
3987
3988   // The covers of the forward tray: two BBox's
3989   TGeoBBox *forwTrayShortCover = new TGeoBBox(kForwardTrayWide/2,
3990                                               kForwardTrayThick/2,
3991                                               kForwardTrayFirstLen/2);
3992
3993   TGeoBBox *forwTrayLongCover = new TGeoBBox(kForwardTrayWide/2,
3994                                              kForwardTrayThick/2,
3995                              (kForwardTrayTotalLen - kForwardTrayFirstLen)/2);
3996
3997   // Each small wing of the forward tray: a BBox
3998   TGeoBBox *forwTrayWing = new TGeoBBox(kForwardTrayWingWide/2,
3999                              (kForwardTrayFirstHigh-kForwardTraySecondHigh)/2,
4000                                         kForwardTrayThick/2);
4001
4002   // The internal plane of the forward tray: a BBox
4003   TGeoBBox *forwTrayPlane = new TGeoBBox(kForwardTrayWide/2-kForwardTrayThick,
4004                                          kForwardTrayThick/2,
4005                                          kForwardTrayTotalLen/2);
4006
4007   // The internal wall of the forward tray: a BBox
4008   TGeoBBox *forwTrayWall = new TGeoBBox(kForwardTrayThick/2,
4009                                  (kForwardTrayInterSpace-kForwardTrayThick)/2,
4010                                         kForwardTrayTotalLen/2);
4011
4012   // Each horizontal face of the external tray: a BBox
4013   TGeoBBox *extTrayHorFace = new TGeoBBox(kExternalTrayWide/2-kExternalTrayThick,
4014                                           kExternalTrayThick/2,
4015                                           kExternalTrayLen/2);
4016
4017   // Each vertical face of the external tray: a BBox
4018   TGeoBBox *extTrayVerFace = new TGeoBBox(kExternalTrayThick/2,
4019                                           kExternalTrayHigh/2,
4020                                           kExternalTrayLen/2);
4021
4022   // The internal wall of the external tray: a BBox
4023   TGeoBBox *extTrayWall = new TGeoBBox(kExternalTrayThick/2,
4024                                  (kForwardTrayInterSpace-kExternalTrayThick)/2,
4025                                        kExternalTrayLen/2);
4026
4027   // The cooling tube inside the forward tray: a Tube
4028   Double_t zelong = (kForwardTraySecondHigh - 2*kForwardTrayThick
4029                 - 2*forwTrayWall->GetDY() - kCoolingTubeRmax)*SinD(kTrayAZRot);
4030   Double_t zlen = (zelong + kForwardTrayTotalLen)/2;
4031   TGeoTube *coolTubeForw = new TGeoTube(0, kCoolingTubeRmax, zlen);
4032
4033   // The freon inside the forward tray tubes: a Tube
4034   TGeoTube *freonTubeForw = new TGeoTube(0, kCoolingTubeRmin, zlen);
4035
4036   // The cooling tube inside the external tray: a Ctub
4037   TGeoCtub *coolTubeExt = new TGeoCtub(0, kCoolingTubeRmax,
4038                                        kExternalTrayLen/2, 0, 360,
4039                                        0, SinD(kTrayAZRot),-CosD(kTrayAZRot),
4040                                        0,                0,               1);
4041
4042   // The freon inside the forward tray tubes: a Tube
4043   TGeoCtub *freonTubeExt = new TGeoCtub(0, kCoolingTubeRmin,
4044                                         kExternalTrayLen/2, 0, 360,
4045                                         0, SinD(kTrayAZRot),-CosD(kTrayAZRot),
4046                                         0,                0,               1);
4047
4048   // The optical fibers inside the forward tray: a Xtru
4049   TGeoXtru *optFibsForw = new TGeoXtru(2);
4050
4051   xprof[0] = -kTrayCCablesZLenOut;
4052   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
4053   xprof[1] = 0;
4054   yprof[1] = 0;
4055   xprof[2] = kForwardTrayTotalLen;
4056   yprof[2] = yprof[1];
4057   xprof[3] = xprof[2];
4058   yprof[3] = yprof[2] + kOpticalFibersSect;
4059   xprof[4] = xprof[1];
4060   yprof[4] = yprof[3];
4061   xprof[5] = xprof[0];
4062   yprof[5] = yprof[0] + kOpticalFibersSect;
4063
4064   optFibsForw->DefinePolygon(6, xprof, yprof);
4065   optFibsForw->DefineSection(0,-kOpticalFibersSect/2);
4066   optFibsForw->DefineSection(1, kOpticalFibersSect/2);
4067
4068   // The optical fibers inside the external tray: a Xtru
4069   TGeoXtru *optFibsExt = new TGeoXtru(2);
4070   optFibsExt->SetName("ITSsuppSPDExtTrayOptFibs");
4071
4072   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
4073            + 2*forwTrayWall->GetDY();
4074   xprof[0] = yprof[0]*TanD(kTrayAZRot);
4075   xprof[1] = kExternalTrayLen;
4076   yprof[1] = yprof[0];
4077   xprof[2] = xprof[1];
4078   yprof[2] = yprof[1] + kOpticalFibersSect;
4079   yprof[3] = yprof[2];
4080   xprof[3] = yprof[2]*TanD(kTrayAZRot);
4081
4082   optFibsExt->DefinePolygon(4, xprof, yprof);
4083   optFibsExt->DefineSection(0, 0);
4084   optFibsExt->DefineSection(1, kOpticalFibersSect);
4085
4086   // The Low Voltage cables inside the forward tray: two Xtru
4087   TGeoXtru *lowCablesForwCu = new TGeoXtru(2);
4088
4089   xprof[0] = -kTrayCCablesZLenOut;
4090   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
4091   xprof[1] = 0;
4092   yprof[1] = 0;
4093   xprof[2] = kForwardTrayTotalLen;
4094   yprof[2] = yprof[1];
4095   xprof[3] = xprof[2];
4096   yprof[3] = yprof[2] + kLowVoltageCableSectCu/2;
4097   xprof[4] = xprof[1];
4098   yprof[4] = yprof[3];
4099   xprof[5] = xprof[0];
4100   yprof[5] = yprof[0] + kLowVoltageCableSectCu/2;
4101
4102   lowCablesForwCu->DefinePolygon(6, xprof, yprof);
4103   lowCablesForwCu->DefineSection(0,-kLowVoltageCableSectCu);
4104   lowCablesForwCu->DefineSection(1, kLowVoltageCableSectCu);
4105
4106   TGeoXtru *lowCablesForwPUR = new TGeoXtru(2);
4107
4108   xprof[0] = lowCablesForwCu->GetX(5);
4109   yprof[0] = lowCablesForwCu->GetY(5);
4110   xprof[1] = lowCablesForwCu->GetX(4);
4111   yprof[1] = lowCablesForwCu->GetY(4);
4112   xprof[2] = lowCablesForwCu->GetX(3);
4113   yprof[2] = lowCablesForwCu->GetY(3);
4114   xprof[3] = xprof[2];
4115   yprof[3] = yprof[2] + kLowVoltageCableHighPUR/2;
4116   xprof[4] = xprof[1];
4117   yprof[4] = yprof[3];
4118   xprof[5] = xprof[0];
4119   yprof[5] = yprof[0] + kLowVoltageCableHighPUR/2;
4120
4121   lowCablesForwPUR->DefinePolygon(6, xprof, yprof);
4122   lowCablesForwPUR->DefineSection(0,-kLowVoltageCableSectCu);
4123   lowCablesForwPUR->DefineSection(1, kLowVoltageCableSectCu);
4124
4125   // The Low Voltage inside the external tray: two Xtru
4126   TGeoXtru *lowCablesExtCu = new TGeoXtru(2);
4127   lowCablesExtCu->SetName("ITSsuppSPDExtTrayLowVoltageCu");
4128
4129   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
4130            + 2*forwTrayWall->GetDY();
4131   xprof[0] = yprof[0]*TanD(kTrayAZRot);
4132   xprof[1] = kExternalTrayLen;
4133   yprof[1] = yprof[0];
4134   xprof[2] = xprof[1];
4135   yprof[2] = yprof[1] + kLowVoltageCableSectCu/2;
4136   yprof[3] = yprof[2];
4137   xprof[3] = yprof[2]*TanD(kTrayAZRot);
4138
4139   lowCablesExtCu->DefinePolygon(4, xprof, yprof);
4140   lowCablesExtCu->DefineSection(0, 0);
4141   lowCablesExtCu->DefineSection(1, kLowVoltageCableSectCu*2);
4142
4143   TGeoXtru *lowCablesExtPUR = new TGeoXtru(2);
4144   lowCablesExtPUR->SetName("ITSsuppSPDExtTrayLowVoltagePUR");
4145
4146   xprof[0] = lowCablesExtCu->GetX(3);
4147   yprof[0] = lowCablesExtCu->GetY(3);
4148   xprof[1] = lowCablesExtCu->GetX(2);
4149   yprof[1] = lowCablesExtCu->GetY(2);
4150   xprof[2] = xprof[1];
4151   yprof[2] = yprof[1] + kLowVoltageCableHighPUR/2;
4152   yprof[3] = yprof[2];
4153   xprof[3] = yprof[2]*TanD(kTrayAZRot);
4154
4155   lowCablesExtPUR->DefinePolygon(4, xprof, yprof);
4156   lowCablesExtPUR->DefineSection(0, 0);
4157   lowCablesExtPUR->DefineSection(1, kLowVoltageCableSectCu*2);
4158
4159   // The High Voltage cables inside the forward tray: two Xtru
4160   TGeoXtru *hiCablesForwCu = new TGeoXtru(2);
4161
4162   xprof[0] = -kTrayCCablesZLenOut;
4163   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
4164   xprof[1] = 0;
4165   yprof[1] = 0;
4166   xprof[2] = kForwardTrayTotalLen;
4167   yprof[2] = yprof[1];
4168   xprof[3] = xprof[2];
4169   yprof[3] = yprof[2] + kHiVoltageCableSectCu/2;
4170   xprof[4] = xprof[1];
4171   yprof[4] = yprof[3];
4172   xprof[5] = xprof[0];
4173   yprof[5] = yprof[0] + kHiVoltageCableSectCu/2;
4174
4175   hiCablesForwCu->DefinePolygon(6, xprof, yprof);
4176   hiCablesForwCu->DefineSection(0,-kHiVoltageCableSectCu);
4177   hiCablesForwCu->DefineSection(1, kHiVoltageCableSectCu);
4178
4179   TGeoXtru *hiCablesForwPUR = new TGeoXtru(2);
4180
4181   xprof[0] = hiCablesForwCu->GetX(5);
4182   yprof[0] = hiCablesForwCu->GetY(5);
4183   xprof[1] = hiCablesForwCu->GetX(4);
4184   yprof[1] = hiCablesForwCu->GetY(4);
4185   xprof[2] = hiCablesForwCu->GetX(3);
4186   yprof[2] = hiCablesForwCu->GetY(3);
4187   xprof[3] = xprof[2];
4188   yprof[3] = yprof[2] + kHiVoltageCableHighPUR/2;
4189   xprof[4] = xprof[1];
4190   yprof[4] = yprof[3];
4191   xprof[5] = xprof[0];
4192   yprof[5] = yprof[0] + kHiVoltageCableHighPUR/2;
4193
4194   hiCablesForwPUR->DefinePolygon(6, xprof, yprof);
4195   hiCablesForwPUR->DefineSection(0,-kHiVoltageCableSectCu);
4196   hiCablesForwPUR->DefineSection(1, kHiVoltageCableSectCu);
4197
4198   // The High Voltage inside the external tray: two Xtru
4199   TGeoXtru *hiCablesExtCu = new TGeoXtru(2);
4200   hiCablesExtCu->SetName("ITSsuppSPDExtTrayHiVoltageCu");
4201
4202   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
4203            + 2*forwTrayWall->GetDY();
4204   xprof[0] = yprof[0]*TanD(kTrayAZRot);
4205   xprof[1] = kExternalTrayLen;
4206   yprof[1] = yprof[0];
4207   xprof[2] = xprof[1];
4208   yprof[2] = yprof[1] + kHiVoltageCableSectCu/2;
4209   yprof[3] = yprof[2];
4210   xprof[3] = yprof[2]*TanD(kTrayAZRot);
4211
4212   hiCablesExtCu->DefinePolygon(4, xprof, yprof);
4213   hiCablesExtCu->DefineSection(0, 0);
4214   hiCablesExtCu->DefineSection(1, kHiVoltageCableSectCu*2);
4215
4216   TGeoXtru *hiCablesExtPUR = new TGeoXtru(2);
4217   hiCablesExtPUR->SetName("ITSsuppSPDExtTrayHiVoltagePUR");
4218
4219   xprof[0] = hiCablesExtCu->GetX(3);
4220   yprof[0] = hiCablesExtCu->GetY(3);
4221   xprof[1] = hiCablesExtCu->GetX(2);
4222   yprof[1] = hiCablesExtCu->GetY(2);
4223   xprof[2] = xprof[1];
4224   yprof[2] = yprof[1] + kHiVoltageCableHighPUR/2;
4225   yprof[3] = yprof[2];
4226   xprof[3] = yprof[2]*TanD(kTrayAZRot);
4227
4228   hiCablesExtPUR->DefinePolygon(4, xprof, yprof);
4229   hiCablesExtPUR->DefineSection(0, 0);
4230   hiCablesExtPUR->DefineSection(1, kHiVoltageCableSectCu*2);
4231
4232   // The Coaxial cables inside the forward tray: two Xtru
4233   TGeoXtru *coaxCablesForwCu = new TGeoXtru(2);
4234   coaxCablesForwCu->SetName("ITSsuppSPDForwTrayCoaxCu");
4235
4236   xprof[0] = -kTrayCCablesZLenOut;
4237   yprof[0] = xprof[0]/TanD(kTrayCCablesRot);
4238   xprof[1] = 0;
4239   yprof[1] = 0;
4240   xprof[2] = kForwardTrayTotalLen;
4241   yprof[2] = yprof[1];
4242   xprof[3] = xprof[2];
4243   yprof[3] = yprof[2] + kCoaxCableSectCu/2;
4244   xprof[4] = xprof[1];
4245   yprof[4] = yprof[3];
4246   xprof[5] = xprof[0];
4247   yprof[5] = yprof[0] + kCoaxCableSectCu/2;
4248
4249   coaxCablesForwCu->DefinePolygon(6, xprof, yprof);
4250   coaxCablesForwCu->DefineSection(0,-kCoaxCableSectCu);
4251   coaxCablesForwCu->DefineSection(1, kCoaxCableSectCu);
4252
4253   TGeoXtru *coaxCablesForwMeg = new TGeoXtru(2);
4254   coaxCablesForwMeg->SetName("ITSsuppSPDForwTrayCoaxMeg");
4255
4256   xprof[0] = coaxCablesForwCu->GetX(5);
4257   yprof[0] = coaxCablesForwCu->GetY(5);
4258   xprof[1] = coaxCablesForwCu->GetX(4);
4259   yprof[1] = coaxCablesForwCu->GetY(4);
4260   xprof[2] = coaxCablesForwCu->GetX(3);
4261   yprof[2] = coaxCablesForwCu->GetY(3);
4262   xprof[3] = xprof[2];
4263   yprof[3] = yprof[2] + kCoaxCableHighMeg/2;
4264   xprof[4] = xprof[1];
4265   yprof[4] = yprof[3];
4266   xprof[5] = xprof[0];
4267   yprof[5] = yprof[0] + kCoaxCableHighMeg/2;
4268
4269   coaxCablesForwMeg->DefinePolygon(6, xprof, yprof);
4270   coaxCablesForwMeg->DefineSection(0,-kCoaxCableSectCu);
4271   coaxCablesForwMeg->DefineSection(1, kCoaxCableSectCu);
4272
4273   // The Coaxial inside the external tray: two Xtru
4274   TGeoXtru *coaxCablesExtCu = new TGeoXtru(2);
4275   coaxCablesExtCu->SetName("ITSsuppSPDExtTrayCoaxCu");
4276
4277   yprof[0] = -kExternalTrayHigh + 2*kExternalTrayThick
4278            + 2*forwTrayWall->GetDY();
4279   xprof[0] = yprof[0]*TanD(kTrayAZRot);
4280   xprof[1] = kExternalTrayLen;
4281   yprof[1] = yprof[0];
4282   xprof[2] = xprof[1];
4283   yprof[2] = yprof[1] + kCoaxCableSectCu/2;
4284   yprof[3] = yprof[2];
4285   xprof[3] = yprof[2]*TanD(kTrayAZRot);
4286
4287   coaxCablesExtCu->DefinePolygon(4, xprof, yprof);
4288   coaxCablesExtCu->DefineSection(0, 0);
4289   coaxCablesExtCu->DefineSection(1, kCoaxCableSectCu*2);
4290
4291   TGeoXtru *coaxCablesExtMeg = new TGeoXtru(2);
4292   coaxCablesExtMeg->SetName("ITSsuppSPDExtTrayCoaxMeg");
4293
4294   xprof[0] = coaxCablesExtCu->GetX(3);
4295   yprof[0] = coaxCablesExtCu->GetY(3);
4296   xprof[1] = coaxCablesExtCu->GetX(2);
4297   yprof[1] = coaxCablesExtCu->GetY(2);
4298   xprof[2] = xprof[1];
4299   yprof[2] = yprof[1] + kCoaxCableHighMeg/2;
4300   yprof[3] = yprof[2];
4301   xprof[3] = yprof[2]*TanD(kTrayAZRot);
4302
4303   coaxCablesExtMeg->DefinePolygon(4, xprof, yprof);
4304   coaxCablesExtMeg->DefineSection(0, 0);
4305   coaxCablesExtMeg->DefineSection(1, kCoaxCableSectCu*2);
4306
4307
4308   // We have all shapes: now create the real volumes
4309   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
4310   TGeoMedium *medIn    = mgr->GetMedium("ITS_INOX$");
4311   TGeoMedium *medFreon = mgr->GetMedium("ITS_GASEOUS FREON$");
4312   TGeoMedium *medFibs  = mgr->GetMedium("ITS_SDD OPTICFIB$");//!TO BE CHECKED!
4313   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
4314   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
4315   TGeoMedium *medMeg   = mgr->GetMedium("ITS_MEGOLON$");
4316
4317   TGeoVolume *forwTrayABase = new TGeoVolume("ITSsuppSPDSideAForwTrayABase",
4318                                             forwTrayLowerFace, medAl);
4319
4320   forwTrayABase->SetVisibility(kTRUE);
4321   forwTrayABase->SetLineColor(6); // Purple
4322   forwTrayABase->SetLineWidth(1);
4323   forwTrayABase->SetFillColor(forwTrayABase->GetLineColor());
4324   forwTrayABase->SetFillStyle(4000); // 0% transparent
4325
4326   TGeoVolume *forwTrayASide = new TGeoVolume("ITSsuppSPDSideAForwTrayASide",
4327                                             forwTraySideFace, medAl);
4328
4329   forwTrayASide->SetVisibility(kTRUE);
4330   forwTrayASide->SetLineColor(6); // Purple
4331   forwTrayASide->SetLineWidth(1);
4332   forwTrayASide->SetFillColor(forwTrayASide->GetLineColor());
4333   forwTrayASide->SetFillStyle(4000); // 0% transparent
4334
4335   TGeoVolume *forwTrayACoverShort = new TGeoVolume("ITSsuppSPDSideAForwTrayASC",
4336                                                   forwTrayShortCover, medAl);
4337
4338   forwTrayACoverShort->SetVisibility(kTRUE);
4339   forwTrayACoverShort->SetLineColor(6); // Purple
4340   forwTrayACoverShort->SetLineWidth(1);
4341   forwTrayACoverShort->SetFillColor(forwTrayACoverShort->GetLineColor());
4342   forwTrayACoverShort->SetFillStyle(4000); // 0% transparent
4343
4344   TGeoVolume *forwTrayACoverLong = new TGeoVolume("ITSsuppSPDSideAForwTrayALC",
4345                                                  forwTrayLongCover, medAl);
4346
4347   forwTrayACoverLong->SetVisibility(kTRUE);
4348   forwTrayACoverLong->SetLineColor(6); // Purple
4349   forwTrayACoverLong->SetLineWidth(1);
4350   forwTrayACoverLong->SetFillColor(forwTrayACoverLong->GetLineColor());
4351   forwTrayACoverLong->SetFillStyle(4000); // 0% transparent
4352
4353   TGeoVolume *forwTrayAWing = new TGeoVolume("ITSsuppSPDSideAForwTrayAWing",
4354                                              forwTrayWing, medAl);
4355
4356   forwTrayAWing->SetVisibility(kTRUE);
4357   forwTrayAWing->SetLineColor(6); // Purple
4358   forwTrayAWing->SetLineWidth(1);
4359   forwTrayAWing->SetFillColor(forwTrayAWing->GetLineColor());
4360   forwTrayAWing->SetFillStyle(4000); // 0% transparent
4361
4362   TGeoVolume *forwTrayAPlane = new TGeoVolume("ITSsuppSPDSideAForwTrayAPlane",
4363                                               forwTrayPlane, medAl);
4364
4365   forwTrayAPlane->SetVisibility(kTRUE);
4366   forwTrayAPlane->SetLineColor(6); // Purple
4367   forwTrayAPlane->SetLineWidth(1);
4368   forwTrayAPlane->SetFillColor(forwTrayAPlane->GetLineColor());
4369   forwTrayAPlane->SetFillStyle(4000); // 0% transparent
4370
4371   TGeoVolume *forwTrayAWall = new TGeoVolume("ITSsuppSPDSideAForwTrayAWall",
4372                                              forwTrayWall, medAl);
4373
4374   forwTrayAWall->SetVisibility(kTRUE);
4375   forwTrayAWall->SetLineColor(6); // Purple
4376   forwTrayAWall->SetLineWidth(1);
4377   forwTrayAWall->SetFillColor(forwTrayAWall->GetLineColor());
4378   forwTrayAWall->SetFillStyle(4000); // 0% transparent
4379
4380   TGeoVolume *extTrayAHorFace = new TGeoVolume("ITSsuppSPDSideAExtTrayHorFace",
4381                                                extTrayHorFace, medAl);
4382
4383   extTrayAHorFace->SetVisibility(kTRUE);
4384   extTrayAHorFace->SetLineColor(6); // Purple
4385   extTrayAHorFace->SetLineWidth(1);
4386   extTrayAHorFace->SetFillColor(extTrayAHorFace->GetLineColor());
4387   extTrayAHorFace->SetFillStyle(4000); // 0% transparent
4388
4389   TGeoVolume *extTrayAVerFace = new TGeoVolume("ITSsuppSPDSideAExtTrayVerFace",
4390                                                extTrayVerFace, medAl);
4391
4392   extTrayAVerFace->SetVisibility(kTRUE);
4393   extTrayAVerFace->SetLineColor(6); // Purple
4394   extTrayAVerFace->SetLineWidth(1);
4395   extTrayAVerFace->SetFillColor(extTrayAVerFace->GetLineColor());
4396   extTrayAVerFace->SetFillStyle(4000); // 0% transparent
4397
4398   TGeoVolume *extTrayAWall = new TGeoVolume("ITSsuppSPDSideAExtTrayWall",
4399                                             extTrayWall, medAl);
4400
4401   extTrayAWall->SetVisibility(kTRUE);
4402   extTrayAWall->SetLineColor(6); // Purple
4403   extTrayAWall->SetLineWidth(1);
4404   extTrayAWall->SetFillColor(extTrayAWall->GetLineColor());
4405   extTrayAWall->SetFillStyle(4000); // 0% transparent
4406
4407   TGeoVolume *forwCoolTube = new TGeoVolume("ITSsuppSPDSideAForwTrayCoolTube",
4408                                             coolTubeForw, medIn);
4409
4410   forwCoolTube->SetVisibility(kTRUE);
4411   forwCoolTube->SetLineColor(kGray); // as in GeometrySPD
4412   forwCoolTube->SetLineWidth(1);
4413   forwCoolTube->SetFillColor(forwCoolTube->GetLineColor());
4414   forwCoolTube->SetFillStyle(4000); // 0% transparent
4415
4416   TGeoVolume *forwCoolFreon = new TGeoVolume("ITSsuppSPDSideAForwTrayFreon",
4417                                              freonTubeForw, medFreon);
4418
4419   forwCoolFreon->SetVisibility(kTRUE);
4420   forwCoolFreon->SetLineColor(kBlue); // Blue
4421   forwCoolFreon->SetLineWidth(1);
4422   forwCoolFreon->SetFillColor(forwCoolFreon->GetLineColor());
4423   forwCoolFreon->SetFillStyle(4000); // 0% transparent
4424
4425   TGeoVolume *extCoolTube = new TGeoVolume("ITSsuppSPDSideAExtTrayCoolTube",
4426                                            coolTubeExt, medIn);
4427
4428   extCoolTube->SetVisibility(kTRUE);
4429   extCoolTube->SetLineColor(kGray); // as in GeometrySPD
4430   extCoolTube->SetLineWidth(1);
4431   extCoolTube->SetFillColor(extCoolTube->GetLineColor());
4432   extCoolTube->SetFillStyle(4000); // 0% transparent
4433
4434   TGeoVolume *extCoolFreon = new TGeoVolume("ITSsuppSPDSideAExtTrayFreon",
4435                                             freonTubeExt, medFreon);
4436
4437   extCoolFreon->SetVisibility(kTRUE);
4438   extCoolFreon->SetLineColor(kBlue); // Blue
4439   extCoolFreon->SetLineWidth(1);
4440   extCoolFreon->SetFillColor(extCoolFreon->GetLineColor());
4441   extCoolFreon->SetFillStyle(4000); // 0% transparent
4442
4443   TGeoVolume *forwOptFibs = new TGeoVolume("ITSsuppSPDSideAForwTrayOptFibs",
4444                                            optFibsForw, medFibs);
4445
4446   forwOptFibs->SetVisibility(kTRUE);
4447   forwOptFibs->SetLineColor(kOrange); // Orange
4448   forwOptFibs->SetLineWidth(1);
4449   forwOptFibs->SetFillColor(forwOptFibs->GetLineColor());
4450   forwOptFibs->SetFillStyle(4000); // 0% transparent
4451
4452   TGeoVolume *extOptFibs = new TGeoVolume("ITSsuppSPDSideAExtTrayOptFibs",
4453                                           optFibsExt, medFibs);
4454
4455   extOptFibs->SetVisibility(kTRUE);
4456   extOptFibs->SetLineColor(kOrange); // Orange
4457   extOptFibs->SetLineWidth(1);
4458   extOptFibs->SetFillColor(extOptFibs->GetLineColor());
4459   extOptFibs->SetFillStyle(4000); // 0% transparent
4460
4461   TGeoVolume *forwLowCabsCu = new TGeoVolume("ITSsuppSPDSideAForwLowCabsCu",
4462                                              lowCablesForwCu, medCu);
4463
4464   forwLowCabsCu->SetVisibility(kTRUE);
4465   forwLowCabsCu->SetLineColor(kRed); // Red
4466   forwLowCabsCu->SetLineWidth(1);
4467   forwLowCabsCu->SetFillColor(forwLowCabsCu->GetLineColor());
4468   forwLowCabsCu->SetFillStyle(4000); // 0% transparent
4469
4470   TGeoVolume *forwLowCabsPUR = new TGeoVolume("ITSsuppSPDSideAForwLowCabsPUR",
4471                                               lowCablesForwPUR, medPUR);
4472
4473   forwLowCabsPUR->SetVisibility(kTRUE);
4474   forwLowCabsPUR->SetLineColor(kBlack); // Black
4475   forwLowCabsPUR->SetLineWidth(1);
4476   forwLowCabsPUR->SetFillColor(forwLowCabsPUR->GetLineColor());
4477   forwLowCabsPUR->SetFillStyle(4000); // 0% transparent
4478
4479   TGeoVolume *extLowCabsCu = new TGeoVolume("ITSsuppSPDSideAExtLowCabsCu",
4480                                             lowCablesExtCu, medCu);
4481
4482   extLowCabsCu->SetVisibility(kTRUE);
4483   extLowCabsCu->SetLineColor(kRed); // Red
4484   extLowCabsCu->SetLineWidth(1);
4485   extLowCabsCu->SetFillColor(extLowCabsCu->GetLineColor());
4486   extLowCabsCu->SetFillStyle(4000); // 0% transparent
4487
4488   TGeoVolume *extLowCabsPUR = new TGeoVolume("ITSsuppSPDSideAExtLowCabsPUR",
4489                                              lowCablesExtPUR, medPUR);
4490
4491   extLowCabsPUR->SetVisibility(kTRUE);
4492   extLowCabsPUR->SetLineColor(kBlack); // Black
4493   extLowCabsPUR->SetLineWidth(1);
4494   extLowCabsPUR->SetFillColor(extLowCabsPUR->GetLineColor());
4495   extLowCabsPUR->SetFillStyle(4000); // 0% transparent
4496
4497   TGeoVolume *forwHiCabsCu = new TGeoVolume("ITSsuppSPDSideAForwTrayHiCabsCu",
4498                                             hiCablesForwCu, medCu);
4499
4500   forwHiCabsCu->SetVisibility(kTRUE);
4501   forwHiCabsCu->SetLineColor(kRed); // Red
4502   forwHiCabsCu->SetLineWidth(1);
4503   forwHiCabsCu->SetFillColor(forwHiCabsCu->GetLineColor());
4504   forwHiCabsCu->SetFillStyle(4000); // 0% transparent
4505
4506   TGeoVolume *forwHiCabsPUR = new TGeoVolume("ITSsuppSPDSideAForwTrayHiCabsPUR",
4507                                              hiCablesForwPUR, medPUR);
4508
4509   forwHiCabsPUR->SetVisibility(kTRUE);
4510   forwHiCabsPUR->SetLineColor(kBlack); // Black
4511   forwHiCabsPUR->SetLineWidth(1);
4512   forwHiCabsPUR->SetFillColor(forwHiCabsPUR->GetLineColor());
4513   forwHiCabsPUR->SetFillStyle(4000); // 0% transparent
4514
4515   TGeoVolume *extHiCabsCu = new TGeoVolume("ITSsuppSPDSideAExtTrayHiCabsCu",
4516                                            hiCablesExtCu, medCu);
4517
4518   extHiCabsCu->SetVisibility(kTRUE);
4519   extHiCabsCu->SetLineColor(kRed); // Red
4520   extHiCabsCu->SetLineWidth(1);
4521   extHiCabsCu->SetFillColor(extHiCabsCu->GetLineColor());
4522   extHiCabsCu->SetFillStyle(4000); // 0% transparent
4523
4524   TGeoVolume *extHiCabsPUR = new TGeoVolume("ITSsuppSPDSideAExtTrayHiCabsPUR",
4525                                             hiCablesExtPUR, medPUR);
4526
4527   extHiCabsPUR->SetVisibility(kTRUE);
4528   extHiCabsPUR->SetLineColor(kBlack); // Black
4529   extHiCabsPUR->SetLineWidth(1);
4530   extHiCabsPUR->SetFillColor(extHiCabsPUR->GetLineColor());
4531   extHiCabsPUR->SetFillStyle(4000); // 0% transparent
4532
4533   TGeoVolume *forwCoaxCu = new TGeoVolume("ITSsuppSPDSideAForwTrayCoaxCu",
4534                                           coaxCablesForwCu, medCu);
4535
4536   forwCoaxCu->SetVisibility(kTRUE);
4537   forwCoaxCu->SetLineColor(kRed); // Red
4538   forwCoaxCu->SetLineWidth(1);
4539   forwCoaxCu->SetFillColor(forwCoaxCu->GetLineColor());
4540   forwCoaxCu->SetFillStyle(4000); // 0% transparent
4541
4542   TGeoVolume *forwCoaxMeg = new TGeoVolume("ITSsuppSPDSideAForwTrayCoaxMeg",
4543                                            coaxCablesForwMeg, medMeg);
4544
4545   forwCoaxMeg->SetVisibility(kTRUE);
4546   forwCoaxMeg->SetLineColor(kBlack); // Black
4547   forwCoaxMeg->SetLineWidth(1);
4548   forwCoaxMeg->SetFillColor(forwCoaxMeg->GetLineColor());
4549   forwCoaxMeg->SetFillStyle(4000); // 0% transparent
4550
4551   TGeoVolume *extCoaxCu = new TGeoVolume("ITSsuppSPDSideAExtTrayCoaxCu",
4552                                          coaxCablesExtCu, medCu);
4553
4554   extCoaxCu->SetVisibility(kTRUE);
4555   extCoaxCu->SetLineColor(kRed); // Red
4556   extCoaxCu->SetLineWidth(1);
4557   extCoaxCu->SetFillColor(extCoaxCu->GetLineColor());
4558   extCoaxCu->SetFillStyle(4000); // 0% transparent
4559
4560   TGeoVolume *extCoaxMeg = new TGeoVolume("ITSsuppSPDSideAExtTrayCoaxMeg",
4561                                           coaxCablesExtMeg, medMeg);
4562
4563   extCoaxMeg->SetVisibility(kTRUE);
4564   extCoaxMeg->SetLineColor(kBlack); // Black
4565   extCoaxMeg->SetLineWidth(1);
4566   extCoaxMeg->SetFillColor(extCoaxMeg->GetLineColor());
4567   extCoaxMeg->SetFillStyle(4000); // 0% transparent
4568
4569
4570   // Now build up the trays
4571   yloc = forwTrayLowerFace->GetDY();
4572   zloc = forwTrayLowerFace->GetDZ();
4573   cableTrayAForw->AddNode(forwTrayABase, 1,
4574                       new TGeoTranslation(0, yloc, zloc));
4575
4576   xloc = kForwardTrayWide/2;
4577   cableTrayAForw->AddNode(forwTrayASide, 1,
4578                       new TGeoCombiTrans( xloc, 0, 0,
4579                                          new TGeoRotation("",90,-90,-90)));
4580   cableTrayAForw->AddNode(forwTrayASide, 2,
4581                       new TGeoCombiTrans(-xloc+kForwardTrayThick, 0, 0,
4582                                          new TGeoRotation("",90,-90,-90)));
4583
4584   yloc = kForwardTrayFirstHigh - forwTrayShortCover->GetDY();
4585   zloc = forwTrayShortCover->GetDZ();
4586   cableTrayAForw->AddNode(forwTrayACoverShort, 1,
4587                       new TGeoTranslation(0, yloc, zloc));
4588
4589   yloc = kForwardTraySecondHigh - forwTrayLongCover->GetDY();
4590   zloc = kForwardTrayFirstLen + forwTrayLongCover->GetDZ();
4591   cableTrayAForw->AddNode(forwTrayACoverLong, 1,
4592                       new TGeoTranslation(0, yloc, zloc));
4593
4594   xloc = kForwardTrayWide/2 - kForwardTrayThick - forwTrayWing->GetDX();
4595   yloc = kForwardTrayFirstHigh - kForwardTrayThick - forwTrayWing->GetDY();
4596   zloc = kForwardTrayFirstLen - forwTrayWing->GetDZ();
4597   cableTrayAForw->AddNode(forwTrayAWing, 1,
4598                       new TGeoTranslation( xloc, yloc, zloc));
4599   cableTrayAForw->AddNode(forwTrayAWing, 2,
4600                       new TGeoTranslation(-xloc, yloc, zloc));
4601
4602   yloc = kForwardTrayThick + kForwardTrayInterSpace - forwTrayPlane->GetDY();
4603   zloc = forwTrayPlane->GetDZ();
4604   cableTrayAForw->AddNode(forwTrayAPlane, 1,
4605                       new TGeoTranslation(0, yloc, zloc));
4606
4607   yloc = kForwardTrayThick + forwTrayWall->GetDY();
4608   zloc = forwTrayWall->GetDZ();
4609   cableTrayAForw->AddNode(forwTrayAWall, 1,
4610                       new TGeoTranslation(0, yloc, zloc));
4611
4612   forwCoolTube->AddNode(forwCoolFreon, 1, 0);
4613
4614   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY()
4615        + coolTubeForw->GetRmax();
4616   zloc = coolTubeForw->GetDz();
4617   cableTrayAForw->AddNode(forwCoolTube, 1,
4618                       new TGeoTranslation(0, yloc, zloc));
4619
4620   xloc = optFibsForw->GetZ(1) + coolTubeForw->GetRmax();
4621   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4622   cableTrayAForw->AddNode(forwOptFibs, 1,
4623                       new TGeoCombiTrans( xloc, yloc, 0,
4624                                          new TGeoRotation("",-90.,90.,90.)));
4625
4626   xloc = lowCablesForwCu->GetZ(1) + coolTubeForw->GetRmax();
4627   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4628   cableTrayAForw->AddNode(forwLowCabsCu, 1,
4629                       new TGeoCombiTrans(-xloc, yloc, 0,
4630                                          new TGeoRotation("",-90.,90.,90.)));
4631   cableTrayAForw->AddNode(forwLowCabsPUR, 1,
4632                       new TGeoCombiTrans(-xloc, yloc, 0,
4633                                          new TGeoRotation("",-90.,90.,90.)));
4634
4635   xloc = 2*lowCablesForwCu->GetZ(1) +
4636          hiCablesForwCu->GetZ(1) + coolTubeForw->GetRmax();
4637   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4638   cableTrayAForw->AddNode(forwHiCabsCu, 1,
4639                       new TGeoCombiTrans(-xloc, yloc, 0,
4640                                          new TGeoRotation("",-90.,90.,90.)));
4641   cableTrayAForw->AddNode(forwHiCabsPUR, 1,
4642                       new TGeoCombiTrans(-xloc, yloc, 0,
4643                                          new TGeoRotation("",-90.,90.,90.)));
4644
4645   xloc = 2*optFibsForw->GetZ(1) + coaxCablesForwCu->GetZ(1) +
4646          coolTubeForw->GetRmax();
4647   yloc = 2*kForwardTrayThick + 2*forwTrayWall->GetDY();
4648   cableTrayAForw->AddNode(forwCoaxCu, 1,
4649                       new TGeoCombiTrans( xloc, yloc, 0,
4650                                          new TGeoRotation("",-90.,90.,90.)));
4651   cableTrayAForw->AddNode(forwCoaxMeg, 1,
4652                       new TGeoCombiTrans( xloc, yloc, 0,
4653                                          new TGeoRotation("",-90.,90.,90.)));
4654
4655   // To simplify following placement in MARS, origin is on top
4656   yloc = -kExternalTrayHigh + kExternalTrayThick/2;
4657   zloc = kExternalTrayLen/2;
4658   cableTrayAExt->AddNode(extTrayAHorFace, 1,
4659                       new TGeoTranslation( 0, yloc, zloc));
4660
4661   xloc = kExternalTrayWide/2 - kExternalTrayThick/2;
4662   yloc = -kExternalTrayHigh/2;
4663   cableTrayAExt->AddNode(extTrayAVerFace, 1,
4664                       new TGeoTranslation( xloc, yloc, zloc));
4665   cableTrayAExt->AddNode(extTrayAVerFace, 2,
4666                       new TGeoTranslation(-xloc, yloc, zloc));
4667
4668   yloc = -kExternalTrayThick/2;
4669   cableTrayAExt->AddNode(extTrayAHorFace, 2,
4670                       new TGeoTranslation( 0, yloc, zloc));
4671
4672   yloc = -kExternalTrayHigh
4673        + kExternalTrayThick + kForwardTrayInterSpace - kExternalTrayThick/2;
4674   cableTrayAExt->AddNode(extTrayAHorFace, 3,
4675                       new TGeoTranslation( 0, yloc, zloc));
4676
4677   yloc = -kExternalTrayHigh + kExternalTrayThick + extTrayWall->GetDY();
4678   cableTrayAExt->AddNode(extTrayAWall, 1,
4679                       new TGeoTranslation( 0, yloc, zloc));
4680
4681   extCoolTube->AddNode(extCoolFreon, 1, 0);
4682
4683   yloc = -kExternalTrayHigh + 2*kExternalTrayThick + 2*extTrayWall->GetDY()
4684        + coolTubeExt->GetRmax();
4685   zloc = coolTubeExt->GetDz();
4686   cableTrayAExt->AddNode(extCoolTube, 1,
4687                       new TGeoTranslation(0, yloc, zloc));
4688
4689   xloc = optFibsExt->GetZ(1) + coolTubeExt->GetRmax();
4690   cableTrayAExt->AddNode(extOptFibs, 1,
4691                       new TGeoCombiTrans( xloc, 0, 0,
4692                                          new TGeoRotation("",90,-90,-90)));
4693
4694   xloc = coolTubeExt->GetRmax();
4695   cableTrayAExt->AddNode(extLowCabsCu, 1,
4696                       new TGeoCombiTrans(-xloc, 0, 0,
4697                                          new TGeoRotation("",90,-90,-90)));
4698   cableTrayAExt->AddNode(extLowCabsPUR, 1,
4699                       new TGeoCombiTrans(-xloc, 0, 0,
4700                                          new TGeoRotation("",90,-90,-90)));
4701
4702   xloc = lowCablesExtCu->GetZ(1) + coolTubeExt->GetRmax();
4703   cableTrayAExt->AddNode(extHiCabsCu, 1,
4704                       new TGeoCombiTrans(-xloc, 0, 0,
4705                                          new TGeoRotation("",90,-90,-90)));
4706   cableTrayAExt->AddNode(extHiCabsPUR, 1,
4707                       new TGeoCombiTrans(-xloc, 0, 0,
4708                                          new TGeoRotation("",90,-90,-90)));
4709
4710   xloc = coaxCablesExtCu->GetZ(1) + optFibsExt->GetZ(1) +
4711          coolTubeExt->GetRmax();
4712   cableTrayAExt->AddNode(extCoaxCu, 1,
4713                       new TGeoCombiTrans( xloc, 0, 0,
4714                                          new TGeoRotation("",90,-90,-90)));
4715   cableTrayAExt->AddNode(extCoaxMeg, 1,
4716                       new TGeoCombiTrans( xloc, 0, 0,
4717                                          new TGeoRotation("",90,-90,-90)));
4718
4719
4720   // Finally put everything in the mother volume
4721   Double_t rExtTray = kTrayAR2Trans + kExternalTrayHigh;
4722
4723   moth->AddNode(cableTrayAForw,1,
4724                 new TGeoTranslation( 0, kTrayAR1Trans, kTrayAZTrans));
4725   moth->AddNode(cableTrayAForw,2,
4726                 new TGeoCombiTrans(  0,-kTrayAR1Trans, kTrayAZTrans,
4727                                     new TGeoRotation("",180, 0, 0)));
4728
4729   yloc = kTrayAR1Trans + kExternalTrayHigh;
4730   zloc = kTrayAZTrans + kForwardTrayTotalLen;
4731   moth->AddNode(cableTrayAExt,1,
4732                 new TGeoCombiTrans( 0, yloc, zloc,
4733                                     new TGeoRotation("",  0,-kTrayAZRot, 0)));
4734   moth->AddNode(cableTrayAExt,2,
4735                 new TGeoCombiTrans( 0,-yloc, zloc,
4736                                     new TGeoRotation("",180,-kTrayAZRot, 0)));
4737
4738   alpharot = kTrayAFirstRotAng + kTrayASecondRotAng;
4739   xloc = kTrayAR2Trans*SinD(alpharot);
4740   yloc = kTrayAR2Trans*CosD(alpharot);
4741   moth->AddNode(cableTrayAForw,3,
4742                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4743                             new TGeoRotation("",-alpharot,0,0)   )   );
4744   xloc = rExtTray*SinD(alpharot);
4745   yloc = rExtTray*CosD(alpharot);
4746   moth->AddNode(cableTrayAExt,3,
4747                             new TGeoCombiTrans( xloc, yloc, zloc,
4748                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4749
4750   alpharot += 180;
4751   xloc = kTrayAR2Trans*SinD(alpharot);
4752   yloc = kTrayAR2Trans*CosD(alpharot);
4753   moth->AddNode(cableTrayAForw,4,
4754                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4755                             new TGeoRotation("",-alpharot,0,0)   )   );
4756   xloc = rExtTray*SinD(alpharot);
4757   yloc = rExtTray*CosD(alpharot);
4758   moth->AddNode(cableTrayAExt,4,
4759                             new TGeoCombiTrans( xloc, yloc, zloc,
4760                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4761
4762   alpharot = - kTrayAFirstRotAng - kTrayASecondRotAng;
4763   xloc = kTrayAR2Trans*SinD(alpharot);
4764   yloc = kTrayAR2Trans*CosD(alpharot);
4765   moth->AddNode(cableTrayAForw,5,
4766                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4767                             new TGeoRotation("",-alpharot,0,0)   )   );
4768   xloc = rExtTray*SinD(alpharot);
4769   yloc = rExtTray*CosD(alpharot);
4770   moth->AddNode(cableTrayAExt,5,
4771                             new TGeoCombiTrans( xloc, yloc, zloc,
4772                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4773
4774   alpharot += 180;
4775   xloc = kTrayAR2Trans*SinD(alpharot);
4776   yloc = kTrayAR2Trans*CosD(alpharot);
4777   moth->AddNode(cableTrayAForw,6,
4778                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4779                             new TGeoRotation("",-alpharot,0,0)   )   );
4780   xloc = rExtTray*SinD(alpharot);
4781   yloc = rExtTray*CosD(alpharot);
4782   moth->AddNode(cableTrayAExt,6,
4783                             new TGeoCombiTrans( xloc, yloc, zloc,
4784                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4785
4786   alpharot = kTrayAFirstRotAng + 3*kTrayASecondRotAng;
4787   xloc = kTrayAR2Trans*SinD(alpharot);
4788   yloc = kTrayAR2Trans*CosD(alpharot);
4789   moth->AddNode(cableTrayAForw,7,
4790                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4791                             new TGeoRotation("",-alpharot,0,0)   )   );
4792   xloc = rExtTray*SinD(alpharot);
4793   yloc = rExtTray*CosD(alpharot);
4794   moth->AddNode(cableTrayAExt,7,
4795                             new TGeoCombiTrans( xloc, yloc, zloc,
4796                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4797
4798   alpharot += 180;
4799   xloc = kTrayAR2Trans*SinD(alpharot);
4800   yloc = kTrayAR2Trans*CosD(alpharot);
4801   moth->AddNode(cableTrayAForw,8,
4802                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4803                             new TGeoRotation("",-alpharot,0,0)   )   );
4804   xloc = rExtTray*SinD(alpharot);
4805   yloc = rExtTray*CosD(alpharot);
4806   moth->AddNode(cableTrayAExt,8,
4807                             new TGeoCombiTrans( xloc, yloc, zloc,
4808                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4809
4810   alpharot = - kTrayAFirstRotAng - 3*kTrayASecondRotAng;
4811   xloc = kTrayAR2Trans*SinD(alpharot);
4812   yloc = kTrayAR2Trans*CosD(alpharot);
4813   moth->AddNode(cableTrayAForw,9,
4814                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4815                             new TGeoRotation("",-alpharot,0,0)   )   );
4816   xloc = rExtTray*SinD(alpharot);
4817   yloc = rExtTray*CosD(alpharot);
4818   moth->AddNode(cableTrayAExt,9,
4819                             new TGeoCombiTrans( xloc, yloc, zloc,
4820                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4821
4822   alpharot += 180;
4823   xloc = kTrayAR2Trans*SinD(alpharot);
4824   yloc = kTrayAR2Trans*CosD(alpharot);
4825   moth->AddNode(cableTrayAForw,10,
4826                             new TGeoCombiTrans( xloc, yloc, kTrayAZTrans,
4827                             new TGeoRotation("",-alpharot,0,0)   )   );
4828   xloc = rExtTray*SinD(alpharot);
4829   yloc = rExtTray*CosD(alpharot);
4830   moth->AddNode(cableTrayAExt,10,
4831                             new TGeoCombiTrans( xloc, yloc, zloc,
4832                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
4833
4834
4835   return;
4836 }
4837
4838 //______________________________________________________________________
4839 void AliITSv11GeometrySupport::SPDCableTraysSideC(TGeoVolume *moth,
4840                                             const TGeoManager *mgr){
4841 //
4842 // Creates the SPD cable trays which are outside the ITS support cones
4843 // but still inside the TPC on Side C
4844 // (part of this code is taken or anyway inspired to ServicesCableSupport
4845 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
4846 //
4847 // Input:
4848 //         moth : the TGeoVolume owing the volume structure
4849 //         mgr  : the GeoManager (default gGeoManager)
4850 // Output:
4851 //
4852 // Return:
4853 //
4854 // Created:         ???       Bjorn S. Nilsen
4855 // Updated:      22 Apr 2010  Mario Sitta
4856 // Updated:      10 Jun 2010  Mario Sitta  Freon inside cooling pipes
4857 // Updated:      08 Sep 2010  Mario Sitta
4858 // Updated:      14 Sep 2010  Mario Sitta  Cables prolonged till cone
4859 // Updated:      20 Dec 2011  Mario Sitta  Composite vol to avoid new overlap
4860 //
4861 // Technical data are taken from AutoCAD drawings and other (oral)
4862 // information given by D.Elia
4863 // Optical fibers and voltage cables are approximated with mean materials
4864 // and square cross sections, but preserving the total material budget.
4865 //
4866
4867   // Dimensions and positions of the C-Side Cable Tray elements
4868   const Int_t    kNumTraysSideC       =   10;
4869
4870   const Double_t kTrayCCablesOutRot   =   75.000 *fgkDegree;// Computed
4871   const Double_t kTrayCCablesZLenOut  =  245.000 *fgkmm;// Computed
4872
4873   const Double_t kTrayCHalfWide       =    6.350 *fgkcm;
4874   const Double_t kTrayCLength1        =  172.800 *fgkcm;
4875   const Double_t kTrayCLength2        =  189.300 *fgkcm;
4876   const Double_t kTrayCFirstLen       =  435.000 *fgkmm;
4877   const Double_t kTrayCFirstHigh      =   83.000 *fgkmm;//!!!TO BE CHECKED!!!
4878   const Double_t kTrayCSecondHigh     =   52.700 *fgkmm;//!!!TO BE CHECKED!!!
4879   const Double_t kTrayCThick          =    0.200 *fgkcm;
4880   const Double_t kTrayCInterSpace     =   18.000 *fgkmm;//!!!TO BE CHECKED!!!
4881   const Double_t kTrayCFoldAngle      =    5.000 *fgkDegree;
4882
4883   const Double_t kCoolingTubeRmin     =    2.000 *fgkmm;
4884   const Double_t kCoolingTubeRmax     =    3.000 *fgkmm;
4885   const Double_t kOpticalFibersSect   =    8.696 *fgkmm;//!!!ESTIMATED!!!
4886   const Double_t kLowVoltCableSectCu  =    7.675 *fgkmm;// Computed
4887   const Double_t kLowVoltCableHighPUR =    1.000 *fgkmm;// Computed
4888   const Double_t kHiVoltCableSectCu   =    1.535 *fgkmm;// Computed
4889   const Double_t kHiVoltCableHighPUR  =    0.500 *fgkmm;// Computed
4890   const Double_t kCoaxCableSectCu     =    6.024 *fgkmm;// Computed
4891   const Double_t kCoaxCableHighMeg    =    5.695 *fgkmm;// Computed
4892
4893   const Double_t kCablesYtrans        =    2.500 *fgkmm;// Avoid ovlps
4894
4895   // Overall position and rotation of the C-Side Cable Trays
4896   const Double_t kTraySideCRPos       =   45.300 *fgkcm;
4897   const Double_t kTraySideCZPos       = -102.400 *fgkcm;
4898   const Double_t kTraySideCAlphaRot[kNumTraysSideC/2]  =
4899     {    0.0,      41.0,     -41.0,      76.0,      -76.0};
4900   // From position of the other trays
4901
4902
4903   // Local variables
4904   Double_t xprof[8], yprof[8];
4905   Double_t xloc, yloc, zloc, delta, alpharot;
4906
4907
4908   // The single C-Side Cable tray as an assembly
4909   TGeoVolumeAssembly *cableTrayC = new TGeoVolumeAssembly("ITSsupportSPDTrayC");
4910
4911   // First create all needed shapes
4912
4913   // The Cable Tray lower face: a Xtru
4914   TGeoXtru *sideCHorFace = new TGeoXtru(2);
4915   sideCHorFace->SetName("ITSsuppSPDTraySideCHor");
4916
4917   xprof[0] = 0.;
4918   yprof[0] = 0.;
4919   xprof[1] = kTrayCLength1;
4920   yprof[1] = 0.;
4921   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
4922   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
4923   xprof[3] = xprof[2] - kTrayCThick*SinD(kTrayCFoldAngle);
4924   yprof[3] = yprof[2] + kTrayCThick*CosD(kTrayCFoldAngle);
4925   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
4926               kTrayCThick , xprof[4], yprof[4]);
4927   xprof[5] = 0.;
4928   yprof[5] = kTrayCThick;
4929
4930   delta = kTrayCHalfWide - kTrayCThick;
4931
4932   sideCHorFace->DefinePolygon(6, xprof, yprof);
4933   sideCHorFace->DefineSection(0,-delta);
4934   sideCHorFace->DefineSection(1, delta);
4935
4936   // The Cable Tray middle face: a Xtru
4937   // (somehow duplicate of HorFace, but in this way avoid an overlap with Wall)
4938   TGeoXtru *sideCMidFace = new TGeoXtru(2);
4939
4940   xprof[0] = 0.;
4941   yprof[0] = kTrayCInterSpace + kTrayCThick;
4942   xprof[1] = kTrayCLength1;
4943   yprof[1] = yprof[0];
4944   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
4945   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
4946   xprof[3] = xprof[2] - kTrayCThick*SinD(kTrayCFoldAngle);
4947   yprof[3] = yprof[2] + kTrayCThick*CosD(kTrayCFoldAngle);
4948   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
4949               kTrayCThick , xprof[4], yprof[4]);
4950   xprof[5] = 0.;
4951   yprof[5] = yprof[0] + kTrayCThick;
4952
4953   delta = kTrayCHalfWide - kTrayCThick;
4954
4955   sideCMidFace->DefinePolygon(6, xprof, yprof);
4956   sideCMidFace->DefineSection(0,-delta);
4957   sideCMidFace->DefineSection(1, delta);
4958
4959   // The Cable Tray lower face: a Xtru
4960   TGeoXtru *sideCSideFace = new TGeoXtru(2);
4961
4962   xprof[0] = 0.;
4963   yprof[0] = 0.;
4964   xprof[1] = kTrayCLength1;
4965   yprof[1] = 0.;
4966   xprof[2] = xprof[1] + kTrayCLength2*CosD(kTrayCFoldAngle);
4967   yprof[2] = yprof[1] + kTrayCLength2*SinD(kTrayCFoldAngle);
4968   xprof[3] = xprof[2] - kTrayCSecondHigh*SinD(kTrayCFoldAngle);
4969   yprof[3] = yprof[2] + kTrayCSecondHigh*CosD(kTrayCFoldAngle);
4970   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
4971               kTrayCSecondHigh , xprof[4], yprof[4]);
4972   xprof[5] = kTrayCFirstLen;
4973   yprof[5] = kTrayCSecondHigh;
4974   xprof[6] = xprof[5];
4975   yprof[6] = kTrayCFirstHigh;
4976   xprof[7] = xprof[0];
4977   yprof[7] = yprof[6];
4978
4979   sideCSideFace->DefinePolygon(8, xprof, yprof);
4980   sideCSideFace->DefineSection(0, 0);
4981   sideCSideFace->DefineSection(1, kTrayCThick);
4982
4983   // The short cover: a BBox
4984   TGeoBBox *sideCShortCover = new TGeoBBox(kTrayCFirstLen/2,
4985                                            kTrayCThick/2,
4986                                            kTrayCHalfWide-kTrayCThick);
4987
4988   // The long cover: a Xtru
4989   TGeoXtru *sideCLongCover = new TGeoXtru(2);
4990
4991   xprof[5] = sideCSideFace->GetX(5);
4992   yprof[5] = sideCSideFace->GetY(5);
4993   xprof[4] = sideCSideFace->GetX(4);
4994   yprof[4] = sideCSideFace->GetY(4);
4995   xprof[3] = sideCSideFace->GetX(3);
4996   yprof[3] = sideCSideFace->GetY(3);
4997   xprof[2] = xprof[3] + kTrayCThick*SinD(kTrayCFoldAngle);
4998   yprof[2] = yprof[3] - kTrayCThick*CosD(kTrayCFoldAngle);
4999   InsidePoint(xprof[5], yprof[5], xprof[4], yprof[4], xprof[3], yprof[3],
5000              -kTrayCThick , xprof[1], yprof[1]);
5001   xprof[0] = xprof[5];
5002   yprof[0] = yprof[5] - kTrayCThick;
5003
5004   delta = kTrayCHalfWide - kTrayCThick;
5005
5006   sideCLongCover->DefinePolygon(6, xprof, yprof);
5007   sideCLongCover->DefineSection(0,-delta);
5008   sideCLongCover->DefineSection(1, delta);
5009
5010   // The internal wall: a Xtru
5011   TGeoXtru *intWall = new TGeoXtru(2);
5012   intWall->SetName("ITSsuppSPDTraySideCWall");
5013
5014   xprof[0] = sideCHorFace->GetX(5);
5015   yprof[0] = sideCHorFace->GetY(5);
5016   xprof[1] = sideCHorFace->GetX(4);
5017   yprof[1] = sideCHorFace->GetY(4);
5018   xprof[2] = sideCHorFace->GetX(3);
5019   yprof[2] = sideCHorFace->GetY(3);
5020   xprof[3] = sideCMidFace->GetX(2);
5021   yprof[3] = sideCMidFace->GetY(2);
5022   xprof[4] = sideCMidFace->GetX(1);
5023   yprof[4] = sideCMidFace->GetY(1);
5024   xprof[5] = sideCMidFace->GetX(0);
5025   yprof[5] = sideCMidFace->GetY(0);
5026
5027   intWall->DefinePolygon(6, xprof, yprof);
5028   intWall->DefineSection(0,-kTrayCThick/2);
5029   intWall->DefineSection(1, kTrayCThick/2);
5030
5031   // The horizontal part of the cooling tube inside the tray: a Tube
5032   delta = sideCMidFace->GetX(4) - sideCMidFace->GetX(5);
5033   TGeoTube *horTube = new TGeoTube(0, kCoolingTubeRmax, delta/2);
5034
5035   // The freon inside the horizontal part of the cooling tube: a Tube
5036   TGeoTube *horFreon = new TGeoTube(0, kCoolingTubeRmin, delta/2);
5037
5038   // The inclined part of the cooling tube inside the tray: a Ctub
5039   Double_t x3, y3, x4, y4;
5040   x3 = sideCMidFace->GetX(3);
5041   y3 = sideCMidFace->GetY(3);
5042   x4 = sideCMidFace->GetX(4);
5043   y4 = sideCMidFace->GetY(4);
5044   delta = TMath::Sqrt( (x4 - x3 + kCoolingTubeRmax*SinD(kTrayCFoldAngle))*
5045                        (x4 - x3 + kCoolingTubeRmax*SinD(kTrayCFoldAngle))    +
5046        (y4 + kCoolingTubeRmax - y3 - kCoolingTubeRmax*SinD(kTrayCFoldAngle))*
5047        (y4 + kCoolingTubeRmax - y3 - kCoolingTubeRmax*SinD(kTrayCFoldAngle)) );
5048
5049   TGeoCtub *incTube = new TGeoCtub(0, kCoolingTubeRmax, delta/2, 0, 360,
5050                                0, SinD(kTrayCFoldAngle),-CosD(kTrayCFoldAngle),
5051                                0,                     0,                    1);
5052
5053   // The freon inside the inclined part of the cooling tube: a Ctub
5054   TGeoCtub *incFreon = new TGeoCtub(0, kCoolingTubeRmin, delta/2, 0, 360,
5055                                0, SinD(kTrayCFoldAngle),-CosD(kTrayCFoldAngle),
5056                                0,                     0,                    1);
5057
5058   // The part of the cooling tube outside the tray: a Ctub
5059   TGeoCtub *outTube = new TGeoCtub(0, kCoolingTubeRmax,
5060                         0.5*kTrayCCablesZLenOut/SinD(kTrayCCablesOutRot),
5061                         0, 360,
5062                         0,                        0,                      -1,
5063                         0,-SinD(kTrayCCablesOutRot), CosD(kTrayCCablesOutRot));
5064
5065   // The freon inside the part of the cooling tube outside the tray: a Ctub
5066   TGeoCtub *outFreon = new TGeoCtub(0, kCoolingTubeRmin,
5067                         outTube->GetDz(),
5068                         0, 360,
5069                         0,                        0,                      -1,
5070                         0,-SinD(kTrayCCablesOutRot), CosD(kTrayCCablesOutRot));
5071
5072   // The optical fibers inside the tray: a Xtru
5073   TGeoXtru *optFibs = new TGeoXtru(2);
5074
5075   xprof[0] = -kTrayCCablesZLenOut;
5076   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
5077   xprof[1] = sideCMidFace->GetX(5);
5078   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
5079   xprof[2] = sideCMidFace->GetX(4);
5080   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
5081   xprof[3] = sideCMidFace->GetX(3);
5082   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
5083   xprof[4] = xprof[3] - kOpticalFibersSect*SinD(kTrayCFoldAngle);
5084   yprof[4] = yprof[3] + kOpticalFibersSect*CosD(kTrayCFoldAngle);
5085   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
5086               kOpticalFibersSect , xprof[5], yprof[5]);
5087   xprof[6] = 0.;
5088   yprof[6] = yprof[1] + kOpticalFibersSect;
5089   xprof[7] = xprof[0];
5090   yprof[7] = yprof[0] + kOpticalFibersSect;
5091
5092   optFibs->DefinePolygon(8, xprof, yprof);
5093   optFibs->DefineSection(0, 0);
5094   optFibs->DefineSection(1, kOpticalFibersSect);
5095
5096   // The low voltage cables inside the tray: two Xtru
5097   TGeoXtru *lowCablesCu = new TGeoXtru(2);
5098
5099   xprof[0] = -kTrayCCablesZLenOut;
5100   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
5101   xprof[1] = sideCMidFace->GetX(5);
5102   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
5103   xprof[2] = sideCMidFace->GetX(4);
5104   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
5105   xprof[3] = sideCMidFace->GetX(3);
5106   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
5107   xprof[4] = xprof[3] - kLowVoltCableSectCu*SinD(kTrayCFoldAngle);
5108   yprof[4] = yprof[3] + kLowVoltCableSectCu*CosD(kTrayCFoldAngle);
5109   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
5110               kLowVoltCableSectCu , xprof[5], yprof[5]);
5111   xprof[6] = 0.;
5112   yprof[6] = yprof[1] + kLowVoltCableSectCu;
5113   xprof[7] = xprof[0];
5114   yprof[7] = yprof[0] + kLowVoltCableSectCu;
5115
5116   lowCablesCu->DefinePolygon(8, xprof, yprof);
5117   lowCablesCu->DefineSection(0, 0);
5118   lowCablesCu->DefineSection(1, kLowVoltCableSectCu);
5119
5120   TGeoXtru *lowCablesPUR = new TGeoXtru(2);
5121
5122   xprof[0] = lowCablesCu->GetX(7);
5123   yprof[0] = lowCablesCu->GetY(7);
5124   xprof[1] = lowCablesCu->GetX(6);
5125   yprof[1] = lowCablesCu->GetY(6);
5126   xprof[2] = lowCablesCu->GetX(5);
5127   yprof[2] = lowCablesCu->GetY(5);
5128   xprof[3] = lowCablesCu->GetX(4);
5129   yprof[3] = lowCablesCu->GetY(4);
5130   xprof[4] = xprof[3] - kLowVoltCableHighPUR*SinD(kTrayCFoldAngle);
5131   yprof[4] = yprof[3] + kLowVoltCableHighPUR*CosD(kTrayCFoldAngle);
5132   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
5133               kLowVoltCableHighPUR , xprof[5], yprof[5]);
5134   xprof[6] = 0.;
5135   yprof[6] = yprof[1] + kLowVoltCableHighPUR;
5136   xprof[7] = xprof[0];
5137   yprof[7] = yprof[0] + kLowVoltCableHighPUR;
5138
5139   lowCablesPUR->DefinePolygon(8, xprof, yprof);
5140   lowCablesPUR->DefineSection(0, 0);
5141   lowCablesPUR->DefineSection(1, kLowVoltCableSectCu);
5142
5143   // The high voltage cables inside the tray: two Xtru
5144   TGeoXtru *hiCablesCu = new TGeoXtru(2);
5145
5146   xprof[0] = -kTrayCCablesZLenOut;
5147   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
5148   xprof[1] = sideCMidFace->GetX(5);
5149   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
5150   xprof[2] = sideCMidFace->GetX(4);
5151   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
5152   xprof[3] = sideCMidFace->GetX(3);
5153   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
5154   xprof[4] = xprof[3] - kHiVoltCableSectCu*SinD(kTrayCFoldAngle);
5155   yprof[4] = yprof[3] + kHiVoltCableSectCu*CosD(kTrayCFoldAngle);
5156   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
5157               kHiVoltCableSectCu , xprof[5], yprof[5]);
5158   xprof[6] = 0.;
5159   yprof[6] = yprof[1] + kHiVoltCableSectCu;
5160   xprof[7] = xprof[0];
5161   yprof[7] = yprof[0] + kHiVoltCableSectCu;
5162
5163   hiCablesCu->DefinePolygon(8, xprof, yprof);
5164   hiCablesCu->DefineSection(0, 0);
5165   hiCablesCu->DefineSection(1, kHiVoltCableSectCu);
5166
5167   TGeoXtru *hiCablesPUR = new TGeoXtru(2);
5168
5169   xprof[0] = hiCablesCu->GetX(7);
5170   yprof[0] = hiCablesCu->GetY(7);
5171   xprof[1] = hiCablesCu->GetX(6);
5172   yprof[1] = hiCablesCu->GetY(6);
5173   xprof[2] = hiCablesCu->GetX(5);
5174   yprof[2] = hiCablesCu->GetY(5);
5175   xprof[3] = hiCablesCu->GetX(4);
5176   yprof[3] = hiCablesCu->GetY(4);
5177   xprof[4] = xprof[3] - kHiVoltCableHighPUR*SinD(kTrayCFoldAngle);
5178   yprof[4] = yprof[3] + kHiVoltCableHighPUR*CosD(kTrayCFoldAngle);
5179   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
5180               kHiVoltCableHighPUR , xprof[5], yprof[5]);
5181   xprof[6] = 0.;
5182   yprof[6] = yprof[1] + kHiVoltCableHighPUR;
5183   xprof[7] = xprof[0];
5184   yprof[7] = yprof[0] + kHiVoltCableHighPUR;
5185
5186   hiCablesPUR->DefinePolygon(8, xprof, yprof);
5187   hiCablesPUR->DefineSection(0, 0);
5188   hiCablesPUR->DefineSection(1, kHiVoltCableSectCu);
5189
5190   // The coaxial cables inside the tray: two Xtru
5191   TGeoXtru *coaxCablesCu = new TGeoXtru(2);
5192
5193   xprof[0] = -kTrayCCablesZLenOut;
5194   yprof[0] = xprof[0]/TanD(kTrayCCablesOutRot);
5195   xprof[1] = sideCMidFace->GetX(5);
5196   yprof[1] = sideCMidFace->GetY(5) + kCablesYtrans;
5197   xprof[2] = sideCMidFace->GetX(4);
5198   yprof[2] = sideCMidFace->GetY(4) + kCablesYtrans;
5199   xprof[3] = sideCMidFace->GetX(3);
5200   yprof[3] = sideCMidFace->GetY(3) + kCablesYtrans;
5201   xprof[4] = xprof[3] - kCoaxCableSectCu*SinD(kTrayCFoldAngle);
5202   yprof[4] = yprof[3] + kCoaxCableSectCu*CosD(kTrayCFoldAngle);
5203   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
5204               kCoaxCableSectCu , xprof[5], yprof[5]);
5205   xprof[6] = 0.;
5206   yprof[6] = yprof[1] + kCoaxCableSectCu;
5207   xprof[7] = xprof[0];
5208   yprof[7] = yprof[0] + kCoaxCableSectCu;
5209
5210   coaxCablesCu->DefinePolygon(8, xprof, yprof);
5211   coaxCablesCu->DefineSection(0, 0);
5212   coaxCablesCu->DefineSection(1, kCoaxCableSectCu);
5213
5214   TGeoXtru *coaxCablesMeg = new TGeoXtru(2);
5215
5216   xprof[0] = coaxCablesCu->GetX(7);
5217   yprof[0] = coaxCablesCu->GetY(7);
5218   xprof[1] = coaxCablesCu->GetX(6);
5219   yprof[1] = coaxCablesCu->GetY(6);
5220   xprof[2] = coaxCablesCu->GetX(5);
5221   yprof[2] = coaxCablesCu->GetY(5);
5222   xprof[3] = coaxCablesCu->GetX(4);
5223   yprof[3] = coaxCablesCu->GetY(4);
5224   xprof[4] = xprof[3] - kCoaxCableHighMeg*SinD(kTrayCFoldAngle);
5225   yprof[4] = yprof[3] + kCoaxCableHighMeg*CosD(kTrayCFoldAngle);
5226   InsidePoint(xprof[1], yprof[1], xprof[2], yprof[2], xprof[3], yprof[3],
5227               kCoaxCableHighMeg , xprof[5], yprof[5]);
5228   xprof[6] = 0.;
5229   yprof[6] = yprof[1] + kCoaxCableHighMeg;
5230   xprof[7] = xprof[0];
5231   yprof[7] = yprof[0] + kCoaxCableHighMeg;
5232
5233   coaxCablesMeg->DefinePolygon(8, xprof, yprof);
5234   coaxCablesMeg->DefineSection(0, 0);
5235   coaxCablesMeg->DefineSection(1, kCoaxCableSectCu);
5236
5237   // To avoid a newly discovered overlap,
5238   // transform the two overlapping volumes into a Composite Shape
5239   TGeoCompositeShape *trayIntern =
5240     new TGeoCompositeShape("ITSSPDInternalTrayC",
5241                            "ITSsuppSPDTraySideCHor+ITSsuppSPDTraySideCWall");
5242
5243   // We have all shapes: now create the real volumes
5244   TGeoMedium *medAl   = mgr->GetMedium("ITS_ALUMINUM$");
5245   TGeoMedium *medIn   = mgr->GetMedium("ITS_INOX$");
5246   TGeoMedium *medFr   = mgr->GetMedium("ITS_Freon$");
5247   TGeoMedium *medFibs = mgr->GetMedium("ITS_SDD OPTICFIB$");//!!TO BE CHECKED!!
5248   TGeoMedium *medCu   = mgr->GetMedium("ITS_COPPER$");
5249   TGeoMedium *medPUR  = mgr->GetMedium("ITS_POLYURETHANE$");
5250   TGeoMedium *medMeg  = mgr->GetMedium("ITS_MEGOLON$");
5251
5252   TGeoVolume *traySideCIntern  = new TGeoVolume("ITSsuppSPDTraySideCInternal",
5253                                                 trayIntern, medAl);
5254
5255   traySideCIntern->SetVisibility(kTRUE);
5256   traySideCIntern->SetLineColor(6); // Purple
5257   traySideCIntern->SetLineWidth(1);
5258   traySideCIntern->SetFillColor(traySideCIntern->GetLineColor());
5259   traySideCIntern->SetFillStyle(4000); // 0% transparent
5260
5261   TGeoVolume *traySideCMidFace  = new TGeoVolume("ITSsuppSPDTraySideCMid",
5262                                                  sideCMidFace, medAl);
5263
5264   traySideCMidFace->SetVisibility(kTRUE);
5265   traySideCMidFace->SetLineColor(6); // Purple
5266   traySideCMidFace->SetLineWidth(1);
5267   traySideCMidFace->SetFillColor(traySideCMidFace->GetLineColor());
5268   traySideCMidFace->SetFillStyle(4000); // 0% transparent
5269
5270   TGeoVolume *traySideCSideFace  = new TGeoVolume("ITSsuppSPDTraySideCSide",
5271                                                   sideCSideFace, medAl);
5272
5273   traySideCSideFace->SetVisibility(kTRUE);
5274   traySideCSideFace->SetLineColor(6); // Purple
5275   traySideCSideFace->SetLineWidth(1);
5276   traySideCSideFace->SetFillColor(traySideCSideFace->GetLineColor());
5277   traySideCSideFace->SetFillStyle(4000); // 0% transparent
5278
5279   TGeoVolume *traySideCShortCover  = new TGeoVolume("ITSsuppSPDTraySideCShCov",
5280                                                     sideCShortCover, medAl);
5281
5282   traySideCShortCover->SetVisibility(kTRUE);
5283   traySideCShortCover->SetLineColor(6); // Purple
5284   traySideCShortCover->SetLineWidth(1);
5285   traySideCShortCover->SetFillColor(traySideCShortCover->GetLineColor());
5286   traySideCShortCover->SetFillStyle(4000); // 0% transparent
5287
5288   TGeoVolume *traySideCLongCover  = new TGeoVolume("ITSsuppSPDTraySideCLnCov",
5289                                                    sideCLongCover, medAl);
5290
5291   traySideCLongCover->SetVisibility(kTRUE);
5292   traySideCLongCover->SetLineColor(6); // Purple
5293   traySideCLongCover->SetLineWidth(1);
5294   traySideCLongCover->SetFillColor(traySideCLongCover->GetLineColor());
5295   traySideCLongCover->SetFillStyle(4000); // 0% transparent
5296
5297   TGeoVolume *traySideCHorTube = new TGeoVolume("ITSsuppSPDTraySideCHorTube",
5298                                                 horTube, medIn);
5299
5300   traySideCHorTube->SetVisibility(kTRUE);
5301   traySideCHorTube->SetLineColor(kGray); // as in GeometrySPD
5302   traySideCHorTube->SetLineWidth(1);
5303   traySideCHorTube->SetFillColor(traySideCHorTube->GetLineColor());
5304   traySideCHorTube->SetFillStyle(4000); // 0% transparent
5305
5306   TGeoVolume *traySideCHorFreon = new TGeoVolume("ITSsuppSPDTraySideCHorFreon",
5307                                                  horFreon, medFr);
5308
5309   traySideCHorFreon->SetVisibility(kTRUE);
5310   traySideCHorFreon->SetLineColor(kBlue); // Blue
5311   traySideCHorFreon->SetLineWidth(1);
5312   traySideCHorFreon->SetFillColor(traySideCHorFreon->GetLineColor());
5313   traySideCHorFreon->SetFillStyle(4000); // 0% transparent
5314
5315   TGeoVolume *traySideCIncTube = new TGeoVolume("ITSsuppSPDTraySideCIncTube",
5316                                                 incTube, medIn);
5317
5318   traySideCIncTube->SetVisibility(kTRUE);
5319   traySideCIncTube->SetLineColor(kGray); // as in GeometrySPD
5320   traySideCIncTube->SetLineWidth(1);
5321   traySideCIncTube->SetFillColor(traySideCIncTube->GetLineColor());
5322   traySideCIncTube->SetFillStyle(4000); // 0% transparent
5323
5324   TGeoVolume *traySideCIncFreon = new TGeoVolume("ITSsuppSPDTraySideCIncFreon",
5325                                                  incFreon, medFr);
5326
5327   traySideCIncFreon->SetVisibility(kTRUE);
5328   traySideCIncFreon->SetLineColor(kBlue); // Blue
5329   traySideCIncFreon->SetLineWidth(1);
5330   traySideCIncFreon->SetFillColor(traySideCIncFreon->GetLineColor());
5331   traySideCIncFreon->SetFillStyle(4000); // 0% transparent
5332
5333   TGeoVolume *traySideCOutTube = new TGeoVolume("ITSsuppSPDTraySideCOutTube",
5334                                                 outTube, medIn);
5335
5336   traySideCOutTube->SetVisibility(kTRUE);
5337   traySideCOutTube->SetLineColor(kGray); // as in GeometrySPD
5338   traySideCOutTube->SetLineWidth(1);
5339   traySideCOutTube->SetFillColor(traySideCOutTube->GetLineColor());
5340   traySideCOutTube->SetFillStyle(4000); // 0% transparent
5341
5342   TGeoVolume *traySideCOutFreon = new TGeoVolume("ITSsuppSPDTraySideCOutFreon",
5343                                                  outFreon, medFr);
5344
5345   traySideCOutFreon->SetVisibility(kTRUE);
5346   traySideCOutFreon->SetLineColor(kBlue); // Blue
5347   traySideCOutFreon->SetLineWidth(1);
5348   traySideCOutFreon->SetFillColor(traySideCOutFreon->GetLineColor());
5349   traySideCOutFreon->SetFillStyle(4000); // 0% transparent
5350
5351   TGeoVolume *traySideCOptFibs = new TGeoVolume("ITSsuppSPDTraySideCOptFibs",
5352                                                 optFibs, medFibs);
5353
5354   traySideCOptFibs->SetVisibility(kTRUE);
5355   traySideCOptFibs->SetLineColor(kOrange); // Orange
5356   traySideCOptFibs->SetLineWidth(1);
5357   traySideCOptFibs->SetFillColor(traySideCOptFibs->GetLineColor());
5358   traySideCOptFibs->SetFillStyle(4000); // 0% transparent
5359
5360   TGeoVolume *traySideCLowCabsCu = new TGeoVolume("ITSsuppSPDTraySideCLVCu",
5361                                                   lowCablesCu, medCu);
5362
5363   traySideCLowCabsCu->SetVisibility(kTRUE);
5364   traySideCLowCabsCu->SetLineColor(kRed); // Red
5365   traySideCLowCabsCu->SetLineWidth(1);
5366   traySideCLowCabsCu->SetFillColor(traySideCLowCabsCu->GetLineColor());
5367   traySideCLowCabsCu->SetFillStyle(4000); // 0% transparent
5368
5369   TGeoVolume *traySideCLowCabsPUR = new TGeoVolume("ITSsuppSPDTraySideCLVPUR",
5370                                                    lowCablesPUR, medPUR);
5371
5372   traySideCLowCabsPUR->SetVisibility(kTRUE);
5373   traySideCLowCabsPUR->SetLineColor(kBlack); // Black
5374   traySideCLowCabsPUR->SetLineWidth(1);
5375   traySideCLowCabsPUR->SetFillColor(traySideCLowCabsPUR->GetLineColor());
5376   traySideCLowCabsPUR->SetFillStyle(4000); // 0% transparent
5377
5378   TGeoVolume *traySideCHiCabsCu = new TGeoVolume("ITSsuppSPDTraySideCHVCu",
5379                                                  hiCablesCu, medCu);
5380
5381   traySideCHiCabsCu->SetVisibility(kTRUE);
5382   traySideCHiCabsCu->SetLineColor(kRed); // Red
5383   traySideCHiCabsCu->SetLineWidth(1);
5384   traySideCHiCabsCu->SetFillColor(traySideCHiCabsCu->GetLineColor());
5385   traySideCHiCabsCu->SetFillStyle(4000); // 0% transparent
5386
5387   TGeoVolume *traySideCHiCabsPUR = new TGeoVolume("ITSsuppSPDTraySideCHVPUR",
5388                                                   hiCablesPUR, medPUR);
5389
5390   traySideCHiCabsPUR->SetVisibility(kTRUE);
5391   traySideCHiCabsPUR->SetLineColor(kBlack); // Black
5392   traySideCHiCabsPUR->SetLineWidth(1);
5393   traySideCHiCabsPUR->SetFillColor(traySideCHiCabsPUR->GetLineColor());
5394   traySideCHiCabsPUR->SetFillStyle(4000); // 0% transparent
5395
5396   TGeoVolume *traySideCCoaxCu = new TGeoVolume("ITSsuppSPDTraySideCCoaxCu",
5397                                                coaxCablesCu, medCu);
5398
5399   traySideCCoaxCu->SetVisibility(kTRUE);
5400   traySideCCoaxCu->SetLineColor(kRed); // Red
5401   traySideCCoaxCu->SetLineWidth(1);
5402   traySideCCoaxCu->SetFillColor(traySideCCoaxCu->GetLineColor());
5403   traySideCCoaxCu->SetFillStyle(4000); // 0% transparent
5404
5405   TGeoVolume *traySideCCoaxMeg = new TGeoVolume("ITSsuppSPDTraySideCCoaxMeg",
5406                                                 coaxCablesMeg, medMeg);
5407
5408   traySideCCoaxMeg->SetVisibility(kTRUE);
5409   traySideCCoaxMeg->SetLineColor(kBlack); // Black
5410   traySideCCoaxMeg->SetLineWidth(1);
5411   traySideCCoaxMeg->SetFillColor(traySideCCoaxMeg->GetLineColor());
5412   traySideCCoaxMeg->SetFillStyle(4000); // 0% transparent
5413
5414
5415   // Now build up the trays
5416   cableTrayC->AddNode(traySideCIntern,1,0);
5417
5418   cableTrayC->AddNode(traySideCMidFace,1,0);
5419
5420   zloc = kTrayCHalfWide - kTrayCThick;
5421   cableTrayC->AddNode(traySideCSideFace, 1,
5422                       new TGeoTranslation( 0, 0, zloc));
5423   zloc = -kTrayCHalfWide;
5424   cableTrayC->AddNode(traySideCSideFace, 2,
5425                       new TGeoTranslation( 0, 0, zloc));
5426
5427   xloc = sideCShortCover->GetDX();
5428   yloc = kTrayCFirstHigh - sideCShortCover->GetDY();
5429   cableTrayC->AddNode(traySideCShortCover, 1,
5430                       new TGeoTranslation( xloc, yloc, 0));
5431
5432   cableTrayC->AddNode(traySideCLongCover,1,0);
5433
5434   traySideCHorTube->AddNode(traySideCHorFreon, 1, 0);
5435   traySideCIncTube->AddNode(traySideCIncFreon, 1, 0);
5436   traySideCOutTube->AddNode(traySideCOutFreon, 1, 0);
5437
5438   xloc = horTube->GetDz();
5439   yloc = sideCMidFace->GetY(5) + horTube->GetRmax();
5440   cableTrayC->AddNode(traySideCHorTube, 1,
5441                       new TGeoCombiTrans( xloc, yloc, 0,
5442                       new TGeoRotation("",-90.,-90.,90.)));
5443
5444   xloc = sideCMidFace->GetX(4) + (incTube->GetDz())*CosD(kTrayCFoldAngle);
5445   yloc = sideCMidFace->GetY(4) +  incTube->GetRmax() +
5446             (incTube->GetDz())*SinD(kTrayCFoldAngle)+0.005;//Avoid small ovrlp
5447   cableTrayC->AddNode(traySideCIncTube, 1,
5448                       new TGeoCombiTrans( xloc, yloc, 0,
5449                       new TGeoRotation("",-90.+kTrayCFoldAngle,-90.,90.)));
5450
5451   xloc = -kTrayCCablesZLenOut/2 - outTube->GetRmax();
5452   yloc = xloc/TanD(kTrayCCablesOutRot) + sideCMidFace->GetY(4) -
5453          2*outTube->GetRmax();
5454   cableTrayC->AddNode(traySideCOutTube, 1,
5455                       new TGeoCombiTrans( xloc, yloc, 0,
5456                       new TGeoRotation("",-70.,-90.,90.)));
5457
5458   zloc = horTube->GetRmax();
5459   cableTrayC->AddNode(traySideCOptFibs, 1,
5460                       new TGeoTranslation( 0, 0, zloc));
5461
5462   zloc = kLowVoltCableSectCu + horTube->GetRmax();
5463   cableTrayC->AddNode(traySideCLowCabsCu, 1,
5464                       new TGeoTranslation( 0, 0,-zloc));
5465   cableTrayC->AddNode(traySideCLowCabsPUR, 1,
5466                       new TGeoTranslation( 0, 0,-zloc));
5467
5468   zloc = kHiVoltCableSectCu + kLowVoltCableSectCu + horTube->GetRmax();
5469   cableTrayC->AddNode(traySideCHiCabsCu, 1,
5470                       new TGeoTranslation( 0, 0,-zloc));
5471   cableTrayC->AddNode(traySideCHiCabsPUR, 1,
5472                       new TGeoTranslation( 0, 0,-zloc));
5473
5474   zloc = kOpticalFibersSect + kCoaxCableSectCu + horTube->GetRmax();
5475   cableTrayC->AddNode(traySideCCoaxCu, 1,
5476                       new TGeoTranslation( 0, 0, zloc));
5477   cableTrayC->AddNode(traySideCCoaxMeg, 1,
5478                       new TGeoTranslation( 0, 0, zloc));
5479
5480
5481   // Finally put everything in the mother volume
5482   for (Int_t jt = 0; jt < kNumTraysSideC/2; jt++) {
5483     alpharot = kTraySideCAlphaRot[jt];
5484
5485     xloc = kTraySideCRPos*SinD(alpharot);
5486     yloc = kTraySideCRPos*CosD(alpharot);
5487     moth->AddNode(cableTrayC,2*jt+1,
5488                 new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
5489                 new TGeoRotation("",-90.+alpharot,-90.,90.+kTrayCFoldAngle)));
5490     alpharot += 180;
5491     xloc = kTraySideCRPos*SinD(alpharot);
5492     yloc = kTraySideCRPos*CosD(alpharot);
5493     moth->AddNode(cableTrayC,2*jt+2,
5494                 new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
5495                 new TGeoRotation("",-90.+alpharot,-90.,90.+kTrayCFoldAngle)));
5496   }
5497
5498
5499   return;
5500 }
5501
5502 //______________________________________________________________________
5503 void AliITSv11GeometrySupport::SDDCableTraysSideA(TGeoVolume *moth,
5504                                              const TGeoManager *mgr){
5505 //
5506 // Creates the SDD cable trays which are outside the ITS support cones
5507 // but still inside the TPC on Side A
5508 // (part of this code is taken or anyway inspired to ServicesCableSupport
5509 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
5510 //
5511 // Input:
5512 //         moth : the TGeoVolume owing the volume structure
5513 //         mgr  : the GeoManager (default gGeoManager)
5514 // Output:
5515 //
5516 // Created:         ???       Bjorn S. Nilsen
5517 // Updated:       5 Jan 2010  Mario Sitta
5518 // Updated:      26 Feb 2010  Mario Sitta
5519 // Updated:      06 Sep 2010  Mario Sitta
5520 //
5521 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
5522 // drawings and other (oral) information given by F.Tosello
5523 //
5524
5525   // Overall position and rotation of the A-Side Cable Trays
5526   // (parts of 0872/G/D)
5527   const Double_t kTrayARTrans            =  408.35 *fgkmm;
5528   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
5529   const Double_t kTrayAZToSupportRing    =  435.00 *fgkmm;
5530   const Double_t kExternTrayYTrans       =   96.00 *fgkmm; // Computed
5531   const Double_t kExternTrayZTrans       =  823.00 *fgkmm;
5532   const Double_t kExternCoverYTrans      =    2.00 *fgkmm;
5533   const Double_t kTrayAZRot              = (180-169.5);// Degrees
5534   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
5535   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
5536
5537   const Double_t kForwardTrayThick       =    2.00 *fgkmm;
5538   const Double_t kForwardTrayTailHeight  =  100.00 *fgkmm; // Computed
5539   const Double_t kForwardTrayTotalHeight =  170.00 *fgkmm; // Computed
5540   const Double_t kForwardTrayUpperLength =  405.00 *fgkmm; // Computed
5541   const Double_t kForwardCoverLength     =  380.00 *fgkmm;
5542   const Double_t kForwardCoverWide       =  133.00 *fgkmm;
5543   const Double_t kForwardCoverHeight     =   10.00 *fgkmm;
5544   const Double_t kForwardCoverThick      =    1.00 *fgkmm;
5545
5546   const Double_t kExternTrayTotalLen     = 1200.00 *fgkmm;
5547   const Double_t kExternTrayTotalHeight  =   52.00 *fgkmm;
5548   const Double_t kExternCoverLen         = kExternTrayTotalLen;
5549   const Double_t kExternCoverThick       =    5.00 *fgkmm;
5550   const Double_t kExternCoverSideThick   =    3.00 *fgkmm;
5551
5552   const Int_t    kForwardTrayNpoints     =    8;
5553
5554   // Dimensions and positions of the Cable Tray elements
5555   const Double_t kSideACoolManifWide     =    8.23 *fgkcm;
5556   const Double_t kSideACoolManifHigh     =    8.06 *fgkcm;
5557   const Double_t kSideACoolManifLen      =    3.90 *fgkcm;
5558   const Double_t kSideACoolManifPOMFrac  =    0.0054;
5559   const Double_t kSideACoolManifSteelFrac=    0.8850;
5560   const Double_t kSideACoolManifWaterFrac=    0.0913;
5561   const Double_t kSideACoolManifAlFrac   =    0.0183;
5562
5563   const Double_t kSideACoolTubesWide     =    9.07 *fgkcm;
5564   const Double_t kSideACoolTubesHigh     =    1.88 *fgkcm;
5565   const Double_t kSideACoolTubesTrans    =    0.88 *fgkcm;
5566   const Double_t kSideACoolTubesPURFrac  =    0.5897;
5567   const Double_t kSideACoolTubesWaterFrac=    0.4101;
5568   const Double_t kSideACoolTubesAirFrac  =    0.0002;
5569
5570   const Double_t kSideAOptConnWide       =    0.90    *fgkcm;
5571   const Double_t kSideAOptConnLen        =    1.37    *fgkcm;
5572   const Double_t kSideAOptConnPBTFrac    =    0.5010;
5573   const Double_t kSideAOptConnSteelFrac  =    0.1784;
5574   const Double_t kSideAOptConnAlFrac     =    0.3206;
5575
5576   const Double_t kSideAOptFibsWide       =    0.71    *fgkcm;
5577   const Double_t kSideAOptFibsHigh       =    3.20    *fgkcm;
5578
5579   const Double_t kSideAInputCablesWide   =   12.50    *fgkcm;
5580   const Double_t kSideAInputCablesHigh   =    1.24    *fgkcm;
5581   const Double_t kSideAInputCablesLen    =   25.20    *fgkcm;
5582   const Double_t kSideAInputCablesYTrans =    1.15    *fgkcm;
5583   const Double_t kSideAInputCablesCu     =    0.7404;
5584   const Double_t kSideAInputCablesPlast  =    0.1269;
5585   const Double_t kSideAInputCablesAl     =    0.0057;
5586   const Double_t kSideAInputCablesKapton =    0.0172;
5587   const Double_t kSideAInputCablesPOLYAX =    0.1098;
5588
5589   const Double_t kSideAOutputCablesWide  =    8.30    *fgkcm;
5590   const Double_t kSideAOutputCablesHigh  =    1.56    *fgkcm;
5591   const Double_t kSideAOutputCablesCu    =    0.6783;
5592   const Double_t kSideAOutputCablesPlast =    0.1605;
5593   const Double_t kSideAOutputCablesAl    =    0.0078;
5594   const Double_t kSideAOutputCablesKapton=    0.0232;
5595   const Double_t kSideAOutputCablesPOLYAX=    0.1302;
5596
5597   const Double_t kSideAPCBBoardsWide     =   12.50    *fgkcm;
5598   const Double_t kSideAPCBBoardsHigh     =    6.32    *fgkcm;
5599   const Double_t kSideAPCBBoardsLen      =   24.00    *fgkcm;
5600   const Double_t kSideAPCBBoardsYTrans   =    0.75    *fgkcm;
5601   const Double_t kSideAPCBBoardsCu       =    0.3864;
5602   const Double_t kSideAPCBBoardsEpoxy    =    0.1486;
5603   const Double_t kSideAPCBBoardsPlast    =    0.0578;
5604   const Double_t kSideAPCBBoardsSteel    =    0.1521;
5605   const Double_t kSideAPCBBoardsPPS      =    0.2551;
5606
5607
5608   // Local variables
5609   Double_t xprof[kForwardTrayNpoints], yprof[kForwardTrayNpoints];
5610   Double_t xloc, yloc, zloc, alpharot, height;
5611
5612
5613   // The whole tray as an assembly
5614   TGeoVolumeAssembly *cableTrayA = new TGeoVolumeAssembly("ITSsupportSDDTrayA");
5615   
5616
5617   // First create all needed shapes
5618
5619   // The forward tray is very complex and deserves a dedicated method
5620   CreateSDDForwardTraySideA(cableTrayA,mgr);
5621
5622   // The forward cover: a Xtru
5623   TGeoXtru *forwardCover = new TGeoXtru(2);
5624   forwardCover->SetName("ITSsuppSDDForwCover");
5625
5626   xprof[0] = kForwardCoverWide/2;
5627   yprof[0] = kForwardCoverHeight;
5628   xprof[1] = xprof[0];
5629   yprof[1] = 0;
5630   xprof[2] = xprof[1] - kForwardCoverThick;
5631   yprof[2] = yprof[1];
5632   xprof[3] = xprof[2];
5633   yprof[3] = yprof[0] - kForwardCoverThick;
5634
5635   // We did the right side, now reflex on the left side
5636   for (Int_t jp = 0; jp < 4; jp++) {
5637     xprof[4+jp] = -xprof[3-jp];
5638     yprof[4+jp] =  yprof[3-jp];
5639   }
5640
5641   forwardCover->DefinePolygon(8, xprof, yprof);
5642   forwardCover->DefineSection(0, 0);
5643   forwardCover->DefineSection(1, kForwardCoverLength);
5644
5645   // The external tray (as 0872/G/D/03): a Xtru
5646   TGeoXtru *externalTray = CreateSDDSSDTraysSideA(kExternTrayTotalLen,
5647                                                   kExternTrayTotalHeight);
5648
5649   // The external covers: a Composite Shape
5650   TGeoCompositeShape *externCover = CreateTrayAExternalCover(kExternCoverLen);
5651
5652   // Now the volumes inside it
5653   // The cooling manifold: four boxes
5654   TGeoBBox *coolManifPOM = new TGeoBBox(kSideACoolManifWide/2,
5655                  kSideACoolManifPOMFrac*kSideACoolManifHigh/2,
5656                                         kSideACoolManifLen/2);
5657
5658   TGeoBBox *coolManifSteel = new TGeoBBox(kSideACoolManifWide/2,
5659                  kSideACoolManifSteelFrac*kSideACoolManifHigh/2,
5660                                           kSideACoolManifLen/2);
5661
5662   TGeoBBox *coolManifWater = new TGeoBBox(kSideACoolManifWide/2,
5663                  kSideACoolManifWaterFrac*kSideACoolManifHigh/2,
5664                                           kSideACoolManifLen/2);
5665
5666   TGeoBBox *coolManifAl = new TGeoBBox(kSideACoolManifWide/2,
5667                  kSideACoolManifAlFrac*kSideACoolManifHigh/2,
5668                                        kSideACoolManifLen/2);
5669
5670   // The cooling tubes: three Xtru's
5671   TGeoXtru *coolTubesPUR = new TGeoXtru(2);
5672
5673   height = kSideACoolTubesHigh*kSideACoolTubesPURFrac;
5674
5675   xprof[0] = kSideACoolManifLen;
5676   yprof[0] = kForwardTrayThick + kSideACoolTubesTrans;
5677   xprof[2] = kExternTrayZTrans + kForwardTrayTotalHeight*SinD(kTrayAZRot) +
5678              kExternTrayTotalLen*CosD(kTrayAZRot) - xprof[0]/2;
5679   yprof[2] = kForwardTrayTotalHeight*(1 - CosD(kTrayAZRot)) +
5680              kExternTrayYTrans - kExternTrayTotalHeight*CosD(kTrayAZRot) +
5681              kExternTrayTotalLen*SinD(kTrayAZRot) + yprof[0];
5682   IntersectLines(              0 , xprof[0], yprof[0],
5683                  TanD(kTrayAZRot), xprof[2], yprof[2],
5684                                    xprof[1], yprof[1]);
5685   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5686   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5687   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5688               height, xprof[4], yprof[4]);
5689   xprof[5] = xprof[0];
5690   yprof[5] = yprof[0] + height;
5691
5692   coolTubesPUR->DefinePolygon(6, xprof, yprof);
5693   coolTubesPUR->DefineSection(0,-kSideACoolTubesWide/2);
5694   coolTubesPUR->DefineSection(1, kSideACoolTubesWide/2);
5695
5696   TGeoXtru *coolTubesWater = new TGeoXtru(2);
5697
5698   height = kSideACoolTubesHigh*kSideACoolTubesWaterFrac;
5699
5700   xprof[0] = coolTubesPUR->GetX(5);
5701   yprof[0] = coolTubesPUR->GetY(5);
5702   xprof[1] = coolTubesPUR->GetX(4);
5703   yprof[1] = coolTubesPUR->GetY(4);
5704   xprof[2] = coolTubesPUR->GetX(3);
5705   yprof[2] = coolTubesPUR->GetY(3);
5706   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5707   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5708   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5709               height, xprof[4], yprof[4]);
5710   xprof[5] = xprof[0];
5711   yprof[5] = yprof[0] + height;
5712
5713   coolTubesWater->DefinePolygon(6, xprof, yprof);
5714   coolTubesWater->DefineSection(0,-kSideACoolTubesWide/2);
5715   coolTubesWater->DefineSection(1, kSideACoolTubesWide/2);
5716
5717   TGeoXtru *coolTubesAir = new TGeoXtru(2);
5718
5719   height = kSideACoolTubesHigh*kSideACoolTubesAirFrac;
5720
5721   xprof[0] = coolTubesWater->GetX(5);
5722   yprof[0] = coolTubesWater->GetY(5);
5723   xprof[1] = coolTubesWater->GetX(4);
5724   yprof[1] = coolTubesWater->GetY(4);
5725   xprof[2] = coolTubesWater->GetX(3);
5726   yprof[2] = coolTubesWater->GetY(3);
5727   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5728   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5729   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5730               height, xprof[4], yprof[4]);
5731   xprof[5] = xprof[0];
5732   yprof[5] = yprof[0] + height;
5733
5734   coolTubesAir->DefinePolygon(6, xprof, yprof);
5735   coolTubesAir->DefineSection(0,-kSideACoolTubesWide/2);
5736   coolTubesAir->DefineSection(1, kSideACoolTubesWide/2);
5737
5738   // The optical fiber connectors: three boxes
5739   TGeoBBox *optConnPBT = new TGeoBBox(kSideAOptConnWide/2,
5740                  kSideAOptConnPBTFrac*kSideACoolManifHigh/2,
5741                                       kSideAOptConnLen/2);
5742
5743   TGeoBBox *optConnSteel = new TGeoBBox(kSideAOptConnWide/2,
5744                  kSideAOptConnSteelFrac*kSideACoolManifHigh/2,
5745                                         kSideAOptConnLen/2);
5746
5747   TGeoBBox *optConnAl = new TGeoBBox(kSideAOptConnWide/2,
5748                  kSideAOptConnAlFrac*kSideACoolManifHigh/2,
5749                                      kSideAOptConnLen/2);
5750
5751   // The optical fibers: a Xtru
5752   TGeoXtru *opticalFibs = new TGeoXtru(2);
5753
5754   xprof[0] = kSideAOptConnLen;
5755   yprof[0] = coolTubesPUR->GetY(0);
5756   xprof[1] = coolTubesPUR->GetX(1);
5757   yprof[1] = coolTubesPUR->GetY(1);
5758   xprof[2] = coolTubesPUR->GetX(2);
5759   yprof[2] = coolTubesPUR->GetY(2);
5760   xprof[3] = xprof[2] - kSideAOptFibsHigh*SinD(kTrayAZRot);
5761   yprof[3] = yprof[2] + kSideAOptFibsHigh*CosD(kTrayAZRot);
5762   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5763               kSideAOptFibsHigh, xprof[4], yprof[4]);
5764   xprof[5] = xprof[0];
5765   yprof[5] = yprof[0] + kSideAOptFibsHigh;
5766
5767   opticalFibs->DefinePolygon(6, xprof, yprof);
5768   opticalFibs->DefineSection(0,-kSideAOptFibsWide/2);
5769   opticalFibs->DefineSection(1, kSideAOptFibsWide/2);
5770
5771   // The input cables: five boxes
5772   TGeoBBox *inputCabsCu = new TGeoBBox(kSideAInputCablesWide/2,
5773                    kSideAInputCablesCu*kSideAInputCablesHigh/2,
5774                                        kSideAInputCablesLen/2);
5775
5776   TGeoBBox *inputCabsPlast = new TGeoBBox(kSideAInputCablesWide/2,
5777                    kSideAInputCablesPlast*kSideAInputCablesHigh/2,
5778                                           kSideAInputCablesLen/2);
5779
5780   TGeoBBox *inputCabsAl = new TGeoBBox(kSideAInputCablesWide/2,
5781                    kSideAInputCablesAl*kSideAInputCablesHigh/2,
5782                                        kSideAInputCablesLen/2);
5783
5784   TGeoBBox *inputCabsKapton = new TGeoBBox(kSideAInputCablesWide/2,
5785                    kSideAInputCablesKapton*kSideAInputCablesHigh/2,
5786                                            kSideAInputCablesLen/2);
5787
5788   TGeoBBox *inputCabsPOLYAX = new TGeoBBox(kSideAInputCablesWide/2,
5789                    kSideAInputCablesPOLYAX*kSideAInputCablesHigh/2,
5790                                            kSideAInputCablesLen/2);
5791
5792   // The output cables: five Xtru
5793   TGeoXtru *outputCabsCu = new TGeoXtru(2);
5794
5795   height = kSideAOutputCablesCu*kSideAOutputCablesHigh;
5796
5797   xprof[0] = kSideAInputCablesLen/2 + kSideAPCBBoardsLen/2;
5798   yprof[0] = coolTubesAir->GetY(5);
5799   xprof[1] = coolTubesAir->GetX(4);
5800   yprof[1] = coolTubesAir->GetY(4);
5801   xprof[2] = coolTubesAir->GetX(3);
5802   yprof[2] = coolTubesAir->GetY(3);
5803   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5804   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5805   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5806               height, xprof[4], yprof[4]);
5807   xprof[5] = xprof[0];
5808   yprof[5] = yprof[0] + height;
5809
5810   outputCabsCu->DefinePolygon(6, xprof, yprof);
5811   outputCabsCu->DefineSection(0,-kSideAOutputCablesWide/2);
5812   outputCabsCu->DefineSection(1, kSideAOutputCablesWide/2);
5813
5814   TGeoXtru *outputCabsPlast = new TGeoXtru(2);
5815
5816   height = kSideAOutputCablesPlast*kSideAOutputCablesHigh;
5817
5818   xprof[0] = outputCabsCu->GetX(5);
5819   yprof[0] = outputCabsCu->GetY(5);
5820   xprof[1] = outputCabsCu->GetX(4);
5821   yprof[1] = outputCabsCu->GetY(4);
5822   xprof[2] = outputCabsCu->GetX(3);
5823   yprof[2] = outputCabsCu->GetY(3);
5824   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5825   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5826   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5827               height, xprof[4], yprof[4]);
5828   xprof[5] = xprof[0];
5829   yprof[5] = yprof[0] + height;
5830
5831   outputCabsPlast->DefinePolygon(6, xprof, yprof);
5832   outputCabsPlast->DefineSection(0,-kSideAOutputCablesWide/2);
5833   outputCabsPlast->DefineSection(1, kSideAOutputCablesWide/2);
5834
5835   TGeoXtru *outputCabsAl = new TGeoXtru(2);
5836
5837   height = kSideAOutputCablesAl*kSideAOutputCablesHigh;
5838
5839   xprof[0] = outputCabsPlast->GetX(5);
5840   yprof[0] = outputCabsPlast->GetY(5);
5841   xprof[1] = outputCabsPlast->GetX(4);
5842   yprof[1] = outputCabsPlast->GetY(4);
5843   xprof[2] = outputCabsPlast->GetX(3);
5844   yprof[2] = outputCabsPlast->GetY(3);
5845   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5846   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5847   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5848               height, xprof[4], yprof[4]);
5849   xprof[5] = xprof[0];
5850   yprof[5] = yprof[0] + height;
5851
5852   outputCabsAl->DefinePolygon(6, xprof, yprof);
5853   outputCabsAl->DefineSection(0,-kSideAOutputCablesWide/2);
5854   outputCabsAl->DefineSection(1, kSideAOutputCablesWide/2);
5855
5856   TGeoXtru *outputCabsKapton = new TGeoXtru(2);
5857
5858   height = kSideAOutputCablesKapton*kSideAOutputCablesHigh;
5859
5860   xprof[0] = outputCabsAl->GetX(5);
5861   yprof[0] = outputCabsAl->GetY(5);
5862   xprof[1] = outputCabsAl->GetX(4);
5863   yprof[1] = outputCabsAl->GetY(4);
5864   xprof[2] = outputCabsAl->GetX(3);
5865   yprof[2] = outputCabsAl->GetY(3);
5866   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5867   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5868   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5869               height, xprof[4], yprof[4]);
5870   xprof[5] = xprof[0];
5871   yprof[5] = yprof[0] + height;
5872
5873   outputCabsKapton->DefinePolygon(6, xprof, yprof);
5874   outputCabsKapton->DefineSection(0,-kSideAOutputCablesWide/2);
5875   outputCabsKapton->DefineSection(1, kSideAOutputCablesWide/2);
5876
5877   TGeoXtru *outputCabsPOLYAX = new TGeoXtru(2);
5878
5879   height = kSideAOutputCablesPOLYAX*kSideAOutputCablesHigh;
5880
5881   xprof[0] = outputCabsKapton->GetX(5);
5882   yprof[0] = outputCabsKapton->GetY(5);
5883   xprof[1] = outputCabsKapton->GetX(4);
5884   yprof[1] = outputCabsKapton->GetY(4);
5885   xprof[2] = outputCabsKapton->GetX(3);
5886   yprof[2] = outputCabsKapton->GetY(3);
5887   xprof[3] = xprof[2] - height*SinD(kTrayAZRot);
5888   yprof[3] = yprof[2] + height*CosD(kTrayAZRot);
5889   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
5890               height, xprof[4], yprof[4]);
5891   xprof[5] = xprof[0];
5892   yprof[5] = yprof[0] + height;
5893
5894   outputCabsPOLYAX->DefinePolygon(6, xprof, yprof);
5895   outputCabsPOLYAX->DefineSection(0,-kSideAOutputCablesWide/2);
5896   outputCabsPOLYAX->DefineSection(1, kSideAOutputCablesWide/2);
5897
5898   // The PCB boards: five boxes
5899   TGeoBBox *pcbBoardsCu = new TGeoBBox(kSideAPCBBoardsWide/2,
5900                      kSideAPCBBoardsCu*kSideAPCBBoardsHigh/2,
5901                                        kSideAPCBBoardsLen/2);
5902
5903   TGeoBBox *pcbBoardsEpoxy = new TGeoBBox(kSideAPCBBoardsWide/2,
5904                      kSideAPCBBoardsEpoxy*kSideAPCBBoardsHigh/2,
5905                                           kSideAPCBBoardsLen/2);
5906
5907   TGeoBBox *pcbBoardsPlast = new TGeoBBox(kSideAPCBBoardsWide/2,
5908                      kSideAPCBBoardsPlast*kSideAPCBBoardsHigh/2,
5909                                           kSideAPCBBoardsLen/2);
5910
5911   TGeoBBox *pcbBoardsSteel = new TGeoBBox(kSideAPCBBoardsWide/2,
5912                      kSideAPCBBoardsSteel*kSideAPCBBoardsHigh/2,
5913                                           kSideAPCBBoardsLen/2);
5914
5915   TGeoBBox *pcbBoardsPPS = new TGeoBBox(kSideAPCBBoardsWide/2,
5916                      kSideAPCBBoardsPPS*kSideAPCBBoardsHigh/2,
5917                                         kSideAPCBBoardsLen/2);
5918
5919
5920   // We have all shapes: now create the real volumes
5921   TGeoMedium *medAl     = mgr->GetMedium("ITS_ALUMINUM$");
5922   TGeoMedium *medAntic  = mgr->GetMedium("ITS_ANTICORODAL$");
5923   TGeoMedium *medPOM    = mgr->GetMedium("ITS_POLYOXYMETHYLENE$");
5924   TGeoMedium *medSteel  = mgr->GetMedium("ITS_INOX$");
5925   TGeoMedium *medWater  = mgr->GetMedium("ITS_WATER$");
5926   TGeoMedium *medPUR    = mgr->GetMedium("ITS_POLYURETHANE$");
5927   TGeoMedium *medAir    = mgr->GetMedium("ITS_AIR$");
5928   TGeoMedium *medPBT    = mgr->GetMedium("ITS_PBT$");
5929   TGeoMedium *medOptFib = mgr->GetMedium("ITS_SDD OPTICFIB$");
5930   TGeoMedium *medCu     = mgr->GetMedium("ITS_COPPER$");
5931   TGeoMedium *medKapton = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
5932   TGeoMedium *medPOLYAX = mgr->GetMedium("ITS_POLYAX$");
5933   TGeoMedium *medPPS    = mgr->GetMedium("ITS_PPS$");
5934   TGeoMedium *medEpoxy  = mgr->GetMedium("ITS_EPOXY$");
5935
5936   TGeoVolume *forwardTrayCover = new TGeoVolume("ITSsuppSDDSideAForwTrayCover",
5937                                                 forwardCover, medAl);
5938
5939   forwardTrayCover->SetVisibility(kTRUE);
5940   forwardTrayCover->SetLineColor(kMagenta+1); // Purple
5941   forwardTrayCover->SetLineWidth(1);
5942   forwardTrayCover->SetFillColor(forwardTrayCover->GetLineColor());
5943   forwardTrayCover->SetFillStyle(4000); // 0% transparent
5944
5945   TGeoVolume *externalTraySDD = new TGeoVolume("ITSsuppSDDSideAExternalTray",
5946                                                externalTray, medAl);
5947
5948   externalTraySDD->SetVisibility(kTRUE);
5949   externalTraySDD->SetLineColor(6); // Purple
5950   externalTraySDD->SetLineWidth(1);
5951   externalTraySDD->SetFillColor(externalTraySDD->GetLineColor());
5952   externalTraySDD->SetFillStyle(4000); // 0% transparent
5953
5954   TGeoVolume *externTrayCover = new TGeoVolume("ITSsuppSDDSideAExtTrayCover",
5955                                                externCover, medAntic);
5956
5957   externTrayCover->SetVisibility(kTRUE);
5958   externTrayCover->SetLineColor(kMagenta+1); // Purple
5959   externTrayCover->SetLineWidth(1);
5960   externTrayCover->SetFillColor(externTrayCover->GetLineColor());
5961   externTrayCover->SetFillStyle(4000); // 0% transparent
5962
5963   TGeoVolume *pomCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifPOM",
5964                                             coolManifPOM, medPOM);
5965
5966   pomCoolManif->SetVisibility(kTRUE);
5967   pomCoolManif->SetLineColor(kRed); // Red
5968   pomCoolManif->SetLineWidth(1);
5969   pomCoolManif->SetFillColor(pomCoolManif->GetLineColor());
5970   pomCoolManif->SetFillStyle(4000); // 0% transparent
5971
5972   TGeoVolume *steelCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifSteel",
5973                                               coolManifSteel, medSteel);
5974
5975   steelCoolManif->SetVisibility(kTRUE);
5976   steelCoolManif->SetLineColor(kBlue); // Blue
5977   steelCoolManif->SetLineWidth(1);
5978   steelCoolManif->SetFillColor(steelCoolManif->GetLineColor());
5979   steelCoolManif->SetFillStyle(4000); // 0% transparent
5980
5981   TGeoVolume *waterCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifWater",
5982                                               coolManifWater, medWater);
5983
5984   waterCoolManif->SetVisibility(kTRUE);
5985   waterCoolManif->SetLineColor(33); // Light Blue
5986   waterCoolManif->SetLineWidth(1);
5987   waterCoolManif->SetFillColor(waterCoolManif->GetLineColor());
5988   waterCoolManif->SetFillStyle(4000); // 0% transparent
5989
5990   TGeoVolume *alCoolManif = new TGeoVolume("ITSsuppSDDSideACoolManifAl",
5991                                            coolManifAl, medAl);
5992
5993   alCoolManif->SetVisibility(kTRUE);
5994   alCoolManif->SetLineColor(6); // Purple
5995   alCoolManif->SetLineWidth(1);
5996   alCoolManif->SetFillColor(alCoolManif->GetLineColor());
5997   alCoolManif->SetFillStyle(4000); // 0% transparent
5998
5999   TGeoVolume *purCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesPUR",
6000                                             coolTubesPUR, medPUR);
6001
6002   purCoolTubes->SetVisibility(kTRUE);
6003   purCoolTubes->SetLineColor(kRed); // Red
6004   purCoolTubes->SetLineWidth(1);
6005   purCoolTubes->SetFillColor(purCoolTubes->GetLineColor());
6006   purCoolTubes->SetFillStyle(4000); // 0% transparent
6007
6008   TGeoVolume *waterCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesWater",
6009                                               coolTubesWater, medWater);
6010
6011   waterCoolTubes->SetVisibility(kTRUE);
6012   waterCoolTubes->SetLineColor(33); // Light Blue
6013   waterCoolTubes->SetLineWidth(1);
6014   waterCoolTubes->SetFillColor(waterCoolTubes->GetLineColor());
6015   waterCoolTubes->SetFillStyle(4000); // 0% transparent
6016
6017   TGeoVolume *airCoolTubes = new TGeoVolume("ITSsuppSDDSideACoolTubesAir",
6018                                             coolTubesAir, medAir);
6019
6020   airCoolTubes->SetVisibility(kTRUE);
6021   airCoolTubes->SetLineColor(41);
6022   airCoolTubes->SetLineWidth(1);
6023   airCoolTubes->SetFillColor(airCoolTubes->GetLineColor());
6024   airCoolTubes->SetFillStyle(4000); // 0% transparent
6025
6026   TGeoVolume *pbtOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnPBT",
6027                                           optConnPBT, medPBT);
6028
6029   pbtOptConn->SetVisibility(kTRUE);
6030   pbtOptConn->SetLineColor(kRed); // Red
6031   pbtOptConn->SetLineWidth(1);
6032   pbtOptConn->SetFillColor(pbtOptConn->GetLineColor());
6033   pbtOptConn->SetFillStyle(4000); // 0% transparent
6034
6035   TGeoVolume *steelOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnSteel",
6036                                             optConnSteel, medSteel);
6037
6038   steelOptConn->SetVisibility(kTRUE);
6039   steelOptConn->SetLineColor(kBlue); // Blue
6040   steelOptConn->SetLineWidth(1);
6041   steelOptConn->SetFillColor(steelOptConn->GetLineColor());
6042   steelOptConn->SetFillStyle(4000); // 0% transparent
6043
6044   TGeoVolume *alOptConn = new TGeoVolume("ITSsuppSDDSideAOptConnAl",
6045                                          optConnAl, medAl);
6046
6047   alOptConn->SetVisibility(kTRUE);
6048   alOptConn->SetLineColor(6); // Purple
6049   alOptConn->SetLineWidth(1);
6050   alOptConn->SetFillColor(alOptConn->GetLineColor());
6051   alOptConn->SetFillStyle(4000); // 0% transparent
6052
6053   TGeoVolume *optFibs = new TGeoVolume("ITSsuppSDDSideAOptFibs",
6054                                        opticalFibs, medOptFib);
6055
6056   optFibs->SetVisibility(kTRUE);
6057   optFibs->SetLineColor(kOrange+2); // Orange
6058   optFibs->SetLineWidth(1);
6059   optFibs->SetFillColor(optFibs->GetLineColor());
6060   optFibs->SetFillStyle(4000); // 0% transparent
6061
6062   TGeoVolume *cuInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsCu",
6063                                            inputCabsCu, medCu);
6064
6065   cuInputCabs->SetVisibility(kTRUE);
6066   cuInputCabs->SetLineColor(kBlack); // Black
6067   cuInputCabs->SetLineWidth(1);
6068   cuInputCabs->SetFillColor(cuInputCabs->GetLineColor());
6069   cuInputCabs->SetFillStyle(4000); // 0% transparent
6070
6071   TGeoVolume *plastInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsPlast",
6072                                               inputCabsPlast, medPUR);
6073
6074   plastInputCabs->SetVisibility(kTRUE);
6075   plastInputCabs->SetLineColor(kRed); // Red
6076   plastInputCabs->SetLineWidth(1);
6077   plastInputCabs->SetFillColor(plastInputCabs->GetLineColor());
6078   plastInputCabs->SetFillStyle(4000); // 0% transparent
6079
6080   TGeoVolume *alInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsAl",
6081                                            inputCabsAl, medAl);
6082
6083   alInputCabs->SetVisibility(kTRUE);
6084   alInputCabs->SetLineColor(6); // Purple
6085   alInputCabs->SetLineWidth(1);
6086   alInputCabs->SetFillColor(alInputCabs->GetLineColor());
6087   alInputCabs->SetFillStyle(4000); // 0% transparent
6088
6089   TGeoVolume *kaptonInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsKapton",
6090                                                inputCabsKapton, medKapton);
6091
6092   kaptonInputCabs->SetVisibility(kTRUE);
6093   kaptonInputCabs->SetLineColor(14); // 
6094   kaptonInputCabs->SetLineWidth(1);
6095   kaptonInputCabs->SetFillColor(kaptonInputCabs->GetLineColor());
6096   kaptonInputCabs->SetFillStyle(4000); // 0% transparent
6097
6098   TGeoVolume *polyaxInputCabs = new TGeoVolume("ITSsuppSDDSideAInputCabsPOLYAX",
6099                                                inputCabsPOLYAX, medPOLYAX);
6100
6101   polyaxInputCabs->SetVisibility(kTRUE);
6102   polyaxInputCabs->SetLineColor(34); // 
6103   polyaxInputCabs->SetLineWidth(1);
6104   polyaxInputCabs->SetFillColor(polyaxInputCabs->GetLineColor());
6105   polyaxInputCabs->SetFillStyle(4000); // 0% transparent
6106
6107   TGeoVolume *cuOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsCu",
6108                                             outputCabsCu, medCu);
6109
6110   cuOutputCabs->SetVisibility(kTRUE);
6111   cuOutputCabs->SetLineColor(kBlack); // Black
6112   cuOutputCabs->SetLineWidth(1);
6113   cuOutputCabs->SetFillColor(cuOutputCabs->GetLineColor());
6114   cuOutputCabs->SetFillStyle(4000); // 0% transparent
6115
6116   TGeoVolume *plastOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsPlast",
6117                                                outputCabsPlast, medPUR);
6118
6119   plastOutputCabs->SetVisibility(kTRUE);
6120   plastOutputCabs->SetLineColor(kRed); // Red
6121   plastOutputCabs->SetLineWidth(1);
6122   plastOutputCabs->SetFillColor(plastOutputCabs->GetLineColor());
6123   plastOutputCabs->SetFillStyle(4000); // 0% transparent
6124
6125   TGeoVolume *alOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsAl",
6126                                             outputCabsAl, medAl);
6127
6128   alOutputCabs->SetVisibility(kTRUE);
6129   alOutputCabs->SetLineColor(6); // Purple
6130   alOutputCabs->SetLineWidth(1);
6131   alOutputCabs->SetFillColor(alOutputCabs->GetLineColor());
6132   alOutputCabs->SetFillStyle(4000); // 0% transparent
6133
6134   TGeoVolume *kaptonOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsKapton",
6135                                                 outputCabsKapton, medKapton);
6136
6137   kaptonOutputCabs->SetVisibility(kTRUE);
6138   kaptonOutputCabs->SetLineColor(14); // 
6139   kaptonOutputCabs->SetLineWidth(1);
6140   kaptonOutputCabs->SetFillColor(kaptonOutputCabs->GetLineColor());
6141   kaptonOutputCabs->SetFillStyle(4000); // 0% transparent
6142
6143   TGeoVolume *polyaxOutputCabs = new TGeoVolume("ITSsuppSDDSideAOutputCabsPOLYAX",
6144                                                 outputCabsPOLYAX, medPOLYAX);
6145
6146   polyaxOutputCabs->SetVisibility(kTRUE);
6147   polyaxOutputCabs->SetLineColor(34); // 
6148   polyaxOutputCabs->SetLineWidth(1);
6149   polyaxOutputCabs->SetFillColor(polyaxOutputCabs->GetLineColor());
6150   polyaxOutputCabs->SetFillStyle(4000); // 0% transparent
6151
6152   TGeoVolume *cuPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsCu",
6153                                            pcbBoardsCu, medCu);
6154
6155   cuPCBBoards->SetVisibility(kTRUE);
6156   cuPCBBoards->SetLineColor(kBlack); // Black
6157   cuPCBBoards->SetLineWidth(1);
6158   cuPCBBoards->SetFillColor(cuPCBBoards->GetLineColor());
6159   cuPCBBoards->SetFillStyle(4000); // 0% transparent
6160
6161   TGeoVolume *epoxyPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsEpoxy",
6162                                               pcbBoardsEpoxy, medEpoxy);
6163
6164   epoxyPCBBoards->SetVisibility(kTRUE);
6165   epoxyPCBBoards->SetLineColor(22); //
6166   epoxyPCBBoards->SetLineWidth(1);
6167   epoxyPCBBoards->SetFillColor(epoxyPCBBoards->GetLineColor());
6168   epoxyPCBBoards->SetFillStyle(4000); // 0% transparent
6169
6170   TGeoVolume *plastPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsPlast",
6171                                               pcbBoardsPlast, medPUR);
6172
6173   plastPCBBoards->SetVisibility(kTRUE);
6174   plastPCBBoards->SetLineColor(kRed); // Red
6175   plastPCBBoards->SetLineWidth(1);
6176   plastPCBBoards->SetFillColor(plastPCBBoards->GetLineColor());
6177   plastPCBBoards->SetFillStyle(4000); // 0% transparent
6178
6179   TGeoVolume *steelPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsSteel",
6180                                               pcbBoardsSteel, medSteel);
6181
6182   steelPCBBoards->SetVisibility(kTRUE);
6183   steelPCBBoards->SetLineColor(kBlue); // Blue
6184   steelPCBBoards->SetLineWidth(1);
6185   steelPCBBoards->SetFillColor(steelPCBBoards->GetLineColor());
6186   steelPCBBoards->SetFillStyle(4000); // 0% transparent
6187
6188   TGeoVolume *ppsPCBBoards = new TGeoVolume("ITSsuppSDDSideAPCBBoardsPPS",
6189                                             pcbBoardsPPS, medPPS);
6190
6191   ppsPCBBoards->SetVisibility(kTRUE);
6192   ppsPCBBoards->SetLineColor(kGreen); // Green
6193   ppsPCBBoards->SetLineWidth(1);
6194   ppsPCBBoards->SetFillColor(ppsPCBBoards->GetLineColor());
6195   ppsPCBBoards->SetFillStyle(4000); // 0% transparent
6196
6197
6198   // Now build up the tray
6199   yloc = kForwardTrayTotalHeight - forwardCover->GetY(3);
6200   zloc = kForwardTrayUpperLength - kForwardCoverLength;
6201   cableTrayA->AddNode(forwardTrayCover, 1,
6202                       new TGeoTranslation( 0, yloc, zloc) );
6203
6204   Double_t totalhi = kExternTrayTotalHeight + kExternCoverThick
6205                    - kExternCoverYTrans;
6206
6207   yloc = totalhi*(1 - CosD(kTrayAZRot)) + kExternTrayYTrans -
6208          kExternTrayTotalHeight*CosD(kTrayAZRot);
6209   zloc = kExternTrayZTrans + totalhi*SinD(kTrayAZRot);
6210   cableTrayA->AddNode(externalTraySDD, 1,
6211                       new TGeoCombiTrans( 0, yloc, zloc,
6212                       new TGeoRotation("", 0,-kTrayAZRot, 0)        ) );
6213
6214   yloc = kExternCoverThick*(1 - CosD(kTrayAZRot)) + kExternTrayYTrans -
6215          kExternCoverYTrans*CosD(kTrayAZRot)/2-0.01;
6216   zloc = kExternTrayZTrans + kExternCoverThick*SinD(kTrayAZRot);
6217   cableTrayA->AddNode(externTrayCover,1,
6218                       new TGeoCombiTrans( 0, yloc, zloc,
6219                       new TGeoRotation("", 0,-kTrayAZRot, 0)        ) );
6220
6221   yloc = kForwardTrayThick + coolManifPOM->GetDY();
6222   zloc = coolManifPOM->GetDZ();
6223   cableTrayA->AddNode(pomCoolManif, 1,
6224                       new TGeoTranslation( 0, yloc, zloc) );
6225
6226   yloc += coolManifPOM->GetDY() + coolManifSteel->GetDY();
6227   cableTrayA->AddNode(steelCoolManif, 1,
6228                       new TGeoTranslation( 0, yloc, zloc) );
6229
6230   yloc += coolManifSteel->GetDY() + coolManifWater->GetDY();
6231   cableTrayA->AddNode(waterCoolManif, 1,
6232                       new TGeoTranslation( 0, yloc, zloc) );
6233
6234   yloc += coolManifWater->GetDY() + coolManifAl->GetDY();
6235   cableTrayA->AddNode(alCoolManif, 1,
6236                       new TGeoTranslation( 0, yloc, zloc) );
6237
6238   cableTrayA->AddNode(purCoolTubes,1,
6239                       new TGeoCombiTrans( 0, 0, 0,
6240                       new TGeoRotation("",-90, 90, 90)        ) );
6241   cableTrayA->AddNode(waterCoolTubes,1,
6242                       new TGeoCombiTrans( 0, 0, 0,
6243                       new TGeoRotation("",-90, 90, 90)        ) );
6244   cableTrayA->AddNode(airCoolTubes,1,
6245                       new TGeoCombiTrans( 0, 0, 0,
6246                       new TGeoRotation("",-90, 90, 90)        ) );
6247
6248   xloc = coolManifPOM->GetDX() + optConnPBT->GetDX();
6249   yloc = kForwardTrayThick + optConnPBT->GetDY();
6250   zloc = optConnPBT->GetDZ();
6251   cableTrayA->AddNode(pbtOptConn, 1,
6252                       new TGeoTranslation( xloc, yloc, zloc) );
6253   cableTrayA->AddNode(pbtOptConn, 2,
6254                       new TGeoTranslation(-xloc, yloc, zloc) );
6255
6256   yloc += optConnPBT->GetDY() + optConnSteel->GetDY();
6257   cableTrayA->AddNode(steelOptConn, 1,
6258                       new TGeoTranslation( xloc, yloc, zloc) );
6259   cableTrayA->AddNode(steelOptConn, 2,
6260                       new TGeoTranslation(-xloc, yloc, zloc) );
6261
6262   yloc += optConnSteel->GetDY() + optConnAl->GetDY();
6263   cableTrayA->AddNode(alOptConn, 1,
6264                       new TGeoTranslation( xloc, yloc, zloc) );
6265   cableTrayA->AddNode(alOptConn, 2,
6266                       new TGeoTranslation(-xloc, yloc, zloc) );
6267
6268
6269   xloc = kSideACoolTubesWide/2 + kSideAOptFibsWide/2;
6270   cableTrayA->AddNode(optFibs,1,
6271                       new TGeoCombiTrans( xloc, 0, 0,
6272                       new TGeoRotation("",-90, 90, 90)        ) );
6273   cableTrayA->AddNode(optFibs,2,
6274                       new TGeoCombiTrans(-xloc, 0, 0,
6275                       new TGeoRotation("",-90, 90, 90)        ) );
6276
6277   yloc = kForwardTrayTotalHeight - forwardCover->GetY(3) -
6278          kSideAInputCablesYTrans - inputCabsPOLYAX->GetDY();
6279   zloc = inputCabsPOLYAX->GetDZ();
6280   cableTrayA->AddNode(polyaxInputCabs, 1,
6281                       new TGeoTranslation( 0, yloc, zloc) );
6282
6283   yloc -= (inputCabsPOLYAX->GetDY() + inputCabsKapton->GetDY());
6284   cableTrayA->AddNode(kaptonInputCabs, 1,
6285                       new TGeoTranslation( 0, yloc, zloc) );
6286
6287   yloc -= (inputCabsKapton->GetDY() + inputCabsAl->GetDY());
6288   cableTrayA->AddNode(alInputCabs, 1,
6289                       new TGeoTranslation( 0, yloc, zloc) );
6290
6291   yloc -= (inputCabsAl->GetDY() + inputCabsPlast->GetDY());
6292   cableTrayA->AddNode(plastInputCabs, 1,
6293                       new TGeoTranslation( 0, yloc, zloc) );
6294
6295   yloc -= (inputCabsPlast->GetDY() + inputCabsCu->GetDY());
6296   cableTrayA->AddNode(cuInputCabs, 1,
6297                       new TGeoTranslation( 0, yloc, zloc) );
6298
6299   yloc -= (inputCabsCu->GetDY()+pcbBoardsPPS->GetDY()+kSideAPCBBoardsYTrans);
6300   zloc += pcbBoardsPPS->GetDZ();
6301   cableTrayA->AddNode(ppsPCBBoards, 1,
6302                       new TGeoTranslation( 0, yloc, zloc) );
6303
6304   yloc -= (pcbBoardsPPS->GetDY()+pcbBoardsSteel->GetDY());
6305   cableTrayA->AddNode(steelPCBBoards, 1,
6306                       new TGeoTranslation( 0, yloc, zloc) );
6307
6308   yloc -= (pcbBoardsSteel->GetDY()+pcbBoardsPlast->GetDY());
6309   cableTrayA->AddNode(plastPCBBoards, 1,
6310                       new TGeoTranslation( 0, yloc, zloc) );
6311
6312   yloc -= (pcbBoardsPlast->GetDY()+pcbBoardsEpoxy->GetDY());
6313   cableTrayA->AddNode(epoxyPCBBoards, 1,
6314                       new TGeoTranslation( 0, yloc, zloc) );
6315
6316   yloc -= (pcbBoardsEpoxy->GetDY()+pcbBoardsCu->GetDY());
6317   cableTrayA->AddNode(cuPCBBoards, 1,
6318                       new TGeoTranslation( 0, yloc, zloc) );
6319
6320   cableTrayA->AddNode(cuOutputCabs,1,
6321                       new TGeoCombiTrans( 0, 0, 0,
6322                       new TGeoRotation("",-90, 90, 90)        ) );
6323   cableTrayA->AddNode(plastOutputCabs,1,
6324                       new TGeoCombiTrans( 0, 0, 0,
6325                       new TGeoRotation("",-90, 90, 90)        ) );
6326   cableTrayA->AddNode(alOutputCabs,1,
6327                       new TGeoCombiTrans( 0, 0, 0,
6328                       new TGeoRotation("",-90, 90, 90)        ) );
6329   cableTrayA->AddNode(kaptonOutputCabs,1,
6330                       new TGeoCombiTrans( 0, 0, 0,
6331                       new TGeoRotation("",-90, 90, 90)        ) );
6332   cableTrayA->AddNode(polyaxOutputCabs,1,
6333                       new TGeoCombiTrans( 0, 0, 0,
6334                       new TGeoRotation("",-90, 90, 90)        ) );
6335
6336
6337   // Finally put everything in the mother volume
6338   Double_t rforw = kTrayARTrans + kExternTrayTotalHeight +
6339                    kExternCoverSideThick -
6340                    kForwardTrayTailHeight;
6341
6342   alpharot = -kTrayAFirstRotAng;
6343   xloc = rforw*SinD(alpharot);
6344   yloc = rforw*CosD(alpharot);
6345   zloc = kTrayAZTrans + kTrayAZToSupportRing - kForwardTrayUpperLength;
6346
6347   moth->AddNode(cableTrayA,1,
6348                             new TGeoCombiTrans( xloc, yloc, zloc,
6349                             new TGeoRotation("",-alpharot,0,0)   )   );
6350
6351   alpharot += 180;
6352   xloc = rforw*SinD(alpharot);
6353   yloc = rforw*CosD(alpharot);
6354   moth->AddNode(cableTrayA,2,
6355                             new TGeoCombiTrans( xloc, yloc, zloc,
6356                             new TGeoRotation("",-alpharot,0,0)   )   );
6357
6358   alpharot = kTrayAFirstRotAng + 2*kTrayASecondRotAng;
6359   xloc = rforw*SinD(alpharot);
6360   yloc = rforw*CosD(alpharot);
6361   moth->AddNode(cableTrayA,3,
6362                             new TGeoCombiTrans( xloc, yloc, zloc,
6363                             new TGeoRotation("",-alpharot,0,0)   )   );
6364
6365   alpharot += 180;
6366   xloc = rforw*SinD(alpharot);
6367   yloc = rforw*CosD(alpharot);
6368   moth->AddNode(cableTrayA,4,
6369                             new TGeoCombiTrans( xloc, yloc, zloc,
6370                             new TGeoRotation("",-alpharot,0,0)   )   );
6371
6372
6373   return;
6374 }
6375
6376 //______________________________________________________________________
6377 void AliITSv11GeometrySupport::SDDCableTraysSideC(TGeoVolume *moth,
6378                                             const TGeoManager *mgr){
6379 //
6380 // Creates the SDD cable trays which are outside the ITS support cones
6381 // but still inside the TPC on Side C
6382 // (part of this code is taken or anyway inspired to ServicesCableSupport
6383 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
6384 //
6385 // Input:
6386 //         moth : the TGeoVolume owing the volume structure
6387 //         mgr  : the GeoManager (default gGeoManager)
6388 // Output:
6389 //
6390 // Created:         ???       Bjorn S. Nilsen
6391 // Updated:      17 Apr 2010  Mario Sitta
6392 //
6393 // Technical data are taken from AutoCAD drawings and other (oral)
6394 // information given by F.Tosello
6395 //
6396
6397   // Dimensions and positions of the C-Side Cable Tray
6398   // (Change accordingly to CreateSDDSSDTraysSideC !)
6399   const Int_t    kNumTraySideC           =    4;
6400
6401   const Double_t kSideCHalfThick         =    0.100   *fgkcm;
6402   const Double_t kSideCLength1           =  172.800   *fgkcm;
6403   const Double_t kSideCLength2           =  189.300   *fgkcm;
6404   const Double_t kBarCoolRmax            =    0.4     *fgkcm;
6405   const Double_t kXShiftBarCool          =   13.00    *fgkcm;
6406
6407   const Double_t kSideCFoldAngle         =    5.00 *fgkDegree;
6408
6409   // Dimensions and positions of the Cable Tray elements
6410   const Double_t kSideCCoolManifHalfX    =    4.25    *fgkcm;
6411   const Double_t kSideCCoolManifHalfY    =    4.03    *fgkcm;
6412   const Double_t kSideCCoolManifHalfZ    =    2.17    *fgkcm;
6413   const Double_t kSideCCoolManifPOMFrac  =    0.0051;
6414   const Double_t kSideCCoolManifSteelFrac=    0.8502;
6415   const Double_t kSideCCoolManifWaterFrac=    0.0868;
6416   const Double_t kSideCCoolManifAlFrac   =    0.0579;
6417
6418   const Double_t kSideCCoolTubesHigh     =    1.88    *fgkcm;
6419   const Double_t kSideCCoolTubesTrans    =    0.85    *fgkcm;
6420   const Double_t kSideCCoolTubesPURFrac  =    0.5884;
6421   const Double_t kSideCCoolTubesWaterFrac=    0.4114;
6422   const Double_t kSideCCoolTubesAirFrac  =    0.0002;
6423
6424   const Double_t kSideCOptConnHalfX      =    0.90    *fgkcm;
6425   const Double_t kSideCOptConnHalfZ      =    1.37    *fgkcm;
6426   const Double_t kSideCOptConnPBTFrac    =    0.6798;
6427   const Double_t kSideCOptConnSteelFrac  =    0.2421;
6428   const Double_t kSideCOptConnAlFrac     =    0.0781;
6429
6430   const Double_t kSideCOptFibsWide       =    0.71    *fgkcm;
6431   const Double_t kSideCOptFibsHigh       =    3.20    *fgkcm;
6432   const Double_t kSideCOptFibsTrans      =    0.20    *fgkcm;
6433
6434   const Double_t kSideCInputCablesLen    =   31.45    *fgkcm;
6435   const Double_t kSideCInputCablesWide   =   12.50    *fgkcm;
6436   const Double_t kSideCInputCablesHigh   =    0.95    *fgkcm;
6437   const Double_t kSideCInputCablesTrans  =    1.15    *fgkcm;
6438   const Double_t kSideCInputCablesCu     =    0.7405;
6439   const Double_t kSideCInputCablesPlast  =    0.1268;
6440   const Double_t kSideCInputCablesAl     =    0.0057;
6441   const Double_t kSideCInputCablesKapton =    0.0172;
6442   const Double_t kSideCInputCablesPOLYAX =    0.1098;
6443
6444   const Double_t kSideCOutputCablesX0    =   27.40    *fgkcm;
6445   const Double_t kSideCOutputCablesWide  =    8.50    *fgkcm;
6446   const Double_t kSideCOutputCablesHigh  =    1.18    *fgkcm;
6447   const Double_t kSideCOutputCablesCu    =    0.6775;
6448   const Double_t kSideCOutputCablesPlast =    0.1613;
6449   const Double_t kSideCOutputCablesAl    =    0.0078;
6450   const Double_t kSideCOutputCablesKapton=    0.0234;
6451   const Double_t kSideCOutputCablesPOLYAX=    0.1300;
6452
6453   const Double_t kSideCPCBBoardsHalfX    =    6.30    *fgkcm;
6454   const Double_t kSideCPCBBoardsHalfY    =    2.00    *fgkcm;
6455   const Double_t kSideCPCBBoardsHalfZ    =   21.93    *fgkcm;
6456   const Double_t kSideCPCBBoardsCu       =    0.3864;
6457   const Double_t kSideCPCBBoardsEpoxy    =    0.1491;
6458   const Double_t kSideCPCBBoardsPlast    =    0.0579;
6459   const Double_t kSideCPCBBoardsSteel    =    0.1517;
6460   const Double_t kSideCPCBBoardsPPS      =    0.2549;
6461
6462   // Overall position and rotation of the C-Side Cable Trays
6463   const Double_t kTraySideCRPos          =   45.30    *fgkcm;
6464   const Double_t kTraySideCZPos          = -102.40    *fgkcm;
6465   const Double_t kTraySideCAlphaRot[kNumTraySideC]  = {    -23.0,      59.0,
6466     /* from SSD tray position */                       180.-23.0, 180.+59.0};
6467
6468
6469   // Local variables
6470   Double_t xprof[6], yprof[6];
6471   Double_t height, xloc, yloc, zloc, alpharot, alphafold;
6472
6473
6474   // The assembly holding the metallic structure
6475   TGeoVolumeAssembly *trayStructure = CreateSDDSSDTraysSideC("ITSsupportSDDTrayC");
6476
6477   // Now the volumes inside it
6478   // The cooling manifold: four boxes
6479   // (X and Z are inverted on tray reference system)
6480   TGeoBBox *coolManifPOM = new TGeoBBox(kSideCCoolManifHalfZ,
6481                  kSideCCoolManifPOMFrac*kSideCCoolManifHalfY,
6482                                         kSideCCoolManifHalfX);
6483
6484   TGeoBBox *coolManifSteel = new TGeoBBox(kSideCCoolManifHalfZ,
6485                  kSideCCoolManifSteelFrac*kSideCCoolManifHalfY,
6486                                           kSideCCoolManifHalfX);
6487
6488   TGeoBBox *coolManifWater = new TGeoBBox(kSideCCoolManifHalfZ,
6489                  kSideCCoolManifWaterFrac*kSideCCoolManifHalfY,
6490                                           kSideCCoolManifHalfX);
6491
6492   TGeoBBox *coolManifAl = new TGeoBBox(kSideCCoolManifHalfZ,
6493                  kSideCCoolManifAlFrac*kSideCCoolManifHalfY,
6494                                        kSideCCoolManifHalfX);
6495
6496   // The cooling tubes: three Xtru's
6497   alpharot = kSideCFoldAngle*TMath::DegToRad();
6498
6499   TGeoXtru *coolTubesPUR = new TGeoXtru(2);
6500
6501   height = kSideCCoolTubesHigh*kSideCCoolTubesPURFrac;
6502
6503   xprof[0] = 2*kSideCCoolManifHalfZ;
6504   yprof[0] = 2*kSideCHalfThick + kSideCCoolTubesTrans;
6505   xprof[1] = kSideCLength1;
6506   yprof[1] = yprof[0];
6507   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(alpharot);
6508   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(alpharot);
6509   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6510   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6511   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6512               height, xprof[4], yprof[4]);
6513   xprof[5] = xprof[0];
6514   yprof[5] = yprof[0] + height;
6515
6516   coolTubesPUR->DefinePolygon(6, xprof, yprof);
6517   coolTubesPUR->DefineSection(0,-kSideCCoolManifHalfX);
6518   coolTubesPUR->DefineSection(1, kSideCCoolManifHalfX);
6519
6520   TGeoXtru *coolTubesWater = new TGeoXtru(2);
6521
6522   height = kSideCCoolTubesHigh*kSideCCoolTubesWaterFrac;
6523
6524   xprof[0] = coolTubesPUR->GetX(5);
6525   yprof[0] = coolTubesPUR->GetY(5);
6526   xprof[1] = coolTubesPUR->GetX(4);
6527   yprof[1] = coolTubesPUR->GetY(4);
6528   xprof[2] = coolTubesPUR->GetX(3);
6529   yprof[2] = coolTubesPUR->GetY(3);
6530   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6531   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6532   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6533               height, xprof[4], yprof[4]);
6534   xprof[5] = xprof[0];
6535   yprof[5] = yprof[0] + height;
6536
6537   coolTubesWater->DefinePolygon(6, xprof, yprof);
6538   coolTubesWater->DefineSection(0,-kSideCCoolManifHalfX);
6539   coolTubesWater->DefineSection(1, kSideCCoolManifHalfX);
6540
6541   TGeoXtru *coolTubesAir = new TGeoXtru(2);
6542
6543   height = kSideCCoolTubesHigh*kSideCCoolTubesAirFrac;
6544
6545   xprof[0] = coolTubesWater->GetX(5);
6546   yprof[0] = coolTubesWater->GetY(5);
6547   xprof[1] = coolTubesWater->GetX(4);
6548   yprof[1] = coolTubesWater->GetY(4);
6549   xprof[2] = coolTubesWater->GetX(3);
6550   yprof[2] = coolTubesWater->GetY(3);
6551   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6552   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6553   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6554               height, xprof[4], yprof[4]);
6555   xprof[5] = xprof[0];
6556   yprof[5] = yprof[0] + height;
6557
6558   coolTubesAir->DefinePolygon(6, xprof, yprof);
6559   coolTubesAir->DefineSection(0,-kSideCCoolManifHalfX);
6560   coolTubesAir->DefineSection(1, kSideCCoolManifHalfX);
6561
6562   // The optical fiber connectors: three boxes
6563   // (X and Z are inverted on tray reference system)
6564   TGeoBBox *optConnPBT = new TGeoBBox(kSideCOptConnHalfZ,
6565                  kSideCOptConnPBTFrac*kSideCCoolManifHalfY,
6566                                       kSideCOptConnHalfX);
6567
6568   TGeoBBox *optConnSteel = new TGeoBBox(kSideCOptConnHalfZ,
6569                  kSideCOptConnSteelFrac*kSideCCoolManifHalfY,
6570                                         kSideCOptConnHalfX);
6571
6572   TGeoBBox *optConnAl = new TGeoBBox(kSideCOptConnHalfZ,
6573                  kSideCOptConnAlFrac*kSideCCoolManifHalfY,
6574                                      kSideCOptConnHalfX);
6575
6576   // The optical fibers: a Xtru
6577   TGeoXtru *opticalFibs = new TGeoXtru(2);
6578
6579   xprof[0] = 2*kSideCOptConnHalfZ;
6580   yprof[0] = 2*kSideCHalfThick + kSideCOptFibsTrans;
6581   xprof[1] = kSideCLength1;
6582   yprof[1] = yprof[0];
6583   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(alpharot);
6584   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(alpharot);
6585   xprof[3] = xprof[2] - kSideCOptFibsHigh*TMath::Sin(alpharot);
6586   yprof[3] = yprof[2] + kSideCOptFibsHigh*TMath::Cos(alpharot);
6587   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6588               kSideCOptFibsHigh, xprof[4], yprof[4]);
6589   xprof[5] = xprof[0];
6590   yprof[5] = yprof[0] + kSideCOptFibsHigh;
6591
6592   opticalFibs->DefinePolygon(6, xprof, yprof);
6593   opticalFibs->DefineSection(0,-kSideCOptFibsWide/2);
6594   opticalFibs->DefineSection(1, kSideCOptFibsWide/2);
6595
6596   // The input cables: five boxes
6597   // (X and Z are inverted on tray reference system)
6598   TGeoBBox *inputCabsCu = new TGeoBBox(kSideCInputCablesLen/2,
6599                    kSideCInputCablesCu*kSideCInputCablesHigh/2,
6600                                        kSideCInputCablesWide/2);
6601
6602   TGeoBBox *inputCabsPlast = new TGeoBBox(kSideCInputCablesLen/2,
6603                    kSideCInputCablesPlast*kSideCInputCablesHigh/2,
6604                                           kSideCInputCablesWide/2);
6605
6606   TGeoBBox *inputCabsAl = new TGeoBBox(kSideCInputCablesLen/2,
6607                    kSideCInputCablesAl*kSideCInputCablesHigh/2,
6608                                        kSideCInputCablesWide/2);
6609
6610   TGeoBBox *inputCabsKapton = new TGeoBBox(kSideCInputCablesLen/2,
6611                    kSideCInputCablesKapton*kSideCInputCablesHigh/2,
6612                                            kSideCInputCablesWide/2);
6613
6614   TGeoBBox *inputCabsPOLYAX = new TGeoBBox(kSideCInputCablesLen/2,
6615                    kSideCInputCablesPOLYAX*kSideCInputCablesHigh/2,
6616                                            kSideCInputCablesWide/2);
6617
6618   // The output cables: five Xtru
6619   TGeoXtru *outputCabsCu = new TGeoXtru(2);
6620
6621   height = kSideCOutputCablesCu*kSideCOutputCablesHigh;
6622
6623   xprof[0] = coolTubesAir->GetX(5) + kSideCOutputCablesX0;
6624   yprof[0] = coolTubesAir->GetY(5);
6625   xprof[1] = coolTubesAir->GetX(4);
6626   yprof[1] = coolTubesAir->GetY(4);
6627   xprof[2] = coolTubesAir->GetX(3);
6628   yprof[2] = coolTubesAir->GetY(3);
6629   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6630   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6631   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6632               height, xprof[4], yprof[4]);
6633   xprof[5] = xprof[0];
6634   yprof[5] = yprof[0] + height;
6635
6636   outputCabsCu->DefinePolygon(6, xprof, yprof);
6637   outputCabsCu->DefineSection(0,-kSideCOutputCablesWide/2);
6638   outputCabsCu->DefineSection(1, kSideCOutputCablesWide/2);
6639
6640   TGeoXtru *outputCabsPlast = new TGeoXtru(2);
6641
6642   height = kSideCOutputCablesPlast*kSideCOutputCablesHigh;
6643
6644   xprof[0] = outputCabsCu->GetX(5);
6645   yprof[0] = outputCabsCu->GetY(5);
6646   xprof[1] = outputCabsCu->GetX(4);
6647   yprof[1] = outputCabsCu->GetY(4);
6648   xprof[2] = outputCabsCu->GetX(3);
6649   yprof[2] = outputCabsCu->GetY(3);
6650   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6651   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6652   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6653               height, xprof[4], yprof[4]);
6654   xprof[5] = xprof[0];
6655   yprof[5] = yprof[0] + height;
6656
6657   outputCabsPlast->DefinePolygon(6, xprof, yprof);
6658   outputCabsPlast->DefineSection(0,-kSideCOutputCablesWide/2);
6659   outputCabsPlast->DefineSection(1, kSideCOutputCablesWide/2);
6660
6661   TGeoXtru *outputCabsAl = new TGeoXtru(2);
6662
6663   height = kSideCOutputCablesAl*kSideCOutputCablesHigh;
6664
6665   xprof[0] = outputCabsPlast->GetX(5);
6666   yprof[0] = outputCabsPlast->GetY(5);
6667   xprof[1] = outputCabsPlast->GetX(4);
6668   yprof[1] = outputCabsPlast->GetY(4);
6669   xprof[2] = outputCabsPlast->GetX(3);
6670   yprof[2] = outputCabsPlast->GetY(3);
6671   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6672   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6673   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6674               height, xprof[4], yprof[4]);
6675   xprof[5] = xprof[0];
6676   yprof[5] = yprof[0] + height;
6677
6678   outputCabsAl->DefinePolygon(6, xprof, yprof);
6679   outputCabsAl->DefineSection(0,-kSideCOutputCablesWide/2);
6680   outputCabsAl->DefineSection(1, kSideCOutputCablesWide/2);
6681
6682   TGeoXtru *outputCabsKapton = new TGeoXtru(2);
6683
6684   height = kSideCOutputCablesKapton*kSideCOutputCablesHigh;
6685
6686   xprof[0] = outputCabsAl->GetX(5);
6687   yprof[0] = outputCabsAl->GetY(5);
6688   xprof[1] = outputCabsAl->GetX(4);
6689   yprof[1] = outputCabsAl->GetY(4);
6690   xprof[2] = outputCabsAl->GetX(3);
6691   yprof[2] = outputCabsAl->GetY(3);
6692   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6693   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6694   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6695               height, xprof[4], yprof[4]);
6696   xprof[5] = xprof[0];
6697   yprof[5] = yprof[0] + height;
6698
6699   outputCabsKapton->DefinePolygon(6, xprof, yprof);
6700   outputCabsKapton->DefineSection(0,-kSideCOutputCablesWide/2);
6701   outputCabsKapton->DefineSection(1, kSideCOutputCablesWide/2);
6702
6703   TGeoXtru *outputCabsPOLYAX = new TGeoXtru(2);
6704
6705   height = kSideCOutputCablesPOLYAX*kSideCOutputCablesHigh;
6706
6707   xprof[0] = outputCabsKapton->GetX(5);
6708   yprof[0] = outputCabsKapton->GetY(5);
6709   xprof[1] = outputCabsKapton->GetX(4);
6710   yprof[1] = outputCabsKapton->GetY(4);
6711   xprof[2] = outputCabsKapton->GetX(3);
6712   yprof[2] = outputCabsKapton->GetY(3);
6713   xprof[3] = xprof[2] - height*TMath::Sin(alpharot);
6714   yprof[3] = yprof[2] + height*TMath::Cos(alpharot);
6715   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
6716               height, xprof[4], yprof[4]);
6717   xprof[5] = xprof[0];
6718   yprof[5] = yprof[0] + height;
6719
6720   outputCabsPOLYAX->DefinePolygon(6, xprof, yprof);
6721   outputCabsPOLYAX->DefineSection(0,-kSideCOutputCablesWide/2);
6722   outputCabsPOLYAX->DefineSection(1, kSideCOutputCablesWide/2);
6723
6724   // The PCB boards: five boxes
6725   // (X and Z are inverted on tray reference system)
6726   TGeoBBox *pcbBoardsCu = new TGeoBBox(kSideCPCBBoardsHalfZ,
6727                      kSideCPCBBoardsCu*kSideCPCBBoardsHalfY,
6728                                        kSideCPCBBoardsHalfX);
6729
6730   TGeoBBox *pcbBoardsEpoxy = new TGeoBBox(kSideCPCBBoardsHalfZ,
6731                      kSideCPCBBoardsEpoxy*kSideCPCBBoardsHalfY,
6732                                           kSideCPCBBoardsHalfX);
6733
6734   TGeoBBox *pcbBoardsPlast = new TGeoBBox(kSideCPCBBoardsHalfZ,
6735                      kSideCPCBBoardsPlast*kSideCPCBBoardsHalfY,
6736                                           kSideCPCBBoardsHalfX);
6737
6738   TGeoBBox *pcbBoardsSteel = new TGeoBBox(kSideCPCBBoardsHalfZ,
6739                      kSideCPCBBoardsSteel*kSideCPCBBoardsHalfY,
6740                                           kSideCPCBBoardsHalfX);
6741
6742   TGeoBBox *pcbBoardsPPS = new TGeoBBox(kSideCPCBBoardsHalfZ,
6743                      kSideCPCBBoardsPPS*kSideCPCBBoardsHalfY,
6744                                         kSideCPCBBoardsHalfX);
6745
6746
6747   // We have all shapes: now create the real volumes
6748   TGeoMedium *medPOM    = mgr->GetMedium("ITS_POLYOXYMETHYLENE$");
6749   TGeoMedium *medSteel  = mgr->GetMedium("ITS_INOX$");
6750   TGeoMedium *medWater  = mgr->GetMedium("ITS_WATER$");
6751   TGeoMedium *medAl     = mgr->GetMedium("ITS_ALUMINUM$");
6752   TGeoMedium *medCu     = mgr->GetMedium("ITS_COPPER$");
6753   TGeoMedium *medPUR    = mgr->GetMedium("ITS_POLYURETHANE$");
6754   TGeoMedium *medPOLYAX = mgr->GetMedium("ITS_POLYAX$");
6755   TGeoMedium *medKapton = mgr->GetMedium("ITS_SDDKAPTON (POLYCH2)$");
6756   TGeoMedium *medAir    = mgr->GetMedium("ITS_AIR$");
6757   TGeoMedium *medPBT    = mgr->GetMedium("ITS_PBT$");
6758   TGeoMedium *medOptFib = mgr->GetMedium("ITS_SDD OPTICFIB$");
6759   TGeoMedium *medPPS    = mgr->GetMedium("ITS_PPS$");
6760   TGeoMedium *medEpoxy  = mgr->GetMedium("ITS_EPOXY$");
6761
6762   TGeoVolume *pomCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifPOM",
6763                                             coolManifPOM, medPOM);
6764
6765   pomCoolManif->SetVisibility(kTRUE);
6766   pomCoolManif->SetLineColor(kRed); // Red
6767   pomCoolManif->SetLineWidth(1);
6768   pomCoolManif->SetFillColor(pomCoolManif->GetLineColor());
6769   pomCoolManif->SetFillStyle(4000); // 0% transparent
6770
6771   TGeoVolume *steelCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifSteel",
6772                                               coolManifSteel, medSteel);
6773
6774   steelCoolManif->SetVisibility(kTRUE);
6775   steelCoolManif->SetLineColor(kBlue); // Blue
6776   steelCoolManif->SetLineWidth(1);
6777   steelCoolManif->SetFillColor(steelCoolManif->GetLineColor());
6778   steelCoolManif->SetFillStyle(4000); // 0% transparent
6779
6780   TGeoVolume *waterCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifWater",
6781                                               coolManifWater, medWater);
6782
6783   waterCoolManif->SetVisibility(kTRUE);
6784   waterCoolManif->SetLineColor(33); // Light Blue
6785   waterCoolManif->SetLineWidth(1);
6786   waterCoolManif->SetFillColor(waterCoolManif->GetLineColor());
6787   waterCoolManif->SetFillStyle(4000); // 0% transparent
6788
6789   TGeoVolume *alCoolManif = new TGeoVolume("ITSsuppSDDSideCCoolManifAl",
6790                                            coolManifAl, medAl);
6791
6792   alCoolManif->SetVisibility(kTRUE);
6793   alCoolManif->SetLineColor(6); // Purple
6794   alCoolManif->SetLineWidth(1);
6795   alCoolManif->SetFillColor(alCoolManif->GetLineColor());
6796   alCoolManif->SetFillStyle(4000); // 0% transparent
6797
6798   TGeoVolume *purCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesPUR",
6799                                             coolTubesPUR, medPUR);
6800
6801   purCoolTubes->SetVisibility(kTRUE);
6802   purCoolTubes->SetLineColor(kRed); // Red
6803   purCoolTubes->SetLineWidth(1);
6804   purCoolTubes->SetFillColor(purCoolTubes->GetLineColor());
6805   purCoolTubes->SetFillStyle(4000); // 0% transparent
6806
6807   TGeoVolume *waterCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesWater",
6808                                               coolTubesWater, medWater);
6809
6810   waterCoolTubes->SetVisibility(kTRUE);
6811   waterCoolTubes->SetLineColor(33); // Light Blue
6812   waterCoolTubes->SetLineWidth(1);
6813   waterCoolTubes->SetFillColor(waterCoolTubes->GetLineColor());
6814   waterCoolTubes->SetFillStyle(4000); // 0% transparent
6815
6816   TGeoVolume *airCoolTubes = new TGeoVolume("ITSsuppSDDSideCCoolTubesAir",
6817                                             coolTubesAir, medAir);
6818
6819   airCoolTubes->SetVisibility(kTRUE);
6820   airCoolTubes->SetLineColor(41);
6821   airCoolTubes->SetLineWidth(1);
6822   airCoolTubes->SetFillColor(airCoolTubes->GetLineColor());
6823   airCoolTubes->SetFillStyle(4000); // 0% transparent
6824
6825   TGeoVolume *pbtOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnPBT",
6826                                           optConnPBT, medPBT);
6827
6828   pbtOptConn->SetVisibility(kTRUE);
6829   pbtOptConn->SetLineColor(kRed); // Red
6830   pbtOptConn->SetLineWidth(1);
6831   pbtOptConn->SetFillColor(pbtOptConn->GetLineColor());
6832   pbtOptConn->SetFillStyle(4000); // 0% transparent
6833
6834   TGeoVolume *steelOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnSteel",
6835                                             optConnSteel, medSteel);
6836
6837   steelOptConn->SetVisibility(kTRUE);
6838   steelOptConn->SetLineColor(kBlue); // Blue
6839   steelOptConn->SetLineWidth(1);
6840   steelOptConn->SetFillColor(steelOptConn->GetLineColor());
6841   steelOptConn->SetFillStyle(4000); // 0% transparent
6842
6843   TGeoVolume *alOptConn = new TGeoVolume("ITSsuppSDDSideCOptConnAl",
6844                                          optConnAl, medAl);
6845
6846   alOptConn->SetVisibility(kTRUE);
6847   alOptConn->SetLineColor(6); // Purple
6848   alOptConn->SetLineWidth(1);
6849   alOptConn->SetFillColor(alOptConn->GetLineColor());
6850   alOptConn->SetFillStyle(4000); // 0% transparent
6851
6852   TGeoVolume *optFibs = new TGeoVolume("ITSsuppSDDSideCOptFibs",
6853                                        opticalFibs, medOptFib);
6854
6855   optFibs->SetVisibility(kTRUE);
6856   optFibs->SetLineColor(kOrange+2); // Orange
6857   optFibs->SetLineWidth(1);
6858   optFibs->SetFillColor(optFibs->GetLineColor());
6859   optFibs->SetFillStyle(4000); // 0% transparent
6860
6861   TGeoVolume *cuInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsCu",
6862                                            inputCabsCu, medCu);
6863
6864   cuInputCabs->SetVisibility(kTRUE);
6865   cuInputCabs->SetLineColor(kBlack); // Black
6866   cuInputCabs->SetLineWidth(1);
6867   cuInputCabs->SetFillColor(cuInputCabs->GetLineColor());
6868   cuInputCabs->SetFillStyle(4000); // 0% transparent
6869
6870   TGeoVolume *plastInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsPlast",
6871                                               inputCabsPlast, medPUR);
6872
6873   plastInputCabs->SetVisibility(kTRUE);
6874   plastInputCabs->SetLineColor(kRed); // Red
6875   plastInputCabs->SetLineWidth(1);
6876   plastInputCabs->SetFillColor(plastInputCabs->GetLineColor());
6877   plastInputCabs->SetFillStyle(4000); // 0% transparent
6878
6879   TGeoVolume *alInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsAl",
6880                                            inputCabsAl, medAl);
6881
6882   alInputCabs->SetVisibility(kTRUE);
6883   alInputCabs->SetLineColor(6); // Purple
6884   alInputCabs->SetLineWidth(1);
6885   alInputCabs->SetFillColor(alInputCabs->GetLineColor());
6886   alInputCabs->SetFillStyle(4000); // 0% transparent
6887
6888   TGeoVolume *kaptonInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsKapton",
6889                                                inputCabsKapton, medKapton);
6890
6891   kaptonInputCabs->SetVisibility(kTRUE);
6892   kaptonInputCabs->SetLineColor(14); // 
6893   kaptonInputCabs->SetLineWidth(1);
6894   kaptonInputCabs->SetFillColor(kaptonInputCabs->GetLineColor());
6895   kaptonInputCabs->SetFillStyle(4000); // 0% transparent
6896
6897   TGeoVolume *polyaxInputCabs = new TGeoVolume("ITSsuppSDDSideCInputCabsPOLYAX",
6898                                                inputCabsPOLYAX, medPOLYAX);
6899
6900   polyaxInputCabs->SetVisibility(kTRUE);
6901   polyaxInputCabs->SetLineColor(34); // 
6902   polyaxInputCabs->SetLineWidth(1);
6903   polyaxInputCabs->SetFillColor(polyaxInputCabs->GetLineColor());
6904   polyaxInputCabs->SetFillStyle(4000); // 0% transparent
6905
6906   TGeoVolume *cuOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsCu",
6907                                             outputCabsCu, medCu);
6908
6909   cuOutputCabs->SetVisibility(kTRUE);
6910   cuOutputCabs->SetLineColor(kBlack); // Black
6911   cuOutputCabs->SetLineWidth(1);
6912   cuOutputCabs->SetFillColor(cuOutputCabs->GetLineColor());
6913   cuOutputCabs->SetFillStyle(4000); // 0% transparent
6914
6915   TGeoVolume *plastOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsPlast",
6916                                                outputCabsPlast, medPUR);
6917
6918   plastOutputCabs->SetVisibility(kTRUE);
6919   plastOutputCabs->SetLineColor(kRed); // Red
6920   plastOutputCabs->SetLineWidth(1);
6921   plastOutputCabs->SetFillColor(plastOutputCabs->GetLineColor());
6922   plastOutputCabs->SetFillStyle(4000); // 0% transparent
6923
6924   TGeoVolume *alOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsAl",
6925                                             outputCabsAl, medAl);
6926
6927   alOutputCabs->SetVisibility(kTRUE);
6928   alOutputCabs->SetLineColor(6); // Purple
6929   alOutputCabs->SetLineWidth(1);
6930   alOutputCabs->SetFillColor(alOutputCabs->GetLineColor());
6931   alOutputCabs->SetFillStyle(4000); // 0% transparent
6932
6933   TGeoVolume *kaptonOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsKapton",
6934                                                 outputCabsKapton, medKapton);
6935
6936   kaptonOutputCabs->SetVisibility(kTRUE);
6937   kaptonOutputCabs->SetLineColor(14); // 
6938   kaptonOutputCabs->SetLineWidth(1);
6939   kaptonOutputCabs->SetFillColor(kaptonOutputCabs->GetLineColor());
6940   kaptonOutputCabs->SetFillStyle(4000); // 0% transparent
6941
6942   TGeoVolume *polyaxOutputCabs = new TGeoVolume("ITSsuppSDDSideCOutputCabsPOLYAX",
6943                                                 outputCabsPOLYAX, medPOLYAX);
6944
6945   polyaxOutputCabs->SetVisibility(kTRUE);
6946   polyaxOutputCabs->SetLineColor(34); // 
6947   polyaxOutputCabs->SetLineWidth(1);
6948   polyaxOutputCabs->SetFillColor(polyaxOutputCabs->GetLineColor());
6949   polyaxOutputCabs->SetFillStyle(4000); // 0% transparent
6950
6951   TGeoVolume *cuPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsCu",
6952                                            pcbBoardsCu, medCu);
6953
6954   cuPCBBoards->SetVisibility(kTRUE);
6955   cuPCBBoards->SetLineColor(kBlack); // Black
6956   cuPCBBoards->SetLineWidth(1);
6957   cuPCBBoards->SetFillColor(cuPCBBoards->GetLineColor());
6958   cuPCBBoards->SetFillStyle(4000); // 0% transparent
6959
6960   TGeoVolume *epoxyPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsEpoxy",
6961                                               pcbBoardsEpoxy, medEpoxy);
6962
6963   epoxyPCBBoards->SetVisibility(kTRUE);
6964   epoxyPCBBoards->SetLineColor(22); //
6965   epoxyPCBBoards->SetLineWidth(1);
6966   epoxyPCBBoards->SetFillColor(epoxyPCBBoards->GetLineColor());
6967   epoxyPCBBoards->SetFillStyle(4000); // 0% transparent
6968
6969   TGeoVolume *plastPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsPlast",
6970                                               pcbBoardsPlast, medPUR);
6971
6972   plastPCBBoards->SetVisibility(kTRUE);
6973   plastPCBBoards->SetLineColor(kRed); // Red
6974   plastPCBBoards->SetLineWidth(1);
6975   plastPCBBoards->SetFillColor(plastPCBBoards->GetLineColor());
6976   plastPCBBoards->SetFillStyle(4000); // 0% transparent
6977
6978   TGeoVolume *steelPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsSteel",
6979                                               pcbBoardsSteel, medSteel);
6980
6981   steelPCBBoards->SetVisibility(kTRUE);
6982   steelPCBBoards->SetLineColor(kBlue); // Blue
6983   steelPCBBoards->SetLineWidth(1);
6984   steelPCBBoards->SetFillColor(steelPCBBoards->GetLineColor());
6985   steelPCBBoards->SetFillStyle(4000); // 0% transparent
6986
6987   TGeoVolume *ppsPCBBoards = new TGeoVolume("ITSsuppSDDSideCPCBBoardsPPS",
6988                                             pcbBoardsPPS, medPPS);
6989
6990   ppsPCBBoards->SetVisibility(kTRUE);
6991   ppsPCBBoards->SetLineColor(kGreen); // Green
6992   ppsPCBBoards->SetLineWidth(1);
6993   ppsPCBBoards->SetFillColor(ppsPCBBoards->GetLineColor());
6994   ppsPCBBoards->SetFillStyle(4000); // 0% transparent
6995
6996
6997   // Now fill the tray
6998   xloc = coolManifPOM->GetDX();
6999   yloc = 2*kSideCHalfThick + coolManifPOM->GetDY();
7000   trayStructure->AddNode(pomCoolManif, 1,
7001                          new TGeoTranslation( xloc, yloc, 0) );
7002
7003   yloc += coolManifPOM->GetDY() + coolManifSteel->GetDY();
7004   trayStructure->AddNode(steelCoolManif, 1,
7005                          new TGeoTranslation( xloc, yloc, 0) );
7006
7007   yloc += coolManifSteel->GetDY() + coolManifWater->GetDY();
7008   trayStructure->AddNode(waterCoolManif, 1,
7009                          new TGeoTranslation( xloc, yloc, 0) );
7010
7011   yloc += coolManifWater->GetDY() + coolManifAl->GetDY();
7012   trayStructure->AddNode(alCoolManif, 1,
7013                          new TGeoTranslation( xloc, yloc, 0) );
7014
7015   xloc = inputCabsCu->GetDX();
7016   yloc += coolManifWater->GetDY() + inputCabsCu->GetDY()
7017         + kSideCInputCablesTrans;
7018   trayStructure->AddNode(cuInputCabs, 1,
7019                          new TGeoTranslation( xloc, yloc, 0) );
7020
7021   yloc += inputCabsCu->GetDY() + inputCabsPlast->GetDY();
7022   trayStructure->AddNode(plastInputCabs, 1,
7023                          new TGeoTranslation( xloc, yloc, 0) );
7024
7025   yloc += inputCabsPlast->GetDY() + inputCabsAl->GetDY();
7026   trayStructure->AddNode(alInputCabs, 1,
7027                          new TGeoTranslation( xloc, yloc, 0) );
7028
7029   yloc += inputCabsAl->GetDY() + inputCabsKapton->GetDY();
7030   trayStructure->AddNode(kaptonInputCabs, 1,
7031                          new TGeoTranslation( xloc, yloc, 0) );
7032
7033   yloc += inputCabsKapton->GetDY() + inputCabsPOLYAX->GetDY();
7034   trayStructure->AddNode(polyaxInputCabs, 1,
7035                          new TGeoTranslation( xloc, yloc, 0) );
7036
7037   trayStructure->AddNode(purCoolTubes  , 1, 0);
7038   trayStructure->AddNode(waterCoolTubes, 1, 0);
7039   trayStructure->AddNode(airCoolTubes  , 1, 0);
7040
7041   xloc = optConnPBT->GetDX();
7042   yloc = 2*kSideCHalfThick + optConnPBT->GetDY();
7043   zloc = coolManifPOM->GetDZ() + optConnPBT->GetDZ();
7044   trayStructure->AddNode(pbtOptConn, 1,
7045                          new TGeoTranslation( xloc, yloc, zloc) );
7046   trayStructure->AddNode(pbtOptConn, 2,
7047                          new TGeoTranslation( xloc, yloc,-zloc) );
7048
7049   yloc += optConnPBT->GetDY() + optConnSteel->GetDY();
7050   trayStructure->AddNode(steelOptConn, 1,
7051                          new TGeoTranslation( xloc, yloc, zloc) );
7052   trayStructure->AddNode(steelOptConn, 2,
7053                          new TGeoTranslation( xloc, yloc,-zloc) );
7054
7055   yloc += optConnSteel->GetDY() + optConnAl->GetDY();
7056   trayStructure->AddNode(alOptConn, 1,
7057                          new TGeoTranslation( xloc, yloc, zloc) );
7058   trayStructure->AddNode(alOptConn, 2,
7059                          new TGeoTranslation( xloc, yloc,-zloc) );
7060
7061   trayStructure->AddNode(optFibs, 1,
7062                          new TGeoTranslation( 0, 0, zloc) );
7063   trayStructure->AddNode(optFibs, 2,
7064                          new TGeoTranslation( 0, 0,-zloc) );
7065
7066   trayStructure->AddNode(cuOutputCabs    , 1, 0);
7067   trayStructure->AddNode(plastOutputCabs , 1, 0);
7068   trayStructure->AddNode(alOutputCabs    , 1, 0);
7069   trayStructure->AddNode(kaptonOutputCabs, 1, 0);
7070   trayStructure->AddNode(polyaxOutputCabs, 1, 0);
7071
7072   xloc = kXShiftBarCool + kBarCoolRmax + pcbBoardsCu->GetDX();
7073   yloc = outputCabsPOLYAX->GetY(5) + pcbBoardsCu->GetDY();
7074   trayStructure->AddNode(cuPCBBoards, 1,
7075                          new TGeoTranslation( xloc, yloc , 0) );
7076
7077   yloc += pcbBoardsCu->GetDY() + pcbBoardsEpoxy->GetDY();
7078   trayStructure->AddNode(epoxyPCBBoards, 1,
7079                          new TGeoTranslation( xloc, yloc , 0) );
7080
7081   yloc += pcbBoardsEpoxy->GetDY() + pcbBoardsPlast->GetDY();
7082   trayStructure->AddNode(plastPCBBoards, 1,
7083                          new TGeoTranslation( xloc, yloc , 0) );
7084
7085   yloc += pcbBoardsPlast->GetDY() + pcbBoardsSteel->GetDY();
7086   trayStructure->AddNode(steelPCBBoards, 1,
7087                          new TGeoTranslation( xloc, yloc , 0) );
7088
7089   yloc += pcbBoardsSteel->GetDY() + pcbBoardsPPS->GetDY();
7090   trayStructure->AddNode(ppsPCBBoards, 1,
7091                          new TGeoTranslation( xloc, yloc , 0) );
7092
7093
7094   // Finally put everything in the mother volume
7095   alphafold = kSideCFoldAngle;
7096
7097   for (Int_t jt = 0; jt < kNumTraySideC; jt++) {
7098     alpharot = kTraySideCAlphaRot[jt];
7099     xloc = kTraySideCRPos*SinD(alpharot);
7100     yloc = kTraySideCRPos*CosD(alpharot);
7101     moth->AddNode(trayStructure,jt+1,
7102                        new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
7103                        new TGeoRotation("",-90.+alpharot,-90.,90.+alphafold)));
7104   }
7105
7106
7107   return;
7108 }
7109
7110
7111 //______________________________________________________________________
7112 void AliITSv11GeometrySupport::SSDCableTraysSideA(TGeoVolume *moth,
7113                                             const TGeoManager *mgr){
7114 //
7115 // Creates the SSD cable trays which are outside the ITS support cones
7116 // but still inside the TPC on Side A
7117 // (part of this code is taken or anyway inspired to ServicesCableSupport
7118 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
7119 //
7120 // Input:
7121 //         moth : the TGeoVolume owing the volume structure
7122 //         mgr  : the GeoManager (default gGeoManager)
7123 // Output:
7124 //
7125 // Created:         ???       Bjorn S. Nilsen
7126 // Updated:      30 Dec 2009  Mario Sitta
7127 //
7128 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
7129 // drawings and other (oral) information given by F.Tosello and
7130 // Ton van den Brink
7131 // Cables and cooling tubes are approximated with proper materials and
7132 // rectangular cross sections, always preserving the total material budget.
7133 //
7134
7135   // Dimensions and positions of the A-Side Cable Trays
7136   // (parts of 0872/G/D)
7137   const Double_t kTrayARTrans            =  408.35 *fgkmm;
7138   const Double_t kTrayAZTrans            = 1011.00 *fgkmm;
7139   const Double_t kForwardSideYTrans      =   12.00 *fgkmm;//!!!TO BE CHECKED!!!
7140   const Double_t kCoversYTrans           =    2.00 *fgkmm;
7141   const Double_t kTrayAZRot              = (180-169.5);// Degrees
7142   const Double_t kTrayAFirstRotAng       =   22.00;    // Degrees
7143   const Double_t kTrayASecondRotAng      =   15.00;    // Degrees
7144
7145   const Double_t kTrayTotalHeight        =   52.00 *fgkmm;
7146   const Double_t kTrayHeighToBend        =   32.00 *fgkmm;
7147   const Double_t kTrayWidth              =  130.00 *fgkmm;
7148   const Double_t kTrayThick              =    2.00 *fgkmm;
7149
7150   const Double_t kTrayBendAngle          =   22.00 *TMath::DegToRad();
7151
7152   const Double_t kForwardTrayTotalLen    =  853.00 *fgkmm;
7153   const Double_t kForwardTrayFirstLen    =  350.00 *fgkmm;
7154   const Double_t kForwardTrayFirstHeight =   47.00 *fgkmm;
7155   const Double_t kForwardCoverLen        =  420.00 *fgkmm;
7156
7157   const Double_t kForwardSideLength      = kForwardTrayFirstLen;//!!!TO BE CHECKED!!!
7158   const Double_t kForwardSideHeight      =   90.00 *fgkmm;//!!!TO BE CHECKED!!!
7159   const Double_t kForwardSideThick       =    1.00 *fgkmm;//!!!TO BE CHECKED!!!
7160   const Double_t kForwardCoverHeight     =   10.00 *fgkmm;//!!!TO BE CHECKED!!!
7161
7162   const Double_t kExternalTrayTotalLen   = 1200.00 *fgkmm;
7163   const Double_t kExternalCoverLen       = kExternalTrayTotalLen;
7164   const Double_t kExternalCoverThick     =    5.00 *fgkmm;
7165
7166   const Int_t    kForwardTrayNpoints     =   16;
7167
7168   const Double_t kServicesWidth          =  100.00 *fgkmm;
7169   const Double_t kCopperHeight           =   11.20 *fgkmm;// 1120 mm^2
7170   const Double_t kCablePlasticHeight     =   11.50 *fgkmm;// 1150 mm^2
7171   const Double_t kCoolingWaterHeight     =    2.65 *fgkmm;//  265 mm^2
7172   const Double_t kPoliUrethaneHeight     =    4.62 *fgkmm;//  462 mm^2
7173
7174
7175   // Local variables
7176   Double_t xprof[kForwardTrayNpoints], yprof[kForwardTrayNpoints];
7177   Double_t xloc, yloc, zloc, alpharot, totalhi;
7178
7179
7180   // The two tray components as assemblies
7181   TGeoVolumeAssembly *cableTrayAForw =
7182     new TGeoVolumeAssembly("ITSsupportSSDTrayAForw");
7183   TGeoVolumeAssembly *cableTrayAExt =
7184     new TGeoVolumeAssembly("ITSsupportSSDTrayAExt");
7185   
7186
7187   // First create all needed shapes
7188
7189   // The first part of the forward tray (part of 0872/G/D/07): a Xtru
7190   TGeoXtru *forwTrayPart1 = new TGeoXtru(2);
7191
7192   xprof[3] = kTrayWidth/2;
7193   yprof[3] = kForwardTrayFirstHeight;
7194   xprof[2] = xprof[3] - kTrayThick;
7195   yprof[2] = yprof[3];
7196   xprof[4] = xprof[3];
7197   yprof[4] = kTrayTotalHeight - kTrayHeighToBend;
7198   xprof[5] = xprof[4] - yprof[4]*TMath::Tan(kTrayBendAngle);
7199   yprof[5] = 0;
7200
7201   InsidePoint( xprof[3], yprof[3], xprof[4], yprof[4], xprof[5], yprof[5],
7202               -kTrayThick, xprof[1], yprof[1]);
7203
7204   xprof[6] = -xprof[5];
7205   yprof[6] =  yprof[5];
7206
7207   InsidePoint( xprof[4], yprof[4], xprof[5], yprof[5], xprof[6], yprof[6],
7208               -kTrayThick, xprof[0], yprof[0]);
7209
7210   // We did the right side, now reflex on the left side
7211   for (Int_t jp = 0; jp < 6; jp++) {
7212     xprof[6+jp] = -xprof[5-jp];
7213     yprof[6+jp] =  yprof[5-jp];
7214   }
7215
7216   // And now the actual Xtru
7217   forwTrayPart1->DefinePolygon(12, xprof, yprof);
7218   forwTrayPart1->DefineSection(0, 0);
7219   forwTrayPart1->DefineSection(1, kForwardTrayFirstLen);
7220
7221   // The second part of the forward tray (part of 0872/G/D/07): a Xtru
7222   TGeoXtru *forwTrayPart2 =
7223     CreateSDDSSDTraysSideA(kForwardTrayTotalLen - kForwardTrayFirstLen,
7224                            kTrayTotalHeight);
7225
7226   // The external tray (as 0872/G/D/03): a Xtru with same profile
7227   TGeoXtru *externalTray = CreateSDDSSDTraysSideA(kExternalTrayTotalLen,
7228                                                   kTrayTotalHeight);
7229
7230   // The side wall of the forward tray: a BBox
7231   TGeoBBox *forwSide = new TGeoBBox(kForwardSideThick/2,
7232                                     kForwardSideHeight/2,
7233                                     kForwardSideLength/2);
7234
7235   // The side cover over the walls: a Xtru
7236   TGeoXtru *forwSideCover = new TGeoXtru(2);
7237   forwSideCover->SetName("ITSsuppSSDForwCover");
7238
7239   xprof[0] = kTrayWidth/2 + 2*kForwardSideThick;
7240   yprof[0] = kForwardCoverHeight;
7241   xprof[1] = xprof[0];
7242   yprof[1] = 0;
7243   xprof[2] = xprof[1] - kForwardSideThick;
7244   yprof[2] = yprof[1];
7245   xprof[3] = xprof[2];
7246   yprof[3] = yprof[0] - kForwardSideThick;
7247
7248   // We did the right side, now reflex on the left side
7249   for (Int_t jp = 0; jp < 4; jp++) {
7250     xprof[4+jp] = -xprof[3-jp];
7251     yprof[4+jp] =  yprof[3-jp];
7252   }
7253
7254   forwSideCover->DefinePolygon(8, xprof, yprof);
7255   forwSideCover->DefineSection(0, 0);
7256   forwSideCover->DefineSection(1, kForwardSideLength);
7257
7258   // The forward and external covers: two Composite Shape's
7259   TGeoCompositeShape *forwardCover = CreateTrayAForwardCover(kForwardCoverLen);
7260
7261   TGeoCompositeShape *externCover = CreateTrayAExternalCover(kExternalCoverLen);
7262
7263   // The cable copper inside the forward tray: a BBox
7264   TGeoBBox *forwCopper = new TGeoBBox(kServicesWidth/2,
7265                                       kCopperHeight/2,
7266                                       kForwardTrayTotalLen/2);
7267
7268   // The cable copper inside the forward tray: a Xtru
7269   TGeoXtru *extCopper = new TGeoXtru(2);
7270   extCopper->SetName("ITSsuppSSDExtTrayCopper");
7271
7272   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
7273           - kTrayThick;
7274
7275   xprof[0] = -totalhi*TanD(kTrayAZRot);
7276   yprof[0] = kTrayThick;
7277   xprof[1] = kExternalTrayTotalLen;
7278   yprof[1] = yprof[0];
7279   xprof[2] = xprof[1];
7280   yprof[2] = yprof[1] + kCopperHeight;
7281   totalhi -= kCopperHeight;
7282   xprof[3] = -totalhi*TanD(kTrayAZRot);
7283   yprof[3] = yprof[2];
7284
7285   extCopper->DefinePolygon(4, xprof, yprof);
7286   extCopper->DefineSection(0, 0);
7287   extCopper->DefineSection(1, kServicesWidth);
7288
7289   // The cable plastic inside the forward tray: a BBox
7290   TGeoBBox *forwPlastic = new TGeoBBox(kServicesWidth/2,
7291                                        kCablePlasticHeight/2,
7292                                        kForwardTrayTotalLen/2);
7293
7294   // The cable plastic inside the forward tray: a Xtru
7295   TGeoXtru *extPlastic = new TGeoXtru(2);
7296   extPlastic->SetName("ITSsuppSSDExtTrayPlastic");
7297
7298   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
7299           - kTrayThick - kCopperHeight;
7300
7301   xprof[0] = -totalhi*TanD(kTrayAZRot);
7302   yprof[0] = kTrayThick;
7303   xprof[1] = kExternalTrayTotalLen;
7304   yprof[1] = yprof[0];
7305   xprof[2] = xprof[1];
7306   yprof[2] = yprof[1] + kCablePlasticHeight;
7307   totalhi -= kCablePlasticHeight;
7308   xprof[3] = -totalhi*TanD(kTrayAZRot);
7309   yprof[3] = yprof[2];
7310
7311   extPlastic->DefinePolygon(4, xprof, yprof);
7312   extPlastic->DefineSection(0, 0);
7313   extPlastic->DefineSection(1, kServicesWidth);
7314
7315   // The cooling water inside the forward tray: a BBox
7316   TGeoBBox *forwWater = new TGeoBBox(kServicesWidth/2,
7317                                      kCoolingWaterHeight/2,
7318                                      kForwardTrayTotalLen/2);
7319
7320   // The cooling water inside the forward tray: a Xtru
7321   TGeoXtru *extWater = new TGeoXtru(2);
7322   extWater->SetName("ITSsuppSSDExtTrayWater");
7323
7324   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
7325           - kTrayThick - kCopperHeight - kCablePlasticHeight;
7326
7327   xprof[0] = -totalhi*TanD(kTrayAZRot);
7328   yprof[0] = kTrayThick;
7329   xprof[1] = kExternalTrayTotalLen;
7330   yprof[1] = yprof[0];
7331   xprof[2] = xprof[1];
7332   yprof[2] = yprof[1] + kCoolingWaterHeight;
7333   totalhi -= kCoolingWaterHeight;
7334   xprof[3] = -totalhi*TanD(kTrayAZRot);
7335   yprof[3] = yprof[2];
7336
7337   extWater->DefinePolygon(4, xprof, yprof);
7338   extWater->DefineSection(0, 0);
7339   extWater->DefineSection(1, kServicesWidth);
7340
7341   // The polyurethane inside the forward tray: a BBox
7342   TGeoBBox *forwPUR = new TGeoBBox(kServicesWidth/2,
7343                                    kPoliUrethaneHeight/2,
7344                                    kForwardTrayTotalLen/2);
7345
7346   // The poliurethane inside the forward tray: a Xtru
7347   TGeoXtru *extPUR = new TGeoXtru(2);
7348   extPUR->SetName("ITSsuppSSDExtTrayPUR");
7349
7350   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans
7351           - kTrayThick - kCopperHeight - kCablePlasticHeight
7352           - kCoolingWaterHeight;
7353
7354   xprof[0] = -totalhi*TanD(kTrayAZRot);
7355   yprof[0] = kTrayThick;
7356   xprof[1] = kExternalTrayTotalLen;
7357   yprof[1] = yprof[0];
7358   xprof[2] = xprof[1];
7359   yprof[2] = yprof[1] + kPoliUrethaneHeight;
7360   totalhi -= kPoliUrethaneHeight;
7361   xprof[3] = -totalhi*TanD(kTrayAZRot);
7362   yprof[3] = yprof[2];
7363
7364   extPUR->DefinePolygon(4, xprof, yprof);
7365   extPUR->DefineSection(0, 0);
7366   extPUR->DefineSection(1, kServicesWidth);
7367
7368
7369   // We have all shapes: now create the real volumes
7370   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
7371   TGeoMedium *medAntic = mgr->GetMedium("ITS_ANTICORODAL$");
7372   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
7373   TGeoMedium *medFEP   = mgr->GetMedium("ITS_SSD FEP$");
7374   TGeoMedium *medH2O   = mgr->GetMedium("ITS_WATER$");
7375   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
7376
7377   TGeoVolume *forwTrayFirst = new TGeoVolume("ITSsuppSSDSideAForwTrayFirst",
7378                                              forwTrayPart1, medAl);
7379
7380   forwTrayFirst->SetVisibility(kTRUE);
7381   forwTrayFirst->SetLineColor(6); // Purple
7382   forwTrayFirst->SetLineWidth(1);
7383   forwTrayFirst->SetFillColor(forwTrayFirst->GetLineColor());
7384   forwTrayFirst->SetFillStyle(4000); // 0% transparent
7385
7386   TGeoVolume *forwTraySecond = new TGeoVolume("ITSsuppSSDSideAForwTraySecond",
7387                                               forwTrayPart2, medAl);
7388
7389   forwTraySecond->SetVisibility(kTRUE);
7390   forwTraySecond->SetLineColor(6); // Purple
7391   forwTraySecond->SetLineWidth(1);
7392   forwTraySecond->SetFillColor(forwTraySecond->GetLineColor());
7393   forwTraySecond->SetFillStyle(4000); // 0% transparent
7394
7395   TGeoVolume *forwTraySide = new TGeoVolume("ITSsuppSSDSideAForwTraySide",
7396                                             forwSide, medAl);
7397
7398   forwTraySide->SetVisibility(kTRUE);
7399   forwTraySide->SetLineColor(6); // Purple
7400   forwTraySide->SetLineWidth(1);
7401   forwTraySide->SetFillColor(forwTraySide->GetLineColor());
7402   forwTraySide->SetFillStyle(4000); // 0% transparent
7403
7404   TGeoVolume *forwTraySideCover = new TGeoVolume("ITSsuppSSDSideAForwTraySideCover",
7405                                             forwSideCover, medAl);
7406
7407   forwTraySideCover->SetVisibility(kTRUE);
7408   forwTraySideCover->SetLineColor(6); // Purple
7409   forwTraySideCover->SetLineWidth(1);
7410   forwTraySideCover->SetFillColor(forwTraySideCover->GetLineColor());
7411   forwTraySideCover->SetFillStyle(4000); // 0% transparent
7412
7413   TGeoVolume *externalTraySSD = new TGeoVolume("ITSsuppSSDSideAExternalTray",
7414                                                externalTray, medAl);
7415
7416   externalTraySSD->SetVisibility(kTRUE);
7417   externalTraySSD->SetLineColor(6); // Purple
7418   externalTraySSD->SetLineWidth(1);
7419   externalTraySSD->SetFillColor(externalTraySSD->GetLineColor());
7420   externalTraySSD->SetFillStyle(4000); // 0% transparent
7421
7422   TGeoVolume *forwardTrayCover = new TGeoVolume("ITSsuppSSDSideAForwTrayCover",
7423                                                 forwardCover, medAntic);
7424
7425   forwardTrayCover->SetVisibility(kTRUE);
7426   forwardTrayCover->SetLineColor(kMagenta+1); // Purple
7427   forwardTrayCover->SetLineWidth(1);
7428   forwardTrayCover->SetFillColor(forwardTrayCover->GetLineColor());
7429   forwardTrayCover->SetFillStyle(4000); // 0% transparent
7430
7431   TGeoVolume *externTrayCover = new TGeoVolume("ITSsuppSSDSideAExtTrayCover",
7432                                                externCover, medAntic);
7433
7434   externTrayCover->SetVisibility(kTRUE);
7435   externTrayCover->SetLineColor(kMagenta+1); // Purple
7436   externTrayCover->SetLineWidth(1);
7437   externTrayCover->SetFillColor(externTrayCover->GetLineColor());
7438   externTrayCover->SetFillStyle(4000); // 0% transparent
7439
7440   TGeoVolume *forwCableCu = new TGeoVolume("ITSsuppSSDSideAForwCableCu",
7441                                            forwCopper, medCu);
7442
7443   forwCableCu->SetVisibility(kTRUE);
7444   forwCableCu->SetLineColor(kRed); // Red
7445   forwCableCu->SetLineWidth(1);
7446   forwCableCu->SetFillColor(forwCableCu->GetLineColor());
7447   forwCableCu->SetFillStyle(4000); // 0% transparent
7448
7449   TGeoVolume *extCableCu = new TGeoVolume("ITSsuppSSDSideAExtCableCu",
7450                                           extCopper, medCu);
7451
7452   extCableCu->SetVisibility(kTRUE);
7453   extCableCu->SetLineColor(kRed); // Red
7454   extCableCu->SetLineWidth(1);
7455   extCableCu->SetFillColor(extCableCu->GetLineColor());
7456   extCableCu->SetFillStyle(4000); // 0% transparent
7457
7458   TGeoVolume *forwCableFEP = new TGeoVolume("ITSsuppSSDSideAForwCableFEP",
7459                                             forwPlastic, medFEP);
7460
7461   forwCableFEP->SetVisibility(kTRUE);
7462   forwCableFEP->SetLineColor(kYellow); // Yellow
7463   forwCableFEP->SetLineWidth(1);
7464   forwCableFEP->SetFillColor(forwCableFEP->GetLineColor());
7465   forwCableFEP->SetFillStyle(4000); // 0% transparent
7466
7467   TGeoVolume *extCableFEP = new TGeoVolume("ITSsuppSSDSideAExtCableFEP",
7468                                            extPlastic, medFEP);
7469
7470   extCableFEP->SetVisibility(kTRUE);
7471   extCableFEP->SetLineColor(kYellow); // Yellow
7472   extCableFEP->SetLineWidth(1);
7473   extCableFEP->SetFillColor(extCableFEP->GetLineColor());
7474   extCableFEP->SetFillStyle(4000); // 0% transparent
7475
7476   TGeoVolume *forwTrayWater = new TGeoVolume("ITSsuppSSDSideAForwTrayWater",
7477                                              forwWater, medH2O);
7478
7479   forwTrayWater->SetVisibility(kTRUE);
7480   forwTrayWater->SetLineColor(kBlue); // Blue
7481   forwTrayWater->SetLineWidth(1);
7482   forwTrayWater->SetFillColor(forwTrayWater->GetLineColor());
7483   forwTrayWater->SetFillStyle(4000); // 0% transparent
7484
7485   TGeoVolume *extTrayWater = new TGeoVolume("ITSsuppSSDSideAExtTrayWater",
7486                                             extWater, medH2O);
7487
7488   extTrayWater->SetVisibility(kTRUE);
7489   extTrayWater->SetLineColor(kBlue); // Blue
7490   extTrayWater->SetLineWidth(1);
7491   extTrayWater->SetFillColor(extTrayWater->GetLineColor());
7492   extTrayWater->SetFillStyle(4000); // 0% transparent
7493
7494   TGeoVolume *forwPolyUr = new TGeoVolume("ITSsuppSSDSideAForwPolyUr",
7495                                           forwPUR, medPUR);
7496
7497   forwPolyUr->SetVisibility(kTRUE);
7498   forwPolyUr->SetLineColor(kGray); // Gray
7499   forwPolyUr->SetLineWidth(1);
7500   forwPolyUr->SetFillColor(forwPolyUr->GetLineColor());
7501   forwPolyUr->SetFillStyle(4000); // 0% transparent
7502
7503   TGeoVolume *extPolyUr = new TGeoVolume("ITSsuppSSDSideAExtPolyUr",
7504                                          extPUR, medPUR);
7505
7506   extPolyUr->SetVisibility(kTRUE);
7507   extPolyUr->SetLineColor(kGray); // Gray
7508   extPolyUr->SetLineWidth(1);
7509   extPolyUr->SetFillColor(extPolyUr->GetLineColor());
7510   extPolyUr->SetFillStyle(4000); // 0% transparent
7511
7512
7513   // Now build up the tray
7514   cableTrayAForw->AddNode(forwTrayFirst, 1, 0);
7515
7516   cableTrayAForw->AddNode(forwTraySecond, 1,
7517                         new TGeoTranslation(0, 0, kForwardTrayFirstLen) );
7518
7519   xloc = kTrayWidth/2 + kForwardSideThick/2;
7520   yloc = kForwardTrayFirstHeight + kForwardSideHeight/2 - kForwardSideYTrans;
7521   zloc = kForwardSideLength/2;
7522   cableTrayAForw->AddNode(forwTraySide,1,
7523                         new TGeoTranslation( xloc, yloc, zloc) );
7524   cableTrayAForw->AddNode(forwTraySide,2,
7525                         new TGeoTranslation(-xloc, yloc, zloc) );
7526
7527   yloc = kForwardTrayFirstHeight + kForwardSideHeight - kForwardSideYTrans
7528        - kForwardCoverHeight;
7529   cableTrayAForw->AddNode(forwTraySideCover,1,
7530                         new TGeoTranslation(0, yloc, 0) );
7531
7532   yloc = kTrayTotalHeight - kCoversYTrans;
7533   zloc = kForwardTrayTotalLen - kForwardCoverLen;
7534   cableTrayAForw->AddNode(forwardTrayCover,1,
7535                         new TGeoTranslation(0, yloc, zloc) );
7536
7537   yloc = kTrayThick + forwCopper->GetDY();
7538   zloc = forwCopper->GetDZ();
7539   cableTrayAForw->AddNode(forwCableCu, 1,
7540                         new TGeoTranslation(0, yloc, zloc) );
7541
7542   yloc = kTrayThick + kCopperHeight + forwPlastic->GetDY();
7543   zloc = forwPlastic->GetDZ();
7544   cableTrayAForw->AddNode(forwCableFEP, 1,
7545                         new TGeoTranslation(0, yloc, zloc) );
7546
7547   yloc = kTrayThick + kCopperHeight + kCablePlasticHeight + forwWater->GetDY();
7548   zloc = forwWater->GetDZ();
7549   cableTrayAForw->AddNode(forwTrayWater, 1,
7550                         new TGeoTranslation(0, yloc, zloc) );
7551
7552   yloc = kTrayThick + kCopperHeight + kCablePlasticHeight
7553        + kCoolingWaterHeight + forwPUR->GetDY();
7554   zloc = forwPUR->GetDZ();
7555   cableTrayAForw->AddNode(forwPolyUr, 1,
7556                         new TGeoTranslation(0, yloc, zloc) );
7557
7558   // To simplify following placement in MARS, origin is on top
7559   totalhi = kTrayTotalHeight + kExternalCoverThick - kCoversYTrans;
7560
7561   yloc = -totalhi;
7562   cableTrayAExt->AddNode(externalTraySSD, 1,
7563                         new TGeoTranslation(0, yloc, 0) );
7564
7565   yloc = -totalhi + kTrayTotalHeight - kCoversYTrans;
7566   cableTrayAExt->AddNode(externTrayCover,1,
7567                         new TGeoTranslation(0, yloc, 0) );
7568
7569   xloc = extCopper->GetDZ();
7570   yloc = -totalhi;
7571   cableTrayAExt->AddNode(extCableCu,1,
7572                         new TGeoCombiTrans( xloc, yloc, 0,
7573                         new TGeoRotation("",-90, 90, 90)        ) );
7574
7575   xloc = extPlastic->GetDZ();
7576   yloc = -totalhi + kCopperHeight;
7577   cableTrayAExt->AddNode(extCableFEP,1,
7578                         new TGeoCombiTrans( xloc, yloc, 0,
7579                         new TGeoRotation("",-90, 90, 90)        ) );
7580
7581   xloc = extWater->GetDZ();
7582   yloc = -totalhi + kCopperHeight + kCablePlasticHeight;
7583   cableTrayAExt->AddNode(extTrayWater,1,
7584                         new TGeoCombiTrans( xloc, yloc, 0,
7585                         new TGeoRotation("",-90, 90, 90)        ) );
7586
7587   xloc = extPUR->GetDZ();
7588   yloc = -totalhi + kCopperHeight + kCablePlasticHeight + kCoolingWaterHeight;
7589   cableTrayAExt->AddNode(extPolyUr,1,
7590                         new TGeoCombiTrans( xloc, yloc, 0,
7591                         new TGeoRotation("",-90, 90, 90)        ) );
7592
7593
7594   // Finally put everything in the mother volume
7595   zloc = kTrayAZTrans;
7596   Double_t zlocext = zloc + kForwardTrayTotalLen;
7597   Double_t rExtTray = kTrayARTrans + kTrayTotalHeight;
7598
7599   alpharot = kTrayAFirstRotAng;
7600   xloc = kTrayARTrans*SinD(alpharot);
7601   yloc = kTrayARTrans*CosD(alpharot);
7602   moth->AddNode(cableTrayAForw,1,
7603                             new TGeoCombiTrans( xloc, yloc, zloc,
7604                             new TGeoRotation("",-alpharot,0,0)   )   );
7605   xloc = rExtTray*SinD(alpharot);
7606   yloc = rExtTray*CosD(alpharot);
7607   moth->AddNode(cableTrayAExt,1,
7608                             new TGeoCombiTrans( xloc, yloc, zlocext,
7609                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7610
7611   alpharot += 180;
7612   xloc = kTrayARTrans*SinD(alpharot);
7613   yloc = kTrayARTrans*CosD(alpharot);
7614   moth->AddNode(cableTrayAForw,2,
7615                             new TGeoCombiTrans( xloc, yloc, zloc,
7616                             new TGeoRotation("",-alpharot,0,0)   )   );
7617   xloc = rExtTray*SinD(alpharot);
7618   yloc = rExtTray*CosD(alpharot);
7619   moth->AddNode(cableTrayAExt,2,
7620                             new TGeoCombiTrans( xloc, yloc, zlocext,
7621                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7622
7623   alpharot = -kTrayAFirstRotAng - 2*kTrayASecondRotAng;
7624   xloc = kTrayARTrans*SinD(alpharot);
7625   yloc = kTrayARTrans*CosD(alpharot);
7626   moth->AddNode(cableTrayAForw,3,
7627                             new TGeoCombiTrans( xloc, yloc, zloc,
7628                             new TGeoRotation("",-alpharot,0,0)   )   );
7629   xloc = rExtTray*SinD(alpharot);
7630   yloc = rExtTray*CosD(alpharot);
7631   moth->AddNode(cableTrayAExt,3,
7632                             new TGeoCombiTrans( xloc, yloc, zlocext,
7633                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7634
7635   alpharot += 180;
7636   xloc = kTrayARTrans*SinD(alpharot);
7637   yloc = kTrayARTrans*CosD(alpharot);
7638   moth->AddNode(cableTrayAForw,4,
7639                             new TGeoCombiTrans( xloc, yloc, zloc,
7640                             new TGeoRotation("",-alpharot,0,0)   )   );
7641   xloc = rExtTray*SinD(alpharot);
7642   yloc = rExtTray*CosD(alpharot);
7643   moth->AddNode(cableTrayAExt,4,
7644                             new TGeoCombiTrans( xloc, yloc, zlocext,
7645                             new TGeoRotation("",-alpharot,-kTrayAZRot,0)  )  );
7646
7647
7648   return;
7649 }
7650
7651 //______________________________________________________________________
7652 void AliITSv11GeometrySupport::SSDCableTraysSideC(TGeoVolume *moth,
7653                                             const TGeoManager *mgr){
7654 //
7655 // Creates the SSD cable trays which are outside the ITS support cones
7656 // but still inside the TPC on Side C
7657 // (part of this code is taken or anyway inspired to ServicesCableSupport
7658 // method of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
7659 //
7660 // Input:
7661 //         moth : the TGeoVolume owing the volume structure
7662 //         mgr  : the GeoManager (default gGeoManager)
7663 // Output:
7664 //
7665 // Created:         ???       Bjorn S. Nilsen
7666 // Updated:      15 Apr 2010  Mario Sitta
7667 //
7668 // Technical data are taken from AutoCAD drawings and other (oral)
7669 // information given by F.Tosello
7670 //
7671
7672   // Dimensions and positions of the C-Side Cable Tray elements
7673   const Int_t    kNumTraySideC           =    4;
7674
7675   const Double_t kSideCFoldAngle         =    5.00 *fgkDegree;
7676
7677   const Double_t kServicesWidth          =  100.00 *fgkmm;
7678   const Double_t kCopperHeight           =   11.20 *fgkmm;// 1120 mm^2
7679   const Double_t kCablePlasticHeight     =   11.50 *fgkmm;// 1150 mm^2
7680   const Double_t kCoolingWaterHeight     =    2.65 *fgkmm;//  265 mm^2
7681   const Double_t kPoliUrethaneHeight     =    4.62 *fgkmm;//  462 mm^2
7682   const Double_t kCablesYtrans           =    2.50 *fgkmm;// Avoid ovlps
7683
7684   // Overall position and rotation of the C-Side Cable Trays
7685   const Double_t kTraySideCRPos          =   45.30    *fgkcm;
7686   const Double_t kTraySideCZPos          = -102.40    *fgkcm;
7687   const Double_t kTraySideCAlphaRot[kNumTraySideC]  = {     23.0,     -59.0,
7688     /* from Patch panel position */                    180.+23.0, 180.-59.0};
7689
7690
7691   // Local variables
7692   Double_t xprof[6], yprof[6];
7693   Double_t xloc, yloc, alpharot, alphafold;
7694
7695
7696   // The assembly holding the metallic structure
7697   TGeoVolumeAssembly *trayStructure =
7698                                 CreateSDDSSDTraysSideC("ITSsupportSSDTrayC");
7699
7700   // The cable copper inside the tray: a Xtru
7701   TGeoXtru *copper = new TGeoXtru(2);
7702   copper->SetName("ITSsuppSSDTrayCCopper");
7703
7704   // Copper lies on the lower plate: get position of its points
7705   TGeoXtru *lowerplate = (TGeoXtru*)(mgr->GetVolume("ITSsuppTraySideCLower")->GetShape());
7706   xprof[0] = lowerplate->GetX(5);
7707   yprof[0] = lowerplate->GetY(5) + kCablesYtrans;
7708   xprof[1] = lowerplate->GetX(4);
7709   yprof[1] = lowerplate->GetY(4) + kCablesYtrans;
7710   xprof[2] = lowerplate->GetX(3);
7711   yprof[2] = lowerplate->GetY(3) + kCablesYtrans;
7712   xprof[3] = xprof[2] - kCopperHeight*SinD(kSideCFoldAngle);
7713   yprof[3] = yprof[2] + kCopperHeight*CosD(kSideCFoldAngle);
7714   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7715               kCopperHeight , xprof[4], yprof[4]);
7716   xprof[5] = xprof[0];
7717   yprof[5] = yprof[0] + kCopperHeight;
7718
7719   copper->DefinePolygon(6, xprof, yprof);
7720   copper->DefineSection(0, -kServicesWidth/2);
7721   copper->DefineSection(1,  kServicesWidth/2);
7722
7723   // The cable plastic inside the tray: a Xtru
7724   TGeoXtru *plastic = new TGeoXtru(2);
7725   plastic->SetName("ITSsuppSSDTrayCPlastic");
7726
7727   xprof[0] = copper->GetX(5);
7728   yprof[0] = copper->GetY(5);
7729   xprof[1] = copper->GetX(4);
7730   yprof[1] = copper->GetY(4);
7731   xprof[2] = copper->GetX(3);
7732   yprof[2] = copper->GetY(3);
7733   xprof[3] = xprof[2] - kCablePlasticHeight*SinD(kSideCFoldAngle);
7734   yprof[3] = yprof[2] + kCablePlasticHeight*CosD(kSideCFoldAngle);
7735   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7736               kCablePlasticHeight , xprof[4], yprof[4]);
7737   xprof[5] = xprof[0];
7738   yprof[5] = yprof[0] + kCablePlasticHeight;
7739
7740   plastic->DefinePolygon(6, xprof, yprof);
7741   plastic->DefineSection(0, -kServicesWidth/2);
7742   plastic->DefineSection(1,  kServicesWidth/2);
7743
7744   // The cooling water inside the tray: a Xtru
7745   TGeoXtru *water = new TGeoXtru(2);
7746   water->SetName("ITSsuppSSDTrayCWater");
7747
7748   xprof[0] = plastic->GetX(5);
7749   yprof[0] = plastic->GetY(5);
7750   xprof[1] = plastic->GetX(4);
7751   yprof[1] = plastic->GetY(4);
7752   xprof[2] = plastic->GetX(3);
7753   yprof[2] = plastic->GetY(3);
7754   xprof[3] = xprof[2] - kCoolingWaterHeight*SinD(kSideCFoldAngle);
7755   yprof[3] = yprof[2] + kCoolingWaterHeight*CosD(kSideCFoldAngle);
7756   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7757               kCoolingWaterHeight , xprof[4], yprof[4]);
7758   xprof[5] = xprof[0];
7759   yprof[5] = yprof[0] + kCoolingWaterHeight;
7760
7761   water->DefinePolygon(6, xprof, yprof);
7762   water->DefineSection(0, -kServicesWidth/2);
7763   water->DefineSection(1,  kServicesWidth/2);
7764
7765   // The poliurethane inside the tray: a Xtru
7766   TGeoXtru *pur = new TGeoXtru(2);
7767   pur->SetName("ITSsuppSSDTrayCPUR");
7768   xprof[0] = water->GetX(5);
7769   yprof[0] = water->GetY(5);
7770   xprof[1] = water->GetX(4);
7771   yprof[1] = water->GetY(4);
7772   xprof[2] = water->GetX(3);
7773   yprof[2] = water->GetY(3);
7774   xprof[3] = xprof[2] - kPoliUrethaneHeight*SinD(kSideCFoldAngle);
7775   yprof[3] = yprof[2] + kPoliUrethaneHeight*CosD(kSideCFoldAngle);
7776   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
7777               kPoliUrethaneHeight , xprof[4], yprof[4]);
7778   xprof[5] = xprof[0];
7779   yprof[5] = yprof[0] + kPoliUrethaneHeight;
7780
7781   pur->DefinePolygon(6, xprof, yprof);
7782   pur->DefineSection(0, -kServicesWidth/2);
7783   pur->DefineSection(1,  kServicesWidth/2);
7784
7785
7786   // We have all shapes: now create the real volumes
7787   TGeoMedium *medCu    = mgr->GetMedium("ITS_COPPER$");
7788   TGeoMedium *medFEP   = mgr->GetMedium("ITS_SSD FEP$");
7789   TGeoMedium *medH2O   = mgr->GetMedium("ITS_WATER$");
7790   TGeoMedium *medPUR   = mgr->GetMedium("ITS_POLYURETHANE$");
7791
7792   TGeoVolume *copperCable = new TGeoVolume("ITSsuppSSDSideCCableCu",
7793                                            copper, medCu);
7794
7795   copperCable->SetVisibility(kTRUE);
7796   copperCable->SetLineColor(kRed); // Red
7797   copperCable->SetLineWidth(1);
7798   copperCable->SetFillColor(copperCable->GetLineColor());
7799   copperCable->SetFillStyle(4000); // 0% transparent
7800
7801   TGeoVolume *cableFEP = new TGeoVolume("ITSsuppSSDSideCCableFEP",
7802                                         plastic, medFEP);
7803
7804   cableFEP->SetVisibility(kTRUE);
7805   cableFEP->SetLineColor(kYellow); // Yellow
7806   cableFEP->SetLineWidth(1);
7807   cableFEP->SetFillColor(cableFEP->GetLineColor());
7808   cableFEP->SetFillStyle(4000); // 0% transparent
7809
7810   TGeoVolume *trayWater = new TGeoVolume("ITSsuppSSDSideCTrayWater",
7811                                          water, medH2O);
7812
7813   trayWater->SetVisibility(kTRUE);
7814   trayWater->SetLineColor(kBlue); // Blue
7815   trayWater->SetLineWidth(1);
7816   trayWater->SetFillColor(trayWater->GetLineColor());
7817   trayWater->SetFillStyle(4000); // 0% transparent
7818
7819   TGeoVolume *trayPolyUr = new TGeoVolume("ITSsuppSSDSideCPolyUr",
7820                                           pur, medPUR);
7821
7822   trayPolyUr->SetVisibility(kTRUE);
7823   trayPolyUr->SetLineColor(kGray); // Gray
7824   trayPolyUr->SetLineWidth(1);
7825   trayPolyUr->SetFillColor(trayPolyUr->GetLineColor());
7826   trayPolyUr->SetFillStyle(4000); // 0% transparent
7827
7828
7829   // Now fill in the tray
7830   trayStructure->AddNode(copperCable,1,0);
7831   trayStructure->AddNode(cableFEP,1,0);
7832   trayStructure->AddNode(trayWater,1,0);
7833   trayStructure->AddNode(trayPolyUr,1,0);
7834
7835
7836   // Finally put everything in the mother volume
7837   alphafold = kSideCFoldAngle;
7838
7839   for (Int_t jt = 0; jt < kNumTraySideC; jt++) {
7840     alpharot = kTraySideCAlphaRot[jt];
7841     xloc = kTraySideCRPos*SinD(alpharot);
7842     yloc = kTraySideCRPos*CosD(alpharot);
7843     moth->AddNode(trayStructure,jt+1,
7844                        new TGeoCombiTrans(-xloc, yloc, kTraySideCZPos,
7845                        new TGeoRotation("",-90.+alpharot,-90.,90.+alphafold)));
7846   }
7847
7848
7849   return;
7850 }
7851
7852 //______________________________________________________________________
7853 void AliITSv11GeometrySupport::CreateSDDForwardTraySideA(TGeoVolumeAssembly *tray,
7854                                                    const TGeoManager *mgr){
7855 //
7856 // Creates the forward SDD tray on Side A (0872/G/D/01)
7857 //
7858 // Input:
7859 //         tray : the TGeoVolumeAssembly to put the elements in
7860 //         mgr  : the GeoManager (used only to get the proper material)
7861 //
7862 // Output:
7863 //
7864 // Return:
7865 //
7866 // Created:      08 Jan 2010  Mario Sitta
7867 // Updated:      07 Sep 2010  Mario Sitta
7868 //
7869 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
7870 // drawings and other (oral) information given by F.Tosello
7871 //
7872
7873   // Dimensions of the A-Side Forward Cable Tray (0872/G/D/01)
7874   const Double_t kForwardTrayThick        =    2.00 *fgkmm;
7875   const Double_t kForwardTraySideLength   =  823.00 *fgkmm;
7876   const Double_t kForwardTrayTailLength   =  212.00 *fgkmm;
7877   const Double_t kForwardTrayBaseHalfWide =   55.00 *fgkmm;
7878   const Double_t kForwardTrayNotchLength  =   47.20 *fgkmm;
7879   const Double_t kForwardTrayNotchHeight  =   25.00 *fgkmm;
7880   const Double_t kForwardTrayNotchDown    =   10.00 *fgkmm;
7881   const Double_t kForwardTraySide1Height  =   39.00 *fgkmm;
7882   const Double_t kForwardTraySide2Height  =   26.00 *fgkmm;
7883   const Double_t kForwardTraySide2Expand  =   10.50 *fgkmm;
7884   const Double_t kForwardTraySide3TailLen =  418.00 *fgkmm;
7885   const Double_t kForwardTraySide3TailHi  =   31.00 *fgkmm;
7886   const Double_t kForwardTraySide3HeadLen =  425.00 *fgkmm;
7887   const Double_t kForwardTraySide3HeadHi  =   72.00 *fgkmm;
7888   const Double_t kForwardTrayHorWingWide  =   10.50 *fgkmm;
7889   const Double_t kForwardTrayVertWingWide =   15.00 *fgkmm;
7890
7891   const Int_t    kForwardTraySideNpoints  =    9;
7892
7893
7894   // Local variables
7895   Double_t xprof[kForwardTraySideNpoints], yprof[kForwardTraySideNpoints];
7896   Double_t ylen, zlen;
7897   Double_t xloc, yloc, zloc;
7898
7899
7900   // The tray has a very complex shape, so it is made by assembling
7901   // different elements (with some small simplifications)
7902
7903   // The tray base: a BBox
7904   zlen = (kForwardTraySideLength-kForwardTrayTailLength)/2;
7905   TGeoBBox *trayBase = new TGeoBBox(kForwardTrayBaseHalfWide,
7906                                     kForwardTrayThick/2, zlen);
7907
7908   // The first part of the side wall: a Xtru
7909   TGeoXtru *traySide1 = new TGeoXtru(2);
7910
7911   xprof[0] = 0;
7912   yprof[0] = kForwardTrayThick;
7913   xprof[1] = kForwardTraySideLength-kForwardTrayTailLength;
7914   yprof[1] = yprof[0];
7915   xprof[2] = kForwardTraySideLength;
7916   yprof[2] = kForwardTraySide1Height + kForwardTrayThick;
7917   xprof[3] = 0;
7918   yprof[3] = yprof[2];
7919
7920   traySide1->DefinePolygon(4, xprof, yprof);
7921   traySide1->DefineSection(0, 0);
7922   traySide1->DefineSection(1, kForwardTrayThick);
7923
7924   // The second part of the side wall: a Xtru
7925   TGeoXtru *traySide2 = new TGeoXtru(2);
7926
7927   xprof[0] = kForwardTrayBaseHalfWide - kForwardTrayThick;
7928   yprof[0] = traySide1->GetY(2);
7929   xprof[1] = kForwardTrayBaseHalfWide;
7930   yprof[1] = yprof[0];
7931   xprof[2] = xprof[1] + kForwardTraySide2Expand;
7932   yprof[2] = yprof[1] + kForwardTraySide2Height;
7933   xprof[3] = xprof[2] - kForwardTrayThick;
7934   yprof[3] = yprof[2];
7935
7936   traySide2->DefinePolygon(4, xprof, yprof);
7937   traySide2->DefineSection(0, 0);
7938   traySide2->DefineSection(1, kForwardTraySideLength);
7939
7940   // The third part of the side wall: a Xtru
7941   TGeoXtru *traySide3 = new TGeoXtru(2);
7942
7943   xprof[0] = 0;
7944   yprof[0] = traySide2->GetY(2);
7945   xprof[1] = kForwardTraySideLength;
7946   yprof[1] = yprof[0];
7947   xprof[2] = xprof[1];
7948   yprof[2] = yprof[1] + kForwardTraySide3TailHi - kForwardTrayThick;
7949   xprof[3] = xprof[2] - kForwardTraySide3TailLen - kForwardTrayThick;
7950   yprof[3] = yprof[2];
7951   xprof[4] = xprof[3];
7952   yprof[4] = yprof[3] + kForwardTraySide3HeadHi + kForwardTrayThick;
7953   xprof[5] = xprof[4] - kForwardTraySide3HeadLen;
7954   yprof[5] = yprof[4];
7955   xprof[6] = xprof[5];
7956   yprof[6] = yprof[5] - kForwardTrayNotchHeight;
7957   xprof[7] = xprof[6] + kForwardTrayNotchLength;
7958   yprof[7] = yprof[6];
7959   xprof[8] = xprof[7];
7960   yprof[8] = yprof[7] - kForwardTrayNotchDown;
7961
7962   traySide3->DefinePolygon(9, xprof, yprof);
7963   traySide3->DefineSection(0, 0);
7964   traySide3->DefineSection(1, kForwardTrayThick);
7965
7966   // The horizontal wing: a BBox
7967   TGeoBBox *trayHorWing = new TGeoBBox(kForwardTrayHorWingWide/2,
7968                                        kForwardTrayThick/2,
7969                                        kForwardTraySide3TailLen/2);
7970
7971   // The vertical wing: a BBox
7972   ylen = (traySide3->GetY(4) - traySide3->GetY(3))/2;
7973   TGeoBBox *trayVertWing = new TGeoBBox(kForwardTrayVertWingWide/2,
7974                                         ylen, kForwardTrayThick/2);
7975
7976
7977   // We have all shapes: now create the real volumes
7978   TGeoMedium *medAl    = mgr->GetMedium("ITS_ALUMINUM$");
7979
7980   TGeoVolume *forwTrayBase = new TGeoVolume("ITSsuppSDDSideAForwTrayBase",
7981                                             trayBase, medAl);
7982
7983   forwTrayBase->SetVisibility(kTRUE);
7984   forwTrayBase->SetLineColor(6); // Purple
7985   forwTrayBase->SetLineWidth(1);
7986   forwTrayBase->SetFillColor(forwTrayBase->GetLineColor());
7987   forwTrayBase->SetFillStyle(4000); // 0% transparent
7988
7989   TGeoVolume *forwTraySide1 = new TGeoVolume("ITSsuppSDDSideAForwTraySide1",
7990                                             traySide1, medAl);
7991
7992   forwTraySide1->SetVisibility(kTRUE);
7993   forwTraySide1->SetLineColor(6); // Purple
7994   forwTraySide1->SetLineWidth(1);
7995   forwTraySide1->SetFillColor(forwTraySide1->GetLineColor());
7996   forwTraySide1->SetFillStyle(4000); // 0% transparent
7997
7998   TGeoVolume *forwTraySide2 = new TGeoVolume("ITSsuppSDDSideAForwTraySide2",
7999                                             traySide2, medAl);
8000
8001   forwTraySide2->SetVisibility(kTRUE);
8002   forwTraySide2->SetLineColor(6); // Purple
8003   forwTraySide2->SetLineWidth(1);
8004   forwTraySide2->SetFillColor(forwTraySide2->GetLineColor());
8005   forwTraySide2->SetFillStyle(4000); // 0% transparent
8006
8007   TGeoVolume *forwTraySide3 = new TGeoVolume("ITSsuppSDDSideAForwTraySide3",
8008                                             traySide3, medAl);
8009
8010   forwTraySide3->SetVisibility(kTRUE);
8011   forwTraySide3->SetLineColor(6); // Purple
8012   forwTraySide3->SetLineWidth(1);
8013   forwTraySide3->SetFillColor(forwTraySide3->GetLineColor());
8014   forwTraySide3->SetFillStyle(4000); // 0% transparent
8015
8016   TGeoVolume *forwTrayHWing = new TGeoVolume("ITSsuppSDDSideAForwTrayHorWing",
8017                                             trayHorWing, medAl);
8018
8019   forwTrayHWing->SetVisibility(kTRUE);
8020   forwTrayHWing->SetLineColor(6); // Purple
8021   forwTrayHWing->SetLineWidth(1);
8022   forwTrayHWing->SetFillColor(forwTrayHWing->GetLineColor());
8023   forwTrayHWing->SetFillStyle(4000); // 0% transparent
8024
8025   TGeoVolume *forwTrayVWing = new TGeoVolume("ITSsuppSDDSideAForwTrayVertWing",
8026                                             trayVertWing, medAl);
8027
8028   forwTrayVWing->SetVisibility(kTRUE);
8029   forwTrayVWing->SetLineColor(6); // Purple
8030   forwTrayVWing->SetLineWidth(1);
8031   forwTrayVWing->SetFillColor(forwTrayVWing->GetLineColor());
8032   forwTrayVWing->SetFillStyle(4000); // 0% transparent
8033
8034
8035   // Now build up the tray
8036   yloc = kForwardTrayThick/2;
8037   zloc = zlen;
8038   tray->AddNode(forwTrayBase, 1,
8039                 new TGeoTranslation(0, yloc, zloc) );
8040
8041   xloc = kForwardTrayBaseHalfWide;
8042   tray->AddNode(forwTraySide1, 1,
8043                 new TGeoCombiTrans(xloc, 0, 0,
8044                                    new TGeoRotation("",90,-90,-90)));
8045   xloc = -xloc + kForwardTrayThick;
8046   tray->AddNode(forwTraySide1, 2,
8047                 new TGeoCombiTrans(xloc, 0, 0,
8048                                    new TGeoRotation("",90,-90,-90)));
8049
8050   tray->AddNode(forwTraySide2, 1, 0);
8051   zloc = kForwardTraySideLength;
8052   tray->AddNode(forwTraySide2, 2,
8053                 new TGeoCombiTrans(0, 0, zloc,
8054                                    new TGeoRotation("",90,-180,-90)));
8055
8056   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand;
8057   tray->AddNode(forwTraySide3, 1,
8058                 new TGeoCombiTrans(xloc, 0, 0,
8059                                    new TGeoRotation("",90,-90,-90)));
8060   xloc = -xloc + kForwardTrayThick;
8061   tray->AddNode(forwTraySide3, 2,
8062                 new TGeoCombiTrans(xloc, 0, 0,
8063                                    new TGeoRotation("",90,-90,-90)));
8064
8065   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand
8066        - kForwardTrayHorWingWide/2;
8067   yloc = traySide3->GetY(2) + kForwardTrayThick/2;
8068   zloc = kForwardTraySideLength - trayHorWing->GetDZ();
8069   tray->AddNode(forwTrayHWing, 1,
8070                 new TGeoTranslation( xloc, yloc, zloc) );
8071   tray->AddNode(forwTrayHWing, 2,
8072                 new TGeoTranslation(-xloc, yloc, zloc) );
8073
8074   xloc = kForwardTrayBaseHalfWide + kForwardTraySide2Expand
8075        - kForwardTrayVertWingWide/2;
8076   yloc = traySide3->GetY(2) + trayVertWing->GetDY();
8077   zloc = traySide3->GetX(3) + kForwardTrayThick/2;
8078   tray->AddNode(forwTrayVWing, 1,
8079                 new TGeoTranslation( xloc, yloc, zloc) );
8080   tray->AddNode(forwTrayVWing, 2,
8081                 new TGeoTranslation(-xloc, yloc, zloc) );
8082
8083
8084   return;
8085 }
8086
8087 //______________________________________________________________________
8088 TGeoCompositeShape* AliITSv11GeometrySupport::CreateTrayAForwardCover(const Double_t coverLen){
8089 //
8090 // Creates the forward cover of the SDD and SSD cable trays on Side A
8091 // (0872/G/D/02)
8092 //
8093 // Input:
8094 //             coverLen: the total length of the cover
8095 //
8096 // Output:
8097 //
8098 // Return:     a TGeoCompositeShape for the cover
8099 //
8100 // Created:      03 Jan 2010  Mario Sitta
8101 //
8102 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
8103 // drawings and other (oral) information given by F.Tosello
8104 //
8105
8106   // Dimensions and positions of the A-Side Cable Tray Forward Cover
8107   // (0872/G/D/02)
8108   const Double_t kForwardCoverWide        =  130.00 *fgkmm;
8109   const Double_t kForwardCoverSideWide    =   10.00 *fgkmm;
8110   const Double_t kForwardCoverHoleLen     =  160.00 *fgkmm;
8111   const Double_t kForwardCoverHoleWide    =   90.00 *fgkmm;
8112   const Double_t kForwardCoverHoleR10     =   10.00 *fgkmm;
8113   const Double_t kForwardCoverTotalThick  =    5.00 *fgkmm;
8114   const Double_t kForwardCoverSideThick   =    3.00 *fgkmm;
8115   const Double_t kForwardCoverInternThick =    2.00 *fgkmm;
8116
8117   const Double_t kForwardCoverHoleZTrans  =   40.00 *fgkmm;
8118
8119
8120   // Local variables
8121   Double_t xprof[16], yprof[16];
8122   Double_t yloc, zloc;
8123
8124
8125   // The main shape: a Xtru
8126   TGeoXtru *forwCoverMain = new TGeoXtru(2);
8127   forwCoverMain->SetName("ITSsuppForwCoverMain");
8128
8129   xprof[0] = kForwardCoverWide/2;
8130   yprof[0] = kForwardCoverTotalThick;
8131   xprof[1] = xprof[0];
8132   yprof[1] = yprof[0] - kForwardCoverSideThick;
8133   xprof[2] = xprof[1] - kForwardCoverSideWide;
8134   yprof[2] = yprof[1];
8135   xprof[3] = xprof[2];
8136   yprof[3] = 0;
8137
8138   // We did the right side, now reflex on the left side
8139   for (Int_t jp = 0; jp < 4; jp++) {
8140     xprof[4+jp] = -xprof[3-jp];
8141     yprof[4+jp] =  yprof[3-jp];
8142   }
8143
8144   // And now the actual Xtru
8145   forwCoverMain->DefinePolygon(8, xprof, yprof);
8146   forwCoverMain->DefineSection(0, 0);
8147   forwCoverMain->DefineSection(1, coverLen);
8148
8149   // The hole: another Xtru (rounded corners approximated with segments)
8150   TGeoXtru *forwCoverHole = new TGeoXtru(2);
8151   forwCoverHole->SetName("ITSsuppForwCoverHole");
8152
8153   CreateTrayACoverHolesShape(kForwardCoverHoleWide, kForwardCoverHoleLen,
8154                              kForwardCoverHoleR10 , xprof, yprof);
8155
8156   // And now the actual Xtru
8157   forwCoverHole->DefinePolygon(16, xprof, yprof);
8158   forwCoverHole->DefineSection(0, 0);
8159   forwCoverHole->DefineSection(1, kForwardCoverTotalThick-kForwardCoverInternThick);
8160
8161   // Now the proper rototranslation matrices for the two holes
8162   yloc = kForwardCoverTotalThick-kForwardCoverInternThick-0.01;//Precision fix
8163   zloc = kForwardCoverHoleZTrans;
8164   TGeoCombiTrans *mf1 = new TGeoCombiTrans(0, yloc, zloc,
8165                                            new TGeoRotation("", 0, 90, 0) );
8166   mf1->SetName("mf1");
8167   mf1->RegisterYourself();
8168
8169   zloc = coverLen - kForwardCoverHoleZTrans - kForwardCoverHoleLen;
8170   TGeoCombiTrans *mf2 = new TGeoCombiTrans(0, yloc, zloc,
8171                                            new TGeoRotation("", 0, 90, 0) );
8172   mf2->SetName("mf2");
8173   mf2->RegisterYourself();
8174
8175   // Finally the actual cover shape
8176   TGeoCompositeShape *cover = new TGeoCompositeShape("ITSsuppForwardCoverMain",
8177     "ITSsuppForwCoverMain-ITSsuppForwCoverHole:mf1-ITSsuppForwCoverHole:mf2");
8178
8179   return cover;
8180 }
8181
8182 //______________________________________________________________________
8183 TGeoCompositeShape* AliITSv11GeometrySupport::CreateTrayAExternalCover(const Double_t coverLen){
8184 //
8185 // Creates the external cover of the SDD and SSD cable trays on Side A
8186 // (0872/G/D/04)
8187 //
8188 // Input:
8189 //             coverLen: the total length of the cover
8190 //
8191 // Output:
8192 //
8193 // Return:     a TGeoCompositeShape for the cover
8194 //
8195 // Created:      03 Jan 2010  Mario Sitta
8196 //
8197 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
8198 // drawings and other (oral) information given by F.Tosello
8199 //
8200
8201   // Dimensions and positions of the A-Side Cable Tray External Cover
8202   // (0872/G/D/04)
8203   const Double_t kExternalCoverWide        =  130.00 *fgkmm;
8204   const Double_t kExternalCoverSideWide    =   10.00 *fgkmm;
8205   const Double_t kExternalCoverHoleLen1    =  262.00 *fgkmm;
8206   const Double_t kExternalCoverHoleLen2    =  280.00 *fgkmm;
8207   const Double_t kExternalCoverHoleLen3    =  205.00 *fgkmm;
8208   const Double_t kExternalCoverHoleLen4    =   55.00 *fgkmm;
8209   const Double_t kExternalCoverHoleWide    =   90.00 *fgkmm;
8210   const Double_t kExternalCoverHoleR10     =   10.00 *fgkmm;
8211   const Double_t kExternalCoverTotalThick  =    5.00 *fgkmm;
8212   const Double_t kExternalCoverSideThick   =    3.00 *fgkmm;
8213   const Double_t kExternalCoverInternThick =    2.00 *fgkmm;
8214
8215   const Double_t kExternalCoverHole1ZTrans =   28.00 *fgkmm;
8216   const Double_t kExternalCoverHolesZTrans =   20.00 *fgkmm;
8217
8218
8219   // Local variables
8220   Double_t xprof[16], yprof[16];
8221   Double_t yloc, zloc;
8222
8223
8224   // The main shape: a Xtru
8225   TGeoXtru *externCoverMain = new TGeoXtru(2);
8226   externCoverMain->SetName("ITSsuppExternCoverMain");
8227
8228   xprof[0] = kExternalCoverWide/2;
8229   yprof[0] = kExternalCoverTotalThick;
8230   xprof[1] = xprof[0];
8231   yprof[1] = yprof[0] - kExternalCoverSideThick;
8232   xprof[2] = xprof[1] - kExternalCoverSideWide;
8233   yprof[2] = yprof[1];
8234   xprof[3] = xprof[2];
8235   yprof[3] = 0;
8236
8237   // We did the right side, now reflex on the left side
8238   for (Int_t jp = 0; jp < 4; jp++) {
8239     xprof[4+jp] = -xprof[3-jp];
8240     yprof[4+jp] =  yprof[3-jp];
8241   }
8242
8243   // And now the actual Xtru
8244   externCoverMain->DefinePolygon(8, xprof, yprof);
8245   externCoverMain->DefineSection(0, 0);
8246   externCoverMain->DefineSection(1, coverLen);
8247
8248   // The first hole: a Xtru (rounded corners approximated with segments)
8249   Double_t holethick = kExternalCoverTotalThick-kExternalCoverInternThick;
8250
8251   TGeoXtru *extCoverHole1 = new TGeoXtru(2);
8252   extCoverHole1->SetName("ITSsuppExtCoverHole1");
8253
8254   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen1,
8255                              kExternalCoverHoleR10 , xprof, yprof);
8256
8257   extCoverHole1->DefinePolygon(16, xprof, yprof);
8258   extCoverHole1->DefineSection(0, 0);
8259   extCoverHole1->DefineSection(1, holethick);
8260
8261   // The second (and third) hole: another Xtru
8262   TGeoXtru *extCoverHole2 = new TGeoXtru(2);
8263   extCoverHole2->SetName("ITSsuppExtCoverHole2");
8264
8265   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen2,
8266                              kExternalCoverHoleR10 , xprof, yprof);
8267
8268   extCoverHole2->DefinePolygon(16, xprof, yprof);
8269   extCoverHole2->DefineSection(0, 0);
8270   extCoverHole2->DefineSection(1, holethick);
8271
8272   // The fourth hole: another Xtru
8273   TGeoXtru *extCoverHole3 = new TGeoXtru(2);
8274   extCoverHole3->SetName("ITSsuppExtCoverHole3");
8275
8276   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen3,
8277                              kExternalCoverHoleR10 , xprof, yprof);
8278
8279   extCoverHole3->DefinePolygon(16, xprof, yprof);
8280   extCoverHole3->DefineSection(0, 0);
8281   extCoverHole3->DefineSection(1, holethick);
8282
8283   // The fifth and last hole: another Xtru
8284   TGeoXtru *extCoverHole4 = new TGeoXtru(2);
8285   extCoverHole4->SetName("ITSsuppExtCoverHole4");
8286
8287   CreateTrayACoverHolesShape(kExternalCoverHoleWide, kExternalCoverHoleLen4,
8288                              kExternalCoverHoleR10 , xprof, yprof);
8289
8290   extCoverHole4->DefinePolygon(16, xprof, yprof);
8291   extCoverHole4->DefineSection(0, 0);
8292   extCoverHole4->DefineSection(1, holethick);
8293
8294   // Now the proper rototranslation matrices for the holes
8295   yloc = kExternalCoverTotalThick - kExternalCoverInternThick-0.01;
8296   zloc = kExternalCoverHole1ZTrans;
8297   TGeoCombiTrans *me1 = new TGeoCombiTrans(0, yloc, zloc,
8298                                            new TGeoRotation("", 0, 90, 0) );
8299   me1->SetName("me1");
8300   me1->RegisterYourself();
8301
8302   zloc += (kExternalCoverHoleLen1 + kExternalCoverHolesZTrans);
8303   TGeoCombiTrans *me2 = new TGeoCombiTrans(0, yloc, zloc,
8304                                            new TGeoRotation("", 0, 90, 0) );
8305   me2->SetName("me2");
8306   me2->RegisterYourself();
8307
8308   zloc += (kExternalCoverHoleLen2 + kExternalCoverHolesZTrans);
8309   TGeoCombiTrans *me3 = new TGeoCombiTrans(0, yloc, zloc,
8310                                            new TGeoRotation("", 0, 90, 0) );
8311   me3->SetName("me3");
8312   me3->RegisterYourself();
8313
8314   zloc += (kExternalCoverHoleLen2 + kExternalCoverHolesZTrans);
8315   TGeoCombiTrans *me4 = new TGeoCombiTrans(0, yloc, zloc,
8316                                            new TGeoRotation("", 0, 90, 0) );
8317   me4->SetName("me4");
8318   me4->RegisterYourself();
8319
8320   zloc += (kExternalCoverHoleLen3 + kExternalCoverHolesZTrans);
8321   TGeoCombiTrans *me5 = new TGeoCombiTrans(0, yloc, zloc,
8322                                            new TGeoRotation("", 0, 90, 0) );
8323   me5->SetName("me5");
8324   me5->RegisterYourself();
8325
8326   // Finally the actual cover shape
8327   TGeoCompositeShape *cover = new TGeoCompositeShape("ITSsuppExternCoverMain",
8328     "ITSsuppExternCoverMain-ITSsuppExtCoverHole1:me1-ITSsuppExtCoverHole2:me2-ITSsuppExtCoverHole2:me3-ITSsuppExtCoverHole3:me4-ITSsuppExtCoverHole4:me5");
8329
8330   return cover;
8331 }
8332
8333 //______________________________________________________________________
8334 void AliITSv11GeometrySupport::CreateTrayACoverHolesShape(const Double_t wide,
8335                                const Double_t length, const Double_t r10,
8336                                Double_t *x, Double_t *y){
8337 //
8338 // Creates the proper sequence of X and Y coordinates to determine
8339 // the base XTru polygon for the holes in the SDD and SSD tray covers
8340 // (here the rounded corners are approximated with segments)
8341 //
8342 // Input:
8343 //        wide   : the hole wide
8344 //        length : the hole length
8345 //        r10    : the radius of the rounded corners
8346 //
8347 // Output:
8348 //        x, y : coordinate vectors [16]
8349 //
8350 // Created:      03 Jan 2010  Mario Sitta
8351 //
8352 // Caller must guarantee that x and y have the correct dimensions
8353 // (but being this a private method it's easy to tell)
8354 //
8355
8356   x[0] = wide/2 - r10;
8357   y[0] = length;
8358   x[1] = x[0] + r10*SinD(30);
8359   y[1] = y[0] - r10*(1 - CosD(30));
8360   x[2] = x[0] + r10*SinD(60);
8361   y[2] = y[0] - r10*(1 - CosD(60));
8362   x[3] = x[0] + r10;
8363   y[3] = y[0] - r10;
8364   x[4] = x[3];
8365   y[4] = r10;
8366   x[5] = x[4] - r10*(1 - CosD(30));
8367   y[5] = y[4] - r10*SinD(30);
8368   x[6] = x[4] - r10*(1 - CosD(60));
8369   y[6] = y[4] - r10*SinD(60);
8370   x[7] = x[4] - r10;
8371   y[7] = 0;
8372
8373   // We did the right side, now reflex on the left side
8374   for (Int_t jp = 0; jp < 8; jp++) {
8375     x[8+jp] = -x[7-jp];
8376     y[8+jp] =  y[7-jp];
8377   }
8378
8379   return;
8380 }
8381
8382 //______________________________________________________________________
8383 TGeoXtru* AliITSv11GeometrySupport::CreateSDDSSDTraysSideA(
8384                                               const Double_t trayLen,
8385                                               const Double_t trayHi){
8386 //
8387 // Creates parts of the SDD and SSD Trays on Side A which are identical
8388 // (0872/G/D/03, part of 0872/G/D/07, 0872/G/C/11)
8389 //
8390 // Input:
8391 //         trayLen : the length of the tray part
8392 //         trayHi  : the height of the tray part
8393 //
8394 // Output:
8395 //
8396 // Return:     a TGeoXtru
8397 //
8398 // Created:      26 Feb 2010  Mario Sitta
8399 //
8400 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
8401 // drawings and other (oral) information given by F.Tosello
8402 //
8403
8404   // Dimensions and positions of the A-Side Cable Trays
8405   // (parts of 0872/G/C)
8406   const Double_t kTrayWidth              =  130.00 *fgkmm;
8407   const Double_t kTrayWingWidth          =   10.00 *fgkmm;
8408   const Double_t kTrayHeightToBend       =   20.00 *fgkmm;
8409   const Double_t kTrayThick              =    2.00 *fgkmm;
8410
8411   const Double_t kTrayBendAngle          =   22.00 *TMath::DegToRad();
8412
8413   const Int_t    kTrayNpoints            =   16;
8414
8415   // Local variables
8416   Double_t xprof[kTrayNpoints], yprof[kTrayNpoints];
8417
8418
8419   // The tray shape: a Xtru
8420   TGeoXtru *trayPart = new TGeoXtru(2);
8421
8422   xprof[2] = kTrayWidth/2 - kTrayThick;
8423   yprof[2] = trayHi - kTrayThick;
8424   xprof[3] = kTrayWidth/2 - kTrayWingWidth;
8425   yprof[3] = yprof[2];
8426   xprof[4] = xprof[3];
8427   yprof[4] = trayHi;
8428   xprof[5] = kTrayWidth/2;
8429   yprof[5] = yprof[4];
8430   xprof[6] = xprof[5];
8431   yprof[6] = kTrayHeightToBend;
8432   xprof[7] = xprof[6] - yprof[6]*TMath::Tan(kTrayBendAngle);
8433   yprof[7] = 0;
8434
8435   InsidePoint( xprof[5], yprof[5], xprof[6], yprof[6], xprof[7], yprof[7],
8436               -kTrayThick, xprof[1], yprof[1]);
8437
8438   xprof[8] = -xprof[7];
8439   yprof[8] =  yprof[7];
8440
8441   InsidePoint( xprof[6], yprof[6], xprof[7], yprof[7], xprof[8], yprof[8],
8442               -kTrayThick, xprof[0], yprof[0]);
8443
8444   // We did the right side, now reflex on the left side
8445   for (Int_t jp = 0; jp < 8; jp++) {
8446     xprof[8+jp] = -xprof[7-jp];
8447     yprof[8+jp] =  yprof[7-jp];
8448   }
8449
8450   // And now the actual Xtru
8451   trayPart->DefinePolygon(kTrayNpoints, xprof, yprof);
8452   trayPart->DefineSection(0, 0);
8453   trayPart->DefineSection(1, trayLen);
8454
8455
8456   return trayPart;
8457 }
8458
8459 //______________________________________________________________________
8460 TGeoVolumeAssembly* AliITSv11GeometrySupport::CreateSDDSSDTraysSideC(
8461                                                        const char *trayName,
8462                                                        const TGeoManager *mgr){
8463
8464 //
8465 // Creates the SDD and SSD Trays on Side C which are supposedly identical
8466 //
8467 // Input:
8468 //         trayName : the assembly name
8469 //
8470 // Output:
8471 //
8472 // Return:     a TGeoVolumeAssembly
8473 //
8474 // Created:      16 Apr 2010  Mario Sitta
8475 //
8476 // Technical data are taken from AutoCAD drawings and other (oral)
8477 // information given by F.Tosello
8478 //
8479
8480   const Double_t kSideCHalfThick      =    0.100   *fgkcm;
8481   const Double_t kSideCFoldAngle      =    5.000   *TMath::DegToRad();
8482
8483   const Double_t kSideCLength1        =  172.800   *fgkcm;
8484   const Double_t kSideCLength2        =  189.300   *fgkcm;
8485   const Double_t kSideCHalfWide       =    6.350   *fgkcm;
8486   const Double_t kSideCHeight1        =   11.800   *fgkcm;
8487   const Double_t kSideCHeight2        =    4.300   *fgkcm;
8488   const Double_t kSideCSideLength1    =   10.800   *fgkcm;
8489   const Double_t kSideCSideLength2    =   63.800   *fgkcm;
8490   const Double_t kSideCSideHeight     =    8.800   *fgkcm;
8491   const Int_t    kNPointsLowerFace    =    6;
8492   const Int_t    kNPointsLateralFace  =    9;
8493
8494   const Double_t kSideCWingAHalfLen   =    5.000   *fgkcm;
8495   const Double_t kSideCWingBHalfLen   =   30.500   *fgkcm;
8496   const Double_t kSideCWingCHalfLen   =    2.000   *fgkcm;
8497   const Double_t kSideCWingDHalfLen   =   48.500   *fgkcm;
8498   const Double_t kSideCWingEHalfLen   =   83.000   *fgkcm;
8499   const Double_t kSideCWingsHalfWide  =    0.450   *fgkcm;
8500
8501   const Int_t    kNPointsCoverFace    =   12;
8502
8503   const Double_t kPlateHalfLen        =    6.000   *fgkcm;
8504   const Double_t kPlateThick          =    0.600   *fgkcm;
8505   const Double_t kPlateHeight         =    4.200   *fgkcm;
8506   const Int_t    kNPointsPlate        =    6;
8507
8508   const Double_t kBarCoolRmax         =    0.4     *fgkcm;
8509   const Int_t    kNumBarCool          =    2;
8510   const Double_t kXShiftBarCool[kNumBarCool] = { 8.7, 13.0 };
8511   const Double_t kYShiftBarCool[kNumBarCool] = { 8.5,  5.0 };
8512
8513
8514   // Local variables
8515   Double_t xprof[12], yprof[12];
8516   Double_t xloc, yloc, zloc, delta, alpharot;
8517
8518   // The single C-Side Cable tray as an assembly
8519   TGeoVolumeAssembly *cableTrayC = new TGeoVolumeAssembly(trayName);
8520
8521   // First create all needed shapes
8522
8523   // The Cable Tray lower face: a Xtru
8524   TGeoXtru *sideCLowerFace = new TGeoXtru(2);
8525
8526   xprof[0] = 0.;
8527   yprof[0] = 0.;
8528   xprof[1] = kSideCLength1;
8529   yprof[1] = 0.;
8530   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(kSideCFoldAngle);
8531   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(kSideCFoldAngle);
8532   xprof[3] = xprof[2] - 2*kSideCHalfThick*TMath::Sin(kSideCFoldAngle);
8533   yprof[3] = yprof[2] + 2*kSideCHalfThick*TMath::Cos(kSideCFoldAngle);
8534   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8535               2*kSideCHalfThick , xprof[4], yprof[4]);
8536   xprof[5] = 0.;
8537   yprof[5] = 2*kSideCHalfThick;
8538
8539   sideCLowerFace->DefinePolygon(kNPointsLowerFace, xprof, yprof);
8540   sideCLowerFace->DefineSection(0,-kSideCHalfWide);
8541   sideCLowerFace->DefineSection(1, kSideCHalfWide);
8542
8543   // The Cable Tray lateral face: a Xtru
8544   TGeoXtru *sideCLateralFace = new TGeoXtru(2);
8545
8546   xprof[0] = 0.;
8547   yprof[0] = 0.;
8548   xprof[1] = kSideCLength1;
8549   yprof[1] = 0.;
8550   xprof[2] = xprof[1] + kSideCLength2*TMath::Cos(kSideCFoldAngle);
8551   yprof[2] = yprof[1] + kSideCLength2*TMath::Sin(kSideCFoldAngle);
8552   xprof[3] = xprof[2] - kSideCHeight2*TMath::Sin(kSideCFoldAngle);
8553   yprof[3] = yprof[2] + kSideCHeight2*TMath::Cos(kSideCFoldAngle);
8554   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8555               kSideCHeight2, xprof[4], yprof[4]);
8556   xprof[5] = kSideCSideLength1 + kSideCSideLength2;
8557   yprof[5] = kSideCHeight2;
8558   xprof[6] = xprof[5];
8559   yprof[6] = kSideCSideHeight;
8560   xprof[7] = kSideCSideLength1;
8561   yprof[7] = kSideCHeight1;
8562   xprof[8] = 0;
8563   yprof[8] = yprof[7];
8564
8565   sideCLateralFace->DefinePolygon(kNPointsLateralFace, xprof, yprof);
8566   sideCLateralFace->DefineSection(0,-kSideCHalfThick);
8567   sideCLateralFace->DefineSection(1, kSideCHalfThick);
8568
8569   // The lateral wings: four BBox's
8570   TGeoBBox *sideCLateralWingA = new TGeoBBox(kSideCWingAHalfLen,
8571                                              kSideCHalfThick,
8572                                              kSideCWingsHalfWide);
8573
8574   TGeoBBox *sideCLateralWingB = new TGeoBBox(kSideCWingBHalfLen,
8575                                              kSideCHalfThick,
8576                                              kSideCWingsHalfWide);
8577
8578   TGeoBBox *sideCLateralWingC = new TGeoBBox(kSideCHalfThick,    // With these
8579                                              kSideCWingCHalfLen, // X,Y avoid
8580                                              kSideCWingsHalfWide);//rotations
8581
8582   TGeoBBox *sideCLateralWingD = new TGeoBBox(kSideCWingDHalfLen,
8583                                              kSideCHalfThick,
8584                                              kSideCWingsHalfWide);
8585
8586   TGeoBBox *sideCLateralWingE = new TGeoBBox(kSideCWingEHalfLen,
8587                                              kSideCHalfThick,
8588                                              kSideCWingsHalfWide);
8589
8590   // The connecting lower plate: a Xtru
8591   TGeoXtru *sideCLowerPlate =  new TGeoXtru(2);
8592
8593   xprof[0] = 0.;
8594   yprof[0] = 0.;
8595   xprof[1] = kPlateHalfLen;
8596   yprof[1] = 0.;
8597   xprof[2] = xprof[1] + kPlateHalfLen*TMath::Cos(kSideCFoldAngle);
8598   yprof[2] = kPlateHalfLen*TMath::Sin(kSideCFoldAngle);
8599   xprof[3] = xprof[2] - kPlateThick*TMath::Sin(kSideCFoldAngle);
8600   yprof[3] = yprof[2] + kPlateThick*TMath::Cos(kSideCFoldAngle);
8601   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8602               kPlateThick, xprof[4], yprof[4]);
8603   xprof[5] = 0.;
8604   yprof[5] = kPlateThick;
8605
8606   sideCLowerPlate->DefinePolygon(kNPointsPlate, xprof, yprof);
8607   Double_t zwide = kSideCHalfWide + 2*kSideCHalfThick;
8608   sideCLowerPlate->DefineSection(0,-zwide);
8609   sideCLowerPlate->DefineSection(1, zwide);
8610
8611   // The connecting side plate: a Xtru
8612   TGeoXtru *sideCLateralPlate = new TGeoXtru(2);
8613
8614   xprof[0] = 0.;
8615   yprof[0] = 0.;
8616   xprof[1] = kPlateHalfLen;
8617   yprof[1] = 0.;
8618   xprof[2] = xprof[1] + kPlateHalfLen*TMath::Cos(kSideCFoldAngle);
8619   yprof[2] = kPlateHalfLen*TMath::Sin(kSideCFoldAngle);
8620   xprof[3] = xprof[2] - kPlateHeight*TMath::Sin(kSideCFoldAngle);
8621   yprof[3] = yprof[2] + kPlateHeight*TMath::Cos(kSideCFoldAngle);
8622   InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
8623               kPlateHeight, xprof[4], yprof[4]); // Avoid small overlap
8624   xprof[5] = 0.;
8625   yprof[5] = kPlateHeight;
8626
8627   sideCLateralPlate->DefinePolygon(kNPointsPlate, xprof, yprof);
8628   sideCLateralPlate->DefineSection(0,-kPlateThick/2);
8629   sideCLateralPlate->DefineSection(1, kPlateThick/2);
8630
8631   // The bar fixing the cooling tubes: a Tube
8632   TGeoTube *coolBar = new TGeoTube(0., kBarCoolRmax, kSideCHalfWide);
8633
8634   // The Cable Tray cover: a (complex) Xtru
8635   TGeoXtru *sideCCoverFace = new TGeoXtru(2);
8636
8637   xprof[ 0] = sideCLateralFace->GetX(8);
8638   yprof[ 0] = sideCLateralFace->GetY(8);
8639   xprof[ 1] = sideCLateralFace->GetX(7);
8640   yprof[ 1] = sideCLateralFace->GetY(7);
8641   xprof[ 2] = sideCLateralFace->GetX(6);
8642   yprof[ 2] = sideCLateralFace->GetY(6);
8643   xprof[ 3] = sideCLateralFace->GetX(5);
8644   yprof[ 3] = sideCLateralFace->GetY(5);
8645   xprof[ 4] = sideCLateralFace->GetX(4);
8646   yprof[ 4] = sideCLateralFace->GetY(4);
8647
8648   xloc = (kSideCLength1 + (kSideCSideLength1+kSideCSideLength2))/2;
8649   delta  = kSideCLength1 - (xloc + kSideCWingDHalfLen);
8650   xprof[ 5] = xprof[4]
8651             + (delta + 2*kSideCWingEHalfLen)*TMath::Cos(kSideCFoldAngle);
8652   yprof[ 5] = yprof[4]
8653             + (delta + 2*kSideCWingEHalfLen)*TMath::Sin(kSideCFoldAngle);
8654
8655   xprof[ 6] = xprof[5] - 2*kSideCHalfThick*TMath::Sin(kSideCFoldAngle);
8656   yprof[ 6] = yprof[5] + 2*kSideCHalfThick*TMath::Cos(kSideCFoldAngle);
8657   InsidePoint(xprof[3], yprof[3], xprof[4], yprof[4], xprof[5], yprof[5],
8658               2*kSideCHalfThick, xprof[7], yprof[7]);
8659   InsidePoint(xprof[2], yprof[2], xprof[3], yprof[3], xprof[4], yprof[4],
8660               2*kSideCHalfThick, xprof[8], yprof[8]);
8661   xprof[ 9] = xprof[2] + 2*kSideCHalfThick;
8662   yprof[ 9] = yprof[2] + 2*kSideCHalfThick;
8663   xprof[10] = xprof[1];
8664   yprof[10] = yprof[1] + 2*kSideCHalfThick;
8665   xprof[11] = xprof[0];
8666   yprof[11] = yprof[0] + 2*kSideCHalfThick;
8667
8668   sideCCoverFace->DefinePolygon(kNPointsCoverFace, xprof, yprof);
8669   zloc = kSideCHalfWide + 2*kSideCHalfThick + 2*kSideCWingsHalfWide;
8670   sideCCoverFace->DefineSection(0,-zloc);
8671   sideCCoverFace->DefineSection(1, zloc);
8672
8673
8674   // We have all shapes: now create the real volumes
8675   TGeoMedium *medAl      = mgr->GetMedium("ITS_ALUMINUM$");
8676
8677   TGeoVolume *traySideCLowerFace  = new TGeoVolume("ITSsuppTraySideCLower",
8678                                                    sideCLowerFace, medAl);
8679
8680   traySideCLowerFace->SetVisibility(kTRUE);
8681   traySideCLowerFace->SetLineColor(6); // Purple
8682   traySideCLowerFace->SetLineWidth(1);
8683   traySideCLowerFace->SetFillColor(traySideCLowerFace->GetLineColor());
8684   traySideCLowerFace->SetFillStyle(4000); // 0% transparent
8685
8686   TGeoVolume *traySideCLateralFace  = new TGeoVolume("ITSsuppTraySideCLateral",
8687                                                      sideCLateralFace, medAl);
8688
8689   traySideCLateralFace->SetVisibility(kTRUE);
8690   traySideCLateralFace->SetLineColor(6); // Purple
8691   traySideCLateralFace->SetLineWidth(1);
8692   traySideCLateralFace->SetFillColor(traySideCLateralFace->GetLineColor());
8693   traySideCLateralFace->SetFillStyle(4000); // 0% transparent
8694
8695   TGeoVolume *traySideCLateralWingA =
8696     new TGeoVolume("ITSsuppTraySideCLateralWingA", sideCLateralWingA,  medAl);
8697
8698   traySideCLateralWingA->SetVisibility(kTRUE);
8699   traySideCLateralWingA->SetLineColor(6); // Purple
8700   traySideCLateralWingA->SetLineWidth(1);
8701   traySideCLateralWingA->SetFillColor(traySideCLateralWingA->GetLineColor());
8702   traySideCLateralWingA->SetFillStyle(4000); // 0% transparent
8703
8704   TGeoVolume *traySideCLateralWingB =
8705     new TGeoVolume("ITSsuppTraySideCLateralWingB", sideCLateralWingB,  medAl);
8706
8707   traySideCLateralWingB->SetVisibility(kTRUE);
8708   traySideCLateralWingB->SetLineColor(6); // Purple
8709   traySideCLateralWingB->SetLineWidth(1);
8710   traySideCLateralWingB->SetFillColor(traySideCLateralWingB->GetLineColor());
8711   traySideCLateralWingB->SetFillStyle(4000); // 0% transparent
8712
8713   TGeoVolume *traySideCLateralWingC =
8714     new TGeoVolume("ITSsuppTraySideCLateralWingC", sideCLateralWingC,  medAl);
8715
8716   traySideCLateralWingC->SetVisibility(kTRUE);
8717   traySideCLateralWingC->SetLineColor(6); // Purple
8718   traySideCLateralWingC->SetLineWidth(1);
8719   traySideCLateralWingC->SetFillColor(traySideCLateralWingC->GetLineColor());
8720   traySideCLateralWingC->SetFillStyle(4000); // 0% transparent
8721
8722   TGeoVolume *traySideCLateralWingD =
8723     new TGeoVolume("ITSsuppTraySideCLateralWingD", sideCLateralWingD,  medAl);
8724
8725   traySideCLateralWingD->SetVisibility(kTRUE);
8726   traySideCLateralWingD->SetLineColor(6); // Purple
8727   traySideCLateralWingD->SetLineWidth(1);
8728   traySideCLateralWingD->SetFillColor(traySideCLateralWingD->GetLineColor());
8729   traySideCLateralWingD->SetFillStyle(4000); // 0% transparent
8730
8731   TGeoVolume *traySideCLateralWingE =
8732     new TGeoVolume("ITSsuppTraySideCLateralWingE", sideCLateralWingE,  medAl);
8733
8734   traySideCLateralWingE->SetVisibility(kTRUE);
8735   traySideCLateralWingE->SetLineColor(6); // Purple
8736   traySideCLateralWingE->SetLineWidth(1);
8737   traySideCLateralWingE->SetFillColor(traySideCLateralWingE->GetLineColor());
8738   traySideCLateralWingE->SetFillStyle(4000); // 0% transparent
8739
8740   TGeoVolume *traySideCLowerPlate =
8741     new TGeoVolume("ITSsuppTraySideCLowerPlate", sideCLowerPlate,  medAl);
8742
8743   traySideCLowerPlate->SetVisibility(kTRUE);
8744   traySideCLowerPlate->SetLineColor(6); // Purple
8745   traySideCLowerPlate->SetLineWidth(1);
8746   traySideCLowerPlate->SetFillColor(traySideCLowerPlate->GetLineColor());
8747   traySideCLowerPlate->SetFillStyle(4000); // 0% transparent
8748
8749   TGeoVolume *traySideCLateralPlate =
8750     new TGeoVolume("ITSsuppTraySideCLateralPlate", sideCLateralPlate,  medAl);
8751
8752   traySideCLateralPlate->SetVisibility(kTRUE);
8753   traySideCLateralPlate->SetLineColor(6); // Purple
8754   traySideCLateralPlate->SetLineWidth(1);
8755   traySideCLateralPlate->SetFillColor(traySideCLateralPlate->GetLineColor());
8756   traySideCLateralPlate->SetFillStyle(4000); // 0% transparent
8757
8758   TGeoVolume *traySideCCoverFace =
8759     new TGeoVolume("ITSsuppTraySideCCoverFace", sideCCoverFace,  medAl);
8760
8761   traySideCCoverFace->SetVisibility(kTRUE);
8762   traySideCCoverFace->SetLineColor(6); // Purple
8763   traySideCCoverFace->SetLineWidth(1);
8764   traySideCCoverFace->SetFillColor(traySideCCoverFace->GetLineColor());
8765   traySideCCoverFace->SetFillStyle(4000); // 0% transparent
8766
8767   TGeoVolume *coolingTubeBar = new TGeoVolume("ITSsuppTraySideCCoolBar",
8768                                               coolBar, medAl);
8769
8770   coolingTubeBar->SetVisibility(kTRUE);
8771   coolingTubeBar->SetLineColor(6); // Purple
8772   coolingTubeBar->SetLineWidth(1);
8773   coolingTubeBar->SetFillColor(coolingTubeBar->GetLineColor());
8774   coolingTubeBar->SetFillStyle(4000); // 0% transparent
8775
8776
8777   // Now build up the tray
8778   cableTrayC->AddNode(traySideCLowerFace,1,0);
8779
8780   zloc = kSideCHalfWide + kSideCHalfThick;
8781   cableTrayC->AddNode(traySideCLateralFace,1,
8782                             new TGeoTranslation(0., 0., zloc) );
8783   cableTrayC->AddNode(traySideCLateralFace,2,
8784                             new TGeoTranslation(0., 0.,-zloc) );
8785
8786   xloc = kSideCWingAHalfLen;
8787   yloc = kSideCHeight1 - kSideCHalfThick;
8788   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8789   cableTrayC->AddNode(traySideCLateralWingA,1,
8790                             new TGeoTranslation(xloc, yloc, zloc) );
8791   cableTrayC->AddNode(traySideCLateralWingA,2,
8792                             new TGeoTranslation(xloc, yloc,-zloc) );
8793
8794   xloc = kSideCSideLength1 + kSideCSideLength2/2;
8795   yloc = Yfrom2Points(kSideCSideLength1,kSideCHeight1,
8796                       kSideCSideLength1+kSideCSideLength2,kSideCSideHeight,
8797                       xloc) - kSideCHalfThick -0.0012; // Avoid small overlap
8798   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8799   alpharot = (-(kSideCHeight1 - kSideCSideHeight)/kSideCSideLength2 )*
8800                 TMath::RadToDeg();
8801   cableTrayC->AddNode(traySideCLateralWingB,1,
8802                             new TGeoCombiTrans(xloc, yloc, zloc,
8803                                         new TGeoRotation("",alpharot,0,0) ) );
8804   cableTrayC->AddNode(traySideCLateralWingB,2,
8805                             new TGeoCombiTrans(xloc, yloc,-zloc,
8806                                         new TGeoRotation("",alpharot,0,0) ) );
8807
8808   xloc = kSideCSideLength1 + kSideCSideLength2 - kSideCHalfThick;
8809   yloc = kSideCSideHeight - kSideCWingCHalfLen;
8810   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8811   cableTrayC->AddNode(traySideCLateralWingC,1,
8812                             new TGeoTranslation(xloc, yloc, zloc) );
8813   cableTrayC->AddNode(traySideCLateralWingC,2,
8814                             new TGeoTranslation(xloc, yloc,-zloc) );
8815
8816   xloc = (kSideCLength1 + (kSideCSideLength1+kSideCSideLength2))/2;
8817   yloc = kSideCHeight2 - kSideCHalfThick;
8818   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8819   cableTrayC->AddNode(traySideCLateralWingD,1,
8820                             new TGeoTranslation(xloc, yloc, zloc) );
8821   cableTrayC->AddNode(traySideCLateralWingD,2,
8822                             new TGeoTranslation(xloc, yloc,-zloc) );
8823
8824   delta = kSideCLength1 - (xloc + kSideCWingDHalfLen);
8825   xloc = kSideCLength1 + delta + kSideCWingEHalfLen;
8826   yloc = (xloc - kSideCLength1)*TMath::Tan(kSideCFoldAngle) +
8827           kSideCHeight2*TMath::Cos(kSideCFoldAngle) - kSideCHalfThick;
8828   zloc = kSideCHalfWide + 2*kSideCHalfThick + kSideCWingsHalfWide;
8829   alpharot = kSideCFoldAngle*TMath::RadToDeg();
8830   cableTrayC->AddNode(traySideCLateralWingE,1,
8831                             new TGeoCombiTrans(xloc, yloc, zloc,
8832                                         new TGeoRotation("",alpharot,0,0) ) );
8833   cableTrayC->AddNode(traySideCLateralWingE,2,
8834                             new TGeoCombiTrans(xloc, yloc,-zloc,
8835                                         new TGeoRotation("",alpharot,0,0) ) );
8836
8837   xloc = kSideCLength1 - kPlateHalfLen;
8838   yloc = -kPlateThick -0.0025; // Avoid small overlap
8839   cableTrayC->AddNode(traySideCLowerPlate,1,
8840                             new TGeoTranslation(xloc, yloc, 0.) );
8841
8842   xloc = kSideCLength1 - kPlateHalfLen;
8843   yloc = -kPlateThick;
8844   zloc = kSideCHalfWide + 2*kSideCHalfThick + kPlateThick/2;
8845   cableTrayC->AddNode(traySideCLateralPlate,1,
8846                             new TGeoTranslation(xloc, yloc, zloc) );
8847   cableTrayC->AddNode(traySideCLateralPlate,2,
8848                             new TGeoTranslation(xloc, yloc,-zloc) );
8849
8850   for (Int_t jc = 0; jc <kNumBarCool; jc++) {
8851     xloc = kXShiftBarCool[jc];
8852     yloc = kYShiftBarCool[jc];
8853     cableTrayC->AddNode(coolingTubeBar,jc+1,
8854                               new TGeoTranslation(xloc, yloc, 0.) );
8855   }
8856
8857   cableTrayC->AddNode(traySideCCoverFace,1,0);
8858
8859
8860   // Finally return what we made up
8861
8862   return cableTrayC;
8863 }
8864
8865 //______________________________________________________________________
8866 void AliITSv11GeometrySupport::ITSTPCSupports(TGeoVolume *moth,
8867                                         const TGeoManager *mgr){
8868 //
8869 // Creates the elements suspending the ITS to the TPC and other fixed
8870 // elements used to hook the rails (0872/C and its daughters)
8871 //
8872 // Input:
8873 //         moth : the TGeoVolume owing the volume structure
8874 //         mgr  : the GeoManager (default gGeoManager)
8875 // Output:
8876 //
8877 // Return:
8878 //
8879 // Created:      28 Oct 2010  Mario Sitta
8880 // Updated:      18 Feb 2011  Mario Sitta
8881 //
8882 // Technical data are taken from AutoCAD drawings, L.Simonetti technical
8883 // drawings and other (oral) information given by F.Tosello
8884 //
8885
8886   // Dimensions and positions of the half ring C2/C3 (0872/C/04)
8887   const Double_t kRingCZPos           =   733.000*fgkmm;
8888   const Double_t kRingCZToTPC         =     5.500*fgkmm;
8889
8890   const Double_t kRingCThick          =    12.000*fgkmm;
8891   const Double_t kRingCRmin           =   565.000*fgkmm;
8892   const Double_t kRingCRmax           =   592.000*fgkmm;
8893   const Double_t kRingCHeight         =   560.000*fgkmm;
8894   const Double_t kRingCXToInsert      =   515.000*fgkmm;
8895   const Double_t kRingCYToInsert      =   113.000*fgkmm;
8896
8897   const Int_t kNumberOfRingPoints     =    23; // N.points to approximate arc
8898
8899   // Dimensions of the forward upper hook (0872/C/09)
8900   const Double_t kForwUpHookThick     =    20.000*fgkmm;
8901   const Double_t kForwUpHookRext      =   590.000*fgkmm;
8902   const Double_t kForwUpHookRint      =    20.000*fgkmm;
8903   const Double_t kForwUpHookHiTot     =    89.000*fgkmm;
8904   const Double_t kForwUpHookHiInt     =    59.000*fgkmm;
8905   const Double_t kForwUpHookWide      =    96.000*fgkmm;
8906   const Double_t kForwUpHookHalfBase  =    25.000*fgkmm;
8907   const Double_t kForwUpHookBaseCut   =    10.000*fgkmm;
8908   const Double_t kForwUpHookHoleWide  =    25.000*fgkmm;
8909   const Double_t kForwUpHookHoleHi    =    22.500*fgkmm;
8910   const Double_t kForwUpHookHoleBase  =     5.000*fgkmm;
8911   const Double_t kForwUpHookHoleR5    =     5.000*fgkmm;
8912   const Double_t kForwUpHookHoleY     =     8.000*fgkmm;
8913   const Double_t kForwUpHookHollowHi  =    35.000*fgkmm;
8914   const Double_t kForwUpHookHollowWide=     5.000*fgkmm;
8915
8916   const Int_t kNumberOfForwUpHookPts  =    11;
8917   const Int_t kNumbOfForwUpHookHolePts=     5;
8918
8919   // Dimensions of the forward lower hook (0872/C/08)
8920   const Double_t kForwLwHookThick     =    20.000*fgkmm;
8921   const Double_t kForwLwHookRext      =   590.000*fgkmm;
8922   const Double_t kForwLwHookRint      =    20.000*fgkmm;
8923   const Double_t kForwLwHookHiTot     =    88.500*fgkmm;
8924   const Double_t kForwLwHookWide      =    96.000*fgkmm;
8925   const Double_t kForwLwHookHalfBase  =    25.000*fgkmm;
8926   const Double_t kForwLwHookBaseCut   =    10.000*fgkmm;
8927   const Double_t kForwLwHookYToHollow =     3.500*fgkmm;
8928   const Double_t kForwLwHookHoleR     =     7.500*fgkmm;
8929   const Double_t kForwLwHookHoleIntHi =    35.000*fgkmm;
8930   const Double_t kForwLwHookHoleYPos  =    13.500*fgkmm;
8931   const Double_t kForwLwHookHollowHi  =    62.000*fgkmm;
8932   const Double_t kForwLwHookHollowWide=     5.000*fgkmm;
8933
8934   const Int_t kNumberOfForwLwHookPts  =    11;
8935   const Int_t kNumbOfForwLwHookHolePts=     7;
8936
8937   // Dimensions of the rear upper hook (0872/C/10)
8938   const Double_t kRearUpHookThick     =    15.000*fgkmm;
8939   const Double_t kRearUpHookRext      =   590.000*fgkmm;
8940   const Double_t kRearUpHookRint      =    20.000*fgkmm;
8941   const Double_t kRearUpHookHiTot     =    53.500*fgkmm;
8942   const Double_t kRearUpHookHiInt     =    23.500*fgkmm;
8943   const Double_t kRearUpHookWide      =    96.000*fgkmm;
8944   const Double_t kRearUpHookHalfBase  =    25.000*fgkmm;
8945   const Double_t kRearUpHookHoleWide  =    25.000*fgkmm;
8946   const Double_t kRearUpHookHoleHi    =    22.500*fgkmm;
8947   const Double_t kRearUpHookHoleBase  =     5.000*fgkmm;
8948   const Double_t kRearUpHookHoleR5    =     5.000*fgkmm;
8949   const Double_t kRearUpHookHoleY     =     8.000*fgkmm;
8950
8951   const Int_t kNumberOfRearUpHookPts  =    10;
8952   const Int_t kNumbOfRearUpHookHolePts=     5;
8953
8954   // Dimensions of the forward lower hook (0872/C/11)
8955   const Double_t kRearLwHookThick     =    20.000*fgkmm;
8956   const Double_t kRearLwHookRext      =   590.000*fgkmm;
8957   const Double_t kRearLwHookHiTot     =    30.000*fgkmm;
8958   const Double_t kRearLwHookWide      =    96.000*fgkmm;
8959
8960   const Int_t kNumberOfRearLwHookPts  =     3;
8961
8962   // Dimensions of the rear lower brackets (0872/C/16)
8963   const Double_t kRearLwBracketThick  =    15.000*fgkmm;
8964   const Double_t kRearLwBracketHi1    =    42.000*fgkmm;
8965   const Double_t kRearLwBracketHi2    =    12.000*fgkmm;
8966   const Double_t kRearLwBracketWide1  =    34.000*fgkmm;
8967   const Double_t kRearLwBracketWide2  =    10.000*fgkmm;
8968 //  const Double_t kRearLwBracketR5     =     5.000*fgkmm
8969
8970   // Dimensions of the forward webcam supports (0872/C/V/01-03-04)
8971   const Double_t kForwWebSStirrDep    =    20.000*fgkmm;
8972   const Double_t kForwWebSStirrLen1   =    15.000*fgkmm;
8973   const Double_t kForwWebSStirrLen2   =    55.000*fgkmm;
8974   const Double_t kForwWebSStirrLen3   =    10.000*fgkmm;
8975   const Double_t kForwWebSStirrWide1  =    45.000*fgkmm;
8976   const Double_t kForwWebSStirrWide2  =    38.000*fgkmm;
8977   const Double_t kForwWebSStirrWide3  =    23.000*fgkmm;
8978   const Double_t kForwWebTStirrThick  =     5.000*fgkmm;
8979   const Double_t kForwWebTStirrWide1  =    30.000*fgkmm;
8980   const Double_t kForwWebTStirrWide2  =    10.000*fgkmm;
8981   const Double_t kForwWebTStirrTotLen3=    58.500*fgkmm;
8982   const Double_t kForwWebTStirrTotLen4=    36.000*fgkmm;
8983   const Double_t kForwWebTStirrLen1   =    10.000*fgkmm;
8984
8985   // Dimensions of the forward and rear webcam clamps (0872/C/V/02)
8986   const Double_t kFRWebClampThick     =    10.000*fgkmm;
8987   const Double_t kFRWebClampExtWide   =    30.000*fgkmm;
8988   const Double_t kFRWebClampIntWide   =    18.000*fgkmm;
8989   const Double_t kFRWebClampExtHi     =    22.000*fgkmm;
8990   const Double_t kFRWebClampIntHi     =    17.000*fgkmm;
8991
8992   // Dimensions of the webcam itself
8993   const Double_t kWebcamLength        =    35.000*fgkmm;//ESTIMATED!!!
8994
8995   // Dimensions of the rear upper webcam supports (0872/C/V/05-06)
8996   const Double_t kRearUpWebStirrWide  =    76.000*fgkmm;
8997   const Double_t kRearUpWebStirrDep   =    15.000*fgkmm;
8998   const Double_t kRearUpWebStirrThick =     5.000*fgkmm;
8999   const Double_t kRearUpWebStirrH1    =    27.000*fgkmm;
9000   const Double_t kRearUpWebStirrH2    =    32.000*fgkmm;
9001   const Double_t kRearUpWebBarLen     =   130.000*fgkmm;
9002   const Double_t kRearUpWebBarHi      =    20.000*fgkmm;
9003   const Double_t kRearUpWebBarThick   =     5.000*fgkmm;
9004
9005   // Dimensions of the upper wheel slides (0872/C/Z/00-01-02)
9006   const Double_t kUpperSlideTotHeight =    93.500*fgkmm;
9007   const Double_t kUpperSlideBlockHi   =    62.500*fgkmm;
9008   const Double_t kUpperSlideWidth     =    36.000*fgkmm;
9009   const Double_t kUpperSlideTotDepth  =    51.000*fgkmm;
9010   const Double_t kUpperSlideIntDepth  =    36.000*fgkmm;
9011   const Double_t kUpperSlideStubHi    =    15.000*fgkmm;
9012   const Double_t kUpperSlideStubDep   =     8.000*fgkmm;
9013   const Double_t kUpperSlideWheelHi   =    18.500*fgkmm;
9014   const Double_t kUpperSlideHoleRout  =    11.000*fgkmm;
9015   const Double_t kUpperSlideHoleRint1 =     9.000*fgkmm;
9016   const Double_t kUpperSlideHoleRint2 =    11.500*fgkmm;
9017   const Double_t kUpperSlideHoleH1    =     7.000*fgkmm;
9018   const Double_t kUpperSlideHoleH2    =    46.000*fgkmm;
9019   const Double_t kUpperSlideHoleH3    =     1.100*fgkmm;
9020   const Double_t kUpperSlideHoleXPos  =    20.000*fgkmm;
9021   const Double_t kUpperSlidePinRmin   =     4.000*fgkmm;
9022   const Double_t kUpperSlidePinRmax   =     6.000*fgkmm;
9023   const Double_t kUpperSlidePinH1     =     7.000*fgkmm;
9024   const Double_t kUpperSlidePinH2     =    46.000*fgkmm;
9025   const Double_t kUpperSlidePinH3     =    25.500*fgkmm;
9026
9027   // Dimensions of the lower wheel slides (0872/C/W/00-01-02-03)
9028   const Double_t kLowerSlideTotHeight =    80.000*fgkmm;
9029   const Double_t kLowerSlideBlockHi   =    28.000*fgkmm;
9030   const Double_t kLowerSlideWidth     =    36.000*fgkmm;
9031   const Double_t kLowerSlideTotDepth  =    60.000*fgkmm;
9032   const Double_t kLowerSlideHoleRout  =     9.500*fgkmm;
9033   const Double_t kLowerSlideHoleRint  =     4.700*fgkmm;
9034   const Double_t kLowerSlideHoleH1    =    12.000*fgkmm;
9035   const Double_t kLowerSlideNoseBase  =    40.000*fgkmm;
9036   const Double_t kLowerSlideNoseBasHi =     6.000*fgkmm;//Computed
9037   const Double_t kLowerSlideNoseUpWid =    25.000*fgkmm;
9038   const Double_t kLowerSlideNoseDepth =    10.000*fgkmm;
9039   const Double_t kLowerSlidePinRmin   =     3.000*fgkmm;
9040   const Double_t kLowerSlidePinRmax   =     4.000*fgkmm;
9041   const Double_t kLowerSlidePinH1     =    12.000*fgkmm;
9042   const Double_t kLowerSlidePinH2     =    10.000*fgkmm;
9043
9044   // Dimensions and positions of the C1/C2 rail stirrups (0872/C/01-02)
9045   const Double_t kStirrCXPos          =   759.000*fgkmm;
9046   const Double_t kStirrCZPos          =  1867.000*fgkmm;
9047
9048   const Double_t kStirrC12Thick       =    15.000*fgkmm;
9049   const Double_t kStirrC12TotLen      =   314.000*fgkmm;
9050   const Double_t kStirrC12BodyHalfHi  =    95.000*fgkmm;
9051   const Double_t kStirrC12BodyLen     =   153.000*fgkmm;
9052   const Double_t kStirrC12HeadLen     =    50.000*fgkmm;
9053   const Double_t kStirrC12HeadHalfHi  =   165.000*fgkmm;
9054   const Double_t kStirrC12HeadIntHi   =   114.000*fgkmm;
9055   const Double_t kStirrC12HeadIntLen  =    45.000*fgkmm;
9056   const Double_t kStirrC12TailLen     =    14.000*fgkmm;
9057   const Double_t kStirrC12R100        =   100.000*fgkmm;
9058   const Double_t kStirrC12R50         =    50.000*fgkmm;
9059   const Double_t kStirrC12R10         =    10.000*fgkmm;
9060   const Double_t kStirrC12HeadAng     =    40.000; // Degree
9061
9062   const Int_t kNumberOfStirrCPoints   =    23;
9063
9064   // Dimensions and positions of the C5 rail stirrups (0872/C/05)
9065   const Double_t kStirrC5BodyLen      =   155.000*fgkmm;
9066
9067
9068   // Local variables
9069   Double_t xprof[2*kNumberOfStirrCPoints+1],yprof[2*kNumberOfStirrCPoints+1];
9070   Double_t xpos, ypos, zpos, alpha;
9071   Double_t xdummy, ydummy;
9072   
9073
9074   // First create all needed shapes
9075
9076   // The Supporting Ring (0872/C/04): a really complex Xtru
9077   // to approximate the arc with a polyline
9078   TGeoXtru *ringC2C3 = new TGeoXtru(2);
9079
9080   for (Int_t j=0; j<11; j++) { // The external arc
9081     xprof[j] = kRingCRmax*SinD(90*j/10);
9082     yprof[j] = kRingCRmax*CosD(90*j/10);
9083   }
9084
9085   xprof[11] = kRingCRmin;
9086   yprof[11] = yprof[10];
9087
9088   alpha = TMath::ASin(kRingCYToInsert/kRingCRmin); // Now the insert
9089   xprof[12] = kRingCRmin*TMath::Cos(alpha/2);
9090   yprof[12] = kRingCRmin*TMath::Sin(alpha/2);
9091   xprof[13] = kRingCRmin*TMath::Cos(alpha);
9092   yprof[13] = kRingCRmin*TMath::Sin(alpha);
9093
9094   xprof[14] = kRingCXToInsert;
9095   yprof[14] = yprof[13];
9096
9097   alpha = TMath::ACos(kRingCXToInsert/kRingCRmin); // The insert ending angle
9098   xprof[15] = kRingCRmin*TMath::Cos(alpha);
9099   yprof[15] = kRingCRmin*TMath::Sin(alpha);
9100
9101   for (Int_t j=7; j>1; j--) { // The internal arc
9102     xprof[23-j] = kRingCRmin*SinD(90*j/10);
9103     yprof[23-j] = kRingCRmin*CosD(90*j/10);
9104   }
9105
9106   alpha = TMath::ASin(kRingCHeight/kRingCRmin);    // The angle till the notch
9107   xprof[22] = kRingCRmin*TMath::Cos(alpha);
9108   yprof[22] = kRingCRmin*TMath::Sin(alpha);
9109
9110   xprof[23] = xprof[0];
9111   yprof[23] = yprof[22];
9112
9113   // We did the right side, now reflex on the left side
9114   for (Int_t jp = 0; jp < 22; jp++) {
9115     xprof[24+jp] = -xprof[23-1-jp];
9116     yprof[24+jp] =  yprof[23-1-jp];
9117   }
9118
9119   // wow! now the actual Xtru
9120   ringC2C3->DefinePolygon(2*kNumberOfRingPoints, xprof, yprof);
9121   ringC2C3->DefineSection(0, 0);
9122   ringC2C3->DefineSection(1, kRingCThick);
9123
9124   // The Forward Upper Hook (0872/C/09): a Composite Shape made of
9125   // a really complex Xtru to approximate the arc with a polyline,
9126   // another Xtru for the hole, and a BBox for the hollow
9127   // The main body
9128   TGeoXtru *forwUpHookMainBody = new TGeoXtru(2);
9129   forwUpHookMainBody->SetName("ITSforwUpHookMainBody");
9130
9131   xprof[ 0] = kForwUpHookHalfBase - kForwUpHookBaseCut;
9132   yprof[ 0] = kForwUpHookRext - kForwUpHookHiTot;
9133   xprof[ 1] = kForwUpHookHalfBase;
9134   yprof[ 1] = yprof[0] + kForwUpHookBaseCut;
9135   xprof[ 2] = xprof[1];
9136   yprof[ 2] = yprof[0] + (kForwUpHookHiInt - kForwUpHookRint);
9137   for (Int_t j=1; j<6; j++) {
9138     xprof[2+j] = xprof[2] + kForwUpHookRint*(1 - CosD(90*j/5));
9139     yprof[2+j] = yprof[2] + kForwUpHookRint*SinD(90*j/5);
9140   }
9141   xprof[ 8] = kForwUpHookWide/2;
9142   yprof[ 8] = yprof[7];
9143   xprof[ 9] = xprof[8];
9144   alpha = TMath::ASin(0.5*kForwUpHookWide/kForwUpHookRext);
9145   yprof[ 9] = kForwUpHookRext*TMath::Cos(alpha);
9146   xprof[10] = kForwUpHookRext*TMath::Sin(alpha/2);
9147   yprof[10] = kForwUpHookRext*TMath::Cos(alpha/2);
9148   xprof[11] = 0;
9149   yprof[11] = kForwUpHookRext;
9150
9151   // We did the right side, now reflex on the left side
9152   for (Int_t jp = 0; jp < kNumberOfForwUpHookPts; jp++) {
9153     xprof[12+jp] = -xprof[10-jp];
9154     yprof[12+jp] =  yprof[10-jp];
9155   }
9156
9157   // Now the actual Xtru
9158   forwUpHookMainBody->DefinePolygon(2*kNumberOfForwUpHookPts+1, xprof, yprof);
9159   forwUpHookMainBody->DefineSection(0, 0);
9160   forwUpHookMainBody->DefineSection(1, kForwUpHookThick);
9161
9162   // The hole
9163   TGeoXtru *forwUpHookHole = new TGeoXtru(2);
9164   forwUpHookHole->SetName("ITSforwUpHookHole");
9165
9166   xprof[0] = kForwUpHookHoleBase/2;
9167   yprof[0] = forwUpHookMainBody->GetY(0) + kForwUpHookHoleY;
9168   xprof[1] = kForwUpHookHoleWide/2;
9169   yprof[1] = yprof[0] + (xprof[1] - xprof[0]); // Go at 45deg
9170   xprof[2] = xprof[1];
9171   yprof[2] = yprof[0] + kForwUpHookHoleHi - kForwUpHookHoleR5;
9172   xprof[3] = xprof[2] - kForwUpHookHoleR5*(1 - CosD(45));
9173   yprof[3] = yprof[2] + kForwUpHookHoleR5*SinD(45);
9174   xprof[4] = xprof[2] - kForwUpHookHoleR5;
9175   yprof[4] = yprof[0] + kForwUpHookHoleHi;
9176
9177   // We did the right side, now reflex on the left side
9178   for (Int_t jp = 0; jp < kNumbOfForwUpHookHolePts; jp++) {
9179     xprof[5+jp] = -xprof[4-jp];
9180     yprof[5+jp] =  yprof[4-jp];
9181   }
9182
9183   // Now the actual Xtru
9184   forwUpHookHole->DefinePolygon(2*kNumbOfForwUpHookHolePts, xprof, yprof);
9185   forwUpHookHole->DefineSection(0, -0.1);
9186   forwUpHookHole->DefineSection(1, kForwUpHookThick+0.1);
9187
9188   // The hollow
9189   TGeoBBox *forwUpHookHollow = new TGeoBBox(2.1 *kForwUpHookHalfBase,
9190                                             0.55*kForwUpHookHollowHi,
9191                                             0.55*kForwUpHookHollowWide);
9192   forwUpHookHollow->SetName("ITSforwUpHookHollow");
9193
9194   TGeoTranslation *forwUpHookHollPos = new TGeoTranslation(0.,
9195                       forwUpHookMainBody->GetY(0) + 0.5*kForwUpHookHollowHi,
9196                       forwUpHookMainBody->GetZ(1) - 0.5*kForwUpHookHollowWide);
9197   forwUpHookHollPos->SetName("ITSforwUpHookHollPos");
9198   forwUpHookHollPos->RegisterYourself();
9199
9200   // Finally the actual shape: a CompositeShape
9201   TGeoCompositeShape *forwUpHookShape = new TGeoCompositeShape("ITSforwUpHookMainBody-ITSforwUpHookHole-ITSforwUpHookHollow:ITSforwUpHookHollPos");
9202
9203   // The Forward Lower Hook (0872/C/08): a Composite Shape made of
9204   // a really complex Xtru to approximate the arc with a polyline,
9205   // another Xtru for the hole, and a BBox for the hollow
9206   // The main body
9207   TGeoXtru *forwLwHookMainBody = new TGeoXtru(2);
9208   forwLwHookMainBody->SetName("ITSforwLwHookMainBody");
9209
9210   xprof[ 0] = kForwLwHookHalfBase - kForwLwHookBaseCut;
9211   yprof[ 0] = kForwLwHookRext - kForwLwHookHiTot;
9212   xprof[ 1] = kForwLwHookHalfBase;
9213   yprof[ 1] = yprof[0] + kForwLwHookBaseCut;
9214   xprof[ 2] = xprof[1];
9215   yprof[ 2] = yprof[0] + (kForwLwHookHollowHi - kForwLwHookYToHollow
9216                           - kForwLwHookRint);
9217   for (Int_t j=1; j<6; j++) {
9218     xprof[2+j] = xprof[2] + kForwLwHookRint*(1 - CosD(90*j/5));
9219     yprof[2+j] = yprof[2] + kForwLwHookRint*SinD(90*j/5);
9220   }
9221   xprof[ 8] = kForwLwHookWide/2;
9222   yprof[ 8] = yprof[7];
9223   xprof[ 9] = xprof[8];
9224   alpha = TMath::ASin(0.5*kForwLwHookWide/kForwLwHookRext);
9225   yprof[ 9] = kForwLwHookRext*TMath::Cos(alpha);
9226   xprof[10] = kForwLwHookRext*TMath::Sin(alpha/2);
9227   yprof[10] = kForwLwHookRext*TMath::Cos(alpha/2);
9228   xprof[11] = 0;
9229   yprof[11] = kForwLwHookRext;
9230
9231   // We did the right side, now reflex on the left side
9232   for (Int_t jp = 0; jp < kNumberOfForwLwHookPts; jp++) {
9233     xprof[12+jp] = -xprof[10-jp];
9234     yprof[12+jp] =  yprof[10-jp];
9235   }
9236
9237   // Now the actual Xtru
9238   forwLwHookMainBody->DefinePolygon(2*kNumberOfForwLwHookPts+1, xprof, yprof);
9239   forwLwHookMainBody->DefineSection(0, 0);
9240   forwLwHookMainBody->DefineSection(1, kForwLwHookThick);
9241
9242   // The hole
9243   TGeoXtru *forwLwHookHole = new TGeoXtru(2);
9244   forwLwHookHole->SetName("ITSforwLwHookHole");
9245
9246   xprof[0] = 0;
9247   yprof[0] = forwLwHookMainBody->GetY(0) + kForwLwHookHoleYPos
9248            - kForwLwHookHoleR;
9249   for (Int_t j=1; j<3; j++) {
9250     xprof[0+j] = xprof[0] + kForwLwHookHoleR*SinD(90*j/3);
9251     yprof[0+j] = yprof[0] + kForwLwHookHoleR*(1 - CosD(90*j/3));
9252   }
9253   xprof[3] = xprof[0] + kForwLwHookHoleR;
9254   yprof[3] = yprof[0] + kForwLwHookHoleR;
9255   xprof[4] = xprof[3];
9256   yprof[4] = yprof[3] + kForwLwHookHoleIntHi;
9257   for (Int_t j=1; j<3; j++) {
9258     xprof[4+j] = xprof[4] - kForwLwHookHoleR*(1 - CosD(90*j/3));
9259     yprof[4+j] = yprof[4] + kForwLwHookHoleR*SinD(90*j/3);
9260   }
9261   xprof[7] = xprof[0];
9262   yprof[7] = yprof[4] + kForwLwHookHoleR;
9263
9264   // We did the right side, now reflex on the left side
9265   for (Int_t jp = 0; jp < kNumbOfForwLwHookHolePts-1; jp++) {
9266     xprof[8+jp] = -xprof[6-jp];
9267     yprof[8+jp] =  yprof[6-jp];
9268   }
9269
9270   // Now the actual Xtru
9271   forwLwHookHole->DefinePolygon(2*kNumbOfForwLwHookHolePts, xprof, yprof);
9272   forwLwHookHole->DefineSection(0, -0.1);
9273   forwLwHookHole->DefineSection(1, kForwLwHookThick+0.1);
9274
9275   // The hollow
9276   TGeoBBox *forwLwHookHollow = new TGeoBBox(2.1 *kForwLwHookHalfBase,
9277                                             0.55*kForwLwHookHollowHi,
9278                                             0.55*kForwLwHookHollowWide);
9279   forwLwHookHollow->SetName("ITSforwLwHookHollow");
9280
9281   TGeoTranslation *forwLwHookHollPos = new TGeoTranslation(0.,
9282                       forwLwHookMainBody->GetY(0) + 0.5*kForwLwHookHollowHi,
9283                       forwLwHookMainBody->GetZ(1) - 0.5*kForwLwHookHollowWide);
9284   forwLwHookHollPos->SetName("ITSforwLwHookHollPos");
9285   forwLwHookHollPos->RegisterYourself();
9286
9287   // Finally the actual shape: a CompositeShape
9288   TGeoCompositeShape *forwLwHookShape = new TGeoCompositeShape("ITSforwLwHookMainBody-ITSforwLwHookHole-ITSforwLwHookHollow:ITSforwLwHookHollPos");
9289
9290   // The Rear Upper Hook (0872/C/10): a Composite Shape made of
9291   // a really complex Xtru to approximate the arc with a polyline,
9292   // and another Xtru for the hole
9293   // The main body
9294   TGeoXtru *rearUpHookMainBody = new TGeoXtru(2);
9295   rearUpHookMainBody->SetName("ITSrearUpHookMainBody");
9296
9297   xprof[0] = kRearUpHookHalfBase;
9298   yprof[0] = kRearUpHookRext - kRearUpHookHiTot;
9299   xprof[1] = xprof[0];
9300   yprof[1] = yprof[0] + (kRearUpHookHiInt - kRearUpHookRint); 
9301   for (Int_t j=1; j<6; j++) {
9302     xprof[1+j] = xprof[1] + kRearUpHookRint*(1 - CosD(90*j/5));
9303     yprof[1+j] = yprof[1] + kRearUpHookRint*SinD(90*j/5);
9304   }
9305   xprof[ 7] = kRearUpHookWide/2;
9306   yprof[ 7] = yprof[5];
9307   xprof[ 8] = xprof[7];
9308   alpha = TMath::ASin(0.5*kRearUpHookWide/kRearUpHookRext);
9309   yprof[ 8] = kRearUpHookRext*TMath::Cos(alpha);
9310   xprof[ 9] = kRearUpHookRext*TMath::Sin(alpha/2);
9311   yprof[ 9] = kRearUpHookRext*TMath::Cos(alpha/2);
9312   xprof[10] = 0;
9313   yprof[10] = kRearUpHookRext;
9314
9315   // We did the right side, now reflex on the left side
9316   for (Int_t jp = 0; jp < kNumberOfRearUpHookPts; jp++) {
9317     xprof[11+jp] = -xprof[9-jp];
9318     yprof[11+jp] =  yprof[9-jp];
9319   }
9320
9321   // Now the actual Xtru
9322   rearUpHookMainBody->DefinePolygon(2*kNumberOfRearUpHookPts+1, xprof, yprof);
9323   rearUpHookMainBody->DefineSection(0, 0);
9324   rearUpHookMainBody->DefineSection(1, kRearUpHookThick);
9325
9326   // The hole
9327   TGeoXtru *rearUpHookHole = new TGeoXtru(2);
9328   rearUpHookHole->SetName("ITSrearUpHookHole");
9329
9330   xprof[0] = kRearUpHookHoleBase/2;
9331   yprof[0] = rearUpHookMainBody->GetY(0) + kRearUpHookHoleY;
9332   xprof[1] = kRearUpHookHoleWide/2;
9333   yprof[1] = yprof[0] + (xprof[1] - xprof[0]); // Go at 45deg
9334   xprof[2] = xprof[1];
9335   yprof[2] = yprof[0] + kRearUpHookHoleHi - kRearUpHookHoleR5;
9336   xprof[3] = xprof[2] - kRearUpHookHoleR5*(1 - CosD(45));
9337   yprof[3] = yprof[2] + kRearUpHookHoleR5*SinD(45);
9338   xprof[4] = xprof[2] - kRearUpHookHoleR5;
9339   yprof[4] = yprof[0] + kRearUpHookHoleHi;
9340
9341   // We did the right side, now reflex on the left side
9342   for (Int_t jp = 0; jp < kNumbOfRearUpHookHolePts; jp++) {
9343     xprof[5+jp] = -xprof[4-jp];
9344     yprof[5+jp] =  yprof[4-jp];
9345   }
9346
9347   // Now the actual Xtru
9348   rearUpHookHole->DefinePolygon(2*kNumbOfRearUpHookHolePts, xprof, yprof);
9349   rearUpHookHole->DefineSection(0, -0.1);
9350   rearUpHookHole->DefineSection(1, kRearUpHookThick+0.1);
9351
9352   // Finally the actual shape: a CompositeShape
9353   TGeoCompositeShape *rearUpHookShape = new TGeoCompositeShape("ITSrearUpHookMainBody-ITSrearUpHookHole");
9354
9355   // The Rear Lower Hook (0872/C/11): a Xtru
9356   TGeoXtru *rearLwHookShape = new TGeoXtru(2);
9357   rearLwHookShape->SetName("ITSrearLwHookShape");
9358
9359   xprof[0] = kRearLwHookWide/2;
9360   yprof[0] = kRearLwHookRext - kRearLwHookHiTot;
9361   xprof[1] = xprof[0];
9362   alpha = TMath::ASin(0.5*kRearLwHookWide/kRearLwHookRext);
9363   yprof[1] = kRearLwHookRext*TMath::Cos(alpha);
9364   xprof[2] = kRearLwHookRext*TMath::Sin(alpha/2);
9365   yprof[2] = kRearLwHookRext*TMath::Cos(alpha/2);
9366   xprof[3] = 0;
9367   yprof[3] = kRearLwHookRext;
9368
9369   // We did the right side, now reflex on the left side
9370   for (Int_t jp = 0; jp < kNumberOfRearLwHookPts; jp++) {
9371     xprof[4+jp] = -xprof[2-jp];
9372     yprof[4+jp] =  yprof[2-jp];
9373   }
9374
9375   // Now the actual Xtru
9376   rearLwHookShape->DefinePolygon(2*kNumberOfRearLwHookPts+1, xprof, yprof);
9377   rearLwHookShape->DefineSection(0, 0);
9378   rearLwHookShape->DefineSection(1, kRearLwHookThick);
9379
9380   // The Rear Lower Bracket (0872/C/16): a Xtru
9381   TGeoXtru *rearLwBrackShape = new TGeoXtru(2);
9382   rearLwBrackShape->SetName("ITSrearLwBrackShape");
9383
9384   xprof[0] = 0;
9385   yprof[0] = 0;
9386   xprof[1] = xprof[0] + kRearLwBracketWide1 - kRearLwBracketWide2;
9387   yprof[1] = yprof[0];
9388   xprof[2] = xprof[1];
9389   yprof[2] = yprof[0] + kRearLwBracketHi2;
9390   xprof[3] = xprof[2] - kRearLwBracketWide1;
9391   yprof[3] = yprof[2];
9392   xprof[4] = xprof[3];
9393   yprof[4] = yprof[3] - kRearLwBracketHi1;
9394   xprof[5] = xprof[0];
9395   yprof[5] = yprof[4];
9396
9397   rearLwBrackShape->DefinePolygon(6, xprof, yprof);
9398   rearLwBrackShape->DefineSection(0,-kRearLwBracketThick/2);
9399   rearLwBrackShape->DefineSection(1, kRearLwBracketThick/2);
9400
9401   // The Forward S-shaped Stirrup for the webcam (0872/C/V/01): a Xtru
9402   TGeoXtru *forwWebSStirrSh = new TGeoXtru(2);
9403
9404   xprof[0] = 0;
9405   yprof[0] = 0;
9406   xprof[1] = xprof[0] + kForwWebSStirrLen1;
9407   yprof[1] = yprof[0];
9408   xprof[2] = xprof[1];
9409   yprof[2] = yprof[1] + kForwWebSStirrWide1;
9410   xprof[3] = xprof[0] - kForwWebSStirrLen2 + kForwWebSStirrLen3;
9411   yprof[3] = yprof[2];
9412   xprof[4] = xprof[3];
9413   yprof[4] = yprof[3] + kForwWebSStirrWide3;
9414   xprof[5] = xprof[4] - kForwWebSStirrLen3;
9415   yprof[5] = yprof[4];
9416   xprof[6] = xprof[5];
9417   yprof[6] = yprof[0] + kForwWebSStirrWide2;
9418   xprof[7] = xprof[0];
9419   yprof[7] = yprof[6];
9420
9421   forwWebSStirrSh->DefinePolygon(8, xprof, yprof);
9422   forwWebSStirrSh->DefineSection(0,-kForwWebSStirrDep/2);
9423   forwWebSStirrSh->DefineSection(1, kForwWebSStirrDep/2);
9424
9425   // The Forward T-shaped Stirrups for the webcam (0872/C/V/03-04): two Xtru
9426   TGeoXtru *forwWebTStirr3Sh = new TGeoXtru(2);
9427
9428   xprof[0] = -kForwWebTStirrWide2/2;
9429   yprof[0] = 0;
9430   xprof[1] = -kForwWebTStirrWide1/2;
9431   yprof[1] = yprof[0];
9432   xprof[2] = xprof[1];
9433   yprof[2] = yprof[1] - kForwWebTStirrLen1;
9434   xprof[3] =-xprof[2];
9435   yprof[3] = yprof[2];
9436   xprof[4] = xprof[3];
9437   yprof[4] = yprof[1];
9438   xprof[5] =-xprof[0];
9439   yprof[5] = yprof[4];
9440   xprof[6] = xprof[5];
9441   yprof[6] = kForwWebTStirrTotLen3 - kForwWebTStirrLen1;
9442   xprof[7] = xprof[0];
9443   yprof[7] = yprof[6];
9444
9445   forwWebTStirr3Sh->DefinePolygon(8, xprof, yprof);
9446   forwWebTStirr3Sh->DefineSection(0, 0);
9447   forwWebTStirr3Sh->DefineSection(1, kForwWebTStirrThick);
9448
9449   TGeoXtru *forwWebTStirr4Sh = new TGeoXtru(2);
9450
9451   yprof[6] = kForwWebTStirrTotLen4 - kForwWebTStirrLen1;
9452   yprof[7] = yprof[6];
9453
9454   forwWebTStirr4Sh->DefinePolygon(8, xprof, yprof);
9455   forwWebTStirr4Sh->DefineSection(0, 0);
9456   forwWebTStirr4Sh->DefineSection(1, kForwWebTStirrThick);
9457
9458   // The Forward and Rear clamp for the webcam (0872/C/V/02): a Xtru
9459   TGeoXtru *frWebClampSh = new TGeoXtru(2);
9460
9461   xprof[0] = kFRWebClampIntWide/2;
9462   yprof[0] = kFRWebClampIntHi;
9463   xprof[1] = xprof[0];
9464   yprof[1] = 0;
9465   xprof[2] = kFRWebClampExtWide/2;
9466   yprof[2] = yprof[1];
9467   xprof[3] = xprof[2];
9468   yprof[3] = kFRWebClampExtHi;
9469   for (Int_t jp = 0; jp < 4; jp++) {
9470     xprof[4+jp] = -xprof[3-jp];
9471     yprof[4+jp] =  yprof[3-jp];
9472   }
9473
9474   frWebClampSh->DefinePolygon(8, xprof, yprof);
9475   frWebClampSh->DefineSection(0,-kFRWebClampThick/2);
9476   frWebClampSh->DefineSection(1, kFRWebClampThick/2);
9477
9478   // The Rear Upper Stirrup for the webcam (0872/C/V/05): a Xtru
9479   TGeoXtru *upWebStirrSh = new TGeoXtru(2);
9480
9481   xprof[0] = 0;
9482   yprof[0] = 0;
9483   xprof[1] = xprof[0] - (kRearUpWebStirrWide - 2*kRearUpWebStirrThick);
9484   yprof[1] = yprof[0];
9485   xprof[2] = xprof[1];
9486   yprof[2] = yprof[1] + (kRearUpWebStirrH1 - kRearUpWebStirrThick);
9487   xprof[3] = xprof[2] - kRearUpWebStirrThick;
9488   yprof[3] = yprof[2];
9489   xprof[4] = xprof[3];
9490   yprof[4] = yprof[3] - kRearUpWebStirrH1;
9491   xprof[5] = xprof[4] + kRearUpWebStirrWide;
9492   yprof[5] = yprof[4];
9493   xprof[6] = xprof[5];
9494   yprof[6] = yprof[5] + kRearUpWebStirrH2;
9495   xprof[7] = xprof[0];
9496   yprof[7] = yprof[6];
9497
9498   upWebStirrSh->DefinePolygon(8, xprof, yprof);
9499   upWebStirrSh->DefineSection(0,-kRearUpWebStirrDep/2);
9500   upWebStirrSh->DefineSection(1, kRearUpWebStirrDep/2);
9501
9502   // The Rear Upper Bar for the webcam (0872/C/V/06): a BBox
9503   TGeoBBox *upRearWebBarSh = new TGeoBBox(kRearUpWebBarLen/2,
9504                                           kRearUpWebBarHi/2,
9505                                           kRearUpWebBarThick/2);
9506
9507   // The Webcam: a BBox
9508   TGeoBBox *webcamShape = new TGeoBBox(kFRWebClampIntWide/2,
9509                                        kWebcamLength/2,
9510                                        kFRWebClampIntHi/2);
9511
9512   // The Upper Wheel Slide (0872/C/Z/00-01-02)
9513   // A mother volume of air (to avoid assembly) contains the Alluminum block
9514   // (a Composite Shape: a Xtru and a Pcon for the hole) and the Steel pin
9515   // (a Pcon) (The wheels are approximated as part of the block itself)
9516   // The Air mother volume
9517   TGeoXtru *upSlideAirSh = new TGeoXtru(2);
9518   upSlideAirSh->SetName("ITSupperSlideAirShape");
9519
9520   xprof[0] = 0;
9521   yprof[0] = 0;
9522   xprof[1] = xprof[0];
9523   yprof[1] = kUpperSlideBlockHi + kUpperSlideStubHi - kUpperSlideWheelHi;
9524   xprof[2] = xprof[1] - kUpperSlideIntDepth;
9525   yprof[2] = yprof[1];
9526   xprof[3] = xprof[2];
9527   yprof[3] = yprof[2] - kUpperSlideTotHeight;
9528   xprof[4] = xprof[3] + kUpperSlideTotDepth;
9529   yprof[4] = yprof[3];
9530   xprof[5] = xprof[4];
9531   yprof[5] = yprof[0];
9532
9533   upSlideAirSh->DefinePolygon(6, xprof, yprof);
9534   upSlideAirSh->DefineSection(0,-kUpperSlideWidth/2);
9535   upSlideAirSh->DefineSection(1, kUpperSlideWidth/2);
9536
9537   // The (filled) Aluminum block: a Xtru
9538   TGeoXtru *upSlideAluSh = new TGeoXtru(2);
9539   upSlideAluSh->SetName("ITSupperSlideAluShape");
9540
9541   xprof[0] = upSlideAirSh->GetX(0);
9542   yprof[0] = upSlideAirSh->GetY(0);
9543   xprof[1] = upSlideAirSh->GetX(1);
9544   yprof[1] = upSlideAirSh->GetY(1);
9545   xprof[2] = xprof[1] - kUpperSlideStubDep;
9546   yprof[2] = yprof[1];
9547   xprof[3] = xprof[2];
9548   yprof[3] = yprof[2] - kUpperSlideStubHi;
9549   xprof[4] = upSlideAirSh->GetX(2);
9550   yprof[4] = yprof[3];
9551   xprof[5] = xprof[4];
9552   yprof[5] = yprof[4] - kUpperSlideBlockHi;
9553   xprof[6] = upSlideAirSh->GetX(5);
9554   yprof[6] = yprof[5];
9555   xprof[7] = xprof[6];
9556   yprof[7] = yprof[0];
9557
9558   upSlideAluSh->DefinePolygon(8, xprof, yprof);
9559   upSlideAluSh->DefineSection(0, upSlideAirSh->GetZ(0));
9560   upSlideAluSh->DefineSection(1, upSlideAirSh->GetZ(1));
9561
9562   // The cylindrical hole in the block; a Pcon
9563   TGeoPcon *upSlideHoleSh = new TGeoPcon(0, 360, 10);
9564   upSlideHoleSh->SetName("ITSupperSlideHoleShape");
9565
9566   zpos = upSlideAluSh->GetY(5);
9567   upSlideHoleSh->DefineSection(0, zpos-0.1, 0, kUpperSlideHoleRout);
9568   zpos += (kUpperSlideBlockHi - kUpperSlideHoleH3 - kUpperSlideHoleH2
9569         - 2*kUpperSlideHoleH1);
9570   upSlideHoleSh->DefineSection(1, zpos, 0, kUpperSlideHoleRout);
9571   upSlideHoleSh->DefineSection(2, zpos, 0, kUpperSlideHoleRint2);
9572   zpos += kUpperSlideHoleH3;
9573   upSlideHoleSh->DefineSection(3, zpos, 0, kUpperSlideHoleRint2);
9574   upSlideHoleSh->DefineSection(4, zpos, 0, kUpperSlideHoleRout);
9575   zpos += kUpperSlideHoleH1;
9576   upSlideHoleSh->DefineSection(5, zpos, 0, kUpperSlideHoleRout);
9577   upSlideHoleSh->DefineSection(6, zpos, 0, kUpperSlideHoleRint1);
9578   zpos += kUpperSlideHoleH2;
9579   upSlideHoleSh->DefineSection(7, zpos, 0, kUpperSlideHoleRint1);
9580   upSlideHoleSh->DefineSection(8, zpos, 0, kUpperSlideHoleRout);
9581   zpos += kUpperSlideHoleH1;
9582   upSlideHoleSh->DefineSection(9, zpos+0.1, 0, kUpperSlideHoleRout);
9583
9584   TGeoCombiTrans *upSlideHolePos = new TGeoCombiTrans(-kUpperSlideHoleXPos,0,0,
9585                                    new TGeoRotation("",0,-90,0) );
9586   upSlideHolePos->SetName("ITSupperSlideHolePos");
9587   upSlideHolePos->RegisterYourself();
9588
9589   // The actual block: a CompositeShape
9590   TGeoCompositeShape *upSlideBlockSh = new TGeoCompositeShape("ITSupperSlideAluShape-ITSupperSlideHoleShape:ITSupperSlideHolePos");
9591
9592   // The Steel pin in the block; a Pcon
9593   TGeoPcon *upSlidePinSh = new TGeoPcon(0, 360, 6);
9594   upSlidePinSh->SetName("ITSupperSlidePinShape");
9595
9596   zpos = upSlideAluSh->GetY(5) - (kUpperSlidePinH1 + kUpperSlidePinH2
9597        + kUpperSlidePinH3 - kUpperSlideBlockHi);
9598   upSlidePinSh->DefineSection(0, zpos, 0, kUpperSlidePinRmin);
9599   zpos += kUpperSlidePinH3;
9600   upSlidePinSh->DefineSection(1, zpos, 0, kUpperSlidePinRmin);
9601   upSlidePinSh->DefineSection(2, zpos, 0, kUpperSlidePinRmax);
9602   zpos += kUpperSlidePinH2;
9603   upSlidePinSh->DefineSection(3, zpos, 0, kUpperSlidePinRmax);
9604   upSlidePinSh->DefineSection(4, zpos, 0, kUpperSlidePinRmin);
9605   zpos += kUpperSlidePinH1;
9606   upSlidePinSh->DefineSection(5, zpos, 0, kUpperSlidePinRmin);
9607
9608   // The Lower Wheel Slide (0872/C/W/00-01-02-03)
9609   // A mother volume of air (to avoid assembly) contains the Alluminum block
9610   // (a Composite Shape: a Xtru and a Pcon for the hole), the Alluminum nose
9611   // (a Xtru) and the Steel pin (a Pcon)
9612   // (The wheels are approximated as part of the block itself)
9613   // The Air mother volume
9614   TGeoXtru *lwSlideAirSh = new TGeoXtru(2);
9615   lwSlideAirSh->SetName("ITSlowerSlideAirShape");
9616
9617   xprof[0] = 0;
9618   yprof[0] = 0;
9619   xprof[1] = xprof[0] + kLowerSlideTotDepth/2 - kLowerSlideNoseBase/2;
9620   yprof[1] = yprof[0];
9621   xprof[2] = xprof[1];
9622   yprof[2] = yprof[1] - (kLowerSlideBlockHi + kLowerSlidePinH2);
9623   xprof[3] = xprof[2] - kLowerSlideTotDepth;
9624   yprof[3] = yprof[2];
9625   xprof[4] = xprof[3];
9626   yprof[4] = yprof[3] + kLowerSlidePinH2 + kLowerSlideTotHeight;
9627   xprof[5] = xprof[0];
9628   yprof[5] = yprof[4];
9629
9630   lwSlideAirSh->DefinePolygon(6, xprof, yprof);
9631   lwSlideAirSh->DefineSection(0,-kLowerSlideWidth/2);
9632   lwSlideAirSh->DefineSection(1, kLowerSlideWidth/2);
9633
9634   // The (filled) Aluminum block: a Xtru
9635   TGeoXtru *lwSlideAluSh = new TGeoXtru(2);
9636   lwSlideAluSh->SetName("ITSlowerSlideAluShape");
9637
9638   xprof[0] = lwSlideAirSh->GetX(0);
9639   yprof[0] = lwSlideAirSh->GetY(0);
9640   xprof[1] = lwSlideAirSh->GetX(1);
9641   yprof[1] = lwSlideAirSh->GetY(1);
9642   xprof[2] = xprof[1];
9643   yprof[2] = yprof[1] - kLowerSlideBlockHi;
9644   xprof[3] = lwSlideAirSh->GetX(3);
9645   yprof[3] = yprof[2];
9646   xprof[4] = xprof[3];
9647   yprof[4] = yprof[3] + kLowerSlideBlockHi;
9648   xprof[5] = xprof[4] + kLowerSlideTotDepth/2;
9649   yprof[5] = yprof[4];
9650   xprof[6] = xprof[5];
9651   yprof[6] = lwSlideAirSh->GetY(4);
9652   xprof[7] = xprof[0];
9653   yprof[7] = yprof[6];
9654
9655   lwSlideAluSh->DefinePolygon(8, xprof, yprof);
9656   lwSlideAluSh->DefineSection(0, lwSlideAirSh->GetZ(0));
9657   lwSlideAluSh->DefineSection(1, lwSlideAirSh->GetZ(1));
9658
9659   // The cylindrical hole in the block; a Pcon
9660   TGeoPcon *lwSlideHoleSh = new TGeoPcon(0, 360, 4);
9661   lwSlideHoleSh->SetName("ITSlowerSlideHoleShape");
9662
9663   zpos = lwSlideAluSh->GetY(2);
9664   lwSlideHoleSh->DefineSection(0, zpos-0.1, 0, kLowerSlideHoleRout);
9665   zpos += kLowerSlideHoleH1;
9666   lwSlideHoleSh->DefineSection(1, zpos, 0, kLowerSlideHoleRout);
9667   lwSlideHoleSh->DefineSection(2, zpos, 0, kLowerSlideHoleRint);
9668   zpos = lwSlideAluSh->GetY(4);
9669   lwSlideHoleSh->DefineSection(3, zpos, 0, kLowerSlideHoleRint);
9670
9671   TGeoCombiTrans *lwSlideHolePos = new TGeoCombiTrans(lwSlideAluSh->GetX(5),
9672                                                       0, 0,
9673                                    new TGeoRotation("",0,-90,0) );
9674   lwSlideHolePos->SetName("ITSlowerSlideHolePos");
9675   lwSlideHolePos->RegisterYourself();
9676
9677   // The actual block: a CompositeShape
9678   TGeoCompositeShape *lwSlideBlockSh = new TGeoCompositeShape("ITSlowerSlideAluShape-ITSlowerSlideHoleShape:ITSlowerSlideHolePos");
9679
9680   // The Aluminum nose: a Xtru
9681   TGeoXtru *lwSlideNoseSh = new TGeoXtru(2);
9682   lwSlideNoseSh->SetName("ITSlowerSlideNoseShape");
9683
9684   xprof[0] = lwSlideAluSh->GetX(5);
9685   yprof[0] = lwSlideAluSh->GetY(5);
9686   xprof[1] = xprof[0] - kLowerSlideNoseBase/2;
9687   yprof[1] = yprof[0];
9688   xprof[2] = xprof[1];
9689   yprof[2] = yprof[1] + kLowerSlideNoseBasHi;
9690   xprof[3] = lwSlideAluSh->GetX(0) - kLowerSlideNoseUpWid;
9691   yprof[3] = lwSlideAluSh->GetY(6);
9692   xprof[4] = xprof[0];
9693   yprof[4] = yprof[3];
9694
9695   lwSlideNoseSh->DefinePolygon(5, xprof, yprof);
9696   lwSlideNoseSh->DefineSection(0,-kLowerSlideNoseDepth/2);
9697   lwSlideNoseSh->DefineSection(1, kLowerSlideNoseDepth/2);
9698
9699   // The Steel pin in the block; a Pcon
9700   TGeoPcon *lwSlidePinSh = new TGeoPcon(0, 360, 4);
9701   lwSlidePinSh->SetName("ITSlowerSlidePinShape");
9702
9703   zpos = lwSlideAirSh->GetY(2);
9704   lwSlidePinSh->DefineSection(0, zpos, 0, kLowerSlidePinRmax);
9705   zpos += kLowerSlidePinH2;
9706   lwSlidePinSh->DefineSection(1, zpos, 0, kLowerSlidePinRmax);
9707   lwSlidePinSh->DefineSection(2, zpos, 0, kLowerSlidePinRmin);
9708   zpos += kLowerSlidePinH1;
9709   lwSlidePinSh->DefineSection(3, zpos, 0, kLowerSlidePinRmin);
9710
9711   // The Stirrup on the Muon side (0872/C/01-02): a really complex Xtru
9712   // to approximate arcs with polylines
9713   TGeoXtru *stirrupC1C2Sh = new TGeoXtru(2);
9714
9715   for (Int_t j=0; j<11; j++) { // The internal arc
9716     xprof[j] = kStirrC12R50*(1 - CosD(90*j/10));
9717     yprof[j] = kStirrC12R50*SinD(90*j/10);
9718   }
9719
9720   xprof[11] = xprof[10] + kStirrC12TailLen;
9721   yprof[11] = yprof[10];
9722   xprof[12] = xprof[11];
9723   yprof[12] = kStirrC12BodyHalfHi;
9724   xprof[13] = xprof[12] - kStirrC12BodyLen;
9725   yprof[13] = yprof[12];
9726
9727   xprof[17] = xprof[12] - kStirrC12TotLen + kStirrC12HeadLen;
9728   yprof[17] = kStirrC12HeadHalfHi;
9729   IntersectCircle(-TanD(kStirrC12HeadAng), xprof[17], yprof[17],
9730                   kStirrC12R100, xprof[13], yprof[13]+kStirrC12R100,
9731                   xprof[16], yprof[16], xdummy, ydummy);
9732   alpha = TMath::ASin((xprof[13]-xprof[16])/kStirrC12R100);
9733   xprof[14] = xprof[13] - kStirrC12R100*TMath::Sin(alpha/3);
9734   yprof[14] = yprof[13] + kStirrC12R100*(1 - TMath::Cos(alpha/3));
9735   xprof[15] = xprof[13] - kStirrC12R100*TMath::Sin(2*alpha/3);
9736   yprof[15] = yprof[13] + kStirrC12R100*(1 - TMath::Cos(2*alpha/3));
9737
9738   xprof[18] = xprof[17] - kStirrC12HeadLen;
9739   yprof[18] = yprof[17];
9740   xprof[19] = xprof[18];
9741   yprof[19] = kStirrC12HeadIntHi;
9742   xprof[20] = xprof[19] + kStirrC12HeadIntLen - kStirrC12R10;
9743   yprof[20] = yprof[19];
9744   for (Int_t j=1; j<4; j++) {
9745     xprof[20+j] = xprof[20] + kStirrC12R10*SinD(90*j/3);
9746     yprof[20+j] = yprof[20] - kStirrC12R10*(1 - CosD(90*j/3));
9747   }
9748
9749   // We did the up side, now reflex on the bottom side
9750   for (Int_t jp = 0; jp < kNumberOfStirrCPoints; jp++) {
9751     xprof[24+jp] =  xprof[23-jp];
9752     yprof[24+jp] = -yprof[23-jp];
9753   }
9754
9755   // Now the actual Xtru
9756   stirrupC1C2Sh->DefinePolygon(2*kNumberOfStirrCPoints+1, xprof, yprof);
9757   stirrupC1C2Sh->DefineSection(0,-kStirrC12Thick/2);
9758   stirrupC1C2Sh->DefineSection(1, kStirrC12Thick/2);
9759
9760   // The first element of the Stirrup on the Forward side (0872/C/05):
9761   // a really complex Xtru (equal to part of the Muon Stirrup)
9762   // (0872/C/06 and 0872/C/07 are dismounted after positioning the TPC to I.P.)
9763   TGeoXtru *stirrupC5Sh = new TGeoXtru(2);
9764
9765   for (Int_t j=0; j<13; j++) { // The internal arc and the tail
9766     xprof[j] = stirrupC1C2Sh->GetX(j);
9767     yprof[j] = stirrupC1C2Sh->GetY(j);
9768   }
9769
9770   xprof[13] = xprof[12] - kStirrC5BodyLen;
9771   yprof[13] = yprof[12];
9772
9773   // We did the up side, now reflex on the bottom side
9774   for (Int_t jp = 0; jp < 13; jp++) {
9775     xprof[14+jp] =  xprof[13-jp];
9776     yprof[14+jp] = -yprof[13-jp];
9777   }
9778
9779   // Now the actual Xtru
9780   stirrupC5Sh->DefinePolygon(27, xprof, yprof);
9781   stirrupC5Sh->DefineSection(0,-kStirrC12Thick/2);
9782   stirrupC5Sh->DefineSection(1, kStirrC12Thick/2);
9783
9784
9785   // We have all shapes: now create the real volumes
9786   TGeoMedium *medAlcoa   = mgr->GetMedium("ITS_ALUMINUM$"); // To code!!!!!!
9787   TGeoMedium *medHokotol = mgr->GetMedium("ITS_HOKOTOL$");
9788   TGeoMedium *medAnticor = mgr->GetMedium("ITS_ANTICORODAL$");
9789   TGeoMedium *medErgal   = mgr->GetMedium("ITS_ERGAL$");
9790   TGeoMedium *medAisi    = mgr->GetMedium("ITS_AISI304L$");
9791   TGeoMedium *medAir     = mgr->GetMedium("ITS_AIR$");
9792   TGeoMedium *medPlexy   = mgr->GetMedium("ITS_PLEXYGLAS$");
9793   TGeoMedium *medPVC     = mgr->GetMedium("ITS_PVC$");
9794
9795
9796   TGeoVolume *suppRingC2C3  = new TGeoVolume("ITSTPCsupportRingC2C3",
9797                                              ringC2C3, medAlcoa);
9798
9799   suppRingC2C3->SetVisibility(kTRUE);
9800   suppRingC2C3->SetLineColor(6); // Purple
9801   suppRingC2C3->SetLineWidth(1);
9802   suppRingC2C3->SetFillColor(suppRingC2C3->GetLineColor());
9803   suppRingC2C3->SetFillStyle(4000); // 0% transparent
9804
9805   TGeoVolume *forwUpHook  = new TGeoVolume("ITSTPCsupportForwUpHook",
9806                                            forwUpHookShape, medHokotol);
9807
9808   forwUpHook->SetVisibility(kTRUE);
9809   forwUpHook->SetLineColor(6); // Purple
9810   forwUpHook->SetLineWidth(1);
9811   forwUpHook->SetFillColor(forwUpHook->GetLineColor());
9812   forwUpHook->SetFillStyle(4000); // 0% transparent
9813
9814   TGeoVolume *forwLwHook  = new TGeoVolume("ITSTPCsupportForwLwHook",
9815                                            forwLwHookShape, medHokotol);
9816
9817   forwLwHook->SetVisibility(kTRUE);
9818   forwLwHook->SetLineColor(6); // Purple
9819   forwLwHook->SetLineWidth(1);
9820   forwLwHook->SetFillColor(forwLwHook->GetLineColor());
9821   forwLwHook->SetFillStyle(4000); // 0% transparent
9822
9823   TGeoVolume *rearUpHook  = new TGeoVolume("ITSTPCsupportRearUpHook",
9824                                            rearUpHookShape, medHokotol);
9825
9826   rearUpHook->SetVisibility(kTRUE);
9827   rearUpHook->SetLineColor(6); // Purple
9828   rearUpHook->SetLineWidth(1);
9829   rearUpHook->SetFillColor(rearUpHook->GetLineColor());
9830   rearUpHook->SetFillStyle(4000); // 0% transparent
9831
9832   TGeoVolume *rearLwHook  = new TGeoVolume("ITSTPCsupportRearLwHook",
9833                                            rearLwHookShape, medAnticor);
9834
9835   rearLwHook->SetVisibility(kTRUE);
9836   rearLwHook->SetLineColor(6); // Purple
9837   rearLwHook->SetLineWidth(1);
9838   rearLwHook->SetFillColor(rearLwHook->GetLineColor());
9839   rearLwHook->SetFillStyle(4000); // 0% transparent
9840
9841   TGeoVolume *rearLwBrack  = new TGeoVolume("ITSTPCsupportRearLwBracket",
9842                                             rearLwBrackShape, medAnticor);
9843
9844   rearLwBrack->SetVisibility(kTRUE);
9845   rearLwBrack->SetLineColor(6); // Purple
9846   rearLwBrack->SetLineWidth(1);
9847   rearLwBrack->SetFillColor(rearLwBrack->GetLineColor());
9848   rearLwBrack->SetFillStyle(4000); // 0% transparent
9849
9850   TGeoVolume *forwWebSStirrup  = new TGeoVolume("ITSTPCsupportForwWebSStirrup",
9851                                                 forwWebSStirrSh, medAnticor);
9852
9853   forwWebSStirrup->SetVisibility(kTRUE);
9854   forwWebSStirrup->SetLineColor(6); // Purple
9855   forwWebSStirrup->SetLineWidth(1);
9856   forwWebSStirrup->SetFillColor(forwWebSStirrup->GetLineColor());
9857   forwWebSStirrup->SetFillStyle(4000); // 0% transparent
9858
9859   TGeoVolume *forwWebTStirr3  = new TGeoVolume("ITSTPCsupportForwWebTStirrup3",
9860                                                forwWebTStirr3Sh, medAnticor);
9861
9862   forwWebTStirr3->SetVisibility(kTRUE);
9863   forwWebTStirr3->SetLineColor(6); // Purple
9864   forwWebTStirr3->SetLineWidth(1);
9865   forwWebTStirr3->SetFillColor(forwWebTStirr3->GetLineColor());
9866   forwWebTStirr3->SetFillStyle(4000); // 0% transparent
9867
9868   TGeoVolume *forwWebTStirr4  = new TGeoVolume("ITSTPCsupportForwWebTStirrup4",
9869                                                forwWebTStirr4Sh, medAnticor);
9870
9871   forwWebTStirr4->SetVisibility(kTRUE);
9872   forwWebTStirr4->SetLineColor(6); // Purple
9873   forwWebTStirr4->SetLineWidth(1);
9874   forwWebTStirr4->SetFillColor(forwWebTStirr4->GetLineColor());
9875   forwWebTStirr4->SetFillStyle(4000); // 0% transparent
9876
9877   TGeoVolume *frWebClamp  = new TGeoVolume("ITSTPCsupportForwRearWebClamp",
9878                                            frWebClampSh, medPlexy);
9879
9880   frWebClamp->SetVisibility(kTRUE);
9881   frWebClamp->SetLineColor(kAzure);
9882   frWebClamp->SetLineWidth(1);
9883   frWebClamp->SetFillColor(frWebClamp->GetLineColor());
9884   frWebClamp->SetFillStyle(4000); // 0% transparent
9885
9886   TGeoVolume *upWebStirrup  = new TGeoVolume("ITSTPCsupportUpperWebStirrup",
9887                                              upWebStirrSh, medAnticor);
9888
9889   upWebStirrup->SetVisibility(kTRUE);
9890   upWebStirrup->SetLineColor(6); // Purple
9891   upWebStirrup->SetLineWidth(1);
9892   upWebStirrup->SetFillColor(upWebStirrup->GetLineColor());
9893   upWebStirrup->SetFillStyle(4000); // 0% transparent
9894
9895   TGeoVolume *upRearWebBar  = new TGeoVolume("ITSTPCsupportUpperRearWebBar",
9896                                              upRearWebBarSh, medPlexy);
9897
9898   upRearWebBar->SetVisibility(kTRUE);
9899   upRearWebBar->SetLineColor(kAzure);
9900   upRearWebBar->SetLineWidth(1);
9901   upRearWebBar->SetFillColor(upRearWebBar->GetLineColor());
9902   upRearWebBar->SetFillStyle(4000); // 0% transparent
9903
9904   TGeoVolume *webCam  = new TGeoVolume("ITSTPCsupportWebcam",
9905                                        webcamShape, medPVC);
9906
9907   webCam->SetVisibility(kTRUE);
9908   webCam->SetLineColor(kBlack);
9909   webCam->SetLineWidth(1);
9910   webCam->SetFillColor(webCam->GetLineColor());
9911   webCam->SetFillStyle(4000); // 0% transparent
9912
9913   TGeoVolume *upSlideVol  = new TGeoVolume("ITSTPCsupportUpperSlide",
9914                                            upSlideAirSh, medAir);
9915
9916   upSlideVol->SetVisibility(kFALSE);
9917
9918   TGeoVolume *upSlideBlock  = new TGeoVolume("ITSTPCsupportUpperSlideBlock",
9919                                              upSlideBlockSh, medAnticor);
9920
9921   upSlideBlock->SetVisibility(kTRUE);
9922   upSlideBlock->SetLineColor(6); // Purple
9923   upSlideBlock->SetLineWidth(1);
9924   upSlideBlock->SetFillColor(upSlideBlock->GetLineColor());
9925   upSlideBlock->SetFillStyle(4000); // 0% transparent
9926
9927   TGeoVolume *upSlidePin  = new TGeoVolume("ITSTPCsupportUpperSlidePin",
9928                                            upSlidePinSh, medAisi);
9929
9930   upSlidePin->SetVisibility(kTRUE);
9931   upSlidePin->SetLineColor(kGray);
9932   upSlidePin->SetLineWidth(1);
9933   upSlidePin->SetFillColor(upSlidePin->GetLineColor());
9934   upSlidePin->SetFillStyle(4000); // 0% transparent
9935
9936   TGeoVolume *lwSlideVol  = new TGeoVolume("ITSTPCsupportLowerSlide",
9937                                            lwSlideAirSh, medAir);
9938
9939   lwSlideVol->SetVisibility(kFALSE);
9940
9941   TGeoVolume *lwSlideBlock  = new TGeoVolume("ITSTPCsupportLowerSlideBlock",
9942                                              lwSlideBlockSh, medAnticor);
9943
9944   lwSlideBlock->SetVisibility(kTRUE);
9945   lwSlideBlock->SetLineColor(6); // Purple
9946   lwSlideBlock->SetLineWidth(1);
9947   lwSlideBlock->SetFillColor(lwSlideBlock->GetLineColor());
9948   lwSlideBlock->SetFillStyle(4000); // 0% transparent
9949
9950   TGeoVolume *lwSlideNose  = new TGeoVolume("ITSTPCsupportLowerSlideNose",
9951                                             lwSlideNoseSh, medAnticor);
9952
9953   lwSlideNose->SetVisibility(kTRUE);
9954   lwSlideNose->SetLineColor(6); // Purple
9955   lwSlideNose->SetLineWidth(1);
9956   lwSlideNose->SetFillColor(lwSlideNose->GetLineColor());
9957   lwSlideNose->SetFillStyle(4000); // 0% transparent
9958
9959   TGeoVolume *lwSlidePin  = new TGeoVolume("ITSTPCsupportLowerSlidePin",
9960                                            lwSlidePinSh, medAisi);
9961
9962   lwSlidePin->SetVisibility(kTRUE);
9963   lwSlidePin->SetLineColor(kGray);
9964   lwSlidePin->SetLineWidth(1);
9965   lwSlidePin->SetFillColor(lwSlidePin->GetLineColor());
9966   lwSlidePin->SetFillStyle(4000); // 0% transparent
9967
9968   TGeoVolume *stirrC1C2  = new TGeoVolume("ITSTPCsupportStirrupC1C2",
9969                                           stirrupC1C2Sh, medErgal);
9970
9971   stirrC1C2->SetVisibility(kTRUE);
9972   stirrC1C2->SetLineColor(6); // Purple
9973   stirrC1C2->SetLineWidth(1);
9974   stirrC1C2->SetFillColor(stirrC1C2->GetLineColor());
9975   stirrC1C2->SetFillStyle(4000); // 0% transparent
9976
9977   TGeoVolume *stirrC5  = new TGeoVolume("ITSTPCsupportStirrupC5",
9978                                         stirrupC5Sh, medErgal);
9979
9980   stirrC5->SetVisibility(kTRUE);
9981   stirrC5->SetLineColor(6); // Purple
9982   stirrC5->SetLineWidth(1);
9983   stirrC5->SetFillColor(stirrC5->GetLineColor());
9984   stirrC5->SetFillStyle(4000); // 0% transparent
9985
9986
9987   // Build up the wheel slides
9988   upSlideVol->AddNode(upSlideBlock,1,0);
9989   upSlideVol->AddNode(upSlidePin,  1,
9990                       new TGeoCombiTrans(-kUpperSlideHoleXPos, 0, 0,
9991                                          new TGeoRotation("",0,-90,0) ) );
9992
9993   lwSlideVol->AddNode(lwSlideBlock,1,0);
9994   lwSlideVol->AddNode(lwSlideNose ,1,0);
9995   lwSlideVol->AddNode(lwSlidePin,  1,
9996                       new TGeoCombiTrans(lwSlideAluSh->GetX(5), 0, 0,
9997                                          new TGeoRotation("",0,-90,0) ) );
9998
9999
10000   // Finally put everything in the mother volume
10001   moth->AddNode(suppRingC2C3,1,
10002                 new TGeoTranslation(0, 0, kRingCZPos+kRingCZToTPC) );
10003   moth->AddNode(suppRingC2C3,2,
10004                 new TGeoCombiTrans( 0, 0,-kRingCZPos,
10005                                    new TGeoRotation("",0.,180.,0.) ) );
10006   moth->AddNode(suppRingC2C3,3,
10007                 new TGeoCombiTrans( 0, 0, kRingCZPos+kRingCZToTPC,
10008                                    new TGeoRotation("",0.,0.,180.) ) );
10009   moth->AddNode(suppRingC2C3,4,
10010                 new TGeoCombiTrans( 0, 0,-kRingCZPos,
10011                                    new TGeoRotation("",0.,180.,180.) ) );
10012
10013   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
10014   moth->AddNode(forwUpHook,1,
10015                 new TGeoTranslation( 0, 0, zpos) );
10016
10017   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
10018   moth->AddNode(forwLwHook,1,
10019                 new TGeoCombiTrans( 0, 0, zpos,
10020                                    new TGeoRotation("",0.,0.,180.) ) );
10021
10022   zpos = kRingCZPos + kRingCThick + kRearUpHookThick;
10023   moth->AddNode(rearUpHook,1,
10024                 new TGeoTranslation( 0, 0,-zpos) );
10025
10026   zpos = kRingCZPos + kRingCThick + kRearLwHookThick;
10027   moth->AddNode(rearLwHook,1,
10028                 new TGeoCombiTrans( 0, 0,-zpos,
10029                                    new TGeoRotation("",0.,0.,180.) ) );
10030
10031   xpos =  kRearLwHookWide/2 + kRearLwBracketThick/2;
10032   ypos = -kRingCHeight;
10033   moth->AddNode(rearLwBrack,1,
10034                 new TGeoCombiTrans( xpos, ypos,-zpos,
10035                                    new TGeoRotation("", 90.,-90.,-90.) ) );
10036   moth->AddNode(rearLwBrack,2,
10037                 new TGeoCombiTrans(-xpos, ypos,-zpos,
10038                                    new TGeoRotation("", 90.,-90.,-90.) ) );
10039
10040   xpos = kForwUpHookWide/2;
10041   ypos = (forwUpHookMainBody->GetY(8) + forwUpHookMainBody->GetY(9))/2;
10042   zpos = kRingCZPos + kRingCThick + kRingCZToTPC;
10043   moth->AddNode(forwWebSStirrup,1,
10044                 new TGeoCombiTrans( xpos, ypos, zpos,
10045                                    new TGeoRotation("", 0., 90., 0.) ) );
10046   xpos = kForwLwHookWide/2;
10047   ypos = (forwLwHookMainBody->GetY(8) + forwLwHookMainBody->GetY(9))/2;
10048   moth->AddNode(forwWebSStirrup,2,
10049                 new TGeoCombiTrans( xpos,-ypos, zpos,
10050                                    new TGeoRotation("", 0., 90., 0.) ) );
10051
10052   xpos = kForwUpHookWide/2
10053         + (forwWebSStirrSh->GetX(4) + forwWebSStirrSh->GetX(5))/2;
10054   ypos = (forwUpHookMainBody->GetY(8) + forwUpHookMainBody->GetY(9))/2
10055         +  forwWebSStirrSh->GetZ(1) - forwWebTStirr3Sh->GetY(7);
10056   zpos += (forwWebSStirrSh->GetY(4) - forwWebSStirrSh->GetY(0));
10057   moth->AddNode(forwWebTStirr3,1,
10058                 new TGeoTranslation( xpos, ypos, zpos) );
10059
10060   ypos -= frWebClampSh->GetZ(1);
10061   moth->AddNode(frWebClamp,1,
10062                 new TGeoCombiTrans( xpos, ypos, zpos+forwWebTStirr3Sh->GetZ(1),
10063                                    new TGeoRotation("", 0., 90., 0.) ) );
10064
10065   ypos -= webcamShape->GetDY()/2;
10066   moth->AddNode(webCam,1,
10067                 new TGeoTranslation( xpos, ypos,
10068                      zpos+forwWebTStirr3Sh->GetZ(1)+webcamShape->GetDZ()) );
10069
10070   xpos = kForwLwHookWide/2
10071         + (forwWebSStirrSh->GetX(4) + forwWebSStirrSh->GetX(5))/2;
10072   ypos = (forwLwHookMainBody->GetY(8) + forwLwHookMainBody->GetY(9))/2
10073         +  forwWebSStirrSh->GetZ(1) - forwWebTStirr4Sh->GetY(7);
10074   moth->AddNode(forwWebTStirr4,1,
10075                 new TGeoCombiTrans( xpos,-ypos, zpos,
10076                                    new TGeoRotation("", 180., 0., 0.) ) );
10077
10078   ypos -= frWebClampSh->GetZ(1);
10079   moth->AddNode(frWebClamp,2,
10080                 new TGeoCombiTrans( xpos,-ypos, zpos+forwWebTStirr4Sh->GetZ(1),
10081                                    new TGeoRotation("", 0., 90., 0.) ) );
10082
10083   ypos -= webcamShape->GetDY()/2;
10084   moth->AddNode(webCam,2,
10085                 new TGeoTranslation( xpos,-ypos,
10086                      zpos+forwWebTStirr4Sh->GetZ(1)+webcamShape->GetDZ()) );
10087
10088   xpos = kRearUpHookWide/2 + kRearUpWebStirrDep/2;
10089   ypos = kRingCHeight;
10090   zpos = kRingCZPos + kRingCThick;
10091   moth->AddNode(upWebStirrup,1,
10092                 new TGeoCombiTrans( xpos, ypos,-zpos,
10093                                    new TGeoRotation("",-90.,-90., 90.) ) );
10094   moth->AddNode(upWebStirrup,2,
10095                 new TGeoCombiTrans(-xpos, ypos,-zpos,
10096                                    new TGeoRotation("",-90.,-90., 90.) ) );
10097
10098   ypos = kRingCHeight + upWebStirrSh->GetY(2) - upRearWebBarSh->GetDY();
10099   zpos = kRingCZPos + kRingCThick + upWebStirrSh->GetX(3)
10100        - upRearWebBarSh->GetDZ();
10101   moth->AddNode(upRearWebBar,1,
10102                 new TGeoTranslation( 0, ypos,-zpos) );
10103
10104   zpos -= upRearWebBarSh->GetDZ();
10105   moth->AddNode(frWebClamp,3,
10106                 new TGeoCombiTrans( 0, ypos,-zpos,
10107                                    new TGeoRotation("", 0., 90., 0.) ) );
10108
10109   ypos -= webcamShape->GetDY()/2;
10110   zpos -= webcamShape->GetDZ();
10111   moth->AddNode(webCam,3,
10112                 new TGeoTranslation( 0, ypos,-zpos) );
10113
10114   xpos = ringC2C3->GetX(14) + kUpperSlideWidth/2;
10115   ypos = ringC2C3->GetY(14);
10116   zpos = kRingCZPos + kRingCThick;
10117   moth->AddNode(upSlideVol,1,
10118                 new TGeoCombiTrans( xpos, ypos, zpos + kRingCZToTPC,
10119                                    new TGeoRotation("",-90.,-90., 90.) ) );
10120   moth->AddNode(upSlideVol,2,
10121                 new TGeoCombiTrans(-xpos, ypos, zpos + kRingCZToTPC,
10122                                    new TGeoRotation("",-90.,-90., 90.) ) );
10123   moth->AddNode(upSlideVol,3,
10124                 new TGeoCombiTrans( xpos, ypos, -zpos,
10125                                    new TGeoRotation("", 90.,-90.,-90.) ) );
10126   moth->AddNode(upSlideVol,4,
10127                 new TGeoCombiTrans(-xpos, ypos, -zpos,
10128                                    new TGeoRotation("", 90.,-90.,-90.) ) );
10129
10130   moth->AddNode(lwSlideVol,1,
10131                 new TGeoCombiTrans( xpos,-ypos, zpos + kRingCZToTPC,
10132                                    new TGeoRotation("", 90.,-90., 90.) ) );
10133   moth->AddNode(lwSlideVol,2,
10134                 new TGeoCombiTrans(-xpos,-ypos, zpos + kRingCZToTPC,
10135                                    new TGeoRotation("", 90.,-90., 90.) ) );
10136   moth->AddNode(lwSlideVol,3,
10137                 new TGeoCombiTrans( xpos,-ypos,-zpos,
10138                                    new TGeoRotation("",-90.,-90.,-90.) ) );
10139   moth->AddNode(lwSlideVol,4,
10140                 new TGeoCombiTrans(-xpos,-ypos,-zpos,
10141                                    new TGeoRotation("",-90.,-90.,-90.) ) );
10142
10143   xpos = kStirrCXPos;
10144   zpos = kRingCZPos + kStirrCZPos + stirrupC1C2Sh->GetZ(1) + kRingCZToTPC;
10145   moth->AddNode(stirrC1C2,1,
10146                 new TGeoTranslation( xpos, 0, zpos) );
10147   moth->AddNode(stirrC1C2,2,
10148                 new TGeoCombiTrans(-xpos, 0, zpos,
10149                                    new TGeoRotation("", 90.,-180.,-90.) ) );
10150
10151   xpos = kStirrCXPos + stirrupC1C2Sh->GetX(18) + kUpperSlideWidth/2;
10152   ypos = ringC2C3->GetY(14); // Slides are all at the same height
10153   zpos = kRingCZPos + kStirrCZPos + kStirrC12Thick + kRingCZToTPC;
10154   moth->AddNode(upSlideVol,5,
10155                 new TGeoCombiTrans( xpos, ypos, zpos,
10156                                    new TGeoRotation("",-90.,-90., 90.) ) );
10157   moth->AddNode(upSlideVol,6,
10158                 new TGeoCombiTrans(-xpos, ypos, zpos,
10159                                    new TGeoRotation("",-90.,-90., 90.) ) );
10160   moth->AddNode(lwSlideVol,5,
10161                 new TGeoCombiTrans( xpos,-ypos, zpos,
10162                                    new TGeoRotation("", 90.,-90., 90.) ) );
10163   moth->AddNode(lwSlideVol,6,
10164                 new TGeoCombiTrans(-xpos,-ypos, zpos,
10165                                    new TGeoRotation("", 90.,-90., 90.) ) );
10166
10167   xpos = kStirrCXPos;
10168   zpos = kRingCZPos + kStirrCZPos + stirrupC5Sh->GetZ(1);
10169   moth->AddNode(stirrC5,1,
10170                 new TGeoTranslation( xpos, 0,-zpos) );
10171   moth->AddNode(stirrC5,2,
10172                 new TGeoCombiTrans(-xpos, 0,-zpos,
10173                                    new TGeoRotation("", 90.,-180.,-90.) ) );
10174
10175
10176   return;
10177 }
10178