place all tracks in the origTrack vector and initially all in the seedTrack vector
148 TrackLinkOf[trkIter] = newTrkToVtxLink;
149 myTrackToVtxLinks.push_back(newTrkToVtxLink);
153 unsigned int seedtracknumber = seedTracks.size();
156 if (seedtracknumber == 0) {
ATH_MSG_DEBUG(
"New iteration. No tracks available after track selection for seeding."); }
159 ATH_MSG_DEBUG(
"Iteration number " << iteration <<
" and tracks left for seeding " << seedtracknumber);
161 std::vector<const Trk::TrackParameters*> perigeeList;
163 perigeeList.reserve(seedTracks.size());
168 std::unique_ptr<Trk::IMode3dInfo>
info;
172 ATH_MSG_DEBUG(
"Found seed at x: " << seedVertex.x() <<
" at y: " << seedVertex.y() <<
" at z: " << seedVertex.z());
175 theVertexContainer->push_back(seededxAODVertex);
178 looseConstraintCovariance.setIdentity();
179 looseConstraintCovariance = looseConstraintCovariance * 1
e+8;
181 seededxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
184 if (seedVertex.z() == 0) {
185 ATH_MSG_DEBUG(
"No good seed found: no further vertices in event");
186 ATH_MSG_DEBUG(
"Number of input tracks: " << perigeeList.size() <<
", but no good seed returned");
191 looseConstraintCovariance.setIdentity();
192 looseConstraintCovariance = looseConstraintCovariance * 1
e+8;
204 MvfFitInfo(*actualCandidate) =
206 isInitialized(*actualCandidate) =
false;
207 std::vector<Trk::VxTrackAtVertex*> vectorOfTracks(0);
208 VTAV(*actualCandidate) = vectorOfTracks;
215 std::vector<xAOD::Vertex*>* actualvtxlink = actualLink->
vertices();
217 actualvtxlink->push_back(actualCandidate);
222 ATH_MSG_DEBUG(
" Considering n. " << VTAV(*actualCandidate).size() <<
" tracks for the fit. ");
223 if (actualCandidate !=
nullptr) {
224 if (VTAV(*actualCandidate).size() < 2) {
225 ATH_MSG_DEBUG(
"No tracks found near seed, while at least two tracks were expected.");
227 if (VTAV.isAvailable(*actualCandidate)) {
228 for (
auto *tav : VTAV(*actualCandidate)) {
229 if (tav ==
nullptr)
continue;
235 VTAV(*actualCandidate).clear();
237 if (MvfFitInfo.isAvailable(*actualCandidate) && MvfFitInfo(*actualCandidate) !=
nullptr) {
238 delete MvfFitInfo(*actualCandidate);
239 MvfFitInfo(*actualCandidate) =
nullptr;
241 delete actualCandidate;
242 actualCandidate =
nullptr;
251 ATH_MSG_DEBUG(
"Deleting tracks with really good fit to vertex from seeding tracks.");
254 ATH_MSG_DEBUG(
"Found and deleted " << nFound <<
" tracks from seeding tracks.");
256 ATH_MSG_DEBUG(
"All tracks used for fitting came from fiting tracks, removing closest from seeding.");
264 ATH_MSG_DEBUG(
"You still have not removed any tracks from seeds! Aborting.");
269 bool goodVertex =
checkFit(actualCandidate);
272 ATH_MSG_DEBUG(
"Bad vertex, deleting the vertex and clearing all pointers");
276 if (actualCandidate) {
277 if (VTAV.isAvailable(*actualCandidate)) {
278 for (
auto *tav : VTAV(*actualCandidate)) {
279 if (tav ==
nullptr)
continue;
285 VTAV(*actualCandidate).clear();
287 if (MvfFitInfo.isAvailable(*actualCandidate) && MvfFitInfo(*actualCandidate) !=
nullptr) {
288 delete MvfFitInfo(*actualCandidate);
289 MvfFitInfo(*actualCandidate) =
nullptr;
292 delete actualCandidate;
293 actualCandidate =
nullptr;
301 myxAODVertices.emplace_back(0, actualCandidate);
303 seedtracknumber = seedTracks.size();
308 <<
m_maxIterations <<
") reached; to reconstruct more vertices, set maxIterations to a higher value.");
311 ATH_MSG_DEBUG(
"Secondary vertex finding complete with " << iteration <<
" iterations and " << myxAODVertices.size()
312 <<
" vertices found.");
314 for (
const xAODVertex_pair& vtxIter : myxAODVertices) {
318 theVertexContainer->push_back(cand);
324 std::vector<Trk::VxTrackAtVertex>* tracksOfVertex = &(cand->
vxTrackAtVertex());
325 tracksOfVertex->clear();
328 if ((*MVFtrkIter).initialPerigee()) { (*MVFtrkIter).setPerigeeAtVertex(((*MVFtrkIter).initialPerigee())->clone()); }
329 tracksOfVertex->push_back(*MVFtrkIter);
333 for (
const xAODVertex_pair& vtxIter : myxAODVertices) {
339 MVFtrkIter =
nullptr;
342 delete MvfFitInfo(*cand);
348 std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx = &((vxIter)->vxTrackAtVertex());
349 if (!myVxTracksAtVtx)
continue;
358 if (linkToXAODTP) { (vxIter)->addTrackAtVertex(*linkToXAODTP, (tracksIter).weight()); }
361 int ntrk = myVxTracksAtVtx->size();
376 if (!theVertexContainer->empty()) {
381 theVertexContainer->push_back(dummyxAODVertex);
384 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
391 else if (theVertexContainer->empty()) {
393 theVertexContainer->push_back(dummyxAODVertex);
396 looseConstraintCovariance.setIdentity();
397 looseConstraintCovariance = looseConstraintCovariance * 1
e+8;
399 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
408 for (
unsigned int i = 0;
i < theVertexContainer->size();
i++) {
420 ATH_MSG_DEBUG(
" Vtx: " <<
i <<
" x= " << (*theVertexContainer)[
i]->position().
x() <<
" y= "
421 << (*theVertexContainer)[
i]->position().
y() <<
" z= " << (*theVertexContainer)[
i]->position().
z()
422 <<
" ntracks= " << (*theVertexContainer)[
i]->vxTrackAtVertex().
size() <<
" chi2= "
423 << (*theVertexContainer)[
i]->
chiSquared() <<
" #dof = " << (*theVertexContainer)[
i]->numberDoF());
426 ATH_MSG_DEBUG(
"Done finding " << theVertexContainer->size() <<
" vertices and cleaning the container.");
427 ATH_MSG_DEBUG(
"Seeds good/bad/all : " << noVtx <<
"/" << kinkVtx <<
"/" << notSpec);
428 ATH_MSG_DEBUG(
"'Good' secondaries : " << secVtx <<
" and V0: " << V0vtx);
430 return std::make_pair(theVertexContainer, theVertexAuxContainer);