BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_BC_Triggers.C
Go to the documentation of this file.
1
#include "
TGeoEltu.h
"
2
#include "
TGeoVolume.h
"
3
4
// http://bmnshift.jinr.ru/wiki/lib/exe/fetch.php?media=src_bm_n_55session.pdf
5
//---------------------------
6
// Geometry of BC triggers (more detailed)
7
// Created by A.Driuk andredryuk@gmail.com
8
// Date: 06.12.2020
9
//
10
11
// Triggers are centred according the beam position?????
12
const
Int_t
NStations
= 4;
13
const
Double_t
Zshift
= -647.5;
14
const
Double_t
Xshift
= 0.5;
15
const
Double_t
Yshift
= -4.7;
16
17
//(X-Y-Z)Positions of stations (sensitive volumes) -----------------------------
18
const
Double_t
StationPositions
[
NStations
][3] = {
19
{-0.0125 +
Xshift
, -0.3245 +
Yshift
, -172.0000 +
Zshift
},
// BC1
20
{-0.4735 +
Xshift
, +3.5355 +
Yshift
, -85.50000 +
Zshift
},
// BC2
21
{-0.0955 +
Xshift
, -0.8540 +
Yshift
, +167.8390 +
Zshift
},
// BC3
22
{+0.0360 +
Xshift
,
Yshift
,
23
+188.5850 +
Zshift
}
// BC4 было {+0.0360 + Xshift, +2.1435 + Yshift, +188.5850 + Zshift}
24
};
25
26
// X-Y Z Sizes of the triggers
27
const
Double_t
StationLength
[
NStations
][3] = {
28
{15.000, 15.000, 0.3},
//{21.415, 21.415, 0.3}, //BC1
29
{12.653, 12.653, 0.8},
// BC2
30
{8.507, 13.007, 0.5},
// BC3
31
{8.402, 8.402, 0.5}
// BC4
32
};
33
34
// Angle Rotation of Station along X, Y, Z direction
35
const
Double_t
Rotation
[
NStations
][3] = {
36
{0.0, 0.0, 0.0},
// BC1
37
{90.0, 45.0, 0.0},
// BC2
38
{0.0, 0.0, 0.0},
// BC3
39
{0.0, 0.0, 0.0}
// BC4
40
};
41
42
// GeoManager
43
TGeoManager
*
gGeoMan
= NULL;
44
45
// media
46
TGeoMedium
*
pMedAir
= 0;
47
TGeoMedium
*
pMedBC408
= 0;
48
49
class
FairGeoMedia;
50
class
FairGeoBuilder;
51
52
TGeoVolume
*
CreateStation
(
TString
station_name);
53
54
void
DefineRequiredMedia
(FairGeoMedia* geoMedia, FairGeoBuilder* geoBuild)
55
{
56
57
// air medium
58
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
59
if
(!mAir)
60
Fatal
(
"Main"
,
"FairMedium air not found"
);
61
geoBuild->createMedium(mAir);
62
pMedAir
=
gGeoManager
->GetMedium(
"air"
);
63
if
(!
pMedAir
)
64
Fatal
(
"Main"
,
"Medium air not found"
);
65
66
FairGeoMedium* mBC408 = geoMedia->getMedium(
"BC408"
);
67
if
(!mBC408)
68
Fatal
(
"Main"
,
"FairMedium BC408 not found"
);
69
geoBuild->createMedium(mBC408);
70
pMedBC408
=
gGeoManager
->GetMedium(
"BC408"
);
71
if
(!
pMedBC408
)
72
Fatal
(
"Main"
,
"Medium BC408 not found"
);
73
}
74
75
void
create_rootgeom_BC_Triggers
()
76
{
77
// ---- set working directory --------------------------------------------
78
TString
gPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
79
80
// ------- Geometry file name (output) ----------------------------------
81
const
TString
geoDetectorName =
"BC"
;
82
const
TString
geoDetectorVersion =
"RunSRCSpring2018"
;
83
const
TString
geoFileName = gPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
84
85
// ---- global geometry parameters ---------------------------------------
86
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
87
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
88
89
// ------- Load media from media file ----------------------------------
90
TString
medFile = gPath +
"/geometry/media.geo"
;
91
geoFace->setMediaFile(medFile);
92
geoFace->readMedia();
93
FairGeoMedia* geoMedia = geoFace->getMedia();
94
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
95
96
DefineRequiredMedia
(geoMedia, geoBuild);
97
98
// -------------- Create geometry and top volume -------------------------
99
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
100
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
101
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
102
top->
SetMedium
(
pMedAir
);
103
gGeoMan
->SetTopVolume(top);
104
105
// Define TOP Geometry
106
TGeoVolume
* BC =
new
TGeoVolumeAssembly
(geoDetectorName);
107
BC->
SetMedium
(
pMedAir
);
108
BC->
SetTransparency
(50);
109
110
if
(1) {
111
Int_t
iStat = 0;
// station number
112
TGeoTranslation
* BCPos_trans1 =
new
TGeoTranslation
(
"BC1Pos_trans"
,
StationPositions
[iStat][0],
113
StationPositions
[iStat][1],
StationPositions
[iStat][2]);
114
// TGeoBBox *bodyBC1 = new TGeoBBox("bodyBC1", StationLength[iStat][0]/2., StationLength[iStat][1]/2.,
115
// StationLength[iStat][2]/2.);
116
TGeoEltu
* bodyBC1 =
new
TGeoEltu
(
"bodyBC1"
,
StationLength
[iStat][0] / 2.,
StationLength
[iStat][1] / 2.,
117
StationLength
[iStat][2] / 2.);
118
TGeoVolume
* BC1ActiveVolumeV1 =
new
TGeoVolume
(
"BC1ActiveVolumeV1"
, bodyBC1);
119
BC1ActiveVolumeV1->
SetMedium
(
pMedBC408
);
120
BC1ActiveVolumeV1->
SetLineColor
(
kGray
);
121
TGeoRotation
* DetPos_rotBC1 =
122
new
TGeoRotation
(
"DetPos_rotBC1"
,
Rotation
[iStat][0],
Rotation
[iStat][1],
Rotation
[iStat][2]);
123
BC->
AddNode
(BC1ActiveVolumeV1, 0,
new
TGeoCombiTrans
(*BCPos_trans1, *DetPos_rotBC1));
124
}
125
126
if
(1) {
127
Int_t
iStat = 1;
// station number
128
TGeoTranslation
* BCPos_trans2 =
new
TGeoTranslation
(
"BC2Pos_trans"
,
StationPositions
[iStat][0],
129
StationPositions
[iStat][1],
StationPositions
[iStat][2]);
130
TGeoBBox
* bodyBC2 =
new
TGeoBBox
(
"bodyBC2"
,
StationLength
[iStat][0] / 2.,
StationLength
[iStat][1] / 2.,
131
StationLength
[iStat][2] / 2.);
132
TGeoVolume
* BC2ActiveVolumeV1 =
new
TGeoVolume
(
"BC2ActiveVolumeV1"
, bodyBC2);
133
BC2ActiveVolumeV1->
SetMedium
(
pMedBC408
);
134
BC2ActiveVolumeV1->
SetLineColor
(
kGray
);
135
TGeoRotation
* DetPos_rotBC2 =
136
new
TGeoRotation
(
"DetPos_rotBC2"
,
Rotation
[iStat][0],
Rotation
[iStat][1],
Rotation
[iStat][2]);
137
BC->
AddNode
(BC2ActiveVolumeV1, 0,
new
TGeoCombiTrans
(*BCPos_trans2, *DetPos_rotBC2));
138
}
139
140
if
(1) {
141
Int_t
iStat = 2;
// station number
142
TGeoTranslation
* BCPos_trans3 =
new
TGeoTranslation
(
"BC3Pos_trans"
,
StationPositions
[iStat][0],
143
StationPositions
[iStat][1],
StationPositions
[iStat][2]);
144
TGeoBBox
* bodyBC3 =
new
TGeoBBox
(
"bodyBC3"
,
StationLength
[iStat][0] / 2.,
StationLength
[iStat][1] / 2.,
145
StationLength
[iStat][2] / 2.);
146
TGeoVolume
* BC3ActiveVolumeV1 =
new
TGeoVolume
(
"BC3ActiveVolumeV1"
, bodyBC3);
147
BC3ActiveVolumeV1->
SetMedium
(
pMedBC408
);
148
BC3ActiveVolumeV1->
SetLineColor
(
kGray
);
149
TGeoRotation
* DetPos_rotBC3 =
150
new
TGeoRotation
(
"DetPos_rotBC3"
,
Rotation
[iStat][0],
Rotation
[iStat][1],
Rotation
[iStat][2]);
151
BC->
AddNode
(BC3ActiveVolumeV1, 0,
new
TGeoCombiTrans
(*BCPos_trans3, *DetPos_rotBC3));
152
}
153
154
if
(1) {
155
Int_t
iStat = 3;
// station number
156
TGeoTranslation
* BCPos_trans4 =
new
TGeoTranslation
(
"BC4Pos_trans"
,
StationPositions
[iStat][0],
157
StationPositions
[iStat][1],
StationPositions
[iStat][2]);
158
TGeoBBox
* bodyBC4 =
new
TGeoBBox
(
"bodyBC4"
,
StationLength
[iStat][0] / 2.,
StationLength
[iStat][1] / 2.,
159
StationLength
[iStat][2] / 2.);
160
TGeoVolume
* BC4ActiveVolumeV1 =
new
TGeoVolume
(
"BC4ActiveVolumeV1"
, bodyBC4);
161
BC4ActiveVolumeV1->
SetMedium
(
pMedBC408
);
162
BC4ActiveVolumeV1->
SetLineColor
(
kGray
);
163
TGeoRotation
* DetPos_rotBC4 =
164
new
TGeoRotation
(
"DetPos_rotBC4"
,
Rotation
[iStat][0],
Rotation
[iStat][1],
Rotation
[iStat][2]);
165
BC->
AddNode
(BC4ActiveVolumeV1, 0,
new
TGeoCombiTrans
(*BCPos_trans4, *DetPos_rotBC4));
166
}
167
168
top->
AddNode
(BC, 0);
169
top->
SetVisContainers
(
kTRUE
);
170
171
// --------------- Finish -----------------------------------------------
172
gGeoMan
->CloseGeometry();
173
gGeoMan
->CheckOverlaps(0.0001);
174
gGeoMan
->PrintOverlaps();
175
gGeoMan
->Test();
176
// gGeoMan->RestoreMasterVolume();
177
178
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
179
top->
Write
();
180
geoFile->
Close
();
181
top->
Draw
(
"ogl"
);
182
}
Int_t
int Int_t
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
kGray
kGray
Fatal
void Fatal(const char *location, const char *msgfmt,...)
TGeoEltu.h
gGeoManager
R__EXTERN TGeoManager * gGeoManager
TGeoVolume.h
gROOT
#define gROOT
gSystem
R__EXTERN TSystem * gSystem
TFile
TFile::Close
void Close(Option_t *option="") override
TGeoBBox
TGeoCombiTrans
TGeoEltu
TGeoManager
TGeoMedium
TGeoRotation
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
TObject::Write
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
TString
pMedAir
TGeoMedium * pMedAir
Definition
create_rootgeom_BC_Triggers.C:46
gGeoMan
TGeoManager * gGeoMan
Definition
create_rootgeom_BC_Triggers.C:43
NStations
const Int_t NStations
Definition
create_rootgeom_BC_Triggers.C:12
create_rootgeom_BC_Triggers
void create_rootgeom_BC_Triggers()
Definition
create_rootgeom_BC_Triggers.C:75
pMedBC408
TGeoMedium * pMedBC408
Definition
create_rootgeom_BC_Triggers.C:47
Zshift
const Double_t Zshift
Definition
create_rootgeom_BC_Triggers.C:13
StationLength
const Double_t StationLength[NStations][3]
Definition
create_rootgeom_BC_Triggers.C:27
StationPositions
const Double_t StationPositions[NStations][3]
Definition
create_rootgeom_BC_Triggers.C:18
CreateStation
TGeoVolume * CreateStation(TString station_name)
Definition
create_rootgeom_GEMS_RunSpring2018_misAlign.C:504
Xshift
const Double_t Xshift
Definition
create_rootgeom_BC_Triggers.C:14
DefineRequiredMedia
void DefineRequiredMedia(FairGeoMedia *geoMedia, FairGeoBuilder *geoBuild)
Definition
create_rootgeom_BC_Triggers.C:54
Yshift
const Double_t Yshift
Definition
create_rootgeom_BC_Triggers.C:15
Rotation
const Double_t Rotation[NStations][3]
Definition
create_rootgeom_BC_Triggers.C:35
install
macro
geometry
create_rootgeom_BC_Triggers.C
Generated on
for BmnRoot by
1.17.0