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