Skip to content
Snippets Groups Projects
Commit 9fac66ae authored by Gerhard Raven's avatar Gerhard Raven
Browse files

Prefer namespace LHCb::Event over Sel::Utils for finding ADL-fallback accessors

parent 1981ea88
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ namespace Functors::Adapters {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& top_level ) const {
return [f = detail::prepare( m_f, evtCtx, top_level )]( auto const& mask, auto const& collection ) {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
return Sel::transform_reduce(
decayProducts( collection ), [&f, &mask]( auto const& p ) { return std::invoke( f, mask_arg, mask, p ); },
std::plus<>{} );
......@@ -84,7 +84,7 @@ namespace Functors::Adapters {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& top_level ) const {
return [f = detail::prepare( m_f, evtCtx, top_level )]( auto const& mask, auto const& collection ) {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
return Sel::transform_reduce(
decayProducts( collection ), [&f, &mask]( auto const& p ) { return std::invoke( f, mask_arg, mask, p ); },
[]( auto const& a, auto const& b ) {
......@@ -116,7 +116,7 @@ namespace Functors::Adapters {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& top_level ) const {
return [f = detail::prepare( m_f, evtCtx, top_level )]( auto const& mask, auto const& collection ) {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
return Sel::transform_reduce(
decayProducts( collection ), [&f, &mask]( auto const& p ) { return std::invoke( f, mask_arg, mask, p ); },
[]( auto const& a, auto const& b ) {
......@@ -149,7 +149,7 @@ namespace Functors::Adapters {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& top_level ) const {
return
[f = detail::prepare( m_f, evtCtx, top_level ), i = m_idx - 1]( auto const& mask, auto const& collection ) {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
assert( 0 <= i &&
static_cast<std::size_t>( i ) < decayProducts( Sel::Utils::deref_if_ptr( collection ) ).size() );
return std::invoke( f, mask_arg, mask, decayProducts( Sel::Utils::deref_if_ptr( collection ) )[i] );
......@@ -184,8 +184,8 @@ namespace Functors::detail {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& top_level ) const {
return [f = detail::prepare( m_f, evtCtx, top_level )]( auto const& mask, auto const& combination ) {
using Sel::Utils::decayProducts;
using Sel::Utils::subCombination;
using LHCb::Event::decayProducts;
using LHCb::Event::subCombination;
return std::invoke( f, mask_arg, mask, subCombination<( idxs - 1 )...>( decayProducts( combination ) ) );
};
}
......
......@@ -165,7 +165,7 @@ namespace Functors::detail {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& ) const {
return [calc = m_dist.template prepare<method>( evtCtx )]( const auto& combination ) {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
const auto& dp = decayProducts( combination );
return calc( dp.template get<N - 1>(), dp.template get<M - 1>() );
};
......@@ -184,7 +184,7 @@ namespace Functors::detail {
template <typename CombinationType>
auto operator()( CombinationType const& combination ) const {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
const auto& dp = decayProducts( combination );
if constexpr ( method == DOCAMethod::Distance ) {
return m_dist->particleDOCA( dp.template get<N - 1>(), dp.template get<M - 1>() );
......@@ -207,7 +207,7 @@ namespace Functors::detail {
void bind( TopLevelInfo& top_level ) { m_dist.emplace( top_level.algorithm() ); }
template <typename CombinationType>
auto operator()( CombinationType const& combination ) const {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
const auto& dp = decayProducts( combination );
return dp.pairwise_transform_reduce(
[&]( const auto& i1, const auto& i2 ) {
......@@ -232,7 +232,7 @@ namespace Functors::detail {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& ) const {
return [transform = m_dist.template prepare<method>( evtCtx )]( const auto& combination ) {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
const auto& dp = decayProducts( combination );
return dp.pairwise_transform_reduce( transform, maximum );
};
......@@ -256,7 +256,7 @@ namespace Functors::detail {
template <typename CombinationType>
auto operator()( CombinationType const& combination ) const {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
const auto& dp = decayProducts( combination );
return dp.pairwise_none_of( [&]( const auto& i1, const auto& i2 ) {
if constexpr ( method == DOCAMethod::Distance ) {
......@@ -282,7 +282,7 @@ namespace Functors::detail {
auto prepare( EventContext const& evtCtx, TopLevelInfo const& ) const {
return [calc = m_dist.template prepare<method>( evtCtx ), threshold = m_thresh]( const auto& combination ) {
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
const auto& dp = decayProducts( combination );
return dp.pairwise_none_of( [&]( const auto& i1, const auto& i2 ) { return calc( i1, i2 ) > threshold; } );
};
......@@ -357,8 +357,8 @@ namespace Functors::Combination {
template <typename CombinationType>
auto operator()( CombinationType const& combination ) const {
using Sel::Utils::decayProducts;
using Sel::Utils::threeMomentum;
using LHCb::Event::decayProducts;
using LHCb::Event::threeMomentum;
using std::sqrt;
const auto& dp = decayProducts( combination );
auto m1 = threeMomentum( dp.template get<N - 1>() );
......
......@@ -339,8 +339,8 @@ namespace Functors::Common {
template <typename Position_t, typename TrackChunk>
auto operator()( Position_t const& vertex_pos, TrackChunk const& track_chunk ) const {
using Sel::Utils::referencePoint;
using Sel::Utils::slopes;
using LHCb::Event::referencePoint;
using LHCb::Event::slopes;
using std::sqrt;
using float_v = decltype( referencePoint( track_chunk ).X() );
auto pos = referencePoint( track_chunk );
......
......@@ -64,17 +64,17 @@ namespace Functors::Composite {
auto operator()( VContainer const& vertices, Particle const& composite ) const {
auto const bestPV = Sel::getBestPV( composite, vertices );
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
auto const& children = decayProducts( composite );
auto const& pN = children[N - 1];
auto const& pN_state = Sel::stateVectorFromComposite( pN );
using Sel::Utils::posCovMatrix;
using Sel::Utils::referencePoint;
using Sel::Utils::threeMomCovMatrix;
using Sel::Utils::threeMomentum;
using Sel::Utils::threeMomPosCovMatrix;
using LHCb::Event::posCovMatrix;
using LHCb::Event::referencePoint;
using LHCb::Event::threeMomCovMatrix;
using LHCb::Event::threeMomentum;
using LHCb::Event::threeMomPosCovMatrix;
auto const& composite_state = Sel::stateVectorComputations(
endVertexPos( bestPV ), threeMomentum( composite ), threeMomCovMatrix( composite ), posCovMatrix( bestPV ),
......@@ -108,8 +108,8 @@ namespace Functors::Composite {
// First a helper for the momentum perpendicular to the flight vector
template <typename Vertex_t, typename Composite>
auto perpendicularMomentum( Vertex_t const& vtx, Composite const& comp ) {
using Sel::Utils::endVertexPos;
using Sel::Utils::threeMomentum;
using LHCb::Event::endVertexPos;
using LHCb::Event::threeMomentum;
auto const d = endVertexPos( comp ) - endVertexPos( vtx );
auto const mom = threeMomentum( comp );
auto const perp = mom - d * ( dot( mom, d ) / d.mag2() );
......@@ -124,7 +124,7 @@ namespace Functors::Composite {
template <typename Vertex_t, typename Composite>
auto operator()( Vertex_t const& vtx, Composite const& composite ) const {
using Sel::Utils::mass2;
using LHCb::Event::mass2;
using std::sqrt;
// Get the pT variable that we need
......@@ -142,13 +142,13 @@ namespace Functors::Composite {
template <typename Vertex_t, typename Composite>
auto operator()( Vertex_t const& vertices, Composite const& composite ) const {
using Sel::Utils::endVertexPos;
using Sel::Utils::fourMomentum;
using Sel::Utils::mass2;
using Sel::Utils::momCovMatrix;
using Sel::Utils::momPosCovMatrix;
using Sel::Utils::posCovMatrix;
using Sel::Utils::threeMomentum;
using LHCb::Event::endVertexPos;
using LHCb::Event::fourMomentum;
using LHCb::Event::mass2;
using LHCb::Event::momCovMatrix;
using LHCb::Event::momPosCovMatrix;
using LHCb::Event::posCovMatrix;
using LHCb::Event::threeMomentum;
using std::sqrt;
auto const mom = threeMomentum( composite );
......@@ -205,7 +205,7 @@ namespace Functors::Composite {
auto operator()( CombinationType const& comb ) const {
// Calculate the mass from the child 3-momenta and the given
// mass hypotheses. Start by checking we have the correct number.
using Sel::Utils::decayProducts;
using LHCb::Event::decayProducts;
auto children = decayProducts( comb );
auto NumChildren = children.size();
if ( sizeof...( MassInputs ) != NumChildren || m_mass_values.size() != NumChildren ) {
......@@ -214,7 +214,7 @@ namespace Functors::Composite {
") and the number of children in the given object (" + std::to_string( NumChildren ) + ")",
"Functors::Composite::Mass", StatusCode::FAILURE};
}
using Sel::Utils::threeMomentum;
using LHCb::Event::threeMomentum;
using std::sqrt;
using float_t = decltype( threeMomentum( children[0] ).mag2() );
float_t E{0};
......@@ -259,7 +259,7 @@ namespace Functors::Composite {
template <typename Particle>
auto operator()( Particle const& particle ) const {
using Sel::Utils::mass2;
using LHCb::Event::mass2;
using std::sqrt;
return sqrt( mass2( particle ) );
}
......
......@@ -155,7 +155,7 @@ namespace Functors::Track {
struct ReferencePoint : public Function {
template <typename Data>
auto operator()( Data const& d ) const {
using Sel::Utils::referencePoint;
using LHCb::Event::referencePoint;
return referencePoint( d );
}
};
......@@ -165,7 +165,7 @@ namespace Functors::Track {
struct Slopes : public Function {
template <typename Data>
auto operator()( Data const& d ) const {
using Sel::Utils::slopes;
using LHCb::Event::slopes;
return slopes( Sel::Utils::deref_if_ptr( d ) );
}
};
......@@ -175,7 +175,7 @@ namespace Functors::Track {
struct FourMomentum : public Function {
template <typename Data>
auto operator()( Data const& d ) const {
using Sel::Utils::fourMomentum;
using LHCb::Event::fourMomentum;
return fourMomentum( d );
}
};
......@@ -185,7 +185,7 @@ namespace Functors::Track {
struct ThreeMomentum : public Function {
template <typename Data>
auto operator()( Data const& d ) const {
using Sel::Utils::threeMomentum;
using LHCb::Event::threeMomentum;
return threeMomentum( d );
}
};
......
......@@ -59,7 +59,7 @@ namespace Sel::detail {
auto threeMomentum() const {
return transform_reduce(
[]( auto const& p ) {
using Sel::Utils::threeMomentum;
using LHCb::Event::threeMomentum;
return threeMomentum( p );
},
std::plus<>{} );
......@@ -76,7 +76,7 @@ namespace Sel::detail {
auto momentum() const {
return transform_reduce(
[]( auto const& p ) {
using Sel::Utils::fourMomentum;
using LHCb::Event::fourMomentum;
return fourMomentum( p );
},
std::plus<>{} );
......@@ -87,7 +87,7 @@ namespace Sel::detail {
}
auto mass2() const {
using Sel::Utils::mass2;
using LHCb::Event::mass2;
return mass2( this->momentum() );
}
......
......@@ -132,6 +132,9 @@ namespace Sel::Utils {
/** Helpers for dispatching to the right fdchi2 calculation. */
template <typename Vertex1, typename Vertex2>
auto flightDistanceChi2( Vertex1 const& v1, Vertex2 const& v2 ) {
using LHCb::Event::endVertexPos;
using LHCb::Event::posCovMatrix;
;
auto cov = posCovMatrix( v1 ) + posCovMatrix( v2 );
cov = cov.invChol(); // what if it fails?
return similarity( endVertexPos( v1 ) - endVertexPos( v2 ), cov );
......
......@@ -161,11 +161,11 @@ namespace {
template <int MaxIter, typename Particle, typename VContainer>
auto ctau_optimized( VContainer const& primary, Particle const& particle ) {
// Retrieve position and position covariance of the decay and primary vertices
using Sel::Utils::endVertexPos;
using Sel::Utils::fourMomentum;
using Sel::Utils::momCovMatrix;
using Sel::Utils::momPosCovMatrix;
using Sel::Utils::posCovMatrix;
using LHCb::Event::endVertexPos;
using LHCb::Event::fourMomentum;
using LHCb::Event::momCovMatrix;
using LHCb::Event::momPosCovMatrix;
using LHCb::Event::posCovMatrix;
return ctau_optimized<MaxIter>( endVertexPos( primary ), posCovMatrix( primary ), fourMomentum( particle ),
endVertexPos( particle ), momCovMatrix( particle ), posCovMatrix( particle ),
momPosCovMatrix( particle ) );
......@@ -337,10 +337,10 @@ namespace Sel {
template <typename Particle, typename VContainer>
auto DecayLengthSignificance( VContainer const& primary, Particle const& particle ) const {
using Sel::Utils::covMatrix;
using Sel::Utils::endVertexPos;
using Sel::Utils::posCovMatrix;
using Sel::Utils::threeMomentum;
using LHCb::Event::covMatrix;
using LHCb::Event::endVertexPos;
using LHCb::Event::posCovMatrix;
using LHCb::Event::threeMomentum;
using std::sqrt;
// Calculate the distance between the particle and the vertex we hold.
......@@ -421,9 +421,9 @@ namespace Sel {
auto iterate( VContainer const& primary, Particle const& particle, float_v& ctau, float_v& error,
float_v& chi2 ) const {
using LHCb::Event::endVertexPos;
using LHCb::Event::fourMomentum;
using Sel::Utils::all;
using Sel::Utils::endVertexPos;
using Sel::Utils::fourMomentum;
using std::abs;
using std::sqrt;
......@@ -554,10 +554,10 @@ namespace Sel {
template <typename Particle, typename VContainer>
auto ctau0( VContainer const& primary, Particle const& particle ) const {
// Retrieve position and position covariance of the decay and primary vertices
using Sel::Utils::endVertexPos;
using Sel::Utils::mass2;
using Sel::Utils::posCovMatrix;
using Sel::Utils::threeMomentum;
using LHCb::Event::endVertexPos;
using LHCb::Event::mass2;
using LHCb::Event::posCovMatrix;
using LHCb::Event::threeMomentum;
using std::sqrt;
const auto decay_pos = endVertexPos( particle );
const auto decay_pos_cov = posCovMatrix( particle );
......
......@@ -350,7 +350,7 @@ namespace Sel::Fitters {
SymNxN<4, float_v>& p4cov, Matrix<4, 3, float_v>& gainmatrix ) const {
// first need to 'update' the momentum vector. but for that we
// first need to 'transport'.
using Sel::Utils::fourMomentum;
using LHCb::Event::fourMomentum;
auto mom = fourMomentum( m_particle ); // 4-momentum
float_v const pz = Z( mom );
float_v const tx = m_q( 0 );
......@@ -358,16 +358,16 @@ namespace Sel::Fitters {
// first update the residual
using namespace LHCb::LinAlg;
using Sel::Utils::referencePoint;
using LHCb::Event::referencePoint;
auto particlepos = referencePoint( m_particle );
float_v const dz = Z( vertexpos ) - particlepos.Z();
VecN<2, float_v> res{X( vertexpos ) - ( particlepos.X() + tx * dz ),
Y( vertexpos ) - ( particlepos.Y() + ty * dz )};
auto const& R = m_state.covXX();
auto const& Rinv = m_G;
using Sel::Utils::momCovMatrix;
using LHCb::Event::momCovMatrix;
auto const momCov = momCovMatrix( m_particle );
using Sel::Utils::momPosCovMatrix;
using LHCb::Event::momPosCovMatrix;
auto const momPosCov = momPosCovMatrix( m_particle );
// To do this right we need THREE projection matrices for the residual:
......@@ -637,7 +637,7 @@ namespace Sel::Fitters {
// a variant type.
LHCb::invoke_or_visit(
[&]( auto const& child ) {
using Sel::Utils::endVertexPos;
using LHCb::Event::endVertexPos;
if constexpr ( !Sel::Utils::canBeExtrapolatedDownstream_v<decltype( child )> ) {
tmp.emplace( LHCb::LinAlg::convert( endVertexPos( child ) ), mask_v{true} );
} else {
......@@ -660,9 +660,9 @@ namespace Sel::Fitters {
// a variant type.
LHCb::invoke_or_visit(
[&]( auto const& child ) {
using Sel::Utils::trackState;
using Sel::Utils::referencePoint;
using Sel::Utils::threeMomentum;
using LHCb::Event::trackState;
using LHCb::Event::referencePoint;
using LHCb::Event::threeMomentum;
if ( types[i] == ChildType::TrackWithVelo ) {
if constexpr ( Sel::Utils::canBeExtrapolatedDownstream_v<decltype( child )> ) {
velotrajs[nvelotrajs++] = {trackState( child )};
......
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