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