#include <CondFormats/L1TObjects/interface/L1MuDTExtLut.h>
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 |
Classes | |
class | LUT |
helper class for look-up tables More... |
N. Neumeister CERN EP
Definition at line 40 of file L1MuDTExtLut.h.
L1MuDTExtLut::L1MuDTExtLut | ( | ) |
constructor
Definition at line 51 of file L1MuDTExtLut.cc.
References ext_lut, MAX_EXT, and setPrecision().
00051 { 00052 00053 ext_lut.reserve(MAX_EXT); 00054 setPrecision(); 00055 // if ( load() != 0 ) { 00056 // cout << "Can not open files to load extrapolation look-up tables for DTTrackFinder!" << endl; 00057 // } 00058 00059 // if ( L1MuDTTFConfig::Debug(6) ) print(); 00060 00061 }
L1MuDTExtLut::~L1MuDTExtLut | ( | ) | [virtual] |
get high_value for a given address
Definition at line 264 of file L1MuDTExtLut.cc.
References TestMuL1L2Filter_cff::cerr, lat::endl(), ext_lut, WenuSkim_TriggerBit_cff::high, and iter.
00264 { 00265 00266 LUT::LUTmap::const_iterator iter = ext_lut[ext_ind].high.find(address); 00267 if ( iter != ext_lut[ext_ind].high.end() ) { 00268 return (*iter).second; 00269 } 00270 else { 00271 cerr << "ExtLut::getHigh : can not find address " << address << endl; 00272 return 99999; 00273 } 00274 }
get low_value for a given address
Definition at line 248 of file L1MuDTExtLut.cc.
References TestMuL1L2Filter_cff::cerr, lat::endl(), ext_lut, and iter.
00248 { 00249 00250 LUT::LUTmap::const_iterator iter = ext_lut[ext_ind].low.find(address); 00251 if ( iter != ext_lut[ext_ind].low.end() ) { 00252 return (*iter).second; 00253 } 00254 else { 00255 cerr << "ExtLut::getLow : can not find address " << address << endl; 00256 return 99999; 00257 } 00258 }
int L1MuDTExtLut::load | ( | ) |
load extrapolation look-up tables
Definition at line 98 of file L1MuDTExtLut.cc.
References L1TriggerLutFile::close(), EX12, EX13, EX14, EX15, EX16, EX21, EX23, EX24, EX25, EX26, EX34, EX56, ext_lut, file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), WenuSkim_TriggerBit_cff::high, L1MuDTExtLut::LUT::high, L1MuDTExtLut::LUT::low, MAX_EXT, nbit_phi, nbit_phib, L1TriggerLutFile::open(), and L1TriggerLutFile::readInteger().
00098 { 00099 00100 // get directory name 00101 string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/"; 00102 string ext_dir = "L1TriggerData/DTTrackFinder/Ext/"; 00103 string ext_str = ""; 00104 00105 // precision : in the look-up tables the following precision is used : 00106 // phi ...12 bits (low, high), phib ...10 bits (address) 00107 // now convert phi and phib to the required precision 00108 00109 int sh_phi = 12 - nbit_phi; 00110 int sh_phib = 10 - nbit_phib; 00111 00112 // loop over all extrapolations 00113 for ( int ext = 0; ext < MAX_EXT; ext++ ) { 00114 switch (ext) { 00115 case EX12 : ext_str = "ext12"; break; 00116 case EX13 : ext_str = "ext13"; break; 00117 case EX14 : ext_str = "ext14"; break; 00118 case EX21 : ext_str = "ext21"; break; 00119 case EX23 : ext_str = "ext23"; break; 00120 case EX24 : ext_str = "ext24"; break; 00121 case EX34 : ext_str = "ext34"; break; 00122 case EX15 : ext_str = "ext15"; break; 00123 case EX16 : ext_str = "ext16"; break; 00124 case EX25 : ext_str = "ext25"; break; 00125 case EX26 : ext_str = "ext26"; break; 00126 case EX56 : ext_str = "ext56"; break; 00127 } 00128 00129 // assemble file name 00130 edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + ext_dir + ext_str + ".lut")); 00131 string ext_file = lut_f.fullPath(); 00132 00133 // open file 00134 L1TriggerLutFile file(ext_file); 00135 if ( file.open() != 0 ) return -1; 00136 // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : " 00137 // << file.getName() << endl; 00138 00139 LUT tmplut; 00140 00141 int number = -1; 00142 int adr_old = -512 >> sh_phib; 00143 int sum_low = 0; 00144 int sum_high = 0; 00145 00146 // read values and shift to correct precision 00147 while ( file.good() ) { 00148 00149 int adr = ( file.readInteger() ) >> sh_phib; // address (phib) 00150 int low = ( file.readInteger() ); // low value (phi) 00151 int high = ( file.readInteger() ); // high value (phi) 00152 00153 number++; 00154 00155 if ( adr != adr_old ) { 00156 00157 tmplut.low[adr_old] = sum_low >> sh_phi; 00158 tmplut.high[adr_old] = sum_high >> sh_phi; 00159 00160 adr_old = adr; 00161 number = 0; 00162 sum_low = 0; 00163 sum_high = 0; 00164 00165 } 00166 00167 if (number == 0) sum_low = low; 00168 if (number == 0) sum_high = high; 00169 00170 if ( !file.good() ) file.close(); 00171 } 00172 00173 file.close(); 00174 ext_lut.push_back(tmplut); 00175 } 00176 return 0; 00177 00178 }
print extrapolation look-up tables
Definition at line 184 of file L1MuDTExtLut.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), ext_lut, WenuSkim_TriggerBit_cff::high, i, iter, MAX_EXT, nbit_phi, and nbit_phib.
00184 { 00185 00186 cout << endl; 00187 cout << "L1 barrel Track Finder Extrapolation look-up tables :" << endl; 00188 cout << "=====================================================" << endl; 00189 cout << endl; 00190 cout << "Precision : " << endl; 00191 cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl; 00192 cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl; 00193 00194 // loop over all extrapolations 00195 for ( int ext = 0; ext < MAX_EXT; ext++ ) { 00196 00197 cout << endl; 00198 cout << "Extrapolation : " << static_cast<Extrapolation>(ext) << endl; 00199 cout << "====================" << endl; 00200 cout << endl; 00201 00202 cout << " address"; 00203 for ( int i = 0; i < nbit_phib; i++ ) cout << ' '; 00204 cout << " low-value"; 00205 for ( int i = 0; i < nbit_phi; i++ ) cout << ' '; 00206 cout << " high-value " << endl; 00207 for ( int i = 0; i < 2*nbit_phi + nbit_phib; i++ ) cout << '-'; 00208 cout << "---------------------------------" << endl; 00209 00210 LUT::LUTmap::const_iterator iter = ext_lut[ext].low.begin(); 00211 LUT::LUTmap::const_iterator iter1; 00212 while ( iter != ext_lut[ext].low.end() ) { 00213 int address = (*iter).first; 00214 int low = (*iter).second; 00215 iter1 = ext_lut[ext].high.find(address); 00216 int high = (*iter1).second; 00217 00218 // BitArray<10> b_address(static_cast<unsigned>(abs(address))); 00219 // BitArray<12> b_low(static_cast<unsigned>(abs(low))); 00220 // BitArray<12> b_high(static_cast<unsigned>(abs(high))); 00221 00222 // if ( address < 0 ) b_address.twoComplement(); 00223 // if ( low < 0 ) b_low.twoComplement(); 00224 // if ( high < 0 ) b_high.twoComplement(); 00225 00226 // cout.setf(ios::right,ios::adjustfield); 00227 // cout << " " << setbase(10) << setw(5) << address << " ("; 00228 // for ( int i = nbit_phib-1; i >= 0; i-- ) cout << b_address[i]; 00229 // cout << ") " << setw(5) << low << " ("; 00230 // for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_low[i]; 00231 // cout << ") " << setw(5) << high << " ("; 00232 // for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_high[i]; 00233 // cout << ") " << endl; 00234 00235 iter++; 00236 } 00237 00238 } 00239 00240 cout << endl; 00241 00242 }
reset extrapolation look-up tables
Definition at line 88 of file L1MuDTExtLut.cc.
References ext_lut.
00088 { 00089 00090 ext_lut.clear(); 00091 00092 }
void L1MuDTExtLut::setPrecision | ( | ) | [private] |
set precision for look-up tables
Definition at line 280 of file L1MuDTExtLut.cc.
References nbit_phi, and nbit_phib.
Referenced by L1MuDTExtLut().
std::vector<LUT> L1MuDTExtLut::ext_lut [private] |
Definition at line 81 of file L1MuDTExtLut.h.
Referenced by getHigh(), getLow(), L1MuDTExtLut(), load(), print(), reset(), and ~L1MuDTExtLut().
unsigned short int L1MuDTExtLut::nbit_phi [private] |
unsigned short int L1MuDTExtLut::nbit_phib [private] |