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