CMS 3D CMS Logo

L1MuGMTCand.h
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
9 //
10 //
11 // Author :
12 // H. Sakulin HEPHY Vienna
13 // N. Neumeister CERN EP
14 //
15 // Migrated to CMSSW:
16 // I. Mikulec
17 //
18 //--------------------------------------------------
19 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTCand_h
20 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTCand_h
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 #include <string>
26 
27 //----------------------
28 // Base Class Headers --
29 //----------------------
30 
31 //------------------------------------
32 // Collaborating Class Declarations --
33 //------------------------------------
34 
35 // ---------------------
36 // -- Class Interface --
37 // ---------------------
38 
39 class L1MuGMTCand {
40 public:
42  L1MuGMTCand();
43 
45  L1MuGMTCand(unsigned data, int bx = 0);
46 
48  L1MuGMTCand(const L1MuGMTCand&);
49 
51  virtual ~L1MuGMTCand();
52 
54  void reset();
55 
56  //
57  // Getters
58  //
59 
61  bool empty() const { return readDataField(PT_START, PT_LENGTH) == 0; }
62 
64  unsigned getDataWord() const { return m_dataWord; }
65 
67  std::string name() const { return m_name; }
68 
70  unsigned int phiIndex() const { return readDataField(PHI_START, PHI_LENGTH); }
71 
73  unsigned int ptIndex() const { return readDataField(PT_START, PT_LENGTH); }
74 
76 
90  unsigned int quality() const { return readDataField(QUAL_START, QUAL_LENGTH); }
91 
93  bool useInSingleMuonTrigger() const { return quality() >= 4; };
94 
96  bool useInDiMuonTrigger() const { return (quality() >= 3) && (quality() != 4); };
97 
99  bool isMatchedCand() const { return quality() == 7; }
100 
102  bool isHaloCand() const { return quality() == 1; }
103 
105  unsigned int etaIndex() const { return readDataField(ETA_START, ETA_LENGTH); }
106 
108  unsigned sysign() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH); }
109 
111  bool isol() const { return readDataField(ISO_START, ISO_LENGTH) == 1; }
112 
114  bool mip() const { return readDataField(MIP_START, MIP_LENGTH) == 1; }
115 
117  int bx() const { return m_bx; }
118 
121  float phiValue() const;
122 
125  float etaValue() const;
126 
129  float ptValue() const;
130 
132  int charge() const { return (readDataField(SYSIGN_START, SYSIGN_LENGTH) & 1) == 0 ? 1 : -1; }
133 
135  bool charge_valid() const {
137  return (sysign == 0 || sysign == 1);
138  }
139 
141  bool isSyncWord() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH) == 3; }
142 
146 
149 
152 
155 
158 
161 
163  void setMIP(bool mip) { writeDataField(MIP_START, MIP_LENGTH, mip ? 1 : 0); }
164 
167 
169  void setBx(int bx) { m_bx = bx; }
170 
172 
174  void setPhiValue(float phiVal) { m_phiValue = phiVal; }
175 
177  void setPtValue(float ptVal) { m_ptValue = ptVal; }
178 
180  void setEtaValue(float etaVal) { m_etaValue = etaVal; }
181 
182  //
183  // Other
184  //
185 
186  unsigned int linearizedPt(float lsbValue, unsigned maxScale) const { return 0; }
187 
188  unsigned int etaRegionIndex() const { return etaIndex(); }
189 
190  unsigned int phiRegionIndex() const { return phiIndex(); }
191 
193  bool operator==(const L1MuGMTCand&) const;
194 
196  bool operator!=(const L1MuGMTCand&) const;
197 
199  void print() const;
200 
202  friend std::ostream& operator<<(std::ostream&, const L1MuGMTCand&);
203 
204 protected:
205 protected:
206  inline unsigned readDataField(unsigned start, unsigned count) const;
207  inline void writeDataField(unsigned start, unsigned count, unsigned value);
208 
210  int m_bx; // in here only for technical reasons in simulation
211  unsigned m_dataWord; // muon data word (26 bits) :
212 
213  float m_phiValue;
214  float m_etaValue;
215  float m_ptValue;
216  static const float m_invalidValue;
217 
218  // definition of the bit fields
219  enum { PHI_START = 0 };
220  enum { PHI_LENGTH = 8 }; // Bits 0:7 phi (8 bits)
221  enum { PT_START = 8 };
222  enum { PT_LENGTH = 5 }; // Bits 8:12 pt (5 bits)
223  enum { QUAL_START = 13 };
224  enum { QUAL_LENGTH = 3 }; // Bits 13:15 quality (3 bits)
225  enum { ETA_START = 16 };
226  enum { ETA_LENGTH = 6 }; // Bits 16:21 eta (6 bits)
227  enum { ISO_START = 22 };
228  enum { ISO_LENGTH = 1 }; // Bit 22 Isolation
229  enum { MIP_START = 23 };
230  enum { MIP_LENGTH = 1 }; // Bit 23 MIP
231  enum { SYSIGN_START = 24 };
232  enum { SYSIGN_LENGTH = 2 }; // Bit 24:25 Charge/Syncword
233 };
234 
235 unsigned L1MuGMTCand::readDataField(unsigned start, unsigned count) const {
236  unsigned mask = ((1 << count) - 1) << start;
237  return (m_dataWord & mask) >> start;
238 }
239 
240 void L1MuGMTCand::writeDataField(unsigned start, unsigned count, unsigned value) {
241  unsigned mask = ((1 << count) - 1) << start;
242  m_dataWord &= ~mask; // clear
243  m_dataWord |= (value << start) & mask;
244 }
245 
246 #endif
L1MuGMTCand::ETA_START
Definition: L1MuGMTCand.h:225
L1MuGMTCand::mip
bool mip() const
get mip
Definition: L1MuGMTCand.h:114
L1MuGMTCand::etaIndex
unsigned int etaIndex() const
get eta-code
Definition: L1MuGMTCand.h:105
L1MuGMTCand::m_bx
int m_bx
Definition: L1MuGMTCand.h:210
L1MuGMTCand::setMIP
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:163
L1MuGMTCand::etaRegionIndex
unsigned int etaRegionIndex() const
Definition: L1MuGMTCand.h:188
start
Definition: start.py:1
L1MuGMTCand::ISO_START
Definition: L1MuGMTCand.h:227
L1MuGMTCand::PHI_LENGTH
Definition: L1MuGMTCand.h:220
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
L1MuGMTCand::m_ptValue
float m_ptValue
Definition: L1MuGMTCand.h:215
fftjetcommon_cfi.maxScale
maxScale
Definition: fftjetcommon_cfi.py:110
L1MuGMTCand::linearizedPt
unsigned int linearizedPt(float lsbValue, unsigned maxScale) const
Definition: L1MuGMTCand.h:186
L1MuGMTCand::operator!=
bool operator!=(const L1MuGMTCand &) const
unequal operator
Definition: L1MuGMTCand.cc:133
L1MuGMTCand::phiRegionIndex
unsigned int phiRegionIndex() const
Definition: L1MuGMTCand.h:190
L1MuGMTCand::print
void print() const
print parameters of muon candidate
Definition: L1MuGMTCand.cc:144
L1MuGMTCand::operator<<
friend std::ostream & operator<<(std::ostream &, const L1MuGMTCand &)
output stream operator
L1MuGMTCand::L1MuGMTCand
L1MuGMTCand()
constructor
Definition: L1MuGMTCand.cc:49
L1MuGMTCand
Definition: L1MuGMTCand.h:39
L1MuGMTCand::useInSingleMuonTrigger
bool useInSingleMuonTrigger() const
interpretation of quality code: is the candidate to be used in a single muon trigger ?
Definition: L1MuGMTCand.h:93
L1MuGMTCand::setPhiValue
void setPhiValue(float phiVal)
Setters for physical values.
Definition: L1MuGMTCand.h:174
L1MuGMTCand::bx
int bx() const
get bunch crossing identifier
Definition: L1MuGMTCand.h:117
L1MuGMTCand::reset
void reset()
reset muon candidate
Definition: L1MuGMTCand.cc:81
L1MuGMTCand::m_phiValue
float m_phiValue
Definition: L1MuGMTCand.h:213
L1MuGMTCand::PT_START
Definition: L1MuGMTCand.h:221
L1MuGMTCand::ISO_LENGTH
Definition: L1MuGMTCand.h:228
L1MuGMTCand::ptIndex
unsigned int ptIndex() const
get pt-code
Definition: L1MuGMTCand.h:73
L1MuGMTCand::readDataField
unsigned readDataField(unsigned start, unsigned count) const
Definition: L1MuGMTCand.h:235
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1MuGMTCand::quality
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:90
L1MuGMTCand::ETA_LENGTH
Definition: L1MuGMTCand.h:226
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
L1MuGMTCand::etaValue
float etaValue() const
Definition: L1MuGMTCand.cc:102
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1MuGMTCand::m_etaValue
float m_etaValue
Definition: L1MuGMTCand.h:214
L1MuGMTCand::setChargePacked
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC)
Definition: L1MuGMTCand.h:166
L1MuGMTCand::charge_valid
bool charge_valid() const
is the charge valid ?
Definition: L1MuGMTCand.h:135
L1MuGMTCand::m_invalidValue
static const float m_invalidValue
Definition: L1MuGMTCand.h:216
L1MuGMTCand::SYSIGN_LENGTH
Definition: L1MuGMTCand.h:232
L1MuGMTCand::setBx
void setBx(int bx)
set bunch crossing identifier
Definition: L1MuGMTCand.h:169
L1MuGMTCand::sysign
unsigned sysign() const
get charge/synchronization word (0=POS, 1=NEG, 2=UNDEF, 3=SYNC)
Definition: L1MuGMTCand.h:108
L1MuGMTCand::MIP_START
Definition: L1MuGMTCand.h:229
L1MuGMTCand::setQuality
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:154
L1MuGMTCand::ptValue
float ptValue() const
Definition: L1MuGMTCand.cc:112
L1MuGMTCand::m_name
std::string m_name
Definition: L1MuGMTCand.h:209
value
Definition: value.py:1
L1MuGMTCand::m_dataWord
unsigned m_dataWord
Definition: L1MuGMTCand.h:211
L1MuGMTCand::QUAL_LENGTH
Definition: L1MuGMTCand.h:224
L1MuGMTCand::setEtaPacked
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:157
L1MuGMTCand::SYSIGN_START
Definition: L1MuGMTCand.h:231
L1MuGMTCand::phiIndex
unsigned int phiIndex() const
get phi-code
Definition: L1MuGMTCand.h:70
L1MuGMTCand::charge
int charge() const
get charge (+1 -1)
Definition: L1MuGMTCand.h:132
DDAxes::phi
L1MuGMTCand::empty
bool empty() const
is it an empty muon candidate?
Definition: L1MuGMTCand.h:61
L1MuGMTCand::isHaloCand
bool isHaloCand() const
interpretation of quality code: is the candidate a beam halo muon ?
Definition: L1MuGMTCand.h:102
L1MuGMTCand::phiValue
float phiValue() const
Definition: L1MuGMTCand.cc:92
L1MuGMTCand::QUAL_START
Definition: L1MuGMTCand.h:223
L1MuGMTCand::name
std::string name() const
get name of object
Definition: L1MuGMTCand.h:67
L1MuGMTCand::isSyncWord
bool isSyncWord() const
is the candidate a sync word
Definition: L1MuGMTCand.h:141
L1MuGMTCand::useInDiMuonTrigger
bool useInDiMuonTrigger() const
interpretation of quality code: is the candidate to be used in a di-muon trigger ?
Definition: L1MuGMTCand.h:96
L1MuGMTCand::setPtValue
void setPtValue(float ptVal)
Set Pt Value.
Definition: L1MuGMTCand.h:177
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
L1MuGMTCand::PHI_START
Definition: L1MuGMTCand.h:219
L1MuGMTCand::PT_LENGTH
Definition: L1MuGMTCand.h:222
L1MuGMTCand::setEtaValue
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
Definition: L1MuGMTCand.h:180
L1MuGMTCand::isMatchedCand
bool isMatchedCand() const
interpretation of quality code: is the candidate a matched candidate ?
Definition: L1MuGMTCand.h:99
L1MuGMTCand::MIP_LENGTH
Definition: L1MuGMTCand.h:230
command_line.start
start
Definition: command_line.py:167
L1MuGMTCand::operator==
bool operator==(const L1MuGMTCand &) const
equal operator
Definition: L1MuGMTCand.cc:122
L1MuGMTCand::getDataWord
unsigned getDataWord() const
get muon data word
Definition: L1MuGMTCand.h:64
L1MuGMTCand::setIsolation
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:160
L1MuGMTCand::writeDataField
void writeDataField(unsigned start, unsigned count, unsigned value)
Definition: L1MuGMTCand.h:240
L1MuGMTCand::~L1MuGMTCand
virtual ~L1MuGMTCand()
destructor
Definition: L1MuGMTCand.cc:72
L1MuGMTCand::isol
bool isol() const
get isolation
Definition: L1MuGMTCand.h:111
L1MuGMTCand::setPtPacked
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:151
L1MuGMTCand::setPhiPacked
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
Definition: L1MuGMTCand.h:148