]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/ShowCoordinates.C
Fixes for Coverity + changes to take into account the improvements of the analysis...
[u/mrichter/AliRoot.git] / FMD / scripts / ShowCoordinates.C
1 #include <iomanip>
2
3 void
4 PhysicalCoordinates(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(r, z);
11   if (theta < 0) theta += TMath::Pi();
12   Double_t eta   = -TMath::Log(TMath::Tan(theta / 2));
13   Double_t deg   = 180. / TMath::Pi();
14   
15   std::cout << det << rng << "[" 
16             << std::setw(2) << sec << "," 
17             << std::setw(3) << str << "] | "
18             << std::setw(9) << x << "," 
19             << std::setw(9) << y << "," 
20             << std::setw(9) << z << " | " 
21             << std::setw(9) << phi * deg << "," 
22             << std::setw(9) << theta * deg << "," 
23             << std::setw(9) << eta << std::endl;
24 }
25 void
26 ShowCoordinates()
27 {
28   AliFMDGeometry::Instance()->Init();
29   AliFMDGeometry::Instance()->InitTransformations();
30   std::cout << std::setw(1+1+1+2+1+3+1) << "Detector" << " | " 
31             << std::setw(9+1+9+1+9) << "Cartisian Coords" << " | " 
32             << std::setw(9+1+9+1+9) << "phi,theta,eta" << "\n"
33             << std::setfill('-') 
34             << std::setw(1+1+1+2+1+3+1+1+1)  << "+"
35             << std::setw(1+9+1+9+1+9+1+1)  << "+"
36             << std::setw(1+9+1+9+1+9+1+1)  << "+" 
37             << std::setfill(' ') << std::endl;
38   for (UShort_t d = 1; d <= 3; d++) {
39     UShort_t nrng = (d == 1 ? 1 : 2);
40     for (UShort_t ir = 0; ir < nrng; ir++) { 
41       Char_t r = (ir == 0 ? 'I' : 'O');
42       UShort_t nsec = (r == 'I' ?  20 :  40);
43       UShort_t nstr = 1; // (r == 'I' ? 512 : 256);
44       for (UShort_t s = 0; s < nsec; s++) { 
45         for (UShort_t t = 0; t < nstr; t++) {
46           PhysicalCoordinates(d, r, s, t);
47         }
48       }
49     }
50   }
51 }