Update master to aliroot
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTrackReference.h
CommitLineData
aab9c8d5 1#ifndef ALITRACKREFERENCE_H
2#define ALITRACKREFERENCE_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
0742d588 8//
9// Track Reference object is created every time particle is
10// crossing detector bounds.
11// The object is created by Step Manager
12//
13
aab9c8d5 14#include "TObject.h"
2cad796f 15#include "TMath.h"
aab9c8d5 16
17class AliTrackReference : public TObject {
18public:
2d74ba4f 19
9ac3aec9 20 enum constants {kDisappeared = -1,
21 kITS = 0,
22 kTPC = 1,
23 kFRAME = 2,
24 kTRD = 3,
25 kTOF = 4,
8a388651 26 kMUON = 5,
a95acbbb 27 kHMPID = 6,
dd7dc224 28 kT0 = 7,
c1446131 29 kEMCAL = 8,
30 kPMD = 10,
7b1a8873 31 kFMD = 12,
820b4d9e 32 kVZERO = 14,
bbf0f98c 33 kZDC = 15,
5b37b1dd 34 kMFT = 16,
96d67f0c 35 kHALL = 17,
36 kFIT = 18 //alla
9ac3aec9 37 };
aab9c8d5 38 AliTrackReference();
9ac3aec9 39 AliTrackReference(Int_t label, Int_t id = -999);
40 AliTrackReference(const AliTrackReference &tr);
aab9c8d5 41 virtual ~AliTrackReference() {}
2d74ba4f 42
066cef28 43// static AliExternalTrackParam * MakeTrack(const AliTrackReference *ref, Double_t mass);
aab9c8d5 44 virtual Int_t GetTrack() const {return fTrack;}
45 virtual void SetTrack(Int_t track) {fTrack=track;}
4930c251 46 virtual void SetLength(Float_t length){fLength=length;}
2d74ba4f 47 virtual void SetTime(Float_t time) {fTime = time;}
1c0b669a 48 virtual Float_t GetLength() const {return fLength;}
49 virtual Float_t GetTime() const {return fTime;}
84856b02 50 virtual Int_t Label() const {return fTrack;}
51 virtual void SetLabel(Int_t track) {fTrack=track;}
52 virtual Float_t R() const {return TMath::Sqrt(fX*fX+fY*fY);}
53 virtual Float_t Pt() const {return TMath::Sqrt(fPx*fPx+fPy*fPy);}
54 virtual Float_t Phi() const {return TMath::Pi()+TMath::ATan2(-fPy,-fPx);}
b915b099 55 virtual Float_t Theta() const {return (fPz==0)?TMath::Pi()/2:TMath::ACos(fPz/P());}
aab9c8d5 56 virtual Float_t X() const {return fX;}
57 virtual Float_t Y() const {return fY;}
58 virtual Float_t Z() const {return fZ;}
59 virtual Float_t Px() const {return fPx;}
60 virtual Float_t Py() const {return fPy;}
61 virtual Float_t Pz() const {return fPz;}
b915b099 62 virtual Float_t P() const {return TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz);}
3142ebc3 63 virtual Int_t UserId() const {return fUserId;}
9ac3aec9 64 virtual Int_t DetectorId() const {return fDetectorId;}
7a36ccc5 65 virtual void SetDetectorId(Int_t id){fDetectorId = id;}
aab9c8d5 66 virtual void SetPosition(Float_t x, Float_t y, Float_t z){fX=x; fY=y; fZ=z;}
67 virtual void SetMomentum(Float_t px, Float_t py, Float_t pz){fPx=px; fPy=py; fPz=pz;}
3142ebc3 68 virtual void SetUserId(Int_t userId){fUserId=userId;}
066cef28 69
9c9d2487 70 // Methods to get position of the track reference in
71 // in the TPC/TRD/TOF Tracking coordinate system
72
73 virtual Float_t PhiPos() const {return TMath::Pi()+TMath::ATan2(-fY, -fX);}
74 virtual Float_t Alpha() const
75 {return TMath::Pi()*(20*((((Int_t)(PhiPos()*180/TMath::Pi()))/20))+10)/180.;}
76 virtual Float_t LocalX() const {return fX*TMath::Cos(-Alpha()) - fY*TMath::Sin(-Alpha());}
77 virtual Float_t LocalY() const {return fX*TMath::Sin(-Alpha()) + fY*TMath::Cos(-Alpha());}
78
e54ee89d 79 Bool_t IsSortable() const {return kTRUE;}
80 Int_t Compare(const TObject *obj) const {
81 Int_t ll = ((AliTrackReference*)obj)->GetTrack();
e54ee89d 82 if (ll < fTrack) return 1;
83 if (ll > fTrack) return -1;
a3a4f18d 84 return 0;
e54ee89d 85 }
2d74ba4f 86
65b311b3 87 virtual void Print(Option_t* opt="") const;
88
aab9c8d5 89protected:
9ac3aec9 90 Int_t fTrack; // Track number
91 Float_t fX; // X reference position of the track
92 Float_t fY; // Y reference position of the track
93 Float_t fZ; // Z reference position of the track
94 Float_t fPx; // momentum
95 Float_t fPy; // momentum
96 Float_t fPz; // momentum
97 Float_t fLength; // track lenght from its origin in cm
98 Float_t fTime; // time of flight in cm
99 Int_t fUserId; // optional Id defined by user
100 Int_t fDetectorId; // Detector Id
bbf0f98c 101 ClassDef(AliTrackReference,7) //Base class for all Alice track references
aab9c8d5 102};
103#endif