3 #ifndef ALITKETAPHIVECTOR_H
4 #define ALITKETAPHIVECTOR_H
8 class AliTkEtaPhiVector {
9 // simple class to store a vector in eta-phi space
10 // some subroutines to calculate distance to another vector
12 AliTkEtaPhiVector() {fX = -9999; fY = -9999;}
13 AliTkEtaPhiVector(Double_t x0, Double_t y0) {fX = x0; fY = y0; }
14 AliTkEtaPhiVector(const AliTkEtaPhiVector& v) {fX=v.Eta(); fY=v.Phi();}
16 Double_t Eta() const {return fX;}
17 Double_t Phi() const {return fY;}
19 void setEta(Float_t eta) {fX = eta;}
20 void setPhi(Float_t phi) {fY = phi;}
21 void setVector(Float_t eta, Float_t phi) {
26 // returns the square difference between the vectors in phi
27 Double_t phiDiffSq(AliTkEtaPhiVector& other)
29 Double_t phiDiff = TMath::Abs(fY-other.Phi());
30 if(phiDiff>TMath::Pi()) phiDiff=2*TMath::Pi()-phiDiff;
31 return phiDiff*phiDiff;
33 // returns the difference between this vector and the other in phi
34 Double_t phiDiff(AliTkEtaPhiVector& other)
36 Double_t phiDiff = TMath::Abs(fY-other.Phi());
37 if(phiDiff>TMath::Pi()) phiDiff=2*TMath::Pi()-phiDiff;
40 // returns the difference between the vectors in eta
41 Double_t etaDiff(AliTkEtaPhiVector& other)
42 {return (fX - other.Eta());}
43 // returns the square of the difference between the vectors in eta
44 Double_t etaDiffSq(AliTkEtaPhiVector& other)
45 {return (fX - other.Eta())*(fX - other.Eta());}
46 // returns the difference between the vectors in eta-phi
47 Double_t diff(AliTkEtaPhiVector& other)
48 {return sqrt(diffSq(other));}
49 // returns the square of the difference between the vectors in eta-phi
50 Double_t diffSq(AliTkEtaPhiVector& other)
51 {return (etaDiffSq(other) + phiDiffSq(other));}
58 ostream& operator<<(ostream& s, const AliTkEtaPhiVector& v);