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 
126  void setQualityPacked(unsigned qual) { writeDataField(QUAL_START, QUAL_LENGTH, qual); }
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
L1MuRegionalCand::bx
int bx() const
return bunch crossing identifier
Definition: L1MuRegionalCand.h:79
L1MuRegionalCand::setPhiPacked
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
Definition: L1MuRegionalCand.h:120
L1MuRegionalCand::TYPE_LENGTH
Definition: L1MuRegionalCand.h:206
L1MuRegionalCand::ETA_LENGTH
Definition: L1MuRegionalCand.h:193
L1MuRegionalCand::setPtValue
void setPtValue(float ptVal)
Set Pt Value.
Definition: L1MuRegionalCand.h:148
L1MuRegionalCand::setEtaPacked
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
Definition: L1MuRegionalCand.h:135
start
Definition: start.py:1
L1MuRegionalCand::etaValue
float etaValue() const
get eta-value of muon candidate
Definition: L1MuRegionalCand.cc:87
L1MuRegionalCand::QUAL_START
Definition: L1MuRegionalCand.h:190
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
L1MuRegionalCand::phi_packed
unsigned phi_packed() const
return phi packed as in hardware
Definition: L1MuRegionalCand.h:86
L1MuRegionalCand::setFineHalo
void setFineHalo(bool fh)
Set Fine / Halo.
Definition: L1MuRegionalCand.h:160
L1MuRegionalCand::setPhiValue
void setPhiValue(float phiVal)
Set Phi Value.
Definition: L1MuRegionalCand.h:145
L1MuRegionalCand::QUAL_LENGTH
Definition: L1MuRegionalCand.h:191
L1MuRegionalCand::writeDataField
void writeDataField(unsigned start, unsigned count, unsigned value)
Definition: L1MuRegionalCand.cc:134
L1MuRegionalCand::PHI_LENGTH
Definition: L1MuRegionalCand.h:187
L1MuRegionalCand::m_dataWord
unsigned m_dataWord
Definition: L1MuRegionalCand.h:177
L1MuRegionalCand::CHARGE_LENGTH
Definition: L1MuRegionalCand.h:197
L1MuRegionalCand::PT_START
Definition: L1MuRegionalCand.h:188
L1MuRegionalCand::m_invalidValue
static const float m_invalidValue
Definition: L1MuRegionalCand.h:182
L1MuRegionalCand::L1MuRegionalCand
L1MuRegionalCand(unsigned dataword=0, int bx=0)
constructor from data word
Definition: L1MuRegionalCand.cc:42
L1MuRegionalCand::m_etaValue
float m_etaValue
Definition: L1MuRegionalCand.h:180
L1MuRegionalCand::PHI_START
Definition: L1MuRegionalCand.h:186
L1MuRegionalCand::setType
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
Definition: L1MuRegionalCand.h:114
L1MuRegionalCand::getDataWord
unsigned getDataWord() const
return data word
Definition: L1MuRegionalCand.h:107
L1MuRegionalCand::charge_valid_packed
unsigned charge_valid_packed() const
return charge valid packed as in hardware (1=valid, 0=not valid)
Definition: L1MuRegionalCand.h:104
L1MuRegionalCand::quality_packed
unsigned int quality_packed() const
return quality packed as in hardware
Definition: L1MuRegionalCand.h:92
L1MuRegionalCand::setBx
void setBx(int bx)
Set Bunch Crossing.
Definition: L1MuRegionalCand.h:117
L1MuRegionalCand::CHARGE_START
Definition: L1MuRegionalCand.h:196
L1MuRegionalCand::setEtaValue
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
Definition: L1MuRegionalCand.h:151
L1MuRegionalCand::readDataField
unsigned readDataField(unsigned start, unsigned count) const
Definition: L1MuRegionalCand.cc:129
L1MuRegionalCand::empty
virtual bool empty() const
return empty flag
Definition: L1MuRegionalCand.h:50
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1MuRegionalCand::CHVALID_START
Definition: L1MuRegionalCand.h:198
L1MuRegionalCand::m_ptValue
float m_ptValue
Definition: L1MuRegionalCand.h:181
L1MuRegionalCand::phiValue
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
Definition: L1MuRegionalCand.cc:80
L1MuRegionalCand
Definition: L1MuRegionalCand.h:26
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
L1MuRegionalCand::setChargeValidPacked
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
Definition: L1MuRegionalCand.h:132
L1MuRegionalCand::TYPE_START
Definition: L1MuRegionalCand.h:204
L1MuRegionalCand::setChargeValue
void setChargeValue(int charge)
Set Charge Value: -1, 1.
Definition: L1MuRegionalCand.h:154
L1MuRegionalCand::ETA_START
Definition: L1MuRegionalCand.h:192
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
L1MuRegionalCand::FINEHALO_LENGTH
Definition: L1MuRegionalCand.h:195
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
L1MuRegionalCand::setDataWord
void setDataWord(unsigned dataword)
Set data word.
Definition: L1MuRegionalCand.h:166
L1MuRegionalCand::chargeValue
int chargeValue() const
get charge
Definition: L1MuRegionalCand.h:64
L1MuRegionalCand::setPtPacked
void setPtPacked(unsigned pt)
Set Pt: 0..31.
Definition: L1MuRegionalCand.h:123
value
Definition: value.py:1
L1MuRegionalCand::~L1MuRegionalCand
virtual ~L1MuRegionalCand()
destructor
Definition: L1MuRegionalCand.h:43
DDAxes::phi
L1MuRegionalCand::chargeValid
bool chargeValid() const
is the charge valid ?
Definition: L1MuRegionalCand.h:67
L1MuRegionalCand::m_bx
int m_bx
Definition: L1MuRegionalCand.h:176
L1MuRegionalCand::eta_packed
unsigned eta_packed() const
return eta packed as in hardware
Definition: L1MuRegionalCand.h:95
L1MuRegionalCand::FINEHALO_START
Definition: L1MuRegionalCand.h:194
L1MuRegionalCand::setChargePacked
void setChargePacked(unsigned ch)
Set Charge (0=pos, 1=neg)
Definition: L1MuRegionalCand.h:129
L1MuRegionalCand::isFineHalo
bool isFineHalo() const
is it fine (DT) / halo (CSC) ?
Definition: L1MuRegionalCand.h:70
L1MuRegionalCand::finehalo_packed
unsigned finehalo_packed() const
return eta-fine (for DT) / halo (for CSC) bit
Definition: L1MuRegionalCand.h:98
L1MuRegionalCand::pt_packed
unsigned pt_packed() const
return pt packed as in hardware
Definition: L1MuRegionalCand.h:89
L1MuRegionalCand::CHVALID_LENGTH
Definition: L1MuRegionalCand.h:200
L1MuRegionalCand::m_phiValue
float m_phiValue
Definition: L1MuRegionalCand.h:179
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
L1MuRegionalCand::setChargeValid
void setChargeValid(bool valid)
Set Charge Valid.
Definition: L1MuRegionalCand.h:157
L1MuRegionalCand::ptValue
float ptValue() const
get pt-value of muon candidate in GeV
Definition: L1MuRegionalCand.cc:94
L1MuRegionalCand::type_idx
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
Definition: L1MuRegionalCand.h:76
L1MuRegionalCand::setQualityPacked
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
Definition: L1MuRegionalCand.h:126
L1MuRegionalCand::quality
unsigned int quality() const
return quality
Definition: L1MuRegionalCand.h:73
L1MuRegionalCand::print
virtual void print() const
print candidate
Definition: L1MuRegionalCand.cc:101
L1MuRegionalCand::reset
virtual void reset()
reset
Definition: L1MuRegionalCand.cc:72
L1MuRegionalCand::PT_LENGTH
Definition: L1MuRegionalCand.h:189
L1MuRegionalCand::charge_packed
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
Definition: L1MuRegionalCand.h:101
L1MuRegionalCand::setFineHaloPacked
void setFineHaloPacked(unsigned fh)
Set Fine / Halo.
Definition: L1MuRegionalCand.h:138