]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliTkEtaPhiVector.h
Temporary reverting the changes introduced earlier to store the TGeo geometry. New...
[u/mrichter/AliRoot.git] / JETAN / AliTkEtaPhiVector.h
CommitLineData
b9a6a391 1// $Id$
2
3#ifndef ALITKETAPHIVECTOR_H
4#define ALITKETAPHIVECTOR_H
5
6#include <Riostream.h>
7
8class AliTkEtaPhiVector {
9 // simple class to store a vector in eta-phi space
10 // some subroutines to calculate distance to another vector
11 public:
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();}
15
16 Double_t Eta() const {return fX;}
17 Double_t Phi() const {return fY;}
18
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) {
22 fX =eta;
23 fY = phi;
24 }
25
26 // returns the square difference between the vectors in phi
27 Double_t phiDiffSq(AliTkEtaPhiVector& other)
28 {
29 Double_t phiDiff = TMath::Abs(fY-other.Phi());
30 if(phiDiff>TMath::Pi()) phiDiff=2*TMath::Pi()-phiDiff;
31 return phiDiff*phiDiff;
32 }
33 // returns the difference between this vector and the other in phi
34 Double_t phiDiff(AliTkEtaPhiVector& other)
35 {
36 Double_t phiDiff = TMath::Abs(fY-other.Phi());
37 if(phiDiff>TMath::Pi()) phiDiff=2*TMath::Pi()-phiDiff;
38 return phiDiff;
39 }
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));}
52
53 private:
54 Double_t fX;
55 Double_t fY;
56};
57
58ostream& operator<<(ostream& s, const AliTkEtaPhiVector& v);
59#endif