StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Track.hh
1 
7 #ifndef Track_hh
8 #define Track_hh
9 
13 #include <vector>
14 
18 #include "TLinearFitter.h"
19 
23 #include "StHit.h"
24 
32 class Track : public vector<StHit*> {
33 private:
40  struct LessHit {
41  bool operator()(const StHit* hit1, const StHit* hit2) const
42  {
43  return hit1->position().z() < hit2->position().z();
44  }
45  };
46 
47 public:
51  StHit* firstHit() const;
52 
56  StHit* lastHit() const;
57 
61  void merge(Track* track);
62 
67  bool fit();
68 
72  double chi2zx();
73 
77  double chi2zy();
78 
82  int ndf() const;
83 
89  bool ok() const;
90 
97  bool accept(StHit* hit) const;
98 
104  double length() const;
105 
109  double x0() const;
110 
114  double y0() const;
115 
119  double dxdz() const;
120 
124  double dydz() const;
125 
129  double x0error() const;
130 
134  double y0error() const;
135 
139  double dxdzError() const;
140 
144  double dydzError() const;
145 
146 private:
147  static TLinearFitter mXfitter;
148  static TLinearFitter mYfitter;
149 
150  double mLength;
151  double mChiSquareX;
152  double mChiSquareY;
153  int mNumberFreeParameters;
154  double mX0;
155  double mY0;
156  double mdxdz;
157  double mdydz;
158  double mX0error;
159  double mY0error;
160  double mdxdzError;
161  double mdydzError;
162 };
163 
164 inline StHit* Track::firstHit() const { return front(); }
165 inline StHit* Track::lastHit() const { return back(); }
166 inline double Track::length() const { return mLength; }
167 inline double Track::chi2zx() { return mChiSquareX; }
168 inline double Track::chi2zy() { return mChiSquareY; }
169 inline int Track::ndf() const { return mNumberFreeParameters; }
170 inline double Track::x0() const { return mX0; }
171 inline double Track::y0() const { return mY0; }
172 inline double Track::dxdz() const { return mdxdz; }
173 inline double Track::dydz() const { return mdydz; }
174 inline double Track::x0error() const { return mX0error; }
175 inline double Track::y0error() const { return mY0error; }
176 inline double Track::dxdzError() const { return mdxdzError; }
177 inline double Track::dydzError() const { return mdydzError; }
178 
179 ostream& operator<<(ostream&, const Track&);
180 
181 #endif
void merge(Track *track)
Merge this track with that track.
Definition: Track.cc:19
double y0() const
y-intercept at z = 0
Definition: Track.hh:171
Definition: StHit.h:125
bool fit()
Perform linear fits in zx- and zy-plane.
Definition: Track.cc:26
double x0error() const
Error on x-intercept.
Definition: Track.hh:174
double chi2zx()
chi square of linear fit in zx-plane
Definition: Track.hh:167
double x0() const
x-intercept at z = 0
Definition: Track.hh:170
bool ok() const
Good track?
Definition: Track.cc:62
double dydz() const
dy/dz slope
Definition: Track.hh:173
double y0error() const
Error on y-intercept.
Definition: Track.hh:175
double chi2zy()
chi square of linear fit in zy-plane
Definition: Track.hh:168
bool accept(StHit *hit) const
Is hit close enough to track?
Definition: Track.cc:67
StHit * firstHit() const
First hit.
Definition: Track.hh:164
StHit * lastHit() const
Last hit.
Definition: Track.hh:165
double dxdz() const
dx/dz slope
Definition: Track.hh:172
double dxdzError() const
Error on dx/dz slope.
Definition: Track.hh:176
double dydzError() const
Error on dy/dz slope.
Definition: Track.hh:177
int ndf() const
Number of degrees of freedom.
Definition: Track.hh:169
C++ STL includes.
Definition: AgUStep.h:47
double length() const
Track length.
Definition: Track.hh:166