BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_CSC_RunSpring2018.C
Go to the documentation of this file.
1
/*
2
* Baranov D.
3
* 06.03.2019
4
* Use this macro to create ROOT geometry for the RunSpring2018 CSC (Cathode
5
* Strip Chamber)
6
* configuration (BM@N RUN-7)
7
*
8
* WARNING: all units is in cm!!!
9
*
10
*/
11
12
#include "
TGeoMatrix.h
"
13
#include "
TGeoVolume.h
"
14
#include "
TString.h
"
15
16
// Set Parameters of CSC --------------------------------------------------------
17
const
Int_t
NStations
= 1;
// stations in the detector
18
const
Int_t
NMaxModules
= 2;
// max. number of modules in a station
19
20
//(X-Y-Z)Positions of stations
21
const
Double_t
XStationPositions
[
NStations
] = {110.1895};
// geometry center
22
const
Double_t
YStationPositions
[
NStations
] = {2.21575};
// geometry center
23
const
Double_t
ZStationPositions
[
NStations
] = {411.57};
// outer side nearest to the target
24
25
//(X-Y-Z)Shifts of modules in each station
26
const
Double_t
XModuleShifts
[
NStations
][
NMaxModules
] = {
// centers of gas volume
27
{0.0, 0.0}};
28
const
Double_t
YModuleShifts
[
NStations
][
NMaxModules
] = {
// centers of gas volume
29
{27.1875, -27.1875}};
30
const
Double_t
ZModuleShifts
[
NStations
][
NMaxModules
] = {
// distances from st.side to mod.side
31
{1.25, 1.25}};
32
33
// Sizes of elements (cm) -------------------------------------------------------
34
35
// Gas volume sizes (module: half of station)
36
const
Double_t
XGasSize
= 113.0;
37
const
Double_t
YGasSize
= 54.375;
38
const
Double_t
ZGasSize
= 0.76;
39
40
// Sensitive volume sizes (module: half of station)
41
const
Double_t
XSensSize
= 112.9;
42
const
Double_t
YSensSize
= 53.25;
// 106.5/2
43
const
Double_t
ZSensSize
= 0.76;
44
45
// Frame sizes
46
const
Double_t
dXFrameSize
= 4.5;
47
const
Double_t
dYFrameSize
= 4.5;
48
const
Double_t
dZFrameSize
= 3.26;
49
50
// Side panel sizes
51
const
Double_t
dZFiberglassPanel
= 0.1;
52
const
Double_t
dZHoneycombPanel
= 1.05;
53
54
//------------------------------------------------------------------------------
55
56
// GeoManager
57
TGeoManager
*
gGeoMan
= NULL;
58
59
// media
60
TGeoMedium
*
pMedAir
= 0;
61
TGeoMedium
*
pMedCarbon
= 0;
62
TGeoMedium
*
pMedFiberGlass
= 0;
63
TGeoMedium
*
pMedCopper
= 0;
64
TGeoMedium
*
pMedArCO27030
= 0;
65
TGeoMedium
*
pMedArgonIsobutane7525
= 0;
66
TGeoMedium
*
pMedRohacell
= 0;
67
68
class
FairGeoMedia;
69
class
FairGeoBuilder;
70
71
TGeoVolume
*
CreateStation
(
TString
station_name);
72
TGeoVolume
*
CreateModule
(
TString
module_name);
73
74
void
DefineRequiredMedia
(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
75
{
76
77
// air medium
78
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
79
if
(!mAir)
80
Fatal
(
"Main"
,
"FairMedium air not found"
);
81
geoBuild->createMedium(mAir);
82
pMedAir
=
gGeoManager
->GetMedium(
"air"
);
83
if
(!
pMedAir
)
84
Fatal
(
"Main"
,
"Medium air not found"
);
85
86
// carbon medium
87
FairGeoMedium* mCarbon = geoMedia->getMedium(
"carbon"
);
88
if
(!mCarbon)
89
Fatal
(
"Main"
,
"FairMedium carbon not found"
);
90
geoBuild->createMedium(mCarbon);
91
pMedCarbon
=
gGeoManager
->GetMedium(
"carbon"
);
92
if
(!
pMedCarbon
)
93
Fatal
(
"Main"
,
"Medium carbon not found"
);
94
95
// fiberglass medium
96
FairGeoMedium* mFiberGlass = geoMedia->getMedium(
"fiberglass"
);
97
if
(!mFiberGlass)
98
Fatal
(
"Main"
,
"FairMedium fiberglass not found"
);
99
geoBuild->createMedium(mFiberGlass);
100
pMedFiberGlass
=
gGeoManager
->GetMedium(
"fiberglass"
);
101
if
(!
pMedFiberGlass
)
102
Fatal
(
"Main"
,
"Medium fiberglass not found"
);
103
104
// arco27020 medium
105
FairGeoMedium* mArCO27030 = geoMedia->getMedium(
"arco27030"
);
106
if
(!mArCO27030)
107
Fatal
(
"Main"
,
"FairMedium arco27030 not found"
);
108
geoBuild->createMedium(mArCO27030);
109
pMedArCO27030
=
gGeoManager
->GetMedium(
"arco27030"
);
110
if
(!
pMedArCO27030
)
111
Fatal
(
"Main"
,
"Medium arco27030 not found"
);
112
113
// ArgonIsobutane (75/25): Ar-iC4H10 medium
114
FairGeoMedium* mArgonIsobutane7525 = geoMedia->getMedium(
"ArgonIsobutane7525"
);
115
if
(!mArgonIsobutane7525)
116
Fatal
(
"Main"
,
"FairMedium ArgonIsobutane7525 not found"
);
117
geoBuild->createMedium(mArgonIsobutane7525);
118
pMedArgonIsobutane7525
=
gGeoManager
->GetMedium(
"ArgonIsobutane7525"
);
119
if
(!
pMedArgonIsobutane7525
)
120
Fatal
(
"Main"
,
"Medium ArgonIsobutane7525 not found"
);
121
122
// Rohacell medium
123
FairGeoMedium* mRohacell = geoMedia->getMedium(
"rohacellhf71"
);
124
if
(!mRohacell)
125
Fatal
(
"Main"
,
"FairMedium rohacellhf71 not found"
);
126
geoBuild->createMedium(mRohacell);
127
pMedRohacell
=
gGeoManager
->GetMedium(
"rohacellhf71"
);
128
if
(!
pMedRohacell
)
129
Fatal
(
"Main"
,
"Medium rohacellhf71 not found"
);
130
}
131
132
void
create_rootgeom_CSC_RunSpring2018
()
133
{
134
135
// ---- set working directory --------------------------------------------
136
TString
gPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
137
138
// ------- Geometry file name (output) ----------------------------------
139
const
TString
geoDetectorName =
"CSC"
;
140
const
TString
geoDetectorVersion =
"RunSpring2018"
;
141
const
TString
geoFileName = gPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
142
143
// ---- global geometry parameters ---------------------------------------
144
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
145
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
146
147
// ------- Load media from media file ----------------------------------
148
TString
medFile = gPath +
"/geometry/media.geo"
;
149
geoFace->setMediaFile(medFile);
150
geoFace->readMedia();
151
FairGeoMedia* geoMedia = geoFace->getMedia();
152
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
153
154
DefineRequiredMedia
(geoMedia, geoBuild);
155
// -------------------------------------------------------------------------
156
157
// -------------- Create geometry and top volume ------------------------
158
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
159
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
160
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
161
top->
SetMedium
(
pMedAir
);
162
gGeoMan
->SetTopVolume(top);
163
// gGeoMan->SetTopVisible(1);
164
// -------------------------------------------------------------------------
165
166
// Define TOP Geometry
167
TGeoVolume
* CSC =
new
TGeoVolumeAssembly
(geoDetectorName);
168
CSC->
SetMedium
(
pMedAir
);
169
170
// station 0 (consisting of two modules)
171
if
(1) {
172
Int_t
stationNum = 0;
// station number
173
174
TGeoVolume
* station =
CreateStation
(
TString
(
"station"
) +
TString::Itoa
(stationNum, 10));
175
176
TGeoVolume
* module0 =
CreateModule
(
TString
(
"module0_"
) + station->
GetName
());
177
TGeoVolume
* module1 =
CreateModule
(
TString
(
"module1_"
) + station->
GetName
());
178
179
TGeoCombiTrans
* module0_transform =
new
TGeoCombiTrans
();
180
module0_transform->
SetTranslation
(
XModuleShifts
[stationNum][0],
181
YModuleShifts
[stationNum][0] + 0.5 *
dYFrameSize
,
182
ZModuleShifts
[stationNum][0] + 0.5 *
ZGasSize
);
183
184
TGeoCombiTrans
* module1_transform =
new
TGeoCombiTrans
();
185
module1_transform->
RotateX
(180);
186
module1_transform->
SetTranslation
(
XModuleShifts
[stationNum][1],
187
YModuleShifts
[stationNum][1] - 0.5 *
dYFrameSize
,
188
ZModuleShifts
[stationNum][1] + 0.5 *
ZGasSize
);
189
190
TGeoCombiTrans
* station_transform =
new
TGeoCombiTrans
();
191
station_transform->
SetTranslation
(
XStationPositions
[stationNum],
YStationPositions
[stationNum],
192
ZStationPositions
[stationNum]);
193
194
station->
AddNode
(module0, 0,
new
TGeoCombiTrans
(*module0_transform));
195
station->
AddNode
(module1, 0,
new
TGeoCombiTrans
(*module1_transform));
196
197
CSC->
AddNode
(station, 0, station_transform);
198
}
199
200
top->
AddNode
(CSC, 0);
201
top->
SetVisContainers
(
kTRUE
);
202
203
// --------------- Finish -----------------------------------------------
204
gGeoMan
->CloseGeometry();
205
gGeoMan
->CheckOverlaps(0.0001);
206
gGeoMan
->PrintOverlaps();
207
gGeoMan
->Test();
208
// gGeoMan->RestoreMasterVolume();
209
210
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
211
top->
Write
();
212
geoFile->
Close
();
213
top->
Draw
(
"ogl"
);
214
}
215
216
TGeoVolume
*
CreateStation
(
TString
station_name)
217
{
218
219
TGeoVolume
* stationA =
new
TGeoVolumeAssembly
(station_name);
220
stationA->
SetMedium
(
pMedAir
);
221
222
return
stationA;
223
}
224
225
TGeoVolume
*
CreateModule
(
TString
module_name)
226
{
227
228
// shapes
229
TGeoShape
* moduleS =
new
TGeoBBox
(
"moduleS"
, (
XGasSize
+ 2.0 *
dXFrameSize
) * 0.5, (
YGasSize
+
dYFrameSize
) * 0.5,
230
(
ZGasSize
+ 4.0 *
dZFiberglassPanel
+ 2.0 *
dZHoneycombPanel
) * 0.5);
231
TGeoShape
* gasS =
new
TGeoBBox
(
"gasS"
,
XGasSize
* 0.5,
YGasSize
* 0.5,
ZGasSize
* 0.5);
232
TGeoShape
* sensS =
new
TGeoBBox
(
"sensS"
,
XSensSize
* 0.5,
YSensSize
* 0.5,
ZSensSize
* 0.5);
233
TGeoShape
* fiberglassS =
new
TGeoBBox
(
"fiberglassS"
,
XGasSize
* 0.5,
YGasSize
* 0.5,
dZFiberglassPanel
* 0.5);
234
TGeoShape
* honeycombS =
new
TGeoBBox
(
"honeycombS"
,
XGasSize
* 0.5,
YGasSize
* 0.5,
dZHoneycombPanel
* 0.5);
235
236
TGeoShape
* verticalframeS =
new
TGeoBBox
(
"verticalframeS"
,
dXFrameSize
* 0.5, 0.5 * (
YGasSize
+
dYFrameSize
),
237
(
ZGasSize
+ 4.0 *
dZFiberglassPanel
+ 2.0 *
dZHoneycombPanel
) * 0.5);
238
TGeoShape
* horizontalframeS =
new
TGeoBBox
(
"horizontalframeS"
,
XGasSize
* 0.5,
dYFrameSize
* 0.5,
239
(
ZGasSize
+ 4.0 *
dZFiberglassPanel
+ 2.0 *
dZHoneycombPanel
) * 0.5);
240
241
// volumes
242
TGeoVolume
* moduleV =
new
TGeoVolume
(
TString
(
"moduleV_"
) + module_name, moduleS);
243
TGeoVolume
* gasV =
new
TGeoVolume
(
TString
(
"gasV_"
) + module_name, gasS);
244
TGeoVolume
* sensV =
new
TGeoVolume
(
TString
(
"CSCSensor_"
) + module_name, sensS);
245
TGeoVolume
* fiberglassV =
new
TGeoVolume
(
TString
(
"fiberglassV_"
) + module_name, fiberglassS);
246
TGeoVolume
* honeycombV =
new
TGeoVolume
(
TString
(
"honeycombV_"
) + module_name, honeycombS);
247
TGeoVolume
* verticalframeV =
new
TGeoVolume
(
TString
(
"verticalframeV_"
) + module_name, verticalframeS);
248
TGeoVolume
* horizontalframeV =
new
TGeoVolume
(
TString
(
"horizontalframeV_"
) + module_name, horizontalframeS);
249
250
// medium
251
if
(
pMedAir
)
252
moduleV->
SetMedium
(
pMedAir
);
253
else
254
Fatal
(
"Main"
,
"Invalid medium for module volume!"
);
255
256
if
(
pMedArgonIsobutane7525
) {
257
gasV->
SetMedium
(
pMedArgonIsobutane7525
);
258
sensV->
SetMedium
(
pMedArgonIsobutane7525
);
259
}
else
260
Fatal
(
"Main"
,
"Invalid medium for module volumes!"
);
261
262
if
(
pMedFiberGlass
) {
263
fiberglassV->
SetMedium
(
pMedFiberGlass
);
264
verticalframeV->
SetMedium
(
pMedFiberGlass
);
265
horizontalframeV->
SetMedium
(
pMedFiberGlass
);
266
}
else
267
Fatal
(
"Main"
,
"Invalid medium for fiberglass volume!"
);
268
269
if
(
pMedRohacell
)
270
honeycombV->
SetMedium
(
pMedRohacell
);
271
else
272
Fatal
(
"Main"
,
"Invalid medium for honeycomb volume!"
);
273
274
// visual parameters
275
moduleV->
SetLineColor
(
TColor::GetColor
(
"#cccccc"
));
276
moduleV->
SetTransparency
(20);
277
278
gasV->
SetLineColor
(
TColor::GetColor
(
"#47ffca"
));
279
gasV->
SetTransparency
(20);
280
281
sensV->
SetLineColor
(
TColor::GetColor
(
"#ff47ca"
));
282
sensV->
SetTransparency
(20);
283
284
fiberglassV->
SetLineColor
(
TColor::GetColor
(
"#ff9933"
));
285
fiberglassV->
SetTransparency
(20);
286
287
honeycombV->
SetLineColor
(
TColor::GetColor
(
"#ffff00"
));
288
honeycombV->
SetTransparency
(20);
289
290
verticalframeV->
SetLineColor
(
TColor::GetColor
(
"#9999ff"
));
291
verticalframeV->
SetTransparency
(20);
292
293
horizontalframeV->
SetLineColor
(
TColor::GetColor
(
"#9999ff"
));
294
horizontalframeV->
SetTransparency
(20);
295
296
gasV->
AddNode
(sensV, 0,
new
TGeoTranslation
(0.0, -0.5 * (
YGasSize
-
YSensSize
), 0.0));
297
298
moduleV->
AddNode
(gasV, 0,
new
TGeoTranslation
(0.0, -0.5 *
dYFrameSize
, 0.0));
299
300
moduleV->
AddNode
(fiberglassV, 0,
301
new
TGeoTranslation
(0.0, -0.5 *
dYFrameSize
, -(0.5 *
ZGasSize
+ 0.5 *
dZFiberglassPanel
)));
302
moduleV->
AddNode
(fiberglassV, 1,
303
new
TGeoTranslation
(0.0, -0.5 *
dYFrameSize
, +(0.5 *
ZGasSize
+ 0.5 *
dZFiberglassPanel
)));
304
305
moduleV->
AddNode
(
306
honeycombV, 0,
307
new
TGeoTranslation
(0.0, -0.5 *
dYFrameSize
, -(0.5 *
ZGasSize
+
dZFiberglassPanel
+ 0.5 *
dZHoneycombPanel
)));
308
moduleV->
AddNode
(
309
honeycombV, 1,
310
new
TGeoTranslation
(0.0, -0.5 *
dYFrameSize
, +(0.5 *
ZGasSize
+
dZFiberglassPanel
+ 0.5 *
dZHoneycombPanel
)));
311
312
moduleV->
AddNode
(
313
fiberglassV, 2,
314
new
TGeoTranslation
(0.0, -0.5 *
dYFrameSize
,
315
-(0.5 *
ZGasSize
+
dZFiberglassPanel
+
dZHoneycombPanel
+ 0.5 *
dZFiberglassPanel
)));
316
moduleV->
AddNode
(
317
fiberglassV, 3,
318
new
TGeoTranslation
(0.0, -0.5 *
dYFrameSize
,
319
+(0.5 *
ZGasSize
+
dZFiberglassPanel
+
dZHoneycombPanel
+ 0.5 *
dZFiberglassPanel
)));
320
321
moduleV->
AddNode
(verticalframeV, 0,
new
TGeoTranslation
(+(0.5 *
XGasSize
+ 0.5 *
dXFrameSize
), 0.0, 0.0));
322
moduleV->
AddNode
(verticalframeV, 1,
new
TGeoTranslation
(-(0.5 *
XGasSize
+ 0.5 *
dXFrameSize
), 0.0, 0.0));
323
324
moduleV->
AddNode
(horizontalframeV, 0,
new
TGeoTranslation
(0.0, +(0.5 *
YGasSize
), 0.0));
325
326
return
moduleV;
327
}
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
TGeoMatrix.h
TGeoVolume.h
gROOT
#define gROOT
TString.h
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::RotateX
void RotateX(Double_t angle) override
TGeoCombiTrans::SetTranslation
void SetTranslation(const TGeoTranslation &tr)
TGeoManager
TGeoMedium
TGeoShape
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::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_CSC_RunSpring2018.C:60
YStationPositions
const Double_t YStationPositions[NStations]
Definition
create_rootgeom_CSC_RunSpring2018.C:22
pMedCarbon
TGeoMedium * pMedCarbon
Definition
create_rootgeom_CSC_RunSpring2018.C:61
gGeoMan
TGeoManager * gGeoMan
Definition
create_rootgeom_CSC_RunSpring2018.C:57
NMaxModules
const Int_t NMaxModules
Definition
create_rootgeom_CSC_RunSpring2018.C:18
ZStationPositions
const Double_t ZStationPositions[NStations]
Definition
create_rootgeom_CSC_RunSpring2018.C:23
pMedArCO27030
TGeoMedium * pMedArCO27030
Definition
create_rootgeom_CSC_RunSpring2018.C:64
NStations
const Int_t NStations
Definition
create_rootgeom_CSC_RunSpring2018.C:17
pMedFiberGlass
TGeoMedium * pMedFiberGlass
Definition
create_rootgeom_CSC_RunSpring2018.C:62
XStationPositions
const Double_t XStationPositions[NStations]
Definition
create_rootgeom_CSC_RunSpring2018.C:21
pMedCopper
TGeoMedium * pMedCopper
Definition
create_rootgeom_CSC_RunSpring2018.C:63
pMedRohacell
TGeoMedium * pMedRohacell
Definition
create_rootgeom_CSC_RunSpring2018.C:66
YSensSize
const Double_t YSensSize
Definition
create_rootgeom_CSC_RunSpring2018.C:42
ZSensSize
const Double_t ZSensSize
Definition
create_rootgeom_CSC_RunSpring2018.C:43
YGasSize
const Double_t YGasSize
Definition
create_rootgeom_CSC_RunSpring2018.C:37
XGasSize
const Double_t XGasSize
Definition
create_rootgeom_CSC_RunSpring2018.C:36
pMedArgonIsobutane7525
TGeoMedium * pMedArgonIsobutane7525
Definition
create_rootgeom_CSC_RunSpring2018.C:65
XSensSize
const Double_t XSensSize
Definition
create_rootgeom_CSC_RunSpring2018.C:41
ZGasSize
const Double_t ZGasSize
Definition
create_rootgeom_CSC_RunSpring2018.C:38
dYFrameSize
const Double_t dYFrameSize
Definition
create_rootgeom_CSC_RunSpring2018.C:47
dZFiberglassPanel
const Double_t dZFiberglassPanel
Definition
create_rootgeom_CSC_RunSpring2018.C:51
dXFrameSize
const Double_t dXFrameSize
Definition
create_rootgeom_CSC_RunSpring2018.C:46
dZFrameSize
const Double_t dZFrameSize
Definition
create_rootgeom_CSC_RunSpring2018.C:48
dZHoneycombPanel
const Double_t dZHoneycombPanel
Definition
create_rootgeom_CSC_RunSpring2018.C:52
create_rootgeom_CSC_RunSpring2018
void create_rootgeom_CSC_RunSpring2018()
Definition
create_rootgeom_CSC_RunSpring2018.C:132
CreateModule
TGeoVolume * CreateModule(TString module_name)
Definition
create_rootgeom_CSC_RunSpring2018.C:225
CreateStation
TGeoVolume * CreateStation(TString station_name)
Definition
create_rootgeom_CSC_RunSpring2018.C:216
DefineRequiredMedia
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
Definition
create_rootgeom_CSC_RunSpring2018.C:74
macro
geometry
create_rootgeom_CSC_RunSpring2018.C
Generated on
for BmnRoot by
1.17.0