BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_SiBT_Run9.C
Go to the documentation of this file.
1
/*
2
* Use this macro to create basic ROOT geometry of Silicon Beam Tracker (SiBT)
3
* for the RUN-9 configuration (3 stations)
4
*
5
* Author: Baranov D.
6
* Created: 25.04.2025
7
*
8
* WARNING: all units is in cm!!!
9
*/
10
11
// Set Parameters of SiBT --------------------------------------------------------
12
const
Int_t
NStations
= 3;
// stations in the detector
13
const
Int_t
NMaxModules
= 1;
// max. number of modules in a station
14
15
// X-position of geometrical center of sensor
16
const
Double_t
XStationPositions
[
NStations
] = {
17
+0.002,
// st. 0 (+0.002 + 0.0)
18
-0.258,
// st. 1 (+0.012 + (-0.27))
19
+0.097
// st. 2 (+0.137 + (-0.04))
20
};
21
22
// Y-position of geometrical center of sensor
23
const
Double_t
YStationPositions
[
NStations
] = {
24
+0.084,
// st. 0 (-0.006 + 0.09)
25
-0.003,
// st. 1 (+0.027 + (-0.03))
26
+0.105
// st. 2 (+0.095 + 0.01)
27
};
28
29
// Z-position of sensor side, closest to the beam
30
const
Double_t
ZStationPositions
[
NStations
] = {
31
-283.39,
// st. 0 (-283.060 - 0.33)
32
-183.386,
// st. 1 (-183.276 - 0.11)
33
-84.397
// st. 2 (-84.087 - 0.31)
34
};
35
36
//(X-Y-Z)Shifts of modules in each station
37
const
Double_t
XModuleShifts
[
NStations
][
NMaxModules
] = {
38
{0.0},
// st. 0
39
{0.0},
// st. 1
40
{0.0}
// st. 2
41
};
42
const
Double_t
YModuleShifts
[
NStations
][
NMaxModules
] = {
43
{0.0},
// st. 0
44
{0.0},
// st. 1
45
{0.0}
// st. 2
46
};
47
const
Double_t
ZModuleShifts
[
NStations
][
NMaxModules
] = {
48
{0.0},
// st. 0
49
{0.0},
// st. 1
50
{0.0}
// st. 2
51
};
52
53
// Rotations of stations around Z (deg.)
54
const
Double_t
ZStationRotations
[
NStations
][
NMaxModules
] = {
55
{+0.1020},
// st. 0 (-(90-90.102))
56
{-30.005},
// st. 1 (-(90-59.995))
57
{-59.944}
// st. 2 (-(90-30.560))
58
};
59
60
// Sizes of elements (cm) -------------------------------------------------------
61
62
// Sensor sizes
63
const
Double_t
XSensSize
= 6.08;
// cm
64
const
Double_t
YSensSize
= 6.08;
// cm
65
const
Double_t
ZSensSize
= 0.018;
// cm
66
//------------------------------------------------------------------------------
67
68
// GeoManager
69
TGeoManager
*
gGeoMan
= NULL;
70
71
// media
72
TGeoMedium
*
pMedAir
= 0;
73
TGeoMedium
*
pMedCarbon
= 0;
74
TGeoMedium
*
pMedFiberGlass
= 0;
75
TGeoMedium
*
pMedSilicon
= 0;
76
77
class
FairGeoMedia;
78
class
FairGeoBuilder;
79
80
TGeoVolume
*
CreateStation
(
TString
station_name);
81
TGeoVolume
*
CreateModule
(
TString
module_name);
82
83
void
DefineRequiredMedia
(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
84
{
85
86
// air medium
87
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
88
if
(!mAir)
89
Fatal
(
"Main"
,
"FairMedium air not found"
);
90
geoBuild->createMedium(mAir);
91
pMedAir
=
gGeoManager
->GetMedium(
"air"
);
92
if
(!
pMedAir
)
93
Fatal
(
"Main"
,
"Medium air not found"
);
94
95
// carbon medium
96
FairGeoMedium* mCarbon = geoMedia->getMedium(
"carbon"
);
97
if
(!mCarbon)
98
Fatal
(
"Main"
,
"FairMedium carbon not found"
);
99
geoBuild->createMedium(mCarbon);
100
pMedCarbon
=
gGeoManager
->GetMedium(
"carbon"
);
101
if
(!
pMedCarbon
)
102
Fatal
(
"Main"
,
"Medium carbon not found"
);
103
104
// fiberglass medium
105
FairGeoMedium* mFiberGlass = geoMedia->getMedium(
"fiberglass"
);
106
if
(!mFiberGlass)
107
Fatal
(
"Main"
,
"FairMedium fiberglass not found"
);
108
geoBuild->createMedium(mFiberGlass);
109
pMedFiberGlass
=
gGeoManager
->GetMedium(
"fiberglass"
);
110
if
(!
pMedFiberGlass
)
111
Fatal
(
"Main"
,
"Medium fiberglass not found"
);
112
113
// silicon medium
114
FairGeoMedium* mSilicon = geoMedia->getMedium(
"silicon"
);
115
if
(!mSilicon)
116
Fatal
(
"Main"
,
"FairMedium silicon not found"
);
117
geoBuild->createMedium(mSilicon);
118
pMedSilicon
=
gGeoManager
->GetMedium(
"silicon"
);
119
if
(!
pMedSilicon
)
120
Fatal
(
"Main"
,
"Medium silicon not found"
);
121
}
122
123
void
create_rootgeom_SiBT_Run9
()
124
{
125
126
// ---- set working directory --------------------------------------------
127
TString
gPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
128
129
// ------- Geometry file name (output) ----------------------------------
130
const
TString
geoDetectorName =
"SiBT"
;
131
const
TString
geoDetectorVersion =
"Run9"
;
132
const
TString
geoFileName = gPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
133
134
// ---- global geometry parameters ---------------------------------------
135
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
136
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
137
138
// ------- Load media from media file ----------------------------------
139
TString
medFile = gPath +
"/geometry/media.geo"
;
140
geoFace->setMediaFile(medFile);
141
geoFace->readMedia();
142
FairGeoMedia* geoMedia = geoFace->getMedia();
143
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
144
145
DefineRequiredMedia
(geoMedia, geoBuild);
146
// -------------------------------------------------------------------------
147
148
// -------------- Create geometry and top volume ------------------------
149
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
150
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
151
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
152
top->
SetMedium
(
pMedAir
);
153
gGeoMan
->SetTopVolume(top);
154
// gGeoMan->SetTopVisible(1);
155
// -------------------------------------------------------------------------
156
157
// Define TOP Geometry
158
TGeoVolume
* SiBT =
new
TGeoVolumeAssembly
(geoDetectorName);
159
SiBT->
SetMedium
(
pMedAir
);
160
161
for
(
Int_t
istation = 0; istation <
NStations
; ++istation) {
162
163
Int_t
stationNum = istation;
// station number
164
165
TGeoVolume
* station =
CreateStation
(
TString
(
"station"
) +
TString::Itoa
(stationNum, 10));
166
167
TGeoVolume
* module0 =
CreateModule
(
TString
(
"module0_"
) + station->
GetName
());
168
169
TGeoCombiTrans
* module0_transform =
new
TGeoCombiTrans
();
170
module0_transform->
RotateZ
(
ZStationRotations
[stationNum][0]);
171
module0_transform->
SetTranslation
(
XModuleShifts
[stationNum][0],
YModuleShifts
[stationNum][0],
172
ZModuleShifts
[stationNum][0] + 0.5 *
ZSensSize
);
173
174
TGeoCombiTrans
* station_transform =
new
TGeoCombiTrans
();
175
station_transform->
SetTranslation
(
XStationPositions
[stationNum],
YStationPositions
[stationNum],
176
ZStationPositions
[stationNum]);
177
178
station->
AddNode
(module0, 0,
new
TGeoCombiTrans
(*module0_transform));
179
180
SiBT->
AddNode
(station, 0, station_transform);
181
}
182
183
top->
AddNode
(SiBT, 0);
184
top->
SetVisContainers
(
kTRUE
);
185
186
// --------------- Finish -----------------------------------------------
187
gGeoMan
->CloseGeometry();
188
gGeoMan
->CheckOverlaps(0.0001);
189
gGeoMan
->PrintOverlaps();
190
gGeoMan
->Test();
191
// gGeoMan->RestoreMasterVolume();
192
193
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
194
top->
Write
();
195
geoFile->
Close
();
196
top->
Draw
(
"ogl"
);
197
}
198
199
TGeoVolume
*
CreateStation
(
TString
station_name)
200
{
201
202
TGeoVolume
* stationA =
new
TGeoVolumeAssembly
(station_name);
203
stationA->
SetMedium
(
pMedAir
);
204
205
return
stationA;
206
}
207
208
TGeoVolume
*
CreateModule
(
TString
module_name)
209
{
210
211
// shapes
212
TGeoShape
* moduleS =
new
TGeoBBox
(
TString
(
"moduleS"
) +=
TString
(
"_"
) + module_name,
XSensSize
* 0.5,
213
YSensSize
* 0.5,
ZSensSize
* 0.5);
214
215
// volumes
216
TGeoVolume
* moduleV =
new
TGeoVolume
(
TString
(
"SiBTSensor"
) +=
TString
(
"_"
) + module_name, moduleS);
217
218
// medium
219
if
(
pMedSilicon
) {
220
moduleV->
SetMedium
(
pMedSilicon
);
221
}
else
222
Fatal
(
"Main"
,
"Invalid medium for moduleV volumes!"
);
223
224
// volume visual property
225
moduleV->
SetLineColor
(
TColor::GetColor
(
"#ff47ca"
));
226
moduleV->
SetTransparency
(30);
227
228
return
moduleV;
229
}
230
//------------------------------------------------------------------------------
Int_t
int Int_t
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
Fatal
void Fatal(const char *location, const char *msgfmt,...)
gGeoManager
R__EXTERN TGeoManager * gGeoManager
gROOT
#define gROOT
gSystem
R__EXTERN TSystem * gSystem
TColor::GetColor
static Int_t GetColor(const char *hexcolor)
TFile
TFile::Close
void Close(Option_t *option="") override
TGeoBBox
TGeoCombiTrans
TGeoCombiTrans::SetTranslation
void SetTranslation(const TGeoTranslation &tr)
TGeoCombiTrans::RotateZ
void RotateZ(Double_t angle) override
TGeoManager
TGeoMedium
TGeoShape
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::SetTransparency
void SetTransparency(Char_t transparency=0)
TGeoVolume::SetMedium
virtual void SetMedium(TGeoMedium *medium)
TGeoVolume::SetLineColor
void SetLineColor(Color_t lcolor) override
TNamed::GetName
const char * GetName() const override
TObject::Write
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
TString
TString::Itoa
static TString Itoa(Int_t value, Int_t base)
pMedAir
TGeoMedium * pMedAir
Definition
create_rootgeom_SiBT_Run9.C:72
YStationPositions
const Double_t YStationPositions[NStations]
Definition
create_rootgeom_SiBT_Run9.C:23
pMedCarbon
TGeoMedium * pMedCarbon
Definition
create_rootgeom_SiBT_Run9.C:73
gGeoMan
TGeoManager * gGeoMan
Definition
create_rootgeom_SiBT_Run9.C:69
NMaxModules
const Int_t NMaxModules
Definition
create_rootgeom_SiBT_Run9.C:13
ZStationPositions
const Double_t ZStationPositions[NStations]
Definition
create_rootgeom_SiBT_Run9.C:30
NStations
const Int_t NStations
Definition
create_rootgeom_SiBT_Run9.C:12
pMedFiberGlass
TGeoMedium * pMedFiberGlass
Definition
create_rootgeom_SiBT_Run9.C:74
XStationPositions
const Double_t XStationPositions[NStations]
Definition
create_rootgeom_SiBT_Run9.C:16
YSensSize
const Double_t YSensSize
Definition
create_rootgeom_SiBT_Run9.C:64
ZSensSize
const Double_t ZSensSize
Definition
create_rootgeom_SiBT_Run9.C:65
XSensSize
const Double_t XSensSize
Definition
create_rootgeom_SiBT_Run9.C:63
ZStationRotations
const Double_t ZStationRotations[NStations][NMaxModules]
Definition
create_rootgeom_SiBT_Run9.C:54
pMedSilicon
TGeoMedium * pMedSilicon
Definition
create_rootgeom_SiBT_Run9.C:75
CreateModule
TGeoVolume * CreateModule(TString module_name)
Definition
create_rootgeom_SiBT_Run9.C:208
CreateStation
TGeoVolume * CreateStation(TString station_name)
Definition
create_rootgeom_SiBT_Run9.C:199
create_rootgeom_SiBT_Run9
void create_rootgeom_SiBT_Run9()
Definition
create_rootgeom_SiBT_Run9.C:123
DefineRequiredMedia
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
Definition
create_rootgeom_SiBT_Run9.C:83
macro
geometry
create_rootgeom_SiBT_Run9.C
Generated on
for BmnRoot by
1.17.0