Skip to content
Snippets Groups Projects
Commit f3c7f685 authored by Gerhard Raven's avatar Gerhard Raven Committed by Miroslav Saur
Browse files

Avoid `SmartRef<T>::data()` in `MCParticle::goodEndVertex()`

parent 97f97a20
No related branches found
No related tags found
2 merge requests!4738Synchronize master branch with 2024-patches,!4737Avoid `SmartRef<T>::data()` in `MCParticle::goodEndVertex()`
......@@ -49,8 +49,8 @@ namespace LHCb {
* nullptr if nothing was found.
*/
const MCVertex* MCParticle::goodEndVertex() const {
const auto& v = endVertices();
const auto destructiveV = std::find_if( v.begin(), v.end(), []( auto vtx ) {
const auto& v = endVertices();
const auto i = std::find_if( v.begin(), v.end(), []( auto vtx ) {
switch ( vtx->type() ) {
case MCVertex::DecayVertex:
case MCVertex::OscillatedAndDecay:
......@@ -61,13 +61,11 @@ namespace LHCb {
return false;
}
} );
if ( destructiveV != v.end() ) {
return destructiveV->data();
} else {
const auto hadronIAV =
std::find_if( v.begin(), v.end(), []( auto vtx ) { return vtx->type() == MCVertex::HadronicInteraction; } );
return hadronIAV != v.end() ? hadronIAV->data() : nullptr;
}
if ( i != v.end() ) return *i;
const auto j =
std::find_if( v.begin(), v.end(), []( auto vtx ) { return vtx->type() == MCVertex::HadronicInteraction; } );
return j != v.end() ? *j : nullptr;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment