BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_DCH1.C
Go to the documentation of this file.
1
//---------------------------
2
3
TGeoManager
*
gGeoMan
= NULL;
4
5
// Detector's position
6
const
Double_t
tanpipeangle
= 0.3 / 5.7;
// tangent of pipe angle
7
// const Double_t DCH1_Xpos = 0.0;
8
const
Double_t
DCH1_Ypos
= 0.0;
9
const
Double_t
DCH1_Zpos
= 550.0;
// cm
10
const
Double_t
DCH1_Xpos
=
DCH1_Zpos
*
tanpipeangle
;
11
12
// Detector's construct parameters
13
// const Double_t XYRadius_DCH1 = 144.84;
14
const
Double_t
ZLength_DCH1
= 20.0;
15
const
Double_t
ZLength_DCH1ActiveVolume
= 0.6;
16
const
Double_t
HoleSize_DCH1
= 12.0;
17
18
const
Double_t
SideLengthOfOctagon
= 120.0;
19
const
Double_t
InnerRadiusOfOctagon
= (2.414 *
SideLengthOfOctagon
) / 2.0;
20
21
const
Double_t
MaxRadiusOfActiveVolume
= 120.0;
22
const
Double_t
MinRadiusOfActiveVolume
= 12.0;
23
24
void
create_rootgeom_DCH1
()
25
{
26
27
// Load the necessary FairRoot libraries
28
gROOT
->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C"
);
29
bmnloadlibs();
// load libraries
30
31
// ------- Load media from media file -----------------------------------
32
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
33
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
34
TString
geoPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
35
TString
medFile = geoPath +
"/geometry/media.geo"
;
36
geoFace->setMediaFile(medFile);
37
geoFace->readMedia();
38
gGeoMan
=
gGeoManager
;
39
// --------------------------------------------------------------------------
40
41
// ------- Geometry file name (output) ----------------------------------
42
const
TString
geoDetectorName =
"dch1"
;
43
const
TString
geoDetectorVersion =
"v1"
;
44
geoFileName = geoPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
45
// --------------------------------------------------------------------------
46
47
// ----------------- Get and create the required media -----------------
48
FairGeoMedia* geoMedia = geoFace->getMedia();
49
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
50
51
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
52
if
(!mAir)
53
Fatal
(
"Main"
,
"FairMedium air not found"
);
54
geoBuild->createMedium(mAir);
55
TGeoMedium
* pMedAir =
gGeoMan
->GetMedium(
"air"
);
56
if
(!pMedAir)
57
Fatal
(
"Main"
,
"Medium air not found"
);
58
59
FairGeoMedium* mArCO27030 = geoMedia->getMedium(
"arco27030"
);
60
if
(!mArCO27030)
61
Fatal
(
"Main"
,
"FairMedium arco27030 not found"
);
62
geoBuild->createMedium(mArCO27030);
63
TGeoMedium
* pMedArCO27030 =
gGeoMan
->GetMedium(
"arco27030"
);
64
if
(!pMedArCO27030)
65
Fatal
(
"Main"
,
"Medium arco27030 not found"
);
66
67
// --------------------------------------------------------------------------
68
69
// -------------- Create geometry and top volume -------------------------
70
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
71
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
72
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
73
top->
SetMedium
(pMedAir);
74
gGeoMan
->SetTopVolume(top);
75
// gGeoMan->SetTopVisible(1);
76
// --------------------------------------------------------------------------
77
78
// Define TOP Geometry
79
TGeoVolume
* DCH1Top =
new
TGeoVolumeAssembly
(geoDetectorName);
80
DCH1Top->
SetMedium
(pMedAir);
81
82
// Transformations (translations, rotations and scales)
83
TGeoTranslation
* DetPos_trans =
new
TGeoTranslation
(
"DetPos_trans"
,
DCH1_Xpos
,
DCH1_Ypos
,
DCH1_Zpos
);
84
// SetPos_trans->RegisterYourself();
85
86
TGeoRotation
* rot_Octagon =
new
TGeoRotation
(
"rot_Octagon"
);
87
// rot_RB->SetAngles(90, -45, 90, 45, 0, 0);
88
rot_Octagon->
SetAngles
(90, -22.5, 90, 67.5, 0, 0);
89
rot_Octagon->
RegisterYourself
();
90
91
// Solids (shapes)
92
TGeoPgon
* OctagonS =
new
TGeoPgon
(
"OctagonS"
, 0, 360, 8, 2);
93
OctagonS->
DefineSection
(0, -
ZLength_DCH1
/ 2, 0.0,
InnerRadiusOfOctagon
);
94
OctagonS->
DefineSection
(1,
ZLength_DCH1
/ 2, 0.0,
InnerRadiusOfOctagon
);
95
96
// TGeoBBox *DCH1ContainerS = new TGeoBBox("DCH1ContainerS", InnerRadiusOfOctagon + 0.01, InnerRadiusOfOctagon +
97
// 0.01, ZLength_DCH1/2 + 0.01);
98
TGeoBBox
* DCH1ContainerS =
99
new
TGeoBBox
(
"DCH1ContainerS"
,
InnerRadiusOfOctagon
,
InnerRadiusOfOctagon
,
ZLength_DCH1
/ 2);
100
// TGeoTube *DCH1ActiveVolumeS = new TGeoTube(MinRadiusOfActiveVolume, MaxRadiusOfActiveVolume, ZLength_DCH1/2 -
101
// 0.01);
102
TGeoTube
* DCH1ActiveVolumeS =
103
new
TGeoTube
(
MinRadiusOfActiveVolume
,
MaxRadiusOfActiveVolume
,
ZLength_DCH1ActiveVolume
/ 2);
104
// TGeoBBox *DCH1HoleS = new TGeoBBox("DCH1HoleS", HoleSize_DCH1/2, HoleSize_DCH1/2, ZLength_DCH1/2 + 0.1);
105
TGeoBBox
* DCH1HoleS =
new
TGeoBBox
(
"DCH1HoleS"
,
HoleSize_DCH1
/ 2,
HoleSize_DCH1
/ 2,
ZLength_DCH1
/ 2);
106
107
// Composite solids (shapes)
108
TGeoCompositeShape
* DCH1DetS =
new
TGeoCompositeShape
(
"DCH1DetS"
,
"OctagonS:rot_Octagon-DCH1HoleS"
);
109
110
// Volumes
111
TGeoVolume
* DCH1ContainerV =
new
TGeoVolume
(
"DCH1ContainerV"
, DCH1ContainerS);
112
DCH1ContainerV->
SetMedium
(pMedAir);
113
// DCH1ContainerV->SetVisibility(kFALSE);
114
115
TGeoVolume
* DCH1DetV =
new
TGeoVolume
(
"DCH1DetV"
, DCH1DetS);
116
DCH1DetV->
SetMedium
(pMedAir);
117
DCH1DetV->
SetLineColor
(
kBlue
);
118
119
TGeoVolume
* DCH1ActiveVolumeV =
new
TGeoVolume
(
"DCH1ActiveVolumeV"
, DCH1ActiveVolumeS);
120
DCH1ActiveVolumeV->
SetMedium
(pMedArCO27030);
121
DCH1ActiveVolumeV->
SetLineColor
(
kGreen
);
122
123
// Adding volumes to the TOP Volume
124
top->
AddNode
(DCH1Top, 1, DetPos_trans);
125
DCH1Top->
AddNode
(DCH1ContainerV, 1);
126
DCH1ContainerV->
AddNode
(DCH1DetV, 1);
127
// DCH1DetV->AddNode(DCH1ActiveVolumeV, 1);
128
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 1,
new
TGeoTranslation
(0., 0., -7.8));
129
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 2,
new
TGeoTranslation
(0., 0., -6.6));
130
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 3,
new
TGeoTranslation
(0., 0., -3.0));
131
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 4,
new
TGeoTranslation
(0., 0., -1.8));
132
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 5,
new
TGeoTranslation
(0., 0., 1.8));
133
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 6,
new
TGeoTranslation
(0., 0., 3.0));
134
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 7,
new
TGeoTranslation
(0., 0., 6.6));
135
DCH1DetV->
AddNode
(DCH1ActiveVolumeV, 8,
new
TGeoTranslation
(0., 0., 7.8));
136
137
top->
SetVisContainers
(
kTRUE
);
138
139
// --------------- Finish -----------------------------------------------
140
gGeoMan
->CloseGeometry();
141
gGeoMan
->CheckOverlaps(0.001);
142
gGeoMan
->PrintOverlaps();
143
gGeoMan
->Test();
144
145
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
146
top->
Write
();
147
geoFile->
Close
();
148
// top->Draw("ogl");
149
top->
Draw
(
""
);
150
}
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
kGreen
kGreen
kBlue
kBlue
Fatal
void Fatal(const char *location, const char *msgfmt,...)
gGeoManager
R__EXTERN TGeoManager * gGeoManager
gROOT
#define gROOT
gSystem
R__EXTERN TSystem * gSystem
TFile
TFile::Close
void Close(Option_t *option="") override
TGeoBBox
TGeoCompositeShape
TGeoManager
TGeoMatrix::RegisterYourself
virtual void RegisterYourself()
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::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
MaxRadiusOfActiveVolume
const Double_t MaxRadiusOfActiveVolume
Definition
DCHgeometryconstants_bmn.h:97
SideLengthOfOctagon
const Double_t SideLengthOfOctagon
Definition
DCHgeometryconstants_bmn.h:94
InnerRadiusOfOctagon
const Double_t InnerRadiusOfOctagon
Definition
DCHgeometryconstants_bmn.h:95
MinRadiusOfActiveVolume
const Double_t MinRadiusOfActiveVolume
Definition
DCHgeometryconstants_bmn.h:98
DCH1_Zpos
const Double_t DCH1_Zpos[numRunPeriods]
Definition
DCHgeometryconstants_bmn.h:39
gGeoMan
TGeoManager * gGeoMan
Definition
create_rootgeom_DCH1.C:3
DCH1_Xpos
const Double_t DCH1_Xpos
Definition
create_rootgeom_DCH1.C:10
ZLength_DCH1
const Double_t ZLength_DCH1
Definition
create_rootgeom_DCH1.C:14
DCH1_Ypos
const Double_t DCH1_Ypos
Definition
create_rootgeom_DCH1.C:8
tanpipeangle
const Double_t tanpipeangle
Definition
create_rootgeom_DCH1.C:6
ZLength_DCH1ActiveVolume
const Double_t ZLength_DCH1ActiveVolume
Definition
create_rootgeom_DCH1.C:15
create_rootgeom_DCH1
void create_rootgeom_DCH1()
Definition
create_rootgeom_DCH1.C:24
HoleSize_DCH1
const Double_t HoleSize_DCH1
Definition
create_rootgeom_DCH1.C:16
install
macro
geometry
create_rootgeom_DCH1.C
Generated on
for BmnRoot by
1.17.0