]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added test script
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Apr 2008 22:49:55 +0000 (22:49 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Apr 2008 22:49:55 +0000 (22:49 +0000)
FMD/scripts/ShowCoordinates.C [new file with mode: 0644]

diff --git a/FMD/scripts/ShowCoordinates.C b/FMD/scripts/ShowCoordinates.C
new file mode 100644 (file)
index 0000000..ff8f628
--- /dev/null
@@ -0,0 +1,50 @@
+#include <iomanip>
+
+void
+PhysicalCoordinates(UShort_t det, Char_t rng, UShort_t sec, UShort_t str)
+{
+  Double_t x, y, z;
+  AliFMDGeometry::Instance()->Detector2XYZ(det, rng, sec, str, x, y, z);
+  Double_t phi   = TMath::ATan2(y, x);
+  Double_t r     = TMath::Sqrt(x * x + y * y);
+  Double_t theta = TMath::ATan2(z, r);
+  Double_t eta   = -TMath::Log(TMath::Tan(theta / 2));
+  Double_t deg   = 180. / TMath::Pi();
+  
+  std::cout << det << rng << "[" 
+           << std::setw(2) << sec << "," 
+           << std::setw(3) << str << "] | "
+           << std::setw(9) << x << "," 
+           << std::setw(9) << y << "," 
+           << std::setw(9) << z << " | " 
+           << std::setw(9) << phi * deg << "," 
+           << std::setw(9) << theta * deg << "," 
+           << std::setw(9) << eta << std::endl;
+}
+void
+ShowCoordinates()
+{
+  AliFMDGeometry::Instance()->Init();
+  AliFMDGeometry::Instance()->InitTransformations();
+  std::cout << std::setw(1+1+1+2+1+3+1) << "Detector" << " | " 
+           << std::setw(9+1+9+1+9) << "Cartisian Coords" << " | " 
+           << std::setw(9+1+9+1+9) << "phi,theta,eta" << "\n"
+           << std::setfill('-') 
+           << std::setw(1+1+1+2+1+3+1+1+1)  << "+"
+           << std::setw(1+9+1+9+1+9+1+1)  << "+"
+           << std::setw(1+9+1+9+1+9+1+1)  << "+" 
+           << std::setfill(' ') << std::endl;
+  for (UShort_t d = 1; d < 3; d++) {
+    UShort_t nrng = (d == 1 ? 1 : 2);
+    for (UShort_t ir = 0; ir < nrng; ir++) { 
+      Char_t r = (ir == 0 ? 'I' : 'O');
+      UShort_t nsec = (r == 'I' ?  20 :  40);
+      UShort_t nstr = 1; // (r == 'I' ? 512 : 256);
+      for (UShort_t s = 0; s < nsec; s++) { 
+       for (UShort_t t = 0; t < nstr; t++) {
+         PhysicalCoordinates(d, r, s, t);
+       }
+      }
+    }
+  }
+}