CMS 3D CMS Logo

L1MuRegionalCand.cc
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 //---------------
16 // C++ Headers --
17 //---------------
18 
19 #include <iostream>
20 #include <iomanip>
21 
22 //----------------------
23 // Base Class Headers --
24 //----------------------
26 
27 //------------------------------------
28 // Collaborating Class Declarations --
29 //------------------------------------
30 
32 
33 using namespace std;
34 
35 // ---------------------
36 // -- Class Interface --
37 // ---------------------
38 
39 const float L1MuRegionalCand::m_invalidValue = -10.;
40 
42 L1MuRegionalCand::L1MuRegionalCand(unsigned dataword, int bx) : m_bx(bx), m_dataWord(dataword) {
46 }
47 
50  unsigned phi,
51  unsigned eta,
52  unsigned pt,
53  unsigned charge,
54  unsigned ch_valid,
55  unsigned finehalo,
56  unsigned quality,
57  int bx)
58  : m_bx(bx), m_dataWord(0) {
62  setPtPacked(pt);
64  setChargeValidPacked(ch_valid);
65  setFineHaloPacked(finehalo);
70 }
71 
73  m_bx = 0;
74  m_dataWord = 0;
78 }
79 
81  if (m_phiValue == m_invalidValue) {
82  edm::LogWarning("ValueInvalid") << "L1MuRegionalCand::phiValue requested physical value is invalid";
83  }
84  return m_phiValue;
85 }
86 
88  if (m_etaValue == m_invalidValue) {
89  edm::LogWarning("ValueInvalid") << "L1MuRegionalCand::etaValue requested physical value is invalid";
90  }
91  return m_etaValue;
92 }
93 
95  if (m_ptValue == m_invalidValue) {
96  edm::LogWarning("ValueInvalid") << "L1MuRegionalCand::ptValue requested physical value is invalid";
97  }
98  return m_ptValue;
99 }
100 
102  if (!empty()) {
104  edm::LogVerbatim("GMT_Input_info") << setiosflags(ios::showpoint | ios::fixed | ios::right | ios::adjustfield)
105  << "pt(index) = " << setw(2) << setprecision(1) << pt_packed() << " "
106  << "charge = " << setw(2) << chargeValue() << " "
107  << "eta(index) = " << setw(2) << eta_packed() << " "
108  << "phi(index) = " << setw(3) << phi_packed() << " "
109  << "quality = " << setw(1) << quality() << " "
110  << "charge_valid = " << setw(1) << chargeValid() << " "
111  << "fine_halo = " << setw(1) << isFineHalo() << " "
112  << "bx = " << setw(3) << bx() << " "
113  << "type_idx = " << setw(1) << type_idx();
114  } else {
115  edm::LogVerbatim("GMT_Input_info") << setiosflags(ios::showpoint | ios::fixed | ios::right | ios::adjustfield)
116  << "pt = " << setw(5) << setprecision(1) << ptValue() << " GeV "
117  << "charge = " << setw(2) << chargeValue() << " "
118  << "eta = " << setw(6) << setprecision(3) << etaValue() << " "
119  << "phi = " << setw(5) << setprecision(3) << phiValue() << " rad "
120  << "quality = " << setw(1) << quality() << " "
121  << "charge_valid = " << setw(1) << chargeValid() << " "
122  << "fine_halo = " << setw(1) << isFineHalo() << " "
123  << "bx = " << setw(3) << bx() << " "
124  << "type_idx = " << setw(1) << type_idx();
125  }
126  }
127 }
128 
129 unsigned L1MuRegionalCand::readDataField(unsigned start, unsigned count) const {
130  unsigned mask = ((1 << count) - 1) << start;
131  return (m_dataWord & mask) >> start;
132 }
133 
134 void L1MuRegionalCand::writeDataField(unsigned start, unsigned count, unsigned value) {
135  if (value >= (1U << count))
136  edm::LogWarning("ValueOutOfRange") // value >= 0, since value is unsigned
137  << "L1MuRegionalCand::writeDataField(): value " << value << " out of range for data field with bit width "
138  << count;
139 
140  unsigned mask = ((1 << count) - 1) << start;
141  m_dataWord &= ~mask; // clear
142  m_dataWord |= (value << start) & mask;
143 }
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
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
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
MessageLogger.h
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::writeDataField
void writeDataField(unsigned start, unsigned count, unsigned value)
Definition: L1MuRegionalCand.cc:134
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
L1MuRegionalCand::m_dataWord
unsigned m_dataWord
Definition: L1MuRegionalCand.h:177
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
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
L1MuRegionalCand::m_etaValue
float m_etaValue
Definition: L1MuRegionalCand.h:180
L1MuRegionalCand::setType
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
Definition: L1MuRegionalCand.h:114
L1MuRegionalCand.h
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
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:70
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
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
L1MuRegionalCand::setChargeValidPacked
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
Definition: L1MuRegionalCand.h:132
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
PVValHelper::phi
Definition: PVValidationHelpers.h:69
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
DDAxes::phi
std
Definition: JetResolutionObject.h:76
L1MuRegionalCand::chargeValid
bool chargeValid() const
is the charge valid ?
Definition: L1MuRegionalCand.h:67
L1MuRegionalCand::m_bx
int m_bx
Definition: L1MuRegionalCand.h:176
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
L1MuRegionalCand::eta_packed
unsigned eta_packed() const
return eta packed as in hardware
Definition: L1MuRegionalCand.h:95
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::pt_packed
unsigned pt_packed() const
return pt packed as in hardware
Definition: L1MuRegionalCand.h:89
L1MuRegionalCand::m_phiValue
float m_phiValue
Definition: L1MuRegionalCand.h:179
command_line.start
start
Definition: command_line.py:167
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::setFineHaloPacked
void setFineHaloPacked(unsigned fh)
Set Fine / Halo.
Definition: L1MuRegionalCand.h:138