place all tracks in the origTrack vector and initially all in the seedTrack vector
149 TrackLinkOf[trkIter] = newTrkToVtxLink;
150 myTrackToVtxLinks.push_back(newTrkToVtxLink);
154 unsigned int seedtracknumber = seedTracks.size();
157 if (seedtracknumber == 0) {
ATH_MSG_DEBUG(
"New iteration. No tracks available after track selection for seeding."); }
160 ATH_MSG_DEBUG(
"Iteration number " << iteration <<
" and tracks left for seeding " << seedtracknumber);
162 std::vector<const Trk::TrackParameters*> perigeeList;
164 perigeeList.reserve(seedTracks.size());
169 std::unique_ptr<Trk::IMode3dInfo>
info;
173 ATH_MSG_DEBUG(
"Found seed at x: " << seedVertex.x() <<
" at y: " << seedVertex.y() <<
" at z: " << seedVertex.z());
176 theVertexContainer->push_back(seededxAODVertex);
179 looseConstraintCovariance.setIdentity();
180 looseConstraintCovariance = looseConstraintCovariance * 1
e+8;
182 seededxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
185 if (seedVertex.z() == 0) {
186 ATH_MSG_DEBUG(
"No good seed found: no further vertices in event");
187 ATH_MSG_DEBUG(
"Number of input tracks: " << perigeeList.size() <<
", but no good seed returned");
192 looseConstraintCovariance.setIdentity();
193 looseConstraintCovariance = looseConstraintCovariance * 1
e+8;
205 MvfFitInfo(*actualCandidate) =
207 isInitialized(*actualCandidate) =
false;
208 std::vector<Trk::VxTrackAtVertex*> vectorOfTracks(0);
209 VTAV(*actualCandidate) = vectorOfTracks;
216 std::vector<xAOD::Vertex*>* actualvtxlink = actualLink->
vertices();
218 actualvtxlink->push_back(actualCandidate);
223 ATH_MSG_DEBUG(
" Considering n. " << VTAV(*actualCandidate).size() <<
" tracks for the fit. ");
225 if (VTAV(*actualCandidate).size() < 2) {
226 ATH_MSG_DEBUG(
"No tracks found near seed, while at least two tracks were expected.");
228 if (VTAV.isAvailable(*actualCandidate)) {
229 for (
auto *tav : VTAV(*actualCandidate)) {
230 if (tav ==
nullptr)
continue;
236 VTAV(*actualCandidate).clear();
238 if (MvfFitInfo.isAvailable(*actualCandidate) && MvfFitInfo(*actualCandidate) !=
nullptr) {
239 delete MvfFitInfo(*actualCandidate);
240 MvfFitInfo(*actualCandidate) =
nullptr;
242 delete actualCandidate;
243 actualCandidate =
nullptr;
252 ATH_MSG_DEBUG(
"Deleting tracks with really good fit to vertex from seeding tracks.");
255 ATH_MSG_DEBUG(
"Found and deleted " << nFound <<
" tracks from seeding tracks.");
257 ATH_MSG_DEBUG(
"All tracks used for fitting came from fiting tracks, removing closest from seeding.");
265 ATH_MSG_DEBUG(
"You still have not removed any tracks from seeds! Aborting.");
270 bool goodVertex =
checkFit(actualCandidate);
273 ATH_MSG_DEBUG(
"Bad vertex, deleting the vertex and clearing all pointers");
277 if (actualCandidate) {
278 if (VTAV.isAvailable(*actualCandidate)) {
279 for (
auto *tav : VTAV(*actualCandidate)) {
280 if (tav ==
nullptr)
continue;
286 VTAV(*actualCandidate).clear();
288 if (MvfFitInfo.isAvailable(*actualCandidate) && MvfFitInfo(*actualCandidate) !=
nullptr) {
289 delete MvfFitInfo(*actualCandidate);
290 MvfFitInfo(*actualCandidate) =
nullptr;
293 delete actualCandidate;
294 actualCandidate =
nullptr;
302 myxAODVertices.emplace_back(0, actualCandidate);
304 seedtracknumber = seedTracks.size();
309 <<
m_maxIterations <<
") reached; to reconstruct more vertices, set maxIterations to a higher value.");
312 ATH_MSG_DEBUG(
"Secondary vertex finding complete with " << iteration <<
" iterations and " << myxAODVertices.size()
313 <<
" vertices found.");
315 for (
const xAODVertex_pair& vtxIter : myxAODVertices) {
319 theVertexContainer->push_back(cand);
325 std::vector<Trk::VxTrackAtVertex>* tracksOfVertex = &(cand->
vxTrackAtVertex());
326 tracksOfVertex->clear();
329 if ((*MVFtrkIter).initialPerigee()) { (*MVFtrkIter).setPerigeeAtVertex(((*MVFtrkIter).initialPerigee())->clone()); }
330 tracksOfVertex->push_back(*MVFtrkIter);
334 for (
const xAODVertex_pair& vtxIter : myxAODVertices) {
340 MVFtrkIter =
nullptr;
343 delete MvfFitInfo(*cand);
349 std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx = &((vxIter)->vxTrackAtVertex());
350 if (!myVxTracksAtVtx)
continue;
359 if (linkToXAODTP) { (vxIter)->addTrackAtVertex(*linkToXAODTP, (tracksIter).weight()); }
362 int ntrk = myVxTracksAtVtx->size();
377 if (!theVertexContainer->empty()) {
382 theVertexContainer->push_back(dummyxAODVertex);
385 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
392 else if (theVertexContainer->empty()) {
394 theVertexContainer->push_back(dummyxAODVertex);
397 looseConstraintCovariance.setIdentity();
398 looseConstraintCovariance = looseConstraintCovariance * 1
e+8;
400 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
409 for (
unsigned int i = 0;
i < theVertexContainer->size();
i++) {
421 ATH_MSG_DEBUG(
" Vtx: " <<
i <<
" x= " << (*theVertexContainer)[
i]->position().
x() <<
" y= "
422 << (*theVertexContainer)[
i]->position().
y() <<
" z= " << (*theVertexContainer)[
i]->position().
z()
423 <<
" ntracks= " << (*theVertexContainer)[
i]->vxTrackAtVertex().
size() <<
" chi2= "
424 << (*theVertexContainer)[
i]->
chiSquared() <<
" #dof = " << (*theVertexContainer)[
i]->numberDoF());
427 ATH_MSG_DEBUG(
"Done finding " << theVertexContainer->size() <<
" vertices and cleaning the container.");
428 ATH_MSG_DEBUG(
"Seeds good/bad/all : " << noVtx <<
"/" << kinkVtx <<
"/" << notSpec);
429 ATH_MSG_DEBUG(
"'Good' secondaries : " << secVtx <<
" and V0: " << V0vtx);
431 return std::make_pair(theVertexContainer, theVertexAuxContainer);