CMS 3D CMS Logo

tracks.h
Go to the documentation of this file.
1 
2 #ifndef L1Trigger_DemonstratorTools_codecs_tracks_h
3 #define L1Trigger_DemonstratorTools_codecs_tracks_h
4 
5 #include <array>
6 #include <sstream>
7 #include <vector>
8 
9 #include "ap_int.h"
10 
16 
17 namespace l1t::demo::codecs {
18  //function to get the gttLinkID from the TrackFindingProcessors
19  template <typename T>
20  unsigned int gttLinkID(T track) {
21  // use the sign bit of the tanL word to remove dependence on TTTrack eta member.
22  unsigned int etaSector = (track.getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kTanlMSB,
23  TTTrack_TrackWord::TrackBitLocations::kTanlMSB)
24  ? 0
25  : 1);
26  return etaSector + (2 * track.phiSector());
27  }
28 
29  static inline std::pair<unsigned int, unsigned int> sectorsEtaPhiFromGTTLinkID(unsigned int id) {
30  unsigned int etaSector = (id % 2);
31  unsigned int phiSector = (static_cast<unsigned int>(id) - etaSector) / 2;
32  return std::pair<unsigned int, unsigned int>(etaSector, phiSector);
33  }
34 
35  // Return true if a track is contained within a collection
38 
39  // Encodes a single track into a 96-bit track word
40  ap_uint<96> encodeTrack(const TTTrack_TrackWord& t);
41 
42  // Return the 96-bit track words from a given track collection and place them on the appropriate 18 'logical' links
43  std::array<std::vector<ap_uint<96>>, 18> getTrackWords(const edm::View<TTTrack<Ref_Phase2TrackerDigi_>>&);
44  std::array<std::vector<ap_uint<96>>, 18> getTrackWords(
47 
48  // Encodes track collection onto 18 'logical' output links (2x9 eta-phi sectors; -/+ eta pairs)
49  std::array<std::vector<ap_uint<64>>, 18> encodeTracks(const edm::View<TTTrack<Ref_Phase2TrackerDigi_>>&,
50  int debug = 0);
51 
52  // Encodes a track collection based off the ordering of another track collection
53  // Requirement: The second collection must be a subset of the first
54  std::array<std::vector<ap_uint<64>>, 18> encodeTracks(
57  int debug = 0);
58 
59  // Decodes the tracks for a single link
60  std::vector<TTTrack_TrackWord> decodeTracks(const std::vector<ap_uint<64>>&);
61 
62  // Decodes the tracks from 18 'logical' output links (2x9 eta-phi sectors; , -/+ eta pairs)
63  std::array<std::vector<TTTrack_TrackWord>, 18> decodeTracks(const std::array<std::vector<ap_uint<64>>, 18>&);
64 
65 } // namespace l1t::demo::codecs
66 
67 #endif
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)
static std::pair< unsigned int, unsigned int > sectorsEtaPhiFromGTTLinkID(unsigned int id)
Definition: tracks.h:29
unsigned int gttLinkID(T track)
Definition: tracks.h:20
#define debug
Definition: HDRShower.cc:19
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
std::array< std::vector< ap_uint< 96 > >, 18 > getTrackWords(const edm::View< TTTrack< Ref_Phase2TrackerDigi_ >> &)
bool trackInCollection(const edm::Ref< std::vector< TTTrack< Ref_Phase2TrackerDigi_ >>> &, const edm::Handle< edm::RefVector< std::vector< TTTrack< Ref_Phase2TrackerDigi_ >>>> &)
Definition: codecs_tracks.cc:7
long double T
std::vector< TTTrack_TrackWord > decodeTracks(const std::vector< ap_uint< 64 >> &)