Bug fix by M.Fasel for parallel tracks
[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 ALIPID_H
19 #include "AliPID.h"
20 #endif
21
22 #ifndef ALIRIEMAN_H
23 #include "AliRieman.h"
24 #endif
25
26 class TTreeSRedirector;
27
28 class AliRieman;
29
30 class AliTRDtrackingChamber;
31 class AliTRDcluster;
32 class AliTRDtrack;
33 class AliTRDseedV1 : public AliTRDseed
34 {
35
36   public:
37
38         enum {
39           knSlices = 10
40         };
41
42         AliTRDseedV1(Int_t plane = -1);
43         ~AliTRDseedV1();
44         AliTRDseedV1(const AliTRDseedV1 &ref);
45         AliTRDseedV1& operator=(const AliTRDseedV1 &ref);
46
47         Bool_t  AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t quality, Bool_t kZcorr = kFALSE
48                                  , AliTRDcluster *c=0x0);
49         Bool_t  AttachClusters(AliTRDtrackingChamber *chamber, Bool_t kZcorr = kFALSE);
50         void    CookdEdx(Int_t nslices);
51         void    Draw(Option_t* o = "");
52         Bool_t  Fit();
53
54         Bool_t  Init(AliTRDtrack *track);
55         inline void      Init(const AliRieman *fit);
56         Bool_t    IsOwner() const          { return TestBit(1);}
57         Bool_t    IsRowCross() const       { return TestBit(2);}
58
59         inline Float_t   GetChi2Z(const Float_t z = 999.) const;
60         inline Float_t   GetChi2Y(const Float_t y = 999.) const;
61         void      GetCovAt(Double_t x, Double_t *cov) const;
62         Double_t* GetCrossXYZ() { return &fCross[0];}
63         Double_t  GetCrossSz2() const { return fCross[3];}
64         Float_t*  GetdEdx() {return &fdEdx[0];}
65         Float_t   GetdQdl(Int_t ic) const;
66         Double_t  GetMomentum() const {return fMom;}
67         Int_t     GetN() const {return fN2;}
68         Float_t   GetQuality(Bool_t kZcorr) const;
69         Int_t     GetPlane() const         { return fPlane;    }
70         Double_t* GetProbability();
71         Double_t  GetSnp() const           { return fSnp;}
72         Double_t  GetTgl() const           { return fTgl;}
73         Double_t  GetYat(Double_t x) const { return fYfitR[0] + fYfitR[1] * (x - fX0);}
74         Double_t  GetZat(Double_t x) const { return fZfitR[0] + fZfitR[1] * (x - fX0);}
75         
76         void      Print(Option_t *o = "") const;
77         
78         void      SetMomentum(Double_t mom) {fMom = mom;}
79         void      SetOwner(Bool_t own = kTRUE);
80         void      SetPlane(Int_t p)                      { fPlane     = p;   }
81         void      SetSnp(Double_t snp) {fSnp = snp;}
82         void      SetTgl(Double_t tgl) {fTgl = tgl;}
83
84  protected:
85
86         void Copy(TObject &ref) const;
87
88  private:
89
90         Int_t            fPlane;                  //  TRD plane
91         Float_t          fMom;                    //  Momentum estimate for tracklet [GeV/c]
92         Float_t          fSnp;                    // sin of track with respect to x direction in XY plane       
93         Float_t          fTgl;                    // tg of track with respect to x direction in XZ plane        
94         Float_t          fdX;                     // length of time bin
95         Float_t          fdEdx[knSlices];         //  dE/dx measurements for tracklet
96         Double_t         fCross[4];            // spatial parameters of the pad row crossing
97         Double_t         fProb[AliPID::kSPECIES]; //  PID probabilities
98
99         ClassDef(AliTRDseedV1, 1)                 //  New TRD seed 
100
101 };
102
103 //____________________________________________________________
104 inline Float_t AliTRDseedV1::GetChi2Z(const Float_t z) const
105 {
106         Float_t z1  = (z == 999.) ? fMeanz : z;
107         Float_t chi = fZref[0] - z1;
108         return chi*chi;
109 }
110
111 //____________________________________________________________
112 inline Float_t AliTRDseedV1::GetChi2Y(const Float_t y) const
113 {
114         Float_t y1  = (y == 999.) ? fYfitR[0] : y;
115         Float_t chi = fYref[0] - y1;
116         return chi*chi;
117 }
118
119 //____________________________________________________________
120 inline void AliTRDseedV1::Init(const AliRieman *rieman)
121 {
122         fZref[0] = rieman->GetZat(fX0);
123         fZref[1] = rieman->GetDZat(fX0);
124         fYref[0] = rieman->GetYat(fX0);
125         fYref[1] = rieman->GetDYat(fX0);
126 }
127
128 #endif
129
130