CMS 3D CMS Logo

List of all members | Public Member Functions
l1t::MicroGMTMatchQualSimpleLUT Class Reference

#include <MicroGMTMatchQualLUT.h>

Inheritance diagram for l1t::MicroGMTMatchQualSimpleLUT:
l1t::MicroGMTMatchQualLUT l1t::MicroGMTLUT l1t::LUT

Public Member Functions

int hashInput (int dEta, int dPhi) const
 
int lookup (int etaFine, int dEta, int dPhi) const
 
virtual int lookupPacked (int in) const
 
 MicroGMTMatchQualSimpleLUT ()
 
 MicroGMTMatchQualSimpleLUT (const std::string &, const double maxDR, const double fEta, const double fPhi, cancel_t cancelType)
 
 MicroGMTMatchQualSimpleLUT (l1t::LUT *lut, cancel_t cancelType)
 
void unHashInput (int input, int &dEta, int &dPhi) const
 
virtual ~MicroGMTMatchQualSimpleLUT ()
 
- Public Member Functions inherited from l1t::MicroGMTMatchQualLUT
int getDeltaEtaWidth () const
 
int getDeltaPhiWidth () const
 
 MicroGMTMatchQualLUT ()
 
 MicroGMTMatchQualLUT (l1t::LUT *lut)
 
virtual ~MicroGMTMatchQualLUT ()
 
- Public Member Functions inherited from l1t::MicroGMTLUT
int checkedInput (unsigned in, unsigned maxWidth) const
 
void initialize ()
 
int load (const std::string &inFileName)
 
 MicroGMTLUT ()
 
 MicroGMTLUT (l1t::LUT *lut)
 
void save (std::ofstream &output)
 
virtual ~MicroGMTLUT ()
 
- Public Member Functions inherited from l1t::LUT
int data (unsigned int address) const
 
bool empty () const
 
 LUT ()
 
 LUT (std::istream &stream)
 
unsigned int maxSize () const
 
unsigned int nrBitsAddress () const
 
unsigned int nrBitsData () const
 
int read (std::istream &stream)
 
void write (std::ostream &stream) const
 
 ~LUT ()
 

Additional Inherited Members

- Public Types inherited from l1t::LUT
enum  ReadCodes {
  SUCCESS =0, NO_ENTRIES =1, DUP_ENTRIES =2, MISS_ENTRIES =3,
  MAX_ADDRESS_OUTOFRANGE =4, NO_HEADER =5
}
 
- Protected Attributes inherited from l1t::MicroGMTMatchQualLUT
cancel_t m_cancelType
 
int m_dEtaRedInWidth
 
int m_dEtaRedMask
 
int m_dPhiRedInWidth
 
int m_dPhiRedMask
 
double m_etaScale
 
double m_fEta
 
double m_fPhi
 
double m_maxDR
 
double m_phiScale
 
- Protected Attributes inherited from l1t::MicroGMTLUT
bool m_initialized
 
std::vector< MicroGMTConfiguration::input_tm_inputs
 
unsigned m_outWidth
 
unsigned m_totalInWidth
 

Detailed Description

Definition at line 44 of file MicroGMTMatchQualLUT.h.

Constructor & Destructor Documentation

l1t::MicroGMTMatchQualSimpleLUT::MicroGMTMatchQualSimpleLUT ( )
inline
l1t::MicroGMTMatchQualSimpleLUT::MicroGMTMatchQualSimpleLUT ( const std::string &  fname,
const double  maxDR,
const double  fEta,
const double  fPhi,
cancel_t  cancelType 
)
explicit

Definition at line 4 of file MicroGMTMatchQualSimpleLUT.cc.

References l1t::MicroGMTConfiguration::DELTA_ETA_RED, l1t::MicroGMTConfiguration::DELTA_PHI_RED, l1t::MicroGMTLUT::initialize(), l1t::MicroGMTLUT::load(), l1t::MicroGMTMatchQualLUT::m_cancelType, l1t::MicroGMTMatchQualLUT::m_dEtaRedInWidth, l1t::MicroGMTMatchQualLUT::m_dEtaRedMask, l1t::MicroGMTMatchQualLUT::m_dPhiRedInWidth, l1t::MicroGMTMatchQualLUT::m_dPhiRedMask, l1t::MicroGMTMatchQualLUT::m_etaScale, l1t::MicroGMTMatchQualLUT::m_fEta, l1t::MicroGMTMatchQualLUT::m_fPhi, l1t::MicroGMTLUT::m_inputs, l1t::MicroGMTMatchQualLUT::m_maxDR, l1t::MicroGMTLUT::m_outWidth, l1t::MicroGMTMatchQualLUT::m_phiScale, l1t::MicroGMTLUT::m_totalInWidth, interestingEgammaIsoDetIdsSequence_cff::maxDR, Pi, and AlCaHLTBitMon_QueryRunRegistry::string.

5 {
8  m_maxDR = maxDR;
9  m_fEta = fEta;
10  m_fPhi = fPhi;
11  m_cancelType = cancelType;
12 
14  m_outWidth = 1;
15 
16  m_dPhiRedMask = (1 << m_dPhiRedInWidth) - 1;
18 
21 
22  m_phiScale = 2*TMath::Pi()/576.0;
23  m_etaScale = 0.010875;
24 
25  if (fname != std::string("")) {
26  load(fname);
27  } else {
28  initialize();
29  }
30 }
const double Pi
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
int load(const std::string &inFileName)
Definition: MicroGMTLUT.cc:21
std::vector< MicroGMTConfiguration::input_t > m_inputs
Definition: MicroGMTLUT.h:36
string fname
main script
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
l1t::MicroGMTMatchQualSimpleLUT::MicroGMTMatchQualSimpleLUT ( l1t::LUT lut,
cancel_t  cancelType 
)
explicit

Definition at line 32 of file MicroGMTMatchQualSimpleLUT.cc.

References l1t::MicroGMTConfiguration::DELTA_ETA_RED, l1t::MicroGMTConfiguration::DELTA_PHI_RED, l1t::MicroGMTMatchQualLUT::m_cancelType, l1t::MicroGMTMatchQualLUT::m_dEtaRedInWidth, l1t::MicroGMTMatchQualLUT::m_dEtaRedMask, l1t::MicroGMTMatchQualLUT::m_dPhiRedInWidth, l1t::MicroGMTMatchQualLUT::m_dPhiRedMask, l1t::MicroGMTMatchQualLUT::m_etaScale, l1t::MicroGMTLUT::m_initialized, l1t::MicroGMTLUT::m_inputs, l1t::MicroGMTLUT::m_outWidth, l1t::MicroGMTMatchQualLUT::m_phiScale, l1t::MicroGMTLUT::m_totalInWidth, and Pi.

33 {
34  m_dEtaRedInWidth = 5;
35  m_dPhiRedInWidth = 3;
36  m_cancelType = cancelType;
37 
39  m_outWidth = 1;
40 
41  m_dPhiRedMask = (1 << m_dPhiRedInWidth) - 1;
43 
46 
47  m_phiScale = 2*TMath::Pi()/576.0;
48  m_etaScale = 0.010875;
49 
50  m_initialized = true;
51 }
const double Pi
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
std::vector< MicroGMTConfiguration::input_t > m_inputs
Definition: MicroGMTLUT.h:36
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
virtual l1t::MicroGMTMatchQualSimpleLUT::~MicroGMTMatchQualSimpleLUT ( )
inlinevirtual

Member Function Documentation

int l1t::MicroGMTMatchQualSimpleLUT::hashInput ( int  dEta,
int  dPhi 
) const

Definition at line 83 of file MicroGMTMatchQualSimpleLUT.cc.

References l1t::MicroGMTMatchQualLUT::m_dPhiRedInWidth, and mps_fire::result.

Referenced by lookup().

84 {
85 
86  int result = 0;
87  result += dPhiRed;
88  result += dEtaRed << m_dPhiRedInWidth;
89  return result;
90 }
int l1t::MicroGMTMatchQualSimpleLUT::lookup ( int  etaFine,
int  dEta,
int  dPhi 
) const
virtual

Implements l1t::MicroGMTMatchQualLUT.

Definition at line 54 of file MicroGMTMatchQualSimpleLUT.cc.

References l1t::MicroGMTLUT::checkedInput(), l1t::LUT::data(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, hashInput(), l1t::MicroGMTMatchQualLUT::m_dEtaRedInWidth, l1t::MicroGMTMatchQualLUT::m_dPhiRedInWidth, l1t::MicroGMTMatchQualLUT::m_etaScale, l1t::MicroGMTMatchQualLUT::m_fEta, l1t::MicroGMTMatchQualLUT::m_fPhi, l1t::MicroGMTLUT::m_initialized, l1t::MicroGMTMatchQualLUT::m_maxDR, l1t::MicroGMTMatchQualLUT::m_phiScale, and mathSSE::sqrt().

Referenced by lookupPacked().

55 {
56  // normalize these two to the same scale and then calculate?
57  if (m_initialized) {
58  return data((unsigned)hashInput(checkedInput(dEtaRed, m_dEtaRedInWidth), checkedInput(dPhiRed, m_dPhiRedInWidth)));
59  }
60  double dEta = m_fEta*dEtaRed*m_etaScale;
61  double dPhi = m_fPhi*dPhiRed*m_phiScale;
62  double dR = std::sqrt(dEta*dEta + dPhi*dPhi);
63 
64  int retVal = dR <= m_maxDR ? 1 : 0;
65 
66  return retVal;
67 }
int hashInput(int dEta, int dPhi) const
int checkedInput(unsigned in, unsigned maxWidth) const
Definition: MicroGMTLUT.cc:62
T sqrt(T t)
Definition: SSEVec.h:18
int data(unsigned int address) const
Definition: LUT.h:46
int l1t::MicroGMTMatchQualSimpleLUT::lookupPacked ( int  in) const
virtual

Reimplemented from l1t::MicroGMTLUT.

Definition at line 70 of file MicroGMTMatchQualSimpleLUT.cc.

References l1t::LUT::data(), lookup(), l1t::MicroGMTLUT::m_initialized, and unHashInput().

71 {
72  if (m_initialized) {
73  return data((unsigned)in);
74  }
75 
76  int dEtaRed = 0;
77  int dPhiRed = 0;
78  unHashInput(in, dEtaRed, dPhiRed);
79  return lookup(0, dEtaRed, dPhiRed);
80 }
int lookup(int etaFine, int dEta, int dPhi) const
void unHashInput(int input, int &dEta, int &dPhi) const
int data(unsigned int address) const
Definition: LUT.h:46
void l1t::MicroGMTMatchQualSimpleLUT::unHashInput ( int  input,
int &  dEta,
int &  dPhi 
) const