CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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),
69  m_hwQuality(quality),
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),
117  m_hwQuality(quality),
118  m_trackAddress(trackAddress),
119  m_dataword(0) {
120  setTFIdentifiers(processor, trackFinder);
121  };
122 
123  virtual ~RegionalMuonCand(){};
124 
126  void setHwPt(int bits) { m_hwPt = bits; };
128  void setHwPtUnconstrained(int bits) { m_hwPtUnconstrained = 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; };
138  void setHwSignValid(int bits) { m_hwSignValid = 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 64 bit word from two 32 words. bits 0-31->lsbs, bits 32-63->msbs
148  void setDataword(uint32_t msbs, uint32_t lsbs) { m_dataword = (((uint64_t)msbs) << 32) + lsbs; };
149  // Set the 64 bit word coming from HW directly
150  void setDataword(uint64_t bits) { m_dataword = bits; };
152  void setTrackSubAddress(bmtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
154  void setTrackSubAddress(omtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
156  void setTrackSubAddress(emtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
158  void setTrackAddress(const std::map<int, int>& address) { m_trackAddress = address; }
159 
161  const int hwPt() const { return m_hwPt; };
163  const int hwPtUnconstrained() const { return m_hwPtUnconstrained; };
165  const int hwDXY() const { return m_hwDXY; };
167  const int hwPhi() const { return m_hwPhi; };
169  const int hwEta() const { return m_hwEta; };
171  const int hwSign() const { return m_hwSign; };
173  const int hwSignValid() const { return m_hwSignValid; };
175  const int hwQual() const { return m_hwQuality; };
177  const int link() const { return m_link; };
179  const int processor() const { return m_processor; };
181  const tftype trackFinderType() const { return m_trackFinder; };
183  const int hwHF() const { return m_hwHF; };
185  const uint64_t dataword() const { return m_dataword; };
187  const uint32_t dataword32Msb() const { return (uint32_t)((m_dataword >> 32) & 0xFFFFFFFF); };
189  const uint32_t dataword32Lsb() const { return (uint32_t)(m_dataword & 0xFFFFFFFF); };
191  const std::map<int, int>& trackAddress() const { return m_trackAddress; }
193  int trackSubAddress(bmtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
195  int trackSubAddress(omtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
197  int trackSubAddress(emtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
198 
199  bool operator==(const RegionalMuonCand& rhs) const;
200  inline bool operator!=(const RegionalMuonCand& rhs) const { return !(operator==(rhs)); };
201 
202  private:
203  int m_hwPt;
205  int m_hwDXY;
206  int m_hwPhi;
207  int m_hwEta;
208  bool m_hwHF;
209  int m_hwSign;
212  int m_link;
215  std::map<int, int> m_trackAddress;
216 
219  };
220 
221 } // namespace l1t
222 
223 #endif /* define __l1t_regional_muon_candidate_h__ */
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
const uint32_t dataword32Msb() const
Get 32 MSBs of data word.
const int hwSignValid() const
Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid)
const int hwDXY() const
Get compressed impact parameter (4 bits)
void setTrackSubAddress(emtfAddress subAddress, int value)
Set a part of the muon candidates track address; specialised for EMTF.
double sign(double x)
std::map< int, int > m_trackAddress
string quality
void setTrackAddress(const std::map< int, int > &address)
Set the whole track address.
bool operator==(const RegionalMuonCand &rhs) const
const int hwQual() const
Get quality code.
int trackSubAddress(emtfAddress subAddress) const
Get part of track address (identifies track primitives used for reconstruction)
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
void setTrackSubAddress(bmtfAddress subAddress, int value)
Set a part of the muon candidates track address; specialised for BMTF.
const int hwHF() const
Get HF (halo / fine eta) bit (EMTF: halo -&gt; 1; BMTF: fine eta -&gt; 1)
void setDataword(uint32_t msbs, uint32_t lsbs)
void setHwHF(bool bit)
Set HF (halo / fine eta) bit (EMTF: halo -&gt; 1; BMTF: fine eta -&gt; 1)
void setDataword(uint64_t bits)
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
const std::map< int, int > & trackAddress() const
Get the track address (identifies track primitives used for reconstruction)
bool operator!=(const RegionalMuonCand &rhs) const
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder)
const int link() const
Get link on which the MicroGMT receives the candidate.
const tftype trackFinderType() const
Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) ...
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 processor() const
Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) ...
unsigned long long uint64_t
Definition: Time.h:13
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)
int trackSubAddress(omtfAddress subAddress) const
Get part of track address (identifies track primitives used for reconstruction)
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
const uint64_t dataword() const
Get 64 bit data word.
const int hwSign() const
Get charge sign bit (charge = (-1)^(sign))
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)
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 dataword32Lsb() const
Get 32 LSBs of data word.
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))
const int hwPtUnconstrained() const
Get second compressed pT (returned int * 1.0 = pT (GeV))