BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_VacuumPipe_section2.C
Go to the documentation of this file.
1/*
2 * Use this macro to create ROOT geometry of Vacuum Beam Pipe (section 2: arter
3 * target) for the RUN-8 configuration, according to the measurement scheme
4 *
5 * Author: Baranov D.
6 * Created: 05.12.2022
7 *
8 *
9 * WARNING: all units is in cm!!!
10 *
11 */
12
13#include "TGeoMatrix.h"
14#include "TGeoVolume.h"
15#include "TString.h"
16
17// Parameters of Vacuum Beam Pipe
18
19const Int_t NModules = 4;
20
21// Positions
23 +0.372, // [0]
24 +0.372 + 0.65, // [1]
25 +0.372 + 0.65 + 3.14, // [2]
26 +0.372 + 0.65 + 3.14 + 6.97 // [3]
27};
29 -0.079, // [0]
30 -0.079, // [1]
31 -0.079, // [2]
32 -0.079 // [3]
33};
35 -34.0, // [0]
36 -34.0 + 82.26, // [1]
37 -34.0 + 82.26 + 101.54 - 1.5 - 0.05, // [2]
38 -34.0 + 82.26 + 101.54 - 1.5 + 125.58 - 1.5 - 0.35 // [3]
39};
40
41// Rotations of modules around Z (deg.)
43 +0.0, // [0]
44 +0.0, // [1]
45 +0.0, // [2]
46 +0.0 // [3]
47};
48
49//------------------------------------------------------------------------------
50
51// GeoManager
53
54// media
62
63class FairGeoMedia;
64class FairGeoBuilder;
65
66TGeoVolume* CreateModule1(TString module_name);
67TGeoVolume* CreateModule2(TString module_name);
68TGeoVolume* CreateModule3(TString module_name);
69TGeoVolume* CreateModule4(TString module_name);
70
71void DefineRequiredMedia(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
72{
73
74 // vacuum medium
75 FairGeoMedium* mVacuum = geoMedia->getMedium("vacuum");
76 if (!mVacuum)
77 Fatal("Main", "FairMedium vacuum not found");
78 geoBuild->createMedium(mVacuum);
79 pMedVacuum = gGeoManager->GetMedium("vacuum");
80 if (!pMedVacuum)
81 Fatal("Main", "Medium vacuum not found");
82
83 // air medium
84 FairGeoMedium* mAir = geoMedia->getMedium("air");
85 if (!mAir)
86 Fatal("Main", "FairMedium air not found");
87 geoBuild->createMedium(mAir);
88 pMedAir = gGeoManager->GetMedium("air");
89 if (!pMedAir)
90 Fatal("Main", "Medium air not found");
91
92 // carbon medium
93 FairGeoMedium* mCarbon = geoMedia->getMedium("carbon");
94 if (!mCarbon)
95 Fatal("Main", "FairMedium carbon not found");
96 geoBuild->createMedium(mCarbon);
97 pMedCarbon = gGeoManager->GetMedium("carbon");
98 if (!pMedCarbon)
99 Fatal("Main", "Medium carbon not found");
100
101 // aluminium medium
102 FairGeoMedium* mAluminium = geoMedia->getMedium("aluminium");
103 if (!mAluminium)
104 Fatal("Main", "FairMedium aluminium not found");
105 geoBuild->createMedium(mAluminium);
106 pMedAluminium = gGeoManager->GetMedium("aluminium");
107 if (!pMedAluminium)
108 Fatal("Main", "Medium aluminium not found");
109
110 // steel medium
111 FairGeoMedium* mSteel = geoMedia->getMedium("steel");
112 if (!mSteel)
113 Fatal("Main", "FairMedium steel not found");
114 geoBuild->createMedium(mSteel);
115 pMedSteel = gGeoManager->GetMedium("steel");
116 if (!pMedSteel)
117 Fatal("Main", "Medium steel not found");
118
119 // fiberglass medium
120 FairGeoMedium* mFiberGlass = geoMedia->getMedium("fiberglass");
121 if (!mFiberGlass)
122 Fatal("Main", "FairMedium fiberglass not found");
123 geoBuild->createMedium(mFiberGlass);
124 pMedFiberGlass = gGeoManager->GetMedium("fiberglass");
125 if (!pMedFiberGlass)
126 Fatal("Main", "Medium fiberglass not found");
127
128 // silicon medium
129 FairGeoMedium* mSilicon = geoMedia->getMedium("silicon");
130 if (!mSilicon)
131 Fatal("Main", "FairMedium silicon not found");
132 geoBuild->createMedium(mSilicon);
133 pMedSilicon = gGeoManager->GetMedium("silicon");
134 if (!pMedSilicon)
135 Fatal("Main", "Medium silicon not found");
136}
137
139{
140
141 // ---- set working directory --------------------------------------------
142 TString gPath = gSystem->Getenv("VMCWORKDIR");
143
144 // ------- Geometry file name (output) ----------------------------------
145 const TString geoDetectorName = "VacuumPipe_section2";
146 const TString geoDetectorVersion = "Run8";
147 const TString geoFileName = gPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
148
149 // ---- global geometry parameters ---------------------------------------
150 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
151 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
152
153 // ------- Load media from media file ----------------------------------
154 TString medFile = gPath + "/geometry/media.geo";
155 geoFace->setMediaFile(medFile);
156 geoFace->readMedia();
157 FairGeoMedia* geoMedia = geoFace->getMedia();
158 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
159
160 DefineRequiredMedia(geoMedia, geoBuild);
161 // -------------------------------------------------------------------------
162
163 // -------------- Create geometry and top volume ------------------------
164 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
165 gGeoMan->SetName(geoDetectorName + "_geom");
166 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
167 top->SetMedium(pMedAir);
168 gGeoMan->SetTopVolume(top);
169 // gGeoMan->SetTopVisible(1);
170 // -------------------------------------------------------------------------
171
172 // Define TOP Geometry
173 TGeoVolume* VacuumPipe_section2 = new TGeoVolumeAssembly(geoDetectorName);
174 VacuumPipe_section2->SetMedium(pMedVacuum);
175
176 TGeoVolume* module1 = CreateModule1(TString("VacuumPipeSec2_Module1"));
177 TGeoVolume* module2 = CreateModule2(TString("VacuumPipeSec2_Module2"));
178 TGeoVolume* module3 = CreateModule3(TString("VacuumPipeSec2_Module3"));
179 TGeoVolume* module4 = CreateModule4(TString("VacuumPipeSec2_Module4"));
180
181 TGeoCombiTrans* module1_transform = new TGeoCombiTrans();
182 module1_transform->RotateZ(ZStationRotations[0]);
184
185 TGeoCombiTrans* module2_transform = new TGeoCombiTrans();
186 module2_transform->RotateZ(ZStationRotations[1]);
188 // module2_transform->SetTranslation(XModulePositions[1] + 0.65/*shift*/, YModulePositions[1], ZModulePositions[1]
189 // + 82.26/*shift*/);
190
191 TGeoCombiTrans* module3_transform = new TGeoCombiTrans();
192 module3_transform->RotateZ(ZStationRotations[2]);
194 // module3_transform->SetTranslation(XModulePositions[2] + 0.65 + 3.14/*shift*/, YModulePositions[2],
195 // ZModulePositions[2] + 82.26 + 101.54-1.5-0.05/*shift*/);
196
197 TGeoCombiTrans* module4_transform = new TGeoCombiTrans();
198 module4_transform->RotateZ(ZStationRotations[3]);
200 // module4_transform->SetTranslation(XModulePositions[3] + 0.65 + 3.14 + 6.97/*shift*/, YModulePositions[3],
201 // ZModulePositions[3] + 82.26 + 101.54-1.5 + 125.58-1.5-0.35/*shift*/);
202
203 VacuumPipe_section2->AddNode(module1, 0, module1_transform);
204 VacuumPipe_section2->AddNode(module2, 0, module2_transform);
205 VacuumPipe_section2->AddNode(module3, 0, module3_transform);
206 VacuumPipe_section2->AddNode(module4, 0, module4_transform);
207
208 top->AddNode(VacuumPipe_section2, 0);
210
211 // --------------- Finish ----------------------------------------------
212 gGeoMan->CloseGeometry();
213 gGeoMan->CheckOverlaps(0.0001);
214 gGeoMan->PrintOverlaps();
215 gGeoMan->Test();
216 // gGeoMan->RestoreMasterVolume();
217
218 TFile* geoFile = new TFile(geoFileName, "RECREATE");
219 top->Write();
220 geoFile->Close();
221 top->Draw("ogl");
222}
223//------------------------------------------------------------------------------
224
226{
227
228 Double_t length1 = 34.5; // wide tube
229 Double_t length2 = 5.8; // cone
230 Double_t length3 = 41.96; // narrow tube
231
232 Double_t innerRadius1 = 6.4 * 0.5;
233 Double_t outerRadius1 = 6.6 * 0.5;
234
235 Double_t innerRadius2 = 4.8 * 0.5;
236 Double_t outerRadius2 = 5.0 * 0.5;
237
238 Double_t angleInclined3 = 0.88; // deg
239
240 // shapes
241 TGeoShape* vacTube1S =
242 new TGeoTube(TString("vacTube1S") += TString("_") + module_name, innerRadius1, outerRadius1, length1 * 0.5);
243 TGeoShape* vacCone2S = new TGeoCone(TString("vacCone2S") += TString("_") + module_name, length2 * 0.5, innerRadius1,
244 outerRadius1, innerRadius2, outerRadius2);
245 // TGeoShape *vacTube3S = new TGeoTube(TString("vacTube3S")+=TString("_") + module_name, innerRadius2, outerRadius2,
246 // length3*0.5);
247 TGeoShape* vacTube3S = new TGeoCtub(TString("vacTube3S") += TString("_") + module_name, innerRadius2, outerRadius2,
248 length3 * 0.5, 0.0, 360.0, 0.015 /*!!!*/, 0, -1, 0, 0, 1);
249
250 TGeoShape* vacTube1VacuumS =
251 new TGeoTube(TString("vacTube1VacuumS") += TString("_") + module_name, 0.0, innerRadius1, length1 * 0.5);
252 TGeoShape* vacCone2VacuumS = new TGeoCone(TString("vacCone2VacuumS") += TString("_") + module_name, length2 * 0.5,
253 0.0, innerRadius1, 0.0, innerRadius2);
254 TGeoShape* vacTube3VacuumS = new TGeoCtub(TString("vacTube3VacuumS") += TString("_") + module_name, 0.0,
255 innerRadius2, length3 * 0.5, 0.0, 360.0, 0.015 /*!!!*/, 0, -1, 0, 0, 1);
256
257 TGeoCombiTrans* vacTube3S_transf = new TGeoCombiTrans();
258 vacTube3S_transf->SetName(TString("vacTube3S_transf") += TString("_") + module_name);
259 vacTube3S_transf->RotateY(angleInclined3);
260 vacTube3S_transf->RegisterYourself();
261
262 TGeoCombiTrans* vacTube3S_transf1 = new TGeoCombiTrans();
263 vacTube3S_transf1->SetName(TString("vacTube3S_transf1") += TString("_") + module_name);
264 vacTube3S_transf1->SetTranslation(-1000.0, 0.0, 0.0);
265 vacTube3S_transf1->RegisterYourself();
266
267 TGeoCompositeShape* vacTube3RotS = new TGeoCompositeShape();
268 vacTube3RotS->SetName(TString("vacTube3RotS") += TString("_") + module_name);
269 {
270 TString expression = "vacTube3S";
271 expression += TString("_") + module_name;
272 expression += ":vacTube3S_transf";
273 expression += TString("_") + module_name;
274 expression += "-vacTube3S";
275 expression += TString("_") + module_name;
276 expression += ":vacTube3S_transf1";
277 expression += TString("_") + module_name;
278
279 vacTube3RotS->MakeNode(expression);
280 vacTube3RotS->ComputeBBox(); // need to compute a bounding box
281 }
282
283 TGeoCompositeShape* vacTube3RotVacuumS = new TGeoCompositeShape();
284 vacTube3RotVacuumS->SetName(TString("vacTube3RotVacuumS") += TString("_") + module_name);
285 {
286 TString expression = "vacTube3VacuumS";
287 expression += TString("_") + module_name;
288 expression += ":vacTube3S_transf";
289 expression += TString("_") + module_name;
290 expression += "-vacTube3VacuumS";
291 expression += TString("_") + module_name;
292 expression += ":vacTube3S_transf1";
293 expression += TString("_") + module_name;
294
295 vacTube3RotVacuumS->MakeNode(expression);
296 vacTube3RotVacuumS->ComputeBBox(); // need to compute a bounding box
297 }
298
299 // volumes
300 TGeoVolumeAssembly* vacTubeBoxV = new TGeoVolumeAssembly(module_name);
301 TGeoVolume* vacTube1V = new TGeoVolume(TString("vacTube1V") += TString("_") + module_name, vacTube1S);
302 TGeoVolume* vacCone2V = new TGeoVolume(TString("vacCone2V") += TString("_") + module_name, vacCone2S);
303 // TGeoVolume *vacTube3V = new TGeoVolume(TString("vacTube3V")+=TString("_") + module_name, vacTube3S);
304 TGeoVolume* vacTube3V = new TGeoVolume(TString("vacTube3V") += TString("_") + module_name, vacTube3RotS);
305
306 TGeoVolume* vacTube1VacuumV =
307 new TGeoVolume(TString("vacTube1VacuumV") += TString("_") + module_name, vacTube1VacuumS);
308 TGeoVolume* vacCone2VacuumV =
309 new TGeoVolume(TString("vacCone2VacuumV") += TString("_") + module_name, vacCone2VacuumS);
310 TGeoVolume* vacTube3VacuumV =
311 new TGeoVolume(TString("vacTube3VacuumV") += TString("_") + module_name, vacTube3RotVacuumS);
312
313 // volume medium
314 TGeoMedium* vacTubeV_medium = pMedCarbon;
315 if (vacTubeV_medium) {
316 vacTube1V->SetMedium(vacTubeV_medium);
317 vacCone2V->SetMedium(vacTubeV_medium);
318 vacTube3V->SetMedium(vacTubeV_medium);
319 } else
320 Fatal("Main", "Invalid medium for vacTubeV!");
321
322 vacTube1VacuumV->SetMedium(pMedVacuum);
323 vacCone2VacuumV->SetMedium(pMedVacuum);
324 vacTube3VacuumV->SetMedium(pMedVacuum);
325
326 // volume visual property (transparency)
327 vacTube1V->SetLineColor(TColor::GetColor("#ffcccc"));
328 vacTube1V->SetTransparency(0);
329 vacCone2V->SetLineColor(TColor::GetColor("#ffcccc"));
330 vacTube3V->SetLineColor(TColor::GetColor("#ffcccc"));
331
332 // part positions in the vacuum tube box
333 TGeoCombiTrans* vacTube1V_transf[1];
334 vacTube1V_transf[0] = new TGeoCombiTrans();
335 vacTube1V_transf[0]->SetTranslation(0.0, 0.0, +length1 * 0.5);
336
337 TGeoCombiTrans* vacCone2V_transf[1];
338 vacCone2V_transf[0] = new TGeoCombiTrans();
339 vacCone2V_transf[0]->SetTranslation(0.0, 0.0, +length1 + length2 * 0.5);
340
341 TGeoCombiTrans* vacTube3V_transf[1];
342 vacTube3V_transf[0] = new TGeoCombiTrans();
343 vacTube3V_transf[0]->SetTranslation(TMath::Sin(angleInclined3 * TMath::DegToRad()) * length3 * 0.5, 0.0,
344 +length1 + length2 + length3 * 0.5);
345
346 vacTubeBoxV->AddNode(vacTube1V, 0, vacTube1V_transf[0]);
347 vacTubeBoxV->AddNode(vacCone2V, 0, vacCone2V_transf[0]);
348 vacTubeBoxV->AddNode(vacTube3V, 0, vacTube3V_transf[0]);
349
350 vacTubeBoxV->AddNode(vacTube1VacuumV, 0, vacTube1V_transf[0]);
351 vacTubeBoxV->AddNode(vacCone2VacuumV, 0, vacCone2V_transf[0]);
352 vacTubeBoxV->AddNode(vacTube3VacuumV, 0, vacTube3V_transf[0]);
353
354 return vacTubeBoxV;
355}
356//------------------------------------------------------------------------------
357
359{
360
361 Double_t length1 = 101.54 - 1.5; // cm
362
363 Double_t innerRadius1 = 4.8 * 0.5;
364 Double_t outerRadius1 = 5.0 * 0.5;
365 Double_t angleInclined1 = 1.78; // deg
366
367 // shapes
368 // TGeoShape *vacTube1S = new TGeoTube(TString("vacTube1S")+=TString("_") + module_name, innerRadius1, outerRadius1,
369 // length1*0.5);
370 TGeoShape* vacTube1S = new TGeoCtub(TString("vacTube1S") += TString("_") + module_name, innerRadius1, outerRadius1,
371 length1 * 0.5, 0.0, 360.0, 0.015 /*!!!*/, 0, -1, 0.015 /*!!!*/, 0, 1);
372
373 TGeoShape* vacTube1VacuumS =
374 new TGeoCtub(TString("vacTube1VacuumS") += TString("_") + module_name, 0.0, innerRadius1, length1 * 0.5, 0.0,
375 360.0, 0.015 /*!!!*/, 0, -1, 0.015 /*!!!*/, 0, 1);
376
377 TGeoCombiTrans* vacTube1S_transf = new TGeoCombiTrans();
378 vacTube1S_transf->SetName(TString("vacTube1S_transf") += TString("_") + module_name);
379 vacTube1S_transf->RotateY(angleInclined1);
380 vacTube1S_transf->RegisterYourself();
381
382 TGeoCombiTrans* vacTube1S_transf1 = new TGeoCombiTrans();
383 vacTube1S_transf1->SetName(TString("vacTube1S_transf1") += TString("_") + module_name);
384 vacTube1S_transf1->SetTranslation(-1000.0, 0.0, 0.0);
385 vacTube1S_transf1->RegisterYourself();
386
387 TGeoCompositeShape* vacTube1RotS = new TGeoCompositeShape();
388 vacTube1RotS->SetName(TString("vacTube1RotS") += TString("_") + module_name);
389 {
390 TString expression = "vacTube1S";
391 expression += TString("_") + module_name;
392 expression += ":vacTube1S_transf";
393 expression += TString("_") + module_name;
394 expression += "-vacTube1S";
395 expression += TString("_") + module_name;
396 expression += ":vacTube1S_transf1";
397 expression += TString("_") + module_name;
398
399 vacTube1RotS->MakeNode(expression);
400 vacTube1RotS->ComputeBBox(); // need to compute a bounding box
401 }
402
403 TGeoCompositeShape* vacTube1RotVacuumS = new TGeoCompositeShape();
404 vacTube1RotVacuumS->SetName(TString("vacTube1RotVacuumS") += TString("_") + module_name);
405 {
406 TString expression = "vacTube1VacuumS";
407 expression += TString("_") + module_name;
408 expression += ":vacTube1S_transf";
409 expression += TString("_") + module_name;
410 expression += "-vacTube1VacuumS";
411 expression += TString("_") + module_name;
412 expression += ":vacTube1S_transf1";
413 expression += TString("_") + module_name;
414
415 vacTube1RotVacuumS->MakeNode(expression);
416 vacTube1RotVacuumS->ComputeBBox(); // need to compute a bounding box
417 }
418
419 // volumes
420 TGeoVolumeAssembly* vacTubeBoxV = new TGeoVolumeAssembly(module_name);
421 // TGeoVolume *vacTube1V = new TGeoVolume(TString("vacTube1V")+=TString("_") + module_name, vacTube1S);
422 TGeoVolume* vacTube1V = new TGeoVolume(TString("vacTube3V") += TString("_") + module_name, vacTube1RotS);
423
424 TGeoVolume* vacTube1VacuumV =
425 new TGeoVolume(TString("vacTube1VacuumV") += TString("_") + module_name, vacTube1RotVacuumS);
426
427 // volume medium
428 TGeoMedium* vacTubeV_medium = pMedCarbon;
429 if (vacTubeV_medium) {
430 vacTube1V->SetMedium(vacTubeV_medium);
431 } else
432 Fatal("Main", "Invalid medium for vacTubeV!");
433
434 vacTube1VacuumV->SetMedium(pMedVacuum);
435
436 // volume visual property (transparency)
437 vacTube1V->SetLineColor(TColor::GetColor("#ffcccc"));
438 vacTube1V->SetTransparency(0);
439
440 // part positions in the vacuum tube box
441 TGeoCombiTrans* vacTube1V_transf[1];
442 vacTube1V_transf[0] = new TGeoCombiTrans();
443 vacTube1V_transf[0]->SetTranslation(TMath::Sin(angleInclined1 * TMath::DegToRad()) * length1 * 0.5, 0.0,
444 length1 * 0.5);
445
446 vacTubeBoxV->AddNode(vacTube1V, 0, vacTube1V_transf[0]);
447 vacTubeBoxV->AddNode(vacTube1VacuumV, 0, vacTube1V_transf[0]);
448
449 return vacTubeBoxV;
450}
451//------------------------------------------------------------------------------
452
454{
455
456 Double_t length1 = 125.58 - 1.5; // cm
457
458 Double_t innerRadius1 = 4.8 * 0.5;
459 Double_t outerRadius1 = 5.0 * 0.5;
460
461 Double_t innerRadius2 = 7.0 * 0.5;
462 Double_t outerRadius2 = 7.2 * 0.5;
463
464 Double_t angleInclined1 = 3.22; // deg
465
466 // shapes
467 TGeoShape* vacCone1S = new TGeoCone(TString("vacCone1S") += TString("_") + module_name, length1 * 0.5, innerRadius1,
468 outerRadius1, innerRadius2, outerRadius2);
469
470 TGeoShape* vacCone1VacuumS = new TGeoCone(TString("vacCone1VacuumS") += TString("_") + module_name, length1 * 0.5,
471 0.0, innerRadius1, 0.0, innerRadius2);
472
473 TGeoCombiTrans* vacCone1S_transf = new TGeoCombiTrans();
474 vacCone1S_transf->SetName(TString("vacCone1S_transf") += TString("_") + module_name);
475 vacCone1S_transf->RotateY(angleInclined1);
476 vacCone1S_transf->RegisterYourself();
477
478 TGeoCombiTrans* vacCone1S_transf1 = new TGeoCombiTrans();
479 vacCone1S_transf1->SetName(TString("vacCone1S_transf1") += TString("_") + module_name);
480 vacCone1S_transf1->SetTranslation(-1000.0, 0.0, 0.0);
481 vacCone1S_transf1->RegisterYourself();
482
483 TGeoCompositeShape* vacCone1RotS = new TGeoCompositeShape();
484 vacCone1RotS->SetName(TString("vacCone1RotS") += TString("_") + module_name);
485 {
486 TString expression = "vacCone1S";
487 expression += TString("_") + module_name;
488 expression += ":vacCone1S_transf";
489 expression += TString("_") + module_name;
490 expression += "-vacCone1S";
491 expression += TString("_") + module_name;
492 expression += ":vacCone1S_transf1";
493 expression += TString("_") + module_name;
494
495 vacCone1RotS->MakeNode(expression);
496 vacCone1RotS->ComputeBBox(); // need to compute a bounding box
497 }
498
499 TGeoCompositeShape* vacCone1RotVacuumS = new TGeoCompositeShape();
500 vacCone1RotVacuumS->SetName(TString("vacCone1RotVacuumS") += TString("_") + module_name);
501 {
502 TString expression = "vacCone1VacuumS";
503 expression += TString("_") + module_name;
504 expression += ":vacCone1S_transf";
505 expression += TString("_") + module_name;
506 expression += "-vacCone1VacuumS";
507 expression += TString("_") + module_name;
508 expression += ":vacCone1S_transf1";
509 expression += TString("_") + module_name;
510
511 vacCone1RotVacuumS->MakeNode(expression);
512 vacCone1RotVacuumS->ComputeBBox(); // need to compute a bounding box
513 }
514
515 // volumes
516 TGeoVolumeAssembly* vacTubeBoxV = new TGeoVolumeAssembly(module_name);
517 TGeoVolume* vacCone1V = new TGeoVolume(TString("vacCone1V") += TString("_") + module_name, vacCone1RotS);
518
519 TGeoVolume* vacCone1VacuumV =
520 new TGeoVolume(TString("vacCone1VacuumV") += TString("_") + module_name, vacCone1RotVacuumS);
521
522 // volume medium
523 TGeoMedium* vacTubeV_medium = pMedCarbon;
524 if (vacTubeV_medium) {
525 vacCone1V->SetMedium(vacTubeV_medium);
526 } else
527 Fatal("Main", "Invalid medium for vacCone1V!");
528
529 vacCone1VacuumV->SetMedium(pMedVacuum);
530
531 // volume visual property (transparency)
532 vacCone1V->SetLineColor(TColor::GetColor("#ffcccc"));
533 vacCone1V->SetTransparency(0);
534
535 // part positions in the vacuum tube box
536 TGeoCombiTrans* vacCone1V_transf[1];
537 vacCone1V_transf[0] = new TGeoCombiTrans();
538 vacCone1V_transf[0]->SetTranslation(TMath::Sin(angleInclined1 * TMath::DegToRad()) * length1 * 0.5, 0.0,
539 +length1 * 0.5);
540
541 vacTubeBoxV->AddNode(vacCone1V, 0, vacCone1V_transf[0]);
542 vacTubeBoxV->AddNode(vacCone1VacuumV, 0, vacCone1V_transf[0]);
543
544 return vacTubeBoxV;
545}
546//------------------------------------------------------------------------------
547
549{
550
551 Double_t length1 = 158.28 - 1.5; // cm
552
553 Double_t innerRadius1 = 7.0 * 0.5;
554 Double_t outerRadius1 = 7.2 * 0.5;
555 Double_t angleInclined1 = 4.25; // deg
556
557 // shapes
558 // TGeoShape *vacTube1S = new TGeoTube(TString("vacTube1S")+=TString("_") + module_name, innerRadius1, outerRadius1,
559 // length1*0.5);
560 TGeoShape* vacTube1S = new TGeoCtub(TString("vacTube1S") += TString("_") + module_name, innerRadius1, outerRadius1,
561 length1 * 0.5, 0.0, 360.0, 0.015 /*!!!*/, 0, -1, 0.0 /*!!!*/, 0, 1);
562
563 TGeoShape* vacTube1VacuumS =
564 new TGeoCtub(TString("vacTube1VacuumS") += TString("_") + module_name, 0.0, innerRadius1, length1 * 0.5, 0.0,
565 360.0, 0.015 /*!!!*/, 0, -1, 0.0 /*!!!*/, 0, 1);
566
567 TGeoCombiTrans* vacTube1S_transf = new TGeoCombiTrans();
568 vacTube1S_transf->SetName(TString("vacTube1S_transf") += TString("_") + module_name);
569 vacTube1S_transf->RotateY(angleInclined1);
570 vacTube1S_transf->RegisterYourself();
571
572 TGeoCombiTrans* vacTube1S_transf1 = new TGeoCombiTrans();
573 vacTube1S_transf1->SetName(TString("vacTube1S_transf1") += TString("_") + module_name);
574 vacTube1S_transf1->SetTranslation(-1000.0, 0.0, 0.0);
575 vacTube1S_transf1->RegisterYourself();
576
577 TGeoCompositeShape* vacTube1RotS = new TGeoCompositeShape();
578 vacTube1RotS->SetName(TString("vacTube1RotS") += TString("_") + module_name);
579 {
580 TString expression = "vacTube1S";
581 expression += TString("_") + module_name;
582 expression += ":vacTube1S_transf";
583 expression += TString("_") + module_name;
584 expression += "-vacTube1S";
585 expression += TString("_") + module_name;
586 expression += ":vacTube1S_transf1";
587 expression += TString("_") + module_name;
588
589 vacTube1RotS->MakeNode(expression);
590 vacTube1RotS->ComputeBBox(); // need to compute a bounding box
591 }
592
593 TGeoCompositeShape* vacTube1RotVacuumS = new TGeoCompositeShape();
594 vacTube1RotVacuumS->SetName(TString("vacTube1RotVacuumS") += TString("_") + module_name);
595 {
596 TString expression = "vacTube1VacuumS";
597 expression += TString("_") + module_name;
598 expression += ":vacTube1S_transf";
599 expression += TString("_") + module_name;
600 expression += "-vacTube1VacuumS";
601 expression += TString("_") + module_name;
602 expression += ":vacTube1S_transf1";
603 expression += TString("_") + module_name;
604
605 vacTube1RotVacuumS->MakeNode(expression);
606 vacTube1RotVacuumS->ComputeBBox(); // need to compute a bounding box
607 }
608
609 // volumes
610 TGeoVolumeAssembly* vacTubeBoxV = new TGeoVolumeAssembly(module_name);
611 // TGeoVolume *vacTube1V = new TGeoVolume(TString("vacTube1V")+=TString("_") + module_name, vacTube1S);
612 TGeoVolume* vacTube1V = new TGeoVolume(TString("vacTube3V") += TString("_") + module_name, vacTube1RotS);
613
614 TGeoVolume* vacTube1VacuumV =
615 new TGeoVolume(TString("vacTube1VacuumV") += TString("_") + module_name, vacTube1RotVacuumS);
616
617 // volume medium
618 TGeoMedium* vacTubeV_medium = pMedCarbon;
619 if (vacTubeV_medium) {
620 vacTube1V->SetMedium(vacTubeV_medium);
621 } else
622 Fatal("Main", "Invalid medium for vacTubeV!");
623
624 vacTube1VacuumV->SetMedium(pMedVacuum);
625
626 // volume visual property (transparency)
627 vacTube1V->SetLineColor(TColor::GetColor("#ffcccc"));
628 vacTube1V->SetTransparency(0);
629
630 // part positions in the vacuum tube box
631 TGeoCombiTrans* vacTube1V_transf[1];
632 vacTube1V_transf[0] = new TGeoCombiTrans();
633 vacTube1V_transf[0]->SetTranslation(TMath::Sin(angleInclined1 * TMath::DegToRad()) * length1 * 0.5, 0.0,
634 length1 * 0.5);
635
636 vacTubeBoxV->AddNode(vacTube1V, 0, vacTube1V_transf[0]);
637 vacTubeBoxV->AddNode(vacTube1VacuumV, 0, vacTube1V_transf[0]);
638
639 return vacTubeBoxV;
640}
641//------------------------------------------------------------------------------
int Int_t
double Double_t
constexpr Bool_t kTRUE
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TGeoManager * gGeoManager
#define gROOT
R__EXTERN TSystem * gSystem
static Int_t GetColor(const char *hexcolor)
void Close(Option_t *option="") override
void RegisterYourself() override
void RotateY(Double_t angle) override
void SetTranslation(const TGeoTranslation &tr)
void RotateZ(Double_t angle) override
void ComputeBBox() override
void MakeNode(const char *expression)
TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="") override
void SetVisContainers(Bool_t flag=kTRUE) override
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
void Draw(Option_t *option="") override
void SetTransparency(Char_t transparency=0)
virtual void SetMedium(TGeoMedium *medium)
void SetLineColor(Color_t lcolor) override
virtual void SetName(const char *name)
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
TGeoMedium * pMedCarbon
TGeoManager * gGeoMan
TGeoMedium * pMedFiberGlass
TGeoMedium * pMedSteel
TGeoMedium * pMedAluminium
TGeoMedium * pMedSilicon
const Double_t XModulePositions[NModules]
const Double_t YModulePositions[NModules]
const Double_t ZModulePositions[NModules]
TGeoVolume * CreateModule1(TString module_name)
TGeoVolume * CreateModule3(TString module_name)
TGeoVolume * CreateModule4(TString module_name)
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
void create_rootgeom_VacuumPipe_section2()
TGeoVolume * CreateModule2(TString module_name)
TGeoMedium * pMedVacuum
constexpr Double_t DegToRad()
Double_t Sin(Double_t)