]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCTrack.h
- bugfix: correct initialization of the AliTPCcalibDB to avoid out of bounds messages...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTrack.h
1 // XEmacs -*-C++-*-
2 // @(#) $Id$
3 // Original: AliHLTTrack.h,v 1.18 2005/03/31 04:48:58 cvetan 
4
5 #ifndef ALIHLTTPCTRACK_H
6 #define ALIHLTTPCTRACK_H
7
8 //* This file is property of and copyright by the ALICE HLT Project        * 
9 //* ALICE Experiment at CERN, All rights reserved.                         *
10 //* See cxx source for full Copyright notice                               *
11
12 /** @file   AliHLTTPCTrack.h
13     @author Anders Vestbo, Uli Frankenfeld, maintained by Matthias Richter
14     @date   
15     @brief  HLT TPC track base class (conformal mapping)
16 */
17
18 #include "AliTPCtrack.h"
19
20 class AliHLTTPCVertex;
21 class AliHLTTPCSpacePointData;
22
23 /**
24  * @class AliHLTTPCTrack
25  * This class implements the representation of a TPC track, used by the
26  * HLT conformal mapping track finder. <br>
27  * It was originally separated from the offline TPC track class, but in
28  * order to adjust the output format to the offline ESD, AliHLTTPCTrack
29  * now inherits from AliHLTtrack.
30  *
31  * @ingroup alihlt_tpc
32  */
33 class AliHLTTPCTrack : public AliTPCtrack {
34
35  public:
36   
37   AliHLTTPCTrack();
38   virtual ~AliHLTTPCTrack();
39   
40   /**
41    * Copy track parameters.
42    * @param track   pointer to source track
43    */
44   virtual void Copy(AliHLTTPCTrack* track);
45   using AliTPCtrack::Copy;  //TODO: Check if "virtual void Copy(TObject*)" does what it is supposed to do.
46
47   /**
48    * Compare two tracks by the number of hits
49    * @return 0 if equal number of hits, 
50    *         1 if this > track
51    *        -1 if this < track
52    */
53   virtual Int_t Compare(const AliHLTTPCTrack *track) const;
54   using AliTPCtrack::Compare;  //TODO: Check if "virtual Int_t Compare(TObject*)" does what it is supposed to do.
55
56   /**
57    * Fit the assigned spacepoints to a helix.
58    * The function sets teh track parameters.
59    */
60   virtual void CalculateHelix();
61   
62   Bool_t CalculateReferencePoint(Double_t angle,Double_t radius=132);//Calculate Reference Point
63   Bool_t CalculateEdgePoint(Double_t angle);//Calculate crossing point with line
64   Bool_t CalculatePoint(Double_t xplane);   //Calculate crossing point with X-plane
65   Bool_t IsPoint() {return fIsPoint;}
66   Double_t GetCrossingAngle(Int_t padrow,Int_t slice=-1);
67   Bool_t GetCrossingPoint(Int_t padrow,Float_t *xyz);
68   Double_t GetDistance(Double_t /*x0*/,Double_t /*x1*/){return 0;}
69   void UpdateToFirstPoint();
70   void GetClosestPoint(AliHLTTPCVertex *vertex,Double_t &closestX,Double_t &closestY,Double_t &closestZ);
71   void Rotate(Int_t slice,Bool_t tolocal=kFALSE);
72   Bool_t IsLocal() const {return fIsLocal;}
73   virtual void Print(Option_t* option = "") const;
74   using AliTPCtrack::Print;
75
76   // getter
77   Double_t GetFirstPointX() const {return fFirstPoint[0];}
78   Double_t GetFirstPointY() const {return fFirstPoint[1];}
79   Double_t GetFirstPointZ() const {return fFirstPoint[2];}
80   Double_t GetLastPointX() const {return fLastPoint[0];}
81   Double_t GetLastPointY() const {return fLastPoint[1];}
82   Double_t GetLastPointZ() const {return fLastPoint[2];}
83
84   Double_t GetPointPsi() const {return fPointPsi;}
85   Double_t GetPointX() const {return fPoint[0];}
86   Double_t GetPointY() const {return fPoint[1];}
87   Double_t GetPointZ() const {return fPoint[2];}
88
89   Double_t GetPt() const {return fPt;}
90   Double_t GetTgl() const {return fTanl;}
91   Double_t GetPsi() const {return fPsi;}
92   Double_t GetPhi0() const {return fPhi0;}
93   Double_t GetR0() const {return fR0;}
94   Double_t GetZ0() const {return fFirstPoint[2];}
95   Float_t GetPID() const {return fPID;}
96
97   Double_t GetPterr() const {return fPterr;}
98   Double_t GetPsierr() const {return fPsierr;}
99   Double_t GetTglerr() const {return fTanlerr;}
100   Double_t GetZ0err() const {return fZ0err;}
101   Double_t GetY0err() const {return fY0err;}
102
103   Double_t GetKappa() const {return fKappa;}
104   Double_t GetRadius() const {return fRadius;}
105   Double_t GetCenterX() const {return fCenterX;}
106   Double_t GetCenterY() const {return fCenterY;}
107
108   Int_t GetNHits() const {return fNHits;}
109   Int_t   GetNumberOfPoints()   const {return fNHits;}
110   Bool_t  ComesFromMainVertex() const {return fFromMainVertex;}
111     
112   Double_t GetPx() const {return fPt*cos(fPsi);}
113   Double_t GetPy() const {return fPt*sin(fPsi);}
114   Double_t GetPz() const {return fPt*fTanl;}
115   
116   Double_t GetP() const;
117   Double_t GetPseudoRapidity() const;
118   Double_t GetRapidity() const;
119   
120   Int_t GetCharge() const {return fQ;}
121   Int_t GetMCid() const {return fMCid;}
122   Double_t GetLength() const {return fLength;}
123   Double_t GetLengthXY() const ;
124   Double_t GetLengthTot() const;
125   
126   Int_t GetFirstRow() const {return fRowRange[0];}
127   Int_t GetLastRow()  const {return fRowRange[1];}
128   Int_t GetSector()   const {return fSector;}
129
130   UInt_t *GetHitNumbers() {return fHitNumbers;}
131   Int_t GetId(){ return fId; }
132
133   // setter   
134   void SetPID(Float_t pid) {fPID=pid;}  
135   void SetMCid(Int_t f) {fMCid = f;}
136   void SetFirstPoint(Double_t f,Double_t g,Double_t h) {fFirstPoint[0]=f; fFirstPoint[1]=g; fFirstPoint[2]=h;}
137   void SetLastPoint(Double_t f,Double_t g,Double_t h) {fLastPoint[0]=f; fLastPoint[1]=g; fLastPoint[2]=h;}
138   void SetHits(Int_t nhits,UInt_t *hits);
139   void SetPhi0(Double_t f) {fPhi0 = f;}
140   void SetPsi(Double_t f) {fPsi = f;}
141   void SetR0(Double_t f) {fR0 = f;}
142   void SetTgl(Double_t f) {fTanl =f;}
143   void SetZ0(Double_t f) {fFirstPoint[2] = f;}
144   void SetPt(Double_t f) {fPt = f;}
145   void SetLength(Double_t f) {fLength = f;}
146   void SetPterr(Double_t f) {fPterr = f;}
147   void SetPsierr(Double_t f) {fPsierr = f;}
148   void SetZ0err(Double_t f) {fZ0err = f;}
149   void SetY0err(Double_t f) {fY0err = f;}  
150   void SetTglerr(Double_t f) {fTanlerr = f;}
151   void SetKappa(Double_t f) {fKappa = f;}
152   void SetNHits(Int_t f) {fNHits = f;}
153   void SetRowRange(Int_t f,Int_t g) {fRowRange[0]=f; fRowRange[1]=g;}
154   void SetSector(Int_t f) {fSector = f;}
155   void SetRadius(Double_t f) {fRadius = f;}
156   void SetCenterX(Double_t f) {fCenterX = f;}
157   void SetCenterY(Double_t f) {fCenterY = f;}
158   void SetCharge(Int_t f) {fQ = f;}
159   void SetId( Int_t f ) { fId = f; }
160
161   void ComesFromMainVertex(Bool_t f) {fFromMainVertex = f;}
162
163   /**
164    * Convert all track parameters to the format of AliKalmanTrack
165    * The AliKalmanTrack class implements the track parametrization for offline ITS, TPC
166    * and TRD tracking. The function calculates and sets the parameters of the
167    * parent class (Note: AliHLTTPCTrack inherits from AliTPCtrack and thus
168    * AliKalmanTrack).
169    */
170   int Convert2AliKalmanTrack();
171
172   /**
173    * Check the structure members to be within reasonable limits.
174    */
175   int CheckConsistency();
176
177   /**
178    * Check consistency of a double member
179    */
180   int CheckDoubleMember(double* pMember, double def, const char* name) const;
181
182  private:
183
184   Int_t fNHits; //Number of hits
185   Int_t fMCid;  //Assigned id from MC data.
186
187   Double_t fKappa;   // Signed curvature (projected to a circle)
188   Double_t fRadius;  // Radius of the helix (projected to a circle)
189   Double_t fCenterX; // x coordinate of the center of the helix (projected to a circle)
190   Double_t fCenterY; // y coordinate of the center of the helix (projected to a circle)
191   Bool_t   fFromMainVertex; // true if tracks origin is the main vertex, otherwise false
192   
193   Int_t fRowRange[2]; //Subsector where this track was build
194   Int_t fSector;      //Sector # where  this track was build
195
196   //data from momentum fit
197   Int_t    fQ;    //charge measured fit
198     
199   //track parameters:
200   Double_t fTanl; //tan of dipangle
201   Double_t fPsi;  //azimuthal angle of the momentum 
202   Double_t fPt;   //transverse momentum
203   Double_t fLength; //length of track (s)
204   
205   Double_t fPterr;   //error in pt
206   Double_t fPsierr;  //error in psi
207   Double_t fZ0err;   //error in first point
208   Double_t fY0err;   //error in first point
209   Double_t fTanlerr; //error in tanl
210
211   Double_t fPhi0; //azimuthal angle of the first point
212   Double_t fR0;   //radius of the first point
213   Double_t fZ0;   //z coordinate of the first point (fFirstPoint[2])
214
215   Double_t fFirstPoint[3]; //first point
216   Double_t fLastPoint[3];  //last point
217   Double_t fPoint[3]; //point
218   Double_t fPointPsi; //azimuthal angle of the momentum at Point
219
220   Bool_t fIsPoint;  //Helix crosses the X-plane
221   Bool_t fIsLocal; //Track given in local coordinates.
222
223   Float_t fPID; //pid 
224   static const int fgkHitArraySize=159; // size of hit array
225   UInt_t fHitNumbers[fgkHitArraySize]; //Array of hit numbers for this track
226   Int_t fId; // unique ID of the track
227
228   Bool_t IsPoint(Bool_t ispoint) {fIsPoint = ispoint;return fIsPoint;}
229
230   ClassDef(AliHLTTPCTrack,3) //Base track class
231 };
232 #endif