CMS 3D CMS Logo

codecs_tkjets.cc
Go to the documentation of this file.
1 
3 
4 namespace l1t::demo::codecs {
5 
6  ap_uint<64> encodeTkJet(const l1t::TkJetWord& j) { return j.tkJetWord(); }
7 
8  // Encodes vertex collection onto 1 output link
9  std::array<std::vector<ap_uint<64>>, 1> encodeTkJets(const edm::View<l1t::TkJetWord>& tkJets) {
10  std::vector<ap_uint<64>> tkJetWords;
11 
12  for (const auto& tkJet : tkJets) {
13  tkJetWords.push_back(encodeTkJet(tkJet));
14  tkJetWords.push_back(ap_uint<64>(0));
15  }
16 
17  std::array<std::vector<ap_uint<64>>, 1> linkData;
18 
19  for (size_t i = 0; i < linkData.size(); i++) {
20  // Pad TkJet vectors -> full packet length (48 frames, but only 12 TkJets max, two words per jet)
21  tkJetWords.resize(24, 0);
22  linkData.at(i) = tkJetWords;
23  }
24 
25  return linkData;
26  }
27 
28  std::vector<l1t::TkJetWord> decodeTkJets(const std::vector<ap_uint<64>>& frames) {
29  std::vector<l1t::TkJetWord> tkJets;
30 
31  for (size_t f = 0; f < frames.size(); f += 2) {
32  // There is no valid bit in the definition right now.
33  // Uncomment the next two lines when this is available.
34  //if (not x.test(TkJetWord::kValidLSB))
35  // break;
36 
44  tkJets.push_back(j);
45  }
46 
47  return tkJets;
48  }
49 
50 } // namespace l1t::demo::codecs
ap_int< kGlbEtaSize > glbeta_t
Definition: TkJetWord.h:55
ap_int< kGlbPhiSize > glbphi_t
Definition: TkJetWord.h:56
ap_ufixed< kPtSize, kPtMagSize, AP_TRN, AP_SAT > pt_t
Definition: TkJetWord.h:54
ap_uint< TkJetBitWidths::kUnassignedSize > tkjetunassigned_t
Definition: TkJetWord.h:60
ap_int< kZ0Size > z0_t
Definition: TkJetWord.h:57
double f[11][100]
ap_uint< kXtSize > nx_t
Definition: TkJetWord.h:59
ap_uint< 64 > encodeTkJet(const l1t::TkJetWord &t)
Definition: codecs_tkjets.cc:6
std::vector< l1t::TkJetWord > decodeTkJets(const std::vector< ap_uint< 64 >> &)
ap_uint< kNtSize > nt_t
Definition: TkJetWord.h:58
std::array< std::vector< ap_uint< 64 > >, 1 > encodeTkJets(const edm::View< l1t::TkJetWord > &)
Definition: codecs_tkjets.cc:9