Adding the new detector MFT (Antonio Uras)
[u/mrichter/AliRoot.git] / STRUCT / AliPIPEv4.cxx
1
2 /**************************************************************************
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  *                                                                        *
5  * Author: The ALICE Off-line Project.                                    *
6  * Contributors are mentioned in the code where appropriate.              *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /* $Id$ */
18
19 //-------------------------------------------------------------------------
20 //  Beam pipe class
21 //  This version uses TGeo
22 //  Author: A.Morsch
23 //-------------------------------------------------------------------------
24
25
26 #include <Riostream.h>
27
28 #include <TSystem.h>
29 #include <TVirtualMC.h>
30 #include <TGeoManager.h>
31 #include <TGeoMatrix.h>
32 #include <TGeoVolume.h>
33 #include <TGeoTorus.h>
34 #include <TGeoTube.h>
35 #include <TGeoCone.h>
36 #include <TGeoPcon.h>
37 #include <TGeoBBox.h>
38 #include <TGeoXtru.h>
39 #include <TGeoCompositeShape.h>
40 #include <TGeoGlobalMagField.h>
41
42 #include "AliConst.h"
43 #include "AliMagF.h"
44 #include "AliPIPEv4.h"
45 #include "AliRun.h"
46 #include "AliLog.h"
47  
48 ClassImp(AliPIPEv4)
49  
50 //_____________________________________________________________________________
51 AliPIPEv4::AliPIPEv4():
52     ftheta_cone(6.00),  // angle of conical beam pipe, if angle < 3 --> cylindrical beam pipe
53     frmin1(2.00),       // internal radius of Be beam pipe
54     fepaisseur(0.08),   // width of Be beam pipe
55     fsigmaz(8.00),      // dispersion of z location (1 sigma) of beam impact position
56     fz_chambre(-40.0),  // first pixel chamber location, closest to the IP
57     fzdebut1(50.),      // beginning of beam pipe z location (A side)
58     fzfin4(-82.)        // end of beamp pipe z location (C side)
59 {
60   // Constructor
61 }
62
63 //_____________________________________________________________________________
64 AliPIPEv4::AliPIPEv4(const char *name, const char *title)
65   : AliPIPE(name,title),
66     ftheta_cone(6.00),  // angle of conical beam pipe, if angle < 3 --> cylindrical beam pipe
67     frmin1(2.00),       // internal radius of Be beam pipe
68     fepaisseur(0.08),   // width of Be beam pipe
69     fsigmaz(8.00),      // dispersion of z location (1 sigma) of beam impact position
70     fz_chambre(-40.0),  // first pixel chamber location, closest to the IP
71     fzdebut1(50.),      // beginning of beam pipe z location (A side)
72     fzfin4(-82.)        // end of beamp pipe z location (C side)
73 {
74   // Constructor
75 }
76
77
78 //_____________________________________________________________________________
79 AliPIPEv4::AliPIPEv4(const char *name, const char *title, const Float_t theta_cone,  const Float_t rmin1, const Float_t epaisseur, 
80                      const Float_t sigmaz, const Float_t z_chambre)
81   : AliPIPE(name,title),
82     ftheta_cone(theta_cone), // angle of conical beam pipe, if angle < 3 --> cylindrical beam pipe
83     frmin1(rmin1),           // internal radius of Be beam pipe 
84     fepaisseur(epaisseur),   // width of Be beam pipe 
85     fsigmaz(sigmaz),         // dispersion of z location (1 sigma) of beam impact position
86     fz_chambre(z_chambre),   // first pixel chamber location, closest to the IP
87     fzdebut1(50.),           // beginning of beam pipe z location (A side)
88     fzfin4(-82.)             // end of beamp pipe z location (C side)
89 {
90   // Constructor
91
92 }
93
94  
95 //___________________________________________
96 void AliPIPEv4::CreateGeometry()
97 {
98   AliDebug(1,"Create PIPEv4 geometry");
99   //
100   //  Class describing the beam pipe geometry
101   //
102   Float_t lolo = 0.9;   //1.3 minimum pour que le premier anneau soit dans l'acceptance du spectro
103   Float_t dz, z, zsh, z0;
104   //
105   // Rotation Matrices
106   //
107   const Float_t  kDegRad = TMath::Pi() / 180.;
108   // Rotation by 180 deg
109   TGeoRotation* rot180        = new TGeoRotation("rot180", 90., 180.,  90.,  90., 180.,   0.);
110   TGeoRotation* rotyz         = new TGeoRotation("rotyz",  90., 180.,   0., 180.,  90.,  90.);
111   TGeoRotation* rotxz         = new TGeoRotation("rotxz",   0.,   0.,  90.,  90.,  90., 180.);
112   TGeoRotation* rot045        = new TGeoRotation("rot045", 90.,  45.,  90., 135.,   0.,   0.);
113   TGeoRotation* rot135        = new TGeoRotation("rot135", 90. ,135.,  90., 225.,   0.,   0.);
114   TGeoRotation* rot225        = new TGeoRotation("rot225", 90. ,225.,  90., 315.,   0.,   0.);
115   TGeoRotation* rot315        = new TGeoRotation("rot315", 90. ,315.,  90.,  45.,   0.,   0.);    
116   //
117   // Media
118   const TGeoMedium* kMedAir     =  gGeoManager->GetMedium("PIPE_AIR");
119   const TGeoMedium* kMedAirHigh =  gGeoManager->GetMedium("PIPE_AIR_HIGH");
120   const TGeoMedium* kMedVac     =  gGeoManager->GetMedium("PIPE_VACUUM");    
121   const TGeoMedium* kMedInsu    =  gGeoManager->GetMedium("PIPE_INS_C0");    
122   const TGeoMedium* kMedSteel   =  gGeoManager->GetMedium("PIPE_INOX");        
123   const TGeoMedium* kMedBe      =  gGeoManager->GetMedium("PIPE_BE");       
124   const TGeoMedium* kMedCu      =  gGeoManager->GetMedium("PIPE_CU");        
125   //const TGeoMedium* kMedKapton  =  gGeoManager->GetMedium("PIPE_KAPTON");        
126   const TGeoMedium* kMedAco     =  gGeoManager->GetMedium("PIPE_ANTICORODAL");        
127   //const TGeoMedium* kMedNEG     =  gGeoManager->GetMedium("PIPE_NEG COATING"); 
128        
129   // Top volume
130   TGeoVolume* top    = gGeoManager->GetVolume("ALIC");
131   //
132   //
133   ////////////////////////////////////////////////////////////////////////////////     
134   //                                                                            //
135   //                                  The Central Vacuum system                 // 
136   //                                                                            //
137   ////////////////////////////////////////////////////////////////////////////////
138   //
139   //
140   //  The ALICE central beam-pipe according to drawing         LHCVC2C_0001 
141   //  Drawings of sub-elements:
142   //  
143   //  Pos 7 - Minimised Flange:                                LHCVFX_P0025
144   //  Pos 6 - Standard Flange:                                 STDVFUHV0009
145   //  Pos 8 - Bellow:                                          LHCVBX__0001
146   //
147   //  Absolute z-coordinates -82.0 - 400.0 cm 
148   //  Total length:                                          482.0 cm
149   //  It consists of 3 main parts:
150   //  CP/2 The flange on the non-absorber side:               36.5 cm  
151   //  CP/1 The central Be pipe:                              405.0 cm 
152   //  CP/3 The double-bellow and flange on the absorber side: 40.5 cm 
153   //
154   //
155
156   //
157   //
158   //  Starting position in z
159   const Float_t kCPz0      = -400.0;
160   //  Length of the CP/1 section
161   const Float_t kCP1Length =  405.0;    
162   //  Length of the CP/2 section    
163   const Float_t kCP2Length =   36.5;
164   //  Length of the CP/3 section    
165   const Float_t kCP3Length =   40.5;
166   //  Position of the CP/2 section    
167   //    const Float_t kCP2pos    = kCPz0 + kCP2Length / 2.;
168   //  Position of the CP/3 section
169   const Float_t kCP3pos    = kCPz0 + kCP2Length + kCP1Length + kCP3Length/2.;
170
171
172
173   ///////////////////////////////// NEW GEOMETRY /////////////////////////////////////////////
174   
175   Float_t zfin1= fsigmaz - frmin1/TMath::Tan(ftheta_cone/ 180. * TMath::Pi());
176   Float_t zdebut2=zfin1;
177   Float_t rmax2= TMath::Tan(ftheta_cone/ 180. * TMath::Pi())*(fsigmaz+TMath::Abs(fz_chambre));
178   Float_t zfin2=-(TMath::Abs(fz_chambre)-1);
179   Float_t zdebut3=zfin2;
180   Float_t zfin3=zfin2+(-fepaisseur);
181   Float_t zdebut4=zfin3;
182   //---------------- Conical beam pipe ---------------
183   if(ftheta_cone>3){                              
184     TGeoPcon* CONE_VIDE = new TGeoPcon(0., 360., 8);
185     CONE_VIDE->DefineSection(0,fzdebut1, 0.,frmin1);
186     CONE_VIDE->DefineSection(1,zfin1, 0.,frmin1);
187     CONE_VIDE->DefineSection(2,zdebut2, 0.,frmin1);
188     CONE_VIDE->DefineSection(3,zfin2, 0.,rmax2);
189     CONE_VIDE->DefineSection(4,zdebut3, 0.,frmin1);
190     CONE_VIDE->DefineSection(5,zfin3, 0.,frmin1);
191     CONE_VIDE->DefineSection(6,zdebut4, 0.,frmin1);
192     CONE_VIDE->DefineSection(7,fzfin4, 0.,frmin1);
193     TGeoVolume* voCONE_VIDE = new TGeoVolume("CONE_VIDE",CONE_VIDE,kMedVac);             
194     voCONE_VIDE->SetLineColor(kOrange);
195     top->AddNode(voCONE_VIDE,1,new TGeoTranslation(0., 0., 0.));
196
197     TGeoPcon* CONE_BE = new TGeoPcon(0., 360., 8);
198     CONE_BE->DefineSection(0,fzdebut1,frmin1,frmin1+fepaisseur);
199     CONE_BE->DefineSection(1,zfin1,frmin1,frmin1+fepaisseur);
200     CONE_BE->DefineSection(2,zdebut2,frmin1,frmin1+fepaisseur);
201     CONE_BE->DefineSection(3,zfin2,rmax2,rmax2+fepaisseur);
202     CONE_BE->DefineSection(4,zdebut3,frmin1,rmax2+fepaisseur);
203     CONE_BE->DefineSection(5,zfin3,frmin1,rmax2+fepaisseur);
204     CONE_BE->DefineSection(6,zdebut4,frmin1,frmin1+fepaisseur);
205     CONE_BE->DefineSection(7,fzfin4,frmin1,frmin1+fepaisseur);
206     TGeoVolume* voCONE_BE = new TGeoVolume("CONE_BE",CONE_BE,kMedBe);            
207     voCONE_BE->SetLineColor(kRed);
208   }
209   //--------------- Cylindrical beam pipe -------------
210   if(ftheta_cone<3){
211     TGeoPcon* TUBE_VIDE = new TGeoPcon(0., 360., 2);
212     TUBE_VIDE->DefineSection(0,fzdebut1, 0.,frmin1);
213     TUBE_VIDE->DefineSection(1,fzfin4, 0.,frmin1);
214     TGeoVolume* voTUBE_VIDE = new TGeoVolume("TUBE_VIDE",TUBE_VIDE,kMedVac);
215     voTUBE_VIDE->SetLineColor(kOrange);    
216     top->AddNode(voTUBE_VIDE,1,new TGeoTranslation(0., 0., 0.));
217
218     TGeoPcon* TUBE_BE = new TGeoPcon(0., 360., 2);
219     TUBE_BE->DefineSection(0,fzdebut1,frmin1,frmin1+fepaisseur);
220     TUBE_BE->DefineSection(1,fzfin4,frmin1,frmin1+fepaisseur);
221     TGeoVolume* voTUBE_BE = new TGeoVolume("TUBE_BE",TUBE_BE,kMedBe);
222     voTUBE_BE->SetLineColor(kRed);    
223     top->AddNode(voTUBE_BE,1,new TGeoTranslation(0., 0., 0.));
224   }
225  
226   /////////////////////// END NEW GEOMETRY /////////////////////////////
227     
228
229
230   //
231   ///////////////////
232   //      CP/2     //
233   ///////////////////
234   //
235   // Fixed Point tube [Pos 5]
236   //
237   // Inner and outer radii of the Stainless Steel pipe    
238   const Float_t kCP2StRi               =      2.90-lolo;
239   const Float_t kCP2StRo               =      2.98-lolo;
240   //  
241   // Transition to central Be-pipe (Bulge)   
242   // Length
243   const Float_t kCP2BulgeLength        =      0.80;
244   //     
245   // Bulge outer radius
246   const Float_t kCP2BulgeRo            =      3.05-lolo;
247   //
248   // Fixed Point at z = 391.7 (IP)
249   //
250   // Position of fixed point
251   const Float_t kCP2FixedPointZ        =      8.30;
252   //
253   // Outer radius of fixed point
254   const Float_t kCP2FixedPointRo       =      3.50-lolo;
255   //
256   // Length of fixed point
257   const Float_t kCP2FixedPointLength   =      0.60;
258   //
259   // Fixed Flange [Pos 6]    
260   //
261   // Fixed flange outer radius
262   const Float_t kCP2FixedFlangeRo      =      7.60;
263   //
264   // Fixed flange inner radius
265   const Float_t kCP2FixedFlangeRi      =      3.00;
266   // Fixed flange inner radius bulge
267   const Float_t kCP2FixedFlangeBulgeRi =      2.90;
268   // Fixed flange lengths of sections at inner radius
269   const Float_t kCP2FixedFlangeRecessLengths[3] ={1., 0.08, 0.9};
270   // Fixed flange length
271   const Float_t kCP2FixedFlangeLength =       1.98;
272   //
273   // Fixed flange bulge
274   // Outer radius
275   const Float_t kCP2FixedFlangeBulgeRo =     3.00-lolo;
276   //
277   // Length    
278   const Float_t kCP2FixedFlangeBulgeLength = 2.00;
279
280   //
281   // CP/2 Mother Volume
282   //
283   TGeoPcon* shCp2Mo = new TGeoPcon(0., 360., 14);
284   //  Flange
285   z = - kCP2Length / 2.;
286   shCp2Mo->DefineSection( 0, z, kCP2FixedFlangeRi, kCP2FixedFlangeRo);
287   z +=  kCP2FixedFlangeRecessLengths[0];
288   shCp2Mo->DefineSection( 1, z, kCP2FixedFlangeRi, kCP2FixedFlangeRo);
289   shCp2Mo->DefineSection( 2, z, 0.,                kCP2FixedFlangeRo);
290   z +=  (kCP2FixedFlangeRecessLengths[1] + kCP2FixedFlangeRecessLengths[2]) ;
291   shCp2Mo->DefineSection( 3, z, 0., kCP2FixedFlangeRo);
292   //  Straight section between Flange and Fixed Point
293   shCp2Mo->DefineSection( 4, z, 0., kCP2FixedFlangeBulgeRo);
294   z += kCP2FixedFlangeBulgeLength;
295   shCp2Mo->DefineSection( 5, z, 0., kCP2FixedFlangeBulgeRo);
296   shCp2Mo->DefineSection( 6, z, 0., kCP2StRo);
297   z =  - kCP2Length / 2 +  kCP2FixedPointZ - kCP2FixedPointLength / 2.;
298   shCp2Mo->DefineSection( 7, z, 0., kCP2StRo);
299   //  Fixed Point
300   shCp2Mo->DefineSection( 8, z, 0., kCP2FixedPointRo);
301   z +=  kCP2FixedPointLength;
302   shCp2Mo->DefineSection( 9, z, 0., kCP2FixedPointRo);
303   //  Straight section between Fixed Point and transition bulge
304   shCp2Mo->DefineSection(10, z, 0., kCP2StRo);
305   z  =  kCP2Length / 2. - kCP2BulgeLength;
306   shCp2Mo->DefineSection(11, z, 0., kCP2StRo);
307   shCp2Mo->DefineSection(12, z, 0., kCP2BulgeRo);
308   z = kCP2Length / 2.;
309   shCp2Mo->DefineSection(13, z, 0., kCP2BulgeRo);
310     
311   TGeoVolume* voCp2Mo = new TGeoVolume("CP2MO", shCp2Mo, kMedAir);
312   voCp2Mo->SetVisibility(0);
313   //
314   // CP/1 Vacuum
315   TGeoTube*   shCp2Va = new TGeoTube(0., kCP2StRi, (kCP2Length - kCP2FixedFlangeRecessLengths[0])/2.);
316   TGeoVolume* voCp2Va = new TGeoVolume("CP2VA", shCp2Va, kMedVac);
317     
318   voCp2Mo->AddNode(voCp2Va, 1, new TGeoTranslation(0., 0., kCP2FixedFlangeRecessLengths[0]/2.));
319     
320   /////////////////////////////////////////////
321   //  CP/2 Fixed Flange [Pos 6]              //
322   /////////////////////////////////////////////
323
324   TGeoPcon* shCp2Fl = new TGeoPcon(0., 360., 6);
325   z = - kCP2FixedFlangeLength / 2.;
326   shCp2Fl->DefineSection(0, z, kCP2FixedFlangeRi,      kCP2FixedFlangeRo);
327   z +=  kCP2FixedFlangeRecessLengths[0];
328   shCp2Fl->DefineSection(1, z, kCP2FixedFlangeRi,      kCP2FixedFlangeRo);
329   shCp2Fl->DefineSection(2, z, kCP2FixedFlangeBulgeRi, kCP2FixedFlangeRo);
330   z +=  kCP2FixedFlangeRecessLengths[1];
331   shCp2Fl->DefineSection(3, z, kCP2FixedFlangeBulgeRi, kCP2FixedFlangeRo);
332   shCp2Fl->DefineSection(4, z, kCP2FixedFlangeRi,      kCP2FixedFlangeRo);
333   z = kCP2FixedFlangeLength / 2.;
334   shCp2Fl->DefineSection(5, z, kCP2FixedFlangeRi,      kCP2FixedFlangeRo);
335   TGeoVolume* voCp2Fl = new TGeoVolume("CP2FL", shCp2Fl, kMedSteel);
336   // 
337   dz =  - kCP2Length / 2. +  kCP2FixedFlangeLength / 2.;
338   voCp2Mo->AddNode(voCp2Fl, 1, new TGeoTranslation(0., 0., dz));
339
340
341   /////////////////////////////////////////////////////////////
342   //  CP/2 Beam pipe with fixed point and transition bulges  //
343   /////////////////////////////////////////////////////////////
344   TGeoPcon* shCp2Pi = new TGeoPcon(0., 360., 10);
345   //  Bulge at transition to flange 
346   z =  - (kCP2Length -  kCP2FixedFlangeRecessLengths[0] - kCP2FixedFlangeRecessLengths[1]) / 2.;
347   z0 = z;
348   shCp2Pi->DefineSection(0, z, kCP2StRi, kCP2FixedFlangeBulgeRo);
349   z += kCP2FixedFlangeBulgeLength;
350   shCp2Pi->DefineSection(1, z, kCP2StRi, kCP2FixedFlangeBulgeRo);
351   //  Straight section between Bulge and Fixed Point
352   shCp2Pi->DefineSection(2, z, kCP2StRi, kCP2StRo);
353   z  += (kCP2FixedPointZ - kCP2FixedPointLength / 2. - kCP2FixedFlangeRecessLengths[0]
354          - kCP2FixedFlangeRecessLengths[1] - 
355          kCP2FixedFlangeBulgeLength);
356   shCp2Pi->DefineSection(3, z, kCP2StRi, kCP2StRo);
357   //  Fixed Point
358   shCp2Pi->DefineSection(4, z, kCP2StRi, kCP2FixedPointRo);
359   z +=  kCP2FixedPointLength;
360   shCp2Pi->DefineSection(5, z, kCP2StRi, kCP2FixedPointRo);
361   //  Straight section between Fixed Point and transition bulge
362   shCp2Pi->DefineSection(6, z, kCP2StRi, kCP2StRo);
363   z = - shCp2Pi->GetZ(0) - kCP2BulgeLength;
364   shCp2Pi->DefineSection(7, z, kCP2StRi, kCP2StRo);
365   //  Bulge at transition to Be pipe
366   shCp2Pi->DefineSection(8, z, kCP2StRi, kCP2BulgeRo);
367   z = - shCp2Pi->GetZ(0);
368   shCp2Pi->DefineSection(9, z, kCP2StRi, kCP2BulgeRo);
369
370   TGeoVolume* voCp2Pi = new TGeoVolume("CP2PI", shCp2Pi, kMedSteel);
371   dz = (kCP2FixedFlangeRecessLengths[0] + kCP2FixedFlangeRecessLengths[1]) / 2.;
372   voCp2Mo->AddNode(voCp2Pi, 1, new TGeoTranslation(0., 0., dz));
373
374   //
375   //  Central beam pipe support collars
376   //  LHCVC2C_0019
377   //  Position at z = -46., 40., 150.
378   //TGeoVolume* voCpSupC = new TGeoVolume("CpSupC", new TGeoTube(3.051, 4.00, 0.35), kMedAco);
379   //voCp1->AddNode(voCpSupC, 1, new TGeoTranslation(0., 0.,  kCP1Length / 2. - 98.2)); 
380   //voCp1->AddNode(voCpSupC, 2, new TGeoTranslation(0., 0.,  kCP1Length / 2.- 191.5)); 
381
382   TGeoVolume* voCpSupClolo = new TGeoVolume("CpSupC", new TGeoTube(3.051-lolo, 4.0-lolo, 0.35), kMedAco);   
383   //  Beam Pipe Protection Tube
384   //
385   //  ALIFWDA_0025
386   //    
387   //  Plaque de Centrage  ALIFWDA_0019
388   const Float_t kFwdaBPPTXL = 3.;
389   TGeoXtru* shFwdaBPPTX = new TGeoXtru(2);
390   Double_t xBPPTX[8] = {12.5,  7.5, -7.5, -12.5, -12.5,  -7.5,   7.5, 12.5};
391   Double_t yBPPTX[8] = { 7.0, 12.0, 12.0,  7.0, -7.0, -12.0, -12.0,  -7.0};
392   shFwdaBPPTX->DefinePolygon(8, xBPPTX, yBPPTX);
393   shFwdaBPPTX->DefineSection(0, 0.,         0., 0., 1.);
394   shFwdaBPPTX->DefineSection(1, kFwdaBPPTXL, 0., 0., 1.);
395   shFwdaBPPTX->SetName("FwdaBPPTX");
396   TGeoTube* shFwdaBPPTY = new TGeoTube(0., 8.5, 3.2);
397   shFwdaBPPTY->SetName("FwdaBPPTY");
398   TGeoCompositeShape*  shFwdaBPPTPC = new TGeoCompositeShape("shFwdaBPPTPC", "FwdaBPPTX-FwdaBPPTY");
399   TGeoVolume* voFwdaBPPTPC =  new TGeoVolume("FwdaBPPTPC", shFwdaBPPTPC, kMedAco);
400   //    
401   //  Tube  ALIFWDA_0020  
402   //    const Float_t kFwdaBPPTTL = 48.;
403   const Float_t kFwdaBPPTTL = 35.;
404   TGeoVolume* voFwdaBPPTT =  new TGeoVolume("FwdaBPPTT", new TGeoTube(8.85, 9.0, kFwdaBPPTTL/2.), kMedAco);
405   TGeoVolumeAssembly* voFwdaBPPT = new TGeoVolumeAssembly("FwdaBPPT");
406   voFwdaBPPT->AddNode(voFwdaBPPTPC, 1, gGeoIdentity);
407   voFwdaBPPT->AddNode(voFwdaBPPTT,  1, new TGeoTranslation(0., 0., kFwdaBPPTTL/2. + kFwdaBPPTXL));
408
409     
410   //  BeamPipe and T0A Support
411   //
412   //  ALIFWDA_0033
413   //    
414   //  Support  Plate ALIFWDA_0026
415   const Float_t kFwdaBPSPL = 4.0;
416   TGeoXtru* shFwdaBPSPX = new TGeoXtru(2);
417   Double_t xBPSPX[8] = {10.0,  6.0 , -6.0, -10.0, -10.0,  -6.0,   6.0, 10.0};
418   Double_t yBPSPX[8] = { 6.0, 10.0,  10.0,   6.0, - 6.0, -10.0, -10.0, -6.0};
419   shFwdaBPSPX->DefinePolygon(8, xBPSPX, yBPSPX);
420   shFwdaBPSPX->DefineSection(0, 0.,         0., 0., 1.);
421   shFwdaBPSPX->DefineSection(1, kFwdaBPSPL, 0., 0., 1.);
422   shFwdaBPSPX->SetName("FwdaBPSPX");
423   TGeoPcon* shFwdaBPSPY = new TGeoPcon(0., 360., 6);
424   shFwdaBPSPY->DefineSection(0, -1.00, 0., 5.5);
425   shFwdaBPSPY->DefineSection(1,  3.50, 0., 5.5);    
426   shFwdaBPSPY->DefineSection(2,  3.50, 0., 5.0);    
427   shFwdaBPSPY->DefineSection(3,  3.86, 0., 5.0);    
428   shFwdaBPSPY->DefineSection(4,  3.86, 0., 5.5);    
429   shFwdaBPSPY->DefineSection(5,  5.00, 0., 5.5);    
430   shFwdaBPSPY->SetName("FwdaBPSPY");
431   TGeoCompositeShape*  shFwdaBPSP = new TGeoCompositeShape("shFwdaBPSP", "FwdaBPSPX-FwdaBPSPY");
432   TGeoVolume* voFwdaBPSP =  new TGeoVolume("FwdaBPSP", shFwdaBPSP, kMedAco);
433   //    
434   //  Flasque  ALIFWDA_00027
435
436
437   const Float_t kFwdaBPSTTRi  =  7.6/2.;
438   const Float_t kFwdaBPSTTRo1 = 13.9/2.;
439   const Float_t kFwdaBPSTTRo2 =  8.2/2.;
440   const Float_t kFwdaBPSTTRo3 =  9.4/2.;
441     
442   TGeoPcon* shFwdaBPSFL = new TGeoPcon(0., 360., 8);
443   z = 0., 
444     shFwdaBPSFL->DefineSection(0, z, kFwdaBPSTTRi, kFwdaBPSTTRo1);
445   z += 0.64;
446   shFwdaBPSFL->DefineSection(1, z, kFwdaBPSTTRi, kFwdaBPSTTRo1);
447   shFwdaBPSFL->DefineSection(2, z, kFwdaBPSTTRi, kFwdaBPSTTRo2);
448   z += 2.55;
449   shFwdaBPSFL->DefineSection(3, z, kFwdaBPSTTRi, kFwdaBPSTTRo2);
450   shFwdaBPSFL->DefineSection(4, z, kFwdaBPSTTRi, kFwdaBPSTTRo3);
451   z += 0.4;
452   shFwdaBPSFL->DefineSection(5, z, kFwdaBPSTTRi, kFwdaBPSTTRo3);
453   shFwdaBPSFL->DefineSection(6, z, kFwdaBPSTTRi, kFwdaBPSTTRo2);
454   z += 1.2;
455   shFwdaBPSFL->DefineSection(7, z, kFwdaBPSTTRi, kFwdaBPSTTRo2);
456
457   TGeoVolume* voFwdaBPSFL =  new TGeoVolume("FwdaBPSFL", shFwdaBPSFL, kMedAco);
458
459     
460   //
461   // Cable support 
462   TGeoBBox* shFwdaBPSCSa = new TGeoBBox(3.0, 8.75, 0.5);
463   shFwdaBPSCSa->SetName("FwdaBPSCSa");
464   TGeoBBox* shFwdaBPSCSb = new TGeoBBox(1.25, 4.00, 1.0);
465   shFwdaBPSCSb->SetName("FwdaBPSCSb");   
466   TGeoTranslation* tFwdaBPSCSb = new TGeoTranslation(0., 5.25 - 8.75, 0.);
467   tFwdaBPSCSb->SetName("tFwdaBPSCSb");
468   tFwdaBPSCSb->RegisterYourself();
469   TGeoBBox* shFwdaBPSCSc = new TGeoBBox(3.0, 0.50, 0.70);
470   shFwdaBPSCSc->SetName("FwdaBPSCSc");
471   TGeoTranslation* tFwdaBPSCSc = new TGeoTranslation(0., 0.5 - 8.75, 1.2);
472   tFwdaBPSCSc->SetName("tFwdaBPSCSc");
473   tFwdaBPSCSc->RegisterYourself();
474   TGeoCompositeShape* shFwdaBPSCS = new TGeoCompositeShape("shFwdaBPSCS", "(FwdaBPSCSa-FwdaBPSCSb:tFwdaBPSCSb)+FwdaBPSCSc:tFwdaBPSCSc");
475   TGeoVolume* voFwdaBPSCS = new TGeoVolume("FwdaBPSCS", shFwdaBPSCS, kMedAco);
476     
477     
478   // Assembling the beam pipe support   
479   TGeoVolumeAssembly* voFwdaBPS = new TGeoVolumeAssembly("FwdaBPS");
480   voFwdaBPS->AddNode(voFwdaBPSP,   1,  new TGeoCombiTrans(0., 0., 0., rot045));
481   voFwdaBPS->AddNode(voFwdaBPSFL,  1,  new TGeoTranslation(0., 0., kFwdaBPSPL));
482   const Float_t kFwdaBPSCSdy = 18.75/TMath::Sqrt(2.);
483     
484   voFwdaBPS->AddNode(voFwdaBPSCS,  1,  new TGeoCombiTrans(- kFwdaBPSCSdy,   kFwdaBPSCSdy, 2., rot045));
485   voFwdaBPS->AddNode(voFwdaBPSCS,  2,  new TGeoCombiTrans(- kFwdaBPSCSdy, - kFwdaBPSCSdy, 2., rot135));
486   voFwdaBPS->AddNode(voFwdaBPSCS,  3,  new TGeoCombiTrans(  kFwdaBPSCSdy, - kFwdaBPSCSdy, 2., rot225));
487   voFwdaBPS->AddNode(voFwdaBPSCS,  4,  new TGeoCombiTrans(  kFwdaBPSCSdy,   kFwdaBPSCSdy, 2., rot315));
488
489   TGeoVolumeAssembly* voCp2 = new TGeoVolumeAssembly("CP2");
490   voCp2->AddNode(voCp2Mo, 1, gGeoIdentity);
491   voCp2->AddNode(voFwdaBPPT, 1, new TGeoTranslation(0., 0., -kCP2Length / 2. + 13.8));
492   voCp2->AddNode(voFwdaBPS,  1, new TGeoTranslation(0., 0., -kCP2Length / 2. +  5.1));
493
494   //
495   ///////////////////
496   //      CP/3     //
497   ///////////////////
498   //
499   // Adaptor tube [Pos 4]
500   // 
501   // Adaptor tube length 
502   const Float_t  kCP3AdaptorTubeLength            =  5.50;
503   //
504   // Inner and outer radii
505   const Float_t kCP3AdaptorTubeRi                =  2.92-lolo;
506   const Float_t kCP3AdaptorTubeRo                =  3.00-lolo;
507   //
508   // Bulge at transition point
509   // Inner and outer radii
510   const Float_t kCP3AdaptorTubeBulgeRi           =  2.90-lolo;
511   const Float_t kCP3AdaptorTubeBulgeRo           =  3.05-lolo;    
512   //
513   // Length of bulge
514   const Float_t  kCP3AdaptorTubeBulgeLength       =  0.80;
515   //
516   // Bellow [Pos 8]
517   //
518   //  Total length    
519   const Float_t kCP3BellowLength                  = 13.00;
520   //  Outer Radius
521   const Float_t kCP3BellowRo                      =  3.6-lolo; //-1?
522   //  Inner Radius 
523   const Float_t kCP3BellowRi                      =  2.8-lolo;
524   //  Number of plies
525   const Int_t   kCP3NumberOfPlies                 = 18;
526   //  Length of undulated region
527   const Float_t kCP3BellowUndulatedLength         =  8.30; 
528   //  Plie thickness
529   const Float_t kCP3PlieThickness                 =  0.02;   
530   //  Connection Plie radies (at transition been undulated region and beam pipe)
531   const Float_t kCP3ConnectionPlieR               =  0.21;
532   //  Plie radius
533   //  const Float_t kCP3PlieR = 0.118286;
534   const Float_t kCP3PlieR = 
535     (kCP3BellowUndulatedLength - 4. *  kCP3ConnectionPlieR + 2. * kCP3PlieThickness + 
536      (2. *  kCP3NumberOfPlies - 2.) * kCP3PlieThickness) / (4. * kCP3NumberOfPlies - 2.);
537   //  Length of connection pipe
538   const Float_t kCP3BellowConnectionLength        =  2.35;
539   //
540   //  Tube between bellows [Pos 3]  
541   //    
542   //  Length of tube
543   const Float_t kCP3TubeLength                    =  4.00;
544   //
545   //  Minimised fixed flange [Pos 7]
546   //  
547   //  Length of flange connection tube
548   const Float_t kCP3FlangeConnectorLength         =  5.0 - 1.4;
549   //  Length of Flange
550   const Float_t kCP3FlangeLength                  =  1.40;
551   //  Outer radius    
552   const Float_t kCP3FlangeRo                      =  4.30-lolo-1.;
553
554   //
555   // CP/3 Mother volume
556   //
557   TGeoPcon* shCp3Mo = new TGeoPcon(0., 360., 12);
558   //  From transition to first bellow
559   z = - kCP3Length / 2.;
560   shCp3Mo->DefineSection( 0, z, 0., kCP3AdaptorTubeBulgeRo);
561   z += kCP3BellowConnectionLength + kCP3AdaptorTubeLength;
562   shCp3Mo->DefineSection( 1, z, 0., kCP3AdaptorTubeBulgeRo);
563   //  First Bellow
564   shCp3Mo->DefineSection( 2, z, 0., kCP3BellowRo);
565   z +=  kCP3BellowUndulatedLength;
566   shCp3Mo->DefineSection( 3, z, 0., kCP3BellowRo);
567   //  Connection between the two bellows
568   shCp3Mo->DefineSection( 4, z, 0., kCP3AdaptorTubeBulgeRo);
569   z +=  2. * kCP3BellowConnectionLength + kCP3TubeLength;
570   shCp3Mo->DefineSection( 5, z, 0., kCP3AdaptorTubeBulgeRo);
571   //  Second bellow
572   shCp3Mo->DefineSection( 6, z, 0., kCP3BellowRo);
573   z += kCP3BellowUndulatedLength;
574   shCp3Mo->DefineSection( 7, z, 0., kCP3BellowRo);
575   //  Pipe between second Bellow and Flange
576   shCp3Mo->DefineSection( 8, z, 0., kCP3AdaptorTubeBulgeRo);
577   z +=  kCP3BellowConnectionLength +  kCP3FlangeConnectorLength;
578   shCp3Mo->DefineSection( 9, z, 0., kCP3AdaptorTubeBulgeRo);
579   //  Flange 
580   shCp3Mo->DefineSection(10, z, 0., kCP3FlangeRo);
581   z = -shCp3Mo->GetZ(0);
582   shCp3Mo->DefineSection(11, z, 0., kCP3FlangeRo);
583   //
584   TGeoVolume* voCp3Mo = new TGeoVolume("CP3MO", shCp3Mo, kMedAir);
585   voCp3Mo->SetVisibility(0);
586   TGeoVolumeAssembly* voCp3 = new TGeoVolumeAssembly("Cp3");
587   voCp3->AddNode(voCp3Mo,  1, gGeoIdentity);
588   //  voCp3->AddNode(voCpSupC, 3, new TGeoTranslation(0., 0., - kCP3Length / 2. + 4.6));
589   voCp3->AddNode(voCpSupClolo, 3, new TGeoTranslation(0., 0., - kCP3Length / 2. + 4.6));
590   dz = kCP3pos;
591
592   //////////////////////////////////////////////
593   // CP/3 Adaptor tube                        // 
594   //////////////////////////////////////////////
595   TGeoPcon* shCp3AtV = new TGeoPcon(0., 360., 4);
596   //  Bulge at transition
597   z =  - kCP3AdaptorTubeLength / 2.;
598   shCp3AtV->DefineSection(0, z, 0., kCP3AdaptorTubeBulgeRo);
599   z += kCP3AdaptorTubeBulgeLength;
600   shCp3AtV->DefineSection(1, z, 0., kCP3AdaptorTubeBulgeRo);
601   //  Tube
602   shCp3AtV->DefineSection(2, z, 0., kCP3AdaptorTubeRo);
603   z =  + kCP3AdaptorTubeLength / 2.;
604   shCp3AtV->DefineSection(3, z, 0., kCP3AdaptorTubeRo);
605
606   TGeoVolume* voCp3AtV = new TGeoVolume("CP3ATV", shCp3AtV, kMedVac);
607
608   TGeoPcon* shCp3AtS = new TGeoPcon(0., 360., 4);
609   //  Bulge at transition
610   shCp3AtS->DefineSection(0, shCp3AtV->GetZ(0), kCP3AdaptorTubeBulgeRi, kCP3AdaptorTubeBulgeRo);
611   shCp3AtS->DefineSection(1, shCp3AtV->GetZ(1), kCP3AdaptorTubeBulgeRi, kCP3AdaptorTubeBulgeRo);
612   //  Tube
613   shCp3AtS->DefineSection(2, shCp3AtV->GetZ(2), kCP3AdaptorTubeRi,      kCP3AdaptorTubeRo);
614   shCp3AtS->DefineSection(3, shCp3AtV->GetZ(3), kCP3AdaptorTubeRi ,     kCP3AdaptorTubeRo);
615   TGeoVolume* voCp3AtS = new TGeoVolume("CP3ATS", shCp3AtS, kMedSteel);
616
617   voCp3AtV->AddNode(voCp3AtS, 1, gGeoIdentity);
618   dz = - kCP3Length / 2. +  kCP3AdaptorTubeLength / 2.;
619   voCp3Mo->AddNode(voCp3AtV, 1, new TGeoTranslation(0., 0., dz));
620
621   /////////////////////////////////
622   // CP/3 Bellow section         //
623   /////////////////////////////////
624
625   //
626   //  Upper part of the undulation
627   TGeoTorus* plieTorusUO =  new TGeoTorus(kCP3BellowRo - kCP3PlieR, 0. , kCP3PlieR);
628   plieTorusUO->SetName("TorusUO");
629   TGeoTorus* plieTorusUI =  new TGeoTorus(kCP3BellowRo - kCP3PlieR, kCP3PlieR - kCP3PlieThickness, kCP3PlieR);
630   plieTorusUI->SetName("TorusUI");
631   TGeoTube*  plieTubeU   =  new TGeoTube (kCP3BellowRo - kCP3PlieR, kCP3BellowRo, kCP3PlieR);
632   plieTubeU->SetName("TubeU");
633     
634   TGeoCompositeShape*  shUpperPlieO = new TGeoCompositeShape("upperPlieO", "TorusUO*TubeU");
635   TGeoCompositeShape*  shUpperPlieI = new TGeoCompositeShape("upperPlieI", "TorusUI*TubeU");
636  
637   TGeoVolume* voWiggleUO = new TGeoVolume("CP3WUO", shUpperPlieO, kMedVac);
638   TGeoVolume* voWiggleUI = new TGeoVolume("CP3WUI", shUpperPlieI, kMedSteel);
639   voWiggleUO->AddNode(voWiggleUI, 1,  gGeoIdentity);    
640   //
641   // Lower part of the undulation
642   TGeoTorus* plieTorusLO =  new TGeoTorus(kCP3BellowRi + kCP3PlieR, 0. , kCP3PlieR);
643   plieTorusLO->SetName("TorusLO");
644   TGeoTorus* plieTorusLI =  new TGeoTorus(kCP3BellowRi + kCP3PlieR, kCP3PlieR - kCP3PlieThickness, kCP3PlieR);
645   plieTorusLI->SetName("TorusLI");
646   TGeoTube*  plieTubeL   =  new TGeoTube (kCP3BellowRi, kCP3BellowRi + kCP3PlieR, kCP3PlieR);
647   plieTubeL->SetName("TubeL");
648
649   TGeoCompositeShape*  shLowerPlieO = new TGeoCompositeShape("lowerPlieO", "TorusLO*TubeL");
650   TGeoCompositeShape*  shLowerPlieI = new TGeoCompositeShape("lowerPlieI", "TorusLI*TubeL");
651
652   TGeoVolume* voWiggleLO = new TGeoVolume("CP3WLO", shLowerPlieO, kMedVac);
653   TGeoVolume* voWiggleLI = new TGeoVolume("CP3WLI", shLowerPlieI, kMedSteel);
654   voWiggleLO->AddNode(voWiggleLI, 1,  gGeoIdentity);    
655
656   //
657   // Connection between upper and lower part of undulation
658   TGeoVolume* voWiggleC1 = new TGeoVolume("Q3WCO1",  
659                                           new TGeoTube(kCP3BellowRi + kCP3PlieR, kCP3BellowRo - kCP3PlieR, kCP3PlieThickness / 2.),
660                                           kMedSteel);
661   TGeoVolume* voWiggleC2 = new TGeoVolume("Q3WCO2",  
662                                           new TGeoTube(kCP3BellowRi + kCP3ConnectionPlieR, kCP3BellowRo - kCP3PlieR, kCP3PlieThickness / 2.),
663                                           kMedSteel);
664   //
665   // Conncetion between undulated section and beam pipe
666   TGeoTorus* plieTorusCO =  new TGeoTorus(kCP3BellowRi + kCP3ConnectionPlieR, 0. , kCP3ConnectionPlieR);
667   plieTorusCO->SetName("TorusCO");
668   TGeoTorus* plieTorusCI =  new TGeoTorus(kCP3BellowRi + kCP3ConnectionPlieR, kCP3ConnectionPlieR - kCP3PlieThickness, kCP3ConnectionPlieR);
669   plieTorusCI->SetName("TorusCI");
670   TGeoTube*  plieTubeC   =  new TGeoTube (kCP3BellowRi, kCP3BellowRi + kCP3ConnectionPlieR, kCP3ConnectionPlieR);
671   plieTubeC->SetName("TubeC");
672
673   TGeoCompositeShape*  shConnectionPlieO = new TGeoCompositeShape("connectionPlieO", "TorusCO*TubeC");
674   TGeoCompositeShape*  shConnectionPlieI = new TGeoCompositeShape("connectionPlieI", "TorusCI*TubeC");
675
676   TGeoVolume* voConnectionPO = new TGeoVolume("CP3CPO", shConnectionPlieO, kMedVac);
677   TGeoVolume* voConnectionPI = new TGeoVolume("CP3CPI", shConnectionPlieI, kMedSteel);
678   voConnectionPO->AddNode(voConnectionPI, 1,  gGeoIdentity);    
679   //
680   // Connecting pipes
681   TGeoVolume* voConnectionPipeO = new TGeoVolume("CP3BECO",  
682                                                  new TGeoTube(0., kCP3AdaptorTubeRo, kCP3BellowConnectionLength / 2.),
683                                                  kMedVac);
684   TGeoVolume* voConnectionPipeI = new TGeoVolume("CP3BECI",  
685                                                  new TGeoTube(kCP3AdaptorTubeRi, kCP3AdaptorTubeRo, kCP3BellowConnectionLength / 2.),
686                                                  kMedSteel);
687     
688   voConnectionPipeO->AddNode(voConnectionPipeI, 1,  gGeoIdentity);
689     
690   //
691   // Bellow mother
692   TGeoPcon* shBellowMotherPC = new TGeoPcon(0., 360., 6);
693   dz =  - kCP3BellowLength / 2;
694   shBellowMotherPC->DefineSection(0, dz, 0.,  kCP3AdaptorTubeRo);
695   dz +=  kCP3BellowConnectionLength;
696   shBellowMotherPC->DefineSection(1, dz, 0.,  kCP3AdaptorTubeRo);
697   shBellowMotherPC->DefineSection(2, dz, 0.,  kCP3BellowRo);
698   dz =  kCP3BellowLength /2. -  kCP3BellowConnectionLength;;
699   shBellowMotherPC->DefineSection(3, dz, 0.,  kCP3BellowRo);
700   shBellowMotherPC->DefineSection(4, dz, 0.,  kCP3AdaptorTubeRo);
701   dz +=  kCP3BellowConnectionLength;
702   shBellowMotherPC->DefineSection(5, dz, 0.,  kCP3AdaptorTubeRo);
703
704   TGeoVolume* voBellowMother = new TGeoVolume("CP3BeMO", shBellowMotherPC, kMedVac);
705   voBellowMother->SetVisibility(0);
706     
707   //
708   // Add undulations
709   z0   =  - kCP3BellowLength / 2. +  kCP3BellowConnectionLength + 2. * kCP3ConnectionPlieR - kCP3PlieThickness;
710   zsh  = 4. *  kCP3PlieR -  2. * kCP3PlieThickness;
711   for (Int_t iw = 0; iw < 18; iw++) {
712     Float_t zpos =  z0 + iw * zsh;      
713     if (iw > 0) 
714       voBellowMother->AddNode(voWiggleC1,  iw + 1 , new TGeoTranslation(0., 0., zpos + kCP3PlieThickness / 2.));        
715     else
716       voBellowMother->AddNode(voWiggleC2,  iw + 1 , new TGeoTranslation(0., 0., zpos + kCP3PlieThickness / 2.));        
717
718     zpos += kCP3PlieR;
719     voBellowMother->AddNode(voWiggleUO, iw + 1,  new TGeoTranslation(0., 0., zpos));    
720
721     zpos += kCP3PlieR;
722     if (iw < 17) 
723       voBellowMother->AddNode(voWiggleC1,  iw + 19, new TGeoTranslation(0., 0., zpos - kCP3PlieThickness / 2.));
724     else
725       voBellowMother->AddNode(voWiggleC2,  iw + 19, new TGeoTranslation(0., 0., zpos - kCP3PlieThickness / 2.));
726
727     if (iw < 17) {
728       zpos += kCP3PlieR;
729       voBellowMother->AddNode(voWiggleLO, iw + 1, new TGeoTranslation(0., 0., zpos -  kCP3PlieThickness));
730     }
731   }
732   //
733   // Add connecting undulation between bellow and connecting pipe
734   dz = - kCP3BellowUndulatedLength / 2. + kCP3ConnectionPlieR;
735   voBellowMother->AddNode(voConnectionPO, 1,  new TGeoTranslation(0., 0.,  dz));
736   voBellowMother->AddNode(voConnectionPO, 2,  new TGeoTranslation(0., 0., -dz));
737   //
738   // Add connecting pipe
739   dz =  - kCP3BellowLength / 2. +  kCP3BellowConnectionLength / 2.;
740   voBellowMother->AddNode(voConnectionPipeO, 1,  new TGeoTranslation(0., 0.,   dz));
741   voBellowMother->AddNode(voConnectionPipeO, 2,  new TGeoTranslation(0., 0.,  -dz));
742   //
743   // Add bellow to CP/3 mother    
744   dz = - kCP3Length / 2. +  kCP3AdaptorTubeLength +  kCP3BellowLength / 2.;
745   voCp3Mo->AddNode(voBellowMother, 1,  new TGeoTranslation(0., 0., dz));
746   dz += (kCP3BellowLength +  kCP3TubeLength);
747   voCp3Mo->AddNode(voBellowMother, 2,  new TGeoTranslation(0., 0., dz));
748
749
750   ///////////////////////////////////////////
751   // Beam pipe section between bellows     //
752   ///////////////////////////////////////////
753
754   TGeoVolume* voCp3Bco = new TGeoVolume("CP3BCO",
755                                         new TGeoTube(0.,  kCP3AdaptorTubeRo,  kCP3TubeLength / 2.),
756                                         kMedVac);
757    
758   TGeoVolume* voCp3Bci = new TGeoVolume("CP3BCI",
759                                         new TGeoTube(kCP3AdaptorTubeRi, kCP3AdaptorTubeRo, kCP3TubeLength / 2.), 
760                                         kMedSteel);
761     
762   voCp3Bco->AddNode(voCp3Bci, 1, gGeoIdentity);
763   dz = - kCP3Length / 2. +   kCP3AdaptorTubeLength +  kCP3BellowLength +  kCP3TubeLength / 2.;
764   voCp3Mo->AddNode(voCp3Bco, 1, new TGeoTranslation(0., 0., dz));
765
766
767   ///////////////////////////////////////////             
768   // CP3 Minimised Flange                  //
769   ///////////////////////////////////////////
770
771   TGeoPcon* shCp3mfo = new TGeoPcon(0., 360., 4);
772   z = - (kCP3FlangeConnectorLength + kCP3FlangeLength) / 2.;
773   //  Connection Tube
774   shCp3mfo->DefineSection(0, z, 0., kCP3AdaptorTubeRo);
775   z +=  kCP3FlangeConnectorLength;
776   shCp3mfo->DefineSection(1, z, 0., kCP3AdaptorTubeRo);
777   //  Flange
778   shCp3mfo->DefineSection(2, z, 0., kCP3FlangeRo);
779   z = - shCp3mfo->GetZ(0);
780   shCp3mfo->DefineSection(3, z, 0., kCP3FlangeRo);
781
782   TGeoVolume* voCp3mfo = new TGeoVolume("CP3MFO", shCp3mfo, kMedVac);
783
784
785   TGeoPcon* shCp3mfi = new TGeoPcon(0., 360., 4);
786   //  Connection Tube
787   shCp3mfi->DefineSection(0, shCp3mfo->GetZ(0), kCP3AdaptorTubeRi, kCP3AdaptorTubeRo);
788   shCp3mfi->DefineSection(1, shCp3mfo->GetZ(1), kCP3AdaptorTubeRi, kCP3AdaptorTubeRo);
789   //  Flange
790   shCp3mfi->DefineSection(2, shCp3mfo->GetZ(2), kCP3AdaptorTubeRi, kCP3FlangeRo);
791   shCp3mfi->DefineSection(3, shCp3mfo->GetZ(3), kCP3AdaptorTubeRi, kCP3FlangeRo);
792
793   TGeoVolume* voCp3mfi = new TGeoVolume("CP3MFI", shCp3mfi, kMedSteel);
794
795   voCp3mfo->AddNode(voCp3mfi, 1, gGeoIdentity);
796   dz =  kCP3Length / 2. - (kCP3FlangeConnectorLength + kCP3FlangeLength) / 2.;
797   voCp3Mo->AddNode(voCp3mfo, 1, new TGeoTranslation(0., 0., dz));
798
799
800   /*
801   //
802   //  Assemble the central beam pipe
803   //
804   TGeoVolumeAssembly* asCP = new TGeoVolumeAssembly("CP");
805   z = 0.;
806   // asCP->AddNode(voCp2,   1, gGeoIdentity);
807   z +=  kCP2Length / 2. + kCP1Length / 2.;
808   //asCP->AddNode(voCp1, 1, new TGeoTranslation(0., 0., z));
809   
810   asCP->AddNode(voCp1, 1, new TGeoTranslation(0., 0., 0.));
811     
812   z +=  kCP1Length / 2.  + kCP3Length / 2.;
813   // asCP->AddNode(voCp3, 1, new TGeoTranslation(0., 0., z));
814   top->AddNode(asCP, 1,  new TGeoCombiTrans(0., 0., 400. -  kCP2Length / 2, rot180));
815
816   */
817
818
819   ////////////////////////////////////////////////////////////////////////////////     
820   //                                                                            //
821   //                                  RB24/1                                    // 
822   //                                                                            //
823   ////////////////////////////////////////////////////////////////////////////////
824   //
825   //
826   // Drawing LHCVC2U_0001
827   // Copper Tube RB24/1      393.5 cm 
828   // Warm module VMACA        18.0 cm
829   // Annular Ion Pump         35.0 cm
830   // Valve                     7.5 cm
831   // Warm module VMABC        28.0 cm
832   // ================================
833   //                         462.0 cm
834   //
835
836     
837   // Copper Tube RB24/1
838   const Float_t  kRB24CuTubeL   = 393.5;
839   const Float_t  kRB24CuTubeRi  = 8.0/2.;
840   const Float_t  kRB24CuTubeRo  = 8.4/2.;
841   const Float_t  kRB24CuTubeFRo = 7.6;
842   const Float_t  kRB24CuTubeFL  = 1.86;
843
844   TGeoVolume* voRB24CuTubeM = new TGeoVolume("voRB24CuTubeM", 
845                                              new TGeoTube(0., kRB24CuTubeRo, kRB24CuTubeL/2.), kMedVac);
846   voRB24CuTubeM->SetVisibility(0);
847   TGeoVolume* voRB24CuTube  = new TGeoVolume("voRB24CuTube", 
848                                              new TGeoTube(kRB24CuTubeRi, kRB24CuTubeRo, kRB24CuTubeL/2.), kMedCu);
849   voRB24CuTubeM->AddNode(voRB24CuTube, 1, gGeoIdentity);
850   // Air outside tube with higher transport cuts
851   TGeoVolume* voRB24CuTubeA  = new TGeoVolume("voRB24CuTubeA", 
852                                               new TGeoTube(25., 100., kRB24CuTubeL/2.), kMedAirHigh);
853   voRB24CuTubeA->SetVisibility(0);
854   // Simplified DN 100 Flange
855   TGeoVolume* voRB24CuTubeF = new TGeoVolume("voRB24CuTubeF", 
856                                              new TGeoTube(kRB24CuTubeRo, kRB24CuTubeFRo, kRB24CuTubeFL/2.), kMedSteel);
857
858   // Warm Module Type VMACA
859   // LHCVMACA_0002
860   // 
861   // Pos 1 Warm Bellows DN100       LHCVBU__0012
862   // Pos 2 RF Contact   D80         LHCVSR__0005
863   // Pos 3 Trans. Tube Flange       LHCVSR__0065
864   // [Pos 4 Hex. Countersunk Screw   Bossard BN4719]
865   // [Pos 5 Tension spring           LHCVSR__0011]
866   //
867   //
868   //
869   // Pos1    Warm Bellows DN100
870   // Pos1.1  Bellows                  LHCVBU__0006
871   //
872   //
873   // Connection Tubes    
874   // Connection tube inner r
875   const Float_t kRB24B1ConTubeRin        = 10.0/2.;
876   // Connection tube outer r
877   const Float_t kRB24B1ConTubeRou        = 10.3/2.;
878   // Connection tube length
879   const Float_t kRB24B1ConTubeL          =  2.5;
880   // 
881   const Float_t kRB24B1CompL             = 16.00;    // Length of the compensator
882   const Float_t kRB24B1BellowRi          = 10.25/2.; // Bellow inner radius        
883   const Float_t kRB24B1BellowRo          = 11.40/2.; // Bellow outer radius        
884   const Int_t   kRB24B1NumberOfPlies     = 27;       // Number of plies            
885   const Float_t kRB24B1BellowUndL        = 11.00;    // Length of undulated region 
886   const Float_t kRB24B1PlieThickness     =  0.015;   // Plie thickness             
887
888   const Float_t kRB24B1PlieRadius = 
889     (kRB24B1BellowUndL + (2. *  kRB24B1NumberOfPlies - 2.) * kRB24B1PlieThickness) / (4. * kRB24B1NumberOfPlies);
890     
891   const Float_t kRB24B1ProtTubeThickness = 0.02;     // Thickness of the protection tube
892   const Float_t kRB24B1ProtTubeLength    = 4.2;      // Length of the protection tube
893
894   const Float_t kRB24B1RFlangeL          = 1.86;     // Length of the flanges
895   const Float_t kRB24B1RFlangeLO         = 0.26;     // Flange overlap
896   const Float_t kRB24B1RFlangeRO         = 11.18/2;  // Inner radius at Flange overlap    
897   const Float_t kRB24B1RFlangeRou        = 15.20/2.; // Outer radius of flange
898   const Float_t kRB24B1RFlangeRecess     = 0.98;     // Flange recess
899   const Float_t kRB24B1L                 = kRB24B1CompL +  2. * (kRB24B1RFlangeL - kRB24B1RFlangeRecess);
900     
901   ///      
902   //
903   // Bellow mother volume
904   TGeoPcon* shRB24B1BellowM = new TGeoPcon(0., 360., 14);
905   // Connection Tube and Flange
906   z = 0.;
907   shRB24B1BellowM->DefineSection( 0, z, 0.,               kRB24B1RFlangeRou);
908   z += kRB24B1RFlangeLO;
909   shRB24B1BellowM->DefineSection( 1, z, 0.,               kRB24B1RFlangeRou);
910   shRB24B1BellowM->DefineSection( 2, z, 0.,               kRB24B1RFlangeRou);    
911   z = kRB24B1RFlangeL;
912   shRB24B1BellowM->DefineSection( 3, z, 0.,               kRB24B1RFlangeRou);    
913   shRB24B1BellowM->DefineSection( 4, z, 0.,               kRB24B1ConTubeRou);
914   z = kRB24B1ConTubeL +  kRB24B1RFlangeL - kRB24B1RFlangeRecess;
915   shRB24B1BellowM->DefineSection( 5, z, 0.,               kRB24B1ConTubeRou);
916   // Plie
917   shRB24B1BellowM->DefineSection( 6, z, 0.,               kRB24B1BellowRo + kRB24B1ProtTubeThickness);
918   z += kRB24B1BellowUndL;
919   shRB24B1BellowM->DefineSection( 7, z, 0.,               kRB24B1BellowRo + kRB24B1ProtTubeThickness);
920   shRB24B1BellowM->DefineSection( 8, z, 0.,               kRB24B1ConTubeRou);
921   // Connection Tube and Flange
922   z = kRB24B1L - shRB24B1BellowM->GetZ(3);
923   shRB24B1BellowM->DefineSection( 9, z, 0.,               kRB24B1ConTubeRou);
924   shRB24B1BellowM->DefineSection(10, z, 0.,               kRB24B1RFlangeRou);
925   z = kRB24B1L - shRB24B1BellowM->GetZ(1);
926   shRB24B1BellowM->DefineSection(11, z, 0.,               kRB24B1RFlangeRou);
927   shRB24B1BellowM->DefineSection(12, z, 0.,               kRB24B1RFlangeRou);
928   z = kRB24B1L - shRB24B1BellowM->GetZ(0);
929   shRB24B1BellowM->DefineSection(13, z, 0.,               kRB24B1RFlangeRou);
930
931   TGeoVolume* voRB24B1BellowM = new TGeoVolume("RB24B1BellowM", shRB24B1BellowM, kMedVac);
932   voRB24B1BellowM->SetVisibility(0);
933   //
934   // Bellow Section    
935   TGeoVolume* voRB24B1Bellow 
936     = MakeBellow("RB24B1", kRB24B1NumberOfPlies, kRB24B1BellowRi, kRB24B1BellowRo, 
937                  kRB24B1BellowUndL, kRB24B1PlieRadius ,kRB24B1PlieThickness);
938   voRB24B1Bellow->SetVisibility(0);
939     
940   //
941   // End Parts (connection tube)
942   TGeoVolume* voRB24B1CT = new TGeoVolume("RB24B1CT", new TGeoTube(kRB24B1ConTubeRin, kRB24B1ConTubeRou,  kRB24B1ConTubeL/2.), kMedSteel); 
943   //
944   // Protection Tube      
945   TGeoVolume* voRB24B1PT = new TGeoVolume("RB24B1PT", new TGeoTube(kRB24B1BellowRo, kRB24B1BellowRo + kRB24B1ProtTubeThickness,  
946                                                                    kRB24B1ProtTubeLength / 2.), kMedSteel);
947     
948   z = kRB24B1ConTubeL/2. +  (kRB24B1RFlangeL - kRB24B1RFlangeRecess);
949     
950   voRB24B1BellowM->AddNode(voRB24B1CT, 1, new TGeoTranslation(0., 0., z));
951   z += (kRB24B1ConTubeL/2.+ kRB24B1BellowUndL/2.);
952   voRB24B1BellowM->AddNode(voRB24B1Bellow, 1, new TGeoTranslation(0., 0., z));
953   z += (kRB24B1BellowUndL/2. + kRB24B1ConTubeL/2);
954   voRB24B1BellowM->AddNode(voRB24B1CT, 2, new TGeoTranslation(0., 0., z));
955   z =  kRB24B1ConTubeL +  kRB24B1ProtTubeLength / 2. + 1. + kRB24B1RFlangeLO;
956   voRB24B1BellowM->AddNode(voRB24B1PT, 1, new TGeoTranslation(0., 0., z));
957   z +=  kRB24B1ProtTubeLength + 0.6;
958   voRB24B1BellowM->AddNode(voRB24B1PT, 2, new TGeoTranslation(0., 0., z));
959
960                  
961
962   // Pos 1/2 Rotatable Flange         LHCVBU__0013
963   // Pos 1/3 Flange DN100/103         LHCVBU__0018
964   // The two flanges can be represented by the same volume
965   // Outer Radius (including the outer movable ring).
966   // The inner ring has a diameter of 12.04 cm
967
968   
969   TGeoPcon* shRB24B1RFlange = new TGeoPcon(0., 360., 10);
970   z = 0.;
971   shRB24B1RFlange->DefineSection(0, z, 10.30/2., kRB24B1RFlangeRou);
972   z += 0.55;  // 5.5 mm added for outer ring
973   z += 0.43;
974   shRB24B1RFlange->DefineSection(1, z, 10.30/2., kRB24B1RFlangeRou);
975   shRB24B1RFlange->DefineSection(2, z, 10.06/2., kRB24B1RFlangeRou);    
976   z += 0.15;
977   shRB24B1RFlange->DefineSection(3, z, 10.06/2., kRB24B1RFlangeRou);    
978   // In reality this part is rounded
979   shRB24B1RFlange->DefineSection(4, z, 10.91/2., kRB24B1RFlangeRou);    
980   z += 0.15;
981   shRB24B1RFlange->DefineSection(5, z, 10.91/2., kRB24B1RFlangeRou);    
982   shRB24B1RFlange->DefineSection(6, z, 10.06/2., kRB24B1RFlangeRou);    
983   z += 0.32;
984   shRB24B1RFlange->DefineSection(7, z, 10.06/2., kRB24B1RFlangeRou);    
985   shRB24B1RFlange->DefineSection(8, z, kRB24B1RFlangeRO, kRB24B1RFlangeRou);    
986   z += kRB24B1RFlangeLO;
987   shRB24B1RFlange->DefineSection(9, z, kRB24B1RFlangeRO, kRB24B1RFlangeRou);    
988     
989   TGeoVolume* voRB24B1RFlange = new TGeoVolume("RB24B1RFlange", shRB24B1RFlange, kMedSteel);
990
991     
992   z = kRB24B1L - kRB24B1RFlangeL;
993   voRB24B1BellowM->AddNode(voRB24B1RFlange, 1, new TGeoTranslation(0., 0., z));
994   z = kRB24B1RFlangeL;
995   voRB24B1BellowM->AddNode(voRB24B1RFlange, 2, new TGeoCombiTrans(0., 0., z, rot180));
996   //
997   // Pos 2 RF Contact   D80         LHCVSR__0005
998   //
999   // Pos 2.1 RF Contact Flange      LHCVSR__0003
1000   //
1001   TGeoPcon* shRB24B1RCTFlange = new TGeoPcon(0., 360., 6);
1002   const Float_t kRB24B1RCTFlangeRin  = 8.06/2. + 0.05;  // Inner radius
1003   const Float_t kRB24B1RCTFlangeL    = 1.45;            // Length
1004     
1005   z = 0.;
1006   shRB24B1RCTFlange->DefineSection(0, z, kRB24B1RCTFlangeRin,  8.20/2.);
1007   z += 0.15;
1008   shRB24B1RCTFlange->DefineSection(1, z, kRB24B1RCTFlangeRin,  8.20/2.);
1009   shRB24B1RCTFlange->DefineSection(2, z, kRB24B1RCTFlangeRin,  8.60/2.);
1010   z += 1.05;
1011   shRB24B1RCTFlange->DefineSection(3, z, kRB24B1RCTFlangeRin,  8.60/2.);
1012   shRB24B1RCTFlange->DefineSection(4, z, kRB24B1RCTFlangeRin, 11.16/2.);
1013   z += 0.25;
1014   shRB24B1RCTFlange->DefineSection(5, z, kRB24B1RCTFlangeRin, 11.16/2.);
1015   TGeoVolume* voRB24B1RCTFlange = new TGeoVolume("RB24B1RCTFlange", shRB24B1RCTFlange, kMedCu);
1016   z = kRB24B1L - kRB24B1RCTFlangeL;
1017     
1018   voRB24B1BellowM->AddNode(voRB24B1RCTFlange, 1, new TGeoTranslation(0., 0., z));
1019   //
1020   // Pos 2.2 RF-Contact        LHCVSR__0004
1021   //
1022   TGeoPcon* shRB24B1RCT = new TGeoPcon(0., 360., 3);
1023   const Float_t kRB24B1RCTRin  = 8.00/2.;        // Inner radius
1024   const Float_t kRB24B1RCTCRin = 8.99/2.;        // Max. inner radius conical section
1025   const Float_t kRB24B1RCTL    = 11.78;          // Length
1026   const Float_t kRB24B1RCTSL   = 10.48;          // Length of straight section
1027   const Float_t kRB24B1RCTd    =  0.03;          // Thickness
1028     
1029   z = 0;
1030   shRB24B1RCT->DefineSection(0, z,  kRB24B1RCTCRin,  kRB24B1RCTCRin + kRB24B1RCTd);
1031   z =  kRB24B1RCTL -  kRB24B1RCTSL;
1032   // In the (VSR0004) this section is straight in (LHCVC2U_0001) it is conical ????
1033   shRB24B1RCT->DefineSection(1, z,  kRB24B1RCTRin + 0.35,  kRB24B1RCTRin + 0.35 + kRB24B1RCTd);
1034   z = kRB24B1RCTL - 0.03;
1035   shRB24B1RCT->DefineSection(2, z,  kRB24B1RCTRin,  kRB24B1RCTRin + kRB24B1RCTd);
1036
1037   TGeoVolume* voRB24B1RCT = new TGeoVolume("RB24B1RCT", shRB24B1RCT, kMedCu);
1038   z = kRB24B1L - kRB24B1RCTL - 0.45;
1039   voRB24B1BellowM->AddNode(voRB24B1RCT, 1, new TGeoTranslation(0., 0., z));    
1040
1041   //
1042   // Pos 3 Trans. Tube Flange       LHCVSR__0065
1043   //
1044   // Pos 3.1 Transition Tube D53    LHCVSR__0064
1045   // Pos 3.2 Transition Flange      LHCVSR__0060
1046   // Pos 3.3 Transition Tube        LHCVSR__0058
1047   TGeoPcon* shRB24B1TTF = new TGeoPcon(0., 360., 7);
1048   // Flange
1049   z = 0.;
1050   shRB24B1TTF->DefineSection(0, z,  6.30/2., 11.16/2.);
1051   z += 0.25;
1052   shRB24B1TTF->DefineSection(1, z,  6.30/2., 11.16/2.);
1053   shRB24B1TTF->DefineSection(2, z,  6.30/2.,  9.3/2.);
1054   z += 0.55;
1055   shRB24B1TTF->DefineSection(3, z,  6.30/2.,  9.3/2.);
1056   // Tube
1057   shRB24B1TTF->DefineSection(4, z,  6.30/2.,  6.7/2.);
1058   z += 5.80;
1059   shRB24B1TTF->DefineSection(5, z,  6.30/2.,  6.7/2.);
1060   // Transition Tube
1061   z += 3.75;
1062   shRB24B1TTF->DefineSection(6, z,  8.05/2.,  8.45/2.);
1063   TGeoVolume* voRB24B1TTF = new TGeoVolume("RB24B1TTF", shRB24B1TTF, kMedSteel);
1064   z =  0.;
1065   voRB24B1BellowM->AddNode(voRB24B1TTF, 1, new TGeoTranslation(0., 0., z));    
1066
1067   // Annular Ion Pump        
1068   // LHCVC2U_0003
1069   //
1070   // Pos  1 Rotable Flange         LHCVFX__0031
1071   // Pos  2 RF Screen Tube         LHCVC2U_0005
1072   // Pos  3 Shell                  LHCVC2U_0007
1073   // Pos  4 Extruded Shell         LHCVC2U_0006
1074   // Pos  5 Feedthrough Tube       LHCVC2U_0004
1075   // Pos  6 Tubulated Flange       STDVFUHV0021
1076   // Pos  7 Fixed Flange           LHCVFX__0032
1077   // Pos  8 Pumping Elements
1078
1079   //
1080   // Pos 1 Rotable Flange          LHCVFX__0031
1081   // pos 7 Fixed Flange            LHCVFX__0032
1082   //
1083   //  Mother volume
1084   const Float_t kRB24AIpML = 35.;
1085     
1086   TGeoVolume* voRB24AIpM = new TGeoVolume("voRB24AIpM", new TGeoTube(0., 10., kRB24AIpML/2.), kMedAir);
1087   voRB24AIpM->SetVisibility(0);
1088     
1089   //
1090   // Length 35 cm
1091   // Flange 2 x 1.98 =   3.96
1092   // Tube            =  32.84
1093   //==========================
1094   //                    36.80
1095   // Overlap 2 * 0.90 =  1.80
1096                         
1097   const Float_t kRB24IpRFD1     =  0.68;    // Length of section 1
1098   const Float_t kRB24IpRFD2     =  0.30;    // Length of section 2                                                   
1099   const Float_t kRB24IpRFD3     =  0.10;    // Length of section 3                                                         
1100   const Float_t kRB24IpRFD4     =  0.35;    // Length of section 4                                                         
1101   const Float_t kRB24IpRFD5     =  0.55;    // Length of section 5                                                         
1102     
1103   const Float_t kRB24IpRFRo     = 15.20/2.; // Flange outer radius 
1104   const Float_t kRB24IpRFRi1    =  6.30/2.; // Flange inner radius section 1
1105   const Float_t kRB24IpRFRi2    =  6.00/2.; // Flange inner radius section 2
1106   const Float_t kRB24IpRFRi3    =  5.84/2.; // Flange inner radius section 3    
1107   const Float_t kRB24IpRFRi4    =  6.00/2.; // Flange inner radius section 1
1108   const Float_t kRB24IpRFRi5    = 10.50/2.; // Flange inner radius section 2
1109
1110   TGeoPcon* shRB24IpRF = new TGeoPcon(0., 360., 9);
1111   z0 = 0.;
1112   shRB24IpRF->DefineSection(0, z0, kRB24IpRFRi1, kRB24IpRFRo);
1113   z0 += kRB24IpRFD1;
1114   shRB24IpRF->DefineSection(1, z0, kRB24IpRFRi2, kRB24IpRFRo);
1115   z0 += kRB24IpRFD2;
1116   shRB24IpRF->DefineSection(2, z0, kRB24IpRFRi2, kRB24IpRFRo);
1117   shRB24IpRF->DefineSection(3, z0, kRB24IpRFRi3, kRB24IpRFRo);
1118   z0 += kRB24IpRFD3;
1119   shRB24IpRF->DefineSection(4, z0, kRB24IpRFRi3, kRB24IpRFRo);
1120   shRB24IpRF->DefineSection(5, z0, kRB24IpRFRi4, kRB24IpRFRo);
1121   z0 += kRB24IpRFD4;
1122   shRB24IpRF->DefineSection(6, z0, kRB24IpRFRi4, kRB24IpRFRo);
1123   shRB24IpRF->DefineSection(7, z0, kRB24IpRFRi5, kRB24IpRFRo);
1124   z0 += kRB24IpRFD5;
1125   shRB24IpRF->DefineSection(8, z0, kRB24IpRFRi5, kRB24IpRFRo);
1126
1127   TGeoVolume* voRB24IpRF = new TGeoVolume("RB24IpRF", shRB24IpRF, kMedSteel);
1128     
1129   //
1130   // Pos  2 RF Screen Tube         LHCVC2U_0005
1131   //
1132
1133   //
1134   // Tube
1135   Float_t kRB24IpSTTL  = 32.84;            // Total length of the tube
1136   Float_t kRB24IpSTTRi =  5.80/2.;         // Inner Radius
1137   Float_t kRB24IpSTTRo =  6.00/2.;         // Outer Radius
1138   TGeoVolume* voRB24IpSTT = new TGeoVolume("RB24IpSTT", new TGeoTube(kRB24IpSTTRi, kRB24IpSTTRo, kRB24IpSTTL/2.), kMedSteel);
1139   // Screen
1140   Float_t kRB24IpSTCL  =  0.4;             // Lenth of the crochet detail
1141   // Length of the screen 
1142   Float_t kRB24IpSTSL  =  9.00 - 2. * kRB24IpSTCL; 
1143   // Rel. position of the screen 
1144   Float_t kRB24IpSTSZ  =  7.00 + kRB24IpSTCL; 
1145   TGeoVolume* voRB24IpSTS = new TGeoVolume("RB24IpSTS", new TGeoTube(kRB24IpSTTRi, kRB24IpSTTRo, kRB24IpSTSL/2.), kMedSteel);
1146   // Vacuum
1147   TGeoVolume* voRB24IpSTV = new TGeoVolume("RB24IpSTV", new TGeoTube(0., kRB24IpSTTRi, kRB24AIpML/2.), kMedVac);
1148   //
1149   voRB24IpSTT->AddNode(voRB24IpSTS, 1, new TGeoTranslation(0., 0., kRB24IpSTSZ -  kRB24IpSTTL/2. +  kRB24IpSTSL/2.));
1150     
1151   // Crochets
1152   // Inner radius
1153   Float_t kRB24IpSTCRi  = kRB24IpSTTRo + 0.25;
1154   // Outer radius
1155   Float_t kRB24IpSTCRo  = kRB24IpSTTRo + 0.35;
1156   // Length of 1stsection
1157   Float_t kRB24IpSTCL1  = 0.15;
1158   // Length of 2nd section
1159   Float_t kRB24IpSTCL2  = 0.15;
1160   // Length of 3rd section
1161   Float_t kRB24IpSTCL3  = 0.10;
1162   // Rel. position of 1st Crochet
1163
1164
1165   TGeoPcon* shRB24IpSTC = new TGeoPcon(0., 360., 5);
1166   z0 = 0;
1167   shRB24IpSTC->DefineSection(0, z0, kRB24IpSTCRi, kRB24IpSTCRo);
1168   z0 += kRB24IpSTCL1;
1169   shRB24IpSTC->DefineSection(1, z0, kRB24IpSTCRi, kRB24IpSTCRo);
1170   shRB24IpSTC->DefineSection(2, z0, kRB24IpSTTRo, kRB24IpSTCRo);
1171   z0 += kRB24IpSTCL2;
1172   shRB24IpSTC->DefineSection(3, z0, kRB24IpSTTRo, kRB24IpSTCRo);
1173   z0 += kRB24IpSTCL3;
1174   shRB24IpSTC->DefineSection(4, z0, kRB24IpSTTRo, kRB24IpSTTRo + 0.001);
1175   TGeoVolume* voRB24IpSTC = new TGeoVolume("RB24IpSTC", shRB24IpSTC, kMedSteel);
1176
1177   // Pos  3 Shell                  LHCVC2U_0007
1178   // Pos  4 Extruded Shell         LHCVC2U_0006
1179   Float_t kRB24IpShellL     =  4.45;    // Length of the Shell
1180   Float_t kRB24IpShellD     =  0.10;    // Wall thickness of the shell
1181   Float_t kRB24IpShellCTRi  =  6.70/2.; // Inner radius of the connection tube
1182   Float_t kRB24IpShellCTL   =  1.56;    // Length of the connection tube
1183   Float_t kRB24IpShellCARi  = 17.80/2.; // Inner radius of the cavity
1184   Float_t kRB24IpShellCCRo  = 18.20/2.; // Inner radius at the centre
1185
1186   TGeoPcon* shRB24IpShell = new TGeoPcon(0., 360., 7);
1187   z0 = 0;
1188   shRB24IpShell->DefineSection(0, z0, kRB24IpShellCTRi, kRB24IpShellCTRi + kRB24IpShellD);
1189   z0 +=  kRB24IpShellCTL;
1190   shRB24IpShell->DefineSection(1, z0, kRB24IpShellCTRi, kRB24IpShellCTRi + kRB24IpShellD);
1191   shRB24IpShell->DefineSection(2, z0, kRB24IpShellCTRi, kRB24IpShellCARi + kRB24IpShellD);
1192   z0 += kRB24IpShellD;
1193   shRB24IpShell->DefineSection(3, z0, kRB24IpShellCARi, kRB24IpShellCARi + kRB24IpShellD);
1194   z0 = kRB24IpShellL - kRB24IpShellD;
1195   shRB24IpShell->DefineSection(4, z0, kRB24IpShellCARi, kRB24IpShellCARi + kRB24IpShellD);
1196   shRB24IpShell->DefineSection(5, z0, kRB24IpShellCARi, kRB24IpShellCCRo);
1197   z0 = kRB24IpShellL;
1198   shRB24IpShell->DefineSection(6, z0, kRB24IpShellCARi, kRB24IpShellCCRo);
1199   TGeoVolume* voRB24IpShell = new TGeoVolume("RB24IpShell", shRB24IpShell, kMedSteel);
1200     
1201   TGeoPcon* shRB24IpShellM   = MakeMotherFromTemplate(shRB24IpShell, 0, 6, kRB24IpShellCTRi , 13);
1202     
1203     
1204   for (Int_t i = 0; i < 6; i++) {
1205     z = 2. * kRB24IpShellL  - shRB24IpShellM->GetZ(5-i);
1206     Float_t rmin = shRB24IpShellM->GetRmin(5-i);
1207     Float_t rmax = shRB24IpShellM->GetRmax(5-i);
1208     shRB24IpShellM->DefineSection(7+i, z, rmin, rmax);
1209   }
1210     
1211   TGeoVolume* voRB24IpShellM = new TGeoVolume("RB24IpShellM", shRB24IpShellM, kMedVac);
1212   voRB24IpShellM->SetVisibility(0);
1213   voRB24IpShellM->AddNode(voRB24IpShell, 1, gGeoIdentity);
1214   voRB24IpShellM->AddNode(voRB24IpShell, 2, new TGeoCombiTrans(0., 0., 2. * kRB24IpShellL, rot180));
1215   //
1216   // Pos  8 Pumping Elements
1217   //
1218   //  Anode array
1219   TGeoVolume* voRB24IpPE = new TGeoVolume("voRB24IpPE", new TGeoTube(0.9, 1., 2.54/2.), kMedSteel);
1220   Float_t kRB24IpPEAR = 5.5;
1221     
1222   for (Int_t i = 0; i < 15; i++) {
1223     Float_t phi = Float_t(i) * 24.;
1224     Float_t x   =  kRB24IpPEAR * TMath::Cos(kDegRad * phi);
1225     Float_t y   =  kRB24IpPEAR * TMath::Sin(kDegRad * phi);
1226     voRB24IpShellM->AddNode(voRB24IpPE, i+1, new TGeoTranslation(x, y, kRB24IpShellL));
1227   }
1228     
1229     
1230   //
1231   //  Cathodes
1232   //
1233   // Here we could add some Ti strips
1234
1235   // Postioning of elements
1236   voRB24AIpM->AddNode(voRB24IpRF,     1, new TGeoTranslation(0., 0., -kRB24AIpML/2.));
1237   voRB24AIpM->AddNode(voRB24IpRF,     2, new TGeoCombiTrans (0., 0., +kRB24AIpML/2., rot180));
1238   voRB24AIpM->AddNode(voRB24IpSTT,    1, new TGeoTranslation(0., 0., 0.));
1239   voRB24AIpM->AddNode(voRB24IpSTV,    1, new TGeoTranslation(0., 0., 0.));
1240   voRB24AIpM->AddNode(voRB24IpShellM, 1, new TGeoTranslation(0., 0., -kRB24AIpML/2. +  8.13));
1241   voRB24AIpM->AddNode(voRB24IpSTC,    1, new TGeoTranslation(0., 0., 8.13 - kRB24AIpML/2.));
1242   voRB24AIpM->AddNode(voRB24IpSTC,    2, new TGeoCombiTrans (0., 0., 8.14 + 8.9 - kRB24AIpML/2., rot180));
1243     
1244   //
1245   // Valve
1246   // VAC Series 47 DN 63 with manual actuator
1247   //
1248   const Float_t kRB24ValveWz = 7.5;
1249   const Float_t kRB24ValveDN = 10.0/2.;
1250   //
1251   //  Body containing the valve plate
1252   //
1253   const Float_t kRB24ValveBoWx =  15.6;
1254   const Float_t kRB24ValveBoWy = (21.5 + 23.1 - 5.);
1255   const Float_t kRB24ValveBoWz =  4.6;
1256   const Float_t kRB24ValveBoD  =  0.5;
1257
1258   TGeoVolume* voRB24ValveBoM =
1259     new TGeoVolume("RB24ValveBoM", 
1260                    new TGeoBBox( kRB24ValveBoWx/2.,  kRB24ValveBoWy/2., kRB24ValveBoWz/2.), kMedAir);
1261   voRB24ValveBoM->SetVisibility(0);
1262   TGeoVolume* voRB24ValveBo =
1263     new TGeoVolume("RB24ValveBo", 
1264                    new TGeoBBox( kRB24ValveBoWx/2.,  kRB24ValveBoWy/2., kRB24ValveBoWz/2.), kMedSteel);
1265   voRB24ValveBoM->AddNode(voRB24ValveBo, 1, gGeoIdentity);
1266   //
1267   // Inner volume
1268   //
1269   TGeoVolume* voRB24ValveBoI = new TGeoVolume("RB24ValveBoI", 
1270                                               new TGeoBBox( kRB24ValveBoWx/2. -  kRB24ValveBoD,  
1271                                                             kRB24ValveBoWy/2. -  kRB24ValveBoD/2., 
1272                                                             kRB24ValveBoWz/2. -  kRB24ValveBoD), 
1273                                               kMedVac);
1274   voRB24ValveBo->AddNode(voRB24ValveBoI, 1, new TGeoTranslation(0., kRB24ValveBoD/2., 0.));
1275   //
1276   // Opening and Flanges
1277   const Float_t  kRB24ValveFlRo = 18./2.;
1278   const Float_t  kRB24ValveFlD  = 1.45;    
1279   TGeoVolume* voRB24ValveBoA = new TGeoVolume("RB24ValveBoA", 
1280                                               new TGeoTube(0., kRB24ValveDN/2., kRB24ValveBoD/2.), kMedVac);
1281   voRB24ValveBo->AddNode(voRB24ValveBoA, 1, new TGeoTranslation(0., - kRB24ValveBoWy/2. + 21.5, -kRB24ValveBoWz/2. +  kRB24ValveBoD/2.));
1282   voRB24ValveBo->AddNode(voRB24ValveBoA, 2, new TGeoTranslation(0., - kRB24ValveBoWy/2. + 21.5, +kRB24ValveBoWz/2. -  kRB24ValveBoD/2.));
1283  
1284   TGeoVolume* voRB24ValveFl  = new TGeoVolume("RB24ValveFl",  new TGeoTube(kRB24ValveDN/2.,  kRB24ValveFlRo, kRB24ValveFlD/2.), kMedSteel);
1285   TGeoVolume* voRB24ValveFlI = new TGeoVolume("RB24ValveFlI", new TGeoTube(0.,               kRB24ValveFlRo, kRB24ValveFlD/2.), kMedVac);
1286   voRB24ValveFlI->AddNode(voRB24ValveFl, 1, gGeoIdentity);
1287     
1288   //
1289   // Actuator Flange
1290   const Float_t kRB24ValveAFlWx =  18.9;
1291   const Float_t kRB24ValveAFlWy =   5.0;
1292   const Float_t kRB24ValveAFlWz =   7.7;
1293   TGeoVolume* voRB24ValveAFl = new TGeoVolume("RB24ValveAFl", new TGeoBBox(kRB24ValveAFlWx/2., kRB24ValveAFlWy/2., kRB24ValveAFlWz/2.), kMedSteel);
1294   //
1295   // Actuator Tube
1296   const Float_t kRB24ValveATRo = 9.7/2.;
1297   const Float_t kRB24ValveATH  = 16.6;
1298   TGeoVolume* voRB24ValveAT = new TGeoVolume("RB24ValveAT", new TGeoTube(kRB24ValveATRo -  2. * kRB24ValveBoD,kRB24ValveATRo,  kRB24ValveATH/2.), 
1299                                              kMedSteel);
1300   //
1301   // Manual Actuator (my best guess)
1302   TGeoVolume* voRB24ValveMA1 = new TGeoVolume("RB24ValveMA1", new TGeoCone(2.5/2., 0., 0.5, 4.5, 5.), kMedSteel);
1303   TGeoVolume* voRB24ValveMA2 = new TGeoVolume("RB24ValveMA2", new TGeoTorus(5., 0., 1.25), kMedSteel);
1304   TGeoVolume* voRB24ValveMA3 = new TGeoVolume("RB24ValveMA3", new TGeoTube (0., 1.25, 2.5), kMedSteel);
1305     
1306
1307   //
1308   // Position all volumes
1309   Float_t y0;
1310   TGeoVolumeAssembly*  voRB24ValveMo = new TGeoVolumeAssembly("RB24ValveMo");
1311   voRB24ValveMo->AddNode(voRB24ValveFl,  1, new TGeoTranslation(0., 0., - 7.5/2. + kRB24ValveFlD/2.));
1312   voRB24ValveMo->AddNode(voRB24ValveFl,  2, new TGeoTranslation(0., 0., + 7.5/2. - kRB24ValveFlD/2.));
1313   y0 = -21.5;
1314   voRB24ValveMo->AddNode(voRB24ValveBoM, 1, new TGeoTranslation(0., y0 + kRB24ValveBoWy/2.,   0.));
1315   y0 +=  kRB24ValveBoWy;
1316   voRB24ValveMo->AddNode(voRB24ValveAFl, 1, new TGeoTranslation(0., y0 +  kRB24ValveAFlWy/2., 0.));
1317   y0 +=  kRB24ValveAFlWy;
1318   voRB24ValveMo->AddNode(voRB24ValveAT,  1, new TGeoCombiTrans(0.,  y0 + kRB24ValveATH/2.,    0., rotyz));
1319   y0 += kRB24ValveATH;
1320   voRB24ValveMo->AddNode(voRB24ValveMA1, 1, new TGeoCombiTrans(0.,  y0 + 2.5/2.,    0., rotyz));
1321   y0 += 2.5;
1322   voRB24ValveMo->AddNode(voRB24ValveMA2, 1, new TGeoCombiTrans(0.,  y0 + 2.5/2.,    0., rotyz));
1323   y0 += 2.5;
1324   voRB24ValveMo->AddNode(voRB24ValveMA3, 1, new TGeoCombiTrans(5./TMath::Sqrt(2.),  y0 + 5.0/2., 5./TMath::Sqrt(2.), rotyz));
1325   //
1326   // Warm Module Type VMABC
1327   // LHCVMABC_0002
1328   // 
1329   //
1330   //
1331   // Flange                  1.00
1332   // Central Piece          11.50
1333   // Bellow                 14.50
1334   // End Flange              1.00
1335   //===================================
1336   // Total                  28.00 
1337   //                        
1338   // Pos 1 Warm Bellows DN100       LHCVBU__0016
1339   // Pos 2 Trans. Tube Flange       LHCVSR__0062
1340   // Pos 3 RF Contact   D63         LHCVSR__0057
1341   // [Pos 4 Hex. Countersunk Screw   Bossard BN4719]
1342   // [Pos 5 Tension spring           LHCVSR__00239]
1343   //
1344
1345   // Pos 1 Warm Bellows DN100                   LHCVBU__0016
1346   // Pos 1.1 Right Body 2 Ports with Support    LHCVBU__0014
1347   //
1348   // Tube 1
1349   const Float_t kRB24VMABCRBT1Ri = 10.0/2.;
1350   const Float_t kRB24VMABCRBT1Ro = 10.3/2.;
1351   const Float_t kRB24VMABCRBT1L  = 11.5;   
1352   const Float_t kRB24VMABCRBT1L2 = 8.;
1353   const Float_t kRB24VMABCL      = 28.;
1354     
1355   TGeoTube* shRB24VMABCRBT1 = new TGeoTube(kRB24VMABCRBT1Ri, kRB24VMABCRBT1Ro, kRB24VMABCRBT1L/2.);
1356   shRB24VMABCRBT1->SetName("RB24VMABCRBT1");
1357   TGeoTube* shRB24VMABCRBT1o = new TGeoTube(0., kRB24VMABCRBT1Ro,  kRB24VMABCRBT1L/2.);
1358   shRB24VMABCRBT1o->SetName("RB24VMABCRBT1o");
1359   TGeoTube* shRB24VMABCRBT1o2 = new TGeoTube(0., kRB24VMABCRBT1Ro + 0.3, kRB24VMABCRBT1L/2.);
1360   shRB24VMABCRBT1o2->SetName("RB24VMABCRBT1o2");
1361   // Lower inforcement 
1362   TGeoVolume*  voRB24VMABCRBT12  = new TGeoVolume("RB24VMABCRBT12", 
1363                                                   new TGeoTubeSeg(kRB24VMABCRBT1Ro, kRB24VMABCRBT1Ro + 0.3, kRB24VMABCRBT1L2/2., 220., 320.)
1364                                                   , kMedSteel);
1365   //
1366   // Tube 2
1367   const Float_t kRB24VMABCRBT2Ri =   6.0/2.;
1368   const Float_t kRB24VMABCRBT2Ro =   6.3/2.;
1369   const Float_t kRB24VMABCRBF2Ro =  11.4/2.;
1370   const Float_t kRB24VMABCRBT2L  =   5.95 + 2.; // 2. cm added for welding    
1371   const Float_t kRB24VMABCRBF2L  =   1.75;
1372   TGeoTube* shRB24VMABCRBT2 = new TGeoTube(kRB24VMABCRBT2Ri, kRB24VMABCRBT2Ro,  kRB24VMABCRBT2L/2.);
1373   shRB24VMABCRBT2->SetName("RB24VMABCRBT2");
1374   TGeoTube* shRB24VMABCRBT2i = new TGeoTube(0., kRB24VMABCRBT2Ri, kRB24VMABCRBT2L/2. + 2.);
1375   shRB24VMABCRBT2i->SetName("RB24VMABCRBT2i");
1376   TGeoCombiTrans* tRBT2 = new TGeoCombiTrans(-11.5 + kRB24VMABCRBT2L/2., 0., 7.2 - kRB24VMABCRBT1L/2.  , rotxz);
1377   tRBT2->SetName("tRBT2");
1378   tRBT2->RegisterYourself();
1379   TGeoCompositeShape* shRB24VMABCRBT2c =  new TGeoCompositeShape("shRB24VMABCRBT2c","RB24VMABCRBT2:tRBT2-RB24VMABCRBT1o");
1380   TGeoVolume* voRB24VMABCRBT2 = new TGeoVolume("shRB24VMABCRBT2", shRB24VMABCRBT2c, kMedSteel);
1381   // Flange
1382   // Pos 1.4 Flange DN63                        LHCVBU__0008
1383   TGeoVolume* voRB24VMABCRBF2 = new TGeoVolume("RB24VMABCRBF2", 
1384                                                new TGeoTube(kRB24VMABCRBT2Ro, kRB24VMABCRBF2Ro, kRB24VMABCRBF2L/2.), kMedSteel);
1385   // DN63 Blank Flange (my best guess)
1386   TGeoVolume* voRB24VMABCRBF2B = new TGeoVolume("RB24VMABCRBF2B", 
1387                                                 new TGeoTube(0., kRB24VMABCRBF2Ro, kRB24VMABCRBF2L/2.), kMedSteel);
1388   //
1389   // Tube 3
1390   const Float_t kRB24VMABCRBT3Ri =  3.5/2.;
1391   const Float_t kRB24VMABCRBT3Ro =  3.8/2.;
1392   const Float_t kRB24VMABCRBF3Ro =  7.0/2.;
1393   const Float_t kRB24VMABCRBT3L  =  4.95 + 2.; // 2. cm added for welding    
1394   const Float_t kRB24VMABCRBF3L  =  1.27;
1395   TGeoTube* shRB24VMABCRBT3 = new TGeoTube(kRB24VMABCRBT3Ri, kRB24VMABCRBT3Ro,  kRB24VMABCRBT3L/2);
1396   shRB24VMABCRBT3->SetName("RB24VMABCRBT3");
1397   TGeoTube* shRB24VMABCRBT3i = new TGeoTube(0., kRB24VMABCRBT3Ri, kRB24VMABCRBT3L/2. + 2.);
1398   shRB24VMABCRBT3i->SetName("RB24VMABCRBT3i");
1399   TGeoCombiTrans* tRBT3 = new TGeoCombiTrans(0., 10.5 - kRB24VMABCRBT3L/2., 7.2 - kRB24VMABCRBT1L/2.  , rotyz);
1400   tRBT3->SetName("tRBT3");
1401   tRBT3->RegisterYourself();
1402   TGeoCompositeShape* shRB24VMABCRBT3c =  new TGeoCompositeShape("shRB24VMABCRBT3c","RB24VMABCRBT3:tRBT3-RB24VMABCRBT1o");
1403   TGeoVolume* voRB24VMABCRBT3 = new TGeoVolume("shRB24VMABCRBT3", shRB24VMABCRBT3c, kMedSteel);
1404   // Flange
1405   // Pos 1.4 Flange DN35                        LHCVBU__0007
1406   TGeoVolume* voRB24VMABCRBF3 = new TGeoVolume("RB24VMABCRBF3", 
1407                                                new TGeoTube(kRB24VMABCRBT3Ro, kRB24VMABCRBF3Ro, kRB24VMABCRBF3L/2.), kMedSteel);
1408   //
1409   // Tube 4
1410   const Float_t kRB24VMABCRBT4Ri =  6.0/2.;
1411   const Float_t kRB24VMABCRBT4Ro =  6.4/2.;
1412   const Float_t kRB24VMABCRBT4L  =  6.6;    
1413   TGeoTube* shRB24VMABCRBT4 = new TGeoTube(kRB24VMABCRBT4Ri, kRB24VMABCRBT4Ro,  kRB24VMABCRBT4L/2.);
1414   shRB24VMABCRBT4->SetName("RB24VMABCRBT4");
1415   TGeoCombiTrans* tRBT4 = new TGeoCombiTrans(0.,-11.+kRB24VMABCRBT4L/2., 7.2 - kRB24VMABCRBT1L/2.  , rotyz);
1416   tRBT4->SetName("tRBT4");
1417   tRBT4->RegisterYourself();
1418   TGeoCompositeShape* shRB24VMABCRBT4c =  new TGeoCompositeShape("shRB24VMABCRBT4c","RB24VMABCRBT4:tRBT4-RB24VMABCRBT1o2");
1419   TGeoVolume* voRB24VMABCRBT4 = new TGeoVolume("shRB24VMABCRBT4", shRB24VMABCRBT4c, kMedSteel);
1420   TGeoCompositeShape* shRB24VMABCRB = new TGeoCompositeShape("shRB24VMABCRB", "RB24VMABCRBT1-(RB24VMABCRBT2i:tRBT2+RB24VMABCRBT3i:tRBT3)");
1421   TGeoVolume* voRB24VMABCRBI = new TGeoVolume("RB24VMABCRBI", shRB24VMABCRB, kMedSteel);
1422   //
1423   // Plate
1424   const Float_t kRB24VMABCRBBx = 16.0;
1425   const Float_t kRB24VMABCRBBy =  1.5;
1426   const Float_t kRB24VMABCRBBz = 15.0;
1427     
1428   // Relative position of tubes
1429   const Float_t  kRB24VMABCTz =   7.2;
1430   // Relative position of plate
1431   const Float_t  kRB24VMABCPz =   3.6;
1432   const Float_t  kRB24VMABCPy = -12.5;
1433     
1434   TGeoVolume* voRB24VMABCRBP = new TGeoVolume("RB24VMABCRBP", new TGeoBBox(kRB24VMABCRBBx/2., kRB24VMABCRBBy/2., kRB24VMABCRBBz/2.), kMedSteel);
1435   //
1436   // Pirani Gauge (my best guess)
1437   //
1438   TGeoPcon* shRB24VMABCPirani = new TGeoPcon(0., 360., 15);
1439   // DN35/16 Coupling
1440   z = 0;
1441   shRB24VMABCPirani->DefineSection( 0, z,  0.8 , kRB24VMABCRBF3Ro);
1442   z += kRB24VMABCRBF3L; // 1.3
1443   shRB24VMABCPirani->DefineSection( 1, z,  0.8 , kRB24VMABCRBF3Ro);
1444   shRB24VMABCPirani->DefineSection( 2, z,  0.8 , 1.0);
1445   // Pipe
1446   z += 2.8;
1447   shRB24VMABCPirani->DefineSection( 3, z,  0.8 , 1.0);
1448   // Flange
1449   shRB24VMABCPirani->DefineSection( 4, z,  0.8 , 1.75);
1450   z += 1.6;
1451   shRB24VMABCPirani->DefineSection( 5, z,  0.8 , 1.75);
1452   shRB24VMABCPirani->DefineSection( 6, z,  0.8 , 1.0);
1453   z += 5.2;
1454   shRB24VMABCPirani->DefineSection( 7, z,  0.8 , 1.0);
1455   shRB24VMABCPirani->DefineSection( 8, z,  0.8 , 2.5);    
1456   z += 2.0;
1457   shRB24VMABCPirani->DefineSection( 9, z,  0.80, 2.50);    
1458   shRB24VMABCPirani->DefineSection(10, z,  1.55, 1.75);    
1459   z += 5.7;
1460   shRB24VMABCPirani->DefineSection(11, z,  1.55, 1.75);    
1461   shRB24VMABCPirani->DefineSection(11, z,  0.00, 1.75);    
1462   z += 0.2;
1463   shRB24VMABCPirani->DefineSection(12, z,  0.00, 1.75);    
1464   shRB24VMABCPirani->DefineSection(13, z,  0.00, 0.75);    
1465   z += 0.5;
1466   shRB24VMABCPirani->DefineSection(14, z,  0.00, 0.75);  
1467   TGeoVolume* voRB24VMABCPirani = new TGeoVolume("RB24VMABCPirani", shRB24VMABCPirani, kMedSteel);
1468   //
1469   //
1470   // 
1471     
1472     
1473   //
1474   // Positioning of elements
1475   TGeoVolumeAssembly* voRB24VMABCRB = new TGeoVolumeAssembly("RB24VMABCRB");
1476   //
1477   voRB24VMABCRB->AddNode(voRB24VMABCRBI,   1, gGeoIdentity);
1478   // Plate
1479   voRB24VMABCRB->AddNode(voRB24VMABCRBP,   1, new TGeoTranslation(0., kRB24VMABCPy +  kRB24VMABCRBBy /2., 
1480                                                                   kRB24VMABCRBBz/2. - kRB24VMABCRBT1L/2. +  kRB24VMABCPz));
1481   // Tube 2
1482   voRB24VMABCRB->AddNode(voRB24VMABCRBT2,  1, gGeoIdentity);
1483   // Flange Tube 2
1484   voRB24VMABCRB->AddNode(voRB24VMABCRBF2,  1, new TGeoCombiTrans(kRB24VMABCPy + kRB24VMABCRBF2L/2., 0.,  kRB24VMABCTz - kRB24VMABCRBT1L/2., rotxz));
1485   // Blank Flange Tube 2
1486   voRB24VMABCRB->AddNode(voRB24VMABCRBF2B, 1, new TGeoCombiTrans(kRB24VMABCPy- kRB24VMABCRBF2L/2., 0.,  kRB24VMABCTz - kRB24VMABCRBT1L/2., rotxz));    
1487   // Tube 3
1488   voRB24VMABCRB->AddNode(voRB24VMABCRBT3,  1, gGeoIdentity);
1489   // Flange Tube 3
1490   voRB24VMABCRB->AddNode(voRB24VMABCRBF3,  1, new TGeoCombiTrans(0.,   11.2 - kRB24VMABCRBF3L/2.,  kRB24VMABCTz - kRB24VMABCRBT1L/2., rotyz));
1491   // Pirani Gauge
1492   voRB24VMABCRB->AddNode(voRB24VMABCPirani, 1, new  TGeoCombiTrans(0., 11.2,  kRB24VMABCTz - kRB24VMABCRBT1L/2., rotyz));
1493   // Tube 4
1494   voRB24VMABCRB->AddNode(voRB24VMABCRBT4,  1, gGeoIdentity);
1495   // Inforcement 
1496   voRB24VMABCRB->AddNode(voRB24VMABCRBT12, 1, new TGeoTranslation(0., 0., kRB24VMABCRBT1L2/2. - kRB24VMABCRBT1L/2. + 2.8));
1497     
1498
1499   // Pos 1.3 Bellows with end part              LHCVBU__0002
1500   //
1501   // Connection Tube    
1502   // Connection tube inner r
1503   const Float_t kRB24VMABBEConTubeRin        = 10.0/2.;
1504   // Connection tube outer r
1505   const Float_t kRB24VMABBEConTubeRou        = 10.3/2.;
1506   // Connection tube length
1507   const Float_t kRB24VMABBEConTubeL1         =  0.9;
1508   const Float_t kRB24VMABBEConTubeL2         =  2.6;
1509   //  const Float_t RB24VMABBEBellowL            =  kRB24VMABBEConTubeL1 + kRB24VMABBEConTubeL2 + kRB24B1BellowUndL;
1510     
1511   // Mother volume
1512   TGeoPcon* shRB24VMABBEBellowM = new TGeoPcon(0., 360., 6);
1513   // Connection Tube and Flange
1514   z = 0.;
1515   shRB24VMABBEBellowM->DefineSection( 0, z, kRB24VMABBEConTubeRin,  kRB24VMABBEConTubeRou);
1516   z += kRB24VMABBEConTubeL1;
1517   shRB24VMABBEBellowM->DefineSection( 1, z, kRB24VMABBEConTubeRin, kRB24VMABBEConTubeRou);
1518   shRB24VMABBEBellowM->DefineSection( 2, z, kRB24B1BellowRi,       kRB24B1BellowRo + kRB24B1ProtTubeThickness);
1519   z += kRB24B1BellowUndL;
1520   shRB24VMABBEBellowM->DefineSection( 3, z, kRB24B1BellowRi,       kRB24B1BellowRo + kRB24B1ProtTubeThickness);
1521   shRB24VMABBEBellowM->DefineSection( 4, z, kRB24VMABBEConTubeRin,  kRB24VMABBEConTubeRou);
1522   z += kRB24VMABBEConTubeL2;
1523   shRB24VMABBEBellowM->DefineSection( 5, z, kRB24VMABBEConTubeRin,  kRB24VMABBEConTubeRou);
1524   TGeoVolume* voRB24VMABBEBellowM = new TGeoVolume("RB24VMABBEBellowM", shRB24VMABBEBellowM, kMedVac);
1525   voRB24VMABBEBellowM->SetVisibility(0);
1526     
1527   //  Connection tube left
1528   TGeoVolume* voRB24VMABBECT1 = new TGeoVolume("RB24VMABBECT1", 
1529                                                new TGeoTube(kRB24VMABBEConTubeRin, kRB24VMABBEConTubeRou,kRB24VMABBEConTubeL1/2.),
1530                                                kMedSteel);
1531   //  Connection tube right
1532   TGeoVolume* voRB24VMABBECT2 = new TGeoVolume("RB24VMABBECT2", 
1533                                                new TGeoTube(kRB24VMABBEConTubeRin, kRB24VMABBEConTubeRou,kRB24VMABBEConTubeL2/2.),
1534                                                kMedSteel);
1535   z = kRB24VMABBEConTubeL1/2.;
1536   voRB24VMABBEBellowM->AddNode(voRB24VMABBECT1, 1, new TGeoTranslation(0., 0., z));
1537   z += kRB24VMABBEConTubeL1/2.;
1538   z += kRB24B1BellowUndL/2.;
1539   voRB24VMABBEBellowM->AddNode(voRB24B1Bellow, 2, new TGeoTranslation(0., 0., z));
1540   z += kRB24B1BellowUndL/2.;
1541   z += kRB24VMABBEConTubeL2/2.;
1542   voRB24VMABBEBellowM->AddNode(voRB24VMABBECT2, 1, new TGeoTranslation(0., 0., z));
1543   z += kRB24VMABBEConTubeL2/2.;
1544
1545   voRB24VMABCRB->AddNode(voRB24VMABBEBellowM, 1, new TGeoTranslation(0., 0., kRB24VMABCRBT1L/2.));
1546
1547   // Pos 1.2 Rotable flange                     LHCVBU__0013[*]
1548   // Front
1549   voRB24VMABCRB->AddNode(voRB24B1RFlange,  3, new TGeoCombiTrans(0., 0., - kRB24VMABCRBT1L/2. + 0.86, rot180));
1550   // End
1551   z =  kRB24VMABCRBT1L/2. + kRB24B1BellowUndL +kRB24VMABBEConTubeL1 +  kRB24VMABBEConTubeL2;
1552   voRB24VMABCRB->AddNode(voRB24B1RFlange,  4, new TGeoTranslation(0., 0., z - 0.86));
1553
1554
1555   // Pos 2    Trans. Tube Flange       LHCVSR__0062
1556   // Pos 2.1  Transition Tube          LHCVSR__0063
1557   // Pos 2.2  Transition Flange        LHCVSR__0060
1558   //
1559   // Transition Tube with Flange
1560   TGeoPcon* shRB24VMABCTT = new TGeoPcon(0., 360., 7);
1561   z = 0.;
1562   shRB24VMABCTT->DefineSection(0, z, 6.3/2., 11.16/2.);
1563   z += 0.25;
1564   shRB24VMABCTT->DefineSection(1, z, 6.3/2., 11.16/2.);
1565   shRB24VMABCTT->DefineSection(2, z, 6.3/2.,  9.30/2.);
1566   z += 0.25;
1567   shRB24VMABCTT->DefineSection(3, z, 6.3/2.,  9.30/2.);
1568   shRB24VMABCTT->DefineSection(4, z, 6.3/2.,  6.70/2.);
1569   z += (20.35 - 0.63);
1570   shRB24VMABCTT->DefineSection(5, z, 6.3/2.,  6.7/2.);
1571   z += 0.63;
1572   shRB24VMABCTT->DefineSection(6, z, 6.3/2.,  6.7/2.);
1573   TGeoVolume* voRB24VMABCTT = new TGeoVolume("RB24VMABCTT", shRB24VMABCTT, kMedSteel);
1574   voRB24VMABCRB->AddNode(voRB24VMABCTT, 1, new TGeoTranslation(0., 0., - kRB24VMABCRBT1L/2.-1.));
1575
1576   // Pos 3   RF Contact   D63         LHCVSR__0057
1577   // Pos 3.1 RF Contact Flange        LHCVSR__0017
1578   //
1579   TGeoPcon* shRB24VMABCCTFlange = new TGeoPcon(0., 360., 6);
1580   const Float_t kRB24VMABCCTFlangeRin  = 6.36/2.;  // Inner radius
1581   const Float_t kRB24VMABCCTFlangeL    = 1.30;     // Length
1582     
1583   z = 0.;
1584   shRB24VMABCCTFlange->DefineSection(0, z, kRB24VMABCCTFlangeRin,  6.5/2.);
1585   z += 0.15;
1586   shRB24VMABCCTFlange->DefineSection(1, z, kRB24VMABCCTFlangeRin,  6.5/2.);
1587   shRB24VMABCCTFlange->DefineSection(2, z, kRB24VMABCCTFlangeRin,  6.9/2.);
1588   z += 0.9;
1589   shRB24VMABCCTFlange->DefineSection(3, z, kRB24VMABCCTFlangeRin,  6.9/2.);
1590   shRB24VMABCCTFlange->DefineSection(4, z, kRB24VMABCCTFlangeRin, 11.16/2.);
1591   z += 0.25;
1592   shRB24VMABCCTFlange->DefineSection(5, z, kRB24VMABCCTFlangeRin, 11.16/2.);
1593   TGeoVolume* voRB24VMABCCTFlange = new TGeoVolume("RB24VMABCCTFlange", shRB24VMABCCTFlange, kMedCu);
1594   //
1595   // Pos 3.2 RF-Contact        LHCVSR__0056
1596   //
1597   TGeoPcon* shRB24VMABCCT = new TGeoPcon(0., 360., 4);
1598   const Float_t kRB24VMABCCTRin  = 6.30/2.;        // Inner radius
1599   const Float_t kRB24VMABCCTCRin = 7.29/2.;        // Max. inner radius conical section
1600   const Float_t kRB24VMABCCTL    = 11.88;          // Length
1601   const Float_t kRB24VMABCCTSL   = 10.48;          // Length of straight section
1602   const Float_t kRB24VMABCCTd    =  0.03;          // Thickness
1603   z = 0;
1604   shRB24VMABCCT->DefineSection(0, z,  kRB24VMABCCTCRin,  kRB24VMABCCTCRin + kRB24VMABCCTd);
1605   z =  kRB24VMABCCTL -  kRB24VMABCCTSL;
1606   shRB24VMABCCT->DefineSection(1, z,  kRB24VMABCCTRin + 0.35,  kRB24VMABCCTRin + 0.35 + kRB24VMABCCTd);
1607   z = kRB24VMABCCTL  -  kRB24VMABCCTFlangeL;
1608   shRB24VMABCCT->DefineSection(2, z,  kRB24VMABCCTRin,  kRB24VMABCCTRin + kRB24VMABCCTd);
1609   z = kRB24VMABCCTL;
1610   shRB24VMABCCT->DefineSection(3, z,  kRB24VMABCCTRin,  kRB24VMABCCTRin + kRB24VMABCCTd);
1611
1612   TGeoVolume* voRB24VMABCCT = new TGeoVolume("RB24VMABCCT", shRB24VMABCCT, kMedCu);
1613     
1614   TGeoVolumeAssembly* voRB24VMABRFCT = new TGeoVolumeAssembly("RB24VMABRFCT");
1615   voRB24VMABRFCT->AddNode(voRB24VMABCCT,        1, gGeoIdentity);
1616   voRB24VMABRFCT->AddNode( voRB24VMABCCTFlange, 1, new TGeoTranslation(0., 0.,  kRB24VMABCCTL - kRB24VMABCCTFlangeL));
1617
1618   z =  kRB24VMABCRBT1L/2. + kRB24B1BellowUndL + kRB24VMABBEConTubeL1 +  kRB24VMABBEConTubeL2 - kRB24VMABCCTL + 1.;    
1619   voRB24VMABCRB->AddNode(voRB24VMABRFCT, 1, new TGeoTranslation(0., 0., z));
1620
1621
1622   //
1623   // Assembling RB24/1
1624   //    
1625   TGeoVolumeAssembly* voRB24 = new TGeoVolumeAssembly("RB24");
1626   // Cu Tube with two simplified flanges
1627   voRB24->AddNode(voRB24CuTubeM, 1, gGeoIdentity);
1628   voRB24->AddNode(voRB24CuTubeA, 1, gGeoIdentity);
1629   z = - kRB24CuTubeL/2 + kRB24CuTubeFL/2.;
1630   voRB24->AddNode(voRB24CuTubeF, 1, new TGeoTranslation(0., 0., z));
1631   z = + kRB24CuTubeL/2 - kRB24CuTubeFL/2.;
1632   voRB24->AddNode(voRB24CuTubeF, 2, new TGeoTranslation(0., 0., z));
1633   // VMABC close to compensator magnet
1634   z = - kRB24CuTubeL/2. -  (kRB24VMABCL - kRB24VMABCRBT1L/2) + 1.;
1635     
1636   voRB24->AddNode(voRB24VMABCRB, 2, new TGeoTranslation(0., 0., z));
1637   // Bellow
1638   z =  kRB24CuTubeL/2;
1639   voRB24->AddNode(voRB24B1BellowM, 1, new TGeoTranslation(0., 0., z));
1640   z +=  (kRB24B1L +  kRB24AIpML/2.);
1641   // Annular ion pump
1642   voRB24->AddNode(voRB24AIpM, 1, new TGeoTranslation(0., 0., z));
1643   z +=  (kRB24AIpML/2. +  kRB24ValveWz/2.);
1644   // Valve
1645   voRB24->AddNode(voRB24ValveMo, 1, new TGeoTranslation(0., 0., z));
1646   z += (kRB24ValveWz/2.+ kRB24VMABCRBT1L/2. + 1.);
1647   // VMABC close to forward detectors
1648   voRB24->AddNode(voRB24VMABCRB, 3, new TGeoTranslation(0., 0., z));
1649   //
1650   //   RB24/2
1651   //     
1652   // Copper Tube RB24/2
1653   const Float_t  kRB242CuTubeL  = 330.0;
1654     
1655   TGeoVolume* voRB242CuTubeM = new TGeoVolume("voRB242CuTubeM", 
1656                                               new TGeoTube(0., kRB24CuTubeRo, kRB242CuTubeL/2.), kMedVac);
1657   voRB24CuTubeM->SetVisibility(0);
1658   TGeoVolume* voRB242CuTube = new TGeoVolume("voRB242CuTube", 
1659                                              new TGeoTube(kRB24CuTubeRi, kRB24CuTubeRo, kRB242CuTubeL/2.), kMedCu);
1660   voRB242CuTubeM->AddNode(voRB242CuTube, 1, gGeoIdentity);
1661     
1662
1663   TGeoVolumeAssembly* voRB242 = new TGeoVolumeAssembly("RB242");
1664   voRB242->AddNode(voRB242CuTube, 1, gGeoIdentity);
1665   z = - kRB242CuTubeL/2 + kRB24CuTubeFL/2.;
1666   voRB242->AddNode(voRB24CuTubeF, 3, new TGeoTranslation(0., 0., z));
1667   z = + kRB242CuTubeL/2 - kRB24CuTubeFL/2.;
1668   voRB242->AddNode(voRB24CuTubeF, 4, new TGeoTranslation(0., 0., z));
1669   z = - kRB24CuTubeL/2 - kRB24VMABCL - kRB242CuTubeL/2.;
1670   voRB24->AddNode(voRB242, 1, new TGeoTranslation(0., 0., z));
1671   //
1672   //   RB24/3
1673   //     
1674   // Copper Tube RB24/3
1675   const Float_t  kRB243CuTubeL  = 303.35;
1676     
1677   TGeoVolume* voRB243CuTubeM = new TGeoVolume("voRB243CuTubeM", 
1678                                               new TGeoTube(0., kRB24CuTubeRo, kRB243CuTubeL/2.), kMedVac);
1679   voRB24CuTubeM->SetVisibility(0);
1680   TGeoVolume* voRB243CuTube = new TGeoVolume("voRB243CuTube", 
1681                                              new TGeoTube(kRB24CuTubeRi, kRB24CuTubeRo, kRB243CuTubeL/2.), kMedCu);
1682   voRB243CuTubeM->AddNode(voRB243CuTube, 1, gGeoIdentity);
1683     
1684
1685   TGeoVolumeAssembly* voRB243  = new TGeoVolumeAssembly("RB243");
1686   TGeoVolumeAssembly* voRB243A = new TGeoVolumeAssembly("RB243A");
1687     
1688   voRB243A->AddNode(voRB243CuTube, 1, gGeoIdentity);
1689   z = - kRB243CuTubeL/2 + kRB24CuTubeFL/2.;
1690   voRB243A->AddNode(voRB24CuTubeF, 5, new TGeoTranslation(0., 0., z));
1691   z = + kRB243CuTubeL/2 - kRB24CuTubeFL/2.;
1692   voRB243A->AddNode(voRB24CuTubeF,    6, new TGeoTranslation(0., 0., z));
1693   z = + kRB243CuTubeL/2;
1694   voRB243A->AddNode(voRB24B1BellowM,  2, new TGeoTranslation(0., 0., z));    
1695
1696   z = - kRB243CuTubeL/2.  - kRB24B1L;
1697   voRB243->AddNode(voRB243A, 1, new TGeoTranslation(0., 0., z));    
1698   z = - (1.5 * kRB243CuTubeL + 2. * kRB24B1L);
1699   voRB243->AddNode(voRB243A, 2, new TGeoTranslation(0., 0., z));    
1700
1701   z = - 2. * (kRB243CuTubeL + kRB24B1L) - (kRB24VMABCL - kRB24VMABCRBT1L/2) + 1.;
1702   voRB243->AddNode(voRB24VMABCRB, 3, new TGeoTranslation(0., 0., z));    
1703     
1704   z = - kRB24CuTubeL/2 - kRB24VMABCL - kRB242CuTubeL;
1705   voRB24->AddNode(voRB243, 1, new TGeoTranslation(0., 0., z));
1706
1707
1708   //
1709   //
1710   top->AddNode(voRB24, 1, new TGeoCombiTrans(0., 0., kRB24CuTubeL/2 + 88.5 + 400., rot180));
1711
1712
1713   // 
1714   ////////////////////////////////////////////////////////////////////////////////     
1715   //                                                                            //
1716   //                                  The Absorber Vacuum system                // 
1717   //                                                                            //
1718   ////////////////////////////////////////////////////////////////////////////////
1719   //
1720   //    Rotable Flange starts at:            82.00 cm from IP      
1721   //    Length of rotable flange section:    10.68 cm             
1722   //    Weld                                  0.08 cm                  
1723   //    Length of straight section          207.21 cm
1724   //    =======================================================================
1725   //                                        299.97 cm  [0.03 cm missing ?]
1726   //    Length of opening cone              252.09 cm
1727   //    Weld                                  0.15 cm                
1728   //    Length of compensator                30.54 cm
1729   //    Weld                                  0.15 cm                
1730   //    Length of fixed flange  2.13 - 0.97   1.16 cm
1731   //    ======================================================================= 
1732   //                                        584.06 cm [584.80 installed] [0.74 cm missing]
1733   //    RB26/3
1734   //    Length of split flange  2.13 - 1.2    0.93 cm
1735   //    Weld                                  0.15 cm                
1736   //    Length of fixed point section        16.07 cm               
1737   //    Weld                                  0.15 cm                
1738   //    Length of opening cone              629.20 cm
1739   //    Weld                                  0.30 cm                
1740   //    Kength of the compensator            41.70 cm
1741   //    Weld                                  0.30 cm                
1742   //    Length of fixed flange  2.99 - 1.72   1.27 cm
1743   // =================================================
1744   //    Length of RB26/3                    690.07 cm [689.20 installed] [0.87 cm too much] 
1745   //
1746   //    RB26/4-5
1747   //    Length of split flange  2.13 - 1.2    0.93 cm
1748   //    Weld                                  0.15 cm                
1749   //    Length of fixed point section        16.07 cm               
1750   //    Weld                                  0.15 cm                
1751   //    Length of opening cone              629.20 cm
1752   //    Weld                                  0.30 cm                
1753   //    Length of closing cone
1754   //    Weld
1755   //    Lenth of straight section 
1756   //    Kength of the compensator            41.70 cm
1757   //    Weld                                  0.30 cm                
1758   //    Length of fixed flange  2.99 - 1.72   1.27 cm
1759   // =================================================
1760   //    Length of RB26/3                    690.07 cm [689.20 installed] [0.87 cm too much] 
1761       
1762   ///////////////////////////////////////////
1763   //                                       //
1764   //    RB26/1-2                           //  
1765   //    Drawing LHCV2a_0050 [as installed] //
1766   //    Drawing LHCV2a_0008                //
1767   //    Drawing LHCV2a_0001                //
1768   ///////////////////////////////////////////
1769   //    Pos1 Vacuum Tubes   LHCVC2A__0010
1770   //    Pos2 Compensator    LHCVC2A__0064
1771   //    Pos3 Rotable Flange LHCVFX___0016
1772   //    Pos4 Fixed Flange   LHCVFX___0006
1773   //    Pos5 Bellow Tooling LHCVFX___0003
1774   //
1775   //             
1776   //
1777   ///////////////////////////////////
1778   //    RB26/1-2 Vacuum Tubes      //
1779   //    Drawing  LHCVC2a_0010      //
1780   ///////////////////////////////////
1781   const Float_t kRB26s12TubeL = 459.45; // 0.15 cm added for welding       
1782   //
1783   // Add 1 cm on outer diameter for insulation
1784   //
1785   TGeoPcon* shRB26s12Tube = new TGeoPcon(0., 360., 5);
1786   // Section 1: straight section
1787   shRB26s12Tube->DefineSection(0,   0.00,         5.84/2.,  6.00/2.);
1788   shRB26s12Tube->DefineSection(1, 207.21,         5.84/2.,  6.00/2.);      
1789   // Section 2: 0.72 deg opening cone
1790   shRB26s12Tube->DefineSection(2, 207.21,         5.84/2.,  6.14/2.);      
1791   shRB26s12Tube->DefineSection(3, 452.30,        12.00/2., 12.30/2.);      
1792   shRB26s12Tube->DefineSection(4, kRB26s12TubeL, 12.00/2., 12.30/2.); 
1793   TGeoVolume* voRB26s12Tube  = new TGeoVolume("RB26s12Tube", shRB26s12Tube, kMedSteel);
1794   // Add the insulation layer    
1795   TGeoVolume* voRB26s12TubeIns = new TGeoVolume("RB26s12TubeIns", MakeInsulationFromTemplate(shRB26s12Tube), kMedInsu); 
1796   voRB26s12Tube->AddNode(voRB26s12TubeIns, 1, gGeoIdentity);
1797
1798  
1799   TGeoVolume* voRB26s12TubeM  = new TGeoVolume("RB26s12TubeM", MakeMotherFromTemplate(shRB26s12Tube), kMedVac);
1800   voRB26s12TubeM->AddNode(voRB26s12Tube, 1, gGeoIdentity);
1801       
1802
1803       
1804   ///////////////////////////////////
1805   //    RB26/2   Axial Compensator //
1806   //    Drawing  LHCVC2a_0064      //
1807   ///////////////////////////////////
1808   const Float_t kRB26s2CompL             = 30.65;    // Length of the compensator
1809   const Float_t kRB26s2BellowRo          = 14.38/2.; // Bellow outer radius        [Pos 1]
1810   const Float_t kRB26s2BellowRi          = 12.12/2.; // Bellow inner radius        [Pos 1] 
1811   const Int_t   kRB26s2NumberOfPlies     = 14;       // Number of plies            [Pos 1] 
1812   const Float_t kRB26s2BellowUndL        = 10.00;    // Length of undulated region [Pos 1]  [+10 mm installed including pretension ?] 
1813   const Float_t kRB26s2PlieThickness     =  0.025;   // Plie thickness             [Pos 1]
1814   const Float_t kRB26s2ConnectionPlieR   =  0.21;    // Connection plie radius     [Pos 1] 
1815   //  Plie radius
1816   const Float_t kRB26s2PlieR = 
1817     (kRB26s2BellowUndL - 4. *  kRB26s2ConnectionPlieR + 2. * kRB26s2PlieThickness + 
1818      (2. *  kRB26s2NumberOfPlies - 2.) * kRB26s2PlieThickness) / (4. * kRB26s2NumberOfPlies - 2.);
1819   const Float_t kRB26s2CompTubeInnerR    = 12.00/2.;  // Connection tubes inner radius     [Pos 2 + 3]
1820   const Float_t kRB26s2CompTubeOuterR    = 12.30/2.;  // Connection tubes outer radius     [Pos 2 + 3]
1821   const Float_t kRB26s2WeldingTubeLeftL  =  9.00/2.;  // Left connection tube half length  [Pos 2]
1822   const Float_t kRB26s2WeldingTubeRightL = 11.65/2.;  // Right connection tube half length [Pos 3]  [+ 0.15 cm for welding]
1823   const Float_t kRB26s2RingOuterR        = 18.10/2.;  // Ring inner radius                 [Pos 4]
1824   const Float_t kRB26s2RingL             =  0.40/2.;  // Ring half length                  [Pos 4]
1825   const Float_t kRB26s2RingZ             =  6.50   ;  // Ring z-position                   [Pos 4]
1826   const Float_t kRB26s2ProtOuterR        = 18.20/2.;  // Protection tube outer radius      [Pos 5]
1827   const Float_t kRB26s2ProtL             = 15.00/2.;  // Protection tube half length       [Pos 5]
1828   const Float_t kRB26s2ProtZ             =  6.70   ;  // Protection tube z-position        [Pos 5]
1829    
1830       
1831   // Mother volume
1832   //
1833   TGeoPcon* shRB26s2Compensator  = new TGeoPcon(0., 360., 6);
1834   shRB26s2Compensator->DefineSection( 0,   0.0, 0., kRB26s2CompTubeOuterR);
1835   shRB26s2Compensator->DefineSection( 1,   kRB26s2RingZ, 0., kRB26s2CompTubeOuterR);      
1836   shRB26s2Compensator->DefineSection( 2,   kRB26s2RingZ, 0., kRB26s2ProtOuterR);      
1837   shRB26s2Compensator->DefineSection( 3,   kRB26s2ProtZ + 2. * kRB26s2ProtL, 0., kRB26s2ProtOuterR);            
1838   shRB26s2Compensator->DefineSection( 4,   kRB26s2ProtZ + 2. * kRB26s2ProtL, 0., kRB26s2CompTubeOuterR);
1839   shRB26s2Compensator->DefineSection( 5,   kRB26s2CompL                    , 0., kRB26s2CompTubeOuterR);            
1840   TGeoVolume* voRB26s2Compensator  = new TGeoVolume("RB26s2Compensator", shRB26s2Compensator, kMedVac);
1841             
1842   //
1843   // [Pos 1] Bellow
1844   //      
1845   //
1846   TGeoVolume* voRB26s2Bellow = new TGeoVolume("RB26s2Bellow", new TGeoTube(kRB26s2BellowRi, kRB26s2BellowRo, kRB26s2BellowUndL/2.), kMedVac);
1847   //      
1848   //  Upper part of the undulation
1849   //
1850   TGeoTorus* shRB26s2PlieTorusU  =  new TGeoTorus(kRB26s2BellowRo - kRB26s2PlieR, kRB26s2PlieR - kRB26s2PlieThickness, kRB26s2PlieR);
1851   shRB26s2PlieTorusU->SetName("RB26s2TorusU");
1852   TGeoTube*  shRB26s2PlieTubeU   =  new TGeoTube (kRB26s2BellowRo - kRB26s2PlieR, kRB26s2BellowRo, kRB26s2PlieR);
1853   shRB26s2PlieTubeU->SetName("RB26s2TubeU");
1854   TGeoCompositeShape*  shRB26s2UpperPlie = new TGeoCompositeShape("RB26s2UpperPlie", "RB26s2TorusU*RB26s2TubeU");
1855  
1856   TGeoVolume* voRB26s2WiggleU = new TGeoVolume("RB26s2UpperPlie", shRB26s2UpperPlie, kMedSteel);
1857   //
1858   // Lower part of the undulation
1859   TGeoTorus* shRB26s2PlieTorusL =  new TGeoTorus(kRB26s2BellowRi + kRB26s2PlieR, kRB26s2PlieR - kRB26s2PlieThickness, kRB26s2PlieR);
1860   shRB26s2PlieTorusL->SetName("RB26s2TorusL");
1861   TGeoTube*  shRB26s2PlieTubeL   =  new TGeoTube (kRB26s2BellowRi, kRB26s2BellowRi + kRB26s2PlieR, kRB26s2PlieR);
1862   shRB26s2PlieTubeL->SetName("RB26s2TubeL");
1863   TGeoCompositeShape*  shRB26s2LowerPlie = new TGeoCompositeShape("RB26s2LowerPlie", "RB26s2TorusL*RB26s2TubeL");
1864       
1865   TGeoVolume* voRB26s2WiggleL = new TGeoVolume("RB26s2LowerPlie", shRB26s2LowerPlie, kMedSteel); 
1866
1867   //
1868   // Connection between upper and lower part of undulation
1869   TGeoVolume* voRB26s2WiggleC1 = new TGeoVolume("RB26s2PlieConn1",  
1870                                                 new TGeoTube(kRB26s2BellowRi + kRB26s2PlieR, 
1871                                                              kRB26s2BellowRo - kRB26s2PlieR, kRB26s2PlieThickness / 2.), kMedSteel);
1872   //
1873   // One wiggle
1874   TGeoVolumeAssembly* voRB26s2Wiggle = new TGeoVolumeAssembly("RB26s2Wiggle");
1875   z0 =  -  kRB26s2PlieThickness / 2.;
1876   voRB26s2Wiggle->AddNode(voRB26s2WiggleC1,  1 , new TGeoTranslation(0., 0., z0));
1877   z0 += kRB26s2PlieR -  kRB26s2PlieThickness / 2.;
1878   voRB26s2Wiggle->AddNode(voRB26s2WiggleU,   1 , new TGeoTranslation(0., 0., z0));
1879   z0 += kRB26s2PlieR -  kRB26s2PlieThickness / 2.;
1880   voRB26s2Wiggle->AddNode(voRB26s2WiggleC1,  2 , new TGeoTranslation(0., 0., z0));
1881   z0 += kRB26s2PlieR -  kRB26s2PlieThickness;
1882   voRB26s2Wiggle->AddNode(voRB26s2WiggleL ,  1 , new TGeoTranslation(0., 0., z0));
1883   // Positioning of the volumes
1884   z0   = - kRB26s2BellowUndL/2.+ kRB26s2ConnectionPlieR;
1885   voRB26s2Bellow->AddNode(voRB26s2WiggleL, 1, new TGeoTranslation(0., 0., z0));
1886   z0  +=  kRB26s2ConnectionPlieR;
1887   zsh  = 4. *  kRB26s2PlieR -  2. * kRB26s2PlieThickness;
1888   for (Int_t iw = 0; iw < kRB26s2NumberOfPlies; iw++) {
1889     Float_t zpos =  z0 + iw * zsh;      
1890     voRB26s2Bellow->AddNode(voRB26s2Wiggle,  iw + 1, new TGeoTranslation(0., 0., zpos -  kRB26s2PlieThickness));        
1891   }
1892
1893   voRB26s2Compensator->AddNode(voRB26s2Bellow, 1,  new TGeoTranslation(0., 0., 2. * kRB26s2WeldingTubeLeftL + kRB26s2BellowUndL/2.));
1894       
1895   //
1896   // [Pos 2] Left Welding Tube
1897   //      
1898   TGeoTube* shRB26s2CompLeftTube = new TGeoTube(kRB26s2CompTubeInnerR, kRB26s2CompTubeOuterR, kRB26s2WeldingTubeLeftL);
1899   TGeoVolume* voRB26s2CompLeftTube = new TGeoVolume("RB26s2CompLeftTube", shRB26s2CompLeftTube, kMedSteel);
1900   voRB26s2Compensator->AddNode(voRB26s2CompLeftTube, 1,  new TGeoTranslation(0., 0., kRB26s2WeldingTubeLeftL));
1901   //
1902   // [Pos 3] Right Welding Tube
1903   //      
1904   TGeoTube* shRB26s2CompRightTube = new TGeoTube(kRB26s2CompTubeInnerR, kRB26s2CompTubeOuterR, kRB26s2WeldingTubeRightL);
1905   TGeoVolume* voRB26s2CompRightTube = new TGeoVolume("RB26s2CompRightTube", shRB26s2CompRightTube, kMedSteel);
1906   voRB26s2Compensator->AddNode(voRB26s2CompRightTube,  1, new TGeoTranslation(0., 0.,  kRB26s2CompL - kRB26s2WeldingTubeRightL));
1907   //
1908   // [Pos 4] Ring
1909   //      
1910   TGeoTube* shRB26s2CompRing = new TGeoTube(kRB26s2CompTubeOuterR, kRB26s2RingOuterR, kRB26s2RingL);
1911   TGeoVolume* voRB26s2CompRing = new TGeoVolume("RB26s2CompRing", shRB26s2CompRing, kMedSteel);
1912   voRB26s2Compensator->AddNode(voRB26s2CompRing,  1, new TGeoTranslation(0., 0., kRB26s2RingZ + kRB26s2RingL));
1913
1914   //
1915   // [Pos 5] Outer Protecting Tube
1916   //      
1917   TGeoTube* shRB26s2CompProtTube = new TGeoTube(kRB26s2RingOuterR, kRB26s2ProtOuterR, kRB26s2ProtL);
1918   TGeoVolume* voRB26s2CompProtTube = new TGeoVolume("RB26s2CompProtTube", shRB26s2CompProtTube, kMedSteel);
1919   voRB26s2Compensator->AddNode(voRB26s2CompProtTube, 1,  new TGeoTranslation(0., 0., kRB26s2ProtZ + kRB26s2ProtL));
1920       
1921   ///////////////////////////////////
1922   //    Rotable Flange             //
1923   //    Drawing  LHCVFX_0016       //
1924   /////////////////////////////////// 
1925   const Float_t kRB26s1RFlangeTubeRi    = 5.84/2.-lolo ;  // Tube inner radius
1926   const Float_t kRB26s1RFlangeTubeRo    = 6.00/2.-lolo ;  // Tube outer radius
1927
1928   // Pos 1 Clamp Ring          LHCVFX__0015
1929   const Float_t kRB26s1RFlangeCrL       = 1.40     ; // Lenth of the clamp ring
1930   const Float_t kRB26s1RFlangeCrRi1     = 6.72/2.-lolo-1. ; // Ring inner radius section 1
1931   const Float_t kRB26s1RFlangeCrRi2     = 6.06/2.-lolo-1.  ; // Ring inner radius section 2
1932   const Float_t kRB26s1RFlangeCrRo      = 8.60/2.-lolo-1.  ; // Ring outer radius 
1933   const Float_t kRB26s1RFlangeCrD       = 0.800    ; // Width section 1
1934       
1935   TGeoPcon* shRB26s1RFlangeCr = new TGeoPcon(0., 360., 4);
1936   z0 = 0.;
1937   shRB26s1RFlangeCr->DefineSection(0, z0, kRB26s1RFlangeCrRi1, kRB26s1RFlangeCrRo);
1938   z0 += kRB26s1RFlangeCrD;
1939   shRB26s1RFlangeCr->DefineSection(1, z0, kRB26s1RFlangeCrRi1, kRB26s1RFlangeCrRo);
1940   shRB26s1RFlangeCr->DefineSection(2, z0, kRB26s1RFlangeCrRi2, kRB26s1RFlangeCrRo);      
1941   z0 = kRB26s1RFlangeCrL;
1942   shRB26s1RFlangeCr->DefineSection(3, z0, kRB26s1RFlangeCrRi2, kRB26s1RFlangeCrRo);
1943   TGeoVolume* voRB26s1RFlangeCr =  
1944     new TGeoVolume("RB26s1RFlangeCr", shRB26s1RFlangeCr, kMedSteel);
1945
1946   // Pos 2 Insert              LHCVFX__0015
1947   const Float_t kRB26s1RFlangeIsL       = 4.88     ; // Lenth of the insert
1948   const Float_t kRB26s1RFlangeIsR       = 6.70/2.-lolo  ; // Ring radius
1949   const Float_t kRB26s1RFlangeIsD       = 0.80     ; // Ring Width
1950
1951   TGeoPcon* shRB26s1RFlangeIs = new TGeoPcon(0., 360., 4);
1952   z0 = 0.;
1953   shRB26s1RFlangeIs->DefineSection(0, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeIsR);
1954   z0 += kRB26s1RFlangeIsD;
1955   shRB26s1RFlangeIs->DefineSection(1, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeIsR);
1956   shRB26s1RFlangeIs->DefineSection(2, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeTubeRo);      
1957   z0 = kRB26s1RFlangeIsL;
1958   shRB26s1RFlangeIs->DefineSection(3, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeTubeRo);
1959   TGeoVolume* voRB26s1RFlangeIs =  
1960     new TGeoVolume("RB26s1RFlangeIs", shRB26s1RFlangeIs, kMedSteel);
1961   // 4.88 + 3.7 = 8.58 (8.7 to avoid overlap)
1962   // Pos 3 Fixed Point Section LHCVC2A_0021
1963   const Float_t kRB26s1RFlangeFpL       = 5.88     ; // Length of the fixed point section (0.08 cm added for welding)
1964   const Float_t kRB26s1RFlangeFpZ       = 3.82     ; // Position of the ring
1965   const Float_t kRB26s1RFlangeFpD       = 0.59     ; // Width of the ring
1966   const Float_t kRB26s1RFlangeFpR       = 7.00/2.-lolo  ; // Radius of the ring
1967       
1968   TGeoPcon* shRB26s1RFlangeFp = new TGeoPcon(0., 360., 6);
1969   z0 = 0.;
1970   shRB26s1RFlangeFp->DefineSection(0, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeTubeRo);
1971   z0 += kRB26s1RFlangeFpZ;
1972   shRB26s1RFlangeFp->DefineSection(1, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeTubeRo);      
1973   shRB26s1RFlangeFp->DefineSection(2, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeFpR);               
1974   z0 += kRB26s1RFlangeFpD;
1975   shRB26s1RFlangeFp->DefineSection(3, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeFpR);               
1976   shRB26s1RFlangeFp->DefineSection(4, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeTubeRo);
1977   z0 = kRB26s1RFlangeFpL;
1978   shRB26s1RFlangeFp->DefineSection(5, z0, kRB26s1RFlangeTubeRi, kRB26s1RFlangeTubeRo);
1979   TGeoVolume* voRB26s1RFlangeFp = new TGeoVolume("RB26s1RFlangeFp", shRB26s1RFlangeFp, kMedSteel);
1980              
1981   // Put everything in a mother volume
1982   TGeoPcon* shRB26s1RFlange = new TGeoPcon(0., 360., 8);
1983   z0 =  0.;
1984   shRB26s1RFlange->DefineSection(0, z0, 0., kRB26s1RFlangeCrRo);
1985   z0 += kRB26s1RFlangeCrL;
1986   shRB26s1RFlange->DefineSection(1, z0, 0., kRB26s1RFlangeCrRo);
1987   shRB26s1RFlange->DefineSection(2, z0, 0., kRB26s1RFlangeTubeRo);
1988   z0 = kRB26s1RFlangeIsL + kRB26s1RFlangeFpZ;
1989   shRB26s1RFlange->DefineSection(3, z0, 0., kRB26s1RFlangeTubeRo);      
1990   shRB26s1RFlange->DefineSection(4, z0, 0., kRB26s1RFlangeFpR);
1991   z0 += kRB26s1RFlangeFpD;
1992   shRB26s1RFlange->DefineSection(5, z0, 0., kRB26s1RFlangeFpR);           
1993   shRB26s1RFlange->DefineSection(6, z0, 0., kRB26s1RFlangeTubeRo);
1994   z0 = kRB26s1RFlangeIsL + kRB26s1RFlangeFpL;
1995   shRB26s1RFlange->DefineSection(7, z0, 0., kRB26s1RFlangeTubeRo);
1996   TGeoVolume* voRB26s1RFlange = new TGeoVolume("RB26s1RFlange", shRB26s1RFlange, kMedVac);
1997
1998   voRB26s1RFlange->AddNode(voRB26s1RFlangeIs, 1, gGeoIdentity);
1999   voRB26s1RFlange->AddNode(voRB26s1RFlangeCr, 1, gGeoIdentity);
2000   voRB26s1RFlange->AddNode(voRB26s1RFlangeFp, 1, new TGeoTranslation(0., 0., kRB26s1RFlangeIsL));
2001       
2002   ///////////////////////////////////
2003   //    Fixed Flange               //
2004   //    Drawing  LHCVFX_0006       //
2005   /////////////////////////////////// 
2006   const Float_t kRB26s2FFlangeL      =  2.13;    // Length of the flange
2007   const Float_t kRB26s2FFlangeD1     =  0.97;    // Length of section 1
2008   const Float_t kRB26s2FFlangeD2     =  0.29;    // Length of section 2                                              
2009   const Float_t kRB26s2FFlangeD3     =  0.87;    // Length of section 3                                                    
2010   const Float_t kRB26s2FFlangeRo     = 17.15/2.; // Flange outer radius 
2011   const Float_t kRB26s2FFlangeRi1    = 12.30/2.; // Flange inner radius section 1
2012   const Float_t kRB26s2FFlangeRi2    = 12.00/2.; // Flange inner radius section 2
2013   const Float_t kRB26s2FFlangeRi3    = 12.30/2.; // Flange inner radius section 3
2014   z0 = 0;
2015   TGeoPcon* shRB26s2FFlange = new TGeoPcon(0., 360., 6);
2016   z0 = 0.;
2017   shRB26s2FFlange->DefineSection(0, z0, kRB26s2FFlangeRi1, kRB26s2FFlangeRo);
2018   z0 += kRB26s2FFlangeD1;
2019   shRB26s2FFlange->DefineSection(1, z0, kRB26s2FFlangeRi1, kRB26s2FFlangeRo);
2020   shRB26s2FFlange->DefineSection(2, z0, kRB26s2FFlangeRi2, kRB26s2FFlangeRo);
2021   z0 += kRB26s2FFlangeD2;
2022   shRB26s2FFlange->DefineSection(3, z0, kRB26s2FFlangeRi2, kRB26s2FFlangeRo);
2023   shRB26s2FFlange->DefineSection(4, z0, kRB26s2FFlangeRi3, kRB26s2FFlangeRo);
2024   z0 += kRB26s2FFlangeD3;
2025   shRB26s2FFlange->DefineSection(5, z0, kRB26s2FFlangeRi3, kRB26s2FFlangeRo);
2026   TGeoVolume* voRB26s2FFlange = new TGeoVolume("RB26s2FFlange", shRB26s2FFlange, kMedSteel);
2027
2028   TGeoVolume* voRB26s2FFlangeM = new TGeoVolume("RB26s2FFlangeM", MakeMotherFromTemplate(shRB26s2FFlange, 2, 5), kMedVac);
2029   voRB26s2FFlangeM->AddNode(voRB26s2FFlange, 1, gGeoIdentity);
2030       
2031       
2032
2033   ////////////////////////////////////////
2034   //                                    //
2035   //    RB26/3                          //  
2036   //    Drawing LHCV2a_0048             //
2037   //    Drawing LHCV2a_0002             //
2038   ////////////////////////////////////////    
2039   //
2040   //    Pos 1 Vacuum Tubes      LHCVC2A__0003
2041   //    Pos 2 Fixed Point       LHCVFX___0005
2042   //    Pos 3 Split Flange      LHCVFX___0007
2043   //    Pos 4 Fixed Flange      LHCVFX___0004
2044   //    Pos 5 Axial Compensator LHCVC2A__0065
2045   //
2046   //
2047   //
2048   //
2049   ///////////////////////////////////
2050   //    Vacuum Tube                //
2051   //    Drawing  LHCVC2A_0003      //
2052   /////////////////////////////////// 
2053   const Float_t kRB26s3TubeL  = 629.35 + 0.3; // 0.3 cm added for welding
2054   const Float_t kRB26s3TubeR1 =  12./2.;
2055   const Float_t kRB26s3TubeR2 =  kRB26s3TubeR1 + 215.8 * TMath::Tan(0.829 / 180. * TMath::Pi());
2056       
2057       
2058   TGeoPcon* shRB26s3Tube = new TGeoPcon(0., 360., 7);
2059   // Section 1: straight section
2060   shRB26s3Tube->DefineSection(0,   0.00, kRB26s3TubeR1, kRB26s3TubeR1 + 0.15);
2061   shRB26s3Tube->DefineSection(1,   2.00, kRB26s3TubeR1, kRB26s3TubeR1 + 0.15);      
2062   // Section 2: 0.829 deg opening cone
2063   shRB26s3Tube->DefineSection(2,   2.00, kRB26s3TubeR1, kRB26s3TubeR1 + 0.20);
2064       
2065   shRB26s3Tube->DefineSection(3, 217.80, kRB26s3TubeR2, kRB26s3TubeR2 + 0.20);
2066   shRB26s3Tube->DefineSection(4, 217.80, kRB26s3TubeR2, kRB26s3TubeR2 + 0.30);      
2067
2068   shRB26s3Tube->DefineSection(5, 622.20,       30.00/2., 30.60/2.);      
2069   shRB26s3Tube->DefineSection(6, kRB26s3TubeL, 30.00/2., 30.60/2.); 
2070
2071   TGeoVolume* voRB26s3Tube = new TGeoVolume("RB26s3Tube", shRB26s3Tube, kMedSteel);
2072   //    Add the insulation layer
2073   TGeoVolume* voRB26s3TubeIns = new TGeoVolume("RB26s3TubeIns", MakeInsulationFromTemplate(shRB26s3Tube), kMedInsu); 
2074   voRB26s3Tube->AddNode(voRB26s3TubeIns, 1, gGeoIdentity);
2075
2076   TGeoVolume* voRB26s3TubeM  = new TGeoVolume("RB26s3TubeM", MakeMotherFromTemplate(shRB26s3Tube), kMedVac);
2077   voRB26s3TubeM->AddNode(voRB26s3Tube, 1, gGeoIdentity);
2078
2079       
2080
2081   ///////////////////////////////////
2082   //    Fixed Point                //
2083   //    Drawing  LHCVFX_0005       //
2084   /////////////////////////////////// 
2085   const Float_t kRB26s3FixedPointL       = 16.37     ; // Length of the fixed point section (0.3 cm added for welding)
2086   const Float_t kRB26s3FixedPointZ       =  9.72     ; // Position of the ring (0.15 cm added for welding)
2087   const Float_t kRB26s3FixedPointD       =  0.595    ; // Width of the ring
2088   const Float_t kRB26s3FixedPointR       = 13.30/2.  ; // Radius of the ring
2089   const Float_t kRB26s3FixedPointRi      = 12.00/2.  ; // Inner radius of the tube
2090   const Float_t kRB26s3FixedPointRo1     = 12.30/2.  ; // Outer radius of the tube (in)
2091   const Float_t kRB26s3FixedPointRo2     = 12.40/2.  ; // Outer radius of the tube (out)
2092   const Float_t kRB26s3FixedPointDs      =  1.5      ; // Width of straight section behind ring
2093   const Float_t kRB26s3FixedPointDc      =  3.15     ; // Width of conical  section behind ring (0.15 cm added for welding)      
2094       
2095   TGeoPcon* shRB26s3FixedPoint = new TGeoPcon(0., 360., 8);
2096   z0 = 0.;
2097   shRB26s3FixedPoint->DefineSection(0, z0, kRB26s3FixedPointRi, kRB26s3FixedPointRo1);
2098   z0 += kRB26s3FixedPointZ;
2099   shRB26s3FixedPoint->DefineSection(1, z0, kRB26s3FixedPointRi, kRB26s3FixedPointRo1);      
2100   shRB26s3FixedPoint->DefineSection(2, z0, kRB26s3FixedPointRi, kRB26s3FixedPointR);              
2101   z0 += kRB26s3FixedPointD;
2102   shRB26s3FixedPoint->DefineSection(3, z0, kRB26s3FixedPointRi, kRB26s3FixedPointR);              
2103   shRB26s3FixedPoint->DefineSection(4, z0, kRB26s3FixedPointRi, kRB26s3FixedPointRo1);
2104   z0 += kRB26s3FixedPointDs;
2105   shRB26s3FixedPoint->DefineSection(5, z0, kRB26s3FixedPointRi, kRB26s3FixedPointRo1);
2106   z0 += kRB26s3FixedPointDc;
2107   shRB26s3FixedPoint->DefineSection(6, z0, kRB26s3FixedPointRi, kRB26s3FixedPointRo2);
2108   z0 = kRB26s3FixedPointL;
2109   shRB26s3FixedPoint->DefineSection(7, z0, kRB26s3FixedPointRi, kRB26s3FixedPointRo2);
2110   TGeoVolume* voRB26s3FixedPoint = new TGeoVolume("RB26s3FixedPoint", shRB26s3FixedPoint, kMedSteel);
2111
2112   TGeoVolume* voRB26s3FixedPointM = new TGeoVolume("RB26s3FixedPointM", MakeMotherFromTemplate(shRB26s3FixedPoint), kMedVac);
2113   voRB26s3FixedPointM->AddNode(voRB26s3FixedPoint, 1, gGeoIdentity);
2114       
2115   ///////////////////////////////////
2116   //    Split Flange               //
2117   //    Drawing  LHCVFX_0005       //
2118   /////////////////////////////////// 
2119   const Float_t kRB26s3SFlangeL      =  2.13;        // Length of the flange
2120   const Float_t kRB26s3SFlangeD1     =  0.57;        // Length of section 1
2121   const Float_t kRB26s3SFlangeD2     =  0.36;        // Length of section 2                                                  
2122   const Float_t kRB26s3SFlangeD3     =  0.50 + 0.70; // Length of section 3                                                        
2123   const Float_t kRB26s3SFlangeRo     = 17.15/2.;     // Flange outer radius 
2124   const Float_t kRB26s3SFlangeRi1    = 12.30/2.;     // Flange inner radius section 1
2125   const Float_t kRB26s3SFlangeRi2    = 12.00/2.;     // Flange inner radius section 2
2126   const Float_t kRB26s3SFlangeRi3    = 12.30/2.;     // Flange inner radius section 3
2127   z0 = 0;
2128   TGeoPcon* shRB26s3SFlange = new TGeoPcon(0., 360., 6);
2129   z0 = 0.;
2130   shRB26s3SFlange->DefineSection(0, z0, kRB26s3SFlangeRi1, kRB26s3SFlangeRo);
2131   z0 += kRB26s3SFlangeD1;
2132   shRB26s3SFlange->DefineSection(1, z0, kRB26s3SFlangeRi1, kRB26s3SFlangeRo);
2133   shRB26s3SFlange->DefineSection(2, z0, kRB26s3SFlangeRi2, kRB26s3SFlangeRo);
2134   z0 += kRB26s3SFlangeD2;
2135   shRB26s3SFlange->DefineSection(3, z0, kRB26s3SFlangeRi2, kRB26s3SFlangeRo);
2136   shRB26s3SFlange->DefineSection(4, z0, kRB26s3SFlangeRi3, kRB26s3SFlangeRo);
2137   z0 += kRB26s3SFlangeD3;
2138   shRB26s3SFlange->DefineSection(5, z0, kRB26s3SFlangeRi3, kRB26s3SFlangeRo);
2139   TGeoVolume* voRB26s3SFlange = new TGeoVolume("RB26s3SFlange", shRB26s3SFlange, kMedSteel);
2140
2141   TGeoVolume* voRB26s3SFlangeM = new TGeoVolume("RB26s3SFlangeM", MakeMotherFromTemplate(shRB26s3SFlange, 0, 3), kMedVac);
2142   voRB26s3SFlangeM->AddNode(voRB26s3SFlange, 1, gGeoIdentity);
2143         
2144   ///////////////////////////////////
2145   //    RB26/3   Fixed Flange      //
2146   //    Drawing  LHCVFX___0004     //
2147   /////////////////////////////////// 
2148   const Float_t kRB26s3FFlangeL      =  2.99;    // Length of the flange
2149   const Float_t kRB26s3FFlangeD1     =  1.72;    // Length of section 1
2150   const Float_t kRB26s3FFlangeD2     =  0.30;    // Length of section 2                                              
2151   const Float_t kRB26s3FFlangeD3     =  0.97;    // Length of section 3                                                    
2152   const Float_t kRB26s3FFlangeRo     = 36.20/2.; // Flange outer radius 
2153   const Float_t kRB26s3FFlangeRi1    = 30.60/2.; // Flange inner radius section 1
2154   const Float_t kRB26s3FFlangeRi2    = 30.00/2.; // Flange inner radius section 2
2155   const Float_t kRB26s3FFlangeRi3    = 30.60/2.; // Flange inner radius section 3
2156   z0 = 0;
2157   TGeoPcon* shRB26s3FFlange = new TGeoPcon(0., 360., 6);
2158   z0 = 0.;
2159   shRB26s3FFlange->DefineSection(0, z0, kRB26s3FFlangeRi1, kRB26s3FFlangeRo);
2160   z0 += kRB26s3FFlangeD1;
2161   shRB26s3FFlange->DefineSection(1, z0, kRB26s3FFlangeRi1, kRB26s3FFlangeRo);
2162   shRB26s3FFlange->DefineSection(2, z0, kRB26s3FFlangeRi2, kRB26s3FFlangeRo);
2163   z0 += kRB26s3FFlangeD2;
2164   shRB26s3FFlange->DefineSection(3, z0, kRB26s3FFlangeRi2, kRB26s3FFlangeRo);
2165   shRB26s3FFlange->DefineSection(4, z0, kRB26s3FFlangeRi3, kRB26s3FFlangeRo);
2166   z0 += kRB26s3FFlangeD3;
2167   shRB26s3FFlange->DefineSection(5, z0, kRB26s3FFlangeRi3, kRB26s3FFlangeRo);
2168   TGeoVolume* voRB26s3FFlange = new TGeoVolume("RB26s3FFlange", shRB26s3FFlange, kMedSteel);
2169       
2170   TGeoVolume* voRB26s3FFlangeM = new TGeoVolume("RB26s3FFlangeM", MakeMotherFromTemplate(shRB26s3FFlange, 2, 5), kMedVac);
2171   voRB26s3FFlangeM->AddNode(voRB26s3FFlange, 1, gGeoIdentity);
2172             
2173
2174
2175   ///////////////////////////////////
2176   //    RB26/3   Axial Compensator //
2177   //    Drawing  LHCVC2a_0065      //
2178   /////////////////////////////////// 
2179   const Float_t kRB26s3CompL              = 42.0;     // Length of the compensator (0.3 cm added for welding)
2180   const Float_t kRB26s3BellowRo           = 34.00/2.; // Bellow outer radius        [Pos 1]
2181   const Float_t kRB26s3BellowRi           = 30.10/2.; // Bellow inner radius        [Pos 1] 
2182   const Int_t   kRB26s3NumberOfPlies      = 13;       // Number of plies            [Pos 1] 
2183   const Float_t kRB26s3BellowUndL         = 17.70;    // Length of undulated region [Pos 1] 
2184   const Float_t kRB26s3PlieThickness      =  0.06;    // Plie thickness             [Pos 1]
2185   const Float_t kRB26s3ConnectionPlieR    =  0.21;    // Connection plie radius     [Pos 1] 
2186   //  Plie radius
2187   const Float_t kRB26s3PlieR = 
2188     (kRB26s3BellowUndL - 4. *  kRB26s3ConnectionPlieR + 2. * kRB26s3PlieThickness + 
2189      (2. *  kRB26s3NumberOfPlies - 2.) * kRB26s3PlieThickness) / (4. * kRB26s3NumberOfPlies - 2.);
2190
2191   //
2192   // The welding tubes have 3 sections with different radii and 2 transition regions.
2193   // Section 1: connection to the outside
2194   // Section 2: commection to the bellow
2195   // Section 3: between 1 and 2
2196   const Float_t kRB26s3CompTubeInnerR1    = 30.0/2.;  // Outer Connection tubes inner radius     [Pos 4 + 3]
2197   const Float_t kRB26s3CompTubeOuterR1    = 30.6/2.;  // Outer Connection tubes outer radius     [Pos 4 + 3]
2198   const Float_t kRB26s3CompTubeInnerR2    = 29.4/2.;  // Connection tubes inner radius           [Pos 4 + 3]
2199   const Float_t kRB26s3CompTubeOuterR2    = 30.0/2.;  // Connection tubes outer radius           [Pos 4 + 3]
2200   const Float_t kRB26s3CompTubeInnerR3    = 30.6/2.;  // Connection tubes inner radius at bellow [Pos 4 + 3]
2201   const Float_t kRB26s3CompTubeOuterR3    = 32.2/2.;  // Connection tubes outer radius at bellow [Pos 4 + 3]
2202  
2203   const Float_t kRB26s3WeldingTubeLeftL1  =  2.0;     // Left connection tube length             [Pos 4]
2204   const Float_t kRB26s3WeldingTubeLeftL2  =  3.4;     // Left connection tube length             [Pos 4]
2205   const Float_t kRB26s3WeldingTubeLeftL   =  7.0;     // Left connection tube total length       [Pos 4]
2206   const Float_t kRB26s3WeldingTubeRightL1 =  2.3;     // Right connection tube length            [Pos 3] (0.3 cm added for welding)
2207   const Float_t kRB26s3WeldingTubeRightL2 = 13.4;     // Right connection tube length            [Pos 3]
2208
2209   const Float_t kRB26s3WeldingTubeT1      =  0.6;     // Length of first r-transition            [Pos 4 + 3]
2210   const Float_t kRB26s3WeldingTubeT2      =  1.0;     // Length of 2nd   r-transition            [Pos 4 + 3]       
2211
2212       
2213       
2214   const Float_t kRB26s3RingOuterR         = 36.1/2.;  // Ring inner radius                       [Pos 4]
2215   const Float_t kRB26s3RingL              =  0.8/2.;  // Ring half length                        [Pos 4]
2216   const Float_t kRB26s3RingZ              =  3.7   ;  // Ring z-position                         [Pos 4]
2217   const Float_t kRB26s3ProtOuterR         = 36.2/2.;  // Protection tube outer radius            [Pos 2]
2218   const Float_t kRB26s3ProtL              = 27.0/2.;  // Protection tube half length             [Pos 2]
2219   const Float_t kRB26s3ProtZ              =  4.0   ;  // Protection tube z-position              [Pos 2]
2220    
2221       
2222   // Mother volume
2223   //
2224   TGeoPcon* shRB26s3Compensator  = new TGeoPcon(0., 360., 6);
2225   shRB26s3Compensator->DefineSection( 0,   0.0, 0., kRB26s3CompTubeOuterR1);
2226   shRB26s3Compensator->DefineSection( 1,   kRB26s3RingZ, 0., kRB26s3CompTubeOuterR1);      
2227   shRB26s3Compensator->DefineSection( 2,   kRB26s3RingZ, 0., kRB26s3ProtOuterR);      
2228   shRB26s3Compensator->DefineSection( 3,   kRB26s3ProtZ + 2. * kRB26s3ProtL, 0., kRB26s3ProtOuterR);            
2229   shRB26s3Compensator->DefineSection( 4,   kRB26s3ProtZ + 2. * kRB26s3ProtL, 0., kRB26s3CompTubeOuterR1);
2230   shRB26s3Compensator->DefineSection( 5,   kRB26s3CompL                    , 0., kRB26s3CompTubeOuterR1);            
2231   TGeoVolume* voRB26s3Compensator  =  
2232     new TGeoVolume("RB26s3Compensator", shRB26s3Compensator, kMedVac);
2233             
2234   //
2235   // [Pos 1] Bellow
2236   //      
2237   //
2238   TGeoVolume* voRB26s3Bellow = new TGeoVolume("RB26s3Bellow", 
2239                                               new TGeoTube(kRB26s3BellowRi, kRB26s3BellowRo, kRB26s3BellowUndL/2.), kMedVac);
2240   //      
2241   //  Upper part of the undulation
2242   //
2243   TGeoTorus* shRB26s3PlieTorusU  =  new TGeoTorus(kRB26s3BellowRo - kRB26s3PlieR, kRB26s3PlieR - kRB26s3PlieThickness, kRB26s3PlieR);
2244   shRB26s3PlieTorusU->SetName("RB26s3TorusU");
2245   TGeoTube*  shRB26s3PlieTubeU   =  new TGeoTube (kRB26s3BellowRo - kRB26s3PlieR, kRB26s3BellowRo, kRB26s3PlieR);
2246   shRB26s3PlieTubeU->SetName("RB26s3TubeU");
2247   TGeoCompositeShape*  shRB26s3UpperPlie = new TGeoCompositeShape("RB26s3UpperPlie", "RB26s3TorusU*RB26s3TubeU");
2248  
2249   TGeoVolume* voRB26s3WiggleU = new TGeoVolume("RB26s3UpperPlie", shRB26s3UpperPlie, kMedSteel);
2250   //
2251   // Lower part of the undulation
2252   TGeoTorus* shRB26s3PlieTorusL =  new TGeoTorus(kRB26s3BellowRi + kRB26s3PlieR, kRB26s3PlieR - kRB26s3PlieThickness, kRB26s3PlieR);
2253   shRB26s3PlieTorusL->SetName("RB26s3TorusL");
2254   TGeoTube*  shRB26s3PlieTubeL   =  new TGeoTube (kRB26s3BellowRi, kRB26s3BellowRi + kRB26s3PlieR, kRB26s3PlieR);
2255   shRB26s3PlieTubeL->SetName("RB26s3TubeL");
2256   TGeoCompositeShape*  shRB26s3LowerPlie = new TGeoCompositeShape("RB26s3LowerPlie", "RB26s3TorusL*RB26s3TubeL");
2257       
2258   TGeoVolume* voRB26s3WiggleL = new TGeoVolume("RB26s3LowerPlie", shRB26s3LowerPlie, kMedSteel); 
2259
2260   //
2261   // Connection between upper and lower part of undulation
2262   TGeoVolume* voRB26s3WiggleC1 = new TGeoVolume("RB26s3PlieConn1",  
2263                                                 new TGeoTube(kRB26s3BellowRi + kRB26s3PlieR, 
2264                                                              kRB26s3BellowRo - kRB26s3PlieR, kRB26s3PlieThickness / 2.), kMedSteel);
2265   //
2266   // One wiggle
2267   TGeoVolumeAssembly* voRB26s3Wiggle = new TGeoVolumeAssembly("RB26s3Wiggle");
2268   z0 =  -  kRB26s3PlieThickness / 2.;
2269   voRB26s3Wiggle->AddNode(voRB26s3WiggleC1,  1 , new TGeoTranslation(0., 0., z0));
2270   z0 += kRB26s3PlieR -  kRB26s3PlieThickness / 2.;
2271   voRB26s3Wiggle->AddNode(voRB26s3WiggleU,   1 , new TGeoTranslation(0., 0., z0));
2272   z0 += kRB26s3PlieR -  kRB26s3PlieThickness / 2.;
2273   voRB26s3Wiggle->AddNode(voRB26s3WiggleC1,  2 , new TGeoTranslation(0., 0., z0));
2274   z0 += kRB26s3PlieR -  kRB26s3PlieThickness;
2275   voRB26s3Wiggle->AddNode(voRB26s3WiggleL,  1 , new TGeoTranslation(0., 0., z0));
2276   // Positioning of the volumes
2277   z0   = - kRB26s3BellowUndL/2.+ kRB26s3ConnectionPlieR;
2278   voRB26s3Bellow->AddNode(voRB26s3WiggleL, 1, new TGeoTranslation(0., 0., z0));
2279   z0  +=  kRB26s3ConnectionPlieR;
2280   zsh  = 4. *  kRB26s3PlieR -  2. * kRB26s3PlieThickness;
2281   for (Int_t iw = 0; iw < kRB26s3NumberOfPlies; iw++) {
2282     Float_t zpos =  z0 + iw * zsh;      
2283     voRB26s3Bellow->AddNode(voRB26s3Wiggle,  iw + 1, new TGeoTranslation(0., 0., zpos -  kRB26s3PlieThickness));        
2284   }
2285
2286   voRB26s3Compensator->AddNode(voRB26s3Bellow, 1,  new TGeoTranslation(0., 0., kRB26s3WeldingTubeLeftL + kRB26s3BellowUndL/2.));
2287
2288
2289   //
2290   // [Pos 2] Outer Protecting Tube
2291   //      
2292   TGeoTube* shRB26s3CompProtTube = new TGeoTube(kRB26s3RingOuterR, kRB26s3ProtOuterR, kRB26s3ProtL);
2293   TGeoVolume* voRB26s3CompProtTube =  
2294     new TGeoVolume("RB26s3CompProtTube", shRB26s3CompProtTube, kMedSteel);
2295   voRB26s3Compensator->AddNode(voRB26s3CompProtTube, 1,  new TGeoTranslation(0., 0., kRB26s3ProtZ + kRB26s3ProtL));
2296       
2297
2298   //
2299   // [Pos 3] Right Welding Tube
2300   //      
2301   TGeoPcon* shRB26s3CompRightTube = new TGeoPcon(0., 360., 5);
2302   z0 = 0.;
2303   shRB26s3CompRightTube->DefineSection(0, z0,  kRB26s3CompTubeInnerR3, kRB26s3CompTubeOuterR3);
2304   z0 += kRB26s3WeldingTubeT2;
2305   shRB26s3CompRightTube->DefineSection(1, z0,  kRB26s3CompTubeInnerR2, kRB26s3CompTubeOuterR2);
2306   z0 += kRB26s3WeldingTubeRightL2;
2307   shRB26s3CompRightTube->DefineSection(2, z0,  kRB26s3CompTubeInnerR2, kRB26s3CompTubeOuterR2);
2308   z0 += kRB26s3WeldingTubeT1;
2309   shRB26s3CompRightTube->DefineSection(3, z0,  kRB26s3CompTubeInnerR1, kRB26s3CompTubeOuterR1);
2310   z0 += kRB26s3WeldingTubeRightL1;
2311   shRB26s3CompRightTube->DefineSection(4, z0,  kRB26s3CompTubeInnerR1, kRB26s3CompTubeOuterR1);
2312       
2313   TGeoVolume* voRB26s3CompRightTube =  
2314     new TGeoVolume("RB26s3CompRightTube", shRB26s3CompRightTube, kMedSteel);
2315   voRB26s3Compensator->AddNode(voRB26s3CompRightTube,  1, new TGeoTranslation(0., 0.,  kRB26s3CompL - z0));
2316
2317   //
2318   // [Pos 4] Left Welding Tube
2319   //      
2320   TGeoPcon* shRB26s3CompLeftTube = new TGeoPcon(0., 360., 5);
2321   z0 = 0.;
2322   shRB26s3CompLeftTube->DefineSection(0, z0,  kRB26s3CompTubeInnerR1, kRB26s3CompTubeOuterR1);
2323   z0 += kRB26s3WeldingTubeLeftL1;
2324   shRB26s3CompLeftTube->DefineSection(1, z0,  kRB26s3CompTubeInnerR1, kRB26s3CompTubeOuterR1);
2325   z0 += kRB26s3WeldingTubeT1;
2326   shRB26s3CompLeftTube->DefineSection(2, z0,  kRB26s3CompTubeInnerR2, kRB26s3CompTubeOuterR2);
2327   z0 += kRB26s3WeldingTubeLeftL2;
2328   shRB26s3CompLeftTube->DefineSection(3, z0,  kRB26s3CompTubeInnerR2, kRB26s3CompTubeOuterR2);
2329   z0 += kRB26s3WeldingTubeT2;
2330   shRB26s3CompLeftTube->DefineSection(4, z0,  kRB26s3CompTubeInnerR3, kRB26s3CompTubeOuterR3);
2331
2332   TGeoVolume* voRB26s3CompLeftTube =  
2333     new TGeoVolume("RB26s3CompLeftTube", shRB26s3CompLeftTube, kMedSteel);
2334   voRB26s3Compensator->AddNode(voRB26s3CompLeftTube, 1,  gGeoIdentity);
2335   //
2336   // [Pos 5] Ring
2337   //      
2338   TGeoTube* shRB26s3CompRing = new TGeoTube(kRB26s3CompTubeOuterR2, kRB26s3RingOuterR, kRB26s3RingL);
2339   TGeoVolume* voRB26s3CompRing =  
2340     new TGeoVolume("RB26s3CompRing", shRB26s3CompRing, kMedSteel);
2341   voRB26s3Compensator->AddNode(voRB26s3CompRing,  1, new TGeoTranslation(0., 0., kRB26s3RingZ + kRB26s3RingL));
2342
2343
2344
2345   ///////////////////////////////////////////
2346   //                                       //
2347   //    RB26/4-5                           //  
2348   //    Drawing LHCV2a_0012 [as installed] //
2349   ////////////////////////////////////////////
2350   //    Pos1 Vacuum Tubes        LHCVC2A__0014
2351   //    Pos2 Compensator         LHCVC2A__0066
2352   //    Pos3 Fixed Point Section LHCVC2A__0016
2353   //    Pos4 Split Flange        LHCVFX___0005
2354   //    Pos5 RotableFlange       LHCVFX___0009
2355   ////////////////////////////////////////////
2356
2357   ///////////////////////////////////
2358   //    RB26/4-5 Vacuum Tubes      //
2359   //    Drawing  LHCVC2a_0014      //
2360   /////////////////////////////////// 
2361   const Float_t kRB26s45TubeL = 593.12 + 0.3; // 0.3 cm added for welding
2362       
2363   TGeoPcon* shRB26s45Tube = new TGeoPcon(0., 360., 11);
2364   // Section 1: straight section
2365   shRB26s45Tube->DefineSection( 0,   0.00, 30.00/2., 30.60/2.);
2366   shRB26s45Tube->DefineSection( 1,   1.20, 30.00/2., 30.60/2.);
2367   shRB26s45Tube->DefineSection( 2,   1.20, 30.00/2., 30.80/2.);
2368   shRB26s45Tube->DefineSection( 3,  25.10, 30.00/2., 30.80/2.);      
2369   // Section 2: 0.932 deg opening cone
2370   shRB26s45Tube->DefineSection( 4, 486.10, 45.00/2., 45.80/2.);      
2371   // Section 3: straight section 4 mm 
2372   shRB26s45Tube->DefineSection( 5, 512.10, 45.00/2., 45.80/2.);
2373   // Section 4: straight section 3 mm
2374   shRB26s45Tube->DefineSection( 6, 512.10, 45.00/2., 45.60/2.);
2375   shRB26s45Tube->DefineSection( 7, 527.70, 45.00/2., 45.60/2.);
2376   // Section 4: closing cone 
2377   shRB26s45Tube->DefineSection( 8, 591.30, 10.00/2., 10.60/2.);      
2378   shRB26s45Tube->DefineSection( 9, 591.89, 10.00/2., 10.30/2.);      
2379
2380   shRB26s45Tube->DefineSection(10, kRB26s45TubeL, 10.00/2., 10.30/2.);      
2381   TGeoVolume* voRB26s45Tube  =  
2382     new TGeoVolume("RB26s45Tube", shRB26s45Tube, kMedSteel);
2383
2384   TGeoVolume* voRB26s45TubeM  = new TGeoVolume("RB26s45TubeM", MakeMotherFromTemplate(shRB26s45Tube), kMedVac);
2385   voRB26s45TubeM->AddNode(voRB26s45Tube, 1, gGeoIdentity);
2386             
2387       
2388
2389   ///////////////////////////////////
2390   //    RB26/5   Axial Compensator //
2391   //    Drawing  LHCVC2a_0066      //
2392   /////////////////////////////////// 
2393   const Float_t kRB26s5CompL             = 27.60;    // Length of the compensator (0.30 cm added for welding)
2394   const Float_t kRB26s5BellowRo          = 12.48/2.; // Bellow outer radius        [Pos 1]
2395   const Float_t kRB26s5BellowRi          = 10.32/2.; // Bellow inner radius        [Pos 1] 
2396   const Int_t   kRB26s5NumberOfPlies     = 15;       // Number of plies            [Pos 1] 
2397   const Float_t kRB26s5BellowUndL        = 10.50;    // Length of undulated region [Pos 1] 
2398   const Float_t kRB26s5PlieThickness     =  0.025;   // Plie thickness             [Pos 1]
2399   const Float_t kRB26s5ConnectionPlieR   =  0.21;    // Connection plie radius     [Pos 1] 
2400   const Float_t kRB26s5ConnectionR       = 11.2/2.;  // Bellow connection radius   [Pos 1] 
2401   //  Plie radius
2402   const Float_t kRB26s5PlieR = 
2403     (kRB26s5BellowUndL - 4. *  kRB26s5ConnectionPlieR + 2. * kRB26s5PlieThickness + 
2404      (2. *  kRB26s5NumberOfPlies - 2.) * kRB26s5PlieThickness) / (4. * kRB26s5NumberOfPlies - 2.);
2405   const Float_t kRB26s5CompTubeInnerR    = 10.00/2.;  // Connection tubes inner radius     [Pos 2 + 3]
2406   const Float_t kRB26s5CompTubeOuterR    = 10.30/2.;  // Connection tubes outer radius     [Pos 2 + 3]
2407   const Float_t kRB26s5WeldingTubeLeftL  =  3.70/2.;  // Left connection tube half length  [Pos 2]
2408   const Float_t kRB26s5WeldingTubeRightL = 13.40/2.;  // Right connection tube half length [Pos 3]   (0.3 cm added for welding)
2409   const Float_t kRB26s5RingInnerR        = 11.2/2.;   // Ring inner radius                 [Pos 4]
2410   const Float_t kRB26s5RingOuterR        = 16.0/2.;   // Ring inner radius                 [Pos 4]
2411   const Float_t kRB26s5RingL             =  0.4/2.;   // Ring half length                  [Pos 4]
2412   const Float_t kRB26s5RingZ             = 14.97;     // Ring z-position                   [Pos 4]
2413   const Float_t kRB26s5ProtOuterR        = 16.2/2.;   // Protection tube outer radius      [Pos 5]
2414   const Float_t kRB26s5ProtL             = 13.0/2.;   // Protection tube half length       [Pos 5]
2415   const Float_t kRB26s5ProtZ             =  2.17;     // Protection tube z-position        [Pos 5]
2416   const Float_t kRB26s5DetailZR          = 11.3/2.;   // Detail Z max radius
2417       
2418       
2419   // Mother volume
2420   //
2421   TGeoPcon* shRB26s5Compensator  = new TGeoPcon(0., 360., 8);
2422   shRB26s5Compensator->DefineSection( 0,   0.0,                                                  0., kRB26s5CompTubeOuterR);
2423   shRB26s5Compensator->DefineSection( 1,   kRB26s5ProtZ,                                         0., kRB26s5CompTubeOuterR);      
2424   shRB26s5Compensator->DefineSection( 2,   kRB26s5ProtZ,                                         0., kRB26s5ProtOuterR);
2425   shRB26s5Compensator->DefineSection( 3,   kRB26s5ProtZ + 2. * kRB26s5ProtL + 2. * kRB26s5RingL, 0., kRB26s5ProtOuterR);      
2426   shRB26s5Compensator->DefineSection( 4,   kRB26s5ProtZ + 2. * kRB26s5ProtL + 2. * kRB26s5RingL, 0., kRB26s5DetailZR);
2427   shRB26s5Compensator->DefineSection( 5,   kRB26s5CompL - 8.,                                    0., kRB26s5DetailZR);
2428   shRB26s5Compensator->DefineSection( 6,   kRB26s5CompL - 8.,                                    0., kRB26s5CompTubeOuterR);            
2429   shRB26s5Compensator->DefineSection( 7,   kRB26s5CompL,                                         0., kRB26s5CompTubeOuterR);            
2430   TGeoVolume* voRB26s5Compensator  = new TGeoVolume("RB26s5Compensator", shRB26s5Compensator, kMedVac);
2431             
2432   //
2433   // [Pos 1] Bellow
2434   //      
2435   //
2436   TGeoVolume* voRB26s5Bellow = new TGeoVolume("RB26s5Bellow", 
2437                                               new TGeoTube(kRB26s5BellowRi, kRB26s5BellowRo, kRB26s5BellowUndL/2.), kMedVac);
2438   //      
2439   //  Upper part of the undulation
2440   //
2441   TGeoTorus* shRB26s5PlieTorusU  =  new TGeoTorus(kRB26s5BellowRo - kRB26s5PlieR, kRB26s5PlieR - kRB26s5PlieThickness, kRB26s5PlieR);
2442   shRB26s5PlieTorusU->SetName("RB26s5TorusU");
2443   TGeoTube*  shRB26s5PlieTubeU   =  new TGeoTube (kRB26s5BellowRo - kRB26s5PlieR, kRB26s5BellowRo, kRB26s5PlieR);
2444   shRB26s5PlieTubeU->SetName("RB26s5TubeU");
2445   TGeoCompositeShape*  shRB26s5UpperPlie = new TGeoCompositeShape("RB26s5UpperPlie", "RB26s5TorusU*RB26s5TubeU");
2446  
2447   TGeoVolume* voRB26s5WiggleU = new TGeoVolume("RB26s5UpperPlie", shRB26s5UpperPlie, kMedSteel);
2448   //
2449   // Lower part of the undulation
2450   TGeoTorus* shRB26s5PlieTorusL =  new TGeoTorus(kRB26s5BellowRi + kRB26s5PlieR, kRB26s5PlieR - kRB26s5PlieThickness, kRB26s5PlieR);
2451   shRB26s5PlieTorusL->SetName("RB26s5TorusL");
2452   TGeoTube*  shRB26s5PlieTubeL   =  new TGeoTube (kRB26s5BellowRi, kRB26s5BellowRi + kRB26s5PlieR, kRB26s5PlieR);
2453   shRB26s5PlieTubeL->SetName("RB26s5TubeL");
2454   TGeoCompositeShape*  shRB26s5LowerPlie = new TGeoCompositeShape("RB26s5LowerPlie", "RB26s5TorusL*RB26s5TubeL");
2455       
2456   TGeoVolume* voRB26s5WiggleL = new TGeoVolume("RB26s5LowerPlie", shRB26s5LowerPlie, kMedSteel); 
2457
2458   //
2459   // Connection between upper and lower part of undulation
2460   TGeoVolume* voRB26s5WiggleC1 = new TGeoVolume("RB26s5PlieConn1",  
2461                                                 new TGeoTube(kRB26s5BellowRi + kRB26s5PlieR, 
2462                                                              kRB26s5BellowRo - kRB26s5PlieR, kRB26s5PlieThickness / 2.), kMedSteel);
2463   //
2464   // One wiggle
2465   TGeoVolumeAssembly* voRB26s5Wiggle = new TGeoVolumeAssembly("RB26s5Wiggle");
2466   z0 =  -  kRB26s5PlieThickness / 2.;
2467   voRB26s5Wiggle->AddNode(voRB26s5WiggleC1,  1 , new TGeoTranslation(0., 0., z0));
2468   z0 += kRB26s5PlieR -  kRB26s5PlieThickness / 2.;
2469   voRB26s5Wiggle->AddNode(voRB26s5WiggleU,   1 , new TGeoTranslation(0., 0., z0));
2470   z0 += kRB26s5PlieR -  kRB26s5PlieThickness / 2.;
2471   voRB26s5Wiggle->AddNode(voRB26s5WiggleC1,  2 , new TGeoTranslation(0., 0., z0));
2472   z0 += kRB26s5PlieR -  kRB26s5PlieThickness;
2473   voRB26s5Wiggle->AddNode(voRB26s5WiggleL ,  1 , new TGeoTranslation(0., 0., z0));
2474   // Positioning of the volumes
2475   z0   = - kRB26s5BellowUndL/2.+ kRB26s5ConnectionPlieR;
2476   voRB26s5Bellow->AddNode(voRB26s5WiggleL, 1, new TGeoTranslation(0., 0., z0));
2477   z0  +=  kRB26s5ConnectionPlieR;
2478   zsh  = 4. *  kRB26s5PlieR -  2. * kRB26s5PlieThickness;
2479   for (Int_t iw = 0; iw < kRB26s5NumberOfPlies; iw++) {
2480     Float_t zpos =  z0 + iw * zsh;      
2481     voRB26s5Bellow->AddNode(voRB26s5Wiggle,  iw + 1, new TGeoTranslation(0., 0., zpos -  kRB26s5PlieThickness));        
2482   }
2483
2484   voRB26s5Compensator->AddNode(voRB26s5Bellow, 1,  new TGeoTranslation(0., 0., 2. * kRB26s5WeldingTubeLeftL + kRB26s5BellowUndL/2.));
2485       
2486   //
2487   // [Pos 2] Left Welding Tube
2488   //      
2489   TGeoPcon* shRB26s5CompLeftTube = new TGeoPcon(0., 360., 3);
2490   z0 = 0;
2491   shRB26s5CompLeftTube->DefineSection(0, z0, kRB26s5CompTubeInnerR, kRB26s5CompTubeOuterR);
2492   z0 += 2 * kRB26s5WeldingTubeLeftL - ( kRB26s5ConnectionR - kRB26s5CompTubeOuterR);
2493   shRB26s5CompLeftTube->DefineSection(1, z0, kRB26s5CompTubeInnerR, kRB26s5CompTubeOuterR);
2494   z0 += ( kRB26s5ConnectionR - kRB26s5CompTubeOuterR);
2495   shRB26s5CompLeftTube->DefineSection(2, z0, kRB26s5ConnectionR - 0.15, kRB26s5ConnectionR);
2496   TGeoVolume* voRB26s5CompLeftTube = new TGeoVolume("RB26s5CompLeftTube", shRB26s5CompLeftTube, kMedSteel);
2497   voRB26s5Compensator->AddNode(voRB26s5CompLeftTube, 1,  gGeoIdentity);
2498   //
2499   // [Pos 3] Right Welding Tube
2500   //      
2501   TGeoPcon* shRB26s5CompRightTube = new TGeoPcon(0., 360., 11);
2502   // Detail Z
2503   shRB26s5CompRightTube->DefineSection( 0, 0.  , kRB26s5CompTubeInnerR + 0.22, 11.2/2.);
2504   shRB26s5CompRightTube->DefineSection( 1, 0.05, kRB26s5CompTubeInnerR + 0.18, 11.2/2.);
2505   shRB26s5CompRightTube->DefineSection( 2, 0.22, kRB26s5CompTubeInnerR       , 11.2/2. - 0.22);
2506   shRB26s5CompRightTube->DefineSection( 3, 0.44, kRB26s5CompTubeInnerR       , 11.2/2.);
2507   shRB26s5CompRightTube->DefineSection( 4, 1.70, kRB26s5CompTubeInnerR       , 11.2/2.);
2508   shRB26s5CompRightTube->DefineSection( 5, 2.10, kRB26s5CompTubeInnerR       , kRB26s5CompTubeOuterR);
2509   shRB26s5CompRightTube->DefineSection( 6, 2.80, kRB26s5CompTubeInnerR       , kRB26s5CompTubeOuterR);
2510   shRB26s5CompRightTube->DefineSection( 7, 2.80, kRB26s5CompTubeInnerR       , 11.3/2.);
2511   shRB26s5CompRightTube->DefineSection( 8, 3.40, kRB26s5CompTubeInnerR       , 11.3/2.);
2512   // Normal pipe
2513   shRB26s5CompRightTube->DefineSection( 9, 3.50, kRB26s5CompTubeInnerR       , kRB26s5CompTubeOuterR);
2514   shRB26s5CompRightTube->DefineSection(10, 2. * kRB26s5WeldingTubeRightL, kRB26s5CompTubeInnerR, kRB26s5CompTubeOuterR);
2515       
2516   TGeoVolume* voRB26s5CompRightTube =  
2517     new TGeoVolume("RB26s5CompRightTube", shRB26s5CompRightTube, kMedSteel);
2518   voRB26s5Compensator->AddNode(voRB26s5CompRightTube,  1, 
2519                                new TGeoTranslation(0., 0.,  kRB26s5CompL - 2. * kRB26s5WeldingTubeRightL));
2520   //
2521   // [Pos 4] Ring
2522   //      
2523   TGeoTube* shRB26s5CompRing = new TGeoTube(kRB26s5RingInnerR, kRB26s5RingOuterR, kRB26s5RingL);
2524   TGeoVolume* voRB26s5CompRing =  
2525     new TGeoVolume("RB26s5CompRing", shRB26s5CompRing, kMedSteel);
2526   voRB26s5Compensator->AddNode(voRB26s5CompRing,  1, new TGeoTranslation(0., 0., kRB26s5RingZ + kRB26s5RingL));
2527
2528   //
2529   // [Pos 5] Outer Protecting Tube
2530   //      
2531   TGeoTube* shRB26s5CompProtTube = new TGeoTube(kRB26s5RingOuterR, kRB26s5ProtOuterR, kRB26s5ProtL);
2532   TGeoVolume* voRB26s5CompProtTube =  
2533     new TGeoVolume("RB26s5CompProtTube", shRB26s5CompProtTube, kMedSteel);
2534   voRB26s5Compensator->AddNode(voRB26s5CompProtTube, 1,  new TGeoTranslation(0., 0., kRB26s5ProtZ + kRB26s5ProtL));
2535
2536   ///////////////////////////////////////
2537   //    RB26/4   Fixed Point Section   //
2538   //    Drawing  LHCVC2a_0016          //
2539   /////////////////////////////////////// 
2540   const Float_t kRB26s4TubeRi            =  30.30/2. ; // Tube inner radius  (0.3 cm added for welding)
2541   const Float_t kRB26s4TubeRo            =  30.60/2. ; // Tube outer radius      
2542   const Float_t kRB26s4FixedPointL       =  12.63    ; // Length of the fixed point section
2543   const Float_t kRB26s4FixedPointZ       =  10.53    ; // Position of the ring (0.15 added for welding)
2544   const Float_t kRB26s4FixedPointD       =   0.595   ; // Width of the ring
2545   const Float_t kRB26s4FixedPointR       =  31.60/2. ; // Radius of the ring
2546       
2547   TGeoPcon* shRB26s4FixedPoint = new TGeoPcon(0., 360., 6);
2548   z0 = 0.;
2549   shRB26s4FixedPoint->DefineSection(0, z0, kRB26s4TubeRi, kRB26s4TubeRo);
2550   z0 += kRB26s4FixedPointZ;
2551   shRB26s4FixedPoint->DefineSection(1, z0, kRB26s4TubeRi, kRB26s4TubeRo);      
2552   shRB26s4FixedPoint->DefineSection(2, z0, kRB26s4TubeRi, kRB26s4FixedPointR);            
2553   z0 += kRB26s4FixedPointD;
2554   shRB26s4FixedPoint->DefineSection(3, z0, kRB26s4TubeRi, kRB26s4FixedPointR);            
2555   shRB26s4FixedPoint->DefineSection(4, z0, kRB26s4TubeRi, kRB26s4TubeRo);
2556   z0 = kRB26s4FixedPointL;
2557   shRB26s4FixedPoint->DefineSection(5, z0, kRB26s4TubeRi, kRB26s4TubeRo);
2558   TGeoVolume* voRB26s4FixedPoint = new TGeoVolume("RB26s4FixedPoint", shRB26s4FixedPoint, kMedSteel);
2559       
2560   TGeoVolume* voRB26s4FixedPointM = new TGeoVolume("RB26s4FixedPointM", MakeMotherFromTemplate(shRB26s4FixedPoint), kMedVac);
2561   voRB26s4FixedPointM->AddNode(voRB26s4FixedPoint, 1, gGeoIdentity);
2562             
2563
2564   ///////////////////////////////////////
2565   //    RB26/4   Split Flange          //
2566   //    Drawing  LHCVFX__0005          //
2567   /////////////////////////////////////// 
2568   const Float_t kRB26s4SFlangeL      =  2.99;        // Length of the flange
2569   const Float_t kRB26s4SFlangeD1     =  0.85;        // Length of section 1
2570   const Float_t kRB26s4SFlangeD2     =  0.36;        // Length of section 2                                                  
2571   const Float_t kRB26s4SFlangeD3     =  0.73 + 1.05; // Length of section 3                                                        
2572   const Float_t kRB26s4SFlangeRo     = 36.20/2.;     // Flange outer radius 
2573   const Float_t kRB26s4SFlangeRi1    = 30.60/2.;     // Flange inner radius section 1
2574   const Float_t kRB26s4SFlangeRi2    = 30.00/2.;     // Flange inner radius section 2
2575   const Float_t kRB26s4SFlangeRi3    = 30.60/2.;     // Flange inner radius section 3
2576   z0 = 0;
2577   TGeoPcon* shRB26s4SFlange = new TGeoPcon(0., 360., 6);
2578   z0 = 0.;
2579   shRB26s4SFlange->DefineSection(0, z0, kRB26s4SFlangeRi1, kRB26s4SFlangeRo);
2580   z0 += kRB26s4SFlangeD1;
2581   shRB26s4SFlange->DefineSection(1, z0, kRB26s4SFlangeRi1, kRB26s4SFlangeRo);
2582   shRB26s4SFlange->DefineSection(2, z0, kRB26s4SFlangeRi2, kRB26s4SFlangeRo);
2583   z0 += kRB26s4SFlangeD2;
2584   shRB26s4SFlange->DefineSection(3, z0, kRB26s4SFlangeRi2, kRB26s4SFlangeRo);
2585   shRB26s4SFlange->DefineSection(4, z0, kRB26s4SFlangeRi3, kRB26s4SFlangeRo);
2586   z0 += kRB26s4SFlangeD3;
2587   shRB26s4SFlange->DefineSection(5, z0, kRB26s4SFlangeRi3, kRB26s4SFlangeRo);
2588   TGeoVolume* voRB26s4SFlange = new TGeoVolume("RB26s4SFlange", shRB26s4SFlange, kMedSteel);
2589
2590   TGeoVolume* voRB26s4SFlangeM = new TGeoVolume("RB26s4SFlangeM", MakeMotherFromTemplate(shRB26s4SFlange, 0, 3), kMedVac);
2591   voRB26s4SFlangeM->AddNode(voRB26s4SFlange, 1, gGeoIdentity);
2592       
2593   ///////////////////////////////////////
2594   //    RB26/5   Rotable Flange        //
2595   //    Drawing  LHCVFX__0009          //
2596   /////////////////////////////////////// 
2597   const Float_t kRB26s5RFlangeL      =  1.86;    // Length of the flange
2598   const Float_t kRB26s5RFlangeD1     =  0.61;    // Length of section 1
2599   const Float_t kRB26s5RFlangeD2     =  0.15;    // Length of section 2                                              
2600   const Float_t kRB26s5RFlangeD3     =  0.60;    // Length of section 3                                                    
2601   const Float_t kRB26s5RFlangeD4     =  0.50;    // Length of section 4                                                    
2602   const Float_t kRB26s5RFlangeRo     = 15.20/2.; // Flange outer radius 
2603   const Float_t kRB26s5RFlangeRi1    = 10.30/2.; // Flange inner radius section 1
2604   const Float_t kRB26s5RFlangeRi2    = 10.00/2.; // Flange inner radius section 2
2605   const Float_t kRB26s5RFlangeRi3    = 10.30/2.; // Flange inner radius section 3
2606   const Float_t kRB26s5RFlangeRi4    = 10.50/2.; // Flange inner radius section 4
2607
2608   z0 = 0;
2609   TGeoPcon* shRB26s5RFlange = new TGeoPcon(0., 360., 8);
2610   z0 = 0.;
2611   shRB26s5RFlange->DefineSection(0, z0, kRB26s5RFlangeRi4, kRB26s5RFlangeRo);
2612   z0 += kRB26s5RFlangeD4;
2613   shRB26s5RFlange->DefineSection(1, z0, kRB26s5RFlangeRi4, kRB26s5RFlangeRo);
2614   shRB26s5RFlange->DefineSection(2, z0, kRB26s5RFlangeRi3, kRB26s5RFlangeRo);
2615   z0 += kRB26s5RFlangeD3;
2616   shRB26s5RFlange->DefineSection(3, z0, kRB26s5RFlangeRi3, kRB26s5RFlangeRo);
2617   shRB26s5RFlange->DefineSection(4, z0, kRB26s5RFlangeRi2, kRB26s5RFlangeRo);
2618   z0 += kRB26s5RFlangeD2;
2619   shRB26s5RFlange->DefineSection(5, z0, kRB26s5RFlangeRi2, kRB26s5RFlangeRo);
2620   shRB26s5RFlange->DefineSection(6, z0, kRB26s5RFlangeRi1, kRB26s5RFlangeRo);
2621   z0 += kRB26s5RFlangeD1;
2622   shRB26s5RFlange->DefineSection(7, z0, kRB26s5RFlangeRi1, kRB26s5RFlangeRo);
2623   TGeoVolume* voRB26s5RFlange = new TGeoVolume("RB26s5RFlange", shRB26s5RFlange, kMedSteel);
2624
2625   TGeoVolume* voRB26s5RFlangeM = new TGeoVolume("RB26s5RFlangeM", MakeMotherFromTemplate(shRB26s5RFlange, 4, 7), kMedVac);
2626   voRB26s5RFlangeM->AddNode(voRB26s5RFlange, 1, gGeoIdentity);
2627
2628   //      
2629   // Assemble RB26/1-2
2630   //
2631   TGeoVolumeAssembly* asRB26s12 = new TGeoVolumeAssembly("RB26s12"); 
2632   z0 = 0.;
2633   asRB26s12->AddNode(voRB26s1RFlange,       1, gGeoIdentity);
2634   z0 += kRB26s1RFlangeIsL + kRB26s1RFlangeFpL;
2635   asRB26s12->AddNode(voRB26s12TubeM,         1, new TGeoTranslation(0., 0., z0));
2636   z0 += kRB26s12TubeL;
2637   asRB26s12->AddNode(voRB26s2Compensator,   1, new TGeoTranslation(0., 0., z0));
2638   z0 += kRB26s2CompL;
2639   z0 -= kRB26s2FFlangeD1;
2640   asRB26s12->AddNode(voRB26s2FFlangeM,       1, new TGeoTranslation(0., 0., z0));
2641   z0 += kRB26s2FFlangeL;
2642   const Float_t kRB26s12L = z0;
2643
2644   //
2645   // Assemble RB26/3
2646   //
2647   TGeoVolumeAssembly* asRB26s3 = new TGeoVolumeAssembly("RB26s3"); 
2648   z0 = 0.;
2649   asRB26s3->AddNode(voRB26s3SFlangeM,      1, gGeoIdentity);
2650   z0 +=  kRB26s3SFlangeL;
2651   z0 -=  kRB26s3SFlangeD3;
2652   asRB26s3->AddNode(voRB26s3FixedPointM,   1, new TGeoTranslation(0., 0., z0));
2653   z0 += kRB26s3FixedPointL;
2654   asRB26s3->AddNode(voRB26s3TubeM,         1, new TGeoTranslation(0., 0., z0));
2655   z0 += kRB26s3TubeL;
2656   asRB26s3->AddNode(voRB26s3Compensator,   1, new TGeoTranslation(0., 0., z0));
2657   z0 += kRB26s3CompL;
2658   z0 -= kRB26s3FFlangeD1;
2659   asRB26s3->AddNode(voRB26s3FFlangeM,      1, new TGeoTranslation(0., 0., z0));
2660   z0 += kRB26s3FFlangeL;
2661   const Float_t kRB26s3L = z0;
2662       
2663
2664   //
2665   // Assemble RB26/4-5
2666   //
2667   TGeoVolumeAssembly* asRB26s45 = new TGeoVolumeAssembly("RB26s45"); 
2668   z0 = 0.;
2669   asRB26s45->AddNode(voRB26s4SFlangeM,       1, gGeoIdentity);
2670   z0 +=  kRB26s4SFlangeL;
2671   z0 -=  kRB26s4SFlangeD3;
2672   asRB26s45->AddNode(voRB26s4FixedPointM,    1, new TGeoTranslation(0., 0., z0));
2673   z0 += kRB26s4FixedPointL;
2674   asRB26s45->AddNode(voRB26s45TubeM,         1, new TGeoTranslation(0., 0., z0));
2675   z0 += kRB26s45TubeL;
2676   asRB26s45->AddNode(voRB26s5Compensator,    1, new TGeoTranslation(0., 0., z0));
2677   z0 += kRB26s5CompL;
2678   z0 -= kRB26s5RFlangeD3;
2679   z0 -= kRB26s5RFlangeD4;
2680   asRB26s45->AddNode(voRB26s5RFlangeM,       1, new TGeoTranslation(0., 0., z0));
2681   z0 += kRB26s5RFlangeL;
2682   const Float_t kRB26s45L = z0;
2683       
2684   //
2685   // Assemble RB26
2686   //
2687   TGeoVolumeAssembly* asRB26Pipe = new TGeoVolumeAssembly("RB26Pipe"); 
2688   z0 = 0.;
2689   asRB26Pipe->AddNode(asRB26s12,       1, new TGeoTranslation(0., 0., z0));
2690   z0 +=  kRB26s12L;
2691   asRB26Pipe->AddNode(asRB26s3,        1, new TGeoTranslation(0., 0., z0));
2692   z0 +=  kRB26s3L;
2693   asRB26Pipe->AddNode(asRB26s45,       1, new TGeoTranslation(0., 0., z0));
2694   z0 +=  kRB26s45L;
2695   top->AddNode(asRB26Pipe, 1, new TGeoCombiTrans(0., 0., -82., rot180));
2696 }
2697
2698
2699
2700 //___________________________________________
2701 void AliPIPEv4::CreateMaterials()
2702 {
2703   //
2704   // Define materials for beam pipe
2705   //
2706
2707   AliDebugClass(1,"Create PIPEv4 materials");
2708   Int_t   isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
2709   Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
2710   // Steel (Inox)  
2711   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
2712   Float_t zsteel[4] = { 26.,24.,28.,14. };
2713   Float_t wsteel[4] = { .715,.18,.1,.005 };
2714   // AlBe - alloy 
2715   Float_t aAlBe[2] = { 26.98, 9.01};
2716   Float_t zAlBe[2] = { 13.00, 4.00};
2717   Float_t wAlBe[2] = { 0.4, 0.6};
2718   //
2719   // Polyamid
2720   Float_t aPA[4] = {16., 14., 12.,  1.};
2721   Float_t zPA[4] = { 8.,  7.,  6.,  1.};
2722   Float_t wPA[4] = { 1.,  1.,  6., 11.};
2723   //
2724   // Air 
2725   //
2726   Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
2727   Float_t zAir[4]={6.,7.,8.,18.};
2728   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
2729   Float_t dAir = 1.20479E-3;
2730   Float_t dAir1 = 1.20479E-10;
2731   //
2732   // Insulation powder
2733   //                    Si         O       Ti     Al
2734   Float_t ains[4] ={28.0855, 15.9994, 47.867,  26.982};
2735   Float_t zins[4] ={14.,      8.    , 22.   ,  13.   };
2736   Float_t wins[4] ={ 0.3019,  0.4887,  0.1914,  0.018};
2737   //
2738   //
2739   // Anticorodal
2740   //
2741   // Al Si7 Mg 0.6
2742   //
2743   Float_t aaco[3] ={26.982, 28.0855, 24.035};
2744   Float_t zaco[3] ={13.,    14.    , 12.   };
2745   Float_t waco[3] ={ 0.924,  0.07,  0.006};
2746   // Kapton
2747   //
2748   Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
2749   Float_t zKapton[4]={1.,6.,7.,8.};
2750   Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
2751   Float_t dKapton = 1.42;
2752   // NEG coating
2753   //                  Ti     V      Zr
2754   Float_t aNEG[4] = {47.87, 50.94, 91.24};
2755   Float_t zNEG[4] = {22.00, 23.00, 40.00};
2756   Float_t wNEG[4] = {1./3., 1./3., 1./3.};  
2757   Float_t dNEG = 5.6; // ?
2758
2759   //
2760   //
2761   //     Berillium 
2762   AliMaterial(5, "BERILLIUM$", 9.01, 4., 1.848, 35.3, 36.7);
2763   //
2764   //     Carbon 
2765   AliMaterial(6,  "CARBON$   ", 12.01, 6., 2.265, 18.8, 49.9);
2766   //
2767   //     Aluminum 
2768   AliMaterial(9,  "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
2769   //
2770   //     Copper 
2771   AliMaterial(10, "COPPER", 63.55, 29, 8.96, 1.43, 85.6/8.96);
2772   //
2773   //     Air 
2774   AliMixture(15, "AIR$      ", aAir, zAir, dAir, 4, wAir);
2775   AliMixture(35, "AIR_HIGH$ ", aAir, zAir, dAir, 4, wAir);
2776   //
2777   //     Vacuum 
2778   AliMixture(16, "VACUUM$ ", aAir, zAir, dAir1, 4, wAir);
2779   //
2780   //     stainless Steel 
2781   AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
2782   //
2783   //     reduced density steel to approximate pump getter material
2784   AliMixture(20, "GETTER$", asteel, zsteel, 1.00, 4, wsteel);
2785   //     Al-Be alloy
2786   //     
2787   AliMixture(21, "AlBe$", aAlBe, zAlBe, 2.07, 2, wAlBe);
2788   //     Polyamid
2789   //   
2790   AliMixture(22, "PA$", aPA, zPA, 1.14, -4, wPA);
2791   //
2792   //     Kapton
2793   AliMixture(23, "KAPTON", aKapton, zKapton, dKapton, 4, wKapton);
2794   // Anticorodal 
2795   AliMixture(24, "ANTICORODAL", aaco, zaco, 2.66, 3, waco);
2796   
2797   //
2798   //     Insulation powder 
2799   AliMixture(14, "INSULATION0$", ains, zins, 0.41, 4, wins);
2800   AliMixture(34, "INSULATION1$", ains, zins, 0.41, 4, wins);
2801   AliMixture(54, "INSULATION2$", ains, zins, 0.41, 4, wins);
2802
2803   //    NEG
2804   AliMixture(25, "NEG COATING", aNEG, zNEG, dNEG, -3, wNEG);
2805    
2806    
2807   // **************** 
2808   //     Defines tracking media parameters. 
2809   //
2810   Float_t epsil  = .001;    // Tracking precision, 
2811   Float_t stemax = -0.01;   // Maximum displacement for multiple scat 
2812   Float_t tmaxfd = -20.;    // Maximum angle due to field deflection 
2813   Float_t deemax = -.3;     // Maximum fractional energy loss, DLS 
2814   Float_t stmin  = -.8;
2815   // *************** 
2816   //
2817   //    Beryllium 
2818   
2819   AliMedium(5, "BE",       5, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2820
2821   //    Carbon 
2822   AliMedium(6, "C",        6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2823   //
2824   //    Aluminum 
2825   AliMedium(9, "ALU",      9, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2826   //    Copper 
2827   AliMedium(10, "CU",      10, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2828   //
2829   //    Air 
2830   AliMedium(15, "AIR",     15, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2831   AliMedium(35, "AIR_HIGH",35, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2832   //
2833   //    Vacuum 
2834   AliMedium(16, "VACUUM", 16, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2835   //
2836   //    Steel 
2837   AliMedium(19, "INOX",   19, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2838   //
2839   //    Getter 
2840   AliMedium(20, "GETTER", 20, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2841   //
2842   //   AlBe - Aloy 
2843   AliMedium(21, "AlBe"  , 21, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2844   //
2845   //   Polyamid
2846   AliMedium(22, "PA"  ,   22, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2847   //   Antocorodal
2848   AliMedium(24, "ANTICORODAL",   24, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2849   //    Insulation Powder 
2850   AliMedium(14, "INS_C0          ", 14, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2851   AliMedium(34, "INS_C1          ", 34, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2852   AliMedium(54, "INS_C2          ", 54, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2853   //
2854   //   KAPTON
2855   AliMedium(23, "KAPTON", 23, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2856
2857   //
2858   //   NEG
2859   AliMedium(25, "NEG COATING", 25, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2860 }
2861
2862
2863 TGeoPcon* AliPIPEv4::MakeMotherFromTemplate(TGeoPcon* shape, Int_t imin, Int_t imax, Float_t r0, Int_t nz)
2864 {
2865   //
2866   //  Create a mother shape from a template setting some min radii to 0
2867   //
2868   Int_t nz0 = shape->GetNz();
2869   // if nz > -1 the number of planes is given by nz
2870   if (nz != -1) nz0 = nz;
2871   TGeoPcon* mother = new TGeoPcon(0., 360., nz0);
2872
2873   if (imin == -1 || imax == -1) {
2874     imin = 0;
2875     imax = shape->GetNz();
2876   } else if (imax >= nz0) {
2877     imax = nz0 - 1;
2878     printf("Warning: imax reset to nz-1 %5d %5d %5d %5d\n", imin, imax, nz, nz0);
2879   }
2880     
2881
2882     
2883   for (Int_t i = 0;  i < shape->GetNz(); i++) {
2884     Double_t rmin = shape->GetRmin(i);
2885     if ((i >= imin) && (i <= imax) ) rmin = r0;
2886     Double_t rmax = shape->GetRmax(i);
2887     Double_t    z = shape->GetZ(i);
2888     mother->DefineSection(i, z, rmin, rmax);
2889   }
2890   return mother;
2891     
2892 }
2893
2894 TGeoPcon* AliPIPEv4::MakeInsulationFromTemplate(TGeoPcon* shape)
2895 {
2896   //
2897   //  Create an beam pipe insulation layer shape from a template
2898   //
2899   Int_t nz = shape->GetNz();
2900   TGeoPcon* insu = new TGeoPcon(0., 360., nz);
2901     
2902   for (Int_t i = 0;  i < nz; i++) {
2903     Double_t    z = shape->GetZ(i);
2904     Double_t rmin = shape->GetRmin(i);
2905     Double_t rmax = shape->GetRmax(i);
2906     rmax += 0.5;
2907     shape->DefineSection(i, z, rmin, rmax);     
2908     rmin  = rmax - 0.5;
2909     insu->DefineSection(i, z, rmin, rmax);      
2910   }
2911   return insu;
2912     
2913 }
2914
2915
2916 TGeoVolume* AliPIPEv4::MakeBellow(const char* ext, Int_t nc, Float_t rMin, Float_t rMax, Float_t dU, Float_t rPlie, Float_t dPlie)
2917 {
2918   // nc     Number of convolution
2919   // rMin   Inner radius of the bellow
2920   // rMax   Outer radius of the bellow
2921   // dU     Undulation length
2922   // rPlie  Plie radius
2923   // dPlie  Plie thickness
2924   const TGeoMedium* kMedVac    =  gGeoManager->GetMedium("PIPE_VACUUM");    
2925   const TGeoMedium* kMedSteel  =  gGeoManager->GetMedium("PIPE_INOX");   
2926
2927   char name[64], nameA[64], nameB[64], bools[64];
2928   sprintf(name, "%sBellowUS", ext);
2929   TGeoVolume* voBellow = new TGeoVolume(name, new TGeoTube(rMin, rMax, dU/2.), kMedVac);
2930   //      
2931   //  Upper part of the undulation
2932   //
2933   TGeoTorus* shPlieTorusU  =  new TGeoTorus(rMax - rPlie, rPlie - dPlie, rPlie);
2934   sprintf(nameA, "%sTorusU", ext);
2935   shPlieTorusU->SetName(nameA);
2936   TGeoTube*  shPlieTubeU   =  new TGeoTube (rMax - rPlie, rMax, rPlie);
2937   sprintf(nameB, "%sTubeU", ext);
2938   shPlieTubeU->SetName(nameB);
2939   sprintf(name, "%sUpperPlie", ext);
2940   sprintf(bools, "%s*%s", nameA, nameB);
2941   TGeoCompositeShape*  shUpperPlie = new TGeoCompositeShape(name, bools);
2942     
2943   TGeoVolume* voWiggleU = new TGeoVolume(name, shUpperPlie, kMedSteel);
2944   //
2945   // Lower part of the undulation
2946   TGeoTorus* shPlieTorusL =  new TGeoTorus(rMin + rPlie, rPlie - dPlie, rPlie);
2947   sprintf(nameA, "%sTorusL", ext);
2948   shPlieTorusL->SetName(nameA);
2949   TGeoTube*  shPlieTubeL  =  new TGeoTube (rMin, rMin + rPlie, rPlie);
2950   sprintf(nameB, "%sTubeL", ext);
2951   shPlieTubeL->SetName(nameB);
2952   sprintf(name, "%sLowerPlie", ext);
2953   sprintf(bools, "%s*%s", nameA, nameB);
2954   TGeoCompositeShape*  shLowerPlie = new TGeoCompositeShape(name, bools);
2955     
2956   TGeoVolume* voWiggleL = new TGeoVolume(name, shLowerPlie, kMedSteel); 
2957     
2958   //
2959   // Connection between upper and lower part of undulation
2960   sprintf(name, "%sPlieConn1", ext);
2961   TGeoVolume* voWiggleC1 = new TGeoVolume(name, new TGeoTube(rMin + rPlie, rMax - rPlie, dPlie/2.), kMedSteel);
2962   //
2963   // One wiggle
2964   Float_t dz = rPlie -  dPlie / 2.;
2965   Float_t z0 = -  dPlie / 2.;
2966   sprintf(name, "%sWiggle", ext);
2967   TGeoVolumeAssembly* asWiggle = new TGeoVolumeAssembly(name);
2968   asWiggle->AddNode(voWiggleC1,  1 , new TGeoTranslation(0., 0., z0));
2969   z0 += dz;
2970   asWiggle->AddNode(voWiggleU,   1 , new TGeoTranslation(0., 0., z0));
2971   z0 += dz;
2972   asWiggle->AddNode(voWiggleC1,  2 , new TGeoTranslation(0., 0., z0));
2973   z0 += dz;
2974   asWiggle->AddNode(voWiggleL ,  1 , new TGeoTranslation(0., 0., z0));
2975   // Positioning of the volumes
2976   z0   = - dU / 2.+ rPlie;
2977   voBellow->AddNode(voWiggleL, 2, new TGeoTranslation(0., 0., z0));
2978   z0  +=  rPlie;
2979   Float_t zsh  = 4. *  rPlie -  2. * dPlie;
2980   for (Int_t iw = 0; iw < nc; iw++) {
2981     Float_t zpos =  z0 + iw * zsh;      
2982     voBellow->AddNode(asWiggle,  iw + 1, new TGeoTranslation(0., 0., zpos - dPlie));    
2983   }
2984   return voBellow;
2985 }
2986
2987
2988
2989