BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_DCH_Run8.C
Go to the documentation of this file.
1
//---------------------------
2
// Geometry of DCH detector (more detailed)
3
// Update: D.Baranov
4
// Date: 07.08.2019
5
//
6
7
TGeoManager
*
gGeoMan
= NULL;
8
9
// Detector's position
10
const
Double_t
DCH1_Xpos
= 28.89;
// 23.0;
11
const
Double_t
DCH1_Ypos
= 0.03;
// 0.0
12
const
Double_t
DCH1_Zpos
= 492.63;
// 514.0;
13
14
const
Double_t
DCH2_Xpos
= 43.48;
// 36.0;
15
const
Double_t
DCH2_Ypos
= -0.04;
// 0.0;
16
const
Double_t
DCH2_Zpos
= 726.25;
// 713.0;
17
18
// Detector's construct parameters
19
const
Double_t
ZLengthOfChamber
= 23.2;
// 4*(0.8+0.62+0.38+0.38+0.44+0.38+0.38+0.62+0.8)+ 2*2.0
20
const
Double_t
ActiveVolumeThickness
= 0.002;
// 20 micron (sense wire diameter)
21
const
Double_t
CoverFoilThickness
= 0.0022;
// 22 micron (maylar coated with graphite)
22
const
Double_t
HoleSize
= 16.0;
23
24
const
Double_t
SideLengthOfOctagon
= 120.0;
25
const
Double_t
OuterRadiusOfOctagon
=
26
(2.414 *
SideLengthOfOctagon
) / 2.0;
// incircle radius, where 2.414 is a constant
27
const
Double_t
OuterRadiusOfOctagon_ActivePlane
= 120.0;
28
const
Double_t
InnerRadiusOfOctagon
= 8.0;
29
30
// Flange parameters
31
const
Double_t
InnerRadiusOfFlange
= 7.6;
32
const
Double_t
OuterRadiusOfFlange
= 9.6;
33
const
Double_t
ZLengthOfFlange
= 7.5;
34
35
const
Double_t
InnerRadiusOfTube
=
InnerRadiusOfFlange
;
36
const
Double_t
OuterRadiusOfTube
= 7.75;
37
const
Double_t
ZLengthOfTube
=
ZLengthOfChamber
;
38
39
void
create_rootgeom_DCH_Run8
()
40
{
41
42
// ------- Load media from media file -----------------------------------
43
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
44
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
45
TString
geoPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
46
TString
medFile = geoPath +
"/geometry/media.geo"
;
47
geoFace->setMediaFile(medFile);
48
geoFace->readMedia();
49
gGeoMan
=
gGeoManager
;
50
// --------------------------------------------------------------------------
51
52
// ------- Geometry file name (output) ----------------------------------
53
const
TString
geoDetectorName =
"DCH"
;
54
const
TString
geoDetectorVersion =
"Run8"
;
55
const
TString
geoFileName = geoPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
56
// --------------------------------------------------------------------------
57
58
// ----------------- Get and create the required media -----------------
59
FairGeoMedia* geoMedia = geoFace->getMedia();
60
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
61
62
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
63
if
(!mAir)
64
Fatal
(
"Main"
,
"FairMedium air not found"
);
65
geoBuild->createMedium(mAir);
66
TGeoMedium
* pMedAir =
gGeoMan
->GetMedium(
"air"
);
67
if
(!pMedAir)
68
Fatal
(
"Main"
,
"Medium air not found"
);
69
70
FairGeoMedium* mArCO27030 = geoMedia->getMedium(
"arco27030"
);
71
if
(!mArCO27030)
72
Fatal
(
"Main"
,
"FairMedium arco27030 not found"
);
73
geoBuild->createMedium(mArCO27030);
74
TGeoMedium
* pMedArCO27030 =
gGeoMan
->GetMedium(
"arco27030"
);
75
if
(!pMedArCO27030)
76
Fatal
(
"Main"
,
"Medium arco27030 not found"
);
77
78
// ArgonIsobutane7525
79
FairGeoMedium* mArgonIsobutane7525 = geoMedia->getMedium(
"ArgonIsobutane7525"
);
80
if
(!mArgonIsobutane7525)
81
Fatal
(
"Main"
,
"FairMedium ArgonIsobutane7525 not found"
);
82
geoBuild->createMedium(mArgonIsobutane7525);
83
TGeoMedium
* pMedArgonIsobutane7525 =
gGeoMan
->GetMedium(
"ArgonIsobutane7525"
);
84
if
(!pMedArgonIsobutane7525)
85
Fatal
(
"Main"
,
"Medium ArgonIsobutane7525 not found"
);
86
87
// maylar
88
FairGeoMedium* mMylar = geoMedia->getMedium(
"mylar"
);
89
if
(!mMylar)
90
Fatal
(
"Main"
,
"FairMedium mMylar not found"
);
91
geoBuild->createMedium(mMylar);
92
TGeoMedium
* pMedMylar =
gGeoMan
->GetMedium(
"mylar"
);
93
if
(!pMedMylar)
94
Fatal
(
"Main"
,
"Medium mylar not found"
);
95
96
// aluminium
97
FairGeoMedium* mAluminium = geoMedia->getMedium(
"aluminium"
);
98
if
(!mAluminium)
99
Fatal
(
"Main"
,
"FairMedium aluminium not found"
);
100
geoBuild->createMedium(mAluminium);
101
TGeoMedium
* pMedAluminium =
gGeoMan
->GetMedium(
"aluminium"
);
102
if
(!pMedAluminium)
103
Fatal
(
"Main"
,
"Medium aluminium not found"
);
104
// --------------------------------------------------------------------------
105
106
// -------------- Create geometry and top volume -------------------------
107
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
108
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
109
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
110
top->
SetMedium
(pMedAir);
111
gGeoMan
->SetTopVolume(top);
112
// gGeoMan->SetTopVisible(1);
113
// --------------------------------------------------------------------------
114
115
// Define TOP Geometry
116
TGeoVolume
* DCH =
new
TGeoVolumeAssembly
(geoDetectorName);
117
DCH->SetMedium(pMedAir);
118
119
// Transformations (translations, rotations and scales)
120
TGeoCombiTrans
* combi1 =
121
new
TGeoCombiTrans
(
DCH1_Xpos
,
DCH1_Ypos
,
DCH1_Zpos
,
new
TGeoRotation
(
"rot"
, 45 * 0.5, 0, 0));
122
TGeoCombiTrans
* combi2 =
123
new
TGeoCombiTrans
(
DCH2_Xpos
,
DCH2_Ypos
,
DCH2_Zpos
,
new
TGeoRotation
(
"rot"
, 45 * 0.5, 0, 0));
124
125
TGeoRotation
* rot_Octagon =
new
TGeoRotation
(
"rot_Octagon"
);
126
rot_Octagon->
SetAngles
(90, -22.5, 90, 67.5, 0, 0);
127
128
// Chamber ------------------------------------------------------------------
129
TGeoPgon
* OctagonS =
new
TGeoPgon
(
"OctagonS"
, 0, 360, 8, 2);
130
OctagonS->
DefineSection
(0, -
ZLengthOfChamber
* 0.5,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
131
OctagonS->
DefineSection
(1, +
ZLengthOfChamber
* 0.5,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
132
133
TGeoVolume
* DCHDetV =
new
TGeoVolume
(
"DCHDetV"
, OctagonS);
134
DCHDetV->
SetMedium
(pMedArgonIsobutane7525);
135
DCHDetV->
SetLineColor
(
kBlue
);
136
DCHDetV->
SetTransparency
(75);
137
//--------------------------------------------------------------------------
138
139
// Active plane (sense wires) -----------------------------------------------
140
TGeoPgon
* OctagonActivePlaneS =
new
TGeoPgon
(
"OctagonActivePlaneS"
, 0, 360, 8, 2);
141
OctagonActivePlaneS->
DefineSection
(0, -
ActiveVolumeThickness
* 0.5,
InnerRadiusOfOctagon
,
142
OuterRadiusOfOctagon_ActivePlane
);
143
OctagonActivePlaneS->
DefineSection
(1, +
ActiveVolumeThickness
* 0.5,
InnerRadiusOfOctagon
,
144
OuterRadiusOfOctagon_ActivePlane
);
145
146
TGeoVolume
* DCHActivePlaneV =
new
TGeoVolume
(
"DCHActivePlaneV"
, OctagonActivePlaneS);
147
DCHActivePlaneV->
SetMedium
(pMedArgonIsobutane7525);
148
DCHActivePlaneV->
SetLineColor
(
TColor::GetColor
(
"#cc0000"
));
149
DCHActivePlaneV->
SetTransparency
(40);
150
//--------------------------------------------------------------------------
151
152
// Cover plane (maylar coated with graphite) --------------------------------
153
TGeoPgon
* OctagonCoverPlaneS =
new
TGeoPgon
(
"OctagonCoverPlaneS"
, 0, 360, 8, 2);
154
OctagonCoverPlaneS->
DefineSection
(0, -
CoverFoilThickness
* 0.5,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
155
OctagonCoverPlaneS->
DefineSection
(1, +
CoverFoilThickness
* 0.5,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
156
157
TGeoVolume
* DCHCoverLayerV =
new
TGeoVolume
(
"DCHCoverLayerV"
, OctagonCoverPlaneS);
158
DCHCoverLayerV->
SetMedium
(pMedMylar);
159
DCHCoverLayerV->
SetLineColor
(
TColor::GetColor
(
"#cccccc"
));
160
DCHCoverLayerV->
SetTransparency
(40);
161
//--------------------------------------------------------------------------
162
163
// Flange -------------------------------------------------------------------
164
TGeoTube
* FlangeS =
new
TGeoTube
(
"FlangeS"
,
InnerRadiusOfFlange
,
OuterRadiusOfFlange
,
ZLengthOfFlange
* 0.5);
165
TGeoTube
* TubeS =
new
TGeoTube
(
"TubeS"
,
InnerRadiusOfTube
,
OuterRadiusOfTube
,
ZLengthOfTube
* 0.5);
166
167
TGeoVolume
* FlangeV =
new
TGeoVolume
(
"FlangeV"
, FlangeS);
168
FlangeV->
SetMedium
(pMedAluminium);
169
FlangeV->
SetLineColor
(
TColor::GetColor
(
"#00cc00"
));
170
FlangeV->
SetTransparency
(40);
171
172
TGeoVolume
* TubeV =
new
TGeoVolume
(
"TubeV"
, TubeS);
173
TubeV->
SetMedium
(pMedAluminium);
174
TubeV->
SetLineColor
(
TColor::GetColor
(
"#00cc00"
));
175
TubeV->
SetTransparency
(40);
176
//--------------------------------------------------------------------------
177
178
DCHDetV->
AddNode
(DCHActivePlaneV, 0,
new
TGeoTranslation
(0., 0., -7.8));
179
DCHDetV->
AddNode
(DCHActivePlaneV, 1,
new
TGeoTranslation
(0., 0., -6.6));
180
DCHDetV->
AddNode
(DCHActivePlaneV, 2,
new
TGeoTranslation
(0., 0., -3.0));
181
DCHDetV->
AddNode
(DCHActivePlaneV, 3,
new
TGeoTranslation
(0., 0., -1.8));
182
DCHDetV->
AddNode
(DCHActivePlaneV, 4,
new
TGeoTranslation
(0., 0., 1.8));
183
DCHDetV->
AddNode
(DCHActivePlaneV, 5,
new
TGeoTranslation
(0., 0., 3.0));
184
DCHDetV->
AddNode
(DCHActivePlaneV, 6,
new
TGeoTranslation
(0., 0., 6.6));
185
DCHDetV->
AddNode
(DCHActivePlaneV, 7,
new
TGeoTranslation
(0., 0., 7.8));
186
187
DCHDetV->
AddNode
(DCHCoverLayerV, 0,
new
TGeoTranslation
(0., 0., -9.6 -
CoverFoilThickness
* 0.5));
188
DCHDetV->
AddNode
(DCHCoverLayerV, 1,
new
TGeoTranslation
(0., 0., -4.8 -
CoverFoilThickness
* 0.5));
189
DCHDetV->
AddNode
(DCHCoverLayerV, 2,
new
TGeoTranslation
(0., 0., -4.8 +
CoverFoilThickness
* 0.5));
190
DCHDetV->
AddNode
(DCHCoverLayerV, 3,
new
TGeoTranslation
(0., 0., 0.0 -
CoverFoilThickness
* 0.5));
191
DCHDetV->
AddNode
(DCHCoverLayerV, 4,
new
TGeoTranslation
(0., 0., 0.0 +
CoverFoilThickness
* 0.5));
192
DCHDetV->
AddNode
(DCHCoverLayerV, 5,
new
TGeoTranslation
(0., 0., 4.8 -
CoverFoilThickness
* 0.5));
193
DCHDetV->
AddNode
(DCHCoverLayerV, 6,
new
TGeoTranslation
(0., 0., 4.8 +
CoverFoilThickness
* 0.5));
194
DCHDetV->
AddNode
(DCHCoverLayerV, 7,
new
TGeoTranslation
(0., 0., 9.6 +
CoverFoilThickness
* 0.5));
195
196
// Adding volumes to the DCH Volume
197
DCH->AddNode(DCHDetV, 0, combi1);
198
DCH->AddNode(FlangeV, 1,
new
TGeoTranslation
(
DCH1_Xpos
,
DCH1_Ypos
, -11.6 -
ZLengthOfFlange
* 0.5 +
DCH1_Zpos
));
199
DCH->AddNode(FlangeV, 2,
new
TGeoTranslation
(
DCH1_Xpos
,
DCH1_Ypos
, +11.6 +
ZLengthOfFlange
* 0.5 +
DCH1_Zpos
));
200
DCH->AddNode(TubeV, 1,
new
TGeoTranslation
(
DCH1_Xpos
,
DCH1_Ypos
,
DCH1_Zpos
));
201
202
DCH->AddNode(DCHDetV, 1, combi2);
203
DCH->AddNode(FlangeV, 3,
new
TGeoTranslation
(
DCH2_Xpos
,
DCH2_Ypos
, -11.6 -
ZLengthOfFlange
* 0.5 +
DCH2_Zpos
));
204
DCH->AddNode(FlangeV, 4,
new
TGeoTranslation
(
DCH2_Xpos
,
DCH2_Ypos
, +11.6 +
ZLengthOfFlange
* 0.5 +
DCH2_Zpos
));
205
DCH->AddNode(TubeV, 2,
new
TGeoTranslation
(
DCH2_Xpos
,
DCH2_Ypos
,
DCH2_Zpos
));
206
207
top->
AddNode
(DCH, 0);
208
top->
SetVisContainers
(
kTRUE
);
209
210
// --------------- Finish -----------------------------------------------
211
gGeoMan
->CloseGeometry();
212
gGeoMan
->CheckOverlaps(0.001);
213
gGeoMan
->PrintOverlaps();
214
gGeoMan
->Test();
215
216
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
217
top->
Write
();
218
geoFile->
Close
();
219
top->
Draw
(
"ogl"
);
220
// top->Draw("");
221
}
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
kBlue
kBlue
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
TGeoCombiTrans
TGeoManager
TGeoMedium
TGeoPcon::DefineSection
virtual void DefineSection(Int_t snum, Double_t z, Double_t rmin, Double_t rmax)
TGeoPgon
TGeoRotation
TGeoRotation::SetAngles
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
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::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
DCH2_Zpos
const Double_t DCH2_Zpos[numRunPeriods]
Definition
DCHgeometryconstants_bmn.h:45
SideLengthOfOctagon
const Double_t SideLengthOfOctagon
Definition
DCHgeometryconstants_bmn.h:94
InnerRadiusOfOctagon
const Double_t InnerRadiusOfOctagon
Definition
DCHgeometryconstants_bmn.h:95
DCH1_Zpos
const Double_t DCH1_Zpos[numRunPeriods]
Definition
DCHgeometryconstants_bmn.h:39
gGeoMan
TGeoManager * gGeoMan
Definition
create_rootgeom_DCH_Run8.C:7
DCH1_Xpos
const Double_t DCH1_Xpos
Definition
create_rootgeom_DCH_Run8.C:10
DCH1_Ypos
const Double_t DCH1_Ypos
Definition
create_rootgeom_DCH_Run8.C:11
DCH2_Ypos
const Double_t DCH2_Ypos
Definition
create_rootgeom_DCH_Run8.C:15
DCH2_Xpos
const Double_t DCH2_Xpos
Definition
create_rootgeom_DCH_Run8.C:14
ZLengthOfTube
const Double_t ZLengthOfTube
Definition
create_rootgeom_DCH_Run8.C:37
OuterRadiusOfOctagon
const Double_t OuterRadiusOfOctagon
Definition
create_rootgeom_DCH_Run8.C:25
ActiveVolumeThickness
const Double_t ActiveVolumeThickness
Definition
create_rootgeom_DCH_Run8.C:20
OuterRadiusOfTube
const Double_t OuterRadiusOfTube
Definition
create_rootgeom_DCH_Run8.C:36
ZLengthOfFlange
const Double_t ZLengthOfFlange
Definition
create_rootgeom_DCH_Run8.C:33
CoverFoilThickness
const Double_t CoverFoilThickness
Definition
create_rootgeom_DCH_Run8.C:21
InnerRadiusOfTube
const Double_t InnerRadiusOfTube
Definition
create_rootgeom_DCH_Run8.C:35
InnerRadiusOfFlange
const Double_t InnerRadiusOfFlange
Definition
create_rootgeom_DCH_Run8.C:31
ZLengthOfChamber
const Double_t ZLengthOfChamber
Definition
create_rootgeom_DCH_Run8.C:19
OuterRadiusOfFlange
const Double_t OuterRadiusOfFlange
Definition
create_rootgeom_DCH_Run8.C:32
OuterRadiusOfOctagon_ActivePlane
const Double_t OuterRadiusOfOctagon_ActivePlane
Definition
create_rootgeom_DCH_Run8.C:27
HoleSize
const Double_t HoleSize
Definition
create_rootgeom_DCH_Run8.C:22
create_rootgeom_DCH_Run8
void create_rootgeom_DCH_Run8()
Definition
create_rootgeom_DCH_Run8.C:39
install
macro
geometry
create_rootgeom_DCH_Run8.C
Generated on
for BmnRoot by
1.17.0