]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDseedV1.h
Adding document for performance study (marian)
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.h
1 #ifndef ALITRDSEEDV1_H
2 #define ALITRDSEEDV1_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
8 ////////////////////////////////////////////////////////////////////////////
9 //                                                                        //
10 //  The TRD track seed                                                    //
11 //                                                                        //
12 ////////////////////////////////////////////////////////////////////////////
13
14 #ifndef ALITRDSEED_H
15 #include "AliTRDseed.h"
16 #endif
17
18 #ifndef ALITRDGEOMETRY_H
19 #include "AliTRDgeometry.h"
20 #endif
21
22 #ifndef ALIPID_H
23 #include "AliPID.h"
24 #endif
25
26 #ifndef ALIRIEMAN_H
27 #include "AliRieman.h"
28 #endif
29
30 class TTreeSRedirector;
31
32 class AliRieman;
33
34 class AliTRDtrackingChamber;
35 class AliTRDcluster;
36 class AliTRDtrackV1;
37 class AliTRDReconstructor;
38 class AliTRDseedV1 : public AliTRDseed
39 {
40
41   public:
42
43   enum {
44     knSlices = 10
45   };
46   // bits from 0-13 are reserved by ROOT (see TObject.h)
47   enum AliTRDtrackletStatus {
48     kOwner    = BIT(14)
49   , kRowCross = BIT(15) 
50   };
51
52   AliTRDseedV1(Int_t det = -1);
53   ~AliTRDseedV1();
54   AliTRDseedV1(const AliTRDseedV1 &ref);
55   AliTRDseedV1& operator=(const AliTRDseedV1 &ref);
56
57   Bool_t        AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t quality, Bool_t kZcorr = kFALSE
58                                 , AliTRDcluster *c=0x0);
59   Bool_t        AttachClusters(AliTRDtrackingChamber *chamber, Bool_t kZcorr = kFALSE);
60   void    Bootstrap(const AliTRDReconstructor *rec);
61   void    CookdEdx(Int_t nslices);
62   Bool_t  Fit(Bool_t tilt=kTRUE);
63
64   Bool_t  Init(AliTRDtrackV1 *track);
65   inline void      Init(const AliRieman *fit);
66   Bool_t    IsOwner() const          { return TestBit(kOwner);}
67   Bool_t    IsRowCross() const       { return TestBit(kRowCross);}
68
69   inline Float_t   GetChi2Z(const Float_t z = 999.) const;
70   inline Float_t   GetChi2Y(const Float_t y = 999.) const;
71   void      GetCovAt(Double_t x, Double_t *cov) const;
72   Double_t* GetCrossXYZ() { return &fCross[0];}
73   Double_t  GetCrossSz2() const { return fCross[3];}
74   Float_t*  GetdEdx() {return &fdEdx[0];}
75   Float_t   GetdQdl(Int_t ic) const;
76   Int_t     GetDetector() const {return fDet;}
77   Double_t  GetMomentum() const {return fMom;}
78   Int_t     GetN() const {return fN2;}
79   Float_t   GetQuality(Bool_t kZcorr) const;
80   Int_t     GetPlane() const         { return AliTRDgeometry::GetLayer(fDet);    }
81
82   Double_t* GetProbability();
83   Double_t  GetSnp() const           { return fSnp;}
84   Double_t  GetTgl() const           { return fTgl;}
85   Double_t  GetYat(Double_t x) const { return fYfit[0] + fYfit[1] * (x-fX0);}
86   Double_t  GetZat(Double_t x) const { return fZfit[0] + fZfit[1] * (x-fX0);}
87   
88   inline AliTRDcluster* NextCluster();
89   inline AliTRDcluster* PrevCluster();
90   void      Print(Option_t *o = "") const;
91   inline void ResetClusterIter(Bool_t forward = kTRUE);
92
93   void      SetMomentum(Double_t mom) {fMom = mom;}
94   void      SetOwner();
95   void      SetDetector(Int_t d) {fDet = d;  }
96   void      SetSnp(Double_t snp) {fSnp = snp;}
97   void      SetTgl(Double_t tgl) {fTgl = tgl;}
98   void      SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
99 protected:
100
101   void Copy(TObject &ref) const;
102
103 private:
104   const AliTRDReconstructor *fReconstructor;//! local reconstructor
105   AliTRDcluster    **fClusterIter;          //! clusters iterator
106   Char_t           fClusterIdx;             //! clusters iterator
107   Int_t            fDet;                    //  TRD detector
108   Float_t          fMom;                    //  Momentum estimate for tracklet [GeV/c]
109   Float_t          fSnp;                    // sin of track with respect to x direction in XY plane     
110   Float_t          fTgl;                    // tg of track with respect to x direction in XZ plane      
111   Float_t          fdX;                     // length of time bin
112   Float_t          fdEdx[knSlices];         //  dE/dx measurements for tracklet
113   Double_t         fCross[4];            // spatial parameters of the pad row crossing
114   Double_t         fProb[AliPID::kSPECIES]; //  PID probabilities
115
116   ClassDef(AliTRDseedV1, 2)                 //  New TRD seed 
117
118 };
119
120 //____________________________________________________________
121 inline Float_t AliTRDseedV1::GetChi2Z(const Float_t z) const
122 {
123   Float_t z1  = (z == 999.) ? fMeanz : z;
124   Float_t chi = fZref[0] - z1;
125   return chi*chi;
126 }
127
128 //____________________________________________________________
129 inline Float_t AliTRDseedV1::GetChi2Y(const Float_t y) const
130 {
131   Float_t y1  = (y == 999.) ? fYfitR[0] : y;
132   Float_t chi = fYref[0] - y1;
133   return chi*chi;
134 }
135
136 //____________________________________________________________
137 inline void AliTRDseedV1::Init(const AliRieman *rieman)
138 {
139   fZref[0] = rieman->GetZat(fX0);
140   fZref[1] = rieman->GetDZat(fX0);
141   fYref[0] = rieman->GetYat(fX0);
142   fYref[1] = rieman->GetDYat(fX0);
143   fC       = rieman->GetC(); 
144   fChi2    = rieman->GetChi2();
145 }
146
147 //____________________________________________________________
148 inline AliTRDcluster* AliTRDseedV1::NextCluster()
149 {
150 // Mimic the usage of STL iterators.
151 // Forward iterator
152
153   fClusterIdx++; fClusterIter++;
154   while(fClusterIdx < AliTRDseed::knTimebins){
155     if(!(*fClusterIter)){ 
156       fClusterIdx++; 
157       fClusterIter++;
158       continue;
159     }
160     return *fClusterIter;
161   }
162   return 0x0;
163 }
164
165 //____________________________________________________________
166 inline AliTRDcluster* AliTRDseedV1::PrevCluster()
167 {
168 // Mimic the usage of STL iterators.
169 // Backward iterator
170
171   fClusterIdx--; fClusterIter--;
172   while(fClusterIdx >= 0){
173     if(!(*fClusterIter)){ 
174       fClusterIdx--; 
175       fClusterIter--;
176       continue;
177     }
178     return *fClusterIter;
179   }
180   return 0x0;
181 }
182
183 //____________________________________________________________
184 inline void AliTRDseedV1::ResetClusterIter(Bool_t forward) 
185 {
186 // Mimic the usage of STL iterators.
187 // Facilitate the usage of NextCluster for forward like 
188 // iterator (kTRUE) and PrevCluster for backward like iterator (kFALSE)
189
190   if(forward){
191     fClusterIter = &fClusters[0]; fClusterIter--; 
192     fClusterIdx=-1;
193   } else {
194     fClusterIter = &fClusters[AliTRDseed::knTimebins-1]; fClusterIter++; 
195     fClusterIdx=AliTRDseed::knTimebins;
196   }
197 }
198
199 #endif
200
201
202