BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_FD_run8.C
Go to the documentation of this file.
2#include "TGeoCone.h"
3#include "TGeoManager.h"
4#include "TGeoPara.h"
5#include "TGeoTrd2.h"
6#include "TGeoTube.h"
7
8#include <iomanip>
9#include <iostream>
10
11R__ADD_INCLUDE_PATH($VMCWORKDIR)
12#include "macro/run/bmnloadlibs.C"
13//---------------------------
14
16
17// Detector's position
18
19const Double_t Fd_X_pos = 49.26; // 46.0;
20const Double_t Fd_Y_pos = 0.02; // 0.0;
21const Double_t Fd_Z_pos = 783.88; // 850.0;
22//
23
24const Double_t Qu_X_size = 15.0;
25const Double_t Qu_Y_size = 15.0;
26const Double_t Qu_Z_size = 0.1;
27
29{
30
31 // Load the necessary FairRoot libraries
32 // gROOT->LoadMacro("home/lashmanov/prog/bmnroot/macro/run/bmnloadlibs.C");
33 bmnloadlibs(); // load libraries
34
35 // ------- Load media from media file -----------------------------------
36 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
37 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
38 TString geoPath = gSystem->Getenv("VMCWORKDIR");
39 TString medFile = geoPath + "/geometry/media.geo";
40 geoFace->setMediaFile(medFile);
41 geoFace->readMedia();
43 // --------------------------------------------------------------------------
44
45 // ------- Geometry file name (output) ----------------------------------
46 const TString geoDetectorName = "FD";
47 const TString geoDetectorVersion = "run8";
48 TString geoFileName = geoPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
49 // --------------------------------------------------------------------------
50
51 // ----------------- Get and create the required media -----------------
52 FairGeoMedia* geoMedia = geoFace->getMedia();
53 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
54
55 FairGeoMedium* mAir = geoMedia->getMedium("air");
56 if (!mAir)
57 Fatal("Main", "FairMedium air not found");
58 geoBuild->createMedium(mAir);
59 TGeoMedium* pMedAir = gGeoMan->GetMedium("air");
60 if (!pMedAir)
61 Fatal("Main", "Medium air not found");
62
63 FairGeoMedium* mlead = geoMedia->getMedium("lead");
64 if (!mlead)
65 Fatal("Main", "FairMedium lead not found");
66 geoBuild->createMedium(mlead);
67 TGeoMedium* pMedlead = gGeoMan->GetMedium("lead");
68 if (!pMedlead)
69 Fatal("Main", "Medium lead not found");
70
71 FairGeoMedium* maluminium = geoMedia->getMedium("aluminium");
72 if (!maluminium)
73 Fatal("Main", "FairMedium aluminium not found");
74 geoBuild->createMedium(maluminium);
75 TGeoMedium* pMedaluminium = gGeoMan->GetMedium("aluminium");
76 if (!pMedaluminium)
77 Fatal("Main", "Medium aluminium not found");
78
79 FairGeoMedium* mPMTvacuum = geoMedia->getMedium("PMTvacuum");
80 if (!mPMTvacuum)
81 Fatal("Main", "FairMedium PMTvacuum not found");
82 geoBuild->createMedium(mPMTvacuum);
83 TGeoMedium* pMedPMTvacuum = gGeoMan->GetMedium("PMTvacuum");
84 if (!pMedPMTvacuum)
85 Fatal("Main", "Medium PMTvacuum not found");
86
87 FairGeoMedium* mFusedSil = geoMedia->getMedium("FusedSil");
88 if (!mFusedSil)
89 Fatal("Main", "FairMedium FusedSil not found");
90 geoBuild->createMedium(mFusedSil);
91 TGeoMedium* pMedFusedSil = gGeoMan->GetMedium("FusedSil");
92 if (!pMedFusedSil)
93 Fatal("Main", "Medium FusedSil not found");
94
95 FairGeoMedium* mFusedSilicon = geoMedia->getMedium("FusedSilicon");
96 if (!mFusedSilicon)
97 Fatal("Main", "FairMedium FusedSilicon not found");
98 geoBuild->createMedium(mFusedSilicon);
99 TGeoMedium* pMedFusedSilicon = gGeoMan->GetMedium("FusedSilicon");
100 if (!pMedFusedSilicon)
101 Fatal("Main", "Medium FusedSilicon not found");
102
103 // --------------------------------------------------------------------------
104
105 // -------------- Create geometry and top volume -------------------------
106 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
107 gGeoMan->SetName(geoDetectorName + "_geom");
108 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
109 top->SetMedium(pMedPMTvacuum);
110 gGeoMan->SetTopVolume(top);
111 // gGeoMan->SetTopVisible(1);
112 // --------------------------------------------------------------------------
113
114 // Define TOP Geometry
115 TGeoVolume* FD_Top = new TGeoVolumeAssembly(geoDetectorName);
116 // TGeoVolume* Qu_Top_1 = new TGeoVolumeAssembly(geoDetectorName);
117 FD_Top->SetMedium(pMedAir);
118
119 TGeoTranslation* Fd_pos = new TGeoTranslation("Fd_pos", Fd_X_pos, Fd_Y_pos, Fd_Z_pos);
120
121 TGeoCombiTrans* Null_pos = new TGeoCombiTrans("Null_pos", 0, 0, 0, new TGeoRotation("rot01", 0, 0, 0));
122 Null_pos->RegisterYourself();
123 TGeoCombiTrans* Null_pos1 = new TGeoCombiTrans("Null_pos1", 0, 0, 0, new TGeoRotation("rot02", 0, 0, 0));
124 Null_pos1->RegisterYourself();
125
126 TGeoCombiTrans* Quartz_pos = new TGeoCombiTrans("Quartz_pos", 0, 0, 0, new TGeoRotation("rot1", 0, 0, 0));
127 Quartz_pos->RegisterYourself();
128
129 TGeoCombiTrans* PMT_tube_pos = new TGeoCombiTrans("PMT_pos", 0, -65, 0, new TGeoRotation("rot2", 0, 90, 0));
130 PMT_tube_pos->RegisterYourself();
131
132 TGeoCombiTrans* panel_1_1_pos = new TGeoCombiTrans("panel_1_1_pos", 0, 0, 6, new TGeoRotation("rot3", 0, 0, 0));
133 panel_1_1_pos->RegisterYourself();
134
135 TGeoCombiTrans* panel_1_2_pos = new TGeoCombiTrans("panel_1_2_pos", 0, 0, -6, new TGeoRotation("rot4", 0, 0, 0));
136 panel_1_2_pos->RegisterYourself();
137
138 TGeoCombiTrans* panel_2_left_pos =
139 new TGeoCombiTrans("panel_2_left_pos", 11, 0, 0, new TGeoRotation("rot5", 90, 90, 0));
140 panel_2_left_pos->RegisterYourself();
141
142 TGeoCombiTrans* panel_2_right_pos =
143 new TGeoCombiTrans("panel_2_right_pos", -11, 0, 0, new TGeoRotation("rot6", 90, 90, 0));
144 panel_2_right_pos->RegisterYourself();
145
146 TGeoCombiTrans* panel_2_down_pos =
147 new TGeoCombiTrans("panel_2_down_pos", 0, -11, 0, new TGeoRotation("rot7", 0, 90, 0));
148 panel_2_down_pos->RegisterYourself();
149
150 TGeoCombiTrans* panel_2_up_pos = new TGeoCombiTrans("panel_2_up_pos", 0, 11, 0, new TGeoRotation("rot8", 0, 90, 0));
151 panel_2_up_pos->RegisterYourself();
152
153 TGeoCombiTrans* panel_3_1_pos = new TGeoCombiTrans("panel_3_1_pos", 0, -31, 6, new TGeoRotation("rot9", 0, 0, 0));
154 panel_3_1_pos->RegisterYourself();
155
156 TGeoCombiTrans* panel_3_2_pos = new TGeoCombiTrans("panel_3_2_pos", 0, -31, -6, new TGeoRotation("rot10", 0, 0, 0));
157 panel_3_2_pos->RegisterYourself();
158
159 TGeoCombiTrans* panel_4_1_pos =
160 new TGeoCombiTrans("panel_4_1_pos", 11, -31, 0, new TGeoRotation("rot11", 90, 90, 90));
161 panel_4_1_pos->RegisterYourself();
162
163 TGeoCombiTrans* panel_4_2_pos =
164 new TGeoCombiTrans("panel_4_2_pos", -11, -31, 0, new TGeoRotation("rot12", 90, 90, 90));
165 panel_4_2_pos->RegisterYourself();
166
167 TGeoCombiTrans* panel_4_2_d_pos =
168 new TGeoCombiTrans("panel_4_2_d_pos", 0, -51, 0, new TGeoRotation("rot13", 0, 90, 0));
169 panel_4_2_d_pos->RegisterYourself();
170
171 //
172
173 TGeoBBox* Qu_box = new TGeoBBox("Qu_box", Qu_X_size / 2, Qu_Y_size / 2, Qu_Z_size / 2);
174 TGeoTube* PMT_tube = new TGeoTube("PMT_tube", 0, 7.5 / 2, 28 / 2);
175
176 TGeoBBox* panel_1 = new TGeoBBox("panel_1", 22 / 2, 22 / 2, 0.2 / 2);
177 TGeoBBox* panel_1_cut = new TGeoBBox("panel_1_cut", 18 / 2, 18 / 2, 1.0 / 2);
178 TGeoBBox* panel_2 = new TGeoBBox("panel_2", 22 / 2, 12 / 2, 0.2 / 2);
179 TGeoBBox* panel_2_cut = new TGeoBBox("panel_2_cut", 18 / 2, 8 / 2, 1.0 / 2);
180
181 TGeoBBox* panel_2_l = new TGeoBBox("panel_2_l", 26 / 2, 16 / 2, 0.4 / 2);
182
183 TGeoBBox* panel_3 = new TGeoBBox("panel_3", 22 / 2, 40 / 2, 0.2 / 2);
184 TGeoBBox* panel_4 = new TGeoBBox("panel_4", 12 / 2, 40 / 2, 0.2 / 2);
185
186 TGeoCompositeShape* Geom_Cut_1 = new TGeoCompositeShape("Geom_Cut_1", "panel_1:Null_pos - panel_1_cut:Null_pos1");
187 TGeoCompositeShape* Geom_Cut_2 = new TGeoCompositeShape("Geom_Cut_2", "panel_2:Null_pos - panel_2_cut:Null_pos1");
188
190 "Al_head",
191 "Geom_Cut_1:panel_1_1_pos + Geom_Cut_1:panel_1_2_pos + Geom_Cut_2:panel_2_right_pos + "
192 "Geom_Cut_2:panel_2_left_pos + panel_2_l:panel_2_down_pos + panel_2:panel_2_up_pos + panel_3:panel_3_1_pos + "
193 "panel_3:panel_3_2_pos + panel_4:panel_4_1_pos + panel_4:panel_4_2_pos + panel_2_l:panel_4_2_d_pos");
194
195 //
196
197 TGeoVolume* Qu_ActiveVolumeV = new TGeoVolume("Qu_ActiveVolumeV", Qu_box);
198 Qu_ActiveVolumeV->SetMedium(pMedFusedSil);
199 Qu_ActiveVolumeV->SetLineColor(kAzure + 5);
200
201 TGeoVolume* Pmt_tube_mat = new TGeoVolume("Pmt_tube_mat", PMT_tube);
202 Pmt_tube_mat->SetMedium(pMedAir);
203 Pmt_tube_mat->SetLineColor(kBlue + 4);
204
205 TGeoVolume* Head_mat = new TGeoVolume("Head_mat", Al_head);
206 Head_mat->SetMedium(pMedaluminium);
207 Head_mat->SetLineColor(kGray + 1);
208 // Head_mat->SetLineColor(kBlack);
209
210 // Adding volumes to the TOP Volume
211
212 top->AddNode(FD_Top, 1, Fd_pos);
213 FD_Top->AddNode(Qu_ActiveVolumeV, 1, Quartz_pos);
214 FD_Top->AddNode(Pmt_tube_mat, 1, PMT_tube_pos);
215 FD_Top->AddNode(Head_mat, 1);
216
218
219 // CheckVolume(top);
220
221 // --------------- Finish -----------------------------------------------
222 gGeoMan->CloseGeometry();
223 gGeoMan->CheckOverlaps(0.001);
224 gGeoMan->PrintOverlaps();
225 gGeoMan->Test();
226
227 TFile* geoFile = new TFile(geoFileName, "RECREATE");
228 top->Write();
229 geoFile->Close();
230 top->Draw("ogl");
231 // top->Draw("");
232}
double Double_t
constexpr Bool_t kTRUE
#define R__ADD_INCLUDE_PATH(PATH)
kGray
kBlue
kAzure
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TGeoManager * gGeoManager
#define gROOT
R__EXTERN TSystem * gSystem
void Close(Option_t *option="") override
void RegisterYourself() override
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
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)
TGeoManager * gGeoMan
const Double_t Qu_Y_size
const Double_t Fd_Z_pos
const Double_t Fd_Y_pos
void create_rootgeom_FD_run8()
const Double_t Qu_X_size
const Double_t Fd_X_pos
const Double_t Qu_Z_size