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::string &instances, const std::string &inputs, const std::string &outputs, unsigned vme_addr_width=0, bool distrRAM=false)
 
 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...
 
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, const std::vector< unsigned > &address) const
 additional lookup function (std::vector -> unisgned) More...
 
unsigned LookupPacked (int idx, unsigned) const
 
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
Enumerator
MIP_DT 
MIP_BRPC 
ISO_DT 
ISO_BRPC 
MIP_CSC 
MIP_FRPC 
ISO_CSC 
ISO_FRPC 

Definition at line 40 of file L1MuGMTMIAUPhiPro1LUT.h.

Constructor & Destructor Documentation

◆ L1MuGMTMIAUPhiPro1LUT()

L1MuGMTMIAUPhiPro1LUT::L1MuGMTMIAUPhiPro1LUT ( )
inline

constuctor using function-lookup

Definition at line 43 of file L1MuGMTMIAUPhiPro1LUT.h.

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  };

References InitParameters().

◆ ~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.

41  {
42  m_calo_align = 0.; //***FIXME: read from DB or .orcarc
43 }

Referenced by L1MuGMTMIAUPhiPro1LUT().

◆ 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.

88  {
89  std::vector<unsigned> addr = u2vec(address, m_Inputs);
90  return TheLookupFunction(idx, addr[0], addr[1], addr[2], addr[3]);
91  };

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

◆ SpecificLookup()

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.

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  };

References generateTowerEtThresholdLUT::addr, ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, training_settings::idx, L1MuGMTLUT::LookupPacked(), and DiDispStaMuonMonitor_cfi::pt.

◆ 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.

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  };

References generateTowerEtThresholdLUT::addr, ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, training_settings::idx, L1MuGMTLUT::Lookup(), and DiDispStaMuonMonitor_cfi::pt.

Referenced by L1MuGMTPhiProjectionUnit::run().

◆ 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.

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  };

References generateTowerEtThresholdLUT::addr, ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, training_settings::idx, L1MuGMTLUT::Lookup(), and DiDispStaMuonMonitor_cfi::pt.

Referenced by L1MuGMTPhiProjectionUnit::run().

◆ 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.

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=" << (isys == 0 ? "DT" : isys == 1 ? "CSC" : isys == 2 ? "BRPC" : "FRPC") << " ISO = " << isISO
119  << " etabin = " << eta << " pval = "
120  << theTriggerPtScale->getPtScale()->getLowEdge(pt)
121  // << " pval = " << theTriggerScales->getPtScale()->getLowEdge(pt)
122  << " charge = " << (charge == 0 ? "pos" : "neg") << " phi_fine = " << phi_fine
123  << " calophi(deg) = " << calophi * 180. / M_PI << endl;
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") << " ISO = " << isISO
128  << " etabin = " << eta << " pval = "
129  << theTriggerPtScale->getPtScale()->getLowEdge(pt)
130  // << " pval = " << theTriggerScales->getPtScale()->getLowEdge(pt)
131  << " charge = " << (charge == 0 ? "pos" : "neg") << " phi_fine = " << phi_fine
132  << " calophi(deg) = " << calophi * 180. / M_PI << endl;
133  }
134 
135  // which half of calo region
136  int cphi_fine = (int)((calophi + 2. * M_PI) / (10. / 180. * M_PI));
137  cphi_fine %= 2;
138 
139  // shift by one region so that an offset in wrong direction w.r.t. bending becomes possible
140  // (may be necessary to accomodate a calo alignment)
141  if (charge == 1) // neg charge
142  calophi = 20. / 180 * M_PI - calophi;
143  calophi += 20. / 180 * M_PI;
144 
145  if (calophi < 0.) {
146  edm::LogWarning("LUTMismatch")
147  << "warning: calo offset goes into wrong direction by more than 20deg !!!! please correct!" << endl;
148  calophi = 0.;
149  }
150  int cphi_ofs = (int)(calophi / (20. / 180. * M_PI)); // in 20 deg regions
151  // 0; -1 region; 1 no offset; 2: +1 region , ... 7: +6 regions
152 
153  if (cphi_ofs > 7) {
154  edm::LogWarning("LUTMismatch") << "warning: calo offset is larger than 6 regions !!!! please correct!" << endl;
155  cphi_ofs = 7;
156  }
157 
158  return ((cphi_fine << 3) + cphi_ofs);
159 }

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

