AliPhysics  9c66e61 (9c66e61)
TestGeomUtils.C
Go to the documentation of this file.
1 void
3  const char* what,
4  Double_t fromGeom, Double_t fromUtil, UShort_t type=0,
5  Double_t eps=1e-4)
6 {
7  if (TMath::Abs(fromGeom-fromUtil) < eps) return;
8  Double_t c = 1;
9  if (type==1) c = TMath::RadToDeg();
10  Double_t g = c * fromGeom;
11  Double_t u = c * fromUtil;
12  Printf(" FMD%d%c[%2d,%3d]: %20s G:%10.4f U:%10.4f -> D:%10.4f > %g %s",
13  d, r, s, t, what, g, u, (g-u), eps,
14  type==0 ? "" : type==1 ? "[degrees]" : "[cm]" );
15 }
16 void
17 TestGeomUtils(Bool_t init=false, ULong_t run=138190)
18 {
19  if (!gROOT->GetGlobal("gGeoManager")) init = true;
20  AliCDBManager* cdb = AliCDBManager::Instance();
21  if (init) {
22  cdb->SetDefaultStorageFromRun(run);
23  cdb->SetRun(run);
24  AliGeomManager::LoadGeometry();
25  AliGeomManager::ApplyAlignObjsFromCDB("FMD");
26  }
27  AliFMDGeometry* fmd = AliFMDGeometry::Instance();
28  if (init) {
29  fmd->Init();
30  fmd->InitTransformations();
31  }
32 
33  TVector3 ip(0,0,0);
34  for (UShort_t d = 1; d <= 3; d++) {
35  Printf("FMD%d", d);
36  Int_t nQ = (d == 1 ? 1 : 2);
37  for (UShort_t q=0; q<nQ; q++) {
38  char r = (q == 0 ? 'I' : 'O');
39  UShort_t nSec = (q == 0 ? 20 : 40);
40  UShort_t nStr = (q == 0 ? 512 : 256);
41  printf(" FMD%d%c ", d, r);
42  for (UShort_t s = 0; s < nSec; s++) {
43  printf(".");
44  for (UShort_t t = 0; t < nStr; t++) {
45  UShort_t m = (t % 4);
46  Char_t c = (m == 0 ? '/' : m == 1 ? '-' : m == 2 ? '\\' : '|');
47  printf("%c\b", c);
48  Double_t x, y, z;
49  fmd->Detector2XYZ(d, r, s, t, x, y, z);
50 
51  TVector3 pos;
52  AliForwardUtil::GetXYZ(d, r, s, t, ip, pos);
53  // tolerance set to 1/2 mm for X,Y
54  Double_t tolXY = 5e-2;
55  Compare(d, r, s, t, "X", x, pos.X(), 2, tolXY);
56  Compare(d, r, s, t, "Y", y, pos.Y(), 2, tolXY);
57  Compare(d, r, s, t, "Z", z, pos.Z(), 2);
58 
59  Double_t gRadius, gEta, gPhi, gTheta;
60  fmd->XYZ2REtaPhiTheta(x,y,z,gRadius,gEta,gPhi,gTheta);
61  // if (gPhi < 0) gPhi += TMath::TwoPi();
62 
63  Double_t uEta, uPhi;
64  AliForwardUtil::GetEtaPhi(d, r, s, t, ip, uEta, uPhi);
65  // Tolerance for eta set to 0.01
66  Double_t tolEta = 0.01;
67  Compare(d,r,s,t,"eta",gEta, uEta, 0, tolEta);
68  Compare(d,r,s,t,"phi",gPhi, uPhi, 1);
69  } // for t
70  } // for s
71  Printf("");
72  }
73  }
74 }
double Double_t
Definition: External.C:58
static Bool_t GetEtaPhi(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, const TVector3 &ip, Double_t &eta, Double_t &phi)
void Compare(UShort_t d, Char_t r, UShort_t s, UShort_t t, const char *what, Double_t fromGeom, Double_t fromUtil, UShort_t type=0, Double_t eps=1e-4)
Definition: TestGeomUtils.C:2
char Char_t
Definition: External.C:18
TCanvas * c
Definition: TestFitELoss.C:172
static Bool_t GetXYZ(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, const TVector3 &ip, TVector3 &pos)
void TestGeomUtils(Bool_t init=false, ULong_t run=138190)
Definition: TestGeomUtils.C:17
int Int_t
Definition: External.C:63
unsigned long ULong_t
Definition: External.C:38
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53