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