20 const std::vector<RefCountedKinematicParticle>&
input)
const {
24 par(0) =
vtx.position().x();
25 par(1) =
vtx.position().y();
26 par(2) =
vtx.position().z();
31 std::vector<KinematicRefittedTrackState*> rStates;
32 std::vector<RefCountedVertexTrack> refTracks =
vtx.tracks();
33 for (std::vector<RefCountedVertexTrack>::const_iterator
i = refTracks.begin();
i != refTracks.end(); ++
i) {
39 en +=
sqrt(f_mom(1) * f_mom(1) + f_mom(2) * f_mom(2) + f_mom(3) * f_mom(3) + f_mom(0) * f_mom(0));
40 ch += (*i)->linearizedTrack()->charge();
41 rStates.push_back(rs);
45 double differ = en * en - (par(3) * par(3) + par(4) * par(4) + par(5) * par(5));
47 par(6) =
sqrt(differ);
49 LogDebug(
"FinalTreeBuilder") <<
"Fit failed: Current precision does not allow to calculate the mass\n";
65 for (
int i = 1;
i < 8;
i++) {
66 for (
int j = 1;
j < 8;
j++) {
68 sCov(
i - 1,
j - 1) = cov(
i,
j);
88 float vChi =
vtx.totalChiSquared();
89 float vNdf =
vtx.degreesOfFreedom();
94 resTree->addParticle(pVrt, dVrt,
nPart);
97 std::vector<RefCountedKinematicParticle> rrP;
99 std::vector<RefCountedKinematicParticle>::const_iterator
j;
100 std::vector<RefCountedVertexTrack>::const_iterator
i;
101 for (
j =
input.begin(),
i = refTracks.begin();
j !=
input.end() &&
i != refTracks.end(); ++
j, ++
i) {
113 rrP.push_back(
nPart);
114 if ((*j)->correspondingTree() !=
nullptr) {
117 tree->movePointerToTheTop();
120 resTree->addTree(cdVertex,
tree);
124 resTree->addParticle(dVrt, nV,
nPart);
133 std::vector<RefCountedVertexTrack> refTracks =
vtx.tracks();
134 int size = refTracks.size();
141 double energy_total =
sqrt(par(3) * par(3) + par(6) * par(6) + par(5) * par(5) + par(4) * par(4));
143 std::vector<RefCountedVertexTrack>::const_iterator rt_i;
145 for (rt_i = refTracks.begin(); rt_i != refTracks.end(); rt_i++) {
148 double rho = param[0];
149 double theta = param[1];
150 double phi = param[2];
151 double mass = param[5];
153 if ((**rt_i).linearizedTrack()->charge() != 0) {
154 a = -(**rt_i).refittedState()->freeTrajectoryState().parameters().magneticFieldInInverseGeV(
vtx.position()).
z() *
155 (**rt_i).refittedState()->freeTrajectoryState().parameters().charge();
175 jc_el(4, 4) = energy_total *
mass / (par(6) * energy_local);
188 jac.sub(4, i_int * 4 + 4, jc_el);
192 cov.sub(1, 1, asHepMatrix<7>((**rt_i).fullCovariance()));
195 AlgebraicMatrix fullCovMatrix(asHepMatrix<7>((**rt_i).fullCovariance()));
207 cov.sub(i_int * 4 + 4, i_int * 4 + 4, m_m_cov);
210 cov.sub(1, i_int * 4 + 4, x_p_cov);
211 cov.sub(i_int * 4 + 4, 1, p_x_cov);
217 for (std::vector<RefCountedVertexTrack>::const_iterator rt_j = refTracks.begin(); rt_j != refTracks.end(); rt_j++) {
219 AlgebraicMatrix i_k_cov_m = asHepMatrix<4, 4>(
vtx.tkToTkCovariance((*rt_i), (*rt_j)));
221 cov.sub(i_int * 4 + 4, j_int * 4 + 4, i_k_cov_m);
222 cov.sub(j_int * 4 + 4, i_int * 4 + 4, i_k_cov_m.T());
232 return jac * cov * jac.T();