Project
Loading...
Searching...
No Matches
Geo.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "TOFBase/Geo.h"
13#include "TGeoManager.h"
14#include "TMath.h"
15#include "Framework/Logger.h"
18#include <string>
19#include "MathUtils/Utils.h"
20
22
23using namespace o2::tof;
24
25constexpr Float_t Geo::ANGLES[NPLATES][NMAXNSTRIP];
26constexpr Float_t Geo::HEIGHTS[NPLATES][NMAXNSTRIP];
27constexpr Float_t Geo::DISTANCES[NPLATES][NMAXNSTRIP];
28constexpr Bool_t Geo::FEAWITHMASKS[NSECTORS];
29constexpr Float_t Geo::ROOF2PARAMETERS[3];
30
31Bool_t Geo::mToBeInit = kTRUE;
32Bool_t Geo::mToBeInitIndexing = kTRUE;
33Float_t Geo::mRotationMatrixSector[NSECTORS + 1][3][3];
34Float_t Geo::mRotationMatrixPlateStrip[NSECTORS][NPLATES][NMAXNSTRIP][3][3];
35Float_t Geo::mPadPosition[NSECTORS][NPLATES][NMAXNSTRIP][NPADZ][NPADX][3];
36Float_t Geo::mGeoDistances[NSECTORS][NPLATES][NMAXNSTRIP];
37Float_t Geo::mGeoHeights[NSECTORS][NPLATES][NMAXNSTRIP];
38Float_t Geo::mGeoX[NSECTORS][NPLATES][NMAXNSTRIP];
39Int_t Geo::mPlate[NSTRIPXSECTOR];
40Int_t Geo::mStripInPlate[NSTRIPXSECTOR];
41std::array<std::vector<float>, 5> Geo::mDistances[NSECTORS];
42
44{
45 if (!mToBeInit) {
46 return;
47 }
48 LOG(info) << "tof::Geo: Initialization of TOF rotation parameters";
49
50 if (!gGeoManager) {
51 LOG(fatal) << "geometry is not loaded";
52 }
53
54 Double_t rotationAngles[6] =
55 {90., 90. /*+ (isector + 0.5) * PHISEC*/, 0., 0., 90., 0 /* + (isector + 0.5) * PHISEC*/};
56 for (Int_t ii = 0; ii < 6; ii++) {
57 rotationAngles[ii] *= TMath::DegToRad();
58 }
59
60 for (Int_t isector = 0; isector < NSECTORS; isector++) {
61 rotationAngles[5] = ((isector + 0.5) * PHISEC) * TMath::DegToRad();
62 rotationAngles[1] = 90. * TMath::DegToRad() + rotationAngles[5];
63
64 for (Int_t ii = 0; ii < 3; ii++) {
65 mRotationMatrixSector[isector][ii][0] =
66 TMath::Sin(rotationAngles[2 * ii]) * TMath::Cos(rotationAngles[2 * ii + 1]);
67 mRotationMatrixSector[isector][ii][1] =
68 TMath::Sin(rotationAngles[2 * ii]) * TMath::Sin(rotationAngles[2 * ii + 1]);
69 mRotationMatrixSector[isector][ii][2] = TMath::Cos(rotationAngles[2 * ii]);
70 }
71 }
72
73 rotationAngles[0] = 90. * TMath::DegToRad();
74 rotationAngles[1] = 0.;
75 rotationAngles[2] = 0.;
76 rotationAngles[3] = 0.;
77 rotationAngles[4] = 90. * TMath::DegToRad();
78 rotationAngles[5] = 270. * TMath::DegToRad();
79 for (Int_t ii = 0; ii < 3; ii++) {
80 mRotationMatrixSector[NSECTORS][ii][0] =
81 TMath::Sin(rotationAngles[2 * ii]) * TMath::Cos(rotationAngles[2 * ii + 1]);
82 mRotationMatrixSector[NSECTORS][ii][1] =
83 TMath::Sin(rotationAngles[2 * ii]) * TMath::Sin(rotationAngles[2 * ii + 1]);
84 mRotationMatrixSector[NSECTORS][ii][2] = TMath::Cos(rotationAngles[2 * ii]);
85 }
86
87 double toMyCoord[9];
88 toMyCoord[0] = mRotationMatrixSector[NSECTORS][0][0];
89 toMyCoord[1] = mRotationMatrixSector[NSECTORS][1][0];
90 toMyCoord[2] = mRotationMatrixSector[NSECTORS][2][0];
91
92 toMyCoord[3] = mRotationMatrixSector[NSECTORS][0][1];
93 toMyCoord[4] = mRotationMatrixSector[NSECTORS][1][1];
94 toMyCoord[5] = mRotationMatrixSector[NSECTORS][2][1];
95
96 toMyCoord[6] = mRotationMatrixSector[NSECTORS][0][2];
97 toMyCoord[7] = mRotationMatrixSector[NSECTORS][1][2];
98 toMyCoord[8] = mRotationMatrixSector[NSECTORS][2][2];
99
100 TGeoHMatrix myMatCoord;
101 myMatCoord.SetRotation(toMyCoord);
102 myMatCoord = myMatCoord.Inverse();
103
104 /*
105 printf("SECTOR BACK\n");
106 printf("%f %f %f\n",mRotationMatrixSector[NSECTORS][0][0],mRotationMatrixSector[NSECTORS][0][1],mRotationMatrixSector[NSECTORS][0][2]);
107 printf("%f %f %f\n",mRotationMatrixSector[NSECTORS][1][0],mRotationMatrixSector[NSECTORS][1][1],mRotationMatrixSector[NSECTORS][1][2]);
108 printf("%f %f %f\n",mRotationMatrixSector[NSECTORS][2][0],mRotationMatrixSector[NSECTORS][2][1],mRotationMatrixSector[NSECTORS][2][2]);
109 printf("\n");
110 */
111
112 int det[5];
113 for (Int_t isector = 0; isector < NSECTORS; isector++) {
114 det[0] = isector;
115 auto string1 = fmt::format("/cave_1/barrel_1/B077_1/BSEGMO{:d}_1/BTOF{:d}_1", isector, isector);
116 gGeoManager->cd(string1.c_str());
117 TGeoHMatrix sectorMat = *gGeoManager->GetCurrentMatrix();
118 // put translation to zero -> only rotation are considered for sectors, translation are applied directly for strips
119 double trans0[3] = {0., 0., 0.};
120 sectorMat.SetTranslation(trans0);
121 const Double_t* rot = sectorMat.GetRotationMatrix();
122
123 /*
124 printf("SECTOR %d rotations\n",isector);
125 printf("%f %f %f\n",mRotationMatrixSector[isector][0][0],mRotationMatrixSector[isector][0][1],mRotationMatrixSector[isector][0][2]);
126 printf("%f %f %f\n",mRotationMatrixSector[isector][1][0],mRotationMatrixSector[isector][1][1],mRotationMatrixSector[isector][1][2]);
127 printf("%f %f %f\n",mRotationMatrixSector[isector][2][0],mRotationMatrixSector[isector][2][1],mRotationMatrixSector[isector][2][2]);
128 printf("vs...\n");
129 */
130
131 mRotationMatrixSector[isector][0][0] = rot[0];
132 mRotationMatrixSector[isector][1][0] = rot[1];
133 mRotationMatrixSector[isector][2][0] = rot[2];
134
135 mRotationMatrixSector[isector][0][1] = rot[3];
136 mRotationMatrixSector[isector][1][1] = rot[4];
137 mRotationMatrixSector[isector][2][1] = rot[5];
138
139 mRotationMatrixSector[isector][0][2] = rot[6];
140 mRotationMatrixSector[isector][1][2] = rot[7];
141 mRotationMatrixSector[isector][2][2] = rot[8];
142
143 // let's invert the matric to move from global to sector coordinates
144 sectorMat = sectorMat.Inverse();
145
146 /*
147 printf("%f %f %f\n",mRotationMatrixSector[isector][0][0],mRotationMatrixSector[isector][0][1],mRotationMatrixSector[isector][0][2]);
148 printf("%f %f %f\n",mRotationMatrixSector[isector][1][0],mRotationMatrixSector[isector][1][1],mRotationMatrixSector[isector][1][2]);
149 printf("%f %f %f\n",mRotationMatrixSector[isector][2][0],mRotationMatrixSector[isector][2][1],mRotationMatrixSector[isector][2][2]);
150 printf("\n");
151 */
152
153 for (Int_t iplate = 0; iplate < NPLATES; iplate++) {
154 det[1] = iplate;
155
156 if (iplate == 2 && (isector == 13 || isector == 14 || isector == 15)) {
157 continue; // PHOS HOLES
158 }
159 int istripOff = 0;
160 if (iplate == 1) {
161 istripOff = NSTRIPC;
162 } else if (iplate == 2) {
163 istripOff = NSTRIPC + NSTRIPB;
164 }
165 if (iplate == 3) {
166 istripOff = NSTRIPC + NSTRIPB + NSTRIPA;
167 }
168 if (iplate == 4) {
169 istripOff = NSTRIPC + 2 * NSTRIPB + NSTRIPA;
170 }
171 istripOff++;
172
173 for (Int_t istrip = 0; istrip < NSTRIPC; istrip++) { // maximum number of strip is 19 for plate B and C
174 auto string2 = fmt::format("FTOA_0/FLTA_0/FSTR_{:d}", istrip + istripOff);
175 if (isector == 13 || isector == 14 || isector == 15) {
176 if (iplate < 2) {
177 string2 = fmt::format("FTOB_0/FLTB_0/FSTR_{:d}", istrip + istripOff);
178 }
179 if (iplate > 2) {
180 string2 = fmt::format("FTOC_0/FLTC_0/FSTR_{:d}", istrip + istripOff);
181 }
182 }
183
184 det[2] = istrip;
185 if (!(iplate == 2 && istrip >= NSTRIPA)) { // the middle plate (A) has only 15 strips
186
187 gGeoManager->cd(o2::utils::Str::concat_string(string1, '/', string2).c_str());
188 TGeoHMatrix aliceToStrip = *gGeoManager->GetCurrentMatrix();
189 TGeoHMatrix stripMat = sectorMat * aliceToStrip * myMatCoord; // strip in sector coordinate
190
191 // load strip alignment parameters from current geometry
192 const Double_t* tr = stripMat.GetTranslation();
193 const Double_t* rot = stripMat.GetRotationMatrix();
194 mGeoDistances[isector][iplate][istrip] = tr[1]; // DISTANCES[iplate][istrip];
195 mGeoHeights[isector][iplate][istrip] = tr[2] - (RMAX + RMIN) * 0.5; // HEIGHTS[iplate][istrip];
196 mGeoX[isector][iplate][istrip] = tr[0];
197
198 /*
199 printf("TRANSLATION\n");
200 printf("dist=%f, heights=%f, x=%f\n",DISTANCES[iplate][istrip],HEIGHTS[iplate][istrip],0.);
201 printf("vs...\n");
202 printf("dist=%lf, heights=%lf, x=%lf",tr[1],tr[2]-385.520360,tr[0]);
203 printf("\n");
204 */
205
206 mRotationMatrixPlateStrip[isector][iplate][istrip][0][0] = rot[0];
207 mRotationMatrixPlateStrip[isector][iplate][istrip][1][0] = rot[1];
208 mRotationMatrixPlateStrip[isector][iplate][istrip][2][0] = rot[2];
209
210 mRotationMatrixPlateStrip[isector][iplate][istrip][0][1] = rot[3];
211 mRotationMatrixPlateStrip[isector][iplate][istrip][1][1] = rot[4];
212 mRotationMatrixPlateStrip[isector][iplate][istrip][2][1] = rot[5];
213
214 mRotationMatrixPlateStrip[isector][iplate][istrip][0][2] = rot[6];
215 mRotationMatrixPlateStrip[isector][iplate][istrip][1][2] = rot[7];
216 mRotationMatrixPlateStrip[isector][iplate][istrip][2][2] = rot[8];
217
218 // load pad positions from current geometry
219 for (Int_t ipadz = 0; ipadz < NPADZ; ipadz++) {
220 det[3] = ipadz;
221 for (Int_t ipadx = 0; ipadx < NPADX; ipadx++) {
222 det[4] = ipadx;
223 gGeoManager->cd(getVolumePath(det).c_str());
224 TGeoHMatrix global;
225 global = *gGeoManager->GetCurrentMatrix();
226 tr = global.GetTranslation();
227 mPadPosition[isector][iplate][istrip][ipadz][ipadx][0] = tr[0];
228 mPadPosition[isector][iplate][istrip][ipadz][ipadx][1] = tr[1];
229 mPadPosition[isector][iplate][istrip][ipadz][ipadx][2] = tr[2];
230 }
231 }
232 }
233 }
234 }
235 }
236
237 /*
238 for (Int_t isector = 0; isector < NSECTORS; isector++) {
239 for (Int_t iplate = 0; iplate < NPLATES; iplate++) {
240 for (Int_t istrip = 0; istrip < NSTRIPC; istrip++) {
241 if (getAngles(iplate, istrip) > 0.) {
242 rotationAngles[0] = 90. * TMath::DegToRad();
243 rotationAngles[1] = 0.;
244 rotationAngles[3] = 90. * TMath::DegToRad();
245 rotationAngles[4] = getAngles(iplate, istrip) * TMath::DegToRad();
246 rotationAngles[5] = 90. * TMath::DegToRad();
247 rotationAngles[2] = 90. * TMath::DegToRad() + rotationAngles[4];
248 } else if (getAngles(iplate, istrip) == 0.) {
249 rotationAngles[0] = 90. * TMath::DegToRad();
250 rotationAngles[1] = 0.;
251 rotationAngles[2] = 90. * TMath::DegToRad();
252 rotationAngles[3] = 90. * TMath::DegToRad();
253 rotationAngles[4] = 0;
254 rotationAngles[5] = 0.;
255 } else if (getAngles(iplate, istrip) < 0.) {
256 rotationAngles[0] = 90. * TMath::DegToRad();
257 rotationAngles[1] = 0.;
258 rotationAngles[3] = 90. * TMath::DegToRad();
259 rotationAngles[4] = -getAngles(iplate, istrip) * TMath::DegToRad();
260 rotationAngles[5] = 270. * TMath::DegToRad();
261 rotationAngles[2] = 90. * TMath::DegToRad() - rotationAngles[4];
262 }
263
264 printf("SECTOR %d, PLATE %d, STRIP %d rotations\n",isector,iplate,istrip);
265 printf("%f %f %f\n",mRotationMatrixPlateStrip[isector][iplate][istrip][0][0],mRotationMatrixPlateStrip[isector][iplate][istrip][0][1],mRotationMatrixPlateStrip[isector][iplate][istrip][0][2]);
266 printf("%f %f %f\n",mRotationMatrixPlateStrip[isector][iplate][istrip][1][0],mRotationMatrixPlateStrip[isector][iplate][istrip][1][1],mRotationMatrixPlateStrip[isector][iplate][istrip][1][2]);
267 printf("%f %f %f\n",mRotationMatrixPlateStrip[isector][iplate][istrip][2][0],mRotationMatrixPlateStrip[isector][iplate][istrip][2][1],mRotationMatrixPlateStrip[isector][iplate][istrip][2][2]);
268 printf("vs...\n");
269
270 for (Int_t ii = 0; ii < 3; ii++) {
271 mRotationMatrixPlateStrip[isector][iplate][istrip][ii][0] =
272 TMath::Sin(rotationAngles[2 * ii]) * TMath::Cos(rotationAngles[2 * ii + 1]);
273 mRotationMatrixPlateStrip[isector][iplate][istrip][ii][1] =
274 TMath::Sin(rotationAngles[2 * ii]) * TMath::Sin(rotationAngles[2 * ii + 1]);
275 mRotationMatrixPlateStrip[isector][iplate][istrip][ii][2] = TMath::Cos(rotationAngles[2 * ii]);
276 }
277
278 printf("%f %f %f\n",mRotationMatrixPlateStrip[isector][iplate][istrip][0][0],mRotationMatrixPlateStrip[isector][iplate][istrip][0][1],mRotationMatrixPlateStrip[isector][iplate][istrip][0][2]);
279 printf("%f %f %f\n",mRotationMatrixPlateStrip[isector][iplate][istrip][1][0],mRotationMatrixPlateStrip[isector][iplate][istrip][1][1],mRotationMatrixPlateStrip[isector][iplate][istrip][1][2]);
280 printf("%f %f %f\n",mRotationMatrixPlateStrip[isector][iplate][istrip][2][0],mRotationMatrixPlateStrip[isector][iplate][istrip][2][1],mRotationMatrixPlateStrip[isector][iplate][istrip][2][2]);
281 printf("\n");
282
283 }
284 }
285 }
286 */
287
288 InitIndices();
289 mToBeInit = kFALSE;
290}
291
293{
294 mToBeInit = true;
295 mToBeInitIndexing = true;
296
297 if (!mToBeInit) {
298 return;
299 }
300 LOG(info) << "tof::Geo: Initialization of TOF rotation parameters with ideal";
301
302 Double_t rotationAngles[6] =
303 {90., 90. /*+ (isector + 0.5) * PHISEC*/, 0., 0., 90., 0 /* + (isector + 0.5) * PHISEC*/};
304 for (Int_t ii = 0; ii < 6; ii++) {
305 rotationAngles[ii] *= TMath::DegToRad();
306 }
307
308 for (Int_t isector = 0; isector < NSECTORS; isector++) {
309 rotationAngles[5] = ((isector + 0.5) * PHISEC) * TMath::DegToRad();
310 rotationAngles[1] = 90. * TMath::DegToRad() + rotationAngles[5];
311
312 for (Int_t ii = 0; ii < 3; ii++) {
313 mRotationMatrixSector[isector][ii][0] =
314 TMath::Sin(rotationAngles[2 * ii]) * TMath::Cos(rotationAngles[2 * ii + 1]);
315 mRotationMatrixSector[isector][ii][1] =
316 TMath::Sin(rotationAngles[2 * ii]) * TMath::Sin(rotationAngles[2 * ii + 1]);
317 mRotationMatrixSector[isector][ii][2] = TMath::Cos(rotationAngles[2 * ii]);
318 }
319 }
320
321 rotationAngles[0] = 90. * TMath::DegToRad();
322 rotationAngles[1] = 0.;
323 rotationAngles[2] = 0.;
324 rotationAngles[3] = 0.;
325 rotationAngles[4] = 90. * TMath::DegToRad();
326 rotationAngles[5] = 270. * TMath::DegToRad();
327 for (Int_t ii = 0; ii < 3; ii++) {
328 mRotationMatrixSector[NSECTORS][ii][0] =
329 TMath::Sin(rotationAngles[2 * ii]) * TMath::Cos(rotationAngles[2 * ii + 1]);
330 mRotationMatrixSector[NSECTORS][ii][1] =
331 TMath::Sin(rotationAngles[2 * ii]) * TMath::Sin(rotationAngles[2 * ii + 1]);
332 mRotationMatrixSector[NSECTORS][ii][2] = TMath::Cos(rotationAngles[2 * ii]);
333 }
334
335 for (Int_t isector = 0; isector < NSECTORS; isector++) {
336 for (Int_t iplate = 0; iplate < NPLATES; iplate++) {
337 for (Int_t istrip = 0; istrip < NSTRIPC; istrip++) {
338 mGeoDistances[isector][iplate][istrip] = DISTANCES[iplate][istrip];
339 mGeoHeights[isector][iplate][istrip] = HEIGHTS[iplate][istrip];
340 mGeoX[isector][iplate][istrip] = 0.0;
341
342 if (getAngles(iplate, istrip) > 0.) {
343 rotationAngles[0] = 90. * TMath::DegToRad();
344 rotationAngles[1] = 0.;
345 rotationAngles[3] = 90. * TMath::DegToRad();
346 rotationAngles[4] = getAngles(iplate, istrip) * TMath::DegToRad();
347 rotationAngles[5] = 90. * TMath::DegToRad();
348 rotationAngles[2] = 90. * TMath::DegToRad() + rotationAngles[4];
349 } else if (getAngles(iplate, istrip) == 0.) {
350 rotationAngles[0] = 90. * TMath::DegToRad();
351 rotationAngles[1] = 0.;
352 rotationAngles[2] = 90. * TMath::DegToRad();
353 rotationAngles[3] = 90. * TMath::DegToRad();
354 rotationAngles[4] = 0;
355 rotationAngles[5] = 0.;
356 } else if (getAngles(iplate, istrip) < 0.) {
357 rotationAngles[0] = 90. * TMath::DegToRad();
358 rotationAngles[1] = 0.;
359 rotationAngles[3] = 90. * TMath::DegToRad();
360 rotationAngles[4] = -getAngles(iplate, istrip) * TMath::DegToRad();
361 rotationAngles[5] = 270. * TMath::DegToRad();
362 rotationAngles[2] = 90. * TMath::DegToRad() - rotationAngles[4];
363 }
364
365 for (Int_t ii = 0; ii < 3; ii++) {
366 mRotationMatrixPlateStrip[isector][iplate][istrip][ii][0] =
367 TMath::Sin(rotationAngles[2 * ii]) * TMath::Cos(rotationAngles[2 * ii + 1]);
368 mRotationMatrixPlateStrip[isector][iplate][istrip][ii][1] =
369 TMath::Sin(rotationAngles[2 * ii]) * TMath::Sin(rotationAngles[2 * ii + 1]);
370 mRotationMatrixPlateStrip[isector][iplate][istrip][ii][2] = TMath::Cos(rotationAngles[2 * ii]);
371 }
372 }
373 }
374 }
375
376 InitIndices();
377 mToBeInit = kFALSE;
378
379 for (Int_t isector = 0; isector < NSECTORS; isector++) {
380 for (Int_t iplate = 0; iplate < NPLATES; iplate++) {
381 for (Int_t istrip = 0; istrip < NSTRIPC; istrip++) {
382 for (int iz = 0; iz < 2; iz++) {
383 for (int ix = 0; ix < 48; ix++) {
384 int det[] = {isector, iplate, istrip, iz, ix};
385 float posPad[3] = {0., 0., 0.};
386 getPosInPadCoord(det, posPad);
387 antiRotateToStrip(posPad, iplate, istrip, isector);
388 antiRotateToSector(posPad, 18);
389 antiRotateToSector(posPad, isector);
390
391 mPadPosition[isector][iplate][istrip][iz][ix][0] = -posPad[0];
392 mPadPosition[isector][iplate][istrip][iz][ix][1] = -posPad[1];
393 mPadPosition[isector][iplate][istrip][iz][ix][2] = -posPad[2];
394 }
395 }
396 }
397 }
398 }
399}
400
402{
403 if (!mToBeInitIndexing) {
404 return;
405 }
406 mToBeInitIndexing = kFALSE;
407 // initialization of some indices arrays
408
409 for (Int_t istrip = 0; istrip < NSTRIPXSECTOR; ++istrip) {
410 if (istrip < NSTRIPC) {
411 mPlate[istrip] = 0;
412 mStripInPlate[istrip] = istrip;
413 } else if (istrip >= NSTRIPC && istrip < NSTRIPC + NSTRIPB) {
414 mPlate[istrip] = 1;
415 mStripInPlate[istrip] = istrip - NSTRIPC;
416 } else if (istrip >= NSTRIPC + NSTRIPB && istrip < NSTRIPC + NSTRIPB + NSTRIPA) {
417 mPlate[istrip] = 2;
418 mStripInPlate[istrip] = istrip - NSTRIPC - NSTRIPB;
419 } else if (istrip >= NSTRIPC + NSTRIPB + NSTRIPA && istrip < NSTRIPC + NSTRIPB + NSTRIPA + NSTRIPB) {
420 mPlate[istrip] = 3;
421 mStripInPlate[istrip] = istrip - NSTRIPC - NSTRIPB - NSTRIPA;
422 } else if (istrip >= NSTRIPC + NSTRIPB + NSTRIPA + NSTRIPB && istrip < NSTRIPXSECTOR) {
423 mPlate[istrip] = 4;
424 mStripInPlate[istrip] = istrip - NSTRIPC - NSTRIPB - NSTRIPA - NSTRIPB;
425 }
426 }
427
428 Int_t nstrips = NSTRIPC;
429 for (Int_t isector = 0; isector < NSECTORS; isector++) {
430 for (int iplate = 0; iplate < 5; ++iplate) {
431 if (iplate == 1 || iplate == 3) {
432 nstrips = NSTRIPB;
433 } else if (iplate == 2) {
434 nstrips = NSTRIPA;
435 }
436 mDistances[isector][iplate].reserve(nstrips);
437 for (int i = 0; i < nstrips; ++i) {
438 mDistances[isector][iplate].push_back(getGeoDistances(isector, iplate, nstrips - i - 1));
439 }
440 }
441 }
442}
443
444std::string Geo::getVolumePath(const Int_t* ind)
445{
446 //--------------------------------------------------------------------
447 // This function returns the volume path of a given pad
448 //--------------------------------------------------------------------
449 Int_t sector = ind[0];
450
451 Int_t icopy = -1;
452 icopy = sector;
453
454 auto string1 = fmt::format("/cave_1/barrel_1/B077_1/BSEGMO{:d}_1/BTOF{:d}_1", icopy, icopy);
455
456 Bool_t fgHoles = kTRUE;
457
458 Int_t iplate = ind[1];
459 Int_t istrip = ind[2];
460 if (iplate == 0) {
461 icopy = istrip;
462 }
463 if (iplate == 1) {
464 icopy = istrip + NSTRIPC;
465 }
466 if (iplate == 2) {
467 icopy = istrip + NSTRIPC + NSTRIPB;
468 }
469 if (iplate == 3) {
470 icopy = istrip + NSTRIPC + NSTRIPB + NSTRIPA;
471 }
472 if (iplate == 4) {
473 icopy = istrip + NSTRIPC + 2 * NSTRIPB + NSTRIPA;
474 }
475 icopy++;
476 auto string2 = fmt::format("FTOA_0/FLTA_0/FSTR_{:d}", icopy);
477 if (fgHoles && (sector == 13 || sector == 14 || sector == 15)) {
478 if (iplate < 2) {
479 string2 = fmt::format("FTOB_0/FLTB_0/FSTR_{:d}", icopy);
480 }
481 if (iplate > 2) {
482 string2 = fmt::format("FTOC_0/FLTC_0/FSTR_{:d}", icopy);
483 }
484 }
485
486 Int_t padz = ind[3] + 1;
487 Int_t padx = ind[4] + 1;
488 return o2::utils::Str::concat_string(string1, '/', string2, '/', fmt::format("FPCB_1/FSEN_1/FSEZ_{:d}/FPAD_{:d}", padz, padx));
489}
490
491void Geo::getPos(Int_t* det, Float_t* pos)
492{
493 //
494 // Returns space point coor (x,y,z) (cm) for Detector
495 // Indices (iSect,iPlate,iStrip,iPadZ,iPadX)
496 //
497 if (mToBeInit) {
498 Init();
499 }
500
501 // printf("TOFDBG: %d, %d, %d, %d, %d -> %f %f %f\n", det[0], det[1], det[2], det[3], det[4], mPadPosition[det[0]][det[1]][det[2]][det[3]][det[4]][0], mPadPosition[det[0]][det[1]][det[2]][det[3]][det[4]][1], mPadPosition[det[0]][det[1]][det[2]][det[3]][det[4]][2]);
502 pos[0] = mPadPosition[det[0]][det[1]][det[2]][det[3]][det[4]][0];
503 pos[1] = mPadPosition[det[0]][det[1]][det[2]][det[3]][det[4]][1];
504 pos[2] = mPadPosition[det[0]][det[1]][det[2]][det[3]][det[4]][2];
505}
506
507void Geo::getDetID(Float_t* pos, Int_t* det)
508{
509 //
510 // Returns Detector Indices (iSect,iPlate,iStrip,iPadZ,iPadX)
511 // space point coor (x,y,z) (cm)
512
513 if (mToBeInit) {
514 Init();
515 }
516
517 Float_t posLocal[3];
518 for (Int_t ii = 0; ii < 3; ii++) {
519 posLocal[ii] = pos[ii];
520 }
521
522 det[0] = getSector(posLocal);
523 if (det[0] == -1) {
524 return;
525 }
526
527 fromGlobalToSector(posLocal, det[0]);
528
529 det[1] = getPlate(posLocal);
530 if (det[1] == -1) {
531 return;
532 }
533
534 det[2] = fromPlateToStrip(posLocal, det[1], det[0]);
535 if (det[2] == -1) {
536 return;
537 }
538
539 det[3] = getPadZ(posLocal);
540 det[4] = getPadX(posLocal);
541}
542
543void Geo::getVolumeIndices(Int_t index, Int_t* detId)
544{
545 //
546 // Retrieve volume indices from the calibration channel index
547 //
548
549 if (mToBeInitIndexing) {
550 InitIndices();
551 }
553
554 Int_t dummyStripPerModule = index / NPADS - NSTRIPXSECTOR * detId[0];
555 detId[1] = mPlate[dummyStripPerModule];
556 detId[2] = mStripInPlate[dummyStripPerModule];
557 Int_t padPerStrip = index - (NSTRIPXSECTOR * detId[0] + dummyStripPerModule) * NPADS;
558
559 detId[3] = padPerStrip / NPADX; // padZ
560 detId[4] = padPerStrip - detId[3] * NPADX; // padX
561}
562
563Int_t Geo::getIndex(const Int_t* detId)
564{
565 //Retrieve calibration channel index
566 Int_t isector = detId[0];
567 if (isector >= NSECTORS) {
568 printf("Wrong sector number in TOF (%d) !\n", isector);
569 return -1;
570 }
571 Int_t iplate = detId[1];
572 if (iplate >= NPLATES) {
573 printf("Wrong plate number in TOF (%d) !\n", iplate);
574 return -1;
575 }
576 Int_t istrip = detId[2];
577 Int_t stripOffset = getStripNumberPerSM(iplate, istrip);
578 if (stripOffset == -1) {
579 printf("Wrong strip number per SM in TOF (%d) !\n", stripOffset);
580 return -1;
581 }
582
583 Int_t ipadz = detId[3];
584 Int_t ipadx = detId[4];
585
586 Int_t idet = ((2 * (NSTRIPC + NSTRIPB) + NSTRIPA) * NPADZ * NPADX) * isector +
587 (stripOffset * NPADZ * NPADX) +
588 (NPADX)*ipadz +
589 ipadx;
590 return idet;
591}
592
593Int_t Geo::getStripNumberPerSM(Int_t iplate, Int_t istrip)
594{
595 //
596 // Get the serial number of the TOF strip number istrip [0,14/18],
597 // in the module number iplate [0,4].
598 // This number will range in [0,90].
599 //
600
601 Int_t index = -1;
602
603 Bool_t check = ((iplate < 0 || iplate >= NPLATES) ||
604 ((iplate == 2 && (istrip < 0 || istrip >= NSTRIPA)) ||
605 (iplate != 2 && (istrip < 0 || istrip >= NSTRIPC))));
606
607 if (iplate < 0 || iplate >= NPLATES) {
608 LOG(error) << "getStripNumberPerSM : "
609 << "Wrong plate number in TOF (" << iplate << ")!\n";
610 }
611
612 if (
613 (iplate == 2 && (istrip < 0 || istrip >= NSTRIPA)) ||
614 (iplate != 2 && (istrip < 0 || istrip >= NSTRIPC))) {
615 LOG(error) << "getStripNumberPerSM : "
616 << " Wrong strip number in TOF (strip=" << istrip << " in the plate= " << iplate << ")!\n";
617 }
618
619 Int_t stripOffset = 0;
620 switch (iplate) {
621 case 0:
622 stripOffset = 0;
623 break;
624 case 1:
625 stripOffset = NSTRIPC;
626 break;
627 case 2:
628 stripOffset = NSTRIPC + NSTRIPB;
629 break;
630 case 3:
631 stripOffset = NSTRIPC + NSTRIPB + NSTRIPA;
632 break;
633 case 4:
634 stripOffset = NSTRIPC + NSTRIPB + NSTRIPA + NSTRIPB;
635 break;
636 };
637
638 if (!check) {
639 index = stripOffset + istrip;
640 }
641
642 return index;
643}
644
645void Geo::getPosInSectorCoord(const Int_t* detId, float* pos)
646{
647 Init();
648 fromGlobalToSector(pos, detId[0]);
649
650 float swap = pos[0];
651 pos[0] = pos[1];
652 pos[1] = swap;
653 pos[2] = -pos[2];
654}
655
656void Geo::getPosInStripCoord(const Int_t* detId, float* pos)
657{
658 Init();
659 fromGlobalToSector(pos, detId[0]);
660
661 float step[3];
662 step[0] = getGeoX(detId[0], detId[1], detId[2]);
663 step[1] = getGeoHeights(detId[0], detId[1], detId[2]);
664 step[2] = -getGeoDistances(detId[0], detId[1], detId[2]);
665 translate(pos[0], pos[1], pos[2], step);
666 rotateToStrip(pos, detId[1], detId[2], detId[0]);
667}
668
669void Geo::getPosInPadCoord(const Int_t* detId, float* pos)
670{
671 Init();
672 fromGlobalToSector(pos, detId[0]);
673
674 float step[3];
675 step[0] = getGeoX(detId[0], detId[1], detId[2]);
676 step[1] = getGeoHeights(detId[0], detId[1], detId[2]);
677 step[2] = -getGeoDistances(detId[0], detId[1], detId[2]);
678 translate(pos[0], pos[1], pos[2], step);
679 rotateToStrip(pos, detId[1], detId[2], detId[0]);
680
681 pos[0] -= (detId[4] + 0.5) * XPAD - XHALFSTRIP;
682 pos[2] -= (detId[3] - 0.5) * ZPAD;
683}
684
685void Geo::getPosInSectorCoord(int ch, float* pos)
686{
687 int det[5];
688 getVolumeIndices(ch, det);
690}
691
692void Geo::getPosInStripCoord(int ch, float* pos)
693{
694 int det[5];
695 getVolumeIndices(ch, det);
697}
698
699void Geo::getPosInPadCoord(int ch, float* pos)
700{
701 int det[5];
702 getVolumeIndices(ch, det);
703 getPosInPadCoord(det, pos);
704}
705
706void Geo::fromGlobalToSector(Float_t* pos, Int_t isector)
707{
708 if (isector == -1) {
709 //LOG(error) << "Sector Index not valid (-1)\n";
710 return;
711 }
712
713 // ALICE reference frame -> B071/B074/B075 = BTO1/2/3 reference frame
714 rotateToSector(pos, isector);
715
716 Float_t step[3] = {0., 0., static_cast<Float_t>((RMAX + RMIN) * 0.5)};
717 translate(pos, step);
718
719 // B071/B074/B075 = BTO1/2/3 reference frame -> FTOA = FLTA reference frame
721}
722
723Int_t Geo::fromPlateToStrip(Float_t* pos, Int_t iplate, Int_t isector)
724{
725 if (iplate == -1) {
726 return -1;
727 }
728
729 Int_t nstrips = 0;
730 switch (iplate) {
731 case 0:
732 case 4:
733 nstrips = NSTRIPC;
734 break;
735 case 1:
736 case 3:
737 nstrips = NSTRIPB;
738 break;
739 case 2:
740 nstrips = NSTRIPA;
741 break;
742 }
743
744 constexpr Float_t HGLFY = HFILIY + 2 * HGLASSY; // heigth of GLASS+FISHLINE Layer
745 constexpr Float_t HSTRIPY = 2. * HHONY + 2. * HPCBY + 4. * HRGLY + 2. * HGLFY + HCPCBY; // 3.11
746
747 Float_t step[3];
748
749 // FTOA/B/C = FLTA/B/C reference frame -> FSTR reference frame
750
751 // we restrict the search of the strip to a more reasonable range, considering that the
752 // DISTANCES are never larger than 10 between consecutive strips
753 auto ilower = std::lower_bound(mDistances[isector][iplate].begin(), mDistances[isector][iplate].end(), -pos[2]);
754 int stripFound = mDistances[isector][iplate].size() - 1 - std::distance(mDistances[isector][iplate].begin(), ilower);
755 int firstStripToCheck = stripFound;
756 int lastStripToCheck = stripFound;
757 if (stripFound != 0) {
758 while (firstStripToCheck != 0 && std::abs(pos[2] + getGeoDistances(isector, iplate, firstStripToCheck - 1)) < 10) {
759 --firstStripToCheck;
760 }
761 }
762 if (stripFound != nstrips - 1) {
763 while (lastStripToCheck != nstrips - 1 && std::abs(pos[2] + getGeoDistances(isector, iplate, lastStripToCheck + 1)) < 10) {
764 ++lastStripToCheck;
765 }
766 }
767
768 for (Int_t istrip = firstStripToCheck; istrip <= lastStripToCheck; ++istrip) {
769 Float_t posLoc2[3] = {pos[0], pos[1], pos[2]};
770
771 step[0] = getGeoX(isector, iplate, istrip);
772 step[1] = getGeoHeights(isector, iplate, istrip);
773 step[2] = -getGeoDistances(isector, iplate, istrip);
774 translate(posLoc2[0], posLoc2[1], posLoc2[2], step);
775
776 if (std::abs(posLoc2[1]) > 10) {
777 continue;
778 }
779 if (std::abs(posLoc2[2]) > 10) {
780 continue;
781 }
782
783 float distanceSquared = posLoc2[1] * posLoc2[1] + posLoc2[2] * posLoc2[2];
784
785 if (distanceSquared > 45) {
786 continue;
787 }
788
789 rotateToStrip(posLoc2, iplate, istrip, isector);
790
791 if ((std::abs(posLoc2[0]) <= STRIPLENGTH * 0.5) && (std::abs(posLoc2[1]) <= HSTRIPY * 0.5) &&
792 (std::abs(posLoc2[2]) <= WCPCBZ * 0.5)) {
793 step[0] = -0.5 * NPADX * XPAD;
794 step[1] = 0.;
795 step[2] = -0.5 * NPADZ * ZPAD;
796 //translate(posLoc2, step);
797 translate(posLoc2[0], posLoc2[1], posLoc2[2], step);
798
799 for (Int_t jj = 0; jj < 3; ++jj) {
800 pos[jj] = posLoc2[jj];
801 }
802
803 return istrip;
804 }
805 }
806 return -1;
807}
808
809Int_t Geo::getSector(const Float_t* pos)
810{
811 //
812 // Returns the Sector index
813 //
814
815 Int_t iSect = -1;
816
817 //Float_t x = pos[0];
818 //Float_t y = pos[1];
819 //Float_t z = pos[2];
820
821 Float_t rho2 = pos[0] * pos[0] + pos[1] * pos[1];
822
823 if (!((pos[2] >= -ZLENA * 0.5 && pos[2] <= ZLENA * 0.5) && (rho2 >= (RMIN2) && rho2 <= (RMAX2)))) {
824 // AliError("Detector Index could not be determined");
825 return iSect;
826 }
827
828 Float_t phi = TMath::Pi() + o2::math_utils::fastATan2(-pos[1], -pos[0]);
829
830 iSect = (Int_t)(phi * TMath::RadToDeg() * PHISECINV);
831
832 return iSect;
833}
834
835void Geo::getPadDxDyDz(const Float_t* pos, Int_t* det, Float_t* DeltaPos, int sector)
836{
837 //
838 // Returns the x coordinate in the Pad reference frame
839 //
840 if (mToBeInit) {
841 Init();
842 }
843
844 for (Int_t ii = 0; ii < 3; ii++) {
845 DeltaPos[ii] = pos[ii];
846 }
847
848 det[0] = sector;
849 if (det[0] == -1) {
850 det[0] = getSector(DeltaPos);
851
852 if (det[0] == -1) {
853 return;
854 }
855 }
856
857 fromGlobalToSector(DeltaPos, det[0]);
858 det[1] = getPlate(DeltaPos);
859 if (det[1] == -1) {
860 return;
861 }
862
863 det[2] = fromPlateToStrip(DeltaPos, det[1], det[0]);
864 if (det[2] == -1) {
865 return;
866 }
867
868 det[3] = getPadZ(DeltaPos);
869 det[4] = getPadX(DeltaPos);
870 // translate to the pad center
871
872 Float_t step[3];
873
874 step[0] = (det[4] + 0.5) * XPAD;
875
876 step[1] = 0.;
877
878 step[2] = (det[3] + 0.5) * ZPAD;
879 translate(DeltaPos, step);
880}
881
882Int_t Geo::getPlate(const Float_t* pos)
883{
884 //
885 // Returns the Plate index
886 //
887
888 Int_t iPlate = -1;
889
890 Float_t yLocal = pos[1];
891 Float_t zLocal = pos[2];
892
893 Float_t deltaRhoLoc = (RMAX - RMIN) * 0.5 - MODULEWALLTHICKNESS + yLocal;
894 Float_t deltaZetaLoc = std::abs(zLocal);
895
896 Float_t deltaRHOmax = 0.;
897
898 if (std::abs(zLocal) >= EXTERINTERMODBORDER1 && std::abs(zLocal) <= EXTERINTERMODBORDER2) {
899 deltaRhoLoc -= LENGTHEXINMODBORDER;
900 deltaZetaLoc = EXTERINTERMODBORDER2 - deltaZetaLoc;
901 deltaRHOmax = (RMAX - RMIN) * 0.5 - MODULEWALLTHICKNESS - 2. * LENGTHEXINMODBORDER; // old 5.35, new 4.8
902
903 if (deltaRhoLoc > deltaZetaLoc * deltaRHOmax / (INTERCENTRMODBORDER2 - INTERCENTRMODBORDER1)) {
904 if (zLocal < 0) {
905 iPlate = 0;
906 } else {
907 iPlate = 4;
908 }
909 } else {
910 if (zLocal < 0) {
911 iPlate = 1;
912 } else {
913 iPlate = 3;
914 }
915 }
916 } else if (std::abs(zLocal) >= INTERCENTRMODBORDER1 && std::abs(zLocal) <= INTERCENTRMODBORDER2) {
917 deltaRhoLoc -= LENGTHINCEMODBORDERD;
918 deltaZetaLoc = deltaZetaLoc - INTERCENTRMODBORDER1;
919 deltaRHOmax = (RMAX - RMIN) * 0.5 - MODULEWALLTHICKNESS - 2. * LENGTHINCEMODBORDERD; // old 0.39, new 0.2
920
921 if (deltaRhoLoc > deltaZetaLoc * deltaRHOmax / (INTERCENTRMODBORDER2 - INTERCENTRMODBORDER1)) {
922 iPlate = 2;
923 } else {
924 if (zLocal < 0) {
925 iPlate = 1;
926 } else {
927 iPlate = 3;
928 }
929 }
930 }
931
932 if (zLocal > -ZLENA * 0.5 && zLocal < -EXTERINTERMODBORDER2) {
933 iPlate = 0;
934 } else if (zLocal > -EXTERINTERMODBORDER1 && zLocal < -INTERCENTRMODBORDER2) {
935 iPlate = 1;
936 } else if (zLocal > -INTERCENTRMODBORDER1 && zLocal < INTERCENTRMODBORDER1) {
937 iPlate = 2;
938 } else if (zLocal > INTERCENTRMODBORDER2 && zLocal < EXTERINTERMODBORDER1) {
939 iPlate = 3;
940 } else if (zLocal > EXTERINTERMODBORDER2 && zLocal < ZLENA * 0.5) {
941 iPlate = 4;
942 }
943
944 return iPlate;
945}
946
947Int_t Geo::getPadZ(const Float_t* pos)
948{
949 //
950 // Returns the Pad index along Z
951 //
952
953 Int_t iPadZ = (Int_t)(pos[2] / ZPAD);
954 if (iPadZ == NPADZ) {
955 iPadZ--;
956 } else if (iPadZ > NPADZ) {
957 iPadZ = -1;
958 }
959
960 return iPadZ;
961}
962//_____________________________________________________________________________
963Int_t Geo::getPadX(const Float_t* pos)
964{
965 //
966 // Returns the Pad index along X
967 //
968
969 Int_t iPadX = (Int_t)(pos[0] / XPAD);
970 if (iPadX == NPADX) {
971 iPadX--;
972 } else if (iPadX > NPADX) {
973 iPadX = -1;
974 }
975
976 return iPadX;
977}
978
979void Geo::translate(Float_t* xyz, Float_t translationVector[3])
980{
981 //
982 // Return the vector xyz translated by translationVector vector
983 //
984
985 for (Int_t ii = 0; ii < 3; ii++) {
986 xyz[ii] -= translationVector[ii];
987 }
988
989 return;
990}
991void Geo::translate(Float_t& x, Float_t& y, Float_t& z, Float_t translationVector[3])
992{
993 //
994 // Return the vector xyz translated by translationVector vector
995 //
996
997 x -= translationVector[0];
998 y -= translationVector[1];
999 z -= translationVector[2];
1000
1001 /*
1002 for (Int_t ii = 0; ii < 3; ii++) {
1003 xyz[ii] -= translationVector[ii];
1004 }
1005 */
1006 return;
1007}
1008void Geo::antiRotateToSector(Float_t* xyz, Int_t isector)
1009{
1010 if (mToBeInit) {
1011 Init();
1012 }
1013
1014 Float_t xyzDummy[3] = {0., 0., 0.};
1015
1016 for (Int_t ii = 0; ii < 3; ii++) {
1017 xyzDummy[ii] = xyz[0] * mRotationMatrixSector[isector][0][ii] + xyz[1] * mRotationMatrixSector[isector][1][ii] +
1018 xyz[2] * mRotationMatrixSector[isector][2][ii];
1019 }
1020
1021 for (Int_t ii = 0; ii < 3; ii++) {
1022 xyz[ii] = xyzDummy[ii];
1023 }
1024
1025 return;
1026}
1027
1028void Geo::rotateToSector(Float_t* xyz, Int_t isector)
1029{
1030 if (mToBeInit) {
1031 Init();
1032 }
1033
1034 Float_t xyzDummy[3] = {0., 0., 0.};
1035
1036 for (Int_t ii = 0; ii < 3; ii++) {
1037 xyzDummy[ii] = xyz[0] * mRotationMatrixSector[isector][ii][0] + xyz[1] * mRotationMatrixSector[isector][ii][1] +
1038 xyz[2] * mRotationMatrixSector[isector][ii][2];
1039 }
1040
1041 for (Int_t ii = 0; ii < 3; ii++) {
1042 xyz[ii] = xyzDummy[ii];
1043 }
1044
1045 return;
1046}
1047
1048void Geo::antiRotateToStrip(Float_t* xyz, Int_t iplate, Int_t istrip, Int_t isector)
1049{
1050 Float_t xyzDummy[3] = {0., 0., 0.};
1051
1052 for (Int_t ii = 0; ii < 3; ii++) {
1053 xyzDummy[ii] = xyz[0] * mRotationMatrixPlateStrip[isector][iplate][istrip][0][ii] +
1054 xyz[1] * mRotationMatrixPlateStrip[isector][iplate][istrip][1][ii] +
1055 xyz[2] * mRotationMatrixPlateStrip[isector][iplate][istrip][2][ii];
1056 }
1057
1058 for (Int_t ii = 0; ii < 3; ii++) {
1059 xyz[ii] = xyzDummy[ii];
1060 }
1061
1062 return;
1063}
1064
1065void Geo::rotateToStrip(Float_t* xyz, Int_t iplate, Int_t istrip, Int_t isector)
1066{
1067 Float_t xyzDummy[3] = {0., 0., 0.};
1068
1069 for (Int_t ii = 0; ii < 3; ii++) {
1070 xyzDummy[ii] = xyz[0] * mRotationMatrixPlateStrip[isector][iplate][istrip][ii][0] +
1071 xyz[1] * mRotationMatrixPlateStrip[isector][iplate][istrip][ii][1] +
1072 xyz[2] * mRotationMatrixPlateStrip[isector][iplate][istrip][ii][2];
1073 }
1074
1075 for (Int_t ii = 0; ii < 3; ii++) {
1076 xyz[ii] = xyzDummy[ii];
1077 }
1078
1079 return;
1080}
1081
1082void Geo::rotate(Float_t* xyz, Double_t rotationAngles[6])
1083{
1084 //
1085 // Return the vector xyz rotated according to the rotationAngles angles
1086 //
1087
1088 /*
1089 TRotMatrix *matrix = new TRotMatrix("matrix","matrix", angles[0], angles[1],
1090 angles[2], angles[3],
1091 angles[4], angles[5]);
1092 */
1093
1094 for (Int_t ii = 0; ii < 6; ii++) {
1095 rotationAngles[ii] *= TMath::DegToRad();
1096 }
1097
1098 Float_t xyzDummy[3] = {0., 0., 0.};
1099
1100 for (Int_t ii = 0; ii < 3; ii++) {
1101 xyzDummy[ii] = xyz[0] * TMath::Sin(rotationAngles[2 * ii]) * TMath::Cos(rotationAngles[2 * ii + 1]) +
1102 xyz[1] * TMath::Sin(rotationAngles[2 * ii]) * TMath::Sin(rotationAngles[2 * ii + 1]) +
1103 xyz[2] * TMath::Cos(rotationAngles[2 * ii]);
1104 }
1105
1106 for (Int_t ii = 0; ii < 3; ii++) {
1107 xyz[ii] = xyzDummy[ii];
1108 }
1109
1110 return;
1111}
1112
1113void Geo::antiRotate(Float_t* xyz, Double_t rotationAngles[6])
1114{
1115 //
1116 // Rotates the vector xyz acordint to the rotationAngles
1117 //
1118
1119 for (Int_t ii = 0; ii < 6; ii++) {
1120 rotationAngles[ii] *= TMath::DegToRad();
1121 }
1122
1123 Float_t xyzDummy[3] = {0., 0., 0.};
1124
1125 xyzDummy[0] = xyz[0] * TMath::Sin(rotationAngles[0]) * TMath::Cos(rotationAngles[1]) +
1126 xyz[1] * TMath::Sin(rotationAngles[2]) * TMath::Cos(rotationAngles[3]) +
1127 xyz[2] * TMath::Sin(rotationAngles[4]) * TMath::Cos(rotationAngles[5]);
1128
1129 xyzDummy[1] = xyz[0] * TMath::Sin(rotationAngles[0]) * TMath::Sin(rotationAngles[1]) +
1130 xyz[1] * TMath::Sin(rotationAngles[2]) * TMath::Sin(rotationAngles[3]) +
1131 xyz[2] * TMath::Sin(rotationAngles[4]) * TMath::Sin(rotationAngles[5]);
1132
1133 xyzDummy[2] = xyz[0] * TMath::Cos(rotationAngles[0]) + xyz[1] * TMath::Cos(rotationAngles[2]) +
1134 xyz[2] * TMath::Cos(rotationAngles[4]);
1135
1136 for (Int_t ii = 0; ii < 3; ii++) {
1137 xyz[ii] = xyzDummy[ii];
1138 }
1139
1140 return;
1141}
1142
1143Int_t Geo::getIndexFromEquipment(Int_t icrate, Int_t islot, Int_t ichain, Int_t itdc)
1144{
1145 return 0; // to be implemented
1146}
1147
1148void Geo::getStripAndModule(Int_t iStripPerSM, Int_t& iplate, Int_t& istrip)
1149{
1150 //
1151 // Convert the serial number of the TOF strip number iStripPerSM [0,90]
1152 // in module number iplate [0,4] and strip number istrip [0,14/18].
1153 // Copied from AliRoot TOF::AliTOFGeometry
1154 //
1155
1156 if (iStripPerSM < 0 || iStripPerSM >= NSTRIPC + NSTRIPB + NSTRIPA + NSTRIPB + NSTRIPC) {
1157 iplate = -1;
1158 istrip = -1;
1159 } else if (iStripPerSM < NSTRIPC) {
1160 iplate = 0;
1161 istrip = iStripPerSM;
1162 } else if (iStripPerSM >= NSTRIPC && iStripPerSM < NSTRIPC + NSTRIPB) {
1163 iplate = 1;
1164 istrip = iStripPerSM - NSTRIPC;
1165 } else if (iStripPerSM >= NSTRIPC + NSTRIPB && iStripPerSM < NSTRIPC + NSTRIPB + NSTRIPA) {
1166 iplate = 2;
1167 istrip = iStripPerSM - NSTRIPC - NSTRIPB;
1168 } else if (iStripPerSM >= NSTRIPC + NSTRIPB + NSTRIPA && iStripPerSM < NSTRIPC + NSTRIPB + NSTRIPA + NSTRIPB) {
1169 iplate = 3;
1170 istrip = iStripPerSM - NSTRIPC - NSTRIPB - NSTRIPA;
1171 } else if (iStripPerSM >= NSTRIPC + NSTRIPB + NSTRIPA + NSTRIPB && iStripPerSM < NSTRIPC + NSTRIPB + NSTRIPA + NSTRIPB + NSTRIPC) {
1172 iplate = 4;
1173 istrip = iStripPerSM - NSTRIPC - NSTRIPB - NSTRIPA - NSTRIPB;
1174 }
1175}
General auxilliary methods.
Definition of the GeometryManager class.
int32_t i
uint16_t pos
Definition RawData.h:3
ClassImp(o2::tof::Geo)
TOF geo parameters (only statics)
Definition Geo.h:28
static constexpr Float_t RMAX
Definition Geo.h:134
static std::string getVolumePath(const Int_t *ind)
Definition Geo.cxx:444
static constexpr Float_t ZPAD
Definition Geo.h:141
static void getStripAndModule(Int_t iStripPerSM, Int_t &iplate, Int_t &istrip)
Definition Geo.cxx:1148
static constexpr Float_t PHISECINV
Definition Geo.h:148
static constexpr Float_t RMIN2
Definition Geo.h:136
static constexpr Float_t HFILIY
Definition Geo.h:328
static Float_t getGeoDistances(Int_t isector, Int_t iplate, Int_t istrip)
Definition Geo.h:84
static constexpr Float_t ROOF2PARAMETERS[3]
Definition Geo.h:316
static constexpr Float_t XPAD
Definition Geo.h:139
static constexpr Float_t LENGTHEXINMODBORDER
Definition Geo.h:289
static constexpr Int_t NSECTORS
Definition Geo.h:120
static constexpr Float_t XHALFSTRIP
Definition Geo.h:140
static constexpr Float_t HCPCBY
Definition Geo.h:330
static constexpr Float_t HGLASSY
Definition Geo.h:329
static Float_t getAngles(Int_t iplate, Int_t istrip)
Definition Geo.h:79
static constexpr Int_t NPADZ
Definition Geo.h:109
static constexpr Float_t HHONY
Definition Geo.h:325
static void InitIdeal()
Definition Geo.cxx:292
static constexpr Float_t DISTANCES[NPLATES][NMAXNSTRIP]
Definition Geo.h:233
static Int_t getIndexFromEquipment(Int_t icrate, Int_t islot, Int_t ichain, Int_t itdc)
Definition Geo.cxx:1143
static void rotateToSector(Float_t *xyz, Int_t isector)
Definition Geo.cxx:1028
static constexpr Float_t HPCBY
Definition Geo.h:326
static constexpr Float_t HRGLY
Definition Geo.h:327
static Int_t getStripNumberPerSM(Int_t iplate, Int_t istrip)
Definition Geo.cxx:593
static constexpr Int_t NSTRIPXSECTOR
Definition Geo.h:116
static constexpr Float_t NPADS_INV_INT
Definition Geo.h:111
static constexpr Float_t HEIGHTS[NPLATES][NMAXNSTRIP]
Definition Geo.h:221
static void translate(Float_t *xyz, Float_t translationVector[3])
Definition Geo.cxx:979
static constexpr Float_t INTERCENTRMODBORDER1
Definition Geo.h:253
static constexpr Int_t NPADS
Definition Geo.h:110
static void getPosInPadCoord(int ch, float *pos)
Definition Geo.cxx:699
static constexpr Int_t NSTRIPB
Definition Geo.h:113
static constexpr Int_t NSTRIPC
Definition Geo.h:114
static void Init()
Definition Geo.cxx:43
static void getPosInStripCoord(int ch, float *pos)
Definition Geo.cxx:692
static constexpr Int_t NSTRIPA
Definition Geo.h:112
static Float_t getGeoX(Int_t isector, Int_t iplate, Int_t istrip)
Definition Geo.h:83
static constexpr Float_t ZLENA
Definition Geo.h:128
static Float_t getGeoHeights(Int_t isector, Int_t iplate, Int_t istrip)
Definition Geo.h:82
static void getPos(Int_t *det, Float_t *pos)
Definition Geo.cxx:491
static void antiRotateToSector(Float_t *xyz, Int_t isector)
Definition Geo.cxx:1008
static void rotate(Float_t *xyz, Double_t rotationAngles[6])
Definition Geo.cxx:1082
static constexpr Float_t LENGTHINCEMODBORDERD
Definition Geo.h:285
static constexpr Float_t INTERCENTRMODBORDER2
Definition Geo.h:260
static constexpr Float_t MODULEWALLTHICKNESS
Definition Geo.h:252
static void getVolumeIndices(Int_t index, Int_t *detId)
Definition Geo.cxx:543
static constexpr Float_t RMIN
Definition Geo.h:133
static Int_t getIndex(const Int_t *detId)
Definition Geo.cxx:563
static constexpr Int_t NPLATES
Definition Geo.h:122
static void getDetID(Float_t *pos, Int_t *det)
Definition Geo.cxx:507
static void antiRotate(Float_t *xyz, Double_t rotationAngles[6])
Definition Geo.cxx:1113
static void getPadDxDyDz(const Float_t *pos, Int_t *det, Float_t *DeltaPos, int sector=-1)
Definition Geo.cxx:835
static void getPosInSectorCoord(int ch, float *pos)
Definition Geo.cxx:685
static constexpr Float_t NSTRIPXSECTOR_INV_INT
Definition Geo.h:117
static constexpr Float_t EXTERINTERMODBORDER1
Definition Geo.h:267
static constexpr Int_t NPADX
Definition Geo.h:107
static constexpr Float_t STRIPLENGTH
Definition Geo.h:142
static void antiRotateToStrip(Float_t *xyz, Int_t iplate, Int_t istrip, Int_t isector)
Definition Geo.cxx:1048
static constexpr Float_t EXTERINTERMODBORDER2
Definition Geo.h:274
static constexpr Float_t WCPCBZ
Definition Geo.h:334
static constexpr Float_t RMAX2
Definition Geo.h:137
static constexpr Float_t PHISEC
Definition Geo.h:147
static void InitIndices()
Definition Geo.cxx:401
static void rotateToStrip(Float_t *xyz, Int_t iplate, Int_t istrip, Int_t isector)
Definition Geo.cxx:1065
static constexpr Bool_t FEAWITHMASKS[NSECTORS]
Definition Geo.h:246
static constexpr Float_t ANGLES[NPLATES][NMAXNSTRIP]
Definition Geo.h:209
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint GLuint end
Definition glcorearb.h:469
GLuint index
Definition glcorearb.h:781
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
void check(const std::vector< std::string > &arguments, const std::vector< ConfigParamSpec > &workflowOptions, const std::vector< DeviceSpec > &deviceSpecs, CheckMatrix &matrix)
Enum< T >::Iterator begin(Enum< T >)
Definition Defs.h:173
value_T step
Definition TrackUtils.h:42
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"