8 #include "AliITSglobalRecPoint.h"
11 ClassImp(AliITSglobalRecPoint)
15 AliITSglobalRecPoint::AliITSglobalRecPoint()
17 // Default constructor:
18 // sets to zero all members
25 fR2 = fR3 = fPhi = fTheta = 0.0;
27 fLabel[0] = fLabel[1] = fLabel[2] = -1;
38 AliITSglobalRecPoint::AliITSglobalRecPoint(Double_t gx, Double_t gy,
39 Double_t gz, Double_t gsx, Double_t gsy, Double_t gsz, Int_t l) :
40 fGX(gx), fGY(gy), fGZ(gz), fGSX(gsx), fGSY(gsy), fGSZ(gsz), fLayer(l)
42 fR2 = TMath::Sqrt(fGX*fGX + fGY*fGY);
43 fR3 = TMath::Sqrt(fGX*fGX + fGY*fGY + fGZ*fGZ);
44 fPhi = TMath::ATan2(fGY, fGX);
45 if (fPhi < 0.0) fPhi = 2.0 * TMath::Pi() + fPhi;
46 fTheta = TMath::ATan2(fR2, fGZ);
48 fLabel[0] = fLabel[1] = fLabel[2] = -1;
58 Double_t AliITSglobalRecPoint::GetGlobalSigmaR2()
60 // Square sigma of the 2-D radius:
61 // = X^2 * Sx^2 + Y^2 * Sy^2
63 Double_t answer = fGX*fGX*fGSigmaX + fGY*fGY*fGSigmaY;
64 return answer / (fR2 * fR2);
69 Double_t AliITSglobalRecPoint::GetGlobalSigmaR3()
71 // Square sigma of the 3-D radius:
72 // = (X^2 * Sx^2 + Y^2 * Sy^2 + Z^2 * Sz^2) / R^2
75 Double_t answer = fGX*fGX*fGSigmaX + fGY*fGY*fGSigmaY + fGZ*fGZ*fGSigmaZ;
76 return answer / (fR3 * fR3);
81 Double_t AliITSglobalRecPoint::GetGlobalSigmaTheta()
83 // Square sigma of theta:
84 // = (Z^2 * (X^2 * Sx^2 + Y^2 * Sy^2) + r^4 * Sz^2) / (R^4 * r^2)
87 Double_t answer = fGZ*fGZ*(fGX*fGX*fGSigmaX + fGY*fGY*fGSigmaY) + fR2*fR2*fR2*fR2*fGSigmaZ;
88 return answer / (fR3*fR3*fR3*fR3*fR2*fR2);
93 Double_t AliITSglobalRecPoint::GetGlobalSigmaPhi()
95 // Square sigma of phi:
96 // = (Y^2 * Sx^2 + X^2 * Sy^2) / r^4
99 Double_t answer = fGY*fGY*fGSigmaX + fGX*fGX*fGSigmaY;
100 return answer / (fR2 * fR2 * fR2 * fR2);
105 Bool_t AliITSglobalRecPoint::SharesID(AliITSRecPoint* pt)
107 // Controls if there is a track index shared by two points
111 for (i = 0; i < 3; i++) {
112 if (fTracks[i] < 0) continue;
113 for (j = 0; j < 3; j++) {
114 if (pt->fTracks[j] < 0) continue;
115 ok = ok || (fTracks[i] == pt->fTracks[j]);
123 Double_t AliITSglobalRecPoint::DPhi(AliITSglobalRecPoint *p)
125 // Absolute value of the difference
126 // between 'phi' coordinates of two points
127 // controlled in order to avoid that, for
128 // reasons of initial values, it come > 180. degrees
130 Double_t phi = TMath::Abs(fPhi - p->fPhi);
131 if (phi > TMath::Pi())
132 phi = 2.0 * TMath::Pi() - phi;
138 Double_t AliITSglobalRecPoint::DTheta(AliITSglobalRecPoint *p)
140 // Absolute value of the difference
141 // between 'theta' coordinates of two points
143 return TMath::Abs(fTheta - p->fTheta);
148 Int_t AliITSglobalRecPoint::Compare(const TObject *O) const
150 // Criterion for sorting:
151 // p1 < p2 if p1.phi < p2.phi;
153 // Casting to convert the given argument to rec-point
154 AliITSglobalRecPoint *you = (AliITSglobalRecPoint*)O;
157 if (fLayer < you->fLayer)
159 else if (fLayer > you->fLayer)
162 if (fPhi < you->fPhi)
164 else if (fPhi > you->fPhi)