]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PMD/AliPMDUtility.cxx
Adding the Backward-Forward correlation analysis (csoegaar)
[u/mrichter/AliRoot.git] / PMD / AliPMDUtility.cxx
... / ...
CommitLineData
1/***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15//-----------------------------------------------------//
16// //
17// //
18// Date : August 05 2003 //
19// //
20// Utility code for ALICE-PMD //
21// //
22//-----------------------------------------------------//
23
24#include "Riostream.h"
25#include "TMath.h"
26#include "TText.h"
27#include "TLine.h"
28#include <TClonesArray.h>
29
30#include <stdio.h>
31#include <math.h>
32
33#include "AliPMDUtility.h"
34#include "AliAlignObjMatrix.h"
35#include "AliCDBManager.h"
36#include "AliCDBEntry.h"
37#include "AliLog.h"
38
39
40ClassImp(AliPMDUtility)
41
42AliPMDUtility::AliPMDUtility():
43 fAlObj(GetAlignObj()),
44 fPx(0.),
45 fPy(0.),
46 fPz(0.),
47 fTheta(0.),
48 fEta(0.),
49 fPhi(0.),
50 fWriteModule(1)
51{
52 // Default constructor
53 for (Int_t i = 0; i < 4; i++)
54 {
55 for (Int_t j = 0; j < 3; j++)
56 {
57 fSecTr[i][j] = 0.;
58 }
59 }
60
61}
62
63AliPMDUtility::AliPMDUtility(Float_t px, Float_t py, Float_t pz):
64 fAlObj(GetAlignObj()),
65 fPx(px),
66 fPy(py),
67 fPz(pz),
68 fTheta(0.),
69 fEta(0.),
70 fPhi(0.),
71 fWriteModule(1)
72{
73 // Constructor
74 for (Int_t i = 0; i < 4; i++)
75 {
76 for (Int_t j = 0; j < 3; j++)
77 {
78 fSecTr[i][j] = 0.;
79 }
80 }
81
82}
83AliPMDUtility::AliPMDUtility(const AliPMDUtility &pmdutil):
84 TObject(pmdutil),
85 fAlObj(pmdutil.GetAlignObj()),
86 fPx(pmdutil.fPx),
87 fPy(pmdutil.fPy),
88 fPz(pmdutil.fPz),
89 fTheta(pmdutil.fTheta),
90 fEta(pmdutil.fEta),
91 fPhi(pmdutil.fPhi),
92 fWriteModule(pmdutil.fWriteModule)
93{
94 // copy constructor
95 for (Int_t i = 0; i < 4; i++)
96 {
97 for (Int_t j = 0; j < 3; j++)
98 {
99 fSecTr[i][j] = pmdutil.fSecTr[i][j];
100 }
101 }
102
103}
104AliPMDUtility & AliPMDUtility::operator=(const AliPMDUtility &pmdutil)
105{
106 // assignment operator
107 if(this != &pmdutil)
108 {
109 fPx = pmdutil.fPx;
110 fPy = pmdutil.fPy;
111 fPz = pmdutil.fPz;
112 fTheta = pmdutil.fTheta;
113 fEta = pmdutil.fEta;
114 fPhi = pmdutil.fPhi;
115 fWriteModule = pmdutil.fWriteModule;
116 for (Int_t i = 0; i < 4; i++)
117 {
118 for (Int_t j = 0; j < 3; j++)
119 {
120 fSecTr[i][j] = pmdutil.fSecTr[i][j];
121 }
122 }
123
124 }
125 return *this;
126}
127AliPMDUtility::~AliPMDUtility()
128{
129 // Default destructor
130}
131
132void AliPMDUtility::RectGeomCellPos(Int_t ism, Int_t xpad, Int_t ypad, Float_t &xpos, Float_t &ypos)
133{
134 // This routine finds the cell eta,phi for the new PMD rectangular
135 // geometry in ALICE
136 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
137 // modified by B. K. Nandi for change of coordinate sys
138 //
139 // SMA ---> Supermodule Type A ( SM - 0)
140 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
141 // SMB ---> Supermodule Type B ( SM - 2)
142 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
143 //
144 // ism : Serial module number from 0 to 23 for each plane
145
146
147 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
148
149 double xcorner[24] =
150 {
151 74.8833, 53.0045, 31.1255, //Type-A
152 74.8833, 53.0045, 31.1255, //Type-A
153 -74.8833, -53.0044, -31.1255, //Type-AR
154 -74.8833, -53.0044, -31.1255, //Type-AR
155 8.9165, -33.7471, //Type-B
156 8.9165, -33.7471, //Type-B
157 8.9165, -33.7471, //Type-B
158 -8.9165, 33.7471, //Type-BR
159 -8.9165, 33.7471, //Type-BR
160 -8.9165, 33.7471, //Type-BR
161 };
162
163
164 double ycorner[24] =
165 {
166 86.225, 86.225, 86.225, //Type-A
167 37.075, 37.075, 37.075, //Type-A
168 -86.225, -86.225, -86.225, //Type-AR
169 -37.075, -37.075, -37.075, //Type-AR
170 86.225, 86.225, //Type-B
171 61.075, 61.075, //Type-B
172 35.925, 35.925, //Type-B
173 -86.225, -86.225, //Type-BR
174 -61.075, -61.075, //Type-BR
175 -35.925, -35.925 //Type-BR
176 };
177
178
179 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
180 const Float_t kCellRadius = 0.25;
181
182 //
183 //Every even row of cells is shifted and placed
184 //in geant so this condition
185 //
186 Float_t cellRadius = 0.25;
187 Float_t shift = 0.0;
188 if(xpad%2 == 0)
189 {
190 shift = -cellRadius/2.0;
191 }
192 else
193 {
194 shift = 0.0;
195 }
196
197
198 if(ism < 6)
199 {
200 ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
201 xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
202 }
203 else if(ism >=6 && ism < 12)
204 {
205 ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
206 xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
207 }
208 else if(ism >= 12 && ism < 18)
209 {
210 ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
211 xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
212 }
213 else if(ism >= 18 && ism < 24)
214 {
215 ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
216 xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
217 }
218 // Apply the alignment here to the x, y values
219 if(ism < 6)
220 {
221 xpos += fSecTr[0][0];
222 ypos += fSecTr[0][1];
223 }
224 else if(ism >= 6 && ism < 12)
225 {
226 xpos += fSecTr[1][0];
227 ypos += fSecTr[1][1];
228 }
229 else if(ism >=12 && ism < 18)
230 {
231 xpos += fSecTr[2][0];
232 ypos += fSecTr[2][1];
233 }
234 else if(ism >= 18 && ism < 24)
235 {
236 xpos += fSecTr[3][0];
237 ypos += fSecTr[3][1];
238 }
239
240}
241// ----------------------------------------------------------
242void AliPMDUtility::RectGeomCellPos(Int_t ism, Float_t xpad, Float_t ypad, Float_t &xpos, Float_t &ypos)
243{
244 // If the xpad and ypad inputs are float, then 0.5 is added to it
245 // to find the layer which is shifted.
246 // This routine finds the cell eta,phi for the new PMD rectangular
247 // geometry in ALICE
248 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
249 // modified by B. K. Nnadi for change of coordinate sys
250 //
251 // SMA ---> Supermodule Type A ( SM - 0)
252 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
253 // SMB ---> Supermodule Type B ( SM - 2)
254 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
255 //
256 // ism : Serial Module number from 0 to 23 for each plane
257
258 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
259
260 double xcorner[24] =
261 {
262 74.8833, 53.0045, 31.1255, //Type-A
263 74.8833, 53.0045, 31.1255, //Type-A
264 -74.8833, -53.0044, -31.1255, //Type-AR
265 -74.8833, -53.0044, -31.1255, //Type-AR
266 8.9165, -33.7471, //Type-B
267 8.9165, -33.7471, //Type-B
268 8.9165, -33.7471, //Type-B
269 -8.9165, 33.7471, //Type-BR
270 -8.9165, 33.7471, //Type-BR
271 -8.9165, 33.7471, //Type-BR
272 };
273
274
275
276 double ycorner[24] =
277 {
278 86.225, 86.225, 86.225, //Type-A
279 37.075, 37.075, 37.075, //Type-A
280 -86.225, -86.225, -86.225, //Type-AR
281 -37.075, -37.075, -37.075, //Type-AR
282 86.225, 86.225, //Type-B
283 61.075, 61.075, //Type-B
284 35.925, 35.925, //Type-B
285 -86.225, -86.225, //Type-BR
286 -61.075, -61.075, //Type-BR
287 -35.925, -35.925 //Type-BR
288 };
289
290
291 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
292 const Float_t kCellRadius = 0.25;
293
294 //
295 //Every even row of cells is shifted and placed
296 //in geant so this condition
297 //
298 Float_t cellRadius = 0.25;
299 Float_t shift = 0.0;
300 Int_t iirow = (Int_t) (xpad+0.5);
301 if(iirow%2 == 0)
302 {
303 shift = -cellRadius/2.0;
304 }
305 else
306 {
307 shift = 0.0;
308 }
309
310 if(ism < 6)
311 {
312 ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
313 xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
314 }
315 else if(ism >=6 && ism < 12)
316 {
317 ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
318 xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
319 }
320 else if(ism >= 12 && ism < 18)
321 {
322 ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
323 xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
324 }
325 else if(ism >= 18 && ism < 24)
326 {
327 ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
328 xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
329 }
330
331 // Apply the alignment here to the x, y values
332 if(ism < 6)
333 {
334 xpos += fSecTr[0][0];
335 ypos += fSecTr[0][1];
336 }
337 else if(ism >= 6 && ism < 12)
338 {
339 xpos += fSecTr[1][0];
340 ypos += fSecTr[1][1];
341 }
342 else if(ism >=12 && ism < 18)
343 {
344 xpos += fSecTr[2][0];
345 ypos += fSecTr[2][1];
346 }
347 else if(ism >= 18 && ism < 24)
348 {
349 xpos += fSecTr[3][0];
350 ypos += fSecTr[3][1];
351 }
352
353}
354
355// -------------------------------------------------------- //
356
357void AliPMDUtility::RectGeomCellPos(Int_t ism, Float_t xpad,
358 Float_t ypad, Float_t &xpos,
359 Float_t &ypos, Float_t & zpos)
360{
361 // If the xpad and ypad inputs are float, then 0.5 is added to it
362 // to find the layer which is shifted.
363 // This routine finds the cell eta,phi for the new PMD rectangular
364 // geometry in ALICE
365 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
366 // modified by B. K. Nnadi for change of coordinate sys
367 //
368 // SMA ---> Supermodule Type A ( SM - 0)
369 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
370 // SMB ---> Supermodule Type B ( SM - 2)
371 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
372 //
373 // ism : Serial Module number from 0 to 23 for each plane
374
375 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
376
377 double xcorner[24] =
378 {
379 74.8833, 53.0045, 31.1255, //Type-A
380 74.8833, 53.0045, 31.1255, //Type-A
381 -74.8833, -53.0044, -31.1255, //Type-AR
382 -74.8833, -53.0044, -31.1255, //Type-AR
383 8.9165, -33.7471, //Type-B
384 8.9165, -33.7471, //Type-B
385 8.9165, -33.7471, //Type-B
386 -8.9165, 33.7471, //Type-BR
387 -8.9165, 33.7471, //Type-BR
388 -8.9165, 33.7471, //Type-BR
389 };
390
391
392
393 double ycorner[24] =
394 {
395 86.225, 86.225, 86.225, //Type-A
396 37.075, 37.075, 37.075, //Type-A
397 -86.225, -86.225, -86.225, //Type-AR
398 -37.075, -37.075, -37.075, //Type-AR
399 86.225, 86.225, //Type-B
400 61.075, 61.075, //Type-B
401 35.925, 35.925, //Type-B
402 -86.225, -86.225, //Type-BR
403 -61.075, -61.075, //Type-BR
404 -35.925, -35.925 //Type-BR
405 };
406
407
408 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
409 const Float_t kCellRadius = 0.25;
410
411 //
412 //Every even row of cells is shifted and placed
413 //in geant so this condition
414 //
415 Float_t cellRadius = 0.25;
416 Float_t shift = 0.0;
417 Int_t iirow = (Int_t) (xpad+0.5);
418 if(iirow%2 == 0)
419 {
420 shift = -cellRadius/2.0;
421 }
422 else
423 {
424 shift = 0.0;
425 }
426
427 if(ism < 6)
428 {
429 ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
430 xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
431 }
432 else if(ism >=6 && ism < 12)
433 {
434 ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
435 xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
436 }
437 else if(ism >= 12 && ism < 18)
438 {
439 ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
440 xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
441 }
442 else if(ism >= 18 && ism < 24)
443 {
444 ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
445 xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
446 }
447
448 // Apply the alignment here to the x, y, and z values
449 if(ism < 6)
450 {
451 xpos += fSecTr[0][0];
452 ypos += fSecTr[0][1];
453 zpos += fSecTr[0][2];
454 }
455 else if(ism >= 6 && ism < 12)
456 {
457 xpos += fSecTr[1][0];
458 ypos += fSecTr[1][1];
459 zpos += fSecTr[1][2];
460 }
461 else if(ism >=12 && ism < 18)
462 {
463 xpos += fSecTr[2][0];
464 ypos += fSecTr[2][1];
465 zpos += fSecTr[2][2];
466 }
467 else if(ism >= 18 && ism < 24)
468 {
469 xpos += fSecTr[3][0];
470 ypos += fSecTr[3][1];
471 zpos += fSecTr[3][2];
472 }
473
474
475
476}
477// -------------------------------------------------------- //
478
479void AliPMDUtility::GenerateBoundaryPoints(Int_t ism, Float_t &x1ism,
480 Float_t &y1ism, Float_t &x2ism,
481 Float_t &y2ism)
482{
483 // Generate bounding-box.
484
485
486 Float_t xism = 0, yism = 0;
487 Float_t dxism = 0., dyism = 0.;
488
489 const Float_t kRad = 0.25;
490 const Float_t kSqRoot3 = 1.732050808;
491 const Float_t kDia = 0.50;
492
493
494 const Double_t kXcorner[24] =
495 {
496 74.8833, 53.0045, 31.1255, //Type-A
497 74.8833, 53.0045, 31.1255, //Type-A
498 -74.8833, -53.0044, -31.1255, //Type-AR
499 -74.8833, -53.0044, -31.1255, //Type-AR
500 8.9165, -33.7471, //Type-B
501 8.9165, -33.7471, //Type-B
502 8.9165, -33.7471, //Type-B
503 -8.9165, 33.7471, //Type-BR
504 -8.9165, 33.7471, //Type-BR
505 -8.9165, 33.7471, //Type-BR
506 };
507
508
509 const Double_t kYcorner[24] =
510 {
511 86.225, 86.225, 86.225, //Type-A
512 37.075, 37.075, 37.075, //Type-A
513 -86.225, -86.225, -86.225, //Type-AR
514 -37.075, -37.075, -37.075, //Type-AR
515 86.225, 86.225, //Type-B
516 61.075, 61.075, //Type-B
517 35.925, 35.925, //Type-B
518 -86.225, -86.225, //Type-BR
519 -61.075, -61.075, //Type-BR
520 -35.925, -35.925 //Type-BR
521 };
522
523
524 if (ism > 23) ism -= 24;
525
526
527 if (ism < 6)
528 {
529 xism = kXcorner[ism] + kRad;
530 yism = kYcorner[ism] + kRad;
531 dxism = -kRad*kSqRoot3*48.;
532 dyism = -kDia*96. - kRad;
533 }
534 if (ism >= 6 && ism < 12)
535 {
536 xism = kXcorner[ism] - kRad;
537 yism = kYcorner[ism] - kRad;
538 dxism = kRad*kSqRoot3*48.;
539 dyism = kDia*96. + kRad;
540 }
541 if (ism >= 12 && ism < 18)
542 {
543 xism = kXcorner[ism] + kRad;
544 yism = kYcorner[ism] + kRad;
545 dxism = -kRad*kSqRoot3*96.;
546 dyism = -kDia*48. - kRad;
547 }
548 if (ism >= 18 && ism < 24)
549 {
550 xism = kXcorner[ism] - kRad;
551 yism = kYcorner[ism] - kRad;
552 dxism = kRad*kSqRoot3*96.;
553 dyism = kDia*48. + kRad;
554 }
555
556 x1ism = xism;
557 x2ism = xism + dxism;
558 y1ism = yism;
559 y2ism = yism + dyism;
560
561}
562// ------------------------------------------------------------------- //
563
564void AliPMDUtility::DrawPMDModule(Int_t idet)
565{
566
567 Float_t x1ism, x2ism, y1ism, y2ism;
568 Float_t deltaX, deltaY;
569
570 //TH2F *h2 = new TH2F("h2","Y vs. X",200,-100.,100.,200,-100.,100.);
571 //h2->Draw();
572
573 TLine t;
574 t.SetLineColor(2);
575
576 TText tt;
577 tt.SetTextColor(4);
578
579 Char_t smnumber[10];
580
581 for(Int_t ism=0; ism < 24; ism++)
582 {
583 GenerateBoundaryPoints(ism, x1ism, y1ism, x2ism, y2ism);
584 deltaX = (x2ism - x1ism)/2.;
585 deltaY = (y2ism - y1ism)/2.;
586 if (fWriteModule == 1)
587 {
588 if(idet == 0)
589 {
590 sprintf(smnumber,"%d",ism);
591 }
592 else if (idet == 1)
593 {
594 sprintf(smnumber,"%d",24+ism);
595 }
596 tt.DrawText(x1ism+deltaX,y1ism+deltaY,smnumber);
597 }
598 t.DrawLine(x1ism, y1ism, x1ism, y2ism);
599 t.DrawLine(x1ism, y1ism, x2ism, y1ism);
600 t.DrawLine(x2ism, y1ism, x2ism, y2ism);
601 t.DrawLine(x1ism, y2ism, x2ism, y2ism);
602 }
603
604}
605
606// ------------------------------------------------------------------- //
607
608
609void AliPMDUtility::ApplyVertexCorrection(Float_t vertex[], Float_t xpos,
610 Float_t ypos, Float_t zpos)
611{
612 // Not implemented
613 fPx = xpos - vertex[0];
614 fPy = ypos - vertex[1];
615 fPz = zpos - vertex[2];
616}
617void AliPMDUtility::ApplyAlignment()
618{
619 // Get the alignment stuff here
620
621 AliAlignObjMatrix * aam;
622 Double_t tr[3];
623 //Double_t secTr[4][3];
624
625 for (Int_t isector=0; isector<4; isector++)
626 {
627 aam = (AliAlignObjMatrix*)fAlObj->UncheckedAt(isector);
628 aam->GetTranslation(tr);
629
630 for(Int_t ixyz=0; ixyz < 3; ixyz++)
631 {
632 fSecTr[isector][ixyz] = (Float_t) tr[ixyz];
633 }
634 }
635}
636
637void AliPMDUtility::SetPxPyPz(Float_t px, Float_t py, Float_t pz)
638{
639 fPx = px;
640 fPy = py;
641 fPz = pz;
642}
643
644void AliPMDUtility::SetXYZ(Float_t xpos, Float_t ypos, Float_t zpos)
645{
646 fPx = xpos;
647 fPy = ypos;
648 fPz = zpos;
649}
650void AliPMDUtility::SetWriteModule(Int_t wrmod)
651{
652 fWriteModule = wrmod;
653}
654void AliPMDUtility::CalculateEta()
655{
656 Float_t rpxpy, theta, eta;
657
658 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
659 theta = TMath::ATan2(rpxpy,fPz);
660 eta = -TMath::Log(TMath::Tan(0.5*theta));
661 fTheta = theta;
662 fEta = eta;
663}
664void AliPMDUtility::CalculatePhi()
665{
666 Float_t pybypx, phi = 0., phi1;
667
668 if(fPx==0)
669 {
670 if(fPy>0) phi = 90.;
671 if(fPy<0) phi = 270.;
672 }
673 if(fPx != 0)
674 {
675 pybypx = fPy/fPx;
676 if(pybypx < 0) pybypx = - pybypx;
677 phi1 = TMath::ATan(pybypx)*180./3.14159;
678
679 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
680 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
681 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
682 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
683
684 }
685 phi = phi*3.14159/180.;
686
687 fPhi = phi;
688
689}
690void AliPMDUtility::CalculateEtaPhi()
691{
692 Float_t rpxpy, theta, eta;
693 Float_t pybypx, phi = 0., phi1;
694
695 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
696 theta = TMath::ATan2(rpxpy,fPz);
697 eta = -TMath::Log(TMath::Tan(0.5*theta));
698
699 if(fPx == 0)
700 {
701 if(fPy>0) phi = 90.;
702 if(fPy<0) phi = 270.;
703 }
704 if(fPx != 0)
705 {
706 pybypx = fPy/fPx;
707 if(pybypx < 0) pybypx = - pybypx;
708 phi1 = TMath::ATan(pybypx)*180./3.14159;
709 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
710 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
711 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
712 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
713
714 }
715 phi = phi*3.14159/180.;
716
717 fTheta = theta;
718 fEta = eta;
719 fPhi = phi;
720}
721void AliPMDUtility::CalculateXY(Float_t eta, Float_t phi, Float_t zpos)
722{
723 // Not implemented
724
725 // eta = -TMath::Log(TMath::Tan(0.5*theta));
726
727 Float_t xpos = 0., ypos = 0.;
728
729 // Float_t theta = 2.0*TMath::ATan(TMath::Log(-eta));
730
731 fEta = eta;
732 fPhi = phi;
733 fPx = xpos;
734 fPy = ypos;
735 fPz = zpos;
736}
737Float_t AliPMDUtility::GetTheta() const
738{
739 return fTheta;
740}
741Float_t AliPMDUtility::GetEta() const
742{
743 return fEta;
744}
745Float_t AliPMDUtility::GetPhi() const
746{
747 return fPhi;
748}
749Float_t AliPMDUtility::GetX() const
750{
751 return fPx;
752}
753Float_t AliPMDUtility::GetY() const
754{
755 return fPy;
756}
757Float_t AliPMDUtility::GetZ() const
758{
759 return fPz;
760}
761//--------------------------------------------------------------------//
762TClonesArray* AliPMDUtility::GetAlignObj() const
763{
764 // The run number will be centralized in AliCDBManager,
765 // you don't need to set it here!
766 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Align/Data");
767
768 if(!entry) AliFatal("Alignment object retrieval failed!");
769
770 TClonesArray *alobj = 0;
771 if (entry) alobj = (TClonesArray*) entry->GetObject();
772
773 if (!alobj) AliFatal("No alignment data from database !");
774
775 return alobj;
776}
777
778