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