CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
114  void setType(unsigned type) { writeDataField(TYPE_START, TYPE_LENGTH, type); }
115 
117  void setBx(int bx) { m_bx = bx; }
118 
120  void setPhiPacked(unsigned phi) { writeDataField(PHI_START, PHI_LENGTH, phi); }
121 
123  void setPtPacked(unsigned pt) { writeDataField(PT_START, PT_LENGTH, pt); }
124 
126  void setQualityPacked(unsigned qual) { writeDataField(QUAL_START, QUAL_LENGTH, qual); }
127 
130 
133 
135  void setEtaPacked(unsigned eta) { writeDataField(ETA_START, ETA_LENGTH, eta); }
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 
154  void setChargeValue(int charge) { writeDataField(CHARGE_START, CHARGE_LENGTH, charge == 1 ? 0 : 1); }
155 
157  void setChargeValid(bool valid) { writeDataField(CHVALID_START, CHVALID_LENGTH, valid ? 1 : 0); }
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
unsigned charge_valid_packed() const
return charge valid packed as in hardware (1=valid, 0=not valid)
void writeDataField(unsigned start, unsigned count, unsigned value)
virtual void print() const
print candidate
float etaValue() const
get eta-value of muon candidate
virtual bool empty() const
return empty flag
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
void setChargeValue(int charge)
Set Charge Value: -1, 1.
void setPtValue(float ptVal)
Set Pt Value.
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
bool isFineHalo() const
is it fine (DT) / halo (CSC) ?
void setBx(int bx)
Set Bunch Crossing.
float ptValue() const
get pt-value of muon candidate in GeV
void setPhiValue(float phiVal)
Set Phi Value.
void setDataWord(unsigned dataword)
Set data word.
unsigned getDataWord() const
return data word
unsigned readDataField(unsigned start, unsigned count) const
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.
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
unsigned finehalo_packed() const
return eta-fine (for DT) / halo (for CSC) bit
void setChargePacked(unsigned ch)
Set Charge (0=pos, 1=neg)
void setPtPacked(unsigned pt)
Set Pt: 0..31.
bool chargeValid() const
is the charge valid ?
virtual ~L1MuRegionalCand()
destructor
unsigned int quality() const
return quality
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
unsigned int quality_packed() const
return quality packed as in hardware
int bx() const
return bunch crossing identifier
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
virtual void reset()
reset
void setFineHaloPacked(unsigned fh)
Set Fine / Halo.
void setChargeValid(bool valid)
Set Charge Valid.
void setFineHalo(bool fh)
Set Fine / Halo.
unsigned pt_packed() const
return pt packed as in hardware
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
int chargeValue() const
get charge
unsigned phi_packed() const
return phi packed as in hardware