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_(511),
39  stubID1_(511),
40  stubID2_(511),
41  stubID3_(511),
42  stubID4_(511),
43  valid_(false) {}
44 
45  const uint charge() const { return charge_; }
46  const uint pt() const { return pt_; }
47  const int eta() const { return eta_; }
48  const int phi() const { return phi_; }
49  const int z0() const { return z0_; }
50  const int d0() const { return d0_; }
51  const uint beta() const { return beta_; }
52 
53  bool isGlobalMuon() const { return isGlobal_; }
54  const int quality() const { return quality_; }
55  const int offline_pt() const { return offline_pt_; }
56  const float offline_eta() const { return offline_eta_; }
57  const float offline_phi() const { return offline_phi_; }
58 
59  const uint stubID0() const { return stubID0_; }
60  const uint stubID1() const { return stubID1_; }
61  const uint stubID2() const { return stubID2_; }
62  const uint stubID3() const { return stubID3_; }
63  const uint stubID4() const { return stubID4_; }
64  bool valid() const { return valid_; }
65 
67  void setValid(bool v) { valid_ = v; }
68 
69  void setOfflineQuantities(float pt, float eta, float phi) {
70  offline_pt_ = pt;
71  offline_eta_ = eta;
72  offline_phi_ = phi;
73  }
74 
76  muRef_.push_back(ref);
77  isGlobal_ = true;
78  }
79 
80  void resetGlobal() { isGlobal_ = false; }
81 
82  const std::vector<l1t::RegionalMuonCandRef>& muonRef() const { return muRef_; }
83  void addStub(const l1t::MuonStubRef& stub) {
84  stubs_.push_back(stub);
85  if (stub->tfLayer() == 0)
86  stubID0_ = stub->id();
87  else if (stub->tfLayer() == 1)
88  stubID1_ = stub->id();
89  else if (stub->tfLayer() == 2)
90  stubID2_ = stub->id();
91  else if (stub->tfLayer() == 3)
92  stubID3_ = stub->id();
93  else if (stub->tfLayer() == 4)
94  stubID4_ = stub->id();
95  }
96 
97  const l1t::MuonStubRefVector& stubs() const { return stubs_; }
98 
100 
102 
103  void print() const {
104  LogDebug("PreTrackMatchedMuon") << "preconstructed muon : charge=" << charge_ << " pt=" << offline_pt_ << ","
105  << pt_ << " eta=" << offline_eta_ << "," << eta_ << " phi=" << offline_phi_ << ","
106  << phi_ << " z0=" << z0_ << " d0=" << d0_ << " quality=" << quality_
107  << " isGlobal=" << isGlobal_ << " valid=" << valid_ << " stubs: " << stubID0_
108  << " " << stubID1_ << " " << stubID2_ << " " << stubID3_ << " " << stubID4_;
109  }
110 
111  uint64_t lsb() const {
112  uint64_t w = charge_ & 0x1;
113  w = w | (twos_complement(pt_, BITSPT) << 1);
114  w = w | (twos_complement(phi_, BITSPHI) << (BITSPT + 1));
115  w = w | (twos_complement(eta_, BITSETA) << (BITSPHI + BITSPT + 1));
116  w = w | (twos_complement(z0_, BITSZ0) << (BITSETA + BITSPHI + BITSPT + 1));
117  w = w | (twos_complement(d0_, BITSD0) << (BITSZ0 + BITSETA + BITSPHI + BITSPT + 1));
118  return w;
119  }
120 
121  uint64_t msb() const {
122  uint64_t w2 = 0;
128  w2 = w2 | (twos_complement(isGlobal_, 1) << (5 * BITSSTUBID));
129  w2 = w2 | (twos_complement(beta_, BITSMUONBETA) << (5 * BITSSTUBID + 1));
132  return w2;
133  }
134 
135  void printWord() const {
136  LogDebug("PreTrackMatchedMuon") << "PreTrackMatchedMuon : word=" << std::setfill('0') << std::setw(16) << std::hex
137  << (long long unsigned int)(msb() >> 2) << std::setfill('0') << std::setw(16)
138  << std::hex
139  << (long long unsigned int)((lsb() | (msb() << 62)) & 0xffffffffffffffff);
140  }
141 
142  private:
145  int eta_;
146  int phi_;
147  int z0_;
148  int d0_;
150  bool isGlobal_;
152  float offline_pt_;
160  bool valid_;
162  std::vector<l1t::RegionalMuonCandRef> muRef_;
164  };
165 } // namespace Phase2L1GMT
166 
167 #endif
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
void addStub(const l1t::MuonStubRef &stub)
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
std::vector< l1t::RegionalMuonCandRef > muRef_
void setOfflineQuantities(float pt, float eta, float phi)
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
const std::vector< l1t::RegionalMuonCandRef > & 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
void addMuonRef(const l1t::RegionalMuonCandRef &ref)
const int BITSMUONBETA
Definition: Constants.h:42
uint64_t twos_complement(long long int v, uint bits)
Definition: Constants.h:91
#define LogDebug(id)
const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > trkPtr() const