CMS 3D CMS Logo

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

#include <L1MuBMLUTHandler.h>

Public Types

enum  Extrapolation {
  EX12, EX13, EX14, EX21,
  EX23, EX24, EX34, EX15,
  EX16, EX25, EX26, EX56
}
 
enum  PtAssMethod {
  PT12L, PT12H, PT13L, PT13H,
  PT14L, PT14H, PT23L, PT23H,
  PT24L, PT24H, PT34L, PT34H,
  PB12H, PB13H, PB14H, PB21H,
  PB23H, PB24H, PB34H, NODEF
}
 

Public Member Functions

int getDeltaPhi (int idx, int address) const
 get delta-phi for a given address (bend-angle) More...
 
int getHigh (int ext_ind, int address) const
 get high_value for a given address More...
 
int getLow (int ext_ind, int address) const
 get low_value for a given address More...
 
std::pair< unsigned short, unsigned short > getPrecision () const
 get precision for look-up tables More...
 
int getPt (int pta_ind, int address) const
 get pt-value for a given address More...
 
int getPtLutThreshold (int pta_ind) const
 get pt-assignment LUT threshold More...
 
 L1MuBMLUTHandler (const L1TMuonBarrelParams &l1params)
 constructor More...
 
void print_ext_lut () const
 print extrapolation look-up tables More...
 
void print_phi_lut () const
 print phi-assignment look-up tables More...
 
void print_pta_lut () const
 print pt-assignment look-up tables More...
 
virtual ~L1MuBMLUTHandler ()
 destructor More...
 

Public Attributes

const int MAX_EXT = 12
 
const int MAX_PTASSMETH = 19
 
const int MAX_PTASSMETHA = 12
 

Private Attributes

const L1TMuonBarrelParamsAllPublicl1tbmparams
 

Detailed Description

Definition at line 29 of file L1MuBMLUTHandler.h.

Member Enumeration Documentation

Enumerator
PT12L 
PT12H 
PT13L 
PT13H 
PT14L 
PT14H 
PT23L 
PT23H 
PT24L 
PT24H 
PT34L 
PT34H 
PB12H 
PB13H 
PB14H 
PB21H 
PB23H 
PB24H 
PB34H 
NODEF 

Definition at line 86 of file L1MuBMLUTHandler.h.

Constructor & Destructor Documentation

L1MuBMLUTHandler::L1MuBMLUTHandler ( const L1TMuonBarrelParams l1params)

constructor

Definition at line 53 of file L1MuBMLUTHandler.cc.

53  {
54  // l1tbmparams = &l1params;
56 }
const L1TMuonBarrelParamsAllPublic * l1tbmparams
L1MuBMLUTHandler::~L1MuBMLUTHandler ( )
virtual

destructor

Definition at line 63 of file L1MuBMLUTHandler.cc.

63  {
64 delete l1tbmparams;
65 }
const L1TMuonBarrelParamsAllPublic * l1tbmparams

Member Function Documentation

int L1MuBMLUTHandler::getDeltaPhi ( int  idx,
int  address 
) const

get delta-phi for a given address (bend-angle)

Definition at line 171 of file L1MuBMLUTHandler.cc.

References MessageLogger_cfi::cerr, end, and training_settings::idx.

Referenced by L1MuBMAssignmentUnit::PhiAU().

171  {
172  std::vector<L1TMuonBarrelParams::LUT> phi_lut = l1tbmparams->phi_lut();
173  L1TMuonBarrelParams::LUT::const_iterator iter = phi_lut[idx].find(address);
174  if ( iter != phi_lut[idx].end() ) {
175  return (*iter).second;
176  }
177  else {
178  cerr << "PhiLut::getDeltaPhi : can not find address " << address << endl;
179  return 0;
180  }
181 
182 }
std::vector< LUT > phi_lut() const
const L1TMuonBarrelParamsAllPublic * l1tbmparams
#define end
Definition: vmac.h:37
int L1MuBMLUTHandler::getHigh ( int  ext_ind,
int  address 
) const

get high_value for a given address

Definition at line 276 of file L1MuBMLUTHandler.cc.

References MessageLogger_cfi::cerr.

Referenced by L1MuBMEUX::run().

