]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSGeometrySSDCone.cxx
Transition to NewIO
[u/mrichter/AliRoot.git] / ITS / AliITSGeometrySSDCone.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 /*
17 $Log$
18 Revision 1.4.2.1  2003/05/19 16:24:39  hristov
19 Merging with v3-09-09 (partial, AliITCclustererV2 is excluded from compilation and has to be adapted to NewIO, AliITStrackerV2 needs additional changes)
20
21 Revision 1.4  2003/04/22 20:41:08  nilsen
22 Finished geometry objects defninistions, and fixed bugs in SSD cone geometry.
23
24 Revision 1.3  2003/04/17 22:29:23  nilsen
25 Geometry bug fixes and the like. Work still progressing.
26
27 Revision 1.2  2003/03/25 23:27:19  nilsen
28 ITS new Geometry files. Not yet ready for uses, committed to allow additional
29 development.
30
31 Revision 1.1  2003/02/10 17:03:52  nilsen
32 New version and structure of ITS V11 geometry. Work still in progress.
33
34 $Id$
35 */
36
37 #include <Riostream.h>
38 #include <stdio.h>
39 #include <stdlib.h>
40 #include <TMath.h>
41 #include <TGeometry.h>
42 #include <TNode.h>
43 #include <TTUBE.h>
44 #include <TTUBS.h>
45 #include <TPCON.h>
46 #include <TFile.h>    // only required for Tracking function?
47 #include <TCanvas.h>
48 #include <TObjArray.h>
49 #include <TLorentzVector.h>
50 #include <TObjString.h>
51 #include <TClonesArray.h>
52 #include <TBRIK.h>
53 #include <TSystem.h>
54 #include <TVector3.h>
55 #include <AliRun.h>
56 #include <AliITS.h>
57
58 #include "AliITSGeometrySSDCone.h"
59
60 ClassImp(AliITSGeometrySSDCone)
61
62 //______________________________________________________________________
63 AliITSGeometrySSDCone::AliITSGeometrySSDCone() : AliITSBaseGeometry(){
64     //Default Constructor for SSD Cone geometry
65
66     SetScalemm();
67 }
68 //______________________________________________________________________
69 AliITSGeometrySSDCone::AliITSGeometrySSDCone(AliITS *its,TVector3 &tran,
70                                              const char *moth,Int_t mat0):
71     AliITSBaseGeometry(its,0){
72     //Standard Constructor for SSD Cone geometry
73     // Inputs:
74     //   Double_t z0  Z-axis shift of this volume
75     // Outputs:
76     //   none.
77     // Return:
78     //   none.
79     Double_t t; // some general angle and coordinates [degrees].
80     Double_t Z,Rmin,Rmax; // additional point not needed in call to pcons.
81
82     fThickness = 13.0; //mm, Thickness of Rohacell+carbon fiber
83     fCthick=1.5; //mm, Carbon finber thickness
84     fRcurv=15.0; // mm, Radius of curvature.
85     fTc=51.0; // angle of SSD cone [degrees].
86     fSintc=Sind(fTc);fCostc=Cosd(fTc);fTantc=Tand(fTc);
87     fZ0=0.0;fZouterMilled=13.5-5.0;fZcylinder=170.0;fZposts=196.0;
88     fNspoaks=12;fNposts=4;fNmounts=4;
89     fRoutMax=0.5*985.0;fRoutHole=0.5*965.0;fRoutMin=0.5*945.0;
90     fRholeMax=0.5*890.0;fRholeMin=0.5*740.0;
91     fRpostMin=316.0;fdRpost=23.0;fZpostMax=196.0;fPhi0Post=30.0;
92     fRinMax=0.5*590.0;fRinCylinder=0.5*597.0;fRinHole=0.5*575.0;
93     fRinMin=0.5*562.0;fdZin=15.0;
94     // SSD-SDD Thermal/Mechanical cylinder mounts
95     fNinScrews=40;
96     fPhi0Screws=0.5*360.0/((Double_t)fNinScrews);fRcylinderScrews= 0.5*570.0;
97     fDscrewHead=8.0;fDscrewShaft=4.6;fThScrewHeadHole=8.5;
98     // SDD mounting bracket, SSD part
99     fNssdSupports=3;fPhi0SDDsupports=90.0;
100     fRsddSupportPlate = 0.5*585.0;fThSDDsupportPlate=4.0;
101     fWsddSupportPlate = 70.0;
102     fSSDcf=26; // SSD support cone Carbon Fiber materal number.
103     fSSDfs=25; // SSD support cone inserto stesalite 4411w.
104     fSSDfo=68; // SSD support cone foam, Rohacell 50A.
105     fSSDsw=14; // SSD support cone screw material,Stainless steal
106     fNcD=0; // number of screw ends (copy number)
107     fNcE=0; // number of pin end (copy number)
108
109     SetScalemm();
110     // Poly-cone Volume A. Top part of SSD cone Carbon Fiber.
111     fA.Size(7,"SSD Suport cone Carbon Fiber Surface outer left");
112      // Poly-cone Volume B. Stesalite inside volume A.
113     fB.Size(6,"SSD Suport cone Inserto Stesalite left edge");
114     // Poly-cone Volume C. Foam inside volume A.
115     fC.Size(4,"SSD Suport cone Rohacell foam left edge");
116     fD.SetName("Screw+stud used to mount things to the SSD support cone");
117     fE.SetName("pin used to mount things to the SSD support cone");
118     // Poly-cone Volume F. Foam in spoak reagion, inside volume A.
119     fF.Size(4,"SSD Top Suport cone Rohacell foam Spoak");
120     fG.Size(4,"SSD spoak carbon fiber surfaces"); // Poly-cone Volume G.
121     fH.Size(4,"SSD support cone Rohacell foam Spoak"); // Poly-cone Volume H.
122     fI.Size(9,"SSD lower/inner right part of SSD cone"); //Poly-cone Volume I.
123     fJ.Size(4,"SSD inner most foam core"); // Poly-cone Volume J.
124     fK.Size(6,"SSD inner most inserto material"); // Poly-cone Volume K.
125     fL.Size(4,"SSD Bottom cone Rohacell foam Spoak"); // Poly-cone Volume L.
126     fM.Size(4,"SSD mounting post foam substitute, Inserto");//Poly-cone Vol. M
127     fN.Size(4,"SSD mounting post CF subsititute, Inserto");//Poly-cone Vol. N
128     fO.Size(3,"SSD mounting post, carbon fiber"); // Poly-cone Volume O.
129     fP.Size(3,"SSD mounting post, Inserto"); // Poly-cone Volume P.
130     fQ.Size(4,"SSD Thermal sheal stainless steel bolts");//Poly-cone Volume Q.
131     fR.SetName("Air in front of bolt (in stasolit)");
132     fS.SetName("Air in front of Stainless Steal Screw end, N6");
133     fT.Size(2,"SSD-SDD mounting bracket Inserto-> Al."); //Poly-cone Volume T.
134     fU.Size(4,"SSD-SDD mounting bracket CF->Al."); // Poly-cone Volume U.
135     // Lets start with the upper left outer carbon fiber surface.
136     // Between za[2],rmaxa[2] and za[4],rmaxa[4] there is a curved section
137     // given by rmaxa = rmaxa[2]-r*Sind(t) for 0<=t<=fTc and 
138     // za = za[2] + r*Cosd(t) for 0<=t<=fTc. Simularly between za[1],rmina[1
139     // and za[3],rmina[3] there is a curve section given by
140     // rmina = rmina[1]-r*Sind(t) for 0<=t<=fTc and za = za[1]+r&Sind(t)
141     // for t<=0<=fTc. These curves have been replaced by straight lines
142     // between the equivelent points for simplicity.
143     Double_t dza = fThickness/fSintc-(fRoutMax-fRoutMin)/fTantc;
144     if(dza<=0){ // The number or order of the points are in error for a proper
145         // call to pcons!
146         Error("SSDcone","The definition of the points for a call to PCONS is"
147               " in error. abort.");
148         return;
149     } // end if
150     fA.P0() = 0.0;
151     fA.dP() = 360.0;
152     fA.Z(0) = fZ0;
153     fA.Rn(0) = fRoutMin;
154     fA.Rx(0) = fRoutMax;
155     fA.Z(1)  = fA.ZAt(0)+fZouterMilled - dza; // za[2] - dza.
156     fA.Rn(1) = fA.Rmin(0);
157     fA.Rx(1) = fA.Rmax(0);
158     fA.Z(2)  = fA.ZAt(0)+fZouterMilled; //From Drawing ALR-0767 and ALR-0767/3
159     fA.Rx(2) = fA.Rmax(0);
160     RadiusOfCurvature(fRcurv,0.0,fA.ZAt(1),fA.Rmin(1),fTc,fA.Z(3),fA.Rn(3));
161     fA.Rn(2) = RminFrom2Points(fA,3,1,fA.ZAt(2));
162     RadiusOfCurvature(fRcurv,0.0,fA.ZAt(2),fA.Rmax(2),fTc,fA.Z(4),fA.Rx(4));
163     fA.Rn(4) = RminFromZSSDcone(fA.ZAt(4));
164     fA.Rx(3) = RmaxFrom2Points(fA,4,2,fA.ZAt(3));
165     fA.Rn(5) = fRholeMax;
166     fA.Z(5)  = Zfrom2MinPoints(fA,4,3,fA.Rmin(5));
167     fA.Rx(5) = RmaxFromZSSDcone(fA.ZAt(5));
168     fA.Rn(6) = fRholeMax;
169     fA.Rx(6) = fA.Rmin(6);
170     fA.Z(6)  = ZFromRmaxSSDcone(fA.Rmax(6));
171     //
172     // Now lets define the Inserto Stesalite 4411w material volume.
173     fB.P0() = 0.0;
174     fB.dP() = 360.0;
175     fB.Z(0) = fA.ZAt(0);
176     fB.Rn(0) = fA.Rmin(0)+fCthick;
177     fB.Rx(0) = fA.Rmax(0)-fCthick;
178     fB.Z(1)  = fA.ZAt(1);
179     fB.Rn(1) = fB.Rmin(0);
180     fB.Rx(1) = fB.Rmax(0);
181     fB.Z(2)  = fA.ZAt(2);
182     fB.Rx(2) = fB.Rmax(1);
183     RadiusOfCurvature(fRcurv-fCthick,0.,fB.ZAt(2),fB.Rmax(2),
184                                     fTc,fB.Z(3),fB.Rx(3));
185     RadiusOfCurvature(fRcurv+fCthick,0.,fB.ZAt(1),fB.Rmin(1),
186                                     fTc,fB.Z(4),fB.Rn(4));
187     fB.Rn(2) = RminFrom2Points(fB,4,1,fB.ZAt(2));
188     fB.Rn(3) = RminFrom2Points(fB,4,1,fB.ZAt(3));
189     fB.Z(5)  = fB.ZAt(4)+(fThickness-2.0*fCthick)/fSintc;
190     fB.Rn(5) = RmaxFromZSSDcone(fB.ZAt(5),-fCthick);
191     fB.Rx(5) = fB.Rmin(5);
192     fB.Rx(4) = RmaxFrom2Points(fB,5,3,fB.ZAt(4));
193     //
194     // Now lets define the Rohacell foam material volume.
195     fC.P0() = 0.0;
196     fC.dP() = 360.0;
197     fC.Z(0) = fB.ZAt(4);
198     fC.Rn(0) = fB.Rmin(4);
199     fC.Rx(0) = fC.Rmin(0);
200     fC.Z(1)  = fB.ZAt(5);
201     fC.Rx(1) = fB.Rmin(5);
202     fC.Rn(2) = fA.Rmin(5)+fCthick;//leave space for carbon fiber covering hole
203     fC.Z(2)  = ZFromRminSSDcone(fC.Rmin(2),+fCthick);
204     fC.Rn(1) = RminFrom2Points(fC,2,0,fC.ZAt(1));
205     fC.Rx(3) = fA.Rmin(6)+fCthick;
206     fC.Rn(3) = fC.Rmax(3);
207     fC.Z(3)  = ZFromRmaxSSDcone(fC.Rx(3),-fCthick);
208     fC.Rx(2) = RmaxFrom2Points(fC,3,1,fC.ZAt(2));
209     //
210     // In volume SCB, th Inserto Stesalite 4411w material volume, there
211     // are a number of Stainless steel screw and pin studs which will be
212     // filled with screws/studs.
213     fD.Rn()=0.0,fD.Rx()=6.0,fD.Z()=0.5*10.0; // mm
214     fE.Rn()=0.0;fE.Rx()=6.0;fE.Z()=0.5*12.0; // mm
215     //
216     // There is no carbon fiber between this upper left section and the
217     // SSD spoaks. We remove it by replacing it with Rohacell foam.
218     t = fCthick/(0.5*(fRholeMax+fRholeMin));// It is not posible to get the
219     // carbon fiber thickness uniform in this phi direction. We can only
220     // make it a fixed angular thickness.
221     t *= 180.0/TMath::Pi();
222     fF.P0()  = 12.5+t; // degrees see drawing ALR-0767.
223     fF.dP()  = 5.0 - 2.0*t; // degrees
224     fF.Z(0)  = fC.ZAt(2);
225     fF.Rn(0) = fC.Rmin(3);
226     fF.Rx(0) = fF.Rmin(0);
227     fF.Rn(1) = fA.Rmin(5);
228     fF.Rx(1) = fF.Rmin(0);
229     fF.Z(1)  = ZFromRminSSDcone(fF.Rmin(1),+fCthick);
230     fF.Z(2)  = fC.ZAt(3);
231     fF.Rn(2) = fF.Rmin(1);
232     fF.Rx(2) = fF.Rmax(1);
233     fF.Rn(3) = fA.Rmin(6);
234     fF.Rx(3) = fF.Rmin(3);
235     fF.Z(3)  = ZFromRmaxSSDcone(fF.Rmax(3),-fCthick);
236     //=================================================================
237     // Now for the spoak part of the SSD cone.
238     // It is not posible to inclue the radius of curvature between
239     // the spoak part and the upper left part of the SSD cone or lowwer right
240     // part. This would be discribed by the following curves.
241     // R = Rmax - (5mm)*Sin(t) phi = phi0+(5mm*180/(Pi*fRoutHole))*Sin(t) 
242     // where 0<=t<=90 For the inner curve a simular equiation holds.
243     fG.P0()  = 12.5; // degrees see drawing ALR-0767.
244     fG.dP()  = 5.0; // degrees
245     fG.Z(0)  = fA.ZAt(5);
246     fG.Rn(0) = fA.Rmin(5);
247     fG.Rx(0) = fG.Rn(0);
248     fG.Z(1)  = fA.ZAt(6);
249     fG.Rn(1) = RminFromZSSDcone(fG.ZAt(1));
250     fG.Rx(1) = fG.Rmax(0);
251     fG.Rn(2) = fRholeMin;
252     fG.Z(2)  = ZFromRminSSDcone(fG.Rmin(2));
253     fG.Rx(2) = RmaxFromZSSDcone(fG.ZAt(2));
254     fG.Rn(3) = fG.Rmin(2);
255     fG.Rx(3) = fG.Rmin(3);
256     fG.Z(3)  = ZFromRmaxSSDcone(fG.Rmax(3));
257     // For the foam core.
258     t = fCthick/(0.5*(fRholeMax+fRholeMin));// It is not posible to get the
259     // carbon fiber thickness uniform in this phi direction. We can only
260     // make it a fixed angular thickness.
261     t *= 180.0/TMath::Pi();
262     fH.P0()  = 12.5+t; // degrees
263     fH.dP()  = 5.0 - 2.0*t; // degrees see drawing ALR-0767.
264     fH.Z(0)  = fF.ZAt(1);
265     fH.Rn(0) = fG.Rmin(0);
266     fH.Rx(0) = fH.Rmin(0);
267     fH.Z(1)  = fF.ZAt(3);
268     fH.Rn(1) = RminFromZSSDcone(fH.Z(1),+fCthick);
269     fH.Rx(1) = fH.Rmax(0);
270     fH.Z(2)  = ZFromRminSSDcone(fG.Rmin(2),+fCthick);
271     fH.Rn(2) = fG.Rmin(2);
272     fH.Rx(2) = RmaxFromZSSDcone(fH.Z(2),-fCthick);
273     fH.Z(3)  = ZFromRmaxSSDcone(fG.Rmin(3),-fCthick);
274     fH.Rn(3) = fG.Rmin(3);
275     fH.Rx(3) = fH.Rn(3);
276     //
277     //==================================================================
278     // Now for the Inner most part of the SSD cone.
279     fI.P0()  = 0.0;
280     fI.dP()  = 360.0;
281     fI.Z(0)  = fG.ZAt(2);
282     fI.Rn(0) = fG.Rmin(2);
283     fI.Rx(0) = fI.Rmin(0);
284     fI.Z(1)  = fG.ZAt(3);
285     fI.Rn(1) = RminFromZSSDcone(fI.ZAt(1));
286     fI.Rx(1) = fI.Rmax(0);
287     fI.Rn(4) = fRinMin;
288     fI.Rn(5) = fRinMin;
289     RadiusOfCurvature(fRcurv,90.0,0.0,fRinMax,90.0-fTc,Z,fI.Rx(5)); // z dummy
290     fI.Z(5)  = ZFromRmaxSSDcone(fI.Rx(5));
291     fI.Z(6)  = fZcylinder;
292     fI.Rn(6) = fRinMin;
293     fI.Z(7)  = fI.Z(6);
294     fI.Rn(7) = fRinCylinder;
295     fI.Rn(8) = fRinCylinder;
296     fI.Rx(8) = fI.Rmin(8);
297     Rmin = fI.Rmin(5);
298     RadiusOfCurvature(fRcurv,90.0-fTc,fI.Z(5),fI.Rmax(5),90.0,Z,Rmax);
299     Rmax = fRinMax;
300     fI.Z(8)  = Z+(fI.ZAt(5)-Z)*(fI.Rmax(8)-Rmax)/(fI.Rmax(5)-Rmax);
301     fI.Rx(6) = RmaxFrom2Points(fI,8,5,fI.ZAt(6));
302     fI.Rx(7) = fI.Rmax(6);
303     fI.Z(3)  = Z-fdZin;
304     fI.Z(4)  = fI.ZAt(3);
305     fI.Rx(3) = RmaxFromZSSDcone(fI.ZAt(3));
306     fI.Rx(4) = fI.Rx(3);
307     //rmin dummy
308     RadiusOfCurvature(fRcurv,90.,fI.ZAt(3),0.,90.-fTc,fI.Z(2),Rmin);
309     fI.Rn(2) = RminFromZSSDcone(fI.ZAt(2));
310     fI.Rx(2) = RmaxFromZSSDcone(fI.ZAt(2));
311     // z dummy
312     RadiusOfCurvature(fRcurv,90.-fTc,0.0,fI.Rmin(2),90.0,Z,fI.Rn(3)); 
313     // Now for Inserto volume at the inner most radius.
314     fK.P0()  = 0.0;
315     fK.dP()  = 360.0;
316     fK.Z(1)  = fI.ZAt(3)+fCthick;
317     fK.Rn(1) = fI.Rmin(3);
318     fK.Z(2)  = fK.ZAt(1);
319     fK.Rn(2) = fI.Rmin(4);
320     fK.Rn(3) = fK.Rmin(2);
321     fK.Rn(4) = fK.Rmin(2);
322     fK.Rx(4) = fI.Rmax(5)-fCthick*fSintc;
323     RadiusOfCurvature(fRcurv+fCthick,90.0,fK.ZAt(1),fK.Rmin(1),
324                                 90.0-fTc,fK.Z(0),fK.Rn(0));
325     fK.Rx(0) = fK.Rmin(0);
326     fK.Z(3)  = fK.ZAt(0)+(fThickness-2.0*fCthick)*fCostc;;
327     fK.Rx(3) = fK.Rmax(0)+(fThickness-2.0*fCthick)*fSintc;
328     fK.Rx(1) = RmaxFrom2Points(fK,3,0,fK.ZAt(1));
329     fK.Rx(2) = fK.Rmax(1);
330     fK.Z(4)  = ZFromRmaxSSDcone(fK.Rmax(4),-fCthick);
331     fK.Rn(5) = fK.Rmin(2);
332     fK.Z(5)  = fI.ZAt(6);
333     fK.Rx(5) = (fI.Rmax(5)-fI.Rmax(8))/(fI.ZAt(5)-fI.ZAt(8))*
334                (fK.ZAt(5)-fK.ZAt(4)) + fK.Rmax(4);
335     // Now for foam core at the inner most radius.
336     fJ.P0() = 0.0;
337     fJ.dP() = 360.0;
338     fJ.Rn(0) = fI.Rmin(0)-fCthick;
339     fJ.Z(0)  = ZFromRminSSDcone(fJ.Rmin(0),+fCthick);
340     fJ.Rx(0) = fJ.Rmin(0);
341     fJ.Rx(1) = fJ.Rmax(0);
342     fJ.Z(1)  = ZFromRmaxSSDcone(fJ.Rmax(1),-fCthick);
343     fJ.Rn(1) = RminFromZSSDcone(fJ.ZAt(1),+fCthick);
344     fJ.Z(2)  = fK.ZAt(0);
345     fJ.Rn(2) = fK.Rmin(0);
346     fJ.Rx(2) = RmaxFromZSSDcone(fJ.ZAt(2),-fCthick);
347     fJ.Z(3)  = fK.ZAt(3);
348     fJ.Rn(3) = fK.Rmax(3);
349     fJ.Rx(3) = fJ.Rmin(3);
350     // Now for foam core at the top of the inner most radius where 
351     // the spoaks are.
352     t = fCthick/(0.5*(fRholeMax+fRholeMin));// It is not posible to get the
353     // carbon fiber thickness uniform in this phi direction. We can only
354     // make it a fixed angular thickness.
355     t *= 180.0/TMath::Pi();
356     fL.P0() = 12.5+t; // degrees
357     fL.dP() = 5.0 - 2.0*t; // degrees see drawing ALR-0767.
358     fL.Z(0) = fH.ZAt(2);
359     fL.Rn(0) = fH.Rmin(2);
360     fL.Rx(0) = fL.Rmin(0);
361     fL.Z(1)  = fJ.ZAt(0);
362     fL.Rn(1) = fJ.Rmin(0);
363     fL.Rx(1) = fI.Rmax(1);
364     fL.Z(2)  = fH.ZAt(3);
365     fL.Rn(2) = fL.Rmin(1);
366     fL.Rx(2) = fL.Rmax(1);
367     fL.Z(3)  = fJ.ZAt(1);
368     fL.Rn(3) = fL.Rmin(2);
369     fL.Rx(3) = fL.Rmin(3);
370     // Now for the SSD mounting posts
371     fO.P0()  = fPhi0Post; // degrees
372     fO.dP()  = 180.0*fdRpost/(fRpostMin+0.5*fdRpost)/TMath::Pi(); //
373     fO.Rn(0) = fRpostMin+fdRpost;
374     fO.Rx(0) = fO.Rmin(0);
375     fO.Z(0)  = ZFromRmaxSSDcone(fO.Rmax(0));
376     fO.Rn(1) = fRpostMin;
377     fO.Z(1)  = ZFromRmaxSSDcone(fO.Rmin(1));
378     fO.Rx(1) = fO.Rmax(0);
379     fO.Z(2)  = fZ0+fZpostMax;
380     fO.Rn(2) = fRpostMin;
381     fO.Rx(2) = fO.Rmin(2)+fdRpost;
382     // Now for the SSD mounting posts
383     t = 180.0*fCthick/(fRpostMin+0.5*fdRpost)/TMath::Pi();
384     fP.dP()  = fO.DPhi()-2.0*t; // degrees
385     fP.P0()  = fO.Phi0()+t; //
386     fP.Rn(0) = fO.Rmin(0)-fCthick;
387     fP.Rx(0) = fP.Rmin(0);
388     fP.Z(0)  = ZFromRmaxSSDcone(fP.Rmax(0));
389     fP.Rn(1) = fO.Rmin(1)+fCthick;
390     fP.Rx(1) = fO.Rmin(0)-fCthick;
391     fP.Z(1)  = ZFromRmaxSSDcone(fP.Rmin(1));
392     fP.Rn(2) = fP.Rmin(1);
393     fP.Rx(2) = fP.Rmax(1);
394     fP.Z(2)  = fZ0+fZpostMax;
395     // This insrto continues into the SSD cone displacing the foam
396     // and the carbon fiber surface at those points where the posts are.
397     fM.P0()  = fP.Phi0();
398     fM.dP()  = fP.DPhi();
399     fM.Rn(0) = fRpostMin+fdRpost-fCthick;
400     fM.Rx(0) = fM.Rmin(0);
401     fM.Z(0)  = ZFromRminSSDcone(fM.Rmin(0),+fCthick);
402     fM.Rx(1) = fM.Rmax(0);
403     fM.Z(1)  = ZFromRmaxSSDcone(fM.Rmax(1),-fCthick);
404     fM.Rn(1) = RminFromZSSDcone(fM.ZAt(1),+fCthick);
405     fM.Rn(2) = fRpostMin+fCthick;
406     fM.Z(2)  = ZFromRminSSDcone(fM.Rmin(2),+fCthick);
407     fM.Rx(2) = RmaxFromZSSDcone(fM.ZAt(2),-fCthick);
408     fM.Rn(3) = fM.Rmin(2);
409     fM.Rx(3) = fM.Rmin(3);
410     fM.Z(3)  = ZFromRmaxSSDcone(fM.Rmax(3),-fCthick);
411     //
412     fN.P0()  = fP.Phi0();
413     fN.dP()  = fP.DPhi();
414     fN.Z(0)  = fM.ZAt(1);
415     fN.Rn(0) = fM.Rmax(1);
416     fN.Rx(0) = fN.Rmin(0);
417     fN.Rx(1) = fN.Rmax(0);
418     fN.Z(1)  = ZFromRmaxSSDcone(fN.Rmax(1));
419     fN.Rn(1) = RmaxFromZSSDcone(fN.ZAt(1),-fCthick);
420     fN.Z(2)  = fM.ZAt(3);
421     fN.Rn(2) = fM.Rmin(3);
422     fN.Rx(2) = RmaxFromZSSDcone(fN.ZAt(2));
423     fN.Rn(3) = fN.Rmin(2);
424     fN.Rx(3) = fN.Rmin(3);
425     fN.Z(3)  = ZFromRmaxSSDcone(fN.Rmax(3));
426     // Bolt heads holding the SSD-SDD tube to the SSD cone.
427     // Bolt -- PolyCone
428     fQ.P0()  = 0.0;
429     fQ.dP()  = 360.0;
430     fQ.Z(0)  = fI.ZAt(4)-fThSDDsupportPlate;
431     fQ.Rn(0) = 0.0;
432     fQ.Rx(0) = 0.5*fDscrewHead;
433     fQ.Z(1)  = fI.ZAt(4)-fThScrewHeadHole;
434     fQ.Rn(1) = 0.0;
435     fQ.Rx(1) = 0.5*fDscrewHead;
436     fQ.Z(2)  = fQ.ZAt(1);
437     fQ.Rn(2) = 0.0;
438     fQ.Rx(2) = 0.5*fDscrewShaft;
439     fQ.Z(3)  = fQ.ZAt(2);
440     fQ.Rn(3) = 0.0;
441     fQ.Rx(3) = fQ.Rmax(2);
442     // air infront of bolt (stasolit Volume K) -- Tube
443     fR.Z() = 0.5*(fThickness-fThScrewHeadHole);
444     fR.Rn() = 0.0;
445     fR.Rx() = 0.5*fDscrewHead;
446     // air infront of bolt (carbon fiber volume I) -- Tube
447     fS.Z() = 0.5*fThickness;
448     fS.Rn() = 0.0;
449     fS.Rx() = fR.Rmax();
450     // SDD support plate, SSD side.
451     fT.dP()  = 180.0*fWsddSupportPlate/(fRsddSupportPlate*TMath::Pi());
452     fT.P0()  = fPhi0SDDsupports=-0.5*fT.DPhi();
453     fT.Z(0)  = fK.ZAt(2);
454     fT.Rn(0) = fI.Rmin(4);
455     fT.Rx(0) = fRsddSupportPlate;
456     fT.Z(1)  = fI.ZAt(4) - fThSDDsupportPlate;
457     fT.Rn(1) = fT.Rmin(0);
458     fT.Rx(1) = fT.Rmax(0);
459     //
460     fU.dP() = fT.DPhi();
461     fU.P0() = fT.Phi0();
462     fU.Z(2) = fI.ZAt(4);
463     fU.Rn(2) = fT.Rmin(0);
464     fU.Rx(2) = fT.Rmax(0);
465     fU.Z(3)  = fT.ZAt(0);
466     fU.Rn(3) = fU.Rmin(2);
467     fU.Rx(3) = fU.Rmax(2);
468     fU.Z(1)  = fU.ZAt(2);
469     fU.Rn(1) = fI.Rmin(3);
470     fU.Rx(1) = fU.Rmax(3);
471     fU.Rx(0) = fT.Rmax(0);
472     fU.Rn(0) = fU.Rmax(0);
473     fU.Z(0)  = Zfrom2MinPoints(fI,2,3,fU.Rmax(0));
474     // Debuging
475     Print(&cout);
476 }
477 //______________________________________________________________________
478 void AliITSGeometrySSDCone::CreateG3Geometry(const char *moth,
479                                              TVector3 &trans){
480     // Calls Geant 3 geometry inilization routines with the information
481     // stored in this class.
482     // Inputs:
483     //    none.
484     // Outputs:
485     //    none.
486     // Return:
487     //    none.
488
489     PolyCone(fA,fSSDcf);
490     PolyCone(fB,fSSDfs);
491     PolyCone(fC,fSSDfo);
492     Tube(fD,fSSDsw);
493     Tube(fE,fSSDsw);
494     PolyCone(fF,fSSDfo);
495     PolyCone(fG,fSSDcf);
496     PolyCone(fH,fSSDfo);
497     PolyCone(fI,fSSDcf);
498     PolyCone(fJ,fSSDfo);
499     PolyCone(fK,fSSDfs);
500     PolyCone(fL,fSSDfo);
501     PolyCone(fM,fSSDfo);
502     PolyCone(fN,fSSDfo);
503     PolyCone(fO,fSSDcf);
504     PolyCone(fP,fSSDfs);
505     PolyCone(fQ,fSSDfo);
506     Tube(fR,fSSDsw);
507     Tube(fS,fSSDsw);
508     PolyCone(fT,fSSDfo);
509     PolyCone(fU,fSSDfo);
510     return;
511 }
512 //______________________________________________________________________
513 void AliITSGeometrySSDCone::PositionG3Geometry(AliITSBaseVolParams &moth,
514                                                Int_t cn,TVector3 &trans,
515                                                Int_t irot){
516     // Positions ths whole object at t with rotatin irot coply number cn
517     // into volume moth.
518     // Inputs:
519     //   const AliITSBaseVolParams *moth   Mother volume where this object 
520     //                                     is to be placed.
521     //   Int_t      cn      Copy number.
522     //   TVector3   &t      Translation vector for this whole volume
523     //   Int_t      irot    rotation matrix number to be applyed to this
524     //                      volume.
525     // Output:
526     //   none.
527     // Return:
528     //   none.
529     Int_t i,j,k,l,irotSpoaks,irotPost;
530     Double_t t;
531     Bool_t init=kFALSE;
532     TVector3 zero(0.0,0.0,0.0),v(0.0,0.0,0.0);
533
534     if(cn<=0) return;
535     if(cn==1) init=kTRUE;
536     Pos(fA,cn,moth,trans,0);
537     Pos(fI,cn,moth,trans,0);
538     Pos(fG,fNspoaks*(cn-1)+1,moth,trans,0);
539     irotSpoaks = irot;
540     j = 1;
541     for(i=fNspoaks*(cn-1)+2;i<fNspoaks*cn+1;i++){
542         ZMatrix(++irot,((Double_t)j)*360./((Double_t)fNspoaks));
543         Pos(fG,i,moth,trans,irot);
544         j++;
545     } // end for i
546     Pos(fO,fNposts*(cn-1)+1,moth,trans,0);
547     irotPost = irot;
548     j = 1;
549     for(i=fNposts*(cn-1)+2;i<fNposts*cn+1;i++){
550         ZMatrix(++irot,((Double_t)j)*360./((Double_t)fNposts));
551         Pos(fO,i,moth,trans,irot);
552         j++;
553     } // end for
554     if(!init) return;
555     // Inside volume A.
556     Pos(fB,1,fA,zero,0);
557     Pos(fC,1,fA,zero,0);
558     // Inside Volume B
559     k=l=0;
560     for(i=0;i<2;i++){ // position for ITS-TPC mounting brackets
561         for(j=0;j<2;j++){ // 2 screws per bracket
562             fNcD++;
563             t = -5.0+10.0*((Double_t)j)+180.*((Double_t)i);
564             v.SetX(fRoutHole*Sind(t));
565             v.SetY(fRoutHole*Cosd(t));
566             v.SetZ(fD.DzAt());
567             Pos(fD,fNcD,fB,v,0);
568         } // end for j
569         for(j=0;j<3;j++){ // 3 pins per bracket
570             fNcE++;
571             t = -3.0+3.0*((Double_t)j)+180.*((Double_t)i);
572             v.SetX(fRoutHole*Sind(t));
573             v.SetY(fRoutHole*Cosd(t));
574             v.SetZ(fE.DzAt());
575             Pos(fE,fNcE,fB,v,0);
576         } // end for j
577     } // end for i
578     for(i=0;i<2;i++){ // position for ITS-rail mounting brackets
579         for(j=0;j<4;j++){ // 4 screws per bracket
580             Double_t a[4]={0.0,2.0,5.0,7.0}; // Relative angles.
581             fNcD++;
582             t = 90.0-a[j]+187.*((Double_t)i);
583             v.SetX(fRoutHole*Sind(t));
584             v.SetY(fRoutHole*Cosd(t));
585             v.SetZ(fD.DzAt());
586             Pos(fD,fNcD,fB,v,0);
587         } // end for j
588         for(j=0;j<2;j++){ // 2 pins per bracket
589             fNcE++;
590             t = 88+7.0*((Double_t)j)+184.*((Double_t)i);
591             v.SetX(fRoutHole*Sind(t));
592             v.SetY(fRoutHole*Cosd(t));
593             v.SetZ(fE.DzAt());
594             Pos(fE,fNcE,fB,v,0);
595         } // end for j
596     } // end for i
597     for(i=0;i<fNmounts;i++){ // mounting holes/screws for beam 
598         // pipe support and SPD cone support (dump side,non-dump 
599         // side has them to).
600         for(j=0;j<2;j++){ // 2 screws per bracket
601             fNcD++;
602             t = 180.*20./(fRoutHole*TMath::Pi());
603             t = 45.0+((Double_t)(j-1))*t+90.*((Double_t)i);
604             v.SetX(fRoutHole*Sind(t));
605             v.SetY(fRoutHole*Cosd(t));
606             v.SetZ(fD.DzAt());
607             Pos(fD,fNcD,fB,v,0);
608         } // end for j
609         for(j=0;j<1;j++){ // 1 pins per bracket
610             fNcE++;
611             t = 45.0+90.*((Double_t)i);
612             v.SetX(fRoutHole*Sind(t));
613             v.SetY(fRoutHole*Cosd(t));
614             v.SetZ(fE.DzAt());
615             Pos(fE,fNcE,fB,v,0);
616         } // end for j
617     } // end for i
618     Pos(fF,1,fA,zero,0);
619     Pos(fL,1,fI,zero,0);
620     for(i=1;i<fNspoaks;i++){
621         Pos(fF,i+1,fA,zero,irotSpoaks+i);
622         Pos(fL,i+1,fA,zero,irotSpoaks+i);
623     } // end for i
624     Pos(fH,1,fG,zero,0);
625     Pos(fK,1,fI,zero,0);
626     Pos(fJ,1,fI,zero,0);
627     Pos(fP,1,fO,zero,0);
628     Pos(fM,1,fJ,zero,0);
629     Pos(fN,1,fI,zero,0);
630     for(i=1;i<fNposts;i++){
631         Pos(fN,i+1,fI,zero,irotPost+i);
632         Pos(fM,i+1,fJ,zero,irotPost+i);
633     } // end for i
634     // Add SDD thermal sheald screws, and SDD suppport bracket.
635     t = fPhi0Screws;
636     v.SetX(fRcylinderScrews*Sind(t));
637     v.SetY(fRcylinderScrews*Cosd(t));
638     v.SetZ(0.0);
639     Pos(fQ,1,fK,v,0);
640     v.SetZ(fK.ZAt(2)-fR.DzAt());
641     Pos(fR,1,fK,v,0);
642     v.SetZ(fI.ZAt(4)-fS.DzAt());
643     Pos(fS,1,fI,v,0);
644     Pos(fT,1,fK,zero,0);
645     Pos(fU,1,fI,zero,0);
646     Int_t ir=2,it=2;
647     Double_t d = 360./((Double_t)fNssdSupports);
648     cout << fPhi0SDDsupports<<" " << fNssdSupports<< " " << fPhi0Screws<< endl;
649     for(i=1;i<fNinScrews;i++){
650         t = fPhi0Screws + ((Double_t)i)*360./((Double_t)fNinScrews);
651         v.SetX(fRcylinderScrews*Sind(t));
652         v.SetY(fRcylinderScrews*Cosd(t));
653         v.SetZ(0.0);
654         Pos(fQ,i+1,fK,v,0);
655         cout << " t="<<t<<endl;
656         if((t>=-0.5*fT.DPhi()&&t<=+0.5*fT.DPhi())||
657            (t>=d-0.5*fT.DPhi()&&t<=d+0.5*fT.DPhi())||
658            (t>=2.*d-0.5*fT.DPhi()&&t<=2.*d+0.5*fT.DPhi())){
659             // SDD support here
660             if((t>=-0.5*fT.DPhi()&&t<=+0.5*fT.DPhi())) continue;
661             t = ((Double_t)(it-1))*d;
662             cout << " Zmatrix t=" << t << endl;
663             ZMatrix(++irot,t);
664             Pos(fT,it,fK,zero,irot);
665             Pos(fU,it,fI,zero,irot);
666             it++;
667         }else{ // Air here
668             v.SetZ(fK.ZAt(2)-fR.DzAt());
669             Pos(fR,ir,fK,v,0);
670             v.SetZ(fI.ZAt(4)-fS.DzAt());
671             Pos(fS,ir,fI,v,0);
672             ir++;
673         } // end if
674     } // end for i
675     // Air holes and bolts in SSD mounting studs, volumes I,M,N,O.
676     return;
677 }
678 //______________________________________________________________________
679 void AliITSGeometrySSDCone::CreateG3Materials(){
680     // Fills the Geant 3 banks with Material and Medium definisions.
681     // Inputs:
682     //   none.
683     // Outputs:
684     //   none.
685     // Returns:
686     //   none.
687     Int_t i;
688     Int_t Z[5],N[5];
689     Double_t W[5],dens;
690
691     // epoxy
692     dens = 10.*GetA(1)+13.*GetA(6)+3.*GetA(8);
693     Z[0] = 1; W[0] = 10.*GetA(Z[0])/dens; // Hydrogen Content
694     Z[1] = 6; W[1] = 13.*GetA(Z[1])/dens; // Carbon Content
695     Z[2] = 8; W[2] =  3.*GetA(Z[2])/dens; // Oxegen
696     // Carbon fiber is about 64% carbon fiber and 36% epoxy by volume.
697     // Now need to add in the carbon fiber
698     W[0] *= 0.36*GetA(Z[0]);
699     W[1]  = 0.36*W[1]*dens*GetA(Z[1]) + 0.64*GetA(Z[1]);
700     W[2] *= 0.36*GetA(Z[2]);
701     // Renormilize the weights
702     dens = 0.0;
703     for(i=0;i<3;i++){dens += W[i];}
704     for(i=0;i<3;i++){W[i] /= dens;}
705     dens = 1.7; // grams/cm^3 taken as density of G10 PDG book.
706     MixtureByWeight(fSSDcf,"Carbon Fiber for SSD support cone",Z,W,dens,3,0);
707     // epoxy 
708     dens = 10.*GetA(1)+13.*GetA(6)+3.*GetA(8);
709     Z[0] = 1; W[0] = 10.*GetA(Z[0])/dens; // Hydrogen Content
710     Z[1] = 6; W[1] = 13.*GetA(Z[1])/dens; // Carbon Content
711     Z[2] = 8; W[2] =  3.*GetA(Z[2])/dens; // Oxegen
712     Z[3] = 14;W[3] = 0.0; // no Silicon in epoxy.
713     // glass fiber is about 64% carbon fiber and 36% epoxy by volume.
714     // Now need to add in the glass fiber
715     W[0] *= 0.36*GetA(Z[0]);
716     W[1] *= 0.36*GetA(Z[1]);
717     W[2]  = 0.36*W[2]*dens*GetA(Z[2]) + 0.64*2.0*GetA(Z[2]);
718     W[3]  = 0.64*GetA(Z[3]); // Si
719     // Renormilize the weights
720     dens = 0.0;
721     for(i=0;i<4;i++){dens += W[i];}
722     for(i=0;i<4;i++){W[i] /= dens;}
723     dens = 1.7; // grams/cm^3 taken as density of G10 PDG book.
724     MixtureByWeight(fSSDfs,"Inserto stealite 4411w for SSD support cone",
725                     Z,W,dens,4,0);
726     // Rohacell 51 C14 H10 N2 O6 from Flavio Tosello
727     // http://cesweb.grantadesign.com/demo/index.do
728     Z[0] = 1; N[0] = 10; // Hydrogen Content
729     Z[1] = 6; N[1] = 14; // Carbon Content
730     Z[2] = 7; N[2] =  2; // Nitrogen Content
731     Z[3] = 8; N[3] =  6; // Oxigen Content
732     dens = 0.0513; // grams/cm^3 From Flavio Tosello 
733     //  http://www.emkayplatics.co.uk/roh51.html
734     MixtureByNumber(fSSDfo,"Foam core (Rohacell 51) for SSD support cone",
735                     Z,N,dens,4,0);
736     // Stainless steel. Temperary values.
737     Z[0] =  6; W[0] = 0.5; // Carbon Content
738     Z[1] = 25; W[1] = 0.5; // Iron Content
739     dens = 7.87; // Grams/cm^3  density of iron used.
740     MixtureByWeight(fSSDsw,"Stainless steal screw, pin, and stud material",
741                     Z,W,dens,2,0);
742 }
743 //______________________________________________________________________
744 void AliITSGeometrySSDCone::BuildDisplayGeometry(){
745     // Fill Root geometry banks for fast simple ITS simulation event
746     // display. See Display.C, and related code, for more details.
747     // Inputs:
748     //    none.
749     // Outputs:
750     //   none.
751     // Return:
752     //  none.
753
754     // No need to display ITS cones.
755 }
756 //______________________________________________________________________
757 void AliITSGeometrySSDCone::Print(ostream *os){
758     // Prints out the data kept in this class
759     // Inputs:
760     //   ostream *os pointer to the output stream
761     // Outputs:
762     //   none.
763     // Return:
764     //   none.
765
766     *os << "Object AliITSGeometrySSDCone" << endl;
767     *os << " Object fA" << endl << fA << endl;
768     *os << " Object fB" << endl << fB << endl;
769     *os << " Object fC" << endl << fC << endl;
770     *os << " Object fD" << endl << fD << endl;
771     *os << " Object fE" << endl << fE << endl;
772     *os << " Object fF" << endl << fF << endl;
773     *os << " Object fG" << endl << fG << endl;
774     *os << " Object fH" << endl << fH << endl;
775     *os << " Object fI" << endl << fI << endl;
776     *os << " Object fJ" << endl << fJ << endl;
777     *os << " Object fK" << endl << fK << endl;
778     *os << " Object fL" << endl << fL << endl;
779     *os << " Object fM" << endl << fM << endl;
780     *os << " Object fN" << endl << fN << endl;
781     *os << " Object fO" << endl << fO << endl;
782     *os << " Object fP" << endl << fP << endl;
783     *os << " Object fQ" << endl << fQ << endl;
784     *os << " Object fR" << endl << fR << endl;
785     *os << " Object fS" << endl << fS << endl;
786     *os << " Object fT" << endl << fT << endl;
787     *os << " Object fU" << endl << fU << endl;
788     return;
789 }
790 //______________________________________________________________________
791 void AliITSGeometrySSDCone::Read(istream *is){
792     // Read in data written with Print above.
793     // Inputs:
794     //   istream *is Input stream pointer
795     // Output:
796     //   none.
797     // Return:
798     //   none.
799     char s[50];
800
801     is->getline(s,49);
802     is->getline(s,49);
803     *is >> fA;
804     is->getline(s,49);
805     *is >> fB;
806     is->getline(s,49);
807     *is >> fC;
808     is->getline(s,49);
809     *is >> fD;
810     is->getline(s,49);
811     *is >> fE;
812     is->getline(s,49);
813     *is >> fF;
814     is->getline(s,49);
815     *is >> fG;
816     is->getline(s,49);
817     *is >> fH;
818     is->getline(s,49);
819     *is >> fI;
820     is->getline(s,49);
821     *is >> fJ;
822     is->getline(s,49);
823     *is >> fK;
824     is->getline(s,49);
825     *is >> fL;
826     is->getline(s,49);
827     *is >> fM;
828     is->getline(s,49);
829     *is >> fN;
830     is->getline(s,49);
831     *is >> fO;
832     is->getline(s,49);
833     *is >> fP;
834     is->getline(s,49);
835     *is >> fQ;
836     is->getline(s,49);
837     *is >> fR;
838     is->getline(s,49);
839     *is >> fS;
840     is->getline(s,49);
841     *is >> fT;
842     is->getline(s,49);
843     *is >> fU;
844     return;
845 }
846 //______________________________________________________________________
847 ostream &operator<<(ostream &os,AliITSGeometrySSDCone &s){
848     // Operator << for C++ like output of AliITSGeometrySSDCone class.
849     // Inputs:
850     //   ostream &os              The output stream
851     //   AliITSGeometrySSDCone &s The class to be outputed
852     // Outputs:
853     //   none.
854     // Return:
855     //  ostream &os  The address of the output stream
856
857     s.Print(&os);
858     return os;
859 }
860 //______________________________________________________________________
861 istream &operator>>(istream &is,AliITSGeometrySSDCone &s){
862     // Operator >> for C++ like input of AliITSGeometrySSDCone class.
863     // Inputs:
864     //   istream &is              The input stream
865     //   AliITSGeometrySSDCone &s The class to be inputed
866     // Outputs:
867     //   none.
868     // Return:
869     //  istream &is  The address of the input stream
870
871     s.Read(&is);
872     return is;
873 }