#include <L1Trigger/DTTraco/interface/DTTracoLUTs.h>
Public Member Functions | |
DTTracoLUTs (std::string filename) | |
constructor | |
unsigned short int | getBendAng (int pos, int ang, int qualflag) const |
return bending angle from pos and ang | |
unsigned short int | getPhiRad (int pos, int qualflag) const |
get radial angle from traco position and flag: 0=outer, 1=inner, 2=correl. | |
unsigned short int | getPsi (int ang) const |
get psi angle from traco k parameter | |
int | load () |
load look-up tables | |
void | print () const |
print look-up tables | |
void | reset () |
reset look-up tables | |
int | size_phiLUT (int i) const |
int | size_psiLUT () const |
return number of entries in the LUT | |
virtual | ~DTTracoLUTs () |
destructor | |
Private Attributes | |
std::string | _testfile |
LUT | phi_lut [3] |
LUT | psi_lut |
Definition at line 36 of file DTTracoLUTs.h.
DTTracoLUTs::DTTracoLUTs | ( | std::string | filename | ) |
constructor
DTTracoLUTs::~DTTracoLUTs | ( | ) | [virtual] |
return bending angle from pos and ang
Definition at line 182 of file DTTracoLUTs.cc.
References phi_lut, and psi_lut.
00182 { 00183 // bendAng = psi - phi : psi ha risoluzione 12, phi 9, quindi devo riportarli alla 00184 // stessa risoluzione con : phi/8 (scarto i 3 bit meno significativi). 00185 // Il risultato ha risoluzione 10 bits. 00186 unsigned short int BendAng = ( (psi_lut)[ang+512] - ((phi_lut[flag])[pos]/8) ) & 0x3FF; //10 bits 00187 00188 //cout << "Bending angle is:" << hex << BendAng << endl; 00189 //cout << "Abs of bending angle is:" << hex << abs(BendAng) << endl; 00190 00191 00192 return BendAng; 00193 }
get radial angle from traco position and flag: 0=outer, 1=inner, 2=correl.
Definition at line 150 of file DTTracoLUTs.cc.
00150 { 00151 unsigned short int phi = (phi_lut[flag])[pos] & 0xFFF; //12 bits 00152 //int sgn = (phi_lut[flag])[pos] & 0x800; //bit 12 for sign 00153 //if(sgn) 00154 //phi = - phi; 00155 00156 return phi; 00157 }
get psi angle from traco k parameter
Definition at line 162 of file DTTracoLUTs.cc.
References psi_lut.
00162 { 00163 00164 unsigned short int ipsi = (psi_lut)[ang+512]; //scritto in complemento a due 00165 /* 00166 //debug: try with formula 00167 float fpsi = atan( ((float)(ang) * 4.2) /(18 * 1.3 * 30 )); 00168 fpsi*=512; 00169 if(fpsi<=0)fpsi-=1.0; 00170 int ipsi = (int)fpsi; 00171 // if outside range set to lower edge 00172 if( ipsi>= 512 || 00173 ipsi< -512 ) ipsi=-512; 00174 cout << "psi is="<<ipsi <<endl; 00175 */ 00176 return ipsi; 00177 }
load look-up tables
Definition at line 80 of file DTTracoLUTs.cc.
References _testfile, DTTPGLutFile::close(), h, DTTPGLutFile::open(), phi, phi_lut, psi_lut, DTTPGLutFile::readHex(), and y.
00080 { 00081 00082 // get file name in current directory 00083 string ang_file = _testfile + ".anglut"; 00084 string pos_file = _testfile + ".poslut"; 00085 00086 // open file for PSI 00087 DTTPGLutFile filePSI(ang_file); 00088 if ( filePSI.open() != 0 ) return -1; 00089 00090 // ignore comment lines 00091 //filePSI.ignoreLines(14); 00092 00093 // read file for PSI values ---> psi is 10 bits, 9+sign(10,11...16), resolution 9 bits, 00094 for(int u=0;u<1024;u++){ 00095 int word = filePSI.readHex(); //read a 16 bits word 00096 //int psi = word & 0x01FF; //bits 0,1,...8 00097 //int sgn = word & 0x0200; //bit 9 00098 //if(sgn) 00099 //psi = -psi; 00100 psi_lut.push_back(word); //positive value 00101 } 00102 filePSI.close(); 00103 00104 // open file for PHI 00105 DTTPGLutFile filePHI(pos_file); 00106 if ( filePHI.open() != 0 ) return -1; 00107 00108 // read file for PHI values ---> phi is 12 bits, 11+sign(12..16), resolution 12 bits 00109 for(int y=0;y<3;y++){ //3 series of values: I-outer, II-innner, III-correlated 00110 for(int h=0;h<512;h++){ 00111 int phi = filePHI.readHex(); 00112 //phi &= 0x0FFF; //get 12 bits 00113 //int sgn = phi; 00114 //sgn >> 11; //bit 12 for sign 00115 //sgn &= 0x01; 00116 //if(sgn==1) //negative value 00117 //phi = -phi; 00118 phi_lut[y].push_back(phi); //positive value 00119 } 00120 } 00121 filePHI.close(); 00122 return 0; 00123 }
print look-up tables
Definition at line 129 of file DTTracoLUTs.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), m, phi_lut, psi_lut, and x.
00129 { 00130 00131 cout << endl; 00132 cout << "L1 barrel Traco look-up tables :" << endl; 00133 cout << "====================================================" << endl; 00134 cout << endl; 00135 00136 // int i = 0; 00137 // for debugging 00138 for(int x=0;x<1024;x++) 00139 cout << "K=" << x << " ---> " << hex << psi_lut[x] << dec << endl; 00140 for(int m=0;m<512;m++) 00141 cout << "X=" << m << " ---> " << hex << (phi_lut[0])[m] << " " 00142 << (phi_lut[1])[m] << " " 00143 << (phi_lut[2])[m] << " " << dec << endl; 00144 00145 }
int DTTracoLUTs::size_psiLUT | ( | ) | const [inline] |
return number of entries in the LUT
Definition at line 66 of file DTTracoLUTs.h.
References psi_lut.
00066 { return psi_lut.size(); }
std::string DTTracoLUTs::_testfile [private] |
LUT DTTracoLUTs::phi_lut[3] [private] |
Definition at line 71 of file DTTracoLUTs.h.
Referenced by getBendAng(), getPhiRad(), load(), print(), reset(), size_phiLUT(), and ~DTTracoLUTs().
LUT DTTracoLUTs::psi_lut [private] |
Definition at line 72 of file DTTracoLUTs.h.
Referenced by getBendAng(), getPsi(), load(), print(), reset(), size_psiLUT(), and ~DTTracoLUTs().