276  {
277 
278  std::vector<L1TMuonBarrelParams::LUTParams::extLUT> ext_lut = l1tbmparams->ext_lut();
279  L1TMuonBarrelParams::LUT::const_iterator iter = ext_lut[ext_ind].high.find(address);
280  if ( iter != ext_lut[ext_ind].high.end() ) {
281  return (*iter).second;
282  }
283  else {
284  cerr << "ExtLut::getHigh : can not find address " << address << endl;
285  return 99999;
286  }
287 }
std::vector< LUTParams::extLUT > ext_lut() const
const L1TMuonBarrelParamsAllPublic * l1tbmparams
int L1MuBMLUTHandler::getLow ( int  ext_ind,
int  address 
) const

get low_value for a given address

Definition at line 259 of file L1MuBMLUTHandler.cc.

References MessageLogger_cfi::cerr.

Referenced by L1MuBMEUX::run().

259  {
260 
261  std::vector<L1TMuonBarrelParams::LUTParams::extLUT> ext_lut = l1tbmparams->ext_lut();
262  L1TMuonBarrelParams::LUT::const_iterator iter = ext_lut[ext_ind].low.find(address);
263  if ( iter != ext_lut[ext_ind].low.end() ) {
264  return (*iter).second;
265  }
266  else {
267  cerr << "ExtLut::getLow : can not find address " << address << endl;
268  return 99999;
269  }
270 }
std::vector< LUTParams::extLUT > ext_lut() const
const L1TMuonBarrelParamsAllPublic * l1tbmparams
pair< unsigned short, unsigned short > L1MuBMLUTHandler::getPrecision ( ) const

get precision for look-up tables

Definition at line 187 of file L1MuBMLUTHandler.cc.

187  {
188 
189  return pair<unsigned short, unsigned short>(l1tbmparams->get_PHI_Assignment_nbits_Phi()
191 
192 }
const L1TMuonBarrelParamsAllPublic * l1tbmparams
int L1MuBMLUTHandler::getPt ( int  pta_ind,
int  address 
) const

get pt-value for a given address

Definition at line 135 of file L1MuBMLUTHandler.cc.

References MessageLogger_cfi::cerr, and end.

Referenced by L1MuBMAssignmentUnit::PtAU().

135  {
136 
137  std::vector<L1TMuonBarrelParams::LUT> pta_lut = l1tbmparams->pta_lut();
138 
139  L1TMuonBarrelParams::LUT::const_iterator iter = pta_lut[pta_ind].find(address);
140  if ( iter != pta_lut[pta_ind].end() ) {
141  //std::cout<<"pta_ind "<<pta_ind<<" address "<<address<<" pt "<<(*iter).second<<std::endl;
142 
143  return (*iter).second;
144  }
145  else {
146  cerr << "PtaLut::getPt : can not find address " << address << endl;
147  return 0;
148  }
149 
150 }
const L1TMuonBarrelParamsAllPublic * l1tbmparams
#define end
Definition: vmac.h:37
std::vector< LUT > pta_lut() const
int L1MuBMLUTHandler::getPtLutThreshold ( int  pta_ind) const

get pt-assignment LUT threshold

Definition at line 156 of file L1MuBMLUTHandler.cc.

References MessageLogger_cfi::cerr, and MAX_PTASSMETH.

Referenced by L1MuBMAssignmentUnit::getPtMethod().

156  {
157 std::vector<int> pta_threshold = l1tbmparams->pta_threshold();
158  if ( pta_ind >= 0 && pta_ind < L1MuBMLUTHandler::MAX_PTASSMETH /2 ) {
159  return pta_threshold[pta_ind];
160  }
161  else {
162  cerr << "PtaLut::getPtLutThreshold : can not find threshold " << pta_ind << endl;
163  return 0;
164  }
165 
166 }
std::vector< int > pta_threshold() const
const int MAX_PTASSMETH
const L1TMuonBarrelParamsAllPublic * l1tbmparams
void L1MuBMLUTHandler::print_ext_lut ( ) const

print extrapolation look-up tables

Definition at line 293 of file L1MuBMLUTHandler.cc.

References funct::abs(), gather_cfg::cout, i, MAX_EXT, and DTTFBitArray< N >::twoComplement().

293  {
294  unsigned short int nbit_phi = l1tbmparams->get_PHI_Assignment_nbits_Phi();
295  unsigned short int nbit_phib = l1tbmparams->get_PHI_Assignment_nbits_PhiB();
296  cout << endl;
297  cout << "L1 barrel Track Finder Extrapolation look-up tables :" << endl;
298  cout << "=====================================================" << endl;
299  cout << endl;
300  cout << "Precision : " << endl;
301  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
302  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
303 
304  // loop over all extrapolations
305  for ( int ext = 0; ext < L1MuBMLUTHandler::MAX_EXT; ext++ ) {
306 
307  cout << endl;
308  cout << "Extrapolation : " << static_cast<L1MuBMLUTHandler::Extrapolation>(ext) << endl;
309  cout << "====================" << endl;
310  cout << endl;
311 
312  cout << " address";
313  for ( int i = 0; i < nbit_phib; i++ ) cout << ' ';
314  cout << " low-value";
315  for ( int i = 0; i < nbit_phi; i++ ) cout << ' ';
316  cout << " high-value " << endl;
317  for ( int i = 0; i < 2*nbit_phi + nbit_phib; i++ ) cout << '-';
318  cout << "---------------------------------" << endl;
319  std::vector<L1TMuonBarrelParams::LUTParams::extLUT> ext_lut = l1tbmparams->ext_lut();
320  L1TMuonBarrelParams::LUT::const_iterator iter = ext_lut[ext].low.begin();
321  L1TMuonBarrelParams::LUT::const_iterator iter1;
322  while ( iter != ext_lut[ext].low.end() ) {
323  int address = (*iter).first;
324  int low = (*iter).second;
325  iter1 = ext_lut[ext].high.find(address);
326  int high = (*iter1).second;
327 
328  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
329  DTTFBitArray<12> b_low(static_cast<unsigned>(abs(low)));
330  DTTFBitArray<12> b_high(static_cast<unsigned>(abs(high)));
331 
332  if ( address < 0 ) b_address.twoComplement();
333  if ( low < 0 ) b_low.twoComplement();
334  if ( high < 0 ) b_high.twoComplement();
335 
336  cout.setf(ios::right,ios::adjustfield);
337  cout << " " << setbase(10) << setw(5) << address << " (";
338  for ( int i = nbit_phib-1; i >= 0; i-- ) cout << b_address[i];
339  cout << ") " << setw(5) << low << " (";
340  for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_low[i];
341  cout << ") " << setw(5) << high << " (";
342  for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_high[i];
343  cout << ") " << endl;
344 
345  iter++;
346  }
347 
348  }
349 
350  cout << endl;
351 
352 }
int i
Definition: DBlmapReader.cc:9
std::vector< LUTParams::extLUT > ext_lut() const
const L1TMuonBarrelParamsAllPublic * l1tbmparams
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: memstream.h:15
void L1MuBMLUTHandler::print_phi_lut ( ) const

print phi-assignment look-up tables

Definition at line 199 of file L1MuBMLUTHandler.cc.

References funct::abs(), gather_cfg::cout, end, i, training_settings::idx, and DTTFBitArray< N >::twoComplement().

199  {
200  unsigned short int nbit_phi = l1tbmparams->get_PHI_Assignment_nbits_Phi();
201  unsigned short int nbit_phib = l1tbmparams->get_PHI_Assignment_nbits_PhiB();
202 
203  cout << endl;
204  cout << "L1 barrel Track Finder Phi-Assignment look-up tables :" << endl;
205  cout << "======================================================" << endl;
206  cout << endl;
207  cout << "Precision : " << endl;
208  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
209  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
210 
211  // loop over all phi-assignment methods
212  for ( int idx = 0; idx < 2; idx++ ) {
213 
214  cout << endl;
215  if ( idx == 0 ) cout << "Phi-Assignment Method : " << "PHI12" << endl;
216  if ( idx == 1 ) cout << "Phi-Assignment Method : " << "PHI42" << endl;
217  cout << "=============================" << endl;
218  cout << endl;
219 
220  cout << " address";
221  for ( int i = 0; i < nbit_phib; i++ ) cout << ' ';
222  cout << " value" << endl;
223  for ( int i = 0; i < nbit_phi + nbit_phib; i++ ) cout << '-';
224  cout << "----------------------" << endl;
225  std::vector<L1TMuonBarrelParams::LUT> phi_lut = l1tbmparams->phi_lut();
226 
227  L1TMuonBarrelParams::LUT::const_iterator iter = phi_lut[idx].begin();
228  while ( iter != phi_lut[idx].end() ) {
229  int address = (*iter).first;
230  int value = (*iter).second;
231 
232  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
233  DTTFBitArray<12> b_value(static_cast<unsigned>(abs(value)));
234 
235  if ( address < 0 ) b_address.twoComplement();
236  if ( value < 0 ) b_value.twoComplement();
237 
238  cout.setf(ios::right,ios::adjustfield);
239  cout << " " << setbase(10) << setw(5) << address << " (";
240  for ( int i = nbit_phib-1; i >= 0; i-- ) cout << b_address[i];
241  cout << ") " << setw(5) << value << " (";
242  for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_value[i];
243  cout << ") " << endl;
244 
245  iter++;
246  }
247 
248  }
249 
250  cout << endl;
251 
252 }
int i
Definition: DBlmapReader.cc:9
std::vector< LUT > phi_lut() const
const L1TMuonBarrelParamsAllPublic * l1tbmparams
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:37
Definition: value.py:1
void L1MuBMLUTHandler::print_pta_lut ( ) const

print pt-assignment look-up tables

Definition at line 75 of file L1MuBMLUTHandler.cc.

References funct::abs(), gather_cfg::cout, end, i, MAX_PTASSMETH, DTTFBitArray< N >::print(), and DTTFBitArray< N >::twoComplement().

75  {
76  int nbit_phi = l1tbmparams->get_PT_Assignment_nbits_Phi();
77 
78  cout << endl;
79  cout << "L1 barrel Track Finder Pt-Assignment look-up tables :" << endl;
80  cout << "=====================================================" << endl;
81  cout << endl;
82  cout << "Precision : " << endl;
83  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
84 
85  // loop over all pt-assignment methods
86  for ( int pam = 0; pam < L1MuBMLUTHandler::MAX_PTASSMETH; pam++ ) {
87 
88  cout << endl;
89  cout << "Pt-Assignment Method : " << static_cast<L1MuBMLUTHandler::PtAssMethod>(pam) << endl;
90  cout << "============================" << endl;
91  cout << endl;
92 
93  cout << "\t Threshold : " << getPtLutThreshold(pam/2) << endl << endl;
94 
95  int maxbits = nbit_phi;
96  if (pam >= MAX_PTASSMETHA) maxbits = nbit_phi-2;
97 
98  cout << " address";
99  for ( int i = 0; i < maxbits; i++ ) cout << ' ';
100  cout << " value" << endl;
101  for ( int i = 0; i < maxbits; i++ ) cout << '-';
102  cout << "-------------------------" << endl;
103  std::vector<L1TMuonBarrelParams::LUT> pta_lut = l1tbmparams->pta_lut();
104 
105  L1TMuonBarrelParams::LUT::const_iterator iter = pta_lut[pam].begin();
106  while ( iter != pta_lut[pam].end() ) {
107  int address = (*iter).first;
108  int value = (*iter).second;
109 
110  DTTFBitArray<12> b_address(static_cast<unsigned>(abs(address)));
111  DTTFBitArray<9> b_value(static_cast<unsigned>(abs(value)));
112 
113  if ( address < 0 ) b_address.twoComplement();
114 
115  cout.setf(ios::right,ios::adjustfield);
116  cout << " " << setbase(10) << setw(9) << address << " (";
117  for ( int i = maxbits-1; i >= 0; i-- ) cout << b_address[i];
118  cout << ") " << setw(3) << value << " (";
119  b_value.print();
120  cout << ")" << endl;
121 
122  iter++;
123  }
124 
125  }
126 
127  cout << endl;
128 
129 }
int i
Definition: DBlmapReader.cc:9
const int MAX_PTASSMETH
int getPtLutThreshold(int pta_ind) const
get pt-assignment LUT threshold
const L1TMuonBarrelParamsAllPublic * l1tbmparams
const int MAX_PTASSMETHA
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:37
Definition: value.py:1
std::vector< LUT > pta_lut() const

Member Data Documentation

const L1TMuonBarrelParamsAllPublic* L1MuBMLUTHandler::l1tbmparams
private

Definition at line 68 of file L1MuBMLUTHandler.h.

const int L1MuBMLUTHandler::MAX_EXT = 12

Definition at line 75 of file L1MuBMLUTHandler.h.

Referenced by print_ext_lut().

const int L1MuBMLUTHandler::MAX_PTASSMETH = 19

Definition at line 82 of file L1MuBMLUTHandler.h.

Referenced by getPtLutThreshold(), and print_pta_lut().

const int L1MuBMLUTHandler::MAX_PTASSMETHA = 12

Definition at line 83 of file L1MuBMLUTHandler.h.