]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDseedV1.h
- Move to the new attaching cluster to tracklet procedure in the stand
[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
e3cf3d02 14#ifndef ROOT_TObject
15#include "TObject.h"
16#endif
17
18#ifndef ROOT_TMath
19#include "TMath.h"
e4f2f73d 20#endif
21
ae4e8b84 22#ifndef ALITRDGEOMETRY_H
23#include "AliTRDgeometry.h"
24#endif
25
0906e73e 26#ifndef ALIPID_H
27#include "AliPID.h"
28#endif
29
e4f2f73d 30#ifndef ALIRIEMAN_H
31#include "AliRieman.h"
32#endif
33
f29f13a6 34#ifndef ALITRDCLUSTER_H
35#include "AliTRDcluster.h"
36#endif
37
e4f2f73d 38class TTreeSRedirector;
39
40class AliRieman;
41
eb38ed55 42class AliTRDtrackingChamber;
f3d3af1b 43class AliTRDtrackV1;
3a039a31 44class AliTRDReconstructor;
e3cf3d02 45class AliTRDseedV1 : public TObject //TODO we should inherit
46{ // AliTRDtrackletBase
47public:
48 enum ETRDtrackletBuffers {
49 kNtb = 32 // max clusters/pad row
50 ,kNTimeBins = 2*kNtb // max number of clusters/tracklet
51 ,kNSlices = 10 // max dEdx slices
e44586fb 52 };
e3cf3d02 53
2e2915e7 54 // bits from 0-13 are reserved by ROOT (see TObject.h)
e3cf3d02 55 enum ETRDtrackletStatus {
f29f13a6 56 kOwner = BIT(14) // owner of its clusters
57 ,kRowCross = BIT(15) // pad row cross tracklet
58 ,kCalib = BIT(16) // calibrated tracklet
59 ,kKink = BIT(17) // kink prolongation tracklet
60 ,kStandAlone = BIT(18)
e44586fb 61 };
62
ae4e8b84 63 AliTRDseedV1(Int_t det = -1);
e44586fb 64 ~AliTRDseedV1();
65 AliTRDseedV1(const AliTRDseedV1 &ref);
66 AliTRDseedV1& operator=(const AliTRDseedV1 &ref);
67
f29f13a6 68/* Bool_t AttachClustersIter(
203967fc 69 AliTRDtrackingChamber *chamber, Float_t quality,
f29f13a6 70 Bool_t kZcorr = kFALSE, AliTRDcluster *c=0x0);*/
203967fc 71 Bool_t AttachClusters(
b1957d3c 72 AliTRDtrackingChamber *chamber, Bool_t tilt = kFALSE);
203967fc 73 void Bootstrap(const AliTRDReconstructor *rec);
e3cf3d02 74 void Calibrate();
203967fc 75 void CookdEdx(Int_t nslices);
e3cf3d02 76 void CookLabels();
d937ad7a 77 Bool_t Fit(Bool_t tilt=kTRUE, Int_t errors = 2);
f29f13a6 78// void FitMI();
203967fc 79 Bool_t Init(AliTRDtrackV1 *track);
e44586fb 80 inline void Init(const AliRieman *fit);
203967fc 81 Bool_t IsEqual(const TObject *inTracklet) const;
e3cf3d02 82 Bool_t IsCalibrated() const { return TestBit(kCalib);}
e44586fb 83 Bool_t IsOwner() const { return TestBit(kOwner);}
f29f13a6 84 Bool_t IsKink() const { return TestBit(kKink);}
85 Bool_t IsOK() const { return fN2 > 4 && fNUsed < 4;}
e44586fb 86 Bool_t IsRowCross() const { return TestBit(kRowCross);}
f29f13a6 87 Bool_t IsUsable(Int_t i) const { return fClusters[i] && !fClusters[i]->IsUsed();}
88 Bool_t IsStandAlone() const { return TestBit(kStandAlone);}
e44586fb 89
e3cf3d02 90 Float_t GetC() const { return fC; }
91 Float_t GetChi2() const { return fChi2; }
92 inline Float_t GetChi2Z() const;
93 inline Float_t GetChi2Y() const;
f29f13a6 94 inline Float_t GetChi2Phi() const;
d937ad7a 95 static void GetClusterXY(const AliTRDcluster *c, Double_t &x, Double_t &y);
e44586fb 96 void GetCovAt(Double_t x, Double_t *cov) const;
d937ad7a 97 void GetCovXY(Double_t *cov) const { memcpy(cov, &fCov[0], 3*sizeof(Double_t));}
ac6764f5 98 void GetCovRef(Double_t *cov) const { memcpy(cov, &fRefCov[0], 3*sizeof(Double_t));}
203967fc 99 Float_t GetdX() const { return fdX;}
100 Float_t* GetdEdx() { return &fdEdx[0];}
e44586fb 101 Float_t GetdQdl(Int_t ic) const;
203967fc 102 Int_t GetDetector() const { return fDet;}
e3cf3d02 103 void GetCalibParam(Float_t &exb, Float_t &vd, Float_t &t0, Float_t &s2, Float_t &dl, Float_t &dt) const {
104 exb = fExB; vd = fVD; t0 = fT0; s2 = fS2PRF; dl = fDiffL; dt = fDiffT;}
105 AliTRDcluster* GetClusters(Int_t i) const { return i<0 || i>=kNTimeBins ? 0x0 : fClusters[i];}
106 Int_t GetIndexes(Int_t i) const{ return i<0 || i>=kNTimeBins ? -1 : fIndexes[i];}
107 Int_t GetLabels(Int_t i) const { return fLabels[i];}
203967fc 108 Double_t GetMomentum() const { return fMom;}
109 Int_t GetN() const { return fN2;}
e3cf3d02 110 Int_t GetN2() const { return fN2;}
111 Int_t GetNUsed() const { return fNUsed;}
e44586fb 112 Float_t GetQuality(Bool_t kZcorr) const;
e3cf3d02 113 Float_t GetPadLength() const { return fPadLength;}
ae4e8b84 114 Int_t GetPlane() const { return AliTRDgeometry::GetLayer(fDet); }
115
e3cf3d02 116 Float_t* GetProbability();
117 Float_t GetS2Y() const { return fS2Y;}
118 Float_t GetS2Z() const { return fS2Z;}
119 Float_t GetSigmaY() const { return fS2Y > 0. ? TMath::Sqrt(fS2Y) : 0.2;}
120 Float_t GetSnp() const { return fYref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);}
121 Float_t GetTgl() const { return fZref[1];}
122 Float_t GetTilt() const { return fTilt;}
123 Float_t GetX0() const { return fX0;}
124 Float_t GetX() const { return fX0 - fX;}
5a7a515d 125 Float_t GetY() const { return fYfit[0] - fYfit[1] * fX;}
b1957d3c 126 Double_t GetYat(Double_t x) const { return fYfit[0] - fYfit[1] * (fX0-x);}
e3cf3d02 127 Float_t GetYfit(Int_t id) const { return fYfit[id];}
128 Float_t GetYref(Int_t id) const { return fYref[id];}
3658afdc 129 Float_t GetZ() const { return fZfit[0] - fZfit[1] * fX;}
b1957d3c 130 Double_t GetZat(Double_t x) const { return fZfit[0] - fZfit[1] * (fX0-x);}
e3cf3d02 131 Float_t GetZfit(Int_t id) const { return fZfit[id];}
132 Float_t GetZref(Int_t id) const { return fZref[id];}
f29f13a6 133// Long_t GetUsabilityMap() const { return fUsable; }
e3cf3d02 134
ae4e8b84 135 inline AliTRDcluster* NextCluster();
71ea19a3 136 inline AliTRDcluster* PrevCluster();
e44586fb 137 void Print(Option_t *o = "") const;
71ea19a3 138 inline void ResetClusterIter(Bool_t forward = kTRUE);
e3cf3d02 139 void Reset();
ae4e8b84 140
e3cf3d02 141 void SetC(Float_t c) { fC = c;}
142 void SetChi2(Float_t chi2) { fChi2 = chi2;}
0849f128 143 void SetCovRef(const Double_t *cov) { memcpy(&fRefCov[0], cov, 3*sizeof(Double_t));}
e3cf3d02 144 void SetIndexes(Int_t i, Int_t idx) { fIndexes[i] = idx; }
145 void SetLabels(Int_t *lbls) { memcpy(fLabels, lbls, 3*sizeof(Int_t)); }
f29f13a6 146 void SetKink(Bool_t k) { SetBit(kKink, k);}
147 void SetStandAlone(Bool_t st) { SetBit(kStandAlone, st); }
203967fc 148 void SetMomentum(Double_t mom){ fMom = mom;}
29b87567 149 void SetOwner();
e3cf3d02 150 void SetTilt(Float_t tilt) { fTilt = tilt; }
151 void SetPadLength(Float_t len){ fPadLength = len;}
203967fc 152 void SetDetector(Int_t d) { fDet = d; }
bee2b41e 153 void SetDX(Float_t inDX) { fdX = inDX;}
3a039a31 154 void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
e3cf3d02 155 void SetX0(Float_t x0) { fX0 = x0; }
156 void SetYref(Int_t i, Float_t y) { fYref[i] = y;}
157 void SetZref(Int_t i, Float_t z) { fZref[i] = z;}
f29f13a6 158// void SetUsabilityMap(Long_t um) { fUsable = um; }
b1957d3c 159 void UpDate(const AliTRDtrackV1* trk);
e3cf3d02 160 void UpdateUsed();
161 void UseClusters();
e4f2f73d 162
d937ad7a 163protected:
e44586fb 164 void Copy(TObject &ref) const;
e4f2f73d 165
e44586fb 166private:
0ae89c5d 167 const AliTRDReconstructor *fReconstructor;//! local reconstructor
e3cf3d02 168 AliTRDcluster **fClusterIter; //! clusters iterator
169 Int_t fIndexes[kNTimeBins]; //! Indexes
170 Float_t fExB; //! tg(a_L) @ tracklet location
171 Float_t fVD; //! drift velocity @ tracklet location
172 Float_t fT0; //! time 0 @ tracklet location
173 Float_t fS2PRF; //! sigma^2 PRF for xd->0 and phi=a_L
174 Float_t fDiffL; //! longitudinal diffusion coefficient
175 Float_t fDiffT; //! transversal diffusion coefficient
71ea19a3 176 Char_t fClusterIdx; //! clusters iterator
f29f13a6 177// ULong_t fUsable; //! bit map of usable clusters
e3cf3d02 178 UChar_t fN2; // number of clusters attached
f29f13a6 179 UChar_t fNUsed; // number of used usable clusters
e3cf3d02 180 Short_t fDet; // TRD detector
181 Float_t fTilt; // local tg of the tilt angle
182 Float_t fPadLength; // local pad length
183 AliTRDcluster *fClusters[kNTimeBins]; // Clusters
184 Float_t fYref[2]; // Reference y
185 Float_t fZref[2]; // Reference z
186 Float_t fYfit[2]; // Y fit position +derivation
187 Float_t fZfit[2]; // Z fit position
188 Float_t fMom; // Momentum estimate @ tracklet [GeV/c]
e44586fb 189 Float_t fdX; // length of time bin
e3cf3d02 190 Float_t fX0; // anode wire position
191 Float_t fX; // radial position of the tracklet
192 Float_t fY; // r-phi position of the tracklet
193 Float_t fZ; // z position of the tracklet
194 Float_t fS2Y; // estimated resolution in the r-phi direction
195 Float_t fS2Z; // estimated resolution in the z direction
196 Float_t fC; // Curvature
197 Float_t fChi2; // Global chi2
198 Float_t fdEdx[kNSlices]; // dE/dx measurements for tracklet
199 Float_t fProb[AliPID::kSPECIES]; // PID probabilities
200 Int_t fLabels[3]; // most frequent MC labels and total number of different labels
6e4d4425 201 Double_t fRefCov[3]; // covariance matrix of the track in the yz plane
d937ad7a 202 Double_t fCov[3]; // covariance matrix of the tracklet in the xy plane
e4f2f73d 203
e3cf3d02 204 ClassDef(AliTRDseedV1, 5) // The offline TRD tracklet
e4f2f73d 205};
206
207//____________________________________________________________
e3cf3d02 208inline Float_t AliTRDseedV1::GetChi2Z() const
e4f2f73d 209{
e3cf3d02 210 Double_t dz = fZref[0]-fZfit[0]; dz*=dz;
211 Double_t cov[3]; GetCovAt(fX, cov);
212 Double_t s2 = fRefCov[2]+cov[2];
213 return s2 > 0. ? dz/s2 : 0.;
e4f2f73d 214}
215
216//____________________________________________________________
e3cf3d02 217inline Float_t AliTRDseedV1::GetChi2Y() const
e4f2f73d 218{
e3cf3d02 219 Double_t dy = fYref[0]-fYfit[0]; dy*=dy;
220 Double_t cov[3]; GetCovAt(fX, cov);
221 Double_t s2 = fRefCov[0]+cov[0];
222 return s2 > 0. ? dy/s2 : 0.;
e4f2f73d 223}
224
f29f13a6 225//____________________________________________________________
226inline Float_t AliTRDseedV1::GetChi2Phi() const
227{
228 Double_t dphi = fYref[1]-fYfit[1]; dphi*=dphi;
229 Double_t cov[3]; GetCovAt(fX, cov);
230 Double_t s2 = fRefCov[2]+cov[2];
231 return s2 > 0. ? dphi/s2 : 0.;
232}
233
e4f2f73d 234//____________________________________________________________
0906e73e 235inline void AliTRDseedV1::Init(const AliRieman *rieman)
e4f2f73d 236{
e44586fb 237 fZref[0] = rieman->GetZat(fX0);
238 fZref[1] = rieman->GetDZat(fX0);
239 fYref[0] = rieman->GetYat(fX0);
240 fYref[1] = rieman->GetDYat(fX0);
55ef6967 241 fC = rieman->GetC();
242 fChi2 = rieman->GetChi2();
e4f2f73d 243}
244
ae4e8b84 245//____________________________________________________________
246inline AliTRDcluster* AliTRDseedV1::NextCluster()
247{
71ea19a3 248// Mimic the usage of STL iterators.
249// Forward iterator
250
ae4e8b84 251 fClusterIdx++; fClusterIter++;
e3cf3d02 252 while(fClusterIdx < kNTimeBins){
71ea19a3 253 if(!(*fClusterIter)){
254 fClusterIdx++;
255 fClusterIter++;
256 continue;
257 }
258 return *fClusterIter;
259 }
260 return 0x0;
261}
262
263//____________________________________________________________
264inline AliTRDcluster* AliTRDseedV1::PrevCluster()
265{
266// Mimic the usage of STL iterators.
267// Backward iterator
268
269 fClusterIdx--; fClusterIter--;
270 while(fClusterIdx >= 0){
271 if(!(*fClusterIter)){
272 fClusterIdx--;
273 fClusterIter--;
274 continue;
275 }
276 return *fClusterIter;
277 }
278 return 0x0;
279}
280
281//____________________________________________________________
282inline void AliTRDseedV1::ResetClusterIter(Bool_t forward)
283{
284// Mimic the usage of STL iterators.
285// Facilitate the usage of NextCluster for forward like
286// iterator (kTRUE) and PrevCluster for backward like iterator (kFALSE)
287
288 if(forward){
289 fClusterIter = &fClusters[0]; fClusterIter--;
290 fClusterIdx=-1;
291 } else {
e3cf3d02 292 fClusterIter = &fClusters[kNTimeBins-1]; fClusterIter++;
293 fClusterIdx=kNTimeBins;
71ea19a3 294 }
ae4e8b84 295}
296
e4f2f73d 297#endif
298
47d5d320 299
6e49cfdb 300