CMS 3D CMS Logo

L1MuGMTCand.h
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
9 //
10 //
11 // Author :
12 // H. Sakulin HEPHY Vienna
13 // N. Neumeister CERN EP
14 //
15 // Migrated to CMSSW:
16 // I. Mikulec
17 //
18 //--------------------------------------------------
19 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTCand_h
20 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTCand_h
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 #include <string>
26 
27 //----------------------
28 // Base Class Headers --
29 //----------------------
30 
31 //------------------------------------
32 // Collaborating Class Declarations --
33 //------------------------------------
34 
35 // ---------------------
36 // -- Class Interface --
37 // ---------------------
38 
39 class L1MuGMTCand {
40 public:
42  L1MuGMTCand();
43 
45  L1MuGMTCand(unsigned data, int bx = 0);
46 
48  L1MuGMTCand(const L1MuGMTCand&);
49 
51  virtual ~L1MuGMTCand();
52 
54  void reset();
55 
56  //
57  // Getters
58  //
59 
61  bool empty() const { return readDataField(PT_START, PT_LENGTH) == 0; }
62 
64  unsigned getDataWord() const { return m_dataWord; }
65 
67  std::string name() const { return m_name; }
68 
70  unsigned int phiIndex() const { return readDataField(PHI_START, PHI_LENGTH); }
71 
73  unsigned int ptIndex() const { return readDataField(PT_START, PT_LENGTH); }
74 
76 
90  unsigned int quality() const { return readDataField(QUAL_START, QUAL_LENGTH); }
91 
93  bool useInSingleMuonTrigger() const { return quality() >= 4; };
94 
96  bool useInDiMuonTrigger() const { return (quality() >= 3) && (quality() != 4); };
97 
99  bool isMatchedCand() const { return quality() == 7; }
100 
102  bool isHaloCand() const { return quality() == 1; }
103 
105  unsigned int etaIndex() const { return readDataField(ETA_START, ETA_LENGTH); }
106 
108  unsigned sysign() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH); }
109 
111  bool isol() const { return readDataField(ISO_START, ISO_LENGTH) == 1; }
112 
114  bool mip() const { return readDataField(MIP_START, MIP_LENGTH) == 1; }
115 
117  int bx() const { return m_bx; }
118 
121  float phiValue() const;
122 
125  float etaValue() const;
126 
129  float ptValue() const;
130 
132  int charge() const { return (readDataField(SYSIGN_START, SYSIGN_LENGTH) & 1) == 0 ? 1 : -1; }
133 
135  bool charge_valid() const {
137  return (sysign == 0 || sysign == 1);
138  }
139 
141  bool isSyncWord() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH) == 3; }
142 
146 
149 
152 
155 
158 
161 
163  void setMIP(bool mip) { writeDataField(MIP_START, MIP_LENGTH, mip ? 1 : 0); }
164 
167 
169  void setBx(int bx) { m_bx = bx; }
170 
172 
174  void setPhiValue(float phiVal) { m_phiValue = phiVal; }
175 
177  void setPtValue(float ptVal) { m_ptValue = ptVal; }
178 
180  void setEtaValue(float etaVal) { m_etaValue = etaVal; }
181 
182  //
183  // Other
184  //
185 
186  unsigned int linearizedPt(float lsbValue, unsigned maxScale) const { return 0; }
187 
188  unsigned int etaRegionIndex() const { return etaIndex(); }
189 
190  unsigned int phiRegionIndex() const { return phiIndex(); }
191 
193  bool operator==(const L1MuGMTCand&) const;
194 
196  bool operator!=(const L1MuGMTCand&) const;
197 
199  void print() const;
200 
202  friend std::ostream& operator<<(std::ostream&, const L1MuGMTCand&);
203 
204 protected:
205 protected:
206  inline unsigned readDataField(unsigned start, unsigned count) const;
207  inline void writeDataField(unsigned start, unsigned count, unsigned value);
208 
210  int m_bx; // in here only for technical reasons in simulation
211  unsigned m_dataWord; // muon data word (26 bits) :
212 
213  float m_phiValue;
214  float m_etaValue;
215  float m_ptValue;
216  static const float m_invalidValue;
217 
218  // definition of the bit fields
219  enum { PHI_START = 0 };
220  enum { PHI_LENGTH = 8 }; // Bits 0:7 phi (8 bits)
221  enum { PT_START = 8 };
222  enum { PT_LENGTH = 5 }; // Bits 8:12 pt (5 bits)
223  enum { QUAL_START = 13 };
224  enum { QUAL_LENGTH = 3 }; // Bits 13:15 quality (3 bits)
225  enum { ETA_START = 16 };
226  enum { ETA_LENGTH = 6 }; // Bits 16:21 eta (6 bits)
227  enum { ISO_START = 22 };
228  enum { ISO_LENGTH = 1 }; // Bit 22 Isolation
229  enum { MIP_START = 23 };
230  enum { MIP_LENGTH = 1 }; // Bit 23 MIP
231  enum { SYSIGN_START = 24 };
232  enum { SYSIGN_LENGTH = 2 }; // Bit 24:25 Charge/Syncword
233 };
234 
235 unsigned L1MuGMTCand::readDataField(unsigned start, unsigned count) const {
236  unsigned mask = ((1 << count) - 1) << start;
237  return (m_dataWord & mask) >> start;
238 }
239 
240 void L1MuGMTCand::writeDataField(unsigned start, unsigned count, unsigned value) {
241  unsigned mask = ((1 << count) - 1) << start;
242  m_dataWord &= ~mask; // clear
243  m_dataWord |= (value << start) & mask;
244 }
245 
246 #endif
Definition: start.py:1
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:151
bool isol() const
get isolation
Definition: L1MuGMTCand.h:111
void writeDataField(unsigned start, unsigned count, unsigned value)
Definition: L1MuGMTCand.h:240
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:163
unsigned int etaRegionIndex() const
Definition: L1MuGMTCand.h:188
void print() const
print parameters of muon candidate
Definition: L1MuGMTCand.cc:144
unsigned int linearizedPt(float lsbValue, unsigned maxScale) const
Definition: L1MuGMTCand.h:186
bool useInSingleMuonTrigger() const
interpretation of quality code: is the candidate to be used in a single muon trigger ...
Definition: L1MuGMTCand.h:93
bool mip() const
get mip
Definition: L1MuGMTCand.h:114
void reset()
reset muon candidate
Definition: L1MuGMTCand.cc:81
unsigned int ptIndex() const
get pt-code
Definition: L1MuGMTCand.h:73
int bx() const
get bunch crossing identifier
Definition: L1MuGMTCand.h:117
float m_ptValue
Definition: L1MuGMTCand.h:215
unsigned int phiRegionIndex() const
Definition: L1MuGMTCand.h:190
friend std::ostream & operator<<(std::ostream &, const L1MuGMTCand &)
output stream operator
constexpr uint32_t mask
Definition: gpuClustering.h:24
L1MuGMTCand()
constructor
Definition: L1MuGMTCand.cc:49
float m_etaValue
Definition: L1MuGMTCand.h:214
bool operator!=(const L1MuGMTCand &) const
unequal operator
Definition: L1MuGMTCand.cc:133
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:90
float m_phiValue
Definition: L1MuGMTCand.h:213
bool charge_valid() const
is the charge valid ?
Definition: L1MuGMTCand.h:135
static const float m_invalidValue
Definition: L1MuGMTCand.h:216
unsigned readDataField(unsigned start, unsigned count) const
Definition: L1MuGMTCand.h:235
void setPhiValue(float phiVal)
Setters for physical values.
Definition: L1MuGMTCand.h:174
std::string m_name
Definition: L1MuGMTCand.h:209
unsigned int phiIndex() const
get phi-code
Definition: L1MuGMTCand.h:70
float etaValue() const
Definition: L1MuGMTCand.cc:102
void setBx(int bx)
set bunch crossing identifier
Definition: L1MuGMTCand.h:169
Definition: value.py:1
int charge() const
get charge (+1 -1)
Definition: L1MuGMTCand.h:132
float ptValue() const
Definition: L1MuGMTCand.cc:112
unsigned m_dataWord
Definition: L1MuGMTCand.h:211
bool empty() const
is it an empty muon candidate?
Definition: L1MuGMTCand.h:61
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
Definition: L1MuGMTCand.h:166
bool isHaloCand() const
interpretation of quality code: is the candidate a beam halo muon ?
Definition: L1MuGMTCand.h:102
unsigned sysign() const
get charge/synchronization word (0=POS, 1=NEG, 2=UNDEF, 3=SYNC)
Definition: L1MuGMTCand.h:108
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:154
bool useInDiMuonTrigger() const
interpretation of quality code: is the candidate to be used in a di-muon trigger ?
Definition: L1MuGMTCand.h:96
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:157
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
Definition: L1MuGMTCand.h:180
float phiValue() const
Definition: L1MuGMTCand.cc:92
std::string name() const
get name of object
Definition: L1MuGMTCand.h:67
bool isSyncWord() const
is the candidate a sync word
Definition: L1MuGMTCand.h:141
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
bool isMatchedCand() const
interpretation of quality code: is the candidate a matched candidate ?
Definition: L1MuGMTCand.h:99
unsigned getDataWord() const
get muon data word
Definition: L1MuGMTCand.h:64
unsigned int etaIndex() const
get eta-code
Definition: L1MuGMTCand.h:105
void setPtValue(float ptVal)
Set Pt Value.
Definition: L1MuGMTCand.h:177
virtual ~L1MuGMTCand()
destructor
Definition: L1MuGMTCand.cc:72
bool operator==(const L1MuGMTCand &) const
equal operator
Definition: L1MuGMTCand.cc:122
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
Definition: L1MuGMTCand.h:148
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:160