BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
gems_geo_40cm_12st.C
Go to the documentation of this file.
1#if !defined(__CLING__) || defined(__MAKECLING__)
2// MPD includes
3// Fair includes
4#include "FairGeoRotation.h"
5
6// ROOT includes
7#include <Riostream.h>
8#include <TMath.h>
9#include <TROOT.h>
10#include <TSystem.h>
11#include <TVector3.h>
12#include <sstream>
13#endif
14
15#include "mpdshape.class.C"
16
18{
19 // 14-may-2014 VV - GEM tracker geometry for BM@N (detector size 40 cm, 12 large stations )
20
21 // Units are mm
22 const Int_t nStations = 12; // Number of stations
23 Double_t size = 2600.0; // 820.0; // GEM station transverse size
24 Double_t margin = 0.0; // 150.0; // extra size to accomodate rotated stations
25 Double_t hole = 13.5; // GEM station inner hole
26 Double_t lengSts = 3850.0; // 2000.0; // GEM system mother volume length along Z
27 Double_t zMag = 1245.0; // magnet center Z
28 Double_t zShift = -500.0; // station shift w.r.t. GEM system center
29 Double_t thickStat = 130.0; // station thickness
30 Double_t distStat = 100.0; // distance betwen stations
31 Double_t dPhi = 0.0; // 10.0; // rotation between stations
32 Double_t sizeLad = 400.0; // module (ladder) transverse size (ladder)
33 Double_t thickLad = 13.0; // module (ladder) thickness
34 // Double_t thickLad = 1.0; // module (ladder) thickness - test !!!
35 Double_t widthFrame = 12.0; // G10 frame width
36 Double_t thickSens = 0.2; // sensor thickness
37 Double_t dx = sizeLad / 2 + widthFrame; // module (ladder) X displacement
38 Double_t dy = sizeLad / 2 + widthFrame; // module (ladder) Y displacement
39 Double_t dz = 10.0; // module (ladder) Z displacement
40 // Double_t dz = 1.0; // module (ladder) Z displacement - test !!!
41 // Double_t sizeSensX[4] = {100.0, 200.0, 200.0, 100.0};
42 // Double_t sizeSensY[4] = {100.0, 100.0, 200.0, 200.0};
43 // Double_t sizeSensX[4] = {80.0, 220.0, 220.0, 80.0};
44 // Double_t sizeSensY[4] = {80.0, 80.0, 220.0, 220.0};
45 Double_t sizeSensX[4] = {80.0, 320.0, 320.0, 80.0};
46 Double_t sizeSensY[4] = {80.0, 80.0, 320.0, 320.0};
47 Double_t sizeSensX2[4] = {200.0, 200.0, 200.0, 200.0};
48 Double_t sizeSensY2[4] = {200.0, 200.0, 200.0, 200.0};
49
50 // !---!------!
51 // ! ! !
52 // ! 4 ! 3 ! Ladder
53 // !___!______!
54 // ! 1 ! 2 !
55 // !-.-!--..--!
56
57 //====== end declaration =======================================
58
59 // output file
60 const char* filename = "gem_bmn_40_VV.geo";
61 ofstream* f = new ofstream(filename, ios::out | ios::trunc);
62 // helper streams
63 std::ostringstream points, position, rotation;
64 points.setf(ios::showpoint);
65 points.setf(ios::fixed);
66 points << setprecision(6);
67 position.setf(ios::showpoint);
68 position.setf(ios::fixed);
69 position << setprecision(6);
70 rotation.setf(ios::showpoint);
71 rotation.setf(ios::fixed);
72 rotation << setprecision(6);
73
74 points.str("");
75 position.str("");
76 rotation.str("");
77
78 // GEM system mother volume
79 zShift = zMag - lengSts / 2 - 100; // to avoid overlapping with the target
80 Mpdshape* gem = new Mpdshape(f, "STS1", "cave", "PGON", "air", points.str());
81 // gem->Fill_PGON(-lengSts/2, lengSts/2, hole-0.1, size/2+0.1, 45.0, 4);
82 gem->Fill_PGON(-lengSts / 2, lengSts / 2, hole - 0.1, size / 2 + 0.1 + margin, 45.0, 4); //+-130cm
83 gem->SetPosition(0., 0., zMag - zShift);
84 gem->SetSegment(0);
85 gem->DumpWithIncrement();
86
87 // Station 1
88 Mpdshape* station = new Mpdshape(f, "STSStation01", "STS1", "PGON", "air", points.str());
89 // station->Fill_PGON(-thickStat/2, thickStat/2, hole, size/2, 45.0, 4);
90 station->Fill_PGON(-thickStat / 2, thickStat / 2, hole, 3 * sizeLad + 2 * widthFrame + hole, 45.0, 4);
91 // Double_t zSt = -(nStations/2 + 0.5) * distStat + zShift;
92 Double_t zSt = 300.0 - zMag + zShift; // 30 cm from the target
93 station->SetPosition(0., 0., zSt);
94 station->SetSegment(1);
95 station->DumpWithIncrement();
96
97 Double_t dxy[12][2] = {{hole, -hole - 2 * widthFrame},
98 {hole + 2 * widthFrame, hole}, // 0,1
99 {-hole, hole + 2 * widthFrame},
100 {-hole - 2 * widthFrame, -hole}, // 2,3
101 {hole + widthFrame + 1.5 * sizeLad, -hole - widthFrame + 0.5 * sizeLad}, // 4
102 {-hole - widthFrame + 1.5 * sizeLad, -hole - widthFrame - 0.5 * sizeLad}, // 5
103 {-hole - widthFrame + 2.5 * sizeLad, -hole - widthFrame - 0.5 * sizeLad}, // 6
104 {hole + widthFrame + 2.5 * sizeLad, -hole - widthFrame + 0.5 * sizeLad}, // 7
105 {-hole - widthFrame - 1.5 * sizeLad, hole + widthFrame - 0.5 * sizeLad}, // 8
106 {hole + widthFrame - 1.5 * sizeLad, hole + widthFrame + 0.5 * sizeLad}, // 9
107 {hole + widthFrame - 2.5 * sizeLad, hole + widthFrame + 0.5 * sizeLad}, // 10
108 {-hole - widthFrame - 2.5 * sizeLad, hole + widthFrame - 0.5 * sizeLad}}; // 11
109
110 // position of ladders: view from the target
111 // 7 4 0 1 9 10
112 // 6 5 3 2 8 11
113
114 // Describe ladder
115 Mpdshape* ladder = new Mpdshape(f, "STSStation01Ladder", "STSStation01", "BOX", "air", points.str());
116 ladder->Fill_BOX(sizeLad / 2 + widthFrame, sizeLad / 2 + widthFrame, thickLad / 2);
117 ladder->SetPosition(dx + dxy[0][0], dy + dxy[0][1], dz);
118 ladder->SetSegment(1);
119 ladder->SetMotherSegment(1);
120 ladder->DumpWithIncrement();
121
122 // Mpdshape* ladder5 = new Mpdshape(f, "STSStation01Ladder", "STSStation01", "BOX", "air", points.str());
123 Mpdshape* ladder5 = new Mpdshape(f, "STSStation01Ladder1", "STSStation01", "BOX", "air", points.str());
124 ladder5->Fill_BOX(sizeLad / 2 + widthFrame, sizeLad / 2 + widthFrame, thickLad / 2);
125 // ladder->SetPosition(dx+dxy[0][0], dy+dxy[0][1], dz);
126 ladder5->SetSegment(1);
127 ladder5->SetMotherSegment(1);
128 // ladder->DumpWithIncrement();
129
130 // Describe half-ladder (== ladder: auxiliary volume to be consistent with CBM)
131 Mpdshape* hladder = new Mpdshape(f, "STSStation01Hladd", "STSStation01Ladder", "BOX", "air", points.str());
132 hladder->Fill_BOX(sizeLad / 2 + widthFrame, sizeLad / 2 + widthFrame, thickLad / 2);
133 hladder->SetPosition(0.0, 0.0, 0.0);
134 hladder->SetSegment(0);
135 hladder->SetMotherSegment(1);
136 hladder->DumpWithIncrement();
137
138 // Mpdshape* hladder5 = new Mpdshape(f, "STSStation01Hladd", "STSStation01Ladder", "BOX", "air", points.str());
139 Mpdshape* hladder5 = new Mpdshape(f, "STSStation01Hladd", "STSStation01Ladder1", "BOX", "air", points.str());
140 hladder5->Fill_BOX(sizeLad / 2 + widthFrame, sizeLad / 2 + widthFrame, thickLad / 2);
141 hladder5->SetPosition(0.0, 0.0, 0.0);
142 hladder5->SetSegment(1);
143 hladder5->SetMotherSegment(1);
144
145 // Ladder frame
146 /*
147 Mpdshape* frame = new Mpdshape(f, "STSStation01Frame", "STSStation01Hladd", "PGON", "G10", points.str());
148 frame->Fill_PGON(-thickLad/2, thickLad/2, sizeLad/2, sizeLad/2+widthFrame, 45.0, 4);
149 frame->SetPosition(0.0, 0.0, 0.0);
150 frame->SetSegment(0);
151 frame->SetMotherSegment(0);
152 frame->DumpWithIncrement();
153
154 Mpdshape* frame5 = new Mpdshape(f, "STSStation01Frame", "STSStation01Hladd", "PGON", "G10", points.str());
155 frame5->Fill_PGON(-thickLad/2, thickLad/2, sizeLad/2, sizeLad/2+widthFrame, 45.0, 4);
156 frame5->SetPosition(0.0, 0.0, 0.0);
157 frame5->SetSegment(0);
158 frame5->SetMotherSegment(1);
159 */
160
161 // Describe modules and put them inside the half-ladder
162 Mpdshape* modules[4];
163 for (Int_t i = 0; i < 4; ++i) {
164 TString name = "STSStation01Module";
165 name += (i + 1);
166 modules[i] = new Mpdshape(f, name.Data(), "STSStation01Hladd", "BOX", "air", points.str());
167 modules[i]->Fill_BOX(sizeSensX[i] / 2 - 0.0, sizeSensY[i] / 2 - 0.0, thickSens / 2);
168 Double_t x0 = sizeSensX[0] / 2, y0 = sizeSensY[0] / 2;
169 if (i && i < 3)
170 x0 = sizeSensX[1] / 2 + sizeSensX[0];
171 if (i > 1)
172 y0 = sizeSensY[2] / 2 + sizeSensY[0];
173 modules[i]->SetPosition(x0 - sizeLad / 2, y0 - sizeLad / 2, 0.0);
174 modules[i]->SetSegment(0);
175 modules[i]->SetMotherSegment(0);
176 modules[i]->DumpWithIncrement();
177 }
178
179 Mpdshape* modules5[4];
180 for (Int_t i = 0; i < 4; ++i) {
181 TString name = "STSStation01Module";
182 name += (i + 5);
183 modules5[i] = new Mpdshape(f, name.Data(), "STSStation01Hladd", "BOX", "air", points.str());
184 modules5[i]->Fill_BOX(sizeSensX2[i] / 2 - 0.0, sizeSensY2[i] / 2 - 0.0, thickSens / 2);
185 Double_t x0 = sizeSensX2[0] / 2, y0 = sizeSensY2[0] / 2;
186 if (i && i < 3)
187 x0 = sizeSensX2[1] / 2 + sizeSensX2[0];
188 if (i > 1)
189 y0 = sizeSensY2[2] / 2 + sizeSensY2[0];
190 modules5[i]->SetPosition(x0 - sizeLad / 2, y0 - sizeLad / 2, 0.0);
191 modules5[i]->SetSegment(0);
192 modules5[i]->SetMotherSegment(1);
193 // modules5[i]->DumpWithIncrement();
194 }
195
196 // Describe sensors and put them inside modules
197 Mpdshape* sensors[4];
198 for (Int_t i = 0; i < 4; ++i) {
199 TString name = "STSStation01Sensor";
200 name += (i + 1);
201 TString mname = "STSStation01Module";
202 mname += (i + 1);
203 sensors[i] = new Mpdshape(f, name.Data(), mname.Data(), "BOX", "titanium", points.str());
204 sensors[i]->Fill_BOX(sizeSensX[i] / 2 - 0.2, sizeSensY[i] / 2 - 0.2, thickSens / 2);
205 sensors[i]->SetPosition(0.0, 0.0, 0.0);
206 sensors[i]->SetSegment(1);
207 sensors[i]->SetMotherSegment(0);
208 sensors[i]->DumpWithIncrement();
209 }
210
211 Mpdshape* sensors5[4];
212 for (Int_t i = 0; i < 4; ++i) {
213 TString name = "STSStation01Sensor";
214 name += (i + 5);
215 TString mname = "STSStation01Module";
216 mname += (i + 5);
217 sensors5[i] = new Mpdshape(f, name.Data(), mname.Data(), "BOX", "titanium", points.str());
218 sensors5[i]->Fill_BOX(sizeSensX2[i] / 2 - 0.2, sizeSensY2[i] / 2 - 0.2, thickSens / 2);
219 sensors5[i]->SetPosition(0.0, 0.0, 0.0);
220 sensors5[i]->SetSegment(1);
221 sensors5[i]->SetMotherSegment(0);
222 // sensors5[i]->DumpWithIncrement();
223 }
224
225 // Position ladder copies
226
227 Double_t ddx = dx, ddy = dy, ddz = dz, dzExtra[4] = {-dz, -3 * dz, -5 * dz, -3 * dz};
228
229 for (Int_t lad = 1; lad < 12; ++lad) {
230 // for (Int_t lad = 1; lad < 4; ++lad) {
231 if (lad % 2)
232 ddx *= -1;
233 if (!(lad % 2))
234 ddy *= -1;
235 ddz *= -1;
236
237 if (lad < 4) {
238 ladder->SetPosition(ddx + dxy[lad][0], ddy + dxy[lad][1], ddz);
239 ladder->SetRotation(90.0 * lad, 0.0, 0.0);
240 } else if (lad == 4) {
241 ladder = ladder5;
242 ladder->SetPosition(dxy[lad][0], dxy[lad][1], dzExtra[lad % 4]);
243 ladder->SetRotation(0.0, 0.0, 0.0);
244 ladder->DumpWithIncrement();
245 hladder5->DumpWithIncrement();
246 // frame5->DumpWithIncrement();
247 for (Int_t i = 0; i < 4; ++i)
248 modules5[i]->DumpWithIncrement();
249 for (Int_t i = 0; i < 4; ++i)
250 sensors5[i]->DumpWithIncrement();
251 continue;
252 } else {
253 ladder->SetPosition(dxy[lad][0], dxy[lad][1], dzExtra[lad % 4]);
254 }
255 ladder->DumpWithIncrement();
256 }
257 /*
258 for (Int_t lad = 5; lad < 6; ++lad) {
259 ddz *= -1;
260
261 ladder->SetPosition(dxy[lad][0], dxy[lad][1], ddz);
262 ladder->DumpWithIncrement();
263 }
264 */
265
266 // Position station copies
267 // Double_t zPosSt[nStations] = {30, 45, 60, 80, 100, 130, 160, 200, 240, 285, 330, 375};
268 Double_t zPosSt[nStations] = {30, 45, 60, 80, 100, 130, 160, 200, 240, 280, 320, 360};
269 for (Int_t ist = 1; ist < nStations; ++ist) {
270 // for (Int_t ist = 1; ist < nStations-2; ++ist) {
271 distStat = (zPosSt[ist] - zPosSt[ist - 1]) * 10.0;
272 zSt += distStat;
273 station->SetPosition(0., 0., zSt);
274 station->SetRotation(dPhi * ist, 0.0, 0.0);
275 station->DumpWithIncrement();
276 }
277
278 f->close();
279}
int i
Definition P4_F32vec4.h:22
int Int_t
double Double_t
void Fill_PGON(Double_t zmin, Double_t zmax, Double_t rmin, Double_t rmax, Double_t phi1, Int_t nEdges=12)
void SetPosition(std::string position)
void Fill_BOX(Double_t xWidth, Double_t yWidth, Double_t zWidth)
void SetSegment(Int_t segment)
void SetMotherSegment(Int_t segment)
void SetRotation(std::string rotation)
void DumpWithIncrement()
const char * Data() const
void gems_geo_40cm_12st()