#include <L1MuDTExtLut.h>
Classes | |
class | LUT |
helper class for look-up tables More... | |
Public Member Functions | |
int | getHigh (int ext_ind, int address) const |
get high_value for a given address | |
int | getLow (int ext_ind, int address) const |
get low_value for a given address | |
L1MuDTExtLut () | |
constructor | |
int | load () |
load extrapolation look-up tables | |
void | print () const |
print extrapolation look-up tables | |
void | reset () |
reset extrapolation look-up tables | |
virtual | ~L1MuDTExtLut () |
destructor | |
Private Member Functions | |
void | setPrecision () |
set precision for look-up tables | |
Private Attributes | |
std::vector< LUT > | ext_lut |
unsigned short int | nbit_phi |
unsigned short int | nbit_phib |
Look-up tables for extrapolation
N. Neumeister CERN EP
Definition at line 40 of file L1MuDTExtLut.h.
L1MuDTExtLut::L1MuDTExtLut | ( | ) |
constructor
Definition at line 52 of file L1MuDTExtLut.cc.
References MAX_EXT.
{ ext_lut.reserve(MAX_EXT); setPrecision(); // if ( load() != 0 ) { // cout << "Can not open files to load extrapolation look-up tables for DTTrackFinder!" << endl; // } // if ( L1MuDTTFConfig::Debug(6) ) print(); }
L1MuDTExtLut::~L1MuDTExtLut | ( | ) | [virtual] |
destructor
Definition at line 69 of file L1MuDTExtLut.cc.
int L1MuDTExtLut::getHigh | ( | int | ext_ind, |
int | address | ||
) | const |
get high_value for a given address
Definition at line 265 of file L1MuDTExtLut.cc.
References benchmark_cfg::cerr.
int L1MuDTExtLut::getLow | ( | int | ext_ind, |
int | address | ||
) | const |
get low_value for a given address
Definition at line 249 of file L1MuDTExtLut.cc.
References benchmark_cfg::cerr.
int L1MuDTExtLut::load | ( | ) |
load extrapolation look-up tables
Definition at line 99 of file L1MuDTExtLut.cc.
References L1TriggerLutFile::close(), EX12, EX13, EX14, EX15, EX16, EX21, EX23, EX24, EX25, EX26, EX34, EX56, mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), L1MuDTExtLut::LUT::high, L1MuDTExtLut::LUT::low, MAX_EXT, L1TriggerLutFile::open(), and L1TriggerLutFile::readInteger().
{ // get directory name string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/"; string ext_dir = "L1TriggerData/DTTrackFinder/Ext/"; string ext_str = ""; // precision : in the look-up tables the following precision is used : // phi ...12 bits (low, high), phib ...10 bits (address) // now convert phi and phib to the required precision int sh_phi = 12 - nbit_phi; int sh_phib = 10 - nbit_phib; // loop over all extrapolations for ( int ext = 0; ext < MAX_EXT; ext++ ) { switch (ext) { case EX12 : ext_str = "ext12"; break; case EX13 : ext_str = "ext13"; break; case EX14 : ext_str = "ext14"; break; case EX21 : ext_str = "ext21"; break; case EX23 : ext_str = "ext23"; break; case EX24 : ext_str = "ext24"; break; case EX34 : ext_str = "ext34"; break; case EX15 : ext_str = "ext15"; break; case EX16 : ext_str = "ext16"; break; case EX25 : ext_str = "ext25"; break; case EX26 : ext_str = "ext26"; break; case EX56 : ext_str = "ext56"; break; } // assemble file name edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + ext_dir + ext_str + ".lut")); string ext_file = lut_f.fullPath(); // open file L1TriggerLutFile file(ext_file); if ( file.open() != 0 ) return -1; // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : " // << file.getName() << endl; LUT tmplut; int number = -1; int adr_old = -512 >> sh_phib; int sum_low = 0; int sum_high = 0; // read values and shift to correct precision while ( file.good() ) { int adr = ( file.readInteger() ) >> sh_phib; // address (phib) int low = ( file.readInteger() ); // low value (phi) int high = ( file.readInteger() ); // high value (phi) number++; if ( adr != adr_old ) { tmplut.low[adr_old] = sum_low >> sh_phi; tmplut.high[adr_old] = sum_high >> sh_phi; adr_old = adr; number = 0; sum_low = 0; sum_high = 0; } if (number == 0) sum_low = low; if (number == 0) sum_high = high; if ( !file.good() ) file.close(); } file.close(); ext_lut.push_back(tmplut); } return 0; }
void L1MuDTExtLut::print | ( | void | ) | const |
print extrapolation look-up tables
Definition at line 185 of file L1MuDTExtLut.cc.
References abs, gather_cfg::cout, i, MAX_EXT, and DTTFBitArray< N >::twoComplement().
{ cout << endl; cout << "L1 barrel Track Finder Extrapolation look-up tables :" << endl; cout << "=====================================================" << endl; cout << endl; cout << "Precision : " << endl; cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl; cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl; // loop over all extrapolations for ( int ext = 0; ext < MAX_EXT; ext++ ) { cout << endl; cout << "Extrapolation : " << static_cast<Extrapolation>(ext) << endl; cout << "====================" << endl; cout << endl; cout << " address"; for ( int i = 0; i < nbit_phib; i++ ) cout << ' '; cout << " low-value"; for ( int i = 0; i < nbit_phi; i++ ) cout << ' '; cout << " high-value " << endl; for ( int i = 0; i < 2*nbit_phi + nbit_phib; i++ ) cout << '-'; cout << "---------------------------------" << endl; LUT::LUTmap::const_iterator iter = ext_lut[ext].low.begin(); LUT::LUTmap::const_iterator iter1; while ( iter != ext_lut[ext].low.end() ) { int address = (*iter).first; int low = (*iter).second; iter1 = ext_lut[ext].high.find(address); int high = (*iter1).second; DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address))); DTTFBitArray<12> b_low(static_cast<unsigned>(abs(low))); DTTFBitArray<12> b_high(static_cast<unsigned>(abs(high))); if ( address < 0 ) b_address.twoComplement(); if ( low < 0 ) b_low.twoComplement(); if ( high < 0 ) b_high.twoComplement(); cout.setf(ios::right,ios::adjustfield); cout << " " << setbase(10) << setw(5) << address << " ("; for ( int i = nbit_phib-1; i >= 0; i-- ) cout << b_address[i]; cout << ") " << setw(5) << low << " ("; for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_low[i]; cout << ") " << setw(5) << high << " ("; for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_high[i]; cout << ") " << endl; iter++; } } cout << endl; }
void L1MuDTExtLut::reset | ( | void | ) |
reset extrapolation look-up tables
Definition at line 89 of file L1MuDTExtLut.cc.
{ ext_lut.clear(); }
void L1MuDTExtLut::setPrecision | ( | ) | [private] |
set precision for look-up tables
Definition at line 281 of file L1MuDTExtLut.cc.
std::vector<LUT> L1MuDTExtLut::ext_lut [private] |
Definition at line 81 of file L1MuDTExtLut.h.
unsigned short int L1MuDTExtLut::nbit_phi [private] |
Definition at line 83 of file L1MuDTExtLut.h.
unsigned short int L1MuDTExtLut::nbit_phib [private] |
Definition at line 84 of file L1MuDTExtLut.h.