SAA3 as built.
[u/mrichter/AliRoot.git] / STRUCT / AliSHILv3.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 // The small angle absorber SAA (beam shield)
20 // Author: A.Morsch
21 // andreas.morsch@cern.ch
22 //-------------------------------------------------------------------------
23
24 #include <TVirtualMC.h>
25 #include <TArrayI.h>
26 #include <TGeoVolume.h>
27 #include <TGeoTube.h>
28 #include <TGeoManager.h>
29 #include <TGeoMatrix.h>
30 #include <TGeoCompositeShape.h>
31 #include <TGeoBBox.h>
32 #include <TGeoPgon.h>
33 #include <TGeoCone.h>
34
35 #include "AliSHILv3.h"
36 #include "AliConst.h"
37 #include "AliLog.h"
38
39 ClassImp(AliSHILv3)
40  
41 //_____________________________________________________________________________
42 AliSHILv3::AliSHILv3()
43 {
44   //
45   // Default constructor for muon shield
46   //
47 }
48  
49 //_____________________________________________________________________________
50 AliSHILv3::AliSHILv3(const char *name, const char *title)
51   : AliSHIL(name,title)
52 {
53   //
54   // Standard constructor for muon shield
55   //
56 }
57  
58 //_____________________________________________________________________________
59 void AliSHILv3::CreateGeometry()
60 {
61 //
62 // The geometry of the small angle absorber "Beam Shield"
63 //
64     Float_t dz, dr, z, rmax;
65 //
66 // The top volume
67 //
68     TGeoVolume* top = gGeoManager->GetVolume("ALIC");
69 //  Rotations
70     TGeoRotation* rot000 = new TGeoRotation("rot000",  90.,   0., 90.,  90., 0., 0.);
71     TGeoRotation* rot090 = new TGeoRotation("rot090",  90.,  90., 90., 180., 0., 0.);
72     TGeoRotation* rot180 = new TGeoRotation("rot180",  90., 180., 90., 270., 0., 0.);
73     TGeoRotation* rot270 = new TGeoRotation("rot270",  90., 270., 90.,   0., 0., 0.);
74 //
75 // Media
76 //
77     TGeoMedium* kMedNiW     = gGeoManager->GetMedium("SHIL_Ni/W0");
78     TGeoMedium* kMedNiWsh   = gGeoManager->GetMedium("SHIL_Ni/W3");
79 //
80     TGeoMedium* kMedSteel   = gGeoManager->GetMedium("SHIL_ST_C0");
81     TGeoMedium* kMedSteelSh = gGeoManager->GetMedium("SHIL_ST_C3");
82 //
83     TGeoMedium* kMedAir     = gGeoManager->GetMedium("SHIL_AIR_C0");
84     TGeoMedium* kMedAirMu   = gGeoManager->GetMedium("SHIL_AIR_MUON");
85 //
86     TGeoMedium* kMedPb      = gGeoManager->GetMedium("SHIL_PB_C0");
87     TGeoMedium* kMedPbSh    = gGeoManager->GetMedium("SHIL_PB_C2");
88 //
89 //  TGeoMedium* kMedConc    = gGeoManager->GetMedium("SHIL_CC_C0");
90     TGeoMedium* kMedConcSh  = gGeoManager->GetMedium("SHIL_CC_C2");
91 //
92     const Float_t kDegRad = TMath::Pi() / 180.;
93     const Float_t kAngle02   = TMath::Tan( 2.00   * kDegRad);   
94     const Float_t kAngle0071 = TMath::Tan( 0.71   * kDegRad);   
95
96
97 ///////////////////////////////////
98 //    FA Tungsten Tail           //
99 //    Drawing ALIP2A__0049       //
100 //    Drawing ALIP2A__0111       //
101 ///////////////////////////////////
102 //
103 //    The tail as built is shorter than in drawing ALIP2A__0049. 
104 //    The CDD data base has to be updated !
105 //
106 //    Inner radius at the entrance of the flange
107       Float_t rInFaWTail1  = 13.98/2.;
108 //    Outer radius at the entrance of the flange
109       Float_t rOuFaWTail1  = 52.00/2.;
110 //    Outer radius at the end of the section inside the FA
111       Float_t rOuFaWTail2  = 35.27/2.;
112 //    Length of the Flange section inside the FA
113       Float_t dzFaWTail1   =  6.00;
114 //    Length of the Flange section ouside the FA
115       Float_t dzFaWTail2   = 12.70;
116 //    Inner radius at the end of the section inside the FA 
117       Float_t rInFaWTail2  = rInFaWTail1 +  dzFaWTail1 * kAngle0071;
118 //    Inner radius at the end of the flange
119       Float_t rInFaWTail3  = rInFaWTail2 +  dzFaWTail2 * kAngle0071;
120 //    Outer radius at the end of the flange
121       Float_t rOuFaWTail3  = rOuFaWTail2 +  dzFaWTail2 * kAngle02;
122 //    Outer radius of the recess for station 1
123       Float_t rOuFaWTailR  = 30.8/2.;
124 //    Length of the recess
125       Float_t dzFaWTailR   = 36.00;
126 //    Inner radiues at the end of the recess      
127       Float_t rInFaWTail4  =  rInFaWTail3 +  dzFaWTailR * kAngle0071;
128 //    Outer radius at the end of the recess      
129       Float_t rOuFaWTail4  =  rOuFaWTail3 +  dzFaWTailR * kAngle02;
130 //    Inner radius of the straight section
131       Float_t rInFaWTailS  = 22.30/2.;
132 //    Length of the bulge
133       Float_t dzFaWTailB   = 13.0;
134 //    Outer radius at the end of the bulge
135       Float_t rOuFaWTailB  =  rOuFaWTail4 +  dzFaWTailB * kAngle02;
136 //    Outer radius at the end of the tail 
137       Float_t rOuFaWTailE  = 31.6/2.;
138 //    Total length of the tail
139       Float_t dzFaWTail    = 70.7;
140
141       TGeoPcon* shFaWTail = new TGeoPcon(0., 360., 10);
142       z    = 0.;
143 //    Flange section inside FA
144       shFaWTail->DefineSection(0,  z, rInFaWTail1, rOuFaWTail1);
145       z += dzFaWTail1;
146       shFaWTail->DefineSection(1,  z, rInFaWTail2, rOuFaWTail1);      
147       shFaWTail->DefineSection(2,  z, rInFaWTail2, rOuFaWTail2);      
148 //    Flange section outside FA
149       z +=  dzFaWTail2;
150       shFaWTail->DefineSection(3,  z, rInFaWTail3, rOuFaWTail3);      
151       shFaWTail->DefineSection(4,  z, rInFaWTail3, rOuFaWTailR);
152 //    Recess Station 1
153       z +=  dzFaWTailR;
154       shFaWTail->DefineSection(5,  z, rInFaWTail4, rOuFaWTailR); 
155       shFaWTail->DefineSection(6,  z, rInFaWTailS, rOuFaWTail4);
156 //    Bulge
157       z += dzFaWTailB;
158       shFaWTail->DefineSection(7,  z, rInFaWTailS, rOuFaWTailB);
159       shFaWTail->DefineSection(8,  z, rInFaWTailS, rOuFaWTailE);
160 //    End
161       z =  dzFaWTail;
162       shFaWTail->DefineSection(9,  z, rInFaWTailS, rOuFaWTailE);
163       
164       TGeoVolume* voFaWTail = new TGeoVolume("YFaWTail", shFaWTail, kMedNiW);
165 //
166 //    Define an inner region with higher transport cuts
167       TGeoPcon* shFaWTailI = new TGeoPcon(0., 360., 4);
168       z  = 0.;
169       dr = 3.5;
170       shFaWTailI->DefineSection(0, z, rInFaWTail1,  rInFaWTail1 + dr);
171       z += (dzFaWTail1 + dzFaWTail2 +  dzFaWTailR);
172       shFaWTailI->DefineSection(1, z, rInFaWTail4,  rInFaWTail4 + dr);
173       shFaWTailI->DefineSection(2, z, rInFaWTailS,  rInFaWTailS + dr);
174       z = dzFaWTail;
175       shFaWTailI->DefineSection(3, z, rInFaWTailS,  rInFaWTailS + dr);
176       TGeoVolume* voFaWTailI = new TGeoVolume("YFaWTailI", shFaWTailI, kMedNiWsh);
177       voFaWTail->AddNode(voFaWTailI, 1, gGeoIdentity);
178       
179 ///////////////////////////////////
180 //                               //
181 // Recess Station 1              //
182 // Drawing ALIP2A__0260          //
183 ///////////////////////////////////
184
185 ///////////////////////////////////
186 //    FA W-Ring 2                //
187 //    Drawing ALIP2A__0220       //
188 ///////////////////////////////////
189       const Float_t kFaWring2Rinner  = 15.40;
190       const Float_t kFaWring2Router  = 18.40;
191       const Float_t kFaWring2HWidth  =  3.75;
192       const Float_t kFaWring2Cutoffx =  3.35;
193       const Float_t kFaWring2Cutoffy =  3.35;
194       TGeoTubeSeg* shFaWring2a  = new TGeoTubeSeg(kFaWring2Rinner, kFaWring2Router, kFaWring2HWidth, 0., 90.);
195       shFaWring2a->SetName("shFaWring2a");
196       TGeoBBox* shFaWring2b  = new TGeoBBox(kFaWring2Router / 2., kFaWring2Router / 2., kFaWring2HWidth);
197       shFaWring2b->SetName("shFaWring2b");
198       TGeoTranslation* trFaWring2b 
199           = new TGeoTranslation("trFaWring2b", kFaWring2Router / 2. + kFaWring2Cutoffx, kFaWring2Router / 2. + kFaWring2Cutoffy, 0.);
200       trFaWring2b->RegisterYourself();
201       TGeoCompositeShape*  shFaWring2 = new TGeoCompositeShape("shFaWring2", "(shFaWring2a)*(shFaWring2b:trFaWring2b)");
202       TGeoVolume* voFaWring2    = new TGeoVolume("YFA_WRING2", shFaWring2, kMedNiW);
203
204 ///////////////////////////////////
205 //    FA W-Ring 3                //
206 //    Drawing ALIP2A__0219       //
207 ///////////////////////////////////
208       const Float_t kFaWring3Rinner  = 15.40;
209       const Float_t kFaWring3Router  = 18.40;
210       const Float_t kFaWring3HWidth  =  3.75;
211       const Float_t kFaWring3Cutoffx =  3.35;
212       const Float_t kFaWring3Cutoffy =  3.35;
213       TGeoTubeSeg* shFaWring3a  = new TGeoTubeSeg(kFaWring3Rinner, kFaWring3Router, kFaWring3HWidth, 0., 90.);
214       shFaWring3a->SetName("shFaWring3a");
215       TGeoBBox* shFaWring3b  = new TGeoBBox(kFaWring3Router / 2., kFaWring3Router / 2., kFaWring3HWidth);
216       shFaWring3b->SetName("shFaWring3b");
217       TGeoTranslation* trFaWring3b 
218           = new TGeoTranslation("trFaWring3b", kFaWring3Router / 2. + kFaWring3Cutoffx, kFaWring3Router / 2. + kFaWring3Cutoffy, 0.);
219       trFaWring3b->RegisterYourself();
220       TGeoCompositeShape*  shFaWring3 = new TGeoCompositeShape("shFaWring3", "(shFaWring3a)*(shFaWring3b:trFaWring3b)");
221       TGeoVolume* voFaWring3    = new TGeoVolume("YFA_WRING3", shFaWring3, kMedNiW);
222
223 ///////////////////////////////////
224 //    FA W-Ring 5                //
225 //    Drawing ALIP2A__0221       //
226 ///////////////////////////////////
227       const Float_t kFaWring5Rinner = 15.40;
228       const Float_t kFaWring5Router = 18.67;
229       const Float_t kFaWring5HWidth =  1.08;
230       TGeoVolume* voFaWring5    = new TGeoVolume("YFA_WRING5", new TGeoTube(kFaWring5Rinner, kFaWring5Router, kFaWring5HWidth), kMedNiW);
231
232 //
233 // Position the rings in the assembly 
234 //      
235       TGeoVolumeAssembly* asFaExtraShield = new TGeoVolumeAssembly("YCRE");
236 // Distance between rings
237       const Float_t kFaDWrings = 1.92;
238 //
239       dz = 0.;
240       
241       dz +=  kFaWring2HWidth;
242       asFaExtraShield->AddNode(voFaWring2,    1, new TGeoCombiTrans(0., 0., dz, rot090));
243       asFaExtraShield->AddNode(voFaWring2,    2, new TGeoCombiTrans(0., 0., dz, rot270));
244       dz +=   kFaWring2HWidth;
245       dz +=   kFaDWrings;
246       dz +=   kFaWring3HWidth;
247       asFaExtraShield->AddNode(voFaWring3,    1, new TGeoCombiTrans(0., 0., dz, rot000));
248       asFaExtraShield->AddNode(voFaWring3,    2, new TGeoCombiTrans(0., 0., dz, rot180));
249       dz +=   kFaWring3HWidth;   
250       dz +=   kFaWring5HWidth;   
251       asFaExtraShield->AddNode(voFaWring5,    1, new TGeoTranslation(0., 0., dz));
252       dz +=   kFaWring5HWidth;   
253       dz +=   kFaWring3HWidth;   
254       asFaExtraShield->AddNode(voFaWring3,    3, new TGeoCombiTrans(0., 0., dz, rot090));
255       asFaExtraShield->AddNode(voFaWring3,    4, new TGeoCombiTrans(0., 0., dz, rot270));
256       dz +=   kFaWring3HWidth;   
257       dz +=   kFaDWrings;
258       dz +=   kFaWring2HWidth;
259       asFaExtraShield->AddNode(voFaWring2,    3, new TGeoCombiTrans(0., 0., dz, rot000));
260       asFaExtraShield->AddNode(voFaWring2,    4, new TGeoCombiTrans(0., 0., dz, rot180));
261       dz +=   kFaWring2HWidth;
262
263       
264 ///////////////////////////////////////
265 //                SAA1               //
266 ///////////////////////////////////////
267
268
269 ///////////////////////////////////////
270 //          FA/SAA1  W Joint         //
271 //          Drawing ALIP2A__0060     //
272 ///////////////////////////////////////
273
274 // Length of flange FA side      
275       Float_t dzFaSaa1F1  =  2.8;
276 // Inner radius of flange FA side
277       Float_t rInFaSaa1F1 = 32.0/2.;
278 // Outer radius of flange FA side
279       Float_t rOuFaSaa1F1 = 39.5/2.;
280 // Length of first straight section
281       Float_t dzFaSaa1S1  = 18.5 - dzFaSaa1F1;
282 // Inner radius of first straight section
283       Float_t rInFaSaa1S1 = 22.3/2.;
284 // Length of 45 deg transition region
285       Float_t  dzFaSaa1T1 =  2.2;
286 // Inner radius of second straight section
287       Float_t rInFaSaa1S2 = 17.9/2.;
288 // Length of second straight section
289       Float_t dzFaSaa1S2  = 10.1;
290 // Length of flange SAA1 side      
291 //    Float_t dzFaSaa1F2  =  4.0;
292 // Inner radius of flange FA side
293       Float_t rInFaSaa1F2 = 25.2/2.;
294 // Length of joint
295       Float_t dzFaSaa1    = 34.8;
296 // Outer Radius at the end of the joint
297       Float_t rOuFaSaa1E  = 41.93/2.;
298       
299       
300       TGeoPcon* shFaSaa1 = new TGeoPcon(0., 360., 8);
301       z = 0;
302 // Flange FA side      
303       shFaSaa1->DefineSection( 0, z, rInFaSaa1F1, rOuFaSaa1F1);
304       z += dzFaSaa1F1;
305       shFaSaa1->DefineSection( 1, z, rInFaSaa1F1, 40.0);
306       shFaSaa1->DefineSection( 2, z, rInFaSaa1S1, 40.0);
307 // First straight section
308       z += dzFaSaa1S1;
309       shFaSaa1->DefineSection( 3, z, rInFaSaa1S1, 40.0);
310 // 45 deg transition region
311       z += dzFaSaa1T1;
312       shFaSaa1->DefineSection( 4, z, rInFaSaa1S2, 40.0);
313 // Second straight section
314       z += dzFaSaa1S2;
315       shFaSaa1->DefineSection( 5, z, rInFaSaa1S2, 40.0);
316       shFaSaa1->DefineSection( 6, z, rInFaSaa1F2, 40.0);
317 // Flange SAA1 side
318       z = dzFaSaa1;
319       shFaSaa1->DefineSection( 7, z, rInFaSaa1F2, rOuFaSaa1E);
320
321 // Outer 2 deg line
322       for (Int_t i  = 1; i < 7; i++) {
323           Double_t z    = shFaSaa1->GetZ(i);
324           Double_t r1   = shFaSaa1->GetRmin(i);  
325           Double_t r2 = 39.5/2. + z * TMath::Tan(2. * kDegRad) - 0.01;
326           shFaSaa1->DefineSection(i, z, r1, r2);
327       }
328       TGeoVolume* voFaSaa1 = new TGeoVolume("YFASAA1", shFaSaa1, kMedNiWsh);
329 //
330 // Outer region with lower transport cuts
331       TGeoCone* shFaSaa1O   = new TGeoCone(dzFaSaa1/2., rOuFaSaa1F1 - 3.5, rOuFaSaa1F1, rOuFaSaa1E - 3.5, rOuFaSaa1E);
332       TGeoVolume* voFaSaa1O = new TGeoVolume("YFASAA1O", shFaSaa1O, kMedNiW);
333       voFaSaa1->AddNode(voFaSaa1O, 1, new TGeoTranslation(0., 0., dzFaSaa1/2.));
334       
335
336 ///////////////////////////////////
337 //    SAA1 Steel Envelope        //
338 //    Drawing ALIP2A__0039       //
339 ///////////////////////////////////
340       
341       Float_t rOut;      // Outer radius
342 // Thickness of the steel envelope
343       Float_t dSt = 4.;
344 // 4 Section
345 // z-positions
346       Float_t zSaa1StEnv[5] = {111.2, 113.7, 229.3, 195.0};
347 // Radii
348 // 1
349       Float_t rOuSaa1StEnv1 = 40.4/2.;
350       Float_t rInSaa1StEnv1 = rOuSaa1StEnv1 - dSt;
351 // 2  
352       Float_t rInSaa1StEnv2 = 41.7/2.;
353       Float_t rOuSaa1StEnv2 = rInSaa1StEnv2 + dSt / TMath::Cos(2.0 * kDegRad);
354 // 3         
355       Float_t rOuSaa1StEnv3 = 57.6/2.;
356       Float_t rInSaa1StEnv3 = rOuSaa1StEnv3 - dSt;
357 // 4
358       Float_t rInSaa1StEnv4 = 63.4/2.;
359       Float_t rOuSaa1StEnv4 = rInSaa1StEnv4 + dSt / TMath::Cos(1.6 * kDegRad);
360 // end         
361       Float_t rInSaa1StEnv5 = 74.28/2.;
362       Float_t rOuSaa1StEnv5 = rInSaa1StEnv5 + dSt / TMath::Cos(1.6 * kDegRad);
363 // Relative starting position
364       Float_t zSaa1StEnvS = 3.;
365       
366       TGeoPcon* shSaa1StEnv  = new TGeoPcon(0., 360., 11);
367 // 1st Section
368       z = zSaa1StEnvS;
369       shSaa1StEnv->DefineSection( 0, z, rInSaa1StEnv1, rOuSaa1StEnv1);
370       z += (zSaa1StEnv[0] - dSt);
371       shSaa1StEnv->DefineSection( 1, z, rInSaa1StEnv1, rOuSaa1StEnv1);
372 // 1 - 2
373       shSaa1StEnv->DefineSection( 2, z, rInSaa1StEnv1, rOuSaa1StEnv2);
374       z +=  dSt;
375       shSaa1StEnv->DefineSection( 3, z, rInSaa1StEnv1, rOuSaa1StEnv2);      
376 // 2nd Section
377       shSaa1StEnv->DefineSection( 4, z, rInSaa1StEnv2, rOuSaa1StEnv2);      
378       z += zSaa1StEnv[1];
379       shSaa1StEnv->DefineSection( 5, z, rInSaa1StEnv3, rOuSaa1StEnv3);      
380 // 3rd Section  
381       z += (zSaa1StEnv[2] - dSt);
382       shSaa1StEnv->DefineSection( 6, z, rInSaa1StEnv3, rOuSaa1StEnv3);      
383 // 3 - 4
384       shSaa1StEnv->DefineSection( 7, z, rInSaa1StEnv3, rOuSaa1StEnv4);
385       z += dSt;
386       shSaa1StEnv->DefineSection( 8, z, rInSaa1StEnv3, rOuSaa1StEnv4);
387 // 4th Section
388       shSaa1StEnv->DefineSection( 9, z, rInSaa1StEnv4, rOuSaa1StEnv4);
389       z += zSaa1StEnv[3];
390       shSaa1StEnv->DefineSection(10, z, rInSaa1StEnv5, rOuSaa1StEnv5);      
391       TGeoVolume* voSaa1StEnv  =  new TGeoVolume("YSAA1_SteelEnvelope", shSaa1StEnv, kMedSteel);
392
393
394       
395  
396
397 ///////////////////////////////////
398 //    SAA1 W-Pipe                //
399 //    Drawing ALIP2A__0059       //
400 ///////////////////////////////////
401 //
402 //    Flange FA side
403 //    Length of first section      
404       Float_t dzSaa1WPipeF1  = 0.9;
405 //    Outer radius 
406       Float_t rOuSaa1WPipeF1 = 24.5/2.;
407 //    Inner Radius
408       Float_t rInSaa1WPipeF1 = 22.0/2.;
409 //    Length of second section
410       Float_t dzSaa1WPipeF11 =  2.1;
411 //    Inner Radius
412       Float_t rInSaa1WPipeF11 = 18.5/2.;
413 //
414 //    Central tube 
415 //    Length 
416       Float_t dzSaa1WPipeC = 111.2;
417 //    Inner Radius at the end
418       Float_t rInSaa1WPipeC = 22.0/2.;
419 //    Outer Radius
420       Float_t rOuSaa1WPipeC = 31.9/2.;
421 //
422 //    Flange SAA2 Side
423 //    Length
424       Float_t dzSaa1WPipeF2  = 6.0;
425 //    Outer radius 
426       Float_t rOuSaa1WPipeF2 = 41.56/2.;
427
428 //
429       TGeoPcon* shSaa1WPipe  = new TGeoPcon(0., 360., 8);
430       z = 0.;
431 // Flange FA side first section
432       shSaa1WPipe->DefineSection( 0, z, rInSaa1WPipeF1 , rOuSaa1WPipeF1);
433       z += dzSaa1WPipeF1;
434       shSaa1WPipe->DefineSection( 1, z, rInSaa1WPipeF1 , rOuSaa1WPipeF1);
435 // Flange FA side second section
436       shSaa1WPipe->DefineSection( 2, z, rInSaa1WPipeF11, rOuSaa1WPipeF1);
437       z += dzSaa1WPipeF11;
438       shSaa1WPipe->DefineSection( 3, z, rInSaa1WPipeF11, rOuSaa1WPipeF1);
439 // Central Section
440       shSaa1WPipe->DefineSection( 4, z, rInSaa1WPipeF11, rOuSaa1WPipeC);
441       z += dzSaa1WPipeC;
442       shSaa1WPipe->DefineSection( 5, z, rInSaa1WPipeC,   rOuSaa1WPipeC);
443 // Flange SAA2 side
444       shSaa1WPipe->DefineSection( 6, z, rInSaa1WPipeC,   rOuSaa1WPipeF2);
445       z +=  dzSaa1WPipeF2;
446       shSaa1WPipe->DefineSection( 7, z, rInSaa1WPipeC,   rOuSaa1WPipeF2);
447
448       TGeoVolume* voSaa1WPipe  =  new TGeoVolume("YSAA1_WPipe", shSaa1WPipe, kMedNiW);
449 //
450 // Inner region with higher transport cuts
451       TGeoTube*   shSaa1WPipeI = new TGeoTube(rInSaa1WPipeC, rOuSaa1WPipeC, dzSaa1WPipeC/2.);
452       TGeoVolume* voSaa1WPipeI =  new TGeoVolume("YSAA1_WPipeI", shSaa1WPipeI, kMedNiWsh);
453       voSaa1WPipe->AddNode(voSaa1WPipeI, 1, new TGeoTranslation(0., 0., dzSaa1WPipeF1 + dzSaa1WPipeF11 + dzSaa1WPipeC/2));
454       
455
456 ///////////////////////////////////
457 //    SAA1 Pb Components         //
458 //    Drawing ALIP2A__0078       //
459 ///////////////////////////////////
460 //
461 //    Inner angle
462       Float_t tanAlpha = TMath::Tan(1.69    / 2. * kDegRad);
463       Float_t tanBeta  = TMath::Tan(3.20    / 2. * kDegRad);    
464 // 
465 //    1st Section 2deg opening cone
466 //    Length 
467       Float_t dzSaa1PbComp1 = 100.23;
468 //    Inner radius at entrance
469       Float_t rInSaa1PbComp1 = 22.0/2.; // It's 21 cm diameter in the drawing. Is this a typo ??!!
470 //    Outer radius at entrance
471       Float_t rOuSaa1PbComp1 = 42.0/2.;
472 //
473 //    2nd Section: Straight Section
474 //    Length 
475       Float_t dzSaa1PbComp2  = 236.77;
476 //    Inner radius
477       Float_t rInSaa1PbComp2 = rInSaa1PbComp1 + dzSaa1PbComp1 * tanAlpha;
478 //    Outer radius
479       Float_t rOuSaa1PbComp2 = 49.0/2.;
480 //
481 //    3rd Section: 1.6deg opening cone until bellow
482 //    Length 
483       Float_t dzSaa1PbComp3 = 175.6;
484 //    Inner radius        
485       Float_t  rInSaa1PbComp3 = rInSaa1PbComp2 + dzSaa1PbComp2 * tanAlpha;
486 //    Outer radius
487       Float_t rOuSaa1PbComp3 = 62.8/2.;
488 //   
489 //   4th Section: Bellow region
490       Float_t dzSaa1PbComp4  = 26.4;
491 //    Inner radius        
492       Float_t  rInSaa1PbComp4 = 37.1/2.;
493       Float_t  rInSaa1PbCompB = 43.0/2.;
494 //    Outer radius
495       Float_t rOuSaa1PbComp4  = rOuSaa1PbComp3 +  dzSaa1PbComp3 * tanBeta;
496 //
497 //   5th Section: Flange SAA2 side
498 //   1st detail 
499       Float_t dzSaa1PbCompF1  = 4.;
500       Float_t rOuSaa1PbCompF1 = 74.1/2.;
501 //   2nd detail       
502       Float_t dzSaa1PbCompF2  = 3.;
503       Float_t rOuSaa1PbCompF2 = 66.0/2.;
504       Float_t rOuSaa1PbCompF3 = 58.0/2.;
505       
506
507       TGeoPcon* shSaa1PbComp  = new TGeoPcon(0., 360., 11);
508       z = 120.2;
509 // 2 deg opening cone
510       shSaa1PbComp->DefineSection( 0, z, rInSaa1PbComp1, rOuSaa1PbComp1);
511       z += dzSaa1PbComp1;
512       shSaa1PbComp->DefineSection( 1, z, rInSaa1PbComp2, rOuSaa1PbComp2);
513 // Straight section
514       z += dzSaa1PbComp2;
515       shSaa1PbComp->DefineSection( 2, z, rInSaa1PbComp3, rOuSaa1PbComp2);
516 // 1.6 deg opening cone
517       shSaa1PbComp->DefineSection( 3, z, rInSaa1PbComp3, rOuSaa1PbComp3);
518       z += dzSaa1PbComp3;
519       shSaa1PbComp->DefineSection( 4, z, rInSaa1PbComp4, rOuSaa1PbComp4);
520 // Bellow region until outer flange
521       shSaa1PbComp->DefineSection( 5, z, rInSaa1PbCompB, rOuSaa1PbComp4);
522       z += (dzSaa1PbComp4 - dzSaa1PbCompF1 -  dzSaa1PbCompF2);
523       shSaa1PbComp->DefineSection( 6, z, rInSaa1PbCompB, rOuSaa1PbCompF1);
524       shSaa1PbComp->DefineSection( 7, z, rInSaa1PbCompB, rOuSaa1PbCompF2);
525 // Flange first step
526       z +=  dzSaa1PbCompF1;
527       shSaa1PbComp->DefineSection( 8, z, rInSaa1PbCompB, rOuSaa1PbCompF2);
528       shSaa1PbComp->DefineSection( 9, z, rInSaa1PbCompB, rOuSaa1PbCompF3);
529 // Flange second step
530       z +=  dzSaa1PbCompF2;
531       shSaa1PbComp->DefineSection( 10, z, rInSaa1PbCompB, rOuSaa1PbCompF3);
532
533       TGeoVolume* voSaa1PbComp  =  new TGeoVolume("YSAA1_PbComp", shSaa1PbComp, kMedPb);
534 //
535 // Inner region with higher transport cuts
536       TGeoPcon*   shSaa1PbCompI = MakeShapeFromTemplate(shSaa1PbComp, 0., -3.);
537       TGeoVolume* voSaa1PbCompI =  new TGeoVolume("YSAA1_PbCompI", shSaa1PbCompI, kMedPbSh);
538       voSaa1PbComp->AddNode(voSaa1PbCompI, 1, gGeoIdentity);
539       
540 ///////////////////////////////////
541 //    SAA1 W-Cone                //
542 //    Drawing ALIP2A__0058       //
543 ///////////////////////////////////
544       // Length of the Cone
545       Float_t dzSaa1WCone = 52.9;
546       // Inner and outer radii
547       Float_t rInSaa1WCone1 = 20.4;
548       Float_t rOuSaa1WCone1 = rInSaa1WCone1 + 0.97;
549       Float_t rOuSaa1WCone2 = rInSaa1WCone1 + 2.80;
550       // relative z-position 
551       Float_t zSaa1WCone    = 9.3;
552       
553       
554       TGeoPcon* shSaa1WCone  = new TGeoPcon(0., 360., 2);
555       z = zSaa1WCone;
556       shSaa1WCone->DefineSection( 0, z, rInSaa1WCone1, rOuSaa1WCone1);
557       z += dzSaa1WCone;
558       shSaa1WCone->DefineSection( 1, z, rInSaa1WCone1, rOuSaa1WCone2);
559       TGeoVolume* voSaa1WCone  =  new TGeoVolume("YSAA1_WCone", shSaa1WCone, kMedNiW);
560
561 ///////////////////////////////////
562 //    SAA1 Steel-Ring            //
563 //    Drawing ALIP2A__0040       //
564 ///////////////////////////////////
565 //
566 //    Length of the ring
567       Float_t dzSaa1StRing = 4.;
568 //    Inner and outer radius
569       Float_t rInSaa1String = 33.0;
570       Float_t rOuSaa1String = 41.1;      
571 //    Relative z-position
572       Float_t zSaa1StRing   = 652.2;
573       TGeoPcon* shSaa1StRing  = new TGeoPcon(0., 360., 2);
574       z = zSaa1StRing;
575       shSaa1StRing->DefineSection( 0, z, rInSaa1String, rOuSaa1String);
576       z += dzSaa1StRing;
577       shSaa1StRing->DefineSection( 1, z, rInSaa1String, rOuSaa1String);
578       TGeoVolume* voSaa1StRing  =  new TGeoVolume("YSAA1_StRing", shSaa1StRing, kMedSteel);
579
580 ///////////////////////////////////
581 //    SAA1 Inner Tube            //
582 //    Drawing ALIP2A__0082       //
583 ///////////////////////////////////
584 //
585 // Length of saa2:               659.2 cm
586 // Length of inner tube:         631.9 cm
587 // Lenth of bellow cavern:        27.3 cm    
588 // Radius at entrance 18.5/2,  d = 0.3
589 // Radius at exit     37.1/2,  d = 0.3 
590 //
591       Float_t dzSaa1InnerTube     = 631.9/2.;  // Half length of the tube  
592       Float_t rInSaa1InnerTube    =  18.2/2.;  // Radius at entrance
593       Float_t rOuSaa1InnerTube    =  36.8/2.;  // Radius at exit
594       Float_t dSaa1InnerTube      =   0.2   ;  // Thickness      
595       TGeoVolume* voSaa1InnerTube = new TGeoVolume("YSAA1_InnerTube", 
596                                                    new TGeoCone(dzSaa1InnerTube, 
597                                                                 rInSaa1InnerTube - dSaa1InnerTube, rInSaa1InnerTube,
598                                                                 rOuSaa1InnerTube - dSaa1InnerTube, rOuSaa1InnerTube),
599                                                    kMedSteelSh);
600
601 ///////////////////////////////////
602 //    SAA1 Outer Shape           //
603 //    Drawing ALIP2A__0107       //
604 ///////////////////////////////////
605       // Total length 
606       Float_t dzSaa1 = 659.2;
607       //
608       TGeoPcon* shSaa1M  = new TGeoPcon(0., 360., 20);
609       Float_t kSec = 0.01; // security distance to avoid trivial extrusions
610       Float_t rmin = rInSaa1InnerTube - dSaa1InnerTube - kSec;
611       rmax = rOuSaa1InnerTube - dSaa1InnerTube - kSec;
612       z = 0.;
613       shSaa1M->DefineSection( 0, z, rmin, rOuSaa1WPipeF1);
614       z += dzSaa1WPipeF1;
615       shSaa1M->DefineSection( 1, z, rmin, rOuSaa1WPipeF1);
616       shSaa1M->DefineSection( 2, z, 0.,   rOuSaa1WPipeF1);
617       z += dzSaa1WPipeF11;
618       shSaa1M->DefineSection( 3, z, 0.,   rOuSaa1WPipeF1);
619       shSaa1M->DefineSection( 4, z, 0.,   rOuSaa1StEnv1);
620       z = zSaa1WCone;
621       shSaa1M->DefineSection( 5, z, 0.,   rOuSaa1StEnv1);
622       shSaa1M->DefineSection( 6, z, 0.,   rOuSaa1WCone1);
623       z += dzSaa1WCone;
624       shSaa1M->DefineSection( 7, z, 0.,   rOuSaa1WCone2);
625       shSaa1M->DefineSection( 8, z, 0.,   rOuSaa1StEnv1);
626       z =  zSaa1StEnv[0] - dSt + zSaa1StEnvS;
627       shSaa1M->DefineSection( 9, z, 0.,   rOuSaa1StEnv1);
628       shSaa1M->DefineSection(10, z, 0.,   rOuSaa1StEnv2);
629       z +=  (zSaa1StEnv[1] + dSt);
630       shSaa1M->DefineSection(11, z, 0.,   rOuSaa1StEnv3);
631       z +=  (zSaa1StEnv[2] - dSt);
632       shSaa1M->DefineSection(12, z, 0.,   rOuSaa1StEnv3);
633       shSaa1M->DefineSection(13, z, 0.,   rOuSaa1StEnv4);
634
635       z += (zSaa1StEnv[3] - dSt +  dzSaa1PbCompF1 + dzSaa1PbCompF2 - dzSaa1PbComp4);
636       Float_t rmaxSaa1 = shSaa1M->GetRmax(13) + (z - shSaa1M->GetZ(13)) * TMath::Tan(1.6 * kDegRad);
637
638       shSaa1M->DefineSection(14, z, 0.,    rmaxSaa1);
639       shSaa1M->DefineSection(15, z, rmax,  rmaxSaa1);
640       z = zSaa1StRing;     
641       shSaa1M->DefineSection(16, z, rmax, rOuSaa1String);
642       z += dzSaa1PbCompF1;
643       shSaa1M->DefineSection(17, z, rmax, rOuSaa1String);
644       shSaa1M->DefineSection(18, z, rmax, rOuSaa1PbCompF3);
645       z += dzSaa1PbCompF2;
646       shSaa1M->DefineSection(19, z, rmax, rOuSaa1PbCompF3);
647
648 //
649 //    Inner 1.69deg line
650       for (Int_t i  = 2; i < 15; i++) {
651           Double_t z    = shSaa1M->GetZ(i);
652           Double_t r2 = shSaa1M->GetRmax(i);     
653           Double_t r1 = rmin + (z - 0.9) * TMath::Tan(1.69 / 2. * kDegRad) - kSec;
654           shSaa1M->DefineSection(i, z, r1, r2);
655       }
656
657       TGeoVolume* voSaa1M  =  new TGeoVolume("YSAA1M", shSaa1M, kMedAir);
658       voSaa1M->SetVisibility(0);
659       
660
661 ///////////////////////////////////
662 //                               //
663 // Recess Station 2              //
664 // Drawing ALIP2A__0260          //
665 ///////////////////////////////////
666 ///////////////////////////////////
667 //    SAA1 W-Ring 1              //
668 //    Drawing ALIP2A__0217       //
669 ///////////////////////////////////
670       Float_t saa1Wring1Width  =  5.85;
671       TGeoPcon* shSaa1Wring1    = new TGeoPcon(0., 360., 2);
672       shSaa1Wring1->DefineSection(0, 0.00           , 20.30, 23.175);
673       shSaa1Wring1->DefineSection(1, saa1Wring1Width, 20.30, 23.400);
674       TGeoVolume* voSaa1Wring1  =  new TGeoVolume("YSAA1_WRING1", shSaa1Wring1, kMedNiW);
675
676 ///////////////////////////////////
677 //    SAA1 W-Ring 2              //
678 //    Drawing ALIP2A__0055       //
679 ///////////////////////////////////
680       Float_t saa1Wring2Rinner  = 20.30;
681       Float_t saa1Wring2Router  = 23.40;
682       Float_t saa1Wring2HWidth  =  3.75;
683       Float_t saa1Wring2Cutoffx =  4.45;
684       Float_t saa1Wring2Cutoffy =  4.45;
685       TGeoTubeSeg* shSaa1Wring2a  = new TGeoTubeSeg(saa1Wring2Rinner, saa1Wring2Router, saa1Wring2HWidth, 0., 90.);
686       shSaa1Wring2a->SetName("shSaa1Wring2a");
687       TGeoBBox* shSaa1Wring2b  = new TGeoBBox(saa1Wring2Router / 2., saa1Wring2Router / 2., saa1Wring2HWidth);
688       shSaa1Wring2b->SetName("shSaa1Wring2b");
689       TGeoTranslation* trSaa1Wring2b 
690           = new TGeoTranslation("trSaa1Wring2b", saa1Wring2Router / 2. + saa1Wring2Cutoffx, saa1Wring2Router / 2. + saa1Wring2Cutoffy, 0.);
691       trSaa1Wring2b->RegisterYourself();
692       TGeoCompositeShape*  shSaa1Wring2 = new TGeoCompositeShape("shSaa1Wring2", "(shSaa1Wring2a)*(shSaa1Wring2b:trSaa1Wring2b)");
693       TGeoVolume* voSaa1Wring2 = new TGeoVolume("YSAA1_WRING2", shSaa1Wring2, kMedNiW);
694
695 ///////////////////////////////////
696 //    SAA1 W-Ring 3              //
697 //    Drawing ALIP2A__0216       //
698 ///////////////////////////////////
699
700       Float_t saa1Wring3Rinner  = 20.30;
701       Float_t saa1Wring3Router  = 23.40;
702       Float_t saa1Wring3HWidth  =  3.75;
703       Float_t saa1Wring3Cutoffx =  4.50;
704       Float_t saa1Wring3Cutoffy =  4.40;
705       TGeoTubeSeg* shSaa1Wring3a  = new TGeoTubeSeg(saa1Wring3Rinner, saa1Wring3Router, saa1Wring3HWidth, 0., 90.);
706       shSaa1Wring3a->SetName("shSaa1Wring3a");
707       TGeoBBox* shSaa1Wring3b  = new TGeoBBox(saa1Wring3Router / 2., saa1Wring3Router / 2., saa1Wring3HWidth);
708       shSaa1Wring3b->SetName("shSaa1Wring3b");
709       TGeoTranslation* trSaa1Wring3b 
710           = new TGeoTranslation("trSaa1Wring3b", saa1Wring3Router / 2. + saa1Wring3Cutoffx, saa1Wring3Router / 2. + saa1Wring3Cutoffy, 0.);
711       trSaa1Wring3b->RegisterYourself();
712       TGeoCompositeShape*  shSaa1Wring3 = new TGeoCompositeShape("shSaa1Wring3", "(shSaa1Wring3a)*(shSaa1Wring3b:trSaa1Wring3b)");
713       TGeoVolume* voSaa1Wring3 = new TGeoVolume("YSAA1_WRING3", shSaa1Wring3, kMedNiW);
714
715 ///////////////////////////////////
716 //    SAA1 W-Ring 4              //
717 //    Drawing ALIP2A__0215       //
718 ///////////////////////////////////
719       Float_t saa1Wring4Width  =  5.85;
720       TGeoPcon* shSaa1Wring4  = new TGeoPcon(0., 360., 5);
721       shSaa1Wring4->DefineSection(0, 0.00, 20.30, 23.40);
722       shSaa1Wring4->DefineSection(1, 1.00, 20.30, 23.40);
723       shSaa1Wring4->DefineSection(2, 1.00, 20.30, 24.50);      
724       shSaa1Wring4->DefineSection(3, 4.85, 20.30, 24.80);
725       shSaa1Wring4->DefineSection(4, 5.85, 24.10, 24.80);
726       TGeoVolume* voSaa1Wring4  =  new TGeoVolume("YSAA1_WRING4", shSaa1Wring4, kMedNiW);
727
728 ///////////////////////////////////
729 //    SAA1 W-Ring 5              //
730 //    Drawing ALIP2A__0218       //
731 ///////////////////////////////////
732       Float_t saa1Wring5Rinner = 20.30;
733       Float_t saa1Wring5Router = 23.40;
734       Float_t saa1Wring5HWidth =  0.85;
735       TGeoVolume* voSaa1Wring5    = new TGeoVolume("YSAA1_WRING5", 
736                                                    new TGeoTube(saa1Wring5Rinner, saa1Wring5Router, saa1Wring5HWidth), kMedNiW);
737 //
738 // Position the rings in the assembly 
739 //      
740       TGeoVolumeAssembly* asSaa1ExtraShield = new TGeoVolumeAssembly("YSAA1ExtraShield");
741 // Distance between rings
742       Float_t saa1DWrings = 2.3;
743 //
744       dz = - (saa1Wring1Width + 6. * saa1Wring2HWidth + 2. * saa1Wring3HWidth + saa1Wring4Width + 2. * saa1Wring5HWidth + 2. * saa1DWrings) / 2.;
745       asSaa1ExtraShield->AddNode(voSaa1Wring1,    1, new TGeoTranslation(0., 0., dz));
746       dz +=   saa1Wring1Width;
747       dz +=   saa1Wring2HWidth;   
748       asSaa1ExtraShield->AddNode(voSaa1Wring2,    1, new TGeoCombiTrans(0., 0., dz, rot000));
749       asSaa1ExtraShield->AddNode(voSaa1Wring2,    2, new TGeoCombiTrans(0., 0., dz, rot180));
750       dz +=   saa1Wring2HWidth;   
751       dz +=   saa1DWrings;
752       dz +=   saa1Wring2HWidth;   
753       asSaa1ExtraShield->AddNode(voSaa1Wring2,    3, new TGeoCombiTrans(0., 0., dz, rot090));
754       asSaa1ExtraShield->AddNode(voSaa1Wring2,    4, new TGeoCombiTrans(0., 0., dz, rot270));
755       dz +=   saa1Wring2HWidth;   
756       dz +=   saa1Wring5HWidth;   
757       asSaa1ExtraShield->AddNode(voSaa1Wring5,    1, new TGeoTranslation(0., 0., dz));
758       dz +=   saa1Wring5HWidth;   
759       dz +=   saa1Wring2HWidth;   
760       asSaa1ExtraShield->AddNode(voSaa1Wring2,    5, new TGeoCombiTrans(0., 0., dz, rot000));
761       asSaa1ExtraShield->AddNode(voSaa1Wring2,    6, new TGeoCombiTrans(0., 0., dz, rot180));
762       dz +=   saa1Wring2HWidth;   
763       dz +=   saa1DWrings;
764       dz +=   saa1Wring3HWidth;   
765       asSaa1ExtraShield->AddNode(voSaa1Wring3,    1, new TGeoCombiTrans(0., 0., dz, rot090));
766       asSaa1ExtraShield->AddNode(voSaa1Wring3,    2, new TGeoCombiTrans(0., 0., dz, rot270));
767       dz +=   saa1Wring3HWidth;   
768       asSaa1ExtraShield->AddNode(voSaa1Wring4,    1, new TGeoTranslation(0., 0., dz));
769       dz +=   saa1Wring4Width;   
770       const Float_t saa1ExtraShieldL = 48;
771 //
772 // Assemble SAA1
773       voSaa1M->AddNode(voSaa1StEnv,     1, gGeoIdentity);
774       voSaa1M->AddNode(voSaa1WPipe,     1, gGeoIdentity);
775       voSaa1M->AddNode(voSaa1PbComp,    1, gGeoIdentity);
776       voSaa1M->AddNode(voSaa1WCone,     1, gGeoIdentity);
777       voSaa1M->AddNode(voSaa1StRing,    1, gGeoIdentity);
778       voSaa1M->AddNode(voSaa1InnerTube, 1, new TGeoTranslation(0., 0., dzSaa1InnerTube + 0.9));               
779       TGeoVolumeAssembly* voSaa1 = new TGeoVolumeAssembly("YSAA1");
780       voSaa1->AddNode(voSaa1M, 1, gGeoIdentity);
781       
782 ///////////////////////////////////////
783 //          SAA1/SAA2  Pb Joint      //
784 //          Drawing ALIP2A__0081     //
785 ///////////////////////////////////////
786 //
787 // Outer radius
788       Float_t rOuSaa1Saa2      = 70.0/2.;
789 // Flange SAA1 side
790       Float_t dzSaa1Saa2F1     =  3.;
791       Float_t rInSaa1Saa2F1    = 58.5/2.;
792 // 1st Central Section
793       Float_t dzSaa1Saa2C1     = 19.3;
794       Float_t rInSaa1Saa2C1    = 42.8/2.;
795 // Transition Region
796       Float_t dzSaa1Saa2T      =  3.3;
797 // 1st Central Section
798       Float_t dzSaa1Saa2C2     =  6.2;
799       Float_t rInSaa1Saa2C2    = 36.2/2.;
800 // Flange SAA2 side
801       Float_t dzSaa1Saa2F2     =  3.1;
802       Float_t rInSaa1Saa2F2    = 54.1/2.;
803 // Total length
804       Float_t dzSaa1Saa2       = 34.9;
805       
806       
807       TGeoPcon* shSaa1Saa2Pb = new TGeoPcon(0., 360., 8);
808       z = 0.;
809 // Flange SAA1 side
810       shSaa1Saa2Pb->DefineSection( 0,  z, rInSaa1Saa2F1, rOuSaa1Saa2);
811       z += dzSaa1Saa2F1;
812       shSaa1Saa2Pb->DefineSection( 1,  z, rInSaa1Saa2F1, rOuSaa1Saa2);
813       shSaa1Saa2Pb->DefineSection( 2,  z, rInSaa1Saa2C1, rOuSaa1Saa2);
814 // Central region 1
815       z +=  dzSaa1Saa2C1;
816       shSaa1Saa2Pb->DefineSection( 3,  z, rInSaa1Saa2C1, rOuSaa1Saa2);
817 // 45 deg transition
818       z += dzSaa1Saa2T;
819       shSaa1Saa2Pb->DefineSection( 4, z, rInSaa1Saa2C2, rOuSaa1Saa2);
820       z += dzSaa1Saa2C2;
821       shSaa1Saa2Pb->DefineSection( 5, z, rInSaa1Saa2C2, rOuSaa1Saa2);
822       shSaa1Saa2Pb->DefineSection( 6, z, rInSaa1Saa2F2, rOuSaa1Saa2);
823       z += dzSaa1Saa2F2;
824       shSaa1Saa2Pb->DefineSection( 7, z, rInSaa1Saa2F2, rOuSaa1Saa2);
825       TGeoVolume* voSaa1Saa2Pb = new TGeoVolume("YSAA1SAA2Pb", shSaa1Saa2Pb, kMedPb);
826 //
827 //    Mother volume and outer steel envelope
828       Float_t rOuSaa1Saa2Steel = 36.9;
829       
830       TGeoPcon* shSaa1Saa2 = MakeShapeFromTemplate(shSaa1Saa2Pb, 0., rOuSaa1Saa2Steel-rOuSaa1Saa2);
831       TGeoVolume* voSaa1Saa2 = new TGeoVolume("YSAA1SAA2", shSaa1Saa2, kMedSteel);
832       voSaa1Saa2->AddNode(voSaa1Saa2Pb, 1, gGeoIdentity);
833 //
834 //    Inner region with higher transport cuts
835 //
836       TGeoPcon*   shSaa1Saa2I = MakeShapeFromTemplate(shSaa1Saa2Pb, 0., -3.);
837       TGeoVolume* voSaa1Saa2I = new TGeoVolume("YSAA1_SAA2I", shSaa1Saa2I, kMedPbSh);
838       voSaa1Saa2Pb->AddNode(voSaa1Saa2I, 1, gGeoIdentity);
839       
840
841
842 ///////////////////////////////////////
843 //                SAA2               //
844 ///////////////////////////////////////
845
846       
847 ///////////////////////////////////
848 //    SAA2 Steel Envelope        //
849 //    Drawing ALIP2A__0041       //
850 ///////////////////////////////////
851       dSt = 4.;  // Thickness of steel envelope
852       // Length of the first section
853       Float_t dzSaa2StEnv1  = 163.15;
854       Float_t rInSaa2StEnv1 = 65.8/2.;
855       // Length of the second section
856       Float_t dzSaa2StEnv2  = 340.35;
857       Float_t rInSaa2StEnv2 = 87.2/2.;
858       // Rel. starting position 
859       Float_t zSaa2StEnv = 3.;
860       
861       TGeoPcon* shSaa2StEnv  = new TGeoPcon(0., 360., 6);
862       // First Section
863       z = zSaa2StEnv;
864       shSaa2StEnv->DefineSection( 0, z, rInSaa2StEnv1, rInSaa2StEnv1 + dSt);
865       z += dzSaa2StEnv1;
866       shSaa2StEnv->DefineSection( 1, z, rInSaa2StEnv1, rInSaa2StEnv1 + dSt);
867       // Transition region
868       shSaa2StEnv->DefineSection( 2, z, rInSaa2StEnv1, rInSaa2StEnv2 + dSt);           
869       z += dSt;
870       shSaa2StEnv->DefineSection( 3, z, rInSaa2StEnv1, rInSaa2StEnv2 + dSt);          
871       // Second section
872       shSaa2StEnv->DefineSection( 4, z, rInSaa2StEnv2, rInSaa2StEnv2 + dSt);           
873       z += dzSaa2StEnv2;
874       shSaa2StEnv->DefineSection( 5, z, rInSaa2StEnv2, rInSaa2StEnv2 + dSt);           
875
876       TGeoVolume* voSaa2StEnv  =  new TGeoVolume("YSAA2_SteelEnvelope", shSaa2StEnv, kMedSteel);
877
878
879 ///////////////////////////////////
880 //    SAA2 Pb Ring               //
881 //    Drawing ALIP2A__0080       //
882 //    Drawing ALIP2A__0111       //
883 ///////////////////////////////////
884 //
885 // Rel. position in z
886       Float_t zSaa2PbRing    = 35.25;  
887 // Length
888       Float_t dzSaa2PbRing   = 65.90;  
889 // Inner radius
890       Float_t rInSaa2PbRing  = 37.00;
891 // Outer radius at front
892       Float_t rOuSaa2PbRingF = 42.74;
893 // Outer Rradius at rear
894       Float_t rOuSaa2PbRingR = 44.58;      
895       
896       TGeoPcon* shSaa2PbRing  = new TGeoPcon(0., 360., 2);
897       z = zSaa2PbRing;
898       shSaa2PbRing->DefineSection(0, z, rInSaa2PbRing, rOuSaa2PbRingF);
899       z += dzSaa2PbRing;
900       shSaa2PbRing->DefineSection(1, z, rInSaa2PbRing, rOuSaa2PbRingR);
901
902       TGeoVolume* voSaa2PbRing  =  new TGeoVolume("YSAA2_PbRing", shSaa2PbRing, kMedPb);
903
904
905 ///////////////////////////////////
906 //    SAA2 Pb Components         //
907 //    Drawing ALIP2A__0079       //
908 ///////////////////////////////////
909       tanAlpha = TMath::Tan(1.89 / 2. * kDegRad);
910       TGeoPcon* shSaa2PbComp  = new TGeoPcon(0., 360., 16);
911       // Total length 
912       Float_t dzSaa2PbComp    = 512.;
913       // Length of 1st bellow recess
914       Float_t dzSaa2PbCompB1  =  24.;
915       // Length of 2nd bellow recess
916       Float_t dzSaa2PbCompB2   = 27.;
917       // Flange on the SAA1 side Detail A
918       // 1st Step
919       Float_t dzSaa2PbCompA1  =   1.5;
920       Float_t rInSaa2PbCompA1 =  43.0/2.;
921       Float_t rOuSaa2PbCompA1 =  53.0/2.;
922       // 2nd Step
923       Float_t dzSaa2PbCompA2  =   1.5;
924       Float_t rInSaa2PbCompA2 =  36.8/2.;
925       Float_t rOuSaa2PbCompA2 =  rOuSaa2PbCompA1;
926       // Straight section
927       Float_t dzSaa2PbCompA3  =  21.0;
928       Float_t rInSaa2PbCompA3 =  rInSaa2PbCompA2;
929       Float_t rOuSaa2PbCompA3 =  65.2/2.;
930       //
931       // 1st Section (outer straight, inner 1.89/2. deg opening cone)
932       // Length
933       Float_t dzSaa2PbComp1   = 146.15;
934       // Inner radius at the end 
935       Float_t rInSaa2PbComp1  = rInSaa2PbCompA3 + dzSaa2PbComp1 * tanAlpha;
936       // Outer radius
937       Float_t rOuSaa2PbComp1  = rOuSaa2PbCompA3;
938       //
939       // 2nd Section (outer straight, inner 1.89/2. deg opening cone)
940       // Length 
941       Float_t dzSaa2PbComp2   = (dzSaa2PbComp - dzSaa2PbComp1 - dzSaa2PbCompB1 - dzSaa2PbCompB2);
942       // Inner radius at the end 
943       Float_t rInSaa2PbComp2  = rInSaa2PbComp1 + dzSaa2PbComp2 * tanAlpha;
944       // Outer radius
945       Float_t rOuSaa2PbComp2  = 86.6/2.;
946       //
947       // Flange on the SAA3 side (Detail E)
948       //
949       // Straight Section
950       // Length  dzSaa2PbCompB2 - 8.8 = 27 - 8.8 = 18.2
951       Float_t dzSaa2PbCompE1  =  18.2;
952       Float_t rInSaa2PbCompE1 =  52.0/2.;
953       Float_t rOuSaa2PbCompE1 =  86.6/2.;
954       // 45 deg transition
955       Float_t dzSaa2PbCompE2  =   2.7;
956       // 1st Step
957       Float_t dzSaa2PbCompE3  =   0.6;
958       Float_t rInSaa2PbCompE3 =  52.0/2.+ dzSaa2PbCompE2;
959       Float_t rOuSaa2PbCompE3 =  83.0/2.;
960       // 2nd Step
961       Float_t dzSaa2PbCompE4  =   4.0;
962       Float_t rOuSaa2PbCompE4 =  61.6/2.;
963       // end
964       Float_t dzSaa2PbCompE5  =   1.5;
965
966
967       //
968       // Flange on SAA1 side (Detail A)
969       z = 0.;
970       // 1st Step
971       shSaa2PbComp->DefineSection(  0,  z, rInSaa2PbCompA1, rOuSaa2PbCompA1);
972       z += dzSaa2PbCompA1;
973       shSaa2PbComp->DefineSection(  1,  z, rInSaa2PbCompA1, rOuSaa2PbCompA1);
974       shSaa2PbComp->DefineSection(  2,  z, rInSaa2PbCompA2, rOuSaa2PbCompA2);
975       // 2nd Step
976       z += dzSaa2PbCompA2;
977       shSaa2PbComp->DefineSection(  3,  z, rInSaa2PbCompA2, rOuSaa2PbCompA2);
978       shSaa2PbComp->DefineSection(  4,  z, rInSaa2PbCompA3, rOuSaa2PbCompA3);
979       // straight section
980       z += dzSaa2PbCompA3;
981       shSaa2PbComp->DefineSection(  5,  z, rInSaa2PbCompA3, rOuSaa2PbCompA3);
982       //
983       // Section 1
984       z += dzSaa2PbComp1;
985       shSaa2PbComp->DefineSection(  6,  z, rInSaa2PbComp1, rOuSaa2PbComp1);
986       //
987       // Section 2
988       shSaa2PbComp->DefineSection(  7,  z, rInSaa2PbComp2, rOuSaa2PbComp2);
989       z += dzSaa2PbComp2;
990       shSaa2PbComp->DefineSection(  8,  z, rInSaa2PbComp2, rOuSaa2PbComp2);
991       //
992       // Flange SAA3 side (Detail E)
993       z += dzSaa2PbCompE1;
994       shSaa2PbComp->DefineSection(  9,  z, rInSaa2PbCompE1, rOuSaa2PbCompE1);
995       // 45 deg transition
996       z += dzSaa2PbCompE2;
997       shSaa2PbComp->DefineSection( 10,  z, rInSaa2PbCompE3, rOuSaa2PbCompE1);
998       // 1st step
999       z += dzSaa2PbCompE3;
1000       shSaa2PbComp->DefineSection( 11,  z, rInSaa2PbCompE3, rOuSaa2PbCompE1);
1001       shSaa2PbComp->DefineSection( 12,  z, rInSaa2PbCompE3, rOuSaa2PbCompE3);
1002       // 2nd step
1003       z += dzSaa2PbCompE4;
1004       shSaa2PbComp->DefineSection( 13,  z, rInSaa2PbCompE3, rOuSaa2PbCompE3);
1005       shSaa2PbComp->DefineSection( 14,  z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
1006       // end
1007       z += dzSaa2PbCompE5;
1008       shSaa2PbComp->DefineSection( 15,  z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
1009
1010       TGeoVolume* voSaa2PbComp  =  new TGeoVolume("YSAA2_PbComp", shSaa2PbComp, kMedPbSh);
1011
1012
1013 ///////////////////////////////////
1014 //    SAA2 Inner Tube            //
1015 //    Drawing ALIP2A__0083       //
1016 ///////////////////////////////////
1017 //
1018 //
1019 //
1020 // Length of saa2:               512.0 cm
1021 // Length of inner tube:         501.7 cm 
1022 // Lenth of bellow recess:        10.3 cm   ( 1.5 + 8.8) 
1023 // Radius at entrance 36.8/2,  d = 0.1
1024 // Radius at exit     52.0/2,  d = 0.1 
1025 //
1026       const Float_t kSaa2InnerTubeL     =  501.7;    // Length of the tube  
1027       const Float_t kSaa2InnerTubeRmin  =  36.6/2.;  // Radius at entrance
1028       const Float_t kSaa2InnerTubeRmax  =  51.8/2.;  // Radius at exit
1029       const Float_t kSaa2InnerTubeD     =   0.2   ;  // Thickness     
1030       TGeoPcon*   shSaa2InnerTube = new TGeoPcon(0., 360., 4);
1031       z = 0.;
1032       shSaa2InnerTube->DefineSection( 0, z, kSaa2InnerTubeRmin - kSaa2InnerTubeD, kSaa2InnerTubeRmin);
1033       z += dzSaa2PbCompA2 + dzSaa2PbCompA3;
1034       shSaa2InnerTube->DefineSection( 1, z, kSaa2InnerTubeRmin - kSaa2InnerTubeD, kSaa2InnerTubeRmin);
1035       z =  kSaa2InnerTubeL - dzSaa2PbCompE1;
1036       shSaa2InnerTube->DefineSection( 2, z, kSaa2InnerTubeRmax - kSaa2InnerTubeD, kSaa2InnerTubeRmax);
1037       z =  kSaa2InnerTubeL;
1038       shSaa2InnerTube->DefineSection( 3, z, kSaa2InnerTubeRmax - kSaa2InnerTubeD, kSaa2InnerTubeRmax);
1039       TGeoVolume* voSaa2InnerTube = new TGeoVolume("YSAA2_InnerTube", shSaa2InnerTube, kMedSteelSh);
1040       
1041 ///////////////////////////////////
1042 //    SAA2 Steel Ring            //
1043 //    Drawing ALIP2A__0042       //
1044 ///////////////////////////////////
1045       //  HalfWidth
1046       Float_t dzSaa2SteelRing = 2.;
1047       TGeoTube*   shSaa2SteelRing  = new TGeoTube(41.6, 47.6, dzSaa2SteelRing);
1048       TGeoVolume* voSaa2SteelRing  = new TGeoVolume("YSAA2_SteelRing", shSaa2SteelRing, kMedSteel);
1049
1050 ///////////////////////////////////
1051 //    SAA2 Outer Shape           //
1052 //    Drawing ALIP2A__0108       //
1053 ///////////////////////////////////
1054
1055       TGeoPcon* shSaa2  = new TGeoPcon(0., 360., 16);
1056       kSec = 0.02; // security distance to avoid trivial extrusions
1057       rmin = kSaa2InnerTubeRmin - kSaa2InnerTubeD - kSec;
1058       rmax = kSaa2InnerTubeRmax - kSaa2InnerTubeD - kSec;
1059       // Flange SAA1 side
1060       z = 0.;
1061       shSaa2->DefineSection( 0, z, rmin           , rOuSaa2PbCompA1);
1062       z += dzSaa2PbCompA1 + dzSaa2PbCompA2;
1063       shSaa2->DefineSection( 1, z, rmin           , rOuSaa2PbCompA1);
1064       shSaa2->DefineSection( 2, z, rmin           , rInSaa2StEnv1 + dSt);
1065       z += dzSaa2PbCompA3;
1066       shSaa2->DefineSection( 3, z, rmin           , rInSaa2StEnv1 + dSt);
1067       z = zSaa2PbRing;
1068       shSaa2->DefineSection( 4, z, 0.             , rInSaa2StEnv1 + dSt);
1069       shSaa2->DefineSection( 5, z, 0.             , rOuSaa2PbRingF);
1070       z += dzSaa2PbRing;
1071       shSaa2->DefineSection( 6, z, 0.             , rOuSaa2PbRingR);
1072       shSaa2->DefineSection( 7, z, 0.             , rInSaa2StEnv1 + dSt);
1073       z = dzSaa2PbCompA1 + dzSaa2PbCompA2 + dzSaa2StEnv1;
1074       shSaa2->DefineSection( 8, z, 0.             , rInSaa2StEnv1 + dSt);
1075       shSaa2->DefineSection( 9, z, 0.             , rInSaa2StEnv2 + dSt);
1076       z = dzSaa2PbComp - dzSaa2PbCompB2;
1077       shSaa2->DefineSection(10, z, rmax           , rInSaa2StEnv2 + dSt);
1078       z += dzSaa2PbCompE1;
1079       shSaa2->DefineSection(11, z, rmax           , rInSaa2StEnv2 + dSt);
1080       z += dzSaa2PbCompE2;
1081       shSaa2->DefineSection(12, z, rInSaa2PbCompE3, rInSaa2StEnv2 + dSt);
1082       z += (dzSaa2PbCompE3 + dzSaa2PbCompE4);
1083       shSaa2->DefineSection(13, z, rInSaa2PbCompE3, rInSaa2StEnv2 + dSt);
1084       shSaa2->DefineSection(14, z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
1085       z += dzSaa2PbCompE5;
1086       shSaa2->DefineSection(15, z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
1087
1088       TGeoVolume* voSaa2  =  new TGeoVolume("YSAA2", shSaa2, kMedAir);
1089       voSaa2->SetVisibility(0);
1090 // Inner 1.89/2 deg line
1091       Double_t zref   = dzSaa2PbCompA1 + dzSaa2PbCompA2 + dzSaa2PbCompA3;
1092       for (Int_t i  = 4; i < 10; i++) {
1093           Double_t z    = shSaa2->GetZ(i);
1094           Double_t r2 = shSaa2->GetRmax(i);      
1095           Double_t r1 = rmin + (z -  zref) * TMath::Tan(1.89 / 2. * kDegRad) - kSec;
1096           shSaa2->DefineSection(i, z, r1, r2);
1097       }
1098
1099 //
1100 //    Assemble SAA2
1101       voSaa2->AddNode(voSaa2StEnv,     1, gGeoIdentity);
1102       voSaa2->AddNode(voSaa2PbRing,    1, gGeoIdentity);
1103       voSaa2->AddNode(voSaa2PbComp,    1, gGeoIdentity);
1104       voSaa2->AddNode(voSaa2InnerTube, 1, new TGeoTranslation(0., 0., dzSaa2PbCompA1));
1105       z = (dzSaa2PbComp - dzSaa2PbCompE4 - dzSaa2PbCompE5) + dzSaa2SteelRing;
1106       voSaa2->AddNode(voSaa2SteelRing, 1, new TGeoTranslation(0., 0., z));
1107
1108
1109 ///////////////////////////////////////
1110 //                SAA3               //
1111 ///////////////////////////////////////
1112 //
1113 //
1114 //  This is a study performed by S. Maridor
1115 //  The SAA3 has not yet been designed !!!!!!!!
1116 //
1117 ///////////////////////////////////
1118 //    SAA3 Outer Shape           //
1119 //    Drawing ALIP2A__0xxx       //
1120 ///////////////////////////////////
1121       
1122       TGeoVolumeAssembly* voSaa3  = new TGeoVolumeAssembly("YSAA3");
1123       
1124 ///////////////////////////////////
1125 //    SAA3 Steel Components      //
1126 //    Drawing ALIP2A__0xxx       //
1127 ///////////////////////////////////
1128 //    Block
1129       TGeoBBox* shSaa3CCBlockO   = new TGeoBBox(80./2., 80./2., 100./2.);
1130       shSaa3CCBlockO->SetName("Saa3CCBlockO");
1131
1132       TGeoPcon* shSaa3InnerRegion  = new TGeoPcon(0., 360., 6);
1133       shSaa3InnerRegion->DefineSection( 0, -60.0, 0., 56.6/2.);
1134       shSaa3InnerRegion->DefineSection( 1, -45.0, 0., 56.6/2.);
1135       shSaa3InnerRegion->DefineSection( 2, -42.0, 0., 50.6/2.);
1136       shSaa3InnerRegion->DefineSection( 3, -30.0, 0., 50.6/2.);
1137       shSaa3InnerRegion->DefineSection( 4,  30.5, 0., 16.8/2.);
1138       shSaa3InnerRegion->DefineSection( 5,  60.0, 0., 16.8/2.);
1139       shSaa3InnerRegion->SetName("Saa3InnerRegion");
1140
1141       TGeoCompositeShape* shSaa3CCBlock = new TGeoCompositeShape("Saa3CCBlock", "Saa3CCBlockO-Saa3InnerRegion");
1142       TGeoVolume* voSaa3CCBlock         = new TGeoVolume("YSAA3CCBlock", shSaa3CCBlock, kMedConcSh);     
1143
1144
1145       voSaa3->AddNode(voSaa3CCBlock, 1, gGeoIdentity);
1146       
1147 //    Plate 1: 240 cm x 80 cm x 100 cm (x 2)
1148       TGeoVolume* voSaa3SteelPlate1  =  new TGeoVolume("YSAA3SteelPlate1", 
1149                                                        new TGeoBBox(240./2., 80./2., 100./2.),
1150                                                        kMedSteelSh);
1151       TGeoVolume* voSaa3SteelPlate11 =  new TGeoVolume("YSAA3SteelPlate11", 
1152                                                        new TGeoBBox(240./2., 80./2., 10./2.),
1153                                                        kMedSteel);
1154       voSaa3SteelPlate1->AddNode(voSaa3SteelPlate11, 1, new TGeoTranslation(0., 0., -45.));
1155       voSaa3->AddNode(voSaa3SteelPlate1, 1, new TGeoTranslation(0., +80., 0.));
1156       voSaa3->AddNode(voSaa3SteelPlate1, 2, new TGeoTranslation(0., -80., 0.));
1157
1158
1159 //    Plate 2:  80 cm x 80 cm x 100 cm (x 2)
1160       TGeoVolume* voSaa3SteelPlate2  =  new TGeoVolume("YSAA3SteelPlate2", 
1161                                                        new TGeoBBox( 80./2., 80./2., 100./2.),
1162                                                        kMedSteelSh);
1163       TGeoVolume* voSaa3SteelPlate21 =  new TGeoVolume("YSAA3SteelPlate21", 
1164                                                        new TGeoBBox( 80./2., 80./2., 10./2.),
1165                                                        kMedSteel);
1166       voSaa3SteelPlate2->AddNode(voSaa3SteelPlate21, 1, new TGeoTranslation(0., 0., -45.));
1167
1168       voSaa3->AddNode(voSaa3SteelPlate2, 1, new TGeoTranslation(+80, 0., 0.));
1169       voSaa3->AddNode(voSaa3SteelPlate2, 2, new TGeoTranslation(-80, 0., 0.));
1170
1171
1172 ///////////////////////////////////
1173 //    Muon Filter                //
1174 //    Drawing ALIP2A__0105       //
1175 ///////////////////////////////////
1176       // Half Length 
1177       Float_t dzMuonFilter = 60.;
1178       
1179       TGeoBBox*   shMuonFilterO  = new TGeoBBox(550./2., 620./2., dzMuonFilter);
1180       shMuonFilterO->SetName("FilterO");
1181       TGeoTube*   shMuonFilterI  = new TGeoTube(0., 50., dzMuonFilter + 5.);
1182       shMuonFilterI->SetName("FilterI");
1183       TGeoCompositeShape* shMuonFilter = new TGeoCompositeShape("MuonFilter", "FilterO-FilterI");
1184       //
1185       // !!!!! Needs to be inclined
1186       TGeoVolume* voMuonFilter = new TGeoVolume("YMuonFilter", shMuonFilter, kMedSteel);
1187
1188       // Inner part with higher transport cuts
1189       Float_t dzMuonFilterH = 50.;
1190       TGeoBBox*   shMuonFilterOH  = new TGeoBBox(550./2., 620./2., dzMuonFilterH);
1191       shMuonFilterOH->SetName("FilterOH");
1192       TGeoTube*   shMuonFilterIH  = new TGeoTube(0., 50., dzMuonFilterH + 5.);
1193       shMuonFilterIH->SetName("FilterIH");
1194       TGeoCompositeShape* shMuonFilterH = new TGeoCompositeShape("MuonFilterH", "FilterOH-FilterIH");
1195       TGeoVolume* voMuonFilterH = new TGeoVolume("YMuonFilterH", shMuonFilterH, kMedSteelSh);
1196       voMuonFilter->AddNode(voMuonFilterH, 1, gGeoIdentity);
1197       
1198 //  
1199       TGeoVolumeAssembly* voSaa  = new TGeoVolumeAssembly("YSAA");
1200 //
1201 //    
1202 //    
1203 //
1204 //
1205 //    Starting position of the FA Flange/Tail 
1206       Float_t ziFaWTail   = 499.0;
1207 //    End of the FA Flange/Tail
1208       Float_t zoFaWTail   = ziFaWTail + dzFaWTail;
1209 //    Starting position of the FA/SAA1 Joint (2.8 cm overlap with tail)
1210       Float_t ozFaSaa1    = 2.8;
1211       Float_t ziFaSaa1    = zoFaWTail - ozFaSaa1;
1212 //    End of the FA/SAA1 Joint
1213       Float_t zoFaSaa1    = ziFaSaa1 +  dzFaSaa1;
1214 //    Starting position of SAA1 (2.0 cm overlap with joint)     
1215       Float_t ozSaa1      = 2.;
1216       Float_t ziSaa1      = zoFaSaa1 - ozSaa1;
1217 //    End of SAA1
1218       Float_t zoSaa1      = ziSaa1 + dzSaa1;
1219 //    Starting position of SAA1/SAA2 Joint (1.95 cm overlap with SAA1)
1220       Float_t ziSaa1Saa2  = zoSaa1 - 1.95;
1221 //    End of SAA1/SAA2 Joint
1222       Float_t zoSaa1Saa2  = ziSaa1Saa2 + dzSaa1Saa2;
1223 //    Starting position of SAA2 (3.1 cm overlap with the joint)
1224       Float_t ziSaa2      = zoSaa1Saa2 - 3.1;
1225 //    End of SAA2
1226       Float_t zoSaa2      = ziSaa2 + dzSaa2PbComp;
1227 //    Position of SAA3
1228       Float_t zcSaa3      = zoSaa2 + 50.;
1229 //    Position of the Muon Filter
1230       Float_t zcFilter    = 1465.9 + dzMuonFilter;
1231
1232       voSaa->AddNode(voFaWTail,    1, new TGeoTranslation(0., 0., ziFaWTail));
1233       voSaa->AddNode(voFaSaa1,     1, new TGeoTranslation(0., 0., ziFaSaa1));
1234       voSaa->AddNode(voSaa1 ,      1, new TGeoTranslation(0., 0., ziSaa1));
1235       voSaa->AddNode(voSaa1Saa2,   1, new TGeoTranslation(0., 0., ziSaa1Saa2));
1236       voSaa->AddNode(voSaa2 ,      1, new TGeoTranslation(0., 0., ziSaa2));
1237       voSaa->AddNode(voSaa3,       1, new TGeoTranslation(0., 0., zcSaa3));
1238       
1239
1240       TGeoRotation* rotxz  = new TGeoRotation("rotxz",   90.,   0., 90.,  90., 180., 0.);
1241       top->AddNode(voSaa, 1, new TGeoCombiTrans(0., 0., 0., rotxz));
1242 //
1243 //  Mother volume for muon stations 1+2 and shielding material placed between the quadrants
1244 //
1245       // Position of the dipole
1246       Float_t ziDipole = 724.45;
1247       
1248       TGeoPcon* shYOUT1 = new TGeoPcon(0., 360., 25);
1249       Float_t eps = 1.e-2;
1250       // FA Tail Section
1251       for (Int_t iz =  0; iz < 9; iz++) {
1252           z = shFaWTail->GetZ(iz+1);
1253           if (iz == 8) z -= ozFaSaa1;
1254           shYOUT1->DefineSection(iz, z + ziFaWTail, shFaWTail->GetRmax(iz+1) + eps, 150.);
1255       }
1256       // FA-SAA1 Joint
1257       z = shYOUT1->GetZ(8);
1258       
1259       for (Int_t iz =  9; iz < 17; iz++) 
1260           shYOUT1->DefineSection(iz, z + shFaSaa1->GetZ(iz-9), shFaSaa1->GetRmax(iz-9) + eps, 150.);
1261
1262       z = shYOUT1->GetZ(16) - ozSaa1;
1263       // SAA1  - Dipole
1264       for (Int_t iz = 17; iz < 24; iz++) 
1265           shYOUT1->DefineSection(iz, z + shSaa1M->GetZ(iz-13), shSaa1M->GetRmax(iz-13) + eps, 150.); 
1266       // Distance between dipole and start of SAA1 2deg opening cone
1267       dz   = ziDipole - (zSaa1StEnv[0] - dSt + zSaa1StEnvS + ziSaa1);
1268       rOut = rOuSaa1StEnv2 + dz * TMath::Tan(2. * kDegRad);
1269       
1270       shYOUT1->DefineSection(24, ziDipole, rOut + eps, 150.);
1271
1272       InvertPcon(shYOUT1);
1273       TGeoVolume* voYOUT1 = new TGeoVolume("YOUT1", shYOUT1, kMedAirMu);
1274       voYOUT1->SetVisibility(0);
1275
1276       voYOUT1->AddNode(asSaa1ExtraShield, 1, new TGeoCombiTrans(0., 0., - (100.7 + 62.2 + saa1ExtraShieldL / 2. + ziFaWTail), rotxz));
1277       voYOUT1->AddNode(asFaExtraShield,   1, new TGeoCombiTrans(0., 0., - (16.41 + kFaWring2HWidth + ziFaWTail), rotxz));
1278       top->AddNode(voYOUT1, 1, gGeoIdentity);
1279 //
1280 //  Mother volume for muon stations 4+5 and trigger stations.
1281 //
1282       Float_t zoDipole = 1235.55;
1283       
1284       TGeoPcon* shYOUT2 = new TGeoPcon(0., 360., 14);
1285       z =  zoDipole;
1286       shYOUT2->DefineSection(0, z,             rOuSaa1String,       252.);
1287 //    Start of SAA1-SAA2
1288       z = ziSaa1Saa2;
1289       shYOUT2->DefineSection(1, z,             rOuSaa1String,       252.);
1290       shYOUT2->DefineSection(2, z,             rOuSaa1Saa2Steel,    252.);
1291 //    End of SAA1-SAA2
1292       z = ziSaa2;
1293       shYOUT2->DefineSection(3, z,             rOuSaa1Saa2Steel,    252.);
1294 //    SAA2
1295       shYOUT2->DefineSection( 4, z,            rInSaa2StEnv1 + dSt, 252.);
1296       z = ziSaa2 + zSaa2PbRing;
1297       shYOUT2->DefineSection( 5, z,            rInSaa2StEnv1 + dSt, 252.);
1298 //    Pb Cone
1299       shYOUT2->DefineSection( 6, z,            rOuSaa2PbRingF,      252.);
1300       rmin = rOuSaa2PbRingF + (1380. - z) * TMath::Tan(1.6 * kDegRad);
1301       shYOUT2->DefineSection( 7, 1380., rmin, 252.);
1302       shYOUT2->DefineSection( 8, 1380., rmin, 304.);
1303       z = ziSaa2 + zSaa2PbRing + dzSaa2PbRing;
1304       shYOUT2->DefineSection( 9, z,            rOuSaa2PbRingR,      304.);
1305 //    Straight Sections
1306       shYOUT2->DefineSection(10, z,            rInSaa2StEnv1 + dSt, 460.);
1307       z = ziSaa2 + dzSaa2StEnv1;
1308       shYOUT2->DefineSection(11, z,            rInSaa2StEnv1 + dSt, 460.);
1309       shYOUT2->DefineSection(12, z,            rInSaa2StEnv2 + dSt, 460.);
1310       z += dzSaa2StEnv2;
1311       shYOUT2->DefineSection(13, z,            rInSaa2StEnv2 + dSt, 460.);
1312       
1313       InvertPcon(shYOUT2);
1314       TGeoVolume* voYOUT2 = new TGeoVolume("YOUT2", shYOUT2, kMedAirMu);
1315       voYOUT2->SetVisibility(0);
1316       voYOUT2->AddNode(voMuonFilter, 1, new TGeoTranslation(0., 0., -zcFilter));            
1317       top->AddNode(voYOUT2, 1, gGeoIdentity);
1318 }
1319
1320 void AliSHILv3::Init()
1321 {
1322   //
1323   // Initialise the muon shield after it has been built
1324   //
1325   Int_t i;
1326   //
1327   if(AliLog::GetGlobalDebugLevel()>0) {
1328     printf("\n%s: ",ClassName());
1329     for(i=0;i<35;i++) printf("*");
1330     printf(" SHILv3_INIT ");
1331     for(i=0;i<35;i++) printf("*");
1332     printf("\n%s: ",ClassName());
1333     //
1334     // Here the SHIL initialisation code (if any!)
1335     for(i=0;i<80;i++) printf("*");
1336     printf("\n");
1337   }
1338 }
1339
1340 void AliSHILv3::InvertPcon(TGeoPcon* pcon)
1341 {
1342 //
1343 //  z -> -z
1344 // 
1345     Int_t nz = pcon->GetNz();
1346     Double_t* z    = new Double_t[nz];
1347     Double_t* rmin = new Double_t[nz];
1348     Double_t* rmax = new Double_t[nz];
1349
1350     Double_t*  z0    = pcon->GetZ();
1351     Double_t*  rmin0 = pcon->GetRmin();
1352     Double_t*  rmax0 = pcon->GetRmax();
1353     
1354     for (Int_t i = 0; i < nz; i++) {
1355         z[i] = z0[i];
1356         rmin[i] = rmin0[i];
1357         rmax[i] = rmax0[i];     
1358     }
1359     
1360     for (Int_t i = 0; i < nz; i++) {
1361         Int_t j = nz - i - 1;
1362         pcon->DefineSection(i, - z[j], rmin[j], rmax[j]);
1363     }
1364     
1365     delete[] z;
1366     delete[] rmin;
1367     delete[] rmax;
1368 }
1369
1370 TGeoPcon* AliSHILv3::MakeShapeFromTemplate(TGeoPcon* pcon, Float_t drMin, Float_t drMax)
1371 {
1372     // 
1373     // Returns new shape based on a template changing
1374     // the inner radii by drMin and the outer radii by drMax.
1375     //
1376     Int_t nz = pcon->GetNz();
1377     TGeoPcon* cpcon = new TGeoPcon(0., 360., nz);
1378     for (Int_t i = 0; i < nz; i++) 
1379         cpcon->DefineSection(i, pcon->GetZ(i), pcon->GetRmin(i) + drMin, pcon->GetRmax(i) + drMax);
1380     return cpcon;
1381 }
1382
1383