BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_GEMS_2ndConfig.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 = 7;
17
18// Station Parameters
19/*
20const Double_t XStationPositions[nStations] = {-2.2, 0.5, 0.7, 1.0, 1.4, 2.1, 2.9};
21const Double_t YStationPositions[nStations] = {0.0, 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, 160.0}; // z pos is the first
23surface of the first sens. volume in module !!!
24*/
25
27XStationPositions[0] = BmnGemStripPositions_SecondConfig::XStationPositions[0];
28XStationPositions[1] = BmnGemStripPositions_SecondConfig::XStationPositions[1];
29XStationPositions[2] = BmnGemStripPositions_SecondConfig::XStationPositions[2];
30XStationPositions[3] = BmnGemStripPositions_SecondConfig::XStationPositions[3];
31XStationPositions[4] = BmnGemStripPositions_SecondConfig::XStationPositions[4];
32XStationPositions[5] = BmnGemStripPositions_SecondConfig::XStationPositions[5];
33XStationPositions[6] = BmnGemStripPositions_SecondConfig::XStationPositions[6];
34
36YStationPositions[0] = BmnGemStripPositions_SecondConfig::YStationPositions[0];
37YStationPositions[1] = BmnGemStripPositions_SecondConfig::YStationPositions[1];
38YStationPositions[2] = BmnGemStripPositions_SecondConfig::YStationPositions[2];
39YStationPositions[3] = BmnGemStripPositions_SecondConfig::YStationPositions[3];
40YStationPositions[4] = BmnGemStripPositions_SecondConfig::YStationPositions[4];
41YStationPositions[5] = BmnGemStripPositions_SecondConfig::YStationPositions[5];
42YStationPositions[6] = BmnGemStripPositions_SecondConfig::YStationPositions[6];
43
45ZStationPositions[0] = BmnGemStripPositions_SecondConfig::ZStationPositions[0];
46ZStationPositions[1] = BmnGemStripPositions_SecondConfig::ZStationPositions[1];
47ZStationPositions[2] = BmnGemStripPositions_SecondConfig::ZStationPositions[2];
48ZStationPositions[3] = BmnGemStripPositions_SecondConfig::ZStationPositions[3];
49ZStationPositions[4] = BmnGemStripPositions_SecondConfig::ZStationPositions[4];
50ZStationPositions[5] = BmnGemStripPositions_SecondConfig::ZStationPositions[5];
51ZStationPositions[6] = BmnGemStripPositions_SecondConfig::ZStationPositions[6];
52
53// GEM plane sizes (66x41 type)
56
59
62
63// GEM plane sizes (163x45 type)
64const Double_t OuterZoneSizes_Station163x45[2] = {163.2 * 0.5, 45.0}; // {xsize, ysize}
65const Double_t HotZoneSizes_rectangle_Station163x45[2] = {40.0, 15.0}; // {xsize, ysize}
66const Double_t HotZoneSizes_slope_Station163x45[3] = {37.99, 42.01, 15.0}; // {xmin_size, xmax_size, ysize}
67const Double_t HoleRadius_Station163x45 = 4.0; // cm (real hole without the circle frame)
68
69// Module Parameters
76
77// media
83
84class FairGeoMedia;
85class FairGeoBuilder;
86
87void DefineRequiredMedia(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
88{
89 // air medium
90 FairGeoMedium* mAir = geoMedia->getMedium("air");
91 if (!mAir)
92 Fatal("Main", "FairMedium air not found");
93 geoBuild->createMedium(mAir);
94 pMedAir = gGeoManager->GetMedium("air");
95 if (!pMedAir)
96 Fatal("Main", "Medium air not found");
97
98 // carbon medium
99 FairGeoMedium* mCarbon = geoMedia->getMedium("carbon");
100 if (!mCarbon)
101 Fatal("Main", "FairMedium carbon not found");
102 geoBuild->createMedium(mCarbon);
103 pMedCarbon = gGeoManager->GetMedium("carbon");
104 if (!pMedCarbon)
105 Fatal("Main", "Medium carbon not found");
106
107 // fiberglass medium
108 FairGeoMedium* mFiberGlass = geoMedia->getMedium("fiberglass");
109 if (!mFiberGlass)
110 Fatal("Main", "FairMedium fiberglass not found");
111 geoBuild->createMedium(mFiberGlass);
112 pMedFiberGlass = gGeoManager->GetMedium("fiberglass");
113 if (!pMedFiberGlass)
114 Fatal("Main", "Medium fiberglass not found");
115
116 // arco27020 medium
117 FairGeoMedium* mArCO27030 = geoMedia->getMedium("arco27030");
118 if (!mArCO27030)
119 Fatal("Main", "FairMedium arco27030 not found");
120 geoBuild->createMedium(mArCO27030);
121 pMedArCO27030 = gGeoManager->GetMedium("arco27030");
122 if (!pMedArCO27030)
123 Fatal("Main", "Medium arco27030 not found");
124}
125
127{
128
129 // Load the necessary FairRoot libraries
130 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
131 bmnloadlibs(); // load libraries
132
133 // ---- set working directory --------------------------------------------
134 TString gPath = gSystem->Getenv("VMCWORKDIR");
135
136 // ------- Geometry file name (output) ----------------------------------
137 const TString geoDetectorName = "GEMS";
138 const TString geoDetectorVersion = "2ndConfig";
139 const TString geoFileName = gPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
140
141 // ---- global geometry parameters ---------------------------------------
142 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
143 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
144
145 // ------- Load media from media file ----------------------------------
146 TString medFile = gPath + "/geometry/media.geo";
147 geoFace->setMediaFile(medFile);
148 geoFace->readMedia();
149 FairGeoMedia* geoMedia = geoFace->getMedia();
150 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
151
152 DefineRequiredMedia(geoMedia, geoBuild);
153 // -------------------------------------------------------------------------
154
155 // -------------- Create geometry and top volume -------------------------
156 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
157 gGeoMan->SetName(geoDetectorName + "_geom");
158 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
159 top->SetMedium(pMedAir);
160 gGeoMan->SetTopVolume(top);
161 // gGeoMan->SetTopVisible(1);
162 // --------------------------------------------------------------------------
163
164 // Define TOP Geometry
165 TGeoVolume* GEMS = new TGeoVolumeAssembly(geoDetectorName);
166 GEMS->SetMedium(pMedAir);
167
168 // station creating
169
171 kFALSE);
172
177
186
187 top->AddNode(GEMS, 0);
189
190 // --------------- Finish -----------------------------------------------
191 gGeoMan->CloseGeometry();
192 gGeoMan->CheckOverlaps(0.0001);
193 gGeoMan->PrintOverlaps();
194 gGeoMan->Test();
195
196 TFile* geoFile = new TFile(geoFileName, "RECREATE");
197 top->Write();
198 geoFile->Close();
199 top->Draw("ogl");
200}
201
202//------------------------------------------------------------------------------
204 TString station_name,
205 Double_t x_position,
206 Double_t y_position,
207 Double_t z_position,
208 Bool_t IsInverted)
209{
210 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
211 stationA->SetMedium(pMedAir);
212
213 // sensitive shapes
215 dZSensitiveVolume * 0.5);
216 TGeoShape* hot_zoneS = new TGeoBBox("hot_zoneS", XHotZoneSize_StationPrototype * 0.5,
218
219 // frame shapes
220 TGeoShape* vertical_outer_frameS =
221 new TGeoBBox("vertical_outer_frameS", dXOuterFrame * 0.5,
223 TGeoShape* horizontal_outer_frameS =
224 new TGeoBBox("horizontal_outer_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYOuterFrame * 0.5,
226 TGeoShape* vertical_inner_frameS =
227 new TGeoBBox("vertical_inner_frameS", dXInnerFrame * 0.5, YModuleSize_StationPrototype * 0.5,
229 TGeoShape* horizontal_inner_frameS =
230 new TGeoBBox("horizontal_inner_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYInnerFrame * 0.5,
231 ZModuleSize * 0.5);
232
233 /*
234 TGeoXtru *moduleS = new TGeoXtru(2);
235 Double_t x_pos[6] = {XModuleSize_StationPrototype, XModuleSize_StationPrototype, 0.0, 0.0,
236 XHotZoneSize_StationPrototype, XHotZoneSize_StationPrototype}; Double_t y_pos[6] = {0.0,
237 YModuleSize_StationPrototype, YModuleSize_StationPrototype, YHotZoneSize_StationPrototype,
238 YHotZoneSize_StationPrototype, 0.0}; moduleS->DefinePolygon(6, x_pos, y_pos); moduleS->DefineSection(0,
239 -dZSensitiveVolume*0.5); moduleS->DefineSection(1, dZSensitiveVolume*0.5);
240 */
241 // sensitive volumes
242 TGeoVolume* moduleV = new TGeoVolume("module_Sensor", moduleS);
243 TGeoVolume* hot_zoneV = new TGeoVolume("hot_zone_Sensor", hot_zoneS);
244 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
245 hot_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
246
247 // frame volumes
248 TGeoVolume* vertical_outer_frameV = new TGeoVolume("vertical_outer_frame", vertical_outer_frameS);
249 TGeoVolume* horizontal_outer_frameV = new TGeoVolume("horizontal_outer_frame", horizontal_outer_frameS);
250 TGeoVolume* vertical_inner_frameV = new TGeoVolume("vertical_inner_frame", vertical_inner_frameS);
251 TGeoVolume* horizontal_inner_frameV = new TGeoVolume("horizontal_inner_frame", horizontal_inner_frameS);
252 TGeoVolume* composite_frameV = new TGeoVolumeAssembly("frame");
253 vertical_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
254 horizontal_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
255 vertical_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
256 horizontal_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
257
258 // media for sensitive volumes
259 TGeoMedium* sensitive_medium = pMedArCO27030; // set medium
260 if (sensitive_medium) {
261 moduleV->SetMedium(sensitive_medium);
262 hot_zoneV->SetMedium(sensitive_medium);
263 } else
264 Fatal("Main", "Invalid medium for sensitive modules!");
265
266 // media for frames
267 TGeoMedium* frame_medium = pMedCarbon; // set medium
268 if (frame_medium) {
269 vertical_outer_frameV->SetMedium(frame_medium);
270 horizontal_outer_frameV->SetMedium(frame_medium);
271 vertical_inner_frameV->SetMedium(frame_medium);
272 horizontal_inner_frameV->SetMedium(frame_medium);
273 composite_frameV->SetMedium(frame_medium);
274 } else
275 Fatal("Main", "Invalid medium for frames!");
276
277 moduleV->SetTransparency(20);
278
279 // hot zone position in the module
280 TGeoTranslation* hot_zone_trans =
283
284 // module positions in the station
285 TGeoCombiTrans* module_center_position = new TGeoCombiTrans();
286 module_center_position->ReflectX(true);
287 if (IsInverted) {
288 module_center_position->ReflectY(true);
289 }
290 // module_center_position->SetTranslation(0.0, 0.0, 0.0);
291
292 // frame part positions in the frame
293 TGeoCombiTrans* left_outer_frame_position = new TGeoCombiTrans();
294 left_outer_frame_position->SetTranslation(XModuleSize_StationPrototype * 0.5 + dXOuterFrame * 0.5,
295 (dYOuterFrame - dYInnerFrame) * 0.5,
297
298 TGeoCombiTrans* top_outer_frame_position = new TGeoCombiTrans();
299 top_outer_frame_position->SetTranslation(
301
302 TGeoCombiTrans* right_inner_frame_position = new TGeoCombiTrans();
303 right_inner_frame_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 - dXInnerFrame * 0.5, 0,
304 ZModuleSize * 0.5);
305
306 TGeoCombiTrans* bottom_inner_frame_position = new TGeoCombiTrans();
307 bottom_inner_frame_position->SetTranslation(-dXInnerFrame * 0.5,
310
311 // frame positions in the station
312 TGeoCombiTrans* comp_frame_center_position = new TGeoCombiTrans();
313 comp_frame_center_position->ReflectX(true);
314 if (IsInverted) {
315 comp_frame_center_position->ReflectY(true);
316 }
317 // comp_frame_center_position->SetTranslation(module_center_position->GetTranslation());
318
319 // station assembling
320 moduleV->AddNode(hot_zoneV, 0, hot_zone_trans);
321
322 composite_frameV->AddNode(vertical_outer_frameV, 0, left_outer_frame_position);
323 composite_frameV->AddNode(horizontal_outer_frameV, 0, top_outer_frame_position);
324 composite_frameV->AddNode(vertical_inner_frameV, 0, right_inner_frame_position);
325 composite_frameV->AddNode(horizontal_inner_frameV, 0, bottom_inner_frame_position);
326
327 stationA->AddNode(moduleV, 0, module_center_position);
328
329 stationA->AddNode(composite_frameV, 0, comp_frame_center_position);
330
331 // Station position
332 Double_t station_shift = dZSensitiveVolume * 0.5;
333 TGeoTranslation* station_pos = new TGeoTranslation(x_position, y_position, z_position + station_shift);
334
335 mother_volume->AddNode(stationA, 0, station_pos);
336}
337
339 TString station_name,
340 Double_t x_position,
341 Double_t y_position,
342 Double_t z_position,
343 Double_t IsInverted)
344{
345 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
346 stationA->SetMedium(pMedAir);
347
348 // sensitive shapes
350 dZSensitiveVolume * 0.5);
351 TGeoShape* hot_zoneS = new TGeoBBox("hot_zoneS", XHotZoneSize_StationPrototype * 0.5,
353
354 // frame shapes
355 TGeoShape* vertical_outer_frameS =
356 new TGeoBBox("vertical_outer_frameS", dXOuterFrame * 0.5,
358 TGeoShape* horizontal_outer_frameS =
359 new TGeoBBox("horizontal_outer_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYOuterFrame * 0.5,
361 TGeoShape* vertical_inner_frameS =
362 new TGeoBBox("vertical_inner_frameS", dXInnerFrame * 0.5, YModuleSize_StationPrototype * 0.5,
364 TGeoShape* horizontal_inner_frameS =
365 new TGeoBBox("horizontal_inner_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYInnerFrame * 0.5,
366 ZModuleSize * 0.5);
367
368 /*
369 TGeoXtru *moduleS = new TGeoXtru(2);
370 Double_t x_pos[6] = {XModuleSize_StationPrototype, XModuleSize_StationPrototype, 0.0, 0.0,
371 XHotZoneSize_StationPrototype, XHotZoneSize_StationPrototype}; Double_t y_pos[6] = {0.0,
372 YModuleSize_StationPrototype, YModuleSize_StationPrototype, YHotZoneSize_StationPrototype,
373 YHotZoneSize_StationPrototype, 0.0}; moduleS->DefinePolygon(6, x_pos, y_pos); moduleS->DefineSection(0,
374 -dZSensitiveVolume*0.5); moduleS->DefineSection(1, dZSensitiveVolume*0.5);
375 */
376 // sensitive volumes
377 TGeoVolume* moduleV = new TGeoVolume("module_Sensor", moduleS);
378 TGeoVolume* hot_zoneV = new TGeoVolume("hot_zone_Sensor", hot_zoneS);
379 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
380 hot_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
381
382 // frame volumes
383 TGeoVolume* vertical_outer_frameV = new TGeoVolume("vertical_outer_frame", vertical_outer_frameS);
384 TGeoVolume* horizontal_outer_frameV = new TGeoVolume("horizontal_outer_frame", horizontal_outer_frameS);
385 TGeoVolume* vertical_inner_frameV = new TGeoVolume("vertical_inner_frame", vertical_inner_frameS);
386 TGeoVolume* horizontal_inner_frameV = new TGeoVolume("horizontal_inner_frame", horizontal_inner_frameS);
387 TGeoVolume* composite_frameV = new TGeoVolumeAssembly("frame");
388 vertical_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
389 horizontal_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
390 vertical_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
391 horizontal_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
392
393 // media for sensitive volumes
394 TGeoMedium* sensitive_medium = pMedArCO27030; // set medium
395 if (sensitive_medium) {
396 moduleV->SetMedium(sensitive_medium);
397 hot_zoneV->SetMedium(sensitive_medium);
398 } else
399 Fatal("Main", "Invalid medium for sensitive modules!");
400
401 // media for frames
402 TGeoMedium* frame_medium = pMedCarbon; // set medium
403 if (frame_medium) {
404 vertical_outer_frameV->SetMedium(frame_medium);
405 horizontal_outer_frameV->SetMedium(frame_medium);
406 vertical_inner_frameV->SetMedium(frame_medium);
407 horizontal_inner_frameV->SetMedium(frame_medium);
408 composite_frameV->SetMedium(frame_medium);
409 } else
410 Fatal("Main", "Invalid medium for frames!");
411
412 moduleV->SetTransparency(20);
413 composite_frameV->SetTransparency(20);
414
415 // hot zone position in the module
416 TGeoTranslation* hot_zone_trans =
419
420 // module positions in the station
421 TGeoCombiTrans* module_left_position = new TGeoCombiTrans();
422 // module_left_position->ReflectX(true);
423 module_left_position->SetTranslation(XModuleSize_StationPrototype * 0.5 - XIntersectionSensModule * 0.5, 0.0,
425
426 TGeoCombiTrans* module_right_position = new TGeoCombiTrans();
427 module_right_position->ReflectX(true);
428 module_right_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 + XIntersectionSensModule * 0.5, 0.0,
429 0.0);
430
431 // frame part positions in the frame
432 TGeoCombiTrans* left_outer_frame_position = new TGeoCombiTrans();
433 left_outer_frame_position->SetTranslation(XModuleSize_StationPrototype * 0.5 + dXOuterFrame * 0.5,
434 (dYOuterFrame - dYInnerFrame) * 0.5,
436
437 TGeoCombiTrans* top_outer_frame_position = new TGeoCombiTrans();
438 top_outer_frame_position->SetTranslation(
440
441 TGeoCombiTrans* right_inner_frame_position = new TGeoCombiTrans();
442 right_inner_frame_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 - dXInnerFrame * 0.5, 0,
443 ZModuleSize * 0.5);
444
445 TGeoCombiTrans* bottom_inner_frame_position = new TGeoCombiTrans();
446 bottom_inner_frame_position->SetTranslation(-dXInnerFrame * 0.5,
449
450 // frame positions in the station
451 TGeoCombiTrans* comp_frame_left_position = new TGeoCombiTrans();
452 // comp_frame_left_position->ReflectX(true);
453 comp_frame_left_position->SetTranslation(module_left_position->GetTranslation());
454
455 TGeoCombiTrans* comp_frame_right_position = new TGeoCombiTrans();
456 comp_frame_right_position->ReflectX(true);
457 comp_frame_right_position->ReflectZ(true);
458 comp_frame_right_position->SetTranslation(module_right_position->GetTranslation());
459
460 // station assembling
461 moduleV->AddNode(hot_zoneV, 0, hot_zone_trans);
462
463 composite_frameV->AddNode(vertical_outer_frameV, 0, left_outer_frame_position);
464 composite_frameV->AddNode(horizontal_outer_frameV, 0, top_outer_frame_position);
465 composite_frameV->AddNode(vertical_inner_frameV, 0, right_inner_frame_position);
466 composite_frameV->AddNode(horizontal_inner_frameV, 0, bottom_inner_frame_position);
467
468 stationA->AddNode(moduleV, 0, module_left_position);
469 stationA->AddNode(moduleV, 1, module_right_position);
470
471 stationA->AddNode(composite_frameV, 0, comp_frame_left_position);
472 stationA->AddNode(composite_frameV, 1, comp_frame_right_position);
473
474 // Station position
475 Double_t station_shift = dZSensitiveVolume * 0.5;
476 TGeoCombiTrans* station_pos = new TGeoCombiTrans();
477 if (IsInverted) {
478 station_pos->RotateX(180.0);
479 station_shift += dZSensitiveVolume;
480 }
481 station_pos->SetTranslation(x_position, y_position, z_position + station_shift);
482 mother_volume->AddNode(stationA, 0, station_pos);
483}
484
486 TString station_name,
487 Double_t x_position,
488 Double_t y_position,
489 Double_t z_position)
490{
491 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
492 stationA->SetMedium(pMedAir);
493
494 // sensitive shapes
496 dZSensitiveVolume * 0.5);
497 TGeoShape* hot_zoneS = new TGeoBBox("hot_zoneS", XHotZoneSize_StationPrototype * 0.5,
499
500 // frame shapes
501 TGeoShape* vertical_outer_frameS =
502 new TGeoBBox("vertical_outer_frameS", dXOuterFrame * 0.5,
504 TGeoShape* horizontal_outer_frameS =
505 new TGeoBBox("horizontal_outer_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYOuterFrame * 0.5,
507 TGeoShape* vertical_inner_frameS =
508 new TGeoBBox("vertical_inner_frameS", dXInnerFrame * 0.5, YModuleSize_StationPrototype * 0.5,
510 TGeoShape* horizontal_inner_frameS =
511 new TGeoBBox("horizontal_inner_frameS", (XModuleSize_StationPrototype + dXInnerFrame) * 0.5, dYInnerFrame * 0.5,
512 ZModuleSize * 0.5);
513
514 /*
515 TGeoXtru *moduleS = new TGeoXtru(2);
516 Double_t x_pos[6] = {XModuleSize_StationPrototype, XModuleSize_StationPrototype, 0.0, 0.0,
517 XHotZoneSize_StationPrototype, XHotZoneSize_StationPrototype}; Double_t y_pos[6] = {0.0,
518 YModuleSize_StationPrototype, YModuleSize_StationPrototype, YHotZoneSize_StationPrototype,
519 YHotZoneSize_StationPrototype, 0.0}; moduleS->DefinePolygon(6, x_pos, y_pos); moduleS->DefineSection(0,
520 -dZSensitiveVolume*0.5); moduleS->DefineSection(1, dZSensitiveVolume*0.5);
521 */
522 // sensitive volumes
523 TGeoVolume* moduleV = new TGeoVolume("module_Sensor", moduleS);
524 TGeoVolume* hot_zoneV = new TGeoVolume("hot_zone_Sensor", hot_zoneS);
525 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
526 hot_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
527
528 // frame volumes
529 TGeoVolume* vertical_outer_frameV = new TGeoVolume("vertical_outer_frame", vertical_outer_frameS);
530 TGeoVolume* horizontal_outer_frameV = new TGeoVolume("horizontal_outer_frame", horizontal_outer_frameS);
531 TGeoVolume* vertical_inner_frameV = new TGeoVolume("vertical_inner_frame", vertical_inner_frameS);
532 TGeoVolume* horizontal_inner_frameV = new TGeoVolume("horizontal_inner_frame", horizontal_inner_frameS);
533 TGeoVolume* composite_frameV = new TGeoVolumeAssembly("frame");
534 vertical_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
535 horizontal_outer_frameV->SetLineColor(TColor::GetColor("#9999ff"));
536 vertical_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
537 horizontal_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
538
539 // media for sensitive volumes
540 TGeoMedium* sensitive_medium = pMedArCO27030; // set medium
541 if (sensitive_medium) {
542 moduleV->SetMedium(sensitive_medium);
543 hot_zoneV->SetMedium(sensitive_medium);
544 } else
545 Fatal("Main", "Invalid medium for sensitive modules!");
546
547 // media for frames
548 TGeoMedium* frame_medium = pMedCarbon; // set medium
549 if (frame_medium) {
550 vertical_outer_frameV->SetMedium(frame_medium);
551 horizontal_outer_frameV->SetMedium(frame_medium);
552 vertical_inner_frameV->SetMedium(frame_medium);
553 horizontal_inner_frameV->SetMedium(frame_medium);
554 composite_frameV->SetMedium(frame_medium);
555 } else
556 Fatal("Main", "Invalid medium for frames!");
557
558 moduleV->SetTransparency(20);
559
560 // hot zone position in the module
561 TGeoTranslation* hot_zone_trans =
564
565 // module positions in the station
566 TGeoCombiTrans* module_left_position = new TGeoCombiTrans();
567 // module_left_position->ReflectX(true);
568 module_left_position->SetTranslation(XModuleSize_StationPrototype * 0.5 + XDistanceSensModule * 0.5, 0.0, 0.0);
569
570 TGeoCombiTrans* module_right_position = new TGeoCombiTrans();
571 module_right_position->ReflectX(true);
572 module_right_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 - XDistanceSensModule * 0.5, 0.0, 0.0);
573
574 // frame part positions in the frame
575 TGeoCombiTrans* left_outer_frame_position = new TGeoCombiTrans();
576 left_outer_frame_position->SetTranslation(XModuleSize_StationPrototype * 0.5 + dXOuterFrame * 0.5,
577 (dYOuterFrame - dYInnerFrame) * 0.5,
579
580 TGeoCombiTrans* top_outer_frame_position = new TGeoCombiTrans();
581 top_outer_frame_position->SetTranslation(
583
584 TGeoCombiTrans* right_inner_frame_position = new TGeoCombiTrans();
585 right_inner_frame_position->SetTranslation(-XModuleSize_StationPrototype * 0.5 - dXInnerFrame * 0.5, 0,
586 ZModuleSize * 0.5);
587
588 TGeoCombiTrans* bottom_inner_frame_position = new TGeoCombiTrans();
589 bottom_inner_frame_position->SetTranslation(-dXInnerFrame * 0.5,
592
593 // frame positions in the station
594 TGeoCombiTrans* comp_frame_left_position = new TGeoCombiTrans();
595 // comp_frame_left_position->ReflectX(true);
596 comp_frame_left_position->SetTranslation(module_left_position->GetTranslation());
597
598 TGeoCombiTrans* comp_frame_right_position = new TGeoCombiTrans();
599 comp_frame_right_position->ReflectX(true);
600 comp_frame_right_position->ReflectZ(true);
601 comp_frame_right_position->SetTranslation(module_right_position->GetTranslation());
602
603 // station assembling
604 moduleV->AddNode(hot_zoneV, 0, hot_zone_trans);
605
606 composite_frameV->AddNode(vertical_outer_frameV, 0, left_outer_frame_position);
607 composite_frameV->AddNode(horizontal_outer_frameV, 0, top_outer_frame_position);
608 composite_frameV->AddNode(vertical_inner_frameV, 0, right_inner_frame_position);
609 composite_frameV->AddNode(horizontal_inner_frameV, 0, bottom_inner_frame_position);
610
611 stationA->AddNode(moduleV, 0, module_left_position);
612 stationA->AddNode(moduleV, 1, module_right_position);
613
614 stationA->AddNode(composite_frameV, 0, comp_frame_left_position);
615 stationA->AddNode(composite_frameV, 1, comp_frame_right_position);
616
617 // Station position
618 Double_t station_shift = dZSensitiveVolume * 0.5;
619 TGeoTranslation* station_pos = new TGeoTranslation(x_position, y_position, z_position + station_shift);
620
621 mother_volume->AddNode(stationA, 0, station_pos);
622}
623
625 TString station_name,
626 Double_t x_position,
627 Double_t y_position,
628 Double_t z_position,
629 Double_t hole_radius_with_frame,
630 Bool_t IsInverted)
631{
632 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
633 stationA->SetMedium(pMedAir);
634
635 Double_t XOuterZoneSize = OuterZoneSizes_Station163x45[0];
636 Double_t YOuterZoneSize = OuterZoneSizes_Station163x45[1];
637
638 Double_t XRectangleZoneSize = HotZoneSizes_rectangle_Station163x45[0];
639 Double_t YRectangleZoneSize = HotZoneSizes_rectangle_Station163x45[1];
640
641 Double_t XMinSlopeZoneSize = HotZoneSizes_slope_Station163x45[0];
642 Double_t XMaxSlopeZoneSize = HotZoneSizes_slope_Station163x45[1];
643 Double_t YSlopeZoneSize = HotZoneSizes_slope_Station163x45[2];
644
645 // module shape
646 TString part_module_name = "part_moduleS_" + station_name;
647 TGeoShape* part_moduleS =
648 new TGeoBBox(part_module_name, XOuterZoneSize * 0.5, YOuterZoneSize * 0.5, dZSensitiveVolume * 0.5);
649
650 // part hot zone shapes (without the hole)
651 TString part_rectangle_inner_zone_name = "part_rectangle_inner_zoneS_" + station_name;
652 TGeoShape* part_rectangle_inner_zoneS = new TGeoBBox(part_rectangle_inner_zone_name, XRectangleZoneSize * 0.5,
653 YRectangleZoneSize * 0.5, dZSensitiveVolume * 0.5);
654
655 TString part_slope_inner_zone_name = "part_slope_inner_zoneS_" + station_name;
656 TGeoXtru* part_slope_inner_zoneS = new TGeoXtru(2); // origin centered
657 part_slope_inner_zoneS->SetName(part_slope_inner_zone_name);
658 Double_t x_pos[4] = {XMaxSlopeZoneSize * 0.5, XMaxSlopeZoneSize * 0.5 - (XMaxSlopeZoneSize - XMinSlopeZoneSize),
659 -XMaxSlopeZoneSize * 0.5, -XMaxSlopeZoneSize * 0.5};
660 Double_t y_pos[4] = {-YSlopeZoneSize * 0.5, YSlopeZoneSize * 0.5, YSlopeZoneSize * 0.5, -YSlopeZoneSize * 0.5};
661 part_slope_inner_zoneS->DefinePolygon(4, x_pos, y_pos);
662 part_slope_inner_zoneS->DefineSection(0, -dZSensitiveVolume * 0.5);
663 part_slope_inner_zoneS->DefineSection(1, dZSensitiveVolume * 0.5);
664
665 // hole shape
666 TString hole_name = "holeS_" + station_name;
667 // TGeoShape *holeS = new TGeoTubeSeg(hole_name, 0.0, hole_radius_with_frame, dZSensitiveVolume*0.5 + 0.1,
668 // -1.0, 91.0);
669 TGeoShape* holeS = new TGeoTube(hole_name, 0.0, hole_radius_with_frame, dZSensitiveVolume * 0.5 + 0.01);
670
671 // hole positions in the module and zones to extract the hole
672 TString hole_module_trans_name = "hole_module_trans_name_" + station_name;
673 TGeoTranslation* hole_module_trans =
674 new TGeoTranslation(hole_module_trans_name, -XOuterZoneSize * 0.5, -YOuterZoneSize * 0.5, 0);
675 hole_module_trans->RegisterYourself();
676
677 TString hole_rectangle_inner_zone_trans_name = "hole_rectangle_inner_zone_trans_name_" + station_name;
678 TGeoTranslation* hole_rectangle_inner_zone_trans = new TGeoTranslation(
679 hole_rectangle_inner_zone_trans_name, -XRectangleZoneSize * 0.5, -YRectangleZoneSize * 0.5, 0);
680 hole_rectangle_inner_zone_trans->RegisterYourself();
681
682 TString hole_slope_inner_zone_trans_name = "hole_slope_inner_zone_trans_name_" + station_name;
683 TGeoTranslation* hole_slope_inner_zone_trans =
684 new TGeoTranslation(hole_slope_inner_zone_trans_name, -XMaxSlopeZoneSize * 0.5, -YSlopeZoneSize * 0.5, 0);
685 hole_slope_inner_zone_trans->RegisterYourself();
686
687 // module and hot zone shapes
688 TString bool_expression_module = part_module_name + " - " + hole_name + ":" + hole_module_trans_name;
689 TGeoCompositeShape* moduleS = new TGeoCompositeShape(bool_expression_module);
690
691 TString bool_expression_rectangle_inner_zone =
692 part_rectangle_inner_zone_name + " - " + hole_name + ":" + hole_rectangle_inner_zone_trans_name;
693 TGeoCompositeShape* rectangle_inner_zoneS = new TGeoCompositeShape(bool_expression_rectangle_inner_zone);
694
695 TString bool_expression_slope_inner_zone =
696 part_slope_inner_zone_name + " - " + hole_name + ":" + hole_slope_inner_zone_trans_name;
697 TGeoCompositeShape* slope_inner_zoneS = new TGeoCompositeShape(bool_expression_slope_inner_zone);
698
699 // frame shapes
700 TGeoShape* vertical_frameS = new TGeoBBox("vertical_frameS", dXOuterFrame * 0.5,
701 (YOuterZoneSize + dYInnerFrame + dYOuterFrame) * 0.5, ZModuleSize * 0.5);
702 TGeoShape* horizontal_long_frameS = new TGeoBBox("horizontal_long_frameS", XOuterZoneSize, dYOuterFrame * 0.5,
704 TGeoShape* horizontal_short_frameS =
705 new TGeoBBox("horizontal_short_frameS", (XOuterZoneSize - hole_radius_with_frame + dXInnerFrame) * 0.5,
707 TGeoShape* circle_inner_frameS = new TGeoTubeSeg("circle_inner_frameS", hole_radius_with_frame - dXInnerFrame,
708 hole_radius_with_frame, ZModuleSize * 0.5, 0., -180.0);
709
710 // Volumes
711 TGeoVolume* module_with_slope_inner_zoneV = new TGeoVolume("module_Sensor", moduleS);
712 TGeoVolume* module_with_rect_inner_zoneV = new TGeoVolume("module_Sensor", moduleS);
713
714 TGeoVolume* rectangle_inner_zoneV = new TGeoVolume("inner_zone_Sensor", rectangle_inner_zoneS);
715 TGeoVolume* slope_inner_zoneV = new TGeoVolume("inner_zone_Sensor", slope_inner_zoneS);
716
717 TGeoVolume* vertical_frameV = new TGeoVolume("vertical_frame", vertical_frameS);
718 TGeoVolume* horizontal_long_frameV = new TGeoVolume("horizontal_long_frame", horizontal_long_frameS);
719 TGeoVolume* horizontal_short_frameV = new TGeoVolume("horizontal_short_frame", horizontal_short_frameS);
720 TGeoVolume* circle_inner_frameV = new TGeoVolume("circle_inner_frame", circle_inner_frameS);
721 TGeoVolume* composite_frameV = new TGeoVolumeAssembly("frame");
722
723 // media for sensitive volumes
724 TGeoMedium* sensitive_medium = pMedArCO27030; // set medium
725 if (sensitive_medium) {
726 module_with_slope_inner_zoneV->SetMedium(sensitive_medium);
727 module_with_rect_inner_zoneV->SetMedium(sensitive_medium);
728 rectangle_inner_zoneV->SetMedium(sensitive_medium);
729 slope_inner_zoneV->SetMedium(sensitive_medium);
730 } else
731 Fatal("Main", "Invalid medium for sensitive modules!");
732
733 // media for frames
734 TGeoMedium* frame_medium = pMedCarbon; // set medium
735 if (frame_medium) {
736 vertical_frameV->SetMedium(frame_medium);
737 horizontal_long_frameV->SetMedium(frame_medium);
738 horizontal_short_frameV->SetMedium(frame_medium);
739 circle_inner_frameV->SetMedium(frame_medium);
740 composite_frameV->SetMedium(frame_medium);
741 } else
742 Fatal("Main", "Invalid medium for frames!");
743
744 // volume visual properties
745 module_with_slope_inner_zoneV->SetTransparency(20);
746 module_with_rect_inner_zoneV->SetTransparency(20);
747 module_with_slope_inner_zoneV->SetLineColor(TColor::GetColor("#ff47ca"));
748 module_with_rect_inner_zoneV->SetLineColor(TColor::GetColor("#ff47ca"));
749 rectangle_inner_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
750 slope_inner_zoneV->SetLineColor(TColor::GetColor("#e0b0ff"));
751 vertical_frameV->SetLineColor(TColor::GetColor("#9999ff"));
752 horizontal_long_frameV->SetLineColor(TColor::GetColor("#9999ff"));
753 horizontal_short_frameV->SetLineColor(TColor::GetColor("#9999ff"));
754 circle_inner_frameV->SetLineColor(TColor::GetColor("#9999ff"));
755
756 // hot zone positions in modules
757 TGeoTranslation* slope_inner_zone_position = new TGeoTranslation(-XOuterZoneSize * 0.5 + XMaxSlopeZoneSize * 0.5,
758 -YOuterZoneSize * 0.5 + YSlopeZoneSize * 0.5, 0);
759 TGeoTranslation* rect_inner_zone_position = new TGeoTranslation(
760 -XOuterZoneSize * 0.5 + XRectangleZoneSize * 0.5, -YOuterZoneSize * 0.5 + YRectangleZoneSize * 0.5, 0);
761
762 // module positions in the station
763 TGeoCombiTrans* left_module_position = new TGeoCombiTrans();
764 left_module_position->SetTranslation(XOuterZoneSize * 0.5, 0.0, 0.0);
765
766 TGeoCombiTrans* right_module_position = new TGeoCombiTrans();
767 right_module_position->RotateY(180.0);
768 right_module_position->SetTranslation(-XOuterZoneSize * 0.5, 0.0, 0.0);
769
770 // frame part positions in the frame
771 TGeoTranslation* left_frame_position = new TGeoTranslation(XOuterZoneSize + dXOuterFrame * 0.5,
772 (dYOuterFrame - dYInnerFrame) * 0.5, ZModuleSize * 0.5);
773 TGeoTranslation* right_frame_position = new TGeoTranslation(-(XOuterZoneSize + dXOuterFrame * 0.5),
774 (dYOuterFrame - dYInnerFrame) * 0.5, ZModuleSize * 0.5);
775 TGeoTranslation* top_long_frame_position = new TGeoTranslation(
776 0, YOuterZoneSize * 0.5 + dYOuterFrame * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
777 TGeoTranslation* left_top_short_frame_position = new TGeoTranslation(
778 (XOuterZoneSize - hole_radius_with_frame - dXInnerFrame) * 0.5 + hole_radius_with_frame,
779 -dYInnerFrame * 0.5 - YOuterZoneSize * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
780 TGeoTranslation* right_bottom_short_frame_position = new TGeoTranslation(
781 -((XOuterZoneSize - hole_radius_with_frame - dXInnerFrame) * 0.5 + hole_radius_with_frame),
782 -dYInnerFrame * 0.5 - YOuterZoneSize * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
783 TGeoTranslation* left_bottom_short_frame_position = new TGeoTranslation(
784 ((XOuterZoneSize - hole_radius_with_frame - dXInnerFrame) * 0.5 + hole_radius_with_frame),
785 -dYInnerFrame * 0.5 - YOuterZoneSize * 0.5, (ZModuleSize - dZSensitiveVolume) * 0.5 + dZSensitiveVolume);
786
787 // frame positions in the station
788 TGeoCombiTrans* upper_frame_trans = new TGeoCombiTrans();
789 upper_frame_trans->SetTranslation(0.0, 0.0, -dZSensitiveVolume * 0.5);
790
791 // station assembling
792 module_with_slope_inner_zoneV->AddNode(slope_inner_zoneV, 0, slope_inner_zone_position);
793 module_with_rect_inner_zoneV->AddNode(rectangle_inner_zoneV, 0, rect_inner_zone_position);
794
795 if (IsInverted) {
796 stationA->AddNode(module_with_rect_inner_zoneV, 0, left_module_position);
797 stationA->AddNode(module_with_slope_inner_zoneV, 1, right_module_position);
798 } else {
799 stationA->AddNode(module_with_slope_inner_zoneV, 0, left_module_position);
800 stationA->AddNode(module_with_rect_inner_zoneV, 1, right_module_position);
801 }
802
803 // frames
804 composite_frameV->AddNode(vertical_frameV, 0, left_frame_position);
805 composite_frameV->AddNode(vertical_frameV, 1, right_frame_position);
806 composite_frameV->AddNode(horizontal_long_frameV, 0, top_long_frame_position);
807 composite_frameV->AddNode(horizontal_short_frameV, 0, left_bottom_short_frame_position);
808 composite_frameV->AddNode(horizontal_short_frameV, 1, right_bottom_short_frame_position);
809 composite_frameV->AddNode(circle_inner_frameV, 0, new TGeoTranslation(0, -YOuterZoneSize * 0.5, ZModuleSize * 0.5));
810
811 stationA->AddNode(composite_frameV, 0, upper_frame_trans);
812
813 // Station position
814 Double_t station_shift = 0.0;
815 station_shift = dZSensitiveVolume * 0.5;
816 TGeoTranslation* station_pos = new TGeoTranslation(x_position, y_position, z_position + station_shift);
817
818 mother_volume->AddNode(stationA, 0, station_pos);
819}
820
821//------------------------------------------------------------------------------
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 RotateX(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
const Double_t XDistanceSensModule
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_Intersec(TGeoVolume *mother_volume, TString station_name, Double_t x_position, Double_t y_position, Double_t z_position, Double_t IsInverted)
void create_rootgeom_GEMS_2ndConfig()
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
void CreateStation_Two66x41Plane_Distance(TGeoVolume *mother_volume, TString station_name, Double_t x_position, Double_t y_position, Double_t z_position)
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)