BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
GemConfigCalculate_Run8_8stations_aligned.C
Go to the documentation of this file.
1/*
2 * Description:
3 * Macro for calculating parameters of GEM detector and writing them
4 * into the XML-file needed for simulation and reconstruction procedures.
5 * The obtained XML-file should be moved into the 'parameters/gem/XMLConfigs' directory
6 *
7 * GEM configuration: Run8 (8 stations)
8 *
9 * Created: 12.05.2020
10 * 02.03.2021 (Updated): radius of hole in active zone (4.0 -> 6.0 cm)
11 * 09.03.2021 (Updated): the form of a 'hole' dead zone changed (square -> 12 sided polygon)
12 * 25.05.2021 (Updated): Z-distance from the target to the first sens. vol. has been increased
13 * 08.12.2022 (Updated): Positions were corrected in accordance with the measurement scheme
14 * 24.01.2023 (updated): half-plane shifts have been added according to the measurement scheme
15 * Author: Baranov D.
16 */
17
18#include "Rtypes.h"
19
20R__ADD_INCLUDE_PATH($VMCWORKDIR)
21
22#include "TString.h"
23
24#include <fstream>
25
26using namespace TMath;
27using namespace std;
28
29// Set Parameters of GEMs -------------------------------------------------------
30const Int_t NStations = 8; // stations in the detector
31const Int_t NMaxModules = 4; // max. number of modules in a station
32
33const Int_t NModulesInStations[NStations] = {4, 4, 4, 4, 4, 4, 4, 1};
34
35//(X-Y-Z)Positions of stations (sensitive volumes)
36const Double_t XStationPositions[NStations] = {+1.474 /*0*/, +2.614 /*1*/, +3.393 /*2*/, +4.699 /*3*/,
37 +6.337 /*4*/, +8.189 /*5*/, +9.893 /*6*/, +50.0 /*7*/};
38const Double_t YStationPositions[NStations] = {-0.086 /*0*/, -0.107 /*1*/, +0.003 /*2*/, -0.097 /*3*/,
39 -0.003 /*4*/, +0.0245 /*5*/, +0.022 /*6*/, +0.0 /*7*/};
40const Double_t ZStationPositions[NStations] = {+60.76 /*0*/, +92.242 /*1*/, +123.512 /*2*/, +154.692 /*3*/,
41 +185.989 /*4*/, +217.287 /*5*/, +248.401 /*6*/, +790.0 /*7*/};
42
43//(X-Y-Z)Shifts of modules in each station
45 {163.2 * 0.25, -163.2 * 0.25, 163.2 * 0.25, -163.2 * 0.25}, // st. 0
46 {163.2 * 0.25, -163.2 * 0.25, 163.2 * 0.25, -163.2 * 0.25}, // st. 1
47 {163.2 * 0.25, -163.2 * 0.25, 163.2 * 0.25, -163.2 * 0.25}, // st. 2
48 {163.2 * 0.25, -163.2 * 0.25, 163.2 * 0.25, -163.2 * 0.25}, // st. 3
49 {163.2 * 0.25, -163.2 * 0.25, 163.2 * 0.25, -163.2 * 0.25}, // st. 4
50 {163.2 * 0.25, -163.2 * 0.25, 163.2 * 0.25, -163.2 * 0.25}, // st. 5
51 {163.2 * 0.25, -163.2 * 0.25, 163.2 * 0.25, -163.2 * 0.25}, // st. 6
52 {0.0} // st. 7
53};
55 {+22.5, +22.5, -19.5, -19.5}, // st. 0
56 {+22.5, +22.5, -19.5, -19.5}, // st. 1
57 {+22.5, +22.5, -19.5, -19.5}, // st. 2
58 {+22.5, +22.5, -19.5, -19.5}, // st. 3
59 {+22.5, +22.5, -19.5, -19.5}, // st. 4
60 {+22.5, +22.5, -19.5, -19.5}, // st. 5
61 {+22.5, +22.5, -19.5, -19.5}, // st. 6
62 {0.0} // st. 7
63};
65 {+4.1, +4.1, 0.0, 0.0}, // st. 0
66 {0.0, 0.0, +4.1, +4.1}, // st. 1
67 {+4.1, +4.1, 0.0, 0.0}, // st. 2
68 {0.0, 0.0, +4.1, +4.1}, // st. 3
69 {+4.1, +4.1, 0.0, 0.0}, // st. 4
70 {0.0, 0.0, +4.1, +4.1}, // st. 5
71 {+4.1, +4.1, 0.0, 0.0}, // st. 6
72 {0.0} // st. 7
73};
74
75// alignment corrections --------------------------------------------------------
77 {2.28613e-01, 2.34606e-01, 3.70449e-01, 4.39267e-01, 2.67664e-01, 2.84859e-01, 3.41005e-01, 4.16753e-01},
78 {3.17030e-01, 2.45618e-01, 4.29878e-01, 4.29169e-01, 2.60443e-01, 1.79925e-01, 3.76252e-01, 3.71674e-01},
79 {1.25543e-01, 1.37935e-01, 2.77096e-01, 3.51704e-01, 2.16012e-01, 2.12139e-01, 2.88912e-01, 3.57699e-01},
80 {3.17647e-01, 2.36295e-01, 3.75431e-01, 3.80575e-01, 1.68884e-01, 8.80524e-02, 2.51805e-01, 2.56513e-01},
81 {-3.01883e-02, -2.87880e-02, 1.09744e-01, 1.90429e-01, 1.78162e-02, 1.32671e-02, 9.23760e-02, 1.67779e-01},
82 {1.43966e-01, 5.53303e-02, 2.48555e-01, 2.49193e-01, 3.88544e-02, -3.31393e-02, 7.96085e-02, 7.41273e-02},
83 {0., -5.63645e-04, 0.05, 8.74027e-04, 0., 3.60763e-03, 0.074, 1.49797e-01}};
85 {-2.40830e-01, -2.27117e-01, -4.41393e-01, -2.98662e-01, -1.47376e-01, -5.64919e-01, 3.60250e-02, -2.15290e-01},
86 {-4.83443e-01, -3.63780e-01, -3.52015e-01, -3.36903e-01, -1.14008e-01, -3.49136e-01, -2.14579e-01, -6.23524e-01},
87 {-1.91062e-01, -2.04515e-01, -3.79972e-01, -2.57092e-01, -1.01400e-01, -5.18137e-01, 5.39497e-02, -1.85679e-01},
88 {-4.55871e-01, -3.48696e-01, -2.33191e-01, -2.40044e-01, -5.37329e-02, -3.00596e-01, -1.98740e-01, -6.04983e-01},
89 {-2.31062e-01, -2.58276e-01, -4.03759e-01, -2.70196e-01, -8.53213e-02, -5.14891e-01, 3.15495e-02, -2.08464e-01},
90 {-2.58821e-01, -1.58621e-01, -9.84743e-02, -1.05756e-01, 1.54258e-01, -1.04935e-01, 1.83280e-02, -3.86622e-01},
91 {0., -5.86937e-03, -0.23, -1.45342e-01, 0., -3.98117e-01, 0.15, -1.04839e-01}};
92
94 {StsDX[0][0], StsDX[0][2], StsDX[0][4], StsDX[0][6]}, // st. 0
95 {StsDX[1][0], StsDX[1][2], StsDX[1][4], StsDX[1][6]}, // st. 1
96 {StsDX[2][0], StsDX[2][2], StsDX[2][4], StsDX[2][6]}, // st. 2
97 {StsDX[3][0], StsDX[3][2], StsDX[3][4], StsDX[3][6]}, // st. 3
98 {StsDX[4][0], StsDX[4][2], StsDX[4][4], StsDX[4][6]}, // st. 4
99 {StsDX[5][0], StsDX[5][2], StsDX[5][4], StsDX[5][6]}, // st. 5
100 {StsDX[6][0], StsDX[6][2], StsDX[6][4], StsDX[6][6]}, // st. 6
101 {0.0} // st. 7
102};
103
105 {StsDY[0][0], StsDY[0][2], StsDY[0][4], StsDY[0][6]}, // st. 0
106 {StsDY[1][0], StsDY[1][2], StsDY[1][4], StsDY[1][6]}, // st. 1
107 {StsDY[2][0], StsDY[2][2], StsDY[2][4], StsDY[2][6]}, // st. 2
108 {StsDY[3][0], StsDY[3][2], StsDY[3][4], StsDY[3][6]}, // st. 3
109 {StsDY[4][0], StsDY[4][2], StsDY[4][4], StsDY[4][6]}, // st. 4
110 {StsDY[5][0], StsDY[5][2], StsDY[5][4], StsDY[5][6]}, // st. 5
111 {StsDY[6][0], StsDY[6][2], StsDY[6][4], StsDY[6][6]}, // st. 6
112 {0.0} // st. 7
113};
114
116 {0.243654, 0.250775, 0.173749, 0.161366}, // st. 0
117 {-0.143876, -0.150758, 0.109959, 0.156433}, // st. 1
118 {-0.110145, -0.165981, -0.213889, -0.229543}, // st. 2
119 {0.103517, 0.036342, 0.086135, 0.0941369}, // st. 3
120 {-0.037648, -0.0941807, -0.180758, -0.176327}, // st. 4
121 {-0.0674491, -0.0367844, -0.0972473, -0.0584354}, // st. 5
122 {0, 0, 0, 0}, // st. 6
123 {0.0} // st. 7
124};
125//------------------------------------------------------------------------------
126
127////(X-Y-Z)Positions of stations (sensitive volumes)
128// const Double_t XStationPositions[NStations] = { +1.476/*0*/, +2.614/*1*/, +3.342/*2*/, +4.674/*3*/, +6.303/*4*/,
129// +8.140/*5*/, +9.871/*6*/, +50.494/*7*/}; //center of hole for a half-plane nearest to the target const Double_t
130// YStationPositions[NStations] = { -0.148/*0*/, -0.107/*1*/, -0.064/*2*/, -0.120/*3*/, -0.071/*4*/, +0.123/*5*/,
131// -0.050/*6*/, -0.186/*7*/}; //center of hole for a half-plane nearest to the target const Double_t
132// ZStationPositions[NStations] = { +61.229/*0*/, +92.2505/*1*/, +123.502/*2*/, +154.679/*3*/, +185.9235/*4*/,
133// +217.194/*5*/, +248.344/*6*/, +792.532/*7*/}; //half-plane nearest to the target
134//
135// const Double_t xShift[NStations] = {-0.004/*0*/, 0.0/*1*/, +0.102/*2*/, +0.05/*3*/, +0.067/*4*/, +0.098/*5*/,
136// +0.045/*6*/, 0.0/*7*/}; const Double_t yShift[NStations] = {+0.125/*0*/, 0.0/*1*/, +0.131/*2*/, +0.046/*3*/,
137// +0.136/*4*/, -0.197/*5*/, +0.122/*6*/, 0.0/*7*/}; const Double_t zShift[NStations] = {+3.998/*0*/, +4.101/*1*/,
138// +4.0785/*2*/, +4.055/*3*/, +4.0985/*4*/, +3.903/*5*/, +4.1075/*6*/, 0.0/*7*/};
139//
140////(X-Y-Z)Shifts of modules in each station
141// const Double_t XModuleShifts[NStations][NMaxModules] = {
142// {163.2*0.25 + xShift[0], -163.2*0.25 + xShift[0], //st. 0 (upper h. plane)
143// 163.2*0.25, -163.2*0.25}, //st. 0 (lower h. plane)
144//
145// {163.2*0.25, -163.2*0.25, //st. 1 (upper h. plane)
146// 163.2*0.25 + xShift[1], -163.2*0.25 + xShift[1]}, //st. 1 (lower h. plane)
147//
148// {163.2*0.25 + xShift[2], -163.2*0.25 + xShift[2], //st. 2 (upper h. plane)
149// 163.2*0.25, -163.2*0.25}, //st. 2 (lower h. plane)
150//
151// {163.2*0.25, -163.2*0.25, //st. 3 (upper h. plane)
152// 163.2*0.25 + xShift[3], -163.2*0.25 + xShift[3]}, //st. 3 (lower h. plane)
153//
154// {163.2*0.25 + xShift[4], -163.2*0.25 + xShift[4], //st. 4 (upper h. plane)
155// 163.2*0.25, -163.2*0.25}, //st. 4 (lower h. plane)
156//
157// {163.2*0.25, -163.2*0.25, //st. 5 (upper h. plane)
158// 163.2*0.25 + xShift[5], -163.2*0.25 + xShift[5]}, //st. 5 (lower h. plane)
159//
160// {163.2*0.25 + xShift[6], -163.2*0.25 + xShift[6], //st. 6 (upper h. plane)
161// 163.2*0.25, -163.2*0.25}, //st. 6 (lower h. plane)
162//
163// {0.0} //st. 7
164// };
165// const Double_t YModuleShifts[NStations][NMaxModules] = {
166// {+22.5 + yShift[0], +22.5 + yShift[0], //st. 0 (upper h. plane)
167// -19.5, -19.5}, //st. 0 (lower h. plane)
168//
169// {+22.5, +22.5, //st. 1 (upper h. plane)
170// -19.5 + yShift[1], -19.5 + yShift[1]}, //st. 1 (lower h. plane)
171//
172// {+22.5 + yShift[2], +22.5 + yShift[2], //st. 2 (upper h. plane)
173// -19.5, -19.5}, //st. 2 (lower h. plane)
174//
175// {+22.5, +22.5, //st. 3 (upper h. plane)
176// -19.5 + yShift[3], -19.5 + yShift[3]}, //st. 3 (lower h. plane)
177//
178// {+22.5 + yShift[4], +22.5 + yShift[4], //st. 4 (upper h. plane)
179// -19.5, -19.5}, //st. 4 (lower h. plane)
180//
181// {+22.5, +22.5, //st. 5 (upper h. plane)
182// -19.5 + yShift[5], -19.5 + yShift[5]}, //st. 5 (lower h. plane)
183//
184// {+22.5 + yShift[6], +22.5 + yShift[6], //st. 6 (upper h. plane)
185// -19.5, -19.5}, //st. 6 (lower h. plane)
186//
187// {0.0} //st. 7
188// };
189// const Double_t ZModuleShifts[NStations][NMaxModules] = {
190// {zShift[0], zShift[0], 0.0, 0.0}, //st. 0
191// {0.0, 0.0, zShift[1], zShift[1]}, //st. 1
192// {zShift[2], zShift[2], 0.0, 0.0}, //st. 2
193// {0.0, 0.0, zShift[3], zShift[3]}, //st. 3
194// {zShift[4], zShift[4], 0.0, 0.0}, //st. 4
195// {0.0, 0.0, zShift[5], zShift[5]}, //st. 5
196// {zShift[6], zShift[6], 0.0, 0.0}, //st. 6
197// {0.0} //st. 7
198// };
199
200/*
201 * Basic station:
202 *
203 * -------------------- --------------------
204 * | | |
205 * | module 0 | module 1 | ^ beam direction (Z)
206 * | | | /
207 * | ------------|-------------- | /
208 * | / | / | /
209 * | / | / |/
210 * -----------------------------------------
211 * | \ | \ |
212 * | \ | \ |
213 * | \___________|______________\ |
214 * | | |
215 * | | |
216 * | module 3 | module 4 |
217 * -----------------------------------------
218 *
219 */
220
221// rotations of stations around y-axis by 180 deg.
222const Bool_t YStationRotations[NStations] = {true /*0*/, false /*1*/, true /*2*/, false /*3*/,
223 true /*4*/, false /*5*/, true /*6*/, false /*7*/};
224
225// rotations of stations around x-axis by 180 deg.
226const Bool_t XStationRotations[NStations] = {false /*0*/, false /*1*/, false /*2*/, false /*3*/,
227 false /*4*/, false /*5*/, false /*6*/, false /*7*/};
228
229// drift direction in each module ("true" is "forward", "false" is "backward")
231 {false, false, true, true}, // st. 0
232 {true, true, false, false}, // st. 1
233 {false, false, true, true}, // st. 2
234 {true, true, false, false}, // st. 3
235 {false, false, true, true}, // st. 4
236 {true, true, false, false}, // st. 5
237 {false, false, true, true}, // st. 6
238 {true} // st. 7
239};
240
241// thicknesses of gaps inside a GEM chamber (for all modules)
246
247// upper half-plane (type UHP with sizes of 163.2 x 45.0 cm) --------------------
248const Double_t StripPitch_UHP = 0.08; // cm
249
252
255
256const Double_t XHotZoneLayerSize_InclinedStrips_UHP[2] = {37.99, 42.01}; // [0] - min, [1] - max
257const Double_t YHotZoneLayerSize_InclinedStrips_UHP = 15.0; // deg. (plus - clockwise, minus - anticlockwise)
258//------------------------------------------------------------------------------
259
260// lower half-plane (type LHP with sizes of 163.2 x 39.0 cm) --------------------
261const Double_t StripPitch_LHP = 0.08; // cm
262
265
268
269const Double_t XHotZoneLayerSize_InclinedStrips_LHP[2] = {37.99, 42.01}; // [0] - min, [1] - max
270const Double_t YHotZoneLayerSize_InclinedStrips_LHP = 15.0; // deg. (plus - clockwise, minus - anticlockwise)
271//------------------------------------------------------------------------------
272
273// small GEM (type SMALL with sizes of 10.0 x 10.0 cm) --------------------------
274const Double_t StripPitch_SMALL = 0.04; // cm
275
278//------------------------------------------------------------------------------
279
281const Int_t NLayersInModule[NStations] = {4, 4, 4, 4, 4, 4, 4, 2 /*smallGEM*/};
282
284 // 0 - main, 1 - hot zone
285 {0, 0, 1, 1}, // st. 0
286 {0, 0, 1, 1}, // st. 1
287 {0, 0, 1, 1}, // st. 2
288 {0, 0, 1, 1}, // st. 3
289 {0, 0, 1, 1}, // st. 4
290 {0, 0, 1, 1}, // st. 5
291 {0, 0, 1, 1}, // st. 6
292 {0, 0} // st. 7 (small GEM)
293};
294
296 // "lower" is straight strips, "upper " is inclined strips
297 {"lower", "upper", "lower", "upper"}, // st. 0
298 {"lower", "upper", "lower", "upper"}, // st. 1
299 {"lower", "upper", "lower", "upper"}, // st. 2
300 {"lower", "upper", "lower", "upper"}, // st. 3
301 {"lower", "upper", "lower", "upper"}, // st. 4
302 {"lower", "upper", "lower", "upper"}, // st. 5
303 {"lower", "upper", "lower", "upper"}, // st. 6
304 {"lower", "upper"} // st. 7 (small GEM)
305};
306
307// stereo angle for all layers with inclined strips in each module of a basic station
309 // deg. (plus - clockwise, minus - anticlockwise)
310 {+15.0, +15.0, -15.0, -15.0}, // st. 0
311 {+15.0, +15.0, -15.0, -15.0}, // st. 1
312 {+15.0, +15.0, -15.0, -15.0}, // st. 2
313 {+15.0, +15.0, -15.0, -15.0}, // st. 3
314 {+15.0, +15.0, -15.0, -15.0}, // st. 4
315 {+15.0, +15.0, -15.0, -15.0}, // st. 5
316 {+15.0, +15.0, -15.0, -15.0}, // st. 6
317 {+90.0} // st. 7 (small GEM)
318};
319
326
328
329// dead zones (upper half-plane) ------------------------------------------------
336
343
350
357
364
382
383//------------------------------------------------------------------------------
384
385// dead zones (lower half-plane) ------------------------------------------------
392
399
406
413
420
438
439//------------------------------------------------------------------------------
440
441// Function declarations
442// void PrintInfo();
443void CalculateParameters(TString config_name, TString author, TString date);
444//------------------------------------------------------------------------------
445
447{
448
449 TString ConfigName = "GemRun8_aligned";
450 TString AuthorName = "Baranov D.";
451 TString DateCreated = "18.01.2021";
452
453 // PrintInfo();
454 CalculateParameters(ConfigName, AuthorName, DateCreated);
455
456 cout << "It's the end" << "\n";
457 // gApplication->Terminate();
458}
459//------------------------------------------------------------------------------
460
461void CalculateParameters(TString config_name, TString author, TString date)
462{
463
464 TString FileName = config_name + TString(".xml");
465
466 cout << "\nCreating XML configuration file...\n";
467 cout << " Configuration name: " << config_name << "\n";
468 cout << " Author: " << author << "\n";
469 cout << " Date created: " << date << "\n";
470 cout << " 02.03.2021 (Updated): radius of hole in active zone (4.0 -> 6.0 cm)\n";
471 cout << " 09.03.2021 (Updated): the form of a 'hole' dead zone changed (square -> 12 sided polygon) \n";
472 cout << " 25.05.2021 (Updated): Z-distance from the target to the first sens. vol. has been increased \n";
473 cout << " 08.12.2022 (Updated): Positions were corrected in accordance with the measurement scheme \n";
474 cout << " 12.12.2022 (updated): small GEM added \n";
475 cout << " 24.01.2023 (updated): half-plane shifts have been added according to the measurement scheme \n";
476 cout << " File path: " << FileName << "\n";
477 cout << "\n";
478
479 // WARNING(!!!): the file will be written in the current directory
480 ofstream FileOut(FileName.Data(), ios::out);
481
482 FileOut << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
483
484 // reference frame usage comment
485 FileOut << "<!--\
486 \r\tConfig: "
487 << config_name << "\
488 \r\tAuthor: "
489 << author << "\
490 \r\tDate: "
491 << date << "\
492 \r\t02.03.2021 (Updated): radius of hole in active zone (4.0 -> 6.0 cm)\
493 \r\t09.03.2021 (Updated): the form of a 'hole' dead zone changed (square -> 12 sided polygon)\
494 \r\t25.05.2021 (Updated): Z-distance from the target to the first sens. vol. has been increased\
495 \r\t08.12.2022 (Updated): Positions were corrected in accordance with the measurement scheme\
496 \r\t12.12.2022 (updated): small GEM added\
497 \r\t24.01.2023 (updated): half-plane shifts have been added according to the measurement scheme\n\
498 \r\tA right-handed coordinates are used.\
499 \r\tIf you look at the GEMs from the target:\
500 \r\t\tx-axis is directed to the left,\
501 \r\t\ty-axis - to the top,\
502 \r\t\tz-axis - to the GEMs.\
503 \r-->\n\n";
504
505 FileOut << "<StationSet>\n";
506 FileOut << "\n";
507
508 for (Int_t istation = 0; istation < NStations; ++istation) {
509
510 // cout << "istation = " << istation << ": -----------------------------\n";
511
512 FileOut << "<!-- Station " << istation << " -->\n"; // comment
513
514 FileOut << "\t<Station";
515 FileOut << " xPosition=\"" << XStationPositions[istation] << "\"";
516 FileOut << " yPosition=\"" << YStationPositions[istation] << "\"";
517 FileOut << " zPosition=\"" << ZStationPositions[istation] << "\"";
518 if (istation != 7)
519 FileOut << " beamHole=\"" << HoleRadius << "\""; // small GEM
520 FileOut << ">\n";
521 FileOut << "\n";
522
523 for (Int_t imodule = 0; imodule < NModulesInStations[istation]; ++imodule) {
524
525 // Applying alignment corrections to module shifts !!!!!!!!!!
526 XModuleShifts[istation][imodule] -= XAlignmentCorrections[istation][imodule];
527 YModuleShifts[istation][imodule] -= YAlignmentCorrections[istation][imodule];
528 ZModuleShifts[istation][imodule] += ZAlignmentCorrections[istation][imodule];
529
530 // cout << " imodule = " << imodule << "\n";
531
532 FileOut << "\t\t<!-- module " << imodule << " -->\n"; // comment
533
534 FileOut << "\t\t<Module";
535 FileOut << " xShift=\"" << XModuleShifts[istation][imodule] << "\"";
536 FileOut << " yShift=\"" << YModuleShifts[istation][imodule] << "\"";
537 FileOut << " zShift=\"" << ZModuleShifts[istation][imodule] << "\"";
538 FileOut << " driftDirection=\"" << (DriftDirectionInModules[istation][imodule] ? "forward" : "backward")
539 << "\"";
540 FileOut << " gap_drift_thick=\"" << Gap_Drift_Thickness << "\"";
541 FileOut << " gap_ftransf_thick=\"" << Gap_FirstTransfer_Thickness << "\"";
542 FileOut << " gap_stransf_thick=\"" << Gap_SecondTransfer_Thickness << "\"";
543 FileOut << " gap_induct_thick=\"" << Gap_Induction_Thickness << "\"";
544 FileOut << ">\n";
545
546 for (Int_t ilayer = 0; ilayer < NLayersInModule[istation]; ++ilayer) {
547
548 // cout << " ilayer = " << ilayer << "\n";
549
550 FileOut << "\t\t\t<Layer";
551
552 FileOut << " zoneNumber=\"" << ZoneTypeOfLayers[istation][ilayer] << "\"";
553 FileOut << " type=\"" << StripTypeOfLayes[istation][ilayer] << "\"";
554
555 // define a strip angle for the current layer
556 Double_t layer_angle;
557 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower")) {
558 layer_angle = 0.0;
559 } else {
560 layer_angle = StripStereoAngleInModules[istation][imodule];
561 if (YStationRotations[istation] ^ XStationRotations[istation])
562 layer_angle *= -1;
563 }
564
565 FileOut << " stripAngle=\"" << layer_angle << "\"";
566
567 if (istation == 7) { // small GEM
568 FileOut << " pitch=\"" << StripPitch_SMALL << "\"";
569 } else {
570 if (imodule == 0 || imodule == 1)
571 FileOut << " pitch=\"" << StripPitch_UHP << "\"";
572 if (imodule == 2 || imodule == 3)
573 FileOut << " pitch=\"" << StripPitch_LHP << "\"";
574 }
575
576 // define 'xorig' and 'yorig' coordinates (left bottom point), 'xsize' and 'ysize'
577 Double_t xorig = 0.0; // default
578 Double_t yorig = 0.0; // default
579 Double_t xsize = 0.0; // default
580 Double_t ysize = 0.0; // default
581
582 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
583 if (istation == 7) { // small GEM
584 xorig = 0.0 + XMainZoneLayerSize_SMALL * 0.5;
585 yorig = 0.0 - YMainZoneLayerSize_SMALL * 0.5;
588 } else {
589 if (imodule == 0 || imodule == 1) {
590 xorig = 0.0 + XMainZoneLayerSize_UHP * 0.5;
591 yorig = 0.0 - YMainZoneLayerSize_UHP * 0.5;
594 }
595 if (imodule == 2 || imodule == 3) {
596 xorig = 0.0 + XMainZoneLayerSize_LHP * 0.5;
597 yorig = 0.0 - YMainZoneLayerSize_LHP * 0.5;
600 }
601 }
602 } else { // hot zone
603 switch (imodule) {
604 case 0:
605 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower")) {
607 yorig = 0.0 - YMainZoneLayerSize_UHP * 0.5;
610 } else {
612 yorig = 0.0 - YMainZoneLayerSize_UHP * 0.5;
615 }
616 break;
617
618 case 1:
619 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower")) {
620 xorig = 0.0 + XMainZoneLayerSize_UHP * 0.5;
621 yorig = 0.0 - YMainZoneLayerSize_UHP * 0.5;
624 } else {
625 xorig = 0.0 + XMainZoneLayerSize_UHP * 0.5;
626 yorig = 0.0 - YMainZoneLayerSize_UHP * 0.5;
629 }
630 break;
631
632 case 2:
633 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower")) {
638 } else {
643 }
644 break;
645
646 case 3:
647 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower")) {
648 xorig = 0.0 + XMainZoneLayerSize_LHP * 0.5;
652 } else {
653 xorig = 0.0 + XMainZoneLayerSize_LHP * 0.5;
657 }
658 break;
659 }
660 }
661
662 FileOut << " xorig=\"" << xorig << "\"";
663 FileOut << " yorig=\"" << yorig << "\"";
664 FileOut << " xsize=\"" << xsize << "\"";
665 FileOut << " ysize=\"" << ysize << "\"";
666
667 if (YStationRotations[istation] == false)
668 FileOut << " stripDirection=\"" << "LeftToRight" << "\"";
669 else
670 FileOut << " stripDirection=\"" << "RightToLeft" << "\"";
671
672 // define 'lborder' and 'rborder'
673 TString lborder = "";
674 TString rborder = "";
675
676 switch (imodule) {
677 case 0:
678 if (YStationRotations[istation] == false) {
679 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
680 lborder = "LeftTop";
681 rborder = "RightBottom";
682 } else { // hot zone
683 lborder = "LeftBottom";
684 rborder = "RightBottom";
685 }
686 } else {
687 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
688 lborder = "LeftBottom";
689 rborder = "RightTop";
690 } else { // hot zone
691 lborder = "LeftTop";
692 rborder = "RightTop";
693 }
694 }
695 break;
696
697 case 1:
698 if (YStationRotations[istation] == false) {
699 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
700 lborder = "LeftTop";
701 rborder = "RightBottom";
702 } else { // hot zone
703 lborder = "LeftTop";
704 rborder = "RightTop";
705 }
706 } else {
707 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
708 lborder = "LeftBottom";
709 rborder = "RightTop";
710 } else { // hot zone
711 lborder = "LeftBottom";
712 rborder = "RightBottom";
713 }
714 }
715 break;
716
717 case 2:
718 if (YStationRotations[istation] == false) {
719 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
720 lborder = "LeftBottom";
721 rborder = "RightTop";
722 } else { // hot zone
723 lborder = "LeftTop";
724 rborder = "RightTop";
725 }
726 } else {
727 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
728 lborder = "LeftTop";
729 rborder = "RightBottom";
730 } else { // hot zone
731 lborder = "LeftBottom";
732 rborder = "RightBottom";
733 }
734 }
735 break;
736
737 case 3:
738 if (YStationRotations[istation] == false) {
739 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
740 lborder = "LeftBottom";
741 rborder = "RightTop";
742 } else { // hot zone
743 lborder = "LeftBottom";
744 rborder = "RightBottom";
745 }
746 } else {
747 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
748 lborder = "LeftTop";
749 rborder = "RightBottom";
750 } else { // hot zone
751 lborder = "LeftTop";
752 rborder = "RightTop";
753 }
754 }
755 break;
756 }
757
758 FileOut << " lborder=\"" << lborder << "\"";
759 FileOut << " rborder=\"" << rborder << "\"";
760 FileOut << ">\n";
761
762 // add dead zones
763 if (istation != 7) { // small GEM
764 switch (imodule) {
765 // module 0 -------------------------------------------------
766 case 0:
767 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
768 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower"))
769 { // straight strips
770 FileOut << "\t\t\t\t<DeadZone>\n";
771 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
772 FileOut << "\t\t\t\t\t<DeadPoint";
773 FileOut << " x=\"" << XDeadZone_Rect_UHP[ipoint] << "\"";
774 FileOut << " y=\"" << YDeadZone_Rect_UHP[ipoint] << "\"";
775 FileOut << "/>\n";
776 }
777 FileOut << "\t\t\t\t</DeadZone>\n";
778 } else { // inclined strips
779 FileOut << "\t\t\t\t<DeadZone>\n";
780 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
781 FileOut << "\t\t\t\t\t<DeadPoint";
782 if (YStationRotations[istation] == false) {
783 FileOut << " x=\"" << XDeadZone_TrapLeft_UHP[ipoint] << "\"";
784 FileOut << " y=\"" << YDeadZone_TrapLeft_UHP[ipoint] << "\"";
785 } else {
786 FileOut << " x=\"" << XDeadZone_TrapRight_UHP[ipoint] << "\"";
787 FileOut << " y=\"" << YDeadZone_TrapRight_UHP[ipoint] << "\"";
788 }
789 FileOut << "/>\n";
790 }
791 FileOut << "\t\t\t\t</DeadZone>\n";
792 }
793 } else { // hot zone
794 FileOut << "\t\t\t\t<DeadZone>"; // hole
795 FileOut << " <!-- hole -->\n";
796 for (Int_t ipoint = 0; ipoint < NPoints_DeadZone_Hole_UHP; ++ipoint) {
797 FileOut << "\t\t\t\t\t<DeadPoint";
798 FileOut << " x=\"" << XDeadZone_Hole_UHP[ipoint] << "\"";
799 FileOut << " y=\"" << YDeadZone_Hole_UHP[ipoint] << "\"";
800 FileOut << "/>\n";
801 }
802 FileOut << "\t\t\t\t</DeadZone>\n";
803
804 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("upper"))
805 { // inclined strips
806 FileOut << "\t\t\t\t<DeadZone>"; // triangle
807 FileOut << " <!-- triangle -->\n";
808 for (Int_t ipoint = 0; ipoint < 3; ++ipoint) {
809 FileOut << "\t\t\t\t\t<DeadPoint";
810 if (YStationRotations[istation] == false) {
811 FileOut << " x=\"" << XDeadZone_TrianLeft_UHP[ipoint] << "\"";
812 FileOut << " y=\"" << YDeadZone_TrianLeft_UHP[ipoint] << "\"";
813 } else {
814 FileOut << " x=\"" << XDeadZone_TrianRight_UHP[ipoint] << "\"";
815 FileOut << " y=\"" << YDeadZone_TrianRight_UHP[ipoint] << "\"";
816 }
817 FileOut << "/>\n";
818 }
819 FileOut << "\t\t\t\t</DeadZone>\n";
820 }
821 }
822 break;
823 //----------------------------------------------------------
824 // module 1 -------------------------------------------------
825 case 1:
826 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
827 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower"))
828 { // straight strips
829 FileOut << "\t\t\t\t<DeadZone>\n";
830 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
831 FileOut << "\t\t\t\t\t<DeadPoint";
832 FileOut << " x=\"" << XDeadZone_Rect_UHP[ipoint] * (-1) << "\"";
833 FileOut << " y=\"" << YDeadZone_Rect_UHP[ipoint] << "\"";
834 FileOut << "/>\n";
835 }
836 FileOut << "\t\t\t\t</DeadZone>\n";
837 } else { // inclined strips
838 FileOut << "\t\t\t\t<DeadZone>\n";
839 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
840 FileOut << "\t\t\t\t\t<DeadPoint";
841 if (YStationRotations[istation] == false) {
842 FileOut << " x=\"" << XDeadZone_TrapRight_UHP[ipoint] * (-1) << "\"";
843 FileOut << " y=\"" << YDeadZone_TrapRight_UHP[ipoint] << "\"";
844 } else {
845 FileOut << " x=\"" << XDeadZone_TrapLeft_UHP[ipoint] * (-1) << "\"";
846 FileOut << " y=\"" << YDeadZone_TrapLeft_UHP[ipoint] << "\"";
847 }
848 FileOut << "/>\n";
849 }
850 FileOut << "\t\t\t\t</DeadZone>\n";
851 }
852 } else { // hot zone
853 FileOut << "\t\t\t\t<DeadZone>"; // hole
854 FileOut << " <!-- hole -->\n";
855 for (Int_t ipoint = 0; ipoint < NPoints_DeadZone_Hole_UHP; ++ipoint) {
856 FileOut << "\t\t\t\t\t<DeadPoint";
857 FileOut << " x=\"" << XDeadZone_Hole_UHP[ipoint] * (-1) << "\"";
858 FileOut << " y=\"" << YDeadZone_Hole_UHP[ipoint] << "\"";
859 FileOut << "/>\n";
860 }
861 FileOut << "\t\t\t\t</DeadZone>\n";
862
863 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("upper"))
864 { // inclined strips
865 FileOut << "\t\t\t\t<DeadZone>"; // triangle
866 FileOut << " <!-- triangle -->\n";
867 for (Int_t ipoint = 0; ipoint < 3; ++ipoint) {
868 FileOut << "\t\t\t\t\t<DeadPoint";
869 if (YStationRotations[istation] == false) {
870 FileOut << " x=\"" << XDeadZone_TrianRight_UHP[ipoint] * (-1) << "\"";
871 FileOut << " y=\"" << YDeadZone_TrianRight_UHP[ipoint] << "\"";
872 } else {
873 FileOut << " x=\"" << XDeadZone_TrianLeft_UHP[ipoint] * (-1) << "\"";
874 FileOut << " y=\"" << YDeadZone_TrianLeft_UHP[ipoint] << "\"";
875 }
876 FileOut << "/>\n";
877 }
878 FileOut << "\t\t\t\t</DeadZone>\n";
879 }
880 }
881 break;
882 //----------------------------------------------------------
883 // module 2 -------------------------------------------------
884 case 2:
885 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
886 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower"))
887 { // straight strips
888 FileOut << "\t\t\t\t<DeadZone>\n";
889 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
890 FileOut << "\t\t\t\t\t<DeadPoint";
891 FileOut << " x=\"" << XDeadZone_Rect_LHP[ipoint] << "\"";
892 FileOut << " y=\"" << YDeadZone_Rect_LHP[ipoint] * (-1) << "\"";
893 FileOut << "/>\n";
894 }
895 FileOut << "\t\t\t\t</DeadZone>\n";
896 } else { // inclined strips
897 FileOut << "\t\t\t\t<DeadZone>\n";
898 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
899 FileOut << "\t\t\t\t\t<DeadPoint";
900 if (YStationRotations[istation] == false) {
901 FileOut << " x=\"" << XDeadZone_TrapLeft_LHP[ipoint] << "\"";
902 FileOut << " y=\"" << YDeadZone_TrapLeft_LHP[ipoint] * (-1) << "\"";
903 } else {
904 FileOut << " x=\"" << XDeadZone_TrapRight_LHP[ipoint] << "\"";
905 FileOut << " y=\"" << YDeadZone_TrapRight_LHP[ipoint] * (-1) << "\"";
906 }
907 FileOut << "/>\n";
908 }
909 FileOut << "\t\t\t\t</DeadZone>\n";
910 }
911 } else { // hot zone
912 FileOut << "\t\t\t\t<DeadZone>"; // hole
913 FileOut << " <!-- hole -->\n";
914 for (Int_t ipoint = 0; ipoint < NPoints_DeadZone_Hole_LHP; ++ipoint) {
915 FileOut << "\t\t\t\t\t<DeadPoint";
916 FileOut << " x=\"" << XDeadZone_Hole_LHP[ipoint] << "\"";
917 FileOut << " y=\"" << YDeadZone_Hole_LHP[ipoint] * (-1) << "\"";
918 FileOut << "/>\n";
919 }
920 FileOut << "\t\t\t\t</DeadZone>\n";
921
922 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("upper"))
923 { // inclined strips
924 FileOut << "\t\t\t\t<DeadZone>"; // triangle
925 FileOut << " <!-- triangle -->\n";
926 for (Int_t ipoint = 0; ipoint < 3; ++ipoint) {
927 FileOut << "\t\t\t\t\t<DeadPoint";
928 if (YStationRotations[istation] == false) {
929 FileOut << " x=\"" << XDeadZone_TrianLeft_LHP[ipoint] << "\"";
930 FileOut << " y=\"" << YDeadZone_TrianLeft_LHP[ipoint] * (-1) << "\"";
931 } else {
932 FileOut << " x=\"" << XDeadZone_TrianRight_LHP[ipoint] << "\"";
933 FileOut << " y=\"" << YDeadZone_TrianRight_LHP[ipoint] * (-1) << "\"";
934 }
935 FileOut << "/>\n";
936 }
937 FileOut << "\t\t\t\t</DeadZone>\n";
938 }
939 }
940 break;
941 //----------------------------------------------------------
942 // module 3 -------------------------------------------------
943 case 3:
944 if (ZoneTypeOfLayers[istation][ilayer] == 0) { // main zone
945 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("lower"))
946 { // straight strips
947 FileOut << "\t\t\t\t<DeadZone>\n";
948 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
949 FileOut << "\t\t\t\t\t<DeadPoint";
950 FileOut << " x=\"" << XDeadZone_Rect_LHP[ipoint] * (-1) << "\"";
951 FileOut << " y=\"" << YDeadZone_Rect_LHP[ipoint] * (-1) << "\"";
952 FileOut << "/>\n";
953 }
954 FileOut << "\t\t\t\t</DeadZone>\n";
955 } else { // inclined strips
956 FileOut << "\t\t\t\t<DeadZone>\n";
957 for (Int_t ipoint = 0; ipoint < 4; ++ipoint) {
958 FileOut << "\t\t\t\t\t<DeadPoint";
959 if (YStationRotations[istation] == false) {
960 FileOut << " x=\"" << XDeadZone_TrapRight_LHP[ipoint] * (-1) << "\"";
961 FileOut << " y=\"" << YDeadZone_TrapRight_LHP[ipoint] * (-1) << "\"";
962 } else {
963 FileOut << " x=\"" << XDeadZone_TrapLeft_LHP[ipoint] * (-1) << "\"";
964 FileOut << " y=\"" << YDeadZone_TrapLeft_LHP[ipoint] * (-1) << "\"";
965 }
966 FileOut << "/>\n";
967 }
968 FileOut << "\t\t\t\t</DeadZone>\n";
969 }
970 } else { // hot zone
971 FileOut << "\t\t\t\t<DeadZone>"; // hole
972 FileOut << " <!-- hole -->\n";
973 for (Int_t ipoint = 0; ipoint < NPoints_DeadZone_Hole_LHP; ++ipoint) {
974 FileOut << "\t\t\t\t\t<DeadPoint";
975 FileOut << " x=\"" << XDeadZone_Hole_LHP[ipoint] * (-1) << "\"";
976 FileOut << " y=\"" << YDeadZone_Hole_LHP[ipoint] * (-1) << "\"";
977 FileOut << "/>\n";
978 }
979 FileOut << "\t\t\t\t</DeadZone>\n";
980
981 if (TString(StripTypeOfLayes[istation][ilayer]) == TString("upper"))
982 { // inclined strips
983 FileOut << "\t\t\t\t<DeadZone>"; // triangle
984 FileOut << " <!-- triangle -->\n";
985 for (Int_t ipoint = 0; ipoint < 3; ++ipoint) {
986 FileOut << "\t\t\t\t\t<DeadPoint";
987 if (YStationRotations[istation] == false) {
988 FileOut << " x=\"" << XDeadZone_TrianRight_LHP[ipoint] * (-1) << "\"";
989 FileOut << " y=\"" << YDeadZone_TrianRight_LHP[ipoint] * (-1) << "\"";
990 } else {
991 FileOut << " x=\"" << XDeadZone_TrianLeft_LHP[ipoint] * (-1) << "\"";
992 FileOut << " y=\"" << YDeadZone_TrianLeft_LHP[ipoint] * (-1) << "\"";
993 }
994 FileOut << "/>\n";
995 }
996 FileOut << "\t\t\t\t</DeadZone>\n";
997 }
998 }
999 break;
1000 //----------------------------------------------------------
1001 }
1002 }
1003 FileOut << "\t\t\t</Layer>\n";
1004 }
1005 FileOut << "\t\t</Module>\n";
1006 FileOut << "\n";
1007 }
1008 FileOut << "\t</Station>\n";
1009 FileOut << "\n";
1010
1011 // cout << "------------------------------------------------------------\n";
1012 }
1013
1014 FileOut << "</StationSet>\n";
1015
1016 FileOut.close();
1017}
bool Bool_t
int Int_t
unsigned int UInt_t
double Double_t
#define R__ADD_INCLUDE_PATH(PATH)
StripNumberingDirection
@ RightToLeft
@ LeftToRight
const char * Data() const
const Double_t YStationPositions[NStations]
Double_t XModuleShifts[NStations][NMaxModules]
const Double_t ZStationPositions[NStations]
Double_t ZModuleShifts[NStations][NMaxModules]
const Double_t XStationPositions[NStations]
Double_t YModuleShifts[NStations][NMaxModules]
const Double_t XHotZoneLayerSize_InclinedStrips_LHP[2]
Double_t YDeadZone_Hole_LHP[NPoints_DeadZone_Hole_LHP]
const Double_t Gap_Drift_Thickness
const Double_t XHotZoneLayerSize_StraightStrips_LHP
const Bool_t XStationRotations[NStations]
Double_t XDeadZone_Hole_UHP[NPoints_DeadZone_Hole_UHP]
const Double_t XMainZoneLayerSize_UHP
const Double_t Gap_FirstTransfer_Thickness
const Double_t Gap_Induction_Thickness
const Int_t NModulesInStations[NStations]
const Bool_t YStationRotations[NStations]
const Double_t YMainZoneLayerSize_UHP
const Double_t YHotZoneLayerSize_InclinedStrips_LHP
const Double_t XHotZoneLayerSize_InclinedStrips_UHP[2]
const Double_t YHotZoneLayerSize_StraightStrips_LHP
const Double_t XHotZoneLayerSize_StraightStrips_UHP
const Double_t YHotZoneLayerSize_StraightStrips_UHP
const UInt_t NPoints_DeadZone_Hole_UHP
const Double_t XMainZoneLayerSize_LHP
StripNumberingDirection StripDirection[2]
const Double_t YHotZoneLayerSize_InclinedStrips_UHP
const Double_t YMainZoneLayerSize_LHP
const Bool_t DriftDirectionInModules[NStations][NMaxModules]
Double_t YDeadZone_Hole_UHP[NPoints_DeadZone_Hole_UHP]
const Double_t Gap_SecondTransfer_Thickness
const UInt_t NPoints_DeadZone_Hole_LHP
Double_t XDeadZone_Hole_LHP[NPoints_DeadZone_Hole_LHP]
const Double_t YMainZoneLayerSize_SMALL
const Double_t XMainZoneLayerSize_SMALL
const Double_t StripPitch_SMALL
const Double_t StsDY[NStations][8]
const Double_t XAlignmentCorrections[NStations][NMaxModules]
const Double_t YAlignmentCorrections[NStations][NMaxModules]
const Double_t ZAlignmentCorrections[NStations][NMaxModules]
const Double_t StsDX[NStations][8]
void GemConfigCalculate_Run8_8stations_aligned()
constexpr Double_t DegToRad()
Double_t Sqrt(Double_t x)
Double_t Cos(Double_t)
Definition json.hpp:4446