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