]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STRUCT/AliSHILv2.cxx
Initial version
[u/mrichter/AliRoot.git] / STRUCT / AliSHILv2.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 // MUON shielding class
20 // Default version
21 // Author: A.Morsch
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 <TGeoTorus.h>
34
35 #include "AliSHILv2.h"
36 #include "AliConst.h"
37 #include "AliLog.h"
38
39 ClassImp(AliSHILv2)
40  
41 //_____________________________________________________________________________
42 AliSHILv2::AliSHILv2()
43 {
44   //
45   // Default constructor for muon shield
46   //
47 }
48  
49 //_____________________________________________________________________________
50 AliSHILv2::AliSHILv2(const char *name, const char *title)
51   : AliSHIL(name,title)
52 {
53   //
54   // Standard constructor for muon shield
55   //
56   SetMarkerColor(7);
57   SetMarkerStyle(2);
58   SetMarkerSize(0.4);
59   // Pb  cone not yet compatible with muon chamber inner radii
60   // Switched off by default
61   SetWriteGeometry();
62   SetPbCone();
63 }
64  
65 //_____________________________________________________________________________
66 void AliSHILv2::CreateGeometry()
67 {
68   // 
69   // Build muon shield geometry
70   //
71   //
72   //Begin_Html
73   /*
74     <img src="picts/AliSHILv2.gif">
75   */
76   //End_Html
77   //Begin_Html
78   /*
79     <img src="picts/AliSHILv2Tree.gif">
80   */
81   //End_Html
82
83     Float_t cpar[5], cpar0[5], tpar[3], par1[100], pars1[100], par2[100], par3[100], 
84         par4[24], par0[100];
85     Float_t dz, dZ;
86     
87     Int_t *idtmed = fIdtmed->GetArray()-1699;
88
89     Int_t idrotm[1799];
90
91 #include "ABSOSHILConst.h"
92 #include "SHILConst2.h"
93     
94     enum {kC=1705, kAl=1708, kFe=1709, kCu=1710, kW=1711, kPb=1712,
95           kNiCuW=1720, kVacuum=1715, kAir=1714, kConcrete=1716,
96           kPolyCH2=1717, kSteel=1709, kInsulation=1713};        
97     Int_t i;
98     
99 //
100 // Material of the rear part of the shield
101   Int_t iHeavy = kNiCuW;
102   if (fPbCone) iHeavy=kPb;
103 //
104 // Mother volume
105 //
106   Float_t dRear1=kDRear;
107   
108   Float_t zstart=kZRear-dRear1;
109   
110   par0[0]  = 0.;
111   par0[1]  = 360.;
112   par0[2]  = 28.;
113
114   Float_t dl=(kZvac12-zstart)/2.;
115   const Float_t kzLength = dl;
116   
117   dz=zstart+dl;
118 //
119 // start
120   par0[3]  = -dl;
121   par0[4]  = 0.;
122   par0[5]  = zstart * TMath::Tan(kAccMin);
123 // recess station 1
124   par0[6]  = -dl  - zstart + kZch11;
125   par0[7]  = 0.;
126   par0[8]  = 18.2;
127
128   par0[9]   = par0[6];
129   par0[10]  = 0.;
130   par0[11]  = kR11;
131
132   par0[12]  = -dl - zstart + kZch12;
133   par0[13]  = 0.;
134   par0[14]  = kR11;
135
136   par0[15]  = par0[12];
137   par0[16]  = 0.;
138   par0[17]  = 19.5;
139 // recess station 2
140   par0[18]  = -dz+kZch21;
141   par0[19]  = 0.;
142   par0[20]  = kZch21 * TMath::Tan(kAccMin);
143
144   par0[21]  = -dz+kZch21;
145   par0[22] = 0.;
146   par0[23] = kR21;
147
148   par0[24]  = -dz+kZch22;
149   par0[25] = 0.;
150   par0[26] = kR21;
151
152   par0[27]  = -dz+kZch22;
153   par0[28]  = 0.;
154   par0[29]  = kZch22 * TMath::Tan(kAccMin);
155 //
156   par0[30] = -dz+kZvac6;
157   par0[31] = 0.;
158   par0[32] = kZvac6 * TMath::Tan(kAccMin);
159 // end of 2 deg cone
160   par0[33] = -dz+kZConeE;
161   par0[34] = 0.;
162   par0[35] = 30.;
163
164   par0[36] = -dz+kZch31;
165   par0[37] = 0.;
166   par0[38] = 30.;
167
168   par0[39] = -dz+kZch31;
169   par0[40] = 0.;
170   par0[41] = 28.8;
171
172   par0[42] = -dz+kZch32;
173   par0[43] = 0.;
174   par0[44] = 28.8;
175 // start of 1.6 deg cone
176   par0[45] = -dz+kZch32;
177   par0[46] = 0.;
178   par0[47] = 30.+(kZch32-kZConeE)*TMath::Tan(kThetaOpenPbO);
179 // recess station 4
180   par0[48] = -dz+kZch41;
181   par0[49] = 0.;
182   par0[50] = 30.+(kZch41-kZConeE)*TMath::Tan(kThetaOpenPbO);
183
184   par0[51] = -dz+kZch41;
185   par0[52] = 0.;
186   par0[53] = 36.9;
187
188   par0[54] = -dz+kZch42;
189   par0[55] = 0.;
190   par0[56] = 36.9;
191
192   par0[57] = -dz+kZch42;
193   par0[58] = 0.;
194   par0[59] = 30.+(kZch42-kZConeE)*TMath::Tan(kThetaOpenPbO);
195
196 // recess station 5
197
198   par0[60] = -dz+kZch51;
199   par0[61] = 0.;
200   par0[62] = 30.+(kZch51-kZConeE)*TMath::Tan(kThetaOpenPbO);
201
202   par0[63] = -dz+kZch51;
203   par0[64] = 0.;
204   par0[65] = 36.9;
205
206   par0[66] = -dz+kZch52;
207   par0[67] = 0.;
208   par0[68] = 36.9;
209
210   par0[69] = -dz+kZch52;
211   par0[70] = 0.;
212   par0[71] =  30.+(kZch52+4.-kZConeE)*TMath::Tan(kThetaOpenPbO);
213
214 // end of cone
215
216   par0[72] = -dz+kZvac10;
217   par0[73] = 0.;
218   par0[74] = par0[71];
219
220   par0[75] = -dz+kZvac10;
221   par0[76] = 0.;
222   par0[77] = kR42;
223
224   par0[78] = -dz+kZvac11;
225   par0[79] = 0.;
226   par0[80] = kR42;
227
228   par0[81] = -dz+kZvac11;
229   par0[82] = 0.;
230   par0[83] = kR43;
231
232   par0[84] = -dz+kZvac12;
233   par0[85] = 0.;
234   par0[86] = kR43;
235
236   gMC->Gsvolu("YMOT", "PCON", idtmed[kVacuum], par0, 87);
237   dz=zstart+dl;
238   AliMatrix(idrotm[1705], 270., 0., 90., 90., 180., 0.);
239
240   dZ=-dl;
241
242 //
243 // First section: bellows below and behind front absorber 
244 // 
245 //
246   par1[ 0]  = 0.;
247   par1[ 1]  = 360.;
248   par1[ 2]  = 15.;
249   dl=(kZvac4-zstart)/2.;
250   
251   par1[ 3]  = -dl;
252   par1[ 4]  = kRAbs+(zstart-kZOpen) * TMath::Tan(kThetaOpen1);
253   par1[ 5]  = zstart * TMath::Tan(kAccMin);
254
255   par1[ 6]  = -dl-zstart+kZch11;
256   par1[ 7]  = par1[4] + (dRear1 + 19.)  * TMath::Tan(kThetaOpen1);
257   par1[ 8]  = 18.2;
258
259   par1[ 9]  = par1[6];
260   par1[10]  = par1[7];
261   par1[11]  = kR11;
262
263   par1[12]  = -dl-zstart+kZch12;
264   par1[13]  = par1[10] + 36. * TMath::Tan(kThetaOpen1);
265   par1[14]  = kR11;
266
267   par1[15]  = -dl+dRear1 + 50.7;
268   par1[16]  = par1[13];
269   par1[17]  = 19.5;
270
271   par1[18]  = -dl+kZvac1-zstart;
272   par1[19]  = par1[16] + (par1[18] - par1[15]) * TMath::Tan(kThetaOpen1);
273   par1[20]  = (par1[18] +dl +zstart) * TMath::Tan(kAccMin);
274
275   par1[21]  = -dl+kZvac1-zstart;
276   par1[22]  = kRAbs+ (kZvac1-kZOpen) * TMath::Tan(kThetaOpen1);
277   par1[23]  = (par1[21] +dl +zstart) * TMath::Tan(kAccMin);
278   
279
280   par1[24]  = par1[21]+kDr11/10.;
281   par1[25]  = par1[22]+kDr11;
282   par1[26]  = (par1[24] +dl +zstart) * TMath::Tan(kAccMin);
283
284   par1[27]  = -dl+(kZvac1+kDr11/10.+kDB1-zstart);
285   par1[28]  = par1[25];
286   par1[29]  = (par1[27] +dl +zstart) * TMath::Tan(kAccMin);
287
288   par1[30]  = par1[27]+kDr12;
289   par1[31]  = par1[28]+kDr12;
290   par1[32]  = (par1[30] +dl +zstart) * TMath::Tan(kAccMin);
291
292   par1[33]  = par1[30]+kDF1;
293   par1[34]  = par1[31];
294   par1[35]  = (par1[33] +dl +zstart) * TMath::Tan(kAccMin);
295
296   par1[36]  = par1[33]+kDr12;
297   par1[37]  = par1[34]-kDr12; 
298   par1[38]  = (par1[36] +dl +zstart) * TMath::Tan(kAccMin);
299
300   par1[39] = par1[36]+kDB1;
301   par1[40] = par1[37];
302   par1[41] = (par1[39] +dl +zstart) * TMath::Tan(kAccMin);
303
304   par1[42] = par1[39]+kDr13;
305   par1[43] = par1[40]-kDr13;
306   par1[44] = (par1[42] +dl +zstart) * TMath::Tan(kAccMin);
307
308   par1[45] =  -dl+kZvac4-zstart;
309   par1[46] = par1[43];
310   par1[47] = (par1[45] +dl +zstart) * TMath::Tan(kAccMin);
311
312   Float_t r2  = par1[46];
313   Float_t rBox= par1[46]-0.1;
314
315   gMC->Gsvolu("YGO1", "PCON", idtmed[kNiCuW+40], par1, 48);
316
317   for (i=0; i<48; i++)  pars1[i]  = par1[i];
318   for (i=4; i<47; i+=3) pars1[i]  = 0.;
319
320   gMC->Gsvolu("YMO1", "PCON", idtmed[kVacuum+40], pars1, 48);
321   gMC->Gspos("YGO1", 1, "YMO1", 0., 0., 0., 0, "ONLY");  
322   dZ+=dl;
323   gMC->Gspos("YMO1", 1, "YMOT", 0., 0., dZ, 0, "ONLY");  
324   dZ+=dl;
325
326
327   tpar[0]=kR21-0.6;
328   tpar[1]=kR21;
329   tpar[2]=(kZvac4-kZvac41)/2.;
330   gMC->Gsvolu("YSE1", "TUBE", idtmed[kSteel], tpar, 3);
331   dz=dl-tpar[2];
332   gMC->Gspos("YSE1", 1, "YGO1", 0., 0., dz, 0, "ONLY");
333
334
335   tpar[0]=kR11-0.6;
336   tpar[1]=kR11;
337   tpar[2]=(kZvac41-zstart-dRear1)/2.;
338   gMC->Gsvolu("YSE2", "TUBE", idtmed[kSteel], tpar, 3);
339   dz=dl-tpar[2]-(kZvac4-kZvac41);
340   gMC->Gspos("YSE2", 1, "YGO1", 0., 0., dz, 0, "ONLY");
341
342 //
343 // 1st section: vacuum system
344 //
345 //
346 // Bellow 1
347 //
348   tpar[0]=kRB1;
349   tpar[1]=kRB1+kHB1;
350   tpar[2]=kEB1/2.;
351   gMC->Gsvolu("YB11", "TUBE", idtmed[kSteel+40], tpar, 3);
352   Float_t dl1=tpar[2];
353   
354   tpar[0]=kRB1+kHB1-kEB1;
355   tpar[1]=kRB1+kHB1;
356   tpar[2]=(kLB1/2.-2.*kEB1)/2.;
357   gMC->Gsvolu("YB12", "TUBE", idtmed[kSteel+40], tpar, 3);
358   Float_t dl2=tpar[2];
359
360   tpar[0]=kRB1-kEB1;
361   tpar[1]=kRB1;
362   tpar[2]=kLB1/8.;
363   gMC->Gsvolu("YB13", "TUBE", idtmed[kSteel+40], tpar, 3);
364   Float_t dl3=tpar[2];
365
366
367   tpar[0]=0;
368   tpar[1]=kRB1+kHB1;
369   tpar[2]=kLB1/2.;
370   gMC->Gsvolu("YBU1", "TUBE", idtmed[kVacuum+40], tpar, 3);
371
372   dz=-tpar[2]+dl3;
373   gMC->Gspos("YB13", 1, "YBU1", 0., 0., dz, 0, "ONLY"); 
374   dz+=dl3;
375   dz+=dl1;  
376   gMC->Gspos("YB11", 1, "YBU1", 0., 0., dz, 0, "ONLY"); 
377   dz+=dl1;  
378   dz+=dl2;  
379   gMC->Gspos("YB12", 1, "YBU1", 0., 0., dz, 0, "ONLY"); 
380   dz+=dl2;  
381   dz+=dl1;
382   gMC->Gspos("YB11", 2, "YBU1", 0., 0., dz, 0, "ONLY"); 
383   dz+=dl1;
384   dz+=dl3;
385   gMC->Gspos("YB13", 2, "YBU1", 0., 0., dz, 0, "ONLY"); 
386   
387
388   tpar[0]=0;
389   tpar[1]=kRB1+kHB1+0.5;
390   tpar[2]=12.*kLB1/2.;
391   gMC->Gsvolu("YBM1", "TUBE", idtmed[kVacuum+40], tpar, 3);
392   Float_t bsize = tpar[2];
393   tpar[0]=kRB1+kHB1;
394   gMC->Gsvolu("YBI1", "TUBE", idtmed[kInsulation+40], tpar, 3);
395   gMC->Gspos("YBI1", 2, "YBM1", 0., 0., 0., 0, "ONLY"); 
396
397   dz=-bsize+kLB1/2.;
398
399   for (i=0; i<12; i++) {
400     gMC->Gspos("YBU1", i+1 , "YBM1", 0., 0., dz, 0, "ONLY"); 
401     dz+=kLB1;
402   }
403
404   dz=-dl+(kZvac1-zstart)+kDr11/10.+bsize;
405   gMC->Gspos("YBM1", 1, "YMO1", 0., 0., dz, 0, "ONLY"); 
406
407
408
409 //
410 // Flange
411
412   tpar[0]=0;
413   tpar[1]=kRF1+0.6;
414   tpar[2]=kDF1/2.;
415   gMC->Gsvolu("YFM1", "TUBE", idtmed[kVacuum+40], tpar, 3);
416 // Steel
417   tpar[0]=kRB1;
418   tpar[1]=kRF1+0.6;
419   tpar[2]=kDF1/2.;
420   gMC->Gsvolu("YF11", "TUBE", idtmed[kSteel+40], tpar, 3);
421 // Insulation
422   tpar[0]=kRF1;
423   tpar[1]=kRF1+0.5;
424   tpar[2]=kDF1/2.;
425   gMC->Gsvolu("YF12", "TUBE", idtmed[kInsulation+40], tpar, 3);
426
427
428   gMC->Gspos("YF11", 1, "YFM1", 0., 0., 0., 0, "ONLY"); 
429   gMC->Gspos("YF12", 1, "YFM1", 0., 0., 0., 0, "ONLY"); 
430   dz=-dl+(kZvac3-zstart)-2.*kDr13-tpar[2];
431   gMC->Gspos("YFM1", 2, "YMO1", 0., 0., dz, 0, "ONLY"); 
432
433 //
434 // pipe between flange and bellows
435 //
436 // Steel 
437   tpar[0] = kRB1-dTubeS;
438   tpar[1] = kRB1+0.6;
439   tpar[2] = (kZvac3-kZvac1-2.*kDr13-kDr11/10.-kDF1-2.*bsize)/2.;
440   gMC->Gsvolu("YPF1", "TUBE", idtmed[kSteel+40], tpar, 3);
441 // Insulation
442   tpar[0]=kRB1;
443   tpar[1]=kRB1+0.5;
444   gMC->Gsvolu("YPS1", "TUBE", idtmed[kInsulation+40], tpar, 3);
445   gMC->Gspos("YPS1", 1, "YPF1", 0., 0., 0., 0, "ONLY"); 
446   dz=-dl+(kZvac1-zstart)+kDr11/10.+2.*bsize+tpar[2];
447   gMC->Gspos("YPF1", 1, "YMO1", 0., 0., dz, 0, "ONLY"); 
448
449
450 // Pipe+Heating     1.5 mm 
451 // Heating Jacket   5.0 mm
452 // Protection       1.0 mm
453 // ========================
454 //                  7.5 mm
455 // pipe and heating jackets outside bellows
456 //
457 // left side
458   cpar0[0]=(kZvac1+kDr11/10.-zstart)/2;
459   cpar0[1]=kRVacu-0.05  +(zstart-kZOpen)*TMath::Tan(kThetaOpen1);
460   cpar0[2]=kRVacu+0.7   +(zstart-kZOpen)*TMath::Tan(kThetaOpen1);
461   cpar0[3]=cpar0[1]+2.*cpar0[0]*TMath::Tan(kThetaOpen1);
462   cpar0[4]=cpar0[2]+2.*cpar0[0]*TMath::Tan(kThetaOpen1);
463   gMC->Gsvolu("YV11", "CONE", idtmed[kSteel+40], cpar0, 5);
464 //
465 // insulation
466   dTubeS=0.15;
467   cpar[0]=cpar0[0];
468   cpar[1]=cpar0[1]+0.15;
469   cpar[2]=cpar0[1]+0.65;
470   cpar[3]=cpar0[3]+0.15;
471   cpar[4]=cpar0[3]+0.65;
472   gMC->Gsvolu("YI11", "CONE", idtmed[kInsulation+40], cpar, 5);
473   gMC->Gspos("YI11", 1, "YV11", 0., 0., 0., 0, "ONLY"); 
474   dz=-dl+cpar0[0];
475   gMC->Gspos("YV11", 1, "YMO1", 0., 0., dz, 0, "ONLY"); 
476
477 // right side
478   dTubeS  = 0.35;
479   dVacuS += 0.25;
480   
481   cpar0[0] = (kZvac4-kZvac3+2.*kDr13)/2;
482   cpar0[1] = kRB1;
483   cpar0[2] = cpar0[1]+dVacuS;
484   cpar0[3] = cpar0[1]+2.*cpar0[0]*TMath::Tan(kThetaOpenB);
485   cpar0[4] = cpar0[2]+2.*cpar0[0]*TMath::Tan(kThetaOpenB);
486   gMC->Gsvolu("YV12", "CONE", idtmed[kSteel], cpar0, 5);
487   Float_t r2V=cpar0[3];
488 //
489 // insulation
490   cpar[0] = cpar0[0];
491   cpar[1] = cpar0[1]+dTubeS;
492   cpar[2] = cpar0[1]+dTubeS+kDInsuS;
493   cpar[3] = cpar0[3]+dTubeS;
494   cpar[4] = cpar0[3]+dTubeS+kDInsuS;
495   gMC->Gsvolu("YI12", "CONE", idtmed[kInsulation], cpar, 5);
496   gMC->Gspos("YI12", 1, "YV12", 0., 0., 0., 0, "ONLY"); 
497
498   dz=dl-cpar0[0];
499   gMC->Gspos("YV12", 1, "YMO1", 0., 0., dz, 0, "ONLY"); 
500
501
502 //
503 // Second Section
504 // Between first and second bellow section
505 //
506
507   par2[0]  = 0.;
508   par2[1]  = 360.;
509   par2[2]  = 11.;
510   dl=(kZvac7-kZvac4)/2.;
511 // recess station 2
512   par2[3]  = -dl;
513   par2[4]  = r2;
514   par2[5]  = kR21;
515
516   par2[6]  = -dl+.1;
517   par2[7]  = r2;
518   par2[8]  = kR21;
519
520   par2[9]   = -dl+(kZvac6-kZvac4);
521   par2[10]  = r2+(kZvac6-kZvac4-10.) * TMath::Tan(kThetaOpen2);
522   par2[11]  = kR21;
523
524   par2[12] = -dl+(kZvac6-kZvac4);
525   par2[13] = par2[10];
526   par2[14] = kZvac6*TMath::Tan(kAccMin);
527
528 // Start of Pb section
529   par2[15] = -dl+(kZPb-kZvac4);
530   par2[16] = r2+(kZPb-kZvac4-10.) * TMath::Tan(kThetaOpen2);
531   par2[17] = kZPb*TMath::Tan(kAccMin);
532 //
533 // end of cone following 2 deg line
534   par2[18] = -dl+(kZConeE-kZvac4);
535   par2[19] = r2+(kZConeE-kZvac4-10.) * TMath::Tan(kThetaOpen2);
536   par2[20] = 30.;
537 // recess station 3
538   par2[21] = -dl+(kZch31-kZvac4);
539   par2[22] = r2+(kZch31-kZvac4-10.) * TMath::Tan(kThetaOpen2);
540   par2[23] = 30.;
541
542   par2[24] = -dl+(kZch31-kZvac4);
543   par2[25] = r2+(kZch31-kZvac4-10.) * TMath::Tan(kThetaOpen2);
544   par2[26] = 28.8;
545
546   par2[27] = -dl+(kZch32-kZvac4);
547   par2[28] = r2+(kZch32-kZvac4-10.) * TMath::Tan(kThetaOpen2);
548   par2[29] = 28.8;
549
550   par2[30] = -dl+(kZch32-kZvac4);
551   par2[31] = r2+(kZch32-kZvac4-10.) * TMath::Tan(kThetaOpen2);
552   par2[32] = 30.;
553
554   par2[33] = -dl+(kZvac7-kZvac4);
555   par2[34] = r2+(kZvac7-kZvac4-10.) * TMath::Tan(kThetaOpen2);
556   par2[35] = 30.;
557
558   gMC->Gsvolu("YGO2", "PCON", idtmed[kSteel+40], par2, 36);
559
560 //
561 // Lead cone 
562 //
563   Float_t parPb[18];
564   parPb[ 0]  = 0.;
565   parPb[ 1]  = 360.;
566   parPb[ 2]  = 5.;
567   Float_t dlPb=(kZvac7-kZPb)/2.;
568   
569   parPb[ 3]  = -dlPb;
570   parPb[ 4]  =  r2+(kZPb-kZvac4-10.) * TMath::Tan(kThetaOpen2);
571   parPb[ 5]  =  kZPb*TMath::Tan(kAccMin)-kDRSteel2;
572   
573   parPb[ 6]  = -dlPb+(kZConeE-kZPb);
574   parPb[ 7]  =  r2+(kZConeE-kZvac4-10.) * TMath::Tan(kThetaOpen2);
575   parPb[ 8]  = 26.;
576
577   parPb[ 9]  = -dlPb+(kZch32+4.-kZPb);
578   parPb[10]  =  r2+(kZch32+4.-kZvac4-10.) * TMath::Tan(kThetaOpen2);
579   parPb[11]  = 26.;
580
581   parPb[12]  = -dlPb+(kZch32+4.-kZPb);
582   parPb[13]  =  r2+(kZch32+4.-kZvac4-10.) * TMath::Tan(kThetaOpen2);
583   parPb[14]  = 30.;
584   
585   parPb[15]  = dlPb;
586   parPb[16]  =  r2+(kZvac7-kZvac4-10.) * TMath::Tan(kThetaOpen2);
587   parPb[17]  = 30.;
588
589   gMC->Gsvolu("YXO2", "PCON", idtmed[kPb+40], parPb, 18);         
590   gMC->Gspos("YXO2", 1, "YGO2", 0., 0., (kZPb-kZvac4)/2., 0, "ONLY");  
591 //
592 // Concrete replacing Pb
593 //
594   Float_t parCC[9];
595   Float_t zCC1 = 1066.;
596   Float_t zCC2 = 1188.;
597   
598   parCC[ 0]  = 0.;
599   parCC[ 1]  = 360.;
600   parCC[ 2]  = 2.;
601   Float_t dlCC=(zCC2-zCC1)/2.;
602   parCC[ 3]  = -dlCC;
603   parCC[ 4]  =  r2+(zCC1-kZvac4-10.) * TMath::Tan(kThetaOpen2);
604   parCC[ 5]  =  30.;
605   
606   parCC[ 6]  =  dlCC;
607   parCC[ 7]  =  r2+(zCC2-kZvac4-10.) * TMath::Tan(kThetaOpen2);
608   parCC[ 8]  = 30.;
609   gMC->Gsvolu("YCO2", "PCON", idtmed[kSteel], parCC, 9);          
610 //  gMC->Gspos("YCO2", 1, "YXO2", 0., 0., dlPb-dlCC-(kZvac7-zCC2), 0, "ONLY");  
611
612   zCC1 = 751.75;
613   zCC2 = kZConeE;
614   dlCC=(zCC2-zCC1)/2.;
615   parCC[ 3]  = -dlCC;
616   parCC[ 4]  =  r2+(zCC1-kZvac4-10.) * TMath::Tan(kThetaOpen2);
617   parCC[ 5]  =  zCC1*TMath::Tan(kAccMin)-kDRSteel2;
618   
619   parCC[ 6]  =  dlCC;
620   parCC[ 7]  =  r2+(zCC2-kZvac4-10.) * TMath::Tan(kThetaOpen2);
621   parCC[ 8]  = 26.;
622   
623   gMC->Gsvolu("YCO1", "PCON", idtmed[kSteel], parCC, 9);          
624 //  gMC->Gspos("YCO1", 1, "YXO2", 0., 0., dlPb-dlCC-(kZvac7-zCC2), 0, "ONLY");  
625   
626 //
627 // W cone 
628 //
629   Float_t parW[15];
630   parW[0]  = 0.;
631   parW[1]  = 360.;
632   parW[2]  = 4.;
633   Float_t dlW=(kZPb-kZvac4)/2.;
634   
635   parW[3]   = -dlW;
636   parW[4]   =  r2;
637   parW[5]   =  kR21-kDRSteel2;
638   
639   parW[6]   = -dlW+(kZvac6-kZvac4)+kDRSteel2;
640   parW[7]   =  r2+(kZvac6-kZvac4+kDRSteel2) * TMath::Tan(kThetaOpen2);
641   parW[8]   =  kR21-kDRSteel2;
642  
643   parW[9]   = -dlW+(kZvac6-kZvac4)+kDRSteel2;
644   parW[10]  =  r2+(kZvac6-kZvac4+kDRSteel2) * TMath::Tan(kThetaOpen2);
645   parW[11]  =  (kZvac6+kDRSteel2)*TMath::Tan(kAccMin)-kDRSteel2;
646  
647   parW[12]   = dlW;
648   parW[13]  =  r2+(kZPb-kZvac4) * TMath::Tan(kThetaOpen2);
649   parW[14]  = kZPb*TMath::Tan(kAccMin)-kDRSteel2;
650
651   gMC->Gsvolu("YYO2", "PCON", idtmed[kNiCuW+40], parW, 15);       
652   gMC->Gspos("YYO2", 1, "YGO2", 0., 0., -(kZvac7-kZPb)/2., 0, "ONLY");  
653
654   for (i=4; i<35; i+=3) par2[i]  = 0;
655           
656   gMC->Gsvolu("YMO2", "PCON", idtmed[kVacuum+40], par2, 36);
657   gMC->Gspos("YGO2", 1, "YMO2", 0., 0., 0., 0, "ONLY");  
658   dZ+=dl;
659   gMC->Gspos("YMO2", 1, "YMOT", 0., 0., dZ, 0, "ONLY");  
660   dZ+=dl;
661 //
662 //
663 // 2nd section: vacuum system 
664 //
665   cpar0[0]=(kZvac7-kZvac4)/2;
666   cpar0[1]=r2V;
667   cpar0[2]=r2V+dVacuS;
668   cpar0[3]=cpar0[1]+2.*cpar0[0]*TMath::Tan(kThetaOpenB);
669   cpar0[4]=cpar0[2]+2.*cpar0[0]*TMath::Tan(kThetaOpenB);
670   gMC->Gsvolu("YV21", "CONE", idtmed[kSteel+40], cpar0, 5);
671 //
672 // insulation
673   cpar[0]=cpar0[0];
674   cpar[1]=cpar0[1]+dTubeS;
675   cpar[2]=cpar0[1]+dTubeS+kDInsuS;
676   cpar[3]=cpar0[3]+dTubeS;
677   cpar[4]=cpar0[3]+dTubeS+kDInsuS;
678   gMC->Gsvolu("YI21", "CONE", idtmed[kInsulation+40], cpar, 5);
679   gMC->Gspos("YI21", 1, "YV21", 0., 0., 0., 0, "ONLY"); 
680   gMC->Gspos("YV21", 1, "YMO2", 0., 0., 0., 0, "ONLY"); 
681
682 //
683 // Third Section: Bellows and Flange 
684 //
685   par3[0]  = 0.;
686   par3[1]  = 360.;
687   par3[2]  = 8.;
688   dl=(kZvac9-kZvac7)/2.;
689   
690   par3[3]  = -dl;
691   par3[4]  = r2+(kZvac7-kZvac3) * TMath::Tan(kThetaOpen2);
692   par3[5]  = 30.;
693
694   par3[6]  = -dl+kDr21;
695   par3[7]  = par3[4]+kDr21;
696   par3[8]  = 30.;
697
698   par3[9]  = par3[6]+kDB2;
699   par3[10] = par3[7];
700   par3[11] = 30.;
701
702   par3[12] = par3[9]+kDr22;
703   par3[13] = par3[10]+kDr22;
704   par3[14] = 30.;
705
706   par3[15] = par3[12]+kDF2;
707   par3[16] = par3[13];
708   par3[17] = 30.;
709
710   par3[18] = par3[15]+kDr22;
711   par3[19] = par3[16]-kDr22;
712   par3[20] = 30.;
713
714   par3[21] = par3[18]+kDB2;
715   par3[22] = par3[19];
716   par3[23] = 30.;
717
718   par3[24] = par3[21]+kDr23;
719   par3[25] = par3[22];
720   par3[26] = 30.;
721 //
722   rBox=par3[22]-0.1;
723   Float_t r3=par3[25];
724   
725   gMC->Gsvolu("YGO3", "PCON", idtmed[iHeavy+40], par3, 27);
726
727   for (i=4; i<26; i+=3) par3[i]  = 0;
728
729   gMC->Gsvolu("YMO3", "PCON", idtmed[kVacuum+40], par3, 27);
730   gMC->Gspos("YGO3", 1, "YMO3", 0., 0., 0., 0, "ONLY");  
731
732 //
733 // Steel envelope
734 //  tpar[0]=26;
735 //  tpar[1]=30;
736 //  tpar[2]=dl;
737 //  gMC->Gsvolu("YS31", "TUBE", idtmed[kSteel], tpar, 3);
738 //  gMC->Gspos("YS31", 1, "YGO3", 0., 0., 0., 0, "ONLY");  
739   dZ+=dl;
740   gMC->Gspos("YMO3", 1, "YMOT", 0., 0., dZ, 0, "ONLY");  
741   dZ+=dl;
742
743 //
744 // 3rd section: vacuum system
745 //
746 //
747 // Bellow2
748 //
749   tpar[0]=kRB2;
750   tpar[1]=kRB2+kHB2;
751   tpar[2]=kEB2/2.;
752   gMC->Gsvolu("YB21", "TUBE", idtmed[kSteel+40], tpar, 3);
753   dl1=tpar[2];
754   
755   tpar[0]=kRB2+kHB2-kEB2;
756   tpar[1]=kRB2+kHB2;
757   tpar[2]=(kLB2/2.-2.*kEB2)/2.;
758   gMC->Gsvolu("YB22", "TUBE", idtmed[kSteel+40], tpar, 3);
759   dl2=tpar[2];
760
761   tpar[0]=kRB2-kEB2;
762   tpar[1]=kRB2;
763   tpar[2]=kLB2/8.;
764   gMC->Gsvolu("YB23", "TUBE", idtmed[kSteel+40], tpar, 3);
765   dl3=tpar[2];
766
767
768   tpar[0]=0;
769   tpar[1]=kRB2+kHB2;
770   tpar[2]=kLB2/2.;
771   gMC->Gsvolu("YBU2", "TUBE", idtmed[kVacuum+40], tpar, 3);
772
773   dz=-tpar[2]+dl3;
774   gMC->Gspos("YB23", 1, "YBU2", 0., 0., dz, 0, "ONLY"); 
775   dz+=dl3;
776   dz+=dl1;  
777   gMC->Gspos("YB21", 1, "YBU2", 0., 0., dz, 0, "ONLY"); 
778   dz+=dl1;  
779   dz+=dl2;  
780   gMC->Gspos("YB22", 1, "YBU2", 0., 0., dz, 0, "ONLY"); 
781   dz+=dl2;  
782   dz+=dl1;
783   gMC->Gspos("YB21", 2, "YBU2", 0., 0., dz, 0, "ONLY"); 
784   dz+=dl1;
785   dz+=dl3;
786   gMC->Gspos("YB23", 2, "YBU2", 0., 0., dz, 0, "ONLY"); 
787   
788
789   tpar[0]=0;
790   tpar[1]=kRB2+kHB2;
791   tpar[2]=7.*kLB2/2.;
792   gMC->Gsvolu("YBM2", "TUBE", idtmed[kVacuum+40], tpar, 3);
793   dz=-tpar[2]+kLB2/2.;
794
795   for (i=0; i<7; i++) {
796     gMC->Gspos("YBU2", i+1 , "YBM2", 0., 0.,dz , 0, "ONLY"); 
797     dz+=kLB2;
798   }
799
800   dz=-dl+kDr21+tpar[2];
801   gMC->Gspos("YBM2", 1, "YMO3", 0., 0., dz, 0, "ONLY"); 
802
803   dz=dl-kDr23-tpar[2];
804   gMC->Gspos("YBM2", 2, "YMO3", 0., 0., dz, 0, "ONLY"); 
805
806 //
807 // Flange
808
809   tpar[0]=0;
810   tpar[1]=kRF2;
811   tpar[2]=kDF2/2.;
812   gMC->Gsvolu("YFM2", "TUBE", idtmed[kVacuum+40], tpar, 3);
813
814   tpar[0]=kRF2-2.;
815   tpar[1]=kRF2;
816   tpar[2]=kDF2/2.;
817   gMC->Gsvolu("YF21", "TUBE", idtmed[kSteel+40], tpar, 3);
818   gMC->Gspos("YF21", 1, "YFM2", 0., 0., 0., 0, "ONLY"); 
819
820   tpar[0]=kRB2;
821   tpar[1]=kRF2-2.;
822   tpar[2]=kDFlange/2.;
823   gMC->Gsvolu("YF22", "TUBE", idtmed[kSteel+40], tpar, 3);
824   dz=-kDF2/2.+tpar[2];
825   gMC->Gspos("YF22", 1, "YFM2", 0., 0., dz, 0, "ONLY"); 
826   dz= kDF2/2.-tpar[2];
827   gMC->Gspos("YF22", 2, "YFM2", 0., 0., dz, 0, "ONLY"); 
828
829   dz=kDr21/2.-kDr23/2.;
830   gMC->Gspos("YFM2", 2, "YMO3", 0., 0., dz, 0, "ONLY"); 
831
832
833 //
834 // pipe between flange and bellows
835   tpar[0]=kRB2-dTubeS;
836   tpar[1]=kRB2;
837   tpar[2]=2.*(kDB2+kDr22-7.*kLB2)/4.;
838   gMC->Gsvolu("YPF2", "TUBE", idtmed[kSteel+40], tpar, 3);
839   dz=kDr21/2.-kDr23/2.-kDF2/2.-tpar[2];
840   gMC->Gspos("YPF2", 1, "YMO3", 0., 0., dz, 0, "ONLY"); 
841   dz=kDr21/2.-kDr23/2.+kDF2/2.+tpar[2];
842   gMC->Gspos("YPF2", 2, "YMO3", 0., 0., dz, 0, "ONLY"); 
843
844   Float_t dHorZ=20.;
845   
846 //
847 // 4th section: rear shield and closing cone
848 //
849   par4[0]  = 0.;
850   par4[1]  = 360.;
851   par4[2]  = 7.;
852   dl=(kZvac12-kZvac9)/2.;
853   
854   par4[3]  = -dl;
855   par4[4]  = r3;
856   par4[5]  = 30.;
857
858   par4[6]  = -dl+dHorZ;
859   par4[7]  = r3;
860   par4[8]  = 30.;
861
862   par4[9]  = -dl+(kZvac10-kZvac9);
863   par4[10]  = r3+(kZvac10-kZvac9-dHorZ) * TMath::Tan(kThetaOpen3);
864   par4[11]  = 30.;
865
866   par4[12]  = par4[9];
867   par4[13] = par4[10];
868   par4[14] = kR42;
869
870   par4[15] = -dl+(kZvac11-kZvac9);
871   par4[16] = r3+(kZvac11-kZvac9-dHorZ) * TMath::Tan(kThetaOpen3);
872   par4[17] = kR42;
873
874   par4[18] = par4[15];
875   par4[19] = par4[16];
876   par4[20] = kR43;
877
878   par4[21] = -dl+(kZvac12-kZvac9);
879   par4[22] = kRVacu+dVacuS;
880   par4[23] = kR43;
881
882   gMC->Gsvolu("YGO4", "PCON", idtmed[iHeavy+40], par4, 24);
883
884
885   for (i=4; i<23; i+=3) par4[i]  = 0;
886
887   gMC->Gsvolu("YMO4", "PCON", idtmed[kVacuum+40], par4, 24);
888   gMC->Gspos("YGO4", 1, "YMO4", 0., 0., 0., 0, "ONLY");  
889
890
891
892   dZ+=dl;
893   gMC->Gspos("YMO4", 1, "YMOT", 0., 0., dZ, 0, "ONLY");  
894   dZ+=dl;
895 //
896 // Concrete replacing Pb
897 //
898   zCC1 = 1316.;
899   zCC2 = 1349.;
900   
901   parCC[ 0]  = 0.;
902   parCC[ 1]  = 360.;
903   parCC[ 2]  = 2.;
904   dlCC=(zCC2-zCC1)/2.;
905   parCC[ 3]  = -dlCC;
906   parCC[ 4]  = r3+(zCC1-kZvac9-dHorZ) * TMath::Tan(kThetaOpen3);
907   parCC[ 5]  =  30.;
908   
909   parCC[ 6]  =  dlCC;
910   parCC[ 7]  =  r3+(zCC2-kZvac9-dHorZ) * TMath::Tan(kThetaOpen3);
911   parCC[ 8]  = 30.;
912
913   gMC->Gsvolu("YCO4", "PCON", idtmed[kSteel], parCC, 9);          
914 //  gMC->Gspos("YCO4", 1, "YGO4", 0., 0., dl-dlCC-(kZvac12-zCC2), 0, "ONLY");  
915
916   zCC1 = 1471.;
917   zCC2 = 1591.;
918
919   dlCC=(zCC2-zCC1)/2.;
920   parCC[ 3]  = -dlCC;
921   parCC[ 4]  = r3+(zCC1-kZvac9-dHorZ) * TMath::Tan(kThetaOpen3);
922   parCC[ 5]  = kR41-kDRSteel2;
923   
924   parCC[ 6]  =  dlCC;
925   parCC[ 7]  =  r3+(zCC2-kZvac9-dHorZ) * TMath::Tan(kThetaOpen3);
926   parCC[ 8]  =  kR41-kDRSteel2;
927
928   gMC->Gsvolu("YCO5", "PCON", idtmed[kSteel], parCC, 9);          
929 //  gMC->Gspos("YCO5", 1, "YGO4", 0., 0., dl-dlCC-(kZvac12-zCC2), 0, "ONLY");  
930
931 //
932 // Closing concrete cone 
933 //
934   cpar[0]=(kZvac12-kZvac11)/2.;
935   cpar[1] = r3+(kZvac11-kZvac9-dHorZ) * TMath::Tan(kThetaOpen3);
936   cpar[2] = cpar[1]+0.001;
937   cpar[3] = kRVacu+dVacuS;
938   cpar[4] = cpar[2];
939   gMC->Gsvolu("YCC4", "CONE", idtmed[kConcrete+40], cpar, 5);
940   dz=dl-cpar[0];
941   gMC->Gspos("YCC4", 1, "YGO4", 0., 0., dz, 0, "ONLY");  
942
943 //
944 // Steel envelope
945 //
946   dz=-dl;
947   tpar[0]=26.;
948   tpar[1]=30.;
949   tpar[2]=(kZvac10-kZvac9)/2.;
950   gMC->Gsvolu("YS41", "TUBE", idtmed[kSteel], tpar, 3);
951   dz+=tpar[2];
952 //  gMC->Gspos("YS41", 1, "YGO4", 0., 0., dz, 0, "ONLY");  
953   dz+=tpar[2];
954
955   tpar[0]=kR41-kDRSteel2;
956   tpar[1]=kR41;
957   tpar[2]=(kZvac11-kZvac10)/2.;
958   gMC->Gsvolu("YS43", "TUBE", idtmed[kPb+40], tpar, 3);
959   dz+=tpar[2];
960   gMC->Gspos("YS43", 1, "YGO4", 0., 0., dz, 0, "ONLY");  
961 //
962 // rear lead shield
963 //
964   tpar[0]=kR41;
965   tpar[1]=kR42;
966   tpar[2]=(kZvac11-kZvac10)/2.;
967   gMC->Gsvolu("YPBI", "TUBE", idtmed[kPb+40], tpar, 3);
968   dz-=0;
969   gMC->Gspos("YPBI", 1, "YGO4", 0., 0., dz, 0, "ONLY"); 
970
971   tpar[2]=(zCC2-zCC1)/2.;
972   gMC->Gsvolu("YCO6", "TUBE", idtmed[kSteel+40], tpar, 3);
973 //  gMC->Gspos("YCO6", 1, "YPBI", 0., 0., -(kZvac11-kZvac10)/2.+tpar[2], 0, "ONLY"); 
974
975
976   tpar[0]=kR42-5;
977   tpar[1]=kR42;
978   tpar[2]=(kZvac11-kZvac10)/2.;
979   gMC->Gsvolu("YPBO", "TUBE", idtmed[kPb+40], tpar, 3);
980   gMC->Gspos("YPBO", 1, "YPBI", 0., 0., 0., 0, "ONLY"); 
981
982   tpar[2]=(zCC2-zCC1)/2.;
983   gMC->Gsvolu("YCO7", "TUBE", idtmed[kSteel], tpar, 3);
984 //  gMC->Gspos("YCO7", 1, "YPBO", 0., 0., -(kZvac11-kZvac10)/2.+tpar[2], 0, "ONLY"); 
985   
986 //
987 // rear Fe shield
988 //
989
990   tpar[0]=31.;
991   tpar[1]=kR43;
992   tpar[2]=(kZvac12-kZvac11)/2.;
993   gMC->Gsvolu("YFEI", "TUBE", idtmed[kFe+40], tpar, 3);
994   dz=dl-tpar[2];
995   gMC->Gspos("YFEI", 1, "YGO4", 0., 0., dz, 0, "ONLY"); 
996
997   tpar[0]=31.;
998   tpar[1]=kR43;
999   tpar[2]=2.5;
1000   gMC->Gsvolu("YFEO", "TUBE", idtmed[kFe], tpar, 3);
1001   dz=-(kZvac12-kZvac11)/2.+tpar[2];
1002   gMC->Gspos("YFEO", 1, "YFEI", 0., 0., dz, 0, "ONLY"); 
1003
1004
1005 // 
1006 //
1007 // 4th section: vacuum system 
1008 //
1009 // up to closing cone
1010   
1011   Float_t r3V=r3-kDr23+dVacuS-1.6;
1012
1013   cpar0[0]=(kZvac11-kZvac9)/2;
1014   cpar0[1]=r3V-dVacuS;
1015   cpar0[2]=r3V;
1016   cpar0[3]=cpar0[1]+2.*cpar0[0]*TMath::Tan(kThetaOpen3);
1017   cpar0[4]=cpar0[2]+2.*cpar0[0]*TMath::Tan(kThetaOpen3);
1018   gMC->Gsvolu("YV31", "CONE", idtmed[kSteel+40], cpar0, 5);
1019 //
1020 // insulation
1021   cpar[0]=cpar0[0];
1022   cpar[1]=cpar0[1]+dTubeS;
1023   cpar[2]=cpar0[1]+dTubeS+kDInsuS;
1024   cpar[3]=cpar0[3]+dTubeS;
1025   cpar[4]=cpar0[3]+dTubeS+kDInsuS;
1026   gMC->Gsvolu("YI31", "CONE", idtmed[kInsulation+40], cpar, 5);
1027   gMC->Gspos("YI31", 1, "YV31", 0., 0., 0., 0, "ONLY"); 
1028   dz=-dl+cpar[0];
1029   gMC->Gspos("YV31", 1, "YMO4", 0., 0., dz, 0, "ONLY"); 
1030
1031 //
1032 // closing cone
1033   cpar0[0]=(kZvac12-kZvac11)/2;
1034   cpar0[1]=r3V-dVacuS+(kZvac11-kZvac9)*TMath::Tan(kThetaOpen3);
1035   cpar0[2]=r3V       +(kZvac11-kZvac9)*TMath::Tan(kThetaOpen3);
1036   cpar0[3]=kRVacu;
1037   cpar0[4]=kRVacu+dTubeS+kDInsuS+kDProtS+kDFreeS;
1038   gMC->Gsvolu("YV32", "CONE", idtmed[kSteel+40], cpar0, 5);
1039 //
1040 // insulation
1041   cpar[0]=cpar0[0];
1042   cpar[1]=cpar0[1]+dTubeS;
1043   cpar[2]=cpar0[1]+dTubeS+kDInsuS;
1044   cpar[3]=cpar0[3]+dTubeS;
1045   cpar[4]=cpar0[3]+dTubeS+kDInsuS;
1046   gMC->Gsvolu("YI32", "CONE", idtmed[kInsulation+40], cpar, 5);
1047   gMC->Gspos("YI32", 1, "YV32", 0., 0., 0., 0, "ONLY"); 
1048   
1049   dz=dl-cpar[0];
1050   gMC->Gspos("YV32", 1, "YMO4", 0., 0., dz, 0, "ONLY"); 
1051 //
1052 //
1053 // MUON trigger wall
1054 //  
1055   tpar[0] = 50.;
1056   tpar[1] = 310.;
1057   tpar[2] = (kZFilterOut - kZFilterIn) / 2.;
1058   gMC->Gsvolu("YFIM", "TUBE", idtmed[kFe+40], tpar, 3);
1059   dz = (kZFilterIn + kZFilterOut) / 2.;
1060   tpar[2] -= 10.;
1061   gMC->Gsvolu("YFII","TUBE", idtmed[kFe], tpar, 3);
1062   gMC->Gspos("YFII", 1, "YFIM", 0., 0., 0., 0, "ONLY");
1063   gMC->Gspos("YFIM", 1, "ALIC", 0., 0., - dz, 0, "ONLY");
1064 //
1065 // Outer Pb Cone
1066 //  
1067   if (fPbCone) {
1068       dl = (kZvac10-kZch32)/2.;
1069       dz = dl+kZch32;
1070       
1071       par0[0]  = 0.;
1072       par0[1]  = 360.;
1073       par0[2]  = 10.;
1074
1075       par0[ 3]  = -dl;
1076       par0[ 4]  = 30.;
1077       par0[ 5]  = 30.+(kZch32-kZConeE)*TMath::Tan(kThetaOpenPbO);
1078
1079 //    4th station
1080       par0[ 6]  = -dz + kZch41;
1081       par0[ 7]  = 30.;
1082       par0[ 8]  = 30.+(kZch41-kZConeE)*TMath::Tan(kThetaOpenPbO);
1083
1084       par0[ 9]  = -dz + kZch41;
1085       par0[10]  = 30.;
1086       par0[11]  = 36.9;  
1087                                           // recess erice2000
1088       par0[12]  = -dz + kZch42;
1089       par0[13]  = 30.;
1090       par0[14]  = par0[11];
1091
1092       par0[15]  = -dz + kZch42;
1093       par0[16]  = 30.;
1094       par0[17]  = 30.+(kZch42-kZConeE)*TMath::Tan(kThetaOpenPbO);
1095
1096 //    5th station
1097       par0[18]  = -dz + kZch51;
1098       par0[19]  = 30.;
1099       par0[20]  = 30.+(kZch51-kZConeE)*TMath::Tan(kThetaOpenPbO);
1100
1101       par0[21]  = -dz + kZch51;
1102       par0[22]  = 30.;
1103       par0[23]  = 36.9;  // recess erice2000
1104
1105       par0[24]  = -dz + kZch52;
1106       par0[25]  = 30.;
1107       par0[26]  = par0[23];
1108
1109       par0[27]  = -dz + kZch52;
1110       par0[28]  = 30.;
1111       par0[29]  = 30.+(kZch52+4.-kZConeE)*TMath::Tan(kThetaOpenPbO);
1112 // end of cone
1113       par0[30]  = +dl;
1114       par0[31]  = 30.;
1115       par0[32]  = par0[29];
1116 //
1117       gMC->Gsvolu("YOPB", "PCON", idtmed[kPb+40], par0, 33);
1118       Float_t dzs = -kzLength + (kZch32-zstart) + dl;
1119       gMC->Gspos("YOPB", 1, "YMOT", 0., 0., dzs, 0, "ONLY");
1120
1121 //
1122 // Steel envelope
1123 //
1124       par0[ 0]  = 0.;
1125       par0[ 1]  = 360.;
1126       par0[ 2]  = 11.;
1127   
1128       par0[ 3]  = -dl;
1129       par0[ 5]  = 30.+(kZch32-kZConeE)*TMath::Tan(kThetaOpenPbO);
1130       par0[ 4]  = par0[ 5] - 4.;
1131
1132 //    4th station
1133
1134       par0[ 6]  = -dz + kZch41 - 4.;
1135       par0[ 8]  = 30.+(kZch41-4.-kZConeE)*TMath::Tan(kThetaOpenPbO);
1136       par0[ 7]  = par0[ 8] -4.;
1137
1138       par0[ 9]  = -dz + kZch41 - 4.;
1139       par0[11]  = par0[8];  
1140       par0[10]  = 33.5;
1141
1142       par0[12]  = -dz + kZch41;
1143       par0[14]  = 30.+(kZch41-kZConeE)*TMath::Tan(kThetaOpenPbO);  
1144       par0[13]  = 33.5;
1145
1146       par0[15]  = -dz + kZch41;
1147       par0[17]  = 36.9;  
1148       par0[16]  = 32.9;
1149
1150 //    5th station
1151
1152       par0[18]  = -dz + kZch51;
1153       par0[20]  = 36.9;
1154       par0[19]  = 32.9;
1155
1156       par0[21]  = -dz + kZch52;
1157       par0[23]  = 36.9;
1158       par0[22]  = 32.9;
1159
1160       par0[24]  = -dz + kZch52;
1161       par0[26]  = 30.+(kZch52-kZConeE)*TMath::Tan(kThetaOpenPbO);
1162       par0[25]  = 33.5;
1163
1164       par0[27]  = -dz + kZch52 + 4.;
1165       par0[29]  = 30.+(kZch52+4.-kZConeE)*TMath::Tan(kThetaOpenPbO);
1166       par0[28]  = 33.5;
1167
1168       par0[30]  = -dz + kZch52 + 4.;
1169       par0[32]  = 30.+(kZch52+4.-kZConeE)*TMath::Tan(kThetaOpenPbO);
1170       par0[31]  = par0[32] - 4.;
1171
1172       par0[33]  = +dl;
1173       par0[35]  = par0[32];
1174       par0[34]  = par0[31];
1175
1176       gMC->Gsvolu("YOSE",    "PCON", idtmed[kSteel], par0, 36);
1177       gMC->Gspos ("YOSE", 1, "YOPB", 0., 0., 0., 0, "ONLY");
1178 //
1179 //    Extra Tungsten shield close to stations 1 and 2
1180 //
1181       TGeoRotation* rot000 = new TGeoRotation("rot000",  90.,   0., 90.,  90., 0., 0.);
1182       TGeoRotation* rot090 = new TGeoRotation("rot090",  90.,  90., 90., 180., 0., 0.);
1183       TGeoRotation* rot180 = new TGeoRotation("rot180",  90., 180., 90., 270., 0., 0.);
1184       TGeoRotation* rot270 = new TGeoRotation("rot270",  90., 270., 90.,   0., 0., 0.);
1185       TGeoVolume* mother = gGeoManager->GetVolume("YMOT");
1186       TGeoVolumeAssembly* assembly = new TGeoVolumeAssembly("YASS");
1187       assembly->AddNode(mother, 1, new TGeoTranslation(0., 0., 0.));
1188       TGeoVolumeAssembly* extraShield1 = new TGeoVolumeAssembly("YCRE");
1189       TGeoVolumeAssembly* extraShield2 = new TGeoVolumeAssembly("YCRF");
1190
1191 ///////////////////////////////////
1192 //                               //
1193 // Recess Station 1              //
1194 //                               //
1195 ///////////////////////////////////
1196
1197
1198 ///////////////////////////////////
1199 //    FA W-Ring 2                //
1200 //    Drawing ALIP2A__0220       //
1201 ///////////////////////////////////
1202       Float_t faWring2Rinner  = 15.40;
1203       Float_t faWring2Router  = 18.40;
1204       Float_t faWring2HWidth  =  3.75;
1205       Float_t faWring2Cutoffx =  3.35;
1206       Float_t faWring2Cutoffy =  3.35;
1207       TGeoTubeSeg* shFaWring2a  = new TGeoTubeSeg(faWring2Rinner, faWring2Router, faWring2HWidth, 0., 90.);
1208       shFaWring2a->SetName("shFaWring2a");
1209       TGeoBBox* shFaWring2b  = new TGeoBBox(faWring2Router / 2., faWring2Router / 2., faWring2HWidth);
1210       shFaWring2b->SetName("shFaWring2b");
1211       TGeoTranslation* trFaWring2b 
1212           = new TGeoTranslation("trFaWring2b", faWring2Router / 2. + faWring2Cutoffx, faWring2Router / 2. + faWring2Cutoffy, 0.);
1213       trFaWring2b->RegisterYourself();
1214       TGeoCompositeShape*  shFaWring2 = new TGeoCompositeShape("shFaWring2", "(shFaWring2a)*(shFaWring2b:trFaWring2b)");
1215       TGeoVolume* voFaWring2    = new TGeoVolume("FA_WRING2", shFaWring2, gGeoManager->GetMedium("SHIL_Ni/W3"));
1216
1217 ///////////////////////////////////
1218 //    FA W-Ring 3                //
1219 //    Drawing ALIP2A__0219       //
1220 ///////////////////////////////////
1221       Float_t faWring3Rinner  = 15.40;
1222       Float_t faWring3Router  = 18.40;
1223       Float_t faWring3HWidth  =  3.75;
1224       Float_t faWring3Cutoffx =  3.35;
1225       Float_t faWring3Cutoffy =  3.35;
1226       TGeoTubeSeg* shFaWring3a  = new TGeoTubeSeg(faWring3Rinner, faWring3Router, faWring3HWidth, 0., 90.);
1227       shFaWring3a->SetName("shFaWring3a");
1228       TGeoBBox* shFaWring3b  = new TGeoBBox(faWring3Router / 2., faWring3Router / 2., faWring3HWidth);
1229       shFaWring3b->SetName("shFaWring3b");
1230       TGeoTranslation* trFaWring3b 
1231           = new TGeoTranslation("trFaWring3b", faWring3Router / 2. + faWring3Cutoffx, faWring3Router / 2. + faWring3Cutoffy, 0.);
1232       trFaWring3b->RegisterYourself();
1233       TGeoCompositeShape*  shFaWring3 = new TGeoCompositeShape("shFaWring3", "(shFaWring3a)*(shFaWring3b:trFaWring3b)");
1234       TGeoVolume* voFaWring3    = new TGeoVolume("FA_WRING3", shFaWring3, gGeoManager->GetMedium("SHIL_Ni/W3"));
1235
1236 ///////////////////////////////////
1237 //    FA W-Ring 5                //
1238 //    Drawing ALIP2A__0221       //
1239 ///////////////////////////////////
1240       Float_t faWring5Rinner = 15.40;
1241       Float_t faWring5Router = 18.67;
1242       Float_t faWring5HWidth =  1.08;
1243       TGeoVolume* voFaWring5    = new TGeoVolume("FA_WRING5", 
1244                                                    new TGeoTube(faWring5Rinner, faWring5Router, faWring5HWidth), 
1245                                                    gGeoManager->GetMedium("SHIL_Ni/W3"));
1246
1247 //
1248 // Position the rings in the assembly 
1249 //      
1250 // Distance between rings
1251       Float_t faDWrings = 1.92;
1252 //
1253       dz = - (4. * faWring2HWidth + 4. * faWring3HWidth + 2. * faWring5HWidth + 2. *  faDWrings) / 2.;
1254       dz +=  faWring2HWidth;
1255       extraShield1->AddNode(voFaWring2,    1, new TGeoCombiTrans(0., 0., dz, rot090));
1256       extraShield1->AddNode(voFaWring2,    2, new TGeoCombiTrans(0., 0., dz, rot270));
1257       dz +=   faWring2HWidth;      dz +=   faDWrings;
1258       dz +=   faWring3HWidth;
1259       extraShield1->AddNode(voFaWring3,    1, new TGeoCombiTrans(0., 0., dz, rot000));
1260       extraShield1->AddNode(voFaWring3,    2, new TGeoCombiTrans(0., 0., dz, rot180));
1261       dz +=   faWring3HWidth;   
1262       dz +=   faWring5HWidth;   
1263       extraShield1->AddNode(voFaWring5,    1, new TGeoTranslation(0., 0., dz));
1264       dz +=   faWring5HWidth;   
1265       dz +=   faWring3HWidth;   
1266       extraShield1->AddNode(voFaWring3,    3, new TGeoCombiTrans(0., 0., dz, rot090));
1267       extraShield1->AddNode(voFaWring3,    4, new TGeoCombiTrans(0., 0., dz, rot270));
1268       dz +=   faWring3HWidth;   
1269       dz +=   faDWrings;
1270       dz +=   faWring2HWidth;
1271       extraShield1->AddNode(voFaWring2,    3, new TGeoCombiTrans(0., 0., dz, rot000));
1272       extraShield1->AddNode(voFaWring2,    4, new TGeoCombiTrans(0., 0., dz, rot180));
1273       dz +=   faWring2HWidth;
1274
1275       assembly->AddNode(extraShield1, 1, new TGeoTranslation(0., 0., -kzLength + 49.7 + dz));
1276
1277 ///////////////////////////////////
1278 //                               //
1279 // Recess Station 2              //
1280 //                               //
1281 ///////////////////////////////////
1282
1283 ///////////////////////////////////
1284 //    SAA1 W-Ring 1              //
1285 //    Drawing ALIP2A__0217       //
1286 ///////////////////////////////////
1287       Float_t saa1Wring1Width  =  5.85;
1288       TGeoPcon* shSaa1Wring1  = new TGeoPcon(0., 360., 2);
1289       shSaa1Wring1->DefineSection(0, 0.00           , 20.30, 23.175);
1290       shSaa1Wring1->DefineSection(1, saa1Wring1Width, 20.30, 23.400);
1291       TGeoVolume* voSaa1Wring1  =  new TGeoVolume("SAA1_WRING1", shSaa1Wring1, gGeoManager->GetMedium("SHIL_Ni/W3"));
1292
1293 ///////////////////////////////////
1294 //    SAA1 W-Ring 2              //
1295 //    Drawing ALIP2A__0055       //
1296 ///////////////////////////////////
1297       Float_t saa1Wring2Rinner  = 20.30;
1298       Float_t saa1Wring2Router  = 23.40;
1299       Float_t saa1Wring2HWidth  =  3.75;
1300       Float_t saa1Wring2Cutoffx =  4.45;
1301       Float_t saa1Wring2Cutoffy =  4.45;
1302       TGeoTubeSeg* shSaa1Wring2a  = new TGeoTubeSeg(saa1Wring2Rinner, saa1Wring2Router, saa1Wring2HWidth, 0., 90.);
1303       shSaa1Wring2a->SetName("shSaa1Wring2a");
1304       TGeoBBox* shSaa1Wring2b  = new TGeoBBox(saa1Wring2Router / 2., saa1Wring2Router / 2., saa1Wring2HWidth);
1305       shSaa1Wring2b->SetName("shSaa1Wring2b");
1306       TGeoTranslation* trSaa1Wring2b 
1307           = new TGeoTranslation("trSaa1Wring2b", saa1Wring2Router / 2. + saa1Wring2Cutoffx, saa1Wring2Router / 2. + saa1Wring2Cutoffy, 0.);
1308       trSaa1Wring2b->RegisterYourself();
1309       TGeoCompositeShape*  shSaa1Wring2 = new TGeoCompositeShape("shSaa1Wring2", "(shSaa1Wring2a)*(shSaa1Wring2b:trSaa1Wring2b)");
1310       TGeoVolume* voSaa1Wring2    = new TGeoVolume("SAA1_WRING2", shSaa1Wring2, gGeoManager->GetMedium("SHIL_Ni/W3"));
1311
1312 ///////////////////////////////////
1313 //    SAA1 W-Ring 3              //
1314 //    Drawing ALIP2A__0216       //
1315 ///////////////////////////////////
1316
1317       Float_t saa1Wring3Rinner  = 20.30;
1318       Float_t saa1Wring3Router  = 23.40;
1319       Float_t saa1Wring3HWidth  =  3.75;
1320       Float_t saa1Wring3Cutoffx =  4.50;
1321       Float_t saa1Wring3Cutoffy =  4.40;
1322       TGeoTubeSeg* shSaa1Wring3a  = new TGeoTubeSeg(saa1Wring3Rinner, saa1Wring3Router, saa1Wring3HWidth, 0., 90.);
1323       shSaa1Wring3a->SetName("shSaa1Wring3a");
1324       TGeoBBox* shSaa1Wring3b  = new TGeoBBox(saa1Wring3Router / 2., saa1Wring3Router / 2., saa1Wring3HWidth);
1325       shSaa1Wring3b->SetName("shSaa1Wring3b");
1326       TGeoTranslation* trSaa1Wring3b 
1327           = new TGeoTranslation("trSaa1Wring3b", saa1Wring3Router / 2. + saa1Wring3Cutoffx, saa1Wring3Router / 2. + saa1Wring3Cutoffy, 0.);
1328       trSaa1Wring3b->RegisterYourself();
1329       TGeoCompositeShape*  shSaa1Wring3 = new TGeoCompositeShape("shSaa1Wring3", "(shSaa1Wring3a)*(shSaa1Wring3b:trSaa1Wring3b)");
1330       TGeoVolume* voSaa1Wring3    = new TGeoVolume("SAA1_WRING3", shSaa1Wring3, gGeoManager->GetMedium("SHIL_Ni/W3"));
1331
1332 ///////////////////////////////////
1333 //    SAA1 W-Ring 4              //
1334 //    Drawing ALIP2A__0215       //
1335 ///////////////////////////////////
1336       Float_t saa1Wring4Width  =  5.85;
1337       TGeoPcon* shSaa1Wring4  = new TGeoPcon(0., 360., 5);
1338       shSaa1Wring4->DefineSection(0, 0.00, 20.30, 23.40);
1339       shSaa1Wring4->DefineSection(1, 1.00, 20.30, 23.40);
1340       shSaa1Wring4->DefineSection(2, 1.00, 20.30, 24.50);      
1341       shSaa1Wring4->DefineSection(3, 4.85, 20.30, 24.80);
1342       shSaa1Wring4->DefineSection(4, 5.85, 24.10, 24.80);
1343       TGeoVolume* voSaa1Wring4  =  new TGeoVolume("SAA1_WRING4", shSaa1Wring4, gGeoManager->GetMedium("SHIL_Ni/W3"));
1344
1345 ///////////////////////////////////
1346 //    SAA1 W-Ring 5              //
1347 //    Drawing ALIP2A__0218       //
1348 ///////////////////////////////////
1349       Float_t saa1Wring5Rinner = 20.30;
1350       Float_t saa1Wring5Router = 23.40;
1351       Float_t saa1Wring5HWidth =  0.85;
1352       TGeoVolume* voSaa1Wring5    = new TGeoVolume("SAA1_WRING5", 
1353                                                    new TGeoTube(saa1Wring5Rinner, saa1Wring5Router, saa1Wring5HWidth), 
1354                                                    gGeoManager->GetMedium("SHIL_Ni/W3"));
1355 //
1356 // Position the rings in the assembly 
1357 //      
1358 // Distance between rings
1359       Float_t saa1DWrings = 2.6;
1360 //
1361       dz = - (saa1Wring1Width + 6. * saa1Wring2HWidth + 2. * saa1Wring3HWidth + saa1Wring4Width + 2. * saa1Wring5HWidth + 2. * saa1DWrings) / 2.;
1362       extraShield2->AddNode(voSaa1Wring1,    1, new TGeoTranslation(0., 0., dz));
1363       dz +=   saa1Wring1Width;
1364       dz +=   saa1Wring2HWidth;   
1365       extraShield2->AddNode(voSaa1Wring2,    1, new TGeoCombiTrans(0., 0., dz, rot000));
1366       extraShield2->AddNode(voSaa1Wring2,    2, new TGeoCombiTrans(0., 0., dz, rot180));
1367       dz +=   saa1Wring2HWidth;   
1368       dz +=   saa1DWrings;
1369       dz +=   saa1Wring2HWidth;   
1370       extraShield2->AddNode(voSaa1Wring2,    3, new TGeoCombiTrans(0., 0., dz, rot090));
1371       extraShield2->AddNode(voSaa1Wring2,    4, new TGeoCombiTrans(0., 0., dz, rot270));
1372       dz +=   saa1Wring2HWidth;   
1373       dz +=   saa1Wring5HWidth;   
1374       extraShield2->AddNode(voSaa1Wring5,    1, new TGeoTranslation(0., 0., dz));
1375       dz +=   saa1Wring5HWidth;   
1376       dz +=   saa1Wring2HWidth;   
1377       extraShield2->AddNode(voSaa1Wring2,    5, new TGeoCombiTrans(0., 0., dz, rot000));
1378       extraShield2->AddNode(voSaa1Wring2,    6, new TGeoCombiTrans(0., 0., dz, rot180));
1379       dz +=   saa1Wring2HWidth;   
1380       dz +=   saa1DWrings;
1381       dz +=   saa1Wring3HWidth;   
1382       extraShield2->AddNode(voSaa1Wring3,    1, new TGeoCombiTrans(0., 0., dz, rot090));
1383       extraShield2->AddNode(voSaa1Wring3,    2, new TGeoCombiTrans(0., 0., dz, rot270));
1384       dz +=   saa1Wring3HWidth;   
1385       extraShield2->AddNode(voSaa1Wring4,    1, new TGeoTranslation(0., 0., dz));
1386       dz +=   saa1Wring4Width;   
1387       assembly->AddNode(extraShield2, 1, new TGeoTranslation(0., 0., -kzLength + (kZch21 - zstart) + dz));
1388       
1389       TGeoVolume* top =  gGeoManager->GetVolume("ALIC");
1390       TGeoRotation* rotxz = new TGeoRotation("rotxz",  90., 0., 90., 90., 180., 0.);
1391       top->AddNode(assembly, 1, new TGeoCombiTrans(0., 0., -zstart - kzLength, rotxz));
1392       
1393   }
1394 }
1395
1396 void AliSHILv2::Init()
1397 {
1398   //
1399   // Initialise the muon shield after it has been built
1400   //
1401   Int_t i;
1402   //
1403   if(AliLog::GetGlobalDebugLevel()>0) {
1404     printf("\n%s: ",ClassName());
1405     for(i=0;i<35;i++) printf("*");
1406     printf(" SHILv2_INIT ");
1407     for(i=0;i<35;i++) printf("*");
1408     printf("\n%s: ",ClassName());
1409     //
1410     // Here the SHIL initialisation code (if any!)
1411     for(i=0;i<80;i++) printf("*");
1412     printf("\n");
1413   }
1414 }