BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_bd_root_run6.C
Go to the documentation of this file.
1
#include "
TGeoCompositeShape.h
"
2
#include "
TGeoCone.h
"
3
#include "
TGeoManager.h
"
4
#include "
TGeoPara.h
"
5
#include "
TGeoTrd2.h
"
6
#include "
TGeoTube.h
"
7
8
#include <iomanip>
9
#include <iostream>
10
11
R__ADD_INCLUDE_PATH
($VMCWORKDIR)
12
#include "macro/run/bmnloadlibs.C"
13
//---------------------------
14
//---------------------------
15
16
TGeoManager
*
gGeoMan
= NULL;
17
18
const
Double_t
strip_BD_Xpos
= 0.0;
19
const
Double_t
strip_BD_Ypos
= 0.0;
20
const
Double_t
strip_BD_Zpos
= -2.5;
// cm
21
// const Double_t strip_BD_Zpos = -3.5; //cm
22
23
const
Double_t
tubeFe_Xpos
= 0.0;
24
const
Double_t
tubeFe_Ypos
= 0.0;
25
const
Double_t
tubeFe_Zpos
= -8.45;
// cm
26
// const Double_t tubeFe_Zpos = -9.45; //cm
27
28
const
Double_t
tubeAl_Xpos
= 0.0;
29
const
Double_t
tubeAl_Ypos
= 0.0;
30
const
Double_t
tubeAl_Zpos
= -14.3;
// cm
31
32
const
Double_t
roh_Xpos
= 0.0;
33
const
Double_t
roh_Ypos
= 0.0;
34
const
Double_t
roh_Zpos
= -2.65;
// cm
35
36
const
Double_t
ZLength_BDActiveVolume
= 15.;
37
const
Double_t
ZLength_tubeFe
= 29.5;
38
const
Double_t
ZLength_tubeAl
= 18.;
39
const
Double_t
ZLength_roh
= 5.3;
40
41
const
Double_t
dphi1
= 360. / 40;
42
const
Double_t
rr
= 4.95;
43
44
const
Double_t
MaxRadiusFe
= 8.1;
45
const
Double_t
MinRadiusFe
= 8.;
46
47
const
Double_t
MaxRadiusAl
= 7.0;
48
const
Double_t
MinRadiusAl
= 6.8;
49
50
const
Double_t
MaxRadiusRohacel
= 8.0;
51
const
Double_t
MinRadiusRohacel
= 7.0;
52
53
void
create_bd_root_run6
()
54
{
55
56
// ------- Load media from media file -----------------------------------
57
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
58
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
59
TString
geoPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
60
TString
medFile = geoPath +
"/geometry/media.geo"
;
61
geoFace->setMediaFile(medFile);
62
geoFace->readMedia();
63
gGeoMan
=
gGeoManager
;
64
// --------------------------------------------------------------------------
65
66
// ------- Geometry file name (output) ----------------------------------
67
const
TString
geoDetectorName =
"root_geom_BD"
;
68
const
TString
geoDetectorVersion =
"for_run6"
;
69
TString
geoFileName = geoPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
70
// --------------------------------------------------------------------------
71
72
// ----------------- Get and create the required media -----------------
73
FairGeoMedia* geoMedia = geoFace->getMedia();
74
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
75
76
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
77
if
(!mAir)
78
Fatal
(
"Main"
,
"FairMedium air not found"
);
79
geoBuild->createMedium(mAir);
80
TGeoMedium
* pMedAir =
gGeoMan
->GetMedium(
"air"
);
81
if
(!pMedAir)
82
Fatal
(
"Main"
,
"Medium air not found"
);
83
84
FairGeoMedium* mBC408 = geoMedia->getMedium(
"BC408"
);
85
if
(!mBC408)
86
Fatal
(
"Main"
,
"FairMedium BC408 not found"
);
87
geoBuild->createMedium(mBC408);
88
TGeoMedium
* pMedBC408 =
gGeoMan
->GetMedium(
"BC408"
);
89
if
(!pMedBC408)
90
Fatal
(
"Main"
,
"Medium BC408 not found"
);
91
92
FairGeoMedium* miron = geoMedia->getMedium(
"iron"
);
93
if
(!miron)
94
Fatal
(
"Main"
,
"FairMedium iron not found"
);
95
geoBuild->createMedium(miron);
96
TGeoMedium
* pMediron =
gGeoMan
->GetMedium(
"iron"
);
97
if
(!pMediron)
98
Fatal
(
"Main"
,
"Medium iron not found"
);
99
100
FairGeoMedium* maluminium = geoMedia->getMedium(
"aluminium"
);
101
if
(!maluminium)
102
Fatal
(
"Main"
,
"FairMedium aluminium not found"
);
103
geoBuild->createMedium(maluminium);
104
TGeoMedium
* pMedaluminium =
gGeoMan
->GetMedium(
"aluminium"
);
105
if
(!pMedaluminium)
106
Fatal
(
"Main"
,
"Medium aluminium not found"
);
107
108
FairGeoMedium* mpolypropylene = geoMedia->getMedium(
"polypropylene"
);
109
if
(!mpolypropylene)
110
Fatal
(
"Main"
,
"FairMedium polypropylene not found"
);
111
geoBuild->createMedium(mpolypropylene);
112
TGeoMedium
* pMedpolypropylene =
gGeoMan
->GetMedium(
"polypropylene"
);
113
if
(!pMedpolypropylene)
114
Fatal
(
"Main"
,
"Medium polypropylene not found"
);
115
116
// --------------------------------------------------------------------------
117
118
// -------------- Create geometry and top volume -------------------------
119
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
120
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
121
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
122
top->
SetMedium
(pMedAir);
123
gGeoMan
->SetTopVolume(top);
124
125
// --------------------------------------------------------------------------
126
127
TGeoTranslation
* BD_Position =
new
TGeoTranslation
(
"BD_Position"
, 0, 0, 2.5);
128
129
// Define TOP Geometry
130
TGeoVolume
* BD =
new
TGeoVolumeAssembly
(
"BD"
);
131
BD->
SetMedium
(pMedAir);
132
133
TGeoTranslation
* strips_BD1Pos_trans =
134
new
TGeoTranslation
(
"strips_BD1Pos_trans"
,
strip_BD_Xpos
,
strip_BD_Ypos
,
strip_BD_Zpos
);
135
TGeoTranslation
* tubefePos_trans =
new
TGeoTranslation
(
"tubefePos_trans"
,
tubeFe_Xpos
,
tubeFe_Ypos
,
tubeFe_Zpos
);
136
TGeoTranslation
* tubealPos_trans =
new
TGeoTranslation
(
"tubefePos_trans"
,
tubeAl_Xpos
,
tubeAl_Ypos
,
tubeAl_Zpos
);
137
TGeoTranslation
* tuberohPos_trans =
new
TGeoTranslation
(
"tuberohPos_trans"
,
roh_Xpos
,
roh_Ypos
,
roh_Zpos
);
138
139
TGeoBBox
* strip =
new
TGeoBBox
(
"srtip"
, 0.7 / 2., 0.7 / 2., 15. / 2.);
140
TGeoTube
* tubefeContainerS =
new
TGeoTube
(
"tubefeContainerS"
,
MinRadiusFe
/ 2,
MaxRadiusFe
/ 2,
ZLength_tubeFe
/ 2);
141
TGeoTube
* tubealContainerS =
new
TGeoTube
(
"tubealContainerS"
,
MinRadiusAl
/ 2,
MaxRadiusAl
/ 2,
ZLength_tubeAl
/ 2);
142
TGeoTube
* tuberohContainerS =
143
new
TGeoTube
(
"tuberohContainerS"
,
MinRadiusRohacel
/ 2,
MaxRadiusRohacel
/ 2,
ZLength_roh
/ 2);
144
145
Double_t
phi = 90 *
TMath::DegToRad
(), delta_phi = 360. / 40., dphi = delta_phi *
TMath::DegToRad
();
146
147
TGeoCombiTrans
* combi[41];
148
149
for
(
Int_t
i
= 1;
i
< 41;
i
++) {
150
combi[
i
] =
new
TGeoCombiTrans
(
rr
*
TMath::Cos
(dphi * (
i
+ 0.5)),
rr
*
TMath::Sin
(dphi * (
i
+ 0.5)),
151
strip_BD_Zpos
,
new
TGeoRotation
(
"rot"
,
dphi1
* (
i
+ 0.5), 0., 0.));
152
}
153
154
TGeoVolume
* BD1ActiveVolumeV1 =
new
TGeoVolume
(
"BD1ActiveVolumeV1"
, strip);
155
BD1ActiveVolumeV1->
SetMedium
(pMedBC408);
156
BD1ActiveVolumeV1->
SetLineColor
(
kYellow
- 10);
157
158
TGeoVolume
* tubefeMat =
new
TGeoVolume
(
"tubefeMat"
, tubefeContainerS);
159
tubefeMat->
SetMedium
(pMediron);
160
tubefeMat->
SetLineColor
(
kOrange
- 1);
161
162
TGeoVolume
* tubealMat =
new
TGeoVolume
(
"tubealMat"
, tubealContainerS);
163
tubealMat->
SetMedium
(pMedaluminium);
164
tubealMat->
SetLineColor
(
kCyan
- 10);
165
166
TGeoVolume
* tuberohMat =
new
TGeoVolume
(
"tuberohMat"
, tuberohContainerS);
167
tuberohMat->
SetMedium
(pMedpolypropylene);
168
tuberohMat->
SetLineColor
(
kGray
);
169
170
// container1->AddNode(BD1Top, 1);
171
172
// BD1Top->AddNode(BD1ActiveVolumeV1, 1, new TGeoCombiTrans(t1, r1));
173
174
for
(
Int_t
i
= 1;
i
< 41;
i
++) {
175
BD->
AddNode
(BD1ActiveVolumeV1,
i
, combi[
i
]);
176
}
177
178
BD->
AddNode
(tubefeMat, 41, tubefePos_trans);
179
BD->
AddNode
(tubealMat, 42, tubealPos_trans);
180
BD->
AddNode
(tuberohMat, 43, tuberohPos_trans);
181
182
// Adding volumes to the TOP Volume
183
top->
AddNode
(BD, 1, BD_Position);
184
185
top->
SetVisContainers
(
kTRUE
);
186
187
// --------------- Finish -----------------------------------------------
188
gGeoMan
->CloseGeometry();
189
gGeoMan
->CheckOverlaps(0.001);
190
gGeoMan
->PrintOverlaps();
191
gGeoMan
->Test();
192
193
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
194
top->
Write
();
195
geoFile->
Close
();
196
top->
Draw
(
"ogl"
);
197
// top->Draw("");
198
}
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
R__ADD_INCLUDE_PATH
#define R__ADD_INCLUDE_PATH(PATH)
kGray
kGray
kOrange
kOrange
kCyan
kCyan
kYellow
kYellow
Fatal
void Fatal(const char *location, const char *msgfmt,...)
TGeoCompositeShape.h
TGeoCone.h
TGeoManager.h
gGeoManager
R__EXTERN TGeoManager * gGeoManager
TGeoPara.h
TGeoTrd2.h
TGeoTube.h
gROOT
#define gROOT
gSystem
R__EXTERN TSystem * gSystem
TFile
TFile::Close
void Close(Option_t *option="") override
TGeoBBox
TGeoCombiTrans
TGeoManager
TGeoMedium
TGeoRotation
TGeoTranslation
TGeoTube
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_bd_root_run6.C:16
strip_BD_Xpos
const Double_t strip_BD_Xpos
Definition
create_bd_root_run6.C:18
strip_BD_Ypos
const Double_t strip_BD_Ypos
Definition
create_bd_root_run6.C:19
strip_BD_Zpos
const Double_t strip_BD_Zpos
Definition
create_bd_root_run6.C:20
rr
const Double_t rr
Definition
create_bd_root_run6.C:42
MaxRadiusFe
const Double_t MaxRadiusFe
Definition
create_bd_root_run6.C:44
MinRadiusAl
const Double_t MinRadiusAl
Definition
create_bd_root_run6.C:48
ZLength_tubeFe
const Double_t ZLength_tubeFe
Definition
create_bd_root_run6.C:37
MaxRadiusRohacel
const Double_t MaxRadiusRohacel
Definition
create_bd_root_run6.C:50
ZLength_tubeAl
const Double_t ZLength_tubeAl
Definition
create_bd_root_run6.C:38
tubeAl_Zpos
const Double_t tubeAl_Zpos
Definition
create_bd_root_run6.C:30
roh_Zpos
const Double_t roh_Zpos
Definition
create_bd_root_run6.C:34
MinRadiusFe
const Double_t MinRadiusFe
Definition
create_bd_root_run6.C:45
ZLength_BDActiveVolume
const Double_t ZLength_BDActiveVolume
Definition
create_bd_root_run6.C:36
MaxRadiusAl
const Double_t MaxRadiusAl
Definition
create_bd_root_run6.C:47
roh_Ypos
const Double_t roh_Ypos
Definition
create_bd_root_run6.C:33
tubeFe_Ypos
const Double_t tubeFe_Ypos
Definition
create_bd_root_run6.C:24
tubeAl_Ypos
const Double_t tubeAl_Ypos
Definition
create_bd_root_run6.C:29
tubeFe_Xpos
const Double_t tubeFe_Xpos
Definition
create_bd_root_run6.C:23
tubeAl_Xpos
const Double_t tubeAl_Xpos
Definition
create_bd_root_run6.C:28
MinRadiusRohacel
const Double_t MinRadiusRohacel
Definition
create_bd_root_run6.C:51
roh_Xpos
const Double_t roh_Xpos
Definition
create_bd_root_run6.C:32
tubeFe_Zpos
const Double_t tubeFe_Zpos
Definition
create_bd_root_run6.C:25
ZLength_roh
const Double_t ZLength_roh
Definition
create_bd_root_run6.C:39
dphi1
const Double_t dphi1
Definition
create_bd_root_run6.C:41
create_bd_root_run6
void create_bd_root_run6()
Definition
create_bd_root_run6.C:53
TMath::DegToRad
constexpr Double_t DegToRad()
TMath::Cos
Double_t Cos(Double_t)
TMath::Sin
Double_t Sin(Double_t)
macro
geometry
create_bd_root_run6.C
Generated on
for BmnRoot by
1.17.0