Skip to content

PrimaryVertex relies on obsolete detector channel IDs

Primary vertex contains this method, which is a workaround. It depends on TT which no longer exists and is being removed from our software.

  uint32_t PrimaryVertex::uniqueVeloSegmentID( const LHCb::Track& track ) {
    // create a 'hash' from the velo IDs on the track
    const auto&     lhcbids = track.lhcbIDs();
    const uint32_t* begin   = reinterpret_cast<const uint32_t*>( &( *( lhcbids.begin() ) ) );
    const uint32_t* end     = reinterpret_cast<const uint32_t*>( &( *( lhcbids.end() ) ) );

    // // need a trick to find the last velo id: TT comes after velo. so
    // // we use lowerbound with the smallest TT ID. unfortunately need a
    // // number that is private in lhcbid:
    const int detectorTypeBits = 28;
    // const uint32_t* begin = reinterpret_cast<const uint32_t*>(&(*(lhcbids.begin()))) ;
    // const uint32_t* end   = reinterpret_cast<const uint32_t*>(&(*(lhcbids.end()))) ;

    // create a hash object (which performs the hash operations);
    // hashobj does not need memory, and construction is free (no CPU
    // required), so you can instantiate away...
    BloomFilterImpl::HashFNV1a<uint32_t, uint32_t> hashobj;

    // const uint32_t hash1 = hashobj(lhcbid);

    // hashing a second object on top of it
    // uint32_t hash2 = hashobj(lhcbid, hash1);

    // hashing a vector of objects - slightly ugly, since we need to get the
    // initial value of an "empty" hash from deep within the implementation...
    uint32_t        hash   = BloomFilterImpl::__doFNV1a<uint32_t>::hashinit;
    const uint32_t* it     = begin;
    const uint32_t  maxval = LHCb::LHCbID::channelIDtype::TT << detectorTypeBits;
    while ( it < end && *it < maxval ) {
      hash = hashobj( *it, hash );
      ++it;
    }
    return hash;
  }

It is used in PrimaryVertexTrack it seems. See https://gitlab.cern.ch/lhcb/LHCb/-/blob/master/Event/RecEvent/src/PrimaryVertex.cpp

I wonder what that does in Moore (if anything). Please revise.

cc @wouter

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information