CMS 3D CMS Logo

RegionalMuonCand.h
Go to the documentation of this file.
1 #ifndef __l1t_regional_muon_candidate_h__
2 #define __l1t_regional_muon_candidate_h__
3 
4 #include "RegionalMuonCandFwd.h"
5 #include <map>
6 
7 namespace l1t {
9  public:
12  enum bmtfAddress {
14  kWheelNum = 1,
15  kStat1 = 2,
16  kStat2 = 3,
17  kStat3 = 4,
18  kStat4 = 5,
24  };
27  enum omtfAddress { kLayers = 0, kZero = 1, kWeight = 2, kNumOmtfSubAddr = 3 };
30  enum emtfAddress {
31  kME1Seg = 0,
32  kME1Ch = 1,
33  kME2Seg = 2,
34  kME2Ch = 3,
35  kME3Seg = 4,
36  kME3Ch = 5,
37  kME4Seg = 6,
38  kME4Ch = 7,
39  kTrkNum = 8,
40  kBX = 9,
42  };
43 
45 
47  : m_hwPt(0),
49  m_hwDXY(0),
50  m_hwPhi(0),
51  m_hwEta(0),
52  m_hwHF(false),
53  m_hwSign(0),
54  m_hwSignValid(0),
55  m_hwQuality(0),
56  m_dataword(0) {
58  };
59 
60  RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder)
61  : m_hwPt(pt),
63  m_hwDXY(0),
64  m_hwPhi(phi),
65  m_hwEta(eta),
66  m_hwHF(false),
67  m_hwSign(sign),
68  m_hwSignValid(signvalid),
70  m_dataword(0) {
71  setTFIdentifiers(processor, trackFinder);
72  // set default track addresses
73  if (trackFinder == tftype::bmtf) {
74  m_trackAddress = {{kWheelSide, 0},
75  {kWheelNum, 0},
76  {kStat1, 0},
77  {kStat2, 0},
78  {kStat3, 0},
79  {kStat4, 0},
80  {kSegSelStat1, 0},
81  {kSegSelStat2, 0},
82  {kSegSelStat3, 0},
83  {kSegSelStat4, 0}};
84  } else if (trackFinder == tftype::omtf_pos || trackFinder == tftype::omtf_neg) {
85  m_trackAddress = {{kLayers, 0}, {kZero, 0}, {kWeight, 0}};
86  } else if (trackFinder == tftype::emtf_pos || trackFinder == tftype::emtf_neg) {
87  m_trackAddress = {{kME1Seg, 0},
88  {kME1Ch, 0},
89  {kME2Seg, 0},
90  {kME2Ch, 0},
91  {kME3Seg, 0},
92  {kME3Ch, 0},
93  {kME4Seg, 0},
94  {kME4Ch, 0},
95  {kTrkNum, 0},
96  {kBX, 0}};
97  }
98  };
99 
101  int phi,
102  int eta,
103  int sign,
104  int signvalid,
105  int quality,
106  int processor,
107  tftype trackFinder,
108  std::map<int, int> trackAddress)
109  : m_hwPt(pt),
111  m_hwDXY(0),
112  m_hwPhi(phi),
113  m_hwEta(eta),
114  m_hwHF(false),
115  m_hwSign(sign),
116  m_hwSignValid(signvalid),
119  m_dataword(0) {
120  setTFIdentifiers(processor, trackFinder);
121  };
122 
123  virtual ~RegionalMuonCand(){};
124 
126  void setHwPt(int bits) { m_hwPt = bits; };
130  void setHwDXY(int bits) { m_hwDXY = bits; };
132  void setHwPhi(int bits) { m_hwPhi = bits; };
134  void setHwEta(int bits) { m_hwEta = bits; };
136  void setHwSign(int bits) { m_hwSign = bits; };
140  void setHwQual(int bits) { m_hwQuality = bits; };
142  void setHwHF(bool bit) { m_hwHF = bit; };
144  void setTFIdentifiers(int processor, tftype trackFinder);
145  // this is left to still be compatible with OMTF
146  void setLink(int link) { m_link = link; };
147  // Set the muon index on the link (i.e., 0, 1, or 2)
148  void setMuIdx(int muIdx) { m_muIdx = muIdx; };
149  // Set the 64 bit word from two 32 words. bits 0-31->lsbs, bits 32-63->msbs
150  void setDataword(uint32_t msbs, uint32_t lsbs) { m_dataword = (((uint64_t)msbs) << 32) + lsbs; };
151  // Set the 64 bit word coming from HW directly
154  void setTrackSubAddress(bmtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
156  void setTrackSubAddress(omtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
158  void setTrackSubAddress(emtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
160  void setTrackAddress(const std::map<int, int>& address) { m_trackAddress = address; }
161 
163  const int hwPt() const { return m_hwPt; };
165  const int hwPtUnconstrained() const { return m_hwPtUnconstrained; };
167  const int hwDXY() const { return m_hwDXY; };
169  const int hwPhi() const { return m_hwPhi; };
171  const int hwEta() const { return m_hwEta; };
173  const int hwSign() const { return m_hwSign; };
175  const int hwSignValid() const { return m_hwSignValid; };
177  const int hwQual() const { return m_hwQuality; };
179  const int link() const { return m_link; };
181  const int muIdx() const { return m_muIdx; };
183  const int processor() const { return m_processor; };
185  const tftype trackFinderType() const { return m_trackFinder; };
187  const int hwHF() const { return m_hwHF; };
189  const uint64_t dataword() const { return m_dataword; };
191  const uint32_t dataword32Msb() const { return (uint32_t)((m_dataword >> 32) & 0xFFFFFFFF); };
193  const uint32_t dataword32Lsb() const { return (uint32_t)(m_dataword & 0xFFFFFFFF); };
195  const std::map<int, int>& trackAddress() const { return m_trackAddress; }
197  int trackSubAddress(bmtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
199  int trackSubAddress(omtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
201  int trackSubAddress(emtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
202 
203  bool operator==(const RegionalMuonCand& rhs) const;
204  inline bool operator!=(const RegionalMuonCand& rhs) const { return !(operator==(rhs)); };
205 
206  private:
207  int m_hwPt;
209  int m_hwDXY;
210  int m_hwPhi;
211  int m_hwEta;
212  bool m_hwHF;
213  int m_hwSign;
216  int m_link;
219  std::map<int, int> m_trackAddress;
220 
223  int m_muIdx{-1};
224  };
225 
226 } // namespace l1t
227 
228 #endif /* define __l1t_regional_muon_candidate_h__ */
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
bool operator==(const RegionalMuonCand &rhs) const
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
const uint64_t dataword() const
Get 64 bit data word.
int trackSubAddress(omtfAddress subAddress) const
Get part of track address (identifies track primitives used for reconstruction)
int trackSubAddress(emtfAddress subAddress) const
Get part of track address (identifies track primitives used for reconstruction)
void setTrackSubAddress(emtfAddress subAddress, int value)
Set a part of the muon candidates track address; specialised for EMTF.
const int link() const
Get link on which the MicroGMT receives the candidate.
const int processor() const
Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) ...
void setMuIdx(int muIdx)
std::map< int, int > m_trackAddress
delete x;
Definition: CaloConfig.h:22
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
const int hwHF() const
Get HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1)
const uint32_t dataword32Lsb() const
Get 32 LSBs of data word.
void setTrackAddress(const std::map< int, int > &address)
Set the whole track address.
const int hwQual() const
Get quality code.
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
string quality
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
const tftype trackFinderType() const
Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) ...
void setTrackSubAddress(bmtfAddress subAddress, int value)
Set a part of the muon candidates track address; specialised for BMTF.
void setDataword(uint32_t msbs, uint32_t lsbs)
void setHwHF(bool bit)
Set HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1)
void setDataword(uint64_t bits)
Definition: value.py:1
RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder)
const int hwSign() const
Get charge sign bit (charge = (-1)^(sign))
void setHwQual(int bits)
Set compressed quality code as transmitted by hardware (4 bits)
void setHwPt(int bits)
Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits)
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
void setHwDXY(int bits)
Set compressed impact parameter with respect to beamspot (4 bits)
const int hwPtUnconstrained() const
Get second compressed pT (returned int * 1.0 = pT (GeV))
unsigned long long uint64_t
Definition: Time.h:13
const std::map< int, int > & trackAddress() const
Get the track address (identifies track primitives used for reconstruction)
const int hwDXY() const
Get compressed impact parameter (4 bits)
const int hwSignValid() const
Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid)
bool operator!=(const RegionalMuonCand &rhs) const
void setTrackSubAddress(omtfAddress subAddress, int value)
Set a part of the muon candidates track address; specialised for OMTF.
int trackSubAddress(bmtfAddress subAddress) const
Get part of track address (identifies track primitives used for reconstruction)
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder, std::map< int, int > trackAddress)
const int muIdx() const
Get muon index (i.e., 0, 1, or 2)
uint64_t m_dataword
This is the 64 bit word as transmitted in HW.
void setHwPtUnconstrained(int bits)
Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits)
const uint32_t dataword32Msb() const
Get 32 MSBs of data word.
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))