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...
 
unsigned LookupFunctionPacked (int idx, unsigned address) const override
 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...
 
 ~L1MuGMTMIAUPhiPro1LUT () override
 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 38 of file L1MuGMTMIAUPhiPro1LUT.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Constructor & Destructor Documentation

◆ L1MuGMTMIAUPhiPro1LUT()

L1MuGMTMIAUPhiPro1LUT::L1MuGMTMIAUPhiPro1LUT ( )
inline

constuctor using function-lookup

Definition at line 43 of file L1MuGMTMIAUPhiPro1LUT.h.

References InitParameters().

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

◆ ~L1MuGMTMIAUPhiPro1LUT()

L1MuGMTMIAUPhiPro1LUT::~L1MuGMTMIAUPhiPro1LUT ( )
inlineoverride

destructor

Definition at line 54 of file L1MuGMTMIAUPhiPro1LUT.h.

54 {};

Member Function Documentation

◆ InitParameters()

void L1MuGMTMIAUPhiPro1LUT::InitParameters ( )
private

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

Definition at line 41 of file L1MuGMTMIAUPhiPro1LUT.cc.

Referenced by L1MuGMTMIAUPhiPro1LUT().

41  {
42  m_calo_align = 0.; //***FIXME: read from DB or .orcarc
43 }
float m_calo_align
Private data members (LUT parameters);.

◆ LookupFunctionPacked()

unsigned L1MuGMTMIAUPhiPro1LUT::LookupFunctionPacked ( int  idx,
unsigned  address 
) const
inlineoverridevirtual

access to lookup function with packed input and output

Reimplemented from L1MuGMTLUT.

Definition at line 88 of file L1MuGMTMIAUPhiPro1LUT.h.

References generateTowerEtThresholdLUT::addr, heavyIonCSV_trainingSettings::idx, L1MuGMTLUT::m_Inputs, TheLookupFunction(), and L1MuGMTLUT::u2vec().

88  {
89  std::vector<unsigned> addr = u2vec(address, m_Inputs);
90  return TheLookupFunction(idx, addr[0], addr[1], addr[2], addr[3]);
91  };
std::vector< unsigned > u2vec(unsigned value, const std::vector< port > &widths) const
generate composite address or value from compact unsigned
Definition: L1MuGMTLUT.h:251
std::vector< port > m_Inputs
Definition: L1MuGMTLUT.h:214
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.

◆ SpecificLookup()

unsigned L1MuGMTMIAUPhiPro1LUT::SpecificLookup ( int  idx,
unsigned  phi_fine,
unsigned  eta,
unsigned  pt,
unsigned  charge 
) const
inline

◆ SpecificLookup_cphi_fine()

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 generateTowerEtThresholdLUT::addr, ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, heavyIonCSV_trainingSettings::idx, L1MuGMTLUT::Lookup(), and DiDispStaMuonMonitor_cfi::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:121

◆ SpecificLookup_cphi_ofs()

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 generateTowerEtThresholdLUT::addr, ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, heavyIonCSV_trainingSettings::idx, L1MuGMTLUT::Lookup(), and DiDispStaMuonMonitor_cfi::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:121

◆ TheLookupFunction()

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 82 of file L1MuGMTMIAUPhiPro1LUT.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, L1MuGMTPhiLUT::dphi(), PVValHelper::eta, L1MuScale::getLowEdge(), L1MuTriggerPtScale::getPtScale(), L1MuGMTConfig::getTriggerPtScale(), heavyIonCSV_trainingSettings::idx, createfilelist::int, GeomDetEnumerators::isRPC(), M_PI, and DiDispStaMuonMonitor_cfi::pt.

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)
101  eta -= 8;
102 
103  float dphi = L1MuGMTPhiLUT::dphi(isys,
104  isISO,
105  ch_idx,
106  (int)eta,
107  theTriggerPtScale->getPtScale()->getLowEdge(pt)); // use old LUT, here
108  // theTriggerScales->getPtScale()->getLowEdge(pt) ); // use old LUT, here
109 
110  // calculate phi in calo relative to low edge of start region
111  // == use low edge of muon phi bin as dphi was calculated with this assumption
112 
113  float calophi = phi_fine * 2.5 / 180. * M_PI - dphi - m_calo_align;
114 
115  if (charge == 0 && calophi < 0.) { // plus charge
116  edm::LogWarning("LUTMismatch")
117  << "warning: calo offset goes into wrong direction. charge is plus and calophi < 0deg" << endl
118  << "SYS="
119  << (isys == 0 ? "DT"
120  : isys == 1 ? "CSC"
121  : isys == 2 ? "BRPC"
122  : "FRPC")
123  << " ISO = " << isISO << " etabin = " << eta << " pval = "
124  << theTriggerPtScale->getPtScale()->getLowEdge(pt)
125  // << " pval = " << theTriggerScales->getPtScale()->getLowEdge(pt)
126  << " charge = " << (charge == 0 ? "pos" : "neg") << " phi_fine = " << phi_fine
127  << " calophi(deg) = " << calophi * 180. / M_PI << endl;
128  } else if (charge == 1 && calophi > 20. / 180. * M_PI) { // neg charge
129  edm::LogWarning("LUTMismatch")
130  << "warning: calo offset goes into wrong direction. charge is minus and calophi > 20deg" << endl
131  << "SYS="
132  << (isys == 0 ? "DT"
133  : isys == 1 ? "CSC"
134  : isys == 2 ? "BRPC"
135  : "FRPC")
136  << " ISO = " << isISO << " etabin = " << eta << " pval = "
137  << theTriggerPtScale->getPtScale()->getLowEdge(pt)
138  // << " pval = " << theTriggerScales->getPtScale()->getLowEdge(pt)
139  << " charge = " << (charge == 0 ? "pos" : "neg") << " phi_fine = " << phi_fine
140  << " calophi(deg) = " << calophi * 180. / M_PI << endl;
141  }
142 
143  // which half of calo region
144  int cphi_fine = (int)((calophi + 2. * M_PI) / (10. / 180. * M_PI));
145  cphi_fine %= 2;
146 
147  // shift by one region so that an offset in wrong direction w.r.t. bending becomes possible
148  // (may be necessary to accomodate a calo alignment)
149  if (charge == 1) // neg charge
150  calophi = 20. / 180 * M_PI - calophi;
151  calophi += 20. / 180 * M_PI;
152 
153  if (calophi < 0.) {
154  edm::LogWarning("LUTMismatch")
155  << "warning: calo offset goes into wrong direction by more than 20deg !!!! please correct!" << endl;
156  calophi = 0.;
157  }
158  int cphi_ofs = (int)(calophi / (20. / 180. * M_PI)); // in 20 deg regions
159  // 0; -1 region; 1 no offset; 2: +1 region , ... 7: +6 regions
160 
161  if (cphi_ofs > 7) {
162  edm::LogWarning("LUTMismatch") << "warning: calo offset is larger than 6 regions !!!! please correct!" << endl;
163  cphi_ofs = 7;
164  }
165 
166  return ((cphi_fine << 3) + cphi_ofs);
167 }
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
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
float m_calo_align
Private data members (LUT parameters);.
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ m_calo_align

float L1MuGMTMIAUPhiPro1LUT::m_calo_align
private

Private data members (LUT parameters);.

Definition at line 101 of file L1MuGMTMIAUPhiPro1LUT.h.