Referenced by LookupFunctionPacked().

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.

L1MuGMTMIAUPhiPro1LUT::MIP_DT
Definition: L1MuGMTMIAUPhiPro1LUT.h:40
L1MuGMTMIAUPhiPro1LUT::MIP_BRPC
Definition: L1MuGMTMIAUPhiPro1LUT.h:40
L1MuGMTPhiLUT::dphi
static float dphi(int isys, int isISO, int icharge, int ieta, float pt)
look up delta-phi with integer eta
Definition: L1MuGMTPhiLUT.cc:68
L1MuGMTMIAUPhiPro1LUT::TheLookupFunction
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.
Definition: L1MuGMTMIAUPhiPro1LUT.cc:82
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
GeomDetEnumerators::isRPC
bool isRPC(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:90
L1MuGMTMIAUPhiPro1LUT::InitParameters
void InitParameters()
Initialize scales, configuration parameters, alignment constants, ...
Definition: L1MuGMTMIAUPhiPro1LUT.cc:41
L1MuGMTLUT::m_Inputs
std::vector< port > m_Inputs
Definition: L1MuGMTLUT.h:214
training_settings.idx
idx
Definition: training_settings.py:16
L1MuGMTMIAUPhiPro1LUT::ISO_FRPC
Definition: L1MuGMTMIAUPhiPro1LUT.h:40
L1MuTriggerPtScale
Definition: L1MuTriggerPtScale.h:33
generateTowerEtThresholdLUT.addr
addr
Definition: generateTowerEtThresholdLUT.py:57
L1MuGMTMIAUPhiPro1LUT::MIP_CSC
Definition: L1MuGMTMIAUPhiPro1LUT.h:40
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1MuScale::getLowEdge
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
edm::LogWarning
Definition: MessageLogger.h:141
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
L1MuTriggerPtScale::getPtScale
const L1MuScale * getPtScale() const
get the Pt scale
Definition: L1MuTriggerPtScale.h:59
createfilelist.int
int
Definition: createfilelist.py:10
L1MuGMTLUT::LookupPacked
unsigned LookupPacked(int idx, unsigned) const
Definition: L1MuGMTLUT.h:272
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
L1MuGMTMIAUPhiPro1LUT::m_calo_align
float m_calo_align
Private data members (LUT parameters);.
Definition: L1MuGMTMIAUPhiPro1LUT.h:101
L1MuGMTMIAUPhiPro1LUT::MIP_FRPC
Definition: L1MuGMTMIAUPhiPro1LUT.h:40
L1MuGMTLUT::u2vec
std::vector< unsigned > u2vec(unsigned value, const std::vector< port > &widths) const
generate composite address or value from compact unsigned
Definition: L1MuGMTLUT.h:251
L1MuGMTMIAUPhiPro1LUT::ISO_DT
Definition: L1MuGMTMIAUPhiPro1LUT.h:40
L1MuGMTMIAUPhiPro1LUT::ISO_CSC
Definition: L1MuGMTMIAUPhiPro1LUT.h:40
L1MuGMTLUT::L1MuGMTLUT
L1MuGMTLUT()
Init and Destruct.
Definition: L1MuGMTLUT.h:80
L1MuGMTLUT::Lookup
std::vector< unsigned > Lookup(int idx, const std::vector< unsigned > &address) const
additional lookup function (std::vector -> vector)
Definition: L1MuGMTLUT.h:121
L1MuGMTConfig::getTriggerPtScale
static const L1MuTriggerPtScale * getTriggerPtScale()
Definition: L1MuGMTConfig.h:181
L1MuGMTMIAUPhiPro1LUT::ISO_BRPC
Definition: L1MuGMTMIAUPhiPro1LUT.h:40