]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/ESD/AliTrackPointArray.h
Complete implementation of pools, see #88914. From rev. 53550,53557,53568 (Ruben)
[u/mrichter/AliRoot.git] / STEER / ESD / AliTrackPointArray.h
1 #ifndef ALITRACKPOINTARRAY_H
2 #define ALITRACKPOINTARRAY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 //////////////////////////////////////////////////////////////////////////////
7 //                          Class AliTrackPoint                             //
8 //   This class represent a single track space-point.                       //
9 //   It is used to access the points array defined in AliTrackPointArray.   //
10 //   Note that the space point coordinates are given in the global frame.   //
11 //                                                                          //
12 //   cvetan.cheshkov@cern.ch 3/11/2005                                      //
13 //////////////////////////////////////////////////////////////////////////////
14
15 #include <TObject.h>
16 #include <TMatrixDSym.h>
17
18 class AliPoolN;
19 class TGeoRotation;
20
21 class AliTrackPoint : public TObject {
22
23  public:
24   AliTrackPoint();
25   AliTrackPoint(Float_t x, Float_t y, Float_t z, const Float_t *cov, UShort_t volid, Float_t charge = 0, Float_t drifttime = 0,Float_t chargeratio = 0, Int_t clutype = 0);
26   AliTrackPoint(const Float_t *xyz, const Float_t *cov, UShort_t volid, Float_t charge = 0, Float_t drifttime = 0,Float_t chargeratio = 0, Int_t clutype=0);
27   AliTrackPoint(const AliTrackPoint &p);
28   AliTrackPoint& operator= (const AliTrackPoint& p);
29   virtual ~AliTrackPoint() {}
30
31   // Multiplication with TGeoMatrix and distance between points (chi2) to be implemented
32
33   void     SetXYZ(Float_t x, Float_t y, Float_t z, const Float_t *cov = 0);
34   void     SetXYZ(const Float_t *xyz, const Float_t *cov = 0);
35   void     SetCov(const Float_t *cov);
36   void     SetVolumeID(UShort_t volid) { fVolumeID = volid; }
37   void     SetCharge(Float_t charge) { fCharge = charge; }
38   void     SetDriftTime(Float_t time) { fDriftTime = time; }
39   void     SetChargeRatio(Float_t ratio) {  fChargeRatio= ratio; }
40   void     SetClusterType(Int_t clutype) {  fClusterType= clutype; }
41   void     SetExtra(Bool_t flag=kTRUE) { fIsExtra = flag; }
42
43   Float_t  GetX() const { return fX; }
44   Float_t  GetY() const { return fY; }
45   Float_t  GetZ() const { return fZ; }
46   void     GetXYZ(Float_t *xyz, Float_t *cov = 0) const;
47   const Float_t *GetCov() const { return &fCov[0]; }
48   UShort_t GetVolumeID() const { return fVolumeID; }
49   Float_t  GetCharge() const { return fCharge; }
50   Float_t  GetDriftTime() const { return fDriftTime;}
51   Float_t  GetChargeRatio() const { return fChargeRatio;}
52   Int_t    GetClusterType() const { return fClusterType;}
53   Bool_t   IsExtra() const { return fIsExtra;}
54
55   Float_t  GetResidual(const AliTrackPoint &p, Bool_t weighted = kFALSE) const;
56   Bool_t   GetPCA(const AliTrackPoint &p, AliTrackPoint &out) const;
57
58   Float_t  GetAngle() const;
59   Bool_t   GetRotMatrix(TGeoRotation& rot) const;
60   void SetAlignCovMatrix(const TMatrixDSym& alignparmtrx);
61
62   AliTrackPoint& Rotate(Float_t alpha) const;
63   AliTrackPoint& MasterToLocal() const;
64
65   void     Print(Option_t *) const;
66   //
67  private:
68
69   Float_t  fX;        // X coordinate
70   Float_t  fY;        // Y coordinate
71   Float_t  fZ;        // Z coordinate
72   Float_t  fCharge;   // Cluster charge in arbitrary units
73   Float_t  fDriftTime;// Drift time in SDD (in ns)
74   Float_t  fChargeRatio; // Charge ratio in SSD 
75   Int_t    fClusterType; // Cluster Type (encoded info on size and shape)
76   Float_t  fCov[6];   // Cov matrix
77   Bool_t   fIsExtra;  // attached by tracker but not used in fit
78   UShort_t fVolumeID; // Volume ID
79
80   ClassDef(AliTrackPoint,7)
81 };
82
83 //////////////////////////////////////////////////////////////////////////////
84 //                          Class AliTrackPointArray                        //
85 //   This class contains the ESD track space-points which are used during   //
86 //   the alignment procedures. Each space-point consist of 3 coordinates    //
87 //   (and their errors) and the index of the sub-detector which contains    //
88 //   the space-point.                                                       //
89 //   cvetan.cheshkov@cern.ch 3/11/2005                                      //
90 //////////////////////////////////////////////////////////////////////////////
91
92 class AliTrackPointArray : public TObject {
93
94  public:
95
96   AliTrackPointArray();
97   AliTrackPointArray(Int_t npoints);
98   AliTrackPointArray(const AliTrackPointArray &array);
99   AliTrackPointArray& operator= (const AliTrackPointArray& array);
100   virtual ~AliTrackPointArray();
101
102   //  Bool_t    AddPoint(Int_t i, AliCluster *cl, UShort_t volid);
103   Bool_t    AddPoint(Int_t i, const AliTrackPoint *p);
104
105   Int_t     GetNPoints() const { return fNPoints; }
106   Int_t     GetCovSize() const { return fSize; }
107   Bool_t    GetPoint(AliTrackPoint &p, Int_t i) const;
108   // Getters for fast access to the coordinate arrays
109   const Float_t*  GetX() const { return &fX[0]; }
110   const Float_t*  GetY() const { return &fY[0]; }
111   const Float_t*  GetZ() const { return &fZ[0]; }
112   const Float_t*  GetCharge() const { return &fCharge[0]; }
113   const Float_t*  GetDriftTime() const { return &fDriftTime[0]; }
114   const Float_t*  GetChargeRatio() const { return &fChargeRatio[0]; }
115   const Int_t*    GetClusterType() const { return &fClusterType[0]; }
116   const Bool_t*   GetExtra() const { return &fIsExtra[0]; }
117   const Float_t*  GetCov() const { return &fCov[0]; }
118   const UShort_t* GetVolumeID() const { return &fVolumeID[0]; }
119
120   Bool_t    HasVolumeID(UShort_t volid) const;
121   void      Clear(Option_t* opt="");
122   //
123   void Sort(Bool_t down=kTRUE);
124   static void      SetPool(AliPoolN* rc)          {fgPool = rc;}
125   static AliPoolN* GetPool()                      {return fgPool;}
126
127  private:
128   Bool_t fSorted;        // Sorted flag
129
130   Int_t     fNPoints;    // Number of space points
131   Float_t   *fX;         //[fNPoints] Array with space point X coordinates
132   Float_t   *fY;         //[fNPoints] Array with space point Y coordinates
133   Float_t   *fZ;         //[fNPoints] Array with space point Z coordinates
134   Float_t   *fCharge;    //[fNPoints] Array with clusters charge
135   Float_t   *fDriftTime; //[fNPoints] Array with drift times
136   Float_t   *fChargeRatio; //[fNPoints] Array with charge ratio
137   Int_t     *fClusterType; //[fNPoints] Array with cluster type
138   Bool_t    *fIsExtra;   //[fNPoints] Array with extra flags
139   Int_t     fSize;       // Size of array with cov matrices = 6*N of points
140   Float_t   *fCov;       //[fSize] Array with space point coordinates cov matrix
141   UShort_t  *fVolumeID;  //[fNPoints] Array of space point volume IDs
142   //
143   static AliPoolN* fgPool; // pointer to the pool (of AliReconstruction)
144   //
145   ClassDef(AliTrackPointArray,8)
146 };
147
148 #endif
149