TRD module
[u/mrichter/AliRoot.git] / TRD / TRDbase / AliTRDtrackOnline.h
CommitLineData
10b59615 1#ifndef ALITRDTRACKONLINE_H
2#define ALITRDTRACKONLINE_H
3
4#include "TObject.h"
5#include "TList.h"
6
7#include "Math/IFunction.h"
8#include "Math/Minimizer.h"
9
10#include "AliTRDgeometry.h"
11#include "AliTRDpadPlane.h"
12
13class AliVTrdTracklet;
14class AliTRDtrackPosition;
15class AliTRDtrackOnline;
16class AliTRDgeometry;
17
18class AliTRDtrackParametrization : public TNamed
19{
20 public:
21 AliTRDtrackParametrization(const char* name = "", const char* title = "");
22 ~AliTRDtrackParametrization() {}
23
24 virtual void SetParams(ROOT::Math::Minimizer * minim) = 0;
25 virtual void GetParams(ROOT::Math::Minimizer * minim) = 0;
26 virtual void SetValues(const Double_t *par) = 0;
27 virtual Int_t GetNDim() const = 0;
28
29 virtual void UpdateTitle() {}
30
31 virtual AliTRDtrackPosition ExtrapolateToLayer(Int_t layer) = 0;
32 virtual AliTRDtrackPosition ExtrapolateToX(Float_t x) = 0;
33
34 Bool_t IsFitGood() const { return fFitGood; }
35
36 protected:
37 Bool_t fFitGood;
38
39 ClassDef(AliTRDtrackParametrization, 1);
40};
41
42
43class AliTRDtrackParametrizationStraightLine : public AliTRDtrackParametrization
44{
45 public:
46 AliTRDtrackParametrizationStraightLine();
47 AliTRDtrackParametrizationStraightLine(Double_t offsetY, Double_t slopeY,
48 Double_t offsetZ, Double_t slopeZ);
49
50 virtual void SetParams(ROOT::Math::Minimizer * minim);
51 virtual void GetParams(ROOT::Math::Minimizer * minim);
52 virtual void SetValues(const Double_t *par);
53 virtual Int_t GetNDim() const { return 4; }
54
55 AliTRDtrackPosition ExtrapolateToLayer(Int_t layer);
56 AliTRDtrackPosition ExtrapolateToX(Float_t x);
57
58 Double_t GetOffsetY() const { return fOffsetY; }
59 Double_t GetOffsetZ() const { return fOffsetZ; }
60 Double_t GetSlopeY() const { return fSlopeY; }
61 Double_t GetSlopeZ() const { return fSlopeZ; }
62
63 void Print(Option_t *option = "") const;
64
65 protected:
66 Double_t fOffsetY;
67 Double_t fSlopeY;
68 Double_t fOffsetZ;
69 Double_t fSlopeZ;
70
71 ClassDef(AliTRDtrackParametrizationStraightLine, 1);
72};
73
74
75class AliTRDtrackParametrizationCurved : public AliTRDtrackParametrization
76{
77 public:
78 AliTRDtrackParametrizationCurved();
79
80 virtual void SetParams(ROOT::Math::Minimizer * minim);
81 virtual void GetParams(ROOT::Math::Minimizer * minim);
82 virtual void SetValues(const Double_t *par);
83 virtual Int_t GetNDim() const { return 4; }
84
85 AliTRDtrackPosition ExtrapolateToLayer(Int_t layer);
86 AliTRDtrackPosition ExtrapolateToX(Float_t x);
87
88 Float_t GetY(Float_t x);
89
90 void Print(Option_t *option = "") const;
91
92 protected:
93 // parameters
94 Double_t fRadiusInv;
95 Double_t fOffsetY;
96 Double_t fOffsetZ;
97 Double_t fSlopeZ;
98
99 // fixed values
100 Double_t fOffsetX;
101
102 ClassDef(AliTRDtrackParametrizationCurved, 1);
103};
104
105
106class AliTRDtrackOnline : public TObject
107{
108 public:
109 AliTRDtrackOnline();
110 ~AliTRDtrackOnline();
111
112 void AddTracklet(AliVTrdTracklet *trkl);
113
114 Bool_t Fit(ROOT::Math::Minimizer *minim);
115
116 Int_t GetNTracklets() const { return fNTracklets; }
117 AliVTrdTracklet* GetTracklet(Int_t i) const { return i < fNTracklets ? (AliVTrdTracklet*) fTracklets[i] : 0x0; }
118
119 AliTRDtrackPosition ExtrapolateToLayer(Int_t layer);
120
121 void AddParametrization(AliTRDtrackParametrization *param) { fTrackParametrizations.Add(param); }
122 const TList& GetParametrizations() const { return fTrackParametrizations; }
123
124 void Print(Option_t *option = "") const;
125
9fb87430 126 void SetErrorY(Float_t error) { fErrorY = error; }
127 Float_t GetErrorY() const { return fErrorY; }
128
10b59615 129 static Float_t GetX(AliVTrdTracklet *trkl) { return fgGeometry->GetTime0(trkl->GetDetector() % 6); }
20af9b67 130 static Float_t GetZ(AliVTrdTracklet *trkl) { return
131 fgGeometry->GetPadPlane(trkl->GetDetector())->GetRowPos(trkl->GetBinZ()) -
132 .5 * fgGeometry->GetPadPlane(trkl->GetDetector())->GetRowSize(trkl->GetBinZ()); }
10b59615 133 static AliTRDgeometry *fgGeometry;
134
135 protected:
136 static const Int_t fgkMaxTracklets = 10;
137
138 Int_t fNTracklets;
139 TObjArray fTracklets;
140
141 TList fTrackParametrizations;
142
9fb87430 143 Float_t fErrorY;
144
10b59615 145 ClassDef(AliTRDtrackOnline, 1);
146};
147
148
149class AliTRDtrackPosition : public TObject
150{
151 public:
152 AliTRDtrackPosition(Float_t y, Float_t z, Float_t dy = 0.);
153 ~AliTRDtrackPosition();
154
155 Float_t GetY() const { return fY; }
156 Float_t GetZ() const { return fZ; }
157 Float_t GetdY() const { return fDy; }
158
159 Float_t Distance(AliVTrdTracklet *trkl) const;
160
161 protected:
162 Float_t fY;
163 Float_t fZ;
164 Float_t fDy;
165
166 ClassDef(AliTRDtrackPosition, 1);
167};
168
169
170class AliTRDtrackResiduals : public ROOT::Math::IBaseFunctionMultiDim
171{
172public:
173 AliTRDtrackResiduals(const AliTRDtrackOnline *track, AliTRDtrackParametrization *param);
174 AliTRDtrackResiduals(const AliTRDtrackResiduals &rhs);
175 AliTRDtrackResiduals& operator=(const AliTRDtrackResiduals &rhs);
176 ~AliTRDtrackResiduals() {}
177
178 AliTRDtrackResiduals* Clone() const;
179 UInt_t NDim() const { return fParam->GetNDim(); }
180 Double_t DoEval(const Double_t *par) const;
181
182protected:
183 const AliTRDtrackOnline *fTrack; // reference to track being fitted
184 AliTRDtrackParametrization *fParam; // reference to the used parametrization
185
186 static AliTRDgeometry *fgGeometry;
187};
188
189#endif