BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
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
8
9// Detector's position
10const Double_t DCH1_Xpos = 28.89; // 23.0;
11const Double_t DCH1_Ypos = 0.03; // 0.0
12const Double_t DCH1_Zpos = 492.63; // 514.0;
13
14const Double_t DCH2_Xpos = 43.48; // 36.0;
15const Double_t DCH2_Ypos = -0.04; // 0.0;
16const Double_t DCH2_Zpos = 726.25; // 713.0;
17
18// Detector's construct parameters
19const 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
20const Double_t ActiveVolumeThickness = 0.002; // 20 micron (sense wire diameter)
21const Double_t CoverFoilThickness = 0.0022; // 22 micron (maylar coated with graphite)
22const Double_t HoleSize = 16.0;
23
26 (2.414 * SideLengthOfOctagon) / 2.0; // incircle radius, where 2.414 is a constant
29
30// Flange parameters
34
38
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();
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);
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,
143 OctagonActivePlaneS->DefineSection(1, +ActiveVolumeThickness * 0.5, InnerRadiusOfOctagon,
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);
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 -------------------------------------------------------------------
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);
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 Double_t
constexpr Bool_t kTRUE
kBlue
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TGeoManager * gGeoManager
#define gROOT
R__EXTERN TSystem * gSystem
static Int_t GetColor(const char *hexcolor)
void Close(Option_t *option="") override
virtual void DefineSection(Int_t snum, Double_t z, Double_t rmin, Double_t rmax)
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
void SetVisContainers(Bool_t flag=kTRUE) override
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
void Draw(Option_t *option="") override
void SetTransparency(Char_t transparency=0)
virtual void SetMedium(TGeoMedium *medium)
void SetLineColor(Color_t lcolor) override
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
const Double_t DCH2_Zpos[numRunPeriods]
const Double_t SideLengthOfOctagon
const Double_t InnerRadiusOfOctagon
const Double_t DCH1_Zpos[numRunPeriods]
TGeoManager * gGeoMan
const Double_t DCH1_Xpos
const Double_t DCH1_Ypos
const Double_t DCH2_Ypos
const Double_t DCH2_Xpos
const Double_t ZLengthOfTube
const Double_t OuterRadiusOfOctagon
const Double_t ActiveVolumeThickness
const Double_t OuterRadiusOfTube
const Double_t ZLengthOfFlange
const Double_t CoverFoilThickness
const Double_t InnerRadiusOfTube
const Double_t InnerRadiusOfFlange
const Double_t ZLengthOfChamber
const Double_t OuterRadiusOfFlange
const Double_t OuterRadiusOfOctagon_ActivePlane
const Double_t HoleSize
void create_rootgeom_DCH_Run8()