27 return StatusCode::SUCCESS;
34 declareInterface<PrimaryVertexRefitter>(
this);
44 ATH_MSG_DEBUG(
"Empty original xAOD::Vertex pointer passed: returning 0");
45 if(exitcode) *exitcode = -1;
48 unsigned int ntrk_pv = vertex->nTrackParticles();
50 ATH_MSG_DEBUG(
"Input vertex has no associated tracks: returning 0");
51 if(exitcode) *exitcode =-2;
54 if (excludeVertex == 0) {
55 ATH_MSG_DEBUG(
"Empty exclude xAOD::Vertex pointer passed: returning original vertex");
56 if(exitcode) *exitcode = 10;
59 std::vector<const xAOD::TrackParticle*> tps; tps.clear();
62 ATH_MSG_DEBUG(
"Exclude vertex has no associated tracks: returning original vertex");
63 if(exitcode) *exitcode = 11;
67 for (
unsigned int i = 0; i < ntrk ; ++i) {
72 return refitVertex(vertex,tps, returnCopy, exitcode);
80 ATH_MSG_DEBUG(
"Empty original xAOD::Vertex pointer passed: returning 0");
81 if(exitcode) *exitcode =-1;
84 unsigned int ntrk_pv = vertex->nTrackParticles();
86 ATH_MSG_DEBUG(
"Input vertex has no associated tracks: returning 0");
87 if(exitcode) *exitcode = -2;
91 ATH_MSG_DEBUG(
"The number of tracks " << ntrk_pv <<
" in the original vertex is already <= the allowed minimum number of tracks " <<
m_ntrk_min <<
", returning original vertex");
92 if(exitcode) *exitcode = 2;
95 unsigned int ntrk = tps.size();
97 ATH_MSG_DEBUG(
"No tracks requested to be removed: returning original vertex");
98 if(exitcode) *exitcode = 3;
104 std::vector <const xAOD::TrackParticle*>::const_iterator pb = tps.begin();
105 std::vector <const xAOD::TrackParticle*>::const_iterator pe = tps.end();
109 if (tmpVert != vertex)
delete tmpVert;
110 if (reducedVertex == 0) {
112 if(exitcode) *exitcode = -4;
113 return returnCopy ?
new xAOD::Vertex(*vertex) :
nullptr;
115 tmpVert = reducedVertex;
117 ATH_MSG_DEBUG(
"The number of tracks in the refitted vertex would be less than the allowed minimum number of tracks: " <<
m_ntrk_min <<
", returning original vertex");
118 delete reducedVertex;
119 if(exitcode) *exitcode = 5;
120 return returnCopy ?
new xAOD::Vertex(*vertex) :
nullptr;
123 if(exitcode) *exitcode = 1;
124 return reducedVertex;
#define CHECK(...)
Evaluate an expression and check for errors.
PrimaryVertexRefitter(const std::string &t, const std::string &n, const IInterface *p)
Gaudi::Property< unsigned int > m_ntrk_min
xAOD::Vertex * refitVertex(const xAOD::Vertex *vertex, const xAOD::Vertex *excludeVertex, bool ReturnCopy=true, int *exitcode=nullptr) const
ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimator
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
The namespace of all packages in PhysicsAnalysis/JetTagging.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.