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