CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 42 of file L1MuGMTMIAUPhiPro1LUT.h.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

L1MuGMTMIAUPhiPro1LUT::L1MuGMTMIAUPhiPro1LUT ( )
inline

constuctor using function-lookup

Definition at line 48 of file L1MuGMTMIAUPhiPro1LUT.h.

References InitParameters().

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

destructor

Definition at line 56 of file L1MuGMTMIAUPhiPro1LUT.h.

56 {};

Member Function Documentation

void L1MuGMTMIAUPhiPro1LUT::InitParameters ( )
private

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

Definition at line 43 of file L1MuGMTMIAUPhiPro1LUT.cc.

Referenced by L1MuGMTMIAUPhiPro1LUT().

43  {
44  m_calo_align = 0.; //***FIXME: read from DB or .orcarc
45 }
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 92 of file L1MuGMTMIAUPhiPro1LUT.h.

References L1MuGMTLUT::m_Inputs, TheLookupFunction(), and L1MuGMTLUT::u2vec().

92  {
93  std::vector<unsigned> addr = u2vec(address, m_Inputs);
94  return TheLookupFunction(idx ,addr[0] ,addr[1] ,addr[2] ,addr[3]);
95 
96  };
char * address
Definition: mlp_lapack.h:14
std::vector< port > m_Inputs
Definition: L1MuGMTLUT.h:203
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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:241
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 79 of file L1MuGMTMIAUPhiPro1LUT.h.

References DeDxDiscriminatorTools::charge(), eta(), and L1MuGMTLUT::LookupPacked().

79  {
80  std::vector<unsigned> addr(4);
81  addr[0] = phi_fine;
82  addr[1] = eta;
83  addr[2] = pt;
84  addr[3] = charge;
85  return LookupPacked(idx, addr);
86  };
T eta() const
double charge(const std::vector< uint8_t > &Ampls)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned LookupPacked(int idx, unsigned) const
Definition: L1MuGMTLUT.h:262
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 59 of file L1MuGMTMIAUPhiPro1LUT.h.

References DeDxDiscriminatorTools::charge(), eta(), and L1MuGMTLUT::Lookup().

Referenced by L1MuGMTPhiProjectionUnit::run().

59  {
60  std::vector<unsigned> addr(4);
61  addr[0] = phi_fine;
62  addr[1] = eta;
63  addr[2] = pt;
64  addr[3] = charge;
65  return Lookup(idx, addr) [0];
66  };
T eta() const
std::vector< unsigned > Lookup(int idx, const std::vector< unsigned > &address) const
additional lookup function (std::vector -&gt; vector)
Definition: L1MuGMTLUT.h:117
double charge(const std::vector< uint8_t > &Ampls)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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 69 of file L1MuGMTMIAUPhiPro1LUT.h.

References DeDxDiscriminatorTools::charge(), eta(), and L1MuGMTLUT::Lookup().

Referenced by L1MuGMTPhiProjectionUnit::run().

69  {
70  std::vector<unsigned> addr(4);
71  addr[0] = phi_fine;
72  addr[1] = eta;
73  addr[2] = pt;
74  addr[3] = charge;
75  return Lookup(idx, addr) [1];
76  };
T eta() const
std::vector< unsigned > Lookup(int idx, const std::vector< unsigned > &address) const
additional lookup function (std::vector -&gt; vector)
Definition: L1MuGMTLUT.h:117
double charge(const std::vector< uint8_t > &Ampls)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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 85 of file L1MuGMTMIAUPhiPro1LUT.cc.

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

Referenced by LookupFunctionPacked().

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

Member Data Documentation

float L1MuGMTMIAUPhiPro1LUT::m_calo_align
private

Private data members (LUT parameters);.

Definition at line 106 of file L1MuGMTMIAUPhiPro1LUT.h.