BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_Silicon_Run8_3stations.C
Go to the documentation of this file.
1/*
2 * Baranov D.
3 * 20.01.2020
4 * Use this macro to create ROOT geometry for the RUN-8 config. of SILICON
5 * detector
6 *
7 * WARNING: all units is in cm!!!
8 *
9 */
10
11using namespace TMath;
12
13// Set Parameters of SILICON detector -------------------------------------------
14const Int_t NStations = 3; // stations in the detector
15const Int_t NMaxModules = 18; // max. number of modules in a station
16
17const Int_t NModulesInStations[NStations] = {10, 14, 18};
18
19//(X-Y-Z)Positions of stations (sensitive volumes)
20
21const Double_t XStationPositions[NStations] = {0.0, 0.0, 0.0};
22const Double_t YStationPositions[NStations] = {0.0, 0.0, 0.0};
23// const Double_t ZStationPositions[NStations] = { +12.37, +12.37+8.64, +12.37+8.64+8.64 };
24const Double_t ZStationPositions[NStations] = {+15.7, +15.7 + 8.64, +15.7 + 8.64 + 8.64};
25
26/*
27 * where
28 * (1)
29 *
30 * (2)
31 */
32
33//(X-Y-Z)Shifts of modules in each station
35 {+15.15 /*0*/, +9.15 /*1*/, +3.15 /*2*/, -9.15 /*3*/, -15.15 /*4*/, +15.15 /*5*/, +9.15 /*6*/, +3.15 /*7*/,
36 -9.15 /*8*/, -15.15 /*9*/},
37 {+21.15 /*0*/, +15.15 /*1*/, +9.15 /*2*/, +3.15 /*3*/, -9.15 /*4*/, -15.15 /*5*/, -21.15 /*6*/, +21.15 /*7*/,
38 +15.15 /*8*/, +9.15 /*9*/, +3.15 /*10*/, -9.15 /*11*/, -15.15 /*12*/, -21.15 /*13*/},
39 {+27.15 /*0*/, +21.15 /*1*/, +15.15 /*2*/, +9.15 /*3*/, +3.15 /*4*/, -9.15 /*5*/, -15.15 /*6*/, -21.15 /*7*/,
40 -27.15 /*8*/, +27.15 /*9*/, +21.15 /*10*/, +15.15 /*11*/, +9.15 /*12*/, +3.15 /*13*/, -9.15 /*14*/, -15.15 /*15*/,
41 -21.15 /*16*/, -27.15 /*17*/}};
43 {-0.15 /*0*/, -0.15 /*1*/, +2.85 /*2*/, -0.15 /*3*/, -0.15 /*4*/, +0.15 /*5*/, +0.15 /*6*/, -2.85 /*7*/,
44 +0.15 /*8*/, +0.15 /*9*/},
45 {-0.15 /*0*/, -0.15 /*1*/, -0.15 /*2*/, +2.85 /*3*/, -0.15 /*4*/, -0.15 /*5*/, -0.15 /*6*/, +0.15 /*7*/,
46 +0.15 /*8*/, +0.15 /*9*/, -2.85 /*10*/, +0.15 /*11*/, +0.15 /*12*/, +0.15 /*13*/},
47 {-0.15 /*0*/, -0.15 /*1*/, -0.15 /*2*/, -0.15 /*3*/, +2.85 /*4*/, -0.15 /*5*/, -0.15 /*6*/, -0.15 /*7*/,
48 -0.15 /*8*/, +0.15 /*9*/, +0.15 /*10*/, +0.15 /*11*/, +0.15 /*12*/, -2.85 /*13*/, +0.15 /*14*/, +0.15 /*15*/,
49 +0.15 /*16*/, +0.15 /*17*/}};
51 {+1.36 + 4.31 /*0*/, +0.14 + 4.31 /*1*/, +1.36 + 4.31 /*2*/, +0.0 + 4.31 /*3*/, +1.22 + 4.31 /*4*/, +0.0 /*5*/,
52 +1.22 /*6*/, 0.0 /*7*/, +1.36 /*8*/, +0.14 /*9*/},
53 {+0.14 + 4.31 /*0*/, +1.36 + 4.31 /*1*/, +0.14 + 4.31 /*2*/, +1.36 + 4.31 /*3*/, +0.0 + 4.31 /*4*/,
54 +1.22 + 4.31 /*5*/, +0.0 + 4.31 /*6*/, +1.22 /*7*/, +0.0 /*8*/, +1.22 /*9*/, +0.0 /*10*/, +1.36 /*11*/,
55 +0.14 /*12*/, +1.36 /*13*/},
56 {+1.36 + 4.31 /*0*/, +0.14 + 4.31 /*1*/, +1.36 + 4.31 /*2*/, +0.14 + 4.31 /*3*/, +1.36 + 4.31 /*4*/,
57 +0.0 + 4.31 /*5*/, +1.22 + 4.31 /*6*/, +0.0 + 4.31 /*7*/, +1.22 + 4.31 /*8*/, +0.0 /*9*/, +1.22 /*10*/,
58 +0.0 /*11*/, +1.22 /*12*/, +0.0 /*13*/, +1.36 /*14*/, +0.14 /*15*/, +1.36 /*16*/, +0.14 /*17*/}};
59
60// Geometry parameters of modules
68
79
80// rotations of modules around y-axis by 180 deg.
82 {true /*0*/, true /*1*/, true /*2*/, false /*3*/, false /*4*/, true /*5*/, true /*6*/, true /*7*/, false /*8*/,
83 false /*9*/},
84 {true /*0*/, true /*1*/, true /*2*/, true /*3*/, false /*4*/, false /*5*/, false /*6*/, true /*7*/, true /*8*/,
85 true /*9*/, true /*10*/, false /*11*/, false /*12*/, false /*13*/},
86 {true /*0*/, true /*1*/, true /*2*/, true /*3*/, true /*4*/, false /*5*/, false /*6*/, false /*7*/, false /*8*/,
87 true /*9*/, true /*10*/, true /*11*/, true /*12*/, true /*13*/, false /*14*/, false /*15*/, false /*16*/,
88 false /*17*/}};
89
90// rotations of modules around x-axis by 180 deg.
92 {false /*0*/, false /*1*/, false /*2*/, false /*3*/, false /*4*/, true /*5*/, true /*6*/, true /*7*/, true /*8*/,
93 true /*9*/},
94 {false /*0*/, false /*1*/, false /*2*/, false /*3*/, false /*4*/, false /*5*/, false /*6*/, true /*7*/, true /*8*/,
95 true /*9*/, true /*10*/, true /*11*/, true /*12*/, true /*13*/},
96 {false /*0*/, false /*1*/, false /*2*/, false /*3*/, false /*4*/, false /*5*/, false /*6*/, false /*7*/,
97 false /*8*/, true /*9*/, true /*10*/, true /*11*/, true /*12*/, true /*13*/, true /*14*/, true /*15*/, true /*16*/,
98 true /*17*/}};
99
100//------------------------------------------------------------------------------
101
102// GeoManager
104
105// Module -----------------------------------------------------------------------
106Double_t YGapBetweenPartsOfModule = 0.0035; // Mrs. Slit
107
111
114
115Double_t XBevelSize = 3.82; // x-bevel for a angled cut
116Double_t YBevelSize = XBevelSize; // y-bevel for a angled cut
117
120
128//------------------------------------------------------------------------------
129
130// Sensor zones -----------------------------------------------------------------
135//------------------------------------------------------------------------------
136
137// Module frames ----------------------------------------------------------------
140
142//------------------------------------------------------------------------------
143
144// Y-shift from center of the gap to the global x-axis (for y-alignment of the module)
146
147// X-shift from center of the module to the origin of the local x-axis
149
150// Y-shift from center of the module to the origin of the local y-axis
152
153/*
154 ASCII module picture (view from target)
155
156 |<---- XModuleSize ---------->| ^
157 | | | Y-axis
158 ------------------------------ ---------
159 | | top border | | ^
160 ------------------------------ |
161 | | | | |
162 | l | rectangle | r | |
163 | e | sensor | i | |
164 | f | zone | g | |
165 | t | | h | |
166 | | | t | |
167 | | | | |
168 ------------------------------ |
169 | | middle (upper part) | |
170 ------ gap between parts ----- YModuleSize
171 | | middle (lower part) | |
172 ------------------------------ |
173 | | | | |
174 | b | bevel (or rect.) | r | |
175 | e | sensor | i | |
176 \ v \ zone | g | |
177 \ e \ | h | |
178 \ l \ | t | |
179 \ \ | | |
180 ------------------------- |
181 \ \ bottom | | v
182 ---------------------- ---------
183
184 * x-axis <----------------------------------(x0,y0) local point
185
186 */
187
188// media
194
195class FairGeoMedia;
196class FairGeoBuilder;
197
198// function declarations
199TGeoVolume* CreateStation(TString station_name);
200TGeoVolume* CreateModule(TString module_name, ModuleType module_type);
201
202void DefineRequiredMedia(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
203{
204
205 // air medium
206 FairGeoMedium* mAir = geoMedia->getMedium("air");
207 if (!mAir)
208 Fatal("Main", "FairMedium air not found");
209 geoBuild->createMedium(mAir);
210 pMedAir = gGeoManager->GetMedium("air");
211 if (!pMedAir)
212 Fatal("Main", "Medium air not found");
213
214 // carbon medium
215 FairGeoMedium* mCarbon = geoMedia->getMedium("carbon");
216 if (!mCarbon)
217 Fatal("Main", "FairMedium carbon not found");
218 geoBuild->createMedium(mCarbon);
219 pMedCarbon = gGeoManager->GetMedium("carbon");
220 if (!pMedCarbon)
221 Fatal("Main", "Medium carbon not found");
222
223 // fiberglass medium
224 FairGeoMedium* mFiberGlass = geoMedia->getMedium("fiberglass");
225 if (!mFiberGlass)
226 Fatal("Main", "FairMedium fiberglass not found");
227 geoBuild->createMedium(mFiberGlass);
228 pMedFiberGlass = gGeoManager->GetMedium("fiberglass");
229 if (!pMedFiberGlass)
230 Fatal("Main", "Medium fiberglass not found");
231
232 // copper medium
233 FairGeoMedium* mCopper = geoMedia->getMedium("copper");
234 if (!mCopper)
235 Fatal("Main", "FairMedium copper not found");
236 geoBuild->createMedium(mCopper);
237 pMedCopper = gGeoManager->GetMedium("copper");
238 if (!pMedCopper)
239 Fatal("Main", "Medium copper not found");
240
241 // silicon medium
242 FairGeoMedium* mSilicon = geoMedia->getMedium("silicon");
243 if (!mSilicon)
244 Fatal("Main", "FairMedium silicon not found");
245 geoBuild->createMedium(mSilicon);
246 pMedSilicon = gGeoManager->GetMedium("silicon");
247 if (!pMedSilicon)
248 Fatal("Main", "Medium silicon not found");
249}
250
252{
253 cout << "\n";
254 cout << "Module parameters information: ---------------------------" << "\n";
255 cout << " XModuleSize = " << XModuleSize << " cm" << "\n";
256 cout << " YModuleSize = " << YModuleSize << " cm" << " ( " << YModuleSizeUpperPart << " + "
257 << YGapBetweenPartsOfModule << " + " << YModuleSizeLowerPart << " )" << "\n";
258 cout << " YModuleSizeUpperPart = " << YModuleSizeUpperPart << " cm" << "\n";
259 cout << " YModuleSizeLowerPart = " << YModuleSizeLowerPart << " cm" << "\n";
260 cout << " YGapBetweenPartsOfModule = " << YGapBetweenPartsOfModule << " cm" << "\n";
261 cout << " ZModuleSize = " << ZModuleSize << " cm" << "\n";
262 cout << "\n";
263 cout << " XBevelSize = " << XBevelSize << " cm" << "\n";
264 cout << " YBevelSize = " << YBevelSize << " cm" << "\n";
265 cout << " BevelAngleDeg = " << BevelAngleDeg << " deg" << "\n";
266 cout << "\n";
267 cout << " XLeftBorder = " << XLeftBorder << " cm" << "\n";
268 cout << " XRightBorder = " << XRightBorder << " cm" << "\n";
269 cout << " YTopBorder = " << YTopBorder << " cm" << "\n";
270 cout << " YMiddleBorderUpperPart = " << YMiddleBorderUpperPart << " cm" << "\n";
271 cout << " YGapBetweenPartsOfModule = " << YGapBetweenPartsOfModule << " cm" << " (gap between two parts)\n";
272 cout << " YMiddleBorderLowerPart = " << YMiddleBorderLowerPart << " cm" << "\n";
273 cout << " YBottomBorder = " << YBottomBorder << " cm" << "\n";
274 cout << " XYBevelBorder = " << XYBevelBorder << " cm" << "\n";
275 cout << "\n";
276 cout << " XSensorZoneSize = " << XSensorZoneSize << " cm" << "\n";
277 cout << " YSensorZoneSizeUpperPart = " << YSensorZoneSizeUpperPart << " cm" << "\n";
278 cout << " YSensorZoneSizeLowerPart = " << YSensorZoneSizeLowerPart << " cm" << "\n";
279 cout << " ZSensorZoneSize = " << ZSensorZoneSize << " cm" << "\n";
280
281 cout << "-------------------------------------------------------------\n";
282}
283
285{
286 cout << "\n";
287 for (Int_t istation = 0; istation < NStations; ++istation) {
288 cout << "station " << istation << ":\n";
289 cout << " XStationPositions[" << istation << "] = " << XStationPositions[istation] << " cm\n";
290 cout << " YStationPositions[" << istation << "] = " << YStationPositions[istation] << " cm\n";
291 cout << " ZStationPositions[" << istation << "] = " << ZStationPositions[istation] << " cm\n";
292 cout << "\n";
293
294 for (Int_t imodule = 0; imodule < NModulesInStations[istation]; ++imodule) {
295 cout << " module " << imodule << ":\n";
296 cout << " XModuleShifts[" << istation << "][" << imodule << "] = " << XModuleShifts[istation][imodule]
297 << " cm\n";
298 cout << " YModuleShifts[" << istation << "][" << imodule << "] = " << YModuleShifts[istation][imodule]
299 << " cm\n";
300 cout << " ZModuleShifts[" << istation << "][" << imodule << "] = " << ZModuleShifts[istation][imodule]
301 << " cm\n";
302 cout << "\n";
303
304 Double_t XGlobalModulePos = XModuleShifts[istation][imodule] + XStationPositions[istation];
305 Double_t YGlobalModulePos = YModuleShifts[istation][imodule] + YStationPositions[istation];
306 Double_t ZGlobalModulePos = ZModuleShifts[istation][imodule] + ZStationPositions[istation];
307
308 cout << " XGlobalModulePos = " << XGlobalModulePos << " cm\n";
309 cout << " YGlobalModulePos = " << YGlobalModulePos << " cm\n";
310 cout << " ZGlobalModulePos = " << ZGlobalModulePos << " cm\n";
311 cout << "\n";
312
313 cout << " ModulesTypes[" << istation << "][" << imodule << "] = ";
314 if (ModulesTypes[istation][imodule] == 0)
315 cout << "RIGHT_ANGLED_MODULE\n";
316 if (ModulesTypes[istation][imodule] == 1)
317 cout << "BEVEL_MODULE\n";
318 if (ModulesTypes[istation][imodule] == 2)
319 cout << "RIGHT_ANGLED_MODULE_HALF\n";
320 if (ModulesTypes[istation][imodule] == 3)
321 cout << "BEVEL_MODULE_HALF\n";
322 cout << " ModulesYRotations[" << istation << "][" << imodule << "] = ";
323 if (ModulesYRotations[istation][imodule] == false)
324 cout << "not rotated around Y\n";
325 if (ModulesYRotations[istation][imodule] == true)
326 cout << "rotated around Y\n";
327 cout << " ModulesXRotations[" << istation << "][" << imodule << "] = ";
328 if (ModulesXRotations[istation][imodule] == false)
329 cout << "not rotated around X\n";
330 if (ModulesXRotations[istation][imodule] == true)
331 cout << "rotated around X\n";
332 cout << "\n";
333 }
334 cout << "-------------------------------------------------------------\n";
335 }
336 cout << "-------------------------------------------------------------\n";
337}
338
340{
341
342 // ---- set working directory --------------------------------------------
343 TString gPath = gSystem->Getenv("VMCWORKDIR");
344
345 // ------- Geometry file name (output) ----------------------------------
346 const TString geoDetectorName = "Silicon";
347 const TString geoDetectorVersion = "Run8_3stations";
348 const TString geoFileName = gPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
349
350 // ---- global geometry parameters ---------------------------------------
351 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
352 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
353
354 // ------- Load media from media file ----------------------------------
355 TString medFile = gPath + "/geometry/media.geo";
356 geoFace->setMediaFile(medFile);
357 geoFace->readMedia();
358 FairGeoMedia* geoMedia = geoFace->getMedia();
359 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
360
361 DefineRequiredMedia(geoMedia, geoBuild);
362 // -------------------------------------------------------------------------
363
364 // Print information about parameters of SILICON
367
368 // -------------- Create geometry and top volume -------------------------
369 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
370 gGeoMan->SetName(geoDetectorName + "_geom");
371 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
372 top->SetMedium(pMedAir);
373 gGeoMan->SetTopVolume(top);
374 // gGeoMan->SetTopVisible(1);
375 // --------------------------------------------------------------------------
376
377 // Define TOP Geometry
378 TGeoVolume* SILICON = new TGeoVolumeAssembly(geoDetectorName);
379 SILICON->SetMedium(pMedAir);
380
381 // Let's create SILICON stations filled with modules
382 for (Int_t istation = 0; istation < NStations; ++istation) {
383
384 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(istation, 10));
385
386 Int_t NModules = NModulesInStations[istation];
387
388 TGeoVolume* modules[NModules];
389 TGeoCombiTrans* modTransforms[NModules];
390
391 for (Int_t imodule = 0; imodule < NModules; ++imodule) {
392
393 TString module_name = TString("module") + TString::Itoa(imodule, 10) + TString("_") + station->GetName();
394 modules[imodule] = CreateModule(module_name, ModulesTypes[istation][imodule]);
395
396 modTransforms[imodule] = new TGeoCombiTrans();
397
398 if (ModulesYRotations[istation][imodule]) {
399 modTransforms[imodule]->RotateY(180.0);
400 modTransforms[imodule]->SetDx(XModuleShifts[istation][imodule] - XShiftFromCenterToLocalX0);
401 } else {
402 modTransforms[imodule]->SetDx(XModuleShifts[istation][imodule] + XShiftFromCenterToLocalX0);
403 }
404
405 if (ModulesXRotations[istation][imodule]) {
406 modTransforms[imodule]->RotateX(180.0);
407 if (ModulesTypes[istation][imodule] == ModuleType::BEVEL_MODULE_HALF
408 || ModulesTypes[istation][imodule] == ModuleType::RIGHT_ANGLED_MODULE_HALF)
409 {
410 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] - YModuleSizeUpperPart * 0.5);
411 } else {
412 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] + YShiftFromCenterToAxis
414 }
415 } else {
416 if (ModulesTypes[istation][imodule] == ModuleType::BEVEL_MODULE_HALF
417 || ModulesTypes[istation][imodule] == ModuleType::RIGHT_ANGLED_MODULE_HALF)
418 {
419 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] + YModuleSizeUpperPart * 0.5);
420 } else {
421 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] + YShiftFromCenterToAxis
423 }
424 }
425
426 Double_t z_module_shift =
427 +ZModuleSize * 0.5; // To z-module position is at the beginning of the sensitive volume
428 modTransforms[imodule]->SetDz(ZModuleShifts[istation][imodule] + z_module_shift);
429
430 // if(imodule == 1) station->AddNode(modules[imodule], 0, modTransforms[imodule]);
431 station->AddNode(modules[imodule], 0, modTransforms[imodule]);
432 }
433
434 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
435 station_transform->SetTranslation(XStationPositions[istation], YStationPositions[istation],
436 ZStationPositions[istation]);
437
438 SILICON->AddNode(station, 0, station_transform);
439 }
440
441 top->AddNode(SILICON, 0);
443
444 // --------------- Finish -----------------------------------------------
445 gGeoMan->CloseGeometry();
446 gGeoMan->CheckOverlaps(0.0001);
447 gGeoMan->PrintOverlaps();
448 gGeoMan->Test();
449
450 TFile* geoFile = new TFile(geoFileName, "RECREATE");
451 top->Write();
452 geoFile->Close();
453 top->Draw("ogl");
454}
455//------------------------------------------------------------------------------
456
458{
459
460 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
461 stationA->SetMedium(pMedAir);
462
463 return stationA;
464}
465
466TGeoVolume* CreateModule(TString module_name, ModuleType module_type)
467{
468
469 // Shapes -------------------------------------------------------------------
470 // module shape
471 TGeoShape* moduleS = 0;
472
473 switch (module_type) {
474 case RIGHT_ANGLED_MODULE: {
475 moduleS = new TGeoBBox("moduleS", XModuleSize * 0.5, YModuleSize * 0.5, ZModuleSize * 0.5);
476 break;
477 }
479 moduleS = new TGeoBBox("moduleS", XModuleSize * 0.5, YModuleSizeUpperPart * 0.5, ZModuleSize * 0.5);
480 break;
481 }
482 case BEVEL_MODULE: {
483 moduleS = new TGeoXtru(2);
484 moduleS->SetName("moduleS");
485 Double_t x_pos[5] = {+XModuleSize * 0.5, -XModuleSize * 0.5, -XModuleSize * 0.5,
486 +XModuleSize * 0.5 - XBevelSize, +XModuleSize * 0.5};
487 Double_t y_pos[5] = {+YModuleSize * 0.5, +YModuleSize * 0.5, -YModuleSize * 0.5, -YModuleSize * 0.5,
488 -YModuleSize * 0.5 + YBevelSize};
489 ((TGeoXtru*)moduleS)->DefinePolygon(5, x_pos, y_pos);
490 ((TGeoXtru*)moduleS)->DefineSection(0, -ZModuleSize * 0.5);
491 ((TGeoXtru*)moduleS)->DefineSection(1, +ZModuleSize * 0.5);
492 break;
493 }
494 case BEVEL_MODULE_HALF: {
495 moduleS = new TGeoXtru(2);
496 moduleS->SetName("moduleS");
497 Double_t x_pos[5] = {+XModuleSize * 0.5, -XModuleSize * 0.5, -XModuleSize * 0.5,
498 +XModuleSize * 0.5 - XBevelSize, +XModuleSize * 0.5};
501 ((TGeoXtru*)moduleS)->DefinePolygon(5, x_pos, y_pos);
502 ((TGeoXtru*)moduleS)->DefineSection(0, -ZModuleSize * 0.5);
503 ((TGeoXtru*)moduleS)->DefineSection(1, +ZModuleSize * 0.5);
504 break;
505 }
506 default:
507 Error("CreateModule()", "Incorrect module type selected!!!");
508 }
509
510 // sensor zone shape (upper part of the module: rectangle zone)
511 TGeoShape* sensor_zone_upper_part_rectS = new TGeoBBox("sensor_zone_upper_part_rectS", XSensorZoneSize * 0.5,
513
514 // sensor zone shape (upper part of the module: bevel zone)
515 TGeoShape* sensor_zone_upper_part_bevelS = new TGeoXtru(2);
516 sensor_zone_upper_part_bevelS->SetName("sensor_zone_upper_part_bevelS");
517 // Calculate coordinates of the bottom and the top points of the inner bevel
518 {
519 // find x and y projections of the bevel border thickness
522
523 // find shifts of the sensetive zone from module borders via the equation of the straight line for the inner
524 // bevel
525 Double_t x_delta_top_BP = XLeftBorder;
526 Double_t y_delta_top_BP =
527 TMath::Tan(TMath::PiOver2() + BevelAngleRad) * x_delta_top_BP + (YBevelSize + y_delta);
528
529 Double_t y_delta_bottom_BP = YMiddleBorderUpperPart;
530 Double_t x_delta_bottom_BP =
531 (y_delta_bottom_BP - (YBevelSize + y_delta)) / (TMath::Tan(TMath::PiOver2() + BevelAngleRad));
532 //----------------------------------------------------------------------
533
534 Double_t x_pos_sensor_zone_bevel[5] = {
536 +XModuleSize * 0.5 - x_delta_bottom_BP, +XModuleSize * 0.5 - XLeftBorder};
537 Double_t y_pos_sensor_zone_bevel[5] = {
540 -YModuleSizeUpperPart * 0.5 + y_delta_top_BP};
541
542 ((TGeoXtru*)sensor_zone_upper_part_bevelS)->DefinePolygon(5, x_pos_sensor_zone_bevel, y_pos_sensor_zone_bevel);
543 ((TGeoXtru*)sensor_zone_upper_part_bevelS)->DefineSection(0, -ZModuleSize * 0.5);
544 ((TGeoXtru*)sensor_zone_upper_part_bevelS)->DefineSection(1, +ZModuleSize * 0.5);
545 }
546
547 // sensor zone shape (lower part of the module: rectangle zone)
548 TGeoShape* sensor_zone_lower_part_rectS = new TGeoBBox("sensor_zone_lower_part_rectS", XSensorZoneSize * 0.5,
550
551 // sensor zone shape (lower part of the module: bevel zone)
552 TGeoShape* sensor_zone_lower_part_bevelS = new TGeoXtru(2);
553 sensor_zone_lower_part_bevelS->SetName("sensor_zone_lower_part_bevelS");
554 // Calculate coordinates of the bottom and the top points of the inner bevel
555 {
556 // find x and y projections of the bevel border thickness
559
560 // find shifts of the sensetive zone from module borders via the equation of the straight line for the inner
561 // bevel
562 Double_t x_delta_top_BP = XLeftBorder;
563 Double_t y_delta_top_BP =
564 TMath::Tan(TMath::PiOver2() + BevelAngleRad) * x_delta_top_BP + (YBevelSize + y_delta);
565
566 Double_t y_delta_bottom_BP = YBottomBorder;
567 Double_t x_delta_bottom_BP =
568 (y_delta_bottom_BP - (YBevelSize + y_delta)) / (TMath::Tan(TMath::PiOver2() + BevelAngleRad));
569 //----------------------------------------------------------------------
570
571 Double_t x_pos_sensor_zone_bevel[5] = {
573 +XModuleSize * 0.5 - x_delta_bottom_BP, +XModuleSize * 0.5 - XLeftBorder};
574 Double_t y_pos_sensor_zone_bevel[5] = {
577 -YModuleSizeLowerPart * 0.5 + y_delta_top_BP};
578
579 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefinePolygon(5, x_pos_sensor_zone_bevel, y_pos_sensor_zone_bevel);
580 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefineSection(0, -ZModuleSize * 0.5);
581 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefineSection(1, +ZModuleSize * 0.5);
582 }
583
584 //--------------------------------------------------------------------------
585
586 // Volumes ------------------------------------------------------------------
587 // module volume
588 // TString module_name = "moduleV_";
589
590 TGeoVolume* moduleV = new TGeoVolume(module_name, moduleS);
591
592 // sensor zone volume (upper part of the module)
593 TGeoVolume* sensor_zone_upper_part_rectV =
594 new TGeoVolume("Sensor_zone_upper_part_rectV", sensor_zone_upper_part_rectS);
595
596 // sensor zone volume (lower part of the module)
597 TGeoVolume* sensor_zone_upper_part_bevelV =
598 new TGeoVolume("Sensor_zone_upper_part_bevelV", sensor_zone_upper_part_bevelS);
599
600 // sensor zone volume (lower part of the module: rectangle zone)
601 TGeoVolume* sensor_zone_lower_part_rectV =
602 new TGeoVolume("Sensor_zone_lower_part_rectV", sensor_zone_lower_part_rectS);
603
604 // sensor zone volume (lower part of the module: bevel zone)
605 TGeoVolume* sensor_zone_lower_part_bevelV =
606 new TGeoVolume("Sensor_zone_lower_part_bevelV", sensor_zone_lower_part_bevelS);
607
608 // volumes media
609 TGeoMedium* silicon_medium = pMedSilicon;
610 if (silicon_medium) {
611 moduleV->SetMedium(silicon_medium);
612 sensor_zone_upper_part_rectV->SetMedium(silicon_medium);
613 sensor_zone_upper_part_bevelV->SetMedium(silicon_medium);
614 sensor_zone_lower_part_rectV->SetMedium(silicon_medium);
615 sensor_zone_lower_part_bevelV->SetMedium(silicon_medium);
616 } else
617 Fatal("Main", "Invalid medium for modules and sensor zones!");
618
619 // volumes visual property (transparency)
620 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
621 sensor_zone_upper_part_rectV->SetLineColor(TColor::GetColor("#e0b0ff"));
622 sensor_zone_upper_part_bevelV->SetLineColor(TColor::GetColor("#e0b0ff"));
623 sensor_zone_lower_part_rectV->SetLineColor(TColor::GetColor("#e0b0ff"));
624 sensor_zone_lower_part_bevelV->SetLineColor(TColor::GetColor("#e0b0ff"));
625 moduleV->SetTransparency(50);
626
627 switch (module_type) {
628
629 case RIGHT_ANGLED_MODULE: {
630
631 // position of the sensor zone in the upper part of the module
632 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
633 sensor_zone_upper_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
634 sensor_zone_upper_part_pos->SetDy(+YSensorZoneSizeUpperPart * 0.5 + YGapBetweenPartsOfModule * 0.5
636 sensor_zone_upper_part_pos->SetDz(0.0);
637
638 // position of the sensor zone in the lower part of the module
639 TGeoTranslation* sensor_zone_lower_part_pos = new TGeoTranslation();
640 sensor_zone_lower_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
641 sensor_zone_lower_part_pos->SetDy(-YSensorZoneSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
643 sensor_zone_lower_part_pos->SetDz(0.0);
644
645 moduleV->AddNode(sensor_zone_upper_part_rectV, 0, sensor_zone_upper_part_pos);
646 moduleV->AddNode(sensor_zone_lower_part_rectV, 0, sensor_zone_lower_part_pos);
647 break;
648 }
649
651 // position of the sensor zone in the upper part of the module
652 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
653 sensor_zone_upper_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
654 sensor_zone_upper_part_pos->SetDy(+(YTopBorder + YMiddleBorderUpperPart) * 0.5 - YTopBorder);
655 sensor_zone_upper_part_pos->SetDz(0.0);
656
657 moduleV->AddNode(sensor_zone_upper_part_rectV, 0, sensor_zone_upper_part_pos);
658 break;
659 }
660
661 case BEVEL_MODULE: {
662
663 // position of the sensor zone in the upper part of the module
664 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
665 sensor_zone_upper_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
666 sensor_zone_upper_part_pos->SetDy(+YSensorZoneSizeUpperPart * 0.5 + YGapBetweenPartsOfModule * 0.5
668 sensor_zone_upper_part_pos->SetDz(0.0);
669
670 // position of the sensor zone in the lower part of the module
671 TGeoTranslation* sensor_zone_lower_part_bevel_pos = new TGeoTranslation();
672 sensor_zone_lower_part_bevel_pos->SetDx(0.0);
673 sensor_zone_lower_part_bevel_pos->SetDy(-YModuleSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
675 sensor_zone_lower_part_bevel_pos->SetDz(0.0);
676
677 moduleV->AddNode(sensor_zone_upper_part_rectV, 0, sensor_zone_upper_part_pos);
678 moduleV->AddNode(sensor_zone_lower_part_bevelV, 0, sensor_zone_lower_part_bevel_pos);
679 break;
680 }
681
682 case BEVEL_MODULE_HALF: {
683
684 // position of the sensor zone in the upper part of the module
685 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
686 sensor_zone_upper_part_pos->SetDx(0);
687 sensor_zone_upper_part_pos->SetDy(0);
688 sensor_zone_upper_part_pos->SetDz(0.0);
689
690 moduleV->AddNode(sensor_zone_upper_part_bevelV, 0, sensor_zone_upper_part_pos);
691 break;
692 }
693
694 default:
695 Error("CreateModule()", "Incorrect module type selected!!!");
696 }
697
698 return moduleV;
699}
bool Bool_t
int Int_t
double Double_t
constexpr Bool_t kTRUE
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 SetTranslation(const TGeoTranslation &tr)
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
const char * GetName() const override
virtual void SetName(const char *name)
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
static TString Itoa(Int_t value, Int_t base)
const Double_t YStationPositions[NStations]
const Double_t ZStationPositions[NStations]
const Double_t XStationPositions[NStations]
const Int_t NModulesInStations[NStations]
ModuleType
@ BEVEL_MODULE
@ RIGHT_ANGLED_MODULE_HALF
@ RIGHT_ANGLED_MODULE
const Bool_t ModulesYRotations[NStations][NMaxModules]
const ModuleType ModulesTypes[NStations][NMaxModules]
const Bool_t ModulesXRotations[NStations][NMaxModules]
TGeoVolume * CreateModule(TString module_name, ModuleType module_type)
TGeoVolume * CreateStation(TString station_name)
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
void create_rootgeom_Silicon_Run8_3stations()
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()