9 std::vector<float> &xyz,
13 std::vector<TrackEnd> usebeg,
14 std::vector<float> &doca
22 if (tracks.size() < 2)
return(1);
27 for (
size_t i=0; i<tracks.size(); ++i)
29 time += tracks.at(i).getTime();
31 if (tracks.size() > 0)
33 time /= tracks.size();
39 std::vector<TVectorF>
dir;
40 std::vector<TVectorF>
p;
42 for (
size_t itrack = 0; itrack < tracks.size(); ++itrack)
44 TVector3 trackbeg = tracks.at(itrack).getXYZBeg();
45 TVector3 trackend = tracks.at(itrack).getXYZEnd();
50 float tmppos[3] = {(
float) trackbeg.X(), (
float) trackbeg.Y(), (
float) trackbeg.Z()};
51 p.emplace_back(3,tmppos);
52 phi = tracks.at(itrack).getTrackParametersBegin()[3];
53 si = TMath::Tan(tracks.at(itrack).getTrackParametersBegin()[4]);
57 float tmppos[3] = {(
float) trackend.X(), (
float) trackend.Y(), (
float) trackend.Z()};
58 p.emplace_back(3,tmppos);
59 phi = tracks.at(itrack).getTrackParametersEnd()[3];
60 si = TMath::Tan(tracks.at(itrack).getTrackParametersEnd()[4]);
64 dtmp[1] = TMath::Sin(phi);
65 dtmp[2] = TMath::Cos(phi);
66 float norminv = 1.0/TMath::Sqrt(dtmp.Norm2Sqr());
83 for (
size_t itrack=0; itrack < tracks.size(); ++itrack)
85 for (
size_t i=0; i<3; ++i)
87 for (
size_t j=0; j<3; ++j)
89 VVT[i][j] = dir.at(itrack)[i]*dir.at(itrack)[j];
94 vsum += IMVVT*p.at(itrack);
98 if (det == 0)
return(1);
99 TVectorF xyzsol = A*vsum;
100 xyz.at(0) = xyzsol[0];
101 xyz.at(1) = xyzsol[1];
102 xyz.at(2) = xyzsol[2];
106 for (
size_t itrack=0; itrack < tracks.size(); ++itrack)
109 TVector3 dir3(dir.at(itrack)[0],dir.at(itrack)[1],dir.at(itrack)[2]);
110 TVectorF diff = xyzsol - p.at(itrack);
111 TVector3 diff3(diff[0],diff[1],diff[2]);
112 double dctmp = (diff3.Cross(dir3)).Mag2();
113 doca.push_back(dctmp);
114 chisquared += dctmp*dctmp;
123 for (
size_t i=0;i<3;++i)
125 std::vector<float> cmr;
126 for (
size_t j=0; j<3; ++j)
130 covmat.push_back(cmr);
int fitVertex(std::vector< TrackPar > &tracks, std::vector< float > &xyz, float &chisquared, std::vector< std::vector< float > > &covmat, double &time, std::vector< TrackEnd > usebeg, std::vector< float > &doca)
TrackEnd const TrackEndBeg