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