Compilation warnings
[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          =      15.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      =     186.0*fgkmm;
773   const Double_t kConeZOuterMilled   =      23.0*fgkmm;
774   const Double_t kConeDZin           =      15.0*fgkmm; // ???
775   const Double_t kConeThickness      =      10.5*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          = (528.0/2)*fgkmm;
788   const Double_t kHole1RMax          = (527.4/2)*fgkmm; // ??? No overlaps !
789   const Double_t kHole2RMin          = (280.0/2)*fgkmm;
790   const Double_t kHole2RMax          = (375.0/2)*fgkmm;
791   const Double_t kHole1Phi           =      25.0*fgkDegree;
792   const Double_t kHole2Phi           =      50.0*fgkDegree;
793   const Double_t kHole3RMin          =     205.0*fgkmm;
794   const Double_t kHole3DeltaR        =        15*fgkmm;
795   const Double_t kHole3Width         =        30*fgkmm;
796   const Int_t    kNHole3             =         6      ;
797   const Double_t kHole4RMin          =     116.0*fgkmm;
798   const Double_t kHole4DeltaR        =        15*fgkmm;
799   //  const Double_t kHole4Width         =        30*fgkmm;
800   // const Int_t    kNHole4             =         3      ;
801
802   // Local variables
803   Double_t x, y, z, t, dza, rmin, rmax;
804
805
806   // The master volume which holds everything
807   TGeoVolumeAssembly *vM = new TGeoVolumeAssembly("ITSsddCone");
808
809   // Recover the needed materials
810   TGeoMedium *medSDDcf  = mgr->GetMedium("ITS_SDD C (M55J)$");
811   TGeoMedium *medSDDair = mgr->GetMedium("ITS_SDD AIR$");
812   TGeoMedium *medSDDste = mgr->GetMedium("ITS_G10FR4$"); // stesalite
813   TGeoMedium *medSDDroh = mgr->GetMedium("ITS_ROHACELL$");
814   TGeoMedium *medSDDss  = mgr->GetMedium("ITS_INOX$");
815
816   // First define the geometrical shapes
817
818   // Central cylinder with its internal foam and the lateral flanges:
819   // a carbon fiber Tube which contains a rohacell Tube and two
820   // stesalite Tube's
821   TGeoTube *cylindershape = new TGeoTube(kCylinderInnerR,kCylinderOuterR,
822                                          kCylinderHalfLength);
823
824   TGeoTube *insertoshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
825                                         kInsertoHalfLength);
826
827   TGeoTube *flangeshape = new TGeoTube(kFlangeInnerR,kFlangeOuterR,
828                                        kFlangeHalfLength);
829
830   // The flange bolt: it is a Tube
831   TGeoTube *boltshape = new TGeoTube(0.0, 0.5*kBoltDiameter, 0.5*kBoltDepth);
832
833   // Debug if requested
834   if (GetDebug(1)) {
835     cylindershape->InspectShape();
836     insertoshape->InspectShape();
837     flangeshape->InspectShape();
838     boltshape->InspectShape();
839   }
840
841
842   // We have the shapes: now create the real volumes
843
844   TGeoVolume *cfcylinder = new TGeoVolume("SDDCarbonFiberCylinder",
845                                           cylindershape,medSDDcf);
846   cfcylinder->SetVisibility(kTRUE);
847   cfcylinder->SetLineColor(4); // Blue
848   cfcylinder->SetLineWidth(1);
849   cfcylinder->SetFillColor(cfcylinder->GetLineColor());
850   cfcylinder->SetFillStyle(4000); // 0% transparent
851
852   TGeoVolume *foamcylinder = new TGeoVolume("SDDFoamCylinder",
853                                             insertoshape,medSDDroh);
854   foamcylinder->SetVisibility(kTRUE);
855   foamcylinder->SetLineColor(3); // Green
856   foamcylinder->SetLineWidth(1);
857   foamcylinder->SetFillColor(foamcylinder->GetLineColor());
858   foamcylinder->SetFillStyle(4050); // 50% transparent
859
860   TGeoVolume *flangecylinder = new TGeoVolume("SDDFlangeCylinder",
861                                               flangeshape,medSDDste);
862   flangecylinder->SetVisibility(kTRUE);
863   flangecylinder->SetLineColor(2); // Red
864   flangecylinder->SetLineWidth(1);
865   flangecylinder->SetFillColor(flangecylinder->GetLineColor());
866   flangecylinder->SetFillStyle(4050); // 50% transparent
867
868   TGeoVolume *bolt = new TGeoVolume("SDDFlangeBolt",boltshape,medSDDss);
869   bolt->SetVisibility(kTRUE);
870   bolt->SetLineColor(1);  // Black
871   bolt->SetLineWidth(1);
872   bolt->SetFillColor(bolt->GetLineColor());
873   bolt->SetFillStyle(4050); // 50% transparent
874
875   // Mount up the cylinder
876   for(Int_t i=0; i<kNBolts; i++){
877     t = kThetaBolt*i;
878     x = kBoltRadius*TMath::Cos(t);
879     y = kBoltRadius*TMath::Sin(t);
880     z = kFlangeHalfLength-kBoltDepth;
881     flangecylinder->AddNode(bolt, i+1, new TGeoTranslation("",x,y,z));
882   }
883
884   cfcylinder->AddNode(foamcylinder,1,0);
885   cfcylinder->AddNode(flangecylinder,1,
886               new TGeoTranslation(0, 0, kInsertoHalfLength+kFlangeHalfLength));
887   cfcylinder->AddNode(flangecylinder,2,new TGeoCombiTrans(
888               0, 0, -kInsertoHalfLength-kFlangeHalfLength,
889               new TGeoRotation("",0,180,0)     ) );
890
891
892   // SDD Support Cone with its internal inserts: a carbon fiber Pcon
893   // with holes which contains a stesalite Pcon which on turn contains a
894   // rohacell Pcon
895
896   dza = kConeThickness/kSinConeTheta-(kConeROutMax-kConeROutMin)/kTanConeTheta;
897
898   TGeoPcon *coneshape = new TGeoPcon(0.0, 360.0, 12);
899
900   coneshape->Z(0)     = 0.0;
901   coneshape->Rmin(0)  = kConeROutMin;
902   coneshape->Rmax(0)  = kConeROutMax;
903
904   coneshape->Z(1)     = kConeZOuterMilled - dza;
905   coneshape->Rmin(1)  = coneshape->GetRmin(0);
906   coneshape->Rmax(1)  = coneshape->GetRmax(0);
907
908   coneshape->Z(2)     = kConeZOuterMilled;
909   coneshape->Rmax(2)  = coneshape->GetRmax(0);
910
911   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(1),
912                     coneshape->GetRmin(1),kConeTheta,z,rmin);
913   coneshape->Z(3)     = z;
914   coneshape->Rmin(3)  = rmin;
915
916   coneshape->Rmin(2)  = RminFrom2Points(coneshape,3,1,coneshape->GetZ(2));
917
918   RadiusOfCurvature(kConeRCurv,0.,coneshape->GetZ(2),
919                     coneshape->GetRmax(2),kConeTheta,z,rmax);
920   coneshape->Z(4)     = z;
921   coneshape->Rmax(4)  = rmax;
922   coneshape->Rmin(4)  = RminFromZpCone(coneshape,3,kConeTheta,
923                                        coneshape->GetZ(4),0.0);
924
925   coneshape->Rmax(3)  = RmaxFrom2Points(coneshape,4,2,coneshape->GetZ(3));
926
927   coneshape->Rmin(7)  = kConeRinMin;
928
929   coneshape->Rmin(8)  = kConeRinMin;
930
931   RadiusOfCurvature(kConeRCurv,90.0,0.0,kConeRinMax,90.0-kConeTheta,z,rmax);
932   coneshape->Rmax(8)  = rmax;
933   coneshape->Z(8)     = ZFromRmaxpCone(coneshape,4,kConeTheta,
934                                        coneshape->GetRmax(8));
935
936   coneshape->Z(9)     = kConeZCylinder;
937   coneshape->Rmin(9)  = kConeRinMin;
938
939   coneshape->Z(10)    = coneshape->GetZ(9);
940   coneshape->Rmin(10) = kConeRinCylinder;
941
942   coneshape->Rmin(11) = kConeRinCylinder;
943   coneshape->Rmax(11) = coneshape->GetRmin(11);
944
945   rmin                = coneshape->GetRmin(8);
946   RadiusOfCurvature(kConeRCurv,90.0-kConeTheta,
947                     coneshape->GetZ(8),coneshape->GetRmax(8),90.0,z,rmax);
948   rmax                = kConeRinMax;
949   coneshape->Z(11)    = z + (coneshape->GetZ(8)-z)*
950                    (coneshape->GetRmax(11)-rmax)/(coneshape->GetRmax(8)-rmax);
951
952   coneshape->Rmax(9)  = RmaxFrom2Points(coneshape,11,8,coneshape->GetZ(9));
953
954   coneshape->Rmax(10) = coneshape->GetRmax(9);
955
956   coneshape->Z(6)     = z - kConeDZin;
957   coneshape->Z(7)     = coneshape->GetZ(6);
958
959   coneshape->Rmax(6)  = RmaxFromZpCone(coneshape,4,kConeTheta,
960                                        coneshape->GetZ(6));
961
962   coneshape->Rmax(7)  = coneshape->GetRmax(6);
963
964   RadiusOfCurvature(kConeRCurv,90.,
965                     coneshape->GetZ(6),0.0,90.0-kConeTheta,z,rmin);
966   coneshape->Z(5)     = z;
967   coneshape->Rmin(5)  = RminFromZpCone(coneshape,3,kConeTheta,z);
968   coneshape->Rmax(5)  = RmaxFromZpCone(coneshape,4,kConeTheta,z);
969
970   RadiusOfCurvature(kConeRCurv,90.-kConeTheta,
971                     0.0,coneshape->Rmin(5),90.0,z,rmin);
972   coneshape->Rmin(6)  = rmin;
973
974   // SDD Cone Insert: another Pcon
975   Double_t x0, y0, x1, y1, x2, y2;
976   TGeoPcon *coneinsertshape = new TGeoPcon(0.0, 360.0, 9);
977
978   coneinsertshape->Z(0)    = coneshape->GetZ(0) + kConeCFThickness;
979   coneinsertshape->Rmin(0) = coneshape->GetRmin(0) + kConeCFThickness;
980   coneinsertshape->Rmax(0) = coneshape->GetRmax(0) - kConeCFThickness;
981
982   x0 = coneshape->GetZ(0); y0 = coneshape->GetRmin(0);
983   x1 = coneshape->GetZ(1); y1 = coneshape->GetRmin(1);
984   x2 = coneshape->GetZ(2); y2 = coneshape->GetRmin(2);
985   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
986   coneinsertshape->Z(1)    = z;
987   coneinsertshape->Rmin(1) = rmin;
988   coneinsertshape->Rmax(1) = coneinsertshape->GetRmax(0);
989
990   x0 = coneshape->GetZ(1); y0 = coneshape->GetRmax(1);
991   x1 = coneshape->GetZ(2); y1 = coneshape->GetRmax(2);
992   x2 = coneshape->GetZ(3); y2 = coneshape->GetRmax(3);
993   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
994   coneinsertshape->Z(2)    = z;
995   coneinsertshape->Rmax(2) = rmax;
996
997   x0 = coneshape->GetZ(2); y0 = coneshape->GetRmin(2);
998   x1 = coneshape->GetZ(3); y1 = coneshape->GetRmin(3);
999   x2 = coneshape->GetZ(4); y2 = coneshape->GetRmin(4);
1000   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1001   coneinsertshape->Z(3)    = z;
1002   coneinsertshape->Rmin(3) = rmin;
1003
1004   x0 = coneinsertshape->GetZ(1); y0 = coneinsertshape->GetRmin(1);
1005   x1 = coneinsertshape->GetZ(3); y1 = coneinsertshape->GetRmin(3);
1006   coneinsertshape->Rmin(2) = Yfrom2Points(x0, y0, x1, y1,
1007                                           coneinsertshape->Z(2));
1008
1009   x0 = coneshape->GetZ(3); y0 = coneshape->GetRmax(3);
1010   x1 = coneshape->GetZ(4); y1 = coneshape->GetRmax(4);
1011   x2 = coneshape->GetZ(5); y2 = coneshape->GetRmax(5);
1012   InsidePoint(x0, y0, x1, y1, x2, y2, -kConeCFThickness, z, rmax);
1013   coneinsertshape->Z(4)    = z;
1014   coneinsertshape->Rmax(4) = rmax;
1015
1016   x0 = coneinsertshape->GetZ(2); y0 = coneinsertshape->GetRmax(2);
1017   x1 = coneinsertshape->GetZ(4); y1 = coneinsertshape->GetRmax(4);
1018   coneinsertshape->Rmax(3) = Yfrom2Points(x0, y0, x1, y1,
1019                                           coneinsertshape->Z(3));
1020
1021   x0 = coneshape->GetZ(4); y0 = coneshape->GetRmin(4);
1022   x1 = coneshape->GetZ(5); y1 = coneshape->GetRmin(5);
1023   x2 = coneshape->GetZ(6); y2 = coneshape->GetRmin(6);
1024   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1025   coneinsertshape->Z(5)    = z;
1026   coneinsertshape->Rmin(5) = rmin;
1027   coneinsertshape->Rmax(5) = coneinsertshape->GetRmax(4) -
1028           kTanConeTheta*(coneinsertshape->GetZ(5) - coneinsertshape->GetZ(4));
1029
1030   x0 = coneinsertshape->GetZ(3); y0 = coneinsertshape->GetRmin(3);
1031   x1 = coneinsertshape->GetZ(5); y1 = coneinsertshape->GetRmin(5);
1032   coneinsertshape->Rmin(4) = Yfrom2Points(x0, y0, x1, y1,
1033                                           coneinsertshape->Z(4));
1034
1035   x0 = coneshape->GetZ(5); y0 = coneshape->GetRmin(5);
1036   x1 = coneshape->GetZ(6); y1 = coneshape->GetRmin(6);
1037   x2 = coneshape->GetZ(7); y2 = coneshape->GetRmin(7);
1038   InsidePoint(x0, y0, x1, y1, x2, y2,  kConeCFThickness, z, rmin);
1039   coneinsertshape->Z(6)    = z;
1040   coneinsertshape->Rmin(6) = rmin;
1041   coneinsertshape->Rmax(6) = coneinsertshape->GetRmax(4) -
1042           kTanConeTheta*(coneinsertshape->GetZ(6) - coneinsertshape->GetZ(4));
1043
1044   coneinsertshape->Z(7)    = coneinsertshape->GetZ(6);
1045   coneinsertshape->Rmin(7) = coneshape->GetRmin(7) + kConeCFThickness;
1046   coneinsertshape->Rmax(7) = coneinsertshape->GetRmax(6);
1047
1048   coneinsertshape->Z(8)    = coneshape->GetZ(9) - kConeCFThickness;
1049   coneinsertshape->Rmin(8) = coneinsertshape->GetRmin(7);
1050   coneinsertshape->Rmax(8) = coneinsertshape->GetRmax(4) -
1051           kTanConeTheta*(coneinsertshape->GetZ(8) - coneinsertshape->GetZ(4));
1052
1053   // SDD Cone Foam: another Pcon
1054   TGeoPcon *conefoamshape = new TGeoPcon(0.0, 360.0, 4);
1055
1056   RadiusOfCurvature(kConeRCurv+kConeCFThickness,0.0,coneinsertshape->GetZ(1),
1057                     coneinsertshape->GetRmin(1),kConeTheta,z,rmin);
1058
1059   conefoamshape->Z(0)    = z;
1060   conefoamshape->Rmin(0) = rmin;
1061   conefoamshape->Rmax(0) = conefoamshape->GetRmin(0);
1062
1063   conefoamshape->Z(1)    = conefoamshape->GetZ(0)+
1064                          (kConeThickness-2.0*kConeCFThickness)/kSinConeTheta;
1065   conefoamshape->Rmin(1) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1066                                           conefoamshape->GetZ(1));
1067   conefoamshape->Rmax(1) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1068                                           conefoamshape->GetZ(1));
1069
1070   conefoamshape->Z(2)    = coneshape->GetZ(5)-kConeCFThickness;
1071   conefoamshape->Rmin(2) = RminFromZpCone(coneinsertshape,3,kConeTheta,
1072                                           conefoamshape->GetZ(2));
1073   conefoamshape->Rmax(2) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1074                                           conefoamshape->GetZ(2));
1075
1076   conefoamshape->Z(3)    = coneinsertshape->GetZ(5)+
1077                          (kConeThickness-2.0*kConeCFThickness)*kCosConeTheta;
1078   conefoamshape->Rmax(3) = RmaxFromZpCone(coneinsertshape,4,kConeTheta,
1079                                           conefoamshape->GetZ(3));
1080   conefoamshape->Rmin(3) = conefoamshape->GetRmax(3);
1081
1082   // SDD Cone Holes: Pcon's
1083   TGeoPcon *hole1shape = new TGeoPcon(-kHole1Phi/2., kHole1Phi, 4);
1084
1085   hole1shape->Rmin(0) = kHole1RMax;
1086   hole1shape->Rmax(0) = hole1shape->GetRmin(0);
1087   hole1shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1088                                        hole1shape->GetRmin(0));
1089
1090   hole1shape->Rmax(1) = hole1shape->GetRmax(0);
1091   hole1shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1092                                        hole1shape->GetRmax(1));
1093   hole1shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1094                                        hole1shape->GetZ(1));
1095
1096   hole1shape->Rmin(2) = kHole1RMin;
1097   hole1shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1098                                        hole1shape->GetRmin(2));
1099   hole1shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1100                                        hole1shape->GetZ(2));
1101
1102   hole1shape->Rmin(3) = hole1shape->GetRmin(2);
1103   hole1shape->Rmax(3) = hole1shape->GetRmin(3);
1104   hole1shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1105                                        hole1shape->GetRmax(3));
1106
1107   TGeoPcon *hole2shape = new TGeoPcon(-kHole2Phi/2., kHole2Phi, 4);
1108
1109   hole2shape->Rmin(0) = kHole2RMax;
1110   hole2shape->Rmax(0) = hole2shape->GetRmin(0);
1111   hole2shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1112                                        hole2shape->GetRmin(0));
1113
1114   hole2shape->Rmax(1) = hole2shape->GetRmax(0);
1115   hole2shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1116                                        hole2shape->GetRmax(1));
1117   hole2shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1118                                        hole2shape->GetZ(1));
1119
1120   hole2shape->Rmin(2) = kHole2RMin;
1121   hole2shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1122                                        hole2shape->GetRmin(2));
1123   hole2shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1124                                        hole2shape->GetZ(2));
1125
1126   hole2shape->Rmin(3) = hole2shape->GetRmin(2);
1127   hole2shape->Rmax(3) = hole2shape->GetRmin(3);
1128   hole2shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1129                                        hole2shape->GetRmax(3));
1130
1131   Double_t holePhi;
1132   holePhi = (kHole3Width/kHole3RMin)*TMath::RadToDeg();
1133
1134   TGeoPcon *hole3shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1135
1136   hole3shape->Rmin(0) = kHole3RMin + kHole3DeltaR;
1137   hole3shape->Rmax(0) = hole3shape->GetRmin(0);
1138   hole3shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1139                                        hole3shape->GetRmin(0));
1140
1141   hole3shape->Rmax(1) = hole3shape->GetRmax(0);
1142   hole3shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1143                                        hole3shape->GetRmax(1));
1144   hole3shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1145                                        hole3shape->GetZ(1));
1146
1147   hole3shape->Rmin(2) = kHole3RMin;
1148   hole3shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1149                                        hole3shape->GetRmin(2));
1150   hole3shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1151                                        hole3shape->GetZ(2));
1152
1153   hole3shape->Rmin(3) = hole3shape->GetRmin(2);
1154   hole3shape->Rmax(3) = hole3shape->GetRmin(3);
1155   hole3shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1156                                        hole3shape->GetRmax(3));
1157
1158   TGeoPcon *hole4shape = new TGeoPcon(-holePhi/2., holePhi, 4);
1159
1160   hole4shape->Rmin(0) = kHole4RMin + kHole4DeltaR;
1161   hole4shape->Rmax(0) = hole4shape->GetRmin(0);
1162   hole4shape->Z(0)    = ZFromRminpCone(coneshape,3,kConeTheta,
1163                                        hole4shape->GetRmin(0));
1164
1165   hole4shape->Rmax(1) = hole4shape->GetRmax(0);
1166   hole4shape->Z(1)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1167                                        hole4shape->GetRmax(1));
1168   hole4shape->Rmin(1) = RminFromZpCone(coneshape,3,kConeTheta,
1169                                        hole4shape->GetZ(1));
1170
1171   hole4shape->Rmin(2) = kHole4RMin;
1172   hole4shape->Z(2)    = ZFromRminpCone(coneshape,3,kConeTheta,
1173                                        hole4shape->GetRmin(2));
1174   hole4shape->Rmax(2) = RmaxFromZpCone(coneshape,4,kConeTheta,
1175                                        hole4shape->GetZ(2));
1176
1177   hole4shape->Rmin(3) = hole4shape->GetRmin(2);
1178   hole4shape->Rmax(3) = hole4shape->GetRmin(3);
1179   hole4shape->Z(3)    = ZFromRmaxpCone(coneshape,4,kConeTheta,
1180                                        hole4shape->GetRmax(3));
1181
1182   // Debug if requested
1183   if (GetDebug(1)) {
1184     coneshape->InspectShape();
1185     coneinsertshape->InspectShape();
1186     conefoamshape->InspectShape();
1187     hole1shape->InspectShape();
1188     hole2shape->InspectShape();
1189   }
1190
1191
1192   // We have the shapes: now create the real volumes
1193
1194   TGeoVolume *cfcone = new TGeoVolume("SDDCarbonFiberCone",
1195                                       coneshape,medSDDcf);
1196   cfcone->SetVisibility(kTRUE);
1197   cfcone->SetLineColor(4); // Blue
1198   cfcone->SetLineWidth(1);
1199   cfcone->SetFillColor(cfcone->GetLineColor());
1200   cfcone->SetFillStyle(4000); // 0% transparent
1201
1202   TGeoVolume *cfconeinsert = new TGeoVolume("SDDCarbonFiberConeInsert",
1203                                             coneinsertshape,medSDDste);
1204   cfconeinsert->SetVisibility(kTRUE);
1205   cfconeinsert->SetLineColor(2); // Red
1206   cfconeinsert->SetLineWidth(1);
1207   cfconeinsert->SetFillColor(cfconeinsert->GetLineColor());
1208   cfconeinsert->SetFillStyle(4050); // 50% transparent
1209
1210   TGeoVolume *cfconefoam = new TGeoVolume("SDDCarbonFiberConeFoam",
1211                                           conefoamshape,medSDDroh);
1212   cfconefoam->SetVisibility(kTRUE);
1213   cfconefoam->SetLineColor(7); // Light blue
1214   cfconefoam->SetLineWidth(1);
1215   cfconefoam->SetFillColor(cfconefoam->GetLineColor());
1216   cfconefoam->SetFillStyle(4050); // 50% transparent
1217
1218   TGeoVolume *hole1 = new TGeoVolume("SDDCableHole1",
1219                                      hole1shape,medSDDair);
1220   hole1->SetVisibility(kTRUE);
1221   hole1->SetLineColor(5); // Yellow
1222   hole1->SetLineWidth(1);
1223   hole1->SetFillColor(hole1->GetLineColor());
1224   hole1->SetFillStyle(4090); // 90% transparent
1225
1226   TGeoVolume *hole2 = new TGeoVolume("SDDCableHole2",
1227                                      hole2shape,medSDDair);
1228   hole2->SetVisibility(kTRUE);
1229   hole2->SetLineColor(5); // Yellow
1230   hole2->SetLineWidth(1);
1231   hole2->SetFillColor(hole2->GetLineColor());
1232   hole2->SetFillStyle(4090); // 90% transparent
1233
1234   TGeoVolume *hole3 = new TGeoVolume("SDDCableHole3",
1235                                      hole3shape,medSDDair);
1236   hole3->SetVisibility(kTRUE);
1237   hole3->SetLineColor(5); // Yellow
1238   hole3->SetLineWidth(1);
1239   hole3->SetFillColor(hole3->GetLineColor());
1240   hole3->SetFillStyle(4090); // 90% transparent
1241
1242   TGeoVolume *hole4 = new TGeoVolume("SDDCableHole4",
1243                                      hole4shape,medSDDair);
1244   hole4->SetVisibility(kTRUE);
1245   hole4->SetLineColor(5); // Yellow
1246   hole4->SetLineWidth(1);
1247   hole4->SetFillColor(hole4->GetLineColor());
1248   hole4->SetFillStyle(4090); // 90% transparent
1249
1250   // Mount up a cone
1251   cfconeinsert->AddNode(cfconefoam,1,0);
1252
1253   cfcone->AddNode(cfconeinsert,1,0);
1254
1255   for (Int_t i=0; i<12; i++) {
1256     Double_t phiH = i*30.0;
1257     cfcone->AddNode(hole1, i+1, new TGeoRotation("", 0, 0, phiH));
1258   }
1259
1260   for (Int_t i=0; i<6; i++) {
1261     Double_t phiH = i*60.0;
1262     cfcone->AddNode(hole2, i+1, new TGeoRotation("", 0, 0, phiH));
1263   }
1264
1265   for (Int_t i=0; i<kNHole3; i++) {
1266     Double_t phiH0 = 360./(Double_t)kNHole3;
1267     Double_t phiH  = i*phiH0 + 0.5*phiH0;
1268     cfcone->AddNode(hole3, i+1, new TGeoRotation("", phiH, 0, 0));
1269   }
1270 /*
1271   for (Int_t i=0; i<kNHole4; i++) {
1272     Double_t phiH0 = 360./(Double_t)kNHole4;
1273     Double_t phiH  = i*phiH0 + 0.25*phiH0;
1274     cfcone->AddNode(hole4, i+1, new TGeoRotation("", phiH, 0, 0));
1275   }
1276 */
1277   // Add all volumes in the assembly
1278   vM->AddNode(cfcylinder,1,0);
1279
1280   z = coneshape->Z(9);
1281   vM->AddNode(cfcone,1,new TGeoTranslation(0, 0, -z - kCylinderHalfLength));
1282   vM->AddNode(cfcone,2,new TGeoCombiTrans (0, 0,  z + kCylinderHalfLength,
1283                        new TGeoRotation("", 0, 180, 0)                   ));
1284
1285   // Some debugging if requested
1286   if(GetDebug(1)){
1287     vM->PrintNodes();
1288     vM->InspectShape();
1289   }
1290
1291   // Finally put the entire shield in the mother volume
1292   moth->AddNode(vM,1,0);
1293
1294   return;
1295 }
1296
1297 //______________________________________________________________________
1298 void AliITSv11GeometrySupport::SSDCone(TGeoVolume *moth,TGeoManager *mgr){
1299     // Define the detail SSD support cone geometry.
1300     // Inputs:
1301     //   TGeoVolume  *moth  The mother volume to place this object.
1302     //   TGeoManager *mgr   A pointer to the Geo-Manager default gGeoManager
1303     // Outputs:
1304     //  none.
1305     // Return:
1306     //  none.
1307     //
1308     Int_t i,j;
1309     Double_t t,t0,dt,x,y,z,vl[3],vg[3],x0,y0,rmin,rmax;
1310     TGeoMedium *medSSDcf  = 0; // SSD support cone Carbon Fiber materal number.
1311     TGeoMedium *medSSDfs  = 0; // SSD support cone inserto stesalite 4411w.
1312     TGeoMedium *medSSDfo  = 0; // SSD support cone foam, Rohacell 50A.
1313     TGeoMedium *medSSDss  = 0; // SSD support cone screw material,Stainless
1314     TGeoMedium *medSSDair = 0; // SSD support cone Air
1315     TGeoMedium *medSSDal  = 0; // SSD support cone SDD mounting bracket Al
1316     medSSDcf = mgr->GetMedium("ITSssdCarbonFiber");
1317     medSSDfs = mgr->GetMedium("ITSssdStaselite4411w");
1318     medSSDfo = mgr->GetMedium("ITSssdRohacell50A");
1319     medSSDss = mgr->GetMedium("ITSssdStainlessSteal");
1320     medSSDair= mgr->GetMedium("ITSssdAir");
1321     medSSDal = mgr->GetMedium("ITSssdAl");
1322     //
1323     // SSD Central cylinder/Thermal Sheald.
1324     const Double_t kcylZlength     = 1140.0*fgkmm; //
1325     const Double_t kcylZFoamlength = 1020.0*fgkmm; //
1326     const Double_t kcylROuter      = 0.5*595.0*fgkmm; //
1327     const Double_t kcylRInner      = 0.5*560.5*fgkmm; //
1328     const Double_t kcylCthick      = 0.64*fgkmm; //
1329     const Double_t kcylFoamThick   = 5.0*fgkmm; //
1330     const Double_t kcylRholes      = 0.5*570.0*fgkmm;
1331     const Double_t kcylZM6         = 6.0*fgkmm; //
1332     const Double_t kcylRM6         = 0.5*6.0*fgkmm;
1333     const Double_t kcylPhi0M6      = 4.5*fgkDegree;
1334     const Int_t    kcylNM6         = 40;
1335     const Double_t kcylZPin        = 10.0*fgkmm;
1336     const Double_t kcylRPin        = 0.5*4.0*fgkmm;
1337     const Double_t kcylPhi0Pin     = (90.0+4.5)*fgkDegree;
1338     const Int_t    kcylNPin        = 2;
1339     //
1340     TGeoPcon *sCA,*sCB;
1341     TGeoTube *sCC,*sCD,*sCE;
1342     //
1343     //Begin_Html
1344     /*
1345       <img src="picts/ITS/file_name.gif">
1346       <P>
1347       <FONT FACE'"TIMES">
1348       ITS SSD centreal support and thermal sheal cylinder.
1349       </FONT>
1350       </P>
1351      */
1352     //End_Html
1353     //
1354     sCC = new TGeoTube("ITS SSD Thermal Centeral Rohacell CylinderCC",
1355                        kcylROuter-kcylCthick-kcylFoamThick,
1356                        kcylROuter-kcylCthick,0.5*kcylZFoamlength);
1357     sCA = new TGeoPcon("ITS SSD Thermal Centeral Carbon Fiber CylinderCA",
1358                        0.0,360.0,6);
1359     sCB = new TGeoPcon("ITS SSD Thermal Centeral Stesalite CylinderCB",
1360                        0.0,360.0,6);
1361     sCA->Z(0)    = -0.5*kcylZlength;
1362     sCA->Rmin(0) = kcylRInner;
1363     sCA->Rmax(0) = kcylROuter;
1364     sCA->Z(1)    = sCA->GetZ(0) + kcylZM6;
1365     sCA->Rmin(1) = sCA->GetRmin(0);
1366     sCA->Rmax(1) = sCA->GetRmax(0);
1367     sCA->Z(2)    = -0.5*kcylZFoamlength;
1368     sCA->Rmin(2) = kcylROuter - 2.0*kcylCthick-kcylFoamThick;
1369     sCA->Rmax(2) = sCA->GetRmax(0);
1370     sCA->Z(3)    = -sCA->GetZ(2);
1371     sCA->Rmin(3) = sCA->GetRmin(2);
1372     sCA->Rmax(3) = sCA->GetRmax(2);
1373     sCA->Z(4)    = -sCA->GetZ(1);
1374     sCA->Rmin(4) = sCA->GetRmin(1);
1375     sCA->Rmax(4) = sCA->GetRmax(1);
1376     sCA->Z(5)    = -sCA->GetZ(0);
1377     sCA->Rmin(5) = sCA->GetRmin(0);
1378     sCA->Rmax(5) = sCA->GetRmax(0);
1379     //
1380     sCB->Z(0)    = sCA->GetZ(0);
1381     sCB->Rmin(0) = sCA->GetRmin(0) + kcylCthick;
1382     sCB->Rmax(0) = sCA->GetRmax(0) - kcylCthick;
1383     sCB->Z(1)    = sCA->GetZ(1);
1384     sCB->Rmin(1) = sCA->GetRmin(1) + kcylCthick;
1385     sCB->Rmax(1) = sCA->GetRmax(1) - kcylCthick;
1386     sCB->Z(2)    = sCA->GetZ(2);
1387     sCB->Rmin(2) = sCA->GetRmin(2) + kcylCthick;
1388     sCB->Rmax(2) = sCA->GetRmax(2) - kcylCthick;
1389     sCB->Z(3)    = sCA->GetZ(3);
1390     sCB->Rmin(3) = sCA->GetRmin(3) + kcylCthick;
1391     sCB->Rmax(3) = sCA->GetRmax(3) - kcylCthick;
1392     sCB->Z(4)    = sCA->GetZ(4);
1393     sCB->Rmin(4) = sCA->GetRmin(4) + kcylCthick;
1394     sCB->Rmax(4) = sCA->GetRmax(4) - kcylCthick;
1395     sCB->Z(5)    = sCA->GetZ(5);
1396     sCB->Rmin(5) = sCA->GetRmin(5) + kcylCthick;
1397     sCB->Rmax(5) = sCA->GetRmax(5) - kcylCthick;
1398     //
1399     sCD = new TGeoTube("ITS SSD Thermal Centeral Cylinder M6 screwCD",
1400                       0.0,kcylRM6,0.5*kcylZM6);
1401     sCE = new TGeoTube("ITS SSD Thermal Centeral Cylinder PinCE",
1402                       0.0,kcylRPin,0.5*kcylZPin);
1403     //
1404     if(GetDebug(1)){
1405         sCA->InspectShape();
1406         sCB->InspectShape();
1407         sCC->InspectShape();
1408         sCD->InspectShape();
1409         sCE->InspectShape();
1410     } // end if GetDegut()
1411     TGeoVolume *vCA,*vCB,*vCC,*vCD,*vCE;
1412     vCA = new TGeoVolume("ITSssdCentCylCA",sCA,medSSDcf);
1413     vCA->SetVisibility(kTRUE);
1414     vCA->SetLineColor(4); // blue
1415     vCA->SetLineWidth(1);
1416     vCA->SetFillColor(vCA->GetLineColor());
1417     vCA->SetFillStyle(4000); // 0% transparent
1418     vCB = new TGeoVolume("ITSssdCentCylCB",sCB,medSSDfs);
1419     vCB->SetVisibility(kTRUE);
1420     vCB->SetLineColor(2); // red
1421     vCB->SetLineWidth(1);
1422     vCB->SetFillColor(vCB->GetLineColor());
1423     vCB->SetFillStyle(4050); // 50% transparent
1424     vCC = new TGeoVolume("ITSssdCentCylCC",sCC,medSSDfo);
1425     vCC->SetVisibility(kTRUE);
1426     vCC->SetLineColor(3); // green
1427     vCC->SetLineWidth(1);
1428     vCC->SetFillColor(vCC->GetLineColor());
1429     vCC->SetFillStyle(4050); // 50% transparent
1430     vCD = new TGeoVolume("ITSssdCentCylCD",sCD,medSSDss);
1431     vCD->SetVisibility(kTRUE);
1432     vCD->SetLineColor(1); // black
1433     vCD->SetLineWidth(1);
1434     vCD->SetFillColor(vCD->GetLineColor());
1435     vCD->SetFillStyle(4000); // 0% transparent
1436     vCE = new TGeoVolume("ITSssdCentCylCE",sCE,medSSDss);
1437     vCE->SetVisibility(kTRUE);
1438     vCE->SetLineColor(1); // black
1439     vCE->SetLineWidth(1);
1440     vCE->SetFillColor(vCE->GetLineColor());
1441     vCE->SetFillStyle(4000); // 0% transparent
1442     // Insert Bolt and Pins in both the Cone and Cylinder at the same time.
1443     vCB->AddNode(vCC,1,0);
1444     vCA->AddNode(vCB,1,0);
1445     moth->AddNode(vCA,1,0);
1446     if(GetDebug(1)){
1447         vCA->PrintNodes();
1448         vCB->PrintNodes();
1449         vCC->PrintNodes();
1450         vCD->PrintNodes();
1451         vCE->PrintNodes();
1452     } // end if
1453     //
1454     // SSD Cone
1455     // Data from Drawings ALR 0743/2E "Supporto Globale Settore SSD" and 
1456     // ALR 0743/2A "Supporto Generale Settore SSD".
1457     //
1458     const Double_t kconThick            = 13.0*fgkmm; // Thickness of Cone.
1459     const Double_t kconCthick           = 0.75*fgkmm; // Car. finber thickness
1460     const Double_t kconRCurv0           = 10.0*fgkmm; // Radius of curvature.
1461     const Double_t kconRCurv1           = 25.0*fgkmm; // Radius of curvature.
1462     const Double_t kconT                = 39.0*fgkDegree; // angle of SSD cone.
1463     const Double_t kconZOuterRing       = 47.0*fgkmm;
1464     const Double_t kconZOuterRingMill   = kconZOuterRing-5.0*fgkmm;
1465     const Double_t kconZToCylinder      = 170.0*fgkmm;
1466     const Double_t kconZLengthMill      = 171.5*fgkmm;
1467     const Double_t kconZLength          = 176.5*fgkmm-
1468                                           (kconZOuterRing-kconZOuterRingMill);
1469     //const Double_t kconZInnerRing       = 161.5*fgkmm-
1470     //                                     (kconZOuterRing-kconZOuterRingMill);
1471     const Double_t kconZOuterRingInside = 30.25*fgkmm-
1472                                           (kconZOuterRing-kconZOuterRingMill);
1473     const Double_t kconZDisplacement    = kconZToCylinder + 0.5*kcylZlength;
1474     const Double_t kconROuterMax        = 0.5*985.0*fgkmm;
1475     const Double_t kconROuterMin        = 0.5*945.0*fgkmm;
1476     const Double_t kconRCylOuterMill    = 0.5*597.0*fgkmm;
1477     const Double_t kconRInnerMin        = 0.5*562.0*fgkmm;
1478     //const Double_t kconRCentCurv0       = 0.5*927.0*fgkmm;
1479     const Double_t kconRCentCurv1       = 0.5*593.0*fgkmm;
1480     const Double_t kconRCentCurv2       = 0.5*578.0*fgkmm;
1481     // Foam core.
1482     const Double_t kconRohacellL0       = 112.3*fgkmm;
1483     const Double_t kconRohacellL1       = 58.4*fgkmm;
1484     // Screws and pins in outer SSD cone ring
1485     const Double_t kconROutHoles        = 0.5*965.0*fgkmm;
1486     const Double_t kconRScrewM5by12     = 0.5*5.0*fgkmm;
1487     const Double_t kconLScrewM5by12     = 0.5*12.0*fgkmm;
1488     const Int_t    kconNScrewM5by12     = 2;
1489     const Double_t kconRPinO6           = 0.5*6.0*fgkmm;
1490     const Double_t kconLPinO6           = 0.5*10.0*fgkmm;
1491     const Int_t    kconNPinO6           = 3;
1492     const Int_t    kconNRailScrews      = 4;
1493     const Int_t    kconNRailPins        = 2;
1494     const Int_t    kconNmounts          = 4;
1495     const Double_t kconMountPhi0        = 9.0*fgkDegree; // degrees
1496     //
1497     const Double_t kconCableHoleROut    = 0.5*920.0*fgkmm;
1498     const Double_t kconCableHoleRinner  = 0.5*800.0*fgkmm;
1499     const Double_t kconCableHoleWidth   = 200.0*fgkmm;
1500     const Double_t kconCableHoleAngle   = 42.0*fgkDegree;
1501     //const Double_t kconCableHolePhi0    = 90.0/4.0*fgkDegree;
1502     //const Int_t    kconNCableHoles      = 8;
1503     const Double_t kconCoolHoleWidth    = 40.0*fgkmm;
1504     const Double_t kconCoolHoleHight    = 30.0*fgkmm;
1505     const Double_t kconCoolHoleRmin     = 350.0*fgkmm;
1506     //const Double_t kconCoolHolephi0     = 90.0/4.0*fgkDegree;
1507     //const Int_t    kconNCoolHoles       = 8;
1508     const Double_t kconMountHoleWidth   = 20.0*fgkmm;
1509     const Double_t kconMountHoleHight   = 20.0*fgkmm;
1510     const Double_t kconMountHoleRmin    = 317.5*fgkmm;
1511     //const Double_t kconMountHolephi0    = 0.0*fgkDegree;
1512     //const Int_t    kconNMountHoles      = 6;
1513     // SSD cone Wings with holes.
1514     const Double_t kconWingRmax         = 527.5*fgkmm;
1515     const Double_t kconWingWidth        = 70.0*fgkmm;
1516     const Double_t kconWingThick        = 10.0*fgkmm;
1517     const Double_t kconWingPhi0         = 45.0*fgkDegree;
1518     //const Int_t    kconNWings           = 4;
1519     // SSD-SDD Thermal/Mechanical cylinder mounts
1520     const Double_t kconRM6Head          = 0.5*8.0*fgkmm;
1521     const Double_t kconZM6Head          = 8.5*fgkmm;
1522     //
1523     // SSD-SDD Mounting bracket
1524     const Double_t ksupPRmin            = 0.5*539.0*fgkmm;// see SDD RoutMin
1525     const Double_t ksupPRmax            = 0.5*585.0*fgkmm;
1526     const Double_t ksupPZ               = 4.0*fgkmm;
1527     const Double_t ksupPPhi1            = (-0.5*70.*fgkmm/ksupPRmax)*fgkRadian;
1528     const Double_t ksupPPhi2            = -ksupPPhi1;
1529     //
1530     const Double_t kSinkconTc           = SinD(kconT);
1531     const Double_t kCoskconTc           = CosD(kconT);
1532     //
1533     TGeoPcon *sA0,*sB0,*sC0,*sF0,*sQ;
1534     TGeoConeSeg *sAh1,*sBh1;
1535     TGeoArb8 *sAh2,*sBh2;
1536     TGeoBBox *sAh3,*sBh3,*sAh4,*sBh4;
1537     TGeoConeSeg *sG,*sH;
1538     TGeoTubeSeg *sT;
1539     TGeoTube *sD,*sE,*sR,*sS;
1540     TGeoCompositeShape *sA,*sB,*sC,*sF;
1541     //
1542     // Lets start with the upper left outer carbon fiber surface.
1543     // Between za[2],rmaxa[2] and za[4],rmaxa[4] there is a curved section
1544     // given by rmaxa = rmaxa[2]-r*Sind(t) for 0<=t<=kconT and 
1545     // za = za[2] + r*Cosd(t) for 0<=t<=kconT. Simularly between za[1],rmina[1
1546     // and za[3],rmina[3] there is a curve section given by
1547     // rmina = rmina[1]-r*Sind(t) for 0<=t<=kconT and za = za[1]+r&Sind(t)
1548     // for t<=0<=kconT. These curves have been replaced by straight lines
1549     // between the equivelent points for simplicity.
1550     // Poly-cone Volume sA0. Top part of SSD cone Carbon Fiber.
1551     sA0 = new TGeoPcon("ITSssdSuportConeCarbonFiberSurfaceA0",0.0,360.0,15);
1552     sA0->Z(0)    = 0.0;
1553     sA0->Rmin(0) = kconROuterMin;
1554     sA0->Rmax(0) = kconROuterMax;
1555     sA0->Z(1)    = kconZOuterRingInside-kconRCurv0;
1556     sA0->Rmin(1) = sA0->GetRmin(0);
1557     sA0->Rmax(1) = sA0->GetRmax(0);
1558     sA0->Z(2)    = kconZOuterRingInside;
1559     sA0->Rmin(2) = sA0->GetRmin(1)-kconRCurv0;
1560     sA0->Rmax(2) = sA0->GetRmax(0);
1561     sA0->Z(3)    = sA0->GetZ(2);
1562     sA0->Rmin(3) = -1000; // See Below
1563     sA0->Rmax(3) = sA0->GetRmax(0);
1564     sA0->Z(4)    = kconZOuterRingMill-kconRCurv0;
1565     sA0->Rmin(4) = -1000; // See Below
1566     sA0->Rmax(4) = sA0->GetRmax(0);
1567     sA0->Z(5)    = kconZOuterRingMill;
1568     sA0->Rmin(5) = -1000; // See Below
1569     sA0->Rmax(5) = sA0->GetRmax(4) - kconRCurv0;
1570     sA0->Z(6)    = sA0->GetZ(5);
1571     sA0->Rmin(6) = -1000; // See Below
1572     sA0->Rmax(6) = -1000; // See Below
1573     sA0->Z(7)    = sA0->GetZ(6)+kconRCurv0*(1.-kCoskconTc);
1574     sA0->Rmin(7) = -1000; // See Below
1575     sA0->Rmax(7) = -1000; // See Below
1576     sA0->Z(8)    = -1000; // See Below
1577     sA0->Rmin(8) = kconRCentCurv2+kconRCurv1*kSinkconTc; // See Below
1578     sA0->Rmax(8) = -1000; // See Below
1579     sA0->Z(9)    = -1000; // See Below
1580     sA0->Rmin(9) = kconRCentCurv2;
1581     sA0->Rmax(9) = -1000; // See Below
1582     sA0->Z(10)   = -1000; // See Below
1583     sA0->Rmin(10)= kconRInnerMin;
1584     sA0->Rmax(10)= -1000; // See Below
1585     sA0->Z(11)   = kconZLengthMill-kconRCurv0*(1.0-kCoskconTc);
1586     sA0->Rmin(11)= sA0->GetRmin(10);
1587     sA0->Rmax(11)= kconRCentCurv1+kconRCurv0*kSinkconTc;
1588     sA0->Z(12)   = kconZToCylinder;
1589     sA0->Rmin(12)= sA0->GetRmin(10);
1590     sA0->Rmax(12)= -1000; // See Below
1591     sA0->Z(13)   = sA0->GetZ(12);
1592     sA0->Rmin(13)= kconRCylOuterMill;
1593     sA0->Rmax(13)= -1000; // See Below
1594     z            = kconZLengthMill;
1595     rmin         = kconRCentCurv1;
1596     rmax         = rmin;
1597     sA0->Z(14)   = -1000; // See Below
1598     sA0->Rmin(14)= sA0->GetRmin(13);
1599     sA0->Rmax(14)= sA0->GetRmin(14);
1600     // Compute values undefined above
1601     sA0->Z(14)   = Xfrom2Points(sA0->GetZ(11),sA0->GetRmax(11),z,rmax,
1602                                sA0->GetRmax(14));
1603     sA0->Z(8)    = ZFromRmaxpCone(sA0,11,90.-kconT,sA0->GetRmin(8),-kconThick);
1604     sA0->Rmax(8) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(8),0.0);
1605     sA0->Z(9)    = sA0->GetZ(8)+kconRCurv1*(1.-kCoskconTc);
1606     sA0->Z(10)   = sA0->GetZ(9);
1607     sA0->Rmin(3) = RminFromZpCone(sA0,8,90.-kconT,sA0->GetZ(3),0.0);
1608     sA0->Rmin(4) = RminFromZpCone(sA0,3,90.-kconT,sA0->GetZ(4),0.0);
1609     sA0->Rmin(5) = RminFromZpCone(sA0,3,90.-kconT,sA0->GetZ(5),0.0);
1610     sA0->Rmin(7) = RminFromZpCone(sA0,3,90.-kconT,sA0->GetZ(7),0.0);
1611     sA0->Rmax(7) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(7),0.0);
1612     sA0->Rmin(6) = sA0->GetRmin(5);
1613     sA0->Rmax(6) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(7),0.0);
1614     sA0->Rmax(9) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(9),0.0);
1615     sA0->Rmax(10)= sA0->GetRmax(9);
1616     t = TanD(270.+kconT);
1617     sA0->Rmax(12)= RmaxFrom2Points(sA0,11,14,sA0->GetZ(12));
1618     sA0->Rmax(13)= sA0->GetRmax(12);
1619     //
1620     // Poly-cone Volume B. Stesalite inside volume sA0.
1621     // Now lets define the Inserto Stesalite 4411w material volume.
1622     // Poly-cone Volume sA0. Top part of SSD cone Carbon Fiber.
1623     sB0 = new TGeoPcon("ITSssdSuportConeStaseliteB0",0.0,360.0,15);
1624     //
1625     sB0->Z(0)    = sA0->GetZ(0);
1626     sB0->Rmin(0) = sA0->GetRmin(0) + kconCthick;
1627     sB0->Rmax(0) = sA0->GetRmax(0) - kconCthick;
1628     //printf("A0#%d ",1);
1629     InsidePoint(sA0,0,1,2,kconCthick,sB0,1,kFALSE); // Rmin
1630     sB0->Rmax(1) = sB0->Rmax(0);
1631     //printf("A0#%d ",2);
1632     InsidePoint(sA0,1,2,3,kconCthick,sB0,2,kFALSE); // Rmin
1633     sB0->Rmax(2) = sB0->Rmax(0);
1634     //printf("A0#%d ",3);
1635     InsidePoint(sA0,2,3,9,kconCthick,sB0,3,kFALSE);
1636     sB0->Rmax(3) = sB0->Rmax(0);
1637     //printf("A0#%d ",4);
1638     InsidePoint(sA0,0,4,5,kconCthick,sB0,4,kTRUE); // Rmax
1639     sB0->Rmin(4) = -1000.; // see Bellow
1640     //printf("A0#%d ",5);
1641     InsidePoint(sA0,4,5,6,kconCthick,sB0,5,kTRUE); // Rmax
1642     sB0->Rmin(5) = -1000.; // see Bellow
1643     //printf("A0#%d ",6);
1644     InsidePoint(sA0,5,6,7,kconCthick,sB0,6,kTRUE); // Rmax
1645     sB0->Rmin(6) = -1000.; // see Bellow
1646     //printf("A0#%d ",7);
1647     InsidePoint(sA0,6,7,11,kconCthick,sB0,7,kTRUE); // Rmax
1648     sB0->Rmin(7) = -1000.; // see Bellow
1649     //printf("A0#%d ",8);
1650     InsidePoint(sA0,3,8,9,kconCthick,sB0,8,kFALSE); // Rmin
1651     sB0->Rmax(8) = -1000.; // see Bellow
1652     //printf("A0#%d ",9);
1653     InsidePoint(sA0,8,9,10,kconCthick,sB0,9,kFALSE); // Rmin
1654     sB0->Rmax(9) = -1000.; // see Bellow
1655     sB0->Z(10)   = sA0->GetZ(10) + kconCthick;
1656     sB0->Rmin(10)= sA0->GetRmin(10);
1657     sB0->Rmax(10)= -1000.; // see Bellow
1658     //printf("A0#%d ",11);
1659     InsidePoint(sA0,7,11,14,kconCthick,sB0,11,kTRUE); // Rmax
1660     sB0->Rmin(11)= sA0->GetRmin(10);
1661     sB0->Z(12)    = sA0->GetZ(12);
1662     sB0->Rmin(12)= sA0->GetRmin(12);
1663     sB0->Rmax(12)= -1000.; // see Bellow
1664     sB0->Z(13)   = sA0->GetZ(13);
1665     sB0->Rmin(13)= sA0->GetRmin(13);
1666     sB0->Rmax(13)= -1000.; // see Bellow
1667     sB0->Z(14)   = sA0->GetZ(14) - kconCthick;
1668     sB0->Rmin(14)= sA0->GetRmin(14);
1669     sB0->Rmax(14)= sB0->Rmin(14); // Close?
1670     sB0->Rmin(4) = RminFrom2Points(sB0,3,8,sB0->GetZ(4));
1671     sB0->Rmin(5) = RminFrom2Points(sB0,3,8,sB0->GetZ(5));
1672     sB0->Rmin(6) = sB0->GetRmin(5);
1673     sB0->Rmin(7) = RminFrom2Points(sB0,3,8,sB0->GetZ(7));
1674     sB0->Rmax(8) = RmaxFrom2Points(sB0,7,11,sB0->GetZ(8));
1675     sB0->Rmax(9) = RmaxFrom2Points(sB0,7,11,sB0->GetZ(9));
1676     sB0->Rmax(10)= sB0->GetRmax(9);
1677     sB0->Rmax(12)= RmaxFrom2Points(sB0,11,14,sB0->GetZ(12));
1678     sB0->Rmax(13)= RmaxFrom2Points(sB0,11,14,sB0->GetZ(13));
1679     //
1680     // Poly-cone Volume sC0. Foam inside volume sA0.
1681     // Now lets define the Rohacell foam material volume.
1682     sC0 = new TGeoPcon("ITSssdSuportConeRohacellC0",0.0,360.0,4);
1683     sC0->Z(1)    = sB0->GetZ(7);
1684     sC0->Rmax(1) = sB0->GetRmax(7);
1685     sC0->Rmin(1) = RminFrom2Points(sB0,3,8,sC0->GetZ(1));
1686     sC0->Rmin(0) = sC0->GetRmax(1);
1687     sC0->Rmax(0) = sC0->GetRmin(0);
1688     sC0->Z(0)    = Zfrom2MinPoints(sB0,3,8,sC0->Rmin(0));
1689     t = kconThick-2.0*kconCthick;
1690     sC0->Rmax(3) = sC0->GetRmax(0)-kCoskconTc*TMath::Sqrt(
1691                              kconRohacellL0*kconRohacellL0-t*t)+t*kSinkconTc;
1692     sC0->Rmin(3) = sC0->GetRmax(3);
1693     sC0->Z(3)    = ZFromRmaxpCone(sB0,11,90.-kconT,sC0->GetRmax(3),0.0);;
1694     sC0->Rmin(2) = sC0->GetRmin(3);
1695     sC0->Z(2)    = ZFromRminpCone(sB0,3,90.-kconT,sC0->GetRmin(2),0.0);
1696     sC0->Rmax(2) = RmaxFromZpCone(sB0,11,90.0-kconT,sC0->GetZ(2),0.0);
1697     //
1698     // Poly-cone Volume sF0.  Second Foam inside volume sA0.
1699     // Now lets define the Rohacell foam material volume.
1700     sF0 = new TGeoPcon("ITSssdSuportConeRohacellCF0",0.0,360.0,4);
1701     sF0->Z(2)    = sB0->GetZ(8);
1702     sF0->Rmin(2) = sB0->GetRmin(8);
1703     sF0->Rmax(2) = sB0->GetRmax(8);
1704     sF0->Z(0)    = sF0->GetZ(2)-kconRohacellL1*kSinkconTc;
1705     sF0->Rmin(0) = sF0->GetRmin(2)+kconRohacellL1*kCoskconTc;
1706     sF0->Rmax(0) = sF0->GetRmin(0);
1707     sF0->Z(1)    = ZFromRmaxpCone(sB0,11,90.-kconT,sF0->GetRmax(0),0.0);;
1708     sF0->Rmax(1) = sF0->GetRmax(0);
1709     sF0->Rmin(1) = RminFrom2Points(sB0,3,8,sF0->GetZ(1));
1710     sF0->Rmax(3) = sF0->GetRmin(2)+(kconThick-2.0*kconCthick)*kCoskconTc;
1711     sF0->Rmin(3) = sF0->GetRmax(3);
1712     sF0->Z(3)    = ZFromRmaxpCone(sB0,11,90.-kconT,sF0->GetRmax(3),0.0);
1713     // Holes for Cables to pass Through is created by the intersection
1714     // between a cone segment and an Arb8, One for the volume sA0 and a
1715     // larger one for the volumes sB0 and sC0, so that the surface is covered
1716     // in carbon figer (volume sA0).
1717     sAh1 = new TGeoConeSeg("ITSssdCableHoleAh1",
1718                            0.5*kconZLength,kconCableHoleRinner,
1719                            kconCableHoleROut,kconCableHoleRinner,
1720                            kconCableHoleROut,
1721                            90.-(0.5*kconCableHoleWidth/
1722                                 kconCableHoleROut)*fgkRadian,
1723                            90.+(0.5*kconCableHoleWidth/
1724                                 kconCableHoleROut)*fgkRadian);
1725     sBh1 = new TGeoConeSeg("ITSssdCableHoleBh1",0.5*kconZLength,
1726                            kconCableHoleRinner-kconCthick,
1727                            kconCableHoleROut+kconCthick,
1728                            kconCableHoleRinner-kconCthick,
1729                            kconCableHoleROut+kconCthick,
1730                            90.-(((0.5*kconCableHoleWidth+kconCthick)/
1731                                  (kconCableHoleROut+kconCthick)))*fgkRadian,
1732                            90.+(((0.5*kconCableHoleWidth+kconCthick)/
1733                                  (kconCableHoleROut+kconCthick)))*fgkRadian);
1734     x0 = sAh1->GetRmax1()*CosD(sAh1->GetPhi2());
1735     y0 = sAh1->GetRmax1()*SinD(sAh1->GetPhi2());
1736     sAh2 = new TGeoArb8("ITSssdCableHoleAh2",0.5*kconZLength);
1737     y  = sAh1->GetRmax1();
1738     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1739     sAh2->SetVertex(0,x,y);
1740     y  = sAh1->GetRmin1()*SinD(sAh1->GetPhi2());
1741     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1742     sAh2->SetVertex(3,x,y);
1743     x0 = sAh1->GetRmax1()*CosD(sAh1->GetPhi1());
1744     y0 = sAh1->GetRmax1()*SinD(sAh1->GetPhi1());
1745     y  = sAh1->GetRmax1();
1746     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1747     sAh2->SetVertex(1,x,y);
1748     y  = sAh1->GetRmin1()*SinD(sAh1->GetPhi1());
1749     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1750     sAh2->SetVertex(2,x,y);
1751     //
1752     x0 = sBh1->GetRmax1()*CosD(sBh1->GetPhi2());
1753     y0 = sBh1->GetRmax1()*SinD(sBh1->GetPhi2());
1754     sBh2 = new TGeoArb8("ITSssdCableHoleBh2",0.5*kconZLength);
1755     y  = sBh1->GetRmax1();
1756     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1757     sBh2->SetVertex(0,x,y);
1758     y  = sBh1->GetRmin1()*SinD(sBh1->GetPhi2());
1759     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1760     sBh2->SetVertex(3,x,y);
1761     x0 = sBh1->GetRmax1()*CosD(sBh1->GetPhi1());
1762     y0 = sBh1->GetRmax1()*SinD(sBh1->GetPhi1());
1763     y  = sBh1->GetRmax1();
1764     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1765     sBh2->SetVertex(1,x,y);
1766     y  = sBh1->GetRmin1()*SinD(sBh1->GetPhi1());
1767     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1768     sBh2->SetVertex(2,x,y);
1769     for(i=0;i<4;i++){ // define points at +dz
1770         sAh2->SetVertex(i+4,(sAh2->GetVertices())[2*i],
1771                            (sAh2->GetVertices())[1+2*i]);
1772         sBh2->SetVertex(i+4,(sBh2->GetVertices())[2*i],
1773                            (sBh2->GetVertices())[1+2*i]);
1774     } // end for i
1775     sAh3 = new TGeoBBox("ITSssdCoolingHoleAh3",0.5*kconCoolHoleWidth,
1776                         0.5*kconCoolHoleHight,kconZLength);
1777     sBh3 = new TGeoBBox("ITSssdCoolingHoleBh3",
1778                         0.5*kconCoolHoleWidth+kconCthick,
1779                         0.5*kconCoolHoleHight+kconCthick,kconZLength);
1780     sAh4 = new TGeoBBox("ITSssdMountingPostHoleAh4",0.5*kconMountHoleWidth,
1781                         0.5*kconMountHoleHight,0.5*kconZLength);
1782     z = sF0->GetZ(0)-sF0->GetZ(sF0->GetNz()-1);
1783     if(z<0.0) z = -z;
1784     sBh4 = new TGeoBBox("ITSssdMountingPostHoleBh4",
1785                         0.5*kconMountHoleWidth+kconCthick,
1786                         0.5*kconMountHoleHight+kconCthick,0.5*z);
1787     // SSD Cone Wings
1788     sG = new TGeoConeSeg("ITSssdWingCarbonFiberSurfaceG",
1789                          0.5*kconWingThick,kconROuterMax-kconCthick,
1790                          kconWingRmax,kconROuterMax-kconCthick,kconWingRmax,
1791                       kconWingPhi0-(0.5*kconWingWidth/kconWingRmax)*fgkRadian,
1792                       kconWingPhi0+(0.5*kconWingWidth/kconWingRmax)*fgkRadian);
1793     sH = new TGeoConeSeg("ITSssdWingStaseliteH",
1794                          0.5*kconWingThick-kconCthick,kconROuterMax-kconCthick,
1795                          kconWingRmax-kconCthick,
1796                          kconROuterMax-kconCthick,
1797                          kconWingRmax-kconCthick,
1798                          kconWingPhi0-((0.5*kconWingWidth-kconCthick)/
1799                                        (kconWingRmax-kconCthick))*fgkRadian,
1800                          kconWingPhi0+((0.5*kconWingWidth-kconCthick)/
1801                                        (kconWingRmax-kconCthick))*fgkRadian);
1802     // SDD support plate, SSD side.
1803     //Poly-cone Volume sT.
1804     sT = new TGeoTubeSeg("ITSssdsddMountingBracketT",ksupPRmin,ksupPRmax,
1805                          0.5*ksupPZ,ksupPPhi1,ksupPPhi2);
1806     //
1807     TGeoRotation *rotZ225 =new TGeoRotation("ITSssdConeZ225", 0.0,0.0, 22.5);
1808     rotZ225->RegisterYourself();
1809     TGeoRotation *rotZ675 =new TGeoRotation("ITSssdConeZ675", 0.0,0.0, 67.5);
1810     rotZ675->RegisterYourself();
1811     TGeoRotation *rotZ90  =new TGeoRotation("ITSssdConeZ90",  0.0,0.0, 90.0);
1812     rotZ90->RegisterYourself();
1813     TGeoRotation *rotZ1125=new TGeoRotation("ITSssdConeZ1125",0.0,0.0,112.5);
1814     rotZ1125->RegisterYourself();
1815     TGeoRotation *rotZ1575=new TGeoRotation("ITSssdConeZ1575",0.0,0.0,157.5);
1816     rotZ1575->RegisterYourself();
1817     TGeoRotation *rotZ180 =new TGeoRotation("ITSssdConeZ180", 0.0,0.0,180.0);
1818     rotZ180->RegisterYourself();
1819     TGeoRotation *rotZ2025=new TGeoRotation("ITSssdConeZ2025",0.0,0.0,202.5);
1820     rotZ2025->RegisterYourself();
1821     TGeoRotation *rotZ2475=new TGeoRotation("ITSssdConeZ2475",0.0,0.0,247.5);
1822     rotZ2475->RegisterYourself();
1823     TGeoRotation *rotZ270 =new TGeoRotation("ITSssdConeZ270", 0.0,0.0,270.0);
1824     rotZ270->RegisterYourself();
1825     TGeoRotation *rotZ2925=new TGeoRotation("ITSssdConeZ2925",0.0,0.0,292.5);
1826     rotZ2925->RegisterYourself();
1827     TGeoRotation *rotZ3375=new TGeoRotation("ITSssdConeZ3375",0.0,0.0,337.5);
1828     rotZ3375->RegisterYourself();
1829     //
1830     vl[0] = 0.0;vl[1] = kconCoolHoleRmin+0.5*kconCoolHoleHight;vl[2] = 0.0;
1831     rotZ225->LocalToMaster(vl,vg);
1832     TGeoCombiTrans *rotranA225  = new TGeoCombiTrans("ITSssdConeTZ225",vg[0],
1833                                                      vg[1],vg[2],rotZ225);
1834     rotranA225->RegisterYourself();
1835     rotZ675->LocalToMaster(vl,vg);
1836     TGeoCombiTrans *rotranA675  = new TGeoCombiTrans("ITSssdConeTZ675", vg[0],
1837                                                      vg[1],vg[2],rotZ675);
1838     rotranA675->RegisterYourself();
1839     rotZ1125->LocalToMaster(vl,vg);
1840     TGeoCombiTrans *rotranA1125 = new TGeoCombiTrans("ITSssdConeTZ1125",vg[0],
1841                                                      vg[1],vg[2],rotZ1125);
1842     rotranA1125->RegisterYourself();
1843     rotZ1575->LocalToMaster(vl,vg);
1844     TGeoCombiTrans *rotranA1575 = new TGeoCombiTrans("ITSssdConeTZ1575",vg[0],
1845                                                      vg[1],vg[2],rotZ1575);
1846     rotranA1575->RegisterYourself();
1847     rotZ2025->LocalToMaster(vl,vg);
1848     TGeoCombiTrans *rotranA2025 = new TGeoCombiTrans("ITSssdConeTZ2025",vg[0],
1849                                                      vg[1],vg[2],rotZ2025);
1850     rotranA2025->RegisterYourself();
1851     rotZ2475->LocalToMaster(vl,vg);
1852     TGeoCombiTrans *rotranA2475 = new TGeoCombiTrans("ITSssdConeTZ2475",vg[0],
1853                                                      vg[1],vg[2],rotZ2475);
1854     rotranA2475->RegisterYourself();
1855     rotZ2925->LocalToMaster(vl,vg);
1856     TGeoCombiTrans *rotranA2925 = new TGeoCombiTrans("ITSssdConeTZ2925",vg[0],
1857                                                      vg[1],vg[2],rotZ2925);
1858     rotranA2925->RegisterYourself();
1859     rotZ3375->LocalToMaster(vl,vg);
1860     TGeoCombiTrans *rotranA3375 = new TGeoCombiTrans("ITSssdConeTZ3375",vg[0],
1861                                                      vg[1],vg[2],rotZ3375);
1862     rotranA3375->RegisterYourself();
1863     TGeoRotation *rotZ30  = new TGeoRotation("ITSssdConeZ30", 0.0,0.0, 30.0);
1864     TGeoRotation *rotZ60  = new TGeoRotation("ITSssdConeZ60", 0.0,0.0, 60.0);
1865     //TGeoRotation *rotZ120 = new TGeoRotation("ITSssdConeZ120",0.0,0.0,120.0);
1866     TGeoRotation *rotZ150 = new TGeoRotation("ITSssdConeZ150",0.0,0.0,150.0);
1867     TGeoRotation *rotZ210 = new TGeoRotation("ITSssdConeZ210",0.0,0.0,210.0);
1868     //TGeoRotation *rotZ240 = new TGeoRotation("ITSssdConeZ240",0.0,0.0,240.0);
1869     TGeoRotation *rotZ300 = new TGeoRotation("ITSssdConeZ300",0.0,0.0,300.0);
1870     TGeoRotation *rotZ330 = new TGeoRotation("ITSssdConeZ330",0.0,0.0,330.0);
1871     vl[0] = kconMountHoleRmin+0.5*kconMountHoleHight; vl[1] = 0.0; vl[2] = 0.0;
1872     for(i=0;i<sF0->GetNz();i++) vl[2] += sF0->GetZ(i);
1873     vl[2] /= (Double_t)(sF0->GetNz());
1874     rotZ30->LocalToMaster(vl,vg);
1875     TGeoCombiTrans *rotranA30 = new TGeoCombiTrans("ITSssdConeTZ30",vg[0],
1876                                                       vg[1],vg[2],rotZ30);
1877     rotranA30->RegisterYourself();
1878     rotZ90->LocalToMaster(vl,vg);
1879     TGeoCombiTrans *rotranA90  = new TGeoCombiTrans("ITSssdConeTZ90", vg[0],
1880                                                      vg[1],vg[2],rotZ90);
1881     rotranA90->RegisterYourself();
1882     rotZ150->LocalToMaster(vl,vg);
1883     TGeoCombiTrans *rotranA150 = new TGeoCombiTrans("ITSssdConeTZ150",vg[0],
1884                                                      vg[1],vg[2],rotZ150);
1885     rotranA150->RegisterYourself();
1886     rotZ210->LocalToMaster(vl,vg);
1887     TGeoCombiTrans *rotranA210 = new TGeoCombiTrans("ITSssdConeTZ210",vg[0],
1888                                                      vg[1],vg[2],rotZ210);
1889     rotranA210->RegisterYourself();
1890     rotZ270->LocalToMaster(vl,vg);
1891     TGeoCombiTrans *rotranA270 = new TGeoCombiTrans("ITSssdConeTZ270",vg[0],
1892                                                      vg[1],vg[2],rotZ270);
1893     rotranA270->RegisterYourself();
1894     rotZ330->LocalToMaster(vl,vg);
1895     TGeoCombiTrans *rotranA330 = new TGeoCombiTrans("ITSssdConeTZ330",vg[0],
1896                                                      vg[1],vg[2],rotZ330);
1897     rotranA330->RegisterYourself();
1898     vl[0] = 0.0; vl[1] = 0.0; vl[2] = sA0->GetZ(10)+sT->GetDz();
1899     rotZ60->LocalToMaster(vl,vg);
1900     TGeoCombiTrans *rotranBrTZ60  = new TGeoCombiTrans("ITSssdConeBrTZ60",
1901                                                   vg[0],vg[1],vg[2],rotZ60);
1902     rotranBrTZ60->RegisterYourself();
1903     TGeoCombiTrans *rotranBrTZ180 = new TGeoCombiTrans("ITSssdConeBrTZ180",
1904                                                   vg[0],vg[1],vg[2],rotZ180);
1905     rotranBrTZ180->RegisterYourself();
1906     TGeoCombiTrans *rotranBrTZ300 = new TGeoCombiTrans("ITSssdConeBrTZ300",
1907                                                   vg[0],vg[1],vg[2],rotZ300);
1908     rotranBrTZ300->RegisterYourself();
1909     if(GetDebug(1)){
1910         rotZ225->Print();
1911         rotZ675->Print();
1912         rotZ90->Print();
1913         rotZ1125->Print();
1914         rotZ1575->Print();
1915         rotZ180->Print();
1916         rotZ2025->Print();
1917         rotZ2475->Print();
1918         rotZ270->Print();
1919         rotZ2925->Print();
1920         rotZ3375->Print();
1921         rotranA225->Print();
1922         rotranA675->Print();
1923         rotranA1125->Print();
1924         rotranA1575->Print();
1925         rotranA2025->Print();
1926         rotranA2475->Print();
1927         rotranA2925->Print();
1928         rotranA3375->Print();
1929         rotZ60->Print();
1930         rotZ300->Print();
1931         rotranA30->Print();
1932         rotranA90->Print();
1933         rotranA150->Print();
1934         rotranA210->Print();
1935         rotranA270->Print();
1936         rotranA330->Print();
1937         rotranBrTZ60->Print();
1938         rotranBrTZ180->Print();
1939         rotranBrTZ300->Print();
1940     } // end if GetDebug(1)
1941     sA = new TGeoCompositeShape("ITSssdSuportConeCarbonFiberSurfaceA",
1942         "(((((((((((((((((((((((((((("
1943         "ITSssdSuportConeCarbonFiberSurfaceA0 +"
1944         "ITSssdWingCarbonFiberSurfaceG) +"
1945         "ITSssdWingCarbonFiberSurfaceG:ITSssdConeZ90) +"
1946         "ITSssdWingCarbonFiberSurfaceG:ITSssdConeZ180) +"
1947         "ITSssdWingCarbonFiberSurfaceG:ITSssdConeZ270) -"
1948         "(ITSssdCableHoleAh1:ITSssdConeZ225*ITSssdCableHoleAh2:ITSssdConeZ225)) -"
1949         "(ITSssdCableHoleAh1:ITSssdConeZ675*ITSssdCableHoleAh2:ITSssdConeZ675)) -"
1950         "(ITSssdCableHoleAh1:ITSssdConeZ1125*ITSssdCableHoleAh2:ITSssdConeZ1125)) -"
1951         "(ITSssdCableHoleAh1:ITSssdConeZ1575*ITSssdCableHoleAh2:ITSssdConeZ1575)) -"
1952         "(ITSssdCableHoleAh1:ITSssdConeZ2025*ITSssdCableHoleAh2:ITSssdConeZ2025)) -"
1953         "(ITSssdCableHoleAh1:ITSssdConeZ2475*ITSssdCableHoleAh2:ITSssdConeZ2475)) -"
1954         "(ITSssdCableHoleAh1:ITSssdConeZ2925*ITSssdCableHoleAh2:ITSssdConeZ2925)) -"
1955         "(ITSssdCableHoleAh1:ITSssdConeZ3375*ITSssdCableHoleAh2:ITSssdConeZ3375)) -"
1956         "ITSssdCoolingHoleAh3:ITSssdConeTZ225) -"
1957         "ITSssdCoolingHoleAh3:ITSssdConeTZ675) -"
1958         "ITSssdCoolingHoleAh3:ITSssdConeTZ1125) -"
1959         "ITSssdCoolingHoleAh3:ITSssdConeTZ1575) -"
1960         "ITSssdCoolingHoleAh3:ITSssdConeTZ2025) -"
1961         "ITSssdCoolingHoleAh3:ITSssdConeTZ2475) -"
1962         "ITSssdCoolingHoleAh3:ITSssdConeTZ2925) -"
1963         "ITSssdCoolingHoleAh3:ITSssdConeTZ3375) -"
1964         "ITSssdMountingPostHoleAh4:ITSssdConeTZ30) -"
1965         "ITSssdMountingPostHoleAh4:ITSssdConeTZ90) -"
1966         "ITSssdMountingPostHoleAh4:ITSssdConeTZ150) -"
1967         "ITSssdMountingPostHoleAh4:ITSssdConeTZ210) -"
1968         "ITSssdMountingPostHoleAh4:ITSssdConeTZ270) -"
1969         "ITSssdMountingPostHoleAh4:ITSssdConeTZ330) -"
1970         "ITSssdsddMountingBracketT:ITSssdConeBrTZ60) -"
1971         "ITSssdsddMountingBracketT:ITSssdConeBrTZ180) -"
1972         "ITSssdsddMountingBracketT:ITSssdConeBrTZ300"
1973         );
1974     sB = new TGeoCompositeShape("ITSssdSuportConeStaseliteB",
1975         "(((((((((((((((((((((((((((("
1976         "ITSssdSuportConeStaseliteB0 +"
1977         "ITSssdWingStaseliteH) +"
1978         "ITSssdWingStaseliteH:ITSssdConeZ90) +"
1979         "ITSssdWingStaseliteH:ITSssdConeZ180) +"
1980         "ITSssdWingStaseliteH:ITSssdConeZ270) -"
1981         "(ITSssdCableHoleBh1:ITSssdConeZ225*ITSssdCableHoleBh2:ITSssdConeZ225)) -"
1982         "(ITSssdCableHoleBh1:ITSssdConeZ675*ITSssdCableHoleBh2:ITSssdConeZ675)) -"
1983         "(ITSssdCableHoleBh1:ITSssdConeZ1125*ITSssdCableHoleBh2:ITSssdConeZ1125)) -"
1984         "(ITSssdCableHoleBh1:ITSssdConeZ1575*ITSssdCableHoleBh2:ITSssdConeZ1575)) -"
1985         "(ITSssdCableHoleBh1:ITSssdConeZ2025*ITSssdCableHoleBh2:ITSssdConeZ2025)) -"
1986         "(ITSssdCableHoleBh1:ITSssdConeZ2475*ITSssdCableHoleBh2:ITSssdConeZ2475)) -"
1987         "(ITSssdCableHoleBh1:ITSssdConeZ2925*ITSssdCableHoleBh2:ITSssdConeZ2925)) -"
1988         "(ITSssdCableHoleBh1:ITSssdConeZ3375*ITSssdCableHoleBh2:ITSssdConeZ3375)) -"
1989         "ITSssdCoolingHoleBh3:ITSssdConeTZ225) -"
1990         "ITSssdCoolingHoleBh3:ITSssdConeTZ675) -"
1991         "ITSssdCoolingHoleBh3:ITSssdConeTZ1125) -"
1992         "ITSssdCoolingHoleBh3:ITSssdConeTZ1575) -"
1993         "ITSssdCoolingHoleBh3:ITSssdConeTZ2025) -"
1994         "ITSssdCoolingHoleBh3:ITSssdConeTZ2475) -"
1995         "ITSssdCoolingHoleBh3:ITSssdConeTZ2925) -"
1996         "ITSssdCoolingHoleBh3:ITSssdConeTZ3375) -"
1997         "ITSssdMountingPostHoleBh4:ITSssdConeTZ30) -"
1998         "ITSssdMountingPostHoleBh4:ITSssdConeTZ90) -"
1999         "ITSssdMountingPostHoleBh4:ITSssdConeTZ150) -"
2000         "ITSssdMountingPostHoleBh4:ITSssdConeTZ210) -"
2001         "ITSssdMountingPostHoleBh4:ITSssdConeTZ270) -"
2002         "ITSssdMountingPostHoleBh4:ITSssdConeTZ330) -"
2003         "ITSssdsddMountingBracketT:ITSssdConeBrTZ60) -"
2004         "ITSssdsddMountingBracketT:ITSssdConeBrTZ180) -"
2005         "ITSssdsddMountingBracketT:ITSssdConeBrTZ300"
2006         );
2007     sC = new TGeoCompositeShape("ITSssdSuportConeRohacellC",
2008       "((((((("
2009       "ITSssdSuportConeRohacellC0 -"
2010       "ITSssdCableHoleBh1:ITSssdConeZ225*ITSssdCableHoleBh2:ITSssdConeZ225) -"
2011       "ITSssdCableHoleBh1:ITSssdConeZ675*ITSssdCableHoleBh2:ITSssdConeZ675) -"
2012       "ITSssdCableHoleBh1:ITSssdConeZ1125*ITSssdCableHoleBh2:ITSssdConeZ1125) -"
2013       "ITSssdCableHoleBh1:ITSssdConeZ1575*ITSssdCableHoleBh2:ITSssdConeZ1575) -"
2014       "ITSssdCableHoleBh1:ITSssdConeZ2025*ITSssdCableHoleBh2:ITSssdConeZ2025) -"
2015       "ITSssdCableHoleBh1:ITSssdConeZ2475*ITSssdCableHoleBh2:ITSssdConeZ2475) -"
2016       "ITSssdCableHoleBh1:ITSssdConeZ2925*ITSssdCableHoleBh2:ITSssdConeZ2925) -"
2017       "ITSssdCableHoleBh1:ITSssdConeZ3375*ITSssdCableHoleBh2:ITSssdConeZ3375 "
2018         );
2019     sF = new TGeoCompositeShape("ITSssdSuportConeRohacellCF",
2020         "((((("
2021         "ITSssdSuportConeRohacellCF0 -"
2022         "ITSssdMountingPostHoleBh4:ITSssdConeTZ30) -"
2023         "ITSssdMountingPostHoleBh4:ITSssdConeTZ90) -"
2024         "ITSssdMountingPostHoleBh4:ITSssdConeTZ150) -"
2025         "ITSssdMountingPostHoleBh4:ITSssdConeTZ210) -"
2026         "ITSssdMountingPostHoleBh4:ITSssdConeTZ270) -"
2027         "ITSssdMountingPostHoleBh4:ITSssdConeTZ330"
2028         );
2029     //
2030     // In volume SCB, th Inserto Stesalite 4411w material volume, there
2031     // are a number of Stainless steel screw and pin studs which will be
2032     // filled with screws/studs.
2033     sD = new TGeoTube("ITS Screw+stud used to mount things to the SSD "
2034                       "support cone",
2035                       0.0,kconRScrewM5by12,kconLScrewM5by12);
2036     sE = new TGeoTube("ITS pin used to mount things to the "
2037                       "SSD support cone",0.0,kconRPinO6,kconLPinO6);
2038     // Bolt heads holding the SSD-SDD tube to the SSD cone.
2039     // Bolt -- PolyCone
2040     //Poly-cone Volume sQ.
2041     sQ = new TGeoPcon("ITS SSD Thermal sheald M6 screw headQ",0.0,360.0,4);
2042     sQ->Z(0)    = sA0->GetZ(12);
2043     sQ->Rmin(0) = 0.0;
2044     sQ->Rmax(0) = kcylRM6;
2045     sQ->Z(1)    = sA0->GetZ(10) + kconZM6Head;
2046     sQ->Rmin(1) = 0.0;
2047     sQ->Rmax(1) = kcylRM6;
2048     sQ->Z(2)    = sQ->GetZ(1);
2049     sQ->Rmin(2) = 0.0;
2050     sQ->Rmax(2) = kconRM6Head;
2051     sQ->Z(3)    = sA0->GetZ(10)+ksupPZ;
2052     sQ->Rmin(3) = 0.0;
2053     sQ->Rmax(3) = kconRM6Head;
2054     // air infront of bolt (stasolit Volume K) -- Tube
2055     sR = new TGeoTube("ITS Air in front of bolt (in stasolit)R",
2056                       sQ->GetRmin(3),sQ->GetRmax(3),0.5*(ksupPZ-kconCthick));
2057     // air infront of bolt (carbon fiber volume I) -- Tube
2058     sS = new TGeoTube("ITS Air in front of Stainless Steal Screw end, M6S",
2059                       sQ->GetRmin(3),sQ->GetRmax(3),0.5*kconCthick);
2060     //
2061     if(GetDebug(1)){
2062         sA0->InspectShape();
2063         sB0->InspectShape();
2064         sC0->InspectShape();
2065         sF0->InspectShape();
2066         sQ->InspectShape();
2067         sAh1->InspectShape();
2068         sBh1->InspectShape();
2069         sAh2->InspectShape();
2070         sBh2->InspectShape();
2071         sAh3->InspectShape();
2072         sBh3->InspectShape();
2073         sAh4->InspectShape();
2074         sBh4->InspectShape();
2075         sG->InspectShape();
2076         sH->InspectShape();
2077         sT->InspectShape();
2078         sD->InspectShape();
2079         sE->InspectShape();
2080         sR->InspectShape();
2081         sS->InspectShape();
2082         sA->InspectShape();
2083         sB->InspectShape();
2084         sC->InspectShape();
2085         sF->InspectShape();
2086     } // end if GetDebug(1)
2087     TGeoVolume *vA,*vB,*vC,*vD,*vE,*vF,*vQ,*vR,*vS,*vT;
2088     //
2089     vA = new TGeoVolume("ITSssdConeA",sA,medSSDcf); // Carbon Fiber
2090     vA->SetVisibility(kTRUE);
2091     vA->SetLineColor(4); // blue
2092     vA->SetLineWidth(1);
2093     vA->SetFillColor(vA->GetLineColor());
2094     vA->SetFillStyle(4050); // 50% transparent
2095     vB = new TGeoVolume("ITSssdConeB",sB,medSSDfs); // Staselite
2096     vB->SetVisibility(kTRUE);
2097     vB->SetLineColor(2); // red
2098     vB->SetLineWidth(1);
2099     vB->SetFillColor(vB->GetLineColor());
2100     vB->SetFillStyle(4050); // 50% transparent
2101     vC = new TGeoVolume("ITSssdConeC",sC,medSSDfo); // Rohacell
2102     vC->SetVisibility(kTRUE);
2103     vC->SetLineColor(3); // green
2104     vC->SetLineWidth(1);
2105     vC->SetFillColor(vC->GetLineColor());
2106     vC->SetFillStyle(4050); // 50% transparent
2107     vF = new TGeoVolume("ITSssdConeF",sF,medSSDfo); // Rohacell;
2108     vF->SetVisibility(kTRUE);
2109     vF->SetLineColor(3); // green
2110     vF->SetLineWidth(1);
2111     vF->SetFillColor(vF->GetLineColor());
2112     vF->SetFillStyle(4050); // 50% transparent
2113     vD = new TGeoVolume("ITSssdConeD",sD,medSSDss);
2114     vD->SetVisibility(kTRUE);
2115     vD->SetLineColor(1); // black
2116     vD->SetLineWidth(1);
2117     vD->SetFillColor(vD->GetLineColor());
2118     vD->SetFillStyle(4000); // 0% transparent
2119     vE = new TGeoVolume("ITSssdConeE",sE,medSSDss);
2120     vE->SetVisibility(kTRUE);
2121     vE->SetLineColor(1); // black
2122     vE->SetLineWidth(1);
2123     vE->SetFillColor(vE->GetLineColor());
2124     vE->SetFillStyle(4000); // 0% transparent
2125     vQ = new TGeoVolume("ITSssdConeQ",sQ,medSSDss);
2126     vQ->SetVisibility(kTRUE);
2127     vQ->SetLineColor(1); // black
2128     vQ->SetLineWidth(1);
2129     vQ->SetFillColor(vQ->GetLineColor());
2130     vQ->SetFillStyle(4000); // 0% transparent
2131     vR = new TGeoVolume("ITSssdConeR",sR,medSSDair);
2132     vR->SetVisibility(kTRUE);
2133     vR->SetLineColor(5); // yellow
2134     vR->SetLineWidth(1);
2135     vR->SetFillColor(vR->GetLineColor());
2136     vR->SetFillStyle(4090); // 90% transparent
2137     vS = new TGeoVolume("ITSssdConeS",sS,medSSDair);
2138     vS->SetVisibility(kTRUE);
2139     vS->SetLineColor(5); // yellow
2140     vS->SetLineWidth(1);
2141     vS->SetFillColor(vS->GetLineColor());
2142     vS->SetFillStyle(4090); // 90% transparent
2143     vT = new TGeoVolume("ITSssdsddMountingBracket",sT,medSSDal);
2144     vT->SetVisibility(kTRUE);
2145     vT->SetLineColor(5); // yellow
2146     vT->SetLineWidth(1);
2147     vT->SetFillColor(vT->GetLineColor());
2148     vT->SetFillStyle(4000); // 0% transparent
2149     //
2150     TGeoCombiTrans *rotran;
2151     TGeoTranslation *tran;
2152     tran = new TGeoTranslation("ITSssdConeTrans",0.0,0.0,-kconZDisplacement);
2153     TGeoRotation *rotY180 = new TGeoRotation("",0.0,180.0,0.0);
2154     TGeoCombiTrans *flip  = new TGeoCombiTrans("ITSssdConeFlip",
2155                                            0.0,0.0,kconZDisplacement,rotY180);
2156     //delete rotY180;// rot not explicity used in AddNode functions.
2157     //
2158     //
2159     //
2160     //
2161     vA->AddNode(vB,1,0);
2162     vB->AddNode(vC,1,0);
2163     vB->AddNode(vF,1,0);
2164     moth->AddNode(vA,1,tran); // RB24 side
2165     moth->AddNode(vA,2,flip); // RB26 side (Absorber)
2166     //
2167     //
2168     //
2169     // Insert Bolt and Pins in both the Cone and Cylinder at the same time.
2170     Int_t nCopyCDv=0,nCopyCEv=0,nCopyQv=0,nCopyvR=0,nCopySv=0,nCopyTv=0;
2171     Int_t nCopyvD=0,nCopyvE=0;
2172     z = sCB->GetZ(0)+sCD->GetDz(); // sCB->GetZ(0)<0!
2173     dt = (360.0/((Double_t)kcylNPin));
2174     for(i=0;i<kcylNPin;i++){
2175         t = ((Double_t)i)*dt;
2176         x = kcylRholes*CosD(t+kcylPhi0Pin);
2177         y = kcylRholes*SinD(t+kcylPhi0Pin);
2178         tran = new TGeoTranslation("",x,y,z);
2179         vCB->AddNode(vCD,++nCopyCDv,tran);
2180         tran = new TGeoTranslation("",x,y,-z);
2181         vCB->AddNode(vCD,++nCopyCDv,tran);
2182     } // end for i
2183     dt = (360.0/((Double_t)kcylNM6));
2184     for(i=0;i<kcylNM6;i++){
2185         t = ((Double_t)i)*dt;
2186         x = kcylRholes*CosD(t+kcylPhi0M6);
2187         y = kcylRholes*SinD(t+kcylPhi0M6);
2188         z = sCB->GetZ(0)+sCE->GetDz(); // sCB->GetZ()<0!
2189         tran = new TGeoTranslation("",x,y,z);
2190         vCB->AddNode(vCE,++nCopyCEv,tran);
2191         tran = new TGeoTranslation("",x,y,-z);
2192         vCB->AddNode(vCE,++nCopyCEv,tran);
2193         tran = new TGeoTranslation("",x,y,0.0);
2194         vB->AddNode(vQ,++nCopyQv,tran);
2195         if(!((t<rotranBrTZ60->GetRotation()->GetPhiRotation()+sT->GetPhi2()&&
2196              t>rotranBrTZ60->GetRotation()->GetPhiRotation()-sT->GetPhi1())||
2197             (t<rotranBrTZ180->GetRotation()->GetPhiRotation()+sT->GetPhi2()&&
2198              t>rotranBrTZ180->GetRotation()->GetPhiRotation()-sT->GetPhi1())||
2199             (t<rotranBrTZ300->GetRotation()->GetPhiRotation()+sT->GetPhi2()&&
2200              t>rotranBrTZ300->GetRotation()->GetPhiRotation()-sT->GetPhi1()))){
2201             // If not at an angle where the bracket sT is located.
2202             tran = new TGeoTranslation("",x,y,sB0->GetZ(10)-sR->GetDz());
2203             vB->AddNode(vR,++nCopyvR,tran);
2204             tran = new TGeoTranslation("",x,y,sA0->GetZ(10)-sS->GetDz());
2205             vA->AddNode(vS,++nCopySv,tran);
2206         } // end if
2207     } // end for i
2208     // Add the mounting brackets to the RB24 side only.
2209     vl[0] = 0.0;
2210     vl[1] = 0.0;
2211     vl[2] = sA0->GetZ(10)+kconZDisplacement-sT->GetDz();
2212     rotZ60->LocalToMaster(vl,vg);
2213     rotran = new TGeoCombiTrans("",vg[0],vg[1],vg[2],rotZ60);
2214     moth->AddNode(vT,++nCopyTv,rotran);
2215     rotZ180->LocalToMaster(vl,vg);
2216     rotran = new TGeoCombiTrans("",vg[0],vg[1],vg[2],rotZ180);
2217     moth->AddNode(vT,++nCopyTv,rotran);
2218     rotZ300->LocalToMaster(vl,vg);
2219     rotran = new TGeoCombiTrans("",vg[0],vg[1],vg[2],rotZ300);
2220     moth->AddNode(vT,++nCopyTv,rotran);
2221     //
2222     Double_t da[] = {-3.5,-1.5,1.5,3.5};
2223     for(i=0;i<2;i++){ // Mounting for ITS-TPC bracket or ITS-Rails
2224         t0 = 180.*((Double_t)i);
2225         for(j=-kconNScrewM5by12/2;j<=kconNScrewM5by12/2;j++)if(j!=0){
2226                     //screws per ITS-TPC brkt
2227             t = t0 + 5.0*((Double_t)j);
2228             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2229                                           kconROutHoles*SinD(t),
2230                                           sB0->GetZ(0)+sE->GetDz());
2231             vB->AddNode(vE,++nCopyvE,tran);
2232         } // end or j
2233         for(j=-kconNPinO6/2;j<=kconNPinO6/2;j++){ // pins per ITS-TPC bracket
2234             t = t0 + 3.0*((Double_t)j);
2235             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2236                                           kconROutHoles*SinD(t),
2237                                           sB0->GetZ(0)+sD->GetDz());
2238             vB->AddNode(vD,++nCopyvD,tran);
2239         } // end or j
2240         t0 = (-5.5+191.*((Double_t)i));
2241         for(j=0;j<kconNRailScrews;j++){ // screws per ITS-rail bracket
2242             t = t0+da[j];
2243             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2244                                           kconROutHoles*SinD(t),
2245                                           sB0->GetZ(0)+sE->GetDz());
2246             vB->AddNode(vE,++nCopyvE,tran);
2247         } // end or j
2248         t0 = (95.5+191.*((Double_t)i));
2249         for(j=-kconNRailPins/2;j<=kconNRailPins/2;j++)if(j!=0){ 
2250              // pins per ITS-rail bracket
2251             t = t0+(5.5*((Double_t)j));
2252             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2253                                           kconROutHoles*SinD(t),
2254                                           sB0->GetZ(0)+sD->GetDz());
2255             vB->AddNode(vD,++nCopyvD,tran);
2256         } // end or j
2257     } // end for i
2258     for(i=0;i<kconNmounts;i++){ 
2259                 // mounting points for SPD-cone+Beam-pipe support
2260         t0 = (45.0+((Double_t)i)*360./((Double_t)kconNmounts));
2261         for(j=-1;j<=1;j++)if(j!=0){ // 2 screws per bracket
2262             t = t0+((Double_t)j)*0.5*kconMountPhi0;
2263             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2264                                           kconROutHoles*SinD(t),
2265                                           sB0->GetZ(0)+sD->GetDz());
2266             vB->AddNode(vD,++nCopyvD,tran);
2267         } // end for j
2268         for(j=0;j<1;j++){ // 1 pin per bracket
2269             t = t0;
2270             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2271                                           kconROutHoles*SinD(t),
2272                                           sB0->GetZ(0)+sD->GetDz());
2273             vB->AddNode(vE,++nCopyvE,tran);
2274         } // end for j
2275     } // end for i
2276     if(GetDebug(1)){
2277         vA->PrintNodes();
2278         vB->PrintNodes();
2279         vC->PrintNodes();
2280         vD->PrintNodes();
2281         vE->PrintNodes();
2282         vF->PrintNodes();
2283         vQ->PrintNodes();
2284         vR->PrintNodes();
2285         vS->PrintNodes();
2286         vT->PrintNodes();
2287     } // end if
2288 }
2289
2290 //______________________________________________________________________
2291 void AliITSv11GeometrySupport::ServicesCableSupport(TGeoVolume *moth,
2292                                                     TGeoManager *mgr){
2293     // Define the detail ITS cable support trays on both the RB24 and 
2294     // RB26 sides..
2295     // Inputs:
2296     //   TGeoVolume  *moth  The mother volume to place this object.
2297     //   TGeoManager *mgr   A pointer to the Geo-Manager default gGeoManager
2298     // Outputs:
2299     //  none.
2300     // Return:
2301     //  none.
2302     // Based on the Drawings SSup_201A.jpg unless otherwise stated, 
2303     // Volumes A..., 
2304     TGeoMedium *medSUPcf    = 0; // SUP support cone Carbon Fiber materal nbr.
2305     TGeoMedium *medSUPfs    = 0; // SUP support cone inserto stesalite 4411w.
2306     TGeoMedium *medSUPfo    = 0; // SUP support cone foam, Rohacell 50A.
2307     TGeoMedium *medSUPss    = 0; // SUP support cone screw material,Stainless
2308     TGeoMedium *medSUPair   = 0; // SUP support cone Air
2309     TGeoMedium *medSUPal    = 0; // SUP support cone SDD mounting bracket Al
2310     TGeoMedium *medSUPwater = 0; // SUP support cone Water
2311     medSUPcf    = mgr->GetMedium("ITSssdCarbonFiber");
2312     medSUPfs    = mgr->GetMedium("ITSssdStaselite4411w");
2313     medSUPfo    = mgr->GetMedium("ITSssdRohacell50A");
2314     medSUPss    = mgr->GetMedium("ITSssdStainlessSteal");
2315     medSUPair   = mgr->GetMedium("ITSssdAir");
2316     medSUPal    = mgr->GetMedium("ITSssdAl");
2317     medSUPwater = mgr->GetMedium("ITSssdWater");
2318     //
2319     Int_t i,j,iRmin;
2320     Double_t x,y,z,t,t0,dt,di,r,l,local[3],master[3];
2321     Char_t name[100];
2322     Double_t r1,r2,m;
2323     // RB 24, Open Side.
2324     const Double_t kfrm24Z0           = 900*fgkmm;//SSup_203A.jpg
2325     const Double_t kfrm24Thss         = 5.0*fgkmm;
2326     const Double_t kfrm24Rss          = 444.5*fgkmm-kfrm24Thss; //SSup_204A.jpg
2327     const Double_t kfrm24Width        = 10.0*fgkmm;
2328     const Double_t kfrm24Hight        = 10.0*fgkmm;
2329     const Double_t kfrm24Phi0         = 15.2*fgkDegree; // SSup_602A.jpg
2330     const Double_t kfrm24Phi1         = (90.0-7.6)*fgkDegree; // SSup_802A.jpg
2331     const Double_t kfrm24ZssSection   = (415.0-10.0)*fgkmm;
2332     const Int_t    kfrm24NZsections   = 4;
2333     const Int_t    kfrm24NPhiSections = 4;
2334     const Int_t    kfrm24NPhi         = 4;
2335     // These numbers are guessed at.
2336     const Double_t kfrm24ZfracAngle   =  0.55; // frational z length to brack
2337     const Double_t kfrm24Angle        =  10.0*fgkDegree; // Guessed at
2338     //
2339     TGeoTubeSeg *sA24[kfrm24NZsections+1];
2340     TGeoArb8    *sB24[kfrm24NZsections+1];
2341     Double_t zA24[kfrm24NZsections+1];
2342     l = 4.*kfrm24ZssSection+5*kfrm24Width;
2343     j = iRmin = 0;
2344     for(i=0;i<kfrm24NZsections+1;i++){
2345         sprintf(name,"ITS sup Cable tray support frame radial section A24[%d]",
2346                 i);
2347         r1 = kfrm24Rss;
2348         if(i==0) zA24[i] = kfrm24Width;
2349         else zA24[i] = zA24[i-1] + kfrm24ZssSection + kfrm24Width;
2350         if(zA24[i]>l*kfrm24ZfracAngle){ // break, radii get larger
2351             r1 = kfrm24Rss + (zA24[i]-kfrm24ZfracAngle*l)*SinD(kfrm24Angle);
2352         } // end if
2353         r2 = r1+kfrm24Thss;
2354         sA24[i] = new TGeoTubeSeg(name,r1,r2,0.5*kfrm24Width,kfrm24Phi0,
2355                                   kfrm24Phi1);
2356         if(i>0)if(sA24[i-1]->GetRmin()==sA24[i]->GetRmin()) j = iRmin = i;
2357     } // end for i
2358     for(i=0;i<kfrm24NZsections;i++){
2359         sprintf(name,"ITS sup Cable tray support frame Z section B24[%d]",i);
2360         sB24[i] = new TGeoArb8(name,0.5*kfrm24ZssSection);
2361         sB24[i]->SetVertex(0,sA24[i]->GetRmin(),0.5*kfrm24Hight);
2362         sB24[i]->SetVertex(1,sA24[i]->GetRmax(),0.5*kfrm24Hight);
2363         sB24[i]->SetVertex(2,sA24[i]->GetRmin(),-0.5*kfrm24Hight);
2364         sB24[i]->SetVertex(3,sA24[i]->GetRmax(),-0.5*kfrm24Hight);
2365         sB24[i]->SetVertex(4,sA24[i+1]->GetRmin(),0.5*kfrm24Hight);
2366         sB24[i]->SetVertex(5,sA24[i+1]->GetRmax(),0.5*kfrm24Hight);
2367         sB24[i]->SetVertex(6,sA24[i+1]->GetRmin(),-0.5*kfrm24Hight);
2368         sB24[i]->SetVertex(7,sA24[i+1]->GetRmax(),-0.5*kfrm24Hight);
2369     } // end for i
2370     if(GetDebug(1)){
2371         for(i=0;i<kfrm24NZsections+1;i++) sA24[i]->InspectShape();
2372         for(i=0;i<kfrm24NZsections;i++)   sB24[i]->InspectShape();
2373     } // end if GetDebug(1)
2374     TGeoVolume *vA24[kfrm24NZsections+1],*vB24[kfrm24NZsections];
2375     TGeoVolumeAssembly *vM24;
2376     TGeoTranslation *tran;
2377     TGeoRotation    *rot,*rot1;
2378     TGeoCombiTrans  *tranrot;
2379     //
2380     for(i=0;i<kfrm24NZsections+1;i++){
2381         vA24[i] = 0;
2382         sprintf(name,"ITSsupFrameA24[%d]",i);
2383         vA24[i] = new TGeoVolume(name,sA24[i],medSUPss);
2384         vA24[i]->SetVisibility(kTRUE);
2385         vA24[i]->SetLineColor(1); // black
2386         vA24[i]->SetLineWidth(1);
2387         vA24[i]->SetFillColor(vA24[i]->GetLineColor());
2388         vA24[i]->SetFillStyle(4000); // 0% transparent
2389     } // end for i
2390     for(i=0;i<kfrm24NZsections;i++){
2391         vB24[i] = 0;
2392         sprintf(name,"ITSsupFrameB24[%d]",i);
2393         vB24[i] = new TGeoVolume(name,sB24[i],medSUPss);
2394         vB24[i]->SetVisibility(kTRUE);
2395         vB24[i]->SetLineColor(1); // black
2396         vB24[i]->SetLineWidth(1);
2397         vB24[i]->SetFillColor(vB24[i]->GetLineColor());
2398         vB24[i]->SetFillStyle(4000); // 0% transparent
2399     } // end for i
2400     vM24 = new TGeoVolumeAssembly("ITSsupFrameM24");
2401     //vM24->SetVisibility(kTRUE);
2402     //vM24->SetLineColor(7); // light blue
2403     //vM24->SetLineWidth(1);
2404     //vM24->SetFillColor(vM24->GetLineColor());
2405     //vM24->SetFillStyle(4090); // 90% transparent
2406     //
2407     Int_t ncopyB24[kfrm24NPhiSections];
2408     t0 = kfrm24Phi0;
2409     dt = (kfrm24Phi1-kfrm24Phi0)/((Double_t)kfrm24NPhiSections);
2410     for(i=0;i<=kfrm24NZsections;i++){
2411         z = zA24[i];
2412         tran = new TGeoTranslation("",0.0,0.0,z);
2413         vM24->AddNode(vA24[i],1,tran);
2414        if(i<kfrm24NZsections){
2415            ncopyB24[i] = 1;
2416            for(j=0;j<=kfrm24NPhiSections;j++){
2417                t = t0 + ((Double_t)j)*dt;
2418                rot = new TGeoRotation("",0.0,0.0,t);
2419                tranrot = new TGeoCombiTrans("",0.0,0.0,z+sB24[i]->GetDz(),rot);
2420                //delete rot;// rot not explicity used in AddNode functions.
2421                vM24->AddNode(vB24[i],ncopyB24[i]++,tranrot);
2422            } // end for j
2423        } // end if
2424     } // end for i
2425     tran = new TGeoTranslation("",0.0,0.0,kfrm24Z0);
2426     moth->AddNode(vM24,1,tran);
2427     for(i=1;i<kfrm24NPhi;i++){
2428         di = (Double_t) i;
2429         rot = new TGeoRotation("",0.0,0.0,90.0*di);
2430         tranrot = new TGeoCombiTrans("",0.0,0.0,kfrm24Z0,rot);
2431         //delete rot;// rot not explicity used in AddNode functions.
2432         moth->AddNode(vM24,i+1,tranrot);
2433     } // end for i
2434     if(GetDebug(1)){
2435         for(i=0;i<kfrm24NZsections+1;i++) vA24[i]->PrintNodes();
2436         for(i=0;i<kfrm24NZsections;i++) vB24[i]->PrintNodes();
2437         vM24->PrintNodes();
2438     } // end if
2439     //==================================================================
2440     // RB24 Cable Tray
2441     const Double_t kct24WidthBottom   = 44.0*fgkmm; // Serv-C_208.jpg
2442     const Double_t kct24WidthTop      = 46.0*fgkmm; // Serv-C_208.jpg
2443     const Double_t kct24Hight         = 51.0*fgkmm; // Serv-C_208.jpg
2444     const Double_t kct24AlThick       = 1.0*fgkmm; // Serv-C_208.jpg
2445     const Double_t kct24CapWidth      = 46.0*fgkmm; // Serv-C_208.jpg
2446     const Double_t kct24CapEar        = 5.0*fgkmm; // Guess
2447     const Double_t kct24Rmin          = 455.0*fgkmm; // Serv-C_203.jpg
2448     const Double_t kct24CoolSectionH  = 470.0*fgkmm-kct24Rmin;// Serv-C_203.jpg
2449     const Double_t kct24CoolCableDivEar = 2.0*fgkmm; // Guess
2450     const Int_t kct24Ntrays           = 48; // Serv-C_205.jpg
2451     //const Int_t kct24Ntubes           = 3; // Serv-C_208.jpg
2452     // Patch Pannels for RB 24 side
2453     const Double_t kft24PPHightSPDFMD = 72.0*fgkmm; // Serv-C_SPD/FMD.jpg
2454     const Double_t kft24PPHightSDDSSD = 104.0*fgkmm; // Serv-C_SDD/SSD.jpg
2455     const Double_t kft24PPlength      = 350.0*fgkmm;//Serv-C_SPD/SDD/SSD/FMD_1.jpg
2456     const Double_t kft24Theta         = 2.0*TMath::ATan2(kct24WidthBottom,
2457                                                  2.0*kct24Rmin)*fgkRadian; //
2458     const Int_t    kft24NPatchPannels = 20; //
2459     //
2460     Double_t xp[12],yp[12];
2461     TGeoPcon *sMT24;
2462     TGeoXtru *sT24,*sTs24,*sTl24,*sTt24,*sU24,*sVl24,*sVs24,*sW24;
2463     TGeoXtru *s3PP24,*s2PP24,*sV3PP24,*sV2PP24;
2464     // Outer Tray Full
2465     sT24 = new TGeoXtru(3);
2466     sT24->SetName("ITS sup Full Cable Tray for RB24 Side T24");
2467     xp[0]  = -0.5*kct24WidthBottom;
2468     yp[0]  = sA24[0]->GetRmax();
2469     yp[1]  = yp[0] + kct24Hight-kct24CapEar;
2470     xp[1]  = Xfrom2Points(xp[0],yp[0],-0.5*kct24WidthTop+kct24AlThick,
2471                           yp[0]+kct24Hight,yp[1]);
2472     yp[2]  = yp[1];
2473     xp[2]  = xp[1]-kct24AlThick;
2474     xp[3]  = -0.5*kct24CapWidth;
2475     yp[3]  = yp[0] + kct24Hight;
2476     xp[4]  = -xp[3];
2477     yp[4]  =  yp[3];
2478     xp[5]  = -xp[2];
2479     yp[5]  =  yp[2];
2480     xp[6]  = -xp[1];
2481     yp[6]  =  yp[1];
2482     xp[7]  = -xp[0];
2483     yp[7]  =  yp[0];
2484     sT24->DefinePolygon(8,xp,yp);
2485     sT24->DefineSection(0,zA24[0]-kfrm24Width,0.0,0.0,1.0);
2486     sT24->DefineSection(1,zA24[iRmin],0.0,0.0,1.0);
2487     sT24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,0.0,
2488                       sA24[kfrm24NZsections]->GetRmax()-sA24[0]->GetRmin());
2489     // RB 24 full tray no divider (for ALG and T0-V0 cables?)
2490     sW24 = new TGeoXtru(3);
2491     sW24->SetName("ITS sup Cable Tray No Divider for RB24 Side W24");
2492     xp[0] = sT24->GetX(0) + kct24AlThick;
2493     yp[0] = sT24->GetY(0) + kct24AlThick;
2494     yp[1] = sT24->GetY(3) - kct24AlThick;
2495     xp[1] = Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2496                          sT24->GetY(1),yp[1]) + kct24AlThick;
2497     xp[2] = -xp[1];
2498     yp[2] =  yp[1];
2499     xp[3] = -xp[0];
2500     yp[3] =  yp[0];
2501     sW24->DefinePolygon(4,xp,yp);
2502     for(i=0;i<sT24->GetNz();i++){
2503         sW24->DefineSection(i,sT24->GetZ(i),sT24->GetXOffset(i),
2504                             sT24->GetYOffset(i),sT24->GetScale(i));
2505     } // end for i
2506     // Outer Tray Short
2507     sTs24 = new TGeoXtru(3);
2508     sTs24->SetName("ITS sup Short Cable Tray for RB24 Side Ts24");
2509     yp[0]  = sT24->GetY(0) + kct24CoolSectionH;
2510     xp[0]  = Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2511                          sT24->GetY(1),yp[0]);
2512     for(i=1;i<7;i++){
2513         xp[i]  = sT24->GetX(i);
2514         yp[i]  = sT24->GetY(i);
2515     } // end for i
2516     xp[7]  = -xp[0];
2517     yp[7]  =  yp[0];
2518     sTs24->DefinePolygon(8,xp,yp);
2519     sTs24->DefineSection(0,zA24[0] -kfrm24Width+kft24PPlength);
2520     sTs24->DefineSection(1,zA24[iRmin]);
2521     sTs24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,
2522                          sT24->GetXOffset(2),
2523                          sT24->GetYOffset(2),sT24->GetScale(2));
2524     // Outer Tray Long
2525     sTl24 = new TGeoXtru(3);
2526     sTl24->SetName("ITS sup Long Cable Tray for RB24 Side Tl24");
2527     for(i=0;i<8;i++){
2528     xp[i]  = sTs24->GetX(i);
2529     yp[i]  = sTs24->GetY(i);
2530     } // End for i
2531     sTl24->DefinePolygon(8,xp,yp);
2532     sTl24->DefineSection(0,zA24[0]-kfrm24Width,0.0,0.0,1.0);
2533     sTl24->DefineSection(1,zA24[iRmin],0.0,0.0,1.0);
2534     sTl24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,0.0,
2535                      sA24[kfrm24NZsections]->GetRmax()-sA24[0]->GetRmin(),1.0);
2536     // Outer Tray for air Tubes
2537     sTt24 = new TGeoXtru(3);
2538     sTt24->SetName("ITS sup Long Air Tube Tray for RB24 Side Tt24");
2539     xp[0]  = sT24->GetX(0);
2540     yp[0]  = sT24->GetY(0);
2541     xp[1]  = sTl24->GetX(0);
2542     yp[1]  = sTl24->GetY(0);
2543     xp[2]  = -xp[1];
2544     yp[2]  =  yp[1];
2545     xp[3]  = -xp[0];
2546     yp[3]  =  yp[0];
2547     sTt24->DefinePolygon(4,xp,yp);
2548     sTt24->DefineSection(0,zA24[0]-kfrm24Width,0.0,0.0,1.0);
2549     sTt24->DefineSection(1,zA24[iRmin],0.0,0.0,1.0);
2550     sTt24->DefineSection(2,zA24[kfrm24NZsections]+kfrm24Width,0.0,
2551                          sA24[kfrm24NZsections]->GetRmax()-sA24[0]->GetRmin());
2552     // Inner opening for cooling (lower) {inside sTt24}
2553     sU24 = new TGeoXtru(3);
2554     sU24->SetName("ITS sup Cable Tray Cooling tube space RB24 Side U24");
2555     xp[0] = sTt24->GetX(0) + kct24AlThick;
2556     yp[0] = sTt24->GetY(0) + kct24AlThick;
2557     xp[1] = sTt24->GetX(1) + kct24AlThick;
2558     yp[1] = sTt24->GetY(1) - kct24AlThick;
2559     xp[2] = -xp[1];
2560     yp[2] =  yp[1];
2561     xp[3] = -xp[0];
2562     yp[3] =  yp[0];
2563     sU24->DefinePolygon(4,xp,yp);
2564     for(i=0;i<sTt24->GetNz();i++){
2565         sU24->DefineSection(i,sTt24->GetZ(i),sTt24->GetXOffset(i),
2566                             sTt24->GetYOffset(i),sTt24->GetScale(i));
2567     } // end for i
2568     // Inner opening for cables (upper) {inside sTl24}
2569     sVl24 = new TGeoXtru(3);
2570     sVl24->SetName("ITS sup Cable Tray Cable space RB24 Side Vl24");
2571     xp[0] = sTl24->GetX(0)+2.0*kct24AlThick;
2572     yp[0] = sTl24->GetY(0);
2573     yp[1] = yp[0] + kct24CoolCableDivEar;
2574     xp[1] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2575                          sTl24->GetX(1),sTl24->GetY(1),yp[1])+2.0*kct24AlThick;
2576     yp[2] = yp[1];
2577     xp[2] = xp[1] - kct24AlThick;
2578     yp[3] = sTl24->GetY(3) - kct24AlThick;
2579     xp[3] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),sTl24->GetX(1),
2580                          sTl24->GetY(1),yp[3]) + kct24AlThick;
2581     xp[4] = -xp[3];
2582     yp[4] =  yp[3];
2583     xp[5] = -xp[2];
2584     yp[5] =  yp[2];
2585     xp[6] = -xp[1];
2586     yp[6] =  yp[1];
2587     xp[7] = -xp[0];
2588     yp[7] =  yp[0];
2589     sVl24->DefinePolygon(8,xp,yp);
2590     for(i=0;i<sTl24->GetNz();i++){
2591         sVl24->DefineSection(i,sTl24->GetZ(i),sTl24->GetXOffset(i),
2592                             sTl24->GetYOffset(i),sTl24->GetScale(i));
2593     } // end for i
2594     // Inner opening for cables (upper) {inside sTs24}
2595     sVs24 = new TGeoXtru(3);
2596     sVs24->SetName("ITS sup Cable Tray Cable space RB24 Side Vs24");
2597     sVs24->DefinePolygon(8,xp,yp);
2598     for(i=0;i<8;i++){
2599     xp[i]  = sVl24->GetX(i);
2600     yp[i]  = sVl24->GetY(i);
2601     } // end for i
2602     for(i=0;i<sTl24->GetNz();i++){
2603         sVs24->DefineSection(i,sTs24->GetZ(i),sTs24->GetXOffset(i),
2604                             sTs24->GetYOffset(i),sTs24->GetScale(i));
2605     } // end for i
2606     //------------------------------------------------------------------
2607     // Patch Pannels on RB 24 Side
2608     rot  = new TGeoRotation("",0.0,0.0,-kft24Theta); // Gets Used later as well
2609     rot1 = new TGeoRotation("",0.0,0.0,kft24Theta);  // Gets Used later as well
2610     s3PP24 = new TGeoXtru(2);
2611     s3PP24->SetName("ITS sup 3 bay pach pannel RB24 side 3PP24");
2612     yp[5]  = sT24->GetY(7) + kct24CoolSectionH;
2613     xp[5]  = Xfrom2Points(sT24->GetX(7),sT24->GetY(7),sT24->GetX(6),
2614                           sT24->GetY(6),yp[6]);
2615     yp[6]  = sT24->GetY(0) + kct24CoolSectionH;
2616     xp[6]  =  Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2617                           sT24->GetY(1),yp[9]);
2618     local[0] = xp[6]; local[1] = yp[6]; local[2] = 0.0;
2619     rot1->LocalToMaster(local,master);
2620     xp[0]  = master[0];
2621     yp[0]  = master[1];
2622     local[0] = xp[6]; local[1] = yp[6] + kft24PPHightSDDSSD; local[2] = 0.0;
2623     rot1->LocalToMaster(local,master);
2624     xp[1]  = master[0];
2625     yp[1]  = master[1];
2626     xp[2]  = -xp[1];
2627     yp[2]  =  yp[1];
2628     xp[3]  = -xp[0];
2629     yp[3]  =  yp[0];
2630     local[0] = xp[6]; local[1] = yp[6]; local[2] = 0.0;
2631     rot1->MasterToLocal(local,master);
2632     xp[4]  = master[0];
2633     yp[4]  = master[1];
2634     local[0] = xp[5]; local[1] = yp[5]; local[2] = 0.0;
2635     rot1->LocalToMaster(local,master);
2636     xp[7]  = master[0];
2637     yp[7]  = master[1];
2638     s3PP24->DefinePolygon(8,xp,yp);
2639     s3PP24->DefineSection(0,0.0);
2640     s3PP24->DefineSection(1,kft24PPlength);
2641     //
2642     s2PP24 = new TGeoXtru(2);
2643     s2PP24->SetName("ITS sup 2 bay pach pannel RB24 side 2PP24");
2644     local[1] = sTl24->GetY(3); local[2] = 0.0;
2645     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2646                             sTl24->GetX(1),sTl24->GetY(1),local[1]);
2647     rot1->LocalToMaster(local,master);
2648     xp[0]  = master[0];
2649     yp[0]  = master[1];
2650     local[1] = sTl24->GetY(3) + kft24PPHightSPDFMD; local[2] = 0.0;
2651     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2652                             sTl24->GetX(1),sTl24->GetY(1),local[1]);
2653     rot1->LocalToMaster(local,master);
2654     xp[1]  = master[0];
2655     yp[1]  = master[1];
2656     yp[2]  = sTl24->GetY(4) + kft24PPHightSPDFMD;
2657     xp[2]  = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2658                           sTl24->GetX(7),sTl24->GetY(7),yp[2]);
2659     yp[3]  = sTl24->GetY(7);
2660     xp[3]  = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2661                           sTl24->GetX(7),sTl24->GetY(7),yp[3]);
2662     xp[4]  = sTl24->GetX(3);
2663     yp[4]  = sTl24->GetY(3);
2664     local[0] = sTl24->GetX(4);local[1] = sTl24->GetY(4); local[2] = 0.0;
2665     rot1->LocalToMaster(local,master);
2666     xp[5]  = master[0];
2667     yp[5]  = master[1];
2668     s2PP24->DefinePolygon(6,xp,yp);
2669     s2PP24->DefineSection(0,0.0);
2670     s2PP24->DefineSection(1,kft24PPlength);
2671     //
2672     sV3PP24 = new TGeoXtru(2);
2673     sV3PP24->SetName("ITS sup Patch Pannel 3 Bay inside Rb24 side V3PP24");
2674     xp[0] = s3PP24->GetX(0) + kct24AlThick;
2675     yp[0] = s3PP24->GetY(0) + kct24AlThick;
2676     local[1] = s3PP24->GetY(6) + kft24PPHightSDDSSD - kct24AlThick;local[2]=0.;
2677     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2678                            sTl24->GetX(1),sTl24->GetY(1),local[1]);
2679     rot1->LocalToMaster(local,master);
2680     xp[1] = master[0];
2681     yp[1] = master[1];
2682     xp[2] = -xp[1];
2683     yp[2] =  yp[1];
2684     xp[3] = -xp[0];
2685     yp[3] =  yp[0];
2686     xp[4] = s3PP24->GetX(4);
2687     yp[4] = s3PP24->GetY(4);
2688     xp[5] = s3PP24->GetX(5);
2689     yp[5] = s3PP24->GetY(5);
2690     xp[6] = s3PP24->GetX(6);
2691     yp[6] = s3PP24->GetY(6);
2692     xp[7] = s3PP24->GetX(7);
2693     yp[7] = s3PP24->GetY(7);
2694     sV3PP24->DefinePolygon(8,xp,yp);
2695     sV3PP24->DefineSection(0,s3PP24->GetZ(0),s3PP24->GetXOffset(0),
2696                            s3PP24->GetYOffset(0),s3PP24->GetScale(0));
2697     sV3PP24->DefineSection(1,s3PP24->GetZ(1),s3PP24->GetXOffset(1),
2698                            s3PP24->GetYOffset(1),s3PP24->GetScale(1));
2699     //
2700     sV2PP24 = new TGeoXtru(2);
2701     sV2PP24->SetName("ITS sup Patch Pannel 2 Bay inside Rb24 side V2PP24");
2702     xp[0] = s2PP24->GetX(0) + kct24AlThick;
2703     yp[0] = s2PP24->GetY(0) + kct24AlThick;
2704     local[1] = sTl24->GetY(3) + kft24PPHightSPDFMD - kct24AlThick;local[2]=0.;
2705     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2706                            sTl24->GetX(1),sTl24->GetY(1),local[1]);
2707     rot1->LocalToMaster(local,master);
2708     xp[1] = master[0];
2709     yp[1] = master[1];
2710     yp[2] = sTl24->GetY(4) + kft24PPHightSPDFMD - kct24AlThick;
2711     xp[2] = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2712                            sTl24->GetX(7),sTl24->GetY(7),yp[2]);
2713     yp[3] = sTl24->GetY(4);
2714     xp[3] = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2715                            sTl24->GetX(7),sTl24->GetY(7),yp[3]);;
2716     xp[4] = s2PP24->GetX(4);
2717     yp[4] = s2PP24->GetY(4);
2718     xp[5] = s2PP24->GetX(5);
2719     yp[5] = s2PP24->GetY(5);
2720     sV2PP24->DefinePolygon(6,xp,yp);
2721     sV2PP24->DefineSection(0,s2PP24->GetZ(0),s2PP24->GetXOffset(0),
2722                            s2PP24->GetYOffset(0),s2PP24->GetScale(0));
2723     sV2PP24->DefineSection(1,s2PP24->GetZ(1),s2PP24->GetXOffset(1),
2724                            s2PP24->GetYOffset(1),s2PP24->GetScale(1));
2725     // RB 24 Tray Mother Volume
2726     sMT24 = new TGeoPcon("ITS sup Cable Tray Mother Volume RB24 MT24",
2727                          0.0,360.0,5);
2728     sMT24->Z(0)    = 0.0;
2729     sMT24->Rmin(0) = sA24[0]->GetRmax();
2730     sMT24->Rmax(0) = TMath::Max(TMath::Hypot(s3PP24->GetX(1),s3PP24->GetY(1)),
2731                                 TMath::Hypot(s2PP24->GetX(1),s2PP24->GetY(1)));
2732
2733     sMT24->Z(1)    = sMT24->GetZ(0) + kft24PPlength;
2734     sMT24->Rmin(1) = sMT24->GetRmin(0);
2735     sMT24->Rmax(1) = sMT24->GetRmax(0);
2736     sMT24->Z(2)    = sMT24->GetZ(1);
2737     sMT24->Rmin(2) = sMT24->GetRmin(0);
2738     sMT24->Rmax(2) = sMT24->GetRmax(0) - kft24PPHightSPDFMD;
2739
2740     sMT24->Z(3)    = sMT24->GetZ(0) + zA24[iRmin] - zA24[0] -kfrm24Width;
2741     sMT24->Rmin(3) = sA24[iRmin]->GetRmin();
2742     sMT24->Rmax(3) = TMath::Hypot(sT24->GetX(3),sT24->GetY(3));
2743     sMT24->Z(4)    = sMT24->GetZ(0) + zA24[kfrm24NZsections] + kfrm24Width  - 
2744         zA24[0] -kfrm24Width;
2745     sMT24->Rmin(4) = sA24[kfrm24NZsections]->GetRmax();
2746     sMT24->Rmax(4) = TMath::Hypot(sT24->GetX(3)+sT24->GetXOffset(2),
2747                                   sT24->GetY(3)+sT24->GetYOffset(2));
2748     //
2749     if(GetDebug(1)){
2750         sT24->InspectShape();
2751         sW24->InspectShape();
2752         sTl24->InspectShape();
2753         sTs24->InspectShape();
2754         sTt24->InspectShape();
2755         sU24->InspectShape();
2756         sVl24->InspectShape();
2757         sVs24->InspectShape();
2758         s3PP24->InspectShape();
2759         s2PP24->InspectShape();
2760         sV3PP24->InspectShape();
2761         sV2PP24->InspectShape();
2762         sMT24->InspectShape();
2763     } // end if GetDebug(1)
2764     //
2765     TGeoVolume *vC24[kct24Ntrays],*vT24[kct24Ntrays],*vPP24[kft24NPatchPannels];
2766     TGeoVolume *vWTV024,*vW24,*vU24,*vUFMD24,*vVl24,*vVlFMD24,*vVs24;
2767     TGeoVolume *vV3PP24,*vV2PP24,*vV2PPFMD24;
2768     TGeoVolumeAssembly *vMT24;
2769     vMT24 = new TGeoVolumeAssembly("ITSsupCableTrayMotherMT24");
2770     //vMT24->SetVisibility(kTRUE);
2771     //vMT24->SetLineColor(8); // white
2772     //vMT24->SetLineWidth(1);
2773     //vMT24->SetFillColor(vMT24->GetLineColor());
2774     //vMT24->SetFillStyle(4100); // 100% transparent
2775     //
2776     vU24 = new TGeoVolume("ITSsupCableTrayLowerU24",sU24,medSUPair);
2777     vU24->SetVisibility(kTRUE);
2778     vU24->SetLineColor(7); // light blue
2779     vU24->SetLineWidth(1);
2780     vU24->SetFillColor(vU24->GetLineColor());
2781     vU24->SetFillStyle(4090); // 90% transparent
2782     vUFMD24 = new TGeoVolume("FMDsupCableTrayLowerU24",sU24,medSUPair);
2783     vUFMD24->SetVisibility(kTRUE);
2784     vUFMD24->SetLineColor(7); // light blue
2785     vUFMD24->SetLineWidth(1);
2786     vUFMD24->SetFillColor(vUFMD24->GetLineColor());
2787     vUFMD24->SetFillStyle(4090); // 90% transparent
2788     vVl24 = new TGeoVolume("ITSsupCableTrayUpperV24",sVl24,medSUPair);
2789     vVl24->SetVisibility(kTRUE);
2790     vVl24->SetLineColor(7); // light blue
2791     vVl24->SetLineWidth(1);
2792     vVl24->SetFillColor(vVl24->GetLineColor());
2793     vVl24->SetFillStyle(4090); // 90% transparent
2794     vVlFMD24 = new TGeoVolume("FMDsupCableTrayUpperVl24",sVl24,medSUPair);
2795     vVlFMD24->SetVisibility(kTRUE);
2796     vVlFMD24->SetLineColor(7); // light blue
2797     vVlFMD24->SetLineWidth(1);
2798     vVlFMD24->SetFillColor(vVlFMD24->GetLineColor());
2799     vVlFMD24->SetFillStyle(4090); // 90% transparent
2800     vVs24 = new TGeoVolume("ITSsupCableTrayUpperVs24",sVs24,medSUPair);
2801     vVs24->SetVisibility(kTRUE);
2802     vVs24->SetLineColor(7); // light blue
2803     vVs24->SetLineWidth(1);
2804     vVs24->SetFillColor(vVs24->GetLineColor());
2805     vVs24->SetFillStyle(4090); // 90% transparent
2806     vW24 = new TGeoVolume("ITSsupCableTrayUpperW24",sW24,medSUPair);
2807     vW24->SetVisibility(kTRUE);
2808     vW24->SetLineColor(7); // light blue
2809     vW24->SetLineWidth(1);
2810     vW24->SetFillColor(vW24->GetLineColor());
2811     vW24->SetFillStyle(4090); // 90% transparent
2812     //
2813     vWTV024 = new TGeoVolume("V0supCableTrayUpperWTV024",sW24,medSUPair);
2814     vWTV024->SetVisibility(kTRUE);
2815     vWTV024->SetLineColor(7); // light blue
2816     vWTV024->SetLineWidth(1);
2817     vWTV024->SetFillColor(vWTV024->GetLineColor());
2818     vWTV024->SetFillStyle(4090); // 90% transparent
2819     //
2820     vV3PP24 = new TGeoVolume("ITSsup3BayPachPannelInsideV3PP24",sV3PP24,medSUPair);
2821     vV3PP24->SetVisibility(kTRUE);
2822     vV3PP24->SetLineColor(8); // white
2823     vV3PP24->SetLineWidth(1);
2824     vV3PP24->SetFillColor(vV3PP24->GetLineColor());
2825     vV3PP24->SetFillStyle(4100); // 100% transparent
2826     vV2PP24 = new TGeoVolume("ITSsup2BayPachPannelInsideV2PP24",sV2PP24,medSUPair);
2827     vV2PP24->SetVisibility(kTRUE);
2828     vV2PP24->SetLineColor(8); // white
2829     vV2PP24->SetLineWidth(1);
2830     vV2PP24->SetFillColor(vV2PP24->GetLineColor());
2831     vV2PP24->SetFillStyle(4100); // 100% transparent
2832     vV2PPFMD24 = new TGeoVolume("FMDsup2BayPachPannelInsideV2PP24",sV2PP24,medSUPair);
2833     vV2PPFMD24->SetVisibility(kTRUE);
2834     vV2PPFMD24->SetLineColor(8); // white
2835     vV2PPFMD24->SetLineWidth(1);
2836     vV2PPFMD24->SetFillColor(vV2PPFMD24->GetLineColor());
2837     vV2PPFMD24->SetFillStyle(4100); // 100% transparent
2838     //
2839     //delete rot;
2840     //delete rot1;
2841     //
2842     Double_t tha[kct24Ntrays],thb[kft24NPatchPannels];
2843     for(i=0;i<kct24Ntrays/4;i++) {
2844         if(i==0) tha[0] = 17.0+0.5*kft24Theta;
2845         else tha[i] = tha[i-1] + kft24Theta;
2846         tha[i+  kct24Ntrays/4] =  90.0 + tha[i];
2847         tha[i+  kct24Ntrays/2] = 180.0 + tha[i];
2848         tha[i+3*kct24Ntrays/4] = 270.0 + tha[i];
2849     } // end for i
2850     if(GetDebug(1)) for(i=0;i<kct24Ntrays;i++) Info("ServicesCableSupport",
2851                                                   "tha[%d]=%f",i,tha[i]);
2852     Char_t *airName[kct24Ntrays]={"FMD0","SDD0","SSD0","SSD1","SPD0","SPD1",
2853                                   "TV00","SDD1","SDD2","SPD2","SPD3","ALG0",
2854                                   "SPD4","SPD5","SSD2","SSD3","SPD6","SPD7",
2855                                   "TV01","SDD3","SDD4","SPD8","SPD9","ALG1",
2856                                   "FMD1","SDD5","SSD4","SSD5","SPDA","SPDB",
2857                                   "TV02","SDD6","SDD7","SPDC","SPDD","ALG2",
2858                                   "SPDE","SPDF","SSD6","SSD7","SPDG","SPDH",
2859                                   "TV03","SDD8","SDD9","SPDI","SPDJ","ALG3"};
2860     Char_t *trayName[kct24Ntrays]={"FMD0","SSD0","SSD1","SSD2","SSD3","SPD0",
2861                                    "TV00","SDD0","SDD1","SDD2","SPD1","ALG0",
2862                                    "SPD2","SSD4","SSD5","SSD6","SSD7","SPD3",
2863                                    "TV01","SDD3","SDD4","SDD5","SPD4","ALG1",
2864                                    "FMD1","SSD8","SSD9","SSDA","SSDB","SPD5",
2865                                    "TV02","SDD6","SDD7","SDD8","SPD6","ALG2",
2866                                    "SPD7","SSDC","SSDD","SSDE","SSDF","SPD8",
2867                                    "TV03","SDD9","SDDA","SDDB","SPD9","ALG3"};
2868     //
2869     //Int_t ncopyW24=1,ncopyU24=1,ncopyV24=1;
2870     j = 0;
2871     for(i=0;i<kct24Ntrays;i++){
2872         if(strncmp(trayName[i],"FMD",3)==0){
2873             sprintf(name,"FMDsupCableTrayT24[%s]",trayName[i]);
2874             vT24[i] = new TGeoVolume(name,sTl24,medSUPal);
2875             vT24[i]->AddNode(vVlFMD24,1,0);
2876         }else if(strncmp(trayName[i],"TV0",3)==0){
2877             sprintf(name,"V0supCableTrayT24[%s]",trayName[i]);
2878             vT24[i] = new TGeoVolume(name,sT24,medSUPal);
2879             vT24[i]->AddNode(vWTV024,1,0);
2880         }else if(strncmp(trayName[i],"ALG",3)==0){ // ITS Alignment Channel
2881             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2882             vT24[i] = new TGeoVolume(name,sT24,medSUPal);
2883             vT24[i]->AddNode(vW24,1,0);
2884         }else  if(strncmp(trayName[i],"SPD",3)==0){ /*ITS SPD*/
2885             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2886             vT24[i] = new TGeoVolume(name,sTl24,medSUPal);
2887             vT24[i]->AddNode(vVl24,1,0);
2888         }else { /*ITS*/
2889             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2890             vT24[i] = new TGeoVolume(name,sTs24,medSUPal); /// replace solid
2891             vT24[i]->AddNode(vVs24,1,0);
2892         } // end if
2893         vT24[i]->SetVisibility(kTRUE);
2894         vT24[i]->SetLineColor(6); // purple
2895         vT24[i]->SetLineWidth(1);
2896         vT24[i]->SetFillColor(vT24[i]->GetLineColor());
2897         vT24[i]->SetFillStyle(4000); // 0% transparent
2898         rot = new TGeoRotation("",0.0,0.0,tha[i]-90.0);
2899         if(GetDebug(1)) rot->Print();
2900         vMT24->AddNode(vT24[i],1,rot);
2901         //
2902         if(strncmp(trayName[i],"FMD",3)==0){
2903             sprintf(name,"FMDsupAirTubeTrayT24[%s]",airName[i]);
2904             vC24[j] = new TGeoVolume(name,sTt24,medSUPair);
2905             vC24[j]->AddNode(vUFMD24,1,0);
2906         }else if(strncmp(trayName[i],"TV0",3)==0){
2907             continue;
2908         }else if(strncmp(trayName[i],"ALG",3)==0){
2909             continue;
2910         }else{ /*ITS*/
2911             sprintf(name,"ITSsupAirTubTrayT24[%s]",airName[i]);
2912             vC24[j] = new TGeoVolume(name,sTt24,medSUPair);
2913             vC24[j]->AddNode(vU24,1,0);
2914         } // end if
2915         vC24[j]->SetVisibility(kTRUE);
2916         vC24[j]->SetLineColor(6); // purple
2917         vC24[j]->SetLineWidth(1);
2918         vC24[j]->SetFillColor(vC24[j]->GetLineColor());
2919         vC24[j]->SetFillStyle(4000); // 0% transparent
2920         vMT24->AddNode(vC24[j++],1,rot);
2921     } // end for i
2922     for(i=0;i<kft24NPatchPannels/4;i++) {
2923         if(i==0) thb[0] = 17.0+0.5*kft24Theta;
2924         else{
2925             if(i%2) thb[i] = thb[i-1] + 3.0*kft24Theta;
2926             else thb[i] = thb[i-1] + 2.0*kft24Theta;
2927         } // end if-else
2928         thb[i+  kft24NPatchPannels/4] =  90.0 + thb[i];
2929         thb[i+  kft24NPatchPannels/2] = 180.0 + thb[i];
2930         thb[i+3*kft24NPatchPannels/4] = 270.0 + thb[i];
2931     } // end for i
2932     Char_t *pachName[kft24NPatchPannels]={"FMD0","SSD0","SPD0","SDD0","SPD1",
2933                                           "SPD2","SSD1","SPD3","SDD1","SPD4",
2934                                           "FMD1","SSD2","SPD5","SDD2","SPD6",
2935                                           "SPD7","SSD3","SPD8","SDD3","SPD9"};
2936     for(i=0;i<kft24NPatchPannels;i++){
2937         if(strncmp(pachName[i],"FMD",3)==0){
2938             sprintf(name,"FMDsupPatchPannelPP24[%s]",pachName[i]);
2939             vPP24[i] = new TGeoVolume(name,s2PP24,medSUPal);
2940             vPP24[i]->AddNode(vV2PPFMD24,1,0);
2941         }else if(strncmp(pachName[i],"SPD",3)==0){ /*ITS SPD*/
2942             sprintf(name,"ITSsupPathcPannelPP24[%s]",pachName[i]);
2943             vPP24[i] = new TGeoVolume(name,s2PP24,medSUPal);
2944             vPP24[i]->AddNode(vV2PP24,1,0);
2945         }else { /*ITS*/
2946             sprintf(name,"ITSsupPathcPannelPP24[%s]",pachName[i]);
2947             vPP24[i] = new TGeoVolume(name,s3PP24,medSUPal); /// replace solid
2948             vPP24[i]->AddNode(vV3PP24,1,0);
2949         } // end if
2950         vPP24[i]->SetVisibility(kTRUE);
2951         vPP24[i]->SetLineColor(6); // purple
2952         vPP24[i]->SetLineWidth(1);
2953         vPP24[i]->SetFillColor(vPP24[i]->GetLineColor());
2954         vPP24[i]->SetFillStyle(4000); // 0% transparent
2955         rot = new TGeoRotation("",0.0,0.0,thb[i]-90.0);
2956         if(GetDebug(1)) rot->Print();
2957         vMT24->AddNode(vPP24[i],1,rot);
2958     } // end for i
2959     tran = new TGeoTranslation("",0.0,0.0,kfrm24Z0);
2960     moth->AddNode(vMT24,1,tran);
2961     if(GetDebug(1)){
2962         for(i=0;i<kct24Ntrays;i++) vT24[i]->PrintNodes();
2963         for(i=0;i<kct24Ntrays-8;i++) vC24[i]->PrintNodes();
2964         vU24->PrintNodes();
2965         vUFMD24->PrintNodes();
2966         vVl24->PrintNodes();
2967         vVlFMD24->PrintNodes();
2968         vVs24->PrintNodes();
2969         vW24->PrintNodes();
2970         vWTV024->PrintNodes();
2971         vMT24->PrintNodes();
2972     } // end if
2973     //==================================================================
2974     //
2975     // RB 26, Muon Absober side
2976     const Double_t kfrm26Z0           = -900*fgkmm;//SSup_203A.jpg
2977     const Double_t kfrm26Thss         = 5.0*fgkmm;
2978     const Double_t kfrm26R0ss         = 444.5*fgkmm-kfrm26Thss; //SSup_204A.jpg
2979     const Double_t kfrm26R1ss         = 601.6*fgkmm-kfrm26Thss; //SSup_208A.jpg
2980     const Double_t kfrm26Width        = 10.0*fgkmm;
2981     //const Double_t kfrm26Hight       = 10.0*fgkmm;
2982     const Double_t kfrm26Phi0         = 15.2*fgkDegree; // SSup_602A.jpg
2983     const Double_t kfrm26Phi1         = (90.0-7.6)*fgkDegree; // SSup_802A.jpg
2984     const Double_t kfrm26ZssSection   = (415.0-10.0)*fgkmm;
2985     const Int_t    kfrm26NZsections   = 4;
2986     const Int_t    kfrm26NPhiSections = 4;
2987     const Int_t    kfrm26NPhi         = 4;
2988     TGeoConeSeg *sA26[kfrm26NZsections+1];//,*sM26;//Cylinderial support structure
2989     TGeoArb8     *sB26; // Cylinderial support structure
2990     /*
2991     sM26 = new TGeoConeSeg("ITS sup Cable tray support frame mother volume "
2992                           "M26",0.5*(4.*kfrm26ZssSection+5*kfrm26Width),
2993                           kfrm26R1ss,kfrm26R1ss+kfrm26Thss,
2994                           kfrm26R0ss,kfrm26R0ss+kfrm26Thss,
2995                           kfrm26Phi0,kfrm26Phi1);
2996     */
2997     m = -((kfrm26R1ss-kfrm26R0ss)/
2998          (((Double_t)kfrm26NZsections)*(kfrm26ZssSection+kfrm26Width)));
2999     for(i=0;i<kfrm26NZsections+1;i++){
3000         di = ((Double_t) i)*(kfrm26ZssSection+kfrm26Width);
3001         sprintf(name,
3002                 "ITS sup Cable tray support frame radial section A26[%d]",i);
3003         r1 = kfrm26R1ss+m*di;
3004         r2 = kfrm26R1ss+m*(di+kfrm26Width);
3005         sA26[i] = new TGeoConeSeg(name,0.5*kfrm26Width,r2,r2+kfrm26Thss,
3006                                  r1,r1+kfrm26Thss,kfrm26Phi0,kfrm26Phi1);
3007     } // end for i
3008     sB26 = new TGeoArb8("ITS sup Cable tray support frame Z section B26",
3009                        0.5*kfrm26ZssSection);
3010     r = 0.25*(sA26[0]->GetRmax1()+sA26[0]->GetRmin1()+
3011               sA26[1]->GetRmax2()+sA26[1]->GetRmin2());
3012     sB26->SetVertex(0,sA26[0]->GetRmax2()-r,+0.5*kfrm26Width);
3013     sB26->SetVertex(1,sA26[0]->GetRmax2()-r,-0.5*kfrm26Width);
3014     sB26->SetVertex(2,sA26[0]->GetRmin2()-r,-0.5*kfrm26Width);
3015     sB26->SetVertex(3,sA26[0]->GetRmin2()-r,+0.5*kfrm26Width);
3016     sB26->SetVertex(4,sA26[1]->GetRmax1()-r,+0.5*kfrm26Width);
3017     sB26->SetVertex(5,sA26[1]->GetRmax1()-r,-0.5*kfrm26Width);
3018     sB26->SetVertex(6,sA26[1]->GetRmin1()-r,-0.5*kfrm26Width);
3019     sB26->SetVertex(7,sA26[1]->GetRmin1()-r,+0.5*kfrm26Width);
3020     if(GetDebug(1)){
3021         for(i=0;i<kfrm26NZsections+1;i++) sA26[i]->InspectShape();
3022         //sM26->InspectShape();
3023         sB26->InspectShape();
3024     } // end if GetDebug(1)
3025     //
3026     TGeoVolume *vA26[kfrm26NZsections+1],*vB26;
3027     TGeoVolumeAssembly *vM26;
3028     //
3029     for(i=0;i<kfrm26NZsections+1;i++){
3030         sprintf(name,"ITSsupFrameA26[%d]",i);
3031         vA26[i] = new TGeoVolume(name,sA26[i],medSUPss);
3032         vA26[i]->SetVisibility(kTRUE);
3033         vA26[i]->SetLineColor(1); // black
3034         vA26[i]->SetLineWidth(1);
3035         vA26[i]->SetFillColor(vA26[i]->GetLineColor());
3036         vA26[i]->SetFillStyle(4000); // 0% transparent
3037     } // end for i
3038     vB26 = new TGeoVolume("ITSsupFrameB26",sB26,medSUPss);
3039     vB26->SetVisibility(kTRUE);
3040     vB26->SetLineColor(1); // black
3041     vB26->SetLineWidth(1);
3042     vB26->SetFillColor(vB26->GetLineColor());
3043     vB26->SetFillStyle(4000); // 0% transparent
3044     vM26 = new TGeoVolumeAssembly("ITSsupFrameM26");
3045     //vM26 = new TGeoVolume("ITSsupFrameM26",sM26,medSUPair);
3046     //vM26->SetVisibility(kTRUE);
3047     //vM26->SetLineColor(7); // light blue
3048     //vM26->SetLineWidth(1);
3049     //vM26->SetFillColor(vM26->GetLineColor());
3050     //vM26->SetFillStyle(4090); // 90% transparent
3051     //
3052     Int_t ncopyB26=1;
3053     t0 = kfrm26Phi0;
3054     dt = (kfrm26Phi1-kfrm26Phi0)/((Double_t)kfrm26NPhiSections);
3055     for(i=0;i<=kfrm26NZsections;i++){
3056         di = ((Double_t) i)*(kfrm26ZssSection+kfrm26Width);
3057         z = 0.5*(4.*kfrm26ZssSection+5*kfrm26Width);
3058         z = -z+sA26[i]->GetDz() + di;
3059         tran = new TGeoTranslation("",0.0,0.0,z);
3060         vM26->AddNode(vA26[i],1,tran);
3061         z = z+sB26->GetDz();
3062         if(i<kfrm26NZsections)for(j=0;j<=kfrm26NPhiSections;j++){
3063             r = 0.25*(sA26[i]->GetRmax1()+sA26[i]->GetRmin1()+
3064                       sA26[i+1]->GetRmax2()+sA26[i+1]->GetRmin2());
3065             t = t0 + ((Double_t)j)*dt;
3066             rot = new TGeoRotation("",0.0,0.0,t);
3067             y = r*SinD(t);
3068             x = r*CosD(t);
3069             tranrot = new TGeoCombiTrans("",x,y,z,rot);
3070             //delete rot; // rot not explicity used in AddNode functions.
3071             vM26->AddNode(vB26,ncopyB26++,tranrot);
3072         } // end for j
3073     } // end for i
3074     tran = new TGeoTranslation("",0.0,0.0,kfrm26Z0-0.5*(4.*kfrm26ZssSection+5*kfrm26Width));
3075     moth->AddNode(vM26,1,tran);
3076     for(i=1;i<kfrm26NPhi;i++){
3077         rot = new TGeoRotation("",0.0,0.0,90.0*((Double_t)i));
3078         tranrot = new TGeoCombiTrans(*tran,*rot);
3079         //delete rot; // rot not explicity used in AddNode functions.
3080         moth->AddNode(vM26,i+1,tranrot);
3081     } // end for i
3082     if(GetDebug(1)){
3083         for(i=0;i<kfrm26NZsections+1;i++) vA26[i]->PrintNodes();
3084         vB26->PrintNodes();
3085         vM26->PrintNodes();
3086     } // end if
3087 }