BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
create_rootgeom_DCH_RunWinter2016.C
Go to the documentation of this file.
1
//---------------------------
2
// VERY PRELIMINARY! NO INNER STRUCTURE!!!
3
//
4
5
TGeoManager
*
gGeoMan
= NULL;
6
7
// Detector's position
8
9
const
Double_t
DCH1_Xpos
= 0.0;
10
const
Double_t
DCH2_Xpos
= 0.0;
11
const
Double_t
DCH1_Ypos
= 0.0;
12
const
Double_t
DCH2_Ypos
= 0.0;
13
const
Double_t
DCH1_Zpos
= 514.0;
14
const
Double_t
DCH2_Zpos
= 713.0;
15
16
// Detector's construct parameters
17
const
Double_t
ZLength_DCH1
= 26.5;
// 20.0
18
const
Double_t
ZLength_DCH1ActiveVolume
= 0.6;
19
const
Double_t
HoleSize_DCH1
= 12.0;
20
21
const
Double_t
SideLengthOfOctagon
= 120.0;
22
const
Double_t
OuterRadiusOfOctagon
= (2.414 *
SideLengthOfOctagon
) / 2.0;
23
const
Double_t
InnerRadiusOfOctagon
= 12.0;
24
25
void
create_rootgeom_DCH_RunWinter2016
()
26
{
27
28
// Load the necessary FairRoot libraries
29
// gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
30
// bmnloadlibs(); // load libraries
31
32
// ------- Load media from media file -----------------------------------
33
FairGeoLoader* geoLoad =
new
FairGeoLoader(
"TGeo"
,
"FairGeoLoader"
);
34
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
35
TString
geoPath =
gSystem
->Getenv(
"VMCWORKDIR"
);
36
TString
medFile = geoPath +
"/geometry/media.geo"
;
37
geoFace->setMediaFile(medFile);
38
geoFace->readMedia();
39
gGeoMan
=
gGeoManager
;
40
// --------------------------------------------------------------------------
41
42
// ------- Geometry file name (output) ----------------------------------
43
const
TString
geoDetectorName =
"DCH"
;
44
const
TString
geoDetectorVersion =
"RunWinter2016"
;
45
geoFileName = geoPath +
"/geometry/"
+ geoDetectorName +
"_"
+ geoDetectorVersion +
".root"
;
46
// --------------------------------------------------------------------------
47
48
// ----------------- Get and create the required media -----------------
49
FairGeoMedia* geoMedia = geoFace->getMedia();
50
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
51
52
FairGeoMedium* mAir = geoMedia->getMedium(
"air"
);
53
if
(!mAir)
54
Fatal
(
"Main"
,
"FairMedium air not found"
);
55
geoBuild->createMedium(mAir);
56
TGeoMedium
* pMedAir =
gGeoMan
->GetMedium(
"air"
);
57
if
(!pMedAir)
58
Fatal
(
"Main"
,
"Medium air not found"
);
59
60
FairGeoMedium* mArCO27030 = geoMedia->getMedium(
"arco27030"
);
61
if
(!mArCO27030)
62
Fatal
(
"Main"
,
"FairMedium arco27030 not found"
);
63
geoBuild->createMedium(mArCO27030);
64
TGeoMedium
* pMedArCO27030 =
gGeoMan
->GetMedium(
"arco27030"
);
65
if
(!pMedArCO27030)
66
Fatal
(
"Main"
,
"Medium arco27030 not found"
);
67
68
// --------------------------------------------------------------------------
69
70
// -------------- Create geometry and top volume -------------------------
71
gGeoMan
= (
TGeoManager
*)
gROOT
->FindObject(
"FAIRGeom"
);
72
gGeoMan
->SetName(geoDetectorName +
"_geom"
);
73
TGeoVolume
* top =
new
TGeoVolumeAssembly
(
"TOP"
);
74
top->
SetMedium
(pMedAir);
75
gGeoMan
->SetTopVolume(top);
76
// gGeoMan->SetTopVisible(1);
77
// --------------------------------------------------------------------------
78
79
// Define TOP Geometry
80
TGeoVolume
* DCH =
new
TGeoVolumeAssembly
(geoDetectorName);
81
DCH->SetMedium(pMedAir);
82
83
// Transformations (translations, rotations and scales)
84
TGeoCombiTrans
* combi1 =
85
new
TGeoCombiTrans
(
DCH1_Xpos
,
DCH1_Ypos
,
DCH1_Zpos
,
new
TGeoRotation
(
"rot"
, 45 * 0.5, 0, 0));
86
TGeoCombiTrans
* combi2 =
87
new
TGeoCombiTrans
(
DCH2_Xpos
,
DCH2_Ypos
,
DCH2_Zpos
,
new
TGeoRotation
(
"rot"
, 45 * 0.5, 0, 0));
88
89
TGeoRotation
* rot_Octagon =
new
TGeoRotation
(
"rot_Octagon"
);
90
rot_Octagon->
SetAngles
(90, -22.5, 90, 67.5, 0, 0);
91
92
// Solids (shapes)
93
TGeoPgon
* OctagonS =
new
TGeoPgon
(
"OctagonS"
, 0, 360, 8, 2);
94
OctagonS->
DefineSection
(0, -
ZLength_DCH1
/ 2,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
95
OctagonS->
DefineSection
(1,
ZLength_DCH1
/ 2,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
96
97
TGeoVolume
* DCHDetV =
new
TGeoVolume
(
"DCHDetV"
, OctagonS);
98
DCHDetV->
SetMedium
(pMedAir);
99
DCHDetV->
SetLineColor
(
kBlue
);
100
DCHDetV->
SetTransparency
(75);
101
102
TGeoPgon
* OctagonPlaneS =
new
TGeoPgon
(
"OctagonActivePlaneS"
, 0, 360, 8, 2);
103
OctagonPlaneS->
DefineSection
(0, -0.05,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
104
OctagonPlaneS->
DefineSection
(1, 0.05,
InnerRadiusOfOctagon
,
OuterRadiusOfOctagon
);
105
106
TGeoVolume
* DCHActivePlaneV =
new
TGeoVolume
(
"DCHActivePlaneV"
, OctagonPlaneS);
107
DCHActivePlaneV->
SetMedium
(pMedArCO27030);
108
DCHActivePlaneV->
SetLineColor
(
kBlue
);
109
DCHActivePlaneV->
SetTransparency
(40);
110
111
for
(
Int_t
iPlane = 1; iPlane <= 8; ++iPlane) {
112
TGeoTranslation
t0(0.0, 0.0,
ZLength_DCH1
/ 8 * (iPlane - (8 + 1) / 2.0));
113
DCHDetV->
AddNode
(DCHActivePlaneV, iPlane - 1,
new
TGeoCombiTrans
(t0));
114
}
115
116
// Adding volumes to the TOP Volume
117
DCH->AddNode(DCHDetV, 0, combi1);
118
DCH->AddNode(DCHDetV, 0, combi2);
119
top->
AddNode
(DCH, 0);
120
top->
SetVisContainers
(
kTRUE
);
121
122
// --------------- Finish -----------------------------------------------
123
gGeoMan
->CloseGeometry();
124
gGeoMan
->CheckOverlaps(0.001);
125
gGeoMan
->PrintOverlaps();
126
gGeoMan
->Test();
127
128
TFile
* geoFile =
new
TFile
(geoFileName,
"RECREATE"
);
129
top->
Write
();
130
geoFile->
Close
();
131
top->
Draw
(
"ogl"
);
132
// top->Draw("");
133
}
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,...)
gGeoManager
R__EXTERN TGeoManager * gGeoManager
gROOT
#define gROOT
gSystem
R__EXTERN TSystem * gSystem
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
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_RunWinter2016.C:5
DCH1_Xpos
const Double_t DCH1_Xpos
Definition
create_rootgeom_DCH_RunWinter2016.C:9
ZLength_DCH1
const Double_t ZLength_DCH1
Definition
create_rootgeom_DCH_RunWinter2016.C:17
DCH1_Ypos
const Double_t DCH1_Ypos
Definition
create_rootgeom_DCH_RunWinter2016.C:11
ZLength_DCH1ActiveVolume
const Double_t ZLength_DCH1ActiveVolume
Definition
create_rootgeom_DCH_RunWinter2016.C:18
HoleSize_DCH1
const Double_t HoleSize_DCH1
Definition
create_rootgeom_DCH_RunWinter2016.C:19
DCH2_Ypos
const Double_t DCH2_Ypos
Definition
create_rootgeom_DCH_RunWinter2016.C:12
DCH2_Xpos
const Double_t DCH2_Xpos
Definition
create_rootgeom_DCH_RunWinter2016.C:10
OuterRadiusOfOctagon
const Double_t OuterRadiusOfOctagon
Definition
create_rootgeom_DCH_RunWinter2016.C:22
create_rootgeom_DCH_RunWinter2016
void create_rootgeom_DCH_RunWinter2016()
Definition
create_rootgeom_DCH_RunWinter2016.C:25
install
macro
geometry
create_rootgeom_DCH_RunWinter2016.C
Generated on
for BmnRoot by
1.17.0