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 // $Date: 2007/10/18 12:19:14 $
8 // $Revision: 1.3 $
9 //
10 // Author :
11 // H. Sakulin HEPHY Vienna
12 //
13 // Migrated to CMSSW:
14 // I. Mikulec
15 //
16 //--------------------------------------------------
17 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuRegionalCand_h
18 #define DataFormatsL1GlobalMuonTrigger_L1MuRegionalCand_h
19 
20 //------------------------------------
21 // Collaborating Class Declarations --
22 //------------------------------------
23 
24 // ---------------------
25 // -- Class Interface --
26 // ---------------------
27 
29 
30  public:
31 
33  L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
34 
36  L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt, unsigned charge,
37  unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
38 
40  virtual ~L1MuRegionalCand() {}
41 
45 
47  virtual bool empty() const {
48  return (readDataField( PT_START, PT_LENGTH) == 0) || (readDataField( PHI_START, PHI_LENGTH) == 0xff);
49  }
50 
52  float phiValue() const;
53 
55  float etaValue() const;
56 
58  float ptValue() const;
59 
61  int chargeValue() const { return readDataField( CHARGE_START, CHARGE_LENGTH) == 0 ? 1: -1; }
62 
64  bool chargeValid() const { return charge_valid_packed() == 1; }
65 
67  bool isFineHalo() const { return finehalo_packed() == 1; }
68 
70  unsigned int quality() const { return quality_packed(); }
71 
73  unsigned type_idx() const { return (int) readDataField( TYPE_START, TYPE_LENGTH); };
74 
76  int bx() const { return m_bx; }
77 
78 
82 
84  unsigned phi_packed() const { return readDataField (PHI_START, PHI_LENGTH); }
85 
87  unsigned pt_packed() const { return readDataField (PT_START, PT_LENGTH); }
88 
90  unsigned int quality_packed() const { return readDataField( QUAL_START, QUAL_LENGTH); }
91 
93  unsigned eta_packed() const { return readDataField( ETA_START, ETA_LENGTH); }
94 
97 
99  unsigned charge_packed() const { return readDataField( CHARGE_START, CHARGE_LENGTH); }
100 
103 
105  unsigned getDataWord() const { return m_dataWord; };
106 
110 
112  void setType(unsigned type) { writeDataField( TYPE_START, TYPE_LENGTH, type); }
113 
115  void setBx(int bx) { m_bx = bx; }
116 
118  void setPhiPacked(unsigned phi) { writeDataField (PHI_START, PHI_LENGTH, phi); }
119 
121  void setPtPacked(unsigned pt) { writeDataField (PT_START, PT_LENGTH, pt); }
122 
124  void setQualityPacked(unsigned qual) { writeDataField (QUAL_START, QUAL_LENGTH, qual); }
125 
128 
131 
133  void setEtaPacked(unsigned eta) { writeDataField (ETA_START, ETA_LENGTH, eta); }
134 
137 
138 
142 
144  void setPhiValue(float phiVal) {m_phiValue = phiVal;}
145 
147  void setPtValue(float ptVal) {m_ptValue = ptVal;}
148 
150  void setEtaValue(float etaVal) {m_etaValue = etaVal;}
151 
153  void setChargeValue(int charge) { writeDataField (CHARGE_START, CHARGE_LENGTH, charge == 1 ? 0 : 1); }
154 
157 
159  void setFineHalo(bool fh) { writeDataField (FINEHALO_START, FINEHALO_LENGTH, fh ? 1 : 0); }
160 
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 
185  public:
186  // definition of the bit fields
187  enum { PHI_START=0}; enum { PHI_LENGTH = 8}; // Bits 0:7 phi (8 bits)
188  enum { PT_START=8}; enum { PT_LENGTH = 5}; // Bits 8:12 pt (5 bits)
189  enum { QUAL_START=13}; enum { QUAL_LENGTH = 3}; // Bits 13:15 quality (3 bits)
190  enum { ETA_START=16}; enum { ETA_LENGTH = 6}; // Bits 16:21 eta (6 bits)
191  enum { FINEHALO_START=22}; enum { FINEHALO_LENGTH = 1};// Bit 22 Eta is fine (DT) / Halo (CSC)
192  enum { CHARGE_START=23}; enum { CHARGE_LENGTH = 1}; // Bit 23 Charge: 0 = positive
193  enum { CHVALID_START=24}; enum { CHVALID_LENGTH = 1}; // Bit 24 Charge is vaild (1=valid)
194  // Bits 26 to 29: Synchronization
195 
196  enum { TYPE_START=30}; enum { TYPE_LENGTH = 2}; // Bit 30/31 type DT, bRPC, CSC, fRPC
197  // these bits are not sent to the GMT in hardware
198 };
199 #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
T eta() const
void setChargeValue(int charge)
Set Charge Value: -1, 1.
void setPtValue(float ptVal)
Set Pt Value.
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
double charge(const std::vector< uint8_t > &Ampls)
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
Definition: DDAxes.h:10