CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1MuGMTMIAUPhiPro1LUT Class Reference

#include <L1MuGMTMIAUPhiPro1LUT.h>

Inheritance diagram for L1MuGMTMIAUPhiPro1LUT:
L1MuGMTLUT

Public Types

enum  {
  MIP_DT, MIP_BRPC, ISO_DT, ISO_BRPC,
  MIP_CSC, MIP_FRPC, ISO_CSC, ISO_FRPC
}
 
- Public Types inherited from L1MuGMTLUT
typedef std::pair< std::string, unsigned > port
 

Public Member Functions

 L1MuGMTMIAUPhiPro1LUT ()
 constuctor using function-lookup More...
 
virtual unsigned LookupFunctionPacked (int idx, unsigned address) const
 access to lookup function with packed input and output More...
 
unsigned SpecificLookup (int idx, unsigned phi_fine, unsigned eta, unsigned pt, unsigned charge) const
 specific lookup function for entire output field More...
 
unsigned SpecificLookup_cphi_fine (int idx, unsigned phi_fine, unsigned eta, unsigned pt, unsigned charge) const
 specific lookup function for cphi_fine More...
 
unsigned SpecificLookup_cphi_ofs (int idx, unsigned phi_fine, unsigned eta, unsigned pt, unsigned charge) const
 specific lookup function for cphi_ofs More...
 
virtual ~L1MuGMTMIAUPhiPro1LUT ()
 destructor More...
 
- Public Member Functions inherited from L1MuGMTLUT
 L1MuGMTLUT ()
 Init and Destruct. More...
 
 L1MuGMTLUT (const char *name, const std::vector< std::string > &instances, const std::vector< port > &in_widths, const std::vector< port > &out_widths, unsigned vme_addr_width=0, bool distrRAM=false)
 constructor with init More...
 
 L1MuGMTLUT (const char *name, const std::string &instances, const std::string &inputs, const std::string &outputs, unsigned vme_addr_width=0, bool distrRAM=false)
 
void Load (const char *path)
 I/O functions. More...
 
std::vector< unsigned > Lookup (int idx, const std::vector< unsigned > &address) const
 additional lookup function (std::vector -> vector) More...
 
std::vector< unsigned > Lookup (int idx, unsigned address) const
 additional lookup function (unsigned -> std::vector) More...
 
unsigned LookupPacked (int idx, unsigned) const
 
unsigned LookupPacked (int idx, const std::vector< unsigned > &address) const
 additional lookup function (std::vector -> unisgned) More...
 
void MakeSubClass (const char *fname="", const char *template_file_h="../interface/L1MuGMTLUT_SubClass.h_template", const char *template_file_cc="../interface/L1MuGMTLUT_SubClass.cc_template")
 Add Generate SubClass method. More...
 
std::string Name ()
 
int numberOfInstances ()
 get the number of Instances More...
 
void Save (const char *path)
 save to LUT file More...
 
virtual ~L1MuGMTLUT ()
 destructor More...
 

Private Member Functions

void InitParameters ()
 Initialize scales, configuration parameters, alignment constants, ... More...
 
unsigned TheLookupFunction (int idx, unsigned phi_fine, unsigned eta, unsigned pt, unsigned charge) const
 The lookup function - here the functionality of the LUT is implemented. More...
 

Private Attributes

float m_calo_align
 Private data members (LUT parameters);. More...
 

Additional Inherited Members

- Protected Member Functions inherited from L1MuGMTLUT
void Init (const char *name, const std::vector< std::string > &instances, const std::vector< port > &in_widths, const std::vector< port > &out_widths, unsigned vme_addr_width=0, bool distrRAM=false)
 Initialize the LUT. More...
 
void Set (int idx, unsigned address, unsigned value)
 set with single address and value More...
 
std::vector< unsigned > u2vec (unsigned value, const std::vector< port > &widths) const
 generate composite address or value from compact unsigned More...
 
unsigned vec2u (const std::vector< unsigned > &vec, const std::vector< port > &widths) const
 generate address or value from composite address or value More...
 
- Protected Attributes inherited from L1MuGMTLUT
std::vector< std::vector< unsigned > > m_Contents
 
bool m_distrRAM
 
unsigned m_GeneralLUTVersion
 
bool m_initialized
 
std::vector< portm_Inputs
 
std::vector< std::string > m_InstNames
 
std::string m_name
 
int m_NLUTS
 
std::vector< portm_Outputs
 
bool m_saveFlag
 
unsigned m_TotalInWidth
 
unsigned m_TotalOutWidth
 
bool m_UseLookupFunction
 
unsigned m_vme_addr_width
 

Detailed Description

MIAUPhiPro1 look-up table

this class was automatically generated by L1MuGMTLUT::MakeSubClass()

Definition at line 40 of file L1MuGMTMIAUPhiPro1LUT.h.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

L1MuGMTMIAUPhiPro1LUT::L1MuGMTMIAUPhiPro1LUT ( )
inline

constuctor using function-lookup

Definition at line 46 of file L1MuGMTMIAUPhiPro1LUT.h.

References InitParameters().

46  : L1MuGMTLUT("MIAUPhiPro1",
47  "MIP_DT MIP_BRPC ISO_DT ISO_BRPC MIP_CSC MIP_FRPC ISO_CSC ISO_FRPC",
48  "phi_fine(3) eta(4) pt(5) charge(1)",
49  "cphi_fine(1) cphi_ofs(3)", 11, false) {
51  } ;
void InitParameters()
Initialize scales, configuration parameters, alignment constants, ...
L1MuGMTLUT()
Init and Destruct.
Definition: L1MuGMTLUT.h:83
virtual L1MuGMTMIAUPhiPro1LUT::~L1MuGMTMIAUPhiPro1LUT ( )
inlinevirtual

destructor

Definition at line 54 of file L1MuGMTMIAUPhiPro1LUT.h.

54 {};

Member Function Documentation

void L1MuGMTMIAUPhiPro1LUT::InitParameters ( )
private

Initialize scales, configuration parameters, alignment constants, ...

Definition at line 41 of file L1MuGMTMIAUPhiPro1LUT.cc.

Referenced by L1MuGMTMIAUPhiPro1LUT(), and LookupFunctionPacked().

41  {
42  m_calo_align = 0.; //***FIXME: read from DB or .orcarc
43 }
float m_calo_align
Private data members (LUT parameters);.
virtual unsigned L1MuGMTMIAUPhiPro1LUT::LookupFunctionPacked ( int  idx,
unsigned  address 
) const
inlinevirtual

access to lookup function with packed input and output

Reimplemented from L1MuGMTLUT.

Definition at line 90 of file L1MuGMTMIAUPhiPro1LUT.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, training_settings::idx, InitParameters(), L1MuGMTLUT::m_Inputs, EnergyCorrector::pt, TheLookupFunction(), and L1MuGMTLUT::u2vec().

90  {
91  std::vector<unsigned> addr = u2vec(address, m_Inputs);
92  return TheLookupFunction(idx ,addr[0] ,addr[1] ,addr[2] ,addr[3]);
93 
94  };
std::vector< port > m_Inputs
Definition: L1MuGMTLUT.h:201
unsigned TheLookupFunction(int idx, unsigned phi_fine, unsigned eta, unsigned pt, unsigned charge) const
The lookup function - here the functionality of the LUT is implemented.
std::vector< unsigned > u2vec(unsigned value, const std::vector< port > &widths) const
generate composite address or value from compact unsigned
Definition: L1MuGMTLUT.h:239
unsigned L1MuGMTMIAUPhiPro1LUT::SpecificLookup ( int  idx,
unsigned  phi_fine,
unsigned  eta,
unsigned  pt,
unsigned  charge 
) const
inline

specific lookup function for entire output field

Definition at line 77 of file L1MuGMTMIAUPhiPro1LUT.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, L1MuGMTLUT::LookupPacked(), and EnergyCorrector::pt.

77  {
78  std::vector<unsigned> addr(4);
79  addr[0] = phi_fine;
80  addr[1] = eta;
81  addr[2] = pt;
82  addr[3] = charge;
83  return LookupPacked(idx, addr);
84  };
unsigned LookupPacked(int idx, unsigned) const
Definition: L1MuGMTLUT.h:260
unsigned L1MuGMTMIAUPhiPro1LUT::SpecificLookup_cphi_fine ( int  idx,
unsigned  phi_fine,
unsigned  eta,
unsigned  pt,
unsigned  charge 
) const
inline

specific lookup function for cphi_fine

Definition at line 57 of file L1MuGMTMIAUPhiPro1LUT.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, L1MuGMTLUT::Lookup(), and EnergyCorrector::pt.

Referenced by L1MuGMTPhiProjectionUnit::run().

57  {
58  std::vector<unsigned> addr(4);
59  addr[0] = phi_fine;
60  addr[1] = eta;
61  addr[2] = pt;
62  addr[3] = charge;
63  return Lookup(idx, addr) [0];
64  };
std::vector< unsigned > Lookup(int idx, const std::vector< unsigned > &address) const
additional lookup function (std::vector -> vector)
Definition: L1MuGMTLUT.h:115
unsigned L1MuGMTMIAUPhiPro1LUT::SpecificLookup_cphi_ofs ( int  idx,
unsigned  phi_fine,
unsigned  eta,
unsigned  pt,
unsigned  charge 
) const
inline

specific lookup function for cphi_ofs

Definition at line 67 of file L1MuGMTMIAUPhiPro1LUT.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, L1MuGMTLUT::Lookup(), and EnergyCorrector::pt.

Referenced by L1MuGMTPhiProjectionUnit::run().

67  {
68  std::vector<unsigned> addr(4);
69  addr[0] = phi_fine;
70  addr[1] = eta;
71  addr[2] = pt;
72  addr[3] = charge;
73  return Lookup(idx, addr) [1];
74  };
std::vector< unsigned > Lookup(int idx, const std::vector< unsigned > &address) const
additional lookup function (std::vector -> vector)
Definition: L1MuGMTLUT.h:115
unsigned L1MuGMTMIAUPhiPro1LUT::TheLookupFunction ( int  idx,
unsigned  phi_fine,
unsigned  eta,
unsigned  pt,
unsigned  charge 
) const
private

The lookup function - here the functionality of the LUT is implemented.

Definition at line 83 of file L1MuGMTMIAUPhiPro1LUT.cc.

References L1MuGMTPhiLUT::dphi(), L1MuScale::getLowEdge(), L1MuTriggerPtScale::getPtScale(), L1MuGMTConfig::getTriggerPtScale(), createfilelist::int, GeomDetEnumerators::isRPC(), and M_PI.

Referenced by LookupFunctionPacked().

83  {
84  // idx is MIP_DT, MIP_BRPC, ISO_DT, ISO_BRPC, MIP_CSC, MIP_FRPC, ISO_CSC, ISO_FRPC
85  // INPUTS: phi_fine(3) eta(4) pt(5) charge(1)
86  // OUTPUTS: cphi_fine(1) cphi_ofs(3)
87 
88 // const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
89  const L1MuTriggerPtScale* theTriggerPtScale = L1MuGMTConfig::getTriggerPtScale();
90 
91  int isRPC = idx % 2;
92  int isFWD = idx / 4;
93 
94  int isys = isFWD + 2 * isRPC; // DT, CSC, BRPC, FRPC
95  int isISO = (idx / 2) % 2;
96 
97  int ch_idx = (charge == 0) ? 1 : 0; // positive charge is 0 (but idx 1)
98 
99  // currently only support 3-bit eta (3 lower bits); ignore 4th bit
100  if (eta>7) eta -= 8;
101 
102  float dphi = L1MuGMTPhiLUT::dphi (isys, isISO, ch_idx, (int) eta,
103  theTriggerPtScale->getPtScale()->getLowEdge(pt) ); // use old LUT, here
104  // theTriggerScales->getPtScale()->getLowEdge(pt) ); // use old LUT, here
105 
106  // calculate phi in calo relative to low edge of start region
107  // == use low edge of muon phi bin as dphi was calculated with this assumption
108 
109  float calophi = phi_fine * 2.5 / 180. * M_PI - dphi - m_calo_align;
110 
111  if (charge == 0 && calophi < 0.) { // plus charge
112  edm::LogWarning("LUTMismatch")
113  << "warning: calo offset goes into wrong direction. charge is plus and calophi < 0deg" << endl
114  << "SYS=" << ( isys==0?"DT":isys==1? "CSC" : isys== 2? "BRPC" : "FRPC" )
115  << " ISO = " << isISO
116  << " etabin = " << eta
117  << " pval = " << theTriggerPtScale->getPtScale()->getLowEdge(pt)
118  // << " pval = " << theTriggerScales->getPtScale()->getLowEdge(pt)
119  << " charge = " << ( charge==0?"pos":"neg" )
120  << " phi_fine = " << phi_fine
121  << " calophi(deg) = " << calophi * 180. / M_PI
122  << endl;
123  }
124  else if (charge == 1 && calophi > 20. / 180. * M_PI) { // neg charge
125  edm::LogWarning("LUTMismatch")
126  << "warning: calo offset goes into wrong direction. charge is minus and calophi > 20deg" << endl
127  << "SYS=" << ( isys==0?"DT":isys==1? "CSC" : isys== 2? "BRPC" : "FRPC" )
128  << " ISO = " << isISO
129  << " etabin = " << eta
130  << " pval = " << theTriggerPtScale->getPtScale()->getLowEdge(pt)
131  // << " pval = " << theTriggerScales->getPtScale()->getLowEdge(pt)
132  << " charge = " << ( charge==0?"pos":"neg" )
133  << " phi_fine = " << phi_fine
134  << " calophi(deg) = " << calophi * 180. / M_PI
135  << endl;
136  }
137 
138  // which half of calo region
139  int cphi_fine = (int) ( ( calophi + 2. * M_PI ) / ( 10. / 180. * M_PI ) );
140  cphi_fine %= 2;
141 
142  // shift by one region so that an offset in wrong direction w.r.t. bending becomes possible
143  // (may be necessary to accomodate a calo alignment)
144  if (charge == 1) // neg charge
145  calophi = 20. / 180 * M_PI - calophi;
146  calophi += 20. / 180 * M_PI;
147 
148  if (calophi < 0.) {
149  edm::LogWarning("LUTMismatch")
150  << "warning: calo offset goes into wrong direction by more than 20deg !!!! please correct!" << endl;
151  calophi = 0.;
152  }
153  int cphi_ofs = (int) ( calophi / ( 20. / 180. * M_PI) ); // in 20 deg regions
154  // 0; -1 region; 1 no offset; 2: +1 region , ... 7: +6 regions
155 
156  if (cphi_ofs > 7) {
157  edm::LogWarning("LUTMismatch")
158  << "warning: calo offset is larger than 6 regions !!!! please correct!" << endl;
159  cphi_ofs = 7;
160  }
161 
162  return ( (cphi_fine << 3) + cphi_ofs );
163 }
const L1MuScale * getPtScale() const
get the Pt scale
#define M_PI
static const L1MuTriggerPtScale * getTriggerPtScale()
bool isRPC(GeomDetEnumerators::SubDetector m)
static float dphi(int isys, int isISO, int icharge, int ieta, float pt)
look up delta-phi with integer eta
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
float m_calo_align
Private data members (LUT parameters);.

Member Data Documentation

float L1MuGMTMIAUPhiPro1LUT::m_calo_align
private

Private data members (LUT parameters);.

Definition at line 104 of file L1MuGMTMIAUPhiPro1LUT.h.