]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11.cxx
AliITSv11 and AliITSBaseGeometry commented out (temporary)
[u/mrichter/AliRoot.git] / ITS / AliITSv11.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
18 //////////////////////////////////////////////////////////////////////////////
19 //                                                                          //
20 //  Inner Traking System version 11                                         //
21 //  This class contains the base procedures for the Inner Tracking System   //
22 //                                                                          //
23 // Authors: R. Barbera                                                      //
24 // version 6.                                                               //
25 // Created  2000.                                                           //
26 //                                                                          //
27 //  NOTE: THIS IS THE  SYMMETRIC PPR geometry of the ITS.                   //
28 // THIS WILL NOT WORK                                                       //
29 // with the geometry or module classes or any analysis classes. You are     //
30 // strongly encouraged to uses AliITSv5.                                    //
31 //                                                                          //
32 //////////////////////////////////////////////////////////////////////////////
33 // See AliITSv11::StepManager().
34 // General C/C++ includes
35 #include <stdio.h>
36 #include <stdlib.h>
37 // General Root includes
38 #include <Riostream.h>
39 #include <TMath.h>
40 #include <TFile.h>    // only required for Tracking function?
41 #include <TObjArray.h>
42 #include <TClonesArray.h>
43 #include <TLorentzVector.h>
44 #include <TObjString.h>
45 // Root Geometry includes
46 #include <TGeoManager.h>
47 #include <TGeoPcon.h>
48 #include <TGeoTube.h>
49 #include <TGeoNode.h>
50 #include <TGeoMaterial.h>
51 // General AliRoot includes
52 #include "AliRun.h"
53 #include "AliMagF.h"
54 #include "AliConst.h"
55 // ITS specific includes
56 #include "AliITShit.h"
57 #include "AliITSgeom.h"
58 #include "AliITSgeomSPD.h"
59 #include "AliITSgeomSDD.h"
60 #include "AliITSgeomSSD.h"
61 #include "AliITSDetType.h"
62 #include "AliITSresponseSPD.h"
63 #include "AliITSresponseSDD.h"
64 #include "AliITSresponseSSD.h"
65 #include "AliITSsegmentationSPD.h"
66 #include "AliITSsegmentationSDD.h"
67 #include "AliITSsegmentationSSD.h"
68 #include "AliITSsimulationSPD.h"
69 #include "AliITSsimulationSDD.h"
70 #include "AliITSsimulationSSD.h"
71 #include "AliITSClusterFinderSPD.h"
72 #include "AliITSClusterFinderSDD.h"
73 #include "AliITSClusterFinderSSD.h"
74 #include "AliITSBaseGeometry.h"
75 #include "AliITSv11.h"
76
77 // Units, Convert from k?? to cm,degree,GeV,seconds,
78 const Double_t kmm = 0.10; // Convert mm to TGeom's cm.
79 const Double_t kcm = 1.00; // Convert cv to TGeom's cm.
80
81 ClassImp(AliITSv11)
82
83 /*
84   Some temparary #define's used untill ROOT has addoppted the proper
85   Getter in it's classes.
86   These Below are for TGeoPcon functions.
87 */
88
89 //______________________________________________________________________
90 AliITSv11::AliITSv11() : AliITS() {
91     // Standard default constructor for the ITS version 11.
92     // Inputs:
93     //   none.
94     // Outputs:
95     //   none.
96     // Return
97     //   A default constructed AliITSv11 class.
98
99     //fITSV = 0;
100     //fcS = 0;
101 //   fcD = 0;
102 }
103 //______________________________________________________________________
104 AliITSv11::AliITSv11(const char *title) : AliITS("ITS", title){
105     // Standard constructor for the ITS version 11.
106     // Inputs:
107     //   const char *title  The title of for this geometry.
108     // Outputs:
109     //   none.
110     // Return
111     //   A Standard constructed AliITSv11 class.
112
113     //fITSV = 0;
114     //fcS = 0;
115 //    fcD = 0;
116 }
117 //______________________________________________________________________
118 AliITSv11::~AliITSv11() {
119     // Standard destructor for the ITS version 11.
120     // Inputs:
121     //   none.
122     // Outputs:
123     //   none.
124     // Return
125     //   none.
126
127 //    if(fITSV!=0) delete fITSV;
128 //    if(fcS!=0) delete fcS;
129 //    if(fcD!=0) delete fcD;
130 }
131 //______________________________________________________________________
132 AliITSv11::AliITSv11(const AliITSv11 &source) : AliITS(source){
133     //     Copy Constructor for ITS version 11.
134     // Inputs:
135     //   AliITSv11 &source  class to be copied from.
136     // Outputs:
137     //   none.
138     // Return
139     //   none.
140
141     if(&source == this) return;
142     Error("Copy Constructor","Not allowed to copy AliITSv11");
143     return;
144 }
145 //______________________________________________________________________
146 AliITSv11& AliITSv11::operator=(const AliITSv11 &source){
147     //    Assignment operator for the ITS version 11.
148     // Inputs:
149     //   AliITSv11 &source  class to be copied from.
150     // Outputs:
151     //   none.
152     // Return
153     //   none.
154
155     if(&source == this) return *this;
156     Error("= operator","Not allowed to copy AliITSv11");
157     return *this;
158 }
159 //______________________________________________________________________
160 void AliITSv11::BuildGeometry(){
161     // This routine defines and Creates the geometry for version 11 of 
162     // the ITS for use in the simulation display routines. This is a 
163     // very simplified geometry for speed of viewing.
164     // Inputs:
165     //   none.
166     // Outputs:
167     //   none.
168     // Return
169     //   none.
170     TVector3 t(0.0,0.0,0.0);
171
172     //if(fITSV==0) fITSV = new AliITSGeometryITSV(this,"ALIC");
173     //if(fcS==0) fcS = new AliITSGeometrySSDCone(this,t,"TSV",1);
174
175     //fcS->BuildDisplayGeometry();
176 }
177 //______________________________________________________________________
178 void AliITSv11::CreateGeometry(){
179     // This routine defines and Creates the geometry for version 11 of 
180     // the ITS. The geometry is used by the particle trasport routines,
181     // and therefore, is very detailed.
182     // Inputs:
183     //   none.
184     // Outputs:
185     //   none.
186     // Return
187     //   none.
188     TVector3 t(0.0,0.0,0.0);
189
190     TGeoManager *mgr = gGeoManager;
191     TGeoVolume *ALIC = mgr->GetTopVolume();
192
193     TGeoPcon *itsv = new TGeoPcon("ITS Top Volume, Daughter of ALIC",0.0,360.0,2);
194     // DefineSection(section number, Z, Rmin, Rmax).
195     itsv->DefineSection(0,-100.0*kcm,0.01*kcm,50.0*kcm);
196     itsv->DefineSection(1,+100.0*kcm,0.01*kcm,50.0*kcm);
197     TGeoVolume *ITSV = new TGeoVolume("ITSV",itsv,0);
198     mgr->AddVolume(ITSV);
199     ALIC->AddNode(ITSV,1,0);
200     //
201     SSDCone(ITSV);
202 }
203 //______________________________________________________________________
204 Double_t AliITSv11::RmaxFrom2Points(TGeoPcon *p,Int_t i1,Int_t i2,Double_t z){
205     // functions Require at parts of Volume A to be already defined.
206     // Retruns the value of Rmax corresponding to point z alone the line
207     // defined by the two points p.Rmax(i1),p-GetZ(i1) and p->GetRmax(i2),
208     // p->GetZ(i2).
209
210     return p->GetRmax(i2)+(p->GetRmax(i1)-p->GetRmax(i2))*(z-p->GetZ(i2))/
211         (p->GetZ(i1)-p->GetZ(i2));
212 }
213 //______________________________________________________________________
214 Double_t AliITSv11::RminFrom2Points(TGeoPcon *p,Int_t i1,Int_t i2,Double_t z){
215     // Retruns the value of Rmin corresponding to point z alone the line
216     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and p->GetRmin(i2),
217     // p->GetZ(i2).
218
219     return p->GetRmin(i2)+(p->GetRmin(i1)-p->GetRmin(i2))*(z-p->GetZ(i2))/
220         (p->GetZ(i1)-p->GetZ(i2));
221 }
222 //______________________________________________________________________
223 Double_t AliITSv11::RFrom2Points(Double_t *p,Double_t *Z,Int_t i1,Int_t i2,Double_t z){
224     // Retruns the value of Rmin corresponding to point z alone the line
225     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and p->GetRmin(i2),
226     // p->GetZ(i2).
227
228     return p[i2]+(p[i1]-p[i2])*(z-Z[i2])/(Z[i1]-Z[i2]);
229 }
230 //______________________________________________________________________
231 Double_t AliITSv11::Zfrom2MinPoints(TGeoPcon *p,Int_t i1,Int_t i2,Double_t r){
232     // Retruns the value of Z corresponding to point R alone the line
233     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and 
234     // p->GetRmin(i2),p->GetZ(i2)
235
236     return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmin(i2))/
237         (p->GetRmin(i1)-p->GetRmin(i2));
238 }
239 //______________________________________________________________________
240 Double_t AliITSv11::Zfrom2MaxPoints(TGeoPcon *p,Int_t i1,Int_t i2,Double_t r){
241     // Retruns the value of Z corresponding to point R alone the line
242     // defined by the two points p->GetRmax(i1),p->GetZ(i1) and 
243     // p->GetRmax(i2),p->GetZ(i2)
244
245     return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmax(i2))/
246         (p->GetRmax(i1)-p->GetRmax(i2));
247 }
248 //______________________________________________________________________
249 Double_t AliITSv11::Zfrom2Points(Double_t *Z,Double_t *p,Int_t i1,Int_t i2,Double_t r){
250     // Retruns the value of Z corresponding to point R alone the line
251     // defined by the two points p->GetRmax(i1),p->GetZ(i1) and 
252     // p->GetRmax(i2),p->GetZ(i2)
253
254     return Z[i2]+(Z[i1]-Z[i2])*(r-p[i2])/(p[i1]-p[i2]);
255 }
256 //______________________________________________________________________
257 Double_t AliITSv11::RmaxFromZpCone(TGeoPcon *p,Double_t tc,Double_t z,Double_t th){
258     // General SSD Outer Cone surface equation Rmax.
259     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
260     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
261
262     return -tantc*(z-p->GetZ(4))+p->GetRmax(4)+th/costc;
263 }
264 //______________________________________________________________________
265 Double_t AliITSv11::RmaxFromZpCone(Double_t *GetRmax,Double_t *GetZ,Double_t tc,Double_t z,Double_t th){
266     // General SSD Outer Cone surface equation Rmax.
267     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
268     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
269
270     return -tantc*(z-GetZ[4])+GetRmax[4]+th/costc;
271 }
272 //______________________________________________________________________
273 Double_t AliITSv11::RminFromZpCone(TGeoPcon *p,Double_t tc,Double_t z,Double_t th){
274     // General SSD Inner Cone surface equation Rmin.
275     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
276     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
277
278     return -tantc*(z-p->GetZ(3))+p->GetRmin(3)+th/costc;
279 }
280 //______________________________________________________________________
281 Double_t AliITSv11::RminFromZpCone(Double_t *GetRmin,Double_t *GetZ,Double_t tc,Double_t z,Double_t th){
282     // General SSD Inner Cone surface equation Rmin.
283     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
284     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
285
286     return -tantc*(z-GetZ[3])+GetRmin[3]+th/costc;
287 }
288 //______________________________________________________________________
289 Double_t AliITSv11::ZFromRmaxpCone(TGeoPcon *p,Double_t tc,Double_t r,Double_t th){
290     // General SSD Outer cone Surface equation for z.
291     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
292     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
293
294     return p->GetZ(4)+(p->GetRmax(4)+th/costc-r)/tantc;
295 }
296 //______________________________________________________________________
297 Double_t AliITSv11::ZFromRmaxpCone(Double_t *GetRmax,Double_t *GetZ,Double_t tc,Double_t r,Double_t th){
298     // General SSD Outer cone Surface equation for z.
299     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
300     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
301
302     return GetZ[4]+(GetRmax[4]+th/costc-r)/tantc;
303 }
304 //______________________________________________________________________
305 Double_t AliITSv11::ZFromRminpCone(TGeoPcon *p,Double_t tc,Double_t r,Double_t th){
306     // General SSD Inner cone Surface equation for z.
307     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
308     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
309
310     return p->GetZ(3)+(p->GetRmin(3)+th/costc-r)/tantc;
311 }
312 //______________________________________________________________________
313 void AliITSv11::RadiusOfCurvature(Double_t rc,Double_t theta0,Double_t z0,
314                        Double_t r0,Double_t theta1,Double_t &z1,
315                        Double_t &r1){
316     // Given a initial point z0,r0, the initial angle theta0, and the radius
317     // of curvature, returns the point z1, r1 at the angle theta1. Theta
318     // measured from the r axis in the clock wise direction [degrees].
319     Double_t sin0 = TMath::Sin(theta0*TMath::DegToRad());
320     Double_t cos0 = TMath::Cos(theta0*TMath::DegToRad());
321     Double_t sin1 = TMath::Sin(theta1*TMath::DegToRad());
322     Double_t cos1 = TMath::Cos(theta1*TMath::DegToRad());
323
324     z1 = rc*(sin1-sin0)+z0;
325     r1 = rc*(cos1-cos0)+r0;
326     return;
327 }
328 //______________________________________________________________________
329 void AliITSv11::SPDCone(TGeoVolume *Moth){
330     // Define the detail SPD support cone geometry.
331     // Inputs:
332     //   none.
333     // Outputs:
334     //  none.
335     // Return:
336     //  none.
337 }
338 //______________________________________________________________________
339 void AliITSv11::SDDCone(TGeoVolume *Moth){
340     // Define the detail SDD support cone geometry.
341     // Inputs:
342     //   none.
343     // Outputs:
344     //  none.
345     // Return:
346     //  none.
347
348 //______________________________________________________________________
349 void AliITSv11::SSDCone(TGeoVolume *Moth){
350     // Define the detail SSD support cone geometry.
351     // Inputs:
352     //   none.
353     // Outputs:
354     //  none.
355     // Return:
356     //  none.
357     const Double_t Thickness = 13.0*kmm; // Thickness of Rohacell+carbon fiber
358     const Double_t Cthick    = 1.5*kmm; // Carbon finber thickness
359     const Double_t Rcurv     = 15.0*kmm; // Radius of curvature.
360     const Double_t Tc        = 51.0; // angle of SSD cone [degrees].
361     const Double_t Sintc = TMath::Sin(Tc*TMath::DegToRad());
362     const Double_t Costc = TMath::Cos(Tc*TMath::DegToRad());
363     const Double_t Tantc = TMath::Tan(Tc*TMath::DegToRad());
364     const Double_t ZouterMilled = (13.5-5.0)*kmm;
365     const Double_t Zcylinder    = 170.0*kmm;
366     const Double_t Z0           = Zcylinder + 100.0*kmm;
367     const Int_t Nspoaks         = 12;
368     const Int_t Nmounts         = 4;
369     const Double_t DmountAngle  = 9.0; // degrees
370     const Double_t RoutMax      = 0.5*985.0*kmm;
371     const Double_t RoutHole     = 0.5*965.0*kmm;
372     const Double_t RoutMin      = 0.5*945.0*kmm;
373     const Double_t RholeMax     = 0.5*890.0*kmm;
374     const Double_t RholeMin     = 0.5*740.0*kmm;
375     const Double_t RpostMin     = 316.0*kmm;
376     const Double_t ZpostMax     = 196.0*kmm;
377     const Int_t Nposts          = 6;
378     const Double_t Phi0Post     = 0.0; // degree
379     const Double_t dRpost       = 23.0*kmm;
380     const Double_t RinMax       = 0.5*590.0*kmm;
381     const Double_t RinCylinder  = 0.5*597.0*kmm;
382     const Double_t RinHole      = 0.5*575.0*kmm;
383     const Double_t RinMin       = 0.5*562.0*kmm;
384     const Double_t dZin         = 15.0*kmm;
385     // SSD-SDD Thermal/Mechanical cylinder mounts
386     const Int_t NinScrews          = 40;
387     const Double_t Phi0Screws      = 0.5*360.0/((const Double_t)NinScrews);//d
388     const Double_t RcylinderScrews = 0.5*570.0*kmm;//from older drawing????
389     const Double_t DscrewHead      = 8.0*kmm;
390     const Double_t DscrewShaft     = 4.6*kmm;
391     const Double_t ThScrewHeadHole = 8.5*kmm;
392     // SDD mounting bracket, SSD part
393     const Double_t NssdSupports      = 3;// mounting of U and T
394     const Double_t DssdsddBracketAngle = 9.0; // degrees
395     const Double_t Phi0SDDsupports   = 0.0; // degree
396     const Double_t RsddSupportPlate  = 0.5*585.0*kmm;
397     const Double_t ThSDDsupportPlate = 4.0*kmm;
398     const Double_t WsddSupportPlate  = 70.0*kmm;
399     TGeoMedium *SSDcf  = 0; // SSD support cone Carbon Fiber materal number.
400     TGeoMedium *SSDfs  = 0; // SSD support cone inserto stesalite 4411w.
401     TGeoMedium *SSDfo  = 0; // SSD support cone foam, Rohacell 50A.
402     TGeoMedium *SSDss  = 0; // SSD support cone screw material,Stainless steal
403     TGeoMedium *SSDair = 0; // SSD support cone Air
404     TGeoMedium *SSDal  = 0; // SSD support cone SDD mounting bracket Al
405
406     // Lets start with the upper left outer carbon fiber surface.
407     // Between za[2],rmaxa[2] and za[4],rmaxa[4] there is a curved section
408     // given by rmaxa = rmaxa[2]-r*Sind(t) for 0<=t<=Tc and 
409     // za = za[2] + r*Cosd(t) for 0<=t<=Tc. Simularly between za[1],rmina[1
410     // and za[3],rmina[3] there is a curve section given by
411     // rmina = rmina[1]-r*Sind(t) for 0<=t<=Tc and za = za[1]+r&Sind(t)
412     // for t<=0<=Tc. These curves have been replaced by straight lines
413     // between the equivelent points for simplicity.
414     Double_t dza = Thickness/Sintc-(RoutMax-RoutMin)/Tantc;
415     Int_t i,j;
416     Double_t z[9],rn[9],rx[9],phi,dphi;
417     Double_t t,t0,Z,Rmin,Rmax; // Temp variables.
418     if(dza<=0){ // The number or order of the points are in error for a proper
419         // call to pcons!
420         Error("SSDcone","The definition of the points for a call to PCONS is"
421               " in error. abort.");
422         return;
423     } // end if
424     // Poly-cone Volume A. Top part of SSD cone Carbon Fiber.
425     phi   = 0.0;
426     dphi  = 360.0;
427     z[0]  = 0.0;
428     rn[0] = RoutMin;
429     rx[0] = RoutMax;
430     z[1]  = z[0]+ZouterMilled - dza; // za[2] - dza.
431     rn[1] = rn[0];
432     rx[1] = rx[0];
433     z[2]  = z[0]+ZouterMilled;//From Drawing ALR-0767 and ALR-0767/3
434     rx[2] = rx[0];
435     RadiusOfCurvature(Rcurv,0.,z[1],rn[1],Tc,z[3],rn[3]);
436     rn[2] = RFrom2Points(rn,z,3,1,z[2]);
437     RadiusOfCurvature(Rcurv,0.,z[2],rx[2],Tc,z[4],rx[4]);
438     rn[4] = RminFromZpCone(rn,z,Tc,z[4]);
439     rx[3] = RFrom2Points(rx,z,4,2,z[3]);
440     rn[5] = RholeMax;
441     z[5]  = Zfrom2Points(z,rn,4,3,rn[5]);
442     rx[5] = RmaxFromZpCone(rx,z,Tc,z[5]);
443     rn[6] = RholeMax;
444     rx[6] = rn[6];
445     z[6]  = ZFromRmaxpCone(z,rx,Tc,rx[6]);
446     TGeoPcon *A = new TGeoPcon("ITS SSD Suport cone Carbon Fiber "
447                                    "Surface outer left",phi,dphi,7);
448     for(i=0;i<A->GetNz();i++){
449         if(fDebug) cout<<i<<"A: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
450         A->DefineSection(i,z[i],rn[i],rx[i]);
451     } // end for i
452     //
453     // Poly-cone Volume B. Stesalite inside volume A.
454     // Now lets define the Inserto Stesalite 4411w material volume.
455     phi   = 0.0;
456     dphi  = 360.0;
457     z[0]  = A->GetZ(0);
458     rn[0] = A->GetRmin(0)+Cthick;
459     rx[0] = A->GetRmax(0)-Cthick;
460     z[1]  = A->GetZ(1);
461     rn[1] = rn[0];
462     rx[1] = rx[0];
463     z[2]  = A->GetZ(2);
464     rx[2] = rx[1];
465     RadiusOfCurvature(Rcurv-Cthick,0.,z[2],rx[2],Tc,z[3],rx[3]);
466     RadiusOfCurvature(Rcurv+Cthick,0.,z[1],rn[1],Tc,z[4],rn[4]);
467     rn[2] = RFrom2Points(rn,z,4,1,z[2]);
468     rn[3] = RFrom2Points(rn,z,4,1,z[3]);
469     z[5]  = z[4]+(Thickness-2.0*Cthick)/Sintc;
470     rn[5] = RmaxFromZpCone(A,Tc,z[5],-Cthick);
471     rx[5] = rn[5];
472     rx[4] = RFrom2Points(rx,z,5,3,z[4]);
473     TGeoPcon *B = new TGeoPcon("ITS SSD Suport cone Inserto Stesalite "
474                                    "left edge",phi,dphi,6);
475     for(i=0;i<B->GetNz();i++){
476         if(fDebug) cout<<i<<"B: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
477         B->DefineSection(i,z[i],rn[i],rx[i]);
478     } // end for i
479     //
480     // Poly-cone Volume C. Foam inside volume A.
481     // Now lets define the Rohacell foam material volume.
482     phi   = 0.0;
483     dphi  = 360.0;
484     z[0]  = B->GetZ(4);
485     rn[0] = B->GetRmin(4);
486     rx[0] = rn[0];
487     z[1]  = B->GetZ(5);
488     rx[1] = B->GetRmin(5);
489     rn[2] = A->GetRmin(5)+Cthick;//space for carbon fiber covering hole
490     z[2]  = ZFromRminpCone(A,Tc,rn[2],+Cthick);
491     rn[1] = RFrom2Points(rn,z,2,0,z[1]);
492     rx[3] = A->GetRmin(6)+Cthick;
493     rn[3] = rx[3];
494     z[3]  = ZFromRmaxpCone(A,Tc,rx[3],-Cthick);
495     rx[2] = RFrom2Points(rx,z,3,1,z[2]);
496     TGeoPcon *C = new TGeoPcon("ITS SSD Suport cone Rohacell foam "
497                                    "left edge",phi,dphi,4);
498     for(i=0;i<C->GetNz();i++){
499         if(fDebug) cout<<i<<"C: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
500         C->DefineSection(i,z[i],rn[i],rx[i]);
501     } // end for i
502     //
503     // In volume SCB, th Inserto Stesalite 4411w material volume, there
504     // are a number of Stainless steel screw and pin studs which will be
505     // filled with screws/studs.
506     rn[0] = 0.0,rx[0] = 6.0,z[0] = 0.5*10.0; // mm
507     TGeoTube *D = new TGeoTube("ITS Screw+stud used to mount things to "
508                                    "the SSD support cone",rn[0],rx[0],z[0]);
509     rn[0] = 0.0;rx[0] = 6.0;z[0] = 0.5*12.0; // mm
510     TGeoTube *E = new TGeoTube("ITS pin used to mount things to the "
511                                    "SSD support cone",rn[0],rx[0],z[0]);
512     //
513     // Poly-cone Volume F. Foam in spoak reagion, inside volume A.
514     // There is no carbon fiber between this upper left section and the
515     // SSD spoaks. We remove it by replacing it with Rohacell foam.
516     t = Cthick/(0.5*(RholeMax+RholeMin));// It is not posible to get
517     // the carbon fiber thickness uniform in this phi direction. We can only
518     // make it a fixed angular thickness.
519     t *= 180.0/TMath::Pi();
520     phi  = 12.5+t; // degrees see drawing ALR-0767.
521     dphi  = 5.0 - 2.0*t; // degrees
522     z[0]  = C->GetZ(2);
523     rn[0] = C->GetRmin(3);
524     rx[0] = rn[0];
525     rn[1] = A->GetRmin(5);
526     rx[1] = rn[0];
527     z[1]  = ZFromRminpCone(A,Tc,rn[1],+Cthick);
528     z[2]  = C->GetZ(3);
529     rn[2] = rn[1];
530     rx[2] = rx[1];
531     rn[3] = A->GetRmin(6);
532     rx[3] = rn[3];
533     z[3]  = ZFromRmaxpCone(A,Tc,rx[3],-Cthick);
534     TGeoPcon *F = new TGeoPcon("ITS SSD Top Suport cone Rohacell foam "
535                                    "Spoak",phi,dphi,4);
536     for(i=0;i<F->GetNz();i++){
537         if(fDebug) cout<<i<<"F: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
538         F->DefineSection(i,z[i],rn[i],rx[i]);
539     } // end for i
540     //=================================================================
541      // Poly-cone Volume G.
542     // Now for the spoak part of the SSD cone.
543     // It is not posible to inclue the radius of curvature between
544     // the spoak part and the upper left part of the SSD cone or lowwer right
545     // part. This would be discribed by the following curves.
546     // R = Rmax - (5mm)*Sin(t) phi = phi0+(5mm*180/(Pi*RoutHole))*Sin(t) 
547     // where 0<=t<=90 For the inner curve a simular equiation holds.
548     phi   = 12.5; // degrees see drawing ALR-0767.
549     dphi  = 5.0; // degrees
550     z[0]  = A->GetZ(5);
551     rn[0] = A->GetRmin(5);
552     rx[0] = rn[0];
553     z[1]  = A->GetZ(6);
554     rn[1] = RminFromZpCone(A,Tc,z[1]);
555     rx[1] = rx[0];
556     rn[2] = RholeMin;
557     z[2]  = ZFromRminpCone(A,Tc,rn[2]);
558     rx[2] = RmaxFromZpCone(A,Tc,z[2]);
559     rn[3] = rn[2];
560     rx[3] = rn[3];
561     z[3]  = ZFromRmaxpCone(A,Tc,rx[3]);
562     TGeoPcon *G = new TGeoPcon("ITS SSD spoak carbon fiber surfaces",
563                                    phi,dphi,4);
564     for(i=0;i<G->GetNz();i++){
565         if(fDebug) cout<<i<<"G: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
566         G->DefineSection(i,z[i],rn[i],rx[i]);
567     } // end for i
568     // For the foam core.
569     // Poly-cone Volume H.
570     t = Cthick/(0.5*(RholeMax+RholeMin));// It is not posible to get the
571     // carbon fiber thickness uniform in this phi direction. We can only
572     // make it a fixed angular thickness.
573     t *= 180.0/TMath::Pi();
574     phi   = 12.5+t; // degrees
575     dphi  = 5.0 - 2.0*t; // degrees see drawing ALR-0767.
576     z[0]  = F->GetZ(1);
577     rn[0] = G->GetRmin(0);
578     rx[0] = rn[0];
579     z[1]  = F->GetZ(3);
580     rn[1] = RminFromZpCone(A,Tc,z[1],+Cthick);
581     rx[1] = rx[0];
582     z[2]  = ZFromRminpCone(A,Tc,G->GetRmin(2),+Cthick);
583     rn[2] = G->GetRmin(2);
584     rx[2] = RmaxFromZpCone(A,Tc,z[2],-Cthick);
585     z[3]  = ZFromRmaxpCone(A,Tc,G->GetRmin(3),-Cthick);
586     rn[3] = G->GetRmin(3);
587     rx[3] = rn[3];
588     TGeoPcon *H = new TGeoPcon("ITS SSD support cone Rohacell foam Spoak",
589                                    phi,dphi,4); 
590     for(i=0;i<H->GetNz();i++){
591         if(fDebug) cout<<i<<"H: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
592         H->DefineSection(i,z[i],rn[i],rx[i]);
593     } // end for i
594     //
595     //==================================================================
596     // Now for the Inner most part of the SSD cone.
597     //Poly-cone Volume I.
598     phi   = 0.0;
599     dphi  = 360.0;
600     z[0]  = G->GetZ(2);
601     rn[0] = G->GetRmin(2);
602     rx[0] = rn[0];
603     z[1]  = G->GetZ(3);
604     rn[1] = RminFromZpCone(A,Tc,z[1]);
605     rx[1] = rx[0];
606     rn[4] = RinMin;
607     rn[5] = RinMin;
608     RadiusOfCurvature(Rcurv,90.0,0.0,RinMax,90.0-Tc,Z,rx[5]); // z dummy
609     z[5]  = ZFromRmaxpCone(A,Tc,rx[5]);
610     z[6]  = Zcylinder;
611     rn[6] = RinMin;
612     z[7]  = z[6];
613     rn[7] = RinCylinder;
614     rn[8] = RinCylinder;
615     rx[8] = rn[8];
616     Rmin   = rn[5];
617     RadiusOfCurvature(Rcurv,90.0-Tc,z[5],rx[5],90.0,Z,Rmax);
618     Rmax   = RinMax;
619     z[8]  = Z+(z[5]-Z)*(rx[8]-Rmax)/(rx[5]-Rmax);
620     rx[6] = RFrom2Points(rx,z,8,5,z[6]);
621     rx[7] = rx[6];
622     z[3]  = Z-dZin;
623     z[4]  = z[3];
624     rx[3] = RmaxFromZpCone(A,Tc,z[3]);
625     rx[4] = rx[3];
626     //rmin dummy
627     RadiusOfCurvature(Rcurv,90.,z[3],0.,90.-Tc,z[2],Rmin);
628     rn[2] = RminFromZpCone(A,Tc,z[2]);
629     rx[2] = RmaxFromZpCone(A,Tc,z[2]);
630     // z dummy
631     RadiusOfCurvature(Rcurv,90.-Tc,0.0,rn[2],90.0,Z,rn[3]);
632     TGeoPcon *I = new TGeoPcon("ITS SSD lower/inner right part of SSD "
633                                    "cone",phi,dphi,9);
634     for(i=0;i<I->GetNz();i++){
635         if(fDebug) cout<<i<<"I: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
636         I->DefineSection(i,z[i],rn[i],rx[i]);
637     } // end for i
638     // Now for Inserto volume at the inner most radius.
639     // Poly-cone Volume K.
640     phi   = 0.0;
641     dphi  = 360.0;
642     z[1]  = I->GetZ(3)+Cthick;
643     rn[1] = I->GetRmin(3);
644     z[2]  = z[1];
645     rn[2] = I->GetRmin(4);
646     rn[3] = rn[2];
647     rn[4] = rn[2];
648     rx[4] = I->GetRmax(5)-Cthick*Sintc;
649     RadiusOfCurvature(Rcurv+Cthick,90.0,z[1],rn[1],90.0-Tc,z[0],rn[0]);
650     rx[0] = rn[0];
651     z[3]  = z[0]+(Thickness-2.0*Cthick)*Costc;;
652     rx[3] = rx[0]+(Thickness-2.0*Cthick)*Sintc;
653     rx[1] = RFrom2Points(rx,z,3,0,z[1]);
654     rx[2] = rx[1];
655     z[4]  = ZFromRmaxpCone(A,Tc,rx[4],-Cthick);
656     rn[5] = rn[2];
657     z[5]  = I->GetZ(6);
658     rx[5] = (I->GetRmax(5)-I->GetRmax(8))/(I->GetZ(5)-I->GetZ(8))*(z[5]-z[4])+
659              rx[4];
660     TGeoPcon *K = new TGeoPcon("ITS SSD inner most inserto material",
661                                    phi,dphi,6);
662     for(i=0;i<K->GetNz();i++){
663         if(fDebug) cout<<i<<"K: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
664         K->DefineSection(i,z[i],rn[i],rx[i]);
665     } // end for i
666     // Now for foam core at the inner most radius.
667     // Poly-cone Volume J.
668     phi   = 0.0;
669     dphi  = 360.0;
670     rn[0] = I->GetRmin(0)-Cthick;
671     z[0]  = ZFromRminpCone(A,Tc,rn[0],+Cthick);
672     rx[0] = rn[0];
673     rx[1] = rx[0];
674     z[1]  = ZFromRmaxpCone(A,Tc,rx[1],-Cthick);
675     rn[1] = RminFromZpCone(A,Tc,z[1],+Cthick);
676     z[2]  = K->GetZ(0);
677     rn[2] = K->GetRmin(0);
678     rx[2] = RmaxFromZpCone(A,Tc,z[2],-Cthick);
679     z[3]  = K->GetZ(3);
680     rn[3] = K->GetRmax(3);
681     rx[3] = rn[3];
682     TGeoPcon *J = new TGeoPcon("ITS SSD inner most foam core",phi,dphi,4); 
683     for(i=0;i<J->GetNz();i++){
684         if(fDebug) cout<<i<<"J: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
685         J->DefineSection(i,z[i],rn[i],rx[i]);
686     } // end for i
687     // Now for foam core at the top of the inner most radius where 
688     // the spoaks are.
689     t = Cthick/(0.5*(RholeMax+RholeMin));// It is not posible to get the
690     // carbon fiber thickness uniform in this phi direction. We can only
691     // make it a fixed angular thickness.
692     // Poly-cone Volume L.
693     t *= 180.0/TMath::Pi();
694     phi   = 12.5+t; // degrees
695     dphi  = 5.0 - 2.0*t; // degrees see drawing ALR-0767.
696     z[0]  = H->GetZ(2);
697     rn[0] = H->GetRmin(2);
698     rx[0] = rn[0];
699     z[1]  = J->GetZ(0);
700     rn[1] = J->GetRmin(0);
701     rx[1] = I->GetRmax(1);
702     z[2]  = H->GetZ(3);
703     rn[2] = rn[1];
704     rx[2] = rx[1];
705     z[3]  = J->GetZ(1);
706     rn[3] = rn[2];
707     rx[3] = rn[3];
708     TGeoPcon *L = new TGeoPcon("ITS SSD Bottom cone Rohacell foam Spoak",
709                                    phi,dphi,4);
710     for(i=0;i<L->GetNz();i++){
711         if(fDebug) cout<<i<<"L: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
712         L->DefineSection(i,z[i],rn[i],rx[i]);
713     } // end for i
714     // Now for the SSD mounting posts
715     // Poly-cone Volume O.
716     dphi  = 180.0*dRpost/(RpostMin+0.5*dRpost)/TMath::Pi(); //
717     phi   = Phi0Post-0.5*dphi; // degrees
718     rn[0] = RpostMin+dRpost;
719     rx[0] = rn[0];
720     z[0]  = ZFromRmaxpCone(A,Tc,rx[0]);
721     rn[1] = RpostMin;
722     z[1]  = ZFromRmaxpCone(A,Tc,rn[1]);
723     rx[1] = rx[0];
724     z[2]  = ZpostMax;
725     rn[2] = RpostMin;
726     rx[2] = rn[2]+dRpost;
727     TGeoPcon *O = new TGeoPcon("ITS SSD mounting post, carbon fiber",
728                                    phi,dphi,3);
729     for(i=0;i<O->GetNz();i++){
730         if(fDebug) cout<<i<<"O: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
731         O->DefineSection(i,z[i],rn[i],rx[i]);
732     } // end for i
733     // Now for the SSD mounting posts
734     // Poly-cone Volume P.
735     t = 180.0*Cthick/(RpostMin+0.5*dRpost)/TMath::Pi();
736     dphi  = O->GetDphi()-2.0*t; // degrees
737     phi   = O->GetPhi1()+t; //
738     rn[0] = O->GetRmin(0)-Cthick;
739     rx[0] = rn[0];
740     z[0]  = ZFromRmaxpCone(A,Tc,rx[0]);
741     rn[1] = O->GetRmin(1)+Cthick;
742     rx[1] = O->GetRmin(0)-Cthick;
743     z[1]  = ZFromRmaxpCone(A,Tc,rn[1]);
744     rn[2] = rn[1];
745     rx[2] = rx[1];
746     z[2]  = ZpostMax;
747     TGeoPcon *P = new TGeoPcon("ITS SSD mounting post, Inserto",
748                                    phi,dphi,3);
749     for(i=0;i<P->GetNz();i++){
750         if(fDebug) cout<<i<<"P: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
751         P->DefineSection(i,z[i],rn[i],rx[i]);
752     } // end for i
753     // This insrto continues into the SSD cone displacing the foam
754     // and the carbon fiber surface at those points where the posts are.
755     //Poly-cone Vol. M
756     phi   = P->GetPhi1();
757     dphi  = P->GetDphi();
758     rn[0] = RpostMin+dRpost-Cthick;
759     rx[0] = rn[0];
760     z[0]  = ZFromRminpCone(A,Tc,rn[0],+Cthick);
761     rx[1] = rx[0];
762     z[1]  = ZFromRmaxpCone(A,Tc,rx[1],-Cthick);
763     rn[1] = RminFromZpCone(A,Tc,z[1],+Cthick);
764     rn[2] = RpostMin+Cthick;
765     z[2]  = ZFromRminpCone(A,Tc,rn[2],+Cthick);
766     rx[2] = RmaxFromZpCone(A,Tc,z[2],-Cthick);
767     rn[3] = rn[2];
768     rx[3] = rn[3];
769     z[3]  = ZFromRmaxpCone(A,Tc,rx[3],-Cthick);
770     TGeoPcon *M = new TGeoPcon("ITS SSD mounting post foam substitute, "
771                                    "Inserto",phi,dphi,4);
772     for(i=0;i<M->GetNz();i++){
773         if(fDebug) cout<<i<<"M: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
774         M->DefineSection(i,z[i],rn[i],rx[i]);
775     } // end for i
776     //
777     //Poly-cone Vol. N
778     phi   = P->GetPhi1();
779     dphi  = P->GetDphi();
780     z[0]  = M->GetZ(1);
781     rn[0] = M->GetRmax(1);
782     rx[0] = rn[0];
783     rx[1] = rx[0];
784     z[1]  = ZFromRmaxpCone(A,Tc,rx[1]);
785     rn[1] = RmaxFromZpCone(A,Tc,z[1],-Cthick);
786     z[2]  = M->GetZ(3);
787     rn[2] = M->GetRmin(3);
788     rx[2] = RmaxFromZpCone(A,Tc,z[2]);
789     rn[3] = rn[2];
790     rx[3] = rn[3];
791     z[3]  = ZFromRmaxpCone(A,Tc,rx[3]);
792     TGeoPcon *N = new TGeoPcon("ITS SSD mounting post CF subsititute, "
793                                    "Inserto",phi,dphi,4);
794     for(i=0;i<N->GetNz();i++){ 
795         if(fDebug) cout<<i<<"N: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
796         N->DefineSection(i,z[i],rn[i],rx[i]);
797     } // end for i
798     // Bolt heads holding the SSD-SDD tube to the SSD cone.
799     // Bolt -- PolyCone
800     //Poly-cone Volume Q.
801     phi   = 0.0;
802     dphi  = 360.0;
803     z[0]  = I->GetZ(4)-ThSDDsupportPlate;
804     rn[0] = 0.0;
805     rx[0] = 0.5*DscrewHead;
806     z[1]  = I->GetZ(4)-ThScrewHeadHole;
807     rn[1] = 0.0;
808     rx[1] = 0.5*DscrewHead;
809     z[2]  = z[1];
810     rn[2] = 0.0;
811     rx[2] = 0.5*DscrewShaft;
812     z[3]  = z[2];
813     rn[3] = 0.0;
814     rx[3] = rx[2];
815     TGeoPcon *Q = new TGeoPcon("ITS SSD Thermal sheal stainless steel "
816                                    "bolts",phi,dphi,4);
817     for(i=0;i<Q->GetNz();i++){
818         if(fDebug) cout<<i<<"Q: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
819         Q->DefineSection(i,z[i],rn[i],rx[i]);
820     } // end for i
821     // air infront of bolt (stasolit Volume K) -- Tube
822     z[0]  = 0.5*(Thickness-ThScrewHeadHole);
823     rn[0] = 0.0;
824     rx[0] = 0.5*DscrewHead;
825     TGeoTube *R = new TGeoTube("ITS Air in front of bolt (in stasolit)",
826                                    rn[0],rx[0],z[0]);
827     // air infront of bolt (carbon fiber volume I) -- Tube
828     z[0]  = 0.5*Thickness;
829     rn[0] = 0.0;
830     rx[0] = R->GetRmax();
831     TGeoTube *S = new TGeoTube("ITS Air in front of Stainless Steal "
832                                    "Screw end, N6",rn[0],rx[0],z[0]);
833     // SDD support plate, SSD side.
834     //Poly-cone Volume T.
835     dphi  = 180.0*WsddSupportPlate/(RsddSupportPlate*TMath::Pi());
836     phi   = Phi0SDDsupports-0.5*dphi;
837     z[0]  = K->GetZ(2);
838     rn[0] = I->GetRmin(4);
839     rx[0] = RsddSupportPlate;
840     z[1]  = I->GetZ(4) - ThSDDsupportPlate;
841     rn[1] = rn[0];
842     rx[1] = rx[0];
843     TGeoPcon *T = new TGeoPcon("ITS SSD-SDD mounting bracket Inserto->Al.",
844                                    phi,dphi,2);
845     for(i=0;i<T->GetNz();i++){
846         if(fDebug) cout<<i<<"T: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
847         T->DefineSection(i,z[i],rn[i],rx[i]);
848     } // end for i
849     //
850     // Poly-cone Volume U.
851     TGeoPcon *U;
852     if(I->GetRmin(3)<T->GetRmax(0)){
853         dphi  = T->GetDphi();
854         phi   = T->GetPhi1();
855         z[2]  = I->GetZ(4);
856         rn[2] = T->GetRmin(0);
857         rx[2] = T->GetRmax(0);
858         z[3]  = K->GetZ(2);
859         rn[3] = rn[2];
860         rx[3] = rx[2];
861         z[1]  = z[2];
862         rn[1] = I->GetRmin(3);
863         rx[1] = rx[3];
864         rx[0] = T->GetRmax(0);
865         rn[0] = rx[0];
866         z[0]  = Zfrom2MinPoints(I,2,3,rn[0]);
867         U = new TGeoPcon("ITS SSD-SDD mounting bracket CF->Al.",phi,dphi,4);
868     }else{
869         dphi  = T->GetDphi();
870         phi   = T->GetPhi1();
871         z[0]  = I->GetZ(4);
872         rn[0] = T->GetRmin(0);
873         rx[0] = T->GetRmax(0);
874         z[1]  = K->GetZ(2);
875         rn[1] = rn[0];
876         rx[1] = rx[0];
877         U = new TGeoPcon("ITS SSD-SDD mounting bracket CF->Al.",phi,dphi,2);
878     }// end if
879     for(i=0;i<U->GetNz();i++){
880         if(fDebug) cout<<i<<"U: z="<<z[i]<<" Rmin="<<rn[i]<<" Rmax="<<rx[i]<<endl;
881         U->DefineSection(i,z[i],rn[i],rx[i]);
882     } // end for i
883     //
884     TGeoManager *mgr = gGeoManager;
885     SSDcf = mgr->GetMedium("ITSssdCarbonFiber");
886     SSDfs = mgr->GetMedium("ITSssdStaselite4411w");
887     SSDfo = mgr->GetMedium("ITSssdRohacell50A");
888     SSDss = mgr->GetMedium("ITSssdStainlessSteal");
889     SSDair= mgr->GetMedium("ITSssdAir");
890     SSDal = mgr->GetMedium("ITSssdAl");
891     TGeoVolume *Av,*Bv,*Cv,*Dv,*Ev,*Fv,*Gv,*Hv,*Iv,*Jv,*Kv,*Lv,*Mv,*Nv,
892                *Ov,*Pv,*Qv,*Rv,*Sv,*Tv,*Uv;
893     Av = new TGeoVolume("ITSssdConeA",A,SSDcf);
894     mgr->AddVolume(Av);
895     Av->SetLineColor(1);
896     Av->SetLineWidth(1);
897     Bv = new TGeoVolume("ITSssdConeB",B,SSDfs);
898     mgr->AddVolume(Bv);
899     Cv = new TGeoVolume("ITSssdConeC",C,SSDfo);
900     mgr->AddVolume(Cv);
901     Dv = new TGeoVolume("ITSssdConeD",D,SSDss);
902     mgr->AddVolume(Dv);
903     Ev = new TGeoVolume("ITSssdConeE",E,SSDss);
904     mgr->AddVolume(Ev);
905     Fv = new TGeoVolume("ITSssdConeF",F,SSDfo);
906     mgr->AddVolume(Fv);
907     Gv = new TGeoVolume("ITSssdConeG",G,SSDcf);
908     mgr->AddVolume(Gv);
909     Gv->SetLineColor(2);
910     Gv->SetLineWidth(2);
911     Hv = new TGeoVolume("ITSssdConeH",H,SSDfo);
912     mgr->AddVolume(Hv);
913     Iv = new TGeoVolume("ITSssdConeI",I,SSDcf);
914     mgr->AddVolume(Iv);
915     Iv->SetLineColor(3);
916     Iv->SetLineWidth(3);
917     Jv = new TGeoVolume("ITSssdConeJ",J,SSDfo);
918     mgr->AddVolume(Jv);
919     Kv = new TGeoVolume("ITSssdConeK",K,SSDfs);
920     mgr->AddVolume(Kv);
921     Lv = new TGeoVolume("ITSssdConeL",L,SSDfo);
922     mgr->AddVolume(Lv);
923     Mv = new TGeoVolume("ITSssdConeM",M,SSDfs);
924     mgr->AddVolume(Mv);
925     Nv = new TGeoVolume("ITSssdConeN",N,SSDfs);
926     mgr->AddVolume(Nv);
927     Ov = new TGeoVolume("ITSssdConeO",O,SSDcf);
928     mgr->AddVolume(Ov);
929     Iv->SetLineColor(4);
930     Iv->SetLineWidth(4);
931     Pv = new TGeoVolume("ITSssdConeP",P,SSDfs);
932     mgr->AddVolume(Pv);
933     Qv = new TGeoVolume("ITSssdConeQ",Q,SSDss);
934     mgr->AddVolume(Qv);
935     Rv = new TGeoVolume("ITSssdConeR",R,SSDair);
936     mgr->AddVolume(Rv);
937     Sv = new TGeoVolume("ITSssdConeS",S,SSDair);
938     mgr->AddVolume(Sv);
939     Tv = new TGeoVolume("ITSssdConeT",T,SSDal);
940     mgr->AddVolume(Tv);
941     Uv = new TGeoVolume("ITSssdConeU",U,SSDal);
942     mgr->AddVolume(Uv);
943     //
944     TGeoTranslation *tran = new TGeoTranslation("ITSssdConeTrans",0.0,0.0,-Z0);
945     TGeoRotation *rot180  = new TGeoRotation("ITSssdConeRot180",0.0,180.0,0.0);
946     TGeoCombiTrans *flip  = new TGeoCombiTrans("ITSssdConeFlip",0.0,0.0,Z0,rot180);
947     TGeoTranslation *tranR,*tranS;
948     TGeoCombiTrans *fliptran,*rottran;
949     TGeoRotation *rot,*zspoaks,*zspoaks180;
950     Av->AddNode(Bv,1,0);
951     Av->AddNode(Cv,1,0);
952     Moth->AddNode(Av,1,tran); // RB24 side
953     Moth->AddNode(Av,2,flip); // RB26 side (Absorber)
954     Moth->AddNode(Iv,1,tran); // RB24 side
955     Moth->AddNode(Iv,2,flip); // RB26 side (Absorber)
956     Gv->AddNode(Hv,1,0);
957     for(i=0;i<Nspoaks;i++){ // SSD Cone Spoaks
958         zspoaks = new TGeoRotation("",0.0,0.0,
959                                    ((Double_t)i*360.)/((Double_t)Nspoaks));
960         rottran = new TGeoCombiTrans("",0.0,0.0,-Z0,zspoaks);
961         Moth->AddNode(Gv,i+1,rottran); // RB24 side
962         Av->AddNode(Fv,i+1,zspoaks);
963         Iv->AddNode(Lv,i+1,zspoaks);
964         zspoaks180 =  new TGeoRotation("",0.0,180.0,
965                                        ((Double_t)i*360.)/((Double_t)Nspoaks));
966         fliptran = new TGeoCombiTrans("",0.0,0.0,Z0,zspoaks180);
967         Moth->AddNode(Gv,Nspoaks+i+1,fliptran); // RB26 side
968     } // end for i
969     Iv->AddNode(Jv,1,0);
970     Iv->AddNode(Kv,1,0);
971     Ov->AddNode(Pv,1,0);
972     //Pv->AddNode(Qv,2,?); // Screw head
973     //Pv->AddNode(Qv,3,?); // Screw head
974     //Pv->AddNode(Vv,1,?); // Air hole in Posts
975     //Pv->AddNode(Vv,2,?); // Air hole in Posts
976     //Mv->AddNode(Wv,1,?); // Air hole in Posts
977     //Mv->AddNode(Wv,2,?); // Air hole in Posts
978     //Nv->AddNode(Xv,1,?); // Air hole in Posts
979     //Nv->AddNode(Xv,2,?); // Air hole in Posts
980     TGeoRotation *zposts,*zposts180;
981     for(i=0;i<Nposts;i++){ // SSD Cone mounting posts
982         zposts = new TGeoRotation("",0.0,0.0,
983                                   ((Double_t)i*360.)/((Double_t)Nposts));
984         rottran = new TGeoCombiTrans("",0.0,0.0,-Z0,zposts);
985         Moth->AddNode(Ov,i+1,rottran); // RB24 side
986         Jv->AddNode(Mv,i+1,zposts);
987         Iv->AddNode(Nv,i+1,zposts);
988         //Jv->AddNode(Xv,2*i+3,?); // Air hole in Posts
989         //Jv->AddNode(Xv,2*i+4,?); // Air hole in Posts
990         zposts180 = new TGeoRotation("",0.0,180.0,
991                                   ((Double_t)i*360.)/((Double_t)Nposts));
992         fliptran = new TGeoCombiTrans("",0.0,0.0,Z0,zposts180);
993         Moth->AddNode(Ov,Nposts+i+1,fliptran); // RB26 side
994     } // end for i
995     //
996     for(i=0;i<NinScrews;i++){
997         t = Phi0Screws+360.*((Double_t)i)/((Double_t)NinScrews);
998         t *= TMath::DegToRad();
999         tran= new TGeoTranslation("",RcylinderScrews*TMath::Cos(t),
1000                                   RcylinderScrews*TMath::Sin(t),0.0);
1001         Kv->AddNode(Qv,i+4,rottran);
1002         if(/*not where volumes U and T are*/kTRUE){
1003             tranR = new TGeoTranslation("",RinHole*TMath::Cos(t),
1004                                         RinHole*TMath::Sin(t),
1005                                         K->GetZ(2)+R->GetDz());
1006             tranS = new TGeoTranslation("",RinHole*TMath::Cos(t),
1007                                         RinHole*TMath::Sin(t),
1008                                         I->GetZ(4)+S->GetDz());
1009             Kv->AddNode(Rv,i,tranR);
1010             Iv->AddNode(Sv,i,tranS);
1011         } // end if
1012     } // end for i
1013     Int_t NcD=1,NcE=1,NcR=1,NcS=1;
1014     const Int_t Nbscrew=2,Nbpins=3,Nrailsc=4,Nrailp=2;
1015     Double_t da[] = {-3.5,-1.5,1.5,3.5};
1016     for(i=0;i<2;i++){ // Mounting for ITS-TPC bracket or ITS-Rails
1017         t0 = TMath::Pi()*((Double_t)i);
1018         for(j=-Nbscrew/2;j<=Nbscrew/2;j++)if(j!=0){//screws per ITS-TPC bracket
1019             t = t0 + 5.0*((Double_t)j)*TMath::DegToRad();
1020             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
1021                                       RoutHole*TMath::Sin(t),
1022                                       B->GetZ(0)-D->GetDz());
1023             Bv->AddNode(Dv,NcD,tran);
1024             if(fDebug) cout << "D: NcD="<<NcD<<endl;
1025             NcD++;
1026         } // end or j
1027         for(j=-Nbpins/2;j<=Nbpins/2;j++){ // pins per ITS-TPC bracket
1028             t = t0 + 3.0*((Double_t)j)*TMath::DegToRad();
1029             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
1030                                       RoutHole*TMath::Sin(t),
1031                                       B->GetZ(0)-D->GetDz());
1032             Bv->AddNode(Ev,NcE,tran);
1033             if(fDebug) cout << "E: NcE="<<NcE<<endl;
1034             NcE++;
1035         } // end or j
1036         t0 = (96.5+187.*((Double_t)i))*TMath::DegToRad();
1037         for(j=0;j<Nrailsc;j++){ // screws per ITS-rail bracket
1038             t = t0+da[j]*TMath::DegToRad();
1039             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
1040                                       RoutHole*TMath::Sin(t),
1041                                       B->GetZ(0)-D->GetDz());
1042             Bv->AddNode(Dv,NcD,tran);
1043             if(fDebug) cout << "D2: NcD="<<NcD<<endl;
1044             NcD++;
1045         } // end or j
1046         t0 = (91.5+184.*((Double_t)i))*TMath::DegToRad();
1047         for(j=-Nrailp/2;j<=Nrailp/2;j++)if(j!=0){ // pins per ITS-rail bracket
1048             t = t0+(7.0*((Double_t)j))*TMath::DegToRad();
1049             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
1050                                       RoutHole*TMath::Sin(t),
1051                                       B->GetZ(0)-D->GetDz());
1052             Bv->AddNode(Ev,NcE,tran);
1053             if(fDebug) cout << "E2: NcE="<<NcE<<endl;
1054             NcE++;
1055         } // end or j
1056     } // end for i
1057     for(i=0;i<Nmounts;i++){ // mounting points for SPD-cone+Beam-pipe support
1058         t0 = (45.0+((Double_t)i)*360./((Double_t)Nmounts))*TMath::DegToRad();
1059         for(j=-1;j<=1;j++)if(j!=0){ // 2 screws per bracket
1060             t = t0+((Double_t)j)*0.5*DmountAngle;
1061             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
1062                                       RoutHole*TMath::Sin(t),
1063                                       B->GetZ(0)-D->GetDz());
1064             Bv->AddNode(Dv,NcD,tran);
1065             if(fDebug) cout << "D3: NcD="<<NcD<<endl;
1066             NcD++;
1067         } // end for j
1068         for(j=0;j<1;j++){ // 1 pin per bracket
1069             t = t0;
1070             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
1071                                       RoutHole*TMath::Sin(t),
1072                                       B->GetZ(0)-D->GetDz());
1073             Bv->AddNode(Ev,NcE,tran);
1074             if(fDebug) cout << "E3: NcE="<<NcE<<endl;
1075             NcE++;
1076         } // end for j
1077     } // end for i
1078     tran = new TGeoTranslation("",TMath::Cos(T->GetPhi1()+0.5*T->GetDphi()),
1079                               TMath::Sin(T->GetPhi1()+0.5*T->GetDphi()),
1080                               T->GetZ(T->GetNz()-1)+R->GetDz());
1081     Tv->AddNode(Rv,NcR++,tran);
1082     tran = new TGeoTranslation("",TMath::Cos(U->GetPhi1()+0.5*U->GetDphi()),
1083                               TMath::Sin(U->GetPhi1()+0.5*U->GetDphi()),
1084                               U->GetZ(U->GetNz()-1)+S->GetDz());
1085     Uv->AddNode(Sv,NcS++,tran);
1086     for(i=0;i<NssdSupports;i++){ // mounting braclets for SSD/SDD 
1087         t0 = ((Double_t)i*360./((Double_t)NssdSupports));
1088         rot = new TGeoRotation("",0.0,0.0,t0);
1089         Kv->AddNode(Tv,i+1,rot);
1090         Iv->AddNode(Uv,i+1,rot);
1091         if(fDebug) cout << "T/U: copy number="<<i+1<<endl;
1092         //for(j=0;j<1;j++){ // 1 screws per bracket
1093         //    t = t0;
1094         //} // end for j
1095         for(j=0;j<2;j++)if(j!=0){ // 2 pin per bracket
1096             t = t0 + ((Double_t)j)*0.5*DssdsddBracketAngle;
1097             tran = new TGeoTranslation("",RinHole*TMath::Cos(t),
1098                               RinHole*TMath::Sin(t),
1099                               T->GetZ(T->GetNz()-1)-E->GetDz());
1100             Kv->AddNode(Ev,NcE++,tran);
1101         } // end for j
1102     } // end for i
1103 }
1104 //______________________________________________________________________
1105 void AliITSv11::CreateMaterials(){
1106     // Create ITS materials
1107     //     This function defines the default materials used in the Geant
1108     // Monte Carlo simulations for the geometries AliITSv11.
1109     // In general it is automatically replaced by
1110     // Inputs:
1111     //   none.
1112     // Outputs:
1113     //   none.
1114     // Return
1115     //   none.
1116
1117     //TGeoMaterial *C  = new TGeoMaterial("ITSCarbon",12.0,6.0,2.265);
1118     TGeoMaterial *Al = new TGeoMaterial("ITSAluminum",26.981539,13.0,2.07);
1119     TGeoMixture *Cfiber = new TGeoMixture("ITSCarbonFiber",6,1.930);
1120     TGeoMixture *Rohacell = new TGeoMixture("ITSRohacell",6,1.930);
1121     TGeoMixture *Staselite = new TGeoMixture("ITSStaselite4411w",6,1.930);
1122     TGeoMixture *Air = new TGeoMixture("ITSAir",6,1.205*1.E-3);
1123     TGeoMixture *Stainless = new TGeoMixture("ITSStainless",6,1.930);
1124     //
1125     Double_t SSDcone[20];
1126     SSDcone[0] = 1.0; // imat
1127     SSDcone[1] = 0.0; // isvol
1128     SSDcone[2] = gAlice->Field()->Integ(); // ifield
1129     SSDcone[3] = gAlice->Field()->Max(); // fieldm
1130     SSDcone[4] = 1.0; // tmaxfd [degrees]
1131     SSDcone[5] = 1.0; // stemax [cm]
1132     SSDcone[6] = 0.5; // deemax [fraction]
1133     SSDcone[7] = 1.0E-3; // epsil [cm]
1134     SSDcone[8] = 0.0; // stmin [cm]
1135     new TGeoMedium("ITSssdCarbonFiber",1,Cfiber,SSDcone);
1136     SSDcone[0] += 1.0;
1137     new TGeoMedium("ITSssdStaselite4411w",2,Staselite,SSDcone);
1138     SSDcone[0] += 1.0;
1139     new TGeoMedium("ITSssdRohacell50A",3,Rohacell,SSDcone);
1140     SSDcone[0] += 1.0;
1141     new TGeoMedium("ITSssdStainlesSteal",4,Stainless,SSDcone);
1142     SSDcone[0] += 1.0;
1143     new TGeoMedium("ITSssdAir",5,Air,SSDcone);
1144     SSDcone[0] += 1.0;
1145     new TGeoMedium("ITSssdAl",6,Al,SSDcone);
1146 }
1147 //______________________________________________________________________
1148 void AliITSv11::InitAliITSgeom(){
1149     // Based on the geometry tree defined in Geant 3.21, this
1150     // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS 
1151     // geometry sturture.
1152     // Inputs:
1153     //   none.
1154     // Outputs:
1155     //   none.
1156     // Return
1157     //   none.
1158 }
1159 //______________________________________________________________________
1160 void AliITSv11::Init(){
1161     // Initialise the ITS after it has been created.
1162     // Inputs:
1163     //   none.
1164     // Outputs:
1165     //   none.
1166     // Return
1167     //   none.
1168 }
1169 //______________________________________________________________________
1170 void AliITSv11::SetDefaults(){
1171     // Sets the default segmentation, response, digit and raw cluster 
1172     // classes to be used. These defaults can be overwritten in the
1173     // macros that do these later steps. Defaults are give hear for the
1174     // general user.
1175     // Inputs:
1176     //   none.
1177     // Outputs:
1178     //   none.
1179     // Return
1180     //   none.
1181 }
1182 //______________________________________________________________________
1183 void AliITSv11::DrawModule(){
1184     // Draw a standard set of shaded view of the ITS version 11.
1185     // Inputs:
1186     //   none.
1187     // Outputs:
1188     //   none.
1189     // Return
1190     //   none.
1191 }
1192 //______________________________________________________________________
1193 void AliITSv11::StepManager(){
1194     // Called for every step in the ITS, then calles the AliITShit class
1195     // creator with the information to be recoreded about that hit.
1196     //  The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
1197     // printing of information to a file which can be used to create a .det
1198     // file read in by the routine CreateGeometry(). If set to 0 or any other
1199     // value except 1, the default behavior, then no such file is created nor
1200     // is the extra variables and the like used in the printing allocated.
1201 }
1202