]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDseedV1.h
The present commit corresponds to an important change in the way the
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.h
CommitLineData
e4f2f73d 1#ifndef ALITRDSEEDV1_H
2#define ALITRDSEEDV1_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
e44586fb 4* See cxx source for full Copyright notice */
e4f2f73d 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
ae4e8b84 18#ifndef ALITRDGEOMETRY_H
19#include "AliTRDgeometry.h"
20#endif
21
0906e73e 22#ifndef ALIPID_H
23#include "AliPID.h"
24#endif
25
e4f2f73d 26#ifndef ALIRIEMAN_H
27#include "AliRieman.h"
28#endif
29
30class TTreeSRedirector;
31
32class AliRieman;
33
eb38ed55 34class AliTRDtrackingChamber;
e4f2f73d 35class AliTRDcluster;
f3d3af1b 36class AliTRDtrackV1;
3a039a31 37class AliTRDReconstructor;
e4f2f73d 38class AliTRDseedV1 : public AliTRDseed
39{
fbb2ea06 40
0906e73e 41 public:
42
e44586fb 43 enum {
44 knSlices = 10
45 };
2e2915e7 46 // bits from 0-13 are reserved by ROOT (see TObject.h)
e44586fb 47 enum AliTRDtrackletStatus {
2e2915e7 48 kOwner = BIT(14)
49 , kRowCross = BIT(15)
e44586fb 50 };
51
ae4e8b84 52 AliTRDseedV1(Int_t det = -1);
e44586fb 53 ~AliTRDseedV1();
54 AliTRDseedV1(const AliTRDseedV1 &ref);
55 AliTRDseedV1& operator=(const AliTRDseedV1 &ref);
56
203967fc 57 Bool_t AttachClustersIter(
58 AliTRDtrackingChamber *chamber, Float_t quality,
59 Bool_t kZcorr = kFALSE, AliTRDcluster *c=0x0);
60 Bool_t AttachClusters(
b1957d3c 61 AliTRDtrackingChamber *chamber, Bool_t tilt = kFALSE);
203967fc 62 void Bootstrap(const AliTRDReconstructor *rec);
63 void CookdEdx(Int_t nslices);
d937ad7a 64 Bool_t Fit(Bool_t tilt=kTRUE, Int_t errors = 2);
203967fc 65
66 Bool_t Init(AliTRDtrackV1 *track);
e44586fb 67 inline void Init(const AliRieman *fit);
203967fc 68 Bool_t IsEqual(const TObject *inTracklet) const;
e44586fb 69 Bool_t IsOwner() const { return TestBit(kOwner);}
70 Bool_t IsRowCross() const { return TestBit(kRowCross);}
71
72 inline Float_t GetChi2Z(const Float_t z = 999.) const;
73 inline Float_t GetChi2Y(const Float_t y = 999.) const;
d937ad7a 74 static void GetClusterXY(const AliTRDcluster *c, Double_t &x, Double_t &y);
e44586fb 75 void GetCovAt(Double_t x, Double_t *cov) const;
d937ad7a 76 void GetCovXY(Double_t *cov) const { memcpy(cov, &fCov[0], 3*sizeof(Double_t));}
ac6764f5 77 void GetCovRef(Double_t *cov) const { memcpy(cov, &fRefCov[0], 3*sizeof(Double_t));}
203967fc 78 Double_t* GetCrossXYZ() { return &fCross[0];}
79 Double_t GetCrossSz2() const { return fCross[3];}
80 Float_t GetdX() const { return fdX;}
81 Float_t* GetdEdx() { return &fdEdx[0];}
e44586fb 82 Float_t GetdQdl(Int_t ic) const;
203967fc 83 Int_t GetDetector() const { return fDet;}
d937ad7a 84 Float_t GetExB() const { return fExB;}
203967fc 85 Double_t GetMomentum() const { return fMom;}
86 Int_t GetN() const { return fN2;}
e44586fb 87 Float_t GetQuality(Bool_t kZcorr) const;
ae4e8b84 88 Int_t GetPlane() const { return AliTRDgeometry::GetLayer(fDet); }
89
e44586fb 90 Double_t* GetProbability();
91 Double_t GetSnp() const { return fSnp;}
92 Double_t GetTgl() const { return fTgl;}
b1957d3c 93 Float_t GetXref() const { return fX0 - fXref;}
94 Double_t GetYat(Double_t x) const { return fYfit[0] - fYfit[1] * (fX0-x);}
95 Double_t GetZat(Double_t x) const { return fZfit[0] - fZfit[1] * (fX0-x);}
e44586fb 96
ae4e8b84 97 inline AliTRDcluster* NextCluster();
71ea19a3 98 inline AliTRDcluster* PrevCluster();
e44586fb 99 void Print(Option_t *o = "") const;
71ea19a3 100 inline void ResetClusterIter(Bool_t forward = kTRUE);
ae4e8b84 101
0849f128 102 void SetCovRef(const Double_t *cov) { memcpy(&fRefCov[0], cov, 3*sizeof(Double_t));}
203967fc 103 void SetMomentum(Double_t mom){ fMom = mom;}
29b87567 104 void SetOwner();
203967fc 105 void SetDetector(Int_t d) { fDet = d; }
bee2b41e 106 void SetDX(Float_t inDX) { fdX = inDX;}
203967fc 107 void SetSnp(Double_t snp) { fSnp = snp;}
108 void SetTgl(Double_t tgl) { fTgl = tgl;}
3a039a31 109 void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
b1957d3c 110 void UpDate(const AliTRDtrackV1* trk);
e4f2f73d 111
d937ad7a 112protected:
e44586fb 113 void Copy(TObject &ref) const;
d937ad7a 114 void SetExB();
e4f2f73d 115
e44586fb 116private:
0ae89c5d 117 const AliTRDReconstructor *fReconstructor;//! local reconstructor
ae4e8b84 118 AliTRDcluster **fClusterIter; //! clusters iterator
71ea19a3 119 Char_t fClusterIdx; //! clusters iterator
ae4e8b84 120 Int_t fDet; // TRD detector
e44586fb 121 Float_t fMom; // Momentum estimate for tracklet [GeV/c]
122 Float_t fSnp; // sin of track with respect to x direction in XY plane
123 Float_t fTgl; // tg of track with respect to x direction in XZ plane
124 Float_t fdX; // length of time bin
6e4d4425 125 Float_t fXref; // average radial position of clusters
d937ad7a 126 Float_t fExB; // tg(a_L) for the tracklet reagion
6e4d4425 127 Float_t fdEdx[knSlices]; // dE/dx measurements for tracklet
128 Double_t fCross[4]; // spatial parameters of the pad row crossing
129 Double_t fRefCov[3]; // covariance matrix of the track in the yz plane
d937ad7a 130 Double_t fCov[3]; // covariance matrix of the tracklet in the xy plane
e44586fb 131 Double_t fProb[AliPID::kSPECIES]; // PID probabilities
e4f2f73d 132
d937ad7a 133 ClassDef(AliTRDseedV1, 4) // New TRD seed
e4f2f73d 134
135};
136
137//____________________________________________________________
138inline Float_t AliTRDseedV1::GetChi2Z(const Float_t z) const
139{
e44586fb 140 Float_t z1 = (z == 999.) ? fMeanz : z;
141 Float_t chi = fZref[0] - z1;
142 return chi*chi;
e4f2f73d 143}
144
145//____________________________________________________________
146inline Float_t AliTRDseedV1::GetChi2Y(const Float_t y) const
147{
e44586fb 148 Float_t y1 = (y == 999.) ? fYfitR[0] : y;
149 Float_t chi = fYref[0] - y1;
150 return chi*chi;
e4f2f73d 151}
152
153//____________________________________________________________
0906e73e 154inline void AliTRDseedV1::Init(const AliRieman *rieman)
e4f2f73d 155{
e44586fb 156 fZref[0] = rieman->GetZat(fX0);
157 fZref[1] = rieman->GetDZat(fX0);
158 fYref[0] = rieman->GetYat(fX0);
159 fYref[1] = rieman->GetDYat(fX0);
55ef6967 160 fC = rieman->GetC();
161 fChi2 = rieman->GetChi2();
e4f2f73d 162}
163
ae4e8b84 164//____________________________________________________________
165inline AliTRDcluster* AliTRDseedV1::NextCluster()
166{
71ea19a3 167// Mimic the usage of STL iterators.
168// Forward iterator
169
ae4e8b84 170 fClusterIdx++; fClusterIter++;
71ea19a3 171 while(fClusterIdx < AliTRDseed::knTimebins){
172 if(!(*fClusterIter)){
173 fClusterIdx++;
174 fClusterIter++;
175 continue;
176 }
177 return *fClusterIter;
178 }
179 return 0x0;
180}
181
182//____________________________________________________________
183inline AliTRDcluster* AliTRDseedV1::PrevCluster()
184{
185// Mimic the usage of STL iterators.
186// Backward iterator
187
188 fClusterIdx--; fClusterIter--;
189 while(fClusterIdx >= 0){
190 if(!(*fClusterIter)){
191 fClusterIdx--;
192 fClusterIter--;
193 continue;
194 }
195 return *fClusterIter;
196 }
197 return 0x0;
198}
199
200//____________________________________________________________
201inline void AliTRDseedV1::ResetClusterIter(Bool_t forward)
202{
203// Mimic the usage of STL iterators.
204// Facilitate the usage of NextCluster for forward like
205// iterator (kTRUE) and PrevCluster for backward like iterator (kFALSE)
206
207 if(forward){
208 fClusterIter = &fClusters[0]; fClusterIter--;
209 fClusterIdx=-1;
210 } else {
211 fClusterIter = &fClusters[AliTRDseed::knTimebins-1]; fClusterIter++;
212 fClusterIdx=AliTRDseed::knTimebins;
213 }
ae4e8b84 214}
215
e4f2f73d 216#endif
217
47d5d320 218
6e49cfdb 219