00001 #include "AlVertexFitter.h"
00002
00004
00005
00006
00007
00008
00010
00011 bool AlVertexFitter::doFit(AlephCollection<QvecBase*>& track_collection,
00012 AlUserTrack& motherTrack, AlUsrVertex& endVertex) const {
00013
00014 vector<Helix> vTracks;
00015 Helix tempT;
00016
00017
00018 AlephCollection<QvecBase*>::iterator Iqv;
00019 for (Iqv = track_collection.begin(); Iqv < track_collection.end(); Iqv++) {
00020 tempT.setTrackParameters(*Iqv);
00021 vTracks.push_back(tempT);
00022 }
00023
00024
00025 HepLorentzVector track4V;
00026 Hep3Vector vertex3V;
00027 HepSymMatrix covTrack;
00028 HepSymMatrix covVertex;
00029 HepMatrix corrVertexTrack;
00030 float chi2;
00031 bool failed = _algo->getResult(vTracks, track4V, covTrack,
00032 vertex3V, covVertex, corrVertexTrack, chi2);
00033
00034 if (! failed ) {
00035 if (chi2 < 0.) {
00036 failed = ! failed;
00037 } else {
00038
00039 endVertex.setA4V(vertex3V.x(), vertex3V.y(), vertex3V.z(), 0.);
00040 endVertex.setEM(covVertex);
00041 endVertex.setCHIF((double) chi2);
00042
00043
00044 motherTrack.setA4V(track4V);
00045 motherTrack.setEndVertex(& endVertex);
00046 motherTrack.setEM_kin(covTrack);
00047 motherTrack.setCorrMatrix(corrVertexTrack);
00048
00049 for (Iqv = track_collection.begin(); Iqv < track_collection.end(); Iqv++)
00050 motherTrack.addDaughter(*Iqv);
00051 }
00052 }
00053
00054 return failed;
00055
00056 }