Skip to content

Add zipping of SOA tracks + PV relations demonstrator

Olli Lupton requested to merge olupton_pv_relations into master

The main change here is to generalise the IterablePODTracks wrapper (and associated proxies) that was used to loop over/apply selections to LHCb::Pr::*::Tracks objects into LHCb::Pr::Zip, which can take multiple containers and yields proxies that can access fields from all of them:

ContainerA a{...};
ContainerB b{...};
auto zip = LHCb::Pr::make_zip( a, b );
for ( auto const& chunk : zip ) {
  // chunk is a vector-register-sized chunk of elements
  chunk.something_from_a() + chunk.something_from_b();
}

It can also be used to make a filtered copy:

// this copies the selected objects, 'copy' does not refer back to 'zip', 'a' or 'b'
// it contains elements from both 'a' and 'b'
auto copy = zip.filter( []( auto const& chunk ) { chunk.pt() > 400.f; } );
// make_zip() with a single argument is still useful to make an iterable, non-owning view
auto iterable = LHCb::Pr::make_zip( copy );

Along with Rec!1678 (merged) and Moore!229 (merged) this MR uses this tool to make track->PV relations, zip them to tracks, and use the resulting zip as input to the 1-track and 2-track MVA lines. This was the simplest test-case, muon ID is probably a more useful one.

Full list of changes:

  • Add zipIdentifier() methods returning Zipping::ZipFamilyNumber to several classes (some previously had nothing, some previously had a temporary family() method returning unsigned short)
  • Add Foo( Zipping::ZipFamilyNumber, Foo const& ) constructors needed by zip.filter( ... ) to several containers
  • Move proxy definitions out of the generic PrZip.h and into PrIterable{Velo,FittedForward}Tracks.h
  • Minor tweaks in SIMDWrapper (cc: @ahennequ):
    • Reorganise popcount( mask_v ) definitions so they can be found by ADL
    • Add some operator<<( std::ostream& os, ... ) definitions for debugging convenience
    • Add LHCb::type_map entries (see below)
    • lb-format is responsible for the whitespace changes...
  • Add LHCb::type_map<T> helper to allow generic code to ask "what is the integer type that goes with this floating point type" when the types involved may be plain C++ ones or SIMDWrapper ones
  • Minor changes to SOAExtensions (cc: @pseyfert):
    • Make Zipping::generateZipIdentifier() part of the public interface
    • Add operator<<( std::ostream& os, Zipping::ZipFamilyNumber )
    • Make semantic checks conditional on ZIPPING_SEMANTIC_CHECKS instead of NDEBUG so it is easier to turn them on/off. Turn them on in -opt builds, unlike before.
Edited by Marco Cattaneo

Merge request reports