Continue to add and fix new geometry.
[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 <TGeoManager.h>
29 #include <TGeoVolume.h>
30 #include <TGeoPcon.h>
31 #include <TGeoCone.h>
32 #include <TGeoTube.h> // contaings TGeoTubeSeg
33 #include <TGeoArb8.h>
34 #include <TGeoXtru.h>
35 #include <TGeoCompositeShape.h>
36 #include <TGeoMatrix.h>
37 #include "AliITSv11GeometrySupport.h"
38
39 ClassImp(AliITSv11GeometrySupport)
40
41 #define SQ(A) (A)*(A)
42
43 //______________________________________________________________________
44 void AliITSv11GeometrySupport::SPDCone(TGeoVolume *moth){
45     // Define the detail SPD support cone geometry.
46     // Inputs:
47     //   none.
48     // Outputs:
49     //  none.
50     // Return:
51     //  none.
52
53     SPDThermalSheald(moth);
54 }
55 //______________________________________________________________________
56 void AliITSv11GeometrySupport::SPDThermalSheald(TGeoVolume *moth){
57     // Define the detail SPD Thermal Sheld geometry.
58     // Inputs:
59     //   none.
60     // Outputs:
61     //  none.
62     // Return:
63     //  none.
64     // From ALICE-Thermal Screen (SPD) "Cylinder" file thermal-screen2_a3.ps
65     // Volumes sA1,sA2,sA3,sAh1,sAh2,sAh3, and b1,b2,b3,bh1,bh2,bh3;
66     // "CONE TRANSITION" file thermal-screen1_a3.ps Volumes sC1,sC2,sC3,
67     // sCh1,sCh2, sCh3; "FLANGE" file thermal-screen4_a3.ps Volumes d,sDs,
68     // sDw,sDws; and "HALF ASSEMBLY" file thermal-screen3_a3.ps. This object,
69     // both halfs, are incased inside of a single minimum sized mother 
70     // volume called M, which is a union of two parts sM1 and 4 copies of sM2.
71     const Double_t ktscarbonFiberThA = 0.03*fgkmm; // 
72     //const Double_t ktscarbonFiberThB = 0.10*fgkmm; //
73     const Double_t ktscLengthB  = 50.0*fgkmm; //
74     const Double_t ktscLengthA  = 900.0*fgkmm-2.0*ktscLengthB; //
75     const Double_t ktscLengthC  = 290.0*fgkmm; //
76     const Double_t ktscLengthD  = 15.0*fgkmm; //
77     const Double_t ktscAngle    = 36.0*fgkDegree;//Rep. angle of cent. accordin
78     const Double_t ktscRoutA    = 99.255*fgkmm; // Outer radii
79     const Double_t ktscRinA     = 81.475*fgkmm; // Iner radii
80     const Double_t ktscRoutB    = 99.955*fgkmm; // Outer radii
81     const Double_t ktscRinB     = 80.775*fgkmm; // Iner radii
82     const Double_t ktscRoutCp   = 390.0*fgkmm;  // Outer radii
83     const Double_t ktscRinCp    = 373.0*fgkmm;  // Iner radii
84     Double_t ktscRoutC,ktscRinC; // values need to be calculated
85     const Double_t ktscRwingD   = 492.5*fgkmm;  // Outer radii
86     const Double_t ktscRoutD    = 0.5*840.*fgkmm;// Outer radii
87     const Double_t ktscRinD     = 373.0*fgkmm;  // Iner radii
88     // angular wing
89     const Double_t ktscAngleDD  = (60.*fgkmm/ktscRwingD)*fgkRadian;
90                                                     // width of fill material
91     const Double_t ktscAngleDDs = ((60.*fgkmm-2.*ktscarbonFiberThA)/
92                                                   ktscRwingD)*fgkRadian;
93     const Double_t ktscAngleD0  = 45.*fgkDegree;//Strting angle of wing
94     const Double_t ktscoutSA    = 24.372*fgkmm; // The other one Calculated
95     const Double_t ktscinLA     = 31.674*fgkmm; // The ohter one Calculated
96     const Double_t ktscoutSB    = 24.596*fgkmm; // The other one Calculated
97     const Double_t ktscinLB     = 31.453*fgkmm; // The ohter one Calculated
98     const Double_t ktscoutSC    = 148.831*fgkmm;// The other one Calculated
99     const Double_t ktscinLC     = 90.915*fgkmm; // The ohter one Calculated
100     Int_t i,k;
101     Double_t th;
102     Double_t xo[7],yo[7],xi[7],yi[7];
103     Double_t xbo[7],ybo[7],xbi[7],ybi[7];
104     Double_t xco[7],yco[7],xci[7],yci[7];
105     TGeoArb8 *sA1,*sA2,*sA3,*sAh1,*sAh2,*sAh3,*sB1,*sB2,*sB3,*sBh1,*sBh2,*sBh3;
106     TGeoArb8 *sC1,*sC2,*sC3,*sCh1,*sCh2,*sCh3;
107     TGeoPcon *sM1;
108     TGeoTube  *sD,*sDs;
109     TGeoTubeSeg *sDw,*sDws,*sM2;
110     TGeoCompositeShape *sM;
111     TGeoRotation *rot;
112     TGeoTranslation *tranb,*tranbm,*tranc;
113     TGeoTranslation *tranITSspdShealdVVt0;
114     TGeoCombiTrans *rotITSspdShealdVVt1,*rotITSspdShealdVVt2;
115     TGeoCombiTrans *rotITSspdShealdVVt3;
116     TGeoMedium *medSPDcf  = 0; // SPD support cone Carbon Fiber materal number.
117     TGeoMedium *medSPDfs  = 0; // SPD support cone inserto stesalite 4411w.
118     TGeoMedium *medSPDfo  = 0; // SPD support cone foam, Rohacell 50A.
119     TGeoMedium *medSPDss  = 0; // SPD support cone screw material,Stainless
120     TGeoMedium *medSPDair = 0; // SPD support cone Air
121     //TGeoMedium *medSPDal  = 0; // SPD support cone SDD mounting bracket Al
122
123     ktscRoutC = TMath::Sqrt(ktscRoutCp*ktscRoutCp-0.25*ktscoutSC*ktscoutSC);
124     ktscRinC  = TMath::Sqrt(ktscRinCp *ktscRinCp -0.25*ktscinLC *ktscinLC );
125     sA1  = new TGeoArb8("ITS SPD Therm Screen Clyinder A1",0.5*ktscLengthA);
126     sA2  = new TGeoArb8("ITS SPD Therm Screen Clyinder A2",0.5*ktscLengthA);
127     sA3  = new TGeoArb8("ITS SPD Therm Screen Clyinder A3",0.5*ktscLengthA);
128     sAh1 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ah1",0.5*ktscLengthA);
129     sAh2 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ah2",0.5*ktscLengthA);
130     sAh3 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ah3",0.5*ktscLengthA);
131     sB1  = new TGeoArb8("ITS SPD Therm Screen Clyinder B1",0.5*ktscLengthB);
132     sB2  = new TGeoArb8("ITS SPD Therm Screen Clyinder B2",0.5*ktscLengthB);
133     sB3  = new TGeoArb8("ITS SPD Therm Screen Clyinder B3",0.5*ktscLengthB);
134     sBh1 = new TGeoArb8("ITS SPD Therm Screen Cylinder Bh1",0.5*ktscLengthB);
135     sBh2 = new TGeoArb8("ITS SPD Therm Screen Cylinder Bh2",0.5*ktscLengthB);
136     sBh3 = new TGeoArb8("ITS SPD Therm Screen Cylinder Bh3",0.5*ktscLengthB);
137     sC1  = new TGeoArb8("ITS SPD Therm Screen Clyinder C1",0.5*ktscLengthC);
138     sC2  = new TGeoArb8("ITS SPD Therm Screen Clyinder C2",0.5*ktscLengthC);
139     sC3  = new TGeoArb8("ITS SPD Therm Screen Clyinder C3",0.5*ktscLengthC);
140     sCh1 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ch1",0.5*ktscLengthC);
141     sCh2 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ch2",0.5*ktscLengthC);
142     sCh3 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ch3",0.5*ktscLengthC);
143     sD = new TGeoTube("ITS SPD Therm Screen Flange D",ktscRinD,ktscRoutD,
144                     0.5*ktscLengthD);
145     sDs = new TGeoTube("ITS SPD Therm Screen Flange fill Ds",
146                       ktscRinD+ktscarbonFiberThA,ktscRoutD-ktscarbonFiberThA,
147                       0.5*ktscLengthD);
148     sDw = new TGeoTubeSeg("ITS SPD Therm Screen Flange Wing Dw",
149                          ktscRoutD,ktscRwingD ,0.5*ktscLengthD,
150                          ktscAngleD0-0.5*ktscAngleDD,
151                          ktscAngleD0+0.5*ktscAngleDD);
152     sDws = new TGeoTubeSeg("ITS SPD Therm Screen Flange Wing Fill Ds",
153                           ktscRoutD,ktscRwingD-ktscarbonFiberThA,
154                           0.5*ktscLengthD,ktscAngleD0-0.5*ktscAngleDDs,
155                           ktscAngleD0+0.5*ktscAngleDDs);
156     k = 0;
157     for(i=-1;i<2;i++){
158         th = ((Double_t)(i+1))*ktscAngle*fgkDegree;
159         xo[k]  = ktscRoutA*SinD(th) - 0.5*ktscoutSA*CosD(th);
160         yo[k]  = ktscRoutA*CosD(th) + 0.5*ktscoutSA*SinD(th);
161         xi[k]  = ktscRinA *SinD(th) - 0.5*ktscinLA *CosD(th);
162         yi[k]  = ktscRinA *CosD(th) + 0.5*ktscinLA *SinD(th);
163         xbo[k] = ktscRoutB*SinD(th) - 0.5*ktscoutSB*CosD(th);
164         ybo[k] = ktscRoutB*CosD(th) + 0.5*ktscoutSB*SinD(th);
165         xbi[k] = ktscRinB *SinD(th) - 0.5*ktscinLB *CosD(th);
166         ybi[k] = ktscRinB *CosD(th) + 0.5*ktscinLB *SinD(th);
167         xco[k] = ktscRoutC*SinD(th) - 0.5*ktscoutSC*CosD(th);
168         yco[k] = ktscRoutC*CosD(th) + 0.5*ktscoutSC*SinD(th);
169         xci[k] = ktscRinC *SinD(th) - 0.5*ktscinLC *CosD(th);
170         yci[k] = ktscRinC *CosD(th) + 0.5*ktscinLC *SinD(th);
171         k++;
172         xo[k]  = ktscRoutA*SinD(th) + 0.5*ktscoutSA*CosD(th);
173         yo[k]  = ktscRoutA*CosD(th) - 0.5*ktscoutSA*SinD(th);
174         xi[k]  = ktscRinA *SinD(th) + 0.5*ktscinLA *CosD(th);
175         yi[k]  = ktscRinA *CosD(th) - 0.5*ktscinLA *SinD(th);
176         xbo[k] = ktscRoutB*SinD(th) + 0.5*ktscoutSB*CosD(th);
177         ybo[k] = ktscRoutB*CosD(th) - 0.5*ktscoutSB*SinD(th);
178         xbi[k] = ktscRinB *SinD(th) + 0.5*ktscinLB *CosD(th);
179         ybi[k] = ktscRinB *CosD(th) - 0.5*ktscinLB *SinD(th);
180         xco[k] = ktscRoutC*SinD(th) + 0.5*ktscoutSC*CosD(th);
181         yco[k] = ktscRoutC*CosD(th) - 0.5*ktscoutSC*SinD(th);
182         xci[k] = ktscRinC *SinD(th) + 0.5*ktscinLC *CosD(th);
183         yci[k] = ktscRinC *CosD(th) - 0.5*ktscinLC *SinD(th);
184         k++;
185     } // end for i
186     xo[6] = xo[5];
187     yo[6] = 0.0;
188     xi[6] = xi[5];
189     yi[6] = 0.0;
190     xbo[6] = xbo[5];
191     ybo[6] = 0.0;
192     xbi[6] = xbi[5];
193     ybi[6] = 0.0;
194     xco[6] = xco[5];
195     yco[6] = 0.0;
196     xci[6] = xci[5];
197     yci[6] = 0.0;
198     if(GetDebug()){
199         Info("SPDThermalSheald","i     \t  xo  yo    \t  xi yi     \t  xbo "
200              "ybo   \t   xbi ybi  \t   xco yco   \t   xci yxi");
201         for(i=0;i<7;i++){
202             Info("SPDThermalSheald","%7d\t%7.4f,%7.4f\t%7.4f,%7.4f\t"
203                  "%7.4f,%7.4f\t%7.4f,%7.4f\t%7.4f,%7.4f\t%7.4f,%7.4f",i,
204                  xo[i],yo[i],xi[i],yi[i],
205                  xbo[i],ybo[i],xbi[i],ybi[i],
206                  xco[i],yco[i],xci[i],yci[i]);
207         } // end for i
208     } // end if GetDebug()
209     //+++++++++++++++++++++++++
210     sA1->SetVertex(0,xo[0],yo[0]);
211     sA1->SetVertex(1,xo[1],yo[1]);
212     sA1->SetVertex(2,xi[1],yi[1]);
213     sA1->SetVertex(3,xi[0],yi[0]);
214     //
215     sA2->SetVertex(0,xo[1],yo[1]);
216     sA2->SetVertex(1,xo[2],yo[2]);
217     sA2->SetVertex(2,xi[2],yi[2]);
218     sA2->SetVertex(3,xi[1],yi[1]);
219     //
220     sA3->SetVertex(0,xo[5],yo[5]);
221     sA3->SetVertex(1,xo[6],yo[6]);
222     sA3->SetVertex(2,xi[6],yi[6]);
223     sA3->SetVertex(3,xi[5],yi[5]);
224     //--------------------------
225     sB1->SetVertex(0,xbo[0],ybo[0]);
226     sB1->SetVertex(1,xbo[1],ybo[1]);
227     sB1->SetVertex(2,xbi[1],ybi[1]);
228     sB1->SetVertex(3,xbi[0],ybi[0]);
229     //
230     sB2->SetVertex(0,xbo[1],ybo[1]);
231     sB2->SetVertex(1,xbo[2],ybo[2]);
232     sB2->SetVertex(2,xbi[2],ybi[2]);
233     sB2->SetVertex(3,xbi[1],ybi[1]);
234     //
235     sB3->SetVertex(0,xbo[5],ybo[5]);
236     sB3->SetVertex(1,xbo[6],ybo[6]);
237     sB3->SetVertex(2,xbi[6],ybi[6]);
238     sB3->SetVertex(3,xbi[5],ybi[5]);
239     //--------------------------
240     sC1->SetVertex(0,xco[0],yco[0]);
241     sC1->SetVertex(1,xco[1],yco[1]);
242     sC1->SetVertex(2,xci[1],yci[1]);
243     sC1->SetVertex(3,xci[0],yci[0]);
244     //
245     sC2->SetVertex(0,xco[1],yco[1]);
246     sC2->SetVertex(1,xco[2],yco[2]);
247     sC2->SetVertex(2,xci[2],yci[2]);
248     sC2->SetVertex(3,xci[1],yci[1]);
249     //
250     sC3->SetVertex(0,xco[5],yco[5]);
251     sC3->SetVertex(1,xco[6],yco[6]);
252     sC3->SetVertex(2,xci[6],yci[6]);
253     sC3->SetVertex(3,xci[5],yci[5]);
254     // Defining the hole, filled with air
255     Double_t lp1,lc1,x,y,x7[3],y7[3];
256     lp1 = (xo[0]-xi[0])/(yo[0]-yi[0]);
257     lc1 = xo[0]+0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xo[0]-xi[0])+
258                                             SQ(yo[0]-yi[0]))/(xo[0]-xi[0]);
259     y = ktscRoutA-2.*ktscarbonFiberThA;
260     x = lp1*(y-yo[0])+lc1;
261     sAh1->SetVertex(0,x,y);
262     sBh1->SetVertex(0,x,y);
263     sCh1->SetVertex(4,x,y);
264     y = ktscRinA+ktscarbonFiberThA;
265     x = lp1*(y-yo[0])+lc1;
266     sAh1->SetVertex(3,x,y);
267     sBh1->SetVertex(3,x,y);
268     x7[0] = x; y7[0] = y; // vortexing done after last point
269     //sCh1->SetVertex(7,x,y);
270     lp1 = (xo[1]-xi[1])/(yo[1]-yi[1]);
271     lc1 = xo[1]-0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xo[1]-xi[1])+
272                                             SQ(yo[1]-yi[1]))/(xo[1]-xi[1]);
273     y = ktscRoutA-2.*ktscarbonFiberThA;
274     x = lp1*(y-yo[1])+lc1;
275     sAh1->SetVertex(1,x,y);
276     sBh1->SetVertex(1,x,y);
277     sCh1->SetVertex(5,x,y);
278     y = ktscRinA+ktscarbonFiberThA;
279     x = lp1*(y-yo[1])+lc1;
280     sAh1->SetVertex(2,x,y);
281     sBh1->SetVertex(2,x,y);
282     sCh1->SetVertex(6,x,y);
283     //
284     // The easist way to get the points for the hole in volume sA2 is to
285     // rotate it to the Y axis where the y coordinates are easier to know
286     // and then rotate it back.
287     Double_t xp,yp,xa,ya,xb,yb;
288     th = 0.5*ktscAngle;
289     xa = CosD(th)*xo[1]-SinD(th)*yo[1];
290     ya = SinD(th)*xo[1]+CosD(th)*yo[1];
291     xb = CosD(th)*xi[1]-SinD(th)*yi[1];
292     yb = SinD(th)*xi[1]+CosD(th)*yi[1];
293     lp1 = (xa-xb)/(ya-yb);
294     lc1 = xa+0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
295     y = ya-ktscarbonFiberThA;
296     x = lp1*(y-ya)+lc1;
297     xp = CosD(-th)*x-SinD(-th)*y;
298     yp = SinD(-th)*x+CosD(-th)*y;
299     sAh2->SetVertex(0,xp,yp);
300     sBh2->SetVertex(0,xp,yp);
301     sCh2->SetVertex(4,xp,yp);
302     y = yb+2.0*ktscarbonFiberThA;
303     x = lp1*(y-ya)+lc1;
304     xp = CosD(-th)*x-SinD(-th)*y;
305     yp = SinD(-th)*x+CosD(-th)*y;
306     sAh2->SetVertex(3,xp,yp);
307     sBh2->SetVertex(3,xp,yp);
308     x7[1] = x; y7[1] = y; // vortexing done after last point
309     //sCh2->SetVertex(7,xp,yp);
310     xa = CosD(th)*xo[2]-SinD(th)*yo[2];
311     ya = SinD(th)*xo[2]+CosD(th)*yo[2];
312     xb = CosD(th)*xi[2]-SinD(th)*yi[2];
313     yb = SinD(th)*xi[2]+CosD(th)*yi[2];
314     lp1 = (xa-xb)/(ya-yb);
315     lc1 = xa-0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
316     y = ya-ktscarbonFiberThA;
317     x = lp1*(y-ya)+lc1;
318     xp = CosD(-th)*x-SinD(-th)*y;
319     yp = SinD(-th)*x+CosD(-th)*y;
320     sAh2->SetVertex(1,xp,yp);
321     sBh2->SetVertex(1,xp,yp);
322     sCh2->SetVertex(5,xp,yp);
323     y = yb+2.0*ktscarbonFiberThA;
324     x = lp1*(y-ya)+lc1;
325     xp = CosD(-th)*x-SinD(-th)*y;
326     yp = SinD(-th)*x+CosD(-th)*y;
327     sAh2->SetVertex(2,xp,yp);
328     sBh2->SetVertex(2,xp,yp);
329     sCh2->SetVertex(6,xp,yp);
330     //
331     lp1 = (yo[5]-yi[5])/(xo[5]-xi[5]);
332     lc1 = yo[5]+0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(yo[5]-yi[5])+
333                                             SQ(xo[5]-xi[5]))/(yo[5]-yi[5]);
334     x = xo[5]-ktscarbonFiberThA;
335     y = lp1*(x-xo[5])+lc1;
336     sAh3->SetVertex(0,x,y);
337     sBh3->SetVertex(0,x,y);
338     sCh3->SetVertex(4,x,y);
339     x = xi[5]+2.0*ktscarbonFiberThA;
340     y = lp1*(x-xo[5])+lc1;
341     sAh3->SetVertex(3,x,y);
342     sBh3->SetVertex(3,x,y);
343     x7[2] = x; y7[2] = y; // vortexing done after last point
344     //sCh3->SetVertex(7,x,y);
345     y = 2.0*ktscarbonFiberThA;
346     x = xo[5]-ktscarbonFiberThA;
347     sAh3->SetVertex(1,x,y);
348     sBh3->SetVertex(1,x,y);
349     sCh3->SetVertex(5,x,y);
350     y = 2.0*ktscarbonFiberThA;
351     x = xi[5]+2.0*ktscarbonFiberThA;
352     sAh3->SetVertex(2,x,y);
353     sBh3->SetVertex(2,x,y);
354     sCh3->SetVertex(6,x,y);
355     //
356     for(i=0;i<4;i++){ // define points at +dz
357      sA1->SetVertex(i+4,(sA1->GetVertices())[2*i],(sA1->GetVertices())[1+2*i]);
358      sA2->SetVertex(i+4,(sA2->GetVertices())[2*i],(sA2->GetVertices())[1+2*i]);
359      sA3->SetVertex(i+4,(sA3->GetVertices())[2*i],(sA3->GetVertices())[1+2*i]);
360      //
361      sB1->SetVertex(i+4,(sB1->GetVertices())[2*i],(sB1->GetVertices())[1+2*i]);
362      sB2->SetVertex(i+4,(sB2->GetVertices())[2*i],(sB2->GetVertices())[1+2*i]);
363      sB3->SetVertex(i+4,(sB3->GetVertices())[2*i],(sB3->GetVertices())[1+2*i]);
364      // C's are a cone which must match up with B's.
365      sC1->SetVertex(i+4,(sB1->GetVertices())[2*i],(sB1->GetVertices())[1+2*i]);
366      sC2->SetVertex(i+4,(sB2->GetVertices())[2*i],(sB2->GetVertices())[1+2*i]);
367      sC3->SetVertex(i+4,(sB3->GetVertices())[2*i],(sB3->GetVertices())[1+2*i]);
368      //
369      sAh1->SetVertex(i+4,(sAh1->GetVertices())[2*i],
370                      (sAh1->GetVertices())[1+2*i]);
371      sAh2->SetVertex(i+4,(sAh2->GetVertices())[2*i],
372                      (sAh2->GetVertices())[1+2*i]);
373      sAh3->SetVertex(i+4,(sAh3->GetVertices())[2*i],
374                      (sAh3->GetVertices())[1+2*i]);
375      //
376      sBh1->SetVertex(i+4,(sBh1->GetVertices())[2*i],
377                      (sBh1->GetVertices())[1+2*i]);
378      sBh2->SetVertex(i+4,(sBh2->GetVertices())[2*i],
379                      (sBh2->GetVertices())[1+2*i]);
380      sBh3->SetVertex(i+4,(sBh3->GetVertices())[2*i],
381                      (sBh3->GetVertices())[1+2*i]);
382     } // end for
383     //
384     lp1 = (xco[0]-xci[0])/(yco[0]-yci[0]);
385     lc1 = xco[0]+0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xco[0]-xci[0])+
386                                            SQ(yco[0]-yci[0]))/(xco[0]-xci[0]);
387     y = ktscRoutC-2.*ktscarbonFiberThA;
388     x = lp1*(y-yco[0])+lc1;
389     sCh1->SetVertex(0,x,y);
390     y = ktscRinC+ktscarbonFiberThA;
391     x = lp1*(y-yci[0])+lc1;
392     sCh1->SetVertex(2,x,y);
393     lp1 = (xco[1]-xci[1])/(yco[1]-yci[1]);
394     lc1 = xco[1]-0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xco[1]-xci[1])+
395                                            SQ(yco[1]-yci[1]))/(xco[1]-xci[1]);
396     y = ktscRoutC-2.*ktscarbonFiberThA;
397     x = lp1*(y-yco[1])+lc1;
398     sCh1->SetVertex(1,x,y);
399     y = ktscRinC+ktscarbonFiberThA;
400     x = lp1*(y-yci[1])+lc1;
401     sCh1->SetVertex(3,x,y);
402     //
403     th = 0.5*ktscAngle;
404     xa = CosD(th)*xco[1]-SinD(th)*yco[1];
405     ya = SinD(th)*xco[1]+CosD(th)*yco[1];
406     xb = CosD(th)*xci[1]-SinD(th)*yci[1];
407     yb = SinD(th)*xci[1]+CosD(th)*yci[1];
408     lp1 = (xa-xb)/(ya-yb);
409     lc1 = xa+0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
410     y = ya-ktscarbonFiberThA;
411     x = lp1*(y-ya)+lc1;
412     xp = CosD(-th)*x-SinD(-th)*y;
413     yp = SinD(-th)*x+CosD(-th)*y;
414     yp = ya-ktscarbonFiberThA;
415     xp = lp1*(y-ya)+lc1;
416     sCh2->SetVertex(0,xp,yp);
417     y = yb+2.0*ktscarbonFiberThA;
418     x = lp1*(y-ya)+lc1;
419     xp = CosD(-th)*x-SinD(-th)*y;
420     yp = SinD(-th)*x+CosD(-th)*y;
421     sCh2->SetVertex(2,xp,yp);
422     xa = CosD(th)*xco[2]-SinD(th)*yco[2];
423     ya = SinD(th)*xco[2]+CosD(th)*yco[2];
424     xb = CosD(th)*xci[2]-SinD(th)*yci[2];
425     yb = SinD(th)*xci[2]+CosD(th)*yci[2];
426     lp1 = (xa-xb)/(ya-yb);
427     lc1 = xa-0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
428     y = ya-ktscarbonFiberThA;
429     x = lp1*(y-ya)+lc1;
430     xp = CosD(-th)*x-SinD(-th)*y;
431     yp = SinD(-th)*x+CosD(-th)*y;
432     sCh2->SetVertex(1,xp,yp);
433     y = yb+2.0*ktscarbonFiberThA;
434     x = lp1*(y-ya)+lc1;
435     xp = CosD(-th)*x-SinD(-th)*y;
436     yp = SinD(-th)*x+CosD(-th)*y;
437     sCh2->SetVertex(3,xp,yp);
438     //
439     lp1 = (yco[5]-yci[5])/(xco[5]-xci[5]);
440     lc1 = yco[5]+0.5*ktscarbonFiberThA*TMath::Sqrt(SQ(yco[5]-yci[5])+
441                                           SQ(xco[5]-xci[5]))/(yco[5]-yci[5]);
442     x = xco[5]-ktscarbonFiberThA;
443     y = lp1*(x-xco[5])+lc1;
444     sCh3->SetVertex(0,x,y);
445     x = xci[5]+2.0*ktscarbonFiberThA;
446     y = lp1*(x-xci[5])+lc1;
447     sCh3->SetVertex(2,x,y);
448     y = 2.0*ktscarbonFiberThA;
449     x = xco[5]-ktscarbonFiberThA;
450     sCh3->SetVertex(1,x,y);
451     y = 2.0*ktscarbonFiberThA;
452     x = xci[5]+2.0*ktscarbonFiberThA;
453     sCh3->SetVertex(3,x,y);
454     sCh1->SetVertex(7,x7[0],y7[0]); // 7th point most be done last ???
455     sCh2->SetVertex(7,x7[1],y7[1]); // 7th point most be done last ???
456     sCh3->SetVertex(7,x7[2],y7[2]); // 7th point most be done last ???
457     //
458     // Define Minimal volume to inclose this SPD Thermal Sheald.
459     sM1 = new TGeoPcon("ITSspdShealdVV",0.0,360.0,9);
460     sM1->Z(0)    = 0.5*ktscLengthA+ktscLengthB;
461     sM1->Rmin(0) = ktscRinB;
462     x = sB1->GetVertices()[0]; // [0][0]
463     y = sB1->GetVertices()[1]; // [0][1]
464     sM1->Rmax(0) = TMath::Sqrt(x*x+y*y);
465     sM1->Z(1)    = sM1->GetZ(0)-ktscLengthB;
466     sM1->Rmin(1) = sM1->GetRmin(0);
467     sM1->Rmax(1) = sM1->GetRmax(0);
468     sM1->Z(2)    = sM1->GetZ(1);
469     sM1->Rmin(2) = ktscRinA;
470     x = sA1->GetVertices()[0]; // [0]0]
471     y = sA1->GetVertices()[1]; // [0][1]
472     sM1->Rmax(2) = TMath::Sqrt(x*x+y*y);
473     sM1->Z(3)    = -(sM1->GetZ(0)-ktscLengthB);
474     sM1->Rmin(3) = sM1->GetRmin(2);
475     sM1->Rmax(3) = sM1->GetRmax(2);
476     sM1->Z(4)    = sM1->GetZ(3);
477     sM1->Rmin(4) = sM1->GetRmin(1);
478     sM1->Rmax(4) = sM1->GetRmax(1);
479     sM1->Z(5)    = -(sM1->GetZ(0));
480     sM1->Rmin(5) = sM1->GetRmin(0);
481     sM1->Rmax(5) = sM1->GetRmax(0);
482     sM1->Z(6)    = sM1->GetZ(5) - ktscLengthC;
483     sM1->Rmin(6) = ktscRinC;
484     x = sC1->GetVertices()[0]; // [0][0]
485     y = sC1->GetVertices()[1]; // [0][1]
486     sM1->Rmax(6) = TMath::Sqrt(x*x+y*y);
487     sM1->Z(7)    = sM1->GetZ(6);
488     sM1->Rmin(7) = sD->GetRmin();
489     sM1->Rmax(7) = sD->GetRmax();
490     sM1->Z(8)    = sM1->Z(7) - ktscLengthD;
491     sM1->Rmin(8) = sM1->GetRmin(7);
492     sM1->Rmax(8) = sM1->GetRmax(7);
493     sM2 = new TGeoTubeSeg("ITSspdShealdWingVV",
494                           sM1->GetRmax(8),sDw->GetRmax(),sDw->GetDz(),
495                           sDw->GetPhi1(),sDw->GetPhi2());
496     //
497     x = 0.5*(sM1->GetZ(8) + sM1->GetZ(7));
498     tranITSspdShealdVVt0 = new TGeoTranslation("ITSspdShealdVVt0",0.0,0.0,x);
499     tranITSspdShealdVVt0->RegisterYourself();
500     TGeoRotation rotz90("",0.0,0.0,90.0); // never registered.
501     rotITSspdShealdVVt1 = new TGeoCombiTrans(*tranITSspdShealdVVt0,rotz90);
502     rotITSspdShealdVVt1->SetName("ITSspdShealdVVt1");
503     rotITSspdShealdVVt1->RegisterYourself();
504     TGeoRotation rotz180("",0.0,0.0,180.0); // never registered
505     rotITSspdShealdVVt2 = new TGeoCombiTrans(*tranITSspdShealdVVt0,rotz180);
506     rotITSspdShealdVVt2->SetName("ITSspdShealdVVt2");
507     rotITSspdShealdVVt2->RegisterYourself();
508     TGeoRotation rotz270("",0.0,0.0,270.0); // never registered
509     rotITSspdShealdVVt3 = new TGeoCombiTrans(*tranITSspdShealdVVt0,rotz270);
510     rotITSspdShealdVVt3->SetName("ITSspdShealdVVt3");
511     rotITSspdShealdVVt3->RegisterYourself();
512     sM = new TGeoCompositeShape("ITS SPD Thermal sheald volume",
513                                 "(((ITSspdShealdVV+"
514                                 "ITSspdShealdWingVV:ITSspdShealdVVt0)+"
515                                 "ITSspdShealdWingVV:ITSspdShealdVVt1)+"
516                                 "ITSspdShealdWingVV:ITSspdShealdVVt2)+"
517                                 "ITSspdShealdWingVV:ITSspdShealdVVt3");
518     //
519     if(GetDebug()){
520         tranITSspdShealdVVt0->Print();
521         rotITSspdShealdVVt1->Print();
522         rotITSspdShealdVVt2->Print();
523         rotITSspdShealdVVt3->Print();
524         sD->InspectShape();
525         sDs->InspectShape();
526         sDw->InspectShape();
527         sDws->InspectShape();
528         sA1->InspectShape();
529         sAh1->InspectShape();
530         sA2->InspectShape();
531         sAh2->InspectShape();
532         sA3->InspectShape();
533         sAh3->InspectShape();
534         sB1->InspectShape();
535         sBh1->InspectShape();
536         sB2->InspectShape();
537         sBh2->InspectShape();
538         sB3->InspectShape();
539         sBh3->InspectShape();
540         sC1->InspectShape();
541         sCh1->InspectShape();
542         sC2->InspectShape();
543         sCh2->InspectShape();
544         sC3->InspectShape();
545         sCh3->InspectShape();
546         sM1->InspectShape();
547         sM2->InspectShape();
548         sM->InspectShape();
549     } // end if GetDebug
550     //
551     TGeoManager *mgr = gGeoManager;
552     medSPDcf = mgr->GetMedium("ITSspdCarbonFiber");
553     medSPDfs = mgr->GetMedium("ITSspdStaselite4411w");
554     medSPDfo = mgr->GetMedium("ITSspdRohacell50A");
555     medSPDss = mgr->GetMedium("ITSspdStainlessSteal");
556     medSPDair= mgr->GetMedium("ITSspdAir");
557     TGeoVolume *vA1,*vA2,*vA3,*vAh1,*vAh2,*vAh3;
558     TGeoVolume *vB1,*vB2,*vB3,*vBh1,*vBh2,*vBh3;
559     TGeoVolume *vC1,*vC2,*vC3,*vCh1,*vCh2,*vCh3;
560     TGeoVolume *vD,*vDs,*vDw,*vDws,*vM;
561     vM = new TGeoVolume("ITSspdThermalShealdMother",sM,medSPDair);
562     vM->SetVisibility(kTRUE);
563     vM->SetLineColor(7); // light Blue
564     vM->SetLineWidth(1);
565     vM->SetFillColor(vM->GetLineColor());
566     vM->SetFillStyle(4090); // 90% transparent
567     moth->AddNode(vM,1,0); ///////////////////// Virtual Volume ////////
568     vA1 = new TGeoVolume("ITSspdCentCylA1CF",sA1,medSPDcf);
569     vA1->SetVisibility(kTRUE);
570     vA1->SetLineColor(4);
571     vA1->SetLineWidth(1);
572     vA2 = new TGeoVolume("ITSspdCentCylA2CF",sA2,medSPDcf);
573     vA2->SetVisibility(kTRUE);
574     vA2->SetLineColor(4);
575     vA2->SetLineWidth(1);
576     vA3 = new TGeoVolume("ITSspdCentCylA3CF",sA3,medSPDcf);
577     vA3->SetVisibility(kTRUE);
578     vA3->SetLineColor(4);
579     vA3->SetLineWidth(1);
580     vB1 = new TGeoVolume("ITSspdCentCylB1CF",sB1,medSPDcf);
581     vB1->SetVisibility(kTRUE);
582     vB1->SetLineColor(4);
583     vB1->SetLineWidth(1);
584     vB2 = new TGeoVolume("ITSspdCentCylB2CF",sB2,medSPDcf);
585     vB2->SetVisibility(kTRUE);
586     vB2->SetLineColor(4);
587     vB2->SetLineWidth(1);
588     vB3 = new TGeoVolume("ITSspdCentCylB3CF",sB3,medSPDcf);
589     vB3->SetVisibility(kTRUE);
590     vB3->SetLineColor(4);
591     vB3->SetLineWidth(1);
592     vC1 = new TGeoVolume("ITSspdCentCylC1CF",sC1,medSPDcf);
593     vC1->SetVisibility(kTRUE);
594     vC1->SetLineColor(4);
595     vC1->SetLineWidth(1);
596     vC2 = new TGeoVolume("ITSspdCentCylC2CF",sC2,medSPDcf);
597     vC2->SetVisibility(kTRUE);
598     vC2->SetLineColor(4);
599     vC2->SetLineWidth(1);
600     vC3 = new TGeoVolume("ITSspdCentCylC3CF",sC3,medSPDcf);
601     vC3->SetVisibility(kTRUE);
602     vC3->SetLineColor(4);
603     vC3->SetLineWidth(1);
604     vAh1 = new TGeoVolume("ITSspdCentCylA1AirA",sAh1,medSPDair);
605     vAh1->SetVisibility(kTRUE);
606     vAh1->SetLineColor(5); // Yellow
607     vAh1->SetFillColor(vAh1->GetLineColor());
608     vAh1->SetFillStyle(4090); // 90% transparent
609     vAh2 = new TGeoVolume("ITSspdCentCylA2AirA",sAh2,medSPDair);
610     vAh2->SetVisibility(kTRUE);
611     vAh2->SetLineColor(5); // Yellow
612     vAh2->SetFillColor(vAh2->GetLineColor());
613     vAh2->SetFillStyle(4090); // 90% transparent
614     vAh3 = new TGeoVolume("ITSspdCentCylA3AirA",sAh3,medSPDair);
615     vAh3->SetVisibility(kTRUE);
616     vAh3->SetLineColor(5); // Yellow
617     vAh3->SetFillColor(vAh3->GetLineColor());
618     vAh3->SetFillStyle(4090); // 90% transparent
619     vBh1 = new TGeoVolume("ITSspdCentCylA1AirB",sBh1,medSPDair);
620     vBh1->SetVisibility(kTRUE);
621     vBh1->SetLineColor(5); // Yellow
622     vBh1->SetFillColor(vBh1->GetLineColor());
623     vBh1->SetFillStyle(4090); // 90% transparent
624     vBh2 = new TGeoVolume("ITSspdCentCylA2AirB",sBh2,medSPDair);
625     vBh2->SetVisibility(kTRUE);
626     vBh2->SetLineColor(5); // Yellow
627     vBh2->SetFillColor(vBh2->GetLineColor());
628     vBh2->SetFillStyle(4090); // 90% transparent
629     vBh3 = new TGeoVolume("ITSspdCentCylA3AirB",sBh3,medSPDair);
630     vBh3->SetVisibility(kTRUE);
631     vBh3->SetLineColor(5); // Yellow
632     vBh3->SetFillColor(vBh3->GetLineColor());
633     vBh3->SetFillStyle(4090); // 90% transparent
634     vCh1 = new TGeoVolume("ITSspdCentCylA1AirC",sCh1,medSPDair);
635     vCh1->SetVisibility(kTRUE);
636     vCh1->SetLineColor(5); // Yellow
637     vCh1->SetFillColor(vCh1->GetLineColor());
638     vCh1->SetFillStyle(4090); // 90% transparent
639     vCh2 = new TGeoVolume("ITSspdCentCylA2AirC",sCh2,medSPDair);
640     vCh2->SetVisibility(kTRUE);
641     vCh2->SetLineColor(5); // Yellow
642     vCh2->SetFillColor(vCh2->GetLineColor());
643     vCh2->SetFillStyle(4090); // 90% transparent
644     vCh3 = new TGeoVolume("ITSspdCentCylA3AirC",sCh3,medSPDair);
645     vCh3->SetVisibility(kTRUE);
646     vCh3->SetLineColor(5); // Yellow
647     vCh3->SetFillColor(vCh3->GetLineColor());
648     vCh3->SetFillStyle(4090); // 90% transparent
649     vD = new TGeoVolume("ITSspdCentCylA1CD",sD,medSPDcf);
650     vD->SetVisibility(kTRUE);
651     vD->SetLineColor(4);
652     vD->SetLineWidth(1);
653     vDw = new TGeoVolume("ITSspdCentCylA1CDw",sDw,medSPDcf);
654     vDw->SetVisibility(kTRUE);
655     vDw->SetLineColor(4);
656     vDw->SetLineWidth(1);
657     vDs = new TGeoVolume("ITSspdCentCylA1Dfill",sDs,medSPDfs);
658     vDs->SetVisibility(kTRUE);
659     vDs->SetLineColor(3); // Green
660     vDs->SetFillColor(vDs->GetLineColor());
661     vDs->SetFillStyle(4010); // 10% transparent
662     vDws = new TGeoVolume("ITSspdCentCylA1DwingFill",sDws,medSPDfs);
663     vDws->SetVisibility(kTRUE);
664     vDws->SetLineColor(3); // Green
665     vDws->SetFillColor(vDws->GetLineColor());
666     vDws->SetFillStyle(4010); // 10% transparent
667     //
668     vA1->AddNode(vAh1,1,0);
669     vA2->AddNode(vAh2,1,0);
670     vA3->AddNode(vAh3,1,0);
671     vB1->AddNode(vBh1,1,0);
672     vB2->AddNode(vBh2,1,0);
673     vB3->AddNode(vBh3,1,0);
674     vC1->AddNode(vCh1,1,0);
675     vC2->AddNode(vCh2,1,0);
676     vC3->AddNode(vCh3,1,0);
677     vD ->AddNode(vDs ,1,0);
678     vDw->AddNode(vDws,1,0);
679     //
680     vM->AddNode(vA1,1,0);
681     vM->AddNode(vA2,1,0);
682     vM->AddNode(vA3,1,0);
683     tranb  = new TGeoTranslation("",0.0,0.0,0.5*(ktscLengthA+ktscLengthB));
684     tranbm = new TGeoTranslation("",0.0,0.0,0.5*(-ktscLengthA-ktscLengthB));
685     vM->AddNode(vB1,1,tranb);
686     vM->AddNode(vB2,1,tranb);
687     vM->AddNode(vB3,1,tranb);
688     vM->AddNode(vB1,2,tranbm);
689     vM->AddNode(vB2,2,tranbm);
690     vM->AddNode(vB3,2,tranbm);
691     // Muon side (rsB26) is at -Z.
692     tranc = new TGeoTranslation("",0.0,0.0,
693                                 0.5*(-ktscLengthA-ktscLengthB-ktscLengthC));
694     vM->AddNode(vC1,1,tranc);
695     vM->AddNode(vC2,1,tranc);
696     vM->AddNode(vC3,1,tranc);
697     vM->AddNode(vD,1,tranITSspdShealdVVt0);
698     vM->AddNode(vDw,1,tranITSspdShealdVVt0);
699     vM->AddNode(vDw,2,rotITSspdShealdVVt1);
700     vM->AddNode(vDw,3,rotITSspdShealdVVt2);
701     vM->AddNode(vDw,4,rotITSspdShealdVVt3);
702     k=2;
703     for(i=1;i<10;i++) {
704         th = ((Double_t)i)*ktscAngle*fgkDegree;
705         rot = new TGeoRotation("",0.0,0.0,th);
706         vM->AddNode(vA1,i+1,rot);
707         vM->AddNode(vB1,i+2,new TGeoCombiTrans(*tranb,*rot));
708         vM->AddNode(vB1,i+12,new TGeoCombiTrans(*tranbm,*rot));
709         vM->AddNode(vC1,i+1,new TGeoCombiTrans(*tranc,*rot));
710         if(i!=0||i!=2||i!=7){
711             vM->AddNode(vA2,k++,rot);
712             vM->AddNode(vB2,k++,new TGeoCombiTrans(*tranb,*rot));
713             vM->AddNode(vB2,k++,new TGeoCombiTrans(*tranbm,*rot));
714             vM->AddNode(vC2,k++,new TGeoCombiTrans(*tranc,*rot));
715         } // end if
716         if(i==5) {
717             vM->AddNode(vA3,2,rot);
718             vM->AddNode(vB3,3,new TGeoCombiTrans(*tranb,*rot));
719             vM->AddNode(vB3,4,new TGeoCombiTrans(*tranbm,*rot));
720             vM->AddNode(vC3,2,new TGeoCombiTrans(*tranc,*rot));
721         } // end if
722     } // end for i
723     rot = new TGeoRotation("",180.,0.0,0.0);
724     vM->AddNode(vA3,3,rot);
725     vM->AddNode(vB3,5,new TGeoCombiTrans(*tranb,*rot));
726     vM->AddNode(vB3,6,new TGeoCombiTrans(*tranbm,*rot));
727     vM->AddNode(vC3,3,new TGeoCombiTrans(*tranc,*rot));
728     rot = new TGeoRotation("",180.,0.0,180.0);
729     vM->AddNode(vA3,4,rot);
730     vM->AddNode(vB3,7,new TGeoCombiTrans(*tranb,*rot));
731     vM->AddNode(vB3,8,new TGeoCombiTrans(*tranbm,*rot));
732     vM->AddNode(vC3,4,new TGeoCombiTrans(*tranc,*rot));
733     if(GetDebug()){
734         vA1->PrintNodes();
735         vAh1->PrintNodes();
736         vA2->PrintNodes();
737         vAh2->PrintNodes();
738         vA3->PrintNodes();
739         vAh3->PrintNodes();
740         vB1->PrintNodes();
741         vBh1->PrintNodes();
742         vB2->PrintNodes();
743         vBh2->PrintNodes();
744         vB3->PrintNodes();
745         vBh3->PrintNodes();
746         vC1->PrintNodes();
747         vCh1->PrintNodes();
748         vC2->PrintNodes();
749         vCh2->PrintNodes();
750         vC3->PrintNodes();
751         vCh3->PrintNodes();
752         vD->PrintNodes();
753         vDs->PrintNodes();
754         vDw->PrintNodes();
755         vDws->PrintNodes();
756         vM->PrintNodes();
757     } // end if
758 }
759 //______________________________________________________________________
760 void AliITSv11GeometrySupport::SDDCone(TGeoVolume *moth){
761     // Define the detail SDD support cone geometry.
762     // Inputs:
763     //   none.
764     // Outputs:
765     //  none.
766     // Return:
767     //  none.
768     //
769     // From Cilindro Centrale - Lavorazioni, ALR 0816/1 04/08/03 File
770     // name SDD/Cilindro.hpgl
771     const Double_t ktsLength       = 790.0*fgkmm; // Thermal Sheeld length
772     const Double_t ktsInsertoLength= 15.0*fgkmm;    // ????
773     const Double_t ktsOuterR       = 0.5*(220.+10.)*fgkmm; // ????
774     const Double_t ktsInnerR       = 0.5*(220.-10.)*fgkmm; // ????
775     const Double_t ktscarbonFiberth= 0.02*fgkmm;     // ????
776     const Double_t ktsBoltDiameter = 6.0*fgkmm; // M6 screw
777     const Double_t ktsBoltDepth    = 6.0*fgkmm; // in volume sC
778     const Double_t ktsBoltRadius   = 0.5*220.*fgkmm; // Radius in volume sC
779     const Double_t ktsBoltAngle0   = 0.0*fgkDegree; // Angle in volume sC
780     const Double_t ktsBoltdAngle   = 30.0*fgkDegree; // Angle in Volume sC
781     Double_t x,y,z,t,t0,rmin,rmax;
782     Int_t i,n;
783     TGeoTube *sA,*sB,*sC,*sD;
784     TGeoTranslation *tran;
785     TGeoRotation *rot;
786     TGeoCombiTrans *rotran;
787     TGeoMedium *medSDDcf,*medSDDfs,*medSDDfo,*medSDDss;
788
789     sA = new TGeoTube("ITS SDD Central Cylinder",ktsInnerR,ktsOuterR,
790                      0.5*ktsLength);
791     sB = new TGeoTube("ITS SDD CC Foam",ktsInnerR+ktscarbonFiberth,
792                     ktsOuterR-ktscarbonFiberth,
793                     0.5*(ktsLength-2.0*ktsInsertoLength));
794     sC = new TGeoTube("ITS SDD CC Inserto",ktsInnerR+ktscarbonFiberth,
795                     ktsOuterR-ktscarbonFiberth,0.5*ktsLength);
796     sD = new TGeoTube("ITS SDD CC M6 bolt end",0.0,0.5*ktsBoltDiameter,
797                     0.5*ktsBoltDepth);
798     if(GetDebug()){
799         sA->InspectShape();
800         sB->InspectShape();
801         sC->InspectShape();
802         sD->InspectShape();
803     } // end if GetDebug
804     //
805     TGeoManager *mgr = gGeoManager;
806     medSDDcf = mgr->GetMedium("ITSssdCarbonFiber");
807     medSDDfs = mgr->GetMedium("ITSssdStaselite4411w");
808     medSDDfo = mgr->GetMedium("ITSssdRohacell50A");
809     medSDDss = mgr->GetMedium("ITSssdStainlessSteal");
810     TGeoVolume *vA,*vB,*vC,*vD;
811     vA = new TGeoVolume("ITSsddCentCylCF",sA,medSDDcf);
812     vA->SetVisibility(kTRUE);
813     vA->SetLineColor(4);
814     vA->SetLineWidth(1);
815     vA->SetFillColor(vA->GetLineColor());
816     vA->SetFillStyle(4030); // 30% transparent
817     vB = new TGeoVolume("ITSsddCentCylF",sB,medSDDfo);
818     vB->SetVisibility(kTRUE);
819     vB->SetLineColor(3);
820     vB->SetLineWidth(1);
821     vB->SetFillColor(vB->GetLineColor());
822     vB->SetFillStyle(4050); // 50% transparent
823     vC = new TGeoVolume("ITSsddCentCylSt",sC,medSDDfs);
824     vC->SetVisibility(kTRUE);
825     vC->SetLineColor(2);
826     vC->SetLineWidth(1);
827     vC->SetFillColor(vC->GetLineColor());
828     vC->SetFillStyle(4050); // 50% transparent
829     vD = new TGeoVolume("ITSsddCentCylSS",sD,medSDDss);
830     vD->SetVisibility(kTRUE);
831     vD->SetLineColor(1);
832     vD->SetLineWidth(1);
833     vD->SetFillColor(vD->GetLineColor());
834     vD->SetFillStyle(4050); // 50% transparent
835     //
836     moth->AddNode(vA,1,0);
837     vA->AddNode(vC,1,0);
838     vC->AddNode(vB,1,0);
839     n = (Int_t)((360.*fgkDegree)/ktsBoltdAngle);
840     for(i=0;i<n;i++){
841         t = ktsBoltAngle0+((Double_t)i)*ktsBoltdAngle;
842         x = ktsBoltRadius*CosD(t);
843         y = ktsBoltRadius*SinD(t);
844         z = 0.5*(ktsLength-ktsBoltDepth);
845         tran = new TGeoTranslation("",x,y,z);
846         vC->AddNode(vD,i+1,tran);
847         tran = new TGeoTranslation("",x,y,-z);
848         vC->AddNode(vD,i+n+1,tran);
849     } // end for i
850     if(GetDebug()){
851         vA->PrintNodes();
852         vB->PrintNodes();
853         vC->PrintNodes();
854         vD->PrintNodes();
855     } // end if
856     // SDD Suport Cone
857     //
858     //
859     const Double_t kconThickness    = 10.5*fgkmm;//Thickness Rohacell+car. fib.
860     const Double_t kconCthick       = 1.5*fgkmm; // Carbon finber thickness
861     const Double_t kconRcurv        = 15.0*fgkmm; // Radius of curvature.
862     const Double_t kconTc           = 45.0; // angle of SDD cone [degrees].
863     const Double_t kconZouterMilled = 23.0*fgkmm;
864     const Double_t kconZcylinder    = 186.0*fgkmm;
865     const Double_t kconZ0           = kconZcylinder + 0.5*ktsLength;
866     //const Int_t kconNspoaks         = 12;
867     //const Int_t kconNmounts         = 4;
868     //const Double_t kconDmountAngle  = 9.0; // degrees
869     const Double_t kconRoutMax      = 0.5*560.0*fgkmm;
870     const Double_t kconRoutMin      = 0.5*539.0*fgkmm;
871     // Holes in cone for cables
872     const Double_t kconPhiHole1     = 0.0*fgkDegree;
873     const Double_t kcondPhiHole1    = 25.0*fgkDegree;
874     const Double_t kconRholeMax1    = 0.5*528.*fgkmm;
875     const Double_t kconRholeMin1    = 0.5*464.*fgkmm;
876     const Double_t kconPhiHole2     = 0.0*fgkDegree;
877     const Double_t kcondPhiHole2    = 50.0*fgkDegree;
878     const Double_t kconRholeMax2    = 0.5*375.*fgkmm;
879     const Double_t kconRholeMin2    = 0.5*280.*fgkmm;
880     //
881     //const Int_t kconNpostsOut       = 6;
882     //const Int_t kconNpostsIn        = 3;
883     //const Double_t kconPhi0PostOut  = 0.0; // degree
884     //const Double_t kconPhi0PostIn   = 0.0; // degree
885     //const Double_t kcondRpostOut    = 16.0*fgkmm;
886     //const Double_t kcondRpostIn     = 16.0*fgkmm;
887     //const Double_t kconZpostMaxOut  = 116.0*fgkmm;
888     //const Double_t kconZpostMaxIn   = 190.0*fgkmm;
889     const Double_t kconRinMax       = 0.5*216*fgkmm;
890     const Double_t kconRinCylinder  = 0.5*231.0*fgkmm;
891     //const Double_t kconRinHole      = 0.5*220.0*fgkmm;
892     const Double_t kconRinMin       = 0.5*210.0*fgkmm;
893     const Double_t kcondZin         = 15.0*fgkmm; // ???
894     const Double_t kSinkconTc       = SinD(kconTc);
895     const Double_t kCoskconTc       = CosD(kconTc);
896     const Double_t kTankconTc       = TanD(kconTc);
897     //
898     TGeoPcon *sE,*sF,*sG,*sH,*sI,*sJ,*sK;
899     TGeoCompositeShape *sL,*sM,*sN;
900     //
901     Double_t dza = kconThickness/kSinkconTc-
902         (kconRoutMax-kconRoutMin)/kTankconTc;
903     if(dza<=0){ // The number or order of the points are in error for a proper
904      // call to pcons!
905      Error("SDDcone","The definition of the points for a call to PCONS is"
906            " in error. abort.");
907      return;
908     } // end if
909     sE = new TGeoPcon("ITSsddSuportConeCarbonFiberSurfaceE",0.0,360.0,12);
910     sE->Z(0)    = 0.0;
911     sE->Rmin(0) = kconRoutMin;
912     sE->Rmax(0) = kconRoutMax;
913     sE->Z(1)    = kconZouterMilled - dza;
914     sE->Rmin(1) = sE->GetRmin(0);
915     sE->Rmax(1) = sE->GetRmax(0);
916     sE->Z(2)    = kconZouterMilled;
917     sE->Rmax(2) = sE->GetRmax(0);
918     RadiusOfCurvature(kconRcurv,0.,sE->GetZ(1),sE->GetRmin(1),kconTc,z,rmin);
919     sE->Z(3)    = z;
920     sE->Rmin(3) = rmin;
921     sE->Rmin(2) = RminFrom2Points(sE,3,1,sE->GetZ(2));
922     RadiusOfCurvature(kconRcurv,0.,sE->GetZ(2),sE->GetRmax(2),kconTc,z,rmax);
923     sE->Z(4)    = z;
924     sE->Rmax(4) = rmax;
925     sE->Rmin(4) = RminFromZpCone(sE,3,kconTc,sE->GetZ(4),0.0);
926     sE->Rmax(3) = RmaxFrom2Points(sE,4,2,sE->GetZ(3));
927     sE->Rmin(7) = kconRinMin;
928     sE->Rmin(8) = kconRinMin;
929     RadiusOfCurvature(kconRcurv,90.0,0.0,kconRinMax,90.0-kconTc,z,rmax);
930     sE->Rmax(8) = rmax;
931     sE->Z(8)    = ZFromRmaxpCone(sE,4,kconTc,sE->GetRmax(8));
932     sE->Z(9)    = kconZcylinder;
933     sE->Rmin(9) = kconRinMin;
934     sE->Z(10)    = sE->GetZ(9);
935     sE->Rmin(10) = kconRinCylinder;
936     sE->Rmin(11) = kconRinCylinder;
937     sE->Rmax(11) = sE->GetRmin(11);
938     rmin         = sE->GetRmin(8);
939     RadiusOfCurvature(kconRcurv,90.0-kconTc,sE->GetZ(8),sE->GetRmax(8),90.0,
940                       z,rmax);
941     rmax = kconRinMax;
942     sE->Z(11)    = z+(sE->GetZ(8)-z)*(sE->GetRmax(11)-rmax)/
943                                            (sE->GetRmax(8)-rmax);
944     sE->Rmax(9) = RmaxFrom2Points(sE,11,8,sE->GetZ(9));
945     sE->Rmax(10) = sE->GetRmax(9);
946     sE->Z(6)    = z-kcondZin;
947     sE->Z(7)    = sE->GetZ(6);
948     sE->Rmax(6) = RmaxFromZpCone(sE,4,kconTc,sE->GetZ(6));
949     sE->Rmax(7) = sE->GetRmax(6);
950     RadiusOfCurvature(kconRcurv,90.,sE->GetZ(6),0.0,90.0-kconTc,z,rmin);
951     sE->Z(5)    = z;
952     sE->Rmin(5) = RminFromZpCone(sE,3,kconTc,z);
953     sE->Rmax(5) = RmaxFromZpCone(sE,4,kconTc,z);
954     RadiusOfCurvature(kconRcurv,90.-kconTc,0.0,sE->Rmin(5),90.0,z,rmin);
955     sE->Rmin(6) = rmin;
956     // Inner Core, Inserto material
957     sF = new TGeoPcon("ITSsddSuportConeInsertoStesaliteF",0.,360.0,9);
958     sF->Z(0)    = sE->GetZ(0);
959     sF->Rmin(0) = sE->GetRmin(0)+kconCthick;
960     sF->Rmax(0) = sE->GetRmax(0)-kconCthick;
961     sF->Z(1)    = sE->GetZ(1);
962     sF->Rmin(1) = sF->GetRmin(0);
963     sF->Rmax(1) = sF->GetRmax(0);
964     sF->Z(2)    = sE->GetZ(2);
965     sF->Rmax(2) = sF->GetRmax(1);
966     RadiusOfCurvature(kconRcurv-kconCthick,0.,sF->GetZ(1),sF->GetRmax(1),
967                       kconTc,z,rmin);
968     sF->Z(3)    = z;
969     sF->Rmin(3) = rmin;
970     sF->Rmin(2) = RminFrom2Points(sF,3,1,sF->GetZ(2));
971     RadiusOfCurvature(kconRcurv+kconCthick,0.,sF->GetZ(2),sF->GetRmax(2),
972                       kconTc,z,rmax);
973     sF->Z(4)    = z;
974     sF->Rmax(4) = rmax;
975     sF->Rmin(4) = RmaxFromZpCone(sE,2,kconTc,sF->GetZ(4),
976                                                    -kconCthick);
977     sF->Rmax(3) = RmaxFrom2Points(sF,4,2,sF->GetZ(3));
978     sF->Rmin(7) = sE->GetRmin(7);
979     sF->Rmin(8) = sE->GetRmin(8);
980     sF->Z(6)    = sE->GetZ(6)+kconCthick;
981     sF->Rmin(6) = sE->GetRmin(6);
982     sF->Z(7)    = sF->GetZ(6);
983     sF->Rmax(8) = sE->GetRmax(8)-kconCthick*kSinkconTc;
984     RadiusOfCurvature(kconRcurv+kconCthick,90.0,sF->GetZ(6),sF->GetRmin(6),
985                       90.0-kconTc,z,rmin);
986     sF->Z(5)    = z;
987     sF->Rmin(5) = rmin;
988     sF->Rmax(5) = RmaxFromZpCone(sF,4,kconTc,z);
989     sF->Rmax(6) = RmaxFromZpCone(sF,4,kconTc,sF->GetZ(6));
990     sF->Rmax(7) = sF->GetRmax(6);
991     sF->Z(8)    = ZFromRmaxpCone(sF,4,kconTc,sF->GetRmax(8),-kconCthick);
992     // Inner Core, Inserto material
993     sG = new TGeoPcon("ITSsddSuportConeFoamCoreG",0.0,360.0,4);
994     RadiusOfCurvature(kconRcurv+kconCthick,0.0,sF->GetZ(1),sF->GetRmin(1),
995                       kconTc,z,rmin);
996     sG->Z(0)    = z;
997     sG->Rmin(0) = rmin;
998     sG->Rmax(0) = sG->GetRmin(0);
999     sG->Z(1)    = sG->GetZ(0)+(kconThickness-2.0*kconCthick)/kSinkconTc;;
1000     sG->Rmin(1) = RminFromZpCone(sF,3,kconTc,sG->GetZ(1));
1001     sG->Rmax(1) = RmaxFromZpCone(sF,4,kconTc,sG->GetZ(1));
1002     sG->Z(2)    = sE->GetZ(5)-kconCthick;
1003     sG->Rmin(2) = RminFromZpCone(sF,3,kconTc,sG->GetZ(2));
1004     sG->Rmax(2) = RmaxFromZpCone(sF,4,kconTc,sG->GetZ(2));
1005     sG->Z(3)    = sF->GetZ(5)+(kconThickness-2.0*kconCthick)*kCoskconTc;
1006     sG->Rmax(3) = RmaxFromZpCone(sF,4,kconTc,sG->GetZ(3));
1007     sG->Rmin(3) = sG->GetRmax(3);
1008     //
1009     sH = new TGeoPcon("ITSsddSuportConeHoleH",kconPhiHole1,kcondPhiHole1,4);
1010     sH->Rmin(0) = kconRholeMax1;
1011     sH->Rmax(0) = sH->GetRmin(0);
1012     sH->Z(0)    = ZFromRminpCone(sE,3,kconTc,sH->GetRmin(0));
1013     sH->Rmax(1) = sH->GetRmax(0);
1014     sH->Z(1)    = ZFromRmaxpCone(sE,4,kconTc,sH->GetRmax(1));
1015     sH->Rmin(1) = RminFromZpCone(sE,3,kconTc,sH->GetZ(1));
1016     sH->Rmin(2) = kconRholeMin1;
1017     sH->Z(2)    = ZFromRminpCone(sE,3,kconTc,sH->GetRmin(2));
1018     sH->Rmax(2) = RmaxFromZpCone(sE,4,kconTc,sH->GetZ(2));
1019     sH->Rmin(3) = sH->GetRmin(2);
1020     sH->Rmax(3) = sH->GetRmin(3);
1021     sH->Z(3)    = ZFromRminpCone(sE,3,kconTc,sH->GetRmin(3));
1022     //
1023     x = kconCthick/(0.5*(kconRholeMax1+kconRholeMin1));
1024     t0 = kconPhiHole1 - x*fgkRadian;
1025     t  = kcondPhiHole1 + 2.0*x*fgkRadian;
1026     sI = new TGeoPcon("ITSsddSuportConeHoleI",t0,t,4);
1027     sI->Rmin(0) = kconRholeMax1+kconCthick;
1028     sI->Rmax(0) = sI->GetRmin(0);
1029     sI->Z(0)    = ZFromRminpCone(sF,3,kconTc,sI->GetRmin(0));
1030     sI->Rmax(1) = sI->GetRmax(0);
1031     sI->Z(1)    = ZFromRmaxpCone(sF,4,kconTc,sI->GetRmax(1));
1032     sI->Rmin(1) = RminFromZpCone(sF,3,kconTc,sI->GetZ(1));
1033     sI->Rmin(2) = kconRholeMin1-kconCthick;
1034     sI->Z(2)    = ZFromRminpCone(sF,3,kconTc,sI->GetRmin(2));
1035     sI->Rmax(2) = RmaxFromZpCone(sF,4,kconTc,sI->GetZ(2));
1036     sI->Rmin(3) = sI->GetRmin(2);
1037     sI->Rmax(3) = sI->GetRmin(3);
1038     sI->Z(3)    = ZFromRmaxpCone(sF,4,kconTc,sI->GetRmax(3));
1039     //
1040     sJ = new TGeoPcon("ITSsddSuportConeHoleJ",kconPhiHole2,
1041                                 kcondPhiHole2,4);
1042     sJ->Rmin(0) = kconRholeMax2;
1043     sJ->Rmax(0) = sJ->GetRmin(0);
1044     sJ->Z(0)    = ZFromRminpCone(sE,3,kconTc,sJ->GetRmin(0));
1045     sJ->Rmax(1) = sJ->GetRmax(0);
1046     sJ->Z(1)    = ZFromRmaxpCone(sE,4,kconTc,sJ->GetRmax(1));
1047     sJ->Rmin(1) = RminFromZpCone(sE,3,kconTc,sJ->GetZ(1));
1048     sJ->Rmin(2) = kconRholeMin2;
1049     sJ->Z(2)    = ZFromRminpCone(sE,3,kconTc,sJ->GetRmin(2));
1050     sJ->Rmax(2) = RmaxFromZpCone(sE,4,kconTc,sJ->GetZ(2));
1051     sJ->Rmin(3) = sJ->GetRmin(2);
1052     sJ->Rmax(3) = sJ->GetRmin(3);
1053     sJ->Z(3)    = ZFromRmaxpCone(sE,4,kconTc,sJ->GetRmax(3));
1054     //
1055     x = kconCthick/(0.5*(kconRholeMax2+kconRholeMin2));
1056     t0 = kconPhiHole2 - x*fgkRadian;
1057     t  = kcondPhiHole2 + 2.0*x*fgkRadian;
1058     sK = new TGeoPcon("ITSsddSuportConeHoleK",t0,t,4);
1059     sK->Rmin(0) = kconRholeMax2+kconCthick;
1060     sK->Rmax(0) = sK->GetRmin(0);
1061     sK->Z(0)    = ZFromRminpCone(sF,3,kconTc,sK->GetRmin(0));
1062     sK->Rmax(1) = sK->GetRmax(0);
1063     sK->Z(1)    = ZFromRmaxpCone(sF,4,kconTc,sK->GetRmax(1));
1064     sK->Rmin(1) = RminFromZpCone(sF,3,kconTc,sK->GetZ(1));
1065     sK->Rmin(2) = kconRholeMin2-kconCthick;
1066     sK->Z(2)    = ZFromRminpCone(sF,3,kconTc,sK->GetRmin(2));
1067     sK->Rmax(2) = RmaxFromZpCone(sF,4,kconTc,sK->GetZ(2));
1068     sK->Rmin(3) = sK->GetRmin(2);
1069     sK->Rmax(3) = sK->GetRmin(3);
1070     sK->Z(3)    = ZFromRmaxpCone(sF,4,kconTc,sK->GetRmax(3));
1071     //
1072     rot = new TGeoRotation("ITSsddRotZ30",0.0,0.0,30.0);
1073     rot->RegisterYourself();
1074     if(GetDebug()) rot->Print();
1075     rot = new TGeoRotation("ITSsddRotZ60",0.0,0.0,60.0);
1076     rot->RegisterYourself();
1077     if(GetDebug()) rot->Print();
1078     rot = new TGeoRotation("ITSsddRotZ90",0.0,0.0,90.0);
1079     rot->RegisterYourself();
1080     if(GetDebug()) rot->Print();
1081     rot = new TGeoRotation("ITSsddRotZ120",0.0,0.0,120.0);
1082     rot->RegisterYourself();
1083     if(GetDebug()) rot->Print();
1084     rot = new TGeoRotation("ITSsddRotZ150",0.0,0.0,150.0);
1085     rot->RegisterYourself();
1086     if(GetDebug()) rot->Print();
1087     rot = new TGeoRotation("ITSsddRotZ180",0.0,0.0,180.0);
1088     rot->RegisterYourself();
1089     if(GetDebug()) rot->Print();
1090     rot = new TGeoRotation("ITSsddRotZ210",0.0,0.0,210.0);
1091     rot->RegisterYourself();
1092     if(GetDebug()) rot->Print();
1093     rot = new TGeoRotation("ITSsddRotZ240",0.0,0.0,240.0);
1094     rot->RegisterYourself();
1095     if(GetDebug()) rot->Print();
1096     rot = new TGeoRotation("ITSsddRotZ270",0.0,0.0,270.0);
1097     rot->RegisterYourself();
1098     if(GetDebug()) rot->Print();
1099     rot = new TGeoRotation("ITSsddRotZ300",0.0,0.0,300.0);
1100     rot->RegisterYourself();
1101     if(GetDebug()) rot->Print();
1102     rot = new TGeoRotation("ITSsddRotZ330",0.0,0.0,330.0);
1103     rot->RegisterYourself();
1104     if(GetDebug()) rot->Print();
1105     sL = new TGeoCompositeShape("ITS SDD Suport Cone","((((((((((((((((("
1106                                 "ITSsddSuportConeCarbonFiberSurfaceE -"
1107                                 "ITSsddSuportConeHoleH)  -"
1108                                 "ITSsddSuportConeHoleH:ITSsddRotZ30) -"
1109                                 "ITSsddSuportConeHoleH:ITSsddRotZ60) -"
1110                                 "ITSsddSuportConeHoleH:ITSsddRotZ90) -"
1111                                 "ITSsddSuportConeHoleH:ITSsddRotZ120) -"
1112                                 "ITSsddSuportConeHoleH:ITSsddRotZ150) -"
1113                                 "ITSsddSuportConeHoleH:ITSsddRotZ180) -"
1114                                 "ITSsddSuportConeHoleH:ITSsddRotZ210) -"
1115                                 "ITSsddSuportConeHoleH:ITSsddRotZ240) -"
1116                                 "ITSsddSuportConeHoleH:ITSsddRotZ270) -"
1117                                 "ITSsddSuportConeHoleH:ITSsddRotZ300) -"
1118                                 "ITSsddSuportConeHoleH:ITSsddRotZ330) -"
1119                                 "ITSsddSuportConeHoleJ)  -"
1120                                 "ITSsddSuportConeHoleJ:ITSsddRotZ60) -"
1121                                 "ITSsddSuportConeHoleJ:ITSsddRotZ120) -"
1122                                 "ITSsddSuportConeHoleJ:ITSsddRotZ180) -"
1123                                "ITSsddSuportConeHoleJ:ITSsddRotZ240) -"
1124                                 "ITSsddSuportConeHoleJ:ITSsddRotZ300");
1125     sM = new TGeoCompositeShape("ITS SDD Suport Cone Inserto Stesalite",
1126                                 "((((((((((((((((("
1127                                 "ITSsddSuportConeInsertoStesaliteF -"
1128                                 "ITSsddSuportConeHoleI)  -"
1129                                 "ITSsddSuportConeHoleI:ITSsddRotZ30) -"
1130                                 "ITSsddSuportConeHoleI:ITSsddRotZ60) -"
1131                                 "ITSsddSuportConeHoleI:ITSsddRotZ90) -"
1132                                 "ITSsddSuportConeHoleI:ITSsddRotZ120) -"
1133                                 "ITSsddSuportConeHoleI:ITSsddRotZ150) -"
1134                                 "ITSsddSuportConeHoleI:ITSsddRotZ180) -"
1135                                 "ITSsddSuportConeHoleI:ITSsddRotZ210) -"
1136                                 "ITSsddSuportConeHoleI:ITSsddRotZ240) -"
1137                                 "ITSsddSuportConeHoleI:ITSsddRotZ270) -"
1138                                 "ITSsddSuportConeHoleI:ITSsddRotZ300) -"
1139                                 "ITSsddSuportConeHoleI:ITSsddRotZ330) -"
1140                                 "ITSsddSuportConeHoleK)  -"
1141                                 "ITSsddSuportConeHoleK:ITSsddRotZ60) -"
1142                                 "ITSsddSuportConeHoleK:ITSsddRotZ120) -"
1143                                 "ITSsddSuportConeHoleK:ITSsddRotZ180) -"
1144                                 "ITSsddSuportConeHoleK:ITSsddRotZ240) -"
1145                                 "ITSsddSuportConeHoleK:ITSsddRotZ300");
1146     sN = new TGeoCompositeShape("ITS SDD Suport Cone Foam Core",
1147                                 "((((((((((((((((("
1148                                 "ITSsddSuportConeFoamCoreG -"
1149                                 "ITSsddSuportConeHoleI)  -"
1150                                 "ITSsddSuportConeHoleI:ITSsddRotZ30) -"
1151                                 "ITSsddSuportConeHoleI:ITSsddRotZ60) -"
1152                                 "ITSsddSuportConeHoleI:ITSsddRotZ90) -"
1153                                 "ITSsddSuportConeHoleI:ITSsddRotZ120) -"
1154                                 "ITSsddSuportConeHoleI:ITSsddRotZ150) -"
1155                                 "ITSsddSuportConeHoleI:ITSsddRotZ180) -"
1156                                 "ITSsddSuportConeHoleI:ITSsddRotZ210) -"
1157                                 "ITSsddSuportConeHoleI:ITSsddRotZ240) -"
1158                                 "ITSsddSuportConeHoleI:ITSsddRotZ270) -"
1159                                 "ITSsddSuportConeHoleI:ITSsddRotZ300) -"
1160                                 "ITSsddSuportConeHoleI:ITSsddRotZ330) -"
1161                                 "ITSsddSuportConeHoleK)  -"
1162                                 "ITSsddSuportConeHoleK:ITSsddRotZ60) -"
1163                                 "ITSsddSuportConeHoleK:ITSsddRotZ120) -"
1164                                 "ITSsddSuportConeHoleK:ITSsddRotZ180) -"
1165                                 "ITSsddSuportConeHoleK:ITSsddRotZ240) -"
1166                                 "ITSsddSuportConeHoleK:ITSsddRotZ300");
1167     //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1168     if(GetDebug()){
1169         sE->InspectShape();
1170         sF->InspectShape();
1171         sG->InspectShape();
1172         sH->InspectShape();
1173         sI->InspectShape();
1174         sJ->InspectShape();
1175         sK->InspectShape();
1176         sL->InspectShape();
1177         sM->InspectShape();
1178         sN->InspectShape();
1179     } // end if GetDebug()
1180     //
1181     TGeoVolume *vL,*vM,*vN;
1182     vL = new TGeoVolume("ITSsddConeL",sL,medSDDcf);
1183     vL->SetVisibility(kTRUE);
1184     vL->SetLineColor(4);
1185     vL->SetLineWidth(1);
1186     vL->SetFillColor(vL->GetLineColor());
1187     vL->SetFillStyle(4000); // 0% transparent
1188     vM = new TGeoVolume("ITSsddConeM",sM,medSDDfs);
1189     vM->SetVisibility(kTRUE);
1190     vM->SetLineColor(2);
1191     vM->SetLineWidth(1);
1192     vM->SetFillColor(vM->GetLineColor());
1193     vM->SetFillStyle(4010); // 10% transparent
1194     vN = new TGeoVolume("ITSsddConeN",sN,medSDDfo);
1195     vN->SetVisibility(kTRUE);
1196     vN->SetLineColor(7);
1197     vN->SetLineWidth(1);
1198     vN->SetFillColor(vN->GetLineColor());
1199     vN->SetFillStyle(4050); // 50% transparent
1200     //
1201     vM->AddNode(vN,1,0);
1202     vL->AddNode(vM,1,0);
1203     tran = new TGeoTranslation("",0.0,0.0,-kconZ0);
1204     moth->AddNode(vL,1,tran);
1205     rot = new TGeoRotation("",0.0,180.0*fgkDegree,0.0);
1206     rotran = new TGeoCombiTrans("",0.0,0.0,kconZ0,rot);
1207     moth->AddNode(vL,2,rotran);
1208     if(GetDebug()){
1209         tran->Print();
1210         rot->Print();
1211         rotran->Print();
1212         vL->PrintNodes();
1213         vM->PrintNodes();
1214         vN->PrintNodes();
1215     } // end if
1216     delete rot;// rot not explicity used in AddNode functions.
1217 }
1218 //______________________________________________________________________
1219 void AliITSv11GeometrySupport::SSDCone(TGeoVolume *moth){
1220     // Define the detail SSD support cone geometry.
1221     // Inputs:
1222     //   none.
1223     // Outputs:
1224     //  none.
1225     // Return:
1226     //  none.
1227     //
1228     Int_t i,j;
1229     Double_t t,t0,dt,x,y,z,vl[3],vg[3],x0,y0,rmin,rmax;
1230     TGeoMedium *medSSDcf  = 0; // SSD support cone Carbon Fiber materal number.
1231     TGeoMedium *medSSDfs  = 0; // SSD support cone inserto stesalite 4411w.
1232     TGeoMedium *medSSDfo  = 0; // SSD support cone foam, Rohacell 50A.
1233     TGeoMedium *medSSDss  = 0; // SSD support cone screw material,Stainless
1234     TGeoMedium *medSSDair = 0; // SSD support cone Air
1235     TGeoMedium *medSSDal  = 0; // SSD support cone SDD mounting bracket Al
1236     TGeoManager *mgr = gGeoManager;
1237     medSSDcf = mgr->GetMedium("ITSssdCarbonFiber");
1238     medSSDfs = mgr->GetMedium("ITSssdStaselite4411w");
1239     medSSDfo = mgr->GetMedium("ITSssdRohacell50A");
1240     medSSDss = mgr->GetMedium("ITSssdStainlessSteal");
1241     medSSDair= mgr->GetMedium("ITSssdAir");
1242     medSSDal = mgr->GetMedium("ITSssdAl");
1243     //
1244     // SSD Central cylinder/Thermal Sheald.
1245     const Double_t kcylZlength     = 1140.0*fgkmm; //
1246     const Double_t kcylZFoamlength = 1020.0*fgkmm; //
1247     const Double_t kcylROuter      = 0.5*595.0*fgkmm; //
1248     const Double_t kcylRInner      = 0.5*560.5*fgkmm; //
1249     const Double_t kcylCthick      = 0.64*fgkmm; //
1250     const Double_t kcylFoamThick   = 5.0*fgkmm; //
1251     const Double_t kcylRholes      = 0.5*575.0*fgkmm;
1252     const Double_t kcylZM6         = 6.0*fgkmm; //
1253     const Double_t kcylRM6         = 0.5*6.0*fgkmm;
1254     const Double_t kcylPhi0M6      = 0.0*fgkDegree;
1255     const Int_t    kcylNM6         = 40;
1256     const Double_t kcylZPin        = 10.0*fgkmm;
1257     const Double_t kcylRPin        = 0.5*4.0*fgkmm;
1258     const Double_t kcylPhi0Pin     = (90.0+4.5)*fgkDegree;
1259     const Int_t    kcylNPin        = 2;
1260     //
1261     TGeoPcon *sCA,*sCB;
1262     TGeoTube *sCC,*sCD,*sCE;
1263     //
1264     //Begin_Html
1265     /*
1266       <img src="picts/ITS/file_name.gif">
1267       <P>
1268       <FONT FACE'"TIMES">
1269       ITS SSD centreal support and thermal sheal cylinder.
1270       </FONT>
1271       </P>
1272      */
1273     //End_Html
1274     //
1275     sCC = new TGeoTube("ITS SSD Thermal Centeral Rohacell CylinderCC",
1276                        kcylROuter-kcylCthick-kcylFoamThick,
1277                        kcylROuter-kcylCthick,0.5*kcylZFoamlength);
1278     sCA = new TGeoPcon("ITS SSD Thermal Centeral Carbon Fiber CylinderCA",
1279                        0.0,360.0,6);
1280     sCB = new TGeoPcon("ITS SSD Thermal Centeral Stesalite CylinderCB",
1281                        0.0,360.0,6);
1282     sCA->Z(0)    = -0.5*kcylZlength;
1283     sCA->Rmin(0) = kcylRInner;
1284     sCA->Rmax(0) = kcylROuter;
1285     sCA->Z(1)    = sCA->GetZ(0) + kcylZM6;
1286     sCA->Rmin(1) = sCA->GetRmin(0);
1287     sCA->Rmax(1) = sCA->GetRmax(0);
1288     sCA->Z(2)    = -0.5*kcylZFoamlength;
1289     sCA->Rmin(2) = kcylROuter - 2.0*kcylCthick-kcylFoamThick;
1290     sCA->Rmax(2) = sCA->GetRmax(0);
1291     sCA->Z(3)    = -sCA->GetZ(2);
1292     sCA->Rmin(3) = sCA->GetRmin(2);
1293     sCA->Rmax(3) = sCA->GetRmax(2);
1294     sCA->Z(4)    = -sCA->GetZ(1);
1295     sCA->Rmin(4) = sCA->GetRmin(1);
1296     sCA->Rmax(4) = sCA->GetRmax(1);
1297     sCA->Z(5)    = -sCA->GetZ(0);
1298     sCA->Rmin(5) = sCA->GetRmin(0);
1299     sCA->Rmax(5) = sCA->GetRmax(0);
1300     //
1301     sCB->Z(0)    = sCA->GetZ(0);
1302     sCB->Rmin(0) = sCA->GetRmin(0) + kcylCthick;
1303     sCB->Rmax(0) = sCA->GetRmax(0) - kcylCthick;
1304     sCB->Z(1)    = sCA->GetZ(1);
1305     sCB->Rmin(1) = sCA->GetRmin(1) + kcylCthick;
1306     sCB->Rmax(1) = sCA->GetRmax(1) - kcylCthick;
1307     sCB->Z(2)    = sCA->GetZ(2);
1308     sCB->Rmin(2) = sCA->GetRmin(2) + kcylCthick;
1309     sCB->Rmax(2) = sCA->GetRmax(2) - kcylCthick;
1310     sCB->Z(3)    = sCA->GetZ(3);
1311     sCB->Rmin(3) = sCA->GetRmin(3) + kcylCthick;
1312     sCB->Rmax(3) = sCA->GetRmax(3) - kcylCthick;
1313     sCB->Z(4)    = sCA->GetZ(4);
1314     sCB->Rmin(4) = sCA->GetRmin(4) + kcylCthick;
1315     sCB->Rmax(4) = sCA->GetRmax(4) - kcylCthick;
1316     sCB->Z(5)    = sCA->GetZ(5);
1317     sCB->Rmin(5) = sCA->GetRmin(5) + kcylCthick;
1318     sCB->Rmax(5) = sCA->GetRmax(5) - kcylCthick;
1319     //
1320     sCD = new TGeoTube("ITS SSD Thermal Centeral Cylinder M6 screwCD",
1321                       0.0,kcylRM6,0.5*kcylZM6);
1322     sCE = new TGeoTube("ITS SSD Thermal Centeral Cylinder PinCE",
1323                       0.0,kcylRPin,0.5*kcylZPin);
1324     //
1325     if(GetDebug()){
1326         sCA->InspectShape();
1327         sCB->InspectShape();
1328         sCC->InspectShape();
1329         sCD->InspectShape();
1330         sCE->InspectShape();
1331     } // end if GetDegut()
1332     TGeoVolume *vCA,*vCB,*vCC,*vCD,*vCE;
1333     vCA = new TGeoVolume("ITSssdCentCylCA",sCA,medSSDcf);
1334     vCA->SetVisibility(kTRUE);
1335     vCA->SetLineColor(4); // blue
1336     vCA->SetLineWidth(1);
1337     vCA->SetFillColor(vCA->GetLineColor());
1338     vCA->SetFillStyle(4000); // 0% transparent
1339     vCB = new TGeoVolume("ITSssdCentCylCB",sCB,medSSDfs);
1340     vCB->SetVisibility(kTRUE);
1341     vCB->SetLineColor(2); // red
1342     vCB->SetLineWidth(1);
1343     vCB->SetFillColor(vCB->GetLineColor());
1344     vCB->SetFillStyle(4050); // 50% transparent
1345     vCC = new TGeoVolume("ITSssdCentCylCC",sCC,medSSDfo);
1346     vCC->SetVisibility(kTRUE);
1347     vCC->SetLineColor(3); // green
1348     vCC->SetLineWidth(1);
1349     vCC->SetFillColor(vCC->GetLineColor());
1350     vCC->SetFillStyle(4050); // 50% transparent
1351     vCD = new TGeoVolume("ITSssdCentCylCD",sCD,medSSDss);
1352     vCD->SetVisibility(kTRUE);
1353     vCD->SetLineColor(1); // black
1354     vCD->SetLineWidth(1);
1355     vCD->SetFillColor(vCD->GetLineColor());
1356     vCD->SetFillStyle(4000); // 0% transparent
1357     vCE = new TGeoVolume("ITSssdCentCylCE",sCE,medSSDss);
1358     vCE->SetVisibility(kTRUE);
1359     vCE->SetLineColor(1); // black
1360     vCE->SetLineWidth(1);
1361     vCE->SetFillColor(vCE->GetLineColor());
1362     vCE->SetFillStyle(4000); // 0% transparent
1363     // Insert Bolt and Pins in both the Cone and Cylinder at the same time.
1364     vCB->AddNode(vCC,1,0);
1365     vCA->AddNode(vCB,1,0);
1366     moth->AddNode(vCA,1,0);
1367     if(GetDebug()){
1368         vCA->PrintNodes();
1369         vCB->PrintNodes();
1370         vCC->PrintNodes();
1371         vCD->PrintNodes();
1372         vCE->PrintNodes();
1373     } // end if
1374     //
1375     // SSD Cone
1376     // Data from Drawings ALR 0743/2E "Supporto Globale Settore SSD" and 
1377     // ALR 0743/2A "Supporto Generale Settore SSD".
1378     //
1379     const Double_t kconThick            = 13.0*fgkmm; // Thickness of Cone.
1380     const Double_t kconCthick           = 0.75*fgkmm; // Car. finber thickness
1381     const Double_t kconRCurv0           = 10.0*fgkmm; // Radius of curvature.
1382     const Double_t kconRCurv1           = 25.0*fgkmm; // Radius of curvature.
1383     const Double_t kconT                = 39.0*fgkDegree; // angle of SSD cone.
1384     const Double_t kconZOuterRing       = 47.0*fgkmm;
1385     const Double_t kconZOuterRingMill   = kconZOuterRing-5.0*fgkmm;
1386     const Double_t kconZToCylinder      = 170.0*fgkmm;
1387     const Double_t kconZLengthMill      = 171.5*fgkmm;
1388     const Double_t kconZLength          = 176.5*fgkmm-
1389                                           (kconZOuterRing-kconZOuterRingMill);
1390     //const Double_t kconZInnerRing       = 161.5*fgkmm-
1391     //                                     (kconZOuterRing-kconZOuterRingMill);
1392     const Double_t kconZOuterRingInside = 30.25*fgkmm-
1393                                           (kconZOuterRing-kconZOuterRingMill);
1394     const Double_t kconZDisplacement    = kconZToCylinder + 0.5*kcylZlength;
1395     const Double_t kconROuterMax        = 0.5*985.0*fgkmm;
1396     const Double_t kconROuterMin        = 0.5*945.0*fgkmm;
1397     const Double_t kconRCylOuterMill    = 0.5*597.0*fgkmm;
1398     const Double_t kconRInnerMin        = 0.5*562.0*fgkmm;
1399     //const Double_t kconRCentCurv0       = 0.5*927.0*fgkmm;
1400     const Double_t kconRCentCurv1       = 0.5*593.0*fgkmm;
1401     const Double_t kconRCentCurv2       = 0.5*578.0*fgkmm;
1402     // Foam core.
1403     const Double_t kconRohacellL0       = 112.3*fgkmm;
1404     const Double_t kconRohacellL1       = 58.4*fgkmm;
1405     // Screws and pins in outer SSD cone ring
1406     const Double_t kconROutHoles        = 0.5*965.0*fgkmm;
1407     const Double_t kconRScrewM5by12     = 0.5*5.0*fgkmm;
1408     const Double_t kconLScrewM5by12     = 0.5*12.0*fgkmm;
1409     const Int_t    kconNScrewM5by12     = 2;
1410     const Double_t kconRPinO6           = 0.5*6.0*fgkmm;
1411     const Double_t kconLPinO6           = 0.5*10.0*fgkmm;
1412     const Int_t    kconNPinO6           = 3;
1413     const Int_t    kconNRailScrews      = 4;
1414     const Int_t    kconNRailPins        = 2;
1415     const Int_t    kconNmounts          = 4;
1416     const Double_t kconMountPhi0        = 9.0*fgkDegree; // degrees
1417     //
1418     const Double_t kconCableHoleROut    = 0.5*920.0*fgkmm;
1419     const Double_t kconCableHoleRinner  = 0.5*800.0*fgkmm;
1420     const Double_t kconCableHoleWidth   = 200.0*fgkmm;
1421     const Double_t kconCableHoleAngle   = 42.0*fgkDegree;
1422     //const Double_t kconCableHolePhi0    = 90.0/4.0*fgkDegree;
1423     //const Int_t    kconNCableHoles      = 8;
1424     const Double_t kconCoolHoleWidth    = 40.0*fgkmm;
1425     const Double_t kconCoolHoleHight    = 30.0*fgkmm;
1426     const Double_t kconCoolHoleRmin     = 350.0*fgkmm;
1427     //const Double_t kconCoolHolephi0     = 90.0/4.0*fgkDegree;
1428     //const Int_t    kconNCoolHoles       = 8;
1429     const Double_t kconMountHoleWidth   = 20.0*fgkmm;
1430     const Double_t kconMountHoleHight   = 20.0*fgkmm;
1431     const Double_t kconMountHoleRmin    = 317.5*fgkmm;
1432     //const Double_t kconMountHolephi0    = 0.0*fgkDegree;
1433     //const Int_t    kconNMountHoles      = 6;
1434     // SSD cone Wings with holes.
1435     const Double_t kconWingRmax         = 527.5*fgkmm;
1436     const Double_t kconWingWidth        = 70.0*fgkmm;
1437     const Double_t kconWingThick        = 10.0*fgkmm;
1438     const Double_t kconWingPhi0         = 45.0*fgkDegree;
1439     //const Int_t    kconNWings           = 4;
1440     // SSD-SDD Thermal/Mechanical cylinder mounts
1441     const Double_t kconRM6Head          = 8.0*fgkmm;
1442     const Double_t kconZM6Head          = 8.5*fgkmm;
1443     //
1444     // SSD-SDD Mounting bracket
1445     const Double_t ksupPRmin            = 0.5*539.0*fgkmm;// see SDD RoutMin
1446     const Double_t ksupPRmax            = 0.5*585.0*fgkmm;
1447     const Double_t ksupPZ               = 3.5*fgkmm;
1448     const Double_t ksupPPhi1            = (-0.5*70.*fgkmm/ksupPRmax)*fgkRadian;
1449     const Double_t ksupPPhi2            = -ksupPPhi1;
1450     //
1451     const Double_t kSinkconTc           = SinD(kconT);
1452     const Double_t kCoskconTc           = CosD(kconT);
1453     //
1454     TGeoPcon *sA0,*sB0,*sC0,*sF0,*sQ;
1455     TGeoConeSeg *sAh1,*sBh1;
1456     TGeoArb8 *sAh2,*sBh2;
1457     TGeoBBox *sAh3,*sBh3,*sAh4,*sBh4;
1458     TGeoConeSeg *sG,*sH;
1459     TGeoTubeSeg *sT;
1460     TGeoTube *sD,*sE,*sR,*sS;
1461     TGeoCompositeShape *sA,*sB,*sC,*sF;
1462     //
1463     // Lets start with the upper left outer carbon fiber surface.
1464     // Between za[2],rmaxa[2] and za[4],rmaxa[4] there is a curved section
1465     // given by rmaxa = rmaxa[2]-r*Sind(t) for 0<=t<=kconT and 
1466     // za = za[2] + r*Cosd(t) for 0<=t<=kconT. Simularly between za[1],rmina[1
1467     // and za[3],rmina[3] there is a curve section given by
1468     // rmina = rmina[1]-r*Sind(t) for 0<=t<=kconT and za = za[1]+r&Sind(t)
1469     // for t<=0<=kconT. These curves have been replaced by straight lines
1470     // between the equivelent points for simplicity.
1471     // Poly-cone Volume sA0. Top part of SSD cone Carbon Fiber.
1472     sA0 = new TGeoPcon("ITSssdSuportConeCarbonFiberSurfaceA0",0.0,360.0,15);
1473     sA0->Z(0)    = 0.0;
1474     sA0->Rmin(0) = kconROuterMin;
1475     sA0->Rmax(0) = kconROuterMax;
1476     sA0->Z(1)    = kconZOuterRingInside-kconRCurv0;
1477     sA0->Rmin(1) = sA0->GetRmin(0);
1478     sA0->Rmax(1) = sA0->GetRmax(0);
1479     sA0->Z(2)    = kconZOuterRingInside;
1480     sA0->Rmin(2) = sA0->GetRmin(1)-kconRCurv0;
1481     sA0->Rmax(2) = sA0->GetRmax(0);
1482     sA0->Z(3)    = sA0->GetZ(2);
1483     sA0->Rmin(3) = -1000; // See Below
1484     sA0->Rmax(3) = sA0->GetRmax(0);
1485     sA0->Z(4)    = kconZOuterRingMill-kconRCurv0;
1486     sA0->Rmin(4) = -1000; // See Below
1487     sA0->Rmax(4) = sA0->GetRmax(0);
1488     sA0->Z(5)    = kconZOuterRingMill;
1489     sA0->Rmin(5) = -1000; // See Below
1490     sA0->Rmax(5) = sA0->GetRmax(4) - kconRCurv0;
1491     sA0->Z(6)    = sA0->GetZ(5);
1492     sA0->Rmin(6) = -1000; // See Below
1493     sA0->Rmax(6) = -1000; // See Below
1494     sA0->Z(7)    = sA0->GetZ(6)+kconRCurv0*(1.-kCoskconTc);
1495     sA0->Rmin(7) = -1000; // See Below
1496     sA0->Rmax(7) = -1000; // See Below
1497     sA0->Z(8)    = -1000; // See Below
1498     sA0->Rmin(8) = kconRCentCurv2+kconRCurv1*kSinkconTc; // See Below
1499     sA0->Rmax(8) = -1000; // See Below
1500     sA0->Z(9)    = -1000; // See Below
1501     sA0->Rmin(9) = kconRCentCurv2;
1502     sA0->Rmax(9) = -1000; // See Below
1503     sA0->Z(10)   = -1000; // See Below
1504     sA0->Rmin(10)= kconRInnerMin;
1505     sA0->Rmax(10)= -1000; // See Below
1506     sA0->Z(11)   = kconZLengthMill-kconRCurv0*(1.0-kCoskconTc);
1507     sA0->Rmin(11)= sA0->GetRmin(10);
1508     sA0->Rmax(11)= kconRCentCurv1+kconRCurv0*kSinkconTc;
1509     sA0->Z(12)   = kconZToCylinder;
1510     sA0->Rmin(12)= sA0->GetRmin(10);
1511     sA0->Rmax(12)= -1000; // See Below
1512     sA0->Z(13)   = sA0->GetZ(12);
1513     sA0->Rmin(13)= kconRCylOuterMill;
1514     sA0->Rmax(13)= -1000; // See Below
1515     z            = kconZLengthMill;
1516     rmin         = kconRCentCurv1;
1517     rmax         = rmin;
1518     sA0->Z(14)   = -1000; // See Below
1519     sA0->Rmin(14)= sA0->GetRmin(13);
1520     sA0->Rmax(14)= sA0->GetRmin(14);
1521     // Compute values undefined above
1522     sA0->Z(14)   = Xfrom2Points(sA0->GetZ(11),sA0->GetRmax(11),z,rmax,
1523                                sA0->GetRmax(14));
1524     sA0->Z(8)    = ZFromRmaxpCone(sA0,11,90.-kconT,sA0->GetRmin(8),-kconThick);
1525     sA0->Rmax(8) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(8),0.0);
1526     sA0->Z(9)    = sA0->GetZ(8)+kconRCurv1*(1.-kCoskconTc);
1527     sA0->Z(10)   = sA0->GetZ(9);
1528     sA0->Rmin(3) = RminFromZpCone(sA0,8,90.-kconT,sA0->GetZ(3),0.0);
1529     sA0->Rmin(4) = RminFromZpCone(sA0,3,90.-kconT,sA0->GetZ(4),0.0);
1530     sA0->Rmin(5) = RminFromZpCone(sA0,3,90.-kconT,sA0->GetZ(5),0.0);
1531     sA0->Rmin(7) = RminFromZpCone(sA0,3,90.-kconT,sA0->GetZ(7),0.0);
1532     sA0->Rmax(7) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(7),0.0);
1533     sA0->Rmin(6) = sA0->GetRmin(5);
1534     sA0->Rmax(6) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(7),0.0);
1535     sA0->Rmax(9) = RmaxFromZpCone(sA0,11,90.-kconT,sA0->GetZ(9),0.0);
1536     sA0->Rmax(10)= sA0->GetRmax(9);
1537     t = TanD(270.+kconT);
1538     sA0->Rmax(12)= RmaxFrom2Points(sA0,11,14,sA0->GetZ(12));
1539     sA0->Rmax(13)= sA0->GetRmax(12);
1540     //
1541     // Poly-cone Volume B. Stesalite inside volume sA0.
1542     // Now lets define the Inserto Stesalite 4411w material volume.
1543     // Poly-cone Volume sA0. Top part of SSD cone Carbon Fiber.
1544     sB0 = new TGeoPcon("ITSssdSuportConeStaseliteB0",0.0,360.0,15);
1545     //
1546     sB0->Z(0)    = sA0->GetZ(0);
1547     sB0->Rmin(0) = sA0->GetRmin(0) + kconCthick;
1548     sB0->Rmax(0) = sA0->GetRmax(0) - kconCthick;
1549     InsidePoint(sA0,0,1,2,kconCthick,sB0,1,kFALSE); // Rmin
1550     sB0->Rmax(1) = sB0->Rmax(0);
1551     InsidePoint(sA0,1,2,3,kconCthick,sB0,2,kFALSE); // Rmin
1552     sB0->Rmax(2) = sB0->Rmax(0);
1553     InsidePoint(sA0,2,3,9,kconCthick,sB0,3,kFALSE);
1554     sB0->Rmax(3) = sB0->Rmax(0);
1555     InsidePoint(sA0,0,4,5,kconCthick,sB0,4,kTRUE); // Rmax
1556     sB0->Rmin(4) = -1000.; // see Bellow
1557     InsidePoint(sA0,4,5,6,kconCthick,sB0,5,kTRUE); // Rmax
1558     sB0->Rmin(5) = -1000.; // see Bellow
1559     InsidePoint(sA0,5,6,7,kconCthick,sB0,6,kTRUE); // Rmax
1560     sB0->Rmin(6) = -1000.; // see Bellow
1561     InsidePoint(sA0,6,7,11,kconCthick,sB0,7,kTRUE); // Rmax
1562     sB0->Rmin(7) = -1000.; // see Bellow
1563     InsidePoint(sA0,3,8,9,kconCthick,sB0,8,kFALSE); // Rmin
1564     sB0->Rmax(8) = -1000.; // see Bellow
1565     InsidePoint(sA0,8,9,10,kconCthick,sB0,9,kFALSE); // Rmin
1566     sB0->Rmax(9) = -1000.; // see Bellow
1567     sB0->Z(10)   = sA0->GetZ(10) + kconCthick;
1568     sB0->Rmin(10)= sA0->GetRmin(10);
1569     sB0->Rmax(10)= -1000.; // see Bellow
1570     InsidePoint(sA0,7,11,14,kconCthick,sB0,11,kTRUE); // Rmax
1571     sB0->Rmin(11)= sA0->GetRmin(10);
1572     sB0->Z(12)    = sA0->GetZ(12);
1573     sB0->Rmin(12)= sA0->GetRmin(12);
1574     sB0->Rmax(12)= -1000.; // see Bellow
1575     sB0->Z(13)   = sA0->GetZ(13);
1576     sB0->Rmin(13)= sA0->GetRmin(13);
1577     sB0->Rmax(13)= -1000.; // see Bellow
1578     sB0->Z(14)   = sA0->GetZ(14) - kconCthick;
1579     sB0->Rmin(14)= sA0->GetRmin(14);
1580     sB0->Rmax(14)= sB0->Rmin(14); // Close?
1581     sB0->Rmin(4) = RminFrom2Points(sB0,3,8,sB0->GetZ(4));
1582     sB0->Rmin(5) = RminFrom2Points(sB0,3,8,sB0->GetZ(5));
1583     sB0->Rmin(6) = sB0->GetRmin(5);
1584     sB0->Rmin(7) = RminFrom2Points(sB0,3,8,sB0->GetZ(7));
1585     sB0->Rmax(8) = RmaxFrom2Points(sB0,7,11,sB0->GetZ(8));
1586     sB0->Rmax(9) = RmaxFrom2Points(sB0,7,11,sB0->GetZ(9));
1587     sB0->Rmax(10)= sB0->GetRmax(9);
1588     sB0->Rmax(12)= RmaxFrom2Points(sB0,11,14,sB0->GetZ(12));
1589     sB0->Rmax(13)= RmaxFrom2Points(sB0,11,14,sB0->GetZ(13));
1590     //
1591     // Poly-cone Volume sC0. Foam inside volume sA0.
1592     // Now lets define the Rohacell foam material volume.
1593     sC0 = new TGeoPcon("ITSssdSuportConeRohacellC0",0.0,360.0,4);
1594     sC0->Z(1)    = sB0->GetZ(7);
1595     sC0->Rmax(1) = sB0->GetRmax(7);
1596     sC0->Rmin(1) = RminFrom2Points(sB0,3,8,sC0->GetZ(1));
1597     sC0->Rmin(0) = sC0->GetRmax(1);
1598     sC0->Rmax(0) = sC0->GetRmin(0);
1599     sC0->Z(0)    = Zfrom2MinPoints(sB0,3,8,sC0->Rmin(0));
1600     t = kconThick-2.0*kconCthick;
1601     sC0->Rmax(3) = sC0->GetRmax(0)-kCoskconTc*TMath::Sqrt(
1602                              kconRohacellL0*kconRohacellL0-t*t)+t*kSinkconTc;
1603     sC0->Rmin(3) = sC0->GetRmax(3);
1604     sC0->Z(3)    = ZFromRmaxpCone(sB0,11,90.-kconT,sC0->GetRmax(3),0.0);;
1605     sC0->Rmin(2) = sC0->GetRmin(3);
1606     sC0->Z(2)    = ZFromRminpCone(sB0,3,90.-kconT,sC0->GetRmin(2),0.0);
1607     sC0->Rmax(2) = RmaxFromZpCone(sB0,11,90.0-kconT,sC0->GetZ(2),0.0);
1608     //
1609     // Poly-cone Volume sF0.  Second Foam inside volume sA0.
1610     // Now lets define the Rohacell foam material volume.
1611     sF0 = new TGeoPcon("ITSssdSuportConeRohacellCF0",0.0,360.0,4);
1612     sF0->Z(2)    = sB0->GetZ(8);
1613     sF0->Rmin(2) = sB0->GetRmin(8);
1614     sF0->Rmax(2) = sB0->GetRmax(8);
1615     sF0->Z(0)    = sF0->GetZ(2)-kconRohacellL1*kSinkconTc;
1616     sF0->Rmin(0) = sF0->GetRmin(2)+kconRohacellL1*kCoskconTc;
1617     sF0->Rmax(0) = sF0->GetRmin(0);
1618     sF0->Z(1)    = ZFromRmaxpCone(sB0,11,90.-kconT,sF0->GetRmax(0),0.0);;
1619     sF0->Rmax(1) = sF0->GetRmax(0);
1620     sF0->Rmin(1) = RminFrom2Points(sB0,3,8,sF0->GetZ(1));
1621     sF0->Rmax(3) = sF0->GetRmin(2)+(kconThick-2.0*kconCthick)*kCoskconTc;
1622     sF0->Rmin(3) = sF0->GetRmax(3);
1623     sF0->Z(3)    = ZFromRmaxpCone(sB0,11,90.-kconT,sF0->GetRmax(3),0.0);
1624     // Holes for Cables to pass Through is created by the intersection
1625     // between a cone segment and an Arb8, One for the volume sA0 and a
1626     // larger one for the volumes sB0 and sC0, so that the surface is covered
1627     // in carbon figer (volume sA0).
1628     sAh1 = new TGeoConeSeg("ITSssdCableHoleAh1",
1629                            0.5*kconZLength,kconCableHoleRinner,
1630                            kconCableHoleROut,kconCableHoleRinner,
1631                            kconCableHoleROut,
1632                            90.-(0.5*kconCableHoleWidth/
1633                                 kconCableHoleROut)*fgkRadian,
1634                            90.+(0.5*kconCableHoleWidth/
1635                                 kconCableHoleROut)*fgkRadian);
1636     sBh1 = new TGeoConeSeg("ITSssdCableHoleBh1",0.5*kconZLength,
1637                            kconCableHoleRinner-kconCthick,
1638                            kconCableHoleROut+kconCthick,
1639                            kconCableHoleRinner-kconCthick,
1640                            kconCableHoleROut+kconCthick,
1641                            90.-(((0.5*kconCableHoleWidth+kconCthick)/
1642                                  (kconCableHoleROut+kconCthick)))*fgkRadian,
1643                            90.+(((0.5*kconCableHoleWidth+kconCthick)/
1644                                  (kconCableHoleROut+kconCthick)))*fgkRadian);
1645     x0 = sAh1->GetRmax1()*CosD(sAh1->GetPhi2());
1646     y0 = sAh1->GetRmax1()*SinD(sAh1->GetPhi2());
1647     sAh2 = new TGeoArb8("ITSssdCableHoleAh2",0.5*kconZLength);
1648     y  = sAh1->GetRmax1();
1649     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1650     sAh2->SetVertex(0,x,y);
1651     y  = sAh1->GetRmin1()*SinD(sAh1->GetPhi2());
1652     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1653     sAh2->SetVertex(3,x,y);
1654     x0 = sAh1->GetRmax1()*CosD(sAh1->GetPhi1());
1655     y0 = sAh1->GetRmax1()*SinD(sAh1->GetPhi1());
1656     y  = sAh1->GetRmax1();
1657     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1658     sAh2->SetVertex(1,x,y);
1659     y  = sAh1->GetRmin1()*SinD(sAh1->GetPhi1());
1660     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1661     sAh2->SetVertex(2,x,y);
1662     //
1663     x0 = sBh1->GetRmax1()*CosD(sBh1->GetPhi2());
1664     y0 = sBh1->GetRmax1()*SinD(sBh1->GetPhi2());
1665     sBh2 = new TGeoArb8("ITSssdCableHoleBh2",0.5*kconZLength);
1666     y  = sBh1->GetRmax1();
1667     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1668     sBh2->SetVertex(0,x,y);
1669     y  = sBh1->GetRmin1()*SinD(sBh1->GetPhi2());
1670     x  = x0+(y-y0)/TanD(90.0+kconCableHoleAngle);
1671     sBh2->SetVertex(3,x,y);
1672     x0 = sBh1->GetRmax1()*CosD(sBh1->GetPhi1());
1673     y0 = sBh1->GetRmax1()*SinD(sBh1->GetPhi1());
1674     y  = sBh1->GetRmax1();
1675     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1676     sBh2->SetVertex(1,x,y);
1677     y  = sBh1->GetRmin1()*SinD(sBh1->GetPhi1());
1678     x  = x0+(y-y0)/TanD(90.0-kconCableHoleAngle);
1679     sBh2->SetVertex(2,x,y);
1680     for(i=0;i<4;i++){ // define points at +dz
1681         sAh2->SetVertex(i+4,(sAh2->GetVertices())[2*i],
1682                            (sAh2->GetVertices())[1+2*i]);
1683         sBh2->SetVertex(i+4,(sBh2->GetVertices())[2*i],
1684                            (sBh2->GetVertices())[1+2*i]);
1685     } // end for i
1686     sAh3 = new TGeoBBox("ITSssdCoolingHoleAh3",0.5*kconCoolHoleWidth,
1687                         0.5*kconCoolHoleHight,kconZLength);
1688     sBh3 = new TGeoBBox("ITSssdCoolingHoleBh3",
1689                         0.5*kconCoolHoleWidth+kconCthick,
1690                         0.5*kconCoolHoleHight+kconCthick,kconZLength);
1691     sAh4 = new TGeoBBox("ITSssdMountingPostHoleAh4",0.5*kconMountHoleWidth,
1692                         0.5*kconMountHoleHight,0.5*kconZLength);
1693     z = sF0->GetZ(0)-sF0->GetZ(sF0->GetNz()-1);
1694     if(z<0.0) z = -z;
1695     sBh4 = new TGeoBBox("ITSssdMountingPostHoleBh4",
1696                         0.5*kconMountHoleWidth+kconCthick,
1697                         0.5*kconMountHoleHight+kconCthick,0.5*z);
1698     // SSD Cone Wings
1699     sG = new TGeoConeSeg("ITSssdWingCarbonFiberSurfaceG",
1700                          0.5*kconWingThick,kconROuterMax-kconCthick,
1701                          kconWingRmax,kconROuterMax-kconCthick,kconWingRmax,
1702                       kconWingPhi0-(0.5*kconWingWidth/kconWingRmax)*fgkRadian,
1703                       kconWingPhi0+(0.5*kconWingWidth/kconWingRmax)*fgkRadian);
1704     sH = new TGeoConeSeg("ITSssdWingStaseliteH",
1705                          0.5*kconWingThick-kconCthick,kconROuterMax-kconCthick,
1706                          kconWingRmax-kconCthick,
1707                          kconROuterMax-kconCthick,
1708                          kconWingRmax-kconCthick,
1709                          kconWingPhi0-((0.5*kconWingWidth-kconCthick)/
1710                                        (kconWingRmax-kconCthick))*fgkRadian,
1711                          kconWingPhi0+((0.5*kconWingWidth-kconCthick)/
1712                                        (kconWingRmax-kconCthick))*fgkRadian);
1713     // SDD support plate, SSD side.
1714     //Poly-cone Volume sT.
1715     sT = new TGeoTubeSeg("ITSssdsddMountingBracketT",ksupPRmin,ksupPRmax,
1716                          ksupPZ,ksupPPhi1,ksupPPhi2);
1717     //
1718     TGeoRotation *rotZ225 =new TGeoRotation("ITSssdConeZ225", 0.0,0.0, 22.5);
1719     rotZ225->RegisterYourself();
1720     TGeoRotation *rotZ675 =new TGeoRotation("ITSssdConeZ675", 0.0,0.0, 67.5);
1721     rotZ675->RegisterYourself();
1722     TGeoRotation *rotZ90  =new TGeoRotation("ITSssdConeZ90",  0.0,0.0, 90.0);
1723     rotZ90->RegisterYourself();
1724     TGeoRotation *rotZ1125=new TGeoRotation("ITSssdConeZ1125",0.0,0.0,112.5);
1725     rotZ1125->RegisterYourself();
1726     TGeoRotation *rotZ1575=new TGeoRotation("ITSssdConeZ1575",0.0,0.0,157.5);
1727     rotZ1575->RegisterYourself();
1728     TGeoRotation *rotZ180 =new TGeoRotation("ITSssdConeZ180", 0.0,0.0,180.0);
1729     rotZ180->RegisterYourself();
1730     TGeoRotation *rotZ2025=new TGeoRotation("ITSssdConeZ2025",0.0,0.0,202.5);
1731     rotZ2025->RegisterYourself();
1732     TGeoRotation *rotZ2475=new TGeoRotation("ITSssdConeZ2475",0.0,0.0,247.5);
1733     rotZ2475->RegisterYourself();
1734     TGeoRotation *rotZ270 =new TGeoRotation("ITSssdConeZ270", 0.0,0.0,270.0);
1735     rotZ270->RegisterYourself();
1736     TGeoRotation *rotZ2925=new TGeoRotation("ITSssdConeZ2925",0.0,0.0,292.5);
1737     rotZ2925->RegisterYourself();
1738     TGeoRotation *rotZ3375=new TGeoRotation("ITSssdConeZ3375",0.0,0.0,337.5);
1739     rotZ3375->RegisterYourself();
1740     //
1741     vl[0] = 0.0;vl[1] = kconCoolHoleRmin+0.5*kconCoolHoleHight;vl[2] = 0.0;
1742     rotZ225->LocalToMaster(vl,vg);
1743     TGeoCombiTrans *rotranA225  = new TGeoCombiTrans("ITSssdConeTZ225",vg[0],
1744                                                      vg[1],vg[2],rotZ225);
1745     rotranA225->RegisterYourself();
1746     rotZ675->LocalToMaster(vl,vg);
1747     TGeoCombiTrans *rotranA675  = new TGeoCombiTrans("ITSssdConeTZ675", vg[0],
1748                                                      vg[1],vg[2],rotZ675);
1749     rotranA675->RegisterYourself();
1750     rotZ1125->LocalToMaster(vl,vg);
1751     TGeoCombiTrans *rotranA1125 = new TGeoCombiTrans("ITSssdConeTZ1125",vg[0],
1752                                                      vg[1],vg[2],rotZ1125);
1753     rotranA1125->RegisterYourself();
1754     rotZ1575->LocalToMaster(vl,vg);
1755     TGeoCombiTrans *rotranA1575 = new TGeoCombiTrans("ITSssdConeTZ1575",vg[0],
1756                                                      vg[1],vg[2],rotZ1575);
1757     rotranA1575->RegisterYourself();
1758     rotZ2025->LocalToMaster(vl,vg);
1759     TGeoCombiTrans *rotranA2025 = new TGeoCombiTrans("ITSssdConeTZ2025",vg[0],
1760                                                      vg[1],vg[2],rotZ2025);
1761     rotranA2025->RegisterYourself();
1762     rotZ2475->LocalToMaster(vl,vg);
1763     TGeoCombiTrans *rotranA2475 = new TGeoCombiTrans("ITSssdConeTZ2475",vg[0],
1764                                                      vg[1],vg[2],rotZ2475);
1765     rotranA2475->RegisterYourself();
1766     rotZ2925->LocalToMaster(vl,vg);
1767     TGeoCombiTrans *rotranA2925 = new TGeoCombiTrans("ITSssdConeTZ2925",vg[0],
1768                                                      vg[1],vg[2],rotZ2925);
1769     rotranA2925->RegisterYourself();
1770     rotZ3375->LocalToMaster(vl,vg);
1771     TGeoCombiTrans *rotranA3375 = new TGeoCombiTrans("ITSssdConeTZ3375",vg[0],
1772                                                      vg[1],vg[2],rotZ3375);
1773     rotranA3375->RegisterYourself();
1774     TGeoRotation *rotZ30  = new TGeoRotation("ITSssdConeZ30", 0.0,0.0, 30.0);
1775     TGeoRotation *rotZ60  = new TGeoRotation("ITSssdConeZ60", 0.0,0.0, 60.0);
1776     //TGeoRotation *rotZ120 = new TGeoRotation("ITSssdConeZ120",0.0,0.0,120.0);
1777     TGeoRotation *rotZ150 = new TGeoRotation("ITSssdConeZ150",0.0,0.0,150.0);
1778     TGeoRotation *rotZ210 = new TGeoRotation("ITSssdConeZ210",0.0,0.0,210.0);
1779     //TGeoRotation *rotZ240 = new TGeoRotation("ITSssdConeZ240",0.0,0.0,240.0);
1780     TGeoRotation *rotZ300 = new TGeoRotation("ITSssdConeZ300",0.0,0.0,300.0);
1781     TGeoRotation *rotZ330 = new TGeoRotation("ITSssdConeZ330",0.0,0.0,330.0);
1782     vl[0] = kconMountHoleRmin+0.5*kconMountHoleHight; vl[1] = 0.0; vl[2] = 0.0;
1783     for(i=0;i<sF0->GetNz();i++) vl[2] += sF0->GetZ(i);
1784     vl[2] /= (Double_t)(sF0->GetNz());
1785     rotZ30->LocalToMaster(vl,vg);
1786     TGeoCombiTrans *rotranA30 = new TGeoCombiTrans("ITSssdConeTZ30",vg[0],
1787                                                       vg[1],vg[2],rotZ30);
1788     rotranA30->RegisterYourself();
1789     rotZ90->LocalToMaster(vl,vg);
1790     TGeoCombiTrans *rotranA90  = new TGeoCombiTrans("ITSssdConeTZ90", vg[0],
1791                                                      vg[1],vg[2],rotZ90);
1792     rotranA90->RegisterYourself();
1793     rotZ150->LocalToMaster(vl,vg);
1794     TGeoCombiTrans *rotranA150 = new TGeoCombiTrans("ITSssdConeTZ150",vg[0],
1795                                                      vg[1],vg[2],rotZ150);
1796     rotranA150->RegisterYourself();
1797     rotZ210->LocalToMaster(vl,vg);
1798     TGeoCombiTrans *rotranA210 = new TGeoCombiTrans("ITSssdConeTZ210",vg[0],
1799                                                      vg[1],vg[2],rotZ210);
1800     rotranA210->RegisterYourself();
1801     rotZ270->LocalToMaster(vl,vg);
1802     TGeoCombiTrans *rotranA270 = new TGeoCombiTrans("ITSssdConeTZ270",vg[0],
1803                                                      vg[1],vg[2],rotZ270);
1804     rotranA270->RegisterYourself();
1805     rotZ330->LocalToMaster(vl,vg);
1806     TGeoCombiTrans *rotranA330 = new TGeoCombiTrans("ITSssdConeTZ330",vg[0],
1807                                                      vg[1],vg[2],rotZ330);
1808     rotranA330->RegisterYourself();
1809     vl[0] = 0.0; vl[1] = 0.0; vl[2] = sA0->GetZ(10)+sT->GetDz();
1810     rotZ60->LocalToMaster(vl,vg);
1811     TGeoCombiTrans *rotranBrTZ60  = new TGeoCombiTrans("ITSssdConeBrTZ60",
1812                                                   vg[0],vg[1],vg[2],rotZ60);
1813     rotranBrTZ60->RegisterYourself();
1814     TGeoCombiTrans *rotranBrTZ180 = new TGeoCombiTrans("ITSssdConeBrTZ180",
1815                                                   vg[0],vg[1],vg[2],rotZ180);
1816     rotranBrTZ180->RegisterYourself();
1817     TGeoCombiTrans *rotranBrTZ300 = new TGeoCombiTrans("ITSssdConeBrTZ300",
1818                                                   vg[0],vg[1],vg[2],rotZ300);
1819     rotranBrTZ300->RegisterYourself();
1820     if(GetDebug()){
1821         rotZ225->Print();
1822         rotZ675->Print();
1823         rotZ90->Print();
1824         rotZ1125->Print();
1825         rotZ1575->Print();
1826         rotZ180->Print();
1827         rotZ2025->Print();
1828         rotZ2475->Print();
1829         rotZ270->Print();
1830         rotZ2925->Print();
1831         rotZ3375->Print();
1832         rotranA225->Print();
1833         rotranA675->Print();
1834         rotranA1125->Print();
1835         rotranA1575->Print();
1836         rotranA2025->Print();
1837         rotranA2475->Print();
1838         rotranA2925->Print();
1839         rotranA3375->Print();
1840         rotZ60->Print();
1841         rotZ300->Print();
1842         rotranA30->Print();
1843         rotranA90->Print();
1844         rotranA150->Print();
1845         rotranA210->Print();
1846         rotranA270->Print();
1847         rotranA330->Print();
1848         rotranBrTZ60->Print();
1849         rotranBrTZ180->Print();
1850         rotranBrTZ300->Print();
1851     } // end if GetDebug()
1852     sA = new TGeoCompositeShape("ITSssdSuportConeCarbonFiberSurfaceA",
1853         "(((((((((((((((((((((((((((("
1854         "ITSssdSuportConeCarbonFiberSurfaceA0 +"
1855         "ITSssdWingCarbonFiberSurfaceG) +"
1856         "ITSssdWingCarbonFiberSurfaceG:ITSssdConeZ90) +"
1857         "ITSssdWingCarbonFiberSurfaceG:ITSssdConeZ180) +"
1858         "ITSssdWingCarbonFiberSurfaceG:ITSssdConeZ270) -"
1859         "(ITSssdCableHoleAh1:ITSssdConeZ225*ITSssdCableHoleAh2:ITSssdConeZ225)) -"
1860         "(ITSssdCableHoleAh1:ITSssdConeZ675*ITSssdCableHoleAh2:ITSssdConeZ675)) -"
1861         "(ITSssdCableHoleAh1:ITSssdConeZ1125*ITSssdCableHoleAh2:ITSssdConeZ1125)) -"
1862         "(ITSssdCableHoleAh1:ITSssdConeZ1575*ITSssdCableHoleAh2:ITSssdConeZ1575)) -"
1863         "(ITSssdCableHoleAh1:ITSssdConeZ2025*ITSssdCableHoleAh2:ITSssdConeZ2025)) -"
1864         "(ITSssdCableHoleAh1:ITSssdConeZ2475*ITSssdCableHoleAh2:ITSssdConeZ2475)) -"
1865         "(ITSssdCableHoleAh1:ITSssdConeZ2925*ITSssdCableHoleAh2:ITSssdConeZ2925)) -"
1866         "(ITSssdCableHoleAh1:ITSssdConeZ3375*ITSssdCableHoleAh2:ITSssdConeZ3375)) -"
1867         "ITSssdCoolingHoleAh3:ITSssdConeTZ225) -"
1868         "ITSssdCoolingHoleAh3:ITSssdConeTZ675) -"
1869         "ITSssdCoolingHoleAh3:ITSssdConeTZ1125) -"
1870         "ITSssdCoolingHoleAh3:ITSssdConeTZ1575) -"
1871         "ITSssdCoolingHoleAh3:ITSssdConeTZ2025) -"
1872         "ITSssdCoolingHoleAh3:ITSssdConeTZ2475) -"
1873         "ITSssdCoolingHoleAh3:ITSssdConeTZ2925) -"
1874         "ITSssdCoolingHoleAh3:ITSssdConeTZ3375) -"
1875         "ITSssdMountingPostHoleAh4:ITSssdConeTZ30) -"
1876         "ITSssdMountingPostHoleAh4:ITSssdConeTZ90) -"
1877         "ITSssdMountingPostHoleAh4:ITSssdConeTZ150) -"
1878         "ITSssdMountingPostHoleAh4:ITSssdConeTZ210) -"
1879         "ITSssdMountingPostHoleAh4:ITSssdConeTZ270) -"
1880         "ITSssdMountingPostHoleAh4:ITSssdConeTZ330) -"
1881         "ITSssdsddMountingBracketT:ITSssdConeBrTZ60) -"
1882         "ITSssdsddMountingBracketT:ITSssdConeBrTZ180) -"
1883         "ITSssdsddMountingBracketT:ITSssdConeBrTZ300"
1884         );
1885     sB = new TGeoCompositeShape("ITSssdSuportConeStaseliteB",
1886         "(((((((((((((((((((((((((((("
1887         "ITSssdSuportConeStaseliteB0 +"
1888         "ITSssdWingStaseliteH) +"
1889         "ITSssdWingStaseliteH:ITSssdConeZ90) +"
1890         "ITSssdWingStaseliteH:ITSssdConeZ180) +"
1891         "ITSssdWingStaseliteH:ITSssdConeZ270) -"
1892         "(ITSssdCableHoleBh1:ITSssdConeZ225*ITSssdCableHoleBh2:ITSssdConeZ225)) -"
1893         "(ITSssdCableHoleBh1:ITSssdConeZ675*ITSssdCableHoleBh2:ITSssdConeZ675)) -"
1894         "(ITSssdCableHoleBh1:ITSssdConeZ1125*ITSssdCableHoleBh2:ITSssdConeZ1125)) -"
1895         "(ITSssdCableHoleBh1:ITSssdConeZ1575*ITSssdCableHoleBh2:ITSssdConeZ1575)) -"
1896         "(ITSssdCableHoleBh1:ITSssdConeZ2025*ITSssdCableHoleBh2:ITSssdConeZ2025)) -"
1897         "(ITSssdCableHoleBh1:ITSssdConeZ2475*ITSssdCableHoleBh2:ITSssdConeZ2475)) -"
1898         "(ITSssdCableHoleBh1:ITSssdConeZ2925*ITSssdCableHoleBh2:ITSssdConeZ2925)) -"
1899         "(ITSssdCableHoleBh1:ITSssdConeZ3375*ITSssdCableHoleBh2:ITSssdConeZ3375)) -"
1900         "ITSssdCoolingHoleBh3:ITSssdConeTZ225) -"
1901         "ITSssdCoolingHoleBh3:ITSssdConeTZ675) -"
1902         "ITSssdCoolingHoleBh3:ITSssdConeTZ1125) -"
1903         "ITSssdCoolingHoleBh3:ITSssdConeTZ1575) -"
1904         "ITSssdCoolingHoleBh3:ITSssdConeTZ2025) -"
1905         "ITSssdCoolingHoleBh3:ITSssdConeTZ2475) -"
1906         "ITSssdCoolingHoleBh3:ITSssdConeTZ2925) -"
1907         "ITSssdCoolingHoleBh3:ITSssdConeTZ3375) -"
1908         "ITSssdMountingPostHoleBh4:ITSssdConeTZ30) -"
1909         "ITSssdMountingPostHoleBh4:ITSssdConeTZ90) -"
1910         "ITSssdMountingPostHoleBh4:ITSssdConeTZ150) -"
1911         "ITSssdMountingPostHoleBh4:ITSssdConeTZ210) -"
1912         "ITSssdMountingPostHoleBh4:ITSssdConeTZ270) -"
1913         "ITSssdMountingPostHoleBh4:ITSssdConeTZ330) -"
1914         "ITSssdsddMountingBracketT:ITSssdConeBrTZ60) -"
1915         "ITSssdsddMountingBracketT:ITSssdConeBrTZ180) -"
1916         "ITSssdsddMountingBracketT:ITSssdConeBrTZ300"
1917         );
1918     sC = new TGeoCompositeShape("ITSssdSuportConeRohacellC",
1919       "((((((("
1920       "ITSssdSuportConeRohacellC0 -"
1921       "ITSssdCableHoleBh1:ITSssdConeZ225*ITSssdCableHoleBh2:ITSssdConeZ225) -"
1922       "ITSssdCableHoleBh1:ITSssdConeZ675*ITSssdCableHoleBh2:ITSssdConeZ675) -"
1923       "ITSssdCableHoleBh1:ITSssdConeZ1125*ITSssdCableHoleBh2:ITSssdConeZ1125) -"
1924       "ITSssdCableHoleBh1:ITSssdConeZ1575*ITSssdCableHoleBh2:ITSssdConeZ1575) -"
1925       "ITSssdCableHoleBh1:ITSssdConeZ2025*ITSssdCableHoleBh2:ITSssdConeZ2025) -"
1926       "ITSssdCableHoleBh1:ITSssdConeZ2475*ITSssdCableHoleBh2:ITSssdConeZ2475) -"
1927       "ITSssdCableHoleBh1:ITSssdConeZ2925*ITSssdCableHoleBh2:ITSssdConeZ2925) -"
1928       "ITSssdCableHoleBh1:ITSssdConeZ3375*ITSssdCableHoleBh2:ITSssdConeZ3375 "
1929         );
1930     sF = new TGeoCompositeShape("ITSssdSuportConeRohacellCF",
1931         "((((("
1932         "ITSssdSuportConeRohacellCF0 -"
1933         "ITSssdMountingPostHoleBh4:ITSssdConeTZ30) -"
1934         "ITSssdMountingPostHoleBh4:ITSssdConeTZ90) -"
1935         "ITSssdMountingPostHoleBh4:ITSssdConeTZ150) -"
1936         "ITSssdMountingPostHoleBh4:ITSssdConeTZ210) -"
1937         "ITSssdMountingPostHoleBh4:ITSssdConeTZ270) -"
1938         "ITSssdMountingPostHoleBh4:ITSssdConeTZ330"
1939         );
1940     //
1941     // In volume SCB, th Inserto Stesalite 4411w material volume, there
1942     // are a number of Stainless steel screw and pin studs which will be
1943     // filled with screws/studs.
1944     sD = new TGeoTube("ITS Screw+stud used to mount things to the SSD "
1945                       "support cone",
1946                       0.0,kconRScrewM5by12,kconLScrewM5by12);
1947     sE = new TGeoTube("ITS pin used to mount things to the "
1948                       "SSD support cone",0.0,kconRPinO6,kconLPinO6);
1949     // Bolt heads holding the SSD-SDD tube to the SSD cone.
1950     // Bolt -- PolyCone
1951     //Poly-cone Volume sQ.
1952     sQ = new TGeoPcon("ITS SSD Thermal sheal M6 screw headQ",0.0,360.0,4);
1953     sQ->Z(0)    = sA0->GetZ(12);
1954     sQ->Rmin(0) = 0.0;
1955     sQ->Rmax(0) = kcylRM6;
1956     sQ->Z(1)    = sQ->GetZ(0) - kconZM6Head;
1957     sQ->Rmin(1) = 0.0;
1958     sQ->Rmax(1) = kcylRM6;
1959     sQ->Z(2)    = sQ->GetZ(1);
1960     sQ->Rmin(2) = 0.0;
1961     sQ->Rmax(2) = kconRM6Head;
1962     sQ->Z(3)    = sQ->GetZ(0)-ksupPZ;
1963     sQ->Rmin(3) = 0.0;
1964     sQ->Rmax(3) = 0.5*kconRM6Head;
1965     // air infront of bolt (stasolit Volume K) -- Tube
1966     sR = new TGeoTube("ITS Air in front of bolt (in stasolit)R",
1967                       sQ->GetRmin(3),sQ->GetRmax(3),0.5*(ksupPZ-kconCthick));
1968     // air infront of bolt (carbon fiber volume I) -- Tube
1969     sS = new TGeoTube("ITS Air in front of Stainless Steal Screw end, M6S",
1970                       sQ->GetRmin(3),sQ->GetRmax(3),0.5*kconCthick);
1971     //
1972     if(GetDebug()){
1973         sA0->InspectShape();
1974         sB0->InspectShape();
1975         sC0->InspectShape();
1976         sF0->InspectShape();
1977         sQ->InspectShape();
1978         sAh1->InspectShape();
1979         sBh1->InspectShape();
1980         sAh2->InspectShape();
1981         sBh2->InspectShape();
1982         sAh3->InspectShape();
1983         sBh3->InspectShape();
1984         sAh4->InspectShape();
1985         sBh4->InspectShape();
1986         sG->InspectShape();
1987         sH->InspectShape();
1988         sT->InspectShape();
1989         sD->InspectShape();
1990         sE->InspectShape();
1991         sR->InspectShape();
1992         sS->InspectShape();
1993         sA->InspectShape();
1994         sB->InspectShape();
1995         sC->InspectShape();
1996         sF->InspectShape();
1997     } // end if GetDebug()
1998     TGeoVolume *vA,*vB,*vC,*vD,*vE,*vF,*vQ,*vR,*vS,*vT;
1999     //
2000     vA = new TGeoVolume("ITSssdConeA",sA,medSSDcf); // Carbon Fiber
2001     vA->SetVisibility(kTRUE);
2002     vA->SetLineColor(4); // blue
2003     vA->SetLineWidth(1);
2004     vA->SetFillColor(vA->GetLineColor());
2005     vA->SetFillStyle(4050); // 50% transparent
2006     vB = new TGeoVolume("ITSssdConeB",sB,medSSDfs); // Staselite
2007     vB->SetVisibility(kTRUE);
2008     vB->SetLineColor(2); // red
2009     vB->SetLineWidth(1);
2010     vB->SetFillColor(vB->GetLineColor());
2011     vB->SetFillStyle(4050); // 50% transparent
2012     vC = new TGeoVolume("ITSssdConeC",sC,medSSDfo); // Rohacell
2013     vC->SetVisibility(kTRUE);
2014     vC->SetLineColor(3); // green
2015     vC->SetLineWidth(1);
2016     vC->SetFillColor(vC->GetLineColor());
2017     vC->SetFillStyle(4050); // 50% transparent
2018     vF = new TGeoVolume("ITSssdConeF",sF,medSSDfo); // Rohacell;
2019     vF->SetVisibility(kTRUE);
2020     vF->SetLineColor(3); // green
2021     vF->SetLineWidth(1);
2022     vF->SetFillColor(vF->GetLineColor());
2023     vF->SetFillStyle(4050); // 50% transparent
2024     vD = new TGeoVolume("ITSssdConeD",sD,medSSDss);
2025     vD->SetVisibility(kTRUE);
2026     vD->SetLineColor(1); // black
2027     vD->SetLineWidth(1);
2028     vD->SetFillColor(vD->GetLineColor());
2029     vD->SetFillStyle(4000); // 0% transparent
2030     vE = new TGeoVolume("ITSssdConeE",sE,medSSDss);
2031     vE->SetVisibility(kTRUE);
2032     vE->SetLineColor(1); // black
2033     vE->SetLineWidth(1);
2034     vE->SetFillColor(vE->GetLineColor());
2035     vE->SetFillStyle(4000); // 0% transparent
2036     vQ = new TGeoVolume("ITSssdConeQ",sQ,medSSDss);
2037     vQ->SetVisibility(kTRUE);
2038     vQ->SetLineColor(1); // black
2039     vQ->SetLineWidth(1);
2040     vQ->SetFillColor(vQ->GetLineColor());
2041     vQ->SetFillStyle(4000); // 0% transparent
2042     vR = new TGeoVolume("ITSssdConeR",sR,medSSDair);
2043     vR->SetVisibility(kTRUE);
2044     vR->SetLineColor(5); // yellow
2045     vR->SetLineWidth(1);
2046     vR->SetFillColor(vR->GetLineColor());
2047     vR->SetFillStyle(4090); // 90% transparent
2048     vS = new TGeoVolume("ITSssdConeS",sS,medSSDair);
2049     vS->SetVisibility(kTRUE);
2050     vS->SetLineColor(5); // yellow
2051     vS->SetLineWidth(1);
2052     vS->SetFillColor(vS->GetLineColor());
2053     vS->SetFillStyle(4090); // 90% transparent
2054     vT = new TGeoVolume("ITSssdsddMountingBracket",sT,medSSDal);
2055     vT->SetVisibility(kTRUE);
2056     vT->SetLineColor(5); // yellow
2057     vT->SetLineWidth(1);
2058     vT->SetFillColor(vT->GetLineColor());
2059     vT->SetFillStyle(4000); // 0% transparent
2060     //
2061     TGeoCombiTrans *rotran;
2062     TGeoTranslation *tran;
2063     tran = new TGeoTranslation("ITSssdConeTrans",0.0,0.0,-kconZDisplacement);
2064     TGeoRotation *rotY180 = new TGeoRotation("",0.0,180.0,0.0);
2065     TGeoCombiTrans *flip  = new TGeoCombiTrans("ITSssdConeFlip",
2066                                            0.0,0.0,kconZDisplacement,rotY180);
2067     delete rotY180;// rot not explicity used in AddNode functions.
2068     //
2069     //
2070     //
2071     //
2072     vA->AddNode(vB,1,0);
2073     vB->AddNode(vC,1,0);
2074     vB->AddNode(vF,1,0);
2075     moth->AddNode(vA,1,tran); // RB24 side
2076     moth->AddNode(vA,2,flip); // RB26 side (Absorber)
2077     //
2078     //
2079     //
2080     // Insert Bolt and Pins in both the Cone and Cylinder at the same time.
2081     Int_t nCopyCDv=0,nCopyCEv=0,nCopyQv=0,nCopyvR=0,nCopySv=0,nCopyTv=0;
2082     Int_t nCopyvD=0,nCopyvE=0;
2083     z = sCB->GetZ(0)-0.5*kcylZPin;
2084     dt = (360.0/((Double_t)kcylNPin));
2085     for(i=0;i<kcylNPin;i++){
2086         t = ((Double_t)i)*dt;
2087         x = kcylRholes*CosD(t+kcylPhi0Pin);
2088         y = kcylRholes*SinD(t+kcylPhi0Pin);
2089         tran = new TGeoTranslation("",x,y,z);
2090         vCB->AddNode(vCD,++nCopyCDv,tran);
2091         tran = new TGeoTranslation("",x,y,-z);
2092         vCB->AddNode(vCD,++nCopyCDv,tran);
2093     } // end for i
2094     dt = (360.0/((Double_t)kcylNM6));
2095     for(i=0;i<kcylNM6;i++){
2096         t = ((Double_t)i)*dt;
2097         x = kcylRholes*CosD(t+kcylPhi0M6);
2098         y = kcylRholes*SinD(t+kcylPhi0M6);
2099         z = sCB->GetZ(0)-0.5*kcylZM6;
2100         tran = new TGeoTranslation("",x,y,z);
2101         vCB->AddNode(vCE,++nCopyCEv,tran);
2102         tran = new TGeoTranslation("",x,y,-z);
2103         vCB->AddNode(vCE,++nCopyCEv,tran);
2104         tran = new TGeoTranslation("",x,y,0.0);
2105         vB->AddNode(vQ,++nCopyQv,tran);
2106         if(!((t<rotranBrTZ60->GetRotation()->GetPhiRotation()+sT->GetPhi2()&&
2107              t>rotranBrTZ60->GetRotation()->GetPhiRotation()-sT->GetPhi1())||
2108             (t<rotranBrTZ180->GetRotation()->GetPhiRotation()+sT->GetPhi2()&&
2109              t>rotranBrTZ180->GetRotation()->GetPhiRotation()-sT->GetPhi1())||
2110             (t<rotranBrTZ300->GetRotation()->GetPhiRotation()+sT->GetPhi2()&&
2111              t>rotranBrTZ300->GetRotation()->GetPhiRotation()-sT->GetPhi1()))){
2112             // If not at an angle where the bracket sT is located.
2113             tran = new TGeoTranslation("",x,y,sB0->GetZ(10)-sR->GetDz());
2114             vB->AddNode(vR,++nCopyvR,tran);
2115             tran = new TGeoTranslation("",x,y,sA0->GetZ(10)-sS->GetDz());
2116             vA->AddNode(vS,++nCopySv,tran);
2117         } // end if
2118     } // end for i
2119     // Add the mounting brackets to the RB24 side only.
2120     vl[0] = 0.0;
2121     vl[1] = 0.0;
2122     vl[2] = sA0->GetZ(10)+kconZDisplacement-sT->GetDz();
2123     rotZ60->LocalToMaster(vl,vg);
2124     rotran = new TGeoCombiTrans("",vg[0],vg[1],vg[2],rotZ60);
2125     moth->AddNode(vT,++nCopyTv,rotran);
2126     rotZ180->LocalToMaster(vl,vg);
2127     rotran = new TGeoCombiTrans("",vg[0],vg[1],vg[2],rotZ180);
2128     moth->AddNode(vT,++nCopyTv,rotran);
2129     rotZ300->LocalToMaster(vl,vg);
2130     rotran = new TGeoCombiTrans("",vg[0],vg[1],vg[2],rotZ300);
2131     moth->AddNode(vT,++nCopyTv,rotran);
2132     //
2133     Double_t da[] = {-3.5,-1.5,1.5,3.5};
2134     for(i=0;i<2;i++){ // Mounting for ITS-TPC bracket or ITS-Rails
2135         t0 = 180.*((Double_t)i);
2136         for(j=-kconNScrewM5by12/2;j<=kconNScrewM5by12/2;j++)if(j!=0){
2137                     //screws per ITS-TPC brkt
2138             t = t0 + 5.0*((Double_t)j);
2139             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2140                                           kconROutHoles*SinD(t),
2141                                           sB0->GetZ(0)+sD->GetDz());
2142             vB->AddNode(vD,++nCopyvD,tran);
2143         } // end or j
2144         for(j=-kconNPinO6/2;j<=kconNPinO6/2;j++){ // pins per ITS-TPC bracket
2145             t = t0 + 3.0*((Double_t)j);
2146             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2147                                           kconROutHoles*SinD(t),
2148                                           sB0->GetZ(0)+sD->GetDz());
2149             vB->AddNode(vE,++nCopyvE,tran);
2150         } // end or j
2151         t0 = (96.5+187.*((Double_t)i));
2152         for(j=0;j<kconNRailScrews;j++){ // screws per ITS-rail bracket
2153             t = t0+da[j];
2154             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2155                                           kconROutHoles*SinD(t),
2156                                           sB0->GetZ(0)+sD->GetDz());
2157             vB->AddNode(vD,++nCopyvD,tran);
2158         } // end or j
2159         t0 = (91.5+184.*((Double_t)i));
2160         for(j=-kconNRailPins/2;j<=kconNRailPins/2;j++)if(j!=0){ 
2161              // pins per ITS-rail bracket
2162             t = t0+(7.0*((Double_t)j));
2163             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2164                                           kconROutHoles*SinD(t),
2165                                           sB0->GetZ(0)+sD->GetDz());
2166             vB->AddNode(vE,++nCopyvE,tran);
2167         } // end or j
2168     } // end for i
2169     for(i=0;i<kconNmounts;i++){ 
2170                 // mounting points for SPD-cone+Beam-pipe support
2171         t0 = (45.0+((Double_t)i)*360./((Double_t)kconNmounts));
2172         for(j=-1;j<=1;j++)if(j!=0){ // 2 screws per bracket
2173             t = t0+((Double_t)j)*0.5*kconMountPhi0;
2174             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2175                                           kconROutHoles*SinD(t),
2176                                           sB0->GetZ(0)+sD->GetDz());
2177             vB->AddNode(vD,++nCopyvD,tran);
2178         } // end for j
2179         for(j=0;j<1;j++){ // 1 pin per bracket
2180             t = t0;
2181             tran = new TGeoTranslation("",kconROutHoles*CosD(t),
2182                                           kconROutHoles*SinD(t),
2183                                           sB0->GetZ(0)+sD->GetDz());
2184             vB->AddNode(vE,++nCopyvE,tran);
2185         } // end for j
2186     } // end for i
2187     if(GetDebug()){
2188         vA->PrintNodes();
2189         vB->PrintNodes();
2190         vC->PrintNodes();
2191         vD->PrintNodes();
2192         vE->PrintNodes();
2193         vF->PrintNodes();
2194         vQ->PrintNodes();
2195         vR->PrintNodes();
2196         vS->PrintNodes();
2197         vT->PrintNodes();
2198     } // end if
2199 }
2200
2201 //______________________________________________________________________
2202 void AliITSv11GeometrySupport::ServicesCableSupport(TGeoVolume *moth){
2203     // Define the detail ITS cable support trays on both the RB24 and 
2204     // RB26 sides..
2205     // Inputs:
2206     //   none.
2207     // Outputs:
2208     //  none.
2209     // Return:
2210     //  none.
2211     // Based on the Drawings SSup_201A.jpg unless otherwise stated, 
2212     // Volumes A..., 
2213     TGeoMedium *medSUPcf    = 0; // SUP support cone Carbon Fiber materal nbr.
2214     TGeoMedium *medSUPfs    = 0; // SUP support cone inserto stesalite 4411w.
2215     TGeoMedium *medSUPfo    = 0; // SUP support cone foam, Rohacell 50A.
2216     TGeoMedium *medSUPss    = 0; // SUP support cone screw material,Stainless
2217     TGeoMedium *medSUPair   = 0; // SUP support cone Air
2218     TGeoMedium *medSUPal    = 0; // SUP support cone SDD mounting bracket Al
2219     TGeoMedium *medSUPwater = 0; // SUP support cone Water
2220     TGeoManager *mgr = gGeoManager;
2221     medSUPcf    = mgr->GetMedium("ITSssdCarbonFiber");
2222     medSUPfs    = mgr->GetMedium("ITSssdStaselite4411w");
2223     medSUPfo    = mgr->GetMedium("ITSssdRohacell50A");
2224     medSUPss    = mgr->GetMedium("ITSssdStainlessSteal");
2225     medSUPair   = mgr->GetMedium("ITSssdAir");
2226     medSUPal    = mgr->GetMedium("ITSssdAl");
2227     medSUPwater = mgr->GetMedium("ITSssdWater");
2228     //
2229     Int_t i,j;
2230     Double_t x,y,z,t,t0,dt,di,r,l,local[3],master[3];
2231     Char_t name[100];
2232     Double_t r1,r2,m;
2233     // RB 24, Open Side.
2234     const Double_t kfrm24Z0           = 900*fgkmm;//SSup_203A.jpg
2235     const Double_t kfrm24Thss         = 5.0*fgkmm;
2236     const Double_t kfrm24Rss          = 444.5*fgkmm-kfrm24Thss; //SSup_204A.jpg
2237     const Double_t kfrm24Width        = 10.0*fgkmm;
2238     const Double_t kfrm24Hight        = 10.0*fgkmm;
2239     const Double_t kfrm24Phi0         = 15.2*fgkDegree; // SSup_602A.jpg
2240     const Double_t kfrm24Phi1         = (90.0-7.6)*fgkDegree; // SSup_802A.jpg
2241     const Double_t kfrm24ZssSection   = (415.0-10.0)*fgkmm;
2242     const Int_t    kfrm24NZsections   = 4;
2243     const Int_t    kfrm24NPhiSections = 4;
2244     const Int_t    kfrm24NPhi         = 4;
2245     // These numbers are guessed at.
2246     const Double_t kfrm24ZfracAngle   =  0.55; // frational z length to brack
2247     const Double_t kfrm24Angle        =  10.0*fgkDegree; // Guessed at
2248     //
2249     TGeoTubeSeg *sA24[kfrm24NZsections+1];
2250     TGeoArb8    *sB24[kfrm24NZsections+1];
2251     TGeoPcon    *sM24;
2252     Double_t zA24[kfrm24NZsections+1];
2253     l = 4.*kfrm24ZssSection+5*kfrm24Width;
2254     j = 0;
2255     for(i=0;i<kfrm24NZsections+1;i++){
2256         sprintf(name,"ITS sup Cable tray support frame radial section A24[%d]",
2257                 i);
2258         r1 = kfrm24Rss;
2259         if(i==0) zA24[i] = kfrm24Width;
2260         else zA24[i] = zA24[i-1] + kfrm24ZssSection + kfrm24Width;
2261         if(zA24[i]>l*kfrm24ZfracAngle){ // break, radii get larger
2262             r1 = kfrm24Rss + (zA24[i]-kfrm24ZfracAngle*l)*SinD(kfrm24Angle);
2263         } // end if
2264         r2 = r1+kfrm24Thss;
2265         sA24[i] = new TGeoTubeSeg(name,r1,r2,0.5*kfrm24Width,kfrm24Phi0,
2266                                   kfrm24Phi1);
2267         if(i>0)if(sA24[i-1]->GetRmin()==sA24[i]->GetRmin()) j = i;
2268     } // end for i
2269     for(i=0;i<kfrm24NZsections;i++){
2270         sprintf(name,"ITS sup Cable tray support frame Z section B24[%d]",i);
2271         sB24[i] = new TGeoArb8(name,0.5*kfrm24ZssSection);
2272         sB24[i]->SetVertex(0,sA24[i]->GetRmin(),0.5*kfrm24Hight);
2273         sB24[i]->SetVertex(1,sA24[i]->GetRmax(),0.5*kfrm24Hight);
2274         sB24[i]->SetVertex(2,sA24[i]->GetRmin(),-0.5*kfrm24Hight);
2275         sB24[i]->SetVertex(3,sA24[i]->GetRmax(),-0.5*kfrm24Hight);
2276         sB24[i]->SetVertex(4,sA24[i+1]->GetRmin(),0.5*kfrm24Hight);
2277         sB24[i]->SetVertex(5,sA24[i+1]->GetRmax(),0.5*kfrm24Hight);
2278         sB24[i]->SetVertex(6,sA24[i+1]->GetRmin(),-0.5*kfrm24Hight);
2279         sB24[i]->SetVertex(7,sA24[i+1]->GetRmax(),-0.5*kfrm24Hight);
2280     } // end for i
2281     sM24 = new TGeoPcon("ITS sup Cable tray support frame mother volume M24",
2282                         kfrm24Phi0,kfrm24Phi1,3);
2283     sM24->Z(0)    = zA24[0] -kfrm24Width;
2284     sM24->Rmin(0) = sA24[0]->GetRmin();
2285     sM24->Rmax(0) = sA24[0]->GetRmax();
2286     sM24->Z(1)    = zA24[j];
2287     sM24->Rmin(1) = sA24[j]->GetRmin();
2288     sM24->Rmax(1) = sA24[j]->GetRmax();
2289     sM24->Z(2)    = zA24[kfrm24NZsections] + kfrm24Width;
2290     sM24->Rmin(2) = sA24[kfrm24NZsections]->GetRmin();
2291     sM24->Rmax(2) = sA24[kfrm24NZsections]->GetRmax();
2292     if(GetDebug()){
2293         sM24->InspectShape();
2294         for(i=0;i<kfrm24NZsections+1;i++) sA24[i]->InspectShape();
2295         for(i=0;i<kfrm24NZsections;i++)   sB24[i]->InspectShape();
2296     } // end if GetDebug()
2297     TGeoVolume *vA24[kfrm24NZsections+1],*vB24[kfrm24NZsections],*vM24;
2298     TGeoTranslation *tran;
2299     TGeoRotation    *rot,*rot1;
2300     TGeoCombiTrans  *tranrot;
2301     //
2302     for(i=0;i<kfrm24NZsections+1;i++){
2303         vA24[i] = 0;
2304         sprintf(name,"ITSsupFrameA24[%d]",i);
2305         vA24[i] = new TGeoVolume(name,sA24[i],medSUPss);
2306         vA24[i]->SetVisibility(kTRUE);
2307         vA24[i]->SetLineColor(1); // black
2308         vA24[i]->SetLineWidth(1);
2309         vA24[i]->SetFillColor(vA24[i]->GetLineColor());
2310         vA24[i]->SetFillStyle(4000); // 0% transparent
2311     } // end for i
2312     for(i=0;i<kfrm24NZsections;i++){
2313         vB24[i] = 0;
2314         sprintf(name,"ITSsupFrameB24[%d]",i);
2315         vB24[i] = new TGeoVolume(name,sB24[i],medSUPss);
2316         vB24[i]->SetVisibility(kTRUE);
2317         vB24[i]->SetLineColor(1); // black
2318         vB24[i]->SetLineWidth(1);
2319         vB24[i]->SetFillColor(vB24[i]->GetLineColor());
2320         vB24[i]->SetFillStyle(4000); // 0% transparent
2321     } // end for i
2322     vM24 = new TGeoVolume("ITSsupFrameM24",sM24,medSUPair);
2323     vM24->SetVisibility(kTRUE);
2324     vM24->SetLineColor(7); // light blue
2325     vM24->SetLineWidth(1);
2326     vM24->SetFillColor(vM24->GetLineColor());
2327     vM24->SetFillStyle(4090); // 90% transparent
2328     //
2329     Int_t ncopyB24[kfrm24NPhiSections];
2330     t0 = kfrm24Phi0;
2331     dt = (kfrm24Phi1-kfrm24Phi0)/((Double_t)kfrm24NPhiSections);
2332     for(i=0;i<=kfrm24NZsections;i++){
2333         z = zA24[i];
2334         tran = new TGeoTranslation("",0.0,0.0,z);
2335         vM24->AddNode(vA24[i],1,tran);
2336        if(i<kfrm24NZsections){
2337            ncopyB24[i] = 1;
2338            for(j=0;j<=kfrm24NPhiSections;j++){
2339                t = t0 + ((Double_t)j)*dt;
2340                rot = new TGeoRotation("",0.0,0.0,t);
2341                tranrot = new TGeoCombiTrans("",0.0,0.0,z+sB24[i]->GetDz(),rot);
2342                delete rot;// rot not explicity used in AddNode functions.
2343                vM24->AddNode(vB24[i],ncopyB24[i]++,tranrot);
2344            } // end for j
2345        } // end if
2346     } // end for i
2347     tran = new TGeoTranslation("",0.0,0.0,kfrm24Z0);
2348     moth->AddNode(vM24,1,tran);
2349     for(i=1;i<kfrm24NPhi;i++){
2350         di = (Double_t) i;
2351         rot = new TGeoRotation("",0.0,0.0,90.0*di);
2352         tranrot = new TGeoCombiTrans("",0.0,0.0,kfrm24Z0,rot);
2353         delete rot;// rot not explicity used in AddNode functions.
2354         moth->AddNode(vM24,i+1,tranrot);
2355     } // end for i
2356     if(GetDebug()){
2357         for(i=0;i<kfrm24NZsections+1;i++) vA24[i]->PrintNodes();
2358         for(i=0;i<kfrm24NZsections;i++) vB24[i]->PrintNodes();
2359         vM24->PrintNodes();
2360     } // end if
2361     //==================================================================
2362     // RB24 Cable Tray
2363     const Double_t kct24WidthBottom   = 44.0*fgkmm; // Serv-C_208.jpg
2364     const Double_t kct24WidthTop      = 46.0*fgkmm; // Serv-C_208.jpg
2365     const Double_t kct24Hight         = 51.0*fgkmm; // Serv-C_208.jpg
2366     const Double_t kct24AlThick       = 1.0*fgkmm; // Serv-C_208.jpg
2367     const Double_t kct24CapWidth      = 46.0*fgkmm; // Serv-C_208.jpg
2368     const Double_t kct24CapEar        = 5.0*fgkmm; // Guess
2369     const Double_t kct24Rmin          = 455.0*fgkmm; // Serv-C_203.jpg
2370     const Double_t kct24CoolSectionH  = 470.0*fgkmm-kct24Rmin;// Serv-C_203.jpg
2371     const Double_t kct24CoolCableDivEar = 2.0*fgkmm; // Guess
2372     const Int_t kct24Ntrays           = 48; // Serv-C_205.jpg
2373     //const Int_t kct24Ntubes           = 3; // Serv-C_208.jpg
2374     // Patch Pannels for RB 24 side
2375     const Double_t kft24PPHightSPDFMD = 72.0*fgkmm; // Serv-C_SPD/FMD.jpg
2376     const Double_t kft24PPHightSDDSSD = 104.0*fgkmm; // Serv-C_SDD/SSD.jpg
2377     const Double_t kft24PPlength      = 350.0*fgkmm;//Serv-C_SPD/SDD/SSD/FMD_1.jpg
2378     const Double_t kft24Theta         = 2.0*TMath::ATan2(kct24WidthBottom,
2379                                                  2.0*kct24Rmin)*fgkRadian; //
2380     const Int_t    kft24NPatchPannels = 20; //
2381     //
2382     Double_t xp[12],yp[12];
2383     TGeoPcon *sMT24;
2384     TGeoXtru *sT24,*sTs24,*sTl24,*sTt24,*sU24,*sVl24,*sVs24,*sW24;
2385     TGeoXtru *s3PP24,*s2PP24,*sV3PP24,*sV2PP24;
2386     // Outer Tray Full
2387     sT24 = new TGeoXtru(3);
2388     sT24->SetName("ITS sup Full Cable Tray for RB24 Side T24");
2389     xp[0]  = -0.5*kct24WidthBottom;
2390     yp[0]  = sM24->GetRmax(0);
2391     yp[1]  = yp[0] + kct24Hight-kct24CapEar;
2392     xp[1]  = Xfrom2Points(xp[0],yp[0],-0.5*kct24WidthTop+kct24AlThick,
2393                           yp[0]+kct24Hight,yp[1]);
2394     yp[2]  = yp[1];
2395     xp[2]  = xp[1]-kct24AlThick;
2396     xp[3]  = -0.5*kct24CapWidth;
2397     yp[3]  = yp[0] + kct24Hight;
2398     xp[4]  = -xp[3];
2399     yp[4]  =  yp[3];
2400     xp[5]  = -xp[2];
2401     yp[5]  =  yp[2];
2402     xp[6]  = -xp[1];
2403     yp[6]  =  yp[1];
2404     xp[7]  = -xp[0];
2405     yp[7]  =  yp[0];
2406     sT24->DefinePolygon(8,xp,yp);
2407     sT24->DefineSection(0,sM24->GetZ(0));
2408     sT24->DefineSection(1,sM24->GetZ(1));
2409     sT24->DefineSection(2,zA24[kfrm24NZsections],0.0,
2410                       sA24[kfrm24NZsections]->GetRmin()-sA24[0]->GetRmin());
2411     // RB 24 full tray no divider (for ALG and T0-V0 cables?)
2412     sW24 = new TGeoXtru(3);
2413     sW24->SetName("ITS sup Cable Tray No Divider for RB24 Side W24");
2414     xp[0] = sT24->GetX(0) + kct24AlThick;
2415     yp[0] = sT24->GetY(0) - kct24AlThick;
2416     yp[1] = sT24->GetY(3) - kct24AlThick;
2417     xp[1] = Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2418                          sT24->GetY(1),yp[1]) + kct24AlThick;
2419     xp[2] = -xp[1];
2420     yp[2] =  yp[1];
2421     xp[3] = -xp[0];
2422     yp[3] =  yp[0];
2423     sW24->DefinePolygon(4,xp,yp);
2424     for(i=0;i<sT24->GetNz();i++){
2425         sW24->DefineSection(i,sT24->GetZ(i),sT24->GetXOffset(i),
2426                             sT24->GetYOffset(i),sT24->GetScale(i));
2427     } // end for i
2428     // Outer Tray Short
2429     sTs24 = new TGeoXtru(3);
2430     sTs24->SetName("ITS sup Short Cable Tray for RB24 Side Ts24");
2431     yp[0]  = sT24->GetY(0) + kct24CoolSectionH;
2432     xp[0]  = Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2433                          sT24->GetY(1),yp[0]);
2434     for(i=1;i<7;i++){
2435         xp[i]  = sT24->GetX(i);
2436         yp[i]  = sT24->GetY(i);
2437     } // end for i
2438     xp[7]  = -xp[0];
2439     yp[7]  =  yp[0];
2440     sTs24->DefinePolygon(8,xp,yp);
2441     sTs24->DefineSection(0,sM24->GetZ(0)+kft24PPlength);
2442     sTs24->DefineSection(1,sM24->GetZ(1));
2443     sTs24->DefineSection(2,zA24[kfrm24NZsections],sT24->GetXOffset(2),
2444                          sT24->GetYOffset(2),sT24->GetScale(2));
2445     // Outer Tray Long
2446     sTl24 = new TGeoXtru(3);
2447     sTl24->SetName("ITS sup Long Cable Tray for RB24 Side Tl24");
2448     for(i=0;i<8;i++){
2449     xp[i]  = sTs24->GetX(i);
2450     yp[i]  = sTs24->GetY(i);
2451     } // End for i
2452     sTl24->DefinePolygon(8,xp,yp);
2453     sTl24->DefineSection(0,sM24->GetZ(0));
2454     sTl24->DefineSection(1,sM24->GetZ(1));
2455     sTl24->DefineSection(2,zA24[kfrm24NZsections],0.0,
2456                          sA24[kfrm24NZsections]->GetRmin()-sA24[0]->GetRmin());
2457     // Outer Tray for air Tubes
2458     sTt24 = new TGeoXtru(3);
2459     sTt24->SetName("ITS sup Long Air Tube Tray for RB24 Side Tt24");
2460     xp[0]  = sT24->GetX(0);
2461     yp[0]  = sT24->GetY(0);
2462     xp[1]  = sTl24->GetX(0);
2463     yp[1]  = sTl24->GetY(0);
2464     xp[2]  = -xp[1];
2465     yp[2]  =  yp[1];
2466     xp[3]  = -xp[0];
2467     yp[3]  =  yp[1];
2468     sTt24->DefinePolygon(4,xp,yp);
2469     sTt24->DefineSection(0,sM24->GetZ(0));
2470     sTt24->DefineSection(1,sM24->GetZ(1));
2471     sTt24->DefineSection(2,zA24[kfrm24NZsections],0.0,
2472                          sA24[kfrm24NZsections]->GetRmin()-sA24[0]->GetRmin());
2473     // Inner opening for cooling (lower) {inside sTt24}
2474     sU24 = new TGeoXtru(3);
2475     sU24->SetName("ITS sup Cable Tray Cooling tube space RB24 Side U24");
2476     xp[0] = sTt24->GetX(0) + kct24AlThick;
2477     yp[0] = sTt24->GetY(0) + kct24AlThick;
2478     xp[1] = sTt24->GetX(1) + kct24AlThick;
2479     yp[1] = sTt24->GetY(1) - kct24AlThick;
2480     xp[2] = -xp[1];
2481     yp[2] =  yp[1];
2482     xp[3] = -xp[0];
2483     yp[3] =  yp[0];
2484     sU24->DefinePolygon(4,xp,yp);
2485     for(i=0;i<sTt24->GetNz();i++){
2486         sU24->DefineSection(i,sTt24->GetZ(i),sTt24->GetXOffset(i),
2487                             sTt24->GetYOffset(i),sTt24->GetScale(i));
2488     } // end for i
2489     // Inner opening for cables (upper) {inside sTl24}
2490     sVl24 = new TGeoXtru(3);
2491     sVl24->SetName("ITS sup Cable Tray Cable space RB24 Side Vl24");
2492     xp[0] = sTl24->GetX(0)+2.0*kct24AlThick;
2493     yp[0] = sTl24->GetY(0);
2494     yp[1] = yp[0] + kct24CoolCableDivEar;
2495     xp[1] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2496                          sTl24->GetX(1),sTl24->GetY(1),yp[1])+2.0*kct24AlThick;
2497     yp[2] = yp[1];
2498     xp[2] = xp[1] - kct24AlThick;
2499     yp[3] = sTl24->GetY(3) - kct24AlThick;
2500     xp[3] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),sTl24->GetX(1),
2501                          sTl24->GetY(1),yp[3]) + kct24AlThick;
2502     xp[4] = -xp[3];
2503     yp[4] =  yp[3];
2504     xp[5] = -xp[2];
2505     yp[5] =  yp[2];
2506     xp[6] = -xp[1];
2507     yp[6] =  yp[1];
2508     xp[7] = -xp[0];
2509     yp[7] =  yp[0];
2510     sVl24->DefinePolygon(8,xp,yp);
2511     for(i=0;i<sTl24->GetNz();i++){
2512         sVl24->DefineSection(i,sTl24->GetZ(i),sTl24->GetXOffset(i),
2513                             sTl24->GetYOffset(i),sTl24->GetScale(i));
2514     } // end for i
2515     // Inner opening for cables (upper) {inside sTs24}
2516     sVs24 = new TGeoXtru(3);
2517     sVs24->SetName("ITS sup Cable Tray Cable space RB24 Side Vs24");
2518     sVs24->DefinePolygon(8,xp,yp);
2519     for(i=0;i<8;i++){
2520     xp[i]  = sVl24->GetX(i);
2521     yp[i]  = sVl24->GetY(i);
2522     } // end for i
2523     for(i=0;i<sTl24->GetNz();i++){
2524         sVs24->DefineSection(i,sTs24->GetZ(i),sTs24->GetXOffset(i),
2525                             sTs24->GetYOffset(i),sTs24->GetScale(i));
2526     } // end for i
2527     //------------------------------------------------------------------
2528     // Patch Pannels on RB 24 Side
2529     rot  = new TGeoRotation("",0.0,0.0,-kft24Theta); // Gets Used later as well
2530     rot1 = new TGeoRotation("",0.0,0.0,kft24Theta);  // Gets Used later as well
2531     s3PP24 = new TGeoXtru(2);
2532     s3PP24->SetName("ITS sup 3 bay pach pannel RB24 side 3PP24");
2533     yp[5]  = sT24->GetY(7) + kct24CoolSectionH;
2534     xp[5]  = Xfrom2Points(sT24->GetX(7),sT24->GetY(7),sT24->GetX(6),
2535                           sT24->GetY(6),yp[6]);
2536     yp[6]  = sT24->GetY(0) + kct24CoolSectionH;
2537     xp[6]  =  Xfrom2Points(sT24->GetX(0),sT24->GetY(0),sT24->GetX(1),
2538                           sT24->GetY(1),yp[9]);
2539     local[0] = xp[6]; local[1] = yp[6]; local[2] = 0.0;
2540     rot1->LocalToMaster(local,master);
2541     xp[0]  = master[0];
2542     yp[0]  = master[1];
2543     local[0] = xp[6]; local[1] = yp[6] + kft24PPHightSDDSSD; local[2] = 0.0;
2544     rot1->LocalToMaster(local,master);
2545     xp[1]  = master[0];
2546     yp[1]  = master[1];
2547     xp[2]  = -xp[1];
2548     yp[2]  =  yp[1];
2549     xp[3]  = -xp[0];
2550     yp[3]  =  yp[0];
2551     local[0] = xp[6]; local[1] = yp[6]; local[2] = 0.0;
2552     rot1->MasterToLocal(local,master);
2553     xp[4]  = master[0];
2554     yp[4]  = master[1];
2555     local[0] = xp[5]; local[1] = yp[5]; local[2] = 0.0;
2556     rot1->LocalToMaster(local,master);
2557     xp[7]  = master[0];
2558     yp[7]  = master[1];
2559     s3PP24->DefinePolygon(8,xp,yp);
2560     s3PP24->DefineSection(0,0.0);
2561     s3PP24->DefineSection(1,kft24PPlength);
2562     //
2563     s2PP24 = new TGeoXtru(2);
2564     s2PP24->SetName("ITS sup 2 bay pach pannel RB24 side 2PP24");
2565     local[1] = sTl24->GetY(3); local[2] = 0.0;
2566     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2567                             sTl24->GetX(1),sTl24->GetY(1),local[1]);
2568     rot1->LocalToMaster(local,master);
2569     xp[0]  = master[0];
2570     yp[0]  = master[1];
2571     local[1] = sTl24->GetY(3) + kft24PPHightSPDFMD; local[2] = 0.0;
2572     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2573                             sTl24->GetX(1),sTl24->GetY(1),local[1]);
2574     rot1->LocalToMaster(local,master);
2575     xp[1]  = master[0];
2576     yp[1]  = master[1];
2577     yp[2]  = sTl24->GetY(4) + kft24PPHightSPDFMD;
2578     xp[2]  = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2579                           sTl24->GetX(7),sTl24->GetY(7),yp[2]);
2580     yp[3]  = sTl24->GetY(7);
2581     xp[3]  = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2582                           sTl24->GetX(7),sTl24->GetY(7),yp[3]);
2583     xp[4]  = sTl24->GetX(3);
2584     yp[4]  = sTl24->GetY(3);
2585     local[0] = sTl24->GetX(4);local[1] = sTl24->GetY(4); local[2] = 0.0;
2586     rot1->LocalToMaster(local,master);
2587     xp[5]  = master[0];
2588     yp[5]  = master[1];
2589     s2PP24->DefinePolygon(6,xp,yp);
2590     s2PP24->DefineSection(0,0.0);
2591     s2PP24->DefineSection(1,kft24PPlength);
2592     //
2593     sV3PP24 = new TGeoXtru(2);
2594     sV3PP24->SetName("ITS sup Patch Pannel 3 Bay inside Rb24 side V3PP24");
2595     xp[0] = s3PP24->GetX(0) + kct24AlThick;
2596     yp[0] = s3PP24->GetY(0);
2597     local[1] = s3PP24->GetY(6) + kft24PPHightSDDSSD - kct24AlThick;local[2]=0.;
2598     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2599                            sTl24->GetX(1),sTl24->GetY(1),local[1]);
2600     rot1->LocalToMaster(local,master);
2601     xp[1] = master[0];
2602     yp[1] = master[1];
2603     xp[2] = -xp[1];
2604     yp[2] =  yp[1];
2605     xp[3] = -xp[0];
2606     yp[3] =  yp[0];
2607     xp[4] = s3PP24->GetX(4);
2608     yp[4] = s3PP24->GetY(4);
2609     xp[5] = s3PP24->GetX(5);
2610     yp[5] = s3PP24->GetY(5);
2611     xp[6] = s3PP24->GetX(6);
2612     yp[6] = s3PP24->GetY(6);
2613     xp[7] = s3PP24->GetX(7);
2614     yp[7] = s3PP24->GetY(7);
2615     sV3PP24->DefinePolygon(8,xp,yp);
2616     sV3PP24->DefineSection(0,s3PP24->GetZ(0),s3PP24->GetXOffset(0),
2617                            s3PP24->GetYOffset(0),s3PP24->GetScale(0));
2618     sV3PP24->DefineSection(1,s3PP24->GetZ(1),s3PP24->GetXOffset(1),
2619                            s3PP24->GetYOffset(1),s3PP24->GetScale(1));
2620     //
2621     sV2PP24 = new TGeoXtru(2);
2622     sV2PP24->SetName("ITS sup Patch Pannel 2 Bay inside Rb24 side V2PP24");
2623     xp[0] = s2PP24->GetX(0) + kct24AlThick;
2624     yp[0] = s2PP24->GetY(0);
2625     local[1] = sTl24->GetY(3) + kft24PPHightSPDFMD - kct24AlThick;local[2]=0.;
2626     local[0] = Xfrom2Points(sTl24->GetX(0),sTl24->GetY(0),
2627                            sTl24->GetX(1),sTl24->GetY(1),local[1]);
2628     rot1->LocalToMaster(local,master);
2629     xp[1] = master[0];
2630     yp[1] = master[1];
2631     yp[2] = sTl24->GetY(4) + kft24PPHightSPDFMD - kct24AlThick;
2632     xp[2] = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2633                            sTl24->GetX(7),sTl24->GetY(7),yp[2]);
2634     yp[3] = sTl24->GetY(4);
2635     xp[3] = Xfrom2Points(sTl24->GetX(6),sTl24->GetY(6),
2636                            sTl24->GetX(7),sTl24->GetY(7),yp[3]);;
2637     xp[4] = s2PP24->GetX(4);
2638     yp[4] = s2PP24->GetY(4);
2639     xp[5] = s2PP24->GetX(5);
2640     yp[5] = s2PP24->GetY(5);
2641     sV2PP24->DefinePolygon(6,xp,yp);
2642     sV2PP24->DefineSection(0,s2PP24->GetZ(0),s2PP24->GetXOffset(0),
2643                            s2PP24->GetYOffset(0),s2PP24->GetScale(0));
2644     sV2PP24->DefineSection(1,s2PP24->GetZ(1),s2PP24->GetXOffset(1),
2645                            s2PP24->GetYOffset(1),s2PP24->GetScale(1));
2646     // RB 24 Tray Mother Volume
2647     sMT24 = new TGeoPcon("ITS sup Cable Tray Mother Volume RB24 MT24",
2648                          0.0,360.0,5);
2649     sMT24->Z(0)    = 0.0;
2650     sMT24->Rmin(0) = sM24->GetRmax(0);
2651     sMT24->Rmax(0) = TMath::Max(TMath::Hypot(s3PP24->GetX(1),s3PP24->GetY(1)),
2652                                 TMath::Hypot(s2PP24->GetX(1),s2PP24->GetY(1)));
2653
2654     sMT24->Z(1)    = sMT24->GetZ(0) + kft24PPlength;
2655     sMT24->Rmin(1) = sMT24->GetRmin(0);
2656     sMT24->Rmax(1) = sMT24->GetRmax(0);
2657     sMT24->Z(2)    = sMT24->GetZ(1);
2658     sMT24->Rmin(2) = sMT24->GetRmin(0);
2659     sMT24->Rmax(2) = sMT24->GetRmax(0) - kft24PPHightSPDFMD;
2660
2661     sMT24->Z(3)    = sMT24->GetZ(0) + sM24->GetZ(1) - sM24->GetZ(0);
2662     sMT24->Rmin(3) = sM24->GetRmax(1);
2663     sMT24->Rmax(3) = TMath::Hypot(sT24->GetX(3),sT24->GetY(3));
2664     sMT24->Z(4)    = sMT24->GetZ(0) + sM24->GetZ(2)  - sM24->GetZ(0);
2665     sMT24->Rmin(4) = sM24->GetRmax(2);
2666     sMT24->Rmax(4) = TMath::Hypot(sT24->GetX(3)+sT24->GetXOffset(2),
2667                                   sT24->GetY(3)+sT24->GetYOffset(2));
2668     //
2669     if(GetDebug()){
2670         sT24->InspectShape();
2671         sW24->InspectShape();
2672         sTl24->InspectShape();
2673         sTs24->InspectShape();
2674         sTt24->InspectShape();
2675         sU24->InspectShape();
2676         sVl24->InspectShape();
2677         sVs24->InspectShape();
2678         s3PP24->InspectShape();
2679         s2PP24->InspectShape();
2680         sV3PP24->InspectShape();
2681         sV2PP24->InspectShape();
2682         sMT24->InspectShape();
2683     } // end if GetDebug()
2684     //
2685     TGeoVolume *vC24[kct24Ntrays],*vT24[kct24Ntrays],*vPP24[kft24NPatchPannels];
2686     TGeoVolume *vWTV024,*vW24,*vU24,*vUFMD24,*vVl24,*vVlFMD24,*vVs24,*vMT24;
2687     TGeoVolume *vV3PP24,*vV2PP24,*vV2PPFMD24;
2688     vMT24 = new TGeoVolume("ITSsupCableTrayMotherMT24",sMT24,medSUPair);
2689     vMT24->SetVisibility(kTRUE);
2690     vMT24->SetLineColor(8); // white
2691     vMT24->SetLineWidth(1);
2692     vMT24->SetFillColor(vMT24->GetLineColor());
2693     vMT24->SetFillStyle(4100); // 100% transparent
2694     //
2695     vU24 = new TGeoVolume("ITSsupCableTrayLowerU24",sU24,medSUPair);
2696     vU24->SetVisibility(kTRUE);
2697     vU24->SetLineColor(7); // light blue
2698     vU24->SetLineWidth(1);
2699     vU24->SetFillColor(vU24->GetLineColor());
2700     vU24->SetFillStyle(4090); // 90% transparent
2701     vUFMD24 = new TGeoVolume("FMDsupCableTrayLowerU24",sU24,medSUPair);
2702     vUFMD24->SetVisibility(kTRUE);
2703     vUFMD24->SetLineColor(7); // light blue
2704     vUFMD24->SetLineWidth(1);
2705     vUFMD24->SetFillColor(vUFMD24->GetLineColor());
2706     vUFMD24->SetFillStyle(4090); // 90% transparent
2707     vVl24 = new TGeoVolume("ITSsupCableTrayUpperV24",sVl24,medSUPair);
2708     vVl24->SetVisibility(kTRUE);
2709     vVl24->SetLineColor(7); // light blue
2710     vVl24->SetLineWidth(1);
2711     vVl24->SetFillColor(vVl24->GetLineColor());
2712     vVl24->SetFillStyle(4090); // 90% transparent
2713     vVlFMD24 = new TGeoVolume("FMDsupCableTrayUpperVl24",sVl24,medSUPair);
2714     vVlFMD24->SetVisibility(kTRUE);
2715     vVlFMD24->SetLineColor(7); // light blue
2716     vVlFMD24->SetLineWidth(1);
2717     vVlFMD24->SetFillColor(vVlFMD24->GetLineColor());
2718     vVlFMD24->SetFillStyle(4090); // 90% transparent
2719     vVs24 = new TGeoVolume("ITSsupCableTrayUpperVs24",sVs24,medSUPair);
2720     vVs24->SetVisibility(kTRUE);
2721     vVs24->SetLineColor(7); // light blue
2722     vVs24->SetLineWidth(1);
2723     vVs24->SetFillColor(vVs24->GetLineColor());
2724     vVs24->SetFillStyle(4090); // 90% transparent
2725     vW24 = new TGeoVolume("ITSsupCableTrayUpperW24",sW24,medSUPair);
2726     vW24->SetVisibility(kTRUE);
2727     vW24->SetLineColor(7); // light blue
2728     vW24->SetLineWidth(1);
2729     vW24->SetFillColor(vW24->GetLineColor());
2730     vW24->SetFillStyle(4090); // 90% transparent
2731     //
2732     vWTV024 = new TGeoVolume("V0supCableTrayUpperWTV024",sW24,medSUPair);
2733     vWTV024->SetVisibility(kTRUE);
2734     vWTV024->SetLineColor(7); // light blue
2735     vWTV024->SetLineWidth(1);
2736     vWTV024->SetFillColor(vWTV024->GetLineColor());
2737     vWTV024->SetFillStyle(4090); // 90% transparent
2738     //
2739     vV3PP24 = new TGeoVolume("ITSsup3BayPachPannelInsideV3PP24",sV3PP24,medSUPair);
2740     vV3PP24->SetVisibility(kTRUE);
2741     vV3PP24->SetLineColor(8); // white
2742     vV3PP24->SetLineWidth(1);
2743     vV3PP24->SetFillColor(vV3PP24->GetLineColor());
2744     vV3PP24->SetFillStyle(4100); // 100% transparent
2745     vV2PP24 = new TGeoVolume("ITSsup2BayPachPannelInsideV2PP24",sV2PP24,medSUPair);
2746     vV2PP24->SetVisibility(kTRUE);
2747     vV2PP24->SetLineColor(8); // white
2748     vV2PP24->SetLineWidth(1);
2749     vV2PP24->SetFillColor(vV2PP24->GetLineColor());
2750     vV2PP24->SetFillStyle(4100); // 100% transparent
2751     vV2PPFMD24 = new TGeoVolume("FMDsup2BayPachPannelInsideV2PP24",sV2PP24,medSUPair);
2752     vV2PPFMD24->SetVisibility(kTRUE);
2753     vV2PPFMD24->SetLineColor(8); // white
2754     vV2PPFMD24->SetLineWidth(1);
2755     vV2PPFMD24->SetFillColor(vV2PPFMD24->GetLineColor());
2756     vV2PPFMD24->SetFillStyle(4100); // 100% transparent
2757     //
2758     delete rot;
2759     delete rot1;
2760     //
2761     Double_t tha[kct24Ntrays],thb[kft24NPatchPannels];
2762     for(i=0;i<kct24Ntrays/4;i++) {
2763         if(i==0) tha[0] = 17.0+0.5*kft24Theta;
2764         else tha[i] = tha[i-1] + kft24Theta;
2765         tha[i+  kct24Ntrays/4] =  90.0 + tha[i];
2766         tha[i+  kct24Ntrays/2] = 180.0 + tha[i];
2767         tha[i+3*kct24Ntrays/4] = 270.0 + tha[i];
2768     } // end for i
2769     if(GetDebug()) for(i=0;i<kct24Ntrays;i++) Info("ServicesCableSupport",
2770                                                   "tha[%d]=%f",i,tha[i]);
2771     Char_t *airName[kct24Ntrays]={"FMD0","SDD0","SSD0","SSD1","SPD0","SPD1",
2772                                   "TV00","SDD1","SDD2","SPD2","SPD3","ALG0",
2773                                   "SPD4","SPD5","SSD2","SSD3","SPD6","SPD7",
2774                                   "TV01","SDD3","SDD4","SPD8","SPD9","ALG1",
2775                                   "FMD1","SDD5","SSD4","SSD5","SPDA","SPDB",
2776                                   "TV02","SDD6","SDD7","SPDC","SPDD","ALG2",
2777                                   "SPDE","SPDF","SSD6","SSD7","SPDG","SPDH",
2778                                   "TV03","SDD8","SDD9","SPDI","SPDJ","ALG3"};
2779     Char_t *trayName[kct24Ntrays]={"FMD0","SSD0","SSD1","SSD2","SSD3","SPD0",
2780                                    "TV00","SDD0","SDD1","SDD2","SPD1","ALG0",
2781                                    "SPD2","SSD4","SSD5","SSD6","SSD7","SPD3",
2782                                    "TV01","SDD3","SDD4","SDD5","SPD4","ALG1",
2783                                    "FMD1","SSD8","SSD9","SSDA","SSDB","SPD5",
2784                                    "TV02","SDD6","SDD7","SDD8","SPD6","ALG2",
2785                                    "SPD7","SSDC","SSDD","SSDE","SSDF","SPD8",
2786                                    "TV03","SDD9","SDDA","SDDB","SPD9","ALG3"};
2787     //
2788     //Int_t ncopyW24=1,ncopyU24=1,ncopyV24=1;
2789     j = 0;
2790     for(i=0;i<kct24Ntrays;i++){
2791         if(strncmp(trayName[i],"FMD",3)==0){
2792             sprintf(name,"FMDsupCableTrayT24[%s]",trayName[i]);
2793             vT24[i] = new TGeoVolume(name,sTl24,medSUPal);
2794             vT24[i]->AddNode(vVlFMD24,1,0);
2795         }else if(strncmp(trayName[i],"TV0",3)==0){
2796             sprintf(name,"V0supCableTrayT24[%s]",trayName[i]);
2797             vT24[i] = new TGeoVolume(name,sT24,medSUPal);
2798             vT24[i]->AddNode(vWTV024,1,0);
2799         }else if(strncmp(trayName[i],"ALG",3)==0){ // ITS Alignment Channel
2800             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2801             vT24[i] = new TGeoVolume(name,sT24,medSUPal);
2802             vT24[i]->AddNode(vW24,1,0);
2803         }else  if(strncmp(trayName[i],"SPD",3)==0){ /*ITS SPD*/
2804             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2805             vT24[i] = new TGeoVolume(name,sTl24,medSUPal);
2806             vT24[i]->AddNode(vVl24,1,0);
2807         }else { /*ITS*/
2808             sprintf(name,"ITSsupCableTrayT24[%s]",trayName[i]);
2809             vT24[i] = new TGeoVolume(name,sTs24,medSUPal); /// replace solid
2810             vT24[i]->AddNode(vVs24,1,0);
2811         } // end if
2812         vT24[i]->SetVisibility(kTRUE);
2813         vT24[i]->SetLineColor(6); // purple
2814         vT24[i]->SetLineWidth(1);
2815         vT24[i]->SetFillColor(vT24[i]->GetLineColor());
2816         vT24[i]->SetFillStyle(4000); // 0% transparent
2817         rot = new TGeoRotation("",0.0,0.0,tha[i]-90.0);
2818         if(GetDebug()) rot->Print();
2819         vMT24->AddNode(vT24[i],1,rot);
2820         //
2821         if(strncmp(trayName[i],"FMD",3)==0){
2822             sprintf(name,"FMDsupAirTubeTrayT24[%s]",airName[i]);
2823             vC24[j] = new TGeoVolume(name,sTt24,medSUPair);
2824             vC24[j]->AddNode(vUFMD24,1,0);
2825         }else if(strncmp(trayName[i],"TV0",3)==0){
2826             continue;
2827         }else if(strncmp(trayName[i],"ALG",3)==0){
2828             continue;
2829         }else{ /*ITS*/
2830             sprintf(name,"ITSsupAirTubTrayT24[%s]",airName[i]);
2831             vC24[j] = new TGeoVolume(name,sTt24,medSUPair);
2832             vC24[j]->AddNode(vU24,1,0);
2833         } // end if
2834         vC24[j]->SetVisibility(kTRUE);
2835         vC24[j]->SetLineColor(6); // purple
2836         vC24[j]->SetLineWidth(1);
2837         vC24[j]->SetFillColor(vC24[j]->GetLineColor());
2838         vC24[j]->SetFillStyle(4000); // 0% transparent
2839         vMT24->AddNode(vC24[j++],1,rot);
2840     } // end for i
2841     for(i=0;i<kft24NPatchPannels/4;i++) {
2842         if(i==0) thb[0] = 17.0+0.5*kft24Theta;
2843         else{
2844             if(i%2) thb[i] = thb[i-1] + 3.0*kft24Theta;
2845             else thb[i] = thb[i-1] + 2.0*kft24Theta;
2846         } // end if-else
2847         thb[i+  kft24NPatchPannels/4] =  90.0 + thb[i];
2848         thb[i+  kft24NPatchPannels/2] = 180.0 + thb[i];
2849         thb[i+3*kft24NPatchPannels/4] = 270.0 + thb[i];
2850     } // end for i
2851     Char_t *pachName[kft24NPatchPannels]={"FMD0","SSD0","SPD0","SDD0","SPD1",
2852                                           "SPD2","SSD1","SPD3","SDD1","SPD4",
2853                                           "FMD1","SSD2","SPD5","SDD2","SPD6",
2854                                           "SPD7","SSD3","SPD8","SDD3","SPD9"};
2855     for(i=0;i<kft24NPatchPannels;i++){
2856         if(strncmp(pachName[i],"FMD",3)==0){
2857             sprintf(name,"FMDsupPatchPannelPP24[%s]",pachName[i]);
2858             vPP24[i] = new TGeoVolume(name,s2PP24,medSUPal);
2859             vPP24[i]->AddNode(vV2PPFMD24,1,0);
2860         }else if(strncmp(pachName[i],"SPD",3)==0){ /*ITS SPD*/
2861             sprintf(name,"ITSsupPathcPannelPP24[%s]",pachName[i]);
2862             vPP24[i] = new TGeoVolume(name,s2PP24,medSUPal);
2863             vPP24[i]->AddNode(vV2PP24,1,0);
2864         }else { /*ITS*/
2865             sprintf(name,"ITSsupPathcPannelPP24[%s]",pachName[i]);
2866             vPP24[i] = new TGeoVolume(name,s3PP24,medSUPal); /// replace solid
2867             vPP24[i]->AddNode(vV3PP24,1,0);
2868         } // end if
2869         vPP24[i]->SetVisibility(kTRUE);
2870         vPP24[i]->SetLineColor(6); // purple
2871         vPP24[i]->SetLineWidth(1);
2872         vPP24[i]->SetFillColor(vPP24[i]->GetLineColor());
2873         vPP24[i]->SetFillStyle(4000); // 0% transparent
2874         rot = new TGeoRotation("",0.0,0.0,thb[i]-90.0);
2875         if(GetDebug()) rot->Print();
2876         vMT24->AddNode(vPP24[i],1,rot);
2877     } // end for i
2878     tran = new TGeoTranslation("",0.0,0.0,kfrm24Z0);
2879     moth->AddNode(vMT24,1,tran);
2880     if(GetDebug()){
2881         for(i=0;i<kct24Ntrays;i++) vT24[i]->PrintNodes();
2882         for(i=0;i<kct24Ntrays-8;i++) vC24[i]->PrintNodes();
2883         vU24->PrintNodes();
2884         vUFMD24->PrintNodes();
2885         vVl24->PrintNodes();
2886         vVlFMD24->PrintNodes();
2887         vVs24->PrintNodes();
2888         vW24->PrintNodes();
2889         vWTV024->PrintNodes();
2890         vMT24->PrintNodes();
2891     } // end if
2892     //==================================================================
2893     //
2894     // RB 26, Muon Absober side
2895     const Double_t kfrm26Z0           = -900*fgkmm;//SSup_203A.jpg
2896     const Double_t kfrm26Thss         = 5.0*fgkmm;
2897     const Double_t kfrm26R0ss         = 444.5*fgkmm-kfrm26Thss; //SSup_204A.jpg
2898     const Double_t kfrm26R1ss         = 601.6*fgkmm-kfrm26Thss; //SSup_208A.jpg
2899     const Double_t kfrm26Width        = 10.0*fgkmm;
2900     //const Double_t kfrm26Hight       = 10.0*fgkmm;
2901     const Double_t kfrm26Phi0         = 15.2*fgkDegree; // SSup_602A.jpg
2902     const Double_t kfrm26Phi1         = (90.0-7.6)*fgkDegree; // SSup_802A.jpg
2903     const Double_t kfrm26ZssSection   = (415.0-10.0)*fgkmm;
2904     const Int_t    kfrm26NZsections   = 4;
2905     const Int_t    kfrm26NPhiSections = 4;
2906     const Int_t    kfrm26NPhi         = 4;
2907     TGeoConeSeg *sA26[kfrm26NZsections+1],*sM26;//Cylinderial support structure
2908     TGeoArb8     *sB26; // Cylinderial support structure
2909
2910     sM26 = new TGeoConeSeg("ITS sup Cable tray support frame mother volume "
2911                           "M26",0.5*(4.*kfrm26ZssSection+5*kfrm26Width),
2912                           kfrm26R1ss,kfrm26R1ss+kfrm26Thss,
2913                           kfrm26R0ss,kfrm26R0ss+kfrm26Thss,
2914                           kfrm26Phi0,kfrm26Phi1);
2915     m = -((kfrm26R1ss-kfrm26R0ss)/
2916          (((Double_t)kfrm26NZsections)*(kfrm26ZssSection+kfrm26Width)));
2917     for(i=0;i<kfrm26NZsections+1;i++){
2918         di = ((Double_t) i)*(kfrm26ZssSection+kfrm26Width);
2919         sprintf(name,
2920                 "ITS sup Cable tray support frame radial section A26[%d]",i);
2921         r1 = kfrm26R1ss+m*di;
2922         r2 = kfrm26R1ss+m*(di+kfrm26Width);
2923         sA26[i] = new TGeoConeSeg(name,0.5*kfrm26Width,r2,r2+kfrm26Thss,
2924                                  r1,r1+kfrm26Thss,kfrm26Phi0,kfrm26Phi1);
2925     } // end for i
2926     sB26 = new TGeoArb8("ITS sup Cable tray support frame Z section B26",
2927                        0.5*kfrm26ZssSection);
2928     r = 0.25*(sA26[0]->GetRmax1()+sA26[0]->GetRmin1()+
2929               sA26[1]->GetRmax2()+sA26[1]->GetRmin2());
2930     sB26->SetVertex(0,sA26[0]->GetRmax2()-r,+0.5*kfrm26Width);
2931     sB26->SetVertex(1,sA26[0]->GetRmax2()-r,-0.5*kfrm26Width);
2932     sB26->SetVertex(2,sA26[0]->GetRmin2()-r,-0.5*kfrm26Width);
2933     sB26->SetVertex(3,sA26[0]->GetRmin2()-r,+0.5*kfrm26Width);
2934     sB26->SetVertex(4,sA26[1]->GetRmax1()-r,+0.5*kfrm26Width);
2935     sB26->SetVertex(5,sA26[1]->GetRmax1()-r,-0.5*kfrm26Width);
2936     sB26->SetVertex(6,sA26[1]->GetRmin1()-r,-0.5*kfrm26Width);
2937     sB26->SetVertex(7,sA26[1]->GetRmin1()-r,+0.5*kfrm26Width);
2938     if(GetDebug()){
2939         for(i=0;i<kfrm26NZsections+1;i++) sA26[i]->InspectShape();
2940         sM26->InspectShape();
2941         sB26->InspectShape();
2942     } // end if GetDebug()
2943     //
2944     TGeoVolume *vA26[kfrm26NZsections+1],*vB26,*vM26;
2945     //
2946     for(i=0;i<kfrm26NZsections+1;i++){
2947         sprintf(name,"ITSsupFrameA26[%d]",i);
2948         vA26[i] = new TGeoVolume(name,sA26[i],medSUPss);
2949         vA26[i]->SetVisibility(kTRUE);
2950         vA26[i]->SetLineColor(1); // black
2951         vA26[i]->SetLineWidth(1);
2952         vA26[i]->SetFillColor(vA26[i]->GetLineColor());
2953         vA26[i]->SetFillStyle(4000); // 0% transparent
2954     } // end for i
2955     vB26 = new TGeoVolume("ITSsupFrameB26",sB26,medSUPss);
2956     vB26->SetVisibility(kTRUE);
2957     vB26->SetLineColor(1); // black
2958     vB26->SetLineWidth(1);
2959     vB26->SetFillColor(vB26->GetLineColor());
2960     vB26->SetFillStyle(4000); // 0% transparent
2961     vM26 = new TGeoVolume("ITSsupFrameM26",sM26,medSUPair);
2962     vM26->SetVisibility(kTRUE);
2963     vM26->SetLineColor(7); // light blue
2964     vM26->SetLineWidth(1);
2965     vM26->SetFillColor(vM26->GetLineColor());
2966     vM26->SetFillStyle(4090); // 90% transparent
2967     //
2968     Int_t ncopyB26=1;
2969     t0 = kfrm26Phi0;
2970     dt = (kfrm26Phi1-kfrm26Phi0)/((Double_t)kfrm26NPhiSections);
2971     for(i=0;i<=kfrm26NZsections;i++){
2972         di = ((Double_t) i)*(kfrm26ZssSection+kfrm26Width);
2973         z = -sM26->GetDz()+sA26[i]->GetDz() + di;
2974         tran = new TGeoTranslation("",0.0,0.0,z);
2975         vM26->AddNode(vA26[i],1,tran);
2976         z = z+sB26->GetDz();
2977         if(i<kfrm26NZsections)for(j=0;j<=kfrm26NPhiSections;j++){
2978             r = 0.25*(sA26[i]->GetRmax1()+sA26[i]->GetRmin1()+
2979                       sA26[i+1]->GetRmax2()+sA26[i+1]->GetRmin2());
2980             t = t0 + ((Double_t)j)*dt;
2981             rot = new TGeoRotation("",0.0,0.0,t);
2982             y = r*SinD(t);
2983             x = r*CosD(t);
2984             tranrot = new TGeoCombiTrans("",x,y,z,rot);
2985             delete rot; // rot not explicity used in AddNode functions.
2986             vM26->AddNode(vB26,ncopyB26++,tranrot);
2987         } // end for j
2988     } // end for i
2989     tran = new TGeoTranslation("",0.0,0.0,kfrm26Z0-sM26->GetDz());
2990     moth->AddNode(vM26,1,tran);
2991     for(i=1;i<kfrm26NPhi;i++){
2992         rot = new TGeoRotation("",0.0,0.0,90.0*((Double_t)i));
2993         tranrot = new TGeoCombiTrans(*tran,*rot);
2994         delete rot; // rot not explicity used in AddNode functions.
2995         moth->AddNode(vM26,i+1,tranrot);
2996     } // end for i
2997     if(GetDebug()){
2998         for(i=0;i<kfrm26NZsections+1;i++) vA26[i]->PrintNodes();
2999         vB26->PrintNodes();
3000         vM26->PrintNodes();
3001     } // end if
3002 }