CMS 3D CMS Logo

Functions
l1t::demo::codecs Namespace Reference

Functions

std::vector< TTTrack_TrackWorddecodeTracks (const std::vector< ap_uint< 64 >> &frames)
 
std::array< std::vector< TTTrack_TrackWord >, 18 > decodeTracks (const std::array< std::vector< ap_uint< 64 >>, 18 > &frames)
 
std::vector< l1t::VertexWorddecodeVertices (const std::vector< ap_uint< 64 >> &)
 
ap_uint< 96 > encodeTrack (const TTTrack_TrackWord &t)
 
std::array< std::vector< ap_uint< 64 > >, 18 > encodeTracks (const edm::View< TTTrack< Ref_Phase2TrackerDigi_ >> &, int debug=0)
 
ap_uint< 64 > encodeVertex (const l1t::VertexWord &v)
 
std::array< std::vector< ap_uint< 64 > >, 1 > encodeVertices (const edm::View< l1t::VertexWord > &)
 

Function Documentation

◆ decodeTracks() [1/2]

std::vector<TTTrack_TrackWord> l1t::demo::codecs::decodeTracks ( const std::vector< ap_uint< 64 >> &  frames)

Definition at line 41 of file codecs_tracks.cc.

References mps_fire::i, TTTrack_TrackWord::kBendChi2LSB, TTTrack_TrackWord::kBendChi2MSB, TTTrack_TrackWord::kChi2RPhiLSB, TTTrack_TrackWord::kChi2RPhiMSB, TTTrack_TrackWord::kChi2RZLSB, TTTrack_TrackWord::kChi2RZMSB, TTTrack_TrackWord::kD0LSB, TTTrack_TrackWord::kD0MSB, TTTrack_TrackWord::kHitPatternLSB, TTTrack_TrackWord::kHitPatternMSB, TTTrack_TrackWord::kMVAOtherLSB, TTTrack_TrackWord::kMVAOtherMSB, TTTrack_TrackWord::kMVAQualityLSB, TTTrack_TrackWord::kMVAQualityMSB, TTTrack_TrackWord::kPhiLSB, TTTrack_TrackWord::kPhiMSB, TTTrack_TrackWord::kRinvLSB, TTTrack_TrackWord::kRinvMSB, TTTrack_TrackWord::kTanlLSB, TTTrack_TrackWord::kTanlMSB, TTTrack_TrackWord::kValidLSB, TTTrack_TrackWord::kValidMSB, TTTrack_TrackWord::kZ0LSB, TTTrack_TrackWord::kZ0MSB, TTTrack_TrackWord::setTrackWord(), and l1t::tracks.

Referenced by decodeTracks().

