test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
28  public:
29 
31  L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
32 
34  L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt, unsigned charge,
35  unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
36 
38  virtual ~L1MuRegionalCand() {}
39 
43 
45  virtual bool empty() const {
46  return (readDataField( PT_START, PT_LENGTH) == 0) || (readDataField( PHI_START, PHI_LENGTH) == 0xff);
47  }
48 
50  float phiValue() const;
51 
53  float etaValue() const;
54 
56  float ptValue() const;
57 
59  int chargeValue() const { return readDataField( CHARGE_START, CHARGE_LENGTH) == 0 ? 1: -1; }
60 
62  bool chargeValid() const { return charge_valid_packed() == 1; }
63 
65  bool isFineHalo() const { return finehalo_packed() == 1; }
66 
68  unsigned int quality() const { return quality_packed(); }
69 
71  unsigned type_idx() const { return (int) readDataField( TYPE_START, TYPE_LENGTH); };
72 
74  int bx() const { return m_bx; }
75 
76 
80 
82  unsigned phi_packed() const { return readDataField (PHI_START, PHI_LENGTH); }
83 
85  unsigned pt_packed() const { return readDataField (PT_START, PT_LENGTH); }
86 
88  unsigned int quality_packed() const { return readDataField( QUAL_START, QUAL_LENGTH); }
89 
91  unsigned eta_packed() const { return readDataField( ETA_START, ETA_LENGTH); }
92 
95 
97  unsigned charge_packed() const { return readDataField( CHARGE_START, CHARGE_LENGTH); }
98 
101 
103  unsigned getDataWord() const { return m_dataWord; };
104 
108 
110  void setType(unsigned type) { writeDataField( TYPE_START, TYPE_LENGTH, type); }
111 
113  void setBx(int bx) { m_bx = bx; }
114 
116  void setPhiPacked(unsigned phi) { writeDataField (PHI_START, PHI_LENGTH, phi); }
117 
119  void setPtPacked(unsigned pt) { writeDataField (PT_START, PT_LENGTH, pt); }
120 
122  void setQualityPacked(unsigned qual) { writeDataField (QUAL_START, QUAL_LENGTH, qual); }
123 
126 
129 
131  void setEtaPacked(unsigned eta) { writeDataField (ETA_START, ETA_LENGTH, eta); }
132 
135 
136 
140 
142  void setPhiValue(float phiVal) {m_phiValue = phiVal;}
143 
145  void setPtValue(float ptVal) {m_ptValue = ptVal;}
146 
148  void setEtaValue(float etaVal) {m_etaValue = etaVal;}
149 
151  void setChargeValue(int charge) { writeDataField (CHARGE_START, CHARGE_LENGTH, charge == 1 ? 0 : 1); }
152 
154  void setChargeValid(bool valid) { writeDataField( CHVALID_START, CHVALID_LENGTH, valid ? 1 : 0); }
155 
157  void setFineHalo(bool fh) { writeDataField (FINEHALO_START, FINEHALO_LENGTH, fh ? 1 : 0); }
158 
159 
161  virtual void reset();
162 
164  void setDataWord(unsigned dataword) { m_dataWord = dataword;}
165 
167  virtual void print() const;
168 
169  private:
170  unsigned readDataField(unsigned start, unsigned count) const;
171  void writeDataField(unsigned start, unsigned count, unsigned value);
172 
173  private:
174  int m_bx;
175  unsigned m_dataWord; // muon data word (25 bits) :
176 
177  float m_phiValue;
178  float m_etaValue;
179  float m_ptValue;
180  static const float m_invalidValue;
181 
182 
183  public:
184  // definition of the bit fields
185  enum { PHI_START=0}; enum { PHI_LENGTH = 8}; // Bits 0:7 phi (8 bits)
186  enum { PT_START=8}; enum { PT_LENGTH = 5}; // Bits 8:12 pt (5 bits)
187  enum { QUAL_START=13}; enum { QUAL_LENGTH = 3}; // Bits 13:15 quality (3 bits)
188  enum { ETA_START=16}; enum { ETA_LENGTH = 6}; // Bits 16:21 eta (6 bits)
189  enum { FINEHALO_START=22}; enum { FINEHALO_LENGTH = 1};// Bit 22 Eta is fine (DT) / Halo (CSC)
190  enum { CHARGE_START=23}; enum { CHARGE_LENGTH = 1}; // Bit 23 Charge: 0 = positive
191  enum { CHVALID_START=24}; enum { CHVALID_LENGTH = 1}; // Bit 24 Charge is vaild (1=valid)
192  // Bits 26 to 29: Synchronization
193 
194  enum { TYPE_START=30}; enum { TYPE_LENGTH = 2}; // Bit 30/31 type DT, bRPC, CSC, fRPC
195  // these bits are not sent to the GMT in hardware
196 };
197 #endif
unsigned charge_valid_packed() const
return charge valid packed as in hardware (1=valid, 0=not valid)
type
Definition: HCALResponse.h:21
void writeDataField(unsigned start, unsigned count, unsigned value)
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
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