8 #include "StThreeVectorD.hh"
16 TLinearFitter Track::mXfitter(1,
"pol1",
"");
17 TLinearFitter Track::mYfitter(1,
"pol1",
"");
21 unsigned int oldSize = size();
22 copy(track->begin(), track->end(), back_inserter(*
this));
23 inplace_merge(begin(), begin()+oldSize, end(), LessHit());
31 mXfitter.ClearPoints();
32 mYfitter.ClearPoints();
33 for (iterator i = begin(); i != end(); ++i) {
35 double x = hit->position().x();
36 double y = hit->position().y();
37 double z = hit->position().z();
38 mXfitter.AddPoint(&z, x);
39 mYfitter.AddPoint(&z, y);
43 mChiSquareX = mXfitter.GetChisquare();
44 mChiSquareY = mYfitter.GetChisquare();
45 mNumberFreeParameters = mXfitter.GetNumberFreeParameters();
46 mX0 = mXfitter.GetParameter(0);
47 mY0 = mYfitter.GetParameter(0);
48 mdxdz = mXfitter.GetParameter(1);
49 mdydz = mYfitter.GetParameter(1);
50 mX0error = mXfitter.GetParError(0);
51 mY0error = mYfitter.GetParError(0);
52 mdxdzError = mXfitter.GetParError(1);
53 mdydzError = mYfitter.GetParError(1);
56 Line line(origin, direction);
64 return fabs(
dxdz()) <= MAX_SLOPE && fabs(
dydz()) <= MAX_SLOPE;
69 double dx =
x0() +
dxdz() * hit->position().z() - hit->position().x();
70 double dy =
y0() +
dydz() * hit->position().z() - hit->position().y();
71 double dr = hypot(dx, dy);
77 os <<
"Track " << &track <<
" has " << track.size() <<
" hits:\n";
78 for (Track::iterator i = track.begin(); i != track.end(); ++i) {
80 os << hit->position() <<
'\n';
82 os <<
"x0:\t" << track.
x0() <<
" +/- " << track.
x0error() <<
'\n'
83 <<
"y0:\t" << track.
y0() <<
" +/- " << track.
y0error() <<
'\n'
84 <<
"dxdz:\t" << track.
dxdz() <<
" +/- " << track.
dxdzError() <<
'\n'
85 <<
"dydz:\t" << track.
dydz() <<
" +/- " << track.
dydzError() <<
'\n'
86 <<
"chi2zx:\t" << track.
chi2zx() <<
'\n'
87 <<
"chi2zy:\t" << track.
chi2zy() <<
'\n'
88 <<
"probzx:\t" << TMath::Prob(track.
chi2zx(), track.
ndf()) <<
'\n'
89 <<
"probzy:\t" << TMath::Prob(track.
chi2zy(), track.
ndf()) <<
'\n';
void merge(Track *track)
Merge this track with that track.
double y0() const
y-intercept at z = 0
bool fit()
Perform linear fits in zx- and zy-plane.
double x0error() const
Error on x-intercept.
double chi2zx()
chi square of linear fit in zx-plane
double x0() const
x-intercept at z = 0
bool ok() const
Good track?
double dydz() const
dy/dz slope
StThreeVectorD perigee(const StThreeVectorD &point) const
Perigee, i.e. Closest point on the line to a given point.
double y0error() const
Error on y-intercept.
double chi2zy()
chi square of linear fit in zy-plane
bool accept(StHit *hit) const
Is hit close enough to track?
StHit * firstHit() const
First hit.
StHit * lastHit() const
Last hit.
double dxdz() const
dx/dz slope
double dxdzError() const
Error on dx/dz slope.
double dydzError() const
Error on dy/dz slope.
int ndf() const
Number of degrees of freedom.