BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_GEMS_RunWinter2016.C
Go to the documentation of this file.
1//---------------------------
2#include "TFile.h"
3#include "TGeoBBox.h"
4#include "TGeoManager.h"
5#include "TGeoShape.h"
6#include "TMath.h"
7#include "TRandom.h"
8#include "TString.h"
9
10// Set Parameters of GEMS -------------------------------------------------------
11const Int_t NStations = 7; // stations in the detector
12const Int_t NMaxModules = 2; // max. number of modules in a station
13
14//(X-Y-Z)Positions of stations (sensitive volumes)
15const Double_t XStationPositions[NStations] = {+0.0, -1.5, -1.5, -1.5, +0.0, +0.0, +0.0};
16const Double_t YStationPositions[NStations] = {+0.0 - 4.5, +0.0 - 4.5, +0.0 - 4.5, +0.0 - 4.5,
17 +0.0 - 4.5, -2.4 - 4.5, -2.4 - 4.5};
19 -186.0 + 0.1, 31.8 + 0.7, 63.8 + 0.7, 95.8 + 0.7,
20 127.8 + 0.7, 159.8 + 1.5, 191.8 + 1.5}; // All z-positions are start pos. of the sensitive vol. (from the magnet
21 // pole)
22
23//(X-Y-Z)Shifts of modules in each station
25 {0.0}, // station 0 (10x10)
26 {0.0}, // station 1 (66x41)
27 {0.0}, // station 2
28 {0.0}, // station 3
29 {27.7, -34.7}, // station 4 (2 modules of 66x41)
30 {163.2 * 0.25, -163.2 * 0.25}, // station 5 (163x45): module0 + module1
31 {163.2 * 0.25, -163.2 * 0.25} // station 6 (163x45): module0 + module1
32};
34 {0.0}, // station 0 (10x10)
35 {0.0}, // station 1 (66x41)
36 {0.0}, // station 2
37 {0.0}, // station 3
38 {0.0, +0.2}, // station 4 (2 modules of 66x41)
39 {0.0, 0.0}, // station 5 (163x45): module0 + module1
40 {0.0, 0.0} // station 6 (163x45): module0 + module1
41};
43 {0.0}, // station 0 (10x10)
44 {0.0}, // station 1 (66x41)
45 {0.0}, // station 2
46 {0.0}, // station 3
47 {0.0, +2.3}, // station 4 (2 modules of 66x41)
48 {0.0, 0.0}, // station 5 (163x45): module0 + module1
49 {0.0, 0.0} // station 6 (163x45): module0 + module1
50};
51
52// GEM plane sizes (10x10 type) -------------------------------------------------
56
60//------------------------------------------------------------------------------
61
62// GEM plane sizes (66x41 type) -------------------------------------------------
66
70//------------------------------------------------------------------------------
71
72// GEM plane sizes (163x45 type) ------------------------------------------------
76
80//------------------------------------------------------------------------------
81
82// GeoManager
84
85// media
91
92class FairGeoMedia;
93class FairGeoBuilder;
94
95TGeoVolume* CreateStation(TString station_name);
96TGeoVolume* CreateModule_Station10x10(TString module_name, Double_t xsize, Double_t ysize, Double_t zsize);
98TGeoVolume* CreateModule_Station66x41(TString module_name, Double_t xsize, Double_t ysize, Double_t zsize);
101 Double_t xsize,
102 Double_t ysize,
103 Double_t zsize,
104 Double_t hole_radius);
106 Double_t dx,
107 Double_t dy,
108 Double_t dz,
109 Double_t hole_radius);
110
111void DefineRequiredMedia(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
112{
113
114 // air medium
115 FairGeoMedium* mAir = geoMedia->getMedium("air");
116 if (!mAir)
117 Fatal("Main", "FairMedium air not found");
118 geoBuild->createMedium(mAir);
119 pMedAir = gGeoManager->GetMedium("air");
120 if (!pMedAir)
121 Fatal("Main", "Medium air not found");
122
123 // carbon medium
124 FairGeoMedium* mCarbon = geoMedia->getMedium("carbon");
125 if (!mCarbon)
126 Fatal("Main", "FairMedium carbon not found");
127 geoBuild->createMedium(mCarbon);
128 pMedCarbon = gGeoManager->GetMedium("carbon");
129 if (!pMedCarbon)
130 Fatal("Main", "Medium carbon not found");
131
132 // fiberglass medium
133 FairGeoMedium* mFiberGlass = geoMedia->getMedium("fiberglass");
134 if (!mFiberGlass)
135 Fatal("Main", "FairMedium fiberglass not found");
136 geoBuild->createMedium(mFiberGlass);
137 pMedFiberGlass = gGeoManager->GetMedium("fiberglass");
138 if (!pMedFiberGlass)
139 Fatal("Main", "Medium fiberglass not found");
140
141 // arco27020 medium
142 FairGeoMedium* mArCO27030 = geoMedia->getMedium("arco27030");
143 if (!mArCO27030)
144 Fatal("Main", "FairMedium arco27030 not found");
145 geoBuild->createMedium(mArCO27030);
146 pMedArCO27030 = gGeoManager->GetMedium("arco27030");
147 if (!pMedArCO27030)
148 Fatal("Main", "Medium arco27030 not found");
149}
150
152{
153
154 // ---- set working directory --------------------------------------------
155 TString gPath = gSystem->Getenv("VMCWORKDIR");
156
157 // ------- Geometry file name (output) ----------------------------------
158 const TString geoDetectorName = "GEMS";
159 const TString geoDetectorVersion = "RunWinter2016";
160 const TString geoFileName = gPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
161
162 // ---- global geometry parameters ---------------------------------------
163 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
164 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
165
166 // ------- Load media from media file ----------------------------------
167 TString medFile = gPath + "/geometry/media.geo";
168 geoFace->setMediaFile(medFile);
169 geoFace->readMedia();
170 FairGeoMedia* geoMedia = geoFace->getMedia();
171 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
172
173 DefineRequiredMedia(geoMedia, geoBuild);
174 // -------------------------------------------------------------------------
175
176 // -------------- Create geometry and top volume -------------------------
177 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
178 gGeoMan->SetName(geoDetectorName + "_geom");
179 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
180 top->SetMedium(pMedAir);
181 gGeoMan->SetTopVolume(top);
182 // gGeoMan->SetTopVisible(1);
183 // --------------------------------------------------------------------------
184
185 // Define TOP Geometry
186 TGeoVolume* GEMS = new TGeoVolumeAssembly(geoDetectorName);
187 GEMS->SetMedium(pMedAir);
188
189 // station 0 (10x10 GEM)
190 if (1) {
191 Int_t stationNum = 0; // station number
192
193 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(stationNum, 10));
194 TGeoVolume* module0 =
195 CreateModule_Station10x10(TString("Sensor_module0_") + station->GetName(), XModuleSize_Station10x10,
199
200 TGeoCombiTrans* module0_transform = new TGeoCombiTrans();
201 module0_transform->SetTranslation(XModuleShifts[stationNum][0], YModuleShifts[stationNum][0],
202 ZModuleShifts[stationNum][0] + ZModuleSize_Station10x10 * 0.5);
203
204 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
205 station_transform->SetTranslation(XStationPositions[stationNum], YStationPositions[stationNum],
206 ZStationPositions[stationNum]);
207
208 station->AddNode(module0, 0, new TGeoCombiTrans(*module0_transform)); // module
209 station->AddNode(frame0, 0, new TGeoCombiTrans(*module0_transform)); // frame
210
211 GEMS->AddNode(station, 0, station_transform);
212 }
213
214 // station 1 (small GEM)
215 if (1) {
216 Int_t stationNum = 1; // station number
217
218 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(stationNum, 10));
219 TGeoVolume* module0 =
220 CreateModule_Station66x41(TString("Sensor_module0_") + station->GetName(), XModuleSize_Station66x41,
224
225 TGeoCombiTrans* module0_transform = new TGeoCombiTrans();
226 module0_transform->SetTranslation(XModuleShifts[stationNum][0], YModuleShifts[stationNum][0],
227 ZModuleShifts[stationNum][0] + ZModuleSize_Station66x41 * 0.5);
228
229 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
230 station_transform->SetTranslation(XStationPositions[stationNum], YStationPositions[stationNum],
231 ZStationPositions[stationNum]);
232
233 station->AddNode(module0, 0, new TGeoCombiTrans(*module0_transform)); // module
234 station->AddNode(frame0, 0, new TGeoCombiTrans(*module0_transform)); // frame
235
236 GEMS->AddNode(station, 0, station_transform);
237 }
238
239 // station 2 (small GEM)
240 if (1) {
241 Int_t stationNum = 2; // station number
242
243 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(stationNum, 10));
244 TGeoVolume* module0 =
245 CreateModule_Station66x41(TString("Sensor_module0_") + station->GetName(), XModuleSize_Station66x41,
249
250 TGeoCombiTrans* module0_transform = new TGeoCombiTrans();
251 module0_transform->SetTranslation(XModuleShifts[stationNum][0], YModuleShifts[stationNum][0],
252 ZModuleShifts[stationNum][0] + ZModuleSize_Station66x41 * 0.5);
253
254 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
255 station_transform->SetTranslation(XStationPositions[stationNum], YStationPositions[stationNum],
256 ZStationPositions[stationNum]);
257
258 station->AddNode(module0, 0, new TGeoCombiTrans(*module0_transform)); // module
259 station->AddNode(frame0, 0, new TGeoCombiTrans(*module0_transform)); // frame
260
261 GEMS->AddNode(station, 0, station_transform);
262 }
263
264 // station 3 (small GEM)
265 if (1) {
266 Int_t stationNum = 3; // station number
267
268 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(stationNum, 10));
269 TGeoVolume* module0 =
270 CreateModule_Station66x41(TString("Sensor_module0_") + station->GetName(), XModuleSize_Station66x41,
274
275 TGeoCombiTrans* module0_transform = new TGeoCombiTrans();
276 module0_transform->SetTranslation(XModuleShifts[stationNum][0], YModuleShifts[stationNum][0],
277 ZModuleShifts[stationNum][0] + ZModuleSize_Station66x41 * 0.5);
278
279 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
280 station_transform->SetTranslation(XStationPositions[stationNum], YStationPositions[stationNum],
281 ZStationPositions[stationNum]);
282
283 station->AddNode(module0, 0, new TGeoCombiTrans(*module0_transform)); // module
284 station->AddNode(frame0, 0, new TGeoCombiTrans(*module0_transform)); // frame
285
286 GEMS->AddNode(station, 0, station_transform);
287 }
288
289 // station 4 (two 66x41 modules)
290 if (1) {
291 Int_t stationNum = 4; // station number
292
293 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(stationNum, 10));
294 TGeoVolume* module0 =
295 CreateModule_Station66x41(TString("Sensor_module0_") + station->GetName(), XModuleSize_Station66x41,
297 TGeoVolume* module1 =
298 CreateModule_Station66x41(TString("Sensor_module1_") + station->GetName(), XModuleSize_Station66x41,
304
305 TGeoCombiTrans* module0_transform = new TGeoCombiTrans();
306 module0_transform->SetTranslation(XModuleShifts[stationNum][0], YModuleShifts[stationNum][0],
307 ZModuleShifts[stationNum][0] + ZModuleSize_Station66x41 * 0.5);
308
309 TGeoCombiTrans* module1_transform = new TGeoCombiTrans();
310 module1_transform->SetTranslation(XModuleShifts[stationNum][1], YModuleShifts[stationNum][1],
311 ZModuleShifts[stationNum][1] + ZModuleSize_Station66x41 * 0.5);
312
313 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
314 station_transform->SetTranslation(XStationPositions[stationNum], YStationPositions[stationNum],
315 ZStationPositions[stationNum]);
316
317 station->AddNode(module0, 0, new TGeoCombiTrans(*module0_transform)); // module
318 station->AddNode(module1, 0, new TGeoCombiTrans(*module1_transform)); // module
319
320 station->AddNode(frame0, 0, new TGeoCombiTrans(*module0_transform)); // frame
321 station->AddNode(frame1, 0, new TGeoCombiTrans(*module1_transform)); // frame
322
323 GEMS->AddNode(station, 0, station_transform);
324 }
325
326 // station 5 (big 163x45 GEM consisting two modules)
327 if (1) {
328 Int_t stationNum = 5; // station number
329
330 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(stationNum, 10));
331 TGeoVolume* module0 =
334 TGeoVolume* module1 =
337 TGeoVolume* frame0 =
340 TGeoVolume* frame1 =
343
344 TGeoCombiTrans* module0_transform = new TGeoCombiTrans();
345 module0_transform->SetTranslation(XModuleShifts[stationNum][0], YModuleShifts[stationNum][0],
346 ZModuleShifts[stationNum][0] + ZModuleSize_Station163x45 * 0.5);
347
348 TGeoCombiTrans* module1_transform = new TGeoCombiTrans();
349 module1_transform->ReflectX(true);
350 module1_transform->SetTranslation(XModuleShifts[stationNum][1], YModuleShifts[stationNum][1],
351 ZModuleShifts[stationNum][1] + ZModuleSize_Station163x45 * 0.5);
352
353 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
354 station_transform->SetTranslation(XStationPositions[stationNum], YStationPositions[stationNum],
355 ZStationPositions[stationNum]);
356
357 station->AddNode(module0, 0, new TGeoCombiTrans(*module0_transform)); // module
358 station->AddNode(module1, 0, new TGeoCombiTrans(*module1_transform)); // module
359
360 station->AddNode(frame0, 0, new TGeoCombiTrans(*module0_transform)); // frame
361 station->AddNode(frame1, 0, new TGeoCombiTrans(*module1_transform)); // frame
362
363 GEMS->AddNode(station, 0, station_transform);
364 }
365
366 // station 6 (big 163x45 GEM consisting two modules)
367 if (1) {
368 Int_t stationNum = 6; // station number
369
370 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(stationNum, 10));
371 TGeoVolume* module0 =
374 TGeoVolume* module1 =
377 TGeoVolume* frame0 =
380 TGeoVolume* frame1 =
383
384 TGeoCombiTrans* module0_transform = new TGeoCombiTrans();
385 module0_transform->SetTranslation(XModuleShifts[stationNum][0], YModuleShifts[stationNum][0],
386 ZModuleShifts[stationNum][0] + ZModuleSize_Station163x45 * 0.5);
387
388 TGeoCombiTrans* module1_transform = new TGeoCombiTrans();
389 module1_transform->ReflectX(true);
390 module1_transform->SetTranslation(XModuleShifts[stationNum][1], YModuleShifts[stationNum][1],
391 ZModuleShifts[stationNum][1] + ZModuleSize_Station163x45 * 0.5);
392
393 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
394 station_transform->SetTranslation(XStationPositions[stationNum], YStationPositions[stationNum],
395 ZStationPositions[stationNum]);
396
397 station->AddNode(module0, 0, new TGeoCombiTrans(*module0_transform)); // module
398 station->AddNode(module1, 0, new TGeoCombiTrans(*module1_transform)); // module
399
400 station->AddNode(frame0, 0, new TGeoCombiTrans(*module0_transform)); // frame
401 station->AddNode(frame1, 0, new TGeoCombiTrans(*module1_transform)); // frame
402
403 GEMS->AddNode(station, 0, station_transform);
404 }
405
406 top->AddNode(GEMS, 0);
408
409 // --------------- Finish -----------------------------------------------
410 gGeoMan->CloseGeometry();
411 gGeoMan->CheckOverlaps(0.0001);
412 gGeoMan->PrintOverlaps();
413 gGeoMan->Test();
414 // gGeoMan->RestoreMasterVolume();
415
416 TFile* geoFile = new TFile(geoFileName, "RECREATE");
417 top->Write();
418 geoFile->Close();
419 top->Draw("ogl");
420}
421//------------------------------------------------------------------------------
422
424{
425
426 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
427 stationA->SetMedium(pMedAir);
428
429 return stationA;
430}
431
433{
434
435 return CreateModule_Station66x41(module_name, xsize, ysize, zsize);
436}
437
439{
440 // frame shapes
441 TGeoShape* vertical_frameS =
442 new TGeoBBox("vertical_frameS", dx * 0.5, YModuleSize_Station10x10 * 0.5 + dy, dz * 0.5);
443 TGeoShape* horizontal_frameS =
444 new TGeoBBox("horizontal_frameS", XModuleSize_Station10x10 * 0.5, dy * 0.5, dz * 0.5);
445
446 // frame volumes
447 TGeoVolume* composite_frameV = new TGeoVolumeAssembly(frame_name);
448 TGeoVolume* vertical_frameV = new TGeoVolume(frame_name + "_vertical_frameV", vertical_frameS);
449 TGeoVolume* horizontal_frameV = new TGeoVolume(frame_name + "_horizontal_frameV", horizontal_frameS);
450
451 // media
452 TGeoMedium* frame_medium = pMedCarbon; // set medium
453 if (pMedCarbon) {
454 vertical_frameV->SetMedium(frame_medium);
455 horizontal_frameV->SetMedium(frame_medium);
456 } else
457 Fatal("Main", "Invalid medium for frames!");
458 if (pMedAir) {
459 composite_frameV->SetMedium(pMedAir);
460 } else
461 Fatal("Main", "Invalid medium for frames!");
462
463 // visual parameters
464 vertical_frameV->SetLineColor(TColor::GetColor("#9999ff"));
465 horizontal_frameV->SetLineColor(TColor::GetColor("#9999ff"));
466
467 // frame part positions in the frame
468 TGeoCombiTrans* left_vertical_frame_position = new TGeoCombiTrans();
469 left_vertical_frame_position->SetTranslation(XModuleSize_Station10x10 * 0.5 + dXFrame_Station10x10 * 0.5, 0.0, 0.0);
470
471 TGeoCombiTrans* right_vertical_frame_position = new TGeoCombiTrans();
472 right_vertical_frame_position->SetTranslation(-XModuleSize_Station10x10 * 0.5 - dXFrame_Station10x10 * 0.5, 0.0,
473 0.0);
474
475 TGeoCombiTrans* bottom_horizontal_frame_position = new TGeoCombiTrans();
476 bottom_horizontal_frame_position->SetTranslation(0.0, YModuleSize_Station10x10 * 0.5 + dYFrame_Station10x10 * 0.5,
477 0.0);
478
479 TGeoCombiTrans* lower_horizontal_frame_position = new TGeoCombiTrans();
480 lower_horizontal_frame_position->SetTranslation(0.0, -YModuleSize_Station10x10 * 0.5 - dYFrame_Station10x10 * 0.5,
481 0.0);
482
483 composite_frameV->AddNode(vertical_frameV, 0, left_vertical_frame_position);
484 composite_frameV->AddNode(vertical_frameV, 1, right_vertical_frame_position);
485 composite_frameV->AddNode(horizontal_frameV, 0, bottom_horizontal_frame_position);
486 composite_frameV->AddNode(horizontal_frameV, 1, lower_horizontal_frame_position);
487
488 return composite_frameV;
489}
490
492{
493
494 // module shape
495 TGeoShape* moduleS = new TGeoBBox("moduleS", xsize * 0.5, ysize * 0.5, zsize * 0.5);
496
497 // module volume
498 TGeoVolume* moduleV = new TGeoVolume(module_name, moduleS);
499
500 // medium
501 if (pMedArCO27030)
502 moduleV->SetMedium(pMedArCO27030);
503 else
504 Fatal("Main", "Invalid medium for sensitive modules!");
505
506 // visual parameters
507 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
508 moduleV->SetTransparency(20);
509
510 return moduleV;
511}
512
514{
515
516 // frame shapes
517 TGeoShape* vertical_frameS =
518 new TGeoBBox("vertical_frameS", dx * 0.5, YModuleSize_Station66x41 * 0.5 + dy, dz * 0.5);
519 TGeoShape* horizontal_frameS =
520 new TGeoBBox("horizontal_frameS", XModuleSize_Station66x41 * 0.5, dy * 0.5, dz * 0.5);
521
522 // frame volumes
523 TGeoVolume* composite_frameV = new TGeoVolumeAssembly(frame_name);
524 TGeoVolume* vertical_frameV = new TGeoVolume(frame_name + "_vertical_frameV", vertical_frameS);
525 TGeoVolume* horizontal_frameV = new TGeoVolume(frame_name + "_horizontal_frameV", horizontal_frameS);
526
527 // media
528 TGeoMedium* frame_medium = pMedCarbon; // set medium
529 if (pMedCarbon) {
530 vertical_frameV->SetMedium(frame_medium);
531 horizontal_frameV->SetMedium(frame_medium);
532 } else
533 Fatal("Main", "Invalid medium for frames!");
534 if (pMedAir) {
535 composite_frameV->SetMedium(pMedAir);
536 } else
537 Fatal("Main", "Invalid medium for frames!");
538
539 // visual parameters
540 vertical_frameV->SetLineColor(TColor::GetColor("#9999ff"));
541 horizontal_frameV->SetLineColor(TColor::GetColor("#9999ff"));
542
543 // frame part positions in the frame
544 TGeoCombiTrans* left_vertical_frame_position = new TGeoCombiTrans();
545 left_vertical_frame_position->SetTranslation(XModuleSize_Station66x41 * 0.5 + dXFrame_Station66x41 * 0.5, 0.0, 0.0);
546
547 TGeoCombiTrans* right_vertical_frame_position = new TGeoCombiTrans();
548 right_vertical_frame_position->SetTranslation(-XModuleSize_Station66x41 * 0.5 - dXFrame_Station66x41 * 0.5, 0.0,
549 0.0);
550
551 TGeoCombiTrans* bottom_horizontal_frame_position = new TGeoCombiTrans();
552 bottom_horizontal_frame_position->SetTranslation(0.0, YModuleSize_Station66x41 * 0.5 + dYFrame_Station66x41 * 0.5,
553 0.0);
554
555 TGeoCombiTrans* lower_horizontal_frame_position = new TGeoCombiTrans();
556 lower_horizontal_frame_position->SetTranslation(0.0, -YModuleSize_Station66x41 * 0.5 - dYFrame_Station66x41 * 0.5,
557 0.0);
558
559 composite_frameV->AddNode(vertical_frameV, 0, left_vertical_frame_position);
560 composite_frameV->AddNode(vertical_frameV, 1, right_vertical_frame_position);
561 composite_frameV->AddNode(horizontal_frameV, 0, bottom_horizontal_frame_position);
562 composite_frameV->AddNode(horizontal_frameV, 1, lower_horizontal_frame_position);
563
564 return composite_frameV;
565}
566
568 Double_t xsize,
569 Double_t ysize,
570 Double_t zsize,
571 Double_t hole_radius)
572{
573
574 // module shapes
575 TGeoShape* module_partS = new TGeoBBox("module_partS", xsize * 0.5, ysize * 0.5, zsize * 0.5);
576 TGeoShape* holeS = new TGeoTube("holeS", 0.0, hole_radius, zsize * 0.5 + 0.01);
577
578 gRandom->SetSeed(0);
579 Int_t uniqueId = gRandom->Integer(10000);
580 TGeoTranslation* hole_module_trans = new TGeoTranslation(
581 TString("hole_module_trans_") + TString::Itoa(uniqueId, 10), -xsize * 0.5, -ysize * 0.5, 0.0);
582
583 hole_module_trans->RegisterYourself();
584
585 TString bool_expression_module = TString(module_partS->GetName()) + TString(" - ") + TString(holeS->GetName())
586 + TString(":") + TString(hole_module_trans->GetName());
587 TGeoCompositeShape* moduleS = new TGeoCompositeShape(bool_expression_module);
588
589 // module volume
590 TGeoVolume* moduleV = new TGeoVolume(module_name, moduleS);
591
592 // medium
593 if (pMedArCO27030)
594 moduleV->SetMedium(pMedArCO27030);
595 else
596 Fatal("Main", "Invalid medium for sensitive modules!");
597
598 // visual parameters
599 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
600 moduleV->SetTransparency(20);
601
602 return moduleV;
603}
604
606 Double_t dx,
607 Double_t dy,
608 Double_t dz,
609 Double_t hole_radius)
610{
611
612 // frame shapes
613 TGeoShape* vertical_frameS =
614 new TGeoBBox("vertical_frameS", dx * 0.5, YModuleSize_Station163x45 * 0.5 + dy, dz * 0.5);
615 TGeoShape* horizontal_upper_frameS =
616 new TGeoBBox("horizontal_upper_frameS", XModuleSize_Station163x45 * 0.5, dy * 0.5, dz * 0.5);
617 TGeoShape* horizontal_bottom_frameS = new TGeoBBox(
618 "horizontal_upper_frameS", XModuleSize_Station163x45 * 0.5 - hole_radius * 0.5, dy * 0.5, dz * 0.5);
619
620 // frame volumes
621 TGeoVolume* composite_frameV = new TGeoVolumeAssembly(frame_name);
622 TGeoVolume* vertical_frameV = new TGeoVolume(frame_name + "_vertical_frameV", vertical_frameS);
623 TGeoVolume* horizontal_upper_frameV =
624 new TGeoVolume(frame_name + "_horizontal_upper_frameV", horizontal_upper_frameS);
625 TGeoVolume* horizontal_bottom_frameV =
626 new TGeoVolume(frame_name + "_horizontal_bottom_frameV", horizontal_bottom_frameS);
627
628 // media
629 TGeoMedium* frame_medium = pMedCarbon; // set medium
630 if (pMedCarbon) {
631 vertical_frameV->SetMedium(frame_medium);
632 horizontal_upper_frameV->SetMedium(frame_medium);
633 horizontal_bottom_frameV->SetMedium(frame_medium);
634 } else
635 Fatal("Main", "Invalid medium for frames!");
636 if (pMedAir) {
637 composite_frameV->SetMedium(pMedAir);
638 } else
639 Fatal("Main", "Invalid medium for frames!");
640
641 // visual parameters
642 vertical_frameV->SetLineColor(TColor::GetColor("#9999ff"));
643 horizontal_upper_frameV->SetLineColor(TColor::GetColor("#9999ff"));
644 horizontal_bottom_frameV->SetLineColor(TColor::GetColor("#9999ff"));
645
646 // frame part positions in the frame
647 TGeoCombiTrans* left_vertical_frame_position = new TGeoCombiTrans();
648 left_vertical_frame_position->SetTranslation(XModuleSize_Station163x45 * 0.5 + dXFrame_Station163x45 * 0.5, 0.0,
649 0.0);
650
651 TGeoCombiTrans* upper_horizontal_frame_position = new TGeoCombiTrans();
652 upper_horizontal_frame_position->SetTranslation(0.0, YModuleSize_Station163x45 * 0.5 + dYFrame_Station163x45 * 0.5,
653 0.0);
654
655 TGeoCombiTrans* bottom_horizontal_frame_position = new TGeoCombiTrans();
656 bottom_horizontal_frame_position->SetTranslation(
657 hole_radius * 0.5, -YModuleSize_Station163x45 * 0.5 - dYFrame_Station163x45 * 0.5, 0.0);
658
659 composite_frameV->AddNode(vertical_frameV, 0, left_vertical_frame_position);
660 composite_frameV->AddNode(horizontal_upper_frameV, 0, upper_horizontal_frame_position);
661 composite_frameV->AddNode(horizontal_bottom_frameV, 0, bottom_horizontal_frame_position);
662
663 return composite_frameV;
664}
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 TRandom * gRandom
R__EXTERN TSystem * gSystem
static Int_t GetColor(const char *hexcolor)
void Close(Option_t *option="") override
void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE) override
void SetTranslation(const TGeoTranslation &tr)
virtual void RegisterYourself()
const char * GetName() const 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
const char * GetName() const override
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
static TString Itoa(Int_t value, Int_t base)
const Double_t dYFrame_Station163x45
const Double_t dXFrame_Station66x41
const Double_t dZFrame_Station66x41
TGeoMedium * pMedAir
const Double_t ZModuleSize_Station66x41
const Double_t YStationPositions[NStations]
const Double_t dYFrame_Station66x41
const Double_t ZModuleSize_Station163x45
const Double_t dXFrame_Station163x45
const Double_t YModuleSize_Station163x45
TGeoMedium * pMedCarbon
const Double_t dZFrame_Station163x45
TGeoManager * gGeoMan
const Int_t NMaxModules
const Double_t ZStationPositions[NStations]
TGeoMedium * pMedArCO27030
const Int_t NStations
const Double_t YModuleSize_Station66x41
const Double_t XModuleSize_Station163x45
const Double_t XModuleSize_Station66x41
TGeoMedium * pMedFiberGlass
const Double_t XStationPositions[NStations]
TGeoMedium * pMedCopper
const Double_t ZModuleSize_Station10x10
const Double_t dYFrame_Station10x10
const Double_t XModuleSize_Station10x10
const Double_t YModuleSize_Station10x10
const Double_t dXFrame_Station10x10
const Double_t dZFrame_Station10x10
TGeoVolume * CreateModule_Station10x10(TString module_name, Double_t xsize, Double_t ysize, Double_t zsize)
TGeoVolume * CreateModule_Station66x41(TString module_name, Double_t xsize, Double_t ysize, Double_t zsize)
TGeoVolume * CreateFrameForModule_Station163x45(TString frame_name, Double_t dx, Double_t dy, Double_t dz, Double_t hole_radius)
void create_rootgeom_GEMS_RunWinter2016()
TGeoVolume * CreateStation(TString station_name)
TGeoVolume * CreateModule_Station163x45(TString module_name, Double_t xsize, Double_t ysize, Double_t zsize, Double_t hole_radius)
TGeoVolume * CreateFrameForModule_Station10x10(TString frame_name, Double_t dx, Double_t dy, Double_t dz)
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
TGeoVolume * CreateFrameForModule_Station66x41(TString frame_name, Double_t dx, Double_t dy, Double_t dz)