]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/ShowCoordinates.C
Bug fix: corrected file name (Levente)
[u/mrichter/AliRoot.git] / FMD / scripts / ShowCoordinates.C
CommitLineData
455b494f 1#include <iomanip>
2
3void
4PhysicalCoordinates(UShort_t det, Char_t rng, UShort_t sec, UShort_t str)
5{
6 Double_t x, y, z;
7 AliFMDGeometry::Instance()->Detector2XYZ(det, rng, sec, str, x, y, z);
8 Double_t phi = TMath::ATan2(y, x);
9 Double_t r = TMath::Sqrt(x * x + y * y);
10 Double_t theta = TMath::ATan2(z, r);
11 Double_t eta = -TMath::Log(TMath::Tan(theta / 2));
12 Double_t deg = 180. / TMath::Pi();
13
14 std::cout << det << rng << "["
15 << std::setw(2) << sec << ","
16 << std::setw(3) << str << "] | "
17 << std::setw(9) << x << ","
18 << std::setw(9) << y << ","
19 << std::setw(9) << z << " | "
20 << std::setw(9) << phi * deg << ","
21 << std::setw(9) << theta * deg << ","
22 << std::setw(9) << eta << std::endl;
23}
24void
25ShowCoordinates()
26{
27 AliFMDGeometry::Instance()->Init();
28 AliFMDGeometry::Instance()->InitTransformations();
29 std::cout << std::setw(1+1+1+2+1+3+1) << "Detector" << " | "
30 << std::setw(9+1+9+1+9) << "Cartisian Coords" << " | "
31 << std::setw(9+1+9+1+9) << "phi,theta,eta" << "\n"
32 << std::setfill('-')
33 << std::setw(1+1+1+2+1+3+1+1+1) << "+"
34 << std::setw(1+9+1+9+1+9+1+1) << "+"
35 << std::setw(1+9+1+9+1+9+1+1) << "+"
36 << std::setfill(' ') << std::endl;
37 for (UShort_t d = 1; d < 3; d++) {
38 UShort_t nrng = (d == 1 ? 1 : 2);
39 for (UShort_t ir = 0; ir < nrng; ir++) {
40 Char_t r = (ir == 0 ? 'I' : 'O');
41 UShort_t nsec = (r == 'I' ? 20 : 40);
42 UShort_t nstr = 1; // (r == 'I' ? 512 : 256);
43 for (UShort_t s = 0; s < nsec; s++) {
44 for (UShort_t t = 0; t < nstr; t++) {
45 PhysicalCoordinates(d, r, s, t);
46 }
47 }
48 }
49 }
50}