BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_MWPC3_run3.C
Go to the documentation of this file.
1
/**
2
* @brief
3
* Macro for creating geometry root-file describing MWPC3
4
* the first BM@N run (<<Shanghai>>)
5
* @author Sergey Merts
6
* @date 15.10.2014
7
*
8
*/
9
10
#include "
TFile.h
"
11
#include "
TGeoBBox.h
"
12
#include "
TGeoManager.h
"
13
#include "
TGeoShape.h
"
14
#include "
TMath.h
"
15
#include "
TString.h
"
16
17
using namespace
TMath
;
18
19
TGeoManager
*
gGeoMan
= NULL;
20
21
// Number of active planes with wires
22
const
Int_t
NofPlanes
= 6;
23
24
// Detector's position
25
const
Double_t
MWPC3_Xpos
= 0.0;
26
const
Double_t
MWPC3_Ypos
= 0.0;
27
const
Double_t
MWPC3_Zpos
= -150.0;
//-180.5;
28
29
// x
30
// A______B
31
// / \ |\
32
// v' / \ | \ u
33
// / \ | \
34
// \ \ | /
35
// u' \ \ | / v
36
// \______\|/
37
// C
38
// x'
39
40
// X
41
// _____ <----1----> _____ <-2-> _____
42
// | | | | | | |
43
// | | | | | | |
44
// | | | | | | |
45
// | | | | | | |
46
// |_____|_____|_____|_____|_____|_____|
47
// X'
48
//
49
// 1 - GapWireOnePlane
50
// 2 - GapWireTwoPlanes
51
52
// Detector's construct parameters
53
const
Double_t
ABsize
= 24.6;
// cm
54
const
Double_t
BCsize
= 43.3;
// cm
55
const
Double_t
ACsize
= 49.8;
// cm
56
const
Double_t
GapZsize
= 1.0;
// cm
57
const
Double_t
GapWireOnePlane
= 0.25;
// cm
58
const
Double_t
GapWireTwoPlanes
=
GapWireOnePlane
/ 2.0;
// cm // 0.125
59
60
const
Double_t
XSizeOfActiveVolume
=
ABsize
;
61
const
Double_t
YSizeOfActiveVolume
=
BCsize
;
62
const
Double_t
ZSizeOfActiveVolume
=
GapZsize
*
NofPlanes
;
// cm
63
64
const
Double_t
InnerRadiusOfHexagon
=
ABsize
/ 2.0 *
Sqrt
(3.0);
65
66
// FIXME!!! make sure! sizes of frame
67
const
Double_t
XWidthChamber
=
XSizeOfActiveVolume
+ 1.0;
68
const
Double_t
YHeightChamber
=
YSizeOfActiveVolume
+ 1.0;
69
const
Double_t
ZLengthChamber
=
ZSizeOfActiveVolume
+ 1.0;
70
71
void
create_rootgeom_MWPC3_run3
()
72
{
73
74
// Load the necessary FairRoot libraries
75
gROOT
->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C"
);
76
bmnloadlibs();
// load libraries
77
78
// ------- Load media from media file -----------------------------------
79
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
80
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
81
TString
geoPath =
TString
(
gSystem
->Getenv(
"VMCWORKDIR"
)) +
"/geometry/"
;
82
TString
medFile = geoPath +
"media.geo"
;
83
geoFace->setMediaFile(medFile);
84
geoFace->readMedia();
85
gGeoMan
=
gGeoManager
;
86
// --------------------------------------------------------------------------
87
88
// ------- Geometry file name (output) ----------------------------------
89
const
TString
geoDetectorName =
"mwpc3"
;
90
const
TString
geoDetectorVersion =
"v1_run3"
;
91
TString
geoFileName = geoPath + geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
92
// --------------------------------------------------------------------------
93
94
// ----------------- Get and create the required media -----------------
95
FairGeoMedia* geoMedia = geoFace->getMedia();
96
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
97
98
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
99
if
(!mAir)
100
Fatal
(
"Main"
,
"FairMedium air not found"
);
101
geoBuild->createMedium(mAir);
102
TGeoMedium
* pMedAir =
gGeoMan
->GetMedium(
"air"
);
103
if
(!pMedAir)
104
Fatal
(
"Main"
,
"Medium air not found"
);
105
106
FairGeoMedium* mArCO27030 = geoMedia->getMedium(
"arco27030"
);
107
if
(!mArCO27030)
108
Fatal
(
"Main"
,
"FairMedium arco27030 not found"
);
109
geoBuild->createMedium(mArCO27030);
110
TGeoMedium
* pMedArCO27030 =
gGeoMan
->GetMedium(
"arco27030"
);
111
if
(!pMedArCO27030)
112
Fatal
(
"Main"
,
"Medium arco27030 not found"
);
113
114
// --------------------------------------------------------------------------
115
116
// -------------- Create geometry and top volume -------------------------
117
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
118
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
119
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
120
top->
SetMedium
(pMedAir);
121
gGeoMan
->SetTopVolume(top);
122
// gGeoMan->SetTopVisible(1);
123
// --------------------------------------------------------------------------
124
125
// Define TOP Geometry
126
TGeoVolume
* MWPC3Top =
new
TGeoVolumeAssembly
(geoDetectorName);
127
MWPC3Top->
SetMedium
(pMedAir);
128
MWPC3Top->
SetTransparency
(50);
129
// Transformations (translations, rotations and scales)
130
TGeoTranslation
* DetPos_trans =
new
TGeoTranslation
(
"DetPos_trans"
,
MWPC3_Xpos
,
MWPC3_Ypos
,
MWPC3_Zpos
);
131
132
// Solids (shapes)
133
// hexagon which contains active wire planes
134
TGeoPgon
* MWPC3ContainerS =
new
TGeoPgon
(
"MWPC3ContainerS"
, 0, 360, 6, 2);
135
MWPC3ContainerS->
DefineSection
(0, -
ZLengthChamber
/ 2.0, 0.0,
YSizeOfActiveVolume
/ 2.0 + 1.0);
136
MWPC3ContainerS->
DefineSection
(1,
ZLengthChamber
/ 2.0, 0.0,
YSizeOfActiveVolume
/ 2.0 + 1.0);
137
// active wire plane
138
TGeoBBox
* MWPC3ActivePlaneS =
139
new
TGeoBBox
(
"MWPC3ActivePlaneS"
,
XSizeOfActiveVolume
/ 2.0,
YSizeOfActiveVolume
/ 2.0, 0.1
/*GapZsize / 2.0*/
);
140
141
// Volumes
142
TGeoVolume
* MWPC3ContainerV =
new
TGeoVolume
(
"MWPC3ContainerV"
, MWPC3ContainerS);
143
MWPC3ContainerV->
SetMedium
(pMedAir);
144
MWPC3ContainerV->
SetVisibility
(
kTRUE
);
145
MWPC3ContainerV->
SetTransparency
(60);
146
147
TGeoVolume
* MWPC3ActivePlaneV =
new
TGeoVolume
(
"MWPC3ActivePlaneV"
, MWPC3ActivePlaneS);
148
MWPC3ActivePlaneV->
SetMedium
(pMedArCO27030);
149
MWPC3ActivePlaneV->
SetLineColor
(
kBlue
);
150
MWPC3ActivePlaneV->
SetTransparency
(40);
151
152
// Adding volumes to the TOP Volume
153
top->
AddNode
(MWPC3Top, 1, DetPos_trans);
154
MWPC3Top->
AddNode
(MWPC3ContainerV, 1);
155
for
(
Int_t
iPlane = 1; iPlane <=
NofPlanes
; ++iPlane) {
156
TGeoTranslation
t1(0.0, 0.0,
GapZsize
* (iPlane - (
NofPlanes
+ 1) / 2.0));
157
TGeoRotation
r1(
"r1"
, 0.0, 0.0, (iPlane - 1) * 60.0);
158
MWPC3ContainerV->
AddNode
(MWPC3ActivePlaneV, iPlane,
new
TGeoCombiTrans
(t1, r1));
159
}
160
161
top->
SetVisContainers
(
kTRUE
);
162
163
// --------------- Finish -----------------------------------------------
164
gGeoMan
->CloseGeometry();
165
gGeoMan
->CheckOverlaps(0.001);
166
gGeoMan
->PrintOverlaps();
167
gGeoMan
->Test();
168
169
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
170
top->
Write
();
171
geoFile->
Close
();
172
top->
Draw
(
"ogl"
);
173
}
Int_t
int Int_t
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
kBlue
kBlue
Fatal
void Fatal(const char *location, const char *msgfmt,...)
TFile.h
TGeoBBox.h
TGeoManager.h
gGeoManager
R__EXTERN TGeoManager * gGeoManager
TGeoShape.h
TMath.h
gROOT
#define gROOT
TString.h
gSystem
R__EXTERN TSystem * gSystem
TFile
TFile::Close
void Close(Option_t *option="") override
TGeoBBox
TGeoCombiTrans
TGeoManager
TGeoMedium
TGeoPcon::DefineSection
virtual void DefineSection(Int_t snum, Double_t z, Double_t rmin, Double_t rmax)
TGeoPgon
TGeoRotation
TGeoTranslation
TGeoVolumeAssembly
TGeoVolume
TGeoVolume::SetVisContainers
void SetVisContainers(Bool_t flag=kTRUE) override
TGeoVolume::SetVisibility
void SetVisibility(Bool_t vis=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
gGeoMan
TGeoManager * gGeoMan
Definition
create_rootgeom_MWPC3_run3.C:19
XSizeOfActiveVolume
const Double_t XSizeOfActiveVolume
Definition
create_rootgeom_MWPC3_run3.C:60
GapWireOnePlane
const Double_t GapWireOnePlane
Definition
create_rootgeom_MWPC3_run3.C:57
YSizeOfActiveVolume
const Double_t YSizeOfActiveVolume
Definition
create_rootgeom_MWPC3_run3.C:61
InnerRadiusOfHexagon
const Double_t InnerRadiusOfHexagon
Definition
create_rootgeom_MWPC3_run3.C:64
ZSizeOfActiveVolume
const Double_t ZSizeOfActiveVolume
Definition
create_rootgeom_MWPC3_run3.C:62
XWidthChamber
const Double_t XWidthChamber
Definition
create_rootgeom_MWPC3_run3.C:67
ZLengthChamber
const Double_t ZLengthChamber
Definition
create_rootgeom_MWPC3_run3.C:69
NofPlanes
const Int_t NofPlanes
Definition
create_rootgeom_MWPC3_run3.C:22
YHeightChamber
const Double_t YHeightChamber
Definition
create_rootgeom_MWPC3_run3.C:68
BCsize
const Double_t BCsize
Definition
create_rootgeom_MWPC3_run3.C:54
ACsize
const Double_t ACsize
Definition
create_rootgeom_MWPC3_run3.C:55
GapZsize
const Double_t GapZsize
Definition
create_rootgeom_MWPC3_run3.C:56
ABsize
const Double_t ABsize
Definition
create_rootgeom_MWPC3_run3.C:53
GapWireTwoPlanes
const Double_t GapWireTwoPlanes
Definition
create_rootgeom_MWPC3_run3.C:58
MWPC3_Zpos
const Double_t MWPC3_Zpos
Definition
create_rootgeom_MWPC3_run3.C:27
MWPC3_Ypos
const Double_t MWPC3_Ypos
Definition
create_rootgeom_MWPC3_run3.C:26
MWPC3_Xpos
const Double_t MWPC3_Xpos
Definition
create_rootgeom_MWPC3_run3.C:25
create_rootgeom_MWPC3_run3
void create_rootgeom_MWPC3_run3()
Definition
create_rootgeom_MWPC3_run3.C:71
TMath
TMath::Sqrt
Double_t Sqrt(Double_t x)
install
macro
geometry
create_rootgeom_MWPC3_run3.C
Generated on
for BmnRoot by
1.17.0