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