CMS 3D CMS Logo

codecs_vertices.cc
Go to the documentation of this file.
1 
3 
4 namespace l1t::demo::codecs {
5 
6  ap_uint<64> encodeVertex(const l1t::VertexWord& v) { return v.vertexWord(); }
7 
8  // Encodes vertex collection onto 1 output link
9  std::array<std::vector<ap_uint<64>>, 1> encodeVertices(const edm::View<l1t::VertexWord>& vertices) {
10  std::vector<ap_uint<64>> vertexWords;
11 
12  for (const auto& vertex : vertices)
13  vertexWords.push_back(encodeVertex(vertex));
14 
15  std::array<std::vector<ap_uint<64>>, 1> linkData;
16 
17  for (size_t i = 0; i < linkData.size(); i++) {
18  // Pad vertex vectors -> full packet length (48 frames, but only 10 vertices max)
19  vertexWords.resize(10, 0);
20  linkData.at(i) = vertexWords;
21  }
22 
23  return linkData;
24  }
25 
26  std::vector<l1t::VertexWord> decodeVertices(const std::vector<ap_uint<64>>& frames) {
27  std::vector<l1t::VertexWord> vertices;
28 
29  for (const auto& x : frames) {
30  if (not x.test(VertexWord::kValidLSB))
31  break;
32 
40  vertices.push_back(v);
41  }
42 
43  return vertices;
44  }
45 
46 } // namespace l1t::demo::codecs
ap_uint< VertexBitWidths::kUnassignedSize > vtxunassigned_t
Definition: VertexWord.h:71
ap_ufixed< VertexBitWidths::kNTrackInPVSize, VertexBitWidths::kNTrackInPVSize, AP_RND_CONV, AP_SAT > vtxmultiplicity_t
Definition: VertexWord.h:65
ap_ufixed< VertexBitWidths::kNTrackOutPVSize, VertexBitWidths::kNTrackOutPVSize, AP_RND_CONV, AP_SAT > vtxinversemult_t
Definition: VertexWord.h:70
ap_fixed< VertexBitWidths::kZ0Size, VertexBitWidths::kZ0MagSize, AP_RND_CONV, AP_SAT > vtxz0_t
Definition: VertexWord.h:63
std::vector< l1t::VertexWord > decodeVertices(const std::vector< ap_uint< 64 >> &)
ap_ufixed< VertexBitWidths::kSumPtSize, VertexBitWidths::kSumPtMagSize, AP_RND_CONV, AP_SAT > vtxsumpt_t
Definition: VertexWord.h:67
ap_uint< VertexBitWidths::kQualitySize > vtxquality_t
Definition: VertexWord.h:68
std::array< std::vector< ap_uint< 64 > >, 1 > encodeVertices(const edm::View< l1t::VertexWord > &)
float x
ap_uint< 64 > encodeVertex(const l1t::VertexWord &v)
ap_uint< VertexBitWidths::kValidSize > vtxvalid_t
Definition: VertexWord.h:62