BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_Silicon_RunSpring2018.C
Go to the documentation of this file.
1/*
2 * Baranov D.
3 * 01.06.2018
4 * Use this macro to create ROOT geometry for the RunSpring2018 SILICON
5 * configuration (BM@N RUN-7)
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 = 8; // max. number of modules in a station
16
18
19//(X-Y-Z)Positions of stations (sensitive volumes)
20const Double_t XStationPositions[NStations] = {+0.6295, +0.6295, +0.46525};
21const Double_t YStationPositions[NStations] = {-4.53225, -4.53225, -4.67125};
22// const Double_t ZStationPositions[NStations] = { +13.424, +13.424, +25.717 };
23const Double_t ZStationPositions[NStations] = {+10.524, +10.524,
24 +21.604}; // in accordance with rough alignment correction
25
26/*
27 * where
28 * (1) 13.424 cm = 15.709 - 2.285;
29 * 15.709 cm is the distance between the target and the back side (the nearest to the target) of the Vertex-SI
30 * (from A.Kolesnikov's measurement scheme);
31 * //6.9 cm is the thickness of the Vertex-SI;
32 * 2.285 cm is the distance between the target and the magnet pole (as a reference frame);
33 *
34 * (2) 25.717 cm = 28.002 - 2.285;
35 * 28.002 cm is the distance between the target and the back side (the nearest to the target) of the 8mod-SI(from
36 * A.Kolesnikov's measurement scheme);
37 * //5.11 cm is the thickness of the 8mod-SI;
38 * 2.285 cm is the distance between the target and the magnet pole (as a reference frame);
39 */
40
41//(X-Y-Z)Shifts of modules in each station
42const Double_t XModuleShifts[NStations][NMaxModules] = {{+6.4, -5.9, +5.9, -6.4},
43 {+5.9, -6.4},
44 {+12.15, +6.15, -6.15, -12.15, +12.15, +6.15, -6.15, -12.15}};
45const Double_t YModuleShifts[NStations][NMaxModules] = {{-0.4, +0.1, -0.1, +0.4},
46 {-6.22, -6.72},
47 {-0.15, -0.15, -0.15, -0.15, +0.15, +0.15, +0.15, +0.15}};
49 {+1.44, +2.17, +2.17, +1.44},
50 {+4.71, +5.44},
51 {3.51 /*0*/, 1.98 /*1*/, 3.29 /*2*/, 1.76 /*3*/, 2.25 /*4*/, 3.78 /*5*/, 2.47 /*6*/, 4.0 /*7*/}};
52
53// Geometry parameters of modules
61
67
68// rotations of modules around y-axis by 180 deg.
69const Bool_t ModulesYRotations[NStations][NMaxModules] = {{true, false, true, false},
70 {true, false},
71 {true, true, false, false, true, true, false, false}};
72
73// rotations of modules around x-axis by 180 deg.
74const Bool_t ModulesXRotations[NStations][NMaxModules] = {{false, false, true, true},
75 {false, false},
76 {false, false, false, false, true, true, true, true}};
77
78//------------------------------------------------------------------------------
79
80// GeoManager
82
83// Module -----------------------------------------------------------------------
84Double_t YGapBetweenPartsOfModule = 0.0035; // Mrs. Slit
85
89
92
93Double_t XBevelSize = 3.82; // x-bevel for a angled cut
94Double_t YBevelSize = XBevelSize; // y-bevel for a angled cut
95
98
106//------------------------------------------------------------------------------
107
108// Sensor zones -----------------------------------------------------------------
113//------------------------------------------------------------------------------
114
115// Module frames ----------------------------------------------------------------
118
120//------------------------------------------------------------------------------
121
122// Y-shift from center of the gap to the global x-axis (for y-alignment of the module)
124
125// X-shift from center of the module to the origin of the local x-axis
127
128// Y-shift from center of the module to the origin of the local y-axis
130
131/*
132 ASCII module picture (view from target)
133
134 |<---- XModuleSize ---------->| ^
135 | | | Y-axis
136 ------------------------------ ---------
137 | | top border | | ^
138 ------------------------------ |
139 | | | | |
140 | l | rectangle | r | |
141 | e | sensor | i | |
142 | f | zone | g | |
143 | t | | h | |
144 | | | t | |
145 | | | | |
146 ------------------------------ |
147 | | middle (upper part) | |
148 ------ gap between parts ----- YModuleSize
149 | | middle (lower part) | |
150 ------------------------------ |
151 | | | | |
152 | b | bevel (or rect.) | r | |
153 | e | sensor | i | |
154 \ v \ zone | g | |
155 \ e \ | h | |
156 \ l \ | t | |
157 \ \ | | |
158 ------------------------- |
159 \ \ bottom | | v
160 ---------------------- ---------
161
162 * x-axis <----------------------------------(x0,y0) local point
163
164 */
165
166// media
172
173class FairGeoMedia;
174class FairGeoBuilder;
175
176// function declarations
177TGeoVolume* CreateStation(TString station_name);
178TGeoVolume* CreateModule(TString module_name, ModuleType module_type, Int_t iModule, TString stationName);
179
180void DefineRequiredMedia(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
181{
182
183 // air medium
184 FairGeoMedium* mAir = geoMedia->getMedium("air");
185 if (!mAir)
186 Fatal("Main", "FairMedium air not found");
187 geoBuild->createMedium(mAir);
188 pMedAir = gGeoManager->GetMedium("air");
189 if (!pMedAir)
190 Fatal("Main", "Medium air not found");
191
192 // carbon medium
193 FairGeoMedium* mCarbon = geoMedia->getMedium("carbon");
194 if (!mCarbon)
195 Fatal("Main", "FairMedium carbon not found");
196 geoBuild->createMedium(mCarbon);
197 pMedCarbon = gGeoManager->GetMedium("carbon");
198 if (!pMedCarbon)
199 Fatal("Main", "Medium carbon not found");
200
201 // fiberglass medium
202 FairGeoMedium* mFiberGlass = geoMedia->getMedium("fiberglass");
203 if (!mFiberGlass)
204 Fatal("Main", "FairMedium fiberglass not found");
205 geoBuild->createMedium(mFiberGlass);
206 pMedFiberGlass = gGeoManager->GetMedium("fiberglass");
207 if (!pMedFiberGlass)
208 Fatal("Main", "Medium fiberglass not found");
209
210 // copper medium
211 FairGeoMedium* mCopper = geoMedia->getMedium("copper");
212 if (!mCopper)
213 Fatal("Main", "FairMedium copper not found");
214 geoBuild->createMedium(mCopper);
215 pMedCopper = gGeoManager->GetMedium("copper");
216 if (!pMedCopper)
217 Fatal("Main", "Medium copper not found");
218
219 // silicon medium
220 FairGeoMedium* mSilicon = geoMedia->getMedium("silicon");
221 if (!mSilicon)
222 Fatal("Main", "FairMedium silicon not found");
223 geoBuild->createMedium(mSilicon);
224 pMedSilicon = gGeoManager->GetMedium("silicon");
225 if (!pMedSilicon)
226 Fatal("Main", "Medium silicon not found");
227}
228
230{
231 cout << "\n";
232 cout << "Module parameters information: ---------------------------" << "\n";
233 cout << " XModuleSize = " << XModuleSize << " cm" << "\n";
234 cout << " YModuleSize = " << YModuleSize << " cm" << " ( " << YModuleSizeUpperPart << " + "
235 << YGapBetweenPartsOfModule << " + " << YModuleSizeLowerPart << " )" << "\n";
236 cout << " YModuleSizeUpperPart = " << YModuleSizeUpperPart << " cm" << "\n";
237 cout << " YModuleSizeLowerPart = " << YModuleSizeLowerPart << " cm" << "\n";
238 cout << " YGapBetweenPartsOfModule = " << YGapBetweenPartsOfModule << " cm" << "\n";
239 cout << " ZModuleSize = " << ZModuleSize << " cm" << "\n";
240 cout << "\n";
241 cout << " XBevelSize = " << XBevelSize << " cm" << "\n";
242 cout << " YBevelSize = " << YBevelSize << " cm" << "\n";
243 cout << " BevelAngleDeg = " << BevelAngleDeg << " deg" << "\n";
244 cout << "\n";
245 cout << " XLeftBorder = " << XLeftBorder << " cm" << "\n";
246 cout << " XRightBorder = " << XRightBorder << " cm" << "\n";
247 cout << " YTopBorder = " << YTopBorder << " cm" << "\n";
248 cout << " YMiddleBorderUpperPart = " << YMiddleBorderUpperPart << " cm" << "\n";
249 cout << " YGapBetweenPartsOfModule = " << YGapBetweenPartsOfModule << " cm" << " (gap between two parts)\n";
250 cout << " YMiddleBorderLowerPart = " << YMiddleBorderLowerPart << " cm" << "\n";
251 cout << " YBottomBorder = " << YBottomBorder << " cm" << "\n";
252 cout << " XYBevelBorder = " << XYBevelBorder << " cm" << "\n";
253 cout << "\n";
254 cout << " XSensorZoneSize = " << XSensorZoneSize << " cm" << "\n";
255 cout << " YSensorZoneSizeUpperPart = " << YSensorZoneSizeUpperPart << " cm" << "\n";
256 cout << " YSensorZoneSizeLowerPart = " << YSensorZoneSizeLowerPart << " cm" << "\n";
257 cout << " ZSensorZoneSize = " << ZSensorZoneSize << " cm" << "\n";
258
259 cout << "-------------------------------------------------------------\n";
260}
261
263{
264 cout << "\n";
265 for (Int_t istation = 0; istation < NStations; ++istation) {
266 cout << "station " << istation << ":\n";
267 cout << " XStationPositions[" << istation << "] = " << XStationPositions[istation] << " cm\n";
268 cout << " YStationPositions[" << istation << "] = " << YStationPositions[istation] << " cm\n";
269 cout << " ZStationPositions[" << istation << "] = " << ZStationPositions[istation] << " cm\n";
270 cout << "\n";
271
272 for (Int_t imodule = 0; imodule < NModulesInStations[istation]; ++imodule) {
273 cout << " module " << imodule << ":\n";
274 cout << " XModuleShifts[" << istation << "][" << imodule << "] = " << XModuleShifts[istation][imodule]
275 << " cm\n";
276 cout << " YModuleShifts[" << istation << "][" << imodule << "] = " << YModuleShifts[istation][imodule]
277 << " cm\n";
278 cout << " ZModuleShifts[" << istation << "][" << imodule << "] = " << ZModuleShifts[istation][imodule]
279 << " cm\n";
280 cout << "\n";
281
282 Double_t XGlobalModulePos = XModuleShifts[istation][imodule] + XStationPositions[istation];
283 Double_t YGlobalModulePos = YModuleShifts[istation][imodule] + YStationPositions[istation];
284 Double_t ZGlobalModulePos = ZModuleShifts[istation][imodule] + ZStationPositions[istation];
285
286 cout << " XGlobalModulePos = " << XGlobalModulePos << " cm\n";
287 cout << " YGlobalModulePos = " << YGlobalModulePos << " cm\n";
288 cout << " ZGlobalModulePos = " << ZGlobalModulePos << " cm\n";
289 cout << "\n";
290
291 cout << " ModulesTypes[" << istation << "][" << imodule << "] = ";
292 if (ModulesTypes[istation][imodule] == 0)
293 cout << "RIGHT_ANGLED_MODULE\n";
294 if (ModulesTypes[istation][imodule] == 1)
295 cout << "BEVEL_MODULE\n";
296 if (ModulesTypes[istation][imodule] == 2)
297 cout << "RIGHT_ANGLED_MODULE_HALF\n";
298 if (ModulesTypes[istation][imodule] == 3)
299 cout << "BEVEL_MODULE_HALF\n";
300 cout << " ModulesYRotations[" << istation << "][" << imodule << "] = ";
301 if (ModulesYRotations[istation][imodule] == false)
302 cout << "not rotated around Y\n";
303 if (ModulesYRotations[istation][imodule] == true)
304 cout << "rotated around Y\n";
305 cout << " ModulesXRotations[" << istation << "][" << imodule << "] = ";
306 if (ModulesXRotations[istation][imodule] == false)
307 cout << "not rotated around X\n";
308 if (ModulesXRotations[istation][imodule] == true)
309 cout << "rotated around X\n";
310 cout << "\n";
311 }
312 cout << "-------------------------------------------------------------\n";
313 }
314 cout << "-------------------------------------------------------------\n";
315}
316
318{
319
320 // ---- set working directory --------------------------------------------
321 TString gPath = gSystem->Getenv("VMCWORKDIR");
322
323 // ------- Geometry file name (output) ----------------------------------
324 const TString geoDetectorName = "Silicon";
325 const TString geoDetectorVersion = "RunSpring2018";
326 const TString geoFileName = gPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
327
328 // ---- global geometry parameters ---------------------------------------
329 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
330 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
331
332 // ------- Load media from media file ----------------------------------
333 TString medFile = gPath + "/geometry/media.geo";
334 geoFace->setMediaFile(medFile);
335 geoFace->readMedia();
336 FairGeoMedia* geoMedia = geoFace->getMedia();
337 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
338
339 DefineRequiredMedia(geoMedia, geoBuild);
340 // -------------------------------------------------------------------------
341
342 // Print information about parameters of SILICON
345
346 // -------------- Create geometry and top volume -------------------------
347 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
348 gGeoMan->SetName(geoDetectorName + "_geom");
349 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
350 top->SetMedium(pMedAir);
351 gGeoMan->SetTopVolume(top);
352 // gGeoMan->SetTopVisible(1);
353 // --------------------------------------------------------------------------
354
355 // Define TOP Geometry
356 TGeoVolume* SILICON = new TGeoVolumeAssembly(geoDetectorName);
357 SILICON->SetMedium(pMedAir);
358
359 // Let's create SILICON stations filled with modules
360 for (Int_t istation = 0; istation < NStations; ++istation) {
361
362 TGeoVolume* station = CreateStation(TString("station") + TString::Itoa(istation, 10));
363
364 Int_t NModules = NModulesInStations[istation];
365
366 TGeoVolume* modules[NModules];
367 TGeoCombiTrans* modTransforms[NModules];
368
369 for (Int_t imodule = 0; imodule < NModules; ++imodule) {
370
371 TString module_name = TString("module") + TString::Itoa(imodule, 10) + TString("_") + station->GetName();
372 modules[imodule] = CreateModule(module_name, ModulesTypes[istation][imodule], imodule, station->GetName());
373
374 modTransforms[imodule] = new TGeoCombiTrans();
375
376 if (ModulesYRotations[istation][imodule]) {
377 modTransforms[imodule]->RotateY(180.0);
378 modTransforms[imodule]->SetDx(XModuleShifts[istation][imodule] - XShiftFromCenterToLocalX0);
379 } else {
380 modTransforms[imodule]->SetDx(XModuleShifts[istation][imodule] + XShiftFromCenterToLocalX0);
381 }
382
383 if (ModulesXRotations[istation][imodule]) {
384 modTransforms[imodule]->RotateX(180.0);
385 if (ModulesTypes[istation][imodule] == ModuleType::BEVEL_MODULE_HALF
386 || ModulesTypes[istation][imodule] == ModuleType::RIGHT_ANGLED_MODULE_HALF)
387 {
388 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] - YModuleSizeUpperPart * 0.5);
389 } else {
390 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] + YShiftFromCenterToAxis
392 }
393 } else {
394 if (ModulesTypes[istation][imodule] == ModuleType::BEVEL_MODULE_HALF
395 || ModulesTypes[istation][imodule] == ModuleType::RIGHT_ANGLED_MODULE_HALF)
396 {
397 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] + YModuleSizeUpperPart * 0.5);
398 } else {
399 modTransforms[imodule]->SetDy(YModuleShifts[istation][imodule] + YShiftFromCenterToAxis
401 }
402 }
403
404 Double_t z_module_shift =
405 +ZModuleSize * 0.5; // To z-module position is at the beginning of the sensitive volume
406 modTransforms[imodule]->SetDz(ZModuleShifts[istation][imodule] + z_module_shift);
407
408 // if(imodule == 1) station->AddNode(modules[imodule], 0, modTransforms[imodule]);
409 station->AddNode(modules[imodule], 0, modTransforms[imodule]);
410 }
411
412 TGeoCombiTrans* station_transform = new TGeoCombiTrans();
413 station_transform->SetTranslation(XStationPositions[istation], YStationPositions[istation],
414 ZStationPositions[istation]);
415
416 SILICON->AddNode(station, 0, station_transform);
417 }
418
419 top->AddNode(SILICON, 0);
421
422 // --------------- Finish -----------------------------------------------
423 gGeoMan->CloseGeometry();
424 gGeoMan->CheckOverlaps(0.0001);
425 gGeoMan->PrintOverlaps();
426 gGeoMan->Test();
427
428 TFile* geoFile = new TFile(geoFileName, "RECREATE");
429 top->Write();
430 geoFile->Close();
431 top->Draw("ogl");
432}
433//------------------------------------------------------------------------------
434
436{
437
438 TGeoVolume* stationA = new TGeoVolumeAssembly(station_name);
439 stationA->SetMedium(pMedAir);
440
441 return stationA;
442}
443
444TGeoVolume* CreateModule(TString module_name, ModuleType module_type, Int_t iModule, TString stationName)
445{
446
447 // Shapes -------------------------------------------------------------------
448 // module shape
449 TGeoShape* moduleS = 0;
450
451 switch (module_type) {
452 case RIGHT_ANGLED_MODULE: {
453 moduleS = new TGeoBBox("moduleS", XModuleSize * 0.5, YModuleSize * 0.5, ZModuleSize * 0.5);
454 break;
455 }
457 moduleS = new TGeoBBox("moduleS", XModuleSize * 0.5, YModuleSizeUpperPart * 0.5, ZModuleSize * 0.5);
458 break;
459 }
460 case BEVEL_MODULE: {
461 moduleS = new TGeoXtru(2);
462 moduleS->SetName("moduleS");
463 Double_t x_pos[5] = {+XModuleSize * 0.5, -XModuleSize * 0.5, -XModuleSize * 0.5,
464 +XModuleSize * 0.5 - XBevelSize, +XModuleSize * 0.5};
465 Double_t y_pos[5] = {+YModuleSize * 0.5, +YModuleSize * 0.5, -YModuleSize * 0.5, -YModuleSize * 0.5,
466 -YModuleSize * 0.5 + YBevelSize};
467 ((TGeoXtru*)moduleS)->DefinePolygon(5, x_pos, y_pos);
468 ((TGeoXtru*)moduleS)->DefineSection(0, -ZModuleSize * 0.5);
469 ((TGeoXtru*)moduleS)->DefineSection(1, +ZModuleSize * 0.5);
470 break;
471 }
472 case BEVEL_MODULE_HALF: {
473 moduleS = new TGeoXtru(2);
474 moduleS->SetName("moduleS");
475 Double_t x_pos[5] = {+XModuleSize * 0.5, -XModuleSize * 0.5, -XModuleSize * 0.5,
476 +XModuleSize * 0.5 - XBevelSize, +XModuleSize * 0.5};
479 ((TGeoXtru*)moduleS)->DefinePolygon(5, x_pos, y_pos);
480 ((TGeoXtru*)moduleS)->DefineSection(0, -ZModuleSize * 0.5);
481 ((TGeoXtru*)moduleS)->DefineSection(1, +ZModuleSize * 0.5);
482 break;
483 }
484 default:
485 Error("CreateModule()", "Incorrect module type selected!!!");
486 }
487
488 // sensor zone shape (upper part of the module: rectangle zone)
489 TGeoShape* sensor_zone_upper_part_rectS = new TGeoBBox("sensor_zone_upper_part_rectS", XSensorZoneSize * 0.5,
491
492 // sensor zone shape (upper part of the module: bevel zone)
493 TGeoShape* sensor_zone_upper_part_bevelS = new TGeoXtru(2);
494 sensor_zone_upper_part_bevelS->SetName("sensor_zone_upper_part_bevelS");
495 // Calculate coordinates of the bottom and the top points of the inner bevel
496 {
497 // find x and y projections of the bevel border thickness
500
501 // find shifts of the sensetive zone from module borders via the equation of the straight line for the inner
502 // bevel
503 Double_t x_delta_top_BP = XLeftBorder;
504 Double_t y_delta_top_BP =
505 TMath::Tan(TMath::PiOver2() + BevelAngleRad) * x_delta_top_BP + (YBevelSize + y_delta);
506
507 Double_t y_delta_bottom_BP = YMiddleBorderUpperPart;
508 Double_t x_delta_bottom_BP =
509 (y_delta_bottom_BP - (YBevelSize + y_delta)) / (TMath::Tan(TMath::PiOver2() + BevelAngleRad));
510 //----------------------------------------------------------------------
511
512 Double_t x_pos_sensor_zone_bevel[5] = {
514 +XModuleSize * 0.5 - x_delta_bottom_BP, +XModuleSize * 0.5 - XLeftBorder};
515 Double_t y_pos_sensor_zone_bevel[5] = {
518 -YModuleSizeUpperPart * 0.5 + y_delta_top_BP};
519
520 ((TGeoXtru*)sensor_zone_upper_part_bevelS)->DefinePolygon(5, x_pos_sensor_zone_bevel, y_pos_sensor_zone_bevel);
521 ((TGeoXtru*)sensor_zone_upper_part_bevelS)->DefineSection(0, -ZModuleSize * 0.5);
522 ((TGeoXtru*)sensor_zone_upper_part_bevelS)->DefineSection(1, +ZModuleSize * 0.5);
523 }
524
525 // sensor zone shape (lower part of the module: rectangle zone)
526 TGeoShape* sensor_zone_lower_part_rectS = new TGeoBBox("sensor_zone_lower_part_rectS", XSensorZoneSize * 0.5,
528
529 // sensor zone shape (lower part of the module: bevel zone)
530 TGeoShape* sensor_zone_lower_part_bevelS = new TGeoXtru(2);
531 sensor_zone_lower_part_bevelS->SetName("sensor_zone_lower_part_bevelS");
532 // Calculate coordinates of the bottom and the top points of the inner bevel
533 {
534 // find x and y projections of the bevel border thickness
537
538 // find shifts of the sensetive zone from module borders via the equation of the straight line for the inner
539 // bevel
540 Double_t x_delta_top_BP = XLeftBorder;
541 Double_t y_delta_top_BP =
542 TMath::Tan(TMath::PiOver2() + BevelAngleRad) * x_delta_top_BP + (YBevelSize + y_delta);
543
544 Double_t y_delta_bottom_BP = YBottomBorder;
545 Double_t x_delta_bottom_BP =
546 (y_delta_bottom_BP - (YBevelSize + y_delta)) / (TMath::Tan(TMath::PiOver2() + BevelAngleRad));
547 //----------------------------------------------------------------------
548
549 Double_t x_pos_sensor_zone_bevel[5] = {
551 +XModuleSize * 0.5 - x_delta_bottom_BP, +XModuleSize * 0.5 - XLeftBorder};
552 Double_t y_pos_sensor_zone_bevel[5] = {
555 -YModuleSizeLowerPart * 0.5 + y_delta_top_BP};
556
557 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefinePolygon(5, x_pos_sensor_zone_bevel, y_pos_sensor_zone_bevel);
558 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefineSection(0, -ZModuleSize * 0.5);
559 ((TGeoXtru*)sensor_zone_lower_part_bevelS)->DefineSection(1, +ZModuleSize * 0.5);
560 }
561
562 //--------------------------------------------------------------------------
563
564 // Volumes ------------------------------------------------------------------
565 // module volume
566 // TString module_name = "moduleV_";
567
568 TGeoVolume* moduleV = new TGeoVolume(module_name, moduleS);
569
570 // sensor zone volume (upper part of the module)
571 TGeoVolume* sensor_zone_upper_part_rectV = new TGeoVolume(
572 Form("Sensor_zone_upper_part_rectV_module%d_", iModule) + stationName, sensor_zone_upper_part_rectS);
573
574 // sensor zone volume (lower part of the module)
575 TGeoVolume* sensor_zone_upper_part_bevelV = new TGeoVolume(
576 Form("Sensor_zone_upper_part_rectV_module%d_", iModule) + stationName, sensor_zone_upper_part_bevelS);
577
578 // sensor zone volume (lower part of the module: rectangle zone)
579 TGeoVolume* sensor_zone_lower_part_rectV = new TGeoVolume(
580 Form("Sensor_zone_lower_part_rectV_module%d_", iModule) + stationName, sensor_zone_lower_part_rectS);
581
582 // sensor zone volume (lower part of the module: bevel zone)
583 TGeoVolume* sensor_zone_lower_part_bevelV = new TGeoVolume(
584 Form("Sensor_zone_lower_part_rectV_module%d_", iModule) + stationName, sensor_zone_lower_part_bevelS);
585
586 // volumes media
587 TGeoMedium* silicon_medium = pMedSilicon;
588 if (silicon_medium) {
589 moduleV->SetMedium(silicon_medium);
590 sensor_zone_upper_part_rectV->SetMedium(silicon_medium);
591 sensor_zone_upper_part_bevelV->SetMedium(silicon_medium);
592 sensor_zone_lower_part_rectV->SetMedium(silicon_medium);
593 sensor_zone_lower_part_bevelV->SetMedium(silicon_medium);
594 } else
595 Fatal("Main", "Invalid medium for modules and sensor zones!");
596
597 // volumes visual property (transparency)
598 moduleV->SetLineColor(TColor::GetColor("#ff47ca"));
599 sensor_zone_upper_part_rectV->SetLineColor(TColor::GetColor("#e0b0ff"));
600 sensor_zone_upper_part_bevelV->SetLineColor(TColor::GetColor("#e0b0ff"));
601 sensor_zone_lower_part_rectV->SetLineColor(TColor::GetColor("#e0b0ff"));
602 sensor_zone_lower_part_bevelV->SetLineColor(TColor::GetColor("#e0b0ff"));
603 moduleV->SetTransparency(50);
604
605 switch (module_type) {
606
607 case RIGHT_ANGLED_MODULE: {
608
609 // position of the sensor zone in the upper part of the module
610 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
611 sensor_zone_upper_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
612 sensor_zone_upper_part_pos->SetDy(+YSensorZoneSizeUpperPart * 0.5 + YGapBetweenPartsOfModule * 0.5
614 sensor_zone_upper_part_pos->SetDz(0.0);
615
616 // position of the sensor zone in the lower part of the module
617 TGeoTranslation* sensor_zone_lower_part_pos = new TGeoTranslation();
618 sensor_zone_lower_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
619 sensor_zone_lower_part_pos->SetDy(-YSensorZoneSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
621 sensor_zone_lower_part_pos->SetDz(0.0);
622
623 moduleV->AddNode(sensor_zone_upper_part_rectV, 0, sensor_zone_upper_part_pos);
624 moduleV->AddNode(sensor_zone_lower_part_rectV, 0, sensor_zone_lower_part_pos);
625 break;
626 }
627
629 // position of the sensor zone in the upper part of the module
630 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
631 sensor_zone_upper_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
632 sensor_zone_upper_part_pos->SetDy(+(YTopBorder + YMiddleBorderUpperPart) * 0.5 - YTopBorder);
633 sensor_zone_upper_part_pos->SetDz(0.0);
634
635 moduleV->AddNode(sensor_zone_upper_part_rectV, 0, sensor_zone_upper_part_pos);
636 break;
637 }
638
639 case BEVEL_MODULE: {
640
641 // position of the sensor zone in the upper part of the module
642 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
643 sensor_zone_upper_part_pos->SetDx(+(XLeftBorder + XRightBorder) * 0.5 - XLeftBorder);
644 sensor_zone_upper_part_pos->SetDy(+YSensorZoneSizeUpperPart * 0.5 + YGapBetweenPartsOfModule * 0.5
646 sensor_zone_upper_part_pos->SetDz(0.0);
647
648 // position of the sensor zone in the lower part of the module
649 TGeoTranslation* sensor_zone_lower_part_bevel_pos = new TGeoTranslation();
650 sensor_zone_lower_part_bevel_pos->SetDx(0.0);
651 sensor_zone_lower_part_bevel_pos->SetDy(-YModuleSizeLowerPart * 0.5 - YGapBetweenPartsOfModule * 0.5
653 sensor_zone_lower_part_bevel_pos->SetDz(0.0);
654
655 moduleV->AddNode(sensor_zone_upper_part_rectV, 0, sensor_zone_upper_part_pos);
656 moduleV->AddNode(sensor_zone_lower_part_bevelV, 0, sensor_zone_lower_part_bevel_pos);
657 break;
658 }
659
660 case BEVEL_MODULE_HALF: {
661
662 // position of the sensor zone in the upper part of the module
663 TGeoTranslation* sensor_zone_upper_part_pos = new TGeoTranslation();
664 sensor_zone_upper_part_pos->SetDx(0);
665 sensor_zone_upper_part_pos->SetDy(0);
666 sensor_zone_upper_part_pos->SetDz(0.0);
667
668 moduleV->AddNode(sensor_zone_upper_part_bevelV, 0, sensor_zone_upper_part_pos);
669 break;
670 }
671
672 default:
673 Error("CreateModule()", "Incorrect module type selected!!!");
674 }
675
676 return moduleV;
677}
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
char * Form(const char *fmt,...)
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]
TGeoMedium * pMedFiberGlass
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, Int_t iModule, TString stationName)
void create_rootgeom_Silicon_RunSpring2018()
TGeoVolume * CreateStation(TString station_name)
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
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()