FairRoot/PandaRoot
Functions
lmd/Promme/createRootGeometry_beampipe.C File Reference
#include <TROOT.h>
#include <FairGeoLoader.h>
#include <FairGeoInterface.h>
#include <FairGeoBuilder.h>
#include <FairGeoPcon.h>
#include <FairGeoMedia.h>
#include <TGeoCompositeShape.h>
#include <TGeoMatrix.h>
#include <TGeoVolume.h>
#include <TGeoTube.h>
#include <TSystem.h>
#include <TFile.h>
#include <TGeoPcon.h>
#include <TGeoManager.h>
#include <TGeoTorus.h>
#include <TGeoCone.h>
#include <vector>
#include <sstream>
#include <iostream>
#include <cmath>
#include <TApplication.h>

Go to the source code of this file.

Functions

int createRootGeometry_beampipe ()
 
int main ()
 

Function Documentation

int createRootGeometry_beampipe ( )

Definition at line 51 of file lmd/Promme/createRootGeometry_beampipe.C.

References cave, cos(), create_lumi(), Double_t, FairMediumAir, fGeoFile, fi, geoBuild, geoFace, geoLoad, geoMedia, gGeoManager, R, r1, r2, s, sin(), trc1, trc2, trc3, TString, and z0.

Referenced by main().

