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