Commit c91a6ed0 authored by Rosen Matev's avatar Rosen Matev 🌲
Browse files

Merge branch 'ahennequ_proxy' into 'master'

SOACollection proxy simplification

See merge request !1012
parents ea739145 3ceb8c87
Pipeline #3297176 passed with stage
in 25 seconds
......@@ -9,7 +9,6 @@
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#pragma once
#include "Event/ZipCompat.h"
#include "Functors/with_functors.h"
#include "Kernel/GetDecay.h"
#include "Kernel/IDecodeSimpleDecayString.h"
......@@ -83,7 +82,7 @@ namespace ThOr::detail::Combiner {
template <LHCb::Pr::ProxyBehaviour Behaviour>
struct get_proxy {
template <typename T>
using fn = LHCb::Event::ZipCompat::proxy_t<Backend, Behaviour, T>;
using fn = typename LHCb::Event::simd_zip_t<Backend, T>::template zip_proxy_type<Behaviour>;
};
template <typename T>
using unwrap_if_single = std::conditional_t<boost::mp11::mp_size<T>::value == 1, boost::mp11::mp_front<T>, T>;
......@@ -123,8 +122,10 @@ namespace ThOr::detail::Combiner {
template <SIMDWrapper::InstructionSet Backend = SIMDWrapper::Scalar>
struct CompositeCut {
using particle_t = LHCb::Event::ZipCompat::proxy_t<Backend, LHCb::Pr::ProxyBehaviour::Contiguous, Output_t>;
using Signature = mask_b_v<Backend>( Functors::mask_arg_t, mask_b_v<Backend> const&, particle_t const& );
using particle_t =
typename LHCb::Event::simd_zip_t<Backend,
Output_t>::template zip_proxy_type<LHCb::Pr::ProxyBehaviour::Contiguous>;
using Signature = mask_b_v<Backend>( Functors::mask_arg_t, mask_b_v<Backend> const&, particle_t const& );
constexpr static bool is_simd = Backend != SIMDWrapper::Scalar;
constexpr static auto Compilation =
is_simd ? Functors::IFactory::QuietCacheOnly : Functors::IFactory::DefaultCompilationBehaviour;
......@@ -501,7 +502,7 @@ namespace ThOr {
// Get an iterable version of the input if need be -- this should be a noop if the input is already a zip
// If some of the inputs are variants, map those onto new variants (of zips)
std::tuple const in{detail::Combiner::invoke_or_visit_returning_variant(
[]( auto const& raw ) { return LHCb::Event::ZipCompat::make_zip<Backend>( raw ); }, raw_in )...};
[]( auto const& raw ) { return LHCb::Event::make_zip<Backend>( raw ); }, raw_in )...};
// Prepare the output storage
auto const memResource = LHCb::getMemResource( evtCtx );
......
......@@ -27,6 +27,8 @@ using simd_t = SIMDWrapper::type_map_t<SIMDWrapper::InstructionSet::Scalar>;
using float_v = typename simd_t::float_v;
using int_v = typename simd_t::int_v;
namespace ChargedBasicsTag = LHCb::Event::ChargedBasicsTag;
static const LHCb::UniqueIDGenerator unique_id_gen;
// Since Sel::Utils::has_tracklike_API also checks whether the input type
......@@ -35,14 +37,13 @@ static const LHCb::UniqueIDGenerator unique_id_gen;
template <class T>
struct is_tracklike : std::false_type {};
template <SIMDWrapper::InstructionSet Arch, LHCb::Pr::ProxyBehaviour Behaviour, class... T>
struct is_tracklike<LHCb::Pr::detail::proxy_type<Arch, Behaviour, T...>>
: std::conditional_t<
Sel::Utils::details::contains<std::decay_t<LHCb::Event::v3::Tracks>, std::decay_t<T>...>::value,
std::true_type, std::false_type> {};
template <typename... Ts>
struct is_tracklike<LHCb::Event::ZipProxy<Ts...>>
: Sel::Utils::details::contains<std::decay_t<LHCb::Event::v3::Tracks>, std::decay_t<typename Ts::container_t>...> {
};
template <SIMDWrapper::InstructionSet Arch, class... T>
struct is_tracklike<LHCb::Pr::Zip<Arch, T...>>
struct is_tracklike<LHCb::Event::Zip<Arch, T...>>
: std::conditional_t<
Sel::Utils::details::contains<std::decay_t<LHCb::Event::v3::Tracks>, std::decay_t<T>...>::value,
std::true_type, std::false_type> {};
......@@ -414,22 +415,23 @@ auto generate_particles( std::size_t n_elements, LHCb::UniqueIDGenerator const&
combdlls->reserve( n_elements );
for ( auto i = 0u; i < n_elements; ++i ) {
rich_pids->m_pid_codes.emplace_back( 0 );
rich_pids->emplace_back<SIMDWrapper::InstructionSet::Scalar>().field<ChargedBasicsTag::RichPIDCode>().set( 0 );
auto mu_pid = muon_pids->emplace_back<SIMDWrapper::InstructionSet::Scalar>();
mu_pid.field<LHCb::Pr::Muon::Tag::Status>().set( false );
mu_pid.field<LHCb::Pr::Muon::Tag::Chi2Corr>().set( std::numeric_limits<float>::lowest() );
masses->m_masses.emplace_back( 0 );
particle_ids->m_ids.emplace_back( 0 );
combdlls->m_CombDLLps.emplace_back( std::numeric_limits<float>::lowest() );
combdlls->m_CombDLLes.emplace_back( std::numeric_limits<float>::lowest() );
combdlls->m_CombDLLpis.emplace_back( std::numeric_limits<float>::lowest() );
combdlls->m_CombDLLks.emplace_back( std::numeric_limits<float>::lowest() );
combdlls->m_CombDLLmus.emplace_back( std::numeric_limits<float>::lowest() );
masses->emplace_back<SIMDWrapper::InstructionSet::Scalar>().field<ChargedBasicsTag::Masse>().set( 0 );
particle_ids->emplace_back<SIMDWrapper::InstructionSet::Scalar>().field<ChargedBasicsTag::PID>().set( 0 );
auto combdll = combdlls->emplace_back<SIMDWrapper::InstructionSet::Scalar>();
combdll.field<ChargedBasicsTag::CombDLLp>().set( std::numeric_limits<float>::lowest() );
combdll.field<ChargedBasicsTag::CombDLLe>().set( std::numeric_limits<float>::lowest() );
combdll.field<ChargedBasicsTag::CombDLLpi>().set( std::numeric_limits<float>::lowest() );
combdll.field<ChargedBasicsTag::CombDLLk>().set( std::numeric_limits<float>::lowest() );
combdll.field<ChargedBasicsTag::CombDLLmu>().set( std::numeric_limits<float>::lowest() );
}
// we must be careful here, since doing a copy/move instruction will change the
// instruction set to "Best", giving problems comparing SIMD value types
return std::make_tuple( LHCb::Pr::make_zip<SIMDWrapper::InstructionSet::Scalar>(
return std::make_tuple( LHCb::Event::make_zip<SIMDWrapper::InstructionSet::Scalar>(
std::as_const( *tracks ), std::as_const( *rich_pids ), std::as_const( *muon_pids ),
std::as_const( *masses ), std::as_const( *particle_ids ), std::as_const( *combdlls ) ),
std::move( masses ), std::move( rich_pids ), std::move( muon_pids ),
......
......@@ -26,7 +26,8 @@
#include "Kernel/ParticleProperty.h"
#include "TrackInterfaces/ITrackSelector.h"
namespace MuonTag = LHCb::Pr::Muon::Tag;
namespace MuonTag = LHCb::Pr::Muon::Tag;
namespace ChargedBasicsTag = LHCb::Event::ChargedBasicsTag;
using output_t = std::tuple<LHCb::Event::ChargedBasics, std::unique_ptr<LHCb::Event::AssignedMasses>,
std::unique_ptr<LHCb::Event::v2::RichPIDs>, std::unique_ptr<LHCb::Pr::Muon::PIDs>,
......@@ -115,8 +116,10 @@ public:
{ // fill particles
masses->m_masses.emplace_back( prop->mass() );
particle_ids->m_ids.emplace_back( prop->particleID().pid() );
masses->emplace_back<SIMDWrapper::InstructionSet::Scalar>().field<ChargedBasicsTag::Masse>().set(
prop->mass() );
particle_ids->emplace_back<SIMDWrapper::InstructionSet::Scalar>().field<ChargedBasicsTag::PID>().set(
prop->particleID().pid() );
// protos
auto mu_pid = muon_pids->emplace_back<SIMDWrapper::InstructionSet::Scalar>();
......@@ -127,10 +130,12 @@ public:
mu_pid.field<MuonTag::Status>().set( 0 ); // TODO make a correct invalid entry
mu_pid.field<MuonTag::Chi2Corr>().set( std::numeric_limits<float>::lowest() );
}
auto rich_pid =
rich_pids->emplace_back<SIMDWrapper::InstructionSet::Scalar>().field<ChargedBasicsTag::RichPIDCode>();
if ( auto* richpid = proto->richPID() ) {
rich_pids->m_pid_codes.emplace_back( richpid->pidResultCode() );
rich_pid.set( richpid->pidResultCode() );
} else {
rich_pids->m_pid_codes.emplace_back( rich_pids->invalid_entry() );
rich_pid.set( std::numeric_limits<int>::lowest() );
}
{ // tracks
......@@ -140,15 +145,16 @@ public:
}
// combdlls
combdlls->m_CombDLLps.emplace_back(
auto combdll = combdlls->emplace_back<SIMDWrapper::InstructionSet::Scalar>();
combdll.field<ChargedBasicsTag::CombDLLp>().set(
proto->info( LHCb::ProtoParticle::additionalInfo::CombDLLp, std::numeric_limits<float>::lowest() ) );
combdlls->m_CombDLLes.emplace_back(
combdll.field<ChargedBasicsTag::CombDLLe>().set(
proto->info( LHCb::ProtoParticle::additionalInfo::CombDLLe, std::numeric_limits<float>::lowest() ) );
combdlls->m_CombDLLpis.emplace_back(
combdll.field<ChargedBasicsTag::CombDLLpi>().set(
proto->info( LHCb::ProtoParticle::additionalInfo::CombDLLpi, std::numeric_limits<float>::lowest() ) );
combdlls->m_CombDLLks.emplace_back(
combdll.field<ChargedBasicsTag::CombDLLk>().set(
proto->info( LHCb::ProtoParticle::additionalInfo::CombDLLk, std::numeric_limits<float>::lowest() ) );
combdlls->m_CombDLLmus.emplace_back(
combdll.field<ChargedBasicsTag::CombDLLmu>().set(
proto->info( LHCb::ProtoParticle::additionalInfo::CombDLLmu, std::numeric_limits<float>::lowest() ) );
}
if ( prop == m_particle_prop ) {
......@@ -169,8 +175,9 @@ public:
muon_pids->reserve( muon_pids->size() );
// tracks are already fine
return {LHCb::Pr::make_zip( std::as_const( *tracks ), std::as_const( *rich_pids ), std::as_const( *muon_pids ),
std::as_const( *masses ), std::as_const( *particle_ids ), std::as_const( *combdlls ) ),
return {LHCb::Event::make_zip( std::as_const( *tracks ), std::as_const( *rich_pids ), std::as_const( *muon_pids ),
std::as_const( *masses ), std::as_const( *particle_ids ),
std::as_const( *combdlls ) ),
std::move( masses ),
std::move( rich_pids ),
std::move( muon_pids ),
......
......@@ -451,7 +451,7 @@ namespace Sel::Fitters {
assert( type == ChildType::TrackWithVelo || type == ChildType::TrackWithoutVelo );
using VertexTrack =
VertexTraj<child_t, false /* flag this represents a track not a weakly-decaying composite */>;
return VertexTrack{child, child.state( child_t::StateLocation::ClosestToBeam )};
return VertexTrack{child, child.state( LHCb::Event::v3::Tracks::StateLocation::ClosestToBeam )};
}
};
......@@ -669,7 +669,7 @@ namespace Sel::Fitters {
if ( types[i] == ChildType::TrackWithVelo ) {
if constexpr ( Sel::Utils::has_tracklike_API<child_t> ) {
velotrajs[nvelotrajs++] =
StateVector4<float_v>{child.state( child_t::StateLocation::ClosestToBeam )};
StateVector4<float_v>{child.state( LHCb::Event::v3::Tracks::StateLocation::ClosestToBeam )};
} else {
throw exception(
"TrackWithVelo type didn't have a state( child_t::StateLocation::ClosestToBeam)" );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment