#include <L1MuDTPhiLut.h>
Public Member Functions | |
int | getDeltaPhi (int idx, int address) const |
get delta-phi for a given address (bend-angle) | |
std::pair< unsigned short, unsigned short > | getPrecision () const |
get precision for look-up tables | |
L1MuDTPhiLut () | |
constructor | |
int | load () |
load phi-assignment look-up tables | |
void | print () const |
print phi-assignment look-up tables | |
void | reset () |
reset phi-assignment look-up tables | |
virtual | ~L1MuDTPhiLut () |
destructor | |
Private Types | |
typedef std::map< short, short, std::less< short > > | LUT |
Private Member Functions | |
void | setPrecision () |
set precision for look-up tables | |
Private Attributes | |
unsigned short int | nbit_phi |
unsigned short int | nbit_phib |
std::vector< LUT > | phi_lut |
Look-up tables for phi-assignment
N. Neumeister CERN EP
Definition at line 40 of file L1MuDTPhiLut.h.
typedef std::map<short, short, std::less<short> > L1MuDTPhiLut::LUT [private] |
Definition at line 72 of file L1MuDTPhiLut.h.
L1MuDTPhiLut::L1MuDTPhiLut | ( | ) |
constructor
Definition at line 51 of file L1MuDTPhiLut.cc.
{ phi_lut.reserve(2); setPrecision(); // if ( load() != 0 ) { // cout << "Can not open files to load phi-assignment look-up tables for DTTrackFinder!" << endl; // } // if ( L1MuDTTFConfig::Debug(6) ) print(); }
L1MuDTPhiLut::~L1MuDTPhiLut | ( | ) | [virtual] |
destructor
Definition at line 68 of file L1MuDTPhiLut.cc.
{ vector<LUT>::iterator iter; for ( iter = phi_lut.begin(); iter != phi_lut.end(); iter++ ) { (*iter).clear(); } phi_lut.clear(); }
int L1MuDTPhiLut::getDeltaPhi | ( | int | idx, |
int | address | ||
) | const |
get delta-phi for a given address (bend-angle)
Definition at line 223 of file L1MuDTPhiLut.cc.
References dtNoiseDBValidation_cfg::cerr, end, and UserOptions_cff::idx.
pair< unsigned short, unsigned short > L1MuDTPhiLut::getPrecision | ( | ) | const |
get precision for look-up tables
Definition at line 251 of file L1MuDTPhiLut.cc.
{ return pair<unsigned short, unsigned short>(nbit_phi,nbit_phib); }
int L1MuDTPhiLut::load | ( | ) |
load phi-assignment look-up tables
Definition at line 97 of file L1MuDTPhiLut.cc.
References L1TriggerLutFile::close(), mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), UserOptions_cff::idx, L1TriggerLutFile::open(), phi, and L1TriggerLutFile::readInteger().
{ // get directory name string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/"; string phi_dir = "L1TriggerData/DTTrackFinder/Ass/"; string phi_str = ""; // precision : in the look-up tables the following precision is used : // address (phib) ...10 bits, phi ... 12 bits int sh_phi = 12 - nbit_phi; int sh_phib = 10 - nbit_phib; // loop over all phi-assignment methods for ( int idx = 0; idx < 2; idx++ ) { switch ( idx ) { case 0 : { phi_str = "phi12"; break; } case 1 : { phi_str = "phi42"; break; } } // assemble file name edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + phi_dir + phi_str + ".lut")); string phi_file = lut_f.fullPath(); // open file L1TriggerLutFile file(phi_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_phi = 0; // read values while ( file.good() ) { int adr = (file.readInteger()) >> sh_phib; int phi = file.readInteger(); number++; if ( adr != adr_old ) { assert(number); tmplut.insert(make_pair( adr_old, ((sum_phi/number) >> sh_phi) )); adr_old = adr; number = 0; sum_phi = 0; } sum_phi += phi; if ( !file.good() ) file.close(); } file.close(); phi_lut.push_back(tmplut); } return 0; }
void L1MuDTPhiLut::print | ( | void | ) | const |
print phi-assignment look-up tables
Definition at line 167 of file L1MuDTPhiLut.cc.
References abs, gather_cfg::cout, end, i, UserOptions_cff::idx, DTTFBitArray< N >::twoComplement(), and relativeConstraints::value.
{ cout << endl; cout << "L1 barrel Track Finder Phi-Assignment 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 phi-assignment methods for ( int idx = 0; idx < 2; idx++ ) { cout << endl; if ( idx == 0 ) cout << "Phi-Assignment Method : " << "PHI12" << endl; if ( idx == 1 ) cout << "Phi-Assignment Method : " << "PHI42" << endl; cout << "=============================" << endl; cout << endl; cout << " address"; for ( int i = 0; i < nbit_phib; i++ ) cout << ' '; cout << " value" << endl; for ( int i = 0; i < nbit_phi + nbit_phib; i++ ) cout << '-'; cout << "----------------------" << endl; LUT::const_iterator iter = phi_lut[idx].begin(); while ( iter != phi_lut[idx].end() ) { int address = (*iter).first; int value = (*iter).second; DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address))); DTTFBitArray<12> b_value(static_cast<unsigned>(abs(value))); if ( address < 0 ) b_address.twoComplement(); if ( value < 0 ) b_value.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) << value << " ("; for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_value[i]; cout << ") " << endl; iter++; } } cout << endl; }
void L1MuDTPhiLut::reset | ( | void | ) |
reset phi-assignment look-up tables
Definition at line 87 of file L1MuDTPhiLut.cc.
{ phi_lut.clear(); }
void L1MuDTPhiLut::setPrecision | ( | ) | [private] |
set precision for look-up tables
Definition at line 240 of file L1MuDTPhiLut.cc.
unsigned short int L1MuDTPhiLut::nbit_phi [private] |
Definition at line 76 of file L1MuDTPhiLut.h.
unsigned short int L1MuDTPhiLut::nbit_phib [private] |
Definition at line 77 of file L1MuDTPhiLut.h.
std::vector<LUT> L1MuDTPhiLut::phi_lut [private] |
Definition at line 74 of file L1MuDTPhiLut.h.