51  {
52 
53  // basic constants concerning the path of the beam pipe
54  // downstream of the target
55  const double bend_begin = 361.; // where bending has to start
56  const double bend_radius = 5700.; // bending radius
57  const double bend_angle = 40.e-3; // bending angle
58  const double bend_end = bend_begin+sin(bend_angle)*bend_radius; // z position of the bend end
59 
60  cout << " ******************************************* " << endl;
61  cout << " * beam pipe creator * " << endl;
62  cout << " ******************************************* " << endl;
63  cout << "\n\n\t\t 16.09.13 \n " << endl;
64  cout << " \t modified by P.Jasinski \n " << endl;
65 
66  cout << " basic beam pipe parameters: " << endl;
67  cout << " \t bending start " << bend_begin << " cm" << endl;
68  cout << " \t bending end " << bend_end << " cm" << endl;
69  cout << " \t bending angle " << bend_angle << " rad" << endl;
70  cout << " \t bending radius " << bend_radius << " cm \n" << endl;
71 
72  cout << " \t taking the pressure profile into account " << endl;
73 
74 
75  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
76  TString vmcWorkdir = gSystem->Getenv("VMCWORKDIR");
77 
78  // if you do not want sensors in your beam pipe,
79  // so a simple beam pipe only, set it to false
80  // warning: it does not work with vacuum inserted as an medium
81  bool create_sensors = true; // false
82  bool create_vacuum = false; // true
83  bool create_lumi = false; // false
84  bool create_target = true; // true
85  bool create_pipe = false; // true;
86  // key z positions are stored in the following vector
87  std::vector< double > sensor_positions;
88 
89  // materials and media
90  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
91  FairGeoInterface* geoFace = geoLoad->getGeoInterface();
92  geoFace->setMediaFile(vmcWorkdir + "/geometry/media_pnd.geo");
93  geoFace->readMedia();
94  geoFace->print();
95  FairGeoMedia* geoMedia = geoFace->getMedia();
96  FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
97 
98  std::string str_ti = "titanium"; // "titanium" is now implemented in the Panda software
99  FairGeoMedium* FairMediumAir = geoMedia->getMedium("air");
100  FairGeoMedium* FairMediumSteel = geoMedia->getMedium("steel");
101  FairGeoMedium* FairMediumTi = geoMedia->getMedium(str_ti.c_str()); //titanium"); not found in media_pnd.geo !
102  FairGeoMedium* FairMediumKapton = geoMedia->getMedium("mylar"); // mylar properties are nearly the same as for the non existing Kapton
103  FairGeoMedium* FairMediumAu = geoMedia->getMedium("gold_target");
104 
105  /* additional lines for media_pnd.geo file:
106  // 1.205e-3 g/cm³ eq 1e3 mbar (see air)
107  // 1e-8 mbar eq 1.205e-6 * 1e-8 g/cm³
108  vacuum8 3 14.01 16. 39.95 7. 8. 18. 1.205e-14 .755 .231 .014
109  0 1 30. .001
110  0
111  vacuum7 3 14.01 16. 39.95 7. 8. 18. 1.205e-13 .755 .231 .014
112  0 1 30. .001
113  0
114  vacuum6 3 14.01 16. 39.95 7. 8. 18. 1.205e-12 .755 .231 .014
115  0 1 30. .001
116  0
117  vacuum5 3 14.01 16. 39.95 7. 8. 18. 1.205e-11 .755 .231 .014
118  0 1 30. .001
119  0
120  vacuum4 3 14.01 16. 39.95 7. 8. 18. 1.205e-10 .755 .231 .014
121  0 1 30. .001
122  0
123  */
124 
125  FairGeoMedium* FairMediumVac4 = geoMedia->getMedium("vacuum4"); // vacuum 10-4 mbar
126  FairGeoMedium* FairMediumVac5 = geoMedia->getMedium("vacuum5"); // vacuum 10-5 mbar
127  FairGeoMedium* FairMediumVac6 = geoMedia->getMedium("vacuum6"); // vacuum 10-6 mbar
128  FairGeoMedium* FairMediumVac7 = geoMedia->getMedium("vacuum7"); // vacuum 10-7 mbar
129  FairGeoMedium* FairMediumVac8 = geoMedia->getMedium("vacuum8"); // vacuum 10-8 mbar
130 
131 
132 
133  if (!FairMediumAir || !FairMediumSteel || !FairMediumTi || !FairMediumKapton ||
134  !FairMediumVac4 ||!FairMediumVac5 ||!FairMediumVac6 ||!FairMediumVac7 ||!FairMediumVac8) {
135  std::cout << " warning: not all media found " << std::endl;
136  }
137 
138  geoBuild->createMedium(FairMediumAir);
139  geoBuild->createMedium(FairMediumSteel);
140  geoBuild->createMedium(FairMediumTi);
141  geoBuild->createMedium(FairMediumKapton);
142  geoBuild->createMedium(FairMediumVac4);
143  geoBuild->createMedium(FairMediumVac5);
144  geoBuild->createMedium(FairMediumVac6);
145  geoBuild->createMedium(FairMediumVac7);
146  geoBuild->createMedium(FairMediumVac8);
147  std::cout << " done " << std::endl;
148  // open output file
149  TFile* fi;
151  if (create_sensors){
152  fGeoFile = "beampipe_201309_active.root";
153 
154  } else {
155  fGeoFile = "beampipe_201309.root";
156  }
157  fi = new TFile(fGeoFile, "RECREATE");
158 
159 
160  // define cave
161  /*
162  TGeoVolume* cave;
163  TGeoBBox* lTop = new TGeoBBox(200, 200, 300);
164  cave = new TGeoVolume("BeamPipe", lTop, gGeoManager->GetMedium("air"));
165  gGeoManager->SetTopVolume(cave);
166  */
167  TGeoVolume *cave = new TGeoVolumeAssembly("pipeassembly");//gGeoManager->GetTopVolume();
168  gGeoManager->SetTopVolume(cave);
169  //cave->AddNode(beamPipe, 1);
170 
171  // ---------------------------------------------------------------------------
172  // the full geometry is built-up by adding volumes starting from the most
173  // upstream position, variable currentz is continuously updated and always
174  // contains the z-coordinate of the most down-stream point of the geometry
175  Double_t currentz = 0.0;
176 
177  // z-position of very first point
178  Double_t z0 = -459.9328; // with this z0 the target is at z = 0.
179 
180  // Definition of some constants, dummy shapes, transformations
181  Double_t const rad = 3.1415926 / 180.;
182  Double_t const delta = 1.E-6;
183 
184  TGeoRotation* r1 = new TGeoRotation("r1", 0., 0., 0.); // no rotation
185  TGeoRotation* r2 = new TGeoRotation("r2", 0., 90., 180.); // 90 deg about x-axis and 180 deg about y axis
186  TGeoRotation* r3 = new TGeoRotation("r3", 0., -90., 0); // -90 deg about x-axis
187  TGeoRotation* r4 = new TGeoRotation("r4", 90., 0., 0); // 90 deg about z-axis
188 
189  TGeoCombiTrans* tr0 = new TGeoCombiTrans("tra0", 0., 0., z0, r1);
190  tr0->RegisterYourself();
191 
192  // ---------------------------------------------------------------------------
193  // define valves and pumps which are used at different places
194 
195  TGeoCombiTrans* trv1 = new TGeoCombiTrans("trv1", 0., 0., 1.075, r1);
196  trv1->RegisterYourself();
197  TGeoCombiTrans* trv2 = new TGeoCombiTrans("trv2", 0., 0., 3.53875, r1);
198  trv2->RegisterYourself();
199  TGeoCombiTrans* trv3 = new TGeoCombiTrans("trv3", 0., 0., 6.0075, r1);
200  trv3->RegisterYourself();
201 
202  // VAT -Gate Valve CF63
203  // width in z is 7.
204  Double_t ov1[3] = { 0., 5.7, 0. };
205  TGeoBBox* VATvalve63a = new TGeoBBox("VATvalve63a", 5.6, 12.45, 1.35, ov1);
206  TGeoTube* VATvalve63b = new TGeoTube("VATvalve63b", 3.5, 6.5, 1.075);
207  TGeoTube* tv1 = new TGeoTube("tv1", 0., 3.5, 1.35 + delta);
208 
209  TGeoCompositeShape *SVATvalve630 = new TGeoCompositeShape("VATvalve630",
210  "VATvalve63a-tv1");
211  TGeoCompositeShape *SVATvalve63 = new TGeoCompositeShape("VATvalve63",
212  "VATvalve63b:trv1+VATvalve63b:trv3");//"VATvalve63b:trv1+VATvalve630:trv2+VATvalve63b:trv3");
213 
214  TGeoTube* VATvalve630_vac = new TGeoTube("VATvalve630_vac",0., 3.5+delta, 1.35+(1.075+0.01987)*2);
215  TGeoCompositeShape *SVATvalve63_vac = new TGeoCompositeShape("VATvalve63_vac",
216  "VATvalve630_vac:trv2-VATvalve63");
217 
218  // VAT -Gate Valve CF100
219  // width in z is 7.
220  Double_t ov2[3] = { 0., 7.3, 0. };
221  TGeoBBox* VATvalve100a = new TGeoBBox("VATvalve100a", 7.2, 16.0, 1.35, ov2);
222  TGeoTube* VATvalve100b = new TGeoTube("VATvalve100b", 5.0, 8.25, 1.0);
223  TGeoTube* tv2 = new TGeoTube("tv2", 0., 5.0, 1.35 + delta);
224 
225  TGeoCompositeShape *SVATvalve1000 = new TGeoCompositeShape("VATvalve1000",
226  "VATvalve100a-tv2");
227  TGeoCompositeShape *SVATvalve100 = new TGeoCompositeShape("VATvalve100",
228  "VATvalve100b:trv1+VATvalve100b:trv3");//"VATvalve100b:trv1+VATvalve1000:trv2+VATvalve100b:trv3");
229 
230  TGeoTube* VATvalve1000_vac = new TGeoTube("VATvalve1000_vac",0., 5.0+delta, 1.35+(2.19)*2);
231  TGeoCompositeShape *SVATvalve100_vac = new TGeoCompositeShape("VATvalve100_vac",
232  "VATvalve1000_vac:trv2-VATvalve100");
233 
234 
235  // special valve with inner clearance of 110 mm
236  TGeoTube* tv55 = new TGeoTube("tv55", 0., 5.5+ delta, 1.35 + delta);
237  TGeoCompositeShape *SVATvalve110 = new TGeoCompositeShape("VATvalve110",
238  "VATvalve100-tv55:trv2-tv55:trv1-tv55:trv3");
239 
240  TGeoTube* SVATvalve1100_vac = new TGeoTube("VATvalve1100_vac", 0., 5.5, 1.35+(2.)*2.);
241  TGeoCompositeShape *SVATvalve110_vac = new TGeoCompositeShape("VATvalve110_vac",
242  "VATvalve1100_vac:trv2-VATvalve110");
243 
244 
245  // VAT -Gate Valve CF160
246  // width in z is 7.
247  Double_t ov3[3] = { 0., 9.9, 0. };
248  TGeoBBox* VATvalve160a =
249  new TGeoBBox("VATvalve160a", 9.1, 21.75, 1.35, ov3);
250  TGeoTube* VATvalve160b = new TGeoTube("VATvalve160b", 7.5, 11.25, 1.075);
251  TGeoTube* tv3 = new TGeoTube("tv3", 0., 7.5, 1.35 + delta);
252 
253  TGeoCompositeShape *SVATvalve1600 = new TGeoCompositeShape("VATvalve1600",
254  "VATvalve160a-tv3");
255  TGeoCompositeShape *SVATvalve160 = new TGeoCompositeShape("VATvalve160",
256  "VATvalve160b:trv1+VATvalve1600:trv2+VATvalve160b:trv3");
257 
258  // Turbovac_SL700_CF160
259  Double_t psv1[27] = { 0., 360., 8, .0, 6.0, 10.85, 7.6, 6.0, 10.85, 7.6,
260  6.0, 10.15, 16.6, 6.0, 10.15, 16.6, 6.0, 9.0, 24.0, 6.0, 9.0, 24.0,
261  0., 9.0, 24.2, 0., 9.0 };
262  TGeoPcon* TVP700 = new TGeoPcon("TVP700", 0., 360., 8);
263  TVP700->SetDimensions(psv1);
264 
265  // Turbovac_1000C_CF160
266  Double_t psv2[39] = { 0., 360., 12, 0.0, 7.5, 11.25, 2.45, 7.5, 11.25,
267  2.45, 7.5, 7.965, 3.45, 7.5, 7.965, 6.45, 7.5, 12.9, 8.45, 0.,
268  12.9, 8.45, 0., 12.05, 24.00, 0., 12.05, 24.00, 0., 12.9, 26.00,
269  0., 12.9, 26.00, 0., 7.5, 36.85, 0., 7.5 };
270  TGeoPcon* TVP1000 = new TGeoPcon("TVP1000", 0., 360., 12);
271  TVP1000->SetDimensions(psv2);
272 
273  // Ion getter pump 1000l/s
274  // is approximated as a cylinder
275  Double_t psv3[21] = { 0., 360., 6, 0., 7.5, 10.125, 2.0, 7.5, 10.125, 2.0,
276  7.5, 7.7, 10.0, 7.5, 7.7, 10.0, 0., 20.0, 60.7, 0., 20.0 };
277  TGeoPcon* IGP1000 = new TGeoPcon("IGP1000", 0., 360., 6);
278  IGP1000->SetDimensions(psv3);
279 
280  // ---------------------------------------------------------------------------
281  // Definition of the volumes from up- to down-stream
282  // The naming of the shapes and volumes follows the naming in the CATIA
283  // drawing
284  //
285  // ---------------------------------------------------------------------------
286  // a - GV to HESR (GV to HESR.1)
287 
288  // VAT -Gate Valve CF100
289  TGeoVolume *Vgvhesr = new TGeoVolume("gvhesr", SVATvalve100,
290  gGeoManager->GetMedium("steel"));
291  Vgvhesr->SetLineColor(30);
292 
293  // last z-position: 7.
294  currentz += 7. + delta;
295  fprintf(stderr, "currentz a: %f\n", currentz);
296 
297  // ---------------------------------------------------------------------------
298  // b - pipe upstream (pipe upstream.1)
299 
300  Double_t psb1[27] = { 0., 360., 8, 0., 4.35, 7.58, 2.0, 4.35, 7.58, 2.0,
301  4.35, 4.45, 20.0, 4.35, 4.45, 31.3328, 7.50, 7.60, 156.0328, 7.50,
302  7.60, 156.0328, 7.50, 10.125, 158.2328, 7.50, 10.125 };
303  TGeoPcon* pipeup = new TGeoPcon("pipeup", 0., 360., 8);
304  pipeup->SetDimensions(psb1);
305 
306  Double_t psb1_vac[27] = { 0., 360., 8,
307  0., 0.0, 4.35,
308  2.0, 0.0, 4.35,
309  2.0, 0.0, 4.35,
310  20.0, 0.0, 4.35,
311  31.3328, 0.0, 7.50,
312  156.0328, 0.0, 7.50,
313  156.0328, 0.0, 7.50,
314  158.2328, 0.0, 7.50};
315  TGeoPcon* pipeup_vac = new TGeoPcon("pipeup_vac", 0., 360., 8);
316  pipeup_vac->SetDimensions(psb1_vac);
317 
318  TGeoCombiTrans* trb1 =
319  new TGeoCombiTrans("trb1", 0., 0., z0 + currentz, r1);
320  trb1->RegisterYourself();
321  //sensor_positions.push_back(z0 + currentz);
322 
323  TGeoVolume *Vpipeup = new TGeoVolume("pipeup", pipeup,
324  gGeoManager->GetMedium("steel"));
325  Vpipeup->SetLineColor(31);
326  TGeoVolume *Vpipeup_vac = new TGeoVolume("pipeup_vac", pipeup_vac,
327  gGeoManager->GetMedium("vacuum8"));
328  Vpipeup_vac->SetLineColor(2);
329  Vpipeup_vac->SetTransparency(80);
330 
331  // last z-position: 165.2328
332  currentz += 158.2328;
333  fprintf(stderr, "currentz b: %f\n", currentz);
334 
335  // ---------------------------------------------------------------------------
336  // c - KreuzTMpump (KreuzTMpump.1)
337 
338  // horizontal/vertical bar of the cross
339  Double_t psc1[21] = { 0., 360., 6, -16.7, 7.50, 10.125, -14.5, 7.50,
340  10.125, -14.5, 7.50, 7.70, 14.5, 7.50, 7.70, 14.5, 7.50, 10.125,
341  16.7, 7.50, 10.125 };
342  TGeoPcon* ktmpump0 = new TGeoPcon("ktmpump0", 0., 360., 6);
343  ktmpump0->SetDimensions(psc1);
344 
345  // corresponding vacuum
346  Double_t psc1_vac[12] = { 0., 360., 3,
347  -16.7,0.0,7.50,
348  0.0, 0.0, 7.50,
349  16.7,0.0,7.50};
350  TGeoPcon* ktmpump0_vac = new TGeoPcon("ktmpump0_vac", 0., 360., 3);
351  ktmpump0_vac->SetDimensions(psc1_vac);
352 
353  TGeoTube* tc1 = new TGeoTube("tc1", 0., 7.7, 7.7);
354 
355  TGeoCombiTrans* trc1 = new TGeoCombiTrans("trc1", 0., 0., 0, r2);
356  trc1->RegisterYourself();
357  TGeoCombiTrans* trc2 = new TGeoCombiTrans("trc2", 0., 0.,
358  z0 + currentz + 16.7, r1);
359  trc2->RegisterYourself();
360 
361  TGeoCompositeShape *csc1 = new TGeoCompositeShape("csc1",
362  "(ktmpump0-tc1:trc1)");
363  TGeoCompositeShape *Sktmpump = new TGeoCompositeShape("ktmpump",
364  "csc1+(csc1:trc1)");
365 
366  TGeoVolume *Vktmpump = new TGeoVolume("ktmpump", Sktmpump,
367  gGeoManager->GetMedium("steel"));
368  Vktmpump->SetLineColor(32);
369 
370  TGeoVolume *Vktmpump_vac = new TGeoVolume("ktmpump_vac", ktmpump0_vac,
371  gGeoManager->GetMedium("vacuum8"));
372  Vktmpump_vac->SetLineColor(2);
373  Vktmpump_vac->SetTransparency(80);
374 
375  //sensor_positions.push_back(z0 + currentz);
376  // last z-position: 181.932800
377  currentz += 16.7;
378  fprintf(stderr, "currentz c1: %f\n", currentz);
379 
380  // ...........................................................................
381 
382  // add Turbovac_1000C_CF160 and GV_CF160
383  TGeoCombiTrans* trc3 = new TGeoCombiTrans("trc3", 0., 0., 7.0, r1);
384  trc3->RegisterYourself();
385  TGeoCombiTrans* trc4 = new TGeoCombiTrans("trc4", 0., -16.7, currentz, r2);
386  trc4->RegisterYourself();
387  TGeoCombiTrans* trc5 = new TGeoCombiTrans("trc5", 0., 16.7, currentz, r3);
388  trc5->RegisterYourself();
389 
390  TGeoCompositeShape *STVPwValve = new TGeoCompositeShape("TVPwValve",
391  "(VATvalve160+TVP1000:trc3)");
392  TGeoCompositeShape *STpumps = new TGeoCompositeShape("Tpumps",
393  "TVPwValve:trc4+TVPwValve:trc5");
394 
395  TGeoVolume *VTpumps = new TGeoVolume("Tpump", STpumps,
396  gGeoManager->GetMedium("steel"));
397  VTpumps->SetLineColor(33);
398 
399  //sensor_positions.push_back(z0 + currentz);
400  // last z-position: 198.6328
401  currentz += 16.7;
402  fprintf(stderr, "currentz c2: %f\n", currentz);
403 
404  // ---------------------------------------------------------------------------
405  // d - pipeTSup.1, special_flange.1, coneExtensionUpstreamSteel.1
406 
407  Double_t psd1[27] = { 0., 360., 8, 0.0, 7.5, 10.125, 2.20, 7.5, 10.125,
408  2.20, 7.5, 7.70, 148.80, 7.5, 7.70, 148.80, 7.5, 10.125, 153.80,
409  7.5, 10.125, 153.80, 7.5, 7.70, 231.30, 7.5, 7.70 };
410  TGeoPcon* pipeTSup = new TGeoPcon("pipeTSup", 0., 360., 8);
411  pipeTSup->SetDimensions(psd1);
412 
413  Double_t psd1_vac[27] = { 0., 360., 3,
414  0.0, 0.0, 7.5,
415  2.20, 0.0, 7.5,
416  231.30, 0.0, 7.5 };
417  TGeoPcon* pipeTSup_vac = new TGeoPcon("pipeTSup_vac", 0., 360., 3);
418  pipeTSup_vac->SetDimensions(psd1_vac);
419 
420  TGeoCombiTrans* trd1 =
421  new TGeoCombiTrans("trd1", 0., 0., z0 + currentz, r1);
422  trd1->RegisterYourself();
423 
424  TGeoVolume *VpipeTSup = new TGeoVolume("pipeTSup", pipeTSup,
425  gGeoManager->GetMedium("steel"));
426  VpipeTSup->SetLineColor(34);
427 
428  TGeoVolume *VpipeTSup_vac = new TGeoVolume("pipeTSup_vac", pipeTSup_vac,
429  gGeoManager->GetMedium("vacuum7"));
430  VpipeTSup_vac->SetLineColor(2);
431  VpipeTSup_vac->SetTransparency(70);
432 
433  //sensor_positions.push_back(z0 + currentz);
434  // last z-position: 429.9328
435  currentz += 231.3;
436  fprintf(stderr, "currentz d: %f\n", currentz);
437 
438  // ---------------------------------------------------------------------------
439  // e - TargetKreuz.1
440 
441  // target position
442  Double_t tz = 30.0;
443  fprintf(stderr, "Target position: 0 / 0 / %f\n", z0 + currentz + tz);
444 
445  // target cross - horizontal
446  Double_t pse1[24] = { 0., 360.,
447  7, 0., 7.5, 7.55,
448  10.45, 7.5, 7.55,
449  26.8, 1.25, 1.30,
450  26.8, 1.25, 1.27,
451  29.98, 1.25, 1.27,
452  29.98, 1.25, 1.27,
453  tz, 1.25, 1.27 };
454  TGeoPcon* Tcross1 = new TGeoPcon("Tcross1", 0., 360., 7);
455  Tcross1->SetDimensions(pse1);
456 
457  // vacuum - horizontal
458  Double_t pse1_vac[24] = { 0., 360., 7,
459  0., 0., 7.5,
460  10.45, 0., 7.5,
461  26.8, 0., 1.3,
462  26.8, 0., 1.25,
463  29.98, 0., 1.25,
464  29.98, 0., 1.25,
465  tz, 0., 1.25 };
466  TGeoPcon* Tcross1_vac = new TGeoPcon("Tcross1_vac", 0., 360., 7);
467  Tcross1_vac->SetDimensions(pse1_vac);
468 
469  TGeoTube* Tcross2 = new TGeoTube("Tcross2", 1.0, 1.02, 11.5);
470 
471  TGeoTube* Tcross2_vac = new TGeoTube("Tcross2_vac", 0.0, 1.0, 11.5);
472 
473  // target cross vertical
474  Double_t pse2[63] = { 0., 360., 20, -182.0, 7.5, 7.7, -135.5, 7.5, 7.7,
475  -125.5, 4.5, 4.6, -95.5, 4.5, 4.6, -95.5, 3.0, 3.1, -54.0, 3.0,
476  3.1, -54.0, 2.0, 2.1, -42.1, 2.0, 2.1, -17.0, 2.0, 2.1, -17.0, 1.0,
477  1.02, 17.0, 1.0, 1.02, 17.0, 2.0, 2.1, 42.1, 2.0, 2.1, 54.0, 2.0,
478  2.1, 54.0, 3.0, 3.1, 95.5, 3.0, 3.1, 95.5, 4.5, 4.6, 133.5, 4.5,
479  4.6, 143.5, 7.85, 7.95, 168.69, 7.85, 7.95
480  };
481  TGeoPcon* Tcross3 = new TGeoPcon("Tcross3", 0., 360., 20);
482  Tcross3->SetDimensions(pse2);
483 
484  TGeoTube* te1 = new TGeoTube("te1", 0., 1.25, 0.51 + delta);
485  TGeoTube* te2 = new TGeoTube("te2", 0., 1.00, 0.51 + delta);
486  TGeoTube* te3 = new TGeoTube("te3", 0., 1.00, 1.27 + delta);
487  TGeoTube* te4 = new TGeoTube("te4", 0., 1.00, 1.02 + delta);
488 
489  TGeoCombiTrans* tre1 = new TGeoCombiTrans("tre1", 0., 0., tz, r2);
490  tre1->RegisterYourself();
491  TGeoCombiTrans* tre2 = new TGeoCombiTrans("tre2", 0., 0., -11.5, r2);
492  tre2->RegisterYourself();
493  TGeoCombiTrans* tre3 = new TGeoCombiTrans("tre3", 0., 0., 0., r2);
494  tre3->RegisterYourself();
495  TGeoCombiTrans* tre4 = new TGeoCombiTrans("tre4", 0., 0., -0.51, r1);
496  tre4->RegisterYourself();
497  TGeoCombiTrans* tre5 = new TGeoCombiTrans("tre5", 0., 0., 0.51, r1);
498  tre5->RegisterYourself();
499  TGeoCombiTrans* tre6 = new TGeoCombiTrans("tre6", 0., 0., 41.5, r1);
500  tre6->RegisterYourself();
501  TGeoCombiTrans* tre7 = new TGeoCombiTrans("tre7", 0., 0., tz, r1);
502  tre7->RegisterYourself();
503  TGeoCombiTrans* tre8 = new TGeoCombiTrans("tre8", 0., -175.0, tz, r3);
504  tre8->RegisterYourself();
505 
506  TGeoCombiTrans* tre9 =
507  new TGeoCombiTrans("tre9", 0., 0., z0 + currentz, r1);
508  tre9->RegisterYourself();
509 
510  TGeoCompositeShape *STcross0a = new TGeoCompositeShape("Tcross0a",
511  "Tcross1-te3:tre1");
512  TGeoCompositeShape *STcross0b = new TGeoCompositeShape("Tcross0b",
513  "Tcross2-te4:tre2");
514  TGeoCompositeShape *STcross0c = new TGeoCompositeShape("Tcross0c",
515  "Tcross3:tre3-te1:tre4-te2:tre5");
516 
517  TGeoCompositeShape *STcross = new TGeoCompositeShape("Tcross",
518  "Tcross0a+Tcross0b:tre6+Tcross0c:tre7+VATvalve160:tre8");
519 
520  TGeoCompositeShape *STcross_vac = new TGeoCompositeShape("Tcross_vac",
521  "Tcross1_vac+Tcross2_vac:tre6");
522 
523  TGeoTube* shape_target = new TGeoTube("shape_target", 0., 0., 1.);
524  TGeoVolume* vol_target = new TGeoVolume("shape_target", STcross, gGeoManager->GetMedium("gold_target"));
525  vol_target->SetLineColor(35);
526 
527  TGeoVolume *VTcross = new TGeoVolume("Tcross", STcross,
528  gGeoManager->GetMedium(str_ti.c_str()));
529  VTcross->SetLineColor(35);
530 
531  TGeoVolume *VTcross_vac = new TGeoVolume("Tcross_vac", STcross_vac,
532  gGeoManager->GetMedium("vacuum5"));
533  VTcross_vac->SetLineColor(2);
534  VTcross_vac->SetTransparency(50);
535 
536  //sensor_positions.push_back(z0 + currentz);
537  // last z-position: 482.9328
538  currentz += 53.0;
539  fprintf(stderr, "currentz e: %f\n", currentz);
540 
541  // ---------------------------------------------------------------------------
542  // f - pipeTSdown
543 
544  Double_t psf1[51] = { 0., 360., 16, 0.000, 1.0, 1.02, 3.7321, 2.0, 2.02,
545  3.7321, 2.0, 2.05, 93.0000, 2.0, 2.05, 97.4785, 3.2, 3.25,
546  101.0000, 3.2, 3.25, 101.0000, 3.2, 3.4, 106.0225, 3.2, 3.4,
547  106.0225, 3.2, 3.27, 241.8225, 3.2, 3.27, 241.8225, 3.2, 3.35,
548  244.8225, 3.2, 3.35, 244.8225, 3.2, 3.27, 261.0725, 3.2, 3.27,
549  261.0725, 3.2, 5.675, 262.8225, 3.2, 5.675 };
550  TGeoPcon* pipeTSdown = new TGeoPcon("pipeTSdown", 0., 360., 16);
551  pipeTSdown->SetDimensions(psf1);
552 
553  // the corresponding vacuum
554  Double_t psf1_vac[51] = { 0., 360., 16,
555  0.000, 0.0, 1.0,
556  3.7321, 0.0, 2.0,
557  3.7321, 0.0, 2.0,
558  93.0000, 0.0, 2.0,
559  97.4785, 0.0, 3.2,
560  101.0000, 0.0, 3.2,
561  101.0000, 0.0, 3.2,
562  106.0225, 0.0, 3.2,
563  106.0225, 0.0, 3.2,
564  241.8225, 0.0, 3.2,
565  241.8225, 0.0, 3.2,
566  244.8225, 0.0, 3.2,
567  244.8225, 0.0, 3.2,
568  261.0725, 0.0, 3.2,
569  261.0725, 0.0, 3.2,
570  262.8225, 0.0, 3.2};
571  TGeoPcon* pipeTSdown_vac = new TGeoPcon("pipeTSdown_vac", 0., 360., 16);
572  pipeTSdown_vac->SetDimensions(psf1_vac);
573 
574  TGeoCombiTrans* trf1 =
575  new TGeoCombiTrans("trf1", 0., 0., z0 + currentz, r1);
576  trf1->RegisterYourself();
577 
578  TGeoVolume *VpipeTSdown = new TGeoVolume("pipeTSdown", pipeTSdown,
579  gGeoManager->GetMedium(str_ti.c_str()));
580  VpipeTSdown->SetLineColor(36);
581 
582  TGeoVolume *VpipeTSdown_vac = new TGeoVolume("pipeTSdown_vac", pipeTSdown_vac,
583  gGeoManager->GetMedium("vacuum6"));
584  VpipeTSdown_vac->SetLineColor(2);
585  VpipeTSdown_vac->SetTransparency(60);
586 
587  //sensor_positions.push_back(z0 + currentz);
588  // last z-position: 745.7553
589  currentz += 262.8225;
590  fprintf(stderr, "currentz f: %f\n", currentz);
591 
592  // ---------------------------------------------------------------------------
593  // g - cross_TS_TMPs
594 
595  // horizontal part
596  Double_t psg1[27] = { 0., 360., 8, 0.000, 3.2, 5.675, 1.7200, 3.2, 5.675,
597  1.7200, 3.2, 3.27, 3.3653, 3.2, 3.27, 10.0830, 5.0, 5.07, 51.0,
598  5.0, 5.07, 51.0, 5.0, 7.60, 53.0, 5.0, 7.60 };
599  TGeoPcon* crossTS1 = new TGeoPcon("crossTS1", 0., 360., 8);
600  crossTS1->SetDimensions(psg1);
601 
602  // vacuum
603  Double_t psg1_vac[27] = { 0., 360., 8,
604  0.000, 0.0, 3.2,
605  1.7200, 0.0, 3.2,
606  1.7200, 0.0, 3.2,
607  3.3653, 0.0, 3.2,
608  10.0830, 0.0, 5.0,
609  51.0, 0.0, 5.0,
610  51.0, 0.0, 5.0,
611  53.0, 0.0, 5.0};
612  TGeoPcon* crossTS1_vac = new TGeoPcon("crossTS1_vac", 0., 360., 8);
613  crossTS1_vac->SetDimensions(psg1_vac);
614 
615  TGeoTube* tg1 = new TGeoTube("tg1", 0., 6.07, 5.07 + delta);
616  TGeoCombiTrans* trg1 = new TGeoCombiTrans("trg1", 0., 0., 26.0, r2);
617  trg1->RegisterYourself();
618  TGeoCompositeShape *ScrossTSa = new TGeoCompositeShape("crossTSa",
619  "crossTS1-tg1:trg1");
620 
621  // pipe perpendicular
622  Double_t psg2[21] = { 0., 360., 6, -55.0, 6.0, 10.125, -52.8, 6.0, 10.125,
623  -52.8, 6.0, 6.07, 52.8, 6.0, 6.07, 52.8, 6.0, 10.125, 55.0, 6.0,
624  10.125 };
625  TGeoPcon* crossTS2 = new TGeoPcon("crossTS2", 0., 360., 22);
626  crossTS2->SetDimensions(psg2);
627 
628  TGeoTube* tg2 = new TGeoTube("tg2", 0., 5.07, 6.07 + delta);
629  TGeoCombiTrans* trg2 = new TGeoCombiTrans("trg2", 0., -55.0, 0., r2);
630  trg2->RegisterYourself();
631  TGeoCombiTrans* trg3 = new TGeoCombiTrans("trg3", 0., 55.0, 0., r3);
632  trg3->RegisterYourself();
633  TGeoCombiTrans* trg4 = new TGeoCombiTrans("trg4", 0., 0., 7.0775, r1);
634  trg4->RegisterYourself();
635  TGeoCombiTrans* trg5 = new TGeoCombiTrans("trg5", 0., 0., 33.0775, r1);
636  trg5->RegisterYourself();
637 
638  // put it together
639  TGeoCompositeShape *ScrossTSb = new TGeoCompositeShape("crossTSb",
640  "crossTS2:r2-tg2+TVP700:trg2+TVP700:trg3");
641  TGeoCompositeShape *ScrossTS = new TGeoCompositeShape("crossTS",
642  "crossTSa:trg4+crossTSb:trg5");
643 
644  TGeoCombiTrans* trg6 = new TGeoCombiTrans("trg6", 0., 0., 60.0775, r1);
645  trg6->RegisterYourself();
646  TGeoCombiTrans* trg7 =
647  new TGeoCombiTrans("trg7", 0., 0., z0 + currentz, r1);
648  trg7->RegisterYourself();
649 
650  // cross upstream of the dipole including a transition from CF 63 to CF 100 diameter
651  TGeoCompositeShape *ScrossTSTMPs = new TGeoCompositeShape("crossTSTMPs",
652  "VATvalve63+crossTS+VATvalve100:trg6");
653 
654  TGeoCompositeShape *ScrossTS_vac = new TGeoCompositeShape("crossTS_vac",
655  "VATvalve63_vac+crossTS1_vac:trg4+VATvalve100_vac:trg6");
656 
657  TGeoVolume *VcrossTSTMPs = new TGeoVolume("crossTSTMPs", ScrossTSTMPs,
658  gGeoManager->GetMedium("steel"));
659  VcrossTSTMPs->SetLineColor(37);
660 
661  TGeoVolume *VcrossTSTMPs_vac = new TGeoVolume("crossTSTMPs_vac", ScrossTS_vac,
662  gGeoManager->GetMedium("vacuum7"));
663  VcrossTSTMPs_vac->SetLineColor(2);
664  VcrossTSTMPs_vac->SetTransparency(70);
665 
666  //sensor_positions.push_back(z0 + currentz);
667  // last z-position: 812.9103
668  currentz += 67.155;
669  fprintf(stderr, "currentz g: %f\n", currentz);
670 
671  // ---------------------------------------------------------------------------
672  // h - BeamPipe Dipole
673  // The dipole pipe is bent with a radius of 60 m. All elements downstream of this
674  // element need to be rotated and shifted accordingly in the xz-plane.
675  //Double_t R = 6000.0; // bending radius of the pipe
676  Double_t R = bend_radius; // fit results (P.Jasinski) with fixed deflection angle
677  //Double_t dz0 = 241.1985; // this is the length of the pipe along z
678  Double_t dz0 = bend_end-bend_begin; // fit results (P.Jasinski)
679  Double_t dphi = asin(dz0 / R); // what is indeed bend_radius, as it should be
680  Double_t dx0 = R * (1. - cos(dphi));
681  TGeoRotation *dipolerot = new TGeoRotation("dipolerot", 90., dphi / rad,
682  -90.); // rotation to accout for bendig
683  fprintf(stderr, "Rotation due to dipole magnet: %f\n", dphi / rad);
684  cout << " corresponds to " << dphi << " degree " << endl;
685 
686  // shifts need to be computed individually
687  // dz = dz0 + s*cos(dphi) where dx,dz0 is the point where the bended pipe ends
688  // dx = dx0 - s*sin(dphi) s is the length of the added elements
689  // combined transformations are then defined with ...
690  // TGeoCombiTrans* trpr = new TGeoCombiTrans("trpr", dx, 0., dz, dipolerot); trpr->RegisterYourself();
691  Double_t s = 0.;
692 
693  // dipole pipe, first part
694  Double_t psh1[15] = { 0., 360., 4, 0., 5.0, 7.6, 2.2, 5.0, 7.6, 2.2, 5.0,
695  5.2, 7.2, 5.5, 5.7 };
696  TGeoPcon* Dippip1 = new TGeoPcon("Dippip1", 0., 360., 4);
697  Dippip1->SetDimensions(psh1);
698 
699  // it's vacuum
700  Double_t psh1_vac[15] = { 0., 360., 4,
701  0., 0.0, 5.0,
702  2.2, 0.0, 5.0,
703  2.2, 0.0, 5.0,
704  7.2, 0.0, 5.5};
705  TGeoPcon* Dippip1_vac = new TGeoPcon("Dippip1_vac", 0., 360., 4);
706  Dippip1_vac->SetDimensions(psh1_vac);
707 
708  // dipole pipe, bent part
709  TGeoTorus *Dippip2 = new TGeoTorus("Dippip2", R, 5.5, 5.7, 0., dphi / rad);
710  // and it's vacuum
711  TGeoTorus *Dippip2_vac = new TGeoTorus("Dippip2_vac", R, 0.0, 5.49, 0., dphi / rad);
712 
713  // dipole pipe, straight part
714  Double_t psh21[15] = { 0., 360., 4, 0., 5.5, 5.7, 11., 5.5, 5.7,
715  11., 5.5, 7.6, 13., 5.5, 7.6 };
716  TGeoPcon* Dippip21 = new TGeoPcon("Dippip21", 0., 360., 4);
717  Dippip21->SetDimensions(psh21);
718 
719  // and it's vacuum
720  Double_t psh21_vac[12] = { 0., 360., 3,
721  0., 0.0, 5.5,
722  11., 0.0, 5.5,
723  13., 0.0, 5.5};
724  TGeoPcon* Dippip21_vac = new TGeoPcon("Dippip21_vac", 0., 360., 3);
725  Dippip21_vac->SetDimensions(psh21_vac);
726 
727  // horizontal pipe, third part
728  //Double_t psh2[24] = { 0., 360., 7, 0., 5.0, 5.2, 5.0225, 5.0, 5.2, 19.3385
729  Double_t psh2[33] = { 0., 360., 10,
730  0., 5.5, 7.6,
731  2., 5.5, 7.6,
732  2., 5.5, 5.7,
733  5., 5.5, 5.7,
734  20, 9., 9.3,
735  320, 9.0, 9.3,
736  340.5, 10.0, 10.3,
737  340.5+98.9, 10., 10.3,
738  340.5+98.9, 10., 12,
739  340.5+101.5, 10., 12};
740  TGeoPcon* Dippip3 = new TGeoPcon("Dippip3", 0., 360., 10);
741  Dippip3->SetDimensions(psh2);
742 
743  // and it's vacuum
744  Double_t psh2_vac[30] = { 0., 360., 9,
745  0., 0.0, 5.5,
746  2., 0.0, 5.5,
747  2., 0.0, 5.5,
748  5., 0.0, 5.5,
749  20, 0.0, 9.0,
750  320, 0.0, 9.0,
751  340.5, 0.0, 10.0,
752  340.5+98.9, 0.0, 10.,
753  340.5+101.5+0.252, 0.0, 10.};
754  TGeoPcon* Dippip3_vac = new TGeoPcon("Dippip3_vac", 0., 360., 9);
755  Dippip3_vac->SetDimensions(psh2_vac);
756 
757  TGeoCombiTrans* trh1 = new TGeoCombiTrans("trh1", R, 0., 7.1225,
758  new TGeoRotation("a", 0., -90., 180.));
759  trh1->RegisterYourself();
760  TGeoCombiTrans* trh2 = new TGeoCombiTrans("trh2", dx0, .0, 7.1225 + dz0,
761  dipolerot);
762  //sensor_positions.push_back(7.1225 + dz0);
763  trh2->RegisterYourself();
764  s = s + 13.;// 7.0775;
765  TGeoCombiTrans* trh21 = new TGeoCombiTrans("trh21", dx0 + s * sin(dphi), 0.,
766  7.1225 + dz0 + s * cos(dphi), dipolerot);
767  trh21->RegisterYourself();
768  s = s + 7.0775;
769  TGeoCombiTrans* trh3 = new TGeoCombiTrans("trh3", dx0 + s * sin(dphi), 0.,
770  7.1225 + dz0 + s * cos(dphi), dipolerot);
771  trh3->RegisterYourself();
772  s = s + 442;
773  TGeoCombiTrans* trh4 =
774  new TGeoCombiTrans("trh4", 0., 0., z0 + currentz, r1);
775  trh4->RegisterYourself();
776 
777  // put it together including modified VAT valve
778  TGeoCompositeShape *SDippip = new TGeoCompositeShape("Dippip",
779  "Dippip1+Dippip2:trh1+Dippip21:trh2+VATvalve110:trh21+Dippip3:trh3");//"Dippip1+Dippip3:trh3");//"Dippip1+Dippip2:trh1+VATvalve100:trh2+Dippip3:trh3");
780 
781  TGeoCompositeShape *SDippip_vac = new TGeoCompositeShape("Dippip_vac",
782  "Dippip1_vac+Dippip2_vac:trh1+Dippip21_vac:trh2+VATvalve110_vac:trh21+Dippip3_vac:trh3");//"Dippip1+Dippip3:trh3");//"Dippip1+Dippip2:trh1+VATvalve100:trh2+Dippip3:trh3");
783 
784 
785  TGeoVolume *VDipolePip = new TGeoVolume("DipolePip", SDippip,
786  gGeoManager->GetMedium("steel"));
787  VDipolePip->SetLineColor(38);
788 
789  TGeoVolume *VDipolePip_vac = new TGeoVolume("DipolePip_vac", SDippip_vac,
790  gGeoManager->GetMedium("vacuum8"));
791  VDipolePip_vac->SetLineColor(2);
792  VDipolePip_vac->SetTransparency(80);
793 
794  // last z-position: 1498.836617 was 1509.7031905 (s = 448.83470)
795  currentz += 7.1225 + dz0 + s * cos(dphi);
796  fprintf(stderr, "currentz/s h: %f %f\n", currentz, s);
797  std::cout << " luminosity monitor starts at " << currentz + z0 << std::endl;
798 
799  // ---------------------------------------------------------------------------
800  // i - Luminosity monitor
801 
802  TGeoTube* lmd_beampipe_upstr = new TGeoTube(
803  "lmd_beampipe_upstr", 9., 9.2, 25.);
804  TGeoCombiTrans* lmd_trans_b_up = new TGeoCombiTrans("lmd_trans_b_up", 0., 0., 25.+delta, r1);
805  lmd_trans_b_up->RegisterYourself();
806  TGeoTube* lmd_flange_upstr = new TGeoTube(
807  "lmd_flange_upstr", 9.2, 25.3/2., 1.2);
808  TGeoCombiTrans* lmd_trans_fl_up = new TGeoCombiTrans("lmd_trans_fl_up", 0., 0., 1.2+delta, r1);
809  lmd_trans_fl_up->RegisterYourself();
810  // upstream flange holding the kapton cone
811  TGeoTube* lmd_cone_flange_upstr = new TGeoTube(
812  "lmd_cone_flange_upstr", 9.2, 25.3/2., 1.5);
813  TGeoCombiTrans* lmd_trans_co_fl_up = new TGeoCombiTrans("lmd_trans_co_fl_up", 0., 0., -1.5+50.-delta, r1);
814  lmd_trans_co_fl_up->RegisterYourself();
815 
816  // 20 mu thick kapton foil cone
817  TGeoCone* lmd_capton_cone = new TGeoCone("lmd_capton_cone", 23.386/2., 20.4/2., 20.4/2.+0.002/2., 7./2., 7./2.+0.002/2.);
818  TGeoCombiTrans* lmd_trans_cap_co = new TGeoCombiTrans("lmd_trans_cap_co", 0., 0., 50.+23.386/2., r1);
819  lmd_trans_cap_co->RegisterYourself();
820 
821  // flange holding the kapton cone downstream
822  TGeoCone* lmd_cone_flange_downstr = new TGeoCone("lmd_cone_flange_downstr", 3.12/2., 3.1, 8.6/2., 3.1, 3.2);
823  TGeoCombiTrans* lmd_trans_co_fl_do = new TGeoCombiTrans("lmd_trans_co_fl_do", 0., 0., 50.+23.386+3.12/2., r1);
824  lmd_trans_co_fl_do->RegisterYourself();
825  // beam pipe to shield the sensors
826  TGeoTube* lmd_beam_pipe = new TGeoTube("lmd_beam_pipe", 3.5, 3.6, 50./2.);
827  TGeoCombiTrans* lmd_trans_p = new TGeoCombiTrans("lmd_trans_p", 0., 0., 50.+23.386+50./2., r1);
828  lmd_trans_p->RegisterYourself();
829  // beam pipe cone downstream
830  TGeoCone* lmd_cone_downstr = new TGeoCone("lmd_cone_downstr", 20./2., 3.5, 3.7, 9./2., 9.2/2.);
831  TGeoCombiTrans* lmd_trans_co_do = new TGeoCombiTrans("lmd_trans_co_do", 0., 0., 50.+23.386+50.+20./2., r1);
832  lmd_trans_co_do->RegisterYourself();
833  // beam pipe downstream
834  TGeoTube* lmd_beam_pipe_downstream = new TGeoTube("lmd_beam_pipe_downstream", 9./2., 9.2/2., 56./2.);
835  TGeoCombiTrans* lmd_trans_p_down = new TGeoCombiTrans("lmd_trans_p_down", 0., 0., 50.+23.386+50.+20.+56./2., r1);
836  lmd_trans_p_down->RegisterYourself();
837  // main body
838  //Double_t psi1[33] = { 0., 360., 10, 0., 9.0, 12.65, 2.4, 9.0, 12.65, 2.4,
839  // 9.0, 9.2, 4.4343, 9.0, 9.2, 17.5, 12.5, 12.7, 177.0, 12.5, 12.7,
840  // 195.66, 7.5, 7.7, 198.0, 7.5, 7.7, 198.0, 7.5, 10.125, 200.0, 7.5,
841  // 10.125 };
842  //TGeoPcon* LumMon0 = new TGeoPcon("LumMon0", 0., 360., 10);
843  //LumMon0->SetDimensions(psi1);
844 
845  // nozzle
846  //Double_t psi2[21] = { 0., 360., 6, -27.0, 5.2, 7.6, -25.0, 5.2, 7.6, -25.0,
847  // 5.2, 5.4, 25.0, 5.2, 5.4, 25.0, 5.2, 7.6, 27.0, 5.2, 7.6 };
848  //TGeoPcon* nozzle0 = new TGeoPcon("nozzle0", 0., 360., 6);
849  //nozzle0->SetDimensions(psi2);
850 
851  //TGeoTube* ti1 = new TGeoTube("ti1", 0., 12.7, 5.4 + delta);
852  //TGeoTube* ti2 = new TGeoTube("ti2", 0., 5.0, 12.7 + delta);
853 
854  //TGeoCombiTrans* tri1 = new TGeoCombiTrans("tri1", 0., 0., 77.8, r2);
855  //tri1->RegisterYourself();
856  //TGeoCombiTrans* tri2 = new TGeoCombiTrans("tri2", 0., 0., 97.8, r2);
857  //tri2->RegisterYourself();
858  //TGeoCombiTrans* tri3 = new TGeoCombiTrans("tri3", 0., 0., 117.8, r2);
859  //tri3->RegisterYourself();
860  //TGeoCombiTrans* tri4 = new TGeoCombiTrans("tri4", 0., 0., 137.8, r2);
861  //tri4->RegisterYourself();
862  //TGeoCombiTrans* tri5 = new TGeoCombiTrans("tri5", 0., 0., 0., r4);
863  //tri5->RegisterYourself();
864 
865  // put it together
866  //TGeoCompositeShape *Snozzle1 = new TGeoCompositeShape("nozzle1",
867  // "(nozzle0-ti1:r2)");
868  //TGeoCompositeShape *Snozzles = new TGeoCompositeShape("nozzles",
869  // "nozzle1:tri1+nozzle1:tri2+nozzle1:tri3+nozzle1:tri4");
870  //TGeoCompositeShape *Sholes = new TGeoCompositeShape("holes",
871  // "ti1:tri1+ti1:tri2+ti1:tri3+ti1:tri4");
872  //TGeoCompositeShape *SLumMon1 = new TGeoCompositeShape("LumMon1",
873  // "LumMon0-holes-(holes:tri5)");
874  TGeoCompositeShape *slum_beampipe_upstream = new TGeoCompositeShape("slum_beampipe_upstream",
875  "lmd_flange_upstr:lmd_trans_fl_up+lmd_beampipe_upstr:lmd_trans_b_up+lmd_cone_flange_upstr:lmd_trans_co_fl_up");
876  TGeoCompositeShape *slum_CaptonCone = new TGeoCompositeShape("slum_CaptonCone", "lmd_capton_cone:lmd_trans_cap_co-lmd_cone_flange_downstr:lmd_trans_co_fl_do-lmd_cone_flange_upstr:lmd_trans_co_fl_up");
877  TGeoCompositeShape *slum_beampipe_downstream = new TGeoCompositeShape("slum_beampipe_downstream",
878  "lmd_beam_pipe:lmd_trans_p+lmd_cone_downstr:lmd_trans_co_do+lmd_beam_pipe_downstream:lmd_trans_p_down");/*+lmd_cone_flange_downstr:lmd_trans_co_fl_do*/
879  // "nozzles+(nozzles:tri5)");
880 
881  TGeoCombiTrans* tri6 = new TGeoCombiTrans("tri6", dx0 + s * sin(dphi), 0.,
882  z0 + currentz, dipolerot);
883 
884  //std::cout << " rotation for the lumi monitor is " << std::endl;
885  //tri6->Print();
886 
887  tri6->RegisterYourself();
888  s = s + 200.00;
889 
890  TGeoVolume *vlum_beampipe_upstream = new TGeoVolume("vlum_beampipe_upstream", slum_beampipe_upstream,
891  gGeoManager->GetMedium("steel"));
892  vlum_beampipe_upstream->SetLineColor(39);//39);
893  TGeoVolume *vlum_CaptonCone = new TGeoVolume("vlum_CaptonCone", slum_CaptonCone,
894  gGeoManager->GetMedium("mylar"));
895  vlum_CaptonCone->SetLineColor(kRed);//39);
896  TGeoVolume *vlum_beampipe_downstream = new TGeoVolume("vlum_beampipe_downstream", slum_beampipe_downstream,
897  gGeoManager->GetMedium("steel"));
898  vlum_beampipe_downstream->SetLineColor(39);//39);
899 
900  //sensor_positions.push_back(z0 + currentz);
901  // last z-position: 1709.5415231 (s = 648.83470)
902  currentz += 200.00 * cos(dphi);
903  fprintf(stderr, "currentz/s i: %f %f\n", currentz, s);
904 
905  // ---------------------------------------------------------------------------
906  // j - end cross
907 
908  // horizontal pipe, first part
909  Double_t psj1[15] = { 0., 360., 4, 0., 7.5, 10.125, 2.0, 7.5, 10.125, 2.0,
910  7.5, 7.7, 16.7, 7.5, 7.7 };
911  TGeoPcon* EndCross0a = new TGeoPcon("EndCross0a", 0., 360., 4);
912  EndCross0a->SetDimensions(psj1);
913 
914  // horizontal pipe, second part
915  Double_t psj2[15] = { 0., 360., 4, 16.7, 4.5, 4.7, 34.7, 4.5, 4.7, 34.7,
916  4.5, 7.6, 36.7, 4.5, 7.6 };
917  TGeoPcon* EndCross0b = new TGeoPcon("EndCross0b", 0., 360., 4);
918  EndCross0b->SetDimensions(psj2);
919 
920  // vertical pipe
921  Double_t psj3[21] = { 0., 360., 6, -16.7, 7.5, 10.125, -14.7, 7.5, 10.125,
922  -14.7, 7.5, 7.7, 14.7, 7.5, 7.7, 14.7, 7.5, 10.125, 16.7, 7.5,
923  10.125 };
924  TGeoPcon* EndCross1 = new TGeoPcon("EndCross1", 0., 360., 6);
925  EndCross1->SetDimensions(psj3);
926 
927  TGeoTube* tj1 = new TGeoTube("tj1", 0., 7.7, 10.125 + delta);
928  TGeoTube* tj2 = new TGeoTube("tj2", 0., 7.7, 3.85 + delta);
929  TGeoTube* tj3 = new TGeoTube("tj3", 0., 4.7, 3.85 + delta);
930 
931  TGeoCombiTrans* trj1 = new TGeoCombiTrans("trj1", 0., 0., 16.7, r2);
932  trj1->RegisterYourself();
933  TGeoCombiTrans* trj2 =
934  new TGeoCombiTrans("trj2", 0., 0., 12.85 - delta, r1);
935  trj2->RegisterYourself();
936  TGeoCombiTrans* trj3 =
937  new TGeoCombiTrans("trj3", 0., 0., 20.55 + delta, r1);
938  trj3->RegisterYourself();
939  TGeoCombiTrans* trj4 = new TGeoCombiTrans("trj4", 0., 0., 36.7, r1);
940  trj4->RegisterYourself();
941  TGeoCombiTrans* trj5 = new TGeoCombiTrans("trj5", 0., 16.7, 16.7, r3);
942  trj5->RegisterYourself();
943  TGeoCombiTrans* trj6 = new TGeoCombiTrans("trj6", 0., -23.7, 16.7, r3);
944  trj6->RegisterYourself();
945  TGeoCombiTrans* trj7 = new TGeoCombiTrans("trj7", 0., -23.7, 16.7, r2); // here was a typo
946  trj7->RegisterYourself();
947 
948  // adding valves and pumps
949  TGeoCompositeShape *EndCross2 = new TGeoCompositeShape("EndCross2",
950  "EndCross0a+EndCross0b-tj1:trj1");
951  TGeoCompositeShape *EndCross3 = new TGeoCompositeShape("EndCross3",
952  "EndCross1:trj1-tj2:trj2-tj3:trj3");
953  TGeoCompositeShape *EndCross4 = new TGeoCompositeShape("EndCross4",
954  "TVPwValve:trj5+VATvalve160:trj6+IGP1000:trj7");
955  TGeoCompositeShape *EndCross = new TGeoCompositeShape("EndCross",
956  "EndCross2+EndCross3+EndCross4+VATvalve100:trj4");
957  TGeoCombiTrans* trj8 = new TGeoCombiTrans("trj8", dx0 + s * sin(dphi), 0.,
958  z0 + currentz, dipolerot);
959  trj8->RegisterYourself();
960  s = s + 43.7;
961 
962  TGeoVolume *VEndCross = new TGeoVolume("EndCross", EndCross,
963  gGeoManager->GetMedium("steel"));
964  VEndCross->SetLineColor(40);
965 
966  //sensor_positions.push_back(z0 + currentz);
967  // last z-position: 1753.2061988 (s = 692.53470)
968  currentz += 43.7 * cos(dphi);
969  fprintf(stderr, "currentz/s j: %f %f\n", currentz, s);
970  //sensor_positions.push_back(z0 + currentz);
971 
972  // ---------------------------------------------------------------------------
973  // put all volumes together -> beamPipe
974  TGeoVolume *beamPipe = new TGeoVolumeAssembly("BeamPipe");
975  //gGeoManager->SetTopVolume(beamPipe);
976  //beamPipe->AddNode(Vgvhesr, 0, tr0); // a
977  if (create_pipe) beamPipe->AddNode(Vpipeup, 0, trb1); // b
978  if (create_vacuum) beamPipe->AddNode(Vpipeup_vac, 0, trb1);
979 
980  if (create_pipe) beamPipe->AddNode(Vktmpump, 0, trc2); // c1
981  if (create_vacuum) beamPipe->AddNode(Vktmpump_vac, 0, trc2);
982 
983  if (create_pipe) beamPipe->AddNode(VTpumps, 0, tr0); // c2
984 
985  if (create_pipe) beamPipe->AddNode(VpipeTSup, 0, trd1); // d
986  if (create_vacuum) beamPipe->AddNode(VpipeTSup_vac, 0, trd1);
987 
988  if (create_target) VTcross->AddNode(vol_target, 0, tre9);
989 
990  if (create_pipe) beamPipe->AddNode(VTcross, 0, tre9); // e
991  if (create_vacuum) beamPipe->AddNode(VTcross_vac, 0, tre9); // e
992 
993  if (create_pipe) beamPipe->AddNode(VpipeTSdown, 0, trf1); // f
994  if (create_vacuum) beamPipe->AddNode(VpipeTSdown_vac, 0, trf1);
995 
996  if (create_pipe) beamPipe->AddNode(VcrossTSTMPs, 0, trg7); // g
997  if (create_vacuum) beamPipe->AddNode(VcrossTSTMPs_vac, 0, trg7);
998 
999 
1000  if (create_pipe) beamPipe->AddNode(VDipolePip, 0, trh4); // h
1001  if (create_vacuum) beamPipe->AddNode(VDipolePip_vac, 0, trh4);
1002 
1003  //beamPipe->AddNode(VLumMon, 0, tri6); // i
1004  //beamPipe->AddNode(vlum_beampipe_upstream, 0, tri6); // i
1005  //beamPipe->AddNode(vlum_CaptonCone, 0, tri6); // i
1006  //beamPipe->AddNode(vlum_beampipe_downstream, 0, tri6); // i
1007  //beamPipe->AddNode(VEndCross, 0, trj8); // j
1008 
1009  // create an array of z positions for the sensors in 10 cm distances
1010  for (int iposz = 0; iposz < 1200; iposz+=10) sensor_positions.push_back(iposz);
1011  // construct the sensors
1012  if (create_sensors){
1013  for (unsigned int isensor = 1; isensor < sensor_positions.size(); isensor++){
1014  std::stringstream volume_name;
1015  volume_name << "_" << isensor;
1016  // create a sensor with a radius of 40 cm
1017  TGeoTube* disc = new TGeoTube(("disc"+volume_name.str()).c_str(), 0., 40., 0.0000001);
1018  TGeoVolume* Vdisc = new TGeoVolume(("LumActive_pipe_sensor_"+volume_name.str()).c_str(), disc,
1019  gGeoManager->GetMedium("mylar"));
1020  TGeoCombiTrans* tre_disc =
1021  new TGeoCombiTrans(("tre_"+volume_name.str()).c_str(), 0., 0., sensor_positions[isensor], r1);
1022  tre_disc->RegisterYourself();
1023  Vdisc->SetLineColor(2);
1024  beamPipe->AddNode(Vdisc, 0, tre_disc);
1025  }
1026  }
1027 
1028  /*
1029  TGeoVolume *VTest = new TGeoVolume("VTest", SDippip,
1030  gGeoManager->GetMedium("steel"));
1031  VTest->SetLineColor(37);
1032  */
1033 
1034  // add pipe to cave
1035  cave->AddNode(beamPipe, 1);
1036  if (create_lumi){
1037  //PndLmdDim* lmddim = PndLmdDim::Instance();
1038  //lmddim->Generate_rootgeom(*cave, false);
1039  }
1040  //beamPipe->AddNode(VTest, 0, trv1);
1041  gGeoManager->CloseGeometry();
1042 
1043  // check geometry
1044  //cave->CheckOverlaps(0.1, "");
1045  gGeoManager->CheckOverlaps(0.001); // [cm]
1046  //gGeoManager->CheckGeometryFull();
1047  gGeoManager->PrintOverlaps();
1048 
1049  // save geometry
1050 
1051  //cave->Write();
1052  cave->Write();
1053  fi->Close();
1054 
1055  // plot geometry
1056  cave->Draw("ogl");
1057  //cave->Draw("ogl");
1058 
1059  // done
1060  fprintf(stderr, "\n");
1061  fprintf(stderr, "<I> Geometry of PANDA beam pipe written to %s\n",
1062  fGeoFile.Data());
1063  fprintf(stderr, "\n");
1064 
1065  return 0;
1066 }
Double_t z0
Definition: checkhelixhit.C:62
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
int create_lumi()
Definition: create_lumi.C:2
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
int main ( void  )

Definition at line 1070 of file lmd/Promme/createRootGeometry_beampipe.C.

References createRootGeometry_beampipe().

1070  {
1071  TApplication myapp("myapp",0,0);
1073  myapp.Run();
1074  return 0;
1075 }