L1Trigger/DemonstratorTools/src/codecs_tracks.cc
// Encodes track collection onto 18 output links (2x9 eta-phi sectors; first 9 negative eta)
Encodes track collection onto 18 output links (2x9 eta-phi sectors; first 9 negative eta)
Encodes track collection onto 18 output links ( 2x9 eta - phi sectors ; first 9 negative eta )
std::array<std::vector<ap_uint<64>>, 18> encodeTracks(const edm::View<TTTrack<Ref_Phase2TrackerDigi_>>& tracks,
                                                        int debug) {
    std::array<std::vector<ap_uint<96>>, 18> trackWords;
    if (debug > 0) {
      edm::LogInfo("l1t::demo::codecs") << "encodeTrack::Encoding " << tracks.size() << " tracks";
    }
    for (const auto& track : tracks)
      trackWords.at((track.eta() >= 0 ? 9 : 0) + track.phiSector()).push_back(encodeTrack(track));
    std::array<std::vector<ap_uint<64>>, 18> linkData;
    size_t counter = 0;
    for (size_t i = 0; i < linkData.size(); i++) {
      trackWords.at(i).resize(104, 0);
      linkData.at(i).resize(156, {0});
      for (size_t j = 0; (j < trackWords.at(i).size()); j += 2) {
        linkData.at(i).at(3 * j / 2) = trackWords.at(i).at(j)(63, 0);
        linkData.at(i).at(3 * j / 2 + 1) =
            (ap_uint<32>(trackWords.at(i).at(j + 1)(31, 0)), ap_uint<32>(trackWords.at(i).at(j)(95, 64)));
        linkData.at(i).at(3 * j / 2 + 2) = trackWords.at(i).at(j + 1)(95, 32);
        counter += trackWords.at(i).at(j)(95, 95) + trackWords.at(i).at(j + 1)(95, 95);
      }
    }
    if (debug > 0) {
      edm::LogInfo("l1t::demo::codecs") << "encodeTrack::Encoded " << counter << " tracks";
    }
    return linkData;
  }
std :: array < std :: vector < ap_uint < 64 > > , 18 > encodeTracks ( const edm :: View < TTTrack < Ref_Phase2TrackerDigi_ > > & tracks , int debug ) { std :: array < std :: vector < ap_uint < 96 > > , 18 > trackWords ; if ( debug > 0 ) { edm :: LogInfo ( " " ) << " " << tracks . size ( ) << " " ; } for ( const auto & track : tracks ) trackWords . at ( ( track . eta ( ) >= 0 ? 9 : 0 ) + track . phiSector ( ) ) . push_back ( encodeTrack ( track ) ) ; std :: array < std :: vector < ap_uint < 64 > > , 18 > linkData ; size_t counter = 0 ; for ( size_t i = 0 ; i < linkData . size ( ) ; i ++ ) { trackWords . at ( i ) . resize ( 104 , 0 ) ; linkData . at ( i ) . resize ( 156 , { 0 } ) ; for ( size_t j = 0 ; ( j < trackWords . at ( i ) . size ( ) ) ; j += 2 ) { linkData . at ( i ) . at ( 3 * j / 2 ) = trackWords . at ( i ) . at ( j ) ( 63 , 0 ) ; linkData . at ( i ) . at ( 3 * j / 2 + 1 ) = ( ap_uint < 32 > ( trackWords . at ( i ) . at ( j + 1 ) ( 31 , 0 ) ) , ap_uint < 32 > ( trackWords . at ( i ) . at ( j ) ( 95 , 64 ) ) ) ; linkData . at ( i ) . at ( 3 * j / 2 + 2 ) = trackWords . at ( i ) . at ( j + 1 ) ( 95 , 32 ) ; counter += trackWords . at ( i ) . at ( j ) ( 95 , 95 ) + trackWords . at ( i ) . at ( j + 1 ) ( 95 , 95 ) ; } } if ( debug > 0 ) { edm :: LogInfo ( " " ) << " " << counter << " " ; } return linkData ; }
Encodes track collection onto 18 output links (2x9 eta-phi sectors; first 9 negative eta)
Encodes track collection onto 18 output links ( 2x9 eta - phi sectors ; first 9 negative eta )
// Pad track vectors -> full packet length (156 frames = 104 tracks)