BmnRoot 26.10.0-19-g6979a6c6
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_Silicon_RunSpring2017.C
Go to the documentation of this file.
1//
2
3using namespace TMath;
4
5// GeoManager
7
11
12// Geometry parameters (sizes, positions, shifts): all units is in cm!!!
18
19// Station
20const Int_t NModules = 8; // Number of modules in a station
21
23 // in bm@n coordinate system
24 +12.15, // module 0
25 +6.15, // module 1
26 -6.15, // module 2
27 -12.15, // module 3
28 +12.15, // module 4
29 +6.15, // module 5
30 -6.15, // module 6
31 -12.15 // module 7
32};
33
35 // in bm@n coordinate system
36 -0.15, // module 0
37 -0.15, // module 1
38 -0.15, // module 2
39 -0.15, // module 3
40 +0.15, // module 4
41 +0.15, // module 5
42 +0.15, // module 6
43 +0.15 // module 7
44};
45
47 // in bm@n coordinate system
48 3.31, // module 0
49 1.78, // module 1
50 3.09, // module 2
51 1.56, // module 3
52 2.05, // module 4
53 3.58, // module 5
54 2.27, // module 6
55 3.80 // module 7
56};
57
59 RIGHT_ANGLED_MODULE, // module 0
60 BEVEL_MODULE, // module 1
61 BEVEL_MODULE, // module 2
62 RIGHT_ANGLED_MODULE, // module 3
63 RIGHT_ANGLED_MODULE, // module 4
64 BEVEL_MODULE, // module 5
65 BEVEL_MODULE, // module 6
66 RIGHT_ANGLED_MODULE // module 7
67};
68
69// rotations of modules around y-axis by 180 deg.
71 true, // module 0
72 true, // module 1
73 false, // module 2
74 false, // module 3
75 true, // module 4
76 true, // module 5
77 false, // module 6
78 false // module 7
79};
80
81// rotations of modules around x-axis by 180 deg.
83 false, // module 0
84 false, // module 1
85 false, // module 2
86 false, // module 3
87 true, // module 4
88 true, // module 5
89 true, // module 6
90 true // module 7
91};
92
93// Module -----------------------------------------------------------------------
94
96
100
103
104Double_t XBevelSize = 3.82; // x-bevel for a angled cut
105Double_t YBevelSize = XBevelSize; // y-bevel for a angled cut
106
109
117//------------------------------------------------------------------------------
118
119// Sensor zones -----------------------------------------------------------------
124//------------------------------------------------------------------------------
125
126// Module frames ----------------------------------------------------------------
129
131//------------------------------------------------------------------------------
132
133// Y-shift from center of the gap to the global x-axis (for y-alignment of the module)
135
136// X-shift from center of the module to the origin of the local x-axis
138
139// Y-shift from center of the module to the origin of the local y-axis
141
142/*
143 ASCII module picture (view from target)
144
145 |<---- XModuleSize ---------->| ^
146 | | | Y-axis
147 ------------------------------ ---------
148 | | top border | | ^
149 ------------------------------ |
150 | | | | |
151 | l | rectangle | r | |
152 | e | sensor | i | |
153 | f | zone | g | |
154 | t | | h | |
155 | | | t | |
156 | | | | |
157 ------------------------------ |
158 | | middle (upper part) | |
159 ------ gap between parts ----- YModuleSize
160 | | middle (lower part) | |
161 ------------------------------ |
162 | | | | |
163 | b | bevel (or rect.) | r | |
164 | e | sensor | i | |
165 \ v \ zone | g | |
166 \ e \ | h | |
167 \ l \ | t | |
168 \ \ | | |
169 ------------------------- |
170 \ \ bottom | | v
171 ---------------------- ---------
172
173 * x-axis <----------------------------------(x0,y0) local point
174
175 */
176
177// media
183
184class FairGeoMedia;
185class FairGeoBuilder;
186
187// function declarations
188void CreateSiliconStation(TGeoVolume* mother_volume,
189 TString station_name,
190 Double_t x_station_pos,
191 Double_t y_station_pos,
192 Double_t z_station_pos);
193
194void CreateSiliconModule(TGeoVolume* mother_volume,
195 Int_t module_num,
196 ModuleType module_type,
197 Double_t x_module_pos,
198 Double_t y_module_pos,
199 Double_t z_module_pos,
200 Bool_t y_module_rotated,
201 Bool_t x_module_rotated);
202
203void DefineRequiredMedia(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
204{
205
206 // air medium
207 FairGeoMedium* mAir = geoMedia->getMedium("air");
208 if (!mAir)
209 Fatal("Main", "FairMedium air not found");
210 geoBuild->createMedium(mAir);
211 pMedAir = gGeoManager->GetMedium("air");
212 if (!pMedAir)
213 Fatal("Main", "Medium air not found");
214
215 // carbon medium
216 FairGeoMedium* mCarbon = geoMedia->getMedium("carbon");
217 if (!mCarbon)
218 Fatal("Main", "FairMedium carbon not found");
219 geoBuild->createMedium(mCarbon);
220 pMedCarbon = gGeoManager->GetMedium("carbon");
221 if (!pMedCarbon)
222 Fatal("Main", "Medium carbon not found");
223
224 // fiberglass medium
225 FairGeoMedium* mFiberGlass = geoMedia->getMedium("fiberglass");
226 if (!mFiberGlass)
227 Fatal("Main", "FairMedium fiberglass not found");
228 geoBuild->createMedium(mFiberGlass);
229 pMedFiberGlass = gGeoManager->GetMedium("fiberglass");
230 if (!pMedFiberGlass)
231 Fatal("Main", "Medium fiberglass not found");
232
233 // copper medium
234 FairGeoMedium* mCopper = geoMedia->getMedium("copper");
235 if (!mCopper)
236 Fatal("Main", "FairMedium copper not found");
237 geoBuild->createMedium(mCopper);
238 pMedCopper = gGeoManager->GetMedium("copper");
239 if (!pMedCopper)
240 Fatal("Main", "Medium copper not found");
241
242 // silicon medium
243 FairGeoMedium* mSilicon = geoMedia->getMedium("silicon");
244 if (!mSilicon)
245 Fatal("Main", "FairMedium silicon not found");
246 geoBuild->createMedium(mSilicon);
247 pMedSilicon = gGeoManager->GetMedium("silicon");
248 if (!pMedSilicon)
249 Fatal("Main", "Medium silicon not found");
250}
251
253{
254 cout << "\n";
255 cout << "Module parameters information: ---------------------------" << "\n";
256 cout << " XModuleSize = " << XModuleSize << " cm" << "\n";
257 cout << " YModuleSize = " << YModuleSize << " cm" << " ( " << YModuleSizeUpperPart << " + "
258 << YGapBetweenPartsOfModule << " + " << YModuleSizeLowerPart << " )" << "\n";
259 cout << " YModuleSizeUpperPart = " << YModuleSizeUpperPart << " cm" << "\n";
260 cout << " YModuleSizeLowerPart = " << YModuleSizeLowerPart << " cm" << "\n";
261 cout << " YGapBetweenPartsOfModule = " << YGapBetweenPartsOfModule << " cm" << "\n";
262 cout << " ZModuleSize = " << ZModuleSize << " cm" << "\n";
263 cout << "\n";
264 cout << " XBevelSize = " << XBevelSize << " cm" << "\n";
265 cout << " YBevelSize = " << YBevelSize << " cm" << "\n";
266 cout << " BevelAngleDeg = " << BevelAngleDeg << " deg" << "\n";
267 cout << "\n";
268 cout << " XLeftBorder = " << XLeftBorder << " cm" << "\n";
269 cout << " XRightBorder = " << XRightBorder << " cm" << "\n";
270 cout << " YTopBorder = " << YTopBorder << " cm" << "\n";
271 cout << " YMiddleBorderUpperPart = " << YMiddleBorderUpperPart << " cm" << "\n";
272 cout << " YGapBetweenPartsOfModule = " << YGapBetweenPartsOfModule << " cm" << " (gap between two parts)\n";
273 cout << " YMiddleBorderLowerPart = " << YMiddleBorderLowerPart << " cm" << "\n";
274 cout << " YBottomBorder = " << YBottomBorder << " cm" << "\n";
275 cout << " XYBevelBorder = " << XYBevelBorder << " cm" << "\n";
276 cout << "\n";
277 cout << " XSensorZoneSize = " << XSensorZoneSize << " cm" << "\n";
278 cout << " YSensorZoneSizeUpperPart = " << YSensorZoneSizeUpperPart << " cm" << "\n";
279 cout << " YSensorZoneSizeLowerPart = " << YSensorZoneSizeLowerPart << " cm" << "\n";
280 cout << " ZSensorZoneSize = " << ZSensorZoneSize << " cm" << "\n";
281
282 cout << "-------------------------------------------------------------\n";
283}
284
286{
287
288 // ---- set working directory --------------------------------------------
289 TString gPath = gSystem->Getenv("VMCWORKDIR");
290
291 // ------- Geometry file name (output) ----------------------------------
292 const TString geoDetectorName = "Silicon";
293 const TString geoDetectorVersion = "RunSpring2017";
294 const TString geoFileName = gPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
295
296 // ---- global geometry parameters ---------------------------------------
297 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
298 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
299
300 // ------- Load media from media file ----------------------------------
301 TString medFile = gPath + "/geometry/media.geo";
302 geoFace->setMediaFile(medFile);
303 geoFace->readMedia();
304 FairGeoMedia* geoMedia = geoFace->getMedia();
305 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
306
307 DefineRequiredMedia(geoMedia, geoBuild);
308 // -------------------------------------------------------------------------
309
310 // Print information about module parameters
312
313 // -------------- Create geometry and top volume -------------------------
314 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
315 gGeoMan->SetName(geoDetectorName + "_geom");
316 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
317 top->SetMedium(pMedAir);
318 gGeoMan->SetTopVolume(top);
319 // gGeoMan->SetTopVisible(1);
320 // --------------------------------------------------------------------------
321
322 // Define TOP Geometry
323 TGeoVolume* SILICON = new TGeoVolumeAssembly(geoDetectorName);
324 SILICON->SetMedium(pMedAir);
325
327
328 top->AddNode(SILICON, 0);
330
331 // --------------- Finish -----------------------------------------------
332 gGeoMan->CloseGeometry();
333 gGeoMan->CheckOverlaps(0.0001);
334 gGeoMan->PrintOverlaps();
335 gGeoMan->Test();
336
337 TFile* geoFile = new TFile(geoFileName, "RECREATE");
338 top->Write();
339 geoFile->Close();
340 top->Draw("ogl");
341}
342//------------------------------------------------------------------------------
343
345 TString station_name,
346 Double_t x_station_pos,
347 Double_t y_station_pos,
348 Double_t z_station_pos)
349{
350
351 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
352 stationA->SetMedium(pMedAir);
353
354 for (Int_t imodule = 0; imodule < NModules; ++imodule) {
355
356 CreateSiliconModule(stationA, imodule, ModulesTypes[imodule], XModulesPositions[imodule],
357 YModulesPositions[imodule], ZModulesPositions[imodule], ModulesYRotations[imodule],
358 ModulesXRotations[imodule]);
359 }
360
361 // Global position of the station
362 TGeoTranslation* station_pos = new TGeoTranslation(x_station_pos, y_station_pos, z_station_pos);
363
364 // Add station volume (as a node) to the mother volume
365 mother_volume->AddNode(stationA, 0, station_pos);
366}
367
368void CreateSiliconModule(TGeoVolume* mother_volume,
369 Int_t module_num,
370 ModuleType module_type,
371 Double_t x_module_pos,
372 Double_t y_module_pos,
373 Double_t z_module_pos,
374 Bool_t y_module_rotated,
375 Bool_t x_module_rotated)
376{
377
378 // Shapes -------------------------------------------------------------------
379 // module shape
380 TGeoShape* moduleS = NULL;
381 switch (module_type) {
382 case RIGHT_ANGLED_MODULE: {
383 moduleS = new TGeoBBox("moduleS", XModuleSize * 0.5, YModuleSize * 0.5, ZModuleSize * 0.5);
384 break;
385 }
386 case BEVEL_MODULE: {
387 moduleS = new TGeoXtru(2);
388 moduleS->SetName("moduleS");
389 Double_t x_pos[5] = {+XModuleSize * 0.5, -XModuleSize * 0.5, -XModuleSize * 0.5,
390 +XModuleSize * 0.5 - XBevelSize, +XModuleSize * 0.5};
391 Double_t y_pos[5] = {+YModuleSize * 0.5, +YModuleSize * 0.5, -YModuleSize * 0.5, -YModuleSize * 0.5,
392 -YModuleSize * 0.5 + YBevelSize};
393 ((TGeoXtru*)moduleS)->DefinePolygon(5, x_pos, y_pos);
394 ((TGeoXtru*)moduleS)->DefineSection(0, -ZModuleSize * 0.5);
395 ((TGeoXtru*)moduleS)->DefineSection(1, +ZModuleSize * 0.5);
396 break;
397 }
398 default:
399 Error("CreateSiliconModule", "Incorrect module type selected!!!");
400 }
401
402 // sensor zone shape (upper part of the module)
403 TGeoShape* sensor_zone_upper_partS = new TGeoBBox("sensor_zone_upper_partS", XSensorZoneSize * 0.5,
405
406 // sensor zone shape (lower part of the module: rectangle zone)
407 TGeoShape* sensor_zone_lower_part_rectS = new TGeoBBox("sensor_zone_lower_part_rectS", XSensorZoneSize * 0.5,
409
410 // sensor zone shape (lower part of the module: bevel zone)
411 TGeoShape* sensor_zone_lower_part_bevelS = new TGeoXtru(2);
412 sensor_zone_lower_part_bevelS->SetName("sensor_zone_lower_part_bevelS");
413
414 // Calculate coordinates of the bottom and the top points of the inner bevel
415
416 // find x and y projections of the bevel border thickness
419
420 // find shifts of the sensetive zone from module borders via the equation of the straight line for the inner bevel
421 Double_t x_delta_top_BP = XLeftBorder;
422 Double_t y_delta_top_BP = TMath::Tan(TMath::PiOver2() + BevelAngleRad) * x_delta_top_BP + (YBevelSize + y_delta);
423
424 Double_t y_delta_bottom_BP = YBottomBorder;
425 Double_t x_delta_bottom_BP =
426 (y_delta_bottom_BP - (YBevelSize + y_delta)) / (TMath::Tan(TMath::PiOver2() + BevelAngleRad));
427 //----------------------------------------------------------------------
428
429 Double_t x_pos_sensor_zone_bevel[5] = {+XModuleSize * 0.5 - XLeftBorder, -XModuleSize * 0.5 + XRightBorder,
430 -XModuleSize * 0.5 + XRightBorder, +XModuleSize * 0.5 - x_delta_bottom_BP,
431 +XModuleSize * 0.5 - XLeftBorder};
432 Double_t y_pos_sensor_zone_bevel[5] = {
435 -YModuleSizeLowerPart * 0.5 + y_delta_top_BP};
436
437 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefinePolygon(5, x_pos_sensor_zone_bevel, y_pos_sensor_zone_bevel);
438 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefineSection(0, -ZModuleSize * 0.5);
439 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefineSection(1, +ZModuleSize * 0.5);
440
441 // module frame shape
442 TGeoShape* frameS = NULL;
443 switch (module_type) {
444 case RIGHT_ANGLED_MODULE: {
445 frameS = new TGeoBBox(TString("frameS") += module_num, XModuleFrameSize * 0.5, YModuleFrameSize * 0.5,
446 ZModuleFrameSize * 0.5);
447 break;
448 }
449 case BEVEL_MODULE: {
450 frameS = new TGeoXtru(2);
451 frameS->SetName(TString("frameS") += module_num);
452 Double_t x_pos[5] = {+XModuleFrameSize * 0.5, -XModuleFrameSize * 0.5, -XModuleFrameSize * 0.5,
454 Double_t y_pos[5] = {+YModuleFrameSize * 0.5, +YModuleFrameSize * 0.5, -YModuleFrameSize * 0.5,
456 ((TGeoXtru*)frameS)->DefinePolygon(5, x_pos, y_pos);
457 ((TGeoXtru*)frameS)->DefineSection(0, -ZModuleFrameSize * 0.5);
458 ((TGeoXtru*)frameS)->DefineSection(1, +ZModuleFrameSize * 0.5);
459 break;
460 }
461 default:
462 Error("CreateSiliconModule", "Incorrect module type selected!!!");
463 }
464
465 // upper frame window shape
466 TGeoShape* upper_window_frameS = new TGeoBBox(TString("upper_window_frameS") += module_num, XSensorZoneSize * 0.5,
467 YSensorZoneSizeUpperPart * 0.5, (ZModuleFrameSize + 0.001) * 0.5);
468
469 // lower frame rect window shape
470 TGeoShape* lower_window_rect_frameS =
471 new TGeoBBox(TString("lower_window_rect_frameS") += module_num, XSensorZoneSize * 0.5,
472 YSensorZoneSizeLowerPart * 0.5, (ZModuleFrameSize + 0.001) * 0.5);
473
474 // lower frame window shape
475 TGeoShape* lower_window_bevel_frameS = new TGeoXtru(2);
476 lower_window_bevel_frameS->SetName(TString("lower_window_bevel_frameS") += module_num);
477 ((TGeoXtru*)lower_window_bevel_frameS)->DefinePolygon(5, x_pos_sensor_zone_bevel, y_pos_sensor_zone_bevel);
478 ((TGeoXtru*)lower_window_bevel_frameS)->DefineSection(0, -(ZModuleFrameSize + 0.001) * 0.5);
479 ((TGeoXtru*)lower_window_bevel_frameS)->DefineSection(1, +(ZModuleFrameSize + 0.001) * 0.5);
480
481 TGeoTranslation* upper_window_frame_pos = new TGeoTranslation();
482 upper_window_frame_pos->SetName(TString("upper_window_frame_pos") += module_num);
483 upper_window_frame_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
484 upper_window_frame_pos->SetDy(+YSensorZoneSizeUpperPart * 0.5 + YGapBetweenPartsOfModule * 0.5
486 upper_window_frame_pos->SetDz(0.0);
487 upper_window_frame_pos->RegisterYourself();
488
489 TGeoTranslation* lower_window_rect_frame_pos = new TGeoTranslation();
490 lower_window_rect_frame_pos->SetName(TString("lower_window_rect_frame_pos") += module_num);
491 lower_window_rect_frame_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
492 lower_window_rect_frame_pos->SetDy(-YSensorZoneSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
494 lower_window_rect_frame_pos->SetDz(0.0);
495 lower_window_rect_frame_pos->RegisterYourself();
496
497 TGeoTranslation* lower_window_bevel_frame_pos = new TGeoTranslation();
498 lower_window_bevel_frame_pos->SetName(TString("lower_window_bevel_frame_pos") += module_num);
499 lower_window_bevel_frame_pos->SetDx(0.0);
500 lower_window_bevel_frame_pos->SetDy(-YModuleSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
502 lower_window_bevel_frame_pos->SetDz(0.0);
503 lower_window_bevel_frame_pos->RegisterYourself();
504
505 TGeoCompositeShape* frame_with_windowsS = new TGeoCompositeShape();
506 frame_with_windowsS->SetName("frame_with_windowsS");
507
508 switch (module_type) {
509 case RIGHT_ANGLED_MODULE: {
510 TString expression = "(frameS";
511 expression += module_num;
512 expression += "-upper_window_frameS";
513 expression += module_num;
514 expression += ":upper_window_frame_pos";
515 expression += module_num;
516 expression += ")-lower_window_rect_frameS";
517 expression += module_num;
518 expression += ":lower_window_rect_frame_pos";
519 expression += module_num;
520 frame_with_windowsS->MakeNode(expression);
521 break;
522 }
523 case BEVEL_MODULE: {
524 TString expression = "(frameS";
525 expression += module_num;
526 expression += "-upper_window_frameS";
527 expression += module_num;
528 expression += ":upper_window_frame_pos";
529 expression += module_num;
530 expression += ")-lower_window_bevel_frameS";
531 expression += module_num;
532 expression += ":lower_window_bevel_frame_pos";
533 expression += module_num;
534 frame_with_windowsS->MakeNode(expression);
535 break;
536 }
537 default:
538 Error("CreateSiliconModule", "Incorrect module type selected!!!");
539 }
540
541 //--------------------------------------------------------------------------
542
543 // Volumes ------------------------------------------------------------------
544 // module volume
545 TString module_name = "moduleV_";
546 module_name += module_num;
547
548 // TGeoVolume *moduleV = new TGeoVolume("moduleV", moduleS);
549 TGeoVolume* moduleV = new TGeoVolume(module_name, moduleS);
550
551 // sensor zone volume (upper part of the module)
552 TGeoVolume* sensor_zone_upper_partV = new TGeoVolume("Sensor_zone_upper_partV", sensor_zone_upper_partS);
553
554 // sensor zone volume (lower part of the module: rectangle zone)
555 TGeoVolume* sensor_zone_lower_part_rectV =
556 new TGeoVolume("Sensor_zone_lower_part_rectV", sensor_zone_lower_part_rectS);
557
558 // sensor zone volume (lower part of the module: bevel zone)
559 TGeoVolume* sensor_zone_lower_part_bevelV =
560 new TGeoVolume("Sensor_zone_lower_part_bevelV", sensor_zone_lower_part_bevelS);
561
562 // frame volume
563 TGeoVolume* frameV = new TGeoVolume("frameV", frame_with_windowsS);
564
565 // volumes visual properties
566 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
567 sensor_zone_upper_partV->SetLineColor(TColor::GetColor("#e0b0ff"));
568 sensor_zone_lower_part_rectV->SetLineColor(TColor::GetColor("#e0b0ff"));
569 sensor_zone_lower_part_bevelV->SetLineColor(TColor::GetColor("#e0b0ff"));
570 frameV->SetLineColor(TColor::GetColor("#cccccc"));
571
572 // volumes media
573 TGeoMedium* silicon_medium = pMedSilicon;
574 if (silicon_medium) {
575 moduleV->SetMedium(silicon_medium);
576 sensor_zone_upper_partV->SetMedium(silicon_medium);
577 sensor_zone_lower_part_rectV->SetMedium(silicon_medium);
578 sensor_zone_lower_part_bevelV->SetMedium(silicon_medium);
579 } else
580 Fatal("Main", "Invalid medium for modules and sensor zones!");
581
582 TGeoMedium* carbon_medium = pMedCarbon;
583 if (carbon_medium) {
584 frameV->SetMedium(carbon_medium);
585 } else
586 Fatal("Main", "Invalid medium for module frame!");
587 //--------------------------------------------------------------------------
588
589 // position of the sensor zone in the upper part of the module
590 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
591 sensor_zone_upper_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
592 sensor_zone_upper_part_pos->SetDy(+YSensorZoneSizeUpperPart * 0.5 + YGapBetweenPartsOfModule * 0.5
594 sensor_zone_upper_part_pos->SetDz(0.0);
595
596 // position of the sensor zone in the lower part of the module (rectangle zone)
597 TGeoTranslation* sensor_zone_lower_part_rect_pos = new TGeoTranslation();
598 sensor_zone_lower_part_rect_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
599 sensor_zone_lower_part_rect_pos->SetDy(-YSensorZoneSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
601 sensor_zone_lower_part_rect_pos->SetDz(0.0);
602
603 // position of the sensor zone in the lower part of the module (bevel zone)
604 TGeoTranslation* sensor_zone_lower_part_bevel_pos = new TGeoTranslation();
605 sensor_zone_lower_part_bevel_pos->SetDx(0.0);
606 sensor_zone_lower_part_bevel_pos->SetDy(-YModuleSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
608 sensor_zone_lower_part_bevel_pos->SetDz(0.0);
609
610 // Place sensors into the module
611 moduleV->AddNode(sensor_zone_upper_partV, 0, sensor_zone_upper_part_pos);
612
613 switch (module_type) {
614 case RIGHT_ANGLED_MODULE: {
615 moduleV->AddNode(sensor_zone_lower_part_rectV, 0, sensor_zone_lower_part_rect_pos);
616 break;
617 }
618 case BEVEL_MODULE: {
619 moduleV->AddNode(sensor_zone_lower_part_bevelV, 0, sensor_zone_lower_part_bevel_pos);
620 break;
621 }
622 default:
623 Error("CreateSiliconModule", "Incorrect module type selected!!!");
624 }
625
626 // volumes visual property (transparency)
627 moduleV->SetTransparency(50);
628 // frameV->SetTransparency(50);
629
630 // module position ----------------------------------------------------------
631 Double_t z_module_shift = +ZModuleSize * 0.5; // To z-module position is at the start of the sensitive volume
632
633 TGeoCombiTrans* module_orientation = new TGeoCombiTrans();
634
635 if (y_module_rotated)
636 module_orientation->RotateY(180.0);
637 if (x_module_rotated)
638 module_orientation->RotateX(180.0);
639
640 if (y_module_rotated) {
641 module_orientation->SetDx(x_module_pos - XShiftFromCenterToLocalX0);
642 } else {
643 module_orientation->SetDx(x_module_pos + XShiftFromCenterToLocalX0);
644 }
645
646 if (x_module_rotated) {
647 module_orientation->SetDy(y_module_pos + YShiftFromCenterToAxis - YShiftFromCenterToLocalY0);
648 } else {
649 module_orientation->SetDy(y_module_pos + YShiftFromCenterToAxis + YShiftFromCenterToLocalY0);
650 }
651
652 module_orientation->SetDz(z_module_pos + z_module_shift);
653 //--------------------------------------------------------------------------
654
655 // position of the frame ----------------------------------------------------
656 TGeoCombiTrans* frame_orientation = new TGeoCombiTrans();
657
658 if (y_module_rotated)
659 frame_orientation->RotateY(180.0);
660 if (x_module_rotated)
661 frame_orientation->RotateX(180.0);
662
663 if (y_module_rotated) {
664 frame_orientation->SetDx(x_module_pos - XShiftFromCenterToLocalX0);
665 } else {
666 frame_orientation->SetDx(x_module_pos + XShiftFromCenterToLocalX0);
667 }
668
669 if (x_module_rotated) {
670 frame_orientation->SetDy(y_module_pos + YShiftFromCenterToAxis - YShiftFromCenterToLocalY0);
671 } else {
672 frame_orientation->SetDy(y_module_pos + YShiftFromCenterToAxis + YShiftFromCenterToLocalY0);
673 }
674
675 if (y_module_rotated != x_module_rotated) { // logic XOR
676 frame_orientation->SetDz(z_module_pos - (ZModuleFrameSize * 0.5));
677 } else {
678 frame_orientation->SetDz(z_module_pos + (ZModuleFrameSize * 0.5 + ZModuleSize));
679 }
680 //--------------------------------------------------------------------------
681
682 mother_volume->AddNode(moduleV, module_num, module_orientation);
683 mother_volume->AddNode(frameV, module_num, frame_orientation);
684}
685
686//------------------------------------------------------------------------------
bool Bool_t
int Int_t
double Double_t
constexpr Bool_t kTRUE
ModuleType
@ RIGHT_ANGLED_MODULE
void Error(const char *location, const char *msgfmt,...)
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 SetDz(Double_t dz) override
void RotateY(Double_t angle) override
void SetDy(Double_t dy) override
void SetDx(Double_t dx) override
void RotateX(Double_t angle) override
void MakeNode(const char *expression)
virtual void RegisterYourself()
void SetDy(Double_t dy) override
void SetDz(Double_t dz) override
void SetDx(Double_t dx) override
void SetVisContainers(Bool_t flag=kTRUE) override
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
void Draw(Option_t *option="") override
void SetTransparency(Char_t transparency=0)
virtual void SetMedium(TGeoMedium *medium)
void SetLineColor(Color_t lcolor) override
virtual void SetName(const char *name)
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
TGeoManager * gGeoMan
TGeoMedium * pMedFiberGlass
const Double_t ZStationPosition
void CreateSiliconStation(TGeoVolume *mother_volume, TString station_name, Double_t x_station_pos, Double_t y_station_pos, Double_t z_station_pos)
void create_rootgeom_Silicon_RunSpring2017()
const Double_t XStationPosition
void CreateSiliconModule(TGeoVolume *mother_volume, Int_t module_num, ModuleType module_type, Double_t x_module_pos, Double_t y_module_pos, Double_t z_module_pos, Bool_t y_module_rotated, Bool_t x_module_rotated)
Double_t ZModulesPositions[NModules]
const Double_t YStationPosition
Double_t YModulesPositions[NModules]
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
Double_t XModulesPositions[NModules]
Double_t ATan(Double_t)
constexpr Double_t PiOver2()
Double_t Cos(Double_t)
Double_t Sin(Double_t)
Double_t Tan(Double_t)
constexpr Double_t RadToDeg()