diff --git a/reco/KF/CbmKFPrimaryVertexFinder.cxx b/reco/KF/CbmKFPrimaryVertexFinder.cxx index f5914e4e34c6091bb28175a5cb124263c7936194..1439f1c805b3d16108c2776b5dc31dc66153d7ef 100644 --- a/reco/KF/CbmKFPrimaryVertexFinder.cxx +++ b/reco/KF/CbmKFPrimaryVertexFinder.cxx @@ -65,8 +65,8 @@ void CbmKFPrimaryVertexFinder::Fit(CbmKFVertexInterface& vtx) C[5] = (t.dz / 2 / 3.5) * (t.dz / 2 / 3.5); } + int fitIterSuccess = 0; // no. of successful calculations of the vertex position out of requested MaxIter. //* Iteratively fit vertex - number of iterations fixed at MaxIter - for (Int_t iteration = 0; iteration < MaxIter; ++iteration) { //* Store vertex from previous iteration @@ -194,15 +194,21 @@ void CbmKFPrimaryVertexFinder::Fit(CbmKFVertexInterface& vtx) C[3] -= K[2][0] * CHt[0][0] + K[2][1] * CHt[0][1]; C[4] -= K[2][0] * CHt[1][0] + K[2][1] * CHt[1][1]; C[5] -= K[2][0] * CHt[2][0] + K[2][1] * CHt[2][1]; - } //* itr - + } //* itr + if (vtx.GetRefNTracks()) fitIterSuccess++; // mark success of this iteration for vertex calculation } //* finished iterations //* Copy state vector to output (covariance matrix was used directly ) - - vtx.GetRefX() = r[0]; - vtx.GetRefY() = r[1]; - vtx.GetRefZ() = r[2]; + if (fitIterSuccess) { // store successful PV calculation. May include also a reference to MaxIter (AB 17.10.2024) + vtx.GetRefX() = r[0]; + vtx.GetRefY() = r[1]; + vtx.GetRefZ() = r[2]; + } + else { + vtx.GetRefX() = -999; + vtx.GetRefY() = -999; + vtx.GetRefZ() = -999; + } } int CbmKFPrimaryVertexFinder::GetUsedTracks(std::vector<uint32_t>& idx) const