BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_rootgeom_DCH_RunSpring2018.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 = 0.0;
11const Double_t DCH1_Ypos = 0.0;
12const Double_t DCH1_Zpos = 514.0;
13
14const Double_t DCH2_Xpos = 0.0;
15const Double_t DCH2_Ypos = 0.0;
16const Double_t DCH2_Zpos = 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;
39
41{
42
43 // ------- Load media from media file -----------------------------------
44 FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
45 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
46 TString geoPath = gSystem->Getenv("VMCWORKDIR");
47 TString medFile = geoPath + "/geometry/media.geo";
48 geoFace->setMediaFile(medFile);
49 geoFace->readMedia();
51 // --------------------------------------------------------------------------
52
53 // ------- Geometry file name (output) ----------------------------------
54 const TString geoDetectorName = "DCH";
55 const TString geoDetectorVersion = "RunSpring2018";
56 const TString geoFileName = geoPath + "/geometry/" + geoDetectorName + "_" + geoDetectorVersion + ".root";
57 // --------------------------------------------------------------------------
58
59 // ----------------- Get and create the required media -----------------
60 FairGeoMedia* geoMedia = geoFace->getMedia();
61 FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
62
63 FairGeoMedium* mAir = geoMedia->getMedium("air");
64 if (!mAir)
65 Fatal("Main", "FairMedium air not found");
66 geoBuild->createMedium(mAir);
67 TGeoMedium* pMedAir = gGeoMan->GetMedium("air");
68 if (!pMedAir)
69 Fatal("Main", "Medium air not found");
70
71 FairGeoMedium* mArCO27030 = geoMedia->getMedium("arco27030");
72 if (!mArCO27030)
73 Fatal("Main", "FairMedium arco27030 not found");
74 geoBuild->createMedium(mArCO27030);
75 TGeoMedium* pMedArCO27030 = gGeoMan->GetMedium("arco27030");
76 if (!pMedArCO27030)
77 Fatal("Main", "Medium arco27030 not found");
78
79 // ArgonIsobutane7525
80 FairGeoMedium* mArgonIsobutane7525 = geoMedia->getMedium("ArgonIsobutane7525");
81 if (!mArgonIsobutane7525)
82 Fatal("Main", "FairMedium ArgonIsobutane7525 not found");
83 geoBuild->createMedium(mArgonIsobutane7525);
84 TGeoMedium* pMedArgonIsobutane7525 = gGeoMan->GetMedium("ArgonIsobutane7525");
85 if (!pMedArgonIsobutane7525)
86 Fatal("Main", "Medium ArgonIsobutane7525 not found");
87
88 // maylar
89 FairGeoMedium* mMylar = geoMedia->getMedium("mylar");
90 if (!mMylar)
91 Fatal("Main", "FairMedium mMylar not found");
92 geoBuild->createMedium(mMylar);
93 TGeoMedium* pMedMylar = gGeoMan->GetMedium("mylar");
94 if (!pMedMylar)
95 Fatal("Main", "Medium mylar not found");
96
97 // aluminium
98 FairGeoMedium* mAluminium = geoMedia->getMedium("aluminium");
99 if (!mAluminium)
100 Fatal("Main", "FairMedium aluminium not found");
101 geoBuild->createMedium(mAluminium);
102 TGeoMedium* pMedAluminium = gGeoMan->GetMedium("aluminium");
103 if (!pMedAluminium)
104 Fatal("Main", "Medium aluminium not found");
105 // --------------------------------------------------------------------------
106
107 // -------------- Create geometry and top volume -------------------------
108 gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
109 gGeoMan->SetName(geoDetectorName + "_geom");
110 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
111 top->SetMedium(pMedAir);
112 gGeoMan->SetTopVolume(top);
113 // gGeoMan->SetTopVisible(1);
114 // --------------------------------------------------------------------------
115
116 // Define TOP Geometry
117 TGeoVolume* DCH = new TGeoVolumeAssembly(geoDetectorName);
118 DCH->SetMedium(pMedAir);
119
120 // Transformations (translations, rotations and scales)
121 TGeoCombiTrans* combi1 =
122 new TGeoCombiTrans(DCH1_Xpos, DCH1_Ypos, DCH1_Zpos, new TGeoRotation("rot", 45 * 0.5, 0, 0));
123 TGeoCombiTrans* combi2 =
124 new TGeoCombiTrans(DCH2_Xpos, DCH2_Ypos, DCH2_Zpos, new TGeoRotation("rot", 45 * 0.5, 0, 0));
125
126 TGeoRotation* rot_Octagon = new TGeoRotation("rot_Octagon");
127 rot_Octagon->SetAngles(90, -22.5, 90, 67.5, 0, 0);
128
129 // Chamber ------------------------------------------------------------------
130 TGeoPgon* OctagonS = new TGeoPgon("OctagonS", 0, 360, 8, 2);
133
134 TGeoVolume* DCHDetV = new TGeoVolume("DCHDetV", OctagonS);
135 DCHDetV->SetMedium(pMedArgonIsobutane7525);
136 DCHDetV->SetLineColor(kBlue);
137 DCHDetV->SetTransparency(75);
138 //--------------------------------------------------------------------------
139
140 // Active plane (sense wires) -----------------------------------------------
141 TGeoPgon* OctagonActivePlaneS = new TGeoPgon("OctagonActivePlaneS", 0, 360, 8, 2);
142 OctagonActivePlaneS->DefineSection(0, -ActiveVolumeThickness * 0.5, InnerRadiusOfOctagon,
144 OctagonActivePlaneS->DefineSection(1, +ActiveVolumeThickness * 0.5, InnerRadiusOfOctagon,
146
147 TGeoVolume* DCHActivePlaneV = new TGeoVolume("DCHActivePlaneV", OctagonActivePlaneS);
148 DCHActivePlaneV->SetMedium(pMedArgonIsobutane7525);
149 DCHActivePlaneV->SetLineColor(TColor::GetColor("#cc0000"));
150 DCHActivePlaneV->SetTransparency(40);
151 //--------------------------------------------------------------------------
152
153 // Cover plane (maylar coated with graphite) --------------------------------
154 TGeoPgon* OctagonCoverPlaneS = new TGeoPgon("OctagonCoverPlaneS", 0, 360, 8, 2);
157
158 TGeoVolume* DCHCoverLayerV = new TGeoVolume("DCHCoverLayerV", OctagonCoverPlaneS);
159 DCHCoverLayerV->SetMedium(pMedMylar);
160 DCHCoverLayerV->SetLineColor(TColor::GetColor("#cccccc"));
161 DCHCoverLayerV->SetTransparency(40);
162 //--------------------------------------------------------------------------
163
164 // Flange -------------------------------------------------------------------
167
168 TGeoVolume* FlangeV = new TGeoVolume("FlangeV", FlangeS);
169 FlangeV->SetMedium(pMedAluminium);
170 FlangeV->SetLineColor(TColor::GetColor("#00cc00"));
171 FlangeV->SetTransparency(40);
172
173 TGeoVolume* TubeV = new TGeoVolume("TubeV", TubeS);
174 TubeV->SetMedium(pMedAluminium);
175 TubeV->SetLineColor(TColor::GetColor("#00cc00"));
176 TubeV->SetTransparency(40);
177 //--------------------------------------------------------------------------
178
179 DCHDetV->AddNode(DCHActivePlaneV, 0, new TGeoTranslation(0., 0., -7.8));
180 DCHDetV->AddNode(DCHActivePlaneV, 1, new TGeoTranslation(0., 0., -6.6));
181 DCHDetV->AddNode(DCHActivePlaneV, 2, new TGeoTranslation(0., 0., -3.0));
182 DCHDetV->AddNode(DCHActivePlaneV, 3, new TGeoTranslation(0., 0., -1.8));
183 DCHDetV->AddNode(DCHActivePlaneV, 4, new TGeoTranslation(0., 0., 1.8));
184 DCHDetV->AddNode(DCHActivePlaneV, 5, new TGeoTranslation(0., 0., 3.0));
185 DCHDetV->AddNode(DCHActivePlaneV, 6, new TGeoTranslation(0., 0., 6.6));
186 DCHDetV->AddNode(DCHActivePlaneV, 7, new TGeoTranslation(0., 0., 7.8));
187
188 DCHDetV->AddNode(DCHCoverLayerV, 0, new TGeoTranslation(0., 0., -9.6 - CoverFoilThickness * 0.5));
189 DCHDetV->AddNode(DCHCoverLayerV, 1, new TGeoTranslation(0., 0., -4.8 - CoverFoilThickness * 0.5));
190 DCHDetV->AddNode(DCHCoverLayerV, 2, new TGeoTranslation(0., 0., -4.8 + CoverFoilThickness * 0.5));
191 DCHDetV->AddNode(DCHCoverLayerV, 3, new TGeoTranslation(0., 0., 0.0 - CoverFoilThickness * 0.5));
192 DCHDetV->AddNode(DCHCoverLayerV, 4, new TGeoTranslation(0., 0., 0.0 + CoverFoilThickness * 0.5));
193 DCHDetV->AddNode(DCHCoverLayerV, 5, new TGeoTranslation(0., 0., 4.8 - CoverFoilThickness * 0.5));
194 DCHDetV->AddNode(DCHCoverLayerV, 6, new TGeoTranslation(0., 0., 4.8 + CoverFoilThickness * 0.5));
195 DCHDetV->AddNode(DCHCoverLayerV, 7, new TGeoTranslation(0., 0., 9.6 + CoverFoilThickness * 0.5));
196
197 // Adding volumes to the DCH Volume
198 DCH->AddNode(DCHDetV, 0, combi1);
199 DCH->AddNode(FlangeV, 1, new TGeoTranslation(DCH1_Xpos, DCH1_Ypos, -11.6 - ZLengthOfFlange * 0.5 + DCH1_Zpos));
200 DCH->AddNode(FlangeV, 2, new TGeoTranslation(DCH1_Xpos, DCH1_Ypos, +11.6 + ZLengthOfFlange * 0.5 + DCH1_Zpos));
201 DCH->AddNode(TubeV, 1, new TGeoTranslation(DCH1_Xpos, DCH1_Ypos, DCH1_Zpos));
202
203 DCH->AddNode(DCHDetV, 1, combi2);
204 DCH->AddNode(FlangeV, 3, new TGeoTranslation(DCH2_Xpos, DCH2_Ypos, -11.6 - ZLengthOfFlange * 0.5 + DCH2_Zpos));
205 DCH->AddNode(FlangeV, 4, new TGeoTranslation(DCH2_Xpos, DCH2_Ypos, +11.6 + ZLengthOfFlange * 0.5 + DCH2_Zpos));
206 DCH->AddNode(TubeV, 2, new TGeoTranslation(DCH2_Xpos, DCH2_Ypos, DCH2_Zpos));
207
208 top->AddNode(DCH, 0);
210
211 // --------------- Finish -----------------------------------------------
212 gGeoMan->CloseGeometry();
213 gGeoMan->CheckOverlaps(0.001);
214 gGeoMan->PrintOverlaps();
215 gGeoMan->Test();
216
217 TFile* geoFile = new TFile(geoFileName, "RECREATE");
218 top->Write();
219 geoFile->Close();
220 top->Draw("ogl");
221 // top->Draw("");
222}
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_RunSpring2018()