CMS 3D CMS Logo

L1MuRegionalCand.h
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
6 //
7 //
8 // Author :
9 // H. Sakulin HEPHY Vienna
10 //
11 // Migrated to CMSSW:
12 // I. Mikulec
13 //
14 //--------------------------------------------------
15 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuRegionalCand_h
16 #define DataFormatsL1GlobalMuonTrigger_L1MuRegionalCand_h
17 
18 //------------------------------------
19 // Collaborating Class Declarations --
20 //------------------------------------
21 
22 // ---------------------
23 // -- Class Interface --
24 // ---------------------
25 
27 public:
29  L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
30 
32  L1MuRegionalCand(unsigned type_idx,
33  unsigned phi,
34  unsigned eta,
35  unsigned pt,
36  unsigned charge,
37  unsigned ch_valid,
38  unsigned finehalo,
39  unsigned quality,
40  int bx);
41 
43  virtual ~L1MuRegionalCand() {}
44 
48 
50  virtual bool empty() const {
51  return (readDataField(PT_START, PT_LENGTH) == 0) || (readDataField(PHI_START, PHI_LENGTH) == 0xff);
52  }
53 
55  float phiValue() const;
56 
58  float etaValue() const;
59 
61  float ptValue() const;
62 
64  int chargeValue() const { return readDataField(CHARGE_START, CHARGE_LENGTH) == 0 ? 1 : -1; }
65 
67  bool chargeValid() const { return charge_valid_packed() == 1; }
68 
70  bool isFineHalo() const { return finehalo_packed() == 1; }
71 
73  unsigned int quality() const { return quality_packed(); }
74 
76  unsigned type_idx() const { return (int)readDataField(TYPE_START, TYPE_LENGTH); };
77 
79  int bx() const { return m_bx; }
80 
84 
86  unsigned phi_packed() const { return readDataField(PHI_START, PHI_LENGTH); }
87 
89  unsigned pt_packed() const { return readDataField(PT_START, PT_LENGTH); }
90 
92  unsigned int quality_packed() const { return readDataField(QUAL_START, QUAL_LENGTH); }
93 
95  unsigned eta_packed() const { return readDataField(ETA_START, ETA_LENGTH); }
96 
99 
101  unsigned charge_packed() const { return readDataField(CHARGE_START, CHARGE_LENGTH); }
102 
105 
107  unsigned getDataWord() const { return m_dataWord; };
108 
112 
115 
117  void setBx(int bx) { m_bx = bx; }
118 
121 
124 
127 
130 
133 
136 
139 
143 
145  void setPhiValue(float phiVal) { m_phiValue = phiVal; }
146 
148  void setPtValue(float ptVal) { m_ptValue = ptVal; }
149 
151  void setEtaValue(float etaVal) { m_etaValue = etaVal; }
152 
155 
158 
160  void setFineHalo(bool fh) { writeDataField(FINEHALO_START, FINEHALO_LENGTH, fh ? 1 : 0); }
161 
163  virtual void reset();
164 
166  void setDataWord(unsigned dataword) { m_dataWord = dataword; }
167 
169  virtual void print() const;
170 
171 private:
172  unsigned readDataField(unsigned start, unsigned count) const;
173  void writeDataField(unsigned start, unsigned count, unsigned value);
174 
175 private:
176  int m_bx;
177  unsigned m_dataWord; // muon data word (25 bits) :
178 
179  float m_phiValue;
180  float m_etaValue;
181  float m_ptValue;
182  static const float m_invalidValue;
183 
184 public:
185  // definition of the bit fields
186  enum { PHI_START = 0 };
187  enum { PHI_LENGTH = 8 }; // Bits 0:7 phi (8 bits)
188  enum { PT_START = 8 };
189  enum { PT_LENGTH = 5 }; // Bits 8:12 pt (5 bits)
190  enum { QUAL_START = 13 };
191  enum { QUAL_LENGTH = 3 }; // Bits 13:15 quality (3 bits)
192  enum { ETA_START = 16 };
193  enum { ETA_LENGTH = 6 }; // Bits 16:21 eta (6 bits)
194  enum { FINEHALO_START = 22 };
195  enum { FINEHALO_LENGTH = 1 }; // Bit 22 Eta is fine (DT) / Halo (CSC)
196  enum { CHARGE_START = 23 };
197  enum { CHARGE_LENGTH = 1 }; // Bit 23 Charge: 0 = positive
198  enum { CHVALID_START = 24 };
199  enum {
201  }; // Bit 24 Charge is vaild (1=valid)
202  // Bits 26 to 29: Synchronization
203 
204  enum { TYPE_START = 30 };
205  enum {
207  }; // Bit 30/31 type DT, bRPC, CSC, fRPC
208  // these bits are not sent to the GMT in hardware
209 };
210 #endif
Definition: start.py:1
void writeDataField(unsigned start, unsigned count, unsigned value)
unsigned int quality_packed() const
return quality packed as in hardware
unsigned pt_packed() const
return pt packed as in hardware
unsigned int quality() const
return quality
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
L1MuRegionalCand(unsigned dataword=0, int bx=0)
constructor from data word
unsigned getDataWord() const
return data word
unsigned phi_packed() const
return phi packed as in hardware
void setChargeValue(int charge)
Set Charge Value: -1, 1.
void setPtValue(float ptVal)
Set Pt Value.
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
unsigned readDataField(unsigned start, unsigned count) const
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
void setBx(int bx)
Set Bunch Crossing.
void setPhiValue(float phiVal)
Set Phi Value.
void setDataWord(unsigned dataword)
Set data word.
unsigned charge_valid_packed() const
return charge valid packed as in hardware (1=valid, 0=not valid)
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
static const float m_invalidValue
unsigned eta_packed() const
return eta packed as in hardware
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
virtual bool empty() const
return empty flag
Definition: value.py:1
int chargeValue() const
get charge
void setChargePacked(unsigned ch)
Set Charge (0=pos, 1=neg)
bool isFineHalo() const
is it fine (DT) / halo (CSC) ?
void setPtPacked(unsigned pt)
Set Pt: 0..31.
virtual ~L1MuRegionalCand()
destructor
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
bool chargeValid() const
is the charge valid ?
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
unsigned finehalo_packed() const
return eta-fine (for DT) / halo (for CSC) bit
virtual void reset()
reset
void setFineHaloPacked(unsigned fh)
Set Fine / Halo.
float ptValue() const
get pt-value of muon candidate in GeV
void setChargeValid(bool valid)
Set Charge Valid.
void setFineHalo(bool fh)
Set Fine / Halo.
float etaValue() const
get eta-value of muon candidate
virtual void print() const
print candidate
int bx() const
return bunch crossing identifier
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC