CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuRegionalCand.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
6 //
7 // $Date: 2010/12/06 20:04:17 $
8 // $Revision: 1.7 $
9 //
10 // Author :
11 // H. Sakulin HEPHY Vienna
12 //
13 // Migrated to CMSSW:
14 // I. Mikulec
15 //
16 //--------------------------------------------------
17 //---------------
18 // C++ Headers --
19 //---------------
20 
21 #include <iostream>
22 #include <iomanip>
23 
24 //----------------------
25 // Base Class Headers --
26 //----------------------
28 
29 //------------------------------------
30 // Collaborating Class Declarations --
31 //------------------------------------
32 
34 
35 using namespace std;
36 
37 // ---------------------
38 // -- Class Interface --
39 // ---------------------
40 
41 const float L1MuRegionalCand::m_invalidValue = -10.;
42 
44 L1MuRegionalCand::L1MuRegionalCand(unsigned dataword, int bx) : m_bx(bx), m_dataWord(dataword) {
48 }
49 
52  unsigned phi, unsigned eta, unsigned pt, unsigned charge,
53  unsigned ch_valid, unsigned finehalo, unsigned quality, int bx) :
54  m_bx(bx), m_dataWord(0) {
55  setType(type_idx);
56  setPhiPacked(phi);
57  setEtaPacked(eta);
58  setPtPacked(pt);
59  setChargePacked(charge);
60  setChargeValidPacked(ch_valid);
61  setFineHaloPacked(finehalo);
62  setQualityPacked(quality);
66 }
67 
69 
70  m_bx = 0;
71  m_dataWord = 0;
75 
76 }
77 
79  if(m_phiValue == m_invalidValue) {
80  edm::LogWarning("ValueInvalid") <<
81  "L1MuRegionalCand::phiValue requested physical value is invalid";
82  }
83  return m_phiValue;
84 }
85 
87  if(m_etaValue == m_invalidValue) {
88  edm::LogWarning("ValueInvalid") <<
89  "L1MuRegionalCand::etaValue requested physical value is invalid";
90  }
91  return m_etaValue;
92 }
93 
95  if(m_ptValue == m_invalidValue) {
96  edm::LogWarning("ValueInvalid") <<
97  "L1MuRegionalCand::ptValue requested physical value is invalid";
98  }
99  return m_ptValue;
100 }
101 
103  if ( !empty() ) {
104  if(m_phiValue == m_invalidValue ||
107  edm::LogVerbatim("GMT_Input_info")
108  << setiosflags(ios::showpoint | ios::fixed | ios::right | ios::adjustfield)
109  << "pt(index) = " << setw(2) << setprecision(1) << pt_packed() << " "
110  << "charge = " << setw(2) << chargeValue() << " "
111  << "eta(index) = " << setw(2) << eta_packed() << " "
112  << "phi(index) = " << setw(3) << phi_packed() << " "
113  << "quality = " << setw(1) << quality() << " "
114  << "charge_valid = " << setw(1) << chargeValid() << " "
115  << "fine_halo = " << setw(1) << isFineHalo() << " "
116  << "bx = " << setw(3) << bx() << " "
117  << "type_idx = " << setw(1) << type_idx();
118  } else {
119  edm::LogVerbatim("GMT_Input_info")
120  << setiosflags(ios::showpoint | ios::fixed | ios::right | ios::adjustfield)
121  << "pt = " << setw(5) << setprecision(1) << ptValue() << " GeV "
122  << "charge = " << setw(2) << chargeValue() << " "
123  << "eta = " << setw(6) << setprecision(3) << etaValue() << " "
124  << "phi = " << setw(5) << setprecision(3) << phiValue() << " rad "
125  << "quality = " << setw(1) << quality() << " "
126  << "charge_valid = " << setw(1) << chargeValid() << " "
127  << "fine_halo = " << setw(1) << isFineHalo() << " "
128  << "bx = " << setw(3) << bx() << " "
129  << "type_idx = " << setw(1) << type_idx();
130  }
131  }
132 }
133 
134 
135 unsigned L1MuRegionalCand::readDataField(unsigned start, unsigned count) const {
136  unsigned mask = ( (1 << count) - 1 ) << start;
137  return (m_dataWord & mask) >> start;
138 }
139 
140 void L1MuRegionalCand::writeDataField(unsigned start, unsigned count, unsigned value) {
141  if ( value >= ( 1U << count ) ) edm::LogWarning("ValueOutOfRange") // value >= 0, since value is unsigned
142  << "L1MuRegionalCand::writeDataField(): value " << value
143  << " out of range for data field with bit width " << count;
144 
145  unsigned mask = ( (1 << count) - 1 ) << start;
146  m_dataWord &= ~mask; // clear
147  m_dataWord |= (value << start) & mask ;
148 }
149 
void writeDataField(unsigned start, unsigned count, unsigned value)
virtual void print() const
print candidate
float etaValue() const
get eta-value of muon candidate
virtual bool empty() const
return empty flag
L1MuRegionalCand(unsigned dataword=0, int bx=0)
constructor from data word
T eta() const
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
double charge(const std::vector< uint8_t > &Ampls)
bool isFineHalo() const
is it fine (DT) / halo (CSC) ?
float ptValue() const
get pt-value of muon candidate in GeV
unsigned readDataField(unsigned start, unsigned count) const
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)
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 ?
unsigned int quality() const
return quality
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
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.
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