41  {
42  std::vector<TTTrack_TrackWord> tracks;
43 
44  if ((frames.size() % 3) != 0) {
45  std::stringstream message;
46  message << "The number of track frames (" << frames.size() << ") is not evenly divisible by 3";
47  throw std::runtime_error(message.str());
48  }
49 
50  for (size_t i = 0; i < frames.size(); i += 3) {
51  TTTrack_TrackWord::tkword_t combination1 = (ap_uint<32>(frames.at(i + 1)(31, 0)), frames.at(i)(63, 0));
52  TTTrack_TrackWord::tkword_t combination2 = (frames.at(i + 2)(63, 0), ap_uint<32>(frames.at(i + 1)(63, 32)));
53  TTTrack_TrackWord track1, track2;
54  track1.setTrackWord(
69  track2.setTrackWord(
84  tracks.push_back(track1);
85  tracks.push_back(track2);
86  }
87 
88  return tracks;
89  }
ap_uint< TrackBitWidths::kTrackWordSize > tkword_t
ap_uint< TrackBitWidths::kMVAQualitySize > qualityMVA_t
ap_uint< TrackBitWidths::kZ0Size > z0_t
void setTrackWord(unsigned int valid, const GlobalVector &momentum, const GlobalPoint &POCA, double rInv, double chi2RPhi, double chi2RZ, double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, unsigned int mvaOther, unsigned int sector)
ap_uint< TrackBitWidths::kMVAOtherSize > otherMVA_t
ap_uint< TrackBitWidths::kValidSize > valid_t
ap_uint< TrackBitWidths::kRinvSize > rinv_t
ap_uint< TrackBitWidths::kHitPatternSize > hit_t
ap_uint< TrackBitWidths::kChi2RZSize > chi2rz_t
auto const & tracks
cannot be loose
ap_uint< TrackBitWidths::kTanlSize > tanl_t
ap_uint< TrackBitWidths::kD0Size > d0_t
ap_uint< TrackBitWidths::kChi2RPhiSize > chi2rphi_t
ap_uint< TrackBitWidths::kBendChi2Size > bendChi2_t
ap_uint< TrackBitWidths::kPhiSize > phi_t

◆ decodeTracks() [2/2]

std::array<std::vector<TTTrack_TrackWord>, 18> l1t::demo::codecs::decodeTracks ( const std::array< std::vector< ap_uint< 64 >>, 18 > &  frames)

Definition at line 91 of file codecs_tracks.cc.

References decodeTracks(), mps_fire::i, and l1t::tracks.

91  {
92  std::array<std::vector<TTTrack_TrackWord>, 18> tracks;
93 
94  for (size_t i = 0; i < tracks.size(); i++) {
95  tracks.at(i) = decodeTracks(frames.at(i));
96  }
97 
98  return tracks;
99  }
std::array< std::vector< TTTrack_TrackWord >, 18 > decodeTracks(const std::array< std::vector< ap_uint< 64 >>, 18 > &frames)
auto const & tracks
cannot be loose

◆ decodeVertices()

std::vector< l1t::VertexWord > l1t::demo::codecs::decodeVertices ( const std::vector< ap_uint< 64 >> &  frames)

Definition at line 26 of file codecs_vertices.cc.

References l1t::VertexWord::kNTrackInPVLSB, l1t::VertexWord::kNTrackInPVMSB, l1t::VertexWord::kNTrackOutPVLSB, l1t::VertexWord::kNTrackOutPVMSB, l1t::VertexWord::kQualityLSB, l1t::VertexWord::kQualityMSB, l1t::VertexWord::kSumPtLSB, l1t::VertexWord::kSumPtMSB, l1t::VertexWord::kUnassignedLSB, l1t::VertexWord::kUnassignedMSB, l1t::VertexWord::kValidLSB, l1t::VertexWord::kZ0LSB, l1t::VertexWord::kZ0MSB, findQualityFiles::v, AlignmentTracksFromVertexSelector_cfi::vertices, and x.

Referenced by GTTFileReader::produce().

26  {
27  std::vector<l1t::VertexWord> vertices;
28 
29  for (const auto& x : frames) {
30  if (not x.test(VertexWord::kValidLSB))
31  break;
32 
33  VertexWord v(VertexWord::vtxvalid_t(1),
34  VertexWord::vtxz0_t(x(VertexWord::kZ0MSB, VertexWord::kZ0LSB)),
35  VertexWord::vtxmultiplicity_t(x(VertexWord::kNTrackInPVMSB, VertexWord::kNTrackInPVLSB)),
36  VertexWord::vtxsumpt_t(x(VertexWord::kSumPtMSB, VertexWord::kSumPtLSB)),
37  VertexWord::vtxquality_t(x(VertexWord::kQualityMSB, VertexWord::kQualityLSB)),
38  VertexWord::vtxinversemult_t(x(VertexWord::kNTrackOutPVMSB, VertexWord::kNTrackOutPVLSB)),
39  VertexWord::vtxunassigned_t(x(VertexWord::kUnassignedMSB, VertexWord::kUnassignedLSB)));
40  vertices.push_back(v);
41  }
42 
43  return vertices;
44  }
float x

◆ encodeTrack()

ap_uint< 96 > l1t::demo::codecs::encodeTrack ( const TTTrack_TrackWord t)

Definition at line 6 of file codecs_tracks.cc.

References submitPVValidationJobs::t.

Referenced by encodeTracks().

6 { return t.getTrackWord(); }

◆ encodeTracks()

std::array< std::vector< ap_uint< 64 > >, 18 > l1t::demo::codecs::encodeTracks ( const edm::View< TTTrack< Ref_Phase2TrackerDigi_ >> &  tracks,
int  debug = 0 
)

Definition at line 9 of file codecs_tracks.cc.

References debug, encodeTrack(), mps_fire::i, dqmiolumiharvest::j, push_back(), HLT_2022v12_cff::track, and l1t::tracks.

Referenced by GTTFileWriter::analyze().

10  {
11  std::array<std::vector<ap_uint<96>>, 18> trackWords;
12  if (debug > 0) {
13  edm::LogInfo("l1t::demo::codecs") << "encodeTrack::Encoding " << tracks.size() << " tracks";
14  }
15  for (const auto& track : tracks)
16  trackWords.at((track.eta() >= 0 ? 9 : 0) + track.phiSector()).push_back(encodeTrack(track));
17 
18  std::array<std::vector<ap_uint<64>>, 18> linkData;
19 
20  size_t counter = 0;
21  for (size_t i = 0; i < linkData.size(); i++) {
22  // Pad track vectors -> full packet length (156 frames = 104 tracks)
23  trackWords.at(i).resize(104, 0);
24  linkData.at(i).resize(156, {0});
25 
26  for (size_t j = 0; (j < trackWords.at(i).size()); j += 2) {
27  linkData.at(i).at(3 * j / 2) = trackWords.at(i).at(j)(63, 0);
28  linkData.at(i).at(3 * j / 2 + 1) =
29  (ap_uint<32>(trackWords.at(i).at(j + 1)(31, 0)), ap_uint<32>(trackWords.at(i).at(j)(95, 64)));
30  linkData.at(i).at(3 * j / 2 + 2) = trackWords.at(i).at(j + 1)(95, 32);
31  counter += trackWords.at(i).at(j)(95, 95) + trackWords.at(i).at(j + 1)(95, 95);
32  }
33  }
34  if (debug > 0) {
35  edm::LogInfo("l1t::demo::codecs") << "encodeTrack::Encoded " << counter << " tracks";
36  }
37 
38  return linkData;
39  }
ap_uint< 96 > encodeTrack(const TTTrack_TrackWord &t)
Definition: codecs_tracks.cc:6
Log< level::Info, false > LogInfo
#define debug
Definition: HDRShower.cc:19
auto const & tracks
cannot be loose
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})

◆ encodeVertex()

ap_uint< 64 > l1t::demo::codecs::encodeVertex ( const l1t::VertexWord v)

Definition at line 6 of file codecs_vertices.cc.

References findQualityFiles::v.

Referenced by encodeVertices().

6 { return v.vertexWord(); }

◆ encodeVertices()

std::array< std::vector< ap_uint< 64 > >, 1 > l1t::demo::codecs::encodeVertices ( const edm::View< l1t::VertexWord > &  vertices)

Definition at line 9 of file codecs_vertices.cc.

References encodeVertex(), mps_fire::i, bphysicsOniaDQM_cfi::vertex, and AlignmentTracksFromVertexSelector_cfi::vertices.

Referenced by GTTFileWriter::analyze().

9  {
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  }
ap_uint< 64 > encodeVertex(const l1t::VertexWord &v)