BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_GEMS_1stConfig.C
Go to the documentation of this file.
1//---------------------------
2#include "../../gem/BmnGemStripConfiguration.h"
3#include "TFile.h"
4#include "TGeoBBox.h"
5#include "TGeoManager.h"
6#include "TGeoShape.h"
7#include "TMath.h"
8#include "TString.h"
9
10using namespace TMath;
11
12// GeoManager
14
15// Set Parameters of GEMS
16const Int_t nStations = 6;
17
18// Station Parameters
19/*
20const Double_t XStationPositions[nStations] = {-2.2, 3.0, -1.8, 1.0, 1.4, 2.1};
21const Double_t YStationPositions[nStations] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
22const Double_t ZStationPositions[nStations] = {30.0, 45.0, 60.0, 80.0, 100.0, 130.0}; // z pos is the first surface of
23the first sens. volume in module !!!
24*/
25
27XStationPositions[0] = BmnGemStripPositions_FirstConfig::XStationPositions[0];
28XStationPositions[1] = BmnGemStripPositions_FirstConfig::XStationPositions[1];
29XStationPositions[2] = BmnGemStripPositions_FirstConfig::XStationPositions[2];
30XStationPositions[3] = BmnGemStripPositions_FirstConfig::XStationPositions[3];
31XStationPositions[4] = BmnGemStripPositions_FirstConfig::XStationPositions[4];
32XStationPositions[5] = BmnGemStripPositions_FirstConfig::XStationPositions[5];
33
35YStationPositions[0] = BmnGemStripPositions_FirstConfig::YStationPositions[0];
36YStationPositions[1] = BmnGemStripPositions_FirstConfig::YStationPositions[1];
37YStationPositions[2] = BmnGemStripPositions_FirstConfig::YStationPositions[2];
38YStationPositions[3] = BmnGemStripPositions_FirstConfig::YStationPositions[3];
39YStationPositions[4] = BmnGemStripPositions_FirstConfig::YStationPositions[4];
40YStationPositions[5] = BmnGemStripPositions_FirstConfig::YStationPositions[5];
41
43ZStationPositions[0] = BmnGemStripPositions_FirstConfig::ZStationPositions[0];
44ZStationPositions[1] = BmnGemStripPositions_FirstConfig::ZStationPositions[1];
45ZStationPositions[2] = BmnGemStripPositions_FirstConfig::ZStationPositions[2];
46ZStationPositions[3] = BmnGemStripPositions_FirstConfig::ZStationPositions[3];
47ZStationPositions[4] = BmnGemStripPositions_FirstConfig::ZStationPositions[4];
48ZStationPositions[5] = BmnGemStripPositions_FirstConfig::ZStationPositions[5];
49
50// GEM plane sizes (66x41 type)
53
56
58
59// GEM plane sizes (163x45 type)
60const Double_t OuterZoneSizes_Station163x45[2] = {163.2 * 0.5, 45.0}; // {xsize, ysize}
61const Double_t HotZoneSizes_rectangle_Station163x45[2] = {40.0, 15.0}; // {xsize, ysize}
62const Double_t HotZoneSizes_slope_Station163x45[3] = {37.99, 42.01, 15.0}; // {xmin_size, xmax_size, ysize}
63const Double_t HoleRadius_Station163x45 = 4.0; // cm (real hole without the circle frame)
64
65// Module Parameters
72
73// media
79
80class FairGeoMedia;
81class FairGeoBuilder;
82
83void DefineRequiredMedia(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
84{
85
86 // air medium
87 FairGeoMedium* mAir = geoMedia->getMedium("air");
88 if (!mAir)
89 Fatal("Main", "FairMedium air not found");
90 geoBuild->createMedium(mAir);
91 pMedAir = gGeoManager->GetMedium("air");
92 if (!pMedAir)
93 Fatal("Main", "Medium air not found");
94
95 // carbon medium
96 FairGeoMedium* mCarbon = geoMedia->getMedium("carbon");
97 if (!mCarbon)
98 Fatal("Main", "FairMedium carbon not found");
99 geoBuild->createMedium(mCarbon);
100 pMedCarbon = gGeoManager->GetMedium("carbon");
101 if (!pMedCarbon)
102 Fatal("Main", "Medium carbon not found");
103
104 // fiberglass medium
105 FairGeoMedium* mFiberGlass = geoMedia->getMedium("fiberglass");
106 if (!mFiberGlass)
107 Fatal("Main", "FairMedium fiberglass not found");
108 geoBuild->createMedium(mFiberGlass);
109 pMedFiberGlass = gGeoManager->GetMedium("fiberglass");
110 if (!pMedFiberGlass)
111 Fatal("Main", "Medium fiberglass not found");
112
113 // arco27020 medium
114 FairGeoMedium* mArCO27030 = geoMedia->getMedium("arco27030");
115 if (!mArCO27030)
116 Fatal("Main", "FairMedium arco27030 not found");
117 geoBuild->createMedium(mArCO27030);
118 pMedArCO27030 = gGeoManager->GetMedium("arco27030");
119 if (!pMedArCO27030)
120 Fatal("Main", "Medium arco27030 not found");
121}
122
124{
125
126 // Load the necessary FairRoot libraries
127 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
128 bmnloadlibs(); // load libraries
129
130 // ---- set working directory --------------------------------------------
131 TString gPath = gSystem->Getenv("VMCWORKDIR");
132
133 // ------- Geometry file name (output) ----------------------------------
134 const TString geoDetectorName = "GEMS";
135 const TString geoDetectorVersion = "1stConfig";
136 const TString geoFileName = gPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
137
138 // ---- global geometry parameters ---------------------------------------
139 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
140 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
141
142 // ------- Load media from media file ----------------------------------
143 TString medFile = gPath + "/geometry/media.geo";
144 geoFace->setMediaFile(medFile);
145 geoFace->readMedia();
146 FairGeoMedia* geoMedia = geoFace->getMedia();
147 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
148
149 DefineRequiredMedia(geoMedia, geoBuild);
150 // -------------------------------------------------------------------------
151
152 // -------------- Create geometry and top volume -------------------------
153 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
154 gGeoMan->SetName(geoDetectorName + "_geom");
155 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
156 top->SetMedium(pMedAir);
157 gGeoMan->SetTopVolume(top);
158 // gGeoMan->SetTopVisible(1);
159 // --------------------------------------------------------------------------
160
161 // Define TOP Geometry
162 TGeoVolume* GEMS = new TGeoVolumeAssembly(geoDetectorName);
163 GEMS->SetMedium(pMedAir);
164
165 // station creating
166
168 kFALSE);
170 kTRUE);
172 kFALSE);
173
175
180
181 top->AddNode(GEMS, 0);
183
184 // --------------- Finish -----------------------------------------------
185 gGeoMan->CloseGeometry();
186 gGeoMan->CheckOverlaps(0.0001);
187 gGeoMan->PrintOverlaps();
188 gGeoMan->Test();
189
190 TFile* geoFile = new TFile(geoFileName, "RECREATE");
191 top->Write();
192 geoFile->Close();
193 top->Draw("ogl");
194}
195
196//------------------------------------------------------------------------------
198 TString station_name,
199 Double_t x_position,
200 Double_t y_position,
201 Double_t z_position,
202 Bool_t IsInverted)
203{
204 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
205 stationA->SetMedium(pMedAir);
206
207 // sensitive shapes
209 dZSensitiveVolume * 0.5);
210 TGeoShape* hot_zoneS = new TGeoBBox("hot_zoneS", XHotZoneSize_StationPrototype * 0.5,
212
213 // frame shapes
214 TGeoShape* vertical_outer_frameS =
215 new TGeoBBox("vertical_outer_frameS", dXOuterFrame * 0.5,
217 TGeoShape* horizontal_outer_frameS =
218 new TGeoBBox("horizontal_outer_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYOuterFrame * 0.5,
220 TGeoShape* vertical_inner_frameS =
221 new TGeoBBox("vertical_inner_frameS", dXInnerFrame * 0.5, YModuleSize_StationPrototype * 0.5,
223 TGeoShape* horizontal_inner_frameS =
224 new TGeoBBox("horizontal_inner_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYInnerFrame * 0.5,
225 ZModuleSize * 0.5);
226
227 /*
228 TGeoXtru *moduleS = new TGeoXtru(2);
229 Double_t x_pos[6] = {XModuleSize_StationPrototype, XModuleSize_StationPrototype, 0.0, 0.0,
230 XHotZoneSize_StationPrototype, XHotZoneSize_StationPrototype}; Double_t y_pos[6] = {0.0,
231 YModuleSize_StationPrototype, YModuleSize_StationPrototype, YHotZoneSize_StationPrototype,
232 YHotZoneSize_StationPrototype, 0.0}; moduleS->DefinePolygon(6, x_pos, y_pos); moduleS->DefineSection(0,
233 -dZSensitiveVolume*0.5); moduleS->DefineSection(1, dZSensitiveVolume*0.5);
234 */
235 // sensitive volumes
236 TGeoVolume* moduleV = new TGeoVolume("module_Sensor", moduleS);
237 TGeoVolume* hot_zoneV = new TGeoVolume("hot_zone_Sensor", hot_zoneS);
238 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
239 hot_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
240
241 // frame volumes
242 TGeoVolume* vertical_outer_frameV = new TGeoVolume("vertical_outer_frame", vertical_outer_frameS);
243 TGeoVolume* horizontal_outer_frameV = new TGeoVolume("horizontal_outer_frame", horizontal_outer_frameS);
244 TGeoVolume* vertical_inner_frameV = new TGeoVolume("vertical_inner_frame", vertical_inner_frameS);
245 TGeoVolume* horizontal_inner_frameV = new TGeoVolume("horizontal_inner_frame", horizontal_inner_frameS);
246 TGeoVolume* composite_frameV = new TGeoVolumeAssembly("frame");
247 vertical_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
248 horizontal_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
249 vertical_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
250 horizontal_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
251
252 // media for sensitive volumes
253 TGeoMedium* sensitive_medium = pMedArCO27030; // set medium
254 if (sensitive_medium) {
255 moduleV->SetMedium(sensitive_medium);
256 hot_zoneV->SetMedium(sensitive_medium);
257 } else
258 Fatal("Main", "Invalid medium for sensitive modules!");
259
260 // media for frames
261 TGeoMedium* frame_medium = pMedCarbon; // set medium
262 if (frame_medium) {
263 vertical_outer_frameV->SetMedium(frame_medium);
264 horizontal_outer_frameV->SetMedium(frame_medium);
265 vertical_inner_frameV->SetMedium(frame_medium);
266 horizontal_inner_frameV->SetMedium(frame_medium);
267 composite_frameV->SetMedium(frame_medium);
268 } else
269 Fatal("Main", "Invalid medium for frames!");
270
271 moduleV->SetTransparency(20);
272
273 // hot zone position in the module
274 TGeoTranslation* hot_zone_trans =
277
278 // module positions in the station
279 TGeoCombiTrans* module_center_position = new TGeoCombiTrans();
280 module_center_position->ReflectX(true);
281 if (IsInverted) {
282 module_center_position->ReflectY(true);
283 }
284 // module_center_position->SetTranslation(0.0, 0.0, 0.0);
285
286 // frame part positions in the frame
287 TGeoCombiTrans* left_outer_frame_position = new TGeoCombiTrans();
288 left_outer_frame_position->SetTranslation(XModuleSize_StationPrototype * 0.5 + dXOuterFrame * 0.5,
289 (dYOuterFrame - dYInnerFrame) * 0.5,
291
292 TGeoCombiTrans* top_outer_frame_position = new TGeoCombiTrans();
293 top_outer_frame_position->SetTranslation(
295
296 TGeoCombiTrans* right_inner_frame_position = new TGeoCombiTrans();
297 right_inner_frame_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 - dXInnerFrame * 0.5, 0,
298 ZModuleSize * 0.5);
299
300 TGeoCombiTrans* bottom_inner_frame_position = new TGeoCombiTrans();
301 bottom_inner_frame_position->SetTranslation(-dXInnerFrame * 0.5,
304
305 // frame positions in the station
306 TGeoCombiTrans* comp_frame_center_position = new TGeoCombiTrans();
307 comp_frame_center_position->ReflectX(true);
308 if (IsInverted) {
309 comp_frame_center_position->ReflectY(true);
310 }
311 // comp_frame_center_position->SetTranslation(module_center_position->GetTranslation());
312
313 // station assembling
314 moduleV->AddNode(hot_zoneV, 0, hot_zone_trans);
315
316 composite_frameV->AddNode(vertical_outer_frameV, 0, left_outer_frame_position);
317 composite_frameV->AddNode(horizontal_outer_frameV, 0, top_outer_frame_position);
318 composite_frameV->AddNode(vertical_inner_frameV, 0, right_inner_frame_position);
319 composite_frameV->AddNode(horizontal_inner_frameV, 0, bottom_inner_frame_position);
320
321 stationA->AddNode(moduleV, 0, module_center_position);
322
323 stationA->AddNode(composite_frameV, 0, comp_frame_center_position);
324
325 // Station position
326 Double_t station_shift = dZSensitiveVolume * 0.5;
327 TGeoTranslation* station_pos = new TGeoTranslation(x_position, y_position, z_position + station_shift);
328
329 mother_volume->AddNode(stationA, 0, station_pos);
330}
331
333 TString station_name,
334 Double_t x_position,
335 Double_t y_position,
336 Double_t z_position)
337{
338 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
339 stationA->SetMedium(pMedAir);
340
341 // sensitive shapes
343 dZSensitiveVolume * 0.5);
344 TGeoShape* hot_zoneS = new TGeoBBox("hot_zoneS", XHotZoneSize_StationPrototype * 0.5,
346
347 // frame shapes
348 TGeoShape* vertical_outer_frameS =
349 new TGeoBBox("vertical_outer_frameS", dXOuterFrame * 0.5,
351 TGeoShape* horizontal_outer_frameS =
352 new TGeoBBox("horizontal_outer_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYOuterFrame * 0.5,
354 TGeoShape* vertical_inner_frameS =
355 new TGeoBBox("vertical_inner_frameS", dXInnerFrame * 0.5, YModuleSize_StationPrototype * 0.5,
357 TGeoShape* horizontal_inner_frameS =
358 new TGeoBBox("horizontal_inner_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYInnerFrame * 0.5,
359 ZModuleSize * 0.5);
360
361 /*
362 TGeoXtru *moduleS = new TGeoXtru(2);
363 Double_t x_pos[6] = {XModuleSize_StationPrototype, XModuleSize_StationPrototype, 0.0, 0.0,
364 XHotZoneSize_StationPrototype, XHotZoneSize_StationPrototype}; Double_t y_pos[6] = {0.0,
365 YModuleSize_StationPrototype, YModuleSize_StationPrototype, YHotZoneSize_StationPrototype,
366 YHotZoneSize_StationPrototype, 0.0}; moduleS->DefinePolygon(6, x_pos, y_pos); moduleS->DefineSection(0,
367 -dZSensitiveVolume*0.5); moduleS->DefineSection(1, dZSensitiveVolume*0.5);
368 */
369 // sensitive volumes
370 TGeoVolume* moduleV = new TGeoVolume("module_Sensor", moduleS);
371 TGeoVolume* hot_zoneV = new TGeoVolume("hot_zone_Sensor", hot_zoneS);
372 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
373 hot_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
374
375 // frame volumes
376 TGeoVolume* vertical_outer_frameV = new TGeoVolume("vertical_outer_frame", vertical_outer_frameS);
377 TGeoVolume* horizontal_outer_frameV = new TGeoVolume("horizontal_outer_frame", horizontal_outer_frameS);
378 TGeoVolume* vertical_inner_frameV = new TGeoVolume("vertical_inner_frame", vertical_inner_frameS);
379 TGeoVolume* horizontal_inner_frameV = new TGeoVolume("horizontal_inner_frame", horizontal_inner_frameS);
380 TGeoVolume* composite_frameV = new TGeoVolumeAssembly("frame");
381 vertical_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
382 horizontal_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
383 vertical_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
384 horizontal_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
385
386 // media for sensitive volumes
387 TGeoMedium* sensitive_medium = pMedArCO27030; // set medium
388 if (sensitive_medium) {
389 moduleV->SetMedium(sensitive_medium);
390 hot_zoneV->SetMedium(sensitive_medium);
391 } else
392 Fatal("Main", "Invalid medium for sensitive modules!");
393
394 // media for frames
395 TGeoMedium* frame_medium = pMedCarbon; // set medium
396 if (frame_medium) {
397 vertical_outer_frameV->SetMedium(frame_medium);
398 horizontal_outer_frameV->SetMedium(frame_medium);
399 vertical_inner_frameV->SetMedium(frame_medium);
400 horizontal_inner_frameV->SetMedium(frame_medium);
401 composite_frameV->SetMedium(frame_medium);
402 } else
403 Fatal("Main", "Invalid medium for frames!");
404
405 moduleV->SetTransparency(20);
406
407 // hot zone position in the module
408 TGeoTranslation* hot_zone_trans =
411
412 // module positions in the station
413 TGeoCombiTrans* module_left_position = new TGeoCombiTrans();
414 // module_left_position->ReflectX(true);
415 module_left_position->SetTranslation(XModuleSize_StationPrototype * 0.5 - XIntersectionSensModule * 0.5, 0.0,
417
418 TGeoCombiTrans* module_right_position = new TGeoCombiTrans();
419 module_right_position->ReflectX(true);
420 module_right_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 + XIntersectionSensModule * 0.5, 0.0,
421 0.0);
422
423 // frame part positions in the frame
424 TGeoCombiTrans* left_outer_frame_position = new TGeoCombiTrans();
425 left_outer_frame_position->SetTranslation(XModuleSize_StationPrototype * 0.5 + dXOuterFrame * 0.5,
426 (dYOuterFrame - dYInnerFrame) * 0.5,
428
429 TGeoCombiTrans* top_outer_frame_position = new TGeoCombiTrans();
430 top_outer_frame_position->SetTranslation(
432
433 TGeoCombiTrans* right_inner_frame_position = new TGeoCombiTrans();
434 right_inner_frame_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 - dXInnerFrame * 0.5, 0,
435 ZModuleSize * 0.5);
436
437 TGeoCombiTrans* bottom_inner_frame_position = new TGeoCombiTrans();
438 bottom_inner_frame_position->SetTranslation(-dXInnerFrame * 0.5,
441
442 // frame positions in the station
443 TGeoCombiTrans* comp_frame_left_position = new TGeoCombiTrans();
444 // comp_frame_left_position->ReflectX(true);
445 comp_frame_left_position->SetTranslation(module_left_position->GetTranslation());
446
447 TGeoCombiTrans* comp_frame_right_position = new TGeoCombiTrans();
448 comp_frame_right_position->ReflectX(true);
449 comp_frame_right_position->ReflectZ(true);
450 comp_frame_right_position->SetTranslation(module_right_position->GetTranslation());
451
452 // station assembling
453 moduleV->AddNode(hot_zoneV, 0, hot_zone_trans);
454
455 composite_frameV->AddNode(vertical_outer_frameV, 0, left_outer_frame_position);
456 composite_frameV->AddNode(horizontal_outer_frameV, 0, top_outer_frame_position);
457 composite_frameV->AddNode(vertical_inner_frameV, 0, right_inner_frame_position);
458 composite_frameV->AddNode(horizontal_inner_frameV, 0, bottom_inner_frame_position);
459
460 stationA->AddNode(moduleV, 0, module_left_position);
461 stationA->AddNode(moduleV, 1, module_right_position);
462
463 stationA->AddNode(composite_frameV, 0, comp_frame_left_position);
464 stationA->AddNode(composite_frameV, 1, comp_frame_right_position);
465
466 // Station position
467 Double_t station_shift = dZSensitiveVolume * 0.5;
468 TGeoTranslation* station_pos = new TGeoTranslation(x_position, y_position, z_position + station_shift);
469
470 mother_volume->AddNode(stationA, 0, station_pos);
471}
472
474 TString station_name,
475 Double_t x_position,
476 Double_t y_position,
477 Double_t z_position,
478 Double_t hole_radius_with_frame,
479 Bool_t IsInverted)
480{
481 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
482 stationA->SetMedium(pMedAir);
483
484 Double_t XOuterZoneSize = OuterZoneSizes_Station163x45[0];
485 Double_t YOuterZoneSize = OuterZoneSizes_Station163x45[1];
486
487 Double_t XRectangleZoneSize = HotZoneSizes_rectangle_Station163x45[0];
488 Double_t YRectangleZoneSize = HotZoneSizes_rectangle_Station163x45[1];
489
490 Double_t XMinSlopeZoneSize = HotZoneSizes_slope_Station163x45[0];
491 Double_t XMaxSlopeZoneSize = HotZoneSizes_slope_Station163x45[1];
492 Double_t YSlopeZoneSize = HotZoneSizes_slope_Station163x45[2];
493
494 // module shape
495 TString part_module_name = "part_moduleS_" + station_name;
496 TGeoShape* part_moduleS =
497 new TGeoBBox(part_module_name, XOuterZoneSize * 0.5, YOuterZoneSize * 0.5, dZSensitiveVolume * 0.5);
498
499 // part hot zone shapes (without the hole)
500 TString part_rectangle_inner_zone_name = "part_rectangle_inner_zoneS_" + station_name;
501 TGeoShape* part_rectangle_inner_zoneS = new TGeoBBox(part_rectangle_inner_zone_name, XRectangleZoneSize * 0.5,
502 YRectangleZoneSize * 0.5, dZSensitiveVolume * 0.5);
503
504 TString part_slope_inner_zone_name = "part_slope_inner_zoneS_" + station_name;
505 TGeoXtru* part_slope_inner_zoneS = new TGeoXtru(2); // origin centered
506 part_slope_inner_zoneS->SetName(part_slope_inner_zone_name);
507 Double_t x_pos[4] = {XMaxSlopeZoneSize * 0.5, XMaxSlopeZoneSize * 0.5 - (XMaxSlopeZoneSize - XMinSlopeZoneSize),
508 -XMaxSlopeZoneSize * 0.5, -XMaxSlopeZoneSize * 0.5};
509 Double_t y_pos[4] = {-YSlopeZoneSize * 0.5, YSlopeZoneSize * 0.5, YSlopeZoneSize * 0.5, -YSlopeZoneSize * 0.5};
510 part_slope_inner_zoneS->DefinePolygon(4, x_pos, y_pos);
511 part_slope_inner_zoneS->DefineSection(0, -dZSensitiveVolume * 0.5);
512 part_slope_inner_zoneS->DefineSection(1, dZSensitiveVolume * 0.5);
513
514 // hole shape
515 TString hole_name = "holeS_" + station_name;
516 // TGeoShape *holeS = new TGeoTubeSeg(hole_name, 0.0, hole_radius_with_frame, dZSensitiveVolume*0.5 + 0.1,
517 // -1.0, 91.0);
518 TGeoShape* holeS = new TGeoTube(hole_name, 0.0, hole_radius_with_frame, dZSensitiveVolume * 0.5 + 0.01);
519
520 // hole positions in the module and zones to extract the hole
521 TString hole_module_trans_name = "hole_module_trans_name_" + station_name;
522 TGeoTranslation* hole_module_trans =
523 new TGeoTranslation(hole_module_trans_name, -XOuterZoneSize * 0.5, -YOuterZoneSize * 0.5, 0);
524 hole_module_trans->RegisterYourself();
525
526 TString hole_rectangle_inner_zone_trans_name = "hole_rectangle_inner_zone_trans_name_" + station_name;
527 TGeoTranslation* hole_rectangle_inner_zone_trans = new TGeoTranslation(
528 hole_rectangle_inner_zone_trans_name, -XRectangleZoneSize * 0.5, -YRectangleZoneSize * 0.5, 0);
529 hole_rectangle_inner_zone_trans->RegisterYourself();
530
531 TString hole_slope_inner_zone_trans_name = "hole_slope_inner_zone_trans_name_" + station_name;
532 TGeoTranslation* hole_slope_inner_zone_trans =
533 new TGeoTranslation(hole_slope_inner_zone_trans_name, -XMaxSlopeZoneSize * 0.5, -YSlopeZoneSize * 0.5, 0);
534 hole_slope_inner_zone_trans->RegisterYourself();
535
536 // module and hot zone shapes
537 TString bool_expression_module = part_module_name + " - " + hole_name + ":" + hole_module_trans_name;
538 TGeoCompositeShape* moduleS = new TGeoCompositeShape(bool_expression_module);
539
540 TString bool_expression_rectangle_inner_zone =
541 part_rectangle_inner_zone_name + " - " + hole_name + ":" + hole_rectangle_inner_zone_trans_name;
542 TGeoCompositeShape* rectangle_inner_zoneS = new TGeoCompositeShape(bool_expression_rectangle_inner_zone);
543
544 TString bool_expression_slope_inner_zone =
545 part_slope_inner_zone_name + " - " + hole_name + ":" + hole_slope_inner_zone_trans_name;
546 TGeoCompositeShape* slope_inner_zoneS = new TGeoCompositeShape(bool_expression_slope_inner_zone);
547
548 // frame shapes
549 TGeoShape* vertical_frameS = new TGeoBBox("vertical_frameS", dXOuterFrame * 0.5,
550 (YOuterZoneSize + dYInnerFrame + dYOuterFrame) * 0.5, ZModuleSize * 0.5);
551 TGeoShape* horizontal_long_frameS = new TGeoBBox("horizontal_long_frameS", XOuterZoneSize, dYOuterFrame * 0.5,
553 TGeoShape* horizontal_short_frameS =
554 new TGeoBBox("horizontal_short_frameS", (XOuterZoneSize - hole_radius_with_frame + dXInnerFrame) * 0.5,
556 TGeoShape* circle_inner_frameS = new TGeoTubeSeg("circle_inner_frameS", hole_radius_with_frame - dXInnerFrame,
557 hole_radius_with_frame, ZModuleSize * 0.5, 0., -180.0);
558
559 // Volumes
560 TGeoVolume* module_with_slope_inner_zoneV = new TGeoVolume("module_Sensor", moduleS);
561 TGeoVolume* module_with_rect_inner_zoneV = new TGeoVolume("module_Sensor", moduleS);
562
563 TGeoVolume* rectangle_inner_zoneV = new TGeoVolume("inner_zone_Sensor", rectangle_inner_zoneS);
564 TGeoVolume* slope_inner_zoneV = new TGeoVolume("inner_zone_Sensor", slope_inner_zoneS);
565
566 TGeoVolume* vertical_frameV = new TGeoVolume("vertical_frame", vertical_frameS);
567 TGeoVolume* horizontal_long_frameV = new TGeoVolume("horizontal_long_frame", horizontal_long_frameS);
568 TGeoVolume* horizontal_short_frameV = new TGeoVolume("horizontal_short_frame", horizontal_short_frameS);
569 TGeoVolume* circle_inner_frameV = new TGeoVolume("circle_inner_frame", circle_inner_frameS);
570 TGeoVolume* composite_frameV = new TGeoVolumeAssembly("frame");
571
572 // media for sensitive volumes
573 TGeoMedium* sensitive_medium = pMedArCO27030; // set medium
574 if (sensitive_medium) {
575 module_with_slope_inner_zoneV->SetMedium(sensitive_medium);
576 module_with_rect_inner_zoneV->SetMedium(sensitive_medium);
577 rectangle_inner_zoneV->SetMedium(sensitive_medium);
578 slope_inner_zoneV->SetMedium(sensitive_medium);
579 } else
580 Fatal("Main", "Invalid medium for sensitive modules!");
581
582 // media for frames
583 TGeoMedium* frame_medium = pMedCarbon; // set medium
584 if (frame_medium) {
585 vertical_frameV->SetMedium(frame_medium);
586 horizontal_long_frameV->SetMedium(frame_medium);
587 horizontal_short_frameV->SetMedium(frame_medium);
588 circle_inner_frameV->SetMedium(frame_medium);
589 composite_frameV->SetMedium(frame_medium);
590 } else
591 Fatal("Main", "Invalid medium for frames!");
592
593 // volume visual properties
594 module_with_slope_inner_zoneV->SetTransparency(20);
595 module_with_rect_inner_zoneV->SetTransparency(20);
596 module_with_slope_inner_zoneV->SetLineColor(TColor::GetColor("#ff47ca"));
597 module_with_rect_inner_zoneV->SetLineColor(TColor::GetColor("#ff47ca"));
598 rectangle_inner_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
599 slope_inner_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
600 vertical_frameV->SetLineColor(TColor::GetColor("#9999ff"));
601 horizontal_long_frameV->SetLineColor(TColor::GetColor("#9999ff"));
602 horizontal_short_frameV->SetLineColor(TColor::GetColor("#9999ff"));
603 circle_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
604
605 // hot zone positions in modules
606 TGeoTranslation* slope_inner_zone_position = new TGeoTranslation(-XOuterZoneSize * 0.5 + XMaxSlopeZoneSize * 0.5,
607 -YOuterZoneSize * 0.5 + YSlopeZoneSize * 0.5, 0);
608 TGeoTranslation* rect_inner_zone_position = new TGeoTranslation(
609 -XOuterZoneSize * 0.5 + XRectangleZoneSize * 0.5, -YOuterZoneSize * 0.5 + YRectangleZoneSize * 0.5, 0);
610
611 // module positions in the station
612 TGeoCombiTrans* left_module_position = new TGeoCombiTrans();
613 left_module_position->SetTranslation(XOuterZoneSize * 0.5, 0.0, 0.0);
614
615 TGeoCombiTrans* right_module_position = new TGeoCombiTrans();
616 right_module_position->RotateY(180.0);
617 right_module_position->SetTranslation(-XOuterZoneSize * 0.5, 0.0, 0.0);
618
619 // frame part positions in the frame
620 TGeoTranslation* left_frame_position = new TGeoTranslation(XOuterZoneSize + dXOuterFrame * 0.5,
621 (dYOuterFrame - dYInnerFrame) * 0.5, ZModuleSize * 0.5);
622 TGeoTranslation* right_frame_position = new TGeoTranslation(-(XOuterZoneSize + dXOuterFrame * 0.5),
623 (dYOuterFrame - dYInnerFrame) * 0.5, ZModuleSize * 0.5);
624 TGeoTranslation* top_long_frame_position = new TGeoTranslation(
625 0, YOuterZoneSize * 0.5 + dYOuterFrame * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
626 TGeoTranslation* left_top_short_frame_position = new TGeoTranslation(
627 (XOuterZoneSize - hole_radius_with_frame - dXInnerFrame) * 0.5 + hole_radius_with_frame,
628 -dYInnerFrame * 0.5 - YOuterZoneSize * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
629 TGeoTranslation* right_bottom_short_frame_position = new TGeoTranslation(
630 -((XOuterZoneSize - hole_radius_with_frame - dXInnerFrame) * 0.5 + hole_radius_with_frame),
631 -dYInnerFrame * 0.5 - YOuterZoneSize * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
632 TGeoTranslation* left_bottom_short_frame_position = new TGeoTranslation(
633 ((XOuterZoneSize - hole_radius_with_frame - dXInnerFrame) * 0.5 + hole_radius_with_frame),
634 -dYInnerFrame * 0.5 - YOuterZoneSize * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
635
636 // frame positions in the station
637 TGeoCombiTrans* upper_frame_trans = new TGeoCombiTrans();
638 upper_frame_trans->SetTranslation(0.0, 0.0, -dZSensitiveVolume * 0.5);
639
640 // station assembling
641 module_with_slope_inner_zoneV->AddNode(slope_inner_zoneV, 0, slope_inner_zone_position);
642 module_with_rect_inner_zoneV->AddNode(rectangle_inner_zoneV, 0, rect_inner_zone_position);
643
644 if (IsInverted) {
645 stationA->AddNode(module_with_rect_inner_zoneV, 0, left_module_position);
646 stationA->AddNode(module_with_slope_inner_zoneV, 1, right_module_position);
647 } else {
648 stationA->AddNode(module_with_slope_inner_zoneV, 0, left_module_position);
649 stationA->AddNode(module_with_rect_inner_zoneV, 1, right_module_position);
650 }
651
652 // frames
653 composite_frameV->AddNode(vertical_frameV, 0, left_frame_position);
654 composite_frameV->AddNode(vertical_frameV, 1, right_frame_position);
655 composite_frameV->AddNode(horizontal_long_frameV, 0, top_long_frame_position);
656 composite_frameV->AddNode(horizontal_short_frameV, 0, left_bottom_short_frame_position);
657 composite_frameV->AddNode(horizontal_short_frameV, 1, right_bottom_short_frame_position);
658 composite_frameV->AddNode(circle_inner_frameV, 0, new TGeoTranslation(0, -YOuterZoneSize * 0.5, ZModuleSize * 0.5));
659
660 stationA->AddNode(composite_frameV, 0, upper_frame_trans);
661
662 // Station position
663 Double_t station_shift = 0.0;
664 station_shift = dZSensitiveVolume * 0.5;
665 TGeoTranslation* station_pos = new TGeoTranslation(x_position, y_position, z_position + station_shift);
666
667 mother_volume->AddNode(stationA, 0, station_pos);
668}
669
670//------------------------------------------------------------------------------
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
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 ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE) override
const Double_t * GetTranslation() const override
void RotateY(Double_t angle) override
void SetTranslation(const TGeoTranslation &tr)
void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE) override
void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE) override
virtual void RegisterYourself()
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
Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv)
virtual void DefineSection(Int_t snum, Double_t z, Double_t x0=0., Double_t y0=0., Double_t scale=1.)
virtual void SetName(const char *name)
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
TGeoMedium * pMedAir
TGeoMedium * pMedCarbon
TGeoManager * gGeoMan
TGeoMedium * pMedArCO27030
TGeoMedium * pMedFiberGlass
TGeoMedium * pMedCopper
const Double_t dXOuterFrame
const Double_t dZSensitiveVolume
const Int_t nStations
const Double_t dXInnerFrame
const Double_t dYOuterFrame
const Double_t dYInnerFrame
const Double_t XModuleSize_StationPrototype
const Double_t XHotZoneSize_StationPrototype
const Double_t OuterZoneSizes_Station163x45[2]
const Double_t HotZoneSizes_rectangle_Station163x45[2]
const Double_t HoleRadius_Station163x45
const Double_t HotZoneSizes_slope_Station163x45[3]
const Double_t YHotZoneSize_StationPrototype
const Double_t YModuleSize_StationPrototype
const Double_t XIntersectionSensModule
void CreateStation_One66x41Plane(TGeoVolume *mother_volume, TString station_name, Double_t x_position, Double_t y_position, Double_t z_position, Bool_t IsInverted)
void CreateStation_Two66x41Plane(TGeoVolume *mother_volume, TString station_name, Double_t x_position, Double_t y_position, Double_t z_position)
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
void create_rootgeom_GEMS_1stConfig()
void CreateStation_One163x45Plane(TGeoVolume *mother_volume, TString station_name, Double_t x_position, Double_t y_position, Double_t z_position, Double_t hole_radius_with_frame, Bool_t IsInverted)