diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/Root/PhotonVertexSelectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/Root/PhotonVertexSelectionTool.cxx index cd417cd62ce0e5a533bd5f29bb343b45f7b91564..169b97dbc9bf1048467a22b0aedd22da073f303b 100644 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/Root/PhotonVertexSelectionTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection/Root/PhotonVertexSelectionTool.cxx @@ -30,18 +30,13 @@ namespace CP { const xAOD::Vertex* getVertexFromTrack(const xAOD::TrackParticle* track, const xAOD::VertexContainer* vertices) { - const xAOD::Vertex* found_vx = nullptr; for (const auto& vx : *vertices) { for (const auto& tpLink : vx->trackParticleLinks()) { - if (*tpLink == track) { - found_vx = vx; - break; - } + if (*tpLink == track) { return vx; } } - if (found_vx) { break; } } - return found_vx; + return nullptr; } //____________________________________________________________________________