FairRoot/PandaRoot
Functions
lmd/geo/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 46 of file lmd/geo/createRootGeometry_beampipe.C.

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

46  {
47 
48  // basic constants concerning the path of the beam pipe
49  // downstream of the target
50  const double bend_begin = 360.; // where bending has to start
51  const double bend_radius = 5750.; // bending radius
52  const double bend_angle = 40.068e-3; // bending angle
53  const double bend_end = bend_begin+sin(bend_angle)*bend_radius; // z position of the bend end
54 
55  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
56  TString vmcWorkdir = gSystem->Getenv("VMCWORKDIR");
57 
58  // if you do not want sensors in your beam pipe,
59  // so a simple beam pipe only, set it to false
60  bool create_sensors = false;
61  // key z positions are stored in the following vector
62  std::vector< double > sensor_positions;
63 
64  // materials and media
65  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
66  FairGeoInterface* geoFace = geoLoad->getGeoInterface();
67  geoFace->setMediaFile(vmcWorkdir + "/geometry/media_pnd.geo");
68  geoFace->readMedia();
69  geoFace->print();
70  FairGeoMedia* geoMedia = geoFace->getMedia();
71  FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
72 
73  std::string str_ti = "Aluminum"; // "titanium" is in Panda software not yet implemented
74  FairGeoMedium* FairMediumAir = geoMedia->getMedium("air");
75  FairGeoMedium* FairMediumSteel = geoMedia->getMedium("steel");
76  FairGeoMedium* FairMediumTi = geoMedia->getMedium(str_ti.c_str()); //titanium"); not found in media_pnd.geo !
77  FairGeoMedium* FairMediumKapton = geoMedia->getMedium("mylar"); // mylar properties are nearly the same as for the non existing Kapton
78 
79  if (!FairMediumAir || !FairMediumSteel || !FairMediumTi || !FairMediumKapton) {
80  std::cout << " warning: not all media found " << std::endl;
81  }
82 
83  geoBuild->createMedium(FairMediumAir);
84  geoBuild->createMedium(FairMediumSteel);
85  geoBuild->createMedium(FairMediumTi);
86  geoBuild->createMedium(FairMediumKapton);
87  std::cout << " done " << std::endl;
88  // open output file
89  TString fGeoFile = Form("geo/beampipe_201210.root");
90  TFile* fi = new TFile(fGeoFile, "RECREATE");
91 
92  // define cave
93  /*
94  TGeoVolume* cave;
95  TGeoBBox* lTop = new TGeoBBox(200, 200, 300);
96  cave = new TGeoVolume("BeamPipe", lTop, gGeoManager->GetMedium("air"));
97  gGeoManager->SetTopVolume(cave);
98  */
99  TGeoVolume *cave = new TGeoVolumeAssembly("pipeassembly");//gGeoManager->GetTopVolume();
100  gGeoManager->SetTopVolume(cave);
101  //cave->AddNode(beamPipe, 1);
102 
103  // ---------------------------------------------------------------------------
104  // the full geometry is built-up by adding volumes starting from the most
105  // upstream position, variable currentz is continuously updated and always
106  // contains the z-coordinate of the most down-stream point of the geometry
107  Double_t currentz = 0.0;
108 
109  // z-position of very first point
110  Double_t z0 = -459.9328; // with this z0 the target is at z = 0.
111 
112  // Definition of some constants, dummy shapes, transformations
113  Double_t const rad = 3.1415926 / 180.;
114  Double_t const delta = 1.E-6;
115 
116  TGeoRotation* r1 = new TGeoRotation("r1", 0., 0., 0.); // no rotation
117  TGeoRotation* r2 = new TGeoRotation("r2", 0., 90., 180.); // 90 deg about x-axis and 180 deg about y axis
118  TGeoRotation* r3 = new TGeoRotation("r3", 0., -90., 0); // -90 deg about x-axis
119  TGeoRotation* r4 = new TGeoRotation("r4", 90., 0., 0); // 90 deg about z-axis
120 
121  TGeoCombiTrans* tr0 = new TGeoCombiTrans("tra0", 0., 0., z0, r1);
122  tr0->RegisterYourself();
123 
124  // ---------------------------------------------------------------------------
125  // define valves and pumps which are used at different places
126 
127  TGeoCombiTrans* trv1 = new TGeoCombiTrans("trv1", 0., 0., 1.075, r1);
128  trv1->RegisterYourself();
129  TGeoCombiTrans* trv2 = new TGeoCombiTrans("trv2", 0., 0., 3.53875, r1);
130  trv2->RegisterYourself();
131  TGeoCombiTrans* trv3 = new TGeoCombiTrans("trv3", 0., 0., 6.0075, r1);
132  trv3->RegisterYourself();
133 
134  // VAT -Gate Valve CF63
135  // width in z is 7.
136  Double_t ov1[3] = { 0., 5.7, 0. };
137  TGeoBBox* VATvalve63a = new TGeoBBox("VATvalve63a", 5.6, 12.45, 1.35, ov1);
138  TGeoTube* VATvalve63b = new TGeoTube("VATvalve63b", 3.5, 6.5, 1.075);
139  TGeoTube* tv1 = new TGeoTube("tv1", 0., 3.5, 1.35 + delta);
140 
141  TGeoCompositeShape *SVATvalve630 = new TGeoCompositeShape("VATvalve630",
142  "VATvalve63a-tv1");
143  TGeoCompositeShape *SVATvalve63 = new TGeoCompositeShape("VATvalve63",
144  "VATvalve63b:trv1+VATvalve630:trv2+VATvalve63b:trv3");
145 
146  // VAT -Gate Valve CF100
147  // width in z is 7.
148  Double_t ov2[3] = { 0., 7.3, 0. };
149  TGeoBBox* VATvalve100a = new TGeoBBox("VATvalve100a", 7.2, 16.0, 1.35, ov2);
150  TGeoTube* VATvalve100b = new TGeoTube("VATvalve100b", 5.0, 8.25, 1.075);
151  TGeoTube* tv2 = new TGeoTube("tv2", 0., 5.0, 1.35 + delta);
152 
153  TGeoCompositeShape *SVATvalve1000 = new TGeoCompositeShape("VATvalve1000",
154  "VATvalve100a-tv2");
155  TGeoCompositeShape *SVATvalve100 = new TGeoCompositeShape("VATvalve100",
156  "VATvalve100b:trv1+VATvalve1000:trv2+VATvalve100b:trv3");
157 
158  // VAT -Gate Valve CF160
159  // width in z is 7.
160  Double_t ov3[3] = { 0., 9.9, 0. };
161  TGeoBBox* VATvalve160a =
162  new TGeoBBox("VATvalve160a", 9.1, 21.75, 1.35, ov3);
163  TGeoTube* VATvalve160b = new TGeoTube("VATvalve160b", 7.5, 11.25, 1.075);
164  TGeoTube* tv3 = new TGeoTube("tv3", 0., 7.5, 1.35 + delta);
165 
166  TGeoCompositeShape *SVATvalve1600 = new TGeoCompositeShape("VATvalve1600",
167  "VATvalve160a-tv3");
168  TGeoCompositeShape *SVATvalve160 = new TGeoCompositeShape("VATvalve160",
169  "VATvalve160b:trv1+VATvalve1600:trv2+VATvalve160b:trv3");
170 
171  // Turbovac_SL700_CF160
172  Double_t psv1[27] = { 0., 360., 8, .0, 6.0, 10.85, 7.6, 6.0, 10.85, 7.6,
173  6.0, 10.15, 16.6, 6.0, 10.15, 16.6, 6.0, 9.0, 24.0, 6.0, 9.0, 24.0,
174  0., 9.0, 24.2, 0., 9.0 };
175  TGeoPcon* TVP700 = new TGeoPcon("TVP700", 0., 360., 8);
176  TVP700->SetDimensions(psv1);
177 
178  // Turbovac_1000C_CF160
179  Double_t psv2[39] = { 0., 360., 12, 0.0, 7.5, 11.25, 2.45, 7.5, 11.25,
180  2.45, 7.5, 7.965, 3.45, 7.5, 7.965, 6.45, 7.5, 12.9, 8.45, 0.,
181  12.9, 8.45, 0., 12.05, 24.00, 0., 12.05, 24.00, 0., 12.9, 26.00,
182  0., 12.9, 26.00, 0., 7.5, 36.85, 0., 7.5 };
183  TGeoPcon* TVP1000 = new TGeoPcon("TVP1000", 0., 360., 12);
184  TVP1000->SetDimensions(psv2);
185 
186  // Ion getter pump 1000l/s
187  // is approximated as a cylinder
188  Double_t psv3[21] = { 0., 360., 6, 0., 7.5, 10.125, 2.0, 7.5, 10.125, 2.0,
189  7.5, 7.7, 10.0, 7.5, 7.7, 10.0, 0., 20.0, 60.7, 0., 20.0 };
190  TGeoPcon* IGP1000 = new TGeoPcon("IGP1000", 0., 360., 6);
191  IGP1000->SetDimensions(psv3);
192 
193  // ---------------------------------------------------------------------------
194  // Definition of the volumes from up- to down-stream
195  // The naming of the shapes and volumes follows the naming in the CATIA
196  // drawing
197  //
198  // ---------------------------------------------------------------------------
199  // a - GV to HESR (GV to HESR.1)
200 
201  // VAT -Gate Valve CF100
202  TGeoVolume *Vgvhesr = new TGeoVolume("gvhesr", SVATvalve100,
203  gGeoManager->GetMedium("steel"));
204  Vgvhesr->SetLineColor(30);
205 
206  // last z-position: 7.
207  currentz += 7.;
208  fprintf(stderr, "currentz a: %f\n", currentz);
209 
210  // ---------------------------------------------------------------------------
211  // b - pipe upstream (pipe upstream.1)
212 
213  Double_t psb1[27] = { 0., 360., 8, 0., 4.35, 7.58, 2.0, 4.35, 7.58, 2.0,
214  4.35, 4.45, 20.0, 4.35, 4.45, 31.3328, 7.50, 7.60, 156.0328, 7.50,
215  7.60, 156.0328, 7.50, 10.125, 158.2328, 7.50, 10.125 };
216  TGeoPcon* pipeup = new TGeoPcon("pipeup", 0., 360., 8);
217  pipeup->SetDimensions(psb1);
218 
219  TGeoCombiTrans* trb1 =
220  new TGeoCombiTrans("trb1", 0., 0., z0 + currentz, r1);
221  trb1->RegisterYourself();
222  //sensor_positions.push_back(z0 + currentz);
223 
224  TGeoVolume *Vpipeup = new TGeoVolume("pipeup", pipeup,
225  gGeoManager->GetMedium("steel"));
226  Vpipeup->SetLineColor(31);
227 
228  // last z-position: 165.2328
229  currentz += 158.2328;
230  fprintf(stderr, "currentz b: %f\n", currentz);
231 
232  // ---------------------------------------------------------------------------
233  // c - KreuzTMpump (KreuzTMpump.1)
234 
235  // horizontal/vertical bar of the cross
236  Double_t psc1[21] = { 0., 360., 6, -16.7, 7.50, 10.125, -14.5, 7.50,
237  10.125, -14.5, 7.50, 7.70, 14.5, 7.50, 7.70, 14.5, 7.50, 10.125,
238  16.7, 7.50, 10.125 };
239  TGeoPcon* ktmpump0 = new TGeoPcon("ktmpump0", 0., 360., 6);
240  ktmpump0->SetDimensions(psc1);
241  TGeoTube* tc1 = new TGeoTube("tc1", 0., 7.7, 7.7);
242 
243  TGeoCombiTrans* trc1 = new TGeoCombiTrans("trc1", 0., 0., 0, r2);
244  trc1->RegisterYourself();
245  TGeoCombiTrans* trc2 = new TGeoCombiTrans("trc2", 0., 0.,
246  z0 + currentz + 16.7, r1);
247  trc2->RegisterYourself();
248 
249  TGeoCompositeShape *csc1 = new TGeoCompositeShape("csc1",
250  "(ktmpump0-tc1:trc1)");
251  TGeoCompositeShape *Sktmpump = new TGeoCompositeShape("ktmpump",
252  "csc1+(csc1:trc1)");
253 
254  TGeoVolume *Vktmpump = new TGeoVolume("ktmpump", Sktmpump,
255  gGeoManager->GetMedium("steel"));
256  Vktmpump->SetLineColor(32);
257 
258  //sensor_positions.push_back(z0 + currentz);
259  // last z-position: 181.932800
260  currentz += 16.7;
261  fprintf(stderr, "currentz c1: %f\n", currentz);
262 
263  // ...........................................................................
264 
265  // add Turbovac_1000C_CF160 and GV_CF160
266  TGeoCombiTrans* trc3 = new TGeoCombiTrans("trc3", 0., 0., 7.0, r1);
267  trc3->RegisterYourself();
268  TGeoCombiTrans* trc4 = new TGeoCombiTrans("trc4", 0., -16.7, currentz, r2);
269  trc4->RegisterYourself();
270  TGeoCombiTrans* trc5 = new TGeoCombiTrans("trc5", 0., 16.7, currentz, r3);
271  trc5->RegisterYourself();
272 
273  TGeoCompositeShape *STVPwValve = new TGeoCompositeShape("TVPwValve",
274  "(VATvalve160+TVP1000:trc3)");
275  TGeoCompositeShape *STpumps = new TGeoCompositeShape("Tpumps",
276  "TVPwValve:trc4+TVPwValve:trc5");
277 
278  TGeoVolume *VTpumps = new TGeoVolume("Tpump", STpumps,
279  gGeoManager->GetMedium("steel"));
280  VTpumps->SetLineColor(33);
281 
282  //sensor_positions.push_back(z0 + currentz);
283  // last z-position: 198.6328
284  currentz += 16.7;
285  fprintf(stderr, "currentz c2: %f\n", currentz);
286 
287  // ---------------------------------------------------------------------------
288  // d - pipeTSup.1, special_flange.1, coneExtensionUpstreamSteel.1
289 
290  Double_t psd1[27] = { 0., 360., 8, 0.0, 7.5, 10.125, 2.20, 7.5, 10.125,
291  2.20, 7.5, 7.70, 148.80, 7.5, 7.70, 148.80, 7.5, 10.125, 153.80,
292  7.5, 10.125, 153.80, 7.5, 7.70, 231.30, 7.5, 7.70 };
293  TGeoPcon* pipeTSup = new TGeoPcon("pipeTSup", 0., 360., 8);
294  pipeTSup->SetDimensions(psd1);
295 
296  TGeoCombiTrans* trd1 =
297  new TGeoCombiTrans("trd1", 0., 0., z0 + currentz, r1);
298  trd1->RegisterYourself();
299 
300  TGeoVolume *VpipeTSup = new TGeoVolume("pipeTSup", pipeTSup,
301  gGeoManager->GetMedium("steel"));
302  VpipeTSup->SetLineColor(34);
303 
304  //sensor_positions.push_back(z0 + currentz);
305  // last z-position: 429.9328
306  currentz += 231.3;
307  fprintf(stderr, "currentz d: %f\n", currentz);
308 
309  // ---------------------------------------------------------------------------
310  // e - TargetKreuz.1
311 
312  // target position
313  Double_t tz = 30.0;
314  fprintf(stderr, "Target position: 0 / 0 / %f\n", z0 + currentz + tz);
315 
316  // target cross - horizontal
317  Double_t pse1[24] = { 0., 360., 7, 0., 7.5, 7.55, 10.45, 7.5, 7.55, 26.8,
318  1.25, 1.30, 26.8, 1.25, 1.27, 29.98, 1.25, 1.27, 29.98, 0., 1.27,
319  tz, 0., 1.27 };
320  TGeoPcon* Tcross1 = new TGeoPcon("Tcross1", 0., 360., 7);
321  Tcross1->SetDimensions(pse1);
322 
323  TGeoTube* Tcross2 = new TGeoTube("Tcross2", 1.0, 1.02, 11.5);
324 
325  // target cross vertical
326  Double_t pse2[63] = { 0., 360., 20, -182.0, 7.5, 7.7, -135.5, 7.5, 7.7,
327  -125.5, 4.5, 4.6, -95.5, 4.5, 4.6, -95.5, 3.0, 3.1, -54.0, 3.0,
328  3.1, -54.0, 2.0, 2.1, -42.1, 2.0, 2.1, -17.0, 2.0, 2.1, -17.0, 1.0,
329  1.02, 17.0, 1.0, 1.02, 17.0, 2.0, 2.1, 42.1, 2.0, 2.1, 54.0, 2.0,
330  2.1, 54.0, 3.0, 3.1, 95.5, 3.0, 3.1, 95.5, 4.5, 4.6, 133.5, 4.5,
331  4.6, 143.5, 7.85, 7.95, 168.69, 7.85, 7.95,
332 
333  };
334  TGeoPcon* Tcross3 = new TGeoPcon("Tcross3", 0., 360., 20);
335  Tcross3->SetDimensions(pse2);
336 
337  TGeoTube* te1 = new TGeoTube("te1", 0., 1.25, 0.51 + delta);
338  TGeoTube* te2 = new TGeoTube("te2", 0., 1.00, 0.51 + delta);
339  TGeoTube* te3 = new TGeoTube("te3", 0., 1.00, 1.27 + delta);
340  TGeoTube* te4 = new TGeoTube("te4", 0., 1.00, 1.02 + delta);
341 
342  TGeoCombiTrans* tre1 = new TGeoCombiTrans("tre1", 0., 0., tz, r2);
343  tre1->RegisterYourself();
344  TGeoCombiTrans* tre2 = new TGeoCombiTrans("tre2", 0., 0., -11.5, r2);
345  tre2->RegisterYourself();
346  TGeoCombiTrans* tre3 = new TGeoCombiTrans("tre3", 0., 0., 0., r2);
347  tre3->RegisterYourself();
348  TGeoCombiTrans* tre4 = new TGeoCombiTrans("tre4", 0., 0., -0.51, r1);
349  tre4->RegisterYourself();
350  TGeoCombiTrans* tre5 = new TGeoCombiTrans("tre5", 0., 0., 0.51, r1);
351  tre5->RegisterYourself();
352  TGeoCombiTrans* tre6 = new TGeoCombiTrans("tre6", 0., 0., 41.5, r1);
353  tre6->RegisterYourself();
354  TGeoCombiTrans* tre7 = new TGeoCombiTrans("tre7", 0., 0., tz, r1);
355  tre7->RegisterYourself();
356  TGeoCombiTrans* tre8 = new TGeoCombiTrans("tre8", 0., -175.0, tz, r3);
357  tre8->RegisterYourself();
358 
359  TGeoCombiTrans* tre9 =
360  new TGeoCombiTrans("tre9", 0., 0., z0 + currentz, r1);
361  tre9->RegisterYourself();
362 
363  TGeoCompositeShape *STcross0a = new TGeoCompositeShape("Tcross0a",
364  "Tcross1-te3:tre1");
365  TGeoCompositeShape *STcross0b = new TGeoCompositeShape("Tcross0b",
366  "Tcross2-te4:tre2");
367  TGeoCompositeShape *STcross0c = new TGeoCompositeShape("Tcross0c",
368  "Tcross3:tre3-te1:tre4-te2:tre5");
369 
370  TGeoCompositeShape *STcross = new TGeoCompositeShape("Tcross",
371  "Tcross0a+Tcross0b:tre6+Tcross0c:tre7+VATvalve160:tre8");
372 
373  TGeoVolume *VTcross = new TGeoVolume("Tcross", STcross,
374  gGeoManager->GetMedium(str_ti.c_str()));
375  VTcross->SetLineColor(35);
376 
377  //sensor_positions.push_back(z0 + currentz);
378  // last z-position: 482.9328
379  currentz += 53.0;
380  fprintf(stderr, "currentz e: %f\n", currentz);
381 
382  // ---------------------------------------------------------------------------
383  // f - pipeTSdown
384 
385  Double_t psf1[51] = { 0., 360., 16, 0.000, 1.0, 1.02, 3.7321, 2.0, 2.02,
386  3.7321, 2.0, 2.05, 93.0000, 2.0, 2.05, 97.4785, 3.2, 3.25,
387  101.0000, 3.2, 3.25, 101.0000, 3.2, 3.4, 106.0225, 3.2, 3.4,
388  106.0225, 3.2, 3.27, 241.8225, 3.2, 3.27, 241.8225, 3.2, 3.35,
389  244.8225, 3.2, 3.35, 244.8225, 3.2, 3.27, 261.0725, 3.2, 3.27,
390  261.0725, 3.2, 5.675, 262.8225, 3.2, 5.675 };
391  TGeoPcon* pipeTSdown = new TGeoPcon("pipeTSdown", 0., 360., 16);
392  pipeTSdown->SetDimensions(psf1);
393 
394  TGeoCombiTrans* trf1 =
395  new TGeoCombiTrans("trf1", 0., 0., z0 + currentz, r1);
396  trf1->RegisterYourself();
397 
398  TGeoVolume *VpipeTSdown = new TGeoVolume("pipeTSdown", pipeTSdown,
399  gGeoManager->GetMedium(str_ti.c_str()));
400  VpipeTSdown->SetLineColor(36);
401 
402  //sensor_positions.push_back(z0 + currentz);
403  // last z-position: 745.7553
404  currentz += 262.8225;
405  fprintf(stderr, "currentz f: %f\n", currentz);
406 
407  // ---------------------------------------------------------------------------
408  // g - cross_TS_TMPs
409 
410  // horizontal part
411  Double_t psg1[27] = { 0., 360., 8, 0.000, 3.2, 5.675, 1.7200, 3.2, 5.675,
412  1.7200, 3.2, 3.27, 3.3653, 3.2, 3.27, 10.0830, 5.0, 5.07, 51.0,
413  5.0, 5.07, 51.0, 5.0, 7.60, 53.0, 5.0, 7.60 };
414  TGeoPcon* crossTS1 = new TGeoPcon("crossTS1", 0., 360., 8);
415  crossTS1->SetDimensions(psg1);
416 
417  TGeoTube* tg1 = new TGeoTube("tg1", 0., 6.07, 5.07 + delta);
418  TGeoCombiTrans* trg1 = new TGeoCombiTrans("trg1", 0., 0., 26.0, r2);
419  trg1->RegisterYourself();
420  TGeoCompositeShape *ScrossTSa = new TGeoCompositeShape("crossTSa",
421  "crossTS1-tg1:trg1");
422 
423  // pipe perpendicular
424  Double_t psg2[21] = { 0., 360., 6, -55.0, 6.0, 10.125, -52.8, 6.0, 10.125,
425  -52.8, 6.0, 6.07, 52.8, 6.0, 6.07, 52.8, 6.0, 10.125, 55.0, 6.0,
426  10.125 };
427  TGeoPcon* crossTS2 = new TGeoPcon("crossTS2", 0., 360., 22);
428  crossTS2->SetDimensions(psg2);
429 
430  TGeoTube* tg2 = new TGeoTube("tg2", 0., 5.07, 6.07 + delta);
431  TGeoCombiTrans* trg2 = new TGeoCombiTrans("trg2", 0., -55.0, 0., r2);
432  trg2->RegisterYourself();
433  TGeoCombiTrans* trg3 = new TGeoCombiTrans("trg3", 0., 55.0, 0., r3);
434  trg3->RegisterYourself();
435  TGeoCombiTrans* trg4 = new TGeoCombiTrans("trg4", 0., 0., 7.0775, r1);
436  trg4->RegisterYourself();
437  TGeoCombiTrans* trg5 = new TGeoCombiTrans("trg5", 0., 0., 33.0775, r1);
438  trg5->RegisterYourself();
439 
440  // put it together
441  TGeoCompositeShape *ScrossTSb = new TGeoCompositeShape("crossTSb",
442  "crossTS2:r2-tg2+TVP700:trg2+TVP700:trg3");
443  TGeoCompositeShape *ScrossTS = new TGeoCompositeShape("crossTS",
444  "crossTSa:trg4+crossTSb:trg5");
445 
446  TGeoCombiTrans* trg6 = new TGeoCombiTrans("trg6", 0., 0., 60.0775, r1);
447  trg6->RegisterYourself();
448  TGeoCombiTrans* trg7 =
449  new TGeoCombiTrans("trg7", 0., 0., z0 + currentz, r1);
450  trg7->RegisterYourself();
451 
452  TGeoCompositeShape *ScrossTSTMPs = new TGeoCompositeShape("crossTSTMPs",
453  "VATvalve63+crossTS+VATvalve100:trg6");
454 
455  TGeoVolume *VcrossTSTMPs = new TGeoVolume("crossTSTMPs", ScrossTSTMPs,
456  gGeoManager->GetMedium("steel"));
457  VcrossTSTMPs->SetLineColor(37);
458 
459  //sensor_positions.push_back(z0 + currentz);
460  // last z-position: 812.9103
461  currentz += 67.155;
462  fprintf(stderr, "currentz g: %f\n", currentz);
463 
464  // ---------------------------------------------------------------------------
465  // h - BeamPipe Dipole
466  // The dipole pipe is bent with a radius of 60 m. All elements downstream of this
467  // element need to be rotated and shifted accordingly in the xz-plane.
468  //Double_t R = 6000.0; // bending radius of the pipe
469  Double_t R = bend_radius; // fit results (P.Jasinski) with fixed deflection angle
470  //Double_t dz0 = 241.1985; // this is the length of the pipe along z
471  Double_t dz0 = bend_end-bend_begin; // fit results (P.Jasinski)
472  Double_t dphi = asin(dz0 / R); // what is indeed bend_radius, as it should be
473  Double_t dx0 = R * (1. - cos(dphi));
474  TGeoRotation *dipolerot = new TGeoRotation("dipolerot", 90., dphi / rad,
475  -90.); // rotation to accout for bendig
476  fprintf(stderr, "Rotation due to dipole magnet: %f\n", dphi / rad);
477 
478  // shifts need to be computed individually
479  // dz = dz0 + s*cos(dphi) where dx,dz0 is the point where the bended pipe ends
480  // dx = dx0 - s*sin(dphi) s is the length of the added elements
481  // combined transformations are then defined with ...
482  // TGeoCombiTrans* trpr = new TGeoCombiTrans("trpr", dx, 0., dz, dipolerot); trpr->RegisterYourself();
483  Double_t s = 0.;
484 
485  // horizontal pipe, first part
486  Double_t psh1[15] = { 0., 360., 4, 0., 5.0, 7.6, 2.0, 5.0, 7.6, 2.0, 5.0,
487  5.2, 7.1225, 5.0, 5.2, };
488  TGeoPcon* Dippip1 = new TGeoPcon("Dippip1", 0., 360., 4);
489  Dippip1->SetDimensions(psh1);
490 
491  // horizontal pipe, bent part
492  TGeoTorus *Dippip2 = new TGeoTorus("Dippip2", R, 5.0, 5.2, 0., dphi / rad);
493  Double_t psh2[24] = { 0., 360., 7, 0., 5.0, 5.2, 5.0225, 5.0, 5.2, 19.3385,
494  9.0, 9.2, 19.3385, 9.0, 9.3, 439.3572 + 11.1, 9.0, 9.3, 439.3572 + 11.1, 9.0,
495  12.65, 441.7572 + 11.1, 9.0, 12.65, }; // + 11.1 cm needed with the fit radius by P.Jasinski
496 
497  // horizontal pipe, third part
498  TGeoPcon* Dippip3 = new TGeoPcon("Dippip3", 0., 360., 7);
499  Dippip3->SetDimensions(psh2);
500 
501  TGeoCombiTrans* trh1 = new TGeoCombiTrans("trh1", R, 0., 7.1225,
502  new TGeoRotation("a", 0., -90., 180.));
503  trh1->RegisterYourself();
504  TGeoCombiTrans* trh2 = new TGeoCombiTrans("trh2", dx0, .0, 7.1225 + dz0,
505  dipolerot);
506  //sensor_positions.push_back(7.1225 + dz0);
507  trh2->RegisterYourself();
508  s = s + 7.0775;
509  TGeoCombiTrans* trh3 = new TGeoCombiTrans("trh3", dx0 + s * sin(dphi), 0.,
510  7.1225 + dz0 + s * cos(dphi), dipolerot);
511  trh3->RegisterYourself();
512  s = s + 441.7572 + 11.1; // 11.1 cm needed with the fit radius by P.Jasinski
513  TGeoCombiTrans* trh4 =
514  new TGeoCombiTrans("trh4", 0., 0., z0 + currentz, r1);
515  trh4->RegisterYourself();
516 
517  // put it together including VATvalve100
518  TGeoCompositeShape *SDippip = new TGeoCompositeShape("Dippip",
519  "Dippip1+Dippip2:trh1+VATvalve100:trh2+Dippip3:trh3");
520 
521  TGeoVolume *VDipolePip = new TGeoVolume("DipolePip", SDippip,
522  gGeoManager->GetMedium("steel"));
523  VDipolePip->SetLineColor(38);
524 
525  // last z-position: 1498.836617 was 1509.7031905 (s = 448.83470)
526  currentz += 7.1225 + dz0 + s * cos(dphi);
527  fprintf(stderr, "currentz/s h: %f %f\n", currentz, s);
528  std::cout << " luminosity monitor starts at " << currentz + z0 << std::endl;
529 
530  // ---------------------------------------------------------------------------
531  // i - Luminosity monitor
532 
533  TGeoTube* lmd_beampipe_upstr = new TGeoTube(
534  "lmd_beampipe_upstr", 9., 9.2, 25.);
535  TGeoCombiTrans* lmd_trans_b_up = new TGeoCombiTrans("lmd_trans_b_up", 0., 0., 25.+delta, r1);
536  lmd_trans_b_up->RegisterYourself();
537  TGeoTube* lmd_flange_upstr = new TGeoTube(
538  "lmd_flange_upstr", 9.2, 25.3/2., 1.2);
539  TGeoCombiTrans* lmd_trans_fl_up = new TGeoCombiTrans("lmd_trans_fl_up", 0., 0., 1.2+delta, r1);
540  lmd_trans_fl_up->RegisterYourself();
541  // upstream flange holding the kapton cone
542  TGeoTube* lmd_cone_flange_upstr = new TGeoTube(
543  "lmd_cone_flange_upstr", 9.2, 25.3/2., 1.5);
544  TGeoCombiTrans* lmd_trans_co_fl_up = new TGeoCombiTrans("lmd_trans_co_fl_up", 0., 0., -1.5+50.-delta, r1);
545  lmd_trans_co_fl_up->RegisterYourself();
546 
547  // 20 mu thick kapton foil cone
548  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.);
549  TGeoCombiTrans* lmd_trans_cap_co = new TGeoCombiTrans("lmd_trans_cap_co", 0., 0., 50.+23.386/2., r1);
550  lmd_trans_cap_co->RegisterYourself();
551 
552  // flange holding the kapton cone downstream
553  TGeoCone* lmd_cone_flange_downstr = new TGeoCone("lmd_cone_flange_downstr", 3.12/2., 3.1, 8.6/2., 3.1, 3.2);
554  TGeoCombiTrans* lmd_trans_co_fl_do = new TGeoCombiTrans("lmd_trans_co_fl_do", 0., 0., 50.+23.386+3.12/2., r1);
555  lmd_trans_co_fl_do->RegisterYourself();
556  // beam pipe to shield the sensors
557  TGeoTube* lmd_beam_pipe = new TGeoTube("lmd_beam_pipe", 3.5, 3.6, 50./2.);
558  TGeoCombiTrans* lmd_trans_p = new TGeoCombiTrans("lmd_trans_p", 0., 0., 50.+23.386+50./2., r1);
559  lmd_trans_p->RegisterYourself();
560  // beam pipe cone downstream
561  TGeoCone* lmd_cone_downstr = new TGeoCone("lmd_cone_downstr", 20./2., 3.5, 3.7, 9./2., 9.2/2.);
562  TGeoCombiTrans* lmd_trans_co_do = new TGeoCombiTrans("lmd_trans_co_do", 0., 0., 50.+23.386+50.+20./2., r1);
563  lmd_trans_co_do->RegisterYourself();
564  // beam pipe downstream
565  TGeoTube* lmd_beam_pipe_downstream = new TGeoTube("lmd_beam_pipe_downstream", 9./2., 9.2/2., 56./2.);
566  TGeoCombiTrans* lmd_trans_p_down = new TGeoCombiTrans("lmd_trans_p_down", 0., 0., 50.+23.386+50.+20.+56./2., r1);
567  lmd_trans_p_down->RegisterYourself();
568  // main body
569  //Double_t psi1[33] = { 0., 360., 10, 0., 9.0, 12.65, 2.4, 9.0, 12.65, 2.4,
570  // 9.0, 9.2, 4.4343, 9.0, 9.2, 17.5, 12.5, 12.7, 177.0, 12.5, 12.7,
571  // 195.66, 7.5, 7.7, 198.0, 7.5, 7.7, 198.0, 7.5, 10.125, 200.0, 7.5,
572  // 10.125 };
573  //TGeoPcon* LumMon0 = new TGeoPcon("LumMon0", 0., 360., 10);
574  //LumMon0->SetDimensions(psi1);
575 
576  // nozzle
577  //Double_t psi2[21] = { 0., 360., 6, -27.0, 5.2, 7.6, -25.0, 5.2, 7.6, -25.0,
578  // 5.2, 5.4, 25.0, 5.2, 5.4, 25.0, 5.2, 7.6, 27.0, 5.2, 7.6 };
579  //TGeoPcon* nozzle0 = new TGeoPcon("nozzle0", 0., 360., 6);
580  //nozzle0->SetDimensions(psi2);
581 
582  //TGeoTube* ti1 = new TGeoTube("ti1", 0., 12.7, 5.4 + delta);
583  //TGeoTube* ti2 = new TGeoTube("ti2", 0., 5.0, 12.7 + delta);
584 
585  //TGeoCombiTrans* tri1 = new TGeoCombiTrans("tri1", 0., 0., 77.8, r2);
586  //tri1->RegisterYourself();
587  //TGeoCombiTrans* tri2 = new TGeoCombiTrans("tri2", 0., 0., 97.8, r2);
588  //tri2->RegisterYourself();
589  //TGeoCombiTrans* tri3 = new TGeoCombiTrans("tri3", 0., 0., 117.8, r2);
590  //tri3->RegisterYourself();
591  //TGeoCombiTrans* tri4 = new TGeoCombiTrans("tri4", 0., 0., 137.8, r2);
592  //tri4->RegisterYourself();
593  //TGeoCombiTrans* tri5 = new TGeoCombiTrans("tri5", 0., 0., 0., r4);
594  //tri5->RegisterYourself();
595 
596  // put it together
597  //TGeoCompositeShape *Snozzle1 = new TGeoCompositeShape("nozzle1",
598  // "(nozzle0-ti1:r2)");
599  //TGeoCompositeShape *Snozzles = new TGeoCompositeShape("nozzles",
600  // "nozzle1:tri1+nozzle1:tri2+nozzle1:tri3+nozzle1:tri4");
601  //TGeoCompositeShape *Sholes = new TGeoCompositeShape("holes",
602  // "ti1:tri1+ti1:tri2+ti1:tri3+ti1:tri4");
603  //TGeoCompositeShape *SLumMon1 = new TGeoCompositeShape("LumMon1",
604  // "LumMon0-holes-(holes:tri5)");
605  TGeoCompositeShape *slum_beampipe_upstream = new TGeoCompositeShape("slum_beampipe_upstream",
606  "lmd_flange_upstr:lmd_trans_fl_up+lmd_beampipe_upstr:lmd_trans_b_up+lmd_cone_flange_upstr:lmd_trans_co_fl_up");
607  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");
608  TGeoCompositeShape *slum_beampipe_downstream = new TGeoCompositeShape("slum_beampipe_downstream",
609  "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*/
610  // "nozzles+(nozzles:tri5)");
611 
612  TGeoCombiTrans* tri6 = new TGeoCombiTrans("tri6", dx0 + s * sin(dphi), 0.,
613  z0 + currentz, dipolerot);
614 
615  //std::cout << " rotation for the lumi monitor is " << std::endl;
616  //tri6->Print();
617 
618  tri6->RegisterYourself();
619  s = s + 200.00;
620 
621  TGeoVolume *vlum_beampipe_upstream = new TGeoVolume("vlum_beampipe_upstream", slum_beampipe_upstream,
622  gGeoManager->GetMedium("steel"));
623  vlum_beampipe_upstream->SetLineColor(39);//39);
624  TGeoVolume *vlum_CaptonCone = new TGeoVolume("vlum_CaptonCone", slum_CaptonCone,
625  gGeoManager->GetMedium("mylar"));
626  vlum_CaptonCone->SetLineColor(kRed);//39);
627  TGeoVolume *vlum_beampipe_downstream = new TGeoVolume("vlum_beampipe_downstream", slum_beampipe_downstream,
628  gGeoManager->GetMedium("steel"));
629  vlum_beampipe_downstream->SetLineColor(39);//39);
630 
631  //sensor_positions.push_back(z0 + currentz);
632  // last z-position: 1709.5415231 (s = 648.83470)
633  currentz += 200.00 * cos(dphi);
634  fprintf(stderr, "currentz/s i: %f %f\n", currentz, s);
635 
636  // ---------------------------------------------------------------------------
637  // j - end cross
638 
639  // horizontal pipe, first part
640  Double_t psj1[15] = { 0., 360., 4, 0., 7.5, 10.125, 2.0, 7.5, 10.125, 2.0,
641  7.5, 7.7, 16.7, 7.5, 7.7 };
642  TGeoPcon* EndCross0a = new TGeoPcon("EndCross0a", 0., 360., 4);
643  EndCross0a->SetDimensions(psj1);
644 
645  // horizontal pipe, second part
646  Double_t psj2[15] = { 0., 360., 4, 16.7, 4.5, 4.7, 34.7, 4.5, 4.7, 34.7,
647  4.5, 7.6, 36.7, 4.5, 7.6 };
648  TGeoPcon* EndCross0b = new TGeoPcon("EndCross0b", 0., 360., 4);
649  EndCross0b->SetDimensions(psj2);
650 
651  // vertical pipe
652  Double_t psj3[21] = { 0., 360., 6, -16.7, 7.5, 10.125, -14.7, 7.5, 10.125,
653  -14.7, 7.5, 7.7, 14.7, 7.5, 7.7, 14.7, 7.5, 10.125, 16.7, 7.5,
654  10.125 };
655  TGeoPcon* EndCross1 = new TGeoPcon("EndCross1", 0., 360., 6);
656  EndCross1->SetDimensions(psj3);
657 
658  TGeoTube* tj1 = new TGeoTube("tj1", 0., 7.7, 10.125 + delta);
659  TGeoTube* tj2 = new TGeoTube("tj2", 0., 7.7, 3.85 + delta);
660  TGeoTube* tj3 = new TGeoTube("tj3", 0., 4.7, 3.85 + delta);
661 
662  TGeoCombiTrans* trj1 = new TGeoCombiTrans("trj1", 0., 0., 16.7, r2);
663  trj1->RegisterYourself();
664  TGeoCombiTrans* trj2 =
665  new TGeoCombiTrans("trj2", 0., 0., 12.85 - delta, r1);
666  trj2->RegisterYourself();
667  TGeoCombiTrans* trj3 =
668  new TGeoCombiTrans("trj3", 0., 0., 20.55 + delta, r1);
669  trj3->RegisterYourself();
670  TGeoCombiTrans* trj4 = new TGeoCombiTrans("trj4", 0., 0., 36.7, r1);
671  trj4->RegisterYourself();
672  TGeoCombiTrans* trj5 = new TGeoCombiTrans("trj5", 0., 16.7, 16.7, r3);
673  trj5->RegisterYourself();
674  TGeoCombiTrans* trj6 = new TGeoCombiTrans("trj6", 0., -23.7, 16.7, r3);
675  trj6->RegisterYourself();
676  TGeoCombiTrans* trj7 = new TGeoCombiTrans("trj7", 0., -23.7, 16.7, r2); // here was a typo
677  trj7->RegisterYourself();
678 
679  // adding valves and pumps
680  TGeoCompositeShape *EndCross2 = new TGeoCompositeShape("EndCross2",
681  "EndCross0a+EndCross0b-tj1:trj1");
682  TGeoCompositeShape *EndCross3 = new TGeoCompositeShape("EndCross3",
683  "EndCross1:trj1-tj2:trj2-tj3:trj3");
684  TGeoCompositeShape *EndCross4 = new TGeoCompositeShape("EndCross4",
685  "TVPwValve:trj5+VATvalve160:trj6+IGP1000:trj7");
686  TGeoCompositeShape *EndCross = new TGeoCompositeShape("EndCross",
687  "EndCross2+EndCross3+EndCross4+VATvalve100:trj4");
688 
689  TGeoCombiTrans* trj8 = new TGeoCombiTrans("trj8", dx0 + s * sin(dphi), 0.,
690  z0 + currentz, dipolerot);
691  trj8->RegisterYourself();
692  s = s + 43.7;
693 
694  TGeoVolume *VEndCross = new TGeoVolume("EndCross", EndCross,
695  gGeoManager->GetMedium("steel"));
696  VEndCross->SetLineColor(40);
697 
698  //sensor_positions.push_back(z0 + currentz);
699  // last z-position: 1753.2061988 (s = 692.53470)
700  currentz += 43.7 * cos(dphi);
701  fprintf(stderr, "currentz/s j: %f %f\n", currentz, s);
702  //sensor_positions.push_back(z0 + currentz);
703 
704  // ---------------------------------------------------------------------------
705  // put all volumes together -> beamPipe
706  TGeoVolume *beamPipe = new TGeoVolumeAssembly("BeamPipe");
707  //gGeoManager->SetTopVolume(beamPipe);
708  beamPipe->AddNode(Vgvhesr, 0, tr0); // a
709  beamPipe->AddNode(Vpipeup, 0, trb1); // b
710  beamPipe->AddNode(Vktmpump, 0, trc2); // c1
711  beamPipe->AddNode(VTpumps, 0, tr0); // c2
712  beamPipe->AddNode(VpipeTSup, 0, trd1); // d
713  beamPipe->AddNode(VTcross, 0, tre9); // e
714  beamPipe->AddNode(VpipeTSdown, 0, trf1); // f
715  beamPipe->AddNode(VcrossTSTMPs, 0, trg7); // g
716  beamPipe->AddNode(VDipolePip, 0, trh4); // h
717  //beamPipe->AddNode(VLumMon, 0, tri6); // i
718  //beamPipe->AddNode(vlum_beampipe_upstream, 0, tri6); // i
719  //beamPipe->AddNode(vlum_CaptonCone, 0, tri6); // i
720  //beamPipe->AddNode(vlum_beampipe_downstream, 0, tri6); // i
721  //beamPipe->AddNode(VEndCross, 0, trj8); // j
722 
723  // create an array of z positions for the sensors in 10 cm distances
724  for (int iposz = 0; iposz < 1200; iposz+=10) sensor_positions.push_back(iposz);
725  // construct the sensors
726  if (create_sensors){
727  for (unsigned int isensor = 0; isensor < sensor_positions.size(); isensor++){
728  std::stringstream volume_name;
729  volume_name << "_" << isensor;
730  // create a sensor with a radius of 40 cm
731  TGeoTube* disc = new TGeoTube(("disc"+volume_name.str()).c_str(), 0., 40., 0.0000001);
732  TGeoVolume* Vdisc = new TGeoVolume(("LumActive_pipe_sensor_"+volume_name.str()).c_str(), disc,
733  gGeoManager->GetMedium("mylar"));
734  TGeoCombiTrans* tre_disc =
735  new TGeoCombiTrans(("tre_"+volume_name.str()).c_str(), 0., 0., sensor_positions[isensor], r1);
736  tre_disc->RegisterYourself();
737  Vdisc->SetLineColor(2);
738  beamPipe->AddNode(Vdisc, 0, tre_disc);
739  }
740  }
741 
742  /*
743  TGeoVolume *VTest = new TGeoVolume("VTest", SDippip,
744  gGeoManager->GetMedium("steel"));
745  VTest->SetLineColor(37);
746  */
747 
748  // add pipe to cave
749  cave->AddNode(beamPipe, 1);
750  //beamPipe->AddNode(VTest, 0, trv1);
751  gGeoManager->CloseGeometry();
752 
753  // check geometry
754  //cave->CheckOverlaps(0.1, "");
755  //gGeoManager->CheckOverlaps(0.001); // [cm]
756  //gGeoManager->CheckGeometryFull();
757 
758  // save geometry
759 
760  //cave->Write();
761  cave->Write();
762  fi->Close();
763 
764  // plot geometry
765  cave->Draw("ogl");
766  //cave->Draw("ogl");
767 
768  // done
769  fprintf(stderr, "\n");
770  fprintf(stderr, "<I> Geometry of PANDA beam pipe written to %s\n",
771  fGeoFile.Data());
772  fprintf(stderr, "\n");
773 
774  return 0;
775 }
Double_t z0
Definition: checkhelixhit.C:62
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
int main ( void  )

Definition at line 779 of file lmd/geo/createRootGeometry_beampipe.C.

References createRootGeometry_beampipe().

779  {
780  TApplication myapp("myapp",0,0);
782  myapp.Run();
783  return 0;
784 }
int createRootGeometry_beampipe()