BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_MWPC2_run2.C
Go to the documentation of this file.
1
/**
2
* @brief
3
* Macro for creating geometry root-file describing 3 MWPC2
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
MWPC2_Xpos
= 0.0;
26
const
Double_t
MWPC2_Ypos
= 0.0;
27
const
Double_t
MWPC2_Zpos
= -158.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_MWPC2_run2
()
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 =
"mwpc2"
;
90
const
TString
geoDetectorVersion =
"v1_run2"
;
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
* MWPC2Top =
new
TGeoVolumeAssembly
(geoDetectorName);
127
MWPC2Top->
SetMedium
(pMedAir);
128
MWPC2Top->
SetTransparency
(50);
129
130
// Transformations (translations, rotations and scales)
131
TGeoTranslation
* DetPos_trans =
new
TGeoTranslation
(
"DetPos_trans"
,
MWPC2_Xpos
,
MWPC2_Ypos
,
MWPC2_Zpos
);
132
133
// Solids (shapes)
134
// hexagon which contains active wire planes
135
TGeoPgon
* MWPC2ContainerS =
new
TGeoPgon
(
"MWPC2ContainerS"
, 0, 360, 6, 2);
136
MWPC2ContainerS->
DefineSection
(0, -
ZLengthChamber
/ 2.0, 0.0,
YSizeOfActiveVolume
/ 2.0 + 1.0);
137
MWPC2ContainerS->
DefineSection
(1,
ZLengthChamber
/ 2.0, 0.0,
YSizeOfActiveVolume
/ 2.0 + 1.0);
138
// active wire plane
139
TGeoBBox
* MWPC2ActivePlaneS =
140
new
TGeoBBox
(
"MWPC2ActivePlaneS"
,
XSizeOfActiveVolume
/ 2.0,
YSizeOfActiveVolume
/ 2.0, 0.1
/*GapZsize / 2.0*/
);
141
142
// Volumes
143
TGeoVolume
* MWPC2ContainerV =
new
TGeoVolume
(
"MWPC2ContainerV"
, MWPC2ContainerS);
144
MWPC2ContainerV->
SetMedium
(pMedAir);
145
MWPC2ContainerV->
SetVisibility
(
kTRUE
);
146
MWPC2ContainerV->
SetTransparency
(60);
147
148
TGeoVolume
* MWPC2ActivePlaneV =
new
TGeoVolume
(
"MWPC2ActivePlaneV"
, MWPC2ActivePlaneS);
149
MWPC2ActivePlaneV->
SetMedium
(pMedArCO27030);
150
MWPC2ActivePlaneV->
SetLineColor
(
kBlue
);
151
MWPC2ActivePlaneV->
SetTransparency
(40);
152
153
// Adding volumes to the TOP Volume
154
top->
AddNode
(MWPC2Top, 1, DetPos_trans);
155
MWPC2Top->
AddNode
(MWPC2ContainerV, 1);
156
for
(
Int_t
iPlane = 1; iPlane <=
NofPlanes
; ++iPlane) {
157
TGeoTranslation
t1(0.0, 0.0,
GapZsize
* (iPlane - (
NofPlanes
+ 1) / 2.0));
158
TGeoRotation
r1(
"r1"
, 0.0, 0.0, (iPlane - 1) * 60.0);
159
MWPC2ContainerV->
AddNode
(MWPC2ActivePlaneV, iPlane,
new
TGeoCombiTrans
(t1, r1));
160
}
161
162
top->
SetVisContainers
(
kTRUE
);
163
164
// --------------- Finish -----------------------------------------------
165
gGeoMan
->CloseGeometry();
166
gGeoMan
->CheckOverlaps(0.001);
167
gGeoMan
->PrintOverlaps();
168
gGeoMan
->Test();
169
170
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
171
top->
Write
();
172
geoFile->
Close
();
173
top->
Draw
(
"ogl"
);
174
}
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_MWPC2_run2.C:19
XSizeOfActiveVolume
const Double_t XSizeOfActiveVolume
Definition
create_rootgeom_MWPC2_run2.C:60
GapWireOnePlane
const Double_t GapWireOnePlane
Definition
create_rootgeom_MWPC2_run2.C:57
YSizeOfActiveVolume
const Double_t YSizeOfActiveVolume
Definition
create_rootgeom_MWPC2_run2.C:61
InnerRadiusOfHexagon
const Double_t InnerRadiusOfHexagon
Definition
create_rootgeom_MWPC2_run2.C:64
ZSizeOfActiveVolume
const Double_t ZSizeOfActiveVolume
Definition
create_rootgeom_MWPC2_run2.C:62
XWidthChamber
const Double_t XWidthChamber
Definition
create_rootgeom_MWPC2_run2.C:67
ZLengthChamber
const Double_t ZLengthChamber
Definition
create_rootgeom_MWPC2_run2.C:69
NofPlanes
const Int_t NofPlanes
Definition
create_rootgeom_MWPC2_run2.C:22
YHeightChamber
const Double_t YHeightChamber
Definition
create_rootgeom_MWPC2_run2.C:68
BCsize
const Double_t BCsize
Definition
create_rootgeom_MWPC2_run2.C:54
ACsize
const Double_t ACsize
Definition
create_rootgeom_MWPC2_run2.C:55
GapZsize
const Double_t GapZsize
Definition
create_rootgeom_MWPC2_run2.C:56
ABsize
const Double_t ABsize
Definition
create_rootgeom_MWPC2_run2.C:53
GapWireTwoPlanes
const Double_t GapWireTwoPlanes
Definition
create_rootgeom_MWPC2_run2.C:58
MWPC2_Ypos
const Double_t MWPC2_Ypos
Definition
create_rootgeom_MWPC2_run2.C:26
MWPC2_Zpos
const Double_t MWPC2_Zpos
Definition
create_rootgeom_MWPC2_run2.C:27
MWPC2_Xpos
const Double_t MWPC2_Xpos
Definition
create_rootgeom_MWPC2_run2.C:25
create_rootgeom_MWPC2_run2
void create_rootgeom_MWPC2_run2()
Definition
create_rootgeom_MWPC2_run2.C:71
TMath
TMath::Sqrt
Double_t Sqrt(Double_t x)
macro
geometry
create_rootgeom_MWPC2_run2.C
Generated on
for BmnRoot by
1.17.0