CMS 3D CMS Logo

PreTrackMatchedMuon.h
Go to the documentation of this file.
1 #ifndef PHASE2GMT_PRETRACKMATCHEDMUON
2 #define PHASE2GMT_PRETRACKMATCHEDMUON
3 
15 
16 #include <vector>
17 
18 namespace Phase2L1GMT {
19 
21  public:
23  const uint& pt,
24  const int& eta,
25  const int& phi,
26  const int& z0,
27  const int& d0,
28  const uint& beta = 15)
29  : charge_(charge),
30  pt_(pt),
31  eta_(eta),
32  phi_(phi),
33  z0_(z0),
34  d0_(d0),
35  beta_(beta),
37  quality_(0),
38  stubID0_(4095),
39  stubID1_(4095),
40  stubID2_(4095),
41  stubID3_(4095),
42  stubID4_(4095),
43  matchMask_(0),
44  valid_(false) {}
45 
46  const uint charge() const { return charge_; }
47  const uint pt() const { return pt_; }
48  const int eta() const { return eta_; }
49  const int phi() const { return phi_; }
50  const int z0() const { return z0_; }
51  const int d0() const { return d0_; }
52  const uint beta() const { return beta_; }
53 
54  bool isGlobalMuon() const { return isGlobal_; }
55  const int quality() const { return quality_; }
56  const int offline_pt() const { return offline_pt_; }
57  const float offline_eta() const { return offline_eta_; }
58  const float offline_phi() const { return offline_phi_; }
59 
60  const uint stubID0() const { return stubID0_; }
61  const uint stubID1() const { return stubID1_; }
62  const uint stubID2() const { return stubID2_; }
63  const uint stubID3() const { return stubID3_; }
64  const uint stubID4() const { return stubID4_; }
65  const uint matchMask() const { return matchMask_; }
66 
67  bool valid() const { return valid_; }
68 
70  void setValid(bool v) { valid_ = v; }
71 
72  void setOfflineQuantities(float pt, float eta, float phi) {
73  offline_pt_ = pt;
74  offline_eta_ = eta;
75  offline_phi_ = phi;
76  }
77 
78  void addMuonRef(const l1t::SAMuonRef& ref) { muRef_.push_back(ref); }
79 
80  void resetGlobal() { isGlobal_ = false; }
81 
82  const l1t::SAMuonRefVector& muonRef() const { return muRef_; }
83  void addStub(const l1t::MuonStubRef& stub, uint mask) {
84  stubs_.push_back(stub);
85  if (stub->tfLayer() == 0) {
86  stubID0_ = stub->address();
88  } else if (stub->tfLayer() == 1) {
89  stubID1_ = stub->address();
90  matchMask_ = matchMask_ | (mask << 2);
91  } else if (stub->tfLayer() == 2) {
92  stubID2_ = stub->address();
93  matchMask_ = matchMask_ | (mask << 4);
94  } else if (stub->tfLayer() == 3) {
95  stubID3_ = stub->address();
96  matchMask_ = matchMask_ | (mask << 6);
97  } else if (stub->tfLayer() == 4) {
98  stubID4_ = stub->address();
99  matchMask_ = matchMask_ | (mask << 8);
100  }
101  }
102 
103  const l1t::MuonStubRefVector& stubs() const { return stubs_; }
104 
106 
108 
109  void print() const {
110  LogDebug("PreTrackMatchedMuon") << "preconstructed muon : charge=" << charge_ << " pt=" << offline_pt_ << ","
111  << pt_ << " eta=" << offline_eta_ << "," << eta_ << " phi=" << offline_phi_ << ","
112  << phi_ << " z0=" << z0_ << " d0=" << d0_ << " quality=" << quality_
113  << " isGlobal=" << isGlobal_ << " valid=" << valid_ << " stubs: " << stubID0_
114  << " " << stubID1_ << " " << stubID2_ << " " << stubID3_ << " " << stubID4_;
115  }
116 
117  uint64_t lsb() const {
118  wordtype w = 0;
119  int bstart = 0;
120  bstart = wordconcat<wordtype>(w, bstart, charge_ & 0x1, 1);
121  bstart = wordconcat<wordtype>(w, bstart, pt_, BITSPT);
122  bstart = wordconcat<wordtype>(w, bstart, phi_, BITSPHI);
123  bstart = wordconcat<wordtype>(w, bstart, eta_, BITSETA);
124  bstart = wordconcat<wordtype>(w, bstart, z0_, BITSZ0);
125  bstart = wordconcat<wordtype>(w, bstart, d0_, BITSD0);
126  return w.to_int();
127  }
128 
129  uint64_t msb() const {
130  wordtype w2 = 0;
131  int bstart = 0;
132  bstart = wordconcat<wordtype>(w2, bstart, stubID0_, BITSSTUBID);
133  bstart = wordconcat<wordtype>(w2, bstart, stubID1_, BITSSTUBID);
134  bstart = wordconcat<wordtype>(w2, bstart, stubID2_, BITSSTUBID);
135  bstart = wordconcat<wordtype>(w2, bstart, stubID3_, BITSSTUBID);
136  bstart = wordconcat<wordtype>(w2, bstart, stubID4_, BITSSTUBID);
137  bstart = wordconcat<wordtype>(w2, bstart, isGlobal_, 1);
138  bstart = wordconcat<wordtype>(w2, bstart, beta_, BITSMUONBETA);
139  bstart = wordconcat<wordtype>(w2, bstart, quality_, BITSMATCHQUALITY);
140  bstart = wordconcat<wordtype>(w2, bstart, valid_, 1);
141 
142  return w2.to_int();
143  }
144 
145  void printWord() const {
146  LogDebug("PreTrackMatchedMuon") << "PreTrackMatchedMuon : word=" << std::setfill('0') << std::setw(16) << std::hex
147  << (long long unsigned int)(msb() >> 2) << std::setfill('0') << std::setw(16)
148  << std::hex
149  << (long long unsigned int)((lsb() | (msb() << 62)) & 0xffffffffffffffff);
150  }
151 
152  private:
155  int eta_;
156  int phi_;
157  int z0_;
158  int d0_;
160  bool isGlobal_;
162  float offline_pt_;
171 
172  bool valid_;
176  };
177 } // namespace Phase2L1GMT
178 
179 #endif
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
T w() const
const int BITSMATCHQUALITY
Definition: Constants.h:41
const int BITSZ0
Definition: Constants.h:27
void setOfflineQuantities(float pt, float eta, float phi)
std::vector< edm::Ref< SAMuonCollection > > SAMuonRefVector
Definition: SAMuon.h:19
const l1t::MuonStubRefVector & stubs() const
PreTrackMatchedMuon(const uint &charge, const uint &pt, const int &eta, const int &phi, const int &z0, const int &d0, const uint &beta=15)
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Definition: MuonStub.h:44
ap_uint< 64 > wordtype
Definition: Constants.h:101
const l1t::SAMuonRefVector & muonRef() const
const int BITSETA
Definition: Constants.h:26
const int BITSPT
Definition: Constants.h:24
void setTrkPtr(const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > &trkPtr)
const int BITSPHI
Definition: Constants.h:25
const int BITSD0
Definition: Constants.h:28
const int BITSSTUBID
Definition: Constants.h:33
edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > trkPtr_
unsigned long long uint64_t
Definition: Time.h:13
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
const int BITSMUONBETA
Definition: Constants.h:42
void addMuonRef(const l1t::SAMuonRef &ref)
void addStub(const l1t::MuonStubRef &stub, uint mask)
#define LogDebug(id)
const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > trkPtr() const