BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_TOF1.C
Go to the documentation of this file.
1
//---------------------------
2
3
TGeoManager
*
gGeoMan
= NULL;
4
5
// Detector's position
6
const
Double_t
TOF1_Xpos
= 0.0;
7
const
Double_t
TOF1_Ypos
= 0.0;
8
const
Double_t
TOF1_Zpos
= 440.0;
// cm
9
10
// Detector's construct parameters
11
const
Double_t
XWidthOfModule_TOF1
= 100.0;
12
const
Double_t
YHeightOfModule_TOF1
= 200.0;
13
const
Double_t
ZLengthOfModule_TOF1
= 20.0;
14
const
Double_t
GapSize_TOF1
= 100.0;
15
16
const
Double_t
XSizeOfActiveVolume_TOF1
=
XWidthOfModule_TOF1
;
17
const
Double_t
YSizeOfActiveVolume_TOF1
=
YHeightOfModule_TOF1
;
18
const
Double_t
ZSizeOfActiveVolume_TOF1
=
ZLengthOfModule_TOF1
;
19
20
void
create_rootgeom_TOF1
()
21
{
22
23
// Load the necessary FairRoot libraries
24
gROOT
->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C"
);
25
bmnloadlibs();
// load libraries
26
27
// ------- Load media from media file -----------------------------------
28
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
29
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
30
TString
geoPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
31
TString
medFile = geoPath +
"/geometry/media.geo"
;
32
geoFace->setMediaFile(medFile);
33
geoFace->readMedia();
34
gGeoMan
=
gGeoManager
;
35
// --------------------------------------------------------------------------
36
37
// ------- Geometry file name (output) ----------------------------------
38
const
TString
geoDetectorName =
"tof1"
;
39
const
TString
geoDetectorVersion =
"v1"
;
40
geoFileName = geoPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
41
// --------------------------------------------------------------------------
42
43
// ----------------- Get and create the required media -----------------
44
FairGeoMedia* geoMedia = geoFace->getMedia();
45
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
46
47
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
48
if
(!mAir)
49
Fatal
(
"Main"
,
"FairMedium air not found"
);
50
geoBuild->createMedium(mAir);
51
TGeoMedium
* pMedAir =
gGeoMan
->GetMedium(
"air"
);
52
if
(!pMedAir)
53
Fatal
(
"Main"
,
"Medium air not found"
);
54
55
FairGeoMedium* mArCO27030 = geoMedia->getMedium(
"arco27030"
);
56
if
(!mArCO27030)
57
Fatal
(
"Main"
,
"FairMedium arco27030 not found"
);
58
geoBuild->createMedium(mArCO27030);
59
TGeoMedium
* pMedArCO27030 =
gGeoMan
->GetMedium(
"arco27030"
);
60
if
(!pMedArCO27030)
61
Fatal
(
"Main"
,
"Medium arco27030 not found"
);
62
63
// --------------------------------------------------------------------------
64
65
// -------------- Create geometry and top volume -------------------------
66
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
67
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
68
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
69
top->
SetMedium
(pMedAir);
70
gGeoMan
->SetTopVolume(top);
71
// gGeoMan->SetTopVisible(1);
72
// --------------------------------------------------------------------------
73
74
// Define TOP Geometry
75
TGeoVolume
* TOF1Top =
new
TGeoVolumeAssembly
(geoDetectorName);
76
TOF1Top->
SetMedium
(pMedAir);
77
78
// Transformations (translations, rotations and scales)
79
TGeoTranslation
* DetPos_trans =
new
TGeoTranslation
(
"DetPos_trans"
,
TOF1_Xpos
,
TOF1_Ypos
,
TOF1_Zpos
);
80
// DetPos_trans->RegisterYourself();
81
TGeoTranslation
* LeftModulePosTOF1_trans =
new
TGeoTranslation
(
"LeftModulePosTOF1_trans"
,
GapSize_TOF1
, 0.0, 0.0);
82
// LeftModulePosTOF1_trans->RegisterYourself();
83
TGeoTranslation
* RightModulePosTOF1_trans =
84
new
TGeoTranslation
(
"RightModulePosTOF1_trans"
, -
GapSize_TOF1
, 0.0, 0.0);
85
// RightModulePosTOF1_trans->RegisterYourself();
86
87
// Solids (shapes)
88
TGeoBBox
* TOF1ContainerS =
new
TGeoBBox
(
"TOF1ContainerS"
, ((
XWidthOfModule_TOF1
* 2) +
GapSize_TOF1
) / 2,
89
YHeightOfModule_TOF1
/ 2,
ZLengthOfModule_TOF1
/ 2);
90
TGeoBBox
* TOF1ModuleS =
91
new
TGeoBBox
(
"TOF1ModuleS"
,
XWidthOfModule_TOF1
/ 2,
YHeightOfModule_TOF1
/ 2,
ZLengthOfModule_TOF1
/ 2);
92
TGeoBBox
* TOF1ActiveVolumeS =
new
TGeoBBox
(
"TOF1ActiveVolumeS"
,
XSizeOfActiveVolume_TOF1
/ 2,
93
YSizeOfActiveVolume_TOF1
/ 2,
ZSizeOfActiveVolume_TOF1
/ 2);
94
95
// Composite solids (shapes)
96
97
// Volumes
98
TGeoVolume
* TOF1ContainerV =
new
TGeoVolume
(
"TOF1ContainerV"
, TOF1ContainerS);
99
TOF1ContainerV->
SetMedium
(pMedAir);
100
// TOF1ContainerV->SetVisibility(kFALSE);
101
102
TGeoVolume
* TOF1ModuleV =
new
TGeoVolume
(
"TOF1ModuleV"
, TOF1ModuleS);
103
TOF1ModuleV->
SetMedium
(pMedAir);
104
TOF1ModuleV->
SetLineColor
(
kBlue
);
105
// TOF1ModuleV->SetTransparency(80);
106
107
TGeoVolume
* TOF1ActiveVolumeV =
new
TGeoVolume
(
"TOF1ActiveVolumeV"
, TOF1ActiveVolumeS);
108
TOF1ActiveVolumeV->
SetMedium
(pMedArCO27030);
109
TOF1ActiveVolumeV->
SetLineColor
(
kGreen
);
110
111
// Adding volumes to the TOP Volume
112
top->
AddNode
(TOF1Top, 1, DetPos_trans);
113
TOF1Top->
AddNode
(TOF1ContainerV, 1);
114
115
TOF1ContainerV->
AddNode
(TOF1ModuleV, 1, LeftModulePosTOF1_trans);
116
TOF1ContainerV->
AddNode
(TOF1ModuleV, 2, RightModulePosTOF1_trans);
117
118
TOF1ModuleV->
AddNode
(TOF1ActiveVolumeV, 1);
119
120
top->
SetVisContainers
(
kTRUE
);
121
122
// --------------- Finish -----------------------------------------------
123
gGeoMan
->CloseGeometry();
124
gGeoMan
->CheckOverlaps(0.001);
125
gGeoMan
->PrintOverlaps();
126
gGeoMan
->Test();
127
128
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
129
top->
Write
();
130
geoFile->
Close
();
131
top->
Draw
(
"ogl"
);
132
}
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
kGreen
kGreen
kBlue
kBlue
Fatal
void Fatal(const char *location, const char *msgfmt,...)
gGeoManager
R__EXTERN TGeoManager * gGeoManager
gROOT
#define gROOT
gSystem
R__EXTERN TSystem * gSystem
TFile
TFile::Close
void Close(Option_t *option="") override
TGeoBBox
TGeoManager
TGeoMedium
TGeoTranslation
TGeoVolumeAssembly
TGeoVolume
TGeoVolume::SetVisContainers
void SetVisContainers(Bool_t flag=kTRUE) override
TGeoVolume::AddNode
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
TGeoVolume::Draw
void Draw(Option_t *option="") override
TGeoVolume::SetMedium
virtual void SetMedium(TGeoMedium *medium)
TGeoVolume::SetLineColor
void SetLineColor(Color_t lcolor) override
TObject::Write
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
TString
gGeoMan
TGeoManager * gGeoMan
Definition
create_rootgeom_TOF1.C:3
GapSize_TOF1
const Double_t GapSize_TOF1
Definition
create_rootgeom_TOF1.C:14
XSizeOfActiveVolume_TOF1
const Double_t XSizeOfActiveVolume_TOF1
Definition
create_rootgeom_TOF1.C:16
YSizeOfActiveVolume_TOF1
const Double_t YSizeOfActiveVolume_TOF1
Definition
create_rootgeom_TOF1.C:17
ZLengthOfModule_TOF1
const Double_t ZLengthOfModule_TOF1
Definition
create_rootgeom_TOF1.C:13
TOF1_Zpos
const Double_t TOF1_Zpos
Definition
create_rootgeom_TOF1.C:8
ZSizeOfActiveVolume_TOF1
const Double_t ZSizeOfActiveVolume_TOF1
Definition
create_rootgeom_TOF1.C:18
TOF1_Xpos
const Double_t TOF1_Xpos
Definition
create_rootgeom_TOF1.C:6
YHeightOfModule_TOF1
const Double_t YHeightOfModule_TOF1
Definition
create_rootgeom_TOF1.C:12
TOF1_Ypos
const Double_t TOF1_Ypos
Definition
create_rootgeom_TOF1.C:7
XWidthOfModule_TOF1
const Double_t XWidthOfModule_TOF1
Definition
create_rootgeom_TOF1.C:11
create_rootgeom_TOF1
void create_rootgeom_TOF1()
Definition
create_rootgeom_TOF1.C:20
macro
geometry
create_rootgeom_TOF1.C
Generated on
for BmnRoot by
1.17.0