CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTTracoLUTs Class Reference

#include <DTTracoLUTs.h>

Public Member Functions

 DTTracoLUTs (std::string filename)
 constructor More...
 
unsigned short int getBendAng (int pos, int ang, int qualflag) const
 return bending angle from pos and ang More...
 
unsigned short int getPhiRad (int pos, int qualflag) const
 get radial angle from traco position and flag: 0=outer, 1=inner, 2=correl. More...
 
unsigned short int getPsi (int ang) const
 get psi angle from traco k parameter More...
 
int load ()
 load look-up tables More...
 
void print () const
 print look-up tables More...
 
void reset ()
 reset look-up tables More...
 
int size_phiLUT (int i) const
 
int size_psiLUT () const
 return number of entries in the LUT More...
 
virtual ~DTTracoLUTs ()
 destructor More...
 

Private Attributes

std::string _testfile
 
LUT phi_lut [3]
 
LUT psi_lut
 

Detailed Description

Look-up tables for traco angle and position

Author
S. Vanini - INFN Padova

Definition at line 33 of file DTTracoLUTs.h.

Constructor & Destructor Documentation

◆ DTTracoLUTs()

DTTracoLUTs::DTTracoLUTs ( std::string  filename)

constructor

Definition at line 45 of file DTTracoLUTs.cc.

45 : _testfile(testfile) {}
std::string _testfile
Definition: DTTracoLUTs.h:68

◆ ~DTTracoLUTs()

DTTracoLUTs::~DTTracoLUTs ( )
virtual

destructor

Definition at line 51 of file DTTracoLUTs.cc.

References l1ct::clear(), isotrackApplyRegressor::k, phi_lut, and psi_lut.

51  {
52  psi_lut.clear();
53  for (int k = 0; k < 3; k++)
54  phi_lut[k].clear();
55 }
LUT phi_lut[3]
Definition: DTTracoLUTs.h:66
void clear(EGIsoObj &c)
Definition: egamma.h:82

Member Function Documentation

◆ getBendAng()

unsigned short int DTTracoLUTs::getBendAng ( int  pos,
int  ang,
int  qualflag 
) const

return bending angle from pos and ang

Definition at line 174 of file DTTracoLUTs.cc.

References RemoveAddSevLevel::flag, phi_lut, and psi_lut.

174  {
175  // bendAng = psi - phi : psi ha risoluzione 12, phi 9, quindi devo riportarli
176  // alla stessa risoluzione con : phi/8 (scarto i 3 bit meno significativi). Il
177  // risultato ha risoluzione 10 bits.
178  unsigned short int BendAng = ((psi_lut)[ang + 512] - ((phi_lut[flag])[pos] / 8)) & 0x3FF; // 10 bits
179 
180  // cout << "Bending angle is:" << hex << BendAng << endl;
181  // cout << "Abs of bending angle is:" << hex << abs(BendAng) << endl;
182 
183  return BendAng;
184 }
LUT phi_lut[3]
Definition: DTTracoLUTs.h:66

◆ getPhiRad()

unsigned short int DTTracoLUTs::getPhiRad ( int  pos,
int  qualflag 
) const

get radial angle from traco position and flag: 0=outer, 1=inner, 2=correl.

Definition at line 142 of file DTTracoLUTs.cc.

References RemoveAddSevLevel::flag, phi, and phi_lut.

142  {
143  unsigned short int phi = (phi_lut[flag])[pos] & 0xFFF; // 12 bits
144  // int sgn = (phi_lut[flag])[pos] & 0x800; //bit 12 for sign
145  // if(sgn)
146  // phi = - phi;
147 
148  return phi;
149 }
LUT phi_lut[3]
Definition: DTTracoLUTs.h:66

◆ getPsi()

unsigned short int DTTracoLUTs::getPsi ( int  ang) const

get psi angle from traco k parameter

Definition at line 154 of file DTTracoLUTs.cc.

References psi_lut.

154  {
155  unsigned short int ipsi = (psi_lut)[ang + 512]; // scritto in complemento a
156  // due
157  /*
158  //debug: try with formula
159  float fpsi = atan( ((float)(ang) * 4.2) /(18 * 1.3 * 30 ));
160  fpsi*=512;
161  if(fpsi<=0)fpsi-=1.0;
162  int ipsi = (int)fpsi;
163  // if outside range set to lower edge
164  if( ipsi>= 512 ||
165  ipsi< -512 ) ipsi=-512;
166  cout << "psi is="<<ipsi <<endl;
167  */
168  return ipsi;
169 }

◆ load()

int DTTracoLUTs::load ( )

load look-up tables

Definition at line 73 of file DTTracoLUTs.cc.

References _testfile, DTTPGLutFile::close(), h, DTTPGLutFile::open(), phi, phi_lut, psi_lut, DTTPGLutFile::readHex(), and y.

73  {
74  // get file name in current directory
75  string ang_file = _testfile + ".anglut";
76  string pos_file = _testfile + ".poslut";
77 
78  // open file for PSI
79  DTTPGLutFile filePSI(ang_file);
80  if (filePSI.open() != 0)
81  return -1;
82 
83  // ignore comment lines
84  // filePSI.ignoreLines(14);
85 
86  // read file for PSI values ---> psi is 10 bits, 9+sign(10,11...16),
87  // resolution 9 bits,
88  for (int u = 0; u < 1024; u++) {
89  int word = filePSI.readHex(); // read a 16 bits word
90  // int psi = word & 0x01FF; //bits 0,1,...8
91  // int sgn = word & 0x0200; //bit 9
92  // if(sgn)
93  // psi = -psi;
94  psi_lut.push_back(word); // positive value
95  }
96  filePSI.close();
97 
98  // open file for PHI
99  DTTPGLutFile filePHI(pos_file);
100  if (filePHI.open() != 0)
101  return -1;
102 
103  // read file for PHI values ---> phi is 12 bits, 11+sign(12..16),
104  // resolution 12 bits
105  for (int y = 0; y < 3; y++) { // 3 series of values: I-outer, II-innner, III-correlated
106  for (int h = 0; h < 512; h++) {
107  int phi = filePHI.readHex();
108  // phi &= 0x0FFF; //get 12 bits
109  // int sgn = phi;
110  // sgn >> 11; //bit 12 for sign
111  // sgn &= 0x01;
112  // if(sgn==1) //negative value
113  // phi = -phi;
114  phi_lut[y].push_back(phi); // positive value
115  }
116  }
117  filePHI.close();
118  return 0;
119 }
LUT phi_lut[3]
Definition: DTTracoLUTs.h:66
uint64_t word
std::string _testfile
Definition: DTTracoLUTs.h:68
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ print()

void DTTracoLUTs::print ( void  ) const

print look-up tables

Definition at line 124 of file DTTracoLUTs.cc.

References gather_cfg::cout, TauDecayModes::dec, visualization-live-secondInstance_cfg::m, phi_lut, psi_lut, and x.

124  {
125  cout << endl;
126  cout << "L1 barrel Traco look-up tables :" << endl;
127  cout << "====================================================" << endl;
128  cout << endl;
129 
130  // int i = 0;
131  // for debugging
132  for (int x = 0; x < 1024; x++)
133  cout << "K=" << x << " ---> " << hex << psi_lut[x] << dec << endl;
134  for (int m = 0; m < 512; m++)
135  cout << "X=" << m << " ---> " << hex << (phi_lut[0])[m] << " " << (phi_lut[1])[m] << " " << (phi_lut[2])[m]
136  << " " << dec << endl;
137 }
LUT phi_lut[3]
Definition: DTTracoLUTs.h:66

◆ reset()

void DTTracoLUTs::reset ( void  )

reset look-up tables

Definition at line 64 of file DTTracoLUTs.cc.

References l1ct::clear(), isotrackApplyRegressor::k, phi_lut, and psi_lut.

64  {
65  psi_lut.clear();
66  for (int k = 0; k < 3; k++)
67  phi_lut[k].clear();
68 }
LUT phi_lut[3]
Definition: DTTracoLUTs.h:66
void clear(EGIsoObj &c)
Definition: egamma.h:82

◆ size_phiLUT()

int DTTracoLUTs::size_phiLUT ( int  i) const
inline

Definition at line 63 of file DTTracoLUTs.h.

References mps_fire::i, and phi_lut.

63 { return phi_lut[i].size(); }
LUT phi_lut[3]
Definition: DTTracoLUTs.h:66

◆ size_psiLUT()

int DTTracoLUTs::size_psiLUT ( ) const
inline

return number of entries in the LUT

Definition at line 62 of file DTTracoLUTs.h.

References psi_lut.

62 { return psi_lut.size(); }

Member Data Documentation

◆ _testfile

std::string DTTracoLUTs::_testfile
private

Definition at line 68 of file DTTracoLUTs.h.

Referenced by load().

◆ phi_lut

LUT DTTracoLUTs::phi_lut[3]
private

Definition at line 66 of file DTTracoLUTs.h.

Referenced by getBendAng(), getPhiRad(), load(), print(), reset(), size_phiLUT(), and ~DTTracoLUTs().

◆ psi_lut

LUT DTTracoLUTs::psi_lut
private

Definition at line 67 of file DTTracoLUTs.h.

Referenced by getBendAng(), getPsi(), load(), print(), reset(), size_psiLUT(), and ~DTTracoLUTs().