AliPhysics  914d8ff (914d8ff)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestEtaPhi.C
Go to the documentation of this file.
1 class TCanvas;
2 
4 {
5  TH1* h = new TH1D(Form("fmd%d%c", d, r),
6  Form("FMD%d%c", d, r),
7  200, -4, 6);
8  Color_t col = ((d == 1 ? kRed+2 :
9  d == 2 ? kGreen+(r == 'I'?2:-2) :
10  kBlue+(r == 'I'?2:-2)));
11  // (r == 'I' || r == 'i') ? -2 : +2);
12  h->SetDirectory(0);
13  h->SetXTitle("#eta");
14  h->SetYTitle("");
15  h->SetFillColor(col);
16  h->SetLineColor(col);
17  h->SetMarkerColor(col);
18  h->SetMarkerStyle(19+d);
19  h->Sumw2();
20  return h;
21 }
22 
23 void Event(const TVector3& ip, TList* list, Bool_t fake)
24 {
25  for (UShort_t d = 1; d <= 3+(fake?1:0); d++) {
26  // Printf("FMD%d", d);
27  Int_t nQ = (d == 1 ? 1 : 2);
28  for (UShort_t q=0; q<nQ; q++) {
29  char r = (q == 0 ? 'i' : 'o');
30  UShort_t nSec = (q == 0 ? 20 : 40);
31  UShort_t nStr = (q == 0 ? 512 : 256);
32  UShort_t idx = (d-1)*2-(1-q)+(d==1?1:0);
33  TH1* h = static_cast<TH1*>(list->At(idx));
34  if (!h) {
35  h = Make(d,r);
36  Info("", "Adding %s @ %d", h->GetName(), idx);
37  list->AddAt(h, idx);
38  }
39  // Info("", "Got histogram %p", h);
40  // printf(" FMD%d%c ", d, r);
41  for (UShort_t s = 0; s < nSec; s++) {
42  // printf(".");
43  for (UShort_t t = 0; t < nStr; t++) {
44  // UShort_t m = (t % 4);
45  // Char_t c = (m == 0 ? '/' : m == 1 ? '-' : m == 2 ? '\\' : '|');
46  // printf("%c\b", c);
47  // Double_t x, y, z;
48  // fmd->Detector2XYZ(d, r, s, t, x, y, z);
49 
50  // TVector3 pos;
51  // AliForwardUtil::GetXYZ(d, r, s, t, ip, pos);
52  // tolerance set to 1/2 mm for X,Y
53  // Double_t tolXY = 5e-2;
54  // Compare(d, r, s, t, "X", x, pos.X(), 2, tolXY);
55  // Compare(d, r, s, t, "Y", y, pos.Y(), 2, tolXY);
56  // Compare(d, r, s, t, "Z", z, pos.Z(), 2);
57 
58  // Double_t gRadius, gEta, gPhi, gTheta;
59  // fmd->XYZ2REtaPhiTheta(x,y,z,gRadius,gEta,gPhi,gTheta);
60  // if (gPhi < 0) gPhi += TMath::TwoPi();
61 
62  Double_t uEta, uPhi;
63  AliForwardUtil::GetEtaPhi(d, r, s, t, ip, uEta, uPhi);
64  h->Fill(uEta);
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 }
75 
76 void TestEtaPhi()
77 {
78 
79  TList list;
80  Int_t nEv = 500;
81  Double_t mean = .5;
82  Double_t var = 4;
83  Int_t iEv = 0;
84 
85  do {
86  Double_t ipZ = gRandom->Gaus(mean, var);
87  if (TMath::Abs(ipZ) > 10) continue;
88  if (iEv != 0 && (iEv % 100 == 0)) Printf("Event # %4d", iEv);
89  // Info("", "Event %d ipZ=%f", iEv, ipZ);
90  Double_t ipX = gRandom->Gaus(.1, .003);
91  Double_t ipY = gRandom->Gaus(.33, .003);
92  TVector3 ip(ipX, ipY, ipZ);
93  Event(ip, &list, false);
94  iEv++;
95  } while (iEv < nEv);
96 
97  THStack* stack = new THStack("stack","");
98  TIter next(&list);
99  TH1* hist = 0;
100  while ((hist = static_cast<TH1*>(next())))
101  stack->Add(hist);
102  stack->Draw("nostack p");
103 
104 }
double Double_t
Definition: External.C:58
void Event(const TVector3 &ip, TList *list, Bool_t fake)
Definition: TestEtaPhi.C:23
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)
char Char_t
Definition: External.C:18
TList * list
TRandom * gRandom
int Int_t
Definition: External.C:63
void TestEtaPhi()
Definition: TestEtaPhi.C:76
Definition: External.C:212
TH1 * Make(UShort_t d, Char_t r)
Definition: TestEtaPhi.C:3
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
Definition: External.C:196