3 #ifndef VertexFitterSimple_h
4 #define VertexFitterSimple_h 1
10 using namespace lcfiplus;
14 template<
class Iterator>
17 Vertex* operator() (Iterator tracksBegin, Iterator tracksEnd,
Vertex* pointConstraint = 0,
bool pointInitialOnly =
false) {
21 if (pointConstraint) {
23 vector<PointBase*> tracks;
24 if (!pointInitialOnly)
27 for (Iterator it = tracksBegin; it != tracksEnd; it++,ntracks++) {
28 tracks.push_back(
new Helix(*it));
31 cout <<
"VertexFitterSimple: number of tracks is " << ntracks << endl;
33 TVector3 initial = pointConstraint->getPos();
35 double chi2 = -gh->
PointFit(tracks, initial, result);
37 TVector3 vresult = result->
GetPos();
39 cov[Vertex::xx] = result->
GetErr(0,0);
40 cov[Vertex::xy] = result->
GetErr(0,1);
41 cov[Vertex::xz] = result->
GetErr(0,2);
42 cov[Vertex::yy] = result->
GetErr(1,1);
43 cov[Vertex::yz] = result->
GetErr(1,2);
44 cov[Vertex::zz] = result->
GetErr(2,2);
47 cout <<
"Vertex cov matrix:" << endl;
48 cout << scientific << cov[Vertex::xx] <<
" ";
49 cout << cov[Vertex::yy] <<
" ";
50 cout << cov[Vertex::zz] <<
" ";
51 cout << cov[Vertex::xy] <<
" ";
52 cout << cov[Vertex::yz] <<
" ";
53 cout << cov[Vertex::xz] << endl << fixed;
57 cout <<
"VertexFitterSimple: vertex position is " << endl;
61 Vertex* vtx =
new Vertex(chi2, TMath::Prob(chi2, ntracks*2-3), vresult.x(), vresult.y(), vresult.z(),
cov,
false);
62 for (Iterator it = tracksBegin; it != tracksEnd; it++,ntracks++) {
67 cout <<
"VertexFitterSimple: track loglikelihood is " << ll << endl;
71 for (vector<PointBase*>::iterator it = tracks.begin(); it != tracks.end(); it++) {
80 vector<Helix*> tracks;
82 for (Iterator it = tracksBegin; it != tracksEnd; it++,ntracks++) {
83 tracks.push_back(
new Helix(*it));
86 cout <<
"VertexFitterSimple: number of tracks is " << ntracks << endl;
91 TVector3 vresult = result->
GetPos();
93 cov[Vertex::xx] = result->
GetErr(0,0);
94 cov[Vertex::xy] = result->
GetErr(0,1);
95 cov[Vertex::xz] = result->
GetErr(0,2);
96 cov[Vertex::yy] = result->
GetErr(1,1);
97 cov[Vertex::yz] = result->
GetErr(1,2);
98 cov[Vertex::zz] = result->
GetErr(2,2);
101 cout <<
"VertexFitterSimple: vertex position is " << endl;
105 Vertex* vtx =
new Vertex(chi2, (ntracks > 1 ? TMath::Prob(chi2, ntracks*2-3) : 1), vresult.x(), vresult.y(), vresult.z(),
cov,
false);
106 for (Iterator it = tracksBegin; it != tracksEnd; it++, ntracks++) {
110 cout <<
"VertexFitterSimple: track loglikelihood is " << ll << endl;
114 for (vector<Helix*>::iterator it = tracks.begin(); it != tracks.end(); it++) {
127 TVector3 v = vtx->
getPos();
129 }
else if (mode == 1) {
135 vector<PointBase*> vpt;
136 vpt.push_back(&ptVtx);
143 vector<PointBase*> vpt;
144 for (
unsigned int n=0; n<vtx->
getTracks().size(); n++) {
147 vpt.push_back(
new Helix(trk));
153 for (
unsigned int n=0; n<vpt.size(); n++) {
double GetErr(int i, int j) const
Definition: geometry.h:53
Definition: lcfiplus.h:771
Definition: geometry.h:222
double getChi2(const Vertex *vtx, const Track *trk, int mode=1)
Definition: VertexFitterSimple.h:122
Definition: lcfiplus.h:384
Definition: VertexFitterSimple.h:15
Definition: geometry.h:64
TVector3 getPos() const
Definition: lcfiplus.h:817
VertexFitterSimple< vector< const Track * >::const_iterator > VertexFitterSimple_V
Definition: VertexFitterSimple.h:168
double HelixPointFit(const vector< Helix * > &helices, Point *result=0)
VertexFitterSimple< list< const Track * >::const_iterator > VertexFitterSimple_L
Definition: VertexFitterSimple.h:169
Definition: geometry.h:29
TVector3 GetPos() const
Definition: geometry.h:56
void add(const Track *trk)
Definition: lcfiplus.cc:827
double PointFit(const vector< PointBase * > &points, const TVector3 &initial, Point *result=0)
cov
Definition: lcfiplus.h:26
virtual double LogLikelihood(const TVector3 &p) const
Definition: geometry.h:118
const vector< const Track * > & getTracks() const
Definition: lcfiplus.h:823