FairRoot/PandaRoot
fts/createRootGeometry_beampipe.C
Go to the documentation of this file.
1 // =============================================================================
2 //
3 // macro to create the PANDA beam pipe geometry
4 // Author: Paul Buehler, paul.buehler@oeaw.ac.at
5 //
6 // Revisions:
7 // v1: October, 2011
8 //
9 // This files is based on the CAD drawing which is available at the PANDA EDMS
10 // system (https://edms.cern.ch/project/FAIR-000000770) and which was created by
11 // Alexander Gruber (a9302331@unet.univie.ac.at).
12 //
13 //
14 // =============================================================================
16 
17  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
18  TString vmcWorkdir = getenv("VMCWORKDIR");
19 
20  // materials and media
21  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
22  FairGeoInterface* geoFace = geoLoad->getGeoInterface();
23  geoFace->setMediaFile(vmcWorkdir+"/geometry/media_pnd.geo");
24  geoFace->readMedia();
25  FairGeoMedia* geoMedia = geoFace->getMedia();
26  FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
27 
28  FairGeoMedium* FairMediumAir = geoMedia->getMedium("air");
29  FairGeoMedium* FairMediumSteel = geoMedia->getMedium("steel");
30  FairGeoMedium* FairMediumTi = geoMedia->getMedium("titanium");
31  geoBuild->createMedium(FairMediumAir);
32  geoBuild->createMedium(FairMediumSteel);
33  geoBuild->createMedium(FairMediumTi);
34 
35  // open output file
36  TString fGeoFile= Form("beampipe_201111.root");
37  TFile* fi = new TFile(fGeoFile,"RECREATE");
38 
39  // define cave
40  TGeoVolume* cave;
41  TGeoBBox* lTop = new TGeoBBox(200,200,300);
42  cave = new TGeoVolume("BeamPipe", lTop, gGeoManager->GetMedium("air"));
43  gGeoManager->SetTopVolume(cave);
44 
45 
46  // ---------------------------------------------------------------------------
47  // the full geometry is built-up by adding volumes starting from the most
48  // upstream position, variable currentz is continuously updated and allways
49  // contains the z-coordinate of the most down-stream point of the geometry
50  Double_t currentz = 0.0;
51 
52  // z-position of very first point
53  Double_t z0 = -459.9328; // with this z0 the target is at z = 0.
54 
55  // Definition of some constants, dummy shapes, transformations
56  Double_t const rad = 3.1415926/180.;
57  Double_t const delta = 1.E-6;
58 
59  TGeoRotation* r1 = new TGeoRotation("r1",0.,0.,0.); // no rotation
60  TGeoRotation* r2 = new TGeoRotation("r2", 0., 90., 180.); // 90 deg about x-axis and 180 deg about y axis
61  TGeoRotation* r3 = new TGeoRotation("r3", 0.,-90., 0); // -90 deg about x-axis
62  TGeoRotation* r4 = new TGeoRotation("r4", 90., 0., 0); // 90 deg about z-axis
63 
64  TGeoCombiTrans* tr0 = new TGeoCombiTrans("tra0",0.,0.,z0,r1); tr0->RegisterYourself();
65 
66  // ---------------------------------------------------------------------------
67  // define valves and pumps which are used at different places
68 
69  TGeoCombiTrans* trv1 = new TGeoCombiTrans("trv1",0.,0.,1.075, r1); trv1->RegisterYourself();
70  TGeoCombiTrans* trv2 = new TGeoCombiTrans("trv2",0.,0.,3.53875, r1); trv2->RegisterYourself();
71  TGeoCombiTrans* trv3 = new TGeoCombiTrans("trv3",0.,0.,6.0075, r1); trv3->RegisterYourself();
72 
73  // VAT -Gate Valve CF63
74  // width in z is 7.
75  Double_t ov1[3] = {0.,5.7,0.};
76  TGeoBBox* VATvalve63a = new TGeoBBox("VATvalve63a",5.6,12.45,1.35,ov1);
77  TGeoTube* VATvalve63b = new TGeoTube("VATvalve63b",3.5,6.5,1.075);
78  TGeoTube* tv1 = new TGeoTube("tv1",0.,3.5,1.35+delta);
79 
80  TGeoCompositeShape *SVATvalve630 = new TGeoCompositeShape("VATvalve630","VATvalve63a-tv1");
81  TGeoCompositeShape *SVATvalve63 = new TGeoCompositeShape("VATvalve63","VATvalve63b:trv1+VATvalve630:trv2+VATvalve63b:trv3");
82 
83 
84  // VAT -Gate Valve CF100
85  // width in z is 7.
86  Double_t ov2[3] = {0.,7.3,0.};
87  TGeoBBox* VATvalve100a = new TGeoBBox("VATvalve100a",7.2,16.0,1.35,ov2);
88  TGeoTube* VATvalve100b = new TGeoTube("VATvalve100b",5.0,8.25,1.075);
89  TGeoTube* tv2 = new TGeoTube("tv2",0.,5.0,1.35+delta);
90 
91  TGeoCompositeShape *SVATvalve1000 = new TGeoCompositeShape("VATvalve1000","VATvalve100a-tv2");
92  TGeoCompositeShape *SVATvalve100 = new TGeoCompositeShape("VATvalve100","VATvalve100b:trv1+VATvalve1000:trv2+VATvalve100b:trv3");
93 
94 
95  // VAT -Gate Valve CF160
96  // width in z is 7.
97  Double_t ov3[3] = {0.,9.9,0.};
98  TGeoBBox* VATvalve160a = new TGeoBBox("VATvalve160a",9.1,21.75,1.35,ov3);
99  TGeoTube* VATvalve160b = new TGeoTube("VATvalve160b",7.5,11.25,1.075);
100  TGeoTube* tv3 = new TGeoTube("tv3",0.,7.5,1.35+delta);
101 
102  TGeoCompositeShape *SVATvalve1000 = new TGeoCompositeShape("VATvalve1600","VATvalve160a-tv3");
103  TGeoCompositeShape *SVATvalve100 = new TGeoCompositeShape("VATvalve160","VATvalve160b:trv1+VATvalve1600:trv2+VATvalve160b:trv3");
104 
105 
106  // Turbovac_SL700_CF160
107  Double_t psv1[27] = {0.,360.,8,
108  .0, 6.0, 10.85,
109  7.6, 6.0, 10.85,
110  7.6, 6.0, 10.15,
111  16.6, 6.0, 10.15,
112  16.6, 6.0, 9.0,
113  24.0, 6.0, 9.0,
114  24.0, 0., 9.0,
115  24.2, 0., 9.0
116  };
117  TGeoPcon* TVP700 = new TGeoPcon("TVP700",0.,360.,8);
118  TVP700->SetDimensions(psv1);
119 
120 
121  // Turbovac_1000C_CF160
122  Double_t psv2[39] = {0.,360.,12,
123  0.0, 7.5, 11.25,
124  2.45, 7.5, 11.25,
125  2.45, 7.5, 7.965,
126  3.45, 7.5, 7.965,
127  6.45, 7.5, 12.9,
128  8.45, 0., 12.9,
129  8.45, 0., 12.05,
130  24.00, 0., 12.05,
131  24.00, 0., 12.9,
132  26.00, 0., 12.9,
133  26.00, 0., 7.5,
134  36.85, 0., 7.5
135  };
136  TGeoPcon* TVP1000 = new TGeoPcon("TVP1000",0.,360.,12);
137  TVP1000->SetDimensions(psv2);
138 
139 
140  // Ion getter pump 1000l/s
141  // is approximated as a cylinder
142  Double_t psv3[21] = {0.,360.,6,
143  0., 7.5, 10.125,
144  2.0, 7.5, 10.125,
145  2.0, 7.5, 7.7,
146  10.0, 7.5, 7.7,
147  10.0, 0., 20.0,
148  60.7, 0., 20.0
149  };
150  TGeoPcon* IGP1000 = new TGeoPcon("IGP1000",0.,360.,6);
151  IGP1000->SetDimensions(psv3);
152 
153  // ---------------------------------------------------------------------------
154  // Definition of the volumes from up- to down-stream
155  // The naming of the shapes and volumes follows the naming in the CATIA
156  // drawing
157  //
158  // ---------------------------------------------------------------------------
159  // a - GV to HESR (GV to HESR.1)
160 
161  // VAT -Gate Valve CF100
162  TGeoVolume *Vgvhesr = new TGeoVolume("gvhesr",SVATvalve100 , gGeoManager->GetMedium("steel"));
163  Vgvhesr->SetLineColor(30);
164 
165  // last z-position: 7.
166  currentz += 7.;
167  fprintf(stderr,"currentz a: %f\n", currentz);
168 
169  // ---------------------------------------------------------------------------
170  // b - pipe upstream (pipe upstream.1)
171 
172  Double_t psb1[27] = {0.,360.,8,
173  0., 4.35, 7.58,
174  2.0, 4.35, 7.58,
175  2.0, 4.35, 4.45,
176  20.0, 4.35, 4.45,
177  31.3328, 7.50, 7.60,
178  156.0328, 7.50, 7.60,
179  156.0328, 7.50, 10.125,
180  158.2328, 7.50, 10.125
181  };
182  TGeoPcon* pipeup = new TGeoPcon("pipeup",0.,360.,8);
183  pipeup->SetDimensions(psb1);
184 
185  TGeoCombiTrans* trb1 = new TGeoCombiTrans("trb1",0.,0.,z0+currentz,r1); trb1->RegisterYourself();
186 
187  TGeoVolume *Vpipeup = new TGeoVolume("pipeup", pipeup, gGeoManager->GetMedium("steel"));
188  Vpipeup->SetLineColor(31);
189 
190  // last z-position: 165.2328
191  currentz += 158.2328;
192  fprintf(stderr,"currentz b: %f\n", currentz);
193 
194  // ---------------------------------------------------------------------------
195  // c - KreuzTMpump (KreuzTMpump.1)
196 
197  // horizontal/vertical bar of the cross
198  Double_t psc1[21] = {0.,360.,6,
199  -16.7, 7.50, 10.125,
200  -14.5, 7.50, 10.125,
201  -14.5, 7.50, 7.70,
202  14.5, 7.50, 7.70,
203  14.5, 7.50, 10.125,
204  16.7, 7.50, 10.125
205  };
206  TGeoPcon* ktmpump0 = new TGeoPcon("ktmpump0",0.,360.,6);
207  ktmpump0->SetDimensions(psc1);
208  TGeoTube* tc1 = new TGeoTube("tc1",0.,7.7,7.7);
209 
210  TGeoCombiTrans* trc1 = new TGeoCombiTrans("trc1",0.,0.,0,r2); trc1->RegisterYourself();
211  TGeoCombiTrans* trc2 = new TGeoCombiTrans("trc2",0.,0.,z0+currentz+16.7,r1); trc2->RegisterYourself();
212 
213  TGeoCompositeShape *csc1 = new TGeoCompositeShape("csc1","(ktmpump0-tc1:trc1)");
214  TGeoCompositeShape *Sktmpump = new TGeoCompositeShape("ktmpump","csc1+(csc1:trc1)");
215 
216  TGeoVolume *Vktmpump = new TGeoVolume("ktmpump", Sktmpump, gGeoManager->GetMedium("steel"));
217  Vktmpump->SetLineColor(32);
218 
219  // last z-position: 181.932800
220  currentz += 16.7;
221  fprintf(stderr,"currentz c1: %f\n", currentz);
222 
223  // ...........................................................................
224 
225  // add Turbovac_1000C_CF160 and GV_CF160
226  TGeoCombiTrans* trc3 = new TGeoCombiTrans("trc3",0., 0., 7.0,r1); trc3->RegisterYourself();
227  TGeoCombiTrans* trc4 = new TGeoCombiTrans("trc4",0.,-16.7,currentz,r2); trc4->RegisterYourself();
228  TGeoCombiTrans* trc5 = new TGeoCombiTrans("trc5",0., 16.7,currentz,r3); trc5->RegisterYourself();
229 
230  TGeoCompositeShape *STVPwValve = new TGeoCompositeShape("TVPwValve","(VATvalve160+TVP1000:trc3)");
231  TGeoCompositeShape *STpumps = new TGeoCompositeShape("Tpumps","TVPwValve:trc4+TVPwValve:trc5");
232 
233  TGeoVolume *VTpumps = new TGeoVolume("Tpump", STpumps, gGeoManager->GetMedium("steel"));
234  VTpumps->SetLineColor(33);
235 
236 
237  // last z-position: 198.6328
238  currentz += 16.7;
239  fprintf(stderr,"currentz c2: %f\n", currentz);
240 
241  // ---------------------------------------------------------------------------
242  // d - pipeTSup.1, special_flange.1, coneExtensionUpstreamSteel.1
243 
244  Double_t psd1[27] = {0.,360.,8,
245  0.0, 7.5, 10.125,
246  2.20, 7.5, 10.125,
247  2.20, 7.5, 7.70,
248  148.80, 7.5, 7.70,
249  148.80, 7.5, 10.125,
250  153.80, 7.5, 10.125,
251  153.80, 7.5, 7.70,
252  231.30, 7.5, 7.70
253  };
254  TGeoPcon* pipeTSup = new TGeoPcon("pipeTSup",0.,360.,8);
255  pipeTSup->SetDimensions(psd1);
256 
257  TGeoCombiTrans* trd1 = new TGeoCombiTrans("trd1",0.,0.,z0+currentz,r1); trd1->RegisterYourself();
258 
259  TGeoVolume *VpipeTSup = new TGeoVolume("pipeTSup", pipeTSup, gGeoManager->GetMedium("steel"));
260  VpipeTSup->SetLineColor(34);
261 
262 
263  // last z-position: 429.9328
264  currentz += 231.3;
265  fprintf(stderr,"currentz d: %f\n", currentz);
266 
267  // ---------------------------------------------------------------------------
268  // e - TargetKreuz.1
269 
270  // target position
271  Double_t tz = 30.0.;
272  fprintf(stderr,"Target position: 0 / 0 / %f\n",z0+currentz+tz);
273 
274  // target cross - horizontal
275  Double_t pse1[24] = {0.,360.,7,
276  0., 7.5, 7.55,
277  10.45, 7.5, 7.55,
278  26.8, 1.25, 1.30,
279  26.8, 1.25, 1.27,
280  29.98, 1.25, 1.27,
281  29.98, 0., 1.27,
282  tz, 0., 1.27
283  };
284  TGeoPcon* Tcross1 = new TGeoPcon("Tcross1",0.,360.,7);
285  Tcross1->SetDimensions(pse1);
286 
287  TGeoTube* Tcross2 = new TGeoTube("Tcross2",1.0,1.02,11.5);
288 
289  // target cross vertical
290  Double_t pse2[63] = {0.,360.,20,
291  -182.0, 7.5, 7.7,
292  -135.5, 7.5, 7.7,
293  -125.5, 4.5, 4.6,
294  -95.5, 4.5, 4.6,
295  -95.5, 3.0, 3.1,
296  -54.0, 3.0, 3.1,
297  -54.0, 2.0, 2.1,
298  -42.1, 2.0, 2.1,
299  -17.0, 2.0, 2.1,
300  -17.0, 1.0, 1.02,
301  17.0, 1.0, 1.02,
302  17.0, 2.0, 2.1,
303  42.1, 2.0, 2.1,
304  54.0, 2.0, 2.1,
305  54.0, 3.0, 3.1,
306  95.5, 3.0, 3.1,
307  95.5, 4.5, 4.6,
308  133.5, 4.5, 4.6,
309  143.5, 7.85, 7.95,
310  168.69, 7.85, 7.95,
311 
312  };
313  TGeoPcon* Tcross3 = new TGeoPcon("Tcross3",0.,360.,20);
314  Tcross3->SetDimensions(pse2);
315 
316  TGeoTube* te1 = new TGeoTube("te1",0.,1.25,0.51+delta);
317  TGeoTube* te2 = new TGeoTube("te2",0.,1.00,0.51+delta);
318  TGeoTube* te3 = new TGeoTube("te3",0.,1.00,1.27+delta);
319  TGeoTube* te4 = new TGeoTube("te4",0.,1.00,1.02+delta);
320 
321  TGeoCombiTrans* tre1 = new TGeoCombiTrans("tre1",0., 0., tz, r2); tre1->RegisterYourself();
322  TGeoCombiTrans* tre2 = new TGeoCombiTrans("tre2",0., 0.,-11.5, r2); tre2->RegisterYourself();
323  TGeoCombiTrans* tre3 = new TGeoCombiTrans("tre3",0., 0., 0., r2); tre3->RegisterYourself();
324  TGeoCombiTrans* tre4 = new TGeoCombiTrans("tre4",0., 0., -0.51, r1); tre4->RegisterYourself();
325  TGeoCombiTrans* tre5 = new TGeoCombiTrans("tre5",0., 0., 0.51, r1); tre5->RegisterYourself();
326  TGeoCombiTrans* tre6 = new TGeoCombiTrans("tre6",0., 0., 41.5, r1); tre6->RegisterYourself();
327  TGeoCombiTrans* tre7 = new TGeoCombiTrans("tre7",0., 0., tz, r1); tre7->RegisterYourself();
328  TGeoCombiTrans* tre8 = new TGeoCombiTrans("tre8",0., -175.0, tz, r3); tre8->RegisterYourself();
329 
330  TGeoCombiTrans* tre9 = new TGeoCombiTrans("tre9",0.,0.,z0+currentz, r1); tre9->RegisterYourself();
331 
332  TGeoCompositeShape *STcross0a = new TGeoCompositeShape("Tcross0a","Tcross1-te3:tre1");
333  TGeoCompositeShape *STcross0b = new TGeoCompositeShape("Tcross0b","Tcross2-te4:tre2");
334  TGeoCompositeShape *STcross0c = new TGeoCompositeShape("Tcross0c","Tcross3:tre3-te1:tre4-te2:tre5");
335 
336  TGeoCompositeShape *STcross = new TGeoCompositeShape("Tcross","Tcross0a+Tcross0b:tre6+Tcross0c:tre7+VATvalve160:tre8");
337 
338  TGeoVolume *VTcross = new TGeoVolume("Tcross", STcross, gGeoManager->GetMedium("titanium"));
339  VTcross->SetLineColor(35);
340 
341  // last z-position: 482.9328
342  currentz += 53.0;
343  fprintf(stderr,"currentz e: %f\n", currentz);
344 
345  // ---------------------------------------------------------------------------
346  // f - pipeTSdown
347 
348  Double_t psf1[51] = {0.,360.,16,
349  0.000, 1.0, 1.02,
350  3.7321, 2.0, 2.02,
351  3.7321, 2.0, 2.05,
352  93.0000, 2.0, 2.05,
353  97.4785, 3.2, 3.25,
354  101.0000, 3.2, 3.25,
355  101.0000, 3.2, 3.4,
356  106.0225, 3.2, 3.4,
357  106.0225, 3.2, 3.27,
358  241.8225, 3.2, 3.27,
359  241.8225, 3.2, 3.35,
360  244.8225, 3.2, 3.35,
361  244.8225, 3.2, 3.27,
362  261.0725, 3.2, 3.27,
363  261.0725, 3.2, 5.675,
364  262.8225, 3.2, 5.675
365  };
366  TGeoPcon* pipeTSdown = new TGeoPcon("pipeTSdown",0.,360.,16);
367  pipeTSdown->SetDimensions(psf1);
368 
369  TGeoCombiTrans* trf1 = new TGeoCombiTrans("trf1",0.,0.,z0+currentz,r1); trf1->RegisterYourself();
370 
371  TGeoVolume *VpipeTSdown = new TGeoVolume("pipeTSdown", pipeTSdown, gGeoManager->GetMedium("titanium"));
372  VpipeTSdown->SetLineColor(36);
373 
374  // last z-position: 745.7553
375  currentz += 262.8225;
376  fprintf(stderr,"currentz f: %f\n", currentz);
377 
378  // ---------------------------------------------------------------------------
379  // g - cross_TS_TMPs
380 
381  // horizontal part
382  Double_t psg1[27] = {0.,360.,8,
383  0.000, 3.2, 5.675,
384  1.7200, 3.2, 5.675,
385  1.7200, 3.2, 3.27,
386  3.3653, 3.2, 3.27,
387  10.0830, 5.0, 5.07,
388  51.0, 5.0, 5.07,
389  51.0, 5.0, 7.60,
390  53.0, 5.0, 7.60
391  };
392  TGeoPcon* crossTS1 = new TGeoPcon("crossTS1",0.,360.,8);
393  crossTS1->SetDimensions(psg1);
394 
395  TGeoTube* tg1 = new TGeoTube("tg1",0.,6.07,5.07+delta);
396  TGeoCombiTrans* trg1 = new TGeoCombiTrans("trg1" ,0.,0.,26.0, r2); trg1->RegisterYourself();
397  TGeoCompositeShape *ScrossTSa = new TGeoCompositeShape("crossTSa","crossTS1-tg1:trg1");
398 
399  // pipe perpendicular
400  Double_t psg2[21] = {0.,360.,6,
401  -55.0, 6.0, 10.125,
402  -52.8, 6.0, 10.125,
403  -52.8, 6.0, 6.07,
404  52.8, 6.0, 6.07,
405  52.8, 6.0, 10.125,
406  55.0, 6.0, 10.125
407  };
408  TGeoPcon* crossTS2 = new TGeoPcon("crossTS2",0.,360.,22);
409  crossTS2->SetDimensions(psg2);
410 
411  TGeoTube* tg2 = new TGeoTube("tg2",0.,5.07,6.07+delta);
412  TGeoCombiTrans* trg2 = new TGeoCombiTrans("trg2" ,0.,-55.0, 0., r2); trg2->RegisterYourself();
413  TGeoCombiTrans* trg3 = new TGeoCombiTrans("trg3" ,0., 55.0, 0., r3); trg3->RegisterYourself();
414  TGeoCombiTrans* trg4 = new TGeoCombiTrans("trg4" ,0., 0., 7.0775, r1); trg4->RegisterYourself();
415  TGeoCombiTrans* trg5 = new TGeoCombiTrans("trg5" ,0., 0., 33.0775, r1); trg5->RegisterYourself();
416 
417  // put it together
418  TGeoCompositeShape *ScrossTSb = new TGeoCompositeShape("crossTSb","crossTS2:r2-tg2+TVP700:trg2+TVP700:trg3");
419  TGeoCompositeShape *ScrossTS = new TGeoCompositeShape("crossTS" ,"crossTSa:trg4+crossTSb:trg5");
420 
421  TGeoCombiTrans* trg6 = new TGeoCombiTrans("trg6",0.,0.,60.0775, r1); trg6->RegisterYourself();
422  TGeoCombiTrans* trg7 = new TGeoCombiTrans("trg7",0.,0.,z0+currentz, r1); trg7->RegisterYourself();
423 
424  TGeoCompositeShape *ScrossTSTMPs = new TGeoCompositeShape("crossTSTMPs","VATvalve63+crossTS+VATvalve100:trg6");
425 
426  TGeoVolume *VcrossTSTMPs = new TGeoVolume("crossTSTMPs", ScrossTSTMPs, gGeoManager->GetMedium("steel"));
427  VcrossTSTMPs->SetLineColor(37);
428 
429  // last z-position: 812.9103
430  currentz += 67.155;
431  fprintf(stderr,"currentz g: %f\n", currentz);
432 
433  // ---------------------------------------------------------------------------
434  // h - BeamPipe Dipole
435  // The dipole pipe is bent with a radius of 60 m. All elements downstream of this
436  // element need to be rotated and shifted accordingly in the xz-plane.
437  Double_t R = 6000.0; // bending radius of the pipe
438  Double_t dz0 = 241.1985; // this is the length of the pipe along z
439  Double_t dphi = asin(dz0/R);
440  Double_t dx0 = R*(1.-cos(dphi));
441  TGeoRotation *dipolerot = new TGeoRotation("dipolerot",90.,dphi/rad, -90.); // rotation to accout for bendig
442 
443  // shifts need to be computed individually
444  // dz = dz0 + s*cos(dphi) where dx,dz0 is the point where the bended pipe ends
445  // dx = dx0 - s*sin(dphi) s is the length of the added elements
446  // combined transformations are then defined with ...
447  // TGeoCombiTrans* trpr = new TGeoCombiTrans("trpr", dx, 0., dz, dipolerot); trpr->RegisterYourself();
448  Double_t s = 0.;
449 
450  // horizontal pipe, first part
451  Double_t psh1[15] = {0.,360.,4,
452  0., 5.0, 7.6,
453  2.0, 5.0, 7.6,
454  2.0, 5.0, 5.2,
455  7.1225, 5.0, 5.2,
456  };
457  TGeoPcon* Dippip1 = new TGeoPcon("Dippip1",0.,360.,4);
458  Dippip1->SetDimensions(psh1);
459 
460  // horizontal pipe, bent part
461  TGeoTorus *Dippip2 = new TGeoTorus("Dippip2", R, 5.0, 5.2, 0., dphi/rad);
462  Double_t psh2[24] = {0.,360.,7,
463  0., 5.0, 5.2,
464  5.0225, 5.0, 5.2,
465  19.3385, 9.0, 9.2,
466  19.3385, 9.0, 9.3,
467  439.3572, 9.0, 9.3,
468  439.3572, 9.0, 12.65.,
469  441.7572, 9.0, 12.65,
470  };
471 
472  // horizontal pipe, third part
473  TGeoPcon* Dippip3 = new TGeoPcon("Dippip3",0.,360.,7);
474  Dippip3->SetDimensions(psh2);
475 
476  TGeoCombiTrans* trh1 = new TGeoCombiTrans("trh1", R,0.,7.1225, new TGeoRotation("a",0.,-90.,180.)); trh1->RegisterYourself();
477  TGeoCombiTrans* trh2 = new TGeoCombiTrans("trh2",dx0,.0.,7.1225+dz0, dipolerot); trh2->RegisterYourself();
478  s = s + 7.0775;
479  TGeoCombiTrans* trh3 = new TGeoCombiTrans("trh3",dx0+s*sin(dphi),0.,7.1225+dz0+s*cos(dphi),dipolerot); trh3->RegisterYourself();
480  s = s + 441.7572;
481  TGeoCombiTrans* trh4 = new TGeoCombiTrans("trh4",0.,0.,z0+currentz,r1); trh4->RegisterYourself();
482 
483  // put it together including VATvalve100
484  TGeoCompositeShape *SDippip = new TGeoCompositeShape("Dippip","Dippip1+Dippip2:trh1+VATvalve100:trh2+Dippip3:trh3");
485 
486  TGeoVolume *VDipolePip = new TGeoVolume("DipolePip", SDippip, gGeoManager->GetMedium("steel"));
487  VDipolePip->SetLineColor(38);
488 
489  // last z0-position: 1509.7031905 (s = 448.83470)
490  currentz += 7.1225+dz0+s*cos(dphi);
491  fprintf(stderr,"currentz/s h: %f %f\n", currentz,s);
492 
493  // ---------------------------------------------------------------------------
494  // i - Luminosity monitor
495 
496  // main body
497  Double_t psi1[33] = {0.,360.,10,
498  0., 9.0, 12.65,
499  2.4, 9.0, 12.65,
500  2.4, 9.0, 9.2,
501  4.4343, 9.0, 9.2,
502  17.5, 12.5, 12.7,
503  177.0, 12.5, 12.7,
504  195.66, 7.5, 7.7,
505  198.0, 7.5, 7.7,
506  198.0, 7.5, 10.125,
507  200.0, 7.5, 10.125
508  };
509  TGeoPcon* LumMon0 = new TGeoPcon("LumMon0",0.,360.,10);
510  LumMon0->SetDimensions(psi1);
511 
512  // nozzle
513  Double_t psi2[21] = {0.,360.,6,
514  -27.0, 5.2, 7.6,
515  -25.0, 5.2, 7.6,
516  -25.0, 5.2, 5.4,
517  25.0, 5.2, 5.4,
518  25.0, 5.2, 7.6,
519  27.0, 5.2, 7.6
520  };
521  TGeoPcon* nozzle0 = new TGeoPcon("nozzle0",0.,360.,6);
522  nozzle0->SetDimensions(psi2);
523 
524  TGeoTube* ti1 = new TGeoTube("ti1",0.,12.7,5.4+delta);
525  TGeoTube* ti2 = new TGeoTube("ti2",0.,5.0,12.7+delta);
526 
527  TGeoCombiTrans* tri1 = new TGeoCombiTrans("tri1",0.,0., 77.8,r2); tri1->RegisterYourself();
528  TGeoCombiTrans* tri2 = new TGeoCombiTrans("tri2",0.,0., 97.8,r2); tri2->RegisterYourself();
529  TGeoCombiTrans* tri3 = new TGeoCombiTrans("tri3",0.,0.,117.8,r2); tri3->RegisterYourself();
530  TGeoCombiTrans* tri4 = new TGeoCombiTrans("tri4",0.,0.,137.8,r2); tri4->RegisterYourself();
531  TGeoCombiTrans* tri5 = new TGeoCombiTrans("tri5",0.,0., 0., r4); tri5->RegisterYourself();
532 
533  // put it together
534  TGeoCompositeShape *Snozzle1 = new TGeoCompositeShape("nozzle1","(nozzle0-ti1:r2)");
535  TGeoCompositeShape *Snozzles = new TGeoCompositeShape("nozzles","nozzle1:tri1+nozzle1:tri2+nozzle1:tri3+nozzle1:tri4");
536  TGeoCompositeShape *Sholes = new TGeoCompositeShape("holes","ti1:tri1+ti1:tri2+ti1:tri3+ti1:tri4");
537  TGeoCompositeShape *SLumMon1 = new TGeoCompositeShape("LumMon1","LumMon0-holes-(holes:tri5)");
538  TGeoCompositeShape *SLumMon = new TGeoCompositeShape("LumMon","LumMon1+nozzles+(nozzles:tri5)");
539 
540  TGeoCombiTrans* tri6 = new TGeoCombiTrans("tri6",dx0+s*sin(dphi),0.,z0+currentz,dipolerot); tri6->RegisterYourself();
541  s = s + 200.00;
542 
543  TGeoVolume *VLumMon = new TGeoVolume("LumMon", SLumMon, gGeoManager->GetMedium("steel"));
544  VLumMon->SetLineColor(39);
545 
546 
547  // last z0-position: 1709.5415231 (s = 648.83470)
548  currentz += 200.00*cos(dphi);
549  fprintf(stderr,"currentz/s i: %f %f\n", currentz,s);
550 
551  // ---------------------------------------------------------------------------
552  // j - end cross
553 
554  // horizontal pipe, first part
555  Double_t psj1[15] = {0.,360.,4,
556  0., 7.5, 10.125,
557  2.0, 7.5, 10.125,
558  2.0, 7.5, 7.7,
559  16.7, 7.5, 7.7
560  };
561  TGeoPcon* EndCross0a = new TGeoPcon("EndCross0a",0.,360.,4);
562  EndCross0a->SetDimensions(psj1);
563 
564  // horizontal pipe, second part
565  Double_t psj2[15] = {0.,360.,4,
566  16.7, 4.5, 4.7,
567  34.7, 4.5, 4.7,
568  34.7, 4.5, 7.6,
569  36.7, 4.5, 7.6
570  };
571  TGeoPcon* EndCross0b = new TGeoPcon("EndCross0b",0.,360.,4);
572  EndCross0b->SetDimensions(psj2);
573 
574  // vertical pipe
575  Double_t psj3[21] = {0.,360.,6,
576  -16.7, 7.5, 10.125,
577  -14.7, 7.5, 10.125.,
578  -14.7, 7.5, 7.7,
579  14.7, 7.5, 7.7,
580  14.7, 7.5, 10.125.,
581  16.7, 7.5, 10.125
582  };
583  TGeoPcon* EndCross1 = new TGeoPcon("EndCross1",0.,360.,6);
584  EndCross1->SetDimensions(psj3);
585 
586  TGeoTube* tj1 = new TGeoTube("tj1",0.,7.7,10.125+delta);
587  TGeoTube* tj2 = new TGeoTube("tj2",0.,7.7,3.85+delta);
588  TGeoTube* tj2 = new TGeoTube("tj3",0.,4.7,3.85+delta);
589 
590  TGeoCombiTrans* trj1 = new TGeoCombiTrans("trj1",0., 0., 16.7, r2); trj1->RegisterYourself();
591  TGeoCombiTrans* trj2 = new TGeoCombiTrans("trj2",0., 0., 12.85-delta, r1); trj2->RegisterYourself();
592  TGeoCombiTrans* trj3 = new TGeoCombiTrans("trj3",0., 0., 20.55+delta, r1); trj3->RegisterYourself();
593  TGeoCombiTrans* trj4 = new TGeoCombiTrans("trj4",0., 0., 36.7, r1); trj4->RegisterYourself();
594  TGeoCombiTrans* trj5 = new TGeoCombiTrans("trj5",0., 16.7, 16.7, r3); trj5->RegisterYourself();
595  TGeoCombiTrans* trj6 = new TGeoCombiTrans("trj6",0., -23.7, 16.7, r3); trj6->RegisterYourself();
596  TGeoCombiTrans* trj6 = new TGeoCombiTrans("trj7",0., -23.7, 16.7, r2); trj6->RegisterYourself();
597 
598  // adding valves and pumps
599  TGeoCompositeShape *EndCross2 = new TGeoCompositeShape("EndCross2","EndCross0a+EndCross0b-tj1:trj1");
600  TGeoCompositeShape *EndCross3 = new TGeoCompositeShape("EndCross3","EndCross1:trj1-tj2:trj2-tj3:trj3");
601  TGeoCompositeShape *EndCross4 = new TGeoCompositeShape("EndCross4","TVPwValve:trj5+VATvalve160:trj6+IGP1000:trj7");
602  TGeoCompositeShape *EndCross = new TGeoCompositeShape("EndCross","EndCross2+EndCross3+EndCross4+VATvalve100:trj4");
603 
604  TGeoCombiTrans* trj8 = new TGeoCombiTrans("trj8",dx0+s*sin(dphi),0.,z0+currentz,dipolerot); trj8->RegisterYourself();
605  s = s + 43.7;
606 
607  TGeoVolume *VEndCross = new TGeoVolume("EndCross", EndCross, gGeoManager->GetMedium("steel"));
608  VEndCross->SetLineColor(40);
609 
610  // last z0-position: 1753.2061988 (s = 692.53470)
611  currentz += 43.7*cos(dphi);
612  fprintf(stderr,"currentz/s j: %f %f\n", currentz,s);
613 
614  // ---------------------------------------------------------------------------
615  // put all volumes together -> beamPipe
616  TGeoVolume *beamPipe = new TGeoVolumeAssembly("BeamPipe");
617  beamPipe->AddNode(Vgvhesr, 0, tr0); // a
618  beamPipe->AddNode(Vpipeup, 0, trb1); // b
619  beamPipe->AddNode(Vktmpump, 0, trc2); // c1
620  beamPipe->AddNode(VTpumps, 0, tr0); // c2
621  beamPipe->AddNode(VpipeTSup, 0, trd1); // d
622  beamPipe->AddNode(VTcross, 0, tre9); // e
623  beamPipe->AddNode(VpipeTSdown, 0, trf1); // f
624  beamPipe->AddNode(VcrossTSTMPs, 0, trg7); // g
625  beamPipe->AddNode(VDipolePip, 0, trh4); // h
626  beamPipe->AddNode(VLumMon, 0, tri6); // i
627  beamPipe->AddNode(VEndCross, 0, trj8); // i
628 
629  // add pipe to cave
630  cave->AddNode(beamPipe, 1);
631  gGeoManager->CloseGeometry();
632 
633  // check geometry
634  //cave->CheckOverlaps(0.1, "");
635  //gGeoManager->CheckOverlaps(0.001); // [cm]
636  //gGeoManager->CheckGeometryFull();
637 
638  // save geometry
639  cave->Write();
640  fi->Close();
641 
642  // plot geometry
643  cave->Draw("ogl");
644 
645  // done
646  fprintf(stderr,"\n");
647  fprintf(stderr,"<I> Geometry of PANDA beam pipe written to %s\n",(char*)fGeoFile);
648  fprintf(stderr,"\n");
649 
650  return 0;
651 }
Double_t z0
Definition: checkhelixhit.C:62
int createRootGeometry_beampipe()
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
FairGeoLoader * geoLoad
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
TLorentzVector s
Definition: Pnd2DStar.C:50
double r1
TGeoManager * gGeoManager
FairGeoMedium * FairMediumAir
#define cave
Definition: createSTT.C:62
FairGeoMedia * geoMedia
TFile * fi
Double_t
TGeoCombiTrans * trc3
TGeoCombiTrans * trc1
FairGeoInterface * geoFace
TString fGeoFile
TGeoCombiTrans * trc2
Double_t R
Definition: checkhelixhit.C:61
double r2
FairGeoBuilder * geoBuild