Skip to content
Snippets Groups Projects
Commit 1c633cc8 authored by Miroslav Saur's avatar Miroslav Saur
Browse files

Merge branch 'fix-mcparticle-goodendvtx' into '2024-patches'

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

See merge request !4737
parents 97f97a20 f3c7f685
No related branches found
No related tags found
2 merge requests!4738Synchronize master branch with 2024-patches,!4737Avoid `SmartRef<T>::data()` in `MCParticle::goodEndVertex()`
Pipeline #8425108 passed
......@@ -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