]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11GeometrySupport.cxx
- AliITSInitGeometry.cxx (updated): fgkOldSSDcone changed from kTRUE to
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySupport.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // This class Defines the Geometry for the ITS services and support cones
17 // outside of the ceneteral volume (except for the Ceneteral support 
18 // cylinders. Other classes define the rest of the ITS. Specificaly the ITS
19 // The SSD support cone,SSD Support centeral cylinder, SDD support cone,
20 // The SDD cupport centeral cylinder, the SPD Thermal Sheald, The supports
21 // and cable trays on both the RB26 (muon dump) and RB24 sides, and all of
22 // the cabling from the ladders/stave ends out past the TPC. 
23
24 /* $Id$ */
25 // General Root includes
26 #include <TMath.h>
27 // Root Geometry includes
28 //#include <AliLog.h>
29 #include <TGeoManager.h>
30 #include <TGeoVolume.h>
31 #include <TGeoPcon.h>
32 #include <TGeoCone.h>
33 #include <TGeoTube.h> // contaings TGeoTubeSeg
34 #include <TGeoArb8.h>
35 #include <TGeoXtru.h>
36 #include <TGeoCompositeShape.h>
37 #include <TGeoMatrix.h>
38 #include "AliITSv11GeometrySupport.h"
39
40 ClassImp(AliITSv11GeometrySupport)
41
42 #define SQ(A) (A)*(A)
43
44 //______________________________________________________________________
45 void AliITSv11GeometrySupport::SPDCone(TGeoVolume *moth,TGeoManager *mgr)
46 {
47 //
48 // Creates the SPD thermal shield as a volume assembly
49 // and adds it to the mother volume
50 // (this is actually a merge of the previous SPDThermalSheald method
51 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06 and the
52 // CreateSPDThermalShield method of AliITSv11Hybrid)
53 //
54 // Input:
55 //         moth : the TGeoVolume owing the volume structure
56 //         mgr  : the GeoManager (default gGeoManager)
57 // Output:
58 //
59 // Created:         ???          ???
60 // Updated:      11 Dec 2007  Mario Sitta
61 //
62 // Technical data are taken from:  ALICE-Thermal Screen "Cone transition"
63 // (thermal-screen1_a3.ps), "Cylinder" (thermal-screen2_a3.ps), "Half
64 // assembly" (thermal-screen3_a3.ps), "Flange" (thermal-screen4_a3.ps)
65
66
67   // Dimensions of the Central shield
68   const Double_t kHalfLengthCentral  = 400.*fgkmm;
69   const Double_t kThicknessCentral   = 0.4*fgkmm;
70   const Double_t kInnerRadiusCentral = 8.1475*fgkcm;
71   const Double_t kOuterRadiusCentral = 9.9255*fgkcm;
72   const Double_t kInnerACentral = 3.1674*fgkcm;
73   const Double_t kInnerBCentral = 2.023 *fgkcm;
74   const Double_t kOuterACentral = 2.4374*fgkcm;
75   const Double_t kOuterBCentral = 3.8162*fgkcm;
76   // Dimensions of the EndCap shield
77   const Double_t kHalfLengthEndCap  = 25.*fgkmm;
78   const Double_t kThicknessEndCap   = 2.0*fgkmm;
79   const Double_t kInnerRadiusEndCap = 8.0775*fgkcm;
80   const Double_t kOuterRadiusEndCap = 9.9955*fgkcm;
81   const Double_t kInnerAEndCap = 3.1453*fgkcm;
82   const Double_t kInnerBEndCap = 2.0009*fgkcm;
83   const Double_t kOuterAEndCap = 2.4596*fgkcm;
84   const Double_t kOuterBEndCap = 3.8384*fgkcm;
85   // Dimensions of the Cone shield
86   const Double_t kHalfLengthCone  = 145.*fgkmm;
87   const Double_t kThicknessCone   = 0.3*fgkmm;
88   const Double_t kInnerRadialCone = 37.3*fgkcm;
89   const Double_t kOuterRadialCone = 39.0*fgkcm;
90   const Double_t kInnerACone = 14.2344*fgkcm;
91   //  const Double_t kInnerBCone =  9.0915*fgkcm;
92   const Double_t kOuterACone =  9.5058*fgkcm;
93   //  const Double_t kOuterBCone = 14.8831*fgkcm;
94   // Dimensions of the Flange's Ring and Wing
95   const Double_t kHalfLengthRing  = 7.5*fgkmm;
96   const Double_t kThicknessRing   = 0.3*fgkmm;
97   const Double_t kInnerRadiusRing = 37.3*fgkcm;
98   const Double_t kOuterRadiusRing = 42.0*fgkcm;
99   const Double_t kOuterRadiusWing = 49.25*fgkcm;
100   const Double_t kWideWing  = 6.0*fgkcm;
101   const Double_t kThetaWing = 45.0;
102   // Common data
103   const Double_t kTheta = 36.0*TMath::DegToRad();
104   const Double_t kThicknessOmega = 0.3*fgkmm;
105
106   // Local variables
107   Double_t x, y;
108   Double_t xshld[24], yshld[24];
109   Double_t xair[24] , yair[24];
110   Double_t xomega[48], yomega[48];
111   //  Double_t *xyarb8;
112
113   // The entire shield is made up of two half central shields
114   // symmetric with respect to the XZ plane, four half end cap
115   // shields, again symmetric with respect to the XZ plane, and four
116   // half cones, symmetric with respect to the XZ plane too.
117
118   TGeoVolumeAssembly *vM = new TGeoVolumeAssembly("ITSspdThermalShield");
119
120   // The central half shield: a half tube of carbon fiber,
121   // a similar but proportionally smaller half tube of air inside it,
122   // and a Omega-shaped carbon fiber insert inside the air.
123   // They are all XTru shapes
124
125   TGeoXtru *centralshape = new TGeoXtru(2);
126
127   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
128                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
129                         kTheta,xshld,yshld);
130
131   centralshape->DefinePolygon(24,xshld,yshld);
132   centralshape->DefineSection(0,-kHalfLengthCentral);
133   centralshape->DefineSection(1, kHalfLengthCentral);
134
135   // Now rescale to get the air volume dimensions
136     InsidePoint(xshld[23], yshld[23],
137                 xshld[ 0], yshld[ 0],
138                 xshld[ 1], yshld[ 1], kThicknessCentral,
139                 xair[0], yair[0]);
140   for (Int_t i=1; i<23; i++) {
141     InsidePoint(xshld[i-1], yshld[i-1],
142                 xshld[ i ], yshld[ i ],
143                 xshld[i+1], yshld[i+1], kThicknessCentral,
144                 xair[i], yair[i]);
145   }
146     InsidePoint(xshld[22], yshld[22],
147                 xshld[23], yshld[23],
148                 xshld[ 0], yshld[ 0], kThicknessCentral,
149                 xair[23], yair[23]);
150
151   // Create the air shape
152   TGeoXtru *centralairshape = new TGeoXtru(2);
153
154   centralairshape->DefinePolygon(24,xair,yair);
155   centralairshape->DefineSection(0,-kHalfLengthCentral);
156   centralairshape->DefineSection(1, kHalfLengthCentral);
157
158   // Create the Omega insert
159   TGeoXtru *centralomegashape = new TGeoXtru(2);
160
161   CreateSPDOmegaShape(xair,yair,kTheta,kThicknessOmega,xomega,yomega);
162
163   centralomegashape->DefinePolygon(48,xomega,yomega);
164   centralomegashape->DefineSection(0,-kHalfLengthCentral);
165   centralomegashape->DefineSection(1, kHalfLengthCentral);
166
167   // The end cap half shield: a half tube of carbon fiber,
168   // a similar but proportionally smaller half tube of air inside it,
169   // and a Omega-shaped carbon fiber insert inside the air.
170   // They are all XTru shapes
171
172   TGeoXtru *endcapshape = new TGeoXtru(2);
173
174   CreateSPDThermalShape(kInnerAEndCap,kInnerBEndCap,kInnerRadiusEndCap,
175                         kOuterAEndCap,kOuterBEndCap,kOuterRadiusEndCap,
176                         kTheta,xshld,yshld);
177
178   endcapshape->DefinePolygon(24,xshld,yshld);
179   endcapshape->DefineSection(0,-kHalfLengthEndCap);
180   endcapshape->DefineSection(1, kHalfLengthEndCap);
181
182   // Now rescale to get the air volume dimensions
183     InsidePoint(xshld[23], yshld[23],
184                 xshld[ 0], yshld[ 0],
185                 xshld[ 1], yshld[ 1], kThicknessEndCap,
186                 xair[0], yair[0]);
187   for (Int_t i=1; i<23; i++) {
188     InsidePoint(xshld[i-1], yshld[i-1],
189                 xshld[ i ], yshld[ i ],
190                 xshld[i+1], yshld[i+1], kThicknessEndCap,
191                 xair[i], yair[i]);
192   }
193     InsidePoint(xshld[22], yshld[22],
194                 xshld[23], yshld[23],
195                 xshld[ 0], yshld[ 0], kThicknessEndCap,
196                 xair[23], yair[23]);
197
198   // Create the air shape
199   TGeoXtru *endcapairshape = new TGeoXtru(2);
200
201   endcapairshape->DefinePolygon(24,xair,yair);
202   endcapairshape->DefineSection(0,-kHalfLengthEndCap);
203   endcapairshape->DefineSection(1, kHalfLengthEndCap);
204
205   // Create the Omega insert
206   TGeoXtru *endcapomegashape = new TGeoXtru(2);
207
208   CreateSPDOmegaShape(xair,yair,kTheta,kThicknessOmega,xomega,yomega);
209
210   endcapomegashape->DefinePolygon(48,xomega,yomega);
211   endcapomegashape->DefineSection(0,-kHalfLengthEndCap);
212   endcapomegashape->DefineSection(1, kHalfLengthEndCap);
213
214   // The cone half shield is more complex since there is no basic
215   // TGeo shape to describe it correctly. So it is made of a series
216   // of TGeoArb8 shapes filled with air, which all together make up the
217   // the cone AND its internal insert. Part of the following code is
218   // adapted from SPDThermalSheald method.
219
220   // Filled portions
221   TGeoArb8 *sC1 = new TGeoArb8(kHalfLengthCone);
222   TGeoArb8 *sC2 = new TGeoArb8(kHalfLengthCone);
223
224   CreateSPDThermalShape(kInnerACentral,kInnerBCentral,kInnerRadiusCentral,
225                         kOuterACentral,kOuterBCentral,kOuterRadiusCentral,
226                         kTheta,xshld,yshld);
227
228   sC1->SetVertex(0,xshld[12],yshld[12]);
229   sC1->SetVertex(1,xshld[11],yshld[11]);
230   sC1->SetVertex(2,xshld[ 0],yshld[ 0]);
231   sC1->SetVertex(3,xshld[23],yshld[23]);
232
233   sC2->SetVertex(0,xshld[11],yshld[11]);
234   sC2->SetVertex(1,xshld[10],yshld[10]);
235   sC2->SetVertex(2,xshld[ 1],yshld[ 1]);
236   sC2->SetVertex(3,xshld[ 0],yshld[ 0]);
237
238   // Drawings give only the radius, convert it to the apothegm
239   Double_t kInnerRadiusCone = TMath::Sqrt(kInnerRadialCone*kInnerRadialCone
240                                           - 0.25*kInnerACone*kInnerACone);
241   Double_t kOuterRadiusCone = TMath::Sqrt(kOuterRadialCone*kOuterRadialCone
242                                           - 0.25*kOuterACone*kOuterACone);
243
244   Double_t xco[4], yco[4], xci[4], yci[4];
245
246   for (Int_t i=0; i<2; i++) {
247     Double_t th = i*kTheta*TMath::RadToDeg();
248     xco[2*i  ] = kOuterRadiusCone*SinD(th) - 0.5*kOuterACone*CosD(th);
249     yco[2*i  ] = kOuterRadiusCone*CosD(th) + 0.5*kOuterACone*SinD(th);
250     xci[2*i  ] = kInnerRadiusCone*SinD(th) - 0.5*kInnerACone*CosD(th);
251     yci[2*i  ] = kInnerRadiusCone*CosD(th) + 0.5*kInnerACone*SinD(th);
252     xco[2*i+1] = kOuterRadiusCone*SinD(th) + 0.5*kOuterACone*CosD(th);
253     yco[2*i+1] = kOuterRadiusCone*CosD(th) - 0.5*kOuterACone*SinD(th);
254     xci[2*i+1] = kInnerRadiusCone*SinD(th) + 0.5*kInnerACone*CosD(th);
255     yci[2*i+1] = kInnerRadiusCone*CosD(th) - 0.5*kInnerACone*SinD(th);
256   }
257
258   sC1->SetVertex(4,xco[0],yco[0]);
259   sC1->SetVertex(5,xco[1],yco[1]);
260   sC1->SetVertex(6,xci[1],yci[1]);
261   sC1->SetVertex(7,xci[0],yci[0]);
262
263   sC2->SetVertex(4,xco[1],yco[1]);
264   sC2->SetVertex(5,xco[2],yco[2]);
265   sC2->SetVertex(6,xci[2],yci[2]);
266   sC2->SetVertex(7,xci[1],yci[1]);
267
268   // Air holes
269   TGeoArb8 *sCh1 = new TGeoArb8(kHalfLengthCone);
270   TGeoArb8 *sCh2 = new TGeoArb8(kHalfLengthCone);
271
272   for(Int_t i=0; i<4; i++){
273     InsidePoint(sC1->GetVertices()[((i+3)%4)*2+0],
274                 sC1->GetVertices()[((i+3)%4)*2+1],
275                 sC1->GetVertices()[i*2+0],
276                 sC1->GetVertices()[i*2+1],
277                 sC1->GetVertices()[((i+1)%4)*2+0],
278                 sC1->GetVertices()[((i+1)%4)*2+1],-kThicknessCone,x,y);
279     sCh1->SetVertex(i,x,y);
280
281     InsidePoint(sC1->GetVertices()[((i+3)%4 +4)*2+0],
282                 sC1->GetVertices()[((i+3)%4 +4)*2+1],
283                 sC1->GetVertices()[(i+4)*2+0],
284                 sC1->GetVertices()[(i+4)*2+1],
285                 sC1->GetVertices()[((i+1)%4 +4)*2+0],
286                 sC1->GetVertices()[((i+1)%4 +4)*2+1],-kThicknessCone,x,y);
287     sCh1->SetVertex(i+4,x,y);
288
289     InsidePoint(sC2->GetVertices()[((i+3)%4)*2+0],
290                 sC2->GetVertices()[((i+3)%4)*2+1],
291                 sC2->GetVertices()[i*2+0],
292                 sC2->GetVertices()[i*2+1],
293                 sC2->GetVertices()[((i+1)%4)*2+0],
294                 sC2->GetVertices()[((i+1)%4)*2+1],-kThicknessCone,x,y);
295     sCh2->SetVertex(i,x,y);
296
297     InsidePoint(sC2->GetVertices()[((i+3)%4 +4)*2+0],
298                 sC2->GetVertices()[((i+3)%4 +4)*2+1],
299                 sC2->GetVertices()[(i+4)*2+0],
300                 sC2->GetVertices()[(i+4)*2+1],
301                 sC2->GetVertices()[((i+1)%4 +4)*2+0],
302                 sC2->GetVertices()[((i+1)%4 +4)*2+1],-kThicknessCone,x,y);
303     sCh2->SetVertex(i+4,x,y);
304   }
305
306   // Finally the carbon fiber Ring with its Wings and their
307   // stesalite inserts. They are Tube and TubeSeg shapes
308
309   TGeoTube *ringshape = new TGeoTube(kInnerRadiusRing,kOuterRadiusRing,
310                                      kHalfLengthRing);
311
312   TGeoTube *ringinsertshape = new TGeoTube(kInnerRadiusRing+kThicknessRing,
313                                            kOuterRadiusRing-kThicknessRing,
314                                            kHalfLengthRing-kThicknessRing);
315
316   Double_t angleWideWing, angleWideWingThickness;
317   angleWideWing = (kWideWing/kOuterRadiusWing)*TMath::RadToDeg();
318   angleWideWingThickness = (kThicknessRing/kOuterRadiusWing)*TMath::RadToDeg();
319
320   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kOuterRadiusRing,kOuterRadiusWing,
321                                            kHalfLengthRing, 0, angleWideWing);
322
323   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kOuterRadiusRing,
324              kOuterRadiusWing-kThicknessRing, kHalfLengthRing-kThicknessRing,
325              angleWideWingThickness, angleWideWing-angleWideWingThickness);
326
327
328   // We have the shapes: now create the real volumes
329
330   TGeoMedium *medSPDcf  = mgr->GetMedium("ITS_SPD shield$");
331   TGeoMedium *medSPDair = mgr->GetMedium("ITS_SPD AIR$");
332   TGeoMedium *medSPDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
333
334   TGeoVolume *centralshield = new TGeoVolume("SPDcentralshield",
335                                              centralshape,medSPDcf);
336   centralshield->SetVisibility(kTRUE);
337   centralshield->SetLineColor(7);
338   centralshield->SetLineWidth(1);
339
340   TGeoVolume *centralairshield = new TGeoVolume("SPDcentralairshield",
341                                                 centralairshape,medSPDair);
342   centralairshield->SetVisibility(kTRUE);
343   centralairshield->SetLineColor(5); // Yellow
344   centralairshield->SetLineWidth(1);
345   centralairshield->SetFillColor(centralairshield->GetLineColor());
346   centralairshield->SetFillStyle(4090); // 90% transparent
347
348   TGeoVolume *centralomega = new TGeoVolume("SPDcentralomega",
349                                              centralomegashape,medSPDcf);
350   centralomega->SetVisibility(kTRUE);
351   centralomega->SetLineColor(7);
352   centralomega->SetLineWidth(1);
353
354   centralairshield->AddNode(centralomega,1,0);
355   centralshield->AddNode(centralairshield,1,0);
356
357   TGeoVolume *endcapshield = new TGeoVolume("SPDendcapshield",
358                                              endcapshape,medSPDcf);
359   endcapshield->SetVisibility(kTRUE);
360   endcapshield->SetLineColor(7);
361   endcapshield->SetLineWidth(1);
362
363   TGeoVolume *endcapairshield = new TGeoVolume("SPDendcapairshield",
364                                                 endcapairshape,medSPDair);
365   endcapairshield->SetVisibility(kTRUE);
366   endcapairshield->SetLineColor(5); // Yellow
367   endcapairshield->SetLineWidth(1);
368   endcapairshield->SetFillColor(endcapairshield->GetLineColor());
369   endcapairshield->SetFillStyle(4090); // 90% transparent
370
371   TGeoVolume *endcapomega = new TGeoVolume("SPDendcapomega",
372                                            endcapomegashape,medSPDcf);
373   endcapomega->SetVisibility(kTRUE);
374   endcapomega->SetLineColor(7);
375   endcapomega->SetLineWidth(1);
376
377   endcapairshield->AddNode(endcapomega,1,0);
378   endcapshield->AddNode(endcapairshield,1,0);
379
380   TGeoVolume *vC1 = new TGeoVolume("SPDconeshieldV1",sC1,medSPDcf);
381   vC1->SetVisibility(kTRUE);
382   vC1->SetLineColor(7);
383   vC1->SetLineWidth(1);
384
385   TGeoVolume *vCh1 = new TGeoVolume("SPDconeshieldH1",sCh1,medSPDair);
386
387   vCh1->SetVisibility(kTRUE);
388   vCh1->SetLineColor(5); // Yellow
389   vCh1->SetLineWidth(1);
390   vCh1->SetFillColor(vCh1->GetLineColor());
391   vCh1->SetFillStyle(4090); // 90% transparent
392
393   vC1->AddNode(vCh1,1,0);
394
395   TGeoVolume *vC2 = new TGeoVolume("SPDconeshieldV2",sC2,medSPDcf);
396
397   vC2->SetVisibility(kTRUE);
398   vC2->SetLineColor(7);
399   vC2->SetLineWidth(1);
400
401   TGeoVolume *vCh2 = new TGeoVolume("SPDconeshieldH2",sCh2,medSPDair);
402
403   vCh2->SetVisibility(kTRUE);
404   vCh2->SetLineColor(5); // Yellow
405   vCh2->SetLineWidth(1);
406   vCh2->SetFillColor(vCh2->GetLineColor());
407   vCh2->SetFillStyle(4090); // 90% transparent
408
409   vC2->AddNode(vCh2,1,0);
410
411   TGeoVolume *ring = new TGeoVolume("SPDshieldring",ringshape,medSPDcf);
412   ring->SetVisibility(kTRUE);
413   ring->SetLineColor(7);
414   ring->SetLineWidth(1);
415
416   TGeoVolume *ringinsert = new TGeoVolume("SPDshieldringinsert",
417                                           ringinsertshape,medSPDste);
418   ringinsert->SetVisibility(kTRUE);
419   ringinsert->SetLineColor(3); // Green
420 //  ringinsert->SetLineWidth(1);
421   ringinsert->SetFillColor(ringinsert->GetLineColor());
422   ringinsert->SetFillStyle(4010); // 10% transparent
423
424   ring->AddNode(ringinsert,1,0);
425
426   TGeoVolume *wing = new TGeoVolume("SPDshieldringwing",wingshape,medSPDcf);
427   wing->SetVisibility(kTRUE);
428   wing->SetLineColor(7);
429   wing->SetLineWidth(1);
430
431   TGeoVolume *winginsert = new TGeoVolume("SPDshieldringinsert",
432                                           winginsertshape,medSPDste);
433   winginsert->SetVisibility(kTRUE);
434   winginsert->SetLineColor(3); // Green
435 //  winginsert->SetLineWidth(1);
436   winginsert->SetFillColor(winginsert->GetLineColor());
437   winginsert->SetFillStyle(4010); // 10% transparent
438
439   wing->AddNode(winginsert,1,0);
440
441
442   // Add all volumes in the assembly
443   vM->AddNode(centralshield,1,0);
444   vM->AddNode(centralshield,2,new TGeoRotation("",180,0,0));
445
446   vM->AddNode(endcapshield,1,
447               new TGeoTranslation(0,0, kHalfLengthCentral+kHalfLengthEndCap));
448   vM->AddNode(endcapshield,2,
449               new TGeoTranslation(0,0,-kHalfLengthCentral-kHalfLengthEndCap));
450   vM->AddNode(endcapshield,3,new TGeoCombiTrans(
451               0, 0, kHalfLengthCentral+kHalfLengthEndCap,
452               new TGeoRotation("",180,0,0)     ) );
453   vM->AddNode(endcapshield,4,new TGeoCombiTrans(
454               0, 0,-kHalfLengthCentral-kHalfLengthEndCap,
455               new TGeoRotation("",180,0,0)     ) );
456
457   for (Int_t i=0; i<10; i++) {
458     Double_t thetaC12 = kTheta*TMath::RadToDeg();
459     vM->AddNode(vC1,2*i+1, new TGeoCombiTrans(
460                0, 0,  kHalfLengthCentral+2*kHalfLengthEndCap+kHalfLengthCone,
461                new TGeoRotation("",0,  0,i*thetaC12)   ) );
462     vM->AddNode(vC1,2*i+2, new TGeoCombiTrans(
463                0, 0, -kHalfLengthCentral-2*kHalfLengthEndCap-kHalfLengthCone,
464                new TGeoRotation("",0,180,i*thetaC12)   ) );
465     vM->AddNode(vC2,2*i+1, new TGeoCombiTrans(
466                0, 0,  kHalfLengthCentral+2*kHalfLengthEndCap+kHalfLengthCone,
467                new TGeoRotation("",0,  0,i*thetaC12)   ) );
468     vM->AddNode(vC2,2*i+2, new TGeoCombiTrans(
469                0, 0, -kHalfLengthCentral-2*kHalfLengthEndCap-kHalfLengthCone,
470                new TGeoRotation("",0,180,i*thetaC12)   ) );
471   }
472
473   vM->AddNode(ring,1,new TGeoTranslation(0, 0,
474               kHalfLengthCentral+2*kHalfLengthEndCap+2*kHalfLengthCone
475              +kHalfLengthRing));
476   vM->AddNode(ring,2,new TGeoTranslation(0, 0,
477              -kHalfLengthCentral-2*kHalfLengthEndCap-2*kHalfLengthCone
478              -kHalfLengthRing));
479
480   for (Int_t i=0; i<4; i++) {
481     Double_t thetaW = kThetaWing*(2*i+1);
482     vM->AddNode(wing,2*i+1,new TGeoCombiTrans(0, 0,
483               kHalfLengthCentral+2*kHalfLengthEndCap+2*kHalfLengthCone
484              +kHalfLengthRing, new TGeoRotation("",thetaW,0,0)  ));
485     vM->AddNode(wing,2*i+2,new TGeoCombiTrans(0, 0,
486              -kHalfLengthCentral-2*kHalfLengthEndCap-2*kHalfLengthCone
487              -kHalfLengthRing, new TGeoRotation("",thetaW,0,0)  ));
488   }
489
490   // Some debugging if requested
491   if(GetDebug(1)){
492     vM->PrintNodes();
493     vM->InspectShape();
494   }
495
496   // Finally put the entire shield in the mother volume
497   moth->AddNode(vM,1,0);
498
499   return;
500 }
501
502 //______________________________________________________________________
503 void AliITSv11GeometrySupport::CreateSPDThermalShape(
504      Double_t ina, Double_t inb, Double_t inr,
505      Double_t oua, Double_t oub, Double_t our,
506      Double_t   t, Double_t *x , Double_t *y )
507 {
508 //
509 // Creates the proper sequence of X and Y coordinates to determine
510 // the base XTru polygon for the SPD thermal shapes
511 //
512 // Input:
513 //        ina, inb : inner shape sides
514 //        inr      : inner radius
515 //        oua, oub : outer shape sides
516 //        our      : outer radius
517 //        t        : theta angle
518 //
519 // Output:
520 //        x, y : coordinate vectors [24]
521 //
522 // Created:      14 Nov 2007  Mario Sitta
523 // Updated:      11 Dec 2007  Mario Sitta
524 //
525   Double_t xlocal[6],ylocal[6];
526
527   //Create the first inner quadrant (X > 0)
528   FillSPDXtruShape(ina,inb,inr,t,xlocal,ylocal);
529   for (Int_t i=0; i<6; i++) {
530     x[i] = xlocal[i];
531     y[i] = ylocal[i];
532   }
533
534   // Then reflex on the second quadrant (X < 0)
535   for (Int_t i=0; i<6; i++) {
536     x[23-i] = -x[i];
537     y[23-i] =  y[i];
538   }
539
540   // Now create the first outer quadrant (X > 0)
541   FillSPDXtruShape(oua,oub,our,t,xlocal,ylocal);
542   for (Int_t i=0; i<6; i++) {
543     x[11-i] = xlocal[i];
544     y[11-i] = ylocal[i];
545   }
546
547   // Finally reflex on the second quadrant (X < 0)
548   for (Int_t i=0; i<6; i++) {
549     x[12+i] = -x[11-i];
550     y[12+i] =  y[11-i];
551   }
552
553   return;
554 }
555
556 //______________________________________________________________________
557 void AliITSv11GeometrySupport::CreateSPDOmegaShape(
558                              Double_t *xin, Double_t *yin, Double_t  t,
559                              Double_t    d, Double_t   *x, Double_t *y)
560 {
561 //
562 // Creates the proper sequence of X and Y coordinates to determine
563 // the SPD Omega XTru polygon
564 //
565 // Input:
566 //        xin, yin : coordinates of the air volume
567 //        d        : Omega shape thickness
568 //        t        : theta angle
569 //
570 // Output:
571 //        x, y     : coordinate vectors [48]
572 //
573 // Created:      17 Nov 2007  Mario Sitta
574 // Updated:      11 Dec 2007  Mario Sitta
575 //
576   Double_t xlocal[6],ylocal[6];
577
578   // First determine various parameters
579   Double_t ina = TMath::Sqrt( (xin[23]-xin[0])*(xin[23]-xin[0]) +
580                               (yin[23]-yin[0])*(yin[23]-yin[0]) );
581   Double_t inb = TMath::Sqrt( (xin[ 1]-xin[0])*(xin[ 1]-xin[0]) +
582                               (yin[ 1]-yin[0])*(yin[ 1]-yin[0]) );
583   Double_t inr = yin[0];
584   Double_t oua = TMath::Sqrt( (xin[12]-xin[11])*(xin[12]-xin[11]) +
585                               (yin[12]-yin[11])*(yin[12]-yin[11]) );
586   Double_t oub = TMath::Sqrt( (xin[10]-xin[11])*(xin[10]-xin[11]) +
587                               (yin[10]-yin[11])*(yin[10]-yin[11]) );
588   Double_t our = yin[11];
589
590   //Create the first inner pseudo-quadrant
591   FillSPDXtruShape(ina,inb,inr,t,xlocal,ylocal);
592   x[ 1] = xlocal[0];
593   y[ 1] = ylocal[0];
594
595   x[ 2] = xlocal[1];
596   y[ 2] = ylocal[1];
597
598   x[ 5] = xlocal[2];
599   y[ 5] = ylocal[2];
600
601   x[ 6] = xlocal[3];
602   y[ 6] = ylocal[3];
603
604   x[ 9] = xlocal[4];
605   y[ 9] = ylocal[4];
606
607   x[10] = xlocal[5];
608   y[10] = ylocal[5];
609
610   //Create the first outer pseudo-quadrant
611   FillSPDXtruShape(oua,oub,our,t,xlocal,ylocal);
612   x[23] = xlocal[0];
613   y[23] = ylocal[0];
614
615   x[20] = xlocal[1];
616   y[20] = ylocal[1];
617
618   x[19] = xlocal[2];
619   y[19] = ylocal[2];
620
621   x[16] = xlocal[3];
622   y[16] = ylocal[3];
623
624   x[15] = xlocal[4];
625   y[15] = ylocal[4];
626
627   x[11] = xlocal[5];
628   y[11] = ylocal[5];
629
630   //Create the second inner pseudo-quadrant
631   FillSPDXtruShape(ina+2*d,inb-2*d,inr+d,t,xlocal,ylocal);
632   x[22] = xlocal[0];
633   y[22] = ylocal[0];
634
635   x[21] = xlocal[1];
636   y[21] = ylocal[1];
637
638   x[18] = xlocal[2];
639   y[18] = ylocal[2];
640
641   x[17] = xlocal[3];
642   y[17] = ylocal[3];
643
644   x[14] = xlocal[4];
645   y[14] = ylocal[4];
646
647   x[13] = xlocal[5];
648   y[13] = ylocal[5];
649
650   //Create the second outer pseudo-quadrant
651   FillSPDXtruShape(oua-2*d,oub+2*d,our-d,t,xlocal,ylocal);
652   x[ 0] = xlocal[0];
653   y[ 0] = ylocal[0];
654
655   x[ 3] = xlocal[1];
656   y[ 3] = ylocal[1];
657
658   x[ 4] = xlocal[2];
659   y[ 4] = ylocal[2];
660
661   x[ 7] = xlocal[3];
662   y[ 7] = ylocal[3];
663
664   x[ 8] = xlocal[4];
665   y[ 8] = ylocal[4];
666
667   x[12] = xlocal[5];
668   y[12] = ylocal[5];
669
670   // These need to be fixed explicitly
671   y[10] = yin[5];
672   y[11] = yin[6];
673   x[12] = x[11];
674   y[12] = y[11] + d;
675   x[13] = x[10] + d;
676   y[13] = y[12];
677
678   // Finally reflex on the negative side
679   for (Int_t i=0; i<24; i++) {
680     x[24+i] = -x[23-i];
681     y[24+i] =  y[23-i];
682   }
683
684   // Wow ! We've finished
685   return;
686 }
687
688 //______________________________________________________________________
689 void AliITSv11GeometrySupport::FillSPDXtruShape(Double_t a, Double_t b,
690                                                 Double_t r, Double_t t,
691                                                 Double_t *x, Double_t *y)
692 {
693 //
694 // Creates the partial sequence of X and Y coordinates to determine
695 // the lateral part of the SPD thermal shield
696 //
697 // Input:
698 //        a, b : shape sides
699 //        r    : radius
700 //        t    : theta angle
701 //
702 // Output:
703 //        x, y : coordinate vectors [6]
704 //
705 // Created:      14 Nov 2007  Mario Sitta
706 //
707   x[0] = a/2;
708   y[0] = r;
709
710   x[1] = x[0] + b * TMath::Cos(t/2);
711   y[1] = y[0] - b * TMath::Sin(t/2);
712
713   x[2] = x[1] + a * TMath::Cos(t);
714   y[2] = y[1] - a * TMath::Sin(t);
715
716   x[3] = x[2] + b * TMath::Cos(3*t/2);
717   y[3] = y[2] - b * TMath::Sin(3*t/2);
718
719   x[4] = x[3] + a * TMath::Cos(2*t);
720   y[4] = y[3] - a * TMath::Sin(2*t);
721
722   x[5] = x[4];
723   y[5] = 0.;
724
725   return;
726 }
727
728 //______________________________________________________________________
729 void AliITSv11GeometrySupport::SDDCone(TGeoVolume *moth,TGeoManager *mgr)
730 {
731 //
732 // Creates the SDD support cone and cylinder geometry as a
733 // volume assembly and adds it to the mother volume
734 // (part of this code is taken or anyway inspired to SDDCone method
735 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
736 //
737 // Input:
738 //         moth : the TGeoVolume owing the volume structure
739 //         mgr  : the GeoManager (default gGeoManager)
740 // Output:
741 //
742 // Created:         ???       Bjorn S. Nilsen
743 // Updated:      18 Feb 2008  Mario Sitta
744 //
745 // Technical data are taken from:  "Supporto Generale Settore SDD"
746 // (technical drawings ALR-0816/1-B), "Supporto Globale Settore SDD"
747 // (technical drawings ALR-0816/2A, ALR-0816/2B, ALR-0816/2C, ALR-0816/2D), 
748 // private communication with B. Giraudo
749
750   // Dimensions of the Central cylinder and flanges
751   const Double_t kCylinderHalfLength = (790.0/2)*fgkmm;
752   const Double_t kCylinderInnerR     = (210.0/2)*fgkmm;
753   const Double_t kCylinderOuterR     = (231.0/2)*fgkmm;
754   const Double_t kFlangeHalfLength   = ( 15.0/2)*fgkmm;
755   const Double_t kFlangeInnerR       = (210.5/2)*fgkmm;
756   const Double_t kFlangeOuterR       = (230.5/2)*fgkmm;
757   const Double_t kInsertoHalfLength  =
758                                      kCylinderHalfLength - 2*kFlangeHalfLength;
759 //  const Double_t kCFThickness        = kFlangeInnerR - kCylinderInnerR;
760   const Double_t kBoltDiameter       =       6.0*fgkmm; // M6 screw
761   const Double_t kBoltDepth          =       6.0*fgkmm; // In the flange
762   const Double_t kBoltRadius         = (220.0/2)*fgkmm; // Radius in flange
763   const Double_t kThetaBolt          =      30.0*fgkDegree;
764   const Int_t    kNBolts             = (Int_t)(360.0/kThetaBolt);
765   // Dimensions of the Cone
766   const Double_t kConeROutMin        = (540.0/2)*fgkmm;
767   const Double_t kConeROutMax        = (560.0/2)*fgkmm;
768   const Double_t kConeRCurv          =      10.0*fgkmm; // Radius of curvature
769   const Double_t kConeRinMin         = (210.0/2)*fgkmm;
770   const Double_t kConeRinMax         = (216.0/2)*fgkmm;
771   const Double_t kConeRinCylinder    = (231.0/2)*fgkmm;
772   const Double_t kConeZCylinder      =     192.0*fgkmm;
773   const Double_t kConeZOuterMilled   =      23.0*fgkmm;
774   const Double_t kConeDZin           =      15.0*fgkmm; // ???
775   const Double_t kConeThickness      =      10.0*fgkmm; // Rohacell + Carb.Fib.
776   const Double_t kConeTheta          =      45.0*fgkDegree; // SDD cone angle
777   const Double_t kSinConeTheta       =
778                                      TMath::Sin(kConeTheta*TMath::DegToRad());
779   const Double_t kCosConeTheta       =
780                                      TMath::Cos(kConeTheta*TMath::DegToRad());
781   const Double_t kTanConeTheta       =
782                                      TMath::Tan(kConeTheta*TMath::DegToRad());
783   // Dimensions of the Cone Inserts
784   const Double_t kConeCFThickness       = 1.5*fgkmm; // Carbon fiber thickness
785   // Dimensions of the Cone Holes
786   const Double_t kHole1RMin          = (450.0/2)*fgkmm;
787   const Double_t kHole1RMax          = (530.0/2)*fgkmm;
788   const Double_t kHole2RMin          = (280.0/2)*fgkmm;
789   const Double_t kHole2RMax          = (375.0/2)*fgkmm;
790   const Double_t kHole1Phi           =      25.0*fgkDegree;
791   const Double_t kHole2Phi           =      50.0*fgkDegree;
792   const Double_t kHole3RMin          =     205.0*fgkmm;
793   const Double_t kHole3DeltaR        =        15*fgkmm;
794   const Double_t kHole3Width         =        30*fgkmm;
795   const Int_t    kNHole3             =         6      ;
796   const Double_t kHole4RMin          =     116.0*fgkmm;
797   const Double_t kHole4DeltaR        =        15*fgkmm;
798   const Double_t kHole4Width         =        30*fgkmm;
799   //  const Int_t    kNHole4             =         3      ;
800
801   // Local variables
802   Double_t x, y, z, t, dza, rmin, rmax;
803
804
805   // Recover the needed materials
806   TGeoMedium *medSDDcf  = mgr->GetMedium("ITS_SDD C (M55J)$");
807   TGeoMedium *medSDDair = mgr->GetMedium("ITS_SDD AIR$");
808   TGeoMedium *medSDDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
809   TGeoMedium *medSDDroh = mgr->GetMedium("ITS_ROHACELL$");
810   TGeoMedium *medSDDss  = mgr->GetMedium("ITS_INOX$");
811
812   // First define the geometrical shapes
813
814   // Central cylinder with its internal foam and the lateral flanges:
815   // a carbon fiber Tube which contains a rohacell Tube and two
816   // stesalite Tube's
817   TGeoTube *cylindershape = new TGeoTube(kCylinderInnerR,kCylinderOuterR,
818                                          kCylinderHalfLength);
819
820   TGeoTube *insertoshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
821                                         kInsertoHalfLength);
822
823   TGeoTube *flangeshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
824                                        kFlangeHalfLength);
825
826   // The flange bolt: it is a Tube
827   TGeoTube *boltshape = new TGeoTube(0.0, 0.5*kBoltDiameter, 0.5*kBoltDepth);
828
829   // Debug if requested
830   if (GetDebug(1)) {
831     cylindershape->InspectShape();
832     insertoshape->InspectShape();
833     flangeshape->InspectShape();
834     boltshape->InspectShape();
835   }
836
837
838   // We have the shapes: now create the real volumes
839
840   TGeoVolume *cfcylinder = new TGeoVolume("SDDCarbonFiberCylinder",
841                                           cylindershape,medSDDcf);
842   cfcylinder->SetVisibility(kTRUE);
843   cfcylinder->SetLineColor(4); // Blue
844   cfcylinder->SetLineWidth(1);
845   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
846   cfcylinder->SetFillStyle(4000); // 0% transparent
847
848   TGeoVolume *foamcylinder = new TGeoVolume("SDDFoamCylinder",
849                                             insertoshape,medSDDroh);
850   foamcylinder->SetVisibility(kTRUE);
851   foamcylinder->SetLineColor(3); // Green
852   foamcylinder->SetLineWidth(1);
853   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
854   foamcylinder->SetFillStyle(4050); // 50% transparent
855
856   TGeoVolume *flangecylinder = new TGeoVolume("SDDFlangeCylinder",
857                                               flangeshape,medSDDste);
858   flangecylinder->SetVisibility(kTRUE);
859   flangecylinder->SetLineColor(2); // Red
860   flangecylinder->SetLineWidth(1);
861   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
862   flangecylinder->SetFillStyle(4050); // 50% transparent
863
864   TGeoVolume *bolt = new TGeoVolume("SDDFlangeBolt",boltshape,medSDDss);
865   bolt->SetVisibility(kTRUE);
866   bolt->SetLineColor(1);  // Black
867   bolt->SetLineWidth(1);
868   bolt->SetFillColor(bolt->GetLineColor());
869   bolt->SetFillStyle(4050); // 50% transparent
870
871   // Mount up the cylinder
872   for(Int_t i=0; i<kNBolts; i++){
873     t = kThetaBolt*i;
874     x = kBoltRadius*TMath::Cos(t);
875     y = kBoltRadius*TMath::Sin(t);
876     z = kFlangeHalfLength-kBoltDepth;
877     flangecylinder->AddNode(bolt, i+1, new TGeoTranslation("",x,y,z));
878   }
879
880   cfcylinder->AddNode(foamcylinder,1,0);
881   cfcylinder->AddNode(flangecylinder,1,
882               new TGeoTranslation(0, 0, kInsertoHalfLength+kFlangeHalfLength));
883   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
884               0, 0, -kInsertoHalfLength-kFlangeHalfLength,
885               new TGeoRotation("",0,180,0)     ) );
886
887
888   // SDD Support Cone with its internal inserts: a carbon fiber Pcon
889   // with holes which contains a stesalite Pcon which on turn contains a
890   // rohacell Pcon
891
892   dza = kConeThickness/kSinConeTheta-(kConeROutMax-kConeROutMin)/kTanConeTheta;
893
894   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 12);
895
896   coneshape->Z(0)     = 0.0;
897   coneshape->Rmin(0)  = kConeROutMin;
898   coneshape->Rmax(0)  = kConeROutMax;
899
900   coneshape->Z(1)     = kConeZOuterMilled - dza;
901   coneshape->Rmin(1)  = coneshape->GetRmin(0);
902   coneshape->Rmax(1)  = coneshape->GetRmax(0);
903
904   coneshape->Z(2)     = kConeZOuterMilled;
905   coneshape->Rmax(2)  = coneshape->GetRmax(0);
906
907   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(1),
908                     coneshape->GetRmin(1),kConeTheta,z,rmin);
909   coneshape->Z(3)     = z;
910   coneshape->Rmin(3)  = rmin;
911
912   coneshape->Rmin(2)  = RminFrom2Points(coneshape,3,1,coneshape->GetZ(2));
913
914   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(2),
915                     coneshape->GetRmax(2),kConeTheta,z,rmax);
916   coneshape->Z(4)     = z;
917   coneshape->Rmax(4)  = rmax;
918   coneshape->Rmin(4)  = RminFromZpCone(coneshape,3,kConeTheta,
919                                        coneshape->GetZ(4),0.0);
920
921   coneshape->Rmax(3)  = RmaxFrom2Points(coneshape,4,2,coneshape->GetZ(3));
922
923   coneshape->Rmin(7)  = kConeRinMin;
924
925   coneshape->Rmin(8)  = kConeRinMin;
926
927   RadiusOfCurvature(kConeRCurv,90.0,0.0,kConeRinMax,90.0-kConeTheta,z,rmax);
928   coneshape->Rmax(8)  = rmax;
929   coneshape->Z(8)     = ZFromRmaxpCone(coneshape,4,kConeTheta,
930                                        coneshape->GetRmax(8));
931
932   coneshape->Z(9)     = kConeZCylinder;
933   coneshape->Rmin(9)  = kConeRinMin;
934
935   coneshape->Z(10)    = coneshape->GetZ(9);
936   coneshape->Rmin(10) = kConeRinCylinder;
937
938   coneshape->Rmin(11) = kConeRinCylinder;
939   coneshape->Rmax(11) = coneshape->GetRmin(11);
940
941   rmin                = coneshape->GetRmin(8);
942   RadiusOfCurvature(kConeRCurv,90.0-kConeTheta,
943                     coneshape->GetZ(8),coneshape->GetRmax(8),90.0,z,rmax);
944   rmax                = kConeRinMax;
945   coneshape->Z(11)    = z + (coneshape->GetZ(8)-z)*
946                    (coneshape->GetRmax(11)-rmax)/(coneshape->GetRmax(8)-rmax);
947
948   coneshape->Rmax(9)  = RmaxFrom2Points(coneshape,11,8,coneshape->GetZ(9));
949
950   coneshape->Rmax(10) = coneshape->GetRmax(9);
951
952   coneshape->Z(6)     = z - kConeDZin;
953   coneshape->Z(7)     = coneshape->GetZ(6);
954
955   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,4,kConeTheta,
956                                        coneshape->GetZ(6));
957
958   coneshape->Rmax(7)  = coneshape->GetRmax(6);
959
960   RadiusOfCurvature(kConeRCurv,90.,
961                     coneshape->GetZ(6),0.0,90.0-kConeTheta,z,rmin);
962   coneshape->Z(5)     = z;
963   coneshape->Rmin(5)  = RminFromZpCone(coneshape,3,kConeTheta,z);
964   coneshape->Rmax(5)  = RmaxFromZpCone(coneshape,4,kConeTheta,z);
965
966   RadiusOfCurvature(kConeRCurv,90.-kConeTheta,
967                     0.0,coneshape->Rmin(5),90.0,z,rmin);
968   coneshape->Rmin(6)  = rmin;
969
970   // SDD Cone Insert: another Pcon
971   Double_t x0, y0, x1, y1, x2, y2;
972   TGeoPcon *coneinsertshape = new TGeoPcon(0.0, 360.0, 9);
973
974   coneinsertshape->Z(0)    = coneshape->GetZ(0) + kConeCFThickness;
975   coneinsertshape->Rmin(0) = coneshape->GetRmin(0) + kConeCFThickness;
976   coneinsertshape->Rmax(0) = coneshape->GetRmax(0) - kConeCFThickness;
977
978   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
979   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
980   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
981   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
982   coneinsertshape->Z(1)    = z;
983   coneinsertshape->Rmin(1) = rmin;
984   coneinsertshape->Rmax(1) = coneinsertshape->GetRmax(0);
985
986   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmax(1);
987   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmax(2);
988   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmax(3);
989   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
990   coneinsertshape->Z(2)    = z;
991   coneinsertshape->Rmax(2) = rmax;
992
993   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
994   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
995   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
996   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
997   coneinsertshape->Z(3)    = z;
998   coneinsertshape->Rmin(3) = rmin;
999
1000   x0 = coneinsertshape->GetZ(1); y0 = coneinsertshape->GetRmin(1);
1001   x1 = coneinsertshape->GetZ(3); y1 = coneinsertshape->GetRmin(3);
1002   coneinsertshape->Rmin(2) = Yfrom2Points(x0, y0, x1, y1,
1003                                           coneinsertshape->Z(2));
1004
1005   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
1006   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
1007   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
1008   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
1009   coneinsertshape->Z(4)    = z;
1010   coneinsertshape->Rmax(4) = rmax;
1011
1012   x0 = coneinsertshape->GetZ(2); y0 = coneinsertshape->GetRmax(2);
1013   x1 = coneinsertshape->GetZ(4); y1 = coneinsertshape->GetRmax(4);
1014   coneinsertshape->Rmax(3) = Yfrom2Points(x0, y0, x1, y1,
1015                                           coneinsertshape->Z(3));
1016
1017   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmin(4);
1018   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmin(5);
1019   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmin(6);
1020   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1021   coneinsertshape->Z(5)    = z;
1022   coneinsertshape->Rmin(5) = rmin;
1023   coneinsertshape->Rmax(5) = coneinsertshape->GetRmax(4) -
1024           kTanConeTheta*(coneinsertshape->GetZ(5) - coneinsertshape->GetZ(4));
1025
1026   x0 = coneinsertshape->GetZ(3); y0 = coneinsertshape->GetRmin(3);
1027   x1 = coneinsertshape->GetZ(5); y1 = coneinsertshape->GetRmin(5);
1028   coneinsertshape->Rmin(4) = Yfrom2Points(x0, y0, x1, y1,
1029                                           coneinsertshape->Z(4));
1030
1031   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmin(5);
1032   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmin(6);
1033   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmin(7);
1034   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1035   coneinsertshape->Z(6)    = z;
1036   coneinsertshape->Rmin(6) = rmin;
1037   coneinsertshape->Rmax(6) = coneinsertshape->GetRmax(4) -
1038           kTanConeTheta*(coneinsertshape->GetZ(6) - coneinsertshape->GetZ(4));
1039
1040   coneinsertshape->Z(7)    = coneinsertshape->GetZ(6);
1041   coneinsertshape->Rmin(7) = coneshape->GetRmin(7) + kConeCFThickness;
1042   coneinsertshape->Rmax(7) = coneinsertshape->GetRmax(6);
1043
1044   coneinsertshape->Z(8)    = coneshape->GetZ(9) - kConeCFThickness;
1045   coneinsertshape->Rmin(8) = coneinsertshape->GetRmin(7);
1046   coneinsertshape->Rmax(8) = coneinsertshape->GetRmax(4) -
1047           kTanConeTheta*(coneinsertshape->GetZ(8) - coneinsertshape->GetZ(4));
1048
1049   // SDD Cone Foam: another Pcon
1050   TGeoPcon *conefoamshape = new TGeoPcon(0.0, 360.0, 4);
1051
1052   RadiusOfCurvature(kConeRCurv+kConeCFThickness,0.0,coneinsertshape->GetZ(1),
1053                     coneinsertshape->GetRmin(1),kConeTheta,z,rmin);
1054
1055   conefoamshape->Z(0)    = z;
1056   conefoamshape->Rmin(0) = rmin;
1057   conefoamshape->Rmax(0) = conefoamshape->GetRmin(0);
1058
1059   conefoamshape->Z(1)    = conefoamshape->GetZ(0)+
1060                          (kConeThickness-2.0*kConeCFThickness)/kSinConeTheta;
1061   conefoamshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1062                                           conefoamshape->GetZ(1));
1063   conefoamshape->Rmax(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1064                                           conefoamshape->GetZ(1));
1065
1066   conefoamshape->Z(2)    = coneshape->GetZ(5)-kConeCFThickness;
1067   conefoamshape->Rmin(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1068                                           conefoamshape->GetZ(2));
1069   conefoamshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1070                                           conefoamshape->GetZ(2));
1071
1072   conefoamshape->Z(3)    = coneinsertshape->GetZ(5)+
1073                          (kConeThickness-2.0*kConeCFThickness)*kCosConeTheta;
1074   conefoamshape->Rmax(3) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1075                                           conefoamshape->GetZ(3));
1076   conefoamshape->Rmin(3) = conefoamshape->GetRmax(3);
1077
1078   // SDD Cone Holes: Pcon's
1079   TGeoPcon *hole1shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1080
1081   hole1shape->Rmin(0) = kHole1RMax;
1082   hole1shape->Rmax(0) = hole1shape->GetRmin(0);
1083   hole1shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1084                                        hole1shape->GetRmin(0));
1085
1086   hole1shape->Rmax(1) = hole1shape->GetRmax(0);
1087   hole1shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1088                                        hole1shape->GetRmax(1));
1089   hole1shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1090                                        hole1shape->GetZ(1));
1091
1092   hole1shape->Rmin(2) = kHole1RMin;
1093   hole1shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1094                                        hole1shape->GetRmin(2));
1095   hole1shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1096                                        hole1shape->GetZ(2));
1097
1098   hole1shape->Rmin(3) = hole1shape->GetRmin(2);
1099   hole1shape->Rmax(3) = hole1shape->GetRmin(3);
1100   hole1shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1101                                        hole1shape->GetRmax(3));
1102
1103   TGeoPcon *hole2shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1104
1105   hole2shape->Rmin(0) = kHole2RMax;
1106   hole2shape->Rmax(0) = hole2shape->GetRmin(0);
1107   hole2shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1108                                        hole2shape->GetRmin(0));
1109
1110   hole2shape->Rmax(1) = hole2shape->GetRmax(0);
1111   hole2shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1112                                        hole2shape->GetRmax(1));
1113   hole2shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1114                                        hole2shape->GetZ(1));
1115
1116   hole2shape->Rmin(2) = kHole2RMin;
1117   hole2shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1118                                        hole2shape->GetRmin(2));
1119   hole2shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1120                                        hole2shape->GetZ(2));
1121
1122   hole2shape->Rmin(3) = hole2shape->GetRmin(2);
1123   hole2shape->Rmax(3) = hole2shape->GetRmin(3);
1124   hole2shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1125                                        hole2shape->GetRmax(3));
1126
1127   Double_t holePhi;
1128   holePhi = (kHole3Width/kHole3RMin)*TMath::RadToDeg();
1129
1130   TGeoPcon *hole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1131
1132   hole3shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1133   hole3shape->Rmax(0) = hole3shape->GetRmin(0);
1134   hole3shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1135                                        hole3shape->GetRmin(0));
1136
1137   hole3shape->Rmax(1) = hole3shape->GetRmax(0);
1138   hole3shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1139                                        hole3shape->GetRmax(1));
1140   hole3shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1141                                        hole3shape->GetZ(1));
1142
1143   hole3shape->Rmin(2) = kHole3RMin;
1144   hole3shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1145                                        hole3shape->GetRmin(2));
1146   hole3shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1147                                        hole3shape->GetZ(2));
1148
1149   hole3shape->Rmin(3) = hole3shape->GetRmin(2);
1150   hole3shape->Rmax(3) = hole3shape->GetRmin(3);
1151   hole3shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1152                                        hole3shape->GetRmax(3));
1153
1154   holePhi = (kHole4Width/kHole4RMin)*TMath::RadToDeg();
1155
1156   TGeoPcon *hole4shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1157
1158   hole4shape->Rmin(0) = kHole4RMin + kHole4DeltaR;
1159   hole4shape->Rmax(0) = hole4shape->GetRmin(0);
1160   hole4shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1161                                        hole4shape->GetRmin(0));
1162
1163   hole4shape->Rmax(1) = hole4shape->GetRmax(0);
1164   hole4shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1165                                        hole4shape->GetRmax(1));
1166   hole4shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1167                                        hole4shape->GetZ(1));
1168
1169   hole4shape->Rmin(2) = kHole4RMin;
1170   hole4shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1171                                        hole4shape->GetRmin(2));
1172   hole4shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1173                                        hole4shape->GetZ(2));
1174
1175   hole4shape->Rmin(3) = hole4shape->GetRmin(2);
1176   hole4shape->Rmax(3) = hole4shape->GetRmin(3);
1177   hole4shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1178                                        hole4shape->GetRmax(3));
1179
1180   // Debug if requested
1181   if (GetDebug(1)) {
1182     coneshape->InspectShape();
1183     coneinsertshape->InspectShape();
1184     conefoamshape->InspectShape();
1185     hole1shape->InspectShape();
1186     hole2shape->InspectShape();
1187   }
1188
1189
1190   // We have the shapes: now create the real volumes
1191
1192   TGeoVolume *cfcone = new TGeoVolume("SDDCarbonFiberCone",
1193                                       coneshape,medSDDcf);
1194   cfcone->SetVisibility(kTRUE);
1195   cfcone->SetLineColor(4); // Blue
1196   cfcone->SetLineWidth(1);
1197   cfcone->SetFillColor(cfcone->GetLineColor());
1198   cfcone->SetFillStyle(4000); // 0% transparent
1199
1200   TGeoVolume *cfconeinsert = new TGeoVolume("SDDCarbonFiberConeInsert",
1201                                             coneinsertshape,medSDDste);
1202   cfconeinsert->SetVisibility(kTRUE);
1203   cfconeinsert->SetLineColor(2); // Red
1204   cfconeinsert->SetLineWidth(1);
1205   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
1206   cfconeinsert->SetFillStyle(4050); // 50% transparent
1207
1208   TGeoVolume *cfconefoam = new TGeoVolume("SDDCarbonFiberConeFoam",
1209                                           conefoamshape,medSDDroh);
1210   cfconefoam->SetVisibility(kTRUE);
1211   cfconefoam->SetLineColor(7); // Light blue
1212   cfconefoam->SetLineWidth(1);
1213   cfconefoam->SetFillColor(cfconefoam->GetLineColor());
1214   cfconefoam->SetFillStyle(4050); // 50% transparent
1215
1216   TGeoVolume *hole1 = new TGeoVolume("SDDCableHole1",
1217                                      hole1shape,medSDDair);
1218   hole1->SetVisibility(kTRUE);
1219   hole1->SetLineColor(5); // Yellow
1220   hole1->SetLineWidth(1);
1221   hole1->SetFillColor(hole1->GetLineColor());
1222   hole1->SetFillStyle(4090); // 90% transparent
1223
1224   TGeoVolume *hole2 = new TGeoVolume("SDDCableHole2",
1225                                      hole2shape,medSDDair);
1226   hole2->SetVisibility(kTRUE);
1227   hole2->SetLineColor(5); // Yellow
1228   hole2->SetLineWidth(1);
1229   hole2->SetFillColor(hole2->GetLineColor());
1230   hole2->SetFillStyle(4090); // 90% transparent
1231
1232   TGeoVolume *hole3 = new TGeoVolume("SDDCableHole3",
1233                                      hole3shape,medSDDair);
1234   hole3->SetVisibility(kTRUE);
1235   hole3->SetLineColor(5); // Yellow
1236   hole3->SetLineWidth(1);
1237   hole3->SetFillColor(hole3->GetLineColor());
1238   hole3->SetFillStyle(4090); // 90% transparent
1239
1240   TGeoVolume *hole4 = new TGeoVolume("SDDCableHole4",
1241                                      hole4shape,medSDDair);
1242   hole4->SetVisibility(kTRUE);
1243   hole4->SetLineColor(5); // Yellow
1244   hole4->SetLineWidth(1);
1245   hole4->SetFillColor(hole4->GetLineColor());
1246   hole4->SetFillStyle(4090); // 90% transparent
1247
1248   // Mount up a cone
1249   cfconeinsert->AddNode(cfconefoam,1,0);
1250
1251   cfcone->AddNode(cfconeinsert,1,0);
1252
1253   for (Int_t i=0; i<12; i++) {
1254     Double_t phiH = i*30.0;
1255     cfcone->AddNode(hole1, i+1, new TGeoRotation("", 0, 0, phiH));
1256   }
1257
1258   for (Int_t i=0; i<6; i++) {
1259     Double_t phiH = i*60.0;
1260     cfcone->AddNode(hole2, i+1, new TGeoRotation("", 0, 0, phiH));
1261   }
1262
1263   for (Int_t i=0; i<kNHole3; i++) {
1264     Double_t phiH0 = 360./(Double_t)kNHole3;
1265     Double_t phiH  = i*phiH0 + 0.5*phiH0;
1266     cfcone->AddNode(hole3, i+1, new TGeoRotation("", phiH, 0, 0));
1267   }
1268 /*
1269   for (Int_t i=0; i<kNHole4; i++) {
1270     Double_t phiH0 = 360./(Double_t)kNHole4;
1271     Double_t phiH  = i*phiH0 + 0.25*phiH0;
1272     cfcone->AddNode(hole4, i+1, new TGeoRotation("", phiH, 0, 0));
1273   }
1274 */
1275   // Finally put everything in the mother volume
1276   moth->AddNode(cfcylinder,1,0);
1277
1278   z = coneshape->Z(9);
1279   moth->AddNode(cfcone,1,new TGeoTranslation(0, 0, -z - kCylinderHalfLength));
1280   moth->AddNode(cfcone,2,new TGeoCombiTrans (0, 0,  z + kCylinderHalfLength,
1281                          new TGeoRotation("", 0, 180, 0)                   ));
1282
1283
1284   return;
1285 }
1286
1287 //______________________________________________________________________
1288 void AliITSv11GeometrySupport::SSDCone(TGeoVolume *moth,TGeoManager *mgr)
1289 {
1290 //
1291 // Creates the SSD support cone and cylinder geometry. as a
1292 // volume assembly and adds it to the mother volume
1293 // (part of this code is taken or anyway inspired to SSDCone method
1294 // of AliITSv11GeometrySupport.cxx,v 1.9 2007/06/06)
1295 //
1296 // Input:
1297 //         moth : the TGeoVolume owing the volume structure
1298 //         mgr  : the GeoManager (default gGeoManager)
1299 // Output:
1300 //
1301 // Created:         ???       Bjorn S. Nilsen
1302 // Updated:      08 Mar 2008  Mario Sitta
1303 //
1304 // Technical data are taken from:  "ITS Supporto Generale" (technical
1305 // drawings ALR3-0743/1, ALR3-0743/1A and ALR3-0743/1B), "Supporto Generale
1306 // Settore SSD" (technical drawings ALR3-0743/2A and ALR3-0743/2E), private
1307 // communication with B. Giraudo
1308
1309   // Dimensions of the Central cylinder and flanges
1310   const Double_t kCylinderHalfLength   = (1144.0/2) *fgkmm;
1311   const Double_t kCylinderOuterRadius  = ( 595.0/2) *fgkmm;
1312   const Double_t kCylinderThickness    =        0.6 *fgkmm;
1313   const Double_t kFoamHalfLength       = (1020.0/2) *fgkmm;
1314   const Double_t kFoamThickness        =        5.0 *fgkmm;
1315   const Double_t kFlangeHalfLength     =
1316                                       (kCylinderHalfLength-kFoamHalfLength)/2.;
1317   const Double_t kFlangeInnerRadius    = ( 563.0/2) *fgkmm;
1318   // Dimensions of the Cone
1319   const Double_t kConeROuterMin        = ( 945.0/2) *fgkmm;
1320   const Double_t kConeROuterMax        = ( 985.0/2) *fgkmm;
1321   const Double_t kConeRInnerMin        = ( 564.0/2) *fgkmm;
1322   const Double_t kConeRCurv1           =       10.0 *fgkmm;
1323   const Double_t kConeRCurv2           =       25.0 *fgkmm;
1324   const Double_t kConeCent1RCurv2      = ( 578.0/2) *fgkmm;
1325   const Double_t kConeCent2RCurv2      = ( 593.0/2) *fgkmm;
1326   const Double_t kConeZOuterRing       =       47.0 *fgkmm;
1327   const Double_t kConeZOuterRingInside =       30.25*fgkmm;
1328   const Double_t kConeZInnerRing       =      161.5 *fgkmm;
1329   const Double_t kConeZLength          =      176.5 *fgkmm;
1330   const Double_t kConeZPosition        = kConeZLength + kCylinderHalfLength;
1331   const Double_t kConeThickness        =       13.0 *fgkmm; // Cone thickness
1332   const Double_t kConeTheta            =       39.0 *fgkDegree; // Cone angle
1333   const Double_t kSinConeTheta         =
1334                                       TMath::Sin(kConeTheta*TMath::DegToRad());
1335   const Double_t kCosConeTheta         =
1336                                       TMath::Cos(kConeTheta*TMath::DegToRad());
1337   // Dimensions of the Foam cores
1338   const Double_t kConeFoam1Length      =      112.3 *fgkmm;
1339   const Double_t kConeFoam2Length      =       58.4 *fgkmm;
1340   // Dimensions of the Cone Holes
1341   const Double_t kCoolingHoleWidth     =       40.0 *fgkmm;
1342   const Double_t kCoolingHoleHight     =       30.0 *fgkmm;
1343   const Double_t kCoolingHoleRmin      =      350.0 *fgkmm;
1344   const Double_t kCoolingHolePhi       =       45.0 *fgkDegree;
1345   const Double_t kMountingHoleWidth    =       20.0 *fgkmm;
1346   const Double_t kMountingHoleHight    =       20.0 *fgkmm;
1347   const Double_t kMountingHoleRmin     =      317.5 *fgkmm;
1348   const Double_t kMountingHolePhi      =       60.0 *fgkDegree;
1349   const Double_t kCableHoleRin         = ( 800.0/2) *fgkmm;
1350   const Double_t kCableHoleRout        = ( 920.0/2) *fgkmm;
1351   const Double_t kCableHoleWidth       =      200.0 *fgkmm;
1352 //  const Double_t kCableHoleAngle       =       42.0 *fgkDegree;
1353   // Dimensions of the Cone Wings
1354   const Double_t kWingRmax             =      527.5 *fgkmm;
1355   const Double_t kWingWidth            =       70.0 *fgkmm;
1356   const Double_t kWingHalfThick        = (  10.0/2) *fgkmm;
1357   const Double_t kThetaWing            =       45.0 *fgkDegree;
1358   // Dimensions of the SSD-SDD Mounting Brackets
1359   const Double_t kBracketRmin          = ( 540.0/2) *fgkmm;// See SDD ROutMin
1360   const Double_t kBracketRmax          = ( 585.0/2) *fgkmm;
1361   const Double_t kBracketHalfLength    = (   4.0/2) *fgkmm;
1362   const Double_t kBracketPhi           = (70.*fgkmm/kBracketRmax)*fgkRadian;
1363   // Common data
1364   const Double_t kCFThickness          =        0.75*fgkmm; //Carb. fib. thick.
1365
1366
1367   // Local variables
1368   Double_t rmin1, rmin2, rmax, z;
1369
1370   //
1371   //Begin_Html
1372   /*
1373     <img src="picts/ITS/file_name.gif">
1374     <P>
1375     <FONT FACE'"TIMES">
1376     ITS SSD central support and thermal shield cylinder.
1377     </FONT>
1378     </P>
1379   */
1380   //End_Html
1381   //
1382
1383   // Central cylinder with its internal foam and the lateral flanges:
1384   // a carbon fiber Pcon which contains a rohacell Tube and two
1385   // stesalite Cone's
1386   TGeoPcon *externalcylshape = new TGeoPcon(0,360,4);
1387
1388   rmax  = kCylinderOuterRadius;
1389   rmin1 = kFlangeInnerRadius - kCylinderThickness;
1390   rmin2 = rmax - 2*kCylinderThickness - kFoamThickness;
1391   externalcylshape->DefineSection(0,-kCylinderHalfLength,rmin1,rmax);
1392   externalcylshape->DefineSection(1,-kFoamHalfLength    ,rmin2,rmax);
1393   externalcylshape->DefineSection(2, kFoamHalfLength    ,rmin2,rmax);
1394   externalcylshape->DefineSection(3, kCylinderHalfLength,rmin1,rmax);
1395
1396   rmax  = kCylinderOuterRadius - kCylinderThickness;
1397   rmin1 = rmax - kFoamThickness;
1398   TGeoTube *foamshape = new TGeoTube(rmin1,rmax,kFoamHalfLength);
1399
1400   rmax  = kCylinderOuterRadius - kCylinderThickness;
1401   rmin1 = rmax - kFoamThickness;
1402   rmin2 = kFlangeInnerRadius;
1403   TGeoCone *flangeshape = new TGeoCone(kFlangeHalfLength,
1404                                        rmin1,rmax,rmin2,rmax);
1405
1406
1407   // We have the shapes: now create the real volumes
1408
1409   TGeoMedium *medSSDcf  = mgr->GetMedium("ITS_SSD C (M55J)$");
1410   TGeoMedium *medSSDair = mgr->GetMedium("ITS_SSD AIR$");
1411   TGeoMedium *medSSDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
1412   TGeoMedium *medSSDroh = mgr->GetMedium("ITS_ROHACELL$");
1413   TGeoMedium *medSSDal  = mgr->GetMedium("ITS_ALUMINUM$");
1414
1415   TGeoVolume *cfcylinder = new TGeoVolume("SSDexternalcylinder",
1416                                            externalcylshape,medSSDcf);
1417   cfcylinder->SetVisibility(kTRUE);
1418   cfcylinder->SetLineColor(4); // blue
1419   cfcylinder->SetLineWidth(1);
1420   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
1421   cfcylinder->SetFillStyle(4000); // 0% transparent
1422
1423   TGeoVolume *foamcylinder = new TGeoVolume("SSDfoamcylinder",
1424                                             foamshape,medSSDroh);
1425   foamcylinder->SetVisibility(kTRUE);
1426   foamcylinder->SetLineColor(3); // green
1427   foamcylinder->SetLineWidth(1);
1428   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
1429   foamcylinder->SetFillStyle(4050); // 50% transparent
1430
1431   TGeoVolume *flangecylinder = new TGeoVolume("SSDflangecylinder",
1432                                               flangeshape,medSSDste);
1433   flangecylinder->SetVisibility(kTRUE);
1434   flangecylinder->SetLineColor(2); // red
1435   flangecylinder->SetLineWidth(1);
1436   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
1437   flangecylinder->SetFillStyle(4050); // 50% transparent
1438
1439   // Mount up the cylinder
1440   cfcylinder->AddNode(foamcylinder,1,0);
1441   cfcylinder->AddNode(flangecylinder,1,
1442               new TGeoTranslation(0, 0, kFoamHalfLength+kFlangeHalfLength));
1443   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
1444               0, 0, -kFoamHalfLength-kFlangeHalfLength,
1445               new TGeoRotation("",0,180,0)     ) );
1446
1447
1448   // The whole Cone as an assembly
1449   TGeoVolumeAssembly *vC = new TGeoVolumeAssembly("ITSssdCone");
1450
1451
1452   // SSD Support Cone with its internal inserts: a carbon fiber Pcon
1453   // with holes which contains a stesalite Pcon which on turn contains a
1454   // rohacell Pcon
1455   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 12);
1456
1457   coneshape->Z(0)     = 0.0;
1458   coneshape->Rmin(0)  = kConeROuterMin;
1459   coneshape->Rmax(0)  = kConeROuterMax;
1460
1461   coneshape->Z(1)     = kConeZOuterRingInside - kConeRCurv1;
1462   coneshape->Rmin(1)  = coneshape->GetRmin(0);
1463   coneshape->Rmax(1)  = coneshape->GetRmax(0);
1464
1465   coneshape->Z(2)     = kConeZOuterRingInside;
1466   coneshape->Rmin(2)  = coneshape->GetRmin(1) - kConeRCurv1;
1467   coneshape->Rmax(2)  = coneshape->GetRmax(0);
1468
1469   coneshape->Z(3)     = coneshape->GetZ(2);
1470   coneshape->Rmax(3)  = coneshape->GetRmax(0);
1471
1472   coneshape->Z(4)     = kConeZOuterRing - kConeRCurv1;
1473   coneshape->Rmax(4)  = coneshape->GetRmax(0);
1474
1475   coneshape->Z(5)     = kConeZOuterRing;
1476   coneshape->Rmax(5)  = coneshape->GetRmax(4) - kConeRCurv1;
1477
1478   coneshape->Z(6)     = coneshape->GetZ(5);
1479
1480   RadiusOfCurvature(kConeRCurv2,90.0,kConeZInnerRing,kConeCent1RCurv2,
1481                     90.0-kConeTheta,z,rmin1);
1482   coneshape->Z(7)     = z;
1483   coneshape->Rmin(7)  = rmin1;
1484
1485   coneshape->Rmin(3)  = RminFromZpCone(coneshape,7,90.-kConeTheta,
1486                                        coneshape->GetZ(3));
1487
1488   coneshape->Rmin(4)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(4));
1489
1490   coneshape->Rmin(5)  = RminFrom2Points(coneshape,3,7,coneshape->GetZ(5));
1491
1492   coneshape->Rmin(6) = coneshape->GetRmin(5);
1493
1494   coneshape->Z(8)     = kConeZInnerRing;
1495   coneshape->Rmin(8)  = kConeCent1RCurv2;
1496
1497   coneshape->Z(9)     = coneshape->GetZ(8);
1498   coneshape->Rmin(9)  = kConeRInnerMin;
1499
1500   RadiusOfCurvature(kConeRCurv2,90.0,kConeZLength,kConeCent2RCurv2,
1501                     90.0-kConeTheta,z,rmax);
1502
1503   coneshape->Z(10)    = z;
1504   coneshape->Rmin(10) = coneshape->GetRmin(9);
1505   coneshape->Rmax(10) = rmax;
1506
1507   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,10,90.-kConeTheta,
1508                                        coneshape->GetZ(6));
1509
1510   coneshape->Rmax(7)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(7));
1511
1512   coneshape->Rmax(8)  = RmaxFrom2Points(coneshape,6,10,coneshape->GetZ(8));
1513
1514   coneshape->Rmax(9)  = coneshape->GetRmax(8);
1515
1516   coneshape->Z(11)    = kConeZLength;
1517   coneshape->Rmin(11) = coneshape->GetRmin(10);
1518   coneshape->Rmax(11) = kConeCent2RCurv2;
1519
1520   // SSD Cone Insert: another Pcon
1521   Double_t x0, y0, x1, y1, x2, y2;
1522   TGeoPcon *coneinsertshape = new TGeoPcon(0.0,360.0,12);
1523
1524   coneinsertshape->Z(0)     = coneshape->GetZ(0) + kCFThickness;
1525   coneinsertshape->Rmin(0)  = coneshape->GetRmin(0) + kCFThickness;
1526   coneinsertshape->Rmax(0)  = coneshape->GetRmax(0) - kCFThickness;
1527
1528   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
1529   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
1530   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
1531   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
1532   coneinsertshape->Z(1)     = z;
1533   coneinsertshape->Rmin(1)  = rmin1;
1534   coneinsertshape->Rmax(1)  = coneinsertshape->GetRmax(0);
1535
1536   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmin(1);
1537   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmin(2);
1538   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmin(3);
1539   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
1540   coneinsertshape->Z(2)     = z;
1541   coneinsertshape->Rmin(2)  = rmin1;
1542   coneinsertshape->Rmax(2)  = coneinsertshape->GetRmax(1);
1543
1544   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
1545   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
1546   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
1547   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
1548   coneinsertshape->Z(3)     = z;
1549   coneinsertshape->Rmin(3)  = rmin1;
1550   coneinsertshape->Rmax(3)  = coneinsertshape->GetRmax(2);
1551
1552   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
1553   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
1554   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
1555   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
1556   coneinsertshape->Z(4)     = z;
1557   coneinsertshape->Rmax(4)  = rmax;
1558
1559   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmax(4);
1560   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmax(5);
1561   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmax(6);
1562   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
1563   coneinsertshape->Z(5)     = z;
1564   coneinsertshape->Rmax(5)  = rmax;
1565
1566   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmax(5);
1567   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmax(6);
1568   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmax(7);
1569   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
1570   coneinsertshape->Z(6)     = z;
1571   coneinsertshape->Rmax(6)  = rmax;
1572
1573   x0 = coneshape->GetZ(6); y0 = coneshape->GetRmin(6);
1574   x1 = coneshape->GetZ(7); y1 = coneshape->GetRmin(7);
1575   x2 = coneshape->GetZ(8); y2 = coneshape->GetRmin(8);
1576   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
1577   coneinsertshape->Z(7)     = z;
1578   coneinsertshape->Rmin(7)  = rmin1;
1579
1580   coneinsertshape->Rmin(4)  = RminFrom2Points(coneinsertshape,3,7,
1581                                               coneinsertshape->GetZ(4));
1582
1583   coneinsertshape->Rmin(5)  = RminFrom2Points(coneinsertshape,3,7,
1584                                               coneinsertshape->GetZ(5));
1585
1586   coneinsertshape->Rmin(6)  = coneinsertshape->GetRmin(5);
1587
1588   x0 = coneshape->GetZ(7); y0 = coneshape->GetRmin(7);
1589   x1 = coneshape->GetZ(8); y1 = coneshape->GetRmin(8);
1590   x2 = coneshape->GetZ(9); y2 = coneshape->GetRmin(9);
1591   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
1592   coneinsertshape->Z(8)     = z;
1593   coneinsertshape->Rmin(8)  = rmin1;
1594
1595   x0 = coneshape->GetZ( 8); y0 = coneshape->GetRmin( 8);
1596   x1 = coneshape->GetZ( 9); y1 = coneshape->GetRmin( 9);
1597   x2 = coneshape->GetZ(10); y2 = coneshape->GetRmin(10);
1598   InsidePoint(x0, y0, x1, y1, x2, y2,  kCFThickness, z, rmin1);
1599   coneinsertshape->Z(9)     = z;
1600   coneinsertshape->Rmin(9)  = rmin1;
1601
1602   x0 = coneshape->GetZ( 9); y0 = coneshape->GetRmax( 9);
1603   x1 = coneshape->GetZ(10); y1 = coneshape->GetRmax(10);
1604   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmax(11);
1605   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
1606   coneinsertshape->Z(10)    = z;
1607   coneinsertshape->Rmax(10) = rmax;
1608   coneinsertshape->Rmin(10) = coneinsertshape->GetRmin(9);
1609
1610   coneinsertshape->Rmax(7)  = RmaxFrom2Points(coneinsertshape,6,10,
1611                                               coneinsertshape->GetZ(7));
1612
1613   coneinsertshape->Rmax(8)  = RmaxFrom2Points(coneinsertshape,6,10,
1614                                               coneinsertshape->GetZ(8));
1615
1616   coneinsertshape->Rmax(9)  = coneinsertshape->GetRmax(8);
1617
1618   x0 = coneshape->GetZ(10); y0 = coneshape->GetRmax(10);
1619   x1 = coneshape->GetZ(11); y1 = coneshape->GetRmax(11);
1620   x2 = coneshape->GetZ(11); y2 = coneshape->GetRmin(11);
1621   InsidePoint(x0, y0, x1, y1, x2, y2, -kCFThickness, z, rmax);
1622   coneinsertshape->Z(11)    = z;
1623   coneinsertshape->Rmax(11) = rmax;
1624   coneinsertshape->Rmin(11) = coneinsertshape->GetRmin(10);
1625
1626   // SSD Cone Foams: two other Pcon's
1627   TGeoPcon *conefoam1shape = new TGeoPcon(0.0, 360.0, 4);
1628
1629   conefoam1shape->Z(0)    = coneinsertshape->GetZ(3);
1630   conefoam1shape->Rmin(0) = coneinsertshape->GetRmin(3);
1631   conefoam1shape->Rmax(0) = conefoam1shape->GetRmin(0);
1632
1633   conefoam1shape->Rmax(1) = conefoam1shape->GetRmax(0);
1634   conefoam1shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
1635                                            conefoam1shape->GetRmax(1));
1636   conefoam1shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
1637                                            conefoam1shape->GetZ(1));
1638
1639   Double_t t = kConeThickness - 2*kCFThickness;
1640   conefoam1shape->Rmin(2) = conefoam1shape->GetRmax(0) -
1641                            (kConeFoam1Length*kCosConeTheta - t*kSinConeTheta);
1642   conefoam1shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
1643                                            conefoam1shape->GetRmin(2));
1644   conefoam1shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
1645                                            conefoam1shape->GetZ(2));
1646
1647   conefoam1shape->Rmin(3) = conefoam1shape->GetRmin(2);
1648   conefoam1shape->Rmax(3) = conefoam1shape->GetRmin(3);
1649   conefoam1shape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
1650                                            conefoam1shape->GetRmax(3));
1651
1652   TGeoPcon *conefoam2shape = new TGeoPcon(0.0, 360.0, 4);
1653
1654   conefoam2shape->Z(3)    = coneinsertshape->GetZ(10);
1655   conefoam2shape->Rmin(3) = coneinsertshape->GetRmax(10);
1656   conefoam2shape->Rmax(3) = conefoam2shape->GetRmin(3);
1657
1658   conefoam2shape->Rmin(2) = conefoam2shape->GetRmin(3);
1659   conefoam2shape->Z(2)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
1660                                            conefoam2shape->GetRmin(2));
1661   conefoam2shape->Rmax(2) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
1662                                            conefoam2shape->GetZ(2));
1663
1664   conefoam2shape->Rmin(0) = conefoam2shape->GetRmax(2) +
1665                            (kConeFoam2Length*kCosConeTheta - t*kSinConeTheta);
1666   conefoam2shape->Rmax(0) = conefoam2shape->GetRmin(0);
1667   conefoam2shape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
1668                                            conefoam2shape->GetRmin(0));
1669
1670   conefoam2shape->Rmax(1) = conefoam2shape->GetRmax(0);
1671   conefoam2shape->Z(1)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
1672                                            conefoam2shape->GetRmax(1));
1673   conefoam2shape->Rmin(1) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
1674                                            conefoam2shape->GetZ(1));
1675
1676   // SSD Cone Holes: Pcon's
1677   Double_t holePhi;
1678   holePhi = (kCoolingHoleWidth/kCoolingHoleRmin)*TMath::RadToDeg();
1679
1680   TGeoPcon *coolingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
1681
1682   coolingholeshape->Rmin(0) = kCoolingHoleRmin + kCoolingHoleHight;
1683   coolingholeshape->Rmax(0) = coolingholeshape->GetRmin(0);
1684   coolingholeshape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
1685                                              coolingholeshape->GetRmin(0));
1686
1687   coolingholeshape->Rmax(1) = coolingholeshape->GetRmax(0);
1688   coolingholeshape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
1689                                              coolingholeshape->GetRmax(1));
1690   coolingholeshape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
1691                                              coolingholeshape->GetZ(1));
1692
1693   coolingholeshape->Rmin(2) = kCoolingHoleRmin;
1694   coolingholeshape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
1695                                              coolingholeshape->GetRmin(2));
1696   coolingholeshape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
1697                                              coolingholeshape->GetZ(2));
1698
1699   coolingholeshape->Rmin(3) = coolingholeshape->GetRmin(2);
1700   coolingholeshape->Rmax(3) = coolingholeshape->GetRmin(3);
1701   coolingholeshape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
1702                                              coolingholeshape->GetRmax(3));
1703
1704   // This is really weird: a single mountinghole volume gives an overlap
1705   // with coneinsert (why doesn't coolinghole ?), so three contiguous
1706   // volumes are created: one to be put in coneinsert and two in the cone
1707   // carbon fiber envelope
1708   holePhi = (kMountingHoleWidth/kMountingHoleRmin)*TMath::RadToDeg();
1709
1710   TGeoPcon *mountingholeshape = new TGeoPcon(-holePhi/2., holePhi, 4);
1711
1712   mountingholeshape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
1713   mountingholeshape->Rmax(0) = mountingholeshape->GetRmin(0);
1714   mountingholeshape->Z(0)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
1715                                               mountingholeshape->GetRmin(0));
1716
1717   mountingholeshape->Rmin(1) = kMountingHoleRmin;
1718   mountingholeshape->Rmax(1) = mountingholeshape->GetRmax(0);
1719   mountingholeshape->Z(1)    = ZFromRminpCone(coneinsertshape,3,90.-kConeTheta,
1720                                               mountingholeshape->GetRmin(1));
1721
1722   mountingholeshape->Rmin(2) = mountingholeshape->GetRmin(1);
1723   mountingholeshape->Rmax(2) = mountingholeshape->GetRmax(1);
1724   mountingholeshape->Z(2)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
1725                                               mountingholeshape->GetRmax(2));
1726
1727   mountingholeshape->Rmin(3) = mountingholeshape->GetRmin(2);
1728   mountingholeshape->Rmax(3) = mountingholeshape->GetRmin(3);
1729   mountingholeshape->Z(3)    = ZFromRmaxpCone(coneinsertshape,7,90.-kConeTheta,
1730                                               mountingholeshape->GetRmax(3));
1731
1732   TGeoPcon *mountinghole2shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1733
1734   mountinghole2shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
1735   mountinghole2shape->Rmax(0) = mountingholeshape->GetRmin(0);
1736   mountinghole2shape->Z(0)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
1737                                                mountinghole2shape->GetRmin(0));
1738
1739   mountinghole2shape->Rmax(1) = mountinghole2shape->GetRmax(0);
1740   mountinghole2shape->Z(1)    = mountingholeshape->Z(0);
1741   mountinghole2shape->Rmin(1) = RminFromZpCone(coneshape,3,90.-kConeTheta,
1742                                                mountinghole2shape->GetZ(1));
1743
1744   mountinghole2shape->Rmin(2) = kMountingHoleRmin;
1745   mountinghole2shape->Z(2)    = ZFromRminpCone(coneshape,3,90.-kConeTheta,
1746                                                mountinghole2shape->GetRmin(2));
1747   mountinghole2shape->Rmax(2) = RminFromZpCone(coneinsertshape,3,90.-kConeTheta,
1748                                                mountinghole2shape->GetZ(2));
1749
1750   mountinghole2shape->Rmin(3) = mountinghole2shape->Rmin(2);
1751   mountinghole2shape->Rmax(3) = mountinghole2shape->Rmin(3);
1752   mountinghole2shape->Z(3)    = mountingholeshape->Z(1);
1753
1754   TGeoPcon *mountinghole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1755
1756   mountinghole3shape->Rmin(0) = kMountingHoleRmin + kMountingHoleHight;
1757   mountinghole3shape->Rmax(0) = mountingholeshape->GetRmin(0);
1758   mountinghole3shape->Z(0)    = mountingholeshape->GetZ(2);
1759
1760   mountinghole3shape->Rmax(1) = mountinghole3shape->GetRmax(0);
1761   mountinghole3shape->Z(1)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
1762                                                mountinghole3shape->GetRmax(1));
1763   mountinghole3shape->Rmin(1) = RmaxFromZpCone(coneinsertshape,7,90.-kConeTheta,
1764                                                mountinghole3shape->GetZ(1));
1765
1766   mountinghole3shape->Rmin(2) = kMountingHoleRmin;
1767   mountinghole3shape->Z(2)    = mountingholeshape->Z(3);
1768   mountinghole3shape->Rmax(2) = RmaxFromZpCone(coneshape,7,90.-kConeTheta,
1769                                                mountinghole3shape->GetZ(2));
1770
1771   mountinghole3shape->Rmin(3) = mountinghole3shape->Rmin(2);
1772   mountinghole3shape->Rmax(3) = mountinghole3shape->Rmin(3);
1773   mountinghole3shape->Z(3)    = ZFromRmaxpCone(coneshape,7,90.-kConeTheta,
1774                                                mountinghole3shape->GetRmax(3));
1775
1776   // The Cable Hole is even more complicated, a Composite Shape
1777   // is unavoidable here (gosh!)
1778   TGeoPcon *coneshapecopy = new TGeoPcon("conecopy",0.0, 360.0, 12);
1779
1780   for (Int_t i=0; i<12; i++) {
1781     coneshapecopy->Rmin(i) = coneshape->GetRmin(i);
1782     coneshapecopy->Rmax(i) = coneshape->GetRmax(i);
1783     coneshapecopy->Z(i)    = coneshape->GetZ(i);
1784   }
1785
1786   holePhi = (kCableHoleWidth/kCableHoleRout)*TMath::RadToDeg();
1787   TGeoConeSeg *chCS = new TGeoConeSeg("chCS", 0.5*kConeZLength,
1788                                       kCableHoleRin, kCableHoleRout,
1789                                       kCableHoleRin, kCableHoleRout,
1790                                       -0.5*holePhi, 0.5*holePhi);
1791
1792   TGeoCompositeShape *cableholeshape = new TGeoCompositeShape(
1793                                            "SSDCableHoleShape",
1794                                            "conecopy*chCS");
1795
1796   if(GetDebug(1)){
1797     chCS->InspectShape();
1798     cableholeshape->InspectShape();
1799   }
1800
1801   // SSD Cone Wings: Tube and TubeSeg shapes
1802   Double_t angleWideWing, angleWideWingThickness;
1803   angleWideWing = (kWingWidth/kWingRmax)*TMath::RadToDeg();
1804   angleWideWingThickness = (kCFThickness/kWingRmax)*TMath::RadToDeg();
1805
1806   TGeoTubeSeg *wingshape = new TGeoTubeSeg(kConeROuterMax, kWingRmax,
1807                                            kWingHalfThick,
1808                                            0, angleWideWing);
1809
1810   TGeoTubeSeg *winginsertshape = new TGeoTubeSeg(kConeROuterMax,
1811                                  kWingRmax-kCFThickness,
1812                                  kWingHalfThick-kCFThickness,
1813                                  angleWideWingThickness,
1814                                  angleWideWing-angleWideWingThickness);
1815
1816   // SDD support plate, SSD side (Mounting Bracket): a TubeSeg
1817   TGeoTubeSeg *bracketshape = new TGeoTubeSeg(kBracketRmin, kBracketRmax,
1818                             kBracketHalfLength, -kBracketPhi/2, kBracketPhi/2);
1819
1820
1821   // We have the shapes: now create the real volumes
1822
1823   TGeoVolume *cfcone = new TGeoVolume("SSDCarbonFiberCone",
1824                                       coneshape,medSSDcf);
1825   cfcone->SetVisibility(kTRUE);
1826   cfcone->SetLineColor(4); // Blue
1827   cfcone->SetLineWidth(1);
1828   cfcone->SetFillColor(cfcone->GetLineColor());
1829   cfcone->SetFillStyle(4000); // 0% transparent
1830
1831   TGeoVolume *cfconeinsert = new TGeoVolume("SSDCarbonFiberConeInsert",
1832                                             coneinsertshape,medSSDste);
1833   cfconeinsert->SetVisibility(kTRUE);
1834   cfconeinsert->SetLineColor(2); // Red
1835   cfconeinsert->SetLineWidth(1);
1836   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
1837   cfconeinsert->SetFillStyle(4050); // 50% transparent
1838
1839   TGeoVolume *cfconefoam1 = new TGeoVolume("SSDCarbonFiberConeFoam1",
1840                                             conefoam1shape,medSSDroh);
1841   cfconefoam1->SetVisibility(kTRUE);
1842   cfconefoam1->SetLineColor(3); // Green
1843   cfconefoam1->SetLineWidth(1);
1844   cfconefoam1->SetFillColor(cfconefoam1->GetLineColor());
1845   cfconefoam1->SetFillStyle(4050); // 50% transparent
1846
1847   TGeoVolume *cfconefoam2 = new TGeoVolume("SSDCarbonFiberConeFoam2",
1848                                             conefoam2shape,medSSDroh);
1849   cfconefoam2->SetVisibility(kTRUE);
1850   cfconefoam2->SetLineColor(3); // Green
1851   cfconefoam2->SetLineWidth(1);
1852   cfconefoam2->SetFillColor(cfconefoam2->GetLineColor());
1853   cfconefoam2->SetFillStyle(4050); // 50% transparent
1854
1855   TGeoVolume *coolinghole = new TGeoVolume("SSDCoolingHole",
1856                                            coolingholeshape,medSSDair);
1857   coolinghole->SetVisibility(kTRUE);
1858   coolinghole->SetLineColor(5); // Yellow
1859   coolinghole->SetLineWidth(1);
1860   coolinghole->SetFillColor(coolinghole->GetLineColor());
1861   coolinghole->SetFillStyle(4090); // 90% transparent
1862
1863   TGeoVolume *mountinghole = new TGeoVolume("SSDMountingHole",
1864                                             mountingholeshape,medSSDair);
1865   mountinghole->SetVisibility(kTRUE);
1866   mountinghole->SetLineColor(5); // Yellow
1867   mountinghole->SetLineWidth(1);
1868   mountinghole->SetFillColor(mountinghole->GetLineColor());
1869   mountinghole->SetFillStyle(4090); // 90% transparent
1870
1871   TGeoVolume *mountinghole2 = new TGeoVolume("SSDMountingHole2",
1872                                              mountinghole2shape,medSSDair);
1873   mountinghole2->SetVisibility(kTRUE);
1874   mountinghole2->SetLineColor(5); // Yellow
1875   mountinghole2->SetLineWidth(1);
1876   mountinghole2->SetFillColor(mountinghole2->GetLineColor());
1877   mountinghole2->SetFillStyle(4090); // 90% transparent
1878
1879   TGeoVolume *mountinghole3 = new TGeoVolume("SSDMountingHole3",
1880                                              mountinghole3shape,medSSDair);
1881   mountinghole3->SetVisibility(kTRUE);
1882   mountinghole3->SetLineColor(5); // Yellow
1883   mountinghole3->SetLineWidth(1);
1884   mountinghole3->SetFillColor(mountinghole3->GetLineColor());
1885   mountinghole3->SetFillStyle(4090); // 90% transparent
1886
1887   TGeoVolume *wing = new TGeoVolume("SSDWing",wingshape,medSSDcf);
1888   wing->SetVisibility(kTRUE);
1889   wing->SetLineColor(4); // Blue
1890   wing->SetLineWidth(1);
1891   wing->SetFillColor(wing->GetLineColor());
1892   wing->SetFillStyle(4000); // 0% transparent
1893
1894   TGeoVolume *cablehole = new TGeoVolume("SSDCableHole",
1895                                          cableholeshape,medSSDair);
1896   cablehole->SetVisibility(kTRUE);
1897   cablehole->SetLineColor(5); // Yellow
1898   cablehole->SetLineWidth(1);
1899   cablehole->SetFillColor(cablehole->GetLineColor());
1900   cablehole->SetFillStyle(4090); // 90% transparent
1901
1902   TGeoVolume *winginsert = new TGeoVolume("SSDWingInsert",
1903                                           winginsertshape,medSSDste);
1904   winginsert->SetVisibility(kTRUE);
1905   winginsert->SetLineColor(2); // Red
1906   winginsert->SetLineWidth(1);
1907   winginsert->SetFillColor(winginsert->GetLineColor());
1908   winginsert->SetFillStyle(4050); // 50% transparent
1909
1910   TGeoVolume *bracket = new TGeoVolume("SSDMountingBracket",
1911                                        bracketshape,medSSDal);
1912   bracket->SetVisibility(kTRUE);
1913   bracket->SetLineColor(6); // Purple
1914   bracket->SetLineWidth(1);
1915   bracket->SetFillColor(bracket->GetLineColor());
1916   bracket->SetFillStyle(4000); // 0% transparent
1917
1918   // Mount up a cone
1919   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
1920     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
1921     cfconefoam2->AddNode(mountinghole,i+1, new TGeoRotation("", phiH, 0, 0));
1922   }
1923
1924   cfconeinsert->AddNode(cfconefoam1,1,0);
1925   cfconeinsert->AddNode(cfconefoam2,1,0);
1926
1927   cfcone->AddNode(cfconeinsert,1,0);
1928
1929   for (Int_t i=0; i<(Int_t)(360./kCoolingHolePhi); i++) {
1930     Double_t phiH = i*kCoolingHolePhi + 0.5*kCoolingHolePhi;
1931     cfcone->AddNode(coolinghole,i+1, new TGeoRotation("", phiH, 0, 0));
1932     cfcone->AddNodeOverlap(cablehole,i+1, new TGeoRotation("", phiH, 0, 0));
1933   }
1934
1935   for (Int_t i=0; i<(Int_t)(360./kMountingHolePhi); i++) {
1936     Double_t phiH = i*kMountingHolePhi + 0.5*kMountingHolePhi;
1937     cfcone->AddNode(mountinghole2,i+1, new TGeoRotation("", phiH, 0, 0));
1938     cfcone->AddNode(mountinghole3,i+1, new TGeoRotation("", phiH, 0, 0));
1939   }
1940
1941   wing->AddNode(winginsert,1,0);
1942
1943   // Add all volumes in the Cone assembly
1944   vC->AddNode(cfcone,1,new TGeoTranslation(0,0,-kConeZPosition));
1945
1946   for (Int_t i=0; i<4; i++) {
1947     Double_t thetaW = kThetaWing + 90.*i;
1948     vC->AddNode(wing, i+1, new TGeoCombiTrans(0, 0, -kConeZPosition, 
1949                            new TGeoRotation("",thetaW,180,0)));
1950   }
1951
1952   Double_t zBracket = kConeZPosition - coneshape->GetZ(9) +
1953                       bracketshape->GetDz();
1954   for (Int_t i=0; i<3; i++) {
1955     Double_t thetaB = 60 + 120.*i;
1956     vC->AddNode(bracket, i+1, new TGeoCombiTrans(0, 0, -zBracket,
1957                               new TGeoRotation("",thetaB,0,0)));
1958   }
1959
1960   // Finally put everything in the mother volume
1961   moth->AddNode(cfcylinder,1,0);
1962
1963   moth->AddNode(vC, 1, 0 );
1964   moth->AddNode(vC, 2, new TGeoRotation("",180, 180, 0) );
1965
1966   // Some debugging if requested
1967   if(GetDebug(1)){
1968     vC->PrintNodes();
1969     vC->InspectShape();
1970   }
1971
1972   return;
1973 }
1974
1975 //______________________________________________________________________
1976 void AliITSv11GeometrySupport::ServicesCableSupport(TGeoVolume *moth,
1977                                                     TGeoManager *mgr){
1978     // Define the detail ITS cable support trays on both the RB24 and 
1979     // RB26 sides..
1980     // Inputs:
1981     //   TGeoVolume  *moth  The mother volume to place this object.
1982     //   TGeoManager *mgr   A pointer to the Geo-Manager default gGeoManager
1983     // Outputs:
1984     //  none.
1985     // Return:
1986     //  none.
1987     // Based on the Drawings SSup_201A.jpg unless otherwise stated, 
1988     // Volumes A..., 
1989     TGeoMedium *medSUPcf    = 0; // SUP support cone Carbon Fiber materal nbr.
1990     TGeoMedium *medSUPfs    = 0; // SUP support cone inserto stesalite 4411w.
1991     TGeoMedium *medSUPfo    = 0; // SUP support cone foam, Rohacell 50A.
1992     TGeoMedium *medSUPss    = 0; // SUP support cone screw material,Stainless
1993     TGeoMedium *medSUPair   = 0; // SUP support cone Air
1994     TGeoMedium *medSUPal    = 0; // SUP support cone SDD mounting bracket Al
1995     TGeoMedium *medSUPwater = 0; // SUP support cone Water
1996     medSUPcf    = mgr->GetMedium("ITSssdCarbonFiber");
1997     medSUPfs    = mgr->GetMedium("ITSssdStaselite4411w");
1998     medSUPfo    = mgr->GetMedium("ITSssdRohacell50A");
1999     medSUPss    = mgr->GetMedium("ITSssdStainlessSteal");
2000     medSUPair   = mgr->GetMedium("ITSssdAir");
2001     medSUPal    = mgr->GetMedium("ITSssdAl");
2002     medSUPwater = mgr->GetMedium("ITSssdWater");
2003     //
2004     Int_t i,j,iRmin;
2005     Double_t x,y,z,t,t0,dt,di,r,l,local[3],master[3];
2006     Char_t name[100];
2007     Double_t r1,r2,m;
2008     // RB 24, Open Side.
2009     const Double_t kfrm24Z0           = 900*fgkmm;//SSup_203A.jpg
2010     const Double_t kfrm24Thss         = 5.0*fgkmm;
2011     const Double_t kfrm24Rss          = 444.5*fgkmm-kfrm24Thss; //SSup_204A.jpg
2012     const Double_t kfrm24Width        = 10.0*fgkmm;
2013     const Double_t kfrm24Hight        = 10.0*fgkmm;
2014     const Double_t kfrm24Phi0         = 15.2*fgkDegree; // SSup_602A.jpg
2015     const Double_t kfrm24Phi1         = (90.0-7.6)*fgkDegree; // SSup_802A.jpg
2016     const Double_t kfrm24ZssSection   = (415.0-10.0)*fgkmm;
2017     const Int_t    kfrm24NZsections   = 4;
2018     const Int_t    kfrm24NPhiSections = 4;
2019     const Int_t    kfrm24NPhi         = 4;
2020     // These numbers are guessed at.
2021     const Double_t kfrm24ZfracAngle   =  0.55; // frational z length to brack
2022     const Double_t kfrm24Angle        =  10.0*fgkDegree; // Guessed at
2023     //
2024     TGeoTubeSeg *sA24[kfrm24NZsections+1];
2025     TGeoArb8    *sB24[kfrm24NZsections+1];
2026     Double_t zA24[kfrm24NZsections+1];
2027     l = 4.*kfrm24ZssSection+5*kfrm24Width;
2028     j = iRmin = 0;
2029     for(i=0;i<kfrm24NZsections+1;i++){
2030         sprintf(name,"ITS sup Cable tray support frame radial section A24[%d]",
2031                 i);
2032         r1 = kfrm24Rss;
2033         if(i==0) zA24[i] = kfrm24Width;
2034         else zA24[i] = zA24[i-1] + kfrm24ZssSection + kfrm24Width;
2035         if(zA24[i]>l*kfrm24ZfracAngle){ // break, radii get larger
2036             r1 = kfrm24Rss + (zA24[i]-kfrm24ZfracAngle*l)*SinD(kfrm24Angle);
2037         } // end if
2038         r2 = r1+kfrm24Thss;
2039         sA24[i] = new TGeoTubeSeg(name,r1,r2,0.5*kfrm24Width,kfrm24Phi0,
2040                                   kfrm24Phi1);
2041         if(i>0)if(sA24[i-1]->GetRmin()==sA24[i]->GetRmin()) j = iRmin = i;
2042     } // end for i
2043     for(i=0;i<kfrm24NZsections;i++){
2044         sprintf(name,"ITS sup Cable tray support frame Z section B24[%d]",i);
2045         sB24[i] = new TGeoArb8(name,0.5*kfrm24ZssSection);
2046         sB24[i]->SetVertex(0,sA24[i]->GetRmin(),0.5*kfrm24Hight);
2047         sB24[i]->SetVertex(1,sA24[i]->GetRmax(),0.5*kfrm24Hight);
2048         sB24[i]->SetVertex(2,sA24[i]->GetRmin(),-0.5*kfrm24Hight);
2049         sB24[i]->SetVertex(3,sA24[i]->GetRmax(),-0.5*kfrm24Hight);
2050         sB24[i]->SetVertex(4,sA24[i+1]->GetRmin(),0.5*kfrm24Hight);
2051         sB24[i]->SetVertex(5,sA24[i+1]->GetRmax(),0.5*kfrm24Hight);
2052         sB24[i]->SetVertex(6,sA24[i+1]->GetRmin(),-0.5*kfrm24Hight);
2053         sB24[i]->SetVertex(7,sA24[i+1]->GetRmax(),-0.5*kfrm24Hight);
2054     } // end for i
2055     if(GetDebug(1)){
2056         for(i=0;i<kfrm24NZsections+1;i++) sA24[i]->InspectShape();
2057         for(i=0;i<kfrm24NZsections;i++)   sB24[i]->InspectShape();
2058     } // end if GetDebug(1)
2059     TGeoVolume *vA24[kfrm24NZsections+1],*vB24[kfrm24NZsections];
2060     TGeoVolumeAssembly *vM24;
2061     TGeoTranslation *tran;
2062     TGeoRotation    *rot,*rot1;
2063     TGeoCombiTrans  *tranrot;
2064     //
2065     for(i=0;i<kfrm24NZsections+1;i++){
2066         vA24[i] = 0;
2067         sprintf(name,"ITSsupFrameA24[%d]",i);
2068         vA24[i] = new TGeoVolume(name,sA24[i],medSUPss);
2069         vA24[i]->SetVisibility(kTRUE);
2070         vA24[i]->SetLineColor(1); // black
2071         vA24[i]->SetLineWidth(1);
2072         vA24[i]->SetFillColor(vA24[i]->GetLineColor());
2073         vA24[i]->SetFillStyle(4000); // 0% transparent
2074     } // end for i
2075     for(i=0;i<kfrm24NZsections;i++){
2076         vB24[i] = 0;
2077         sprintf(name,"ITSsupFrameB24[%d]",i);
2078         vB24[i] = new TGeoVolume(name,sB24[i],medSUPss);
2079         vB24[i]->SetVisibility(kTRUE);
2080         vB24[i]->SetLineColor(1); // black
2081         vB24[i]->SetLineWidth(1);
2082         vB24[i]->SetFillColor(vB24[i]->GetLineColor());
2083         vB24[i]->SetFillStyle(4000); // 0% transparent
2084     } // end for i
2085     vM24 = new TGeoVolumeAssembly("ITSsupFrameM24");
2086     //vM24->SetVisibility(kTRUE);
2087     //vM24->SetLineColor(7); // light blue
2088     //vM24->SetLineWidth(1);
2089     //vM24->SetFillColor(vM24->GetLineColor());
2090     //vM24->SetFillStyle(4090); // 90% transparent
2091     //
2092     Int_t ncopyB24[kfrm24NPhiSections];
2093     t0 = kfrm24Phi0;
2094     dt = (kfrm24Phi1-kfrm24Phi0)/((Double_t)kfrm24NPhiSections);
2095     for(i=0;i<=kfrm24NZsections;i++){
2096         z = zA24[i];
2097         tran = new TGeoTranslation("",0.0,0.0,z);
2098         vM24->AddNode(vA24[i],1,tran);
2099        if(i<kfrm24NZsections){
2100            ncopyB24[i] = 1;
2101            for(j=0;j<=kfrm24NPhiSections;j++){
2102                t = t0 + ((Double_t)j)*dt;
2103                rot = new TGeoRotation("",0.0,0.0,t);
2104                tranrot = new TGeoCombiTrans("",0.0,0.0,z+sB24[i]->GetDz(),rot);
2105                //delete rot;// rot not explicity used in AddNode functions.
2106                vM24->AddNode(vB24[i],ncopyB24[i]++,tranrot);
2107            } // end for j
2108        } // end if
2109     } // end for i
2110     tran = new TGeoTranslation("",0.0,0.0,kfrm24Z0);
2111     moth->AddNode(vM24,1,tran);
2112     for(i=1;i<kfrm24NPhi;i++){
2113         di = (Double_t) i;
2114         rot = new TGeoRotation("",0.0,0.0,90.0*di);
2115         tranrot = new TGeoCombiTrans("",0.0,0.0,kfrm24Z0,rot);
2116         //delete rot;// rot not explicity used in AddNode functions.
2117         moth->AddNode(vM24,i+1,tranrot);
2118     } // end for i
2119     if(GetDebug(1)){
2120         for(i=0;i<kfrm24NZsections+1;i++) vA24[i]->PrintNodes();
2121         for(i=0;i<kfrm24NZsections;i++) vB24[i]->PrintNodes();
2122         vM24->PrintNodes();
2123     } // end if
2124     //==================================================================
2125     // RB24 Cable Tray
2126     const Double_t kct24WidthBottom   = 44.0*fgkmm; // Serv-C_208.jpg
2127     const Double_t kct24WidthTop      = 46.0*fgkmm; // Serv-C_208.jpg
2128     const Double_t kct24Hight         = 51.0*fgkmm; // Serv-C_208.jpg
2129     const Double_t kct24AlThick       = 1.0*fgkmm; // Serv-C_208.jpg
2130     const Double_t kct24CapWidth      = 46.0*fgkmm; // Serv-C_208.jpg
2131     const Double_t kct24CapEar        = 5.0*fgkmm; // Guess
2132     const Double_t kct24Rmin          = 455.0*fgkmm; // Serv-C_203.jpg
2133     const Double_t kct24CoolSectionH  = 470.0*fgkmm-kct24Rmin;// Serv-C_203.jpg
2134     const Double_t kct24CoolCableDivEar = 2.0*fgkmm; // Guess
2135     const Int_t kct24Ntrays           = 48; // Serv-C_205.jpg
2136     //const Int_t kct24Ntubes           = 3; // Serv-C_208.jpg
2137     // Patch Pannels for RB 24 side
2138     const Double_t kft24PPHightSPDFMD = 72.0*fgkmm; // Serv-C_SPD/FMD.jpg
2139     const Double_t kft24PPHightSDDSSD = 104.0*fgkmm; // Serv-C_SDD/SSD.jpg
2140     const Double_t kft24PPlength      = 350.0*fgkmm;//Serv-C_SPD/SDD/SSD/FMD_1.jpg
2141     const Double_t kft24Theta         = 2.0*TMath::ATan2(kct24WidthBottom,
2142                                                  2.0*kct24Rmin)*fgkRadian; //
2143     const Int_t    kft24NPatchPannels = 20; //
2144     //
2145     Double_t xp[12],yp[12];
2146     TGeoPcon *sMT24;
2147     TGeoXtru *sT24,*sTs24,*sTl24,*sTt24,*sU24,*sVl24,*sVs24,*sW24;
2148     TGeoXtru *s3PP24,*s2PP24,*sV3PP24,*sV2PP24;
2149     // Outer Tray Full
2150     sT24 = new TGeoXtru(3);
2151     sT24->SetName("ITS sup Full Cable Tray for RB24 Side T24");
2152     xp[0]  = -0.5*kct24WidthBottom;
2153     yp[0]  = sA24[0]->GetRmax();
2154     yp[1]  = yp[0] + kct24Hight-kct24CapEar;
2155     xp[1]  = Xfrom2Points(xp[0],yp[0],-0.5*kct24WidthTop+kct24AlThick,
2156                           yp[0]+kct24Hight,yp[1]);
2157     yp[2]  = yp[1];
2158     xp[2]  = xp[1]-kct24AlThick;
2159     xp[3]  = -0.5*kct24CapWidth;
2160     yp[3]  = yp[0] + kct24Hight;
2161     xp[4]  = -xp[3];
2162     yp[4]  =  yp[3];
2163     xp[5]  = -xp[2];
2164     yp[5]  =  yp[2];
2165     xp[6]  = -xp[1];
2166     yp[6]  =  yp[1];
2167     xp[7]  = -xp[0];
2168     yp[7]  =  yp[0];
2169     sT24->DefinePolygon(8,xp,yp);
2170     sT24->DefineSection(0,zA24[0]-kfrm24Width,0.0,0.0,1.0);
2171     sT24->DefineSection(1,zA24[iRmin],0.0,0.0,1.0);
2172     sT24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,0.0,
2173                       sA24[kfrm24NZsections]->GetRmax()-sA24[0]->GetRmin());
2174     // RB 24 full tray no divider (for ALG and T0-V0 cables?)
2175     sW24 = new TGeoXtru(3);
2176     sW24->SetName("ITS sup Cable Tray No Divider for RB24 Side W24");
2177     xp[0] = sT24->GetX(0) + kct24AlThick;
2178     yp[0] = sT24->GetY(0) + kct24AlThick;
2179     yp[1] = sT24->GetY(3) - kct24AlThick;
2180     xp[1] = Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2181                          sT24->GetY(1),yp[1]) + kct24AlThick;
2182     xp[2] = -xp[1];
2183     yp[2] =  yp[1];
2184     xp[3] = -xp[0];
2185     yp[3] =  yp[0];
2186     sW24->DefinePolygon(4,xp,yp);
2187     for(i=0;i<sT24->GetNz();i++){
2188         sW24->DefineSection(i,sT24->GetZ(i),sT24->GetXOffset(i),
2189                             sT24->GetYOffset(i),sT24->GetScale(i));
2190     } // end for i
2191     // Outer Tray Short
2192     sTs24 = new TGeoXtru(3);
2193     sTs24->SetName("ITS sup Short Cable Tray for RB24 Side Ts24");
2194     yp[0]  = sT24->GetY(0) + kct24CoolSectionH;
2195     xp[0]  = Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2196                          sT24->GetY(1),yp[0]);
2197     for(i=1;i<7;i++){
2198         xp[i]  = sT24->GetX(i);
2199         yp[i]  = sT24->GetY(i);
2200     } // end for i
2201     xp[7]  = -xp[0];
2202     yp[7]  =  yp[0];
2203     sTs24->DefinePolygon(8,xp,yp);
2204     sTs24->DefineSection(0,zA24[0] -kfrm24Width+kft24PPlength);
2205     sTs24->DefineSection(1,zA24[iRmin]);
2206     sTs24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,
2207                          sT24->GetXOffset(2),
2208                          sT24->GetYOffset(2),sT24->GetScale(2));
2209     // Outer Tray Long
2210     sTl24 = new TGeoXtru(3);
2211     sTl24->SetName("ITS sup Long Cable Tray for RB24 Side Tl24");
2212     for(i=0;i<8;i++){
2213     xp[i]  = sTs24->GetX(i);
2214     yp[i]  = sTs24->GetY(i);
2215     } // End for i
2216     sTl24->DefinePolygon(8,xp,yp);
2217     sTl24->DefineSection(0,zA24[0]-kfrm24Width,0.0,0.0,1.0);
2218     sTl24->DefineSection(1,zA24[iRmin],0.0,0.0,1.0);
2219     sTl24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,0.0,
2220                      sA24[kfrm24NZsections]->GetRmax()-sA24[0]->GetRmin(),1.0);
2221     // Outer Tray for air Tubes
2222     sTt24 = new TGeoXtru(3);
2223     sTt24->SetName("ITS sup Long Air Tube Tray for RB24 Side Tt24");
2224     xp[0]  = sT24->GetX(0);
2225     yp[0]  = sT24->GetY(0);
2226     xp[1]  = sTl24->GetX(0);
2227     yp[1]  = sTl24->GetY(0);
2228     xp[2]  = -xp[1];
2229     yp[2]  =  yp[1];
2230     xp[3]  = -xp[0];
2231     yp[3]  =  yp[0];
2232     sTt24->DefinePolygon(4,xp,yp);
2233     sTt24->DefineSection(0,zA24[0]-kfrm24Width,0.0,0.0,1.0);
2234     sTt24->DefineSection(1,zA24[iRmin],0.0,0.0,1.0);
2235     sTt24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,0.0,
2236                          sA24[kfrm24NZsections]->GetRmax()-sA24[0]->GetRmin());
2237     // Inner opening for cooling (lower) {inside sTt24}
2238     sU24 = new TGeoXtru(3);
2239     sU24->SetName("ITS sup Cable Tray Cooling tube space RB24 Side U24");
2240     xp[0] = sTt24->GetX(0) + kct24AlThick;
2241     yp[0] = sTt24->GetY(0) + kct24AlThick;
2242     xp[1] = sTt24->GetX(1) + kct24AlThick;
2243     yp[1] = sTt24->GetY(1) - kct24AlThick;
2244     xp[2] = -xp[1];
2245     yp[2] =  yp[1];
2246     xp[3] = -xp[0];
2247     yp[3] =  yp[0];
2248     sU24->DefinePolygon(4,xp,yp);
2249     for(i=0;i<sTt24->GetNz();i++){
2250         sU24->DefineSection(i,sTt24->GetZ(i),sTt24->GetXOffset(i),
2251                             sTt24->GetYOffset(i),sTt24->GetScale(i));
2252     } // end for i
2253     // Inner opening for cables (upper) {inside sTl24}
2254     sVl24 = new TGeoXtru(3);
2255     sVl24->SetName("ITS sup Cable Tray Cable space RB24 Side Vl24");
2256     xp[0] = sTl24->GetX(0)+2.0*kct24AlThick;
2257     yp[0] = sTl24->GetY(0);
2258     yp[1] = yp[0] + kct24CoolCableDivEar;
2259     xp[1] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2260                          sTl24->GetX(1),sTl24->GetY(1),yp[1])+2.0*kct24AlThick;
2261     yp[2] = yp[1];
2262     xp[2] = xp[1] - kct24AlThick;
2263     yp[3] = sTl24->GetY(3) - kct24AlThick;
2264     xp[3] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),sTl24->GetX(1),
2265                          sTl24->GetY(1),yp[3]) + kct24AlThick;
2266     xp[4] = -xp[3];
2267     yp[4] =  yp[3];
2268     xp[5] = -xp[2];
2269     yp[5] =  yp[2];
2270     xp[6] = -xp[1];
2271     yp[6] =  yp[1];
2272     xp[7] = -xp[0];
2273     yp[7] =  yp[0];
2274     sVl24->DefinePolygon(8,xp,yp);
2275     for(i=0;i<sTl24->GetNz();i++){
2276         sVl24->DefineSection(i,sTl24->GetZ(i),sTl24->GetXOffset(i),
2277                             sTl24->GetYOffset(i),sTl24->GetScale(i));
2278     } // end for i
2279     // Inner opening for cables (upper) {inside sTs24}
2280     sVs24 = new TGeoXtru(3);
2281     sVs24->SetName("ITS sup Cable Tray Cable space RB24 Side Vs24");
2282     sVs24->DefinePolygon(8,xp,yp);
2283     for(i=0;i<8;i++){
2284     xp[i]  = sVl24->GetX(i);
2285     yp[i]  = sVl24->GetY(i);
2286     } // end for i
2287     for(i=0;i<sTl24->GetNz();i++){
2288         sVs24->DefineSection(i,sTs24->GetZ(i),sTs24->GetXOffset(i),
2289                             sTs24->GetYOffset(i),sTs24->GetScale(i));
2290     } // end for i
2291     //------------------------------------------------------------------
2292     // Patch Pannels on RB 24 Side
2293     rot  = new TGeoRotation("",0.0,0.0,-kft24Theta); // Gets Used later as well
2294     rot1 = new TGeoRotation("",0.0,0.0,kft24Theta);  // Gets Used later as well
2295     s3PP24 = new TGeoXtru(2);
2296     s3PP24->SetName("ITS sup 3 bay pach pannel RB24 side 3PP24");
2297     yp[5]  = sT24->GetY(7) + kct24CoolSectionH;
2298     xp[5]  = Xfrom2Points(sT24->GetX(7),sT24->GetY(7),sT24->GetX(6),
2299                           sT24->GetY(6),yp[6]);
2300     yp[6]  = sT24->GetY(0) + kct24CoolSectionH;
2301     xp[6]  =  Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2302                           sT24->GetY(1),yp[9]);
2303     local[0] = xp[6]; local[1] = yp[6]; local[2] = 0.0;
2304     rot1->LocalToMaster(local,master);
2305     xp[0]  = master[0];
2306     yp[0]  = master[1];
2307     local[0] = xp[6]; local[1] = yp[6] + kft24PPHightSDDSSD; local[2] = 0.0;
2308     rot1->LocalToMaster(local,master);
2309     xp[1]  = master[0];
2310     yp[1]  = master[1];
2311     xp[2]  = -xp[1];
2312     yp[2]  =  yp[1];
2313     xp[3]  = -xp[0];
2314     yp[3]  =  yp[0];
2315     local[0] = xp[6]; local[1] = yp[6]; local[2] = 0.0;
2316     rot1->MasterToLocal(local,master);
2317     xp[4]  = master[0];
2318     yp[4]  = master[1];
2319     local[0] = xp[5]; local[1] = yp[5]; local[2] = 0.0;
2320     rot1->LocalToMaster(local,master);
2321     xp[7]  = master[0];
2322     yp[7]  = master[1];
2323     s3PP24->DefinePolygon(8,xp,yp);
2324     s3PP24->DefineSection(0,0.0);
2325     s3PP24->DefineSection(1,kft24PPlength);
2326     //
2327     s2PP24 = new TGeoXtru(2);
2328     s2PP24->SetName("ITS sup 2 bay pach pannel RB24 side 2PP24");
2329     local[1] = sTl24->GetY(3); local[2] = 0.0;
2330     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2331                             sTl24->GetX(1),sTl24->GetY(1),local[1]);
2332     rot1->LocalToMaster(local,master);
2333     xp[0]  = master[0];
2334     yp[0]  = master[1];
2335     local[1] = sTl24->GetY(3) + kft24PPHightSPDFMD; local[2] = 0.0;
2336     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2337                             sTl24->GetX(1),sTl24->GetY(1),local[1]);
2338     rot1->LocalToMaster(local,master);
2339     xp[1]  = master[0];
2340     yp[1]  = master[1];
2341     yp[2]  = sTl24->GetY(4) + kft24PPHightSPDFMD;
2342     xp[2]  = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2343                           sTl24->GetX(7),sTl24->GetY(7),yp[2]);
2344     yp[3]  = sTl24->GetY(7);
2345     xp[3]  = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2346                           sTl24->GetX(7),sTl24->GetY(7),yp[3]);
2347     xp[4]  = sTl24->GetX(3);
2348     yp[4]  = sTl24->GetY(3);
2349     local[0] = sTl24->GetX(4);local[1] = sTl24->GetY(4); local[2] = 0.0;
2350     rot1->LocalToMaster(local,master);
2351     xp[5]  = master[0];
2352     yp[5]  = master[1];
2353     s2PP24->DefinePolygon(6,xp,yp);
2354     s2PP24->DefineSection(0,0.0);
2355     s2PP24->DefineSection(1,kft24PPlength);
2356     //
2357     sV3PP24 = new TGeoXtru(2);
2358     sV3PP24->SetName("ITS sup Patch Pannel 3 Bay inside Rb24 side V3PP24");
2359     xp[0] = s3PP24->GetX(0) + kct24AlThick;
2360     yp[0] = s3PP24->GetY(0) + kct24AlThick;
2361     local[1] = s3PP24->GetY(6) + kft24PPHightSDDSSD - kct24AlThick;local[2]=0.;
2362     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2363                            sTl24->GetX(1),sTl24->GetY(1),local[1]);
2364     rot1->LocalToMaster(local,master);
2365     xp[1] = master[0];
2366     yp[1] = master[1];
2367     xp[2] = -xp[1];
2368     yp[2] =  yp[1];
2369     xp[3] = -xp[0];
2370     yp[3] =  yp[0];
2371     xp[4] = s3PP24->GetX(4);
2372     yp[4] = s3PP24->GetY(4);
2373     xp[5] = s3PP24->GetX(5);
2374     yp[5] = s3PP24->GetY(5);
2375     xp[6] = s3PP24->GetX(6);
2376     yp[6] = s3PP24->GetY(6);
2377     xp[7] = s3PP24->GetX(7);
2378     yp[7] = s3PP24->GetY(7);
2379     sV3PP24->DefinePolygon(8,xp,yp);
2380     sV3PP24->DefineSection(0,s3PP24->GetZ(0),s3PP24->GetXOffset(0),
2381                            s3PP24->GetYOffset(0),s3PP24->GetScale(0));
2382     sV3PP24->DefineSection(1,s3PP24->GetZ(1),s3PP24->GetXOffset(1),
2383                            s3PP24->GetYOffset(1),s3PP24->GetScale(1));
2384     //
2385     sV2PP24 = new TGeoXtru(2);
2386     sV2PP24->SetName("ITS sup Patch Pannel 2 Bay inside Rb24 side V2PP24");
2387     xp[0] = s2PP24->GetX(0) + kct24AlThick;
2388     yp[0] = s2PP24->GetY(0) + kct24AlThick;
2389     local[1] = sTl24->GetY(3) + kft24PPHightSPDFMD - kct24AlThick;local[2]=0.;
2390     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2391                            sTl24->GetX(1),sTl24->GetY(1),local[1]);
2392     rot1->LocalToMaster(local,master);
2393     xp[1] = master[0];
2394     yp[1] = master[1];
2395     yp[2] = sTl24->GetY(4) + kft24PPHightSPDFMD - kct24AlThick;
2396     xp[2] = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2397                            sTl24->GetX(7),sTl24->GetY(7),yp[2]);
2398     yp[3] = sTl24->GetY(4);
2399     xp[3] = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2400                            sTl24->GetX(7),sTl24->GetY(7),yp[3]);;
2401     xp[4] = s2PP24->GetX(4);
2402     yp[4] = s2PP24->GetY(4);
2403     xp[5] = s2PP24->GetX(5);
2404     yp[5] = s2PP24->GetY(5);
2405     sV2PP24->DefinePolygon(6,xp,yp);
2406     sV2PP24->DefineSection(0,s2PP24->GetZ(0),s2PP24->GetXOffset(0),
2407                            s2PP24->GetYOffset(0),s2PP24->GetScale(0));
2408     sV2PP24->DefineSection(1,s2PP24->GetZ(1),s2PP24->GetXOffset(1),
2409                            s2PP24->GetYOffset(1),s2PP24->GetScale(1));
2410     // RB 24 Tray Mother Volume
2411     sMT24 = new TGeoPcon("ITS sup Cable Tray Mother Volume RB24 MT24",
2412                          0.0,360.0,5);
2413     sMT24->Z(0)    = 0.0;
2414     sMT24->Rmin(0) = sA24[0]->GetRmax();
2415     sMT24->Rmax(0) = TMath::Max(TMath::Hypot(s3PP24->GetX(1),s3PP24->GetY(1)),
2416                                 TMath::Hypot(s2PP24->GetX(1),s2PP24->GetY(1)));
2417
2418     sMT24->Z(1)    = sMT24->GetZ(0) + kft24PPlength;
2419     sMT24->Rmin(1) = sMT24->GetRmin(0);
2420     sMT24->Rmax(1) = sMT24->GetRmax(0);
2421     sMT24->Z(2)    = sMT24->GetZ(1);
2422     sMT24->Rmin(2) = sMT24->GetRmin(0);
2423     sMT24->Rmax(2) = sMT24->GetRmax(0) - kft24PPHightSPDFMD;
2424
2425     sMT24->Z(3)    = sMT24->GetZ(0) + zA24[iRmin] - zA24[0] -kfrm24Width;
2426     sMT24->Rmin(3) = sA24[iRmin]->GetRmin();
2427     sMT24->Rmax(3) = TMath::Hypot(sT24->GetX(3),sT24->GetY(3));
2428     sMT24->Z(4)    = sMT24->GetZ(0) + zA24[kfrm24NZsections] + kfrm24Width  - 
2429         zA24[0] -kfrm24Width;
2430     sMT24->Rmin(4) = sA24[kfrm24NZsections]->GetRmax();
2431     sMT24->Rmax(4) = TMath::Hypot(sT24->GetX(3)+sT24->GetXOffset(2),
2432                                   sT24->GetY(3)+sT24->GetYOffset(2));
2433     //
2434     if(GetDebug(1)){
2435         sT24->InspectShape();
2436         sW24->InspectShape();
2437         sTl24->InspectShape();
2438         sTs24->InspectShape();
2439         sTt24->InspectShape();
2440         sU24->InspectShape();
2441         sVl24->InspectShape();
2442         sVs24->InspectShape();
2443         s3PP24->InspectShape();
2444         s2PP24->InspectShape();
2445         sV3PP24->InspectShape();
2446         sV2PP24->InspectShape();
2447         sMT24->InspectShape();
2448     } // end if GetDebug(1)
2449     //
2450     TGeoVolume *vC24[kct24Ntrays],*vT24[kct24Ntrays],*vPP24[kft24NPatchPannels];
2451     TGeoVolume *vWTV024,*vW24,*vU24,*vUFMD24,*vVl24,*vVlFMD24,*vVs24;
2452     TGeoVolume *vV3PP24,*vV2PP24,*vV2PPFMD24;
2453     TGeoVolumeAssembly *vMT24;
2454     vMT24 = new TGeoVolumeAssembly("ITSsupCableTrayMotherMT24");
2455     //vMT24->SetVisibility(kTRUE);
2456     //vMT24->SetLineColor(8); // white
2457     //vMT24->SetLineWidth(1);
2458     //vMT24->SetFillColor(vMT24->GetLineColor());
2459     //vMT24->SetFillStyle(4100); // 100% transparent
2460     //
2461     vU24 = new TGeoVolume("ITSsupCableTrayLowerU24",sU24,medSUPair);
2462     vU24->SetVisibility(kTRUE);
2463     vU24->SetLineColor(7); // light blue
2464     vU24->SetLineWidth(1);
2465     vU24->SetFillColor(vU24->GetLineColor());
2466     vU24->SetFillStyle(4090); // 90% transparent
2467     vUFMD24 = new TGeoVolume("FMDsupCableTrayLowerU24",sU24,medSUPair);
2468     vUFMD24->SetVisibility(kTRUE);
2469     vUFMD24->SetLineColor(7); // light blue
2470     vUFMD24->SetLineWidth(1);
2471     vUFMD24->SetFillColor(vUFMD24->GetLineColor());
2472     vUFMD24->SetFillStyle(4090); // 90% transparent
2473     vVl24 = new TGeoVolume("ITSsupCableTrayUpperV24",sVl24,medSUPair);
2474     vVl24->SetVisibility(kTRUE);
2475     vVl24->SetLineColor(7); // light blue
2476     vVl24->SetLineWidth(1);
2477     vVl24->SetFillColor(vVl24->GetLineColor());
2478     vVl24->SetFillStyle(4090); // 90% transparent
2479     vVlFMD24 = new TGeoVolume("FMDsupCableTrayUpperVl24",sVl24,medSUPair);
2480     vVlFMD24->SetVisibility(kTRUE);
2481     vVlFMD24->SetLineColor(7); // light blue
2482     vVlFMD24->SetLineWidth(1);
2483     vVlFMD24->SetFillColor(vVlFMD24->GetLineColor());
2484     vVlFMD24->SetFillStyle(4090); // 90% transparent
2485     vVs24 = new TGeoVolume("ITSsupCableTrayUpperVs24",sVs24,medSUPair);
2486     vVs24->SetVisibility(kTRUE);
2487     vVs24->SetLineColor(7); // light blue
2488     vVs24->SetLineWidth(1);
2489     vVs24->SetFillColor(vVs24->GetLineColor());
2490     vVs24->SetFillStyle(4090); // 90% transparent
2491     vW24 = new TGeoVolume("ITSsupCableTrayUpperW24",sW24,medSUPair);
2492     vW24->SetVisibility(kTRUE);
2493     vW24->SetLineColor(7); // light blue
2494     vW24->SetLineWidth(1);
2495     vW24->SetFillColor(vW24->GetLineColor());
2496     vW24->SetFillStyle(4090); // 90% transparent
2497     //
2498     vWTV024 = new TGeoVolume("V0supCableTrayUpperWTV024",sW24,medSUPair);
2499     vWTV024->SetVisibility(kTRUE);
2500     vWTV024->SetLineColor(7); // light blue
2501     vWTV024->SetLineWidth(1);
2502     vWTV024->SetFillColor(vWTV024->GetLineColor());
2503     vWTV024->SetFillStyle(4090); // 90% transparent
2504     //
2505     vV3PP24 = new TGeoVolume("ITSsup3BayPachPannelInsideV3PP24",sV3PP24,medSUPair);
2506     vV3PP24->SetVisibility(kTRUE);
2507     vV3PP24->SetLineColor(8); // white
2508     vV3PP24->SetLineWidth(1);
2509     vV3PP24->SetFillColor(vV3PP24->GetLineColor());
2510     vV3PP24->SetFillStyle(4100); // 100% transparent
2511     vV2PP24 = new TGeoVolume("ITSsup2BayPachPannelInsideV2PP24",sV2PP24,medSUPair);
2512     vV2PP24->SetVisibility(kTRUE);
2513     vV2PP24->SetLineColor(8); // white
2514     vV2PP24->SetLineWidth(1);
2515     vV2PP24->SetFillColor(vV2PP24->GetLineColor());
2516     vV2PP24->SetFillStyle(4100); // 100% transparent
2517     vV2PPFMD24 = new TGeoVolume("FMDsup2BayPachPannelInsideV2PP24",sV2PP24,medSUPair);
2518     vV2PPFMD24->SetVisibility(kTRUE);
2519     vV2PPFMD24->SetLineColor(8); // white
2520     vV2PPFMD24->SetLineWidth(1);
2521     vV2PPFMD24->SetFillColor(vV2PPFMD24->GetLineColor());
2522     vV2PPFMD24->SetFillStyle(4100); // 100% transparent
2523     //
2524     //delete rot;
2525     //delete rot1;
2526     //
2527     Double_t tha[kct24Ntrays],thb[kft24NPatchPannels];
2528     for(i=0;i<kct24Ntrays/4;i++) {
2529         if(i==0) tha[0] = 17.0+0.5*kft24Theta;
2530         else tha[i] = tha[i-1] + kft24Theta;
2531         tha[i+  kct24Ntrays/4] =  90.0 + tha[i];
2532         tha[i+  kct24Ntrays/2] = 180.0 + tha[i];
2533         tha[i+3*kct24Ntrays/4] = 270.0 + tha[i];
2534     } // end for i
2535     if(GetDebug(1)) for(i=0;i<kct24Ntrays;i++) Info("ServicesCableSupport",
2536                                                   "tha[%d]=%f",i,tha[i]);
2537     Char_t *airName[kct24Ntrays]={"FMD0","SDD0","SSD0","SSD1","SPD0","SPD1",
2538                                   "TV00","SDD1","SDD2","SPD2","SPD3","ALG0",
2539                                   "SPD4","SPD5","SSD2","SSD3","SPD6","SPD7",
2540                                   "TV01","SDD3","SDD4","SPD8","SPD9","ALG1",
2541                                   "FMD1","SDD5","SSD4","SSD5","SPDA","SPDB",
2542                                   "TV02","SDD6","SDD7","SPDC","SPDD","ALG2",
2543                                   "SPDE","SPDF","SSD6","SSD7","SPDG","SPDH",
2544                                   "TV03","SDD8","SDD9","SPDI","SPDJ","ALG3"};
2545     Char_t *trayName[kct24Ntrays]={"FMD0","SSD0","SSD1","SSD2","SSD3","SPD0",
2546                                    "TV00","SDD0","SDD1","SDD2","SPD1","ALG0",
2547                                    "SPD2","SSD4","SSD5","SSD6","SSD7","SPD3",
2548                                    "TV01","SDD3","SDD4","SDD5","SPD4","ALG1",
2549                                    "FMD1","SSD8","SSD9","SSDA","SSDB","SPD5",
2550                                    "TV02","SDD6","SDD7","SDD8","SPD6","ALG2",
2551                                    "SPD7","SSDC","SSDD","SSDE","SSDF","SPD8",
2552                                    "TV03","SDD9","SDDA","SDDB","SPD9","ALG3"};
2553     //
2554     //Int_t ncopyW24=1,ncopyU24=1,ncopyV24=1;
2555     j = 0;
2556     for(i=0;i<kct24Ntrays;i++){
2557         if(strncmp(trayName[i],"FMD",3)==0){
2558             sprintf(name,"FMDsupCableTrayT24[%s]",trayName[i]);
2559             vT24[i] = new TGeoVolume(name,sTl24,medSUPal);
2560             vT24[i]->AddNode(vVlFMD24,1,0);
2561         }else if(strncmp(trayName[i],"TV0",3)==0){
2562             sprintf(name,"V0supCableTrayT24[%s]",trayName[i]);
2563             vT24[i] = new TGeoVolume(name,sT24,medSUPal);
2564             vT24[i]->AddNode(vWTV024,1,0);
2565         }else if(strncmp(trayName[i],"ALG",3)==0){ // ITS Alignment Channel
2566             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2567             vT24[i] = new TGeoVolume(name,sT24,medSUPal);
2568             vT24[i]->AddNode(vW24,1,0);
2569         }else  if(strncmp(trayName[i],"SPD",3)==0){ /*ITS SPD*/
2570             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2571             vT24[i] = new TGeoVolume(name,sTl24,medSUPal);
2572             vT24[i]->AddNode(vVl24,1,0);
2573         }else { /*ITS*/
2574             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2575             vT24[i] = new TGeoVolume(name,sTs24,medSUPal); /// replace solid
2576             vT24[i]->AddNode(vVs24,1,0);
2577         } // end if
2578         vT24[i]->SetVisibility(kTRUE);
2579         vT24[i]->SetLineColor(6); // purple
2580         vT24[i]->SetLineWidth(1);
2581         vT24[i]->SetFillColor(vT24[i]->GetLineColor());
2582         vT24[i]->SetFillStyle(4000); // 0% transparent
2583         rot = new TGeoRotation("",0.0,0.0,tha[i]-90.0);
2584         if(GetDebug(1)) rot->Print();
2585         vMT24->AddNode(vT24[i],1,rot);
2586         //
2587         if(strncmp(trayName[i],"FMD",3)==0){
2588             sprintf(name,"FMDsupAirTubeTrayT24[%s]",airName[i]);
2589             vC24[j] = new TGeoVolume(name,sTt24,medSUPair);
2590             vC24[j]->AddNode(vUFMD24,1,0);
2591         }else if(strncmp(trayName[i],"TV0",3)==0){
2592             continue;
2593         }else if(strncmp(trayName[i],"ALG",3)==0){
2594             continue;
2595         }else{ /*ITS*/
2596             sprintf(name,"ITSsupAirTubTrayT24[%s]",airName[i]);
2597             vC24[j] = new TGeoVolume(name,sTt24,medSUPair);
2598             vC24[j]->AddNode(vU24,1,0);
2599         } // end if
2600         vC24[j]->SetVisibility(kTRUE);
2601         vC24[j]->SetLineColor(6); // purple
2602         vC24[j]->SetLineWidth(1);
2603         vC24[j]->SetFillColor(vC24[j]->GetLineColor());
2604         vC24[j]->SetFillStyle(4000); // 0% transparent
2605         vMT24->AddNode(vC24[j++],1,rot);
2606     } // end for i
2607     for(i=0;i<kft24NPatchPannels/4;i++) {
2608         if(i==0) thb[0] = 17.0+0.5*kft24Theta;
2609         else{
2610             if(i%2) thb[i] = thb[i-1] + 3.0*kft24Theta;
2611             else thb[i] = thb[i-1] + 2.0*kft24Theta;
2612         } // end if-else
2613         thb[i+  kft24NPatchPannels/4] =  90.0 + thb[i];
2614         thb[i+  kft24NPatchPannels/2] = 180.0 + thb[i];
2615         thb[i+3*kft24NPatchPannels/4] = 270.0 + thb[i];
2616     } // end for i
2617     Char_t *pachName[kft24NPatchPannels]={"FMD0","SSD0","SPD0","SDD0","SPD1",
2618                                           "SPD2","SSD1","SPD3","SDD1","SPD4",
2619                                           "FMD1","SSD2","SPD5","SDD2","SPD6",
2620                                           "SPD7","SSD3","SPD8","SDD3","SPD9"};
2621     for(i=0;i<kft24NPatchPannels;i++){
2622         if(strncmp(pachName[i],"FMD",3)==0){
2623             sprintf(name,"FMDsupPatchPannelPP24[%s]",pachName[i]);
2624             vPP24[i] = new TGeoVolume(name,s2PP24,medSUPal);
2625             vPP24[i]->AddNode(vV2PPFMD24,1,0);
2626         }else if(strncmp(pachName[i],"SPD",3)==0){ /*ITS SPD*/
2627             sprintf(name,"ITSsupPathcPannelPP24[%s]",pachName[i]);
2628             vPP24[i] = new TGeoVolume(name,s2PP24,medSUPal);
2629             vPP24[i]->AddNode(vV2PP24,1,0);
2630         }else { /*ITS*/
2631             sprintf(name,"ITSsupPathcPannelPP24[%s]",pachName[i]);
2632             vPP24[i] = new TGeoVolume(name,s3PP24,medSUPal); /// replace solid
2633             vPP24[i]->AddNode(vV3PP24,1,0);
2634         } // end if
2635         vPP24[i]->SetVisibility(kTRUE);
2636         vPP24[i]->SetLineColor(6); // purple
2637         vPP24[i]->SetLineWidth(1);
2638         vPP24[i]->SetFillColor(vPP24[i]->GetLineColor());
2639         vPP24[i]->SetFillStyle(4000); // 0% transparent
2640         rot = new TGeoRotation("",0.0,0.0,thb[i]-90.0);
2641         if(GetDebug(1)) rot->Print();
2642         vMT24->AddNode(vPP24[i],1,rot);
2643     } // end for i
2644     tran = new TGeoTranslation("",0.0,0.0,kfrm24Z0);
2645     moth->AddNode(vMT24,1,tran);
2646     if(GetDebug(1)){
2647         for(i=0;i<kct24Ntrays;i++) vT24[i]->PrintNodes();
2648         for(i=0;i<kct24Ntrays-8;i++) vC24[i]->PrintNodes();
2649         vU24->PrintNodes();
2650         vUFMD24->PrintNodes();
2651         vVl24->PrintNodes();
2652         vVlFMD24->PrintNodes();
2653         vVs24->PrintNodes();
2654         vW24->PrintNodes();
2655         vWTV024->PrintNodes();
2656         vMT24->PrintNodes();
2657     } // end if
2658     //==================================================================
2659     //
2660     // RB 26, Muon Absober side
2661     const Double_t kfrm26Z0           = -900*fgkmm;//SSup_203A.jpg
2662     const Double_t kfrm26Thss         = 5.0*fgkmm;
2663     const Double_t kfrm26R0ss         = 444.5*fgkmm-kfrm26Thss; //SSup_204A.jpg
2664     const Double_t kfrm26R1ss         = 601.6*fgkmm-kfrm26Thss; //SSup_208A.jpg
2665     const Double_t kfrm26Width        = 10.0*fgkmm;
2666     //const Double_t kfrm26Hight       = 10.0*fgkmm;
2667     const Double_t kfrm26Phi0         = 15.2*fgkDegree; // SSup_602A.jpg
2668     const Double_t kfrm26Phi1         = (90.0-7.6)*fgkDegree; // SSup_802A.jpg
2669     const Double_t kfrm26ZssSection   = (415.0-10.0)*fgkmm;
2670     const Int_t    kfrm26NZsections   = 4;
2671     const Int_t    kfrm26NPhiSections = 4;
2672     const Int_t    kfrm26NPhi         = 4;
2673     TGeoConeSeg *sA26[kfrm26NZsections+1];//,*sM26;//Cylinderial support structure
2674     TGeoArb8     *sB26; // Cylinderial support structure
2675     /*
2676     sM26 = new TGeoConeSeg("ITS sup Cable tray support frame mother volume "
2677                           "M26",0.5*(4.*kfrm26ZssSection+5*kfrm26Width),
2678                           kfrm26R1ss,kfrm26R1ss+kfrm26Thss,
2679                           kfrm26R0ss,kfrm26R0ss+kfrm26Thss,
2680                           kfrm26Phi0,kfrm26Phi1);
2681     */
2682     m = -((kfrm26R1ss-kfrm26R0ss)/
2683          (((Double_t)kfrm26NZsections)*(kfrm26ZssSection+kfrm26Width)));
2684     for(i=0;i<kfrm26NZsections+1;i++){
2685         di = ((Double_t) i)*(kfrm26ZssSection+kfrm26Width);
2686         sprintf(name,
2687                 "ITS sup Cable tray support frame radial section A26[%d]",i);
2688         r1 = kfrm26R1ss+m*di;
2689         r2 = kfrm26R1ss+m*(di+kfrm26Width);
2690         sA26[i] = new TGeoConeSeg(name,0.5*kfrm26Width,r2,r2+kfrm26Thss,
2691                                  r1,r1+kfrm26Thss,kfrm26Phi0,kfrm26Phi1);
2692     } // end for i
2693     sB26 = new TGeoArb8("ITS sup Cable tray support frame Z section B26",
2694                        0.5*kfrm26ZssSection);
2695     r = 0.25*(sA26[0]->GetRmax1()+sA26[0]->GetRmin1()+
2696               sA26[1]->GetRmax2()+sA26[1]->GetRmin2());
2697     sB26->SetVertex(0,sA26[0]->GetRmax2()-r,+0.5*kfrm26Width);
2698     sB26->SetVertex(1,sA26[0]->GetRmax2()-r,-0.5*kfrm26Width);
2699     sB26->SetVertex(2,sA26[0]->GetRmin2()-r,-0.5*kfrm26Width);
2700     sB26->SetVertex(3,sA26[0]->GetRmin2()-r,+0.5*kfrm26Width);
2701     sB26->SetVertex(4,sA26[1]->GetRmax1()-r,+0.5*kfrm26Width);
2702     sB26->SetVertex(5,sA26[1]->GetRmax1()-r,-0.5*kfrm26Width);
2703     sB26->SetVertex(6,sA26[1]->GetRmin1()-r,-0.5*kfrm26Width);
2704     sB26->SetVertex(7,sA26[1]->GetRmin1()-r,+0.5*kfrm26Width);
2705     if(GetDebug(1)){
2706         for(i=0;i<kfrm26NZsections+1;i++) sA26[i]->InspectShape();
2707         //sM26->InspectShape();
2708         sB26->InspectShape();
2709     } // end if GetDebug(1)
2710     //
2711     TGeoVolume *vA26[kfrm26NZsections+1],*vB26;
2712     TGeoVolumeAssembly *vM26;
2713     //
2714     for(i=0;i<kfrm26NZsections+1;i++){
2715         sprintf(name,"ITSsupFrameA26[%d]",i);
2716         vA26[i] = new TGeoVolume(name,sA26[i],medSUPss);
2717         vA26[i]->SetVisibility(kTRUE);
2718         vA26[i]->SetLineColor(1); // black
2719         vA26[i]->SetLineWidth(1);
2720         vA26[i]->SetFillColor(vA26[i]->GetLineColor());
2721         vA26[i]->SetFillStyle(4000); // 0% transparent
2722     } // end for i
2723     vB26 = new TGeoVolume("ITSsupFrameB26",sB26,medSUPss);
2724     vB26->SetVisibility(kTRUE);
2725     vB26->SetLineColor(1); // black
2726     vB26->SetLineWidth(1);
2727     vB26->SetFillColor(vB26->GetLineColor());
2728     vB26->SetFillStyle(4000); // 0% transparent
2729     vM26 = new TGeoVolumeAssembly("ITSsupFrameM26");
2730     //vM26 = new TGeoVolume("ITSsupFrameM26",sM26,medSUPair);
2731     //vM26->SetVisibility(kTRUE);
2732     //vM26->SetLineColor(7); // light blue
2733     //vM26->SetLineWidth(1);
2734     //vM26->SetFillColor(vM26->GetLineColor());
2735     //vM26->SetFillStyle(4090); // 90% transparent
2736     //
2737     Int_t ncopyB26=1;
2738     t0 = kfrm26Phi0;
2739     dt = (kfrm26Phi1-kfrm26Phi0)/((Double_t)kfrm26NPhiSections);
2740     for(i=0;i<=kfrm26NZsections;i++){
2741         di = ((Double_t) i)*(kfrm26ZssSection+kfrm26Width);
2742         z = 0.5*(4.*kfrm26ZssSection+5*kfrm26Width);
2743         z = -z+sA26[i]->GetDz() + di;
2744         tran = new TGeoTranslation("",0.0,0.0,z);
2745         vM26->AddNode(vA26[i],1,tran);
2746         z = z+sB26->GetDz();
2747         if(i<kfrm26NZsections)for(j=0;j<=kfrm26NPhiSections;j++){
2748             r = 0.25*(sA26[i]->GetRmax1()+sA26[i]->GetRmin1()+
2749                       sA26[i+1]->GetRmax2()+sA26[i+1]->GetRmin2());
2750             t = t0 + ((Double_t)j)*dt;
2751             rot = new TGeoRotation("",0.0,0.0,t);
2752             y = r*SinD(t);
2753             x = r*CosD(t);
2754             tranrot = new TGeoCombiTrans("",x,y,z,rot);
2755             //delete rot; // rot not explicity used in AddNode functions.
2756             vM26->AddNode(vB26,ncopyB26++,tranrot);
2757         } // end for j
2758     } // end for i
2759     tran = new TGeoTranslation("",0.0,0.0,kfrm26Z0-0.5*(4.*kfrm26ZssSection+5*kfrm26Width));
2760     moth->AddNode(vM26,1,tran);
2761     for(i=1;i<kfrm26NPhi;i++){
2762         rot = new TGeoRotation("",0.0,0.0,90.0*((Double_t)i));
2763         tranrot = new TGeoCombiTrans(*tran,*rot);
2764         //delete rot; // rot not explicity used in AddNode functions.
2765         moth->AddNode(vM26,i+1,tranrot);
2766     } // end for i
2767     if(GetDebug(1)){
2768         for(i=0;i<kfrm26NZsections+1;i++) vA26[i]->PrintNodes();
2769         vB26->PrintNodes();
2770         vM26->PrintNodes();
2771     } // end if
2772 }