CMS 3D CMS Logo

TPSAlgorithm.h
Go to the documentation of this file.
1 #ifndef L1Trigger_Phase2GMT_TPSAlgorithm_h
2 #define L1Trigger_Phase2GMT_TPSAlgorithm_h
3 
15 #include <fstream>
16 #include <iostream>
17 
18 namespace Phase2L1GMT {
19 
20  const unsigned int PHIDIVIDER = 1 << (BITSPHI - BITSSTUBCOORD);
21  const unsigned int ETADIVIDER = 1 << (BITSETA - BITSSTUBETA);
22  const unsigned int BITSPROP = BITSPHI - 2;
23  const unsigned int PROPMAX = ~ap_uint<BITSPROP>(0);
24 
25  struct propagation_t {
26  ap_int<BITSSTUBCOORD> coord1;
27  ap_uint<BITSSIGMACOORD> sigma_coord1;
28  ap_int<BITSSTUBCOORD> coord2;
29  ap_uint<BITSSIGMACOORD> sigma_coord2;
30  ap_int<BITSSTUBETA> eta;
31  ap_uint<BITSSIGMAETA> sigma_eta1;
32  ap_uint<BITSSIGMAETA> sigma_eta2;
33  ap_uint<1> valid;
34  ap_uint<1> is_barrel;
35  };
36 
37  struct match_t {
38  ap_uint<BITSMATCHQUALITY - 2> quality;
39  ap_uint<BITSSTUBID> id;
40  ap_uint<2> valid;
41  bool isGlobal = false;
44  };
45 
46  class TPSAlgorithm {
47  public:
48  explicit TPSAlgorithm(const edm::ParameterSet& iConfig);
49  TPSAlgorithm() = delete;
50  ~TPSAlgorithm() = default;
51 
52  std::vector<PreTrackMatchedMuon> processNonant(const std::vector<ConvertedTTTrack>& convertedTracks,
53  const l1t::MuonStubRefVector& stubs) const;
54 
55  std::vector<PreTrackMatchedMuon> cleanNeighbor(const std::vector<PreTrackMatchedMuon>& muons,
56  const std::vector<PreTrackMatchedMuon>& muonsPrevious,
57  const std::vector<PreTrackMatchedMuon>& muonsNext,
58  bool equality) const;
59  std::vector<l1t::TrackerMuon> convert(const std::vector<PreTrackMatchedMuon>& muons, uint maximum) const;
60  bool outputGT(std::vector<l1t::TrackerMuon>& muons) const;
61  void SetQualityBits(std::vector<l1t::TrackerMuon>& muons) const;
62  std::vector<l1t::TrackerMuon> sort(std::vector<l1t::TrackerMuon>& muons, uint maximum) const;
63 
64  private:
65  int verbose_;
66  propagation_t propagate(const ConvertedTTTrack& track, uint layer) const;
67  ap_uint<BITSSIGMAETA + 1> deltaEta(const ap_int<BITSSTUBETA>& eta1, const ap_int<BITSSTUBETA>& eta2) const;
68  ap_uint<BITSSIGMACOORD + 1> deltaCoord(const ap_int<BITSSTUBCOORD>& phi1, const ap_int<BITSSTUBCOORD>& phi2) const;
69  match_t match(const propagation_t prop, const l1t::MuonStubRef& stub, uint trackID) const;
70  match_t propagateAndMatch(const ConvertedTTTrack& track, const l1t::MuonStubRef& stub, uint trackID) const;
71  match_t getBest(const std::vector<match_t>& matches) const;
73  ap_uint<5> cleanMuon(const PreTrackMatchedMuon& mu, const PreTrackMatchedMuon& other, bool eq) const;
74  void matchingInfos(const std::vector<match_t>& matchInfo,
76  ap_uint<BITSMATCHQUALITY>& quality) const;
77  std::vector<PreTrackMatchedMuon> clean(const std::vector<PreTrackMatchedMuon>& muons) const;
78  };
79 } // namespace Phase2L1GMT
80 
81 #endif
ap_uint< BITSSIGMACOORD > sigma_coord1
Definition: TPSAlgorithm.h:27
const unsigned int PROPMAX
Definition: TPSAlgorithm.h:23
const int BITSSTUBCOORD
Definition: Constants.h:31
ap_uint< BITSSIGMAETA+1 > deltaEta(const ap_int< BITSSTUBETA > &eta1, const ap_int< BITSSTUBETA > &eta2) const
ap_uint< BITSSIGMACOORD+1 > deltaCoord(const ap_int< BITSSTUBCOORD > &phi1, const ap_int< BITSSTUBCOORD > &phi2) const
const int BITSMATCHQUALITY
Definition: Constants.h:41
ap_int< BITSSTUBCOORD > coord1
Definition: TPSAlgorithm.h:26
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
const int BITSSTUBETA
Definition: Constants.h:32
ap_uint< BITSSIGMAETA > sigma_eta2
Definition: TPSAlgorithm.h:32
l1t::MuonStubRef stubRef
Definition: TPSAlgorithm.h:43
ap_uint< BITSSIGMACOORD > sigma_coord2
Definition: TPSAlgorithm.h:29
std::vector< PreTrackMatchedMuon > cleanNeighbor(const std::vector< PreTrackMatchedMuon > &muons, const std::vector< PreTrackMatchedMuon > &muonsPrevious, const std::vector< PreTrackMatchedMuon > &muonsNext, bool equality) const
Definition: TPSAlgorithm.cc:19
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Definition: MuonStub.h:44
l1t::SAMuonRef muRef
Definition: TPSAlgorithm.h:42
void SetQualityBits(std::vector< l1t::TrackerMuon > &muons) const
Definition: TPSAlgorithm.cc:84
string quality
std::vector< PreTrackMatchedMuon > clean(const std::vector< PreTrackMatchedMuon > &muons) const
PreTrackMatchedMuon processTrack(const ConvertedTTTrack &, const l1t::MuonStubRefVector &) const
match_t match(const propagation_t prop, const l1t::MuonStubRef &stub, uint trackID) const
const int BITSETA
Definition: Constants.h:26
void matchingInfos(const std::vector< match_t > &matchInfo, PreTrackMatchedMuon &muon, ap_uint< BITSMATCHQUALITY > &quality) const
bool outputGT(std::vector< l1t::TrackerMuon > &muons) const
Definition: TPSAlgorithm.cc:97
const int BITSPHI
Definition: Constants.h:25
std::vector< PreTrackMatchedMuon > processNonant(const std::vector< ConvertedTTTrack > &convertedTracks, const l1t::MuonStubRefVector &stubs) const
Definition: TPSAlgorithm.cc:7
ap_uint< 5 > cleanMuon(const PreTrackMatchedMuon &mu, const PreTrackMatchedMuon &other, bool eq) const
ap_uint< BITSMATCHQUALITY - 2 > quality
Definition: TPSAlgorithm.h:38
ap_uint< BITSSIGMAETA > sigma_eta1
Definition: TPSAlgorithm.h:31
match_t propagateAndMatch(const ConvertedTTTrack &track, const l1t::MuonStubRef &stub, uint trackID) const
ap_uint< 2 > valid
Definition: TPSAlgorithm.h:40
std::vector< l1t::TrackerMuon > sort(std::vector< l1t::TrackerMuon > &muons, uint maximum) const
std::vector< l1t::TrackerMuon > convert(const std::vector< PreTrackMatchedMuon > &muons, uint maximum) const
Definition: TPSAlgorithm.cc:56
ap_uint< BITSSTUBID > id
Definition: TPSAlgorithm.h:39
ap_int< BITSSTUBETA > eta
Definition: TPSAlgorithm.h:30
const unsigned int PHIDIVIDER
Definition: TPSAlgorithm.h:20
match_t getBest(const std::vector< match_t > &matches) const
const unsigned int BITSPROP
Definition: TPSAlgorithm.h:22
propagation_t propagate(const ConvertedTTTrack &track, uint layer) const
ap_int< BITSSTUBCOORD > coord2
Definition: TPSAlgorithm.h:28
const unsigned int ETADIVIDER
Definition: TPSAlgorithm.h:21