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 L1TMuonBarrelParamsl1tbmparams
 

Detailed Description

Definition at line 25 of file L1MuBMLUTHandler.h.

Member Enumeration Documentation

◆ Extrapolation

◆ PtAssMethod

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

Definition at line 76 of file L1MuBMLUTHandler.h.

Constructor & Destructor Documentation

◆ L1MuBMLUTHandler()

L1MuBMLUTHandler::L1MuBMLUTHandler ( const L1TMuonBarrelParams l1params)

constructor

Definition at line 52 of file L1MuBMLUTHandler.cc.

52 { l1tbmparams = &l1params; }
const L1TMuonBarrelParams * l1tbmparams

◆ ~L1MuBMLUTHandler()

L1MuBMLUTHandler::~L1MuBMLUTHandler ( )
virtual

destructor

Definition at line 58 of file L1MuBMLUTHandler.cc.

58 {}

Member Function Documentation

◆ getDeltaPhi()

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

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

Definition at line 158 of file L1MuBMLUTHandler.cc.

References DMR_cfg::cerr, and heavyIonCSV_trainingSettings::idx.

Referenced by L1MuBMAssignmentUnit::PhiAU().

158  {
159  std::vector<L1TMuonBarrelParams::LUT> const& phi_lut = l1tbmparams->phi_lut();
160  L1TMuonBarrelParams::LUT::const_iterator iter = phi_lut[idx].find(address);
161  if (iter != phi_lut[idx].end()) {
162  return (*iter).second;
163  } else {
164  cerr << "PhiLut::getDeltaPhi : can not find address " << address << endl;
165  return 0;
166  }
167 }
const L1TMuonBarrelParams * l1tbmparams
std::vector< LUT > phi_lut() const

◆ getHigh()

int L1MuBMLUTHandler::getHigh ( int  ext_ind,
int  address 
) const

get high_value for a given address

Definition at line 258 of file L1MuBMLUTHandler.cc.

References DMR_cfg::cerr, and LaserClient_cfi::high.

Referenced by L1MuBMEUX::run().

258  {
259  std::vector<L1TMuonBarrelParams::LUTParams::extLUT> const& ext_lut = l1tbmparams->ext_lut();
260  L1TMuonBarrelParams::LUT::const_iterator iter = ext_lut[ext_ind].high.find(address);
261  if (iter != ext_lut[ext_ind].high.end()) {
262  return (*iter).second;
263  } else {
264  cerr << "ExtLut::getHigh : can not find address " << address << endl;
265  return 99999;
266  }
267 }
std::vector< LUTParams::extLUT > ext_lut() const
const L1TMuonBarrelParams * l1tbmparams

◆ getLow()

int L1MuBMLUTHandler::getLow ( int  ext_ind,
int  address 
) const

get low_value for a given address

Definition at line 244 of file L1MuBMLUTHandler.cc.

References DMR_cfg::cerr, and LaserClient_cfi::low.

Referenced by L1MuBMEUX::run().

244  {
245  std::vector<L1TMuonBarrelParams::LUTParams::extLUT> const& ext_lut = l1tbmparams->ext_lut();
246  L1TMuonBarrelParams::LUT::const_iterator iter = ext_lut[ext_ind].low.find(address);
247  if (iter != ext_lut[ext_ind].low.end()) {
248  return (*iter).second;
249  } else {
250  cerr << "ExtLut::getLow : can not find address " << address << endl;
251  return 99999;
252  }
253 }
std::vector< LUTParams::extLUT > ext_lut() const
const L1TMuonBarrelParams * l1tbmparams

◆ getPrecision()

pair< unsigned short, unsigned short > L1MuBMLUTHandler::getPrecision ( ) const

get precision for look-up tables

Definition at line 172 of file L1MuBMLUTHandler.cc.

172  {
173  return pair<unsigned short, unsigned short>(l1tbmparams->get_PHI_Assignment_nbits_Phi(),
175 }
int get_PHI_Assignment_nbits_Phi() const
int get_PHI_Assignment_nbits_PhiB() const
const L1TMuonBarrelParams * l1tbmparams

◆ getPt()

int L1MuBMLUTHandler::getPt ( int  pta_ind,
int  address 
) const

get pt-value for a given address

Definition at line 128 of file L1MuBMLUTHandler.cc.

References DMR_cfg::cerr.

Referenced by L1MuBMAssignmentUnit::PtAU().

128  {
129  std::vector<L1TMuonBarrelParams::LUT> const& pta_lut = l1tbmparams->pta_lut();
130 
131  L1TMuonBarrelParams::LUT::const_iterator iter = pta_lut[pta_ind].find(address);
132  if (iter != pta_lut[pta_ind].end()) {
133  //std::cout<<"pta_ind "<<pta_ind<<" address "<<address<<" pt "<<(*iter).second<<std::endl;
134 
135  return (*iter).second;
136  } else {
137  cerr << "PtaLut::getPt : can not find address " << address << endl;
138  return 0;
139  }
140 }
std::vector< LUT > pta_lut() const
const L1TMuonBarrelParams * l1tbmparams

◆ getPtLutThreshold()

int L1MuBMLUTHandler::getPtLutThreshold ( int  pta_ind) const

get pt-assignment LUT threshold

Definition at line 145 of file L1MuBMLUTHandler.cc.

References DMR_cfg::cerr, and MAX_PTASSMETH.

Referenced by L1MuBMAssignmentUnit::getPtMethod().

145  {
146  std::vector<int> const& pta_threshold = l1tbmparams->pta_threshold();
147  if (pta_ind >= 0 && pta_ind < L1MuBMLUTHandler::MAX_PTASSMETH / 2) {
148  return pta_threshold[pta_ind];
149  } else {
150  cerr << "PtaLut::getPtLutThreshold : can not find threshold " << pta_ind << endl;
151  return 0;
152  }
153 }
std::vector< int > pta_threshold() const
const int MAX_PTASSMETH
const L1TMuonBarrelParams * l1tbmparams

◆ print_ext_lut()

void L1MuBMLUTHandler::print_ext_lut ( ) const

print extrapolation look-up tables

Definition at line 272 of file L1MuBMLUTHandler.cc.

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

272  {
273  unsigned short int nbit_phi = l1tbmparams->get_PHI_Assignment_nbits_Phi();
274  unsigned short int nbit_phib = l1tbmparams->get_PHI_Assignment_nbits_PhiB();
275  cout << endl;
276  cout << "L1 barrel Track Finder Extrapolation look-up tables :" << endl;
277  cout << "=====================================================" << endl;
278  cout << endl;
279  cout << "Precision : " << endl;
280  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
281  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
282 
283  // loop over all extrapolations
284  for (int ext = 0; ext < L1MuBMLUTHandler::MAX_EXT; ext++) {
285  cout << endl;
286  cout << "Extrapolation : " << static_cast<L1MuBMLUTHandler::Extrapolation>(ext) << endl;
287  cout << "====================" << endl;
288  cout << endl;
289 
290  cout << " address";
291  for (int i = 0; i < nbit_phib; i++)
292  cout << ' ';
293  cout << " low-value";
294  for (int i = 0; i < nbit_phi; i++)
295  cout << ' ';
296  cout << " high-value " << endl;
297  for (int i = 0; i < 2 * nbit_phi + nbit_phib; i++)
298  cout << '-';
299  cout << "---------------------------------" << endl;
300  std::vector<L1TMuonBarrelParams::LUTParams::extLUT> const& ext_lut = l1tbmparams->ext_lut();
301  L1TMuonBarrelParams::LUT::const_iterator iter = ext_lut[ext].low.begin();
302  L1TMuonBarrelParams::LUT::const_iterator iter1;
303  while (iter != ext_lut[ext].low.end()) {
304  int address = (*iter).first;
305  int low = (*iter).second;
306  iter1 = ext_lut[ext].high.find(address);
307  int high = (*iter1).second;
308 
309  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
310  DTTFBitArray<12> b_low(static_cast<unsigned>(abs(low)));
311  DTTFBitArray<12> b_high(static_cast<unsigned>(abs(high)));
312 
313  if (address < 0)
314  b_address.twoComplement();
315  if (low < 0)
316  b_low.twoComplement();
317  if (high < 0)
318  b_high.twoComplement();
319 
320  cout.setf(ios::right, ios::adjustfield);
321  cout << " " << setbase(10) << setw(5) << address << " (";
322  for (int i = nbit_phib - 1; i >= 0; i--)
323  cout << b_address[i];
324  cout << ") " << setw(5) << low << " (";
325  for (int i = nbit_phi - 1; i >= 0; i--)
326  cout << b_low[i];
327  cout << ") " << setw(5) << high << " (";
328  for (int i = nbit_phi - 1; i >= 0; i--)
329  cout << b_high[i];
330  cout << ") " << endl;
331 
332  iter++;
333  }
334  }
335 
336  cout << endl;
337 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int get_PHI_Assignment_nbits_Phi() const
int get_PHI_Assignment_nbits_PhiB() const
std::vector< LUTParams::extLUT > ext_lut() const
const L1TMuonBarrelParams * l1tbmparams
Definition: memstream.h:15

◆ print_phi_lut()

void L1MuBMLUTHandler::print_phi_lut ( ) const

print phi-assignment look-up tables

Definition at line 179 of file L1MuBMLUTHandler.cc.

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

179  {
180  unsigned short int nbit_phi = l1tbmparams->get_PHI_Assignment_nbits_Phi();
181  unsigned short int nbit_phib = l1tbmparams->get_PHI_Assignment_nbits_PhiB();
182 
183  cout << endl;
184  cout << "L1 barrel Track Finder Phi-Assignment look-up tables :" << endl;
185  cout << "======================================================" << endl;
186  cout << endl;
187  cout << "Precision : " << endl;
188  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
189  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
190 
191  // loop over all phi-assignment methods
192  for (int idx = 0; idx < 2; idx++) {
193  cout << endl;
194  if (idx == 0)
195  cout << "Phi-Assignment Method : "
196  << "PHI12" << endl;
197  if (idx == 1)
198  cout << "Phi-Assignment Method : "
199  << "PHI42" << endl;
200  cout << "=============================" << endl;
201  cout << endl;
202 
203  cout << " address";
204  for (int i = 0; i < nbit_phib; i++)
205  cout << ' ';
206  cout << " value" << endl;
207  for (int i = 0; i < nbit_phi + nbit_phib; i++)
208  cout << '-';
209  cout << "----------------------" << endl;
210  std::vector<L1TMuonBarrelParams::LUT> const& phi_lut = l1tbmparams->phi_lut();
211 
212  L1TMuonBarrelParams::LUT::const_iterator iter = phi_lut[idx].begin();
213  while (iter != phi_lut[idx].end()) {
214  int address = (*iter).first;
215  int value = (*iter).second;
216 
217  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
218  DTTFBitArray<12> b_value(static_cast<unsigned>(abs(value)));
219 
220  if (address < 0)
221  b_address.twoComplement();
222  if (value < 0)
223  b_value.twoComplement();
224 
225  cout.setf(ios::right, ios::adjustfield);
226  cout << " " << setbase(10) << setw(5) << address << " (";
227  for (int i = nbit_phib - 1; i >= 0; i--)
228  cout << b_address[i];
229  cout << ") " << setw(5) << value << " (";
230  for (int i = nbit_phi - 1; i >= 0; i--)
231  cout << b_value[i];
232  cout << ") " << endl;
233 
234  iter++;
235  }
236  }
237 
238  cout << endl;
239 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: value.py:1
int get_PHI_Assignment_nbits_Phi() const
int get_PHI_Assignment_nbits_PhiB() const
const L1TMuonBarrelParams * l1tbmparams
std::vector< LUT > phi_lut() const

◆ print_pta_lut()

void L1MuBMLUTHandler::print_pta_lut ( ) const

print pt-assignment look-up tables

Definition at line 67 of file L1MuBMLUTHandler.cc.

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

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

Member Data Documentation

◆ l1tbmparams

const L1TMuonBarrelParams* L1MuBMLUTHandler::l1tbmparams
private

Definition at line 62 of file L1MuBMLUTHandler.h.

◆ MAX_EXT

const int L1MuBMLUTHandler::MAX_EXT = 12

Definition at line 66 of file L1MuBMLUTHandler.h.

Referenced by print_ext_lut().

◆ MAX_PTASSMETH

const int L1MuBMLUTHandler::MAX_PTASSMETH = 19

Definition at line 72 of file L1MuBMLUTHandler.h.

Referenced by getPtLutThreshold(), and print_pta_lut().

◆ MAX_PTASSMETHA

const int L1MuBMLUTHandler::MAX_PTASSMETHA = 12

Definition at line 73 of file L1MuBMLUTHandler.h.