]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11.cxx
Implementing of new function to check for holes (M.Ivanov)
[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 <TGeoVolume.h>
48 #include <TGeoPcon.h>
49 #include <TGeoCone.h>
50 #include <TGeoTube.h> // contaings TGeoTubeSeg
51 #include <TGeoArb8.h>
52 #include <TGeoCompositeShape.h>
53 #include <TGeoMatrix.h>
54 #include <TGeoNode.h>
55 #include <TGeoMaterial.h>
56 #include <TGeoMedium.h>
57 // General AliRoot includes
58 #include "AliRun.h"
59 #include "AliMagF.h"
60 #include "AliConst.h"
61 // ITS specific includes
62 #include "AliITShit.h"
63 #include "AliITSgeom.h"
64 #include "AliITSgeomSPD.h"
65 #include "AliITSgeomSDD.h"
66 #include "AliITSgeomSSD.h"
67 #include "AliITSDetType.h"
68 #include "AliITSresponseSPD.h"
69 #include "AliITSresponseSDD.h"
70 #include "AliITSresponseSSD.h"
71 #include "AliITSsegmentationSPD.h"
72 #include "AliITSsegmentationSDD.h"
73 #include "AliITSsegmentationSSD.h"
74 #include "AliITSsimulationSPD.h"
75 #include "AliITSsimulationSDD.h"
76 #include "AliITSsimulationSSD.h"
77 #include "AliITSClusterFinderSPD.h"
78 #include "AliITSClusterFinderSDD.h"
79 #include "AliITSClusterFinderSSD.h"
80 #include "AliITSBaseGeometry.h"
81 #include "AliITSv11.h"
82
83 // Units, Convert from k?? to cm,degree,GeV,seconds,
84 const Double_t kmm = 0.10; // Convert mm to TGeom's cm.
85 const Double_t kcm = 1.00; // Convert cv to TGeom's cm.
86 const Double_t kDegree = 1.0; // Convert degrees to TGeom's degrees
87 const Double_t kRadian = TMath::DegToRad(); // conver to Radians
88
89 #define SQ(A) ((A)*(A))
90
91 #define printArb8(A)  if(GetDebug()){\
92    cout << A->GetName() << ":"; \
93   for(Int_t iii=0;iii<8;iii+=2){ cout <<"("<<A->GetVertices()[iii]<<","     \
94                           <<A->GetVertices()[iii+1]<<","<<-A->GetDz()<<")";}\
95   for(Int_t iii=8;iii<16;iii+=2){ cout <<"("<<A->GetVertices()[iii]<<","     \
96                           <<A->GetVertices()[iii+1]<<","<<A->GetDz()<<")";}\
97    cout << endl; }
98
99 #define printPcon(A)  if(GetDebug()){\
100      cout << A->GetName() << ": N=" << A->GetNz() << " Phi1=" << A->GetPhi1() \
101           << ", Dphi=" << A->GetDphi() << endl;                              \
102      cout << "i\t   Z   \t  Rmin \t  Rmax" << endl;                          \
103      for(Int_t iii=0;iii<A->GetNz();iii++){                                 \
104          cout << iii << "\t" << A->GetZ(iii) << "\t" << A->GetRmin(iii)     \
105               << "\t" << A->GetRmax(iii) << endl;                           \
106      }} // end for iii
107
108 #define printTube(A)  if(GetDebug()){\
109    cout << A->GetName() <<": Rmin="<<A->GetRmin()\
110                           <<" Rmax=" <<A->GetRmax()<<" Dz="<<A->GetDz()<<endl;}
111
112 #define printTubeSeg(A)   if(GetDebug()){\
113     cout << A->GetName() <<": Phi1="<<A->GetPhi1()<< \
114                            " Phi2="<<A->GetPhi2()<<" Rmin="<<A->GetRmin()\
115                           <<" Rmax=" <<A->GetRmax()<<" Dz="<<A->GetDz()<<endl;}
116
117 #define printConeSeg(A)   if(GetDebug()){\
118     cout << A->GetName() <<": Phi1="<<A->GetPhi1()<< \
119                          " Phi2="<<A->GetPhi2()<<" Rmin1="<<A->GetRmin1()\
120                        <<" Rmax1=" <<A->GetRmax1()<<" Rmin2="<<A->GetRmin2()\
121                        <<" Rmax2=" <<A->GetRmax2()<<" Dz="<<A->GetDz()<<endl;}
122
123 #define printBBox(A)   if(GetDebug()){\
124     cout << A->GetName() <<": Dx="<<A->GetDX()<< \
125                            " Dy="<<A->GetDY()<<" Dz="<<A->GetDZ() <<endl;}
126
127 ClassImp(AliITSv11)
128
129 /*
130   Some temparary #define's used untill ROOT has addoppted the proper
131   Getter in it's classes.
132   These Below are for TGeoPcon functions.
133 */
134
135 //______________________________________________________________________
136 AliITSv11::AliITSv11() : AliITS() {
137     // Standard default constructor for the ITS version 11.
138     // Inputs:
139     //   none.
140     // Outputs:
141     //   none.
142     // Return
143     //   A default constructed AliITSv11 class.
144
145     //fITSV = 0;
146     //fcS = 0;
147 //   fcD = 0;
148 }
149 //______________________________________________________________________
150 AliITSv11::AliITSv11(const char *title) : AliITS("ITS", title){
151     // Standard constructor for the ITS version 11.
152     // Inputs:
153     //   const char *title  The title of for this geometry.
154     // Outputs:
155     //   none.
156     // Return
157     //   A Standard constructed AliITSv11 class.
158
159     //fITSV = 0;
160     //fcS = 0;
161 //    fcD = 0;
162 }
163 //______________________________________________________________________
164 AliITSv11::~AliITSv11() {
165     // Standard destructor for the ITS version 11.
166     // Inputs:
167     //   none.
168     // Outputs:
169     //   none.
170     // Return
171     //   none.
172
173 //    if(fITSV!=0) delete fITSV;
174 //    if(fcS!=0) delete fcS;
175 //    if(fcD!=0) delete fcD;
176 }
177 //______________________________________________________________________
178 AliITSv11::AliITSv11(const AliITSv11 &source) : AliITS(source){
179     //     Copy Constructor for ITS version 11.
180     // Inputs:
181     //   AliITSv11 &source  class to be copied from.
182     // Outputs:
183     //   none.
184     // Return
185     //   none.
186
187     if(&source == this) return;
188     Error("Copy Constructor","Not allowed to copy AliITSv11");
189     return;
190 }
191 //______________________________________________________________________
192 AliITSv11& AliITSv11::operator=(const AliITSv11 &source){
193     //    Assignment operator for the ITS version 11.
194     // Inputs:
195     //   AliITSv11 &source  class to be copied from.
196     // Outputs:
197     //   none.
198     // Return
199     //   none.
200
201     if(&source == this) return *this;
202     Error("= operator","Not allowed to copy AliITSv11");
203     return *this;
204 }
205 //______________________________________________________________________
206 void AliITSv11::BuildGeometry(){
207     // This routine defines and Creates the geometry for version 11 of 
208     // the ITS for use in the simulation display routines. This is a 
209     // very simplified geometry for speed of viewing.
210     // Inputs:
211     //   none.
212     // Outputs:
213     //   none.
214     // Return
215     //   none.
216     TVector3 t(0.0,0.0,0.0);
217
218     //if(fITSV==0) fITSV = new AliITSGeometryITSV(this,"ALIC");
219     //if(fcS==0) fcS = new AliITSGeometrySSDCone(this,t,"TSV",1);
220
221     //fcS->BuildDisplayGeometry();
222 }
223 //______________________________________________________________________
224 void AliITSv11::CreateGeometry(){
225     // This routine defines and Creates the geometry for version 11 of 
226     // the ITS. The geometry is used by the particle trasport routines,
227     // and therefore, is very detailed.
228     // Inputs:
229     //   none.
230     // Outputs:
231     //   none.
232     // Return
233     //   none.
234     TVector3 t(0.0,0.0,0.0);
235
236     TGeoManager *mgr = gGeoManager;
237     TGeoVolume *ALIC = mgr->GetTopVolume();
238
239     TGeoPcon *itsv = new TGeoPcon("ITS Top Volume, Daughter of ALIC",
240                                   0.0,360.0,2);
241     // DefineSection(section number, Z, Rmin, Rmax).
242     itsv->DefineSection(0,-300.0*kcm,0.01*kcm,50.0*kcm);
243     itsv->DefineSection(1,+300.0*kcm,0.01*kcm,50.0*kcm);
244     TGeoVolume *ITSV = new TGeoVolume("ITSV",itsv,0);
245     //mgr->AddVolume(ITSV);
246     ITSV->SetVisibility(kFALSE);
247     ALIC->AddNode(ITSV,1,0);
248     //
249     SPDCone(ITSV);
250     SDDCone(ITSV);
251     SSDCone(ITSV);
252     ServicesCableSupport(ITSV);
253 }
254 //______________________________________________________________________
255 Double_t AliITSv11::RmaxFrom2Points(TGeoPcon *p,Int_t i1,Int_t i2,Double_t z){
256     // functions Require at parts of Volume A to be already defined.
257     // Retruns the value of Rmax corresponding to point z alone the line
258     // defined by the two points p.Rmax(i1),p-GetZ(i1) and p->GetRmax(i2),
259     // p->GetZ(i2).
260
261     return p->GetRmax(i2)+(p->GetRmax(i1)-p->GetRmax(i2))*(z-p->GetZ(i2))/
262      (p->GetZ(i1)-p->GetZ(i2));
263 }
264 //______________________________________________________________________
265 Double_t AliITSv11::RminFrom2Points(TGeoPcon *p,Int_t i1,Int_t i2,Double_t z){
266     // Retruns the value of Rmin corresponding to point z alone the line
267     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and 
268     // p->GetRmin(i2),  p->GetZ(i2).
269
270     return p->GetRmin(i2)+(p->GetRmin(i1)-p->GetRmin(i2))*(z-p->GetZ(i2))/
271      (p->GetZ(i1)-p->GetZ(i2));
272 }
273 //______________________________________________________________________
274 Double_t AliITSv11::RFrom2Points(Double_t *p,Double_t *Z,Int_t i1,
275                                  Int_t i2,Double_t z){
276     // Retruns the value of Rmin corresponding to point z alone the line
277     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and 
278     // p->GetRmin(i2), p->GetZ(i2).
279
280     return p[i2]+(p[i1]-p[i2])*(z-Z[i2])/(Z[i1]-Z[i2]);
281 }
282 //______________________________________________________________________
283 Double_t AliITSv11::Zfrom2MinPoints(TGeoPcon *p,Int_t i1,Int_t i2,Double_t r){
284     // Retruns the value of Z corresponding to point R alone the line
285     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and 
286     // p->GetRmin(i2),p->GetZ(i2)
287
288     return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmin(i2))/
289      (p->GetRmin(i1)-p->GetRmin(i2));
290 }
291 //______________________________________________________________________
292 Double_t AliITSv11::Zfrom2MaxPoints(TGeoPcon *p,Int_t i1,Int_t i2,Double_t r){
293     // Retruns the value of Z corresponding to point R alone the line
294     // defined by the two points p->GetRmax(i1),p->GetZ(i1) and 
295     // p->GetRmax(i2),p->GetZ(i2)
296
297     return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmax(i2))/
298      (p->GetRmax(i1)-p->GetRmax(i2));
299 }
300 //______________________________________________________________________
301 Double_t AliITSv11::Zfrom2Points(Double_t *Z,Double_t *p,Int_t i1,
302                                  Int_t i2,Double_t r){
303     // Retruns the value of Z corresponding to point R alone the line
304     // defined by the two points p->GetRmax(i1),p->GetZ(i1) and 
305     // p->GetRmax(i2),p->GetZ(i2)
306
307     return Z[i2]+(Z[i1]-Z[i2])*(r-p[i2])/(p[i1]-p[i2]);
308 }
309 //______________________________________________________________________
310 Double_t AliITSv11::RmaxFromZpCone(TGeoPcon *p,Double_t tc,Double_t z,
311                                    Double_t th){
312     // General SSD Outer Cone surface equation Rmax.
313     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
314     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
315
316     return -tantc*(z-p->GetZ(4))+p->GetRmax(4)+th/costc;
317 }
318 //______________________________________________________________________
319 Double_t AliITSv11::RmaxFromZpCone(Double_t *GetRmax,Double_t *GetZ,
320                                    Double_t tc,Double_t z,Double_t th){
321     // General SSD Outer Cone surface equation Rmax.
322     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
323     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
324
325     return -tantc*(z-GetZ[4])+GetRmax[4]+th/costc;
326 }
327 //______________________________________________________________________
328 Double_t AliITSv11::RminFromZpCone(TGeoPcon *p,Double_t tc,Double_t z,
329                                    Double_t th){
330     // General SSD Inner Cone surface equation Rmin.
331     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
332     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
333
334     return -tantc*(z-p->GetZ(3))+p->GetRmin(3)+th/costc;
335 }
336 //______________________________________________________________________
337 Double_t AliITSv11::RminFromZpCone(Double_t *GetRmin,Double_t *GetZ,
338                                    Double_t tc,Double_t z,Double_t th){
339     // General SSD Inner Cone surface equation Rmin.
340     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
341     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
342
343     return -tantc*(z-GetZ[3])+GetRmin[3]+th/costc;
344 }
345 //______________________________________________________________________
346 Double_t AliITSv11::ZFromRmaxpCone(TGeoPcon *p,Double_t tc,Double_t r,
347                                    Double_t th){
348     // General SSD Outer cone Surface equation for z.
349     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
350     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
351
352     return p->GetZ(4)+(p->GetRmax(4)+th/costc-r)/tantc;
353 }
354 //______________________________________________________________________
355 Double_t AliITSv11::ZFromRmaxpCone(Double_t *GetRmax,Double_t *GetZ,
356                                    Double_t tc,Double_t r,Double_t th){
357     // General SSD Outer cone Surface equation for z.
358     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
359     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
360
361     return GetZ[4]+(GetRmax[4]+th/costc-r)/tantc;
362 }
363 //______________________________________________________________________
364 Double_t AliITSv11::ZFromRminpCone(TGeoPcon *p,Double_t tc,Double_t r,
365                                    Double_t th){
366     // General SSD Inner cone Surface equation for z.
367     Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
368     Double_t costc = TMath::Cos(tc*TMath::DegToRad());
369
370     return p->GetZ(3)+(p->GetRmin(3)+th/costc-r)/tantc;
371 }
372 //______________________________________________________________________
373 void AliITSv11::RadiusOfCurvature(Double_t rc,Double_t theta0,Double_t z0,
374                  Double_t r0,Double_t theta1,Double_t &z1,
375                  Double_t &r1){
376     // Given a initial point z0,r0, the initial angle theta0, and the radius
377     // of curvature, returns the point z1, r1 at the angle theta1. Theta
378     // measured from the r axis in the clock wise direction [degrees].
379     Double_t sin0 = TMath::Sin(theta0*TMath::DegToRad());
380     Double_t cos0 = TMath::Cos(theta0*TMath::DegToRad());
381     Double_t sin1 = TMath::Sin(theta1*TMath::DegToRad());
382     Double_t cos1 = TMath::Cos(theta1*TMath::DegToRad());
383
384     z1 = rc*(sin1-sin0)+z0;
385     r1 = rc*(cos1-cos0)+r0;
386     return;
387 }
388 //______________________________________________________________________
389 void AliITSv11::SPDCone(TGeoVolume *Moth){
390     // Define the detail SPD support cone geometry.
391     // Inputs:
392     //   none.
393     // Outputs:
394     //  none.
395     // Return:
396     //  none.
397
398     SPDThermalSheald(Moth);
399 }
400 //______________________________________________________________________
401 void AliITSv11::SPDThermalSheald(TGeoVolume *Moth){
402     // Define the detail SPD Thermal Sheld geometry.
403     // Inputs:
404     //   none.
405     // Outputs:
406     //  none.
407     // Return:
408     //  none.
409     // From ALICE-Thermal Screen (SPD) "Cylinder" file thermal-screen2_a3.ps
410     // Volumes A1,A2,A2,Ah1,Ah2,Ah3, and B1,B2,B3,Bh1,Bh2,Bh3;
411     // "CONE TRANSITION" file thermal-screen1_a3.ps Volumes C1,C2,C3,Ch1,Ch2,
412     // Ch3; "FLANGE" file thermal-screen4_a3.ps Volumes D,Ds,Dw,Dws; and 
413     // "HALF ASSEMBLY" file thermal-screen3_a3.ps. This object, both halfs,
414     // are incased inside of a single minimum sized mother volume called M,
415     // which is a union of two parts M1 and 4 copies of M2.
416     const Double_t TSCarbonFiberThA = 0.03*kmm; // 
417     //const Double_t TSCarbonFiberThB = 0.10*kmm; //
418     const Double_t TSCLengthB  = 50.0*kmm; //
419     const Double_t TSCLengthA  = 900.0*kmm-2.0*TSCLengthB; //
420     const Double_t TSCLengthC  = 290.0*kmm; //
421     const Double_t TSCLengthD  = 15.0*kmm; //
422     const Double_t TSCAngle    = 36.0*kDegree;//Rep. angle of cent. accordin
423     const Double_t TSCRoutA    = 99.255*kmm; // Outer radii
424     const Double_t TSCRinA     = 81.475*kmm; // Iner radii
425     const Double_t TSCRoutB    = 99.955*kmm; // Outer radii
426     const Double_t TSCRinB     = 80.775*kmm; // Iner radii
427     const Double_t TSCRoutCp   = 390.0*kmm;  // Outer radii
428     const Double_t TSCRinCp    = 373.0*kmm;  // Iner radii
429     Double_t TSCRoutC,TSCRinC; // values need to be calculated
430     const Double_t TSCRwingD   = 492.5*kmm;  // Outer radii
431     const Double_t TSCRoutD    = 0.5*840.*kmm;// Outer radii
432     const Double_t TSCRinD     = 373.0*kmm;  // Iner radii
433     const Double_t TSCAngleDD  = 60.*kmm/TSCRwingD/kRadian;//angular wing width
434     //angular wing width of fill material
435     const Double_t TSCAngleDDs = (60.*kmm-2.*TSCarbonFiberThA)/TSCRwingD/kRadian;
436     const Double_t TSCAngleD0  = 45.*kDegree;//Strting angle of wing
437     const Double_t TSCoutSA    = 24.372*kmm; // The other one Calculated
438     const Double_t TSCinLA     = 31.674*kmm; // The ohter one Calculated
439     const Double_t TSCoutSB    = 24.596*kmm; // The other one Calculated
440     const Double_t TSCinLB     = 31.453*kmm; // The ohter one Calculated
441     const Double_t TSCoutSC    = 148.831*kmm;// The other one Calculated
442     const Double_t TSCinLC     = 90.915*kmm; // The ohter one Calculated
443     Int_t i,k;
444     Double_t th;
445     Double_t xo[7],yo[7],xi[7],yi[7];
446     Double_t xbo[7],ybo[7],xbi[7],ybi[7];
447     Double_t xco[7],yco[7],xci[7],yci[7];
448     TGeoArb8 *A1,*A2,*A3,*Ah1,*Ah2,*Ah3,*B1,*B2,*B3,*Bh1,*Bh2,*Bh3;
449     TGeoArb8 *C1,*C2,*C3,*Ch1,*Ch2,*Ch3;
450     TGeoTube  *D,*Ds;
451     TGeoTubeSeg *Dw,*Dws,*M2;
452     TGeoPcon *M1;
453     TGeoCompositeShape *M;
454     TGeoRotation *rot;
455     TGeoTranslation *tranb,*tranbm,*tranc;
456     TGeoTranslation *tranITSspdShealdVVt0;
457     TGeoCombiTrans *rotITSspdShealdVVt1,*rotITSspdShealdVVt2;
458     TGeoCombiTrans *rotITSspdShealdVVt3;
459     TGeoMedium *SPDcf  = 0; // SPD support cone Carbon Fiber materal number.
460     TGeoMedium *SPDfs  = 0; // SPD support cone inserto stesalite 4411w.
461     TGeoMedium *SPDfo  = 0; // SPD support cone foam, Rohacell 50A.
462     TGeoMedium *SPDss  = 0; // SPD support cone screw material,Stainless steal
463     TGeoMedium *SPDair = 0; // SPD support cone Air
464     //TGeoMedium *SPDal  = 0; // SPD support cone SDD mounting bracket Al
465
466     TSCRoutC = TMath::Sqrt(TSCRoutCp*TSCRoutCp-0.25*TSCoutSC*TSCoutSC);
467     TSCRinC  = TMath::Sqrt(TSCRinCp *TSCRinCp -0.25*TSCinLC *TSCinLC );
468     A1  = new TGeoArb8("ITS SPD Therm Screen Clyinder A1",0.5*TSCLengthA);
469     A2  = new TGeoArb8("ITS SPD Therm Screen Clyinder A2",0.5*TSCLengthA);
470     A3  = new TGeoArb8("ITS SPD Therm Screen Clyinder A3",0.5*TSCLengthA);
471     Ah1 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ah1",0.5*TSCLengthA);
472     Ah2 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ah2",0.5*TSCLengthA);
473     Ah3 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ah3",0.5*TSCLengthA);
474     B1  = new TGeoArb8("ITS SPD Therm Screen Clyinder B1",0.5*TSCLengthB);
475     B2  = new TGeoArb8("ITS SPD Therm Screen Clyinder B2",0.5*TSCLengthB);
476     B3  = new TGeoArb8("ITS SPD Therm Screen Clyinder B3",0.5*TSCLengthB);
477     Bh1 = new TGeoArb8("ITS SPD Therm Screen Cylinder Bh1",0.5*TSCLengthB);
478     Bh2 = new TGeoArb8("ITS SPD Therm Screen Cylinder Bh2",0.5*TSCLengthB);
479     Bh3 = new TGeoArb8("ITS SPD Therm Screen Cylinder Bh3",0.5*TSCLengthB);
480     C1  = new TGeoArb8("ITS SPD Therm Screen Clyinder C1",0.5*TSCLengthC);
481     C2  = new TGeoArb8("ITS SPD Therm Screen Clyinder C2",0.5*TSCLengthC);
482     C3  = new TGeoArb8("ITS SPD Therm Screen Clyinder C3",0.5*TSCLengthC);
483     Ch1 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ch1",0.5*TSCLengthC);
484     Ch2 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ch2",0.5*TSCLengthC);
485     Ch3 = new TGeoArb8("ITS SPD Therm Screen Cylinder Ch3",0.5*TSCLengthC);
486     D = new TGeoTube("ITS SPD Therm Screen Flange D",TSCRinD,TSCRoutD,
487                     0.5*TSCLengthD);
488     Ds = new TGeoTube("ITS SPD Therm Screen Flange fill Ds",
489                       TSCRinD+TSCarbonFiberThA,TSCRoutD-TSCarbonFiberThA,
490                       0.5*TSCLengthD);
491     printTube(D);
492     printTube(Ds);
493     Dw = new TGeoTubeSeg("ITS SPD Therm Screen Flange Wing Dw",
494                          TSCRoutD,TSCRwingD ,0.5*TSCLengthD,
495                          TSCAngleD0-0.5*TSCAngleDD,TSCAngleD0+0.5*TSCAngleDD);
496     Dws = new TGeoTubeSeg("ITS SPD Therm Screen Flange Wing Fill Ds",
497                           TSCRoutD,TSCRwingD-TSCarbonFiberThA,
498                           0.5*TSCLengthD,TSCAngleD0-0.5*TSCAngleDDs,
499                           TSCAngleD0+0.5*TSCAngleDDs);
500     printTubeSeg(Dw);
501     printTubeSeg(Dws);
502     k = 0;
503     for(i=-1;i<2;i++){
504       th = ((Double_t)(i+1))*TSCAngle*kRadian;
505       xo[k] = TSCRoutA*TMath::Sin(th) - 0.5*TSCoutSA*TMath::Cos(th);
506       yo[k] = TSCRoutA*TMath::Cos(th) + 0.5*TSCoutSA*TMath::Sin(th);
507       xi[k] = TSCRinA *TMath::Sin(th) - 0.5*TSCinLA *TMath::Cos(th);
508       yi[k] = TSCRinA *TMath::Cos(th) + 0.5*TSCinLA *TMath::Sin(th);
509       xbo[k] = TSCRoutB*TMath::Sin(th) - 0.5*TSCoutSB*TMath::Cos(th);
510       ybo[k] = TSCRoutB*TMath::Cos(th) + 0.5*TSCoutSB*TMath::Sin(th);
511       xbi[k] = TSCRinB *TMath::Sin(th) - 0.5*TSCinLB *TMath::Cos(th);
512       ybi[k] = TSCRinB *TMath::Cos(th) + 0.5*TSCinLB *TMath::Sin(th);
513       xco[k] = TSCRoutC*TMath::Sin(th) - 0.5*TSCoutSC*TMath::Cos(th);
514       yco[k] = TSCRoutC*TMath::Cos(th) + 0.5*TSCoutSC*TMath::Sin(th);
515       xci[k] = TSCRinC *TMath::Sin(th) - 0.5*TSCinLC *TMath::Cos(th);
516       yci[k] = TSCRinC *TMath::Cos(th) + 0.5*TSCinLC *TMath::Sin(th);
517       k++;
518       xo[k] = TSCRoutA*TMath::Sin(th) + 0.5*TSCoutSA*TMath::Cos(th);
519       yo[k] = TSCRoutA*TMath::Cos(th) - 0.5*TSCoutSA*TMath::Sin(th);
520       xi[k] = TSCRinA *TMath::Sin(th) + 0.5*TSCinLA *TMath::Cos(th);
521       yi[k] = TSCRinA *TMath::Cos(th) - 0.5*TSCinLA *TMath::Sin(th);
522       xbo[k] = TSCRoutB*TMath::Sin(th) + 0.5*TSCoutSB*TMath::Cos(th);
523       ybo[k] = TSCRoutB*TMath::Cos(th) - 0.5*TSCoutSB*TMath::Sin(th);
524       xbi[k] = TSCRinB *TMath::Sin(th) + 0.5*TSCinLB *TMath::Cos(th);
525       ybi[k] = TSCRinB *TMath::Cos(th) - 0.5*TSCinLB *TMath::Sin(th);
526       xco[k] = TSCRoutC*TMath::Sin(th) + 0.5*TSCoutSC*TMath::Cos(th);
527       yco[k] = TSCRoutC*TMath::Cos(th) - 0.5*TSCoutSC*TMath::Sin(th);
528       xci[k] = TSCRinC *TMath::Sin(th) + 0.5*TSCinLC *TMath::Cos(th);
529       yci[k] = TSCRinC *TMath::Cos(th) - 0.5*TSCinLC *TMath::Sin(th);
530       k++;
531     } // end for i
532     xo[6] = xo[5];
533     yo[6] = 0.0;
534     xi[6] = xi[5];
535     yi[6] = 0.0;
536     xbo[6] = xbo[5];
537     ybo[6] = 0.0;
538     xbi[6] = xbi[5];
539     ybi[6] = 0.0;
540     xco[6] = xco[5];
541     yco[6] = 0.0;
542     xci[6] = xci[5];
543     yci[6] = 0.0;
544     if(GetDebug()){
545     cout.precision(4);
546     cout.width(7);
547     cout <<"i     \t  xo  yo    \t  xi yi     \t  xbo ybo   \t   xbi ybi  "
548         "\t   xco yco   \t   xci yxi"<<endl;
549     for(i=0;i<7;i++){
550         cout << i <<"\t"<<xo[i]<<","<<yo[i];
551         cout      <<"\t"<<xi[i]<<","<<yi[i];
552         cout      <<"\t"<<xbo[i]<<","<<ybo[i];
553         cout      <<"\t"<<xbi[i]<<","<<ybi[i];
554         cout      <<"\t"<<xco[i]<<","<<yco[i];
555         cout      <<"\t"<<xci[i]<<","<<yci[i];
556         cout<<endl;}
557     } // end if GetDebug()
558     //+++++++++++++++++++++++++
559     A1->SetVertex(0,xo[0],yo[0]);
560     A1->SetVertex(1,xo[1],yo[1]);
561     A1->SetVertex(2,xi[1],yi[1]);
562     A1->SetVertex(3,xi[0],yi[0]);
563     //
564     A2->SetVertex(0,xo[1],yo[1]);
565     A2->SetVertex(1,xo[2],yo[2]);
566     A2->SetVertex(2,xi[2],yi[2]);
567     A2->SetVertex(3,xi[1],yi[1]);
568     //
569     A3->SetVertex(0,xo[5],yo[5]);
570     A3->SetVertex(1,xo[6],yo[6]);
571     A3->SetVertex(2,xi[6],yi[6]);
572     A3->SetVertex(3,xi[5],yi[5]);
573     //--------------------------
574     B1->SetVertex(0,xbo[0],ybo[0]);
575     B1->SetVertex(1,xbo[1],ybo[1]);
576     B1->SetVertex(2,xbi[1],ybi[1]);
577     B1->SetVertex(3,xbi[0],ybi[0]);
578     //
579     B2->SetVertex(0,xbo[1],ybo[1]);
580     B2->SetVertex(1,xbo[2],ybo[2]);
581     B2->SetVertex(2,xbi[2],ybi[2]);
582     B2->SetVertex(3,xbi[1],ybi[1]);
583     //
584     B3->SetVertex(0,xbo[5],ybo[5]);
585     B3->SetVertex(1,xbo[6],ybo[6]);
586     B3->SetVertex(2,xbi[6],ybi[6]);
587     B3->SetVertex(3,xbi[5],ybi[5]);
588     //--------------------------
589     C1->SetVertex(0,xco[0],yco[0]);
590     C1->SetVertex(1,xco[1],yco[1]);
591     C1->SetVertex(2,xci[1],yci[1]);
592     C1->SetVertex(3,xci[0],yci[0]);
593     //
594     C2->SetVertex(0,xco[1],yco[1]);
595     C2->SetVertex(1,xco[2],yco[2]);
596     C2->SetVertex(2,xci[2],yci[2]);
597     C2->SetVertex(3,xci[1],yci[1]);
598     //
599     C3->SetVertex(0,xco[5],yco[5]);
600     C3->SetVertex(1,xco[6],yco[6]);
601     C3->SetVertex(2,xci[6],yci[6]);
602     C3->SetVertex(3,xci[5],yci[5]);
603     // Defining the hole, filled with air
604     Double_t p1,c1,x,y,x7[3],y7[3];
605     p1 = (xo[0]-xi[0])/(yo[0]-yi[0]);
606     c1 = xo[0]+0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xo[0]-xi[0])+
607                                                 SQ(yo[0]-yi[0]))/(xo[0]-xi[0]);
608     y = TSCRoutA-2.*TSCarbonFiberThA;
609     x = p1*(y-yo[0])+c1;
610     Ah1->SetVertex(0,x,y);
611     Bh1->SetVertex(0,x,y);
612     Ch1->SetVertex(4,x,y);
613     y = TSCRinA+TSCarbonFiberThA;
614     x = p1*(y-yo[0])+c1;
615     Ah1->SetVertex(3,x,y);
616     Bh1->SetVertex(3,x,y);
617     x7[0] = x; y7[0] = y; // vortexing done after last point
618     //Ch1->SetVertex(7,x,y);
619     p1 = (xo[1]-xi[1])/(yo[1]-yi[1]);
620     c1 = xo[1]-0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xo[1]-xi[1])+
621                                                 SQ(yo[1]-yi[1]))/(xo[1]-xi[1]);
622     y = TSCRoutA-2.*TSCarbonFiberThA;
623     x = p1*(y-yo[1])+c1;
624     Ah1->SetVertex(1,x,y);
625     Bh1->SetVertex(1,x,y);
626     Ch1->SetVertex(5,x,y);
627     y = TSCRinA+TSCarbonFiberThA;
628     x = p1*(y-yo[1])+c1;
629     Ah1->SetVertex(2,x,y);
630     Bh1->SetVertex(2,x,y);
631     Ch1->SetVertex(6,x,y);
632     //
633     // The easist way to get the points for the hole in volume A2 is to
634     // rotate it to the Y axis where the y coordinates are easier to know
635     // and then rotate it back.
636     Double_t xp,yp,xa,ya,xb,yb;
637     th = 0.5*TSCAngle*kRadian;
638     xa = TMath::Cos(th)*xo[1]-TMath::Sin(th)*yo[1];
639     ya = TMath::Sin(th)*xo[1]+TMath::Cos(th)*yo[1];
640     xb = TMath::Cos(th)*xi[1]-TMath::Sin(th)*yi[1];
641     yb = TMath::Sin(th)*xi[1]+TMath::Cos(th)*yi[1];
642     p1 = (xa-xb)/(ya-yb);
643     c1 = xa+0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
644     y = ya-TSCarbonFiberThA;
645     x = p1*(y-ya)+c1;
646     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
647     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
648     Ah2->SetVertex(0,xp,yp);
649     Bh2->SetVertex(0,xp,yp);
650     Ch2->SetVertex(4,xp,yp);
651     y = yb+2.0*TSCarbonFiberThA;
652     x = p1*(y-ya)+c1;
653     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
654     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
655     Ah2->SetVertex(3,xp,yp);
656     Bh2->SetVertex(3,xp,yp);
657     x7[1] = x; y7[1] = y; // vortexing done after last point
658     //Ch2->SetVertex(7,xp,yp);
659     xa = TMath::Cos(th)*xo[2]-TMath::Sin(th)*yo[2];
660     ya = TMath::Sin(th)*xo[2]+TMath::Cos(th)*yo[2];
661     xb = TMath::Cos(th)*xi[2]-TMath::Sin(th)*yi[2];
662     yb = TMath::Sin(th)*xi[2]+TMath::Cos(th)*yi[2];
663     p1 = (xa-xb)/(ya-yb);
664     c1 = xa-0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
665     y = ya-TSCarbonFiberThA;
666     x = p1*(y-ya)+c1;
667     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
668     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
669     Ah2->SetVertex(1,xp,yp);
670     Bh2->SetVertex(1,xp,yp);
671     Ch2->SetVertex(5,xp,yp);
672     y = yb+2.0*TSCarbonFiberThA;
673     x = p1*(y-ya)+c1;
674     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
675     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
676     Ah2->SetVertex(2,xp,yp);
677     Bh2->SetVertex(2,xp,yp);
678     Ch2->SetVertex(6,xp,yp);
679     //
680     p1 = (yo[5]-yi[5])/(xo[5]-xi[5]);
681     c1 = yo[5]+0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(yo[5]-yi[5])+
682                                                 SQ(xo[5]-xi[5]))/(yo[5]-yi[5]);
683     x = xo[5]-TSCarbonFiberThA;
684     y = p1*(x-xo[5])+c1;
685     Ah3->SetVertex(0,x,y);
686     Bh3->SetVertex(0,x,y);
687     Ch3->SetVertex(4,x,y);
688     x = xi[5]+2.0*TSCarbonFiberThA;
689     y = p1*(x-xo[5])+c1;
690     Ah3->SetVertex(3,x,y);
691     Bh3->SetVertex(3,x,y);
692     x7[2] = x; y7[2] = y; // vortexing done after last point
693     //Ch3->SetVertex(7,x,y);
694     y = 2.0*TSCarbonFiberThA;
695     x = xo[5]-TSCarbonFiberThA;
696     Ah3->SetVertex(1,x,y);
697     Bh3->SetVertex(1,x,y);
698     Ch3->SetVertex(5,x,y);
699     y = 2.0*TSCarbonFiberThA;
700     x = xi[5]+2.0*TSCarbonFiberThA;
701     Ah3->SetVertex(2,x,y);
702     Bh3->SetVertex(2,x,y);
703     Ch3->SetVertex(6,x,y);
704     //
705     for(i=0;i<4;i++){ // define points at +dz
706       A1->SetVertex(i+4,(A1->GetVertices())[2*i],(A1->GetVertices())[1+2*i]);
707       A2->SetVertex(i+4,(A2->GetVertices())[2*i],(A2->GetVertices())[1+2*i]);
708       A3->SetVertex(i+4,(A3->GetVertices())[2*i],(A3->GetVertices())[1+2*i]);
709       //
710       B1->SetVertex(i+4,(B1->GetVertices())[2*i],(B1->GetVertices())[1+2*i]);
711       B2->SetVertex(i+4,(B2->GetVertices())[2*i],(B2->GetVertices())[1+2*i]);
712       B3->SetVertex(i+4,(B3->GetVertices())[2*i],(B3->GetVertices())[1+2*i]);
713       // C's are a cone which must match up with B's.
714       C1->SetVertex(i+4,(B1->GetVertices())[2*i],(B1->GetVertices())[1+2*i]);
715       C2->SetVertex(i+4,(B2->GetVertices())[2*i],(B2->GetVertices())[1+2*i]);
716       C3->SetVertex(i+4,(B3->GetVertices())[2*i],(B3->GetVertices())[1+2*i]);
717       //
718       Ah1->SetVertex(i+4,(Ah1->GetVertices())[2*i],
719                          (Ah1->GetVertices())[1+2*i]);
720       Ah2->SetVertex(i+4,(Ah2->GetVertices())[2*i],
721                          (Ah2->GetVertices())[1+2*i]);
722       Ah3->SetVertex(i+4,(Ah3->GetVertices())[2*i],
723                          (Ah3->GetVertices())[1+2*i]);
724       //
725       Bh1->SetVertex(i+4,(Bh1->GetVertices())[2*i],
726                          (Bh1->GetVertices())[1+2*i]);
727       Bh2->SetVertex(i+4,(Bh2->GetVertices())[2*i],
728                          (Bh2->GetVertices())[1+2*i]);
729       Bh3->SetVertex(i+4,(Bh3->GetVertices())[2*i],
730                          (Bh3->GetVertices())[1+2*i]);
731     } // end for
732     //
733     p1 = (xco[0]-xci[0])/(yco[0]-yci[0]);
734     c1 = xco[0]+0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xco[0]-xci[0])+
735                                            SQ(yco[0]-yci[0]))/(xco[0]-xci[0]);
736     y = TSCRoutC-2.*TSCarbonFiberThA;
737     x = p1*(y-yco[0])+c1;
738     Ch1->SetVertex(0,x,y);
739     y = TSCRinC+TSCarbonFiberThA;
740     x = p1*(y-yci[0])+c1;
741     Ch1->SetVertex(2,x,y);
742     p1 = (xco[1]-xci[1])/(yco[1]-yci[1]);
743     c1 = xco[1]-0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xco[1]-xci[1])+
744                                            SQ(yco[1]-yci[1]))/(xco[1]-xci[1]);
745     y = TSCRoutC-2.*TSCarbonFiberThA;
746     x = p1*(y-yco[1])+c1;
747     Ch1->SetVertex(1,x,y);
748     y = TSCRinC+TSCarbonFiberThA;
749     x = p1*(y-yci[1])+c1;
750     Ch1->SetVertex(3,x,y);
751     //
752     th = 0.5*TSCAngle*kRadian;
753     xa = TMath::Cos(th)*xco[1]-TMath::Sin(th)*yco[1];
754     ya = TMath::Sin(th)*xco[1]+TMath::Cos(th)*yco[1];
755     xb = TMath::Cos(th)*xci[1]-TMath::Sin(th)*yci[1];
756     yb = TMath::Sin(th)*xci[1]+TMath::Cos(th)*yci[1];
757     p1 = (xa-xb)/(ya-yb);
758     c1 = xa+0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
759     y = ya-TSCarbonFiberThA;
760     x = p1*(y-ya)+c1;
761     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
762     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
763     yp = ya-TSCarbonFiberThA;
764     xp = p1*(y-ya)+c1;
765     Ch2->SetVertex(0,xp,yp);
766     y = yb+2.0*TSCarbonFiberThA;
767     x = p1*(y-ya)+c1;
768     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
769     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
770     Ch2->SetVertex(2,xp,yp);
771     xa = TMath::Cos(th)*xco[2]-TMath::Sin(th)*yco[2];
772     ya = TMath::Sin(th)*xco[2]+TMath::Cos(th)*yco[2];
773     xb = TMath::Cos(th)*xci[2]-TMath::Sin(th)*yci[2];
774     yb = TMath::Sin(th)*xci[2]+TMath::Cos(th)*yci[2];
775     p1 = (xa-xb)/(ya-yb);
776     c1 = xa-0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(xa-xb)+SQ(ya-yb))/(xa-xb);
777     y = ya-TSCarbonFiberThA;
778     x = p1*(y-ya)+c1;
779     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
780     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
781     Ch2->SetVertex(1,xp,yp);
782     y = yb+2.0*TSCarbonFiberThA;
783     x = p1*(y-ya)+c1;
784     xp = TMath::Cos(-th)*x-TMath::Sin(-th)*y;
785     yp = TMath::Sin(-th)*x+TMath::Cos(-th)*y;
786     Ch2->SetVertex(3,xp,yp);
787     //
788     p1 = (yco[5]-yci[5])/(xco[5]-xci[5]);
789     c1 = yco[5]+0.5*TSCarbonFiberThA*TMath::Sqrt(SQ(yco[5]-yci[5])+
790                                           SQ(xco[5]-xci[5]))/(yco[5]-yci[5]);
791     x = xco[5]-TSCarbonFiberThA;
792     y = p1*(x-xco[5])+c1;
793     Ch3->SetVertex(0,x,y);
794     x = xci[5]+2.0*TSCarbonFiberThA;
795     y = p1*(x-xci[5])+c1;
796     Ch3->SetVertex(2,x,y);
797     y = 2.0*TSCarbonFiberThA;
798     x = xco[5]-TSCarbonFiberThA;
799     Ch3->SetVertex(1,x,y);
800     y = 2.0*TSCarbonFiberThA;
801     x = xci[5]+2.0*TSCarbonFiberThA;
802     Ch3->SetVertex(3,x,y);
803     Ch1->SetVertex(7,x7[0],y7[0]); // 7th point most be done last ???
804     Ch2->SetVertex(7,x7[1],y7[1]); // 7th point most be done last ???
805     Ch3->SetVertex(7,x7[2],y7[2]); // 7th point most be done last ???
806     printArb8(A1);
807     printArb8(Ah1);
808     printArb8(A2);
809     printArb8(Ah2);
810     printArb8(A3);
811     printArb8(Ah3);
812     printArb8(B1);
813     printArb8(Bh1);
814     printArb8(B2);
815     printArb8(Bh2);
816     printArb8(B3);
817     printArb8(Bh3);
818     printArb8(C1);
819     printArb8(Ch1);
820     printArb8(C2);
821     printArb8(Ch2);
822     printArb8(C3);
823     printArb8(Ch3);
824     //
825     // Define Minimal volume to inclose this SPD Thermal Sheald.
826     M1 = new TGeoPcon("ITSspdShealdVV",0.0,360.0,9);
827     M1->Z(0)    = 0.5*TSCLengthA+TSCLengthB;
828     M1->Rmin(0) = TSCRinB;
829     x = B1->GetVertices()[0]; // [0][0]
830     y = B1->GetVertices()[1]; // [0][1]
831     M1->Rmax(0) = TMath::Sqrt(x*x+y*y);
832     M1->Z(1)    = M1->GetZ(0)-TSCLengthB;
833     M1->Rmin(1) = M1->GetRmin(0);
834     M1->Rmax(1) = M1->GetRmax(0);
835     M1->Z(2)    = M1->GetZ(1);
836     M1->Rmin(2) = TSCRinA;
837     x = A1->GetVertices()[0]; // [0]0]
838     y = A1->GetVertices()[1]; // [0][1]
839     M1->Rmax(2) = TMath::Sqrt(x*x+y*y);
840     M1->Z(3)    = -(M1->GetZ(0)-TSCLengthB);
841     M1->Rmin(3) = M1->GetRmin(2);
842     M1->Rmax(3) = M1->GetRmax(2);
843     M1->Z(4)    = M1->GetZ(3);
844     M1->Rmin(4) = M1->GetRmin(1);
845     M1->Rmax(4) = M1->GetRmax(1);
846     M1->Z(5)    = -(M1->GetZ(0));
847     M1->Rmin(5) = M1->GetRmin(0);
848     M1->Rmax(5) = M1->GetRmax(0);
849     M1->Z(6)    = M1->GetZ(5) - TSCLengthC;
850     M1->Rmin(6) = TSCRinC;
851     x = C1->GetVertices()[0]; // [0][0]
852     y = C1->GetVertices()[1]; // [0][1]
853     M1->Rmax(6) = TMath::Sqrt(x*x+y*y);
854     M1->Z(7)    = M1->GetZ(6);
855     M1->Rmin(7) = D->GetRmin();
856     M1->Rmax(7) = D->GetRmax();
857     M1->Z(8)    = M1->Z(7) - TSCLengthD;
858     M1->Rmin(8) = M1->GetRmin(7);
859     M1->Rmax(8) = M1->GetRmax(7);
860     M2 = new TGeoTubeSeg("ITSspdShealdWingVV",
861          M1->GetRmax(8),Dw->GetRmax(),Dw->GetDz(),Dw->GetPhi1(),Dw->GetPhi2());
862     printTubeSeg(M2);
863     //
864     x = 0.5*(M1->GetZ(8) + M1->GetZ(7));
865     tranITSspdShealdVVt0 = new TGeoTranslation("ITSspdShealdVVt0",0.0,0.0,x);
866     tranITSspdShealdVVt0->RegisterYourself();
867     TGeoRotation rotz90("",0.0,0.0,90.0); // never registered.
868     rotITSspdShealdVVt1 = new TGeoCombiTrans(*tranITSspdShealdVVt0,rotz90);
869     rotITSspdShealdVVt1->SetName("ITSspdShealdVVt1");
870     rotITSspdShealdVVt1->RegisterYourself();
871     TGeoRotation rotz180("",0.0,0.0,180.0); // never registered
872     rotITSspdShealdVVt2 = new TGeoCombiTrans(*tranITSspdShealdVVt0,rotz180);
873     rotITSspdShealdVVt2->SetName("ITSspdShealdVVt2");
874     rotITSspdShealdVVt2->RegisterYourself();
875     TGeoRotation rotz270("",0.0,0.0,270.0); // never registered
876     rotITSspdShealdVVt3 = new TGeoCombiTrans(*tranITSspdShealdVVt0,rotz270);
877     rotITSspdShealdVVt3->SetName("ITSspdShealdVVt3");
878     rotITSspdShealdVVt3->RegisterYourself();
879     M = new TGeoCompositeShape("ITS SPD Thermal sheald volume",
880                               "(((ITSspdShealdVV+"
881                               "ITSspdShealdWingVV:ITSspdShealdVVt0)+"
882                               "ITSspdShealdWingVV:ITSspdShealdVVt1)+"
883                               "ITSspdShealdWingVV:ITSspdShealdVVt2)+"
884                               "ITSspdShealdWingVV:ITSspdShealdVVt3");
885     //
886     TGeoManager *mgr = gGeoManager;
887     SPDcf = mgr->GetMedium("ITSspdCarbonFiber");
888     SPDfs = mgr->GetMedium("ITSspdStaselite4411w");
889     SPDfo = mgr->GetMedium("ITSspdRohacell50A");
890     SPDss = mgr->GetMedium("ITSspdStainlessSteal");
891     SPDair= mgr->GetMedium("ITSspdAir");
892     TGeoVolume *A1v,*A2v,*A3v,*Ah1v,*Ah2v,*Ah3v;
893     TGeoVolume *B1v,*B2v,*B3v,*Bh1v,*Bh2v,*Bh3v;
894     TGeoVolume *C1v,*C2v,*C3v,*Ch1v,*Ch2v,*Ch3v;
895     TGeoVolume *Dv,*Dsv,*Dwv,*Dwsv,*Mv;
896     Mv = new TGeoVolume("ITSspdThermalSheald",M,SPDair);
897     Mv->SetVisibility(kTRUE);
898     Mv->SetLineColor(7); // light Blue
899     Mv->SetLineWidth(1);
900     Mv->SetFillColor(Mv->GetLineColor());
901     Mv->SetFillStyle(4090); // 90% transparent
902     Moth->AddNode(Mv,1,0); ///////////////////// Virtual Volume ////////
903     A1v = new TGeoVolume("ITSspdCentCylA1CF",A1,SPDcf);
904     A1v->SetVisibility(kTRUE);
905     A1v->SetLineColor(4);
906     A1v->SetLineWidth(1);
907     A2v = new TGeoVolume("ITSspdCentCylA2CF",A2,SPDcf);
908     A2v->SetVisibility(kTRUE);
909     A2v->SetLineColor(4);
910     A2v->SetLineWidth(1);
911     A3v = new TGeoVolume("ITSspdCentCylA3CF",A3,SPDcf);
912     A3v->SetVisibility(kTRUE);
913     A3v->SetLineColor(4);
914     A3v->SetLineWidth(1);
915     B1v = new TGeoVolume("ITSspdCentCylB1CF",B1,SPDcf);
916     B1v->SetVisibility(kTRUE);
917     B1v->SetLineColor(4);
918     B1v->SetLineWidth(1);
919     B2v = new TGeoVolume("ITSspdCentCylB2CF",B2,SPDcf);
920     B2v->SetVisibility(kTRUE);
921     B2v->SetLineColor(4);
922     B2v->SetLineWidth(1);
923     B3v = new TGeoVolume("ITSspdCentCylB3CF",B3,SPDcf);
924     B3v->SetVisibility(kTRUE);
925     B3v->SetLineColor(4);
926     B3v->SetLineWidth(1);
927     C1v = new TGeoVolume("ITSspdCentCylC1CF",C1,SPDcf);
928     C1v->SetVisibility(kTRUE);
929     C1v->SetLineColor(4);
930     C1v->SetLineWidth(1);
931     C2v = new TGeoVolume("ITSspdCentCylC2CF",C2,SPDcf);
932     C2v->SetVisibility(kTRUE);
933     C2v->SetLineColor(4);
934     C2v->SetLineWidth(1);
935     C3v = new TGeoVolume("ITSspdCentCylC3CF",C3,SPDcf);
936     C3v->SetVisibility(kTRUE);
937     C3v->SetLineColor(4);
938     C3v->SetLineWidth(1);
939     Ah1v = new TGeoVolume("ITSspdCentCylA1AirA",Ah1,SPDair);
940     Ah1v->SetVisibility(kTRUE);
941     Ah1v->SetLineColor(5); // Yellow
942     Ah1v->SetFillColor(Ah1v->GetLineColor());
943     Ah1v->SetFillStyle(4090); // 90% transparent
944     Ah2v = new TGeoVolume("ITSspdCentCylA2AirA",Ah2,SPDair);
945     Ah2v->SetVisibility(kTRUE);
946     Ah2v->SetLineColor(5); // Yellow
947     Ah2v->SetFillColor(Ah2v->GetLineColor());
948     Ah2v->SetFillStyle(4090); // 90% transparent
949     Ah3v = new TGeoVolume("ITSspdCentCylA3AirA",Ah3,SPDair);
950     Ah3v->SetVisibility(kTRUE);
951     Ah3v->SetLineColor(5); // Yellow
952     Ah3v->SetFillColor(Ah3v->GetLineColor());
953     Ah3v->SetFillStyle(4090); // 90% transparent
954     Bh1v = new TGeoVolume("ITSspdCentCylA1AirB",Bh1,SPDair);
955     Bh1v->SetVisibility(kTRUE);
956     Bh1v->SetLineColor(5); // Yellow
957     Bh1v->SetFillColor(Bh1v->GetLineColor());
958     Bh1v->SetFillStyle(4090); // 90% transparent
959     Bh2v = new TGeoVolume("ITSspdCentCylA2AirB",Bh2,SPDair);
960     Bh2v->SetVisibility(kTRUE);
961     Bh2v->SetLineColor(5); // Yellow
962     Bh2v->SetFillColor(Bh2v->GetLineColor());
963     Bh2v->SetFillStyle(4090); // 90% transparent
964     Bh3v = new TGeoVolume("ITSspdCentCylA3AirB",Bh3,SPDair);
965     Bh3v->SetVisibility(kTRUE);
966     Bh3v->SetLineColor(5); // Yellow
967     Bh3v->SetFillColor(Bh3v->GetLineColor());
968     Bh3v->SetFillStyle(4090); // 90% transparent
969     Ch1v = new TGeoVolume("ITSspdCentCylA1AirC",Ch1,SPDair);
970     Ch1v->SetVisibility(kTRUE);
971     Ch1v->SetLineColor(5); // Yellow
972     Ch1v->SetFillColor(Ch1v->GetLineColor());
973     Ch1v->SetFillStyle(4090); // 90% transparent
974     Ch2v = new TGeoVolume("ITSspdCentCylA2AirC",Ch2,SPDair);
975     Ch2v->SetVisibility(kTRUE);
976     Ch2v->SetLineColor(5); // Yellow
977     Ch2v->SetFillColor(Ch2v->GetLineColor());
978     Ch2v->SetFillStyle(4090); // 90% transparent
979     Ch3v = new TGeoVolume("ITSspdCentCylA3AirC",Ch3,SPDair);
980     Ch3v->SetVisibility(kTRUE);
981     Ch3v->SetLineColor(5); // Yellow
982     Ch3v->SetFillColor(Ch3v->GetLineColor());
983     Ch3v->SetFillStyle(4090); // 90% transparent
984     Dv = new TGeoVolume("ITSspdCentCylA1CD",D,SPDcf);
985     Dv->SetVisibility(kTRUE);
986     Dv->SetLineColor(4);
987     Dv->SetLineWidth(1);
988     Dwv = new TGeoVolume("ITSspdCentCylA1CDw",Dw,SPDcf);
989     Dwv->SetVisibility(kTRUE);
990     Dwv->SetLineColor(4);
991     Dwv->SetLineWidth(1);
992     Dsv = new TGeoVolume("ITSspdCentCylA1Dfill",Ds,SPDfs);
993     Dsv->SetVisibility(kTRUE);
994     Dsv->SetLineColor(3); // Green
995     Dsv->SetFillColor(Dsv->GetLineColor());
996     Dsv->SetFillStyle(4010); // 10% transparent
997     Dwsv = new TGeoVolume("ITSspdCentCylA1DwingFill",Dws,SPDfs);
998     Dwsv->SetVisibility(kTRUE);
999     Dwsv->SetLineColor(3); // Green
1000     Dwsv->SetFillColor(Dwsv->GetLineColor());
1001     Dwsv->SetFillStyle(4010); // 10% transparent
1002     //
1003     A1v->AddNode(Ah1v,1,0);
1004     A2v->AddNode(Ah2v,1,0);
1005     A3v->AddNode(Ah3v,1,0);
1006     B1v->AddNode(Bh1v,1,0);
1007     B2v->AddNode(Bh2v,1,0);
1008     B3v->AddNode(Bh3v,1,0);
1009     C1v->AddNode(Ch1v,1,0);
1010     C2v->AddNode(Ch2v,1,0);
1011     C3v->AddNode(Ch3v,1,0);
1012     Dv ->AddNode(Dsv ,1,0);
1013     Dwv->AddNode(Dwsv,1,0);
1014     //
1015     Mv->AddNode(A1v,1,0);
1016     Mv->AddNode(A2v,1,0);
1017     Mv->AddNode(A3v,1,0);
1018     tranb  = new TGeoTranslation("",0.0,0.0,0.5*(TSCLengthA+TSCLengthB));
1019     tranbm = new TGeoTranslation("",0.0,0.0,0.5*(-TSCLengthA-TSCLengthB));
1020     Mv->AddNode(B1v,1,tranb);
1021     Mv->AddNode(B2v,1,tranb);
1022     Mv->AddNode(B3v,1,tranb);
1023     Mv->AddNode(B1v,2,tranbm);
1024     Mv->AddNode(B2v,2,tranbm);
1025     Mv->AddNode(B3v,2,tranbm);
1026     // Muon side (rb26) is at -Z.
1027     tranc = new TGeoTranslation("",0.0,0.0,
1028                                 0.5*(-TSCLengthA-TSCLengthB-TSCLengthC));
1029     Mv->AddNode(C1v,1,tranc);
1030     Mv->AddNode(C2v,1,tranc);
1031     Mv->AddNode(C3v,1,tranc);
1032     Mv->AddNode(Dv,1,tranITSspdShealdVVt0);
1033     Mv->AddNode(Dwv,1,tranITSspdShealdVVt0);
1034     Mv->AddNode(Dwv,2,rotITSspdShealdVVt1);
1035     Mv->AddNode(Dwv,3,rotITSspdShealdVVt2);
1036     Mv->AddNode(Dwv,4,rotITSspdShealdVVt3);
1037     k=2;
1038     for(i=1;i<10;i++) {
1039       th = ((Double_t)i)*TSCAngle*kDegree;
1040       rot = new TGeoRotation("",0.0,0.0,th);
1041       Mv->AddNode(A1v,i+1,rot);
1042       Mv->AddNode(B1v,i+2,new TGeoCombiTrans(*tranb,*rot));
1043       Mv->AddNode(B1v,i+12,new TGeoCombiTrans(*tranbm,*rot));
1044       Mv->AddNode(C1v,i+1,new TGeoCombiTrans(*tranc,*rot));
1045       if(i!=0||i!=2||i!=7){
1046         Mv->AddNode(A2v,k++,rot);
1047         Mv->AddNode(B2v,k++,new TGeoCombiTrans(*tranb,*rot));
1048         Mv->AddNode(B2v,k++,new TGeoCombiTrans(*tranbm,*rot));
1049         Mv->AddNode(C2v,k++,new TGeoCombiTrans(*tranc,*rot));
1050       } // end if
1051       if(i==5) {
1052         Mv->AddNode(A3v,2,rot);
1053         Mv->AddNode(B3v,3,new TGeoCombiTrans(*tranb,*rot));
1054         Mv->AddNode(B3v,4,new TGeoCombiTrans(*tranbm,*rot));
1055         Mv->AddNode(C3v,2,new TGeoCombiTrans(*tranc,*rot));
1056       } // end if
1057     } // end for i
1058     rot = new TGeoRotation("",180.,0.0,0.0);
1059     Mv->AddNode(A3v,3,rot);
1060     Mv->AddNode(B3v,5,new TGeoCombiTrans(*tranb,*rot));
1061     Mv->AddNode(B3v,6,new TGeoCombiTrans(*tranbm,*rot));
1062     Mv->AddNode(C3v,3,new TGeoCombiTrans(*tranc,*rot));
1063     rot = new TGeoRotation("",180.,0.0,180.0);
1064     Mv->AddNode(A3v,4,rot);
1065     Mv->AddNode(B3v,7,new TGeoCombiTrans(*tranb,*rot));
1066     Mv->AddNode(B3v,8,new TGeoCombiTrans(*tranbm,*rot));
1067     Mv->AddNode(C3v,4,new TGeoCombiTrans(*tranc,*rot));
1068     if(GetDebug()){
1069         A1v->PrintNodes();
1070         Ah1v->PrintNodes();
1071         A2v->PrintNodes();
1072         Ah2v->PrintNodes();
1073         A3v->PrintNodes();
1074         Ah3v->PrintNodes();
1075         B1v->PrintNodes();
1076         Bh1v->PrintNodes();
1077         B2v->PrintNodes();
1078         Bh2v->PrintNodes();
1079         B3v->PrintNodes();
1080         Bh3v->PrintNodes();
1081         C1v->PrintNodes();
1082         Ch1v->PrintNodes();
1083         C2v->PrintNodes();
1084         Ch2v->PrintNodes();
1085         C3v->PrintNodes();
1086         Ch3v->PrintNodes();
1087         Dv->PrintNodes();
1088         Dsv->PrintNodes();
1089         Dwv->PrintNodes();
1090         Dwsv->PrintNodes();
1091         //Mv->PrintNodes();
1092     } // end if
1093 }
1094 //______________________________________________________________________
1095 void AliITSv11::SDDCone(TGeoVolume *Moth){
1096     // Define the detail SDD support cone geometry.
1097     // Inputs:
1098     //   none.
1099     // Outputs:
1100     //  none.
1101     // Return:
1102     //  none.
1103     //
1104     // From Cilindro Centrale - Lavorazioni, ALR 0816/1 04/08/03 File
1105     // name SDD/Cilindro.hpgl
1106     const Double_t TSLength       = 790.0*kmm; // Thermal Sheeld length
1107     const Double_t TSInsertoLength= 15.0*kmm;    // ????
1108     const Double_t TSOuterR       = 0.5*(220.+10.)*kmm; // ????
1109     const Double_t TSInnerR       = 0.5*(220.-10.)*kmm; // ????
1110     const Double_t TSCarbonFiberth= 0.02*kmm;     // ????
1111     const Double_t TSBoltDiameter = 6.0*kmm; // M6 screw
1112     const Double_t TSBoltDepth    = 6.0*kmm; // in volume C
1113     const Double_t TSBoltRadius   = 0.5*220.*kmm; // Radius in volume C
1114     const Double_t TSBoltAngle0   = 0.0*kDegree; // Angle in volume C
1115     const Double_t TSBoltdAngle   = 30.0*kDegree; // Angle in Volume C
1116     Double_t x,y,z,t,t0;
1117     Int_t i,n;
1118     TGeoTube *A,*B,*C,*D;
1119     TGeoTranslation *tran;
1120     TGeoRotation *rot;
1121     TGeoCombiTrans *rotran;
1122     TGeoMedium *SDDcf,*SDDfs,*SDDfo,*SDDss;
1123
1124     A = new TGeoTube("ITS SDD Central Cylinder",TSInnerR,TSOuterR,.5*TSLength);
1125     B = new TGeoTube("ITS SDD CC Foam",TSInnerR+TSCarbonFiberth,
1126                     TSOuterR-TSCarbonFiberth,
1127                     0.5*(TSLength-2.0*TSInsertoLength));
1128     C = new TGeoTube("ITS SDD CC Inserto",TSInnerR+TSCarbonFiberth,
1129                     TSOuterR-TSCarbonFiberth,0.5*TSLength);
1130     D = new TGeoTube("ITS SDD CC M6 bolt end",0.0,0.5*TSBoltDiameter,
1131                     0.5*TSBoltDepth);
1132     printTube(A);
1133     printTube(B);
1134     printTube(C);
1135     printTube(D);
1136     //
1137     TGeoManager *mgr = gGeoManager;
1138     SDDcf = mgr->GetMedium("ITSssdCarbonFiber");
1139     SDDfs = mgr->GetMedium("ITSssdStaselite4411w");
1140     SDDfo = mgr->GetMedium("ITSssdRohacell50A");
1141     SDDss = mgr->GetMedium("ITSssdStainlessSteal");
1142     TGeoVolume *Av,*Bv,*Cv,*Dv;
1143     Av = new TGeoVolume("ITSsddCentCylCF",A,SDDcf);
1144     Av->SetVisibility(kTRUE);
1145     Av->SetLineColor(4);
1146     Av->SetLineWidth(1);
1147     Av->SetFillColor(Av->GetLineColor());
1148     Av->SetFillStyle(4000); // 0% transparent
1149     Bv = new TGeoVolume("ITSsddCentCylF",B,SDDfo);
1150     Bv->SetVisibility(kTRUE);
1151     Bv->SetLineColor(3);
1152     Bv->SetLineWidth(1);
1153     Bv->SetFillColor(Bv->GetLineColor());
1154     Bv->SetFillStyle(4000); // 0% transparent
1155     Cv = new TGeoVolume("ITSsddCentCylSt",C,SDDfs);
1156     Cv->SetVisibility(kTRUE);
1157     Cv->SetLineColor(2);
1158     Cv->SetLineWidth(1);
1159     Cv->SetFillColor(Cv->GetLineColor());
1160     Cv->SetFillStyle(4000); // 0% transparent
1161     Dv = new TGeoVolume("ITSsddCentCylSS",D,SDDss);
1162     Dv->SetVisibility(kTRUE);
1163     Dv->SetLineColor(1);
1164     Dv->SetLineWidth(1);
1165     Dv->SetFillColor(Dv->GetLineColor());
1166     Dv->SetFillStyle(4000); // 0% transparent
1167     //
1168     Moth->AddNode(Av,1,0);
1169     Av->AddNode(Cv,1,0);
1170     Cv->AddNode(Bv,1,0);
1171     n = (Int_t)((360.*kDegree)/TSBoltdAngle);
1172     for(i=0;i<n;i++){
1173         t = TSBoltAngle0+((Double_t)i)*TSBoltdAngle;
1174         x = TSBoltRadius*TMath::Cos(t*kRadian);
1175         y = TSBoltRadius*TMath::Sin(t*kRadian);
1176         z = 0.5*(TSLength-TSBoltDepth);
1177         tran = new TGeoTranslation("",x,y,z);
1178         Cv->AddNode(Dv,i+1,tran);
1179         tran = new TGeoTranslation("",x,y,-z);
1180         Cv->AddNode(Dv,i+n+1,tran);
1181     } // end for i
1182     if(GetDebug()){
1183         Av->PrintNodes();
1184         Bv->PrintNodes();
1185         Cv->PrintNodes();
1186         Dv->PrintNodes();
1187     } // end if
1188     // SDD Suport Cone
1189     //
1190     //
1191     const Double_t Thickness = 10.5*kmm; // Thickness of Rohacell+carbon fiber
1192     const Double_t Cthick    = 1.5*kmm; // Carbon finber thickness
1193     const Double_t Rcurv     = 15.0*kmm; // Radius of curvature.
1194     const Double_t Tc        = 45.0; // angle of SSD cone [degrees].
1195     const Double_t Sintc = TMath::Sin(Tc*TMath::DegToRad());
1196     const Double_t Costc = TMath::Cos(Tc*TMath::DegToRad());
1197     const Double_t Tantc = TMath::Tan(Tc*TMath::DegToRad());
1198     const Double_t ZouterMilled = 23.0*kmm;
1199     const Double_t Zcylinder    = 186.0*kmm;
1200     const Double_t Z0           = Zcylinder + 0.5*TSLength;
1201     //const Int_t Nspoaks         = 12;
1202     //const Int_t Nmounts         = 4;
1203     //const Double_t DmountAngle  = 9.0; // degrees
1204     const Double_t RoutMax      = 0.5*560.0*kmm;
1205     const Double_t RoutMin      = 0.5*539.0*kmm;
1206     // Holes in cone for cables
1207     const Double_t PhiHole1     = 0.0*kDegree;
1208     const Double_t dPhiHole1    = 25.0*kDegree;
1209     const Double_t RholeMax1    = 0.5*528.*kmm;
1210     const Double_t RholeMin1    = 0.5*464.*kmm;
1211     const Double_t PhiHole2     = 0.0*kDegree;
1212     const Double_t dPhiHole2    = 50.0*kDegree;
1213     const Double_t RholeMax2    = 0.5*375.*kmm;
1214     const Double_t RholeMin2    = 0.5*280.*kmm;
1215     //
1216     //const Int_t NpostsOut       = 6;
1217     //const Int_t NpostsIn        = 3;
1218     //const Double_t Phi0PostOut  = 0.0; // degree
1219     //const Double_t Phi0PostIn   = 0.0; // degree
1220     //const Double_t dRpostOut    = 16.0*kmm;
1221     //const Double_t dRpostIn     = 16.0*kmm;
1222     //const Double_t ZpostMaxOut  = 116.0*kmm;
1223     //const Double_t ZpostMaxIn   = 190.0*kmm;
1224     const Double_t RinMax       = 0.5*216*kmm;
1225     const Double_t RinCylinder  = 0.5*231.0*kmm;
1226     //const Double_t RinHole      = 0.5*220.0*kmm;
1227     const Double_t RinMin       = 0.5*210.0*kmm;
1228     const Double_t dZin         = 15.0*kmm; // ???
1229     //
1230     Double_t dza = Thickness/Sintc-(RoutMax-RoutMin)/Tantc;
1231     Double_t Z,Rmin,Rmax; // Temp variables.
1232     if(dza<=0){ // The number or order of the points are in error for a proper
1233      // call to pcons!
1234      Error("SDDcone","The definition of the points for a call to PCONS is"
1235            " in error. abort.");
1236      return;
1237     } // end if
1238     TGeoPcon *E = new TGeoPcon("ITSsddSuportConeCarbonFiberSurfaceE",
1239                                0.0,360.0,12);
1240     E->Z(0)    = 0.0;
1241     E->Rmin(0) = RoutMin;
1242     E->Rmax(0) = RoutMax;
1243     E->Z(1)    = ZouterMilled - dza;
1244     E->Rmin(1) = E->GetRmin(0);
1245     E->Rmax(1) = E->GetRmax(0);
1246     E->Z(2)    = ZouterMilled;
1247     E->Rmax(2) = E->GetRmax(0);
1248     RadiusOfCurvature(Rcurv,0.,E->GetZ(1),E->GetRmin(1),Tc,Z,Rmin);
1249     E->Z(3)    = Z;
1250     E->Rmin(3) = Rmin;
1251     E->Rmin(2) = RminFrom2Points(E,3,1,E->GetZ(2));
1252     RadiusOfCurvature(Rcurv,0.,E->GetZ(2),E->GetRmax(2),Tc,Z,Rmax);
1253     E->Z(4)    = Z;
1254     E->Rmax(4) = Rmax;
1255     E->Rmin(4) = RminFromZpCone(E,Tc,E->GetZ(4),0.0);
1256     E->Rmax(3) = RmaxFrom2Points(E,4,2,E->GetZ(3));
1257     E->Rmin(7) = RinMin;
1258     E->Rmin(8) = RinMin;
1259     RadiusOfCurvature(Rcurv,90.0,0.0,RinMax,90.0-Tc,Z,Rmax);
1260     E->Rmax(8) = Rmax;
1261     E->Z(8)    = ZFromRmaxpCone(E,Tc,E->GetRmax(8));
1262     E->Z(9)    = Zcylinder;
1263     E->Rmin(9) = RinMin;
1264     E->Z(10)    = E->GetZ(9);
1265     E->Rmin(10) = RinCylinder;
1266     E->Rmin(11) = RinCylinder;
1267     E->Rmax(11) = E->GetRmin(11);
1268     Rmin        = E->GetRmin(8);
1269     RadiusOfCurvature(Rcurv,90.0-Tc,E->GetZ(8),E->GetRmax(8),90.0,Z,Rmax);
1270     Rmax = RinMax;
1271     E->Z(11)    = Z+(E->GetZ(8)-Z)*(E->GetRmax(11)-Rmax)/(E->GetRmax(8)-Rmax);
1272     E->Rmax(9) = RmaxFrom2Points(E,11,8,E->GetZ(9));
1273     E->Rmax(10) = E->GetRmax(9);
1274     E->Z(6)    = Z-dZin;
1275     E->Z(7)    = E->GetZ(6);
1276     E->Rmax(6) = RmaxFromZpCone(E,Tc,E->GetZ(6));
1277     E->Rmax(7) = E->GetRmax(6);
1278     RadiusOfCurvature(Rcurv,90.,E->GetZ(6),0.0,90.0-Tc,Z,Rmin);
1279     E->Z(5)    = Z;
1280     E->Rmin(5) = RminFromZpCone(E,Tc,Z);
1281     E->Rmax(5) = RmaxFromZpCone(E,Tc,Z);
1282     RadiusOfCurvature(Rcurv,90.-Tc,0.0,E->Rmin(5),90.0,Z,Rmin);
1283     E->Rmin(6) = Rmin;
1284     printPcon(E);
1285     // Inner Core, Inserto material
1286     TGeoPcon *F = new TGeoPcon("ITSsddSuportConeInsertoStesaliteF",0.,360.0,9);
1287     F->Z(0)    = E->GetZ(0);
1288     F->Rmin(0) = E->GetRmin(0)+Cthick;
1289     F->Rmax(0) = E->GetRmax(0)-Cthick;
1290     F->Z(1)    = E->GetZ(1);
1291     F->Rmin(1) = F->GetRmin(0);
1292     F->Rmax(1) = F->GetRmax(0);
1293     F->Z(2)    = E->GetZ(2);
1294     F->Rmax(2) = F->GetRmax(1);
1295     RadiusOfCurvature(Rcurv-Cthick,0.,F->GetZ(1),F->GetRmax(1),Tc,Z,Rmin);
1296     F->Z(3)    = Z;
1297     F->Rmin(3) = Rmin;
1298     F->Rmin(2) = RminFrom2Points(F,3,1,F->GetZ(2));
1299     RadiusOfCurvature(Rcurv+Cthick,0.,F->GetZ(2),F->GetRmax(2),Tc,Z,Rmax);
1300     F->Z(4)    = Z;
1301     F->Rmax(4) = Rmax;
1302     F->Rmin(4) = RmaxFromZpCone(E,Tc,F->GetZ(4),-Cthick);
1303     F->Rmax(3) = RmaxFrom2Points(F,4,2,F->GetZ(3));
1304     F->Rmin(7) = E->GetRmin(7);
1305     F->Rmin(8) = E->GetRmin(8);
1306     F->Z(6)    = E->GetZ(6)+Cthick;
1307     F->Rmin(6) = E->GetRmin(6);
1308     F->Z(7)    = F->GetZ(6);
1309     F->Rmax(8) = E->GetRmax(8)-Cthick*Sintc;
1310     RadiusOfCurvature(Rcurv+Cthick,90.,F->GetZ(6),F->GetRmin(6),90.-Tc,Z,Rmin);
1311     F->Z(5)    = Z;
1312     F->Rmin(5) = Rmin;
1313     F->Rmax(5) = RmaxFromZpCone(F,Tc,Z);
1314     F->Rmax(6) = RmaxFromZpCone(F,Tc,F->GetZ(6));
1315     F->Rmax(7) = F->GetRmax(6);
1316     F->Z(8)    = ZFromRmaxpCone(F,Tc,F->GetRmax(8),-Cthick);
1317     printPcon(F);
1318     // Inner Core, Inserto material
1319     TGeoPcon *G = new TGeoPcon("ITSsddSuportConeFoamCoreG",0.0,360.0,4);
1320     RadiusOfCurvature(Rcurv+Cthick,0.0,F->GetZ(1),F->GetRmin(1),Tc,Z,Rmin);
1321     G->Z(0)    = Z;
1322     G->Rmin(0) = Rmin;
1323     G->Rmax(0) = G->GetRmin(0);
1324     G->Z(1)    = G->GetZ(0)+(Thickness-2.0*Cthick)/Sintc;;
1325     G->Rmin(1) = RminFromZpCone(F,Tc,G->GetZ(1));
1326     G->Rmax(1) = RmaxFromZpCone(F,Tc,G->GetZ(1));
1327     G->Z(2)    = E->GetZ(5)-Cthick;
1328     G->Rmin(2) = RminFromZpCone(F,Tc,G->GetZ(2));
1329     G->Rmax(2) = RmaxFromZpCone(F,Tc,G->GetZ(2));
1330     G->Z(3)    = F->GetZ(5)+(Thickness-2.0*Cthick)*Costc;
1331     G->Rmax(3) = RmaxFromZpCone(F,Tc,G->GetZ(3));
1332     G->Rmin(3) = G->GetRmax(3);
1333     printPcon(G);
1334     //
1335     TGeoPcon *H = new TGeoPcon("ITSsddSuportConeHoleH",PhiHole1,dPhiHole1,4);
1336     H->Rmin(0) = RholeMax1;
1337     H->Rmax(0) = H->GetRmin(0);
1338     H->Z(0)    = ZFromRminpCone(E,Tc,H->GetRmin(0));
1339     H->Rmax(1) = H->GetRmax(0);
1340     H->Z(1)    = ZFromRmaxpCone(E,Tc,H->GetRmax(1));
1341     H->Rmin(1) = RminFromZpCone(E,Tc,H->GetZ(1));
1342     H->Rmin(2) = RholeMin1;
1343     H->Z(2)    = ZFromRminpCone(E,Tc,H->GetRmin(2));
1344     H->Rmax(2) = RmaxFromZpCone(E,Tc,H->GetZ(2));
1345     H->Rmin(3) = H->GetRmin(2);
1346     H->Rmax(3) = H->GetRmin(3);
1347     H->Z(3)    = ZFromRminpCone(E,Tc,H->GetRmin(3));
1348     printPcon(H);
1349     //
1350     x = Cthick/(0.5*(RholeMax1+RholeMin1));
1351     t0 = PhiHole1 - x/kRadian;
1352     t  = dPhiHole1 + 2.0*x/kRadian;
1353     TGeoPcon *I = new TGeoPcon("ITSsddSuportConeHoleI",t0,t,4);
1354     I->Rmin(0) = RholeMax1+Cthick;
1355     I->Rmax(0) = I->GetRmin(0);
1356     I->Z(0)    = ZFromRminpCone(F,Tc,I->GetRmin(0));
1357     I->Rmax(1) = I->GetRmax(0);
1358     I->Z(1)    = ZFromRmaxpCone(F,Tc,I->GetRmax(1));
1359     I->Rmin(1) = RminFromZpCone(F,Tc,I->GetZ(1));
1360     I->Rmin(2) = RholeMin1-Cthick;
1361     I->Z(2)    = ZFromRminpCone(F,Tc,I->GetRmin(2));
1362     I->Rmax(2) = RmaxFromZpCone(F,Tc,I->GetZ(2));
1363     I->Rmin(3) = I->GetRmin(2);
1364     I->Rmax(3) = I->GetRmin(3);
1365     I->Z(3)    = ZFromRmaxpCone(F,Tc,I->GetRmax(3));
1366     printPcon(I);
1367     //
1368     TGeoPcon *J = new TGeoPcon("ITSsddSuportConeHoleJ",PhiHole2,dPhiHole2,4);
1369     J->Rmin(0) = RholeMax2;
1370     J->Rmax(0) = J->GetRmin(0);
1371     J->Z(0)    = ZFromRminpCone(E,Tc,J->GetRmin(0));
1372     J->Rmax(1) = J->GetRmax(0);
1373     J->Z(1)    = ZFromRmaxpCone(E,Tc,J->GetRmax(1));
1374     J->Rmin(1) = RminFromZpCone(E,Tc,J->GetZ(1));
1375     J->Rmin(2) = RholeMin2;
1376     J->Z(2)    = ZFromRminpCone(E,Tc,J->GetRmin(2));
1377     J->Rmax(2) = RmaxFromZpCone(E,Tc,J->GetZ(2));
1378     J->Rmin(3) = J->GetRmin(2);
1379     J->Rmax(3) = J->GetRmin(3);
1380     J->Z(3)    = ZFromRmaxpCone(E,Tc,J->GetRmax(3));
1381     printPcon(J);
1382     //
1383     x = Cthick/(0.5*(RholeMax2+RholeMin2));
1384     t0 = PhiHole2 - x/kRadian;
1385     t  = dPhiHole2 + 2.0*x/kRadian;
1386     TGeoPcon *K = new TGeoPcon("ITSsddSuportConeHoleK",t0,t,4);
1387     K->Rmin(0) = RholeMax2+Cthick;
1388     K->Rmax(0) = K->GetRmin(0);
1389     K->Z(0)    = ZFromRminpCone(F,Tc,K->GetRmin(0));
1390     K->Rmax(1) = K->GetRmax(0);
1391     K->Z(1)    = ZFromRmaxpCone(F,Tc,K->GetRmax(1));
1392     K->Rmin(1) = RminFromZpCone(F,Tc,K->GetZ(1));
1393     K->Rmin(2) = RholeMin2-Cthick;
1394     K->Z(2)    = ZFromRminpCone(F,Tc,K->GetRmin(2));
1395     K->Rmax(2) = RmaxFromZpCone(F,Tc,K->GetZ(2));
1396     K->Rmin(3) = K->GetRmin(2);
1397     K->Rmax(3) = K->GetRmin(3);
1398     K->Z(3)    = ZFromRmaxpCone(F,Tc,K->GetRmax(3));
1399     printPcon(K);
1400     //
1401     TGeoCompositeShape *L,*M,*N;
1402     rot = new TGeoRotation("ITSsddRotZ30",0.0,0.0,30.0);
1403     rot->RegisterYourself();
1404     rot = new TGeoRotation("ITSsddRotZ60",0.0,0.0,60.0);
1405     rot->RegisterYourself();
1406     rot = new TGeoRotation("ITSsddRotZ90",0.0,0.0,90.0);
1407     rot->RegisterYourself();
1408     rot = new TGeoRotation("ITSsddRotZ120",0.0,0.0,120.0);
1409     rot->RegisterYourself();
1410     rot = new TGeoRotation("ITSsddRotZ150",0.0,0.0,150.0);
1411     rot->RegisterYourself();
1412     rot = new TGeoRotation("ITSsddRotZ180",0.0,0.0,180.0);
1413     rot->RegisterYourself();
1414     rot = new TGeoRotation("ITSsddRotZ210",0.0,0.0,210.0);
1415     rot->RegisterYourself();
1416     rot = new TGeoRotation("ITSsddRotZ240",0.0,0.0,240.0);
1417     rot->RegisterYourself();
1418     rot = new TGeoRotation("ITSsddRotZ270",0.0,0.0,270.0);
1419     rot->RegisterYourself();
1420     rot = new TGeoRotation("ITSsddRotZ300",0.0,0.0,300.0);
1421     rot->RegisterYourself();
1422     rot = new TGeoRotation("ITSsddRotZ330",0.0,0.0,330.0);
1423     rot->RegisterYourself();
1424     L = new TGeoCompositeShape("ITS SDD Suport Cone","((((((((((((((((("
1425                                "ITSsddSuportConeCarbonFiberSurfaceE -"
1426                                "ITSsddSuportConeHoleH)  -"
1427                                "ITSsddSuportConeHoleH:ITSsddRotZ30) -"
1428                                "ITSsddSuportConeHoleH:ITSsddRotZ60) -"
1429                                "ITSsddSuportConeHoleH:ITSsddRotZ90) -"
1430                                "ITSsddSuportConeHoleH:ITSsddRotZ120) -"
1431                                "ITSsddSuportConeHoleH:ITSsddRotZ150) -"
1432                                "ITSsddSuportConeHoleH:ITSsddRotZ180) -"
1433                                "ITSsddSuportConeHoleH:ITSsddRotZ210) -"
1434                                "ITSsddSuportConeHoleH:ITSsddRotZ240) -"
1435                                "ITSsddSuportConeHoleH:ITSsddRotZ270) -"
1436                                "ITSsddSuportConeHoleH:ITSsddRotZ300) -"
1437                                "ITSsddSuportConeHoleH:ITSsddRotZ330) -"
1438                                "ITSsddSuportConeHoleJ)  -"
1439                                "ITSsddSuportConeHoleJ:ITSsddRotZ60) -"
1440                                "ITSsddSuportConeHoleJ:ITSsddRotZ120) -"
1441                                "ITSsddSuportConeHoleJ:ITSsddRotZ180) -"
1442                                "ITSsddSuportConeHoleJ:ITSsddRotZ240) -"
1443                                "ITSsddSuportConeHoleJ:ITSsddRotZ300");
1444     M = new TGeoCompositeShape("ITS SDD Suport Cone Inserto Stesalite",
1445                                "((((((((((((((((("
1446                                "ITSsddSuportConeInsertoStesaliteF -"
1447                                "ITSsddSuportConeHoleI)  -"
1448                                "ITSsddSuportConeHoleI:ITSsddRotZ30) -"
1449                                "ITSsddSuportConeHoleI:ITSsddRotZ60) -"
1450                                "ITSsddSuportConeHoleI:ITSsddRotZ90) -"
1451                                "ITSsddSuportConeHoleI:ITSsddRotZ120) -"
1452                                "ITSsddSuportConeHoleI:ITSsddRotZ150) -"
1453                                "ITSsddSuportConeHoleI:ITSsddRotZ180) -"
1454                                "ITSsddSuportConeHoleI:ITSsddRotZ210) -"
1455                                "ITSsddSuportConeHoleI:ITSsddRotZ240) -"
1456                                "ITSsddSuportConeHoleI:ITSsddRotZ270) -"
1457                                "ITSsddSuportConeHoleI:ITSsddRotZ300) -"
1458                                "ITSsddSuportConeHoleI:ITSsddRotZ330) -"
1459                                "ITSsddSuportConeHoleK)  -"
1460                                "ITSsddSuportConeHoleK:ITSsddRotZ60) -"
1461                                "ITSsddSuportConeHoleK:ITSsddRotZ120) -"
1462                                "ITSsddSuportConeHoleK:ITSsddRotZ180) -"
1463                                "ITSsddSuportConeHoleK:ITSsddRotZ240) -"
1464                                "ITSsddSuportConeHoleK:ITSsddRotZ300");
1465     N = new TGeoCompositeShape("ITS SDD Suport Cone Foam Core",
1466                                "((((((((((((((((("
1467                                "ITSsddSuportConeFoamCoreG -"
1468                                "ITSsddSuportConeHoleI)  -"
1469                                "ITSsddSuportConeHoleI:ITSsddRotZ30) -"
1470                                "ITSsddSuportConeHoleI:ITSsddRotZ60) -"
1471                                "ITSsddSuportConeHoleI:ITSsddRotZ90) -"
1472                                "ITSsddSuportConeHoleI:ITSsddRotZ120) -"
1473                                "ITSsddSuportConeHoleI:ITSsddRotZ150) -"
1474                                "ITSsddSuportConeHoleI:ITSsddRotZ180) -"
1475                                "ITSsddSuportConeHoleI:ITSsddRotZ210) -"
1476                                "ITSsddSuportConeHoleI:ITSsddRotZ240) -"
1477                                "ITSsddSuportConeHoleI:ITSsddRotZ270) -"
1478                                "ITSsddSuportConeHoleI:ITSsddRotZ300) -"
1479                                "ITSsddSuportConeHoleI:ITSsddRotZ330) -"
1480                                "ITSsddSuportConeHoleK)  -"
1481                                "ITSsddSuportConeHoleK:ITSsddRotZ60) -"
1482                                "ITSsddSuportConeHoleK:ITSsddRotZ120) -"
1483                                "ITSsddSuportConeHoleK:ITSsddRotZ180) -"
1484                                "ITSsddSuportConeHoleK:ITSsddRotZ240) -"
1485                                "ITSsddSuportConeHoleK:ITSsddRotZ300");
1486     //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1487     TGeoVolume *Lv,*Mv,*Nv;
1488     Lv = new TGeoVolume("ITSsddConeL",L,SDDcf);
1489     Lv->SetVisibility(kTRUE);
1490     Lv->SetLineColor(4);
1491     Lv->SetLineWidth(1);
1492     Lv->SetFillColor(Lv->GetLineColor());
1493     Lv->SetFillStyle(4000); // 0% transparent
1494     Mv = new TGeoVolume("ITSsddConeM",M,SDDfs);
1495     Mv->SetVisibility(kTRUE);
1496     Mv->SetLineColor(2);
1497     Mv->SetLineWidth(1);
1498     Mv->SetFillColor(Mv->GetLineColor());
1499     Mv->SetFillStyle(4010); // 10% transparent
1500     Nv = new TGeoVolume("ITSsddConeN",N,SDDfo);
1501     Nv->SetVisibility(kTRUE);
1502     Nv->SetLineColor(7);
1503     Nv->SetLineWidth(1);
1504     Nv->SetFillColor(Nv->GetLineColor());
1505     Nv->SetFillStyle(4050); // 50% transparent
1506     //
1507     Mv->AddNode(Nv,1,0);
1508     Lv->AddNode(Mv,1,0);
1509     tran = new TGeoTranslation("",0.0,0.0,-Z0);
1510     Moth->AddNode(Lv,1,tran);
1511     rot = new TGeoRotation("",0.0,180.0*kDegree,0.0);
1512     rotran = new TGeoCombiTrans("",0.0,0.0,Z0,rot);
1513     delete rot;// rot not explicity used in AddNode functions.
1514     Moth->AddNode(Lv,2,rotran);
1515     if(GetDebug()){
1516         Lv->PrintNodes();
1517         Mv->PrintNodes();
1518         Nv->PrintNodes();
1519     } // end if
1520 }
1521 //______________________________________________________________________
1522 void AliITSv11::SSDCone(TGeoVolume *Moth){
1523     // Define the detail SSD support cone geometry.
1524     // Inputs:
1525     //   none.
1526     // Outputs:
1527     //  none.
1528     // Return:
1529     //  none.
1530     //
1531     TGeoMedium *SSDcf  = 0; // SSD support cone Carbon Fiber materal number.
1532     TGeoMedium *SSDfs  = 0; // SSD support cone inserto stesalite 4411w.
1533     TGeoMedium *SSDfo  = 0; // SSD support cone foam, Rohacell 50A.
1534     TGeoMedium *SSDss  = 0; // SSD support cone screw material,Stainless steal
1535     TGeoMedium *SSDair = 0; // SSD support cone Air
1536     TGeoMedium *SSDal  = 0; // SSD support cone SDD mounting bracket Al
1537     TGeoManager *mgr = gGeoManager;
1538     SSDcf = mgr->GetMedium("ITSssdCarbonFiber");
1539     SSDfs = mgr->GetMedium("ITSssdStaselite4411w");
1540     SSDfo = mgr->GetMedium("ITSssdRohacell50A");
1541     SSDss = mgr->GetMedium("ITSssdStainlessSteal");
1542     SSDair= mgr->GetMedium("ITSssdAir");
1543     SSDal = mgr->GetMedium("ITSssdAl");
1544     //
1545     // SSD Central cylinder/Thermal Sheald.
1546     const Double_t ZThCylinder = 1140.0*kmm; //
1547     const Double_t ZThCylFoam  = 1020.0*kmm; //
1548     const Double_t RThCylOuter = 0.5*595.0*kmm; //
1549     const Double_t CthickThCyl = 0.64*kmm; //
1550     const Double_t FoamThickTh = 5.0*kmm; //
1551     const Double_t dZThCylThEnd = 6.0*kmm; //
1552     const Double_t RThCylInerEnd= 0.5*560.5*kmm; //
1553     TGeoPcon *CA,*CB;
1554     TGeoTube*CC;
1555     //
1556     CA = new TGeoPcon("ITS SSD Thermal Centeral CylinderA",0.0,360.0,6);
1557     CB = new TGeoPcon("ITS SSD Thermal Centeral CylinderB",0.0,360.0,6);
1558     CC = new TGeoTube("ITS SSD Thermal Centeral CylinderC",
1559                       RThCylOuter-CthickThCyl-FoamThickTh,
1560                       RThCylOuter-CthickThCyl,0.5*ZThCylFoam);
1561     CA->Z(0)    = -0.5*ZThCylinder;
1562     CA->Rmin(0) = RThCylInerEnd;
1563     CA->Rmax(0) = RThCylOuter;
1564     CA->Z(1)    = CA->GetZ(0) + dZThCylThEnd;
1565     CA->Rmin(1) = CA->GetRmin(0);
1566     CA->Rmax(1) = CA->GetRmax(0);
1567     CA->Z(2)    = -0.5*ZThCylFoam;
1568     CA->Rmin(2) = RThCylOuter - 2.0*CthickThCyl-FoamThickTh;
1569     CA->Rmax(2) = CA->GetRmax(0);
1570     CA->Z(3)    = -CA->GetZ(2);
1571     CA->Rmin(3) = CA->GetRmin(2);
1572     CA->Rmax(3) = CA->GetRmax(2);
1573     CA->Z(4)    = -CA->GetZ(1);
1574     CA->Rmin(4) = CA->GetRmin(1);
1575     CA->Rmax(4) = CA->GetRmax(1);
1576     CA->Z(5)    = -CA->GetZ(0);
1577     CA->Rmin(5) = CA->GetRmin(0);
1578     CA->Rmax(5) = CA->GetRmax(0);
1579     //
1580     CB->Z(0)    = CA->GetZ(0);
1581     CB->Rmin(0) = CA->GetRmin(0) + CthickThCyl;
1582     CB->Rmax(0) = CA->GetRmax(0) - CthickThCyl;
1583     CB->Z(1)    = CA->GetZ(1);
1584     CB->Rmin(1) = CA->GetRmin(1) + CthickThCyl;
1585     CB->Rmax(1) = CA->GetRmax(1) - CthickThCyl;
1586     CB->Z(2)    = CA->GetZ(2);
1587     CB->Rmin(2) = CA->GetRmin(2) + CthickThCyl;
1588     CB->Rmax(2) = CA->GetRmax(2) - CthickThCyl;
1589     CB->Z(3)    = CA->GetZ(3);
1590     CB->Rmin(3) = CA->GetRmin(3) + CthickThCyl;
1591     CB->Rmax(3) = CA->GetRmax(3) - CthickThCyl;
1592     CB->Z(4)    = CA->GetZ(4);
1593     CB->Rmin(4) = CA->GetRmin(4) + CthickThCyl;
1594     CB->Rmax(4) = CA->GetRmax(4) - CthickThCyl;
1595     CB->Z(5)    = CA->GetZ(5);
1596     CB->Rmin(5) = CA->GetRmin(5) + CthickThCyl;
1597     CB->Rmax(5) = CA->GetRmax(5) - CthickThCyl;
1598     //
1599     printPcon(CA);
1600     printPcon(CB);
1601     printTube(CC);
1602     TGeoVolume *CAv,*CBv,*CCv;
1603     CAv = new TGeoVolume("ITSssdCentCylCA",CA,SSDcf);
1604     CAv->SetVisibility(kTRUE);
1605     CAv->SetLineColor(4); // blue
1606     CAv->SetLineWidth(1);
1607     CAv->SetFillColor(CAv->GetLineColor());
1608     CAv->SetFillStyle(4010); // 10% transparent
1609     CBv = new TGeoVolume("ITSssdCentCylCB",CB,SSDfs);
1610     CBv->SetVisibility(kTRUE);
1611     CBv->SetLineColor(2); // red
1612     CBv->SetLineWidth(1);
1613     CBv->SetFillColor(CBv->GetLineColor());
1614     CBv->SetFillStyle(4010); // 10% transparent
1615     CCv = new TGeoVolume("ITSssdCentCylCC",CC,SSDfo);
1616     CCv->SetVisibility(kTRUE);
1617     CCv->SetLineColor(3); // green
1618     CCv->SetLineWidth(1);
1619     CCv->SetFillColor(CCv->GetLineColor());
1620     CCv->SetFillStyle(4010); // 10% transparent
1621     CBv->AddNode(CCv,1,0);
1622     CAv->AddNode(CBv,1,0);
1623     Moth->AddNode(CAv,1,0);
1624     if(GetDebug()){
1625         CAv->PrintNodes();
1626         CBv->PrintNodes();
1627         CCv->PrintNodes();
1628     } // end if
1629     //
1630     const Double_t Thickness = 13.0*kmm; // Thickness of Rohacell+carbon fiber
1631     const Double_t Cthick    = 1.5*kmm; // Carbon finber thickness
1632     const Double_t Rcurv     = 15.0*kmm; // Radius of curvature.
1633     const Double_t Tc        = 51.0; // angle of SSD cone [degrees].
1634     const Double_t Sintc = TMath::Sin(Tc*TMath::DegToRad());
1635     const Double_t Costc = TMath::Cos(Tc*TMath::DegToRad());
1636     const Double_t Tantc = TMath::Tan(Tc*TMath::DegToRad());
1637     const Double_t ZouterMilled = (13.5-5.0)*kmm;
1638     const Double_t Zcylinder    = 170.0*kmm;
1639     const Double_t Z0           = Zcylinder + 0.5*ZThCylinder;
1640     const Int_t Nspoaks         = 12;
1641     const Int_t Nmounts         = 4;
1642     const Double_t DmountAngle  = 9.0; // degrees
1643     const Double_t RoutMax      = 0.5*985.0*kmm;
1644     const Double_t RoutHole     = 0.5*965.0*kmm;
1645     const Double_t RoutMin      = 0.5*945.0*kmm;
1646     const Double_t RholeMax     = 0.5*890.0*kmm;
1647     const Double_t RholeMin     = 0.5*740.0*kmm;
1648     const Double_t RpostMin     = 316.0*kmm;
1649     const Double_t ZpostMax     = 196.0*kmm;
1650     const Int_t Nposts          = 6;
1651     const Double_t Phi0Post     = 0.0; // degree
1652     const Double_t dRpost       = 23.0*kmm;
1653     const Double_t RinMax       = 0.5*590.0*kmm;
1654     const Double_t RinCylinder  = 0.5*597.0*kmm;
1655     const Double_t RinHole      = 0.5*575.0*kmm;
1656     const Double_t RinMin       = 0.5*562.0*kmm;
1657     const Double_t dZin         = 15.0*kmm;
1658     // SSD-SDD Thermal/Mechanical cylinder mounts
1659     const Int_t NinScrews          = 40;
1660     const Double_t Phi0Screws      = 0.5*360.0/((const Double_t)NinScrews);//d
1661     const Double_t RcylinderScrews = 0.5*570.0*kmm;//from older drawing????
1662     const Double_t DscrewHead      = 8.0*kmm;
1663     const Double_t DscrewShaft     = 4.6*kmm;
1664     const Double_t ThScrewHeadHole = 8.5*kmm;
1665     // SDD mounting bracket, SSD part
1666     const Double_t NssdSupports      = 3;// mounting of U and T
1667     const Double_t DssdsddBracketAngle = 9.0; // degrees
1668     const Double_t Phi0SDDsupports   = 0.0; // degree
1669     const Double_t RsddSupportPlate  = 0.5*585.0*kmm;
1670     const Double_t ThSDDsupportPlate = 4.0*kmm;
1671     const Double_t WsddSupportPlate  = 70.0*kmm;
1672     //
1673     // Lets start with the upper left outer carbon fiber surface.
1674     // Between za[2],rmaxa[2] and za[4],rmaxa[4] there is a curved section
1675     // given by rmaxa = rmaxa[2]-r*Sind(t) for 0<=t<=Tc and 
1676     // za = za[2] + r*Cosd(t) for 0<=t<=Tc. Simularly between za[1],rmina[1
1677     // and za[3],rmina[3] there is a curve section given by
1678     // rmina = rmina[1]-r*Sind(t) for 0<=t<=Tc and za = za[1]+r&Sind(t)
1679     // for t<=0<=Tc. These curves have been replaced by straight lines
1680     // between the equivelent points for simplicity.
1681     Double_t dza = Thickness/Sintc-(RoutMax-RoutMin)/Tantc;
1682     Int_t i,j;
1683     Double_t x,y,z[9],rn[9],rx[9],phi,dphi;
1684     Double_t t,t0,Z,Rmin,Rmax; // Temp variables.
1685     if(dza<=0){ // The number or order of the points are in error for a proper
1686      // call to pcons!
1687      Error("SSDcone","The definition of the points for a call to PCONS is"
1688            " in error. abort.");
1689      return;
1690     } // end if
1691     // Poly-cone Volume A. Top part of SSD cone Carbon Fiber.
1692     phi   = 0.0;
1693     dphi  = 360.0;
1694     z[0]  = 0.0;
1695     rn[0] = RoutMin;
1696     rx[0] = RoutMax;
1697     z[1]  = z[0]+ZouterMilled - dza; // za[2] - dza.
1698     rn[1] = rn[0];
1699     rx[1] = rx[0];
1700     z[2]  = z[0]+ZouterMilled;//From Drawing ALR-0767 and ALR-0767/3
1701     rx[2] = rx[0];
1702     RadiusOfCurvature(Rcurv,0.,z[1],rn[1],Tc,z[3],rn[3]);
1703     rn[2] = RFrom2Points(rn,z,3,1,z[2]);
1704     RadiusOfCurvature(Rcurv,0.,z[2],rx[2],Tc,z[4],rx[4]);
1705     rn[4] = RminFromZpCone(rn,z,Tc,z[4]);
1706     rx[3] = RFrom2Points(rx,z,4,2,z[3]);
1707     rn[5] = RholeMax;
1708     z[5]  = Zfrom2Points(z,rn,4,3,rn[5]);
1709     rx[5] = RmaxFromZpCone(rx,z,Tc,z[5]);
1710     rn[6] = RholeMax;
1711     rx[6] = rn[6];
1712     z[6]  = ZFromRmaxpCone(rx,z,Tc,rx[6]);
1713     TGeoPcon *A = new TGeoPcon("ITS SSD Suport cone Carbon Fiber "
1714                        "Surface outer left",phi,dphi,7);
1715     for(i=0;i<A->GetNz();i++){
1716         A->DefineSection(i,z[i],rn[i],rx[i]);
1717     } // end for i
1718     printPcon(A);
1719     //
1720     // Poly-cone Volume B. Stesalite inside volume A.
1721     // Now lets define the Inserto Stesalite 4411w material volume.
1722     phi   = 0.0;
1723     dphi  = 360.0;
1724     z[0]  = A->GetZ(0);
1725     rn[0] = A->GetRmin(0)+Cthick;
1726     rx[0] = A->GetRmax(0)-Cthick;
1727     z[1]  = A->GetZ(1);
1728     rn[1] = rn[0];
1729     rx[1] = rx[0];
1730     z[2]  = A->GetZ(2);
1731     rx[2] = rx[1];
1732     RadiusOfCurvature(Rcurv-Cthick,0.,z[2],rx[2],Tc,z[3],rx[3]);
1733     RadiusOfCurvature(Rcurv+Cthick,0.,z[1],rn[1],Tc,z[4],rn[4]);
1734     rn[2] = RFrom2Points(rn,z,4,1,z[2]);
1735     rn[3] = RFrom2Points(rn,z,4,1,z[3]);
1736     z[5]  = z[4]+(Thickness-2.0*Cthick)/Sintc;
1737     rn[5] = RmaxFromZpCone(A,Tc,z[5],-Cthick);
1738     rx[5] = rn[5];
1739     rx[4] = RFrom2Points(rx,z,5,3,z[4]);
1740     TGeoPcon *B = new TGeoPcon("ITS SSD Suport cone Inserto Stesalite "
1741                        "left edge",phi,dphi,6);
1742     for(i=0;i<B->GetNz();i++){
1743         B->DefineSection(i,z[i],rn[i],rx[i]);
1744     } // end for i
1745     printPcon(B);
1746     //
1747     // Poly-cone Volume C. Foam inside volume A.
1748     // Now lets define the Rohacell foam material volume.
1749     phi   = 0.0;
1750     dphi  = 360.0;
1751     z[0]  = B->GetZ(4);
1752     rn[0] = B->GetRmin(4);
1753     rx[0] = rn[0];
1754     z[1]  = B->GetZ(5);
1755     rx[1] = B->GetRmin(5);
1756     rn[2] = A->GetRmin(5)+Cthick;//space for carbon fiber covering hole
1757     z[2]  = ZFromRminpCone(A,Tc,rn[2],+Cthick);
1758     rn[1] = RFrom2Points(rn,z,2,0,z[1]);
1759     rx[3] = A->GetRmin(6)+Cthick;
1760     rn[3] = rx[3];
1761     z[3]  = ZFromRmaxpCone(A,Tc,rx[3],-Cthick);
1762     rx[2] = RFrom2Points(rx,z,3,1,z[2]);
1763     TGeoPcon *C = new TGeoPcon("ITS SSD Suport cone Rohacell foam "
1764                        "left edge",phi,dphi,4);
1765     for(i=0;i<C->GetNz();i++){
1766         C->DefineSection(i,z[i],rn[i],rx[i]);
1767     } // end for i
1768     printPcon(C);
1769     //
1770     // In volume SCB, th Inserto Stesalite 4411w material volume, there
1771     // are a number of Stainless steel screw and pin studs which will be
1772     // filled with screws/studs.
1773     rn[0] = 0.0*kmm,rx[0] = 6.0*kmm,z[0] = 0.5*10.0*kmm; // mm
1774     TGeoTube *D = new TGeoTube("ITS Screw+stud used to mount things to "
1775                        "the SSD support cone",rn[0],rx[0],z[0]);
1776     printTube(D);
1777     rn[0] = 0.0*kmm;rx[0] = 6.0*kmm;z[0] = 0.5*12.0*kmm; // mm
1778     TGeoTube *E = new TGeoTube("ITS pin used to mount things to the "
1779                        "SSD support cone",rn[0],rx[0],z[0]);
1780     printTube(E);
1781     //
1782     // Poly-cone Volume F. Foam in spoak reagion, inside volume A.
1783     // There is no carbon fiber between this upper left section and the
1784     // SSD spoaks. We remove it by replacing it with Rohacell foam.
1785     t = Cthick/(0.5*(RholeMax+RholeMin));// It is not posible to get
1786     // the carbon fiber thickness uniform in this phi direction. We can only
1787     // make it a fixed angular thickness.
1788     t *= 180.0/TMath::Pi();
1789     phi  = 12.5+t; // degrees see drawing ALR-0767.
1790     dphi  = 5.0 - 2.0*t; // degrees
1791     z[0]  = C->GetZ(2);
1792     rn[0] = C->GetRmin(3);
1793     rx[0] = rn[0];
1794     rn[1] = A->GetRmin(5);
1795     rx[1] = rn[0];
1796     z[1]  = ZFromRminpCone(A,Tc,rn[1],+Cthick);
1797     z[2]  = C->GetZ(3);
1798     rn[2] = rn[1];
1799     rx[2] = rx[1];
1800     rn[3] = A->GetRmin(6);
1801     rx[3] = rn[3];
1802     z[3]  = ZFromRmaxpCone(A,Tc,rx[3],-Cthick);
1803     TGeoPcon *F = new TGeoPcon("ITS SSD Top Suport cone Rohacell foam "
1804                        "Spoak",phi,dphi,4);
1805     for(i=0;i<F->GetNz();i++){
1806         F->DefineSection(i,z[i],rn[i],rx[i]);
1807     } // end for i
1808     printPcon(F);
1809     //=================================================================
1810      // Poly-cone Volume G.
1811     // Now for the spoak part of the SSD cone.
1812     // It is not posible to inclue the radius of curvature between
1813     // the spoak part and the upper left part of the SSD cone or lowwer right
1814     // part. This would be discribed by the following curves.
1815     // R = Rmax - (5mm)*Sin(t) phi = phi0+(5mm*180/(Pi*RoutHole))*Sin(t) 
1816     // where 0<=t<=90 For the inner curve a simular equiation holds.
1817     phi   = 12.5; // degrees see drawing ALR-0767.
1818     dphi  = 5.0; // degrees
1819     z[0]  = A->GetZ(5);
1820     rn[0] = A->GetRmin(5);
1821     rx[0] = rn[0];
1822     z[1]  = A->GetZ(6);
1823     rn[1] = RminFromZpCone(A,Tc,z[1]);
1824     rx[1] = rx[0];
1825     rn[2] = RholeMin;
1826     z[2]  = ZFromRminpCone(A,Tc,rn[2]);
1827     rx[2] = RmaxFromZpCone(A,Tc,z[2]);
1828     rn[3] = rn[2];
1829     rx[3] = rn[3];
1830     z[3]  = ZFromRmaxpCone(A,Tc,rx[3]);
1831     TGeoPcon *G = new TGeoPcon("ITS SSD spoak carbon fiber surfaces",
1832                        phi,dphi,4);
1833     for(i=0;i<G->GetNz();i++){
1834         G->DefineSection(i,z[i],rn[i],rx[i]);
1835     } // end for i
1836     printPcon(G);
1837     // For the foam core.
1838     // Poly-cone Volume H.
1839     t = Cthick/(0.5*(RholeMax+RholeMin));// It is not posible to get the
1840     // carbon fiber thickness uniform in this phi direction. We can only
1841     // make it a fixed angular thickness.
1842     t *= 180.0/TMath::Pi();
1843     phi   = 12.5+t; // degrees
1844     dphi  = 5.0 - 2.0*t; // degrees see drawing ALR-0767.
1845     z[0]  = F->GetZ(1);
1846     rn[0] = G->GetRmin(0);
1847     rx[0] = rn[0];
1848     z[1]  = F->GetZ(3);
1849     rn[1] = RminFromZpCone(A,Tc,z[1],+Cthick);
1850     rx[1] = rx[0];
1851     z[2]  = ZFromRminpCone(A,Tc,G->GetRmin(2),+Cthick);
1852     rn[2] = G->GetRmin(2);
1853     rx[2] = RmaxFromZpCone(A,Tc,z[2],-Cthick);
1854     z[3]  = ZFromRmaxpCone(A,Tc,G->GetRmin(3),-Cthick);
1855     rn[3] = G->GetRmin(3);
1856     rx[3] = rn[3];
1857     TGeoPcon *H = new TGeoPcon("ITS SSD support cone Rohacell foam Spoak",
1858                        phi,dphi,4); 
1859     for(i=0;i<H->GetNz();i++){
1860         H->DefineSection(i,z[i],rn[i],rx[i]);
1861     } // end for i
1862     printPcon(H);
1863     //
1864     //==================================================================
1865     // Now for the Inner most part of the SSD cone.
1866     //Poly-cone Volume I.
1867     phi   = 0.0;
1868     dphi  = 360.0;
1869     z[0]  = G->GetZ(2);
1870     rn[0] = G->GetRmin(2);
1871     rx[0] = rn[0];
1872     z[1]  = G->GetZ(3);
1873     rn[1] = RminFromZpCone(A,Tc,z[1]);
1874     rx[1] = rx[0];
1875     rn[4] = RinMin;
1876     rn[5] = RinMin;
1877     RadiusOfCurvature(Rcurv,90.0,0.0,RinMax,90.0-Tc,Z,rx[5]); // z dummy
1878     z[5]  = ZFromRmaxpCone(A,Tc,rx[5]);
1879     z[6]  = Zcylinder;
1880     rn[6] = RinMin;
1881     z[7]  = z[6];
1882     rn[7] = RinCylinder;
1883     rn[8] = RinCylinder;
1884     rx[8] = rn[8];
1885     Rmin   = rn[5];
1886     RadiusOfCurvature(Rcurv,90.0-Tc,z[5],rx[5],90.0,Z,Rmax);
1887     Rmax   = RinMax;
1888     z[8]  = Z+(z[5]-Z)*(rx[8]-Rmax)/(rx[5]-Rmax);
1889     rx[6] = RFrom2Points(rx,z,8,5,z[6]);
1890     rx[7] = rx[6];
1891     z[3]  = Z-dZin;
1892     z[4]  = z[3];
1893     rx[3] = RmaxFromZpCone(A,Tc,z[3]);
1894     rx[4] = rx[3];
1895     //rmin dummy
1896     RadiusOfCurvature(Rcurv,90.,z[3],0.,90.-Tc,z[2],Rmin);
1897     rn[2] = RminFromZpCone(A,Tc,z[2]);
1898     rx[2] = RmaxFromZpCone(A,Tc,z[2]);
1899     // z dummy
1900     RadiusOfCurvature(Rcurv,90.-Tc,0.0,rn[2],90.0,Z,rn[3]);
1901     TGeoPcon *I = new TGeoPcon("ITS SSD lower/inner right part of SSD "
1902                        "cone",phi,dphi,9);
1903     for(i=0;i<I->GetNz();i++){
1904         I->DefineSection(i,z[i],rn[i],rx[i]);
1905     } // end for i
1906     printPcon(I);
1907     // Now for Inserto volume at the inner most radius.
1908     // Poly-cone Volume K.
1909     phi   = 0.0;
1910     dphi  = 360.0;
1911     z[1]  = I->GetZ(3)+Cthick;
1912     rn[1] = I->GetRmin(3);
1913     z[2]  = z[1];
1914     rn[2] = I->GetRmin(4);
1915     rn[3] = rn[2];
1916     rn[4] = rn[2];
1917     rx[4] = I->GetRmax(5)-Cthick*Sintc;
1918     RadiusOfCurvature(Rcurv+Cthick,90.0,z[1],rn[1],90.0-Tc,z[0],rn[0]);
1919     rx[0] = rn[0];
1920     z[3]  = z[0]+(Thickness-2.0*Cthick)*Costc;;
1921     rx[3] = rx[0]+(Thickness-2.0*Cthick)*Sintc;
1922     rx[1] = RFrom2Points(rx,z,3,0,z[1]);
1923     rx[2] = rx[1];
1924     z[4]  = ZFromRmaxpCone(A,Tc,rx[4],-Cthick);
1925     rn[5] = rn[2];
1926     z[5]  = I->GetZ(6);
1927     rx[5] = (I->GetRmax(5)-I->GetRmax(8))/(I->GetZ(5)-I->GetZ(8))*(z[5]-z[4])+
1928           rx[4];
1929     TGeoPcon *K = new TGeoPcon("ITS SSD inner most inserto material",
1930                        phi,dphi,6);
1931     for(i=0;i<K->GetNz();i++){
1932         K->DefineSection(i,z[i],rn[i],rx[i]);
1933     } // end for i
1934     printPcon(K);
1935     // Now for foam core at the inner most radius.
1936     // Poly-cone Volume J.
1937     phi   = 0.0;
1938     dphi  = 360.0;
1939     rn[0] = I->GetRmin(0)-Cthick;
1940     z[0]  = ZFromRminpCone(A,Tc,rn[0],+Cthick);
1941     rx[0] = rn[0];
1942     rx[1] = rx[0];
1943     z[1]  = ZFromRmaxpCone(A,Tc,rx[1],-Cthick);
1944     rn[1] = RminFromZpCone(A,Tc,z[1],+Cthick);
1945     z[2]  = K->GetZ(0);
1946     rn[2] = K->GetRmin(0);
1947     rx[2] = RmaxFromZpCone(A,Tc,z[2],-Cthick);
1948     z[3]  = K->GetZ(3);
1949     rn[3] = K->GetRmax(3);
1950     rx[3] = rn[3];
1951     TGeoPcon *J = new TGeoPcon("ITS SSD inner most foam core",phi,dphi,4); 
1952     for(i=0;i<J->GetNz();i++){
1953         J->DefineSection(i,z[i],rn[i],rx[i]);
1954     } // end for i
1955     printPcon(J);
1956     // Now for foam core at the top of the inner most radius where 
1957     // the spoaks are.
1958     t = Cthick/(0.5*(RholeMax+RholeMin));// It is not posible to get the
1959     // carbon fiber thickness uniform in this phi direction. We can only
1960     // make it a fixed angular thickness.
1961     // Poly-cone Volume L.
1962     t *= 180.0/TMath::Pi();
1963     phi   = 12.5+t; // degrees
1964     dphi  = 5.0 - 2.0*t; // degrees see drawing ALR-0767.
1965     z[0]  = H->GetZ(2);
1966     rn[0] = H->GetRmin(2);
1967     rx[0] = rn[0];
1968     z[1]  = J->GetZ(0);
1969     rn[1] = J->GetRmin(0);
1970     rx[1] = I->GetRmax(1);
1971     z[2]  = H->GetZ(3);
1972     rn[2] = rn[1];
1973     rx[2] = rx[1];
1974     z[3]  = J->GetZ(1);
1975     rn[3] = rn[2];
1976     rx[3] = rn[3];
1977     TGeoPcon *L = new TGeoPcon("ITS SSD Bottom cone Rohacell foam Spoak",
1978                        phi,dphi,4);
1979     for(i=0;i<L->GetNz();i++){
1980         L->DefineSection(i,z[i],rn[i],rx[i]);
1981     } // end for i
1982     printPcon(L);
1983     // Now for the SSD mounting posts
1984     // Poly-cone Volume O.
1985     dphi  = 180.0*dRpost/(RpostMin+0.5*dRpost)/TMath::Pi(); //
1986     phi   = Phi0Post-0.5*dphi; // degrees
1987     rn[0] = RpostMin+dRpost;
1988     rx[0] = rn[0];
1989     z[0]  = ZFromRmaxpCone(A,Tc,rx[0]);
1990     rn[1] = RpostMin;
1991     z[1]  = ZFromRmaxpCone(A,Tc,rn[1]);
1992     rx[1] = rx[0];
1993     z[2]  = ZpostMax;
1994     rn[2] = RpostMin;
1995     rx[2] = rn[2]+dRpost;
1996     TGeoPcon *O = new TGeoPcon("ITS SSD mounting post, carbon fiber",
1997                        phi,dphi,3);
1998     for(i=0;i<O->GetNz();i++){
1999         O->DefineSection(i,z[i],rn[i],rx[i]);
2000     } // end for i
2001     printPcon(O);
2002     // Now for the SSD mounting posts
2003     // Poly-cone Volume P.
2004     t = 180.0*Cthick/(RpostMin+0.5*dRpost)/TMath::Pi();
2005     dphi  = O->GetDphi()-2.0*t; // degrees
2006     phi   = O->GetPhi1()+t; //
2007     rn[0] = O->GetRmin(0)-Cthick;
2008     rx[0] = rn[0];
2009     z[0]  = ZFromRmaxpCone(A,Tc,rx[0]);
2010     rn[1] = O->GetRmin(1)+Cthick;
2011     rx[1] = O->GetRmin(0)-Cthick;
2012     z[1]  = ZFromRmaxpCone(A,Tc,rn[1]);
2013     rn[2] = rn[1];
2014     rx[2] = rx[1];
2015     z[2]  = ZpostMax;
2016     TGeoPcon *P = new TGeoPcon("ITS SSD mounting post, Inserto",
2017                        phi,dphi,3);
2018     for(i=0;i<P->GetNz();i++){
2019         P->DefineSection(i,z[i],rn[i],rx[i]);
2020     } // end for i
2021     printPcon(P);
2022     // This insrto continues into the SSD cone displacing the foam
2023     // and the carbon fiber surface at those points where the posts are.
2024     //Poly-cone Vol. M
2025     phi   = P->GetPhi1();
2026     dphi  = P->GetDphi();
2027     rn[0] = RpostMin+dRpost-Cthick;
2028     rx[0] = rn[0];
2029     z[0]  = ZFromRminpCone(A,Tc,rn[0],+Cthick);
2030     rx[1] = rx[0];
2031     z[1]  = ZFromRmaxpCone(A,Tc,rx[1],-Cthick);
2032     rn[1] = RminFromZpCone(A,Tc,z[1],+Cthick);
2033     rn[2] = RpostMin+Cthick;
2034     z[2]  = ZFromRminpCone(A,Tc,rn[2],+Cthick);
2035     rx[2] = RmaxFromZpCone(A,Tc,z[2],-Cthick);
2036     rn[3] = rn[2];
2037     rx[3] = rn[3];
2038     z[3]  = ZFromRmaxpCone(A,Tc,rx[3],-Cthick);
2039     TGeoPcon *M = new TGeoPcon("ITS SSD mounting post foam substitute, "
2040                        "Inserto",phi,dphi,4);
2041     for(i=0;i<M->GetNz();i++){
2042         M->DefineSection(i,z[i],rn[i],rx[i]);
2043     } // end for i
2044     printPcon(M);
2045     //
2046     //Poly-cone Vol. N
2047     phi   = P->GetPhi1();
2048     dphi  = P->GetDphi();
2049     z[0]  = M->GetZ(1);
2050     rn[0] = M->GetRmax(1);
2051     rx[0] = rn[0];
2052     rx[1] = rx[0];
2053     z[1]  = ZFromRmaxpCone(A,Tc,rx[1]);
2054     rn[1] = RmaxFromZpCone(A,Tc,z[1],-Cthick);
2055     z[2]  = M->GetZ(3);
2056     rn[2] = M->GetRmin(3);
2057     rx[2] = RmaxFromZpCone(A,Tc,z[2]);
2058     rn[3] = rn[2];
2059     rx[3] = rn[3];
2060     z[3]  = ZFromRmaxpCone(A,Tc,rx[3]);
2061     TGeoPcon *N = new TGeoPcon("ITS SSD mounting post CF subsititute, "
2062                        "Inserto",phi,dphi,4);
2063     for(i=0;i<N->GetNz();i++){ 
2064         N->DefineSection(i,z[i],rn[i],rx[i]);
2065     } // end for i
2066     printPcon(N);
2067     // Bolt heads holding the SSD-SDD tube to the SSD cone.
2068     // Bolt -- PolyCone
2069     //Poly-cone Volume Q.
2070     phi   = 0.0;
2071     dphi  = 360.0;
2072     z[0]  = I->GetZ(4)+ThSDDsupportPlate;
2073     rn[0] = 0.0;
2074     rx[0] = 0.5*DscrewHead;
2075     z[1]  = I->GetZ(4)+ThScrewHeadHole;
2076     rn[1] = 0.0;
2077     rx[1] = 0.5*DscrewHead;
2078     z[2]  = z[1];
2079     rn[2] = 0.0;
2080     rx[2] = 0.5*DscrewShaft;
2081     z[3]  = I->GetZ(6);
2082     rn[3] = 0.0;
2083     rx[3] = rx[2];
2084     TGeoPcon *Q = new TGeoPcon("ITS SSD Thermal sheal stainless steel "
2085                        "bolts",phi,dphi,4);
2086     for(i=0;i<Q->GetNz();i++){
2087         Q->DefineSection(i,z[i],rn[i],rx[i]);
2088     } // end for i
2089     printPcon(Q);
2090     // air infront of bolt (stasolit Volume K) -- Tube
2091     z[0]  = 0.5*(ThSDDsupportPlate-Cthick);
2092     rn[0] = 0.0*kmm;
2093     rx[0] = 0.5*DscrewHead;
2094     TGeoTube *R = new TGeoTube("ITS Air in front of bolt (in stasolit)",
2095                        rn[0],rx[0],z[0]);
2096     // air infront of bolt (carbon fiber volume I) -- Tube
2097     z[0]  = 0.5*Cthick;
2098     rn[0] = 0.0*kmm;
2099     rx[0] = R->GetRmax();
2100     TGeoTube *S = new TGeoTube("ITS Air in front of Stainless Steal "
2101                        "Screw end, N6",rn[0],rx[0],z[0]);
2102     printTube(S);
2103     // SDD support plate, SSD side.
2104     //Poly-cone Volume T.
2105     dphi  = TMath::RadToDeg()*TMath::ATan2(0.5*WsddSupportPlate,
2106                                            RsddSupportPlate);
2107     phi   = Phi0SDDsupports-0.5*dphi;
2108     z[0]  = K->GetZ(2);
2109     rn[0] = I->GetRmin(4);
2110     rx[0] = RsddSupportPlate;
2111     z[1]  = I->GetZ(4) - ThSDDsupportPlate;
2112     rn[1] = rn[0];
2113     rx[1] = rx[0];
2114     TGeoPcon *T = new TGeoPcon("ITS SSD-SDD mounting bracket Inserto->Al.",
2115                        phi,dphi,2);
2116     for(i=0;i<T->GetNz();i++){
2117         T->DefineSection(i,z[i],rn[i],rx[i]);
2118     } // end for i
2119     printPcon(T);
2120     //
2121     // Poly-cone Volume U.
2122     TGeoPcon *U;
2123     if(I->GetRmin(3)<T->GetRmax(0)){
2124      dphi  = T->GetDphi();
2125      phi   = T->GetPhi1();
2126      z[2]  = I->GetZ(4);
2127      rn[2] = T->GetRmin(0);
2128      rx[2] = T->GetRmax(0);
2129      z[3]  = K->GetZ(2);
2130      rn[3] = rn[2];
2131      rx[3] = rx[2];
2132      z[1]  = z[2];
2133      rn[1] = I->GetRmin(3);
2134      rx[1] = rx[3];
2135      rx[0] = T->GetRmax(0);
2136      rn[0] = rx[0];
2137      z[0]  = Zfrom2MinPoints(I,2,3,rn[0]);
2138      U = new TGeoPcon("ITS SSD-SDD mounting bracket CF->Al.",phi,dphi,4);
2139     }else{
2140      dphi  = T->GetDphi();
2141      phi   = T->GetPhi1();
2142      z[0]  = I->GetZ(4);
2143      rn[0] = T->GetRmin(0);
2144      rx[0] = T->GetRmax(0);
2145      z[1]  = K->GetZ(2);
2146      rn[1] = rn[0];
2147      rx[1] = rx[0];
2148      U = new TGeoPcon("ITS SSD-SDD mounting bracket CF->Al.",phi,dphi,2);
2149     }// end if
2150     for(i=0;i<U->GetNz();i++){
2151         U->DefineSection(i,z[i],rn[i],rx[i]);
2152     } // end for i
2153     printPcon(U);
2154     //
2155     TGeoVolume *Av,*Bv,*Cv,*Dv,*Ev,*Fv,*Gv,*Hv,*Iv,*Jv,*Kv,*Lv,*Mv,*Nv,
2156             *Ov,*Pv,*Qv,*Rv,*Sv,*Tv,*Uv;
2157     Av = new TGeoVolume("ITSssdConeA",A,SSDcf);
2158     Av->SetVisibility(kTRUE);
2159     Av->SetLineColor(4); // blue
2160     Av->SetLineWidth(1);
2161     Av->SetFillColor(Av->GetLineColor());
2162     Av->SetFillStyle(4010); // 10% transparent
2163     Bv = new TGeoVolume("ITSssdConeB",B,SSDfs);
2164     Bv->SetVisibility(kTRUE);
2165     Bv->SetLineColor(2); // red
2166     Bv->SetLineWidth(1);
2167     Bv->SetFillColor(Bv->GetLineColor());
2168     Bv->SetFillStyle(4010); // 10% transparent
2169     Cv = new TGeoVolume("ITSssdConeC",C,SSDfo);
2170     Cv->SetVisibility(kTRUE);
2171     Cv->SetLineColor(3); // green
2172     Cv->SetLineWidth(1);
2173     Cv->SetFillColor(Cv->GetLineColor());
2174     Cv->SetFillStyle(4010); // 10% transparent
2175     Dv = new TGeoVolume("ITSssdConeD",D,SSDss);
2176     Dv->SetVisibility(kTRUE);
2177     Dv->SetLineColor(1); // black
2178     Dv->SetLineWidth(1);
2179     Dv->SetFillColor(Dv->GetLineColor());
2180     Dv->SetFillStyle(4010); // 10% transparent
2181     Ev = new TGeoVolume("ITSssdConeE",E,SSDss);
2182     Ev->SetVisibility(kTRUE);
2183     Ev->SetLineColor(1); // black
2184     Ev->SetLineWidth(1);
2185     Ev->SetFillColor(Ev->GetLineColor());
2186     Ev->SetFillStyle(4010); // 10% transparent
2187     Fv = new TGeoVolume("ITSssdConeF",F,SSDfo);
2188     Fv->SetVisibility(kTRUE);
2189     Fv->SetLineColor(3); // green
2190     Fv->SetLineWidth(1);
2191     Fv->SetFillColor(Fv->GetLineColor());
2192     Fv->SetFillStyle(4010); // 10% transparent
2193     Gv = new TGeoVolume("ITSssdConeG",G,SSDcf);
2194     Gv->SetVisibility(kTRUE);
2195     Gv->SetLineColor(4); // blue
2196     Gv->SetLineWidth(2);
2197     Gv->SetFillColor(Gv->GetLineColor());
2198     Gv->SetFillStyle(4010); // 10% transparent
2199     Hv = new TGeoVolume("ITSssdConeH",H,SSDfo);
2200     Hv->SetVisibility(kTRUE);
2201     Hv->SetLineColor(3); // green
2202     Hv->SetLineWidth(1);
2203     Hv->SetFillColor(Hv->GetLineColor());
2204     Hv->SetFillStyle(4010); // 10% transparent
2205     Iv = new TGeoVolume("ITSssdConeI",I,SSDcf);
2206     Iv->SetVisibility(kTRUE);
2207     Iv->SetLineColor(4); // blue
2208     Iv->SetLineWidth(1);
2209     Iv->SetFillColor(Iv->GetLineColor());
2210     Iv->SetFillStyle(4010); // 10% transparent
2211     Jv = new TGeoVolume("ITSssdConeJ",J,SSDfo);
2212     Jv->SetVisibility(kTRUE);
2213     Jv->SetLineColor(3); // green
2214     Jv->SetLineWidth(3);
2215     Jv->SetFillColor(Jv->GetLineColor());
2216     Jv->SetFillStyle(4010); // 10% transparent
2217     Kv = new TGeoVolume("ITSssdConeK",K,SSDfs);
2218     Kv->SetVisibility(kTRUE);
2219     Kv->SetLineColor(2); // red
2220     Kv->SetLineWidth(1);
2221     Kv->SetFillColor(Kv->GetLineColor());
2222     Kv->SetFillStyle(4010); // 10% transparent
2223     Lv = new TGeoVolume("ITSssdConeL",L,SSDfo);
2224     Lv->SetVisibility(kTRUE);
2225     Lv->SetLineColor(3); // green
2226     Lv->SetLineWidth(3);
2227     Lv->SetFillColor(Lv->GetLineColor());
2228     Lv->SetFillStyle(4010); // 10% transparent
2229     Mv = new TGeoVolume("ITSssdConeM",M,SSDfs);
2230     Mv->SetVisibility(kTRUE);
2231     Mv->SetLineColor(2); // red
2232     Mv->SetLineWidth(1);
2233     Mv->SetFillColor(Mv->GetLineColor());
2234     Mv->SetFillStyle(4010); // 10% transparent
2235     Nv = new TGeoVolume("ITSssdConeN",N,SSDfs);
2236     Nv->SetVisibility(kTRUE);
2237     Nv->SetLineColor(2); // red
2238     Nv->SetLineWidth(1);
2239     Nv->SetFillColor(Nv->GetLineColor());
2240     Nv->SetFillStyle(4010); // 10% transparent
2241     Ov = new TGeoVolume("ITSssdConeO",O,SSDcf);
2242     Ov->SetVisibility(kTRUE);
2243     Ov->SetLineColor(4); // blue
2244     Ov->SetLineWidth(1);
2245     Ov->SetFillColor(Iv->GetLineColor());
2246     Ov->SetFillStyle(4010); // 10% transparent
2247     Pv = new TGeoVolume("ITSssdConeP",P,SSDfs);
2248     Pv->SetVisibility(kTRUE);
2249     Pv->SetLineColor(2); // red
2250     Pv->SetLineWidth(1);
2251     Pv->SetFillColor(Pv->GetLineColor());
2252     Pv->SetFillStyle(4010); // 10% transparent
2253     Qv = new TGeoVolume("ITSssdConeQ",Q,SSDss);
2254     Qv->SetVisibility(kTRUE);
2255     Qv->SetLineColor(1); // black
2256     Qv->SetLineWidth(1);
2257     Qv->SetFillColor(Qv->GetLineColor());
2258     Qv->SetFillStyle(4010); // 10% transparent
2259     Rv = new TGeoVolume("ITSssdConeR",R,SSDair);
2260     Rv->SetVisibility(kTRUE);
2261     Rv->SetLineColor(5); // yellow
2262     Rv->SetLineWidth(1);
2263     Rv->SetFillColor(Rv->GetLineColor());
2264     Rv->SetFillStyle(4010); // 10% transparent
2265     Sv = new TGeoVolume("ITSssdConeS",S,SSDair);
2266     Sv->SetVisibility(kTRUE);
2267     Sv->SetLineColor(5); // yellow
2268     Sv->SetLineWidth(1);
2269     Sv->SetFillColor(Sv->GetLineColor());
2270     Sv->SetFillStyle(4010); // 10% transparent
2271     Tv = new TGeoVolume("ITSssdConeT",T,SSDal);
2272     Tv->SetVisibility(kTRUE);
2273     Tv->SetLineColor(17); // gray
2274     Tv->SetLineWidth(1);
2275     Tv->SetFillColor(Tv->GetLineColor());
2276     Tv->SetFillStyle(4010); // 10% transparent
2277     Uv = new TGeoVolume("ITSssdConeU",U,SSDal);
2278     Uv->SetVisibility(kTRUE);
2279     Uv->SetLineColor(17); // gray
2280     Uv->SetLineWidth(1);
2281     Uv->SetFillColor(Uv->GetLineColor());
2282     Uv->SetFillStyle(4010); // 10% transparent
2283     //
2284     TGeoTranslation *tran = new TGeoTranslation("ITSssdConeTrans",0.0,0.0,-Z0);
2285     TGeoRotation *rot180  = new TGeoRotation("",0.0,180.0,0.0);
2286     TGeoCombiTrans *flip  = new TGeoCombiTrans("ITSssdConeFlip",0.0,0.0,Z0,rot180);
2287     delete rot180;// rot not explicity used in AddNode functions.
2288     TGeoTranslation *tranR,*tranS;
2289     TGeoCombiTrans *fliptran,*rottran;
2290     TGeoRotation *rot,*zspoaks,*zspoaks180;
2291     Int_t NcD=1,NcE=1,NcQ=1,NcR=1,NcS=1,NcT=1,NcU=1;
2292     Av->AddNode(Bv,1,0);
2293     Av->AddNode(Cv,1,0);
2294     Moth->AddNode(Av,1,tran); // RB24 side
2295     Moth->AddNode(Av,2,flip); // RB26 side (Absorber)
2296     Moth->AddNode(Iv,1,tran); // RB24 side
2297     Moth->AddNode(Iv,2,flip); // RB26 side (Absorber)
2298     Gv->AddNode(Hv,1,0);
2299     for(i=0;i<Nspoaks;i++){ // SSD Cone Spoaks
2300      zspoaks = new TGeoRotation("",0.0,0.0,
2301                        ((Double_t)i*360.)/((Double_t)Nspoaks));
2302      rottran = new TGeoCombiTrans("",0.0,0.0,-Z0,zspoaks);
2303      Moth->AddNode(Gv,i+1,rottran); // RB24 side
2304      Av->AddNode(Fv,i+1,zspoaks);
2305      Iv->AddNode(Lv,i+1,zspoaks);
2306      zspoaks180 =  new TGeoRotation("",0.0,180.0,
2307                            ((Double_t)i*360.)/((Double_t)Nspoaks));
2308      fliptran = new TGeoCombiTrans("",0.0,0.0,Z0,zspoaks180);
2309      delete zspoaks180;// rot not explicity used in AddNode functions.
2310      Moth->AddNode(Gv,Nspoaks+i+1,fliptran); // RB26 side
2311     } // end for i
2312     Iv->AddNode(Jv,1,0);
2313     Iv->AddNode(Kv,1,0);
2314     Ov->AddNode(Pv,1,0);
2315     t0 = (P->GetPhi1()+0.5*P->GetDphi())*kRadian;
2316     t  = (0.25* P->GetDphi())*kRadian;
2317     z[0] = 0.5*(P->GetRmin(2)+P->GetRmax(2))+
2318           0.25*(P->GetRmax(2)-P->GetRmin(2));
2319     x = z[0]*TMath::Cos(t0+t);
2320     y = z[0]*TMath::Sin(t0+t);
2321     tran = new TGeoTranslation("",x,y,P->GetZ(2)-Q->GetZ(3));
2322     Pv->AddNode(Qv,NcQ++,tran); // Screw head
2323     z[0] = 0.5*(P->GetRmin(2)+P->GetRmax(2))-
2324           0.25*(P->GetRmax(2)-P->GetRmin(2));
2325     x = z[0]*TMath::Cos(t0-t);
2326     y = z[0]*TMath::Sin(t0-t);
2327     tran = new TGeoTranslation("",x,y,P->GetZ(2)-Q->GetZ(3));
2328     Pv->AddNode(Qv,NcQ++,tran); // Screw head
2329     //Pv->AddNode(Vv,1,?); // Air hole in Posts
2330     //Pv->AddNode(Vv,2,?); // Air hole in Posts
2331     //Mv->AddNode(Wv,1,?); // Air hole in Posts
2332     //Mv->AddNode(Wv,2,?); // Air hole in Posts
2333     //Nv->AddNode(Xv,1,?); // Air hole in Posts
2334     //Nv->AddNode(Xv,2,?); // Air hole in Posts
2335     TGeoRotation *zposts,*zposts180;
2336     for(i=0;i<Nposts;i++){ // SSD Cone mounting posts
2337         zposts = new TGeoRotation("",0.0,0.0,
2338                                   ((Double_t)i*360.)/((Double_t)Nposts));
2339         rottran = new TGeoCombiTrans("",0.0,0.0,-Z0,zposts);
2340         Moth->AddNode(Ov,i+1,rottran); // RB24 side
2341         Jv->AddNode(Mv,i+1,zposts);
2342         Iv->AddNode(Nv,i+1,zposts);
2343         //Jv->AddNode(Xv,2*i+3,?); // Air hole in Posts
2344         //Jv->AddNode(Xv,2*i+4,?); // Air hole in Posts
2345         zposts180 = new TGeoRotation("",0.0,180.0,
2346                                      ((Double_t)i*360.)/((Double_t)Nposts));
2347         fliptran = new TGeoCombiTrans("",0.0,0.0,Z0,zposts180);
2348         delete zposts180;// rot not explicity used in AddNode functions.
2349         Moth->AddNode(Ov,Nposts+i+1,fliptran); // RB26 side
2350     } // end for i
2351     //
2352     for(i=0;i<NinScrews;i++){
2353         t = (Phi0Screws+360.*((Double_t)i)/((Double_t)NinScrews))*kRadian;
2354         tran= new TGeoTranslation("",RcylinderScrews*TMath::Cos(t),
2355                                   RcylinderScrews*TMath::Sin(t),0.0);
2356         Kv->AddNode(Qv,NcQ++,tran);
2357         tran = new TGeoTranslation("",RcylinderScrews*TMath::Cos(t),
2358                                   RcylinderScrews*TMath::Sin(t),
2359                                    CB->GetZ(0)+D->GetDz());
2360         CBv->AddNode(Dv,NcD++,tran);
2361         tran = new TGeoTranslation("",RcylinderScrews*TMath::Cos(t),
2362                                   RcylinderScrews*TMath::Sin(t),
2363                                    CB->GetZ(5)-D->GetDz());
2364         CBv->AddNode(Dv,NcD++,tran);
2365         if(/*not where volumes U and T are*/kTRUE){
2366             tranR = new TGeoTranslation("",RcylinderScrews*TMath::Cos(t),
2367                                         RcylinderScrews*TMath::Sin(t),
2368                                         K->GetZ(2)+R->GetDz());
2369             tranS = new TGeoTranslation("",RcylinderScrews*TMath::Cos(t),
2370                                         RcylinderScrews*TMath::Sin(t),
2371                                         I->GetZ(4)+S->GetDz());
2372             Kv->AddNode(Rv,NcR++,tranR);
2373             Iv->AddNode(Sv,NcS++,tranS);
2374         } // end if
2375     } // end for i
2376     const Int_t Nbscrew=2,Nbpins=3,Nrailsc=4,Nrailp=2;
2377     Double_t da[] = {-3.5,-1.5,1.5,3.5};
2378     for(i=0;i<2;i++){ // Mounting for ITS-TPC bracket or ITS-Rails
2379         t0 = 180.*((Double_t)i)*kRadian;
2380         for(j=-Nbscrew/2;j<=Nbscrew/2;j++)if(j!=0){//screws per ITS-TPC bracket
2381             t = t0 + 5.0*((Double_t)j)*kRadian;
2382             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
2383                                        RoutHole*TMath::Sin(t),
2384                                        B->GetZ(0)+D->GetDz());
2385             Bv->AddNode(Dv,NcD++,tran);
2386         } // end or j
2387         for(j=-Nbpins/2;j<=Nbpins/2;j++){ // pins per ITS-TPC bracket
2388             t = t0 + 3.0*((Double_t)j)*kRadian;
2389             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
2390                                        RoutHole*TMath::Sin(t),
2391                                        B->GetZ(0)+D->GetDz());
2392             Bv->AddNode(Ev,NcE++,tran);
2393         } // end or j
2394         t0 = (96.5+187.*((Double_t)i))*kRadian;
2395         for(j=0;j<Nrailsc;j++){ // screws per ITS-rail bracket
2396             t = t0+da[j]*kRadian;
2397             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
2398                                        RoutHole*TMath::Sin(t),
2399                                        B->GetZ(0)+D->GetDz());
2400             Bv->AddNode(Dv,NcD++,tran);
2401         } // end or j
2402         t0 = (91.5+184.*((Double_t)i))*kRadian;
2403         for(j=-Nrailp/2;j<=Nrailp/2;j++)if(j!=0){ // pins per ITS-rail bracket
2404             t = t0+(7.0*((Double_t)j))*kRadian;
2405             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
2406                                        RoutHole*TMath::Sin(t),
2407                                        B->GetZ(0)+D->GetDz());
2408             Bv->AddNode(Ev,NcE++,tran);
2409         } // end or j
2410     } // end for i
2411     for(i=0;i<Nmounts;i++){ // mounting points for SPD-cone+Beam-pipe support
2412         t0 = (45.0+((Double_t)i)*360./((Double_t)Nmounts))*kRadian;
2413         for(j=-1;j<=1;j++)if(j!=0){ // 2 screws per bracket
2414             t = t0+((Double_t)j)*0.5*DmountAngle*kRadian;
2415             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
2416                                        RoutHole*TMath::Sin(t),
2417                                        B->GetZ(0)+D->GetDz());
2418             Bv->AddNode(Dv,NcD++,tran);
2419         } // end for j
2420         for(j=0;j<1;j++){ // 1 pin per bracket
2421             t = t0;
2422             tran = new TGeoTranslation("",RoutHole*TMath::Cos(t),
2423                                        RoutHole*TMath::Sin(t),
2424                                        B->GetZ(0)+D->GetDz());
2425             Bv->AddNode(Ev,NcE++,tran);
2426         } // end for j
2427     } // end for i
2428     t = (T->GetPhi1()+0.5*T->GetDphi())*kRadian;
2429     tran = new TGeoTranslation("",RinHole*TMath::Cos(t),RinHole*TMath::Sin(t),
2430                                T->GetZ(T->GetNz()-1)+R->GetDz());
2431     Tv->AddNode(Rv,NcR++,tran);
2432     t = (U->GetPhi1()+0.5*U->GetDphi())*kRadian;
2433     tran = new TGeoTranslation("",RinHole*TMath::Cos(t),RinHole*TMath::Sin(t),
2434                                U->GetZ(U->GetNz()-1)+S->GetDz());
2435     Uv->AddNode(Sv,NcS++,tran);
2436     for(i=0;i<NssdSupports;i++){ // mounting braclets for SSD/SDD 
2437         t0 = ((Double_t)i*360./((Double_t)NssdSupports));
2438         rot = new TGeoRotation("",0.0,0.0,t0);
2439         Kv->AddNode(Tv,NcT++,rot);
2440         Iv->AddNode(Uv,NcU++,rot);
2441         for(j=0;j<2;j++)if(j!=0){ // 2 pin per bracket
2442             t = t0 + ((Double_t)j)*0.5*DssdsddBracketAngle;
2443             tran = new TGeoTranslation("",RinHole*TMath::Cos(t),
2444                                        RinHole*TMath::Sin(t),
2445                                        T->GetZ(T->GetNz()-1)-E->GetDz());
2446             Kv->AddNode(Ev,NcE++,tran);
2447         } // end for j
2448     } // end for i
2449     if(GetDebug()){
2450         Av->PrintNodes();
2451         Bv->PrintNodes();
2452         Cv->PrintNodes();
2453         Dv->PrintNodes();
2454         Ev->PrintNodes();
2455         Fv->PrintNodes();
2456         Gv->PrintNodes();
2457         Hv->PrintNodes();
2458         Iv->PrintNodes();
2459         Jv->PrintNodes();
2460         Kv->PrintNodes();
2461         Lv->PrintNodes();
2462         Mv->PrintNodes();
2463         Nv->PrintNodes();
2464         Ov->PrintNodes();
2465         Pv->PrintNodes();
2466         Qv->PrintNodes();
2467         Rv->PrintNodes();
2468         Sv->PrintNodes();
2469         Tv->PrintNodes();
2470         Uv->PrintNodes();
2471     } // end if
2472 }
2473 //______________________________________________________________________
2474 void AliITSv11::CreateMaterials(){
2475     // Create ITS materials
2476     //     This function defines the default materials used in the Geant
2477     // Monte Carlo simulations for the geometries AliITSv11.
2478     // In general it is automatically replaced by
2479     // Inputs:
2480     //   none.
2481     // Outputs:
2482     //   none.
2483     // Return
2484     //   none.
2485
2486     //TGeoMaterial *C  = new TGeoMaterial("ITSCarbon",12.0,6.0,2.265);
2487     TGeoMaterial *Al = new TGeoMaterial("ITSAluminum",26.981539,13.0,2.07);
2488     TGeoMixture *Cfiber = new TGeoMixture("ITSCarbonFiber",6,1.930);
2489     TGeoMixture *Rohacell = new TGeoMixture("ITSRohacell",6,1.930);
2490     TGeoMixture *Staselite = new TGeoMixture("ITSStaselite4411w",6,1.930);
2491     TGeoMixture *Air = new TGeoMixture("ITSAir",6,1.205*1.E-3);
2492     TGeoMixture *Stainless = new TGeoMixture("ITSStainless",6,1.930);
2493     //
2494     Double_t SPDcone[20];
2495     SPDcone[0] = 1.0; // imat
2496     SPDcone[1] = 0.0; // isvol
2497     SPDcone[2] = gAlice->Field()->Integ(); // ifield
2498     SPDcone[3] = gAlice->Field()->Max(); // fieldm
2499     SPDcone[4] = 1.0; // tmaxfd [degrees]
2500     SPDcone[5] = 1.0; // stemax [cm]
2501     SPDcone[6] = 0.5; // deemax [fraction]
2502     SPDcone[7] = 1.0E-3; // epsil [cm]
2503     SPDcone[8] = 0.0; // stmin [cm]
2504     new TGeoMedium("ITSspdCarbonFiber",1,Cfiber,SPDcone);
2505     SPDcone[0] += 1.0;
2506     new TGeoMedium("ITSspdStaselite4411w",2,Staselite,SPDcone);
2507     SPDcone[0] += 1.0;
2508     new TGeoMedium("ITSspdRohacell50A",3,Rohacell,SPDcone);
2509     SPDcone[0] += 1.0;
2510     new TGeoMedium("ITSspdStainlesSteal",4,Stainless,SPDcone);
2511     SPDcone[0] += 1.0;
2512     new TGeoMedium("ITSspdAir",5,Air,SPDcone);
2513     SPDcone[0] += 1.0;
2514     new TGeoMedium("ITSspdAl",6,Al,SPDcone);
2515     //
2516     Double_t SSDcone[20];
2517     SSDcone[0] = 1.0; // imat
2518     SSDcone[1] = 0.0; // isvol
2519     SSDcone[2] = gAlice->Field()->Integ(); // ifield
2520     SSDcone[3] = gAlice->Field()->Max(); // fieldm
2521     SSDcone[4] = 1.0; // tmaxfd [degrees]
2522     SSDcone[5] = 1.0; // stemax [cm]
2523     SSDcone[6] = 0.5; // deemax [fraction]
2524     SSDcone[7] = 1.0E-3; // epsil [cm]
2525     SSDcone[8] = 0.0; // stmin [cm]
2526     new TGeoMedium("ITSssdCarbonFiber",1,Cfiber,SSDcone);
2527     SSDcone[0] += 1.0;
2528     new TGeoMedium("ITSssdStaselite4411w",2,Staselite,SSDcone);
2529     SSDcone[0] += 1.0;
2530     new TGeoMedium("ITSssdRohacell50A",3,Rohacell,SSDcone);
2531     SSDcone[0] += 1.0;
2532     new TGeoMedium("ITSssdStainlesSteal",4,Stainless,SSDcone);
2533     SSDcone[0] += 1.0;
2534     new TGeoMedium("ITSssdAir",5,Air,SSDcone);
2535     SSDcone[0] += 1.0;
2536     new TGeoMedium("ITSssdAl",6,Al,SSDcone);
2537 }
2538 //______________________________________________________________________
2539 void AliITSv11::ServicesCableSupport(TGeoVolume *Moth){
2540     // Define the detail ITS cable support trays on both the RB24 and 
2541     // RB26 sides..
2542     // Inputs:
2543     //   none.
2544     // Outputs:
2545     //  none.
2546     // Return:
2547     //  none.
2548     // Based on the Drawings SSup_201A.jpg unless otherwise stated, 
2549     // Volumes A..., 
2550     TGeoMedium *SUPcf    = 0; // SUP support cone Carbon Fiber materal number.
2551     TGeoMedium *SUPfs    = 0; // SUP support cone inserto stesalite 4411w.
2552     TGeoMedium *SUPfo    = 0; // SUP support cone foam, Rohacell 50A.
2553     TGeoMedium *SUPss    = 0; // SUP support cone screw material,Stainless
2554     TGeoMedium *SUPair   = 0; // SUP support cone Air
2555     TGeoMedium *SUPal    = 0; // SUP support cone SDD mounting bracket Al
2556     TGeoMedium *SUPwater = 0; // SUP support cone Water
2557     TGeoManager *mgr = gGeoManager;
2558     SUPcf    = mgr->GetMedium("ITSssdCarbonFiber");
2559     SUPfs    = mgr->GetMedium("ITSssdStaselite4411w");
2560     SUPfo    = mgr->GetMedium("ITSssdRohacell50A");
2561     SUPss    = mgr->GetMedium("ITSssdStainlessSteal");
2562     SUPair   = mgr->GetMedium("ITSssdAir");
2563     SUPal    = mgr->GetMedium("ITSssdAl");
2564     SUPwater = mgr->GetMedium("ITSssdWater");
2565     //
2566     Int_t i,j;
2567     Double_t x,y,z,t,t0,dt,di,r;
2568
2569     // RB 24 side
2570     const Double_t Z024         = 900*kmm;//SSup_203A.jpg
2571     const Double_t ThssFrame24  = 5.0*kmm;
2572     const Double_t RssFrame24   = 444.5*kmm-ThssFrame24; // SSup_204A.jpg
2573     const Double_t WidthFrame24 = 10.0*kmm;
2574     const Double_t HightFrame24 = 10.0*kmm;
2575     const Double_t Phi0Frame24  = 15.2*kDegree; // SSup_602A.jpg
2576     const Double_t Phi1Frame24  = (90.0-7.6)*kDegree; // SSup_802A.jpg
2577     const Double_t ZssFrameSection24 = (415.0-10.0)*kmm;
2578     const Int_t    NZsections24      = 4;
2579     const Int_t    NPhiSections24    = 4;
2580     const Int_t    NFramesPhi24      = 4;
2581     TGeoTubeSeg *A24,*M24; // Cylinderial support structure
2582     TGeoBBox    *B24; // Cylinderial support structure
2583
2584     M24 = new TGeoTubeSeg("ITS sup Cable tray support frame mother volume M24",
2585                           RssFrame24,RssFrame24+ThssFrame24,
2586                           0.5*(4.*ZssFrameSection24+5*WidthFrame24),
2587                           Phi0Frame24,Phi1Frame24);
2588     A24 = new TGeoTubeSeg("ITS sup Cable tray support frame radial section A24",
2589                           RssFrame24,RssFrame24+ThssFrame24,0.5*WidthFrame24,
2590                           Phi0Frame24,Phi1Frame24);
2591     B24 = new TGeoBBox("ITS sup Cable tray support frame Z section B24",
2592                        0.5*ThssFrame24,0.5*HightFrame24,0.5*ZssFrameSection24);
2593     printTubeSeg(A24);
2594     printTubeSeg(M24);
2595     printBBox(B24);
2596     TGeoVolume *A24v,*B24v,*M24v;
2597     TGeoTranslation *tran;
2598     TGeoRotation    *rot;
2599     TGeoCombiTrans  *tranrot;
2600     //
2601     A24v = new TGeoVolume("ITSsupFrameA24",A24,SUPss);
2602     A24v->SetVisibility(kTRUE);
2603     A24v->SetLineColor(1); // black
2604     A24v->SetLineWidth(1);
2605     A24v->SetFillColor(A24v->GetLineColor());
2606     A24v->SetFillStyle(4000); // 0% transparent
2607     B24v = new TGeoVolume("ITSsupFrameB24",B24,SUPss);
2608     B24v->SetVisibility(kTRUE);
2609     B24v->SetLineColor(1); // black
2610     B24v->SetLineWidth(1);
2611     B24v->SetFillColor(B24v->GetLineColor());
2612     B24v->SetFillStyle(4000); // 0% transparent
2613     M24v = new TGeoVolume("ITSsupFrameM24",M24,SUPair);
2614     M24v->SetVisibility(kTRUE);
2615     M24v->SetLineColor(7); // light blue
2616     M24v->SetLineWidth(1);
2617     M24v->SetFillColor(M24v->GetLineColor());
2618     M24v->SetFillStyle(4090); // 90% transparent
2619     //
2620     Int_t NcA24=1,NcB24=1;
2621     t0 = Phi0Frame24;
2622     dt = (Phi1Frame24-Phi0Frame24)/((Double_t)NPhiSections24);
2623     for(i=0;i<=NZsections24;i++){
2624         di = (Double_t) i;
2625         z = -M24->GetDz()+A24->GetDz() + di*(ZssFrameSection24+WidthFrame24);
2626         tran = new TGeoTranslation("",0.0,0.0,z);
2627         M24v->AddNode(A24v,NcA24++,tran);
2628         r = RssFrame24+B24->GetDX();
2629         z = z + A24->GetDz()+B24->GetDZ();
2630        if(i<NZsections24) for(j=0;j<=NPhiSections24;j++){
2631             t = t0 + ((Double_t)j)*dt;
2632             rot = new TGeoRotation("",0.0,0.0,t);
2633             y = r*TMath::Sin(t*kRadian);
2634             x = r*TMath::Cos(t*kRadian);
2635             tranrot = new TGeoCombiTrans("",x,y,z,rot);
2636             delete rot;// rot not explicity used in AddNode functions.
2637             M24v->AddNode(B24v,NcB24++,tranrot);
2638         } // end for j
2639     } // end for i
2640     tran = new TGeoTranslation("",0.0,0.0,Z024+M24->GetDz());
2641     Moth->AddNode(M24v,1,tran);
2642     for(i=1;i<NFramesPhi24;i++){
2643         di = (Double_t) i;
2644         rot = new TGeoRotation("",0.0,0.0,90.0*di);
2645         tranrot = new TGeoCombiTrans("",0.0,0.0,Z024+M24->GetDz(),rot);
2646         delete rot;// rot not explicity used in AddNode functions.
2647         Moth->AddNode(M24v,i+1,tranrot);
2648     } // end for i
2649     if(GetDebug()){
2650         A24v->PrintNodes();
2651         B24v->PrintNodes();
2652         M24v->PrintNodes();
2653     } // end if
2654     // Cable support tray 
2655     // Material is Aluminum
2656     const Double_t RS24in     = TMath::Max(RssFrame24,444.5*kmm);
2657                                            // SSup_204A & SSup_206A
2658     const Double_t RS24Airout = 459.5*kmm; // SSup_204A & SSup_206A
2659     const Double_t RS24out    = 494.5*kmm; // SSup_206A & SSup_204A
2660     const Double_t RS24PPout  = 550.0*kmm; // SSup_206A
2661     const Double_t LS24PP     = 350.0*kmm; // SSup_202A
2662     const Double_t LS24       = (2693.0-900.0)*kmm; //SSup_205A & SSup_207A
2663     const Double_t ThS24wall  = 1.0*kmm; // SSup_209A & SSup_210A
2664     const Double_t WbS24      = 42.0*kmm; // SSup_209A & SSup_210A
2665     const Double_t WtS24      = 46.9*kmm; // SSup_209A & SSup_210A
2666     const Double_t WcapS24    = 50.0*kmm; // SSup_209A & SSup_210A
2667     const Double_t WdS24      = 41.0*kmm; // SSup_209A ? should be 41.46938776
2668     const Double_t HS24       = 50.0*kmm; // SSup_209A & SSup_210A
2669     const Double_t OutDcoolTub= 12.0*kmm; // SSup_209A
2670     const Double_t InDcoolTub = 10.0*kmm; // SSup_209A
2671     const Double_t BlkNozInDS24= 6.0*kmm; // SSup_209A
2672     // The following are deduced or guessed at
2673     const Double_t LtopLipS24 = 6.0*kmm; // Guessed at.
2674     const Double_t LdLipS24   = 6.0*kmm; // Guessed at.
2675     const Double_t HdS24      = OutDcoolTub; //
2676     const Double_t BlkNozZS24 = 6.0*kmm; // Guessed at.
2677     // Simplifided exterior shape. The side wall size is 2.5*thicker than
2678     // it should be (due to simplification).
2679     TGeoArb8 *C24 = new TGeoArb8("ITS Sup Cable Tray Element C24",0.5*LS24);
2680     C24->SetVertex(0,-0.5*WcapS24,HS24+ThS24wall);
2681     C24->SetVertex(1,+0.5*WcapS24,HS24+ThS24wall);
2682     C24->SetVertex(2,+0.5*WbS24,0.0);
2683     C24->SetVertex(3,-0.5*WbS24,0.0);
2684     C24->SetVertex(4,-0.5*WcapS24,HS24+ThS24wall);
2685     C24->SetVertex(5,+0.5*WcapS24,HS24+ThS24wall);
2686     C24->SetVertex(6,+0.5*WbS24,0.0);
2687     C24->SetVertex(7,-0.5*WbS24,0.0);
2688     TGeoArb8 *D24 = new TGeoArb8("ITS Sup Cable Tray lower Element D24",
2689                                  0.5*LS24);
2690     // Because of question about the value of WdS24, compute what it
2691     // should be assuming cooling tube fixes hight of volume.
2692     x = OutDcoolTub*(0.5*WcapS24-0.5*WbS24-ThS24wall)/(HS24-ThS24wall);
2693     D24->SetVertex(0,-x,OutDcoolTub+ThS24wall);
2694     D24->SetVertex(1,+x,OutDcoolTub+ThS24wall);
2695     D24->SetVertex(2,+0.5*WbS24-ThS24wall,ThS24wall);
2696     D24->SetVertex(3,-0.5*WbS24+ThS24wall,ThS24wall);
2697     D24->SetVertex(4,-x,OutDcoolTub+ThS24wall);
2698     D24->SetVertex(5,+x,OutDcoolTub+ThS24wall);
2699     D24->SetVertex(6,+0.5*WbS24-ThS24wall,ThS24wall);
2700     D24->SetVertex(7,-0.5*WbS24+ThS24wall,ThS24wall);
2701     TGeoTube *E24 = new TGeoTube("ITS Sup Cooling Tube E24",0.5*InDcoolTub,
2702                                  0.5*OutDcoolTub,0.5*LS24-BlkNozZS24);
2703     TGeoArb8 *F24 = new TGeoArb8("ITS Sup Cable Tray lower Element block F24",
2704                                  0.5*BlkNozZS24);
2705     for(i=0;i<8;i++) F24->SetVertex(i,D24->GetVertices()[i*2+0],
2706                                       D24->GetVertices()[i*2+1]); //
2707     TGeoTube *G24 = new TGeoTube("ITS Sup Cooling Tube hole in block G24",
2708                                  0.0,0.5*BlkNozInDS24,0.5*BlkNozZS24);
2709     TGeoArb8 *H24 = new TGeoArb8("ITS Sup Cable Tray upper Element H24",
2710                                  0.5*(LS24- LS24PP));
2711     H24->SetVertex(0,C24->GetVertices()[0*2+0]+2.*ThS24wall,
2712                      C24->GetVertices()[0*2+1]-ThS24wall);
2713     H24->SetVertex(1,C24->GetVertices()[1*2+0]-2.*ThS24wall,
2714                      C24->GetVertices()[1*2+1]-ThS24wall);
2715     H24->SetVertex(2,D24->GetVertices()[1*2+0]-ThS24wall,
2716                      D24->GetVertices()[1*2+1]+ThS24wall);
2717     H24->SetVertex(3,D24->GetVertices()[0*2+0]+ThS24wall,
2718                      D24->GetVertices()[0*2+1]+ThS24wall);
2719     for(i=4;i<8;i++) H24->SetVertex(i,H24->GetVertices()[(i-4)*2+0],
2720                                       H24->GetVertices()[(i-4)*2+1]); //
2721     printArb8(C24);
2722     printArb8(D24);
2723     printTube(E24);
2724     printArb8(F24);
2725     printTube(G24);
2726     printArb8(H24);
2727     TGeoVolume *C24v,*D24v,*E24v,*F24v,*Ga24v,*Gw24v,*Gf24v,*H24v;
2728     //
2729     C24v = new TGeoVolume("ITSsupCableTrayC24",C24,SUPal);
2730     C24v->SetVisibility(kTRUE);
2731     C24v->SetLineColor(6); //
2732     C24v->SetLineWidth(1);
2733     C24v->SetFillColor(C24v->GetLineColor());
2734     C24v->SetFillStyle(4000); // 0% transparent
2735     D24v = new TGeoVolume("ITSsupCableTrayLowerD24",D24,SUPair);
2736     D24v->SetVisibility(kTRUE);
2737     D24v->SetLineColor(6); //
2738     D24v->SetLineWidth(1);
2739     D24v->SetFillColor(D24v->GetLineColor());
2740     D24v->SetFillStyle(4000); // 0% transparent
2741     E24v = new TGeoVolume("ITSsupCableTrayCoolTubeE24",E24,SUPss);
2742     E24v->SetVisibility(kTRUE);
2743     E24v->SetLineColor(6); //
2744     E24v->SetLineWidth(1);
2745     E24v->SetFillColor(E24v->GetLineColor());
2746     E24v->SetFillStyle(4000); // 0% transparent
2747     F24v = new TGeoVolume("ITSsupCableTrayBlockF24",F24,SUPal);
2748     F24v->SetVisibility(kTRUE);
2749     F24v->SetLineColor(6); //
2750     F24v->SetLineWidth(1);
2751     F24v->SetFillColor(F24v->GetLineColor());
2752     F24v->SetFillStyle(4000); // 0% transparent
2753     Gw24v = new TGeoVolume("ITSsupCableTrayCoolantWaterG24",G24,SUPwater);
2754     Gw24v->SetVisibility(kTRUE);
2755     Gw24v->SetLineColor(6); //
2756     Gw24v->SetLineWidth(1);
2757     Gw24v->SetFillColor(Gw24v->GetLineColor());
2758     Gw24v->SetFillStyle(4000); // 0% transparent
2759     Ga24v = new TGeoVolume("ITSsupCableTrayCoolantAirG24",G24,SUPair);
2760     Ga24v->SetVisibility(kTRUE);
2761     Ga24v->SetLineColor(6); //
2762     Ga24v->SetLineWidth(1);
2763     Ga24v->SetFillColor(Ga24v->GetLineColor());
2764     Ga24v->SetFillStyle(4000); // 0% transparent
2765     H24v = new TGeoVolume("ITSsupCableTrayUpperC24",H24,SUPair);
2766     H24v->SetVisibility(kTRUE);
2767     H24v->SetLineColor(6); //
2768     H24v->SetLineWidth(1);
2769     H24v->SetFillColor(H24v->GetLineColor());
2770     H24v->SetFillStyle(4000); // 0% transparent
2771     //
2772     tran = new TGeoTranslation("",-OutDcoolTub,OutDcoolTub+ThS24wall,0.0);
2773     F24v->AddNode(Gw24v,1,tran);
2774     D24v->AddNode(E24v,1,tran);
2775     tran = new TGeoTranslation("",0.0,OutDcoolTub+ThS24wall,0.0);
2776     F24v->AddNode(Gw24v,2,tran);
2777     D24v->AddNode(E24v,2,tran);
2778     tran = new TGeoTranslation("",+OutDcoolTub,OutDcoolTub+ThS24wall,0.0);
2779     F24v->AddNode(Gw24v,3,tran);
2780     D24v->AddNode(E24v,3,tran);
2781     tran = new TGeoTranslation("",0.0,0.0,0.5*LS24-0.5*BlkNozZS24);
2782     D24v->AddNode(F24v,1,tran);
2783     tran = new TGeoTranslation("",0.0,0.0,-(0.5*LS24-0.5*BlkNozZS24));
2784     D24v->AddNode(F24v,2,tran);
2785     C24v->AddNode(D24v,1,0);
2786     C24v->AddNode(H24v,1,0);
2787     //==================================================================
2788     //
2789     // RB 26 side
2790     const Double_t Z026         = -900*kmm;//SSup_203A.jpg
2791     const Double_t ThssFrame26  = 5.0*kmm;
2792     const Double_t R0ssFrame26  = 444.5*kmm-ThssFrame26; // SSup_204A.jpg
2793     const Double_t R1ssFrame26  = 601.6*kmm-ThssFrame26; // SSup_208A.jpg
2794     const Double_t WidthFrame26 = 10.0*kmm;
2795     //const Double_t HightFrame26 = 10.0*kmm;
2796     const Double_t Phi0Frame26  = 15.2*kDegree; // SSup_602A.jpg
2797     const Double_t Phi1Frame26  = (90.0-7.6)*kDegree; // SSup_802A.jpg
2798     const Double_t ZssFrameSection26 = (415.0-10.0)*kmm;
2799     const Int_t    NZsections26      = 4;
2800     const Int_t    NPhiSections26    = 4;
2801     const Int_t    NFramesPhi26      = 4;
2802     TGeoConeSeg *A26[NZsections26+1],*M26; // Cylinderial support structure
2803     TGeoArb8     *B26; // Cylinderial support structure
2804     Char_t name[100];
2805     Double_t r1,r2,m;
2806
2807     M26 = new TGeoConeSeg("ITS sup Cable tray support frame mother volume M26",
2808                          0.5*(4.*ZssFrameSection26+5*WidthFrame26),
2809                           R1ssFrame26,R1ssFrame26+ThssFrame26,
2810                           R0ssFrame26,R0ssFrame26+ThssFrame26,
2811                           Phi0Frame26,Phi1Frame26);
2812     m = -((R1ssFrame26-R0ssFrame26)/
2813          (((Double_t)NZsections26)*(ZssFrameSection26+WidthFrame26)));
2814     for(i=0;i<NZsections26+1;i++){
2815         di = ((Double_t) i)*(ZssFrameSection26+WidthFrame26);
2816         sprintf(name,
2817                 "ITS sup Cable tray support frame radial section A26[%d]",i);
2818         r1 = R1ssFrame26+m*di;
2819         r2 = R1ssFrame26+m*(di+WidthFrame26);
2820         A26[i] = new TGeoConeSeg(name,0.5*WidthFrame26,r2,r2+ThssFrame26,
2821                                  r1,r1+ThssFrame26,Phi0Frame26,Phi1Frame26);
2822     } // end for i
2823     B26 = new TGeoArb8("ITS sup Cable tray support frame Z section B26",
2824                        0.5*ZssFrameSection26);
2825     r = 0.25*(A26[0]->GetRmax1()+A26[0]->GetRmin1()+
2826               A26[1]->GetRmax2()+A26[1]->GetRmin2());
2827     B26->SetVertex(0,A26[0]->GetRmax2()-r,+0.5*WidthFrame26);
2828     B26->SetVertex(1,A26[0]->GetRmax2()-r,-0.5*WidthFrame26);
2829     B26->SetVertex(2,A26[0]->GetRmin2()-r,-0.5*WidthFrame26);
2830     B26->SetVertex(3,A26[0]->GetRmin2()-r,+0.5*WidthFrame26);
2831     B26->SetVertex(4,A26[1]->GetRmax1()-r,+0.5*WidthFrame26);
2832     B26->SetVertex(5,A26[1]->GetRmax1()-r,-0.5*WidthFrame26);
2833     B26->SetVertex(6,A26[1]->GetRmin1()-r,-0.5*WidthFrame26);
2834     B26->SetVertex(7,A26[1]->GetRmin1()-r,+0.5*WidthFrame26);
2835     for(i=0;i<NZsections26+1;i++) printConeSeg(A26[i]);
2836     printConeSeg(M26);
2837     printArb8(B26);
2838     TGeoVolume *A26v[NZsections26+1],*B26v,*M26v;
2839     //
2840     for(i=0;i<NZsections26+1;i++){
2841         sprintf(name,"ITSsupFrameA26[%d]",i);
2842         A26v[i] = new TGeoVolume(name,A26[i],SUPss);
2843         A26v[i]->SetVisibility(kTRUE);
2844         A26v[i]->SetLineColor(1); // black
2845         A26v[i]->SetLineWidth(1);
2846         A26v[i]->SetFillColor(A26v[i]->GetLineColor());
2847         A26v[i]->SetFillStyle(4000); // 0% transparent
2848     } // end for i
2849     B26v = new TGeoVolume("ITSsupFrameB26",B26,SUPss);
2850     B26v->SetVisibility(kTRUE);
2851     B26v->SetLineColor(1); // black
2852     B26v->SetLineWidth(1);
2853     B26v->SetFillColor(B26v->GetLineColor());
2854     B26v->SetFillStyle(4000); // 0% transparent
2855     M26v = new TGeoVolume("ITSsupFrameM26",M26,SUPair);
2856     M26v->SetVisibility(kTRUE);
2857     M26v->SetLineColor(7); // light blue
2858     M26v->SetLineWidth(1);
2859     M26v->SetFillColor(M26v->GetLineColor());
2860     M26v->SetFillStyle(4090); // 90% transparent
2861     //
2862     Int_t NcB26=1;
2863     t0 = Phi0Frame26;
2864     dt = (Phi1Frame26-Phi0Frame26)/((Double_t)NPhiSections26);
2865     for(i=0;i<=NZsections26;i++){
2866         di = ((Double_t) i)*(ZssFrameSection26+WidthFrame26);
2867         z = -M26->GetDz()+A26[i]->GetDz() + di;
2868         tran = new TGeoTranslation("",0.0,0.0,z);
2869         M26v->AddNode(A26v[i],1,tran);
2870         z = z+B26->GetDz();
2871         if(i<NZsections26)for(j=0;j<=NPhiSections26;j++){
2872             r = 0.25*(A26[i]->GetRmax1()+A26[i]->GetRmin1()+
2873                       A26[i+1]->GetRmax2()+A26[i+1]->GetRmin2());
2874             t = t0 + ((Double_t)j)*dt;
2875             rot = new TGeoRotation("",0.0,0.0,t);
2876             y = r*TMath::Sin(t*kRadian);
2877             x = r*TMath::Cos(t*kRadian);
2878             tranrot = new TGeoCombiTrans("",x,y,z,rot);
2879             delete rot; // rot not explicity used in AddNode functions.
2880             M26v->AddNode(B26v,NcB26++,tranrot);
2881         } // end for j
2882     } // end for i
2883     tran = new TGeoTranslation("",0.0,0.0,Z026-M26->GetDz());
2884     Moth->AddNode(M26v,1,tran);
2885     for(i=1;i<NFramesPhi26;i++){
2886         rot = new TGeoRotation("",0.0,0.0,90.0*((Double_t)i));
2887         tranrot = new TGeoCombiTrans(*tran,*rot);
2888         delete rot; // rot not explicity used in AddNode functions.
2889         Moth->AddNode(M26v,i+1,tranrot);
2890     } // end for i
2891     if(GetDebug()){
2892         for(i=0;i<NZsections26+1;i++) A26v[i]->PrintNodes();
2893         B26v->PrintNodes();
2894         M26v->PrintNodes();
2895     } // end if
2896 }
2897 //______________________________________________________________________
2898 void AliITSv11::InitAliITSgeom(){
2899     // Based on the geometry tree defined in Geant 3.21, this
2900     // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS 
2901     // geometry sturture.
2902     // Inputs:
2903     //   none.
2904     // Outputs:
2905     //   none.
2906     // Return
2907     //   none.
2908 }
2909 //______________________________________________________________________
2910 void AliITSv11::Init(){
2911     // Initialise the ITS after it has been created.
2912     // Inputs:
2913     //   none.
2914     // Outputs:
2915     //   none.
2916     // Return
2917     //   none.
2918 }
2919 //______________________________________________________________________
2920 void AliITSv11::SetDefaults(){
2921     // Sets the default segmentation, response, digit and raw cluster 
2922     // classes to be used. These defaults can be overwritten in the
2923     // macros that do these later steps. Defaults are give hear for the
2924     // general user.
2925     // Inputs:
2926     //   none.
2927     // Outputs:
2928     //   none.
2929     // Return
2930     //   none.
2931 }
2932 //______________________________________________________________________
2933 void AliITSv11::DrawModule(){
2934     // Draw a standard set of shaded view of the ITS version 11.
2935     // Inputs:
2936     //   none.
2937     // Outputs:
2938     //   none.
2939     // Return
2940     //   none.
2941 }
2942 //______________________________________________________________________
2943 void AliITSv11::StepManager(){
2944     // Called for every step in the ITS, then calles the AliITShit class
2945     // creator with the information to be recoreded about that hit.
2946     //  The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
2947     // printing of information to a file which can be used to create a .det
2948     // file read in by the routine CreateGeometry(). If set to 0 or any other
2949     // value except 1, the default behavior, then no such file is created nor
2950     // is the extra variables and the like used in the printing allocated.
2951 }
2952