CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
L1MuDTPhiLut Class Reference

#include <L1MuDTPhiLut.h>

Public Member Functions

int getDeltaPhi (int idx, int address) const
 get delta-phi for a given address (bend-angle) More...
 
std::pair< unsigned short,
unsigned short > 
getPrecision () const
 get precision for look-up tables More...
 
 L1MuDTPhiLut ()
 constructor More...
 
int load ()
 load phi-assignment look-up tables More...
 
void print () const
 print phi-assignment look-up tables More...
 
void reset ()
 reset phi-assignment look-up tables More...
 
virtual ~L1MuDTPhiLut ()
 destructor More...
 

Private Types

typedef std::map< short, short,
std::less< short > > 
LUT
 

Private Member Functions

void setPrecision ()
 set precision for look-up tables More...
 

Private Attributes

unsigned short int nbit_phi
 
unsigned short int nbit_phib
 
std::vector< LUTphi_lut
 

Detailed Description

Look-up tables for phi-assignment

Date:
2008/04/09 15:22:31
Revision:
1.3

N. Neumeister CERN EP

Definition at line 40 of file L1MuDTPhiLut.h.

Member Typedef Documentation

typedef std::map<short, short, std::less<short> > L1MuDTPhiLut::LUT
private

Definition at line 72 of file L1MuDTPhiLut.h.

Constructor & Destructor Documentation

L1MuDTPhiLut::L1MuDTPhiLut ( )

constructor

Definition at line 51 of file L1MuDTPhiLut.cc.

51  {
52 
53  phi_lut.reserve(2);
54  setPrecision();
55  // if ( load() != 0 ) {
56  // cout << "Can not open files to load phi-assignment look-up tables for DTTrackFinder!" << endl;
57  // }
58 
59  // if ( L1MuDTTFConfig::Debug(6) ) print();
60 
61 }
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:74
void setPrecision()
set precision for look-up tables
L1MuDTPhiLut::~L1MuDTPhiLut ( )
virtual

destructor

Definition at line 68 of file L1MuDTPhiLut.cc.

68  {
69 
70  vector<LUT>::iterator iter;
71  for ( iter = phi_lut.begin(); iter != phi_lut.end(); iter++ ) {
72  (*iter).clear();
73  }
74 
75  phi_lut.clear();
76 
77 }
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:74

Member Function Documentation

int L1MuDTPhiLut::getDeltaPhi ( int  idx,
int  address 
) const

get delta-phi for a given address (bend-angle)

Definition at line 222 of file L1MuDTPhiLut.cc.

References dtNoiseDBValidation_cfg::cerr, and end.

222  {
223 
224  LUT::const_iterator iter = phi_lut[idx].find(address);
225  if ( iter != phi_lut[idx].end() ) {
226  return (*iter).second;
227  }
228  else {
229  cerr << "PhiLut::getDeltaPhi : can not find address " << address << endl;
230  return 0;
231  }
232 
233 }
char * address
Definition: mlp_lapack.h:14
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:74
#define end
Definition: vmac.h:38
pair< unsigned short, unsigned short > L1MuDTPhiLut::getPrecision ( ) const

get precision for look-up tables

Definition at line 250 of file L1MuDTPhiLut.cc.

250  {
251 
252  return pair<unsigned short, unsigned short>(nbit_phi,nbit_phib);
253 
254 }
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:76
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:77
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(), L1TriggerLutFile::open(), phi, and L1TriggerLutFile::readInteger().

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), and MatrixToProcess.MatrixToProcess::listAll().

97  {
98 
99  // get directory name
100  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
101  string phi_dir = "L1TriggerData/DTTrackFinder/Ass/";
102  string phi_str = "";
103 
104  // precision : in the look-up tables the following precision is used :
105  // address (phib) ...10 bits, phi ... 12 bits
106 
107  int sh_phi = 12 - nbit_phi;
108  int sh_phib = 10 - nbit_phib;
109 
110  // loop over all phi-assignment methods
111  for ( int idx = 0; idx < 2; idx++ ) {
112  switch ( idx ) {
113  case 0 : { phi_str = "phi12"; break; }
114  case 1 : { phi_str = "phi42"; break; }
115  }
116 
117  // assemble file name
118  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + phi_dir + phi_str + ".lut"));
119  string phi_file = lut_f.fullPath();
120 
121  // open file
122  L1TriggerLutFile file(phi_file);
123  if ( file.open() != 0 ) return -1;
124  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
125  // << file.getName() << endl;
126 
127  LUT tmplut;
128 
129  int number = -1;
130  int adr_old = -512 >> sh_phib;
131  int sum_phi = 0;
132 
133  // read values
134  while ( file.good() ) {
135 
136  int adr = (file.readInteger()) >> sh_phib;
137  int phi = file.readInteger();
138 
139  number++;
140 
141  if ( adr != adr_old ) {
142  tmplut.insert(make_pair( adr_old, ((sum_phi/number) >> sh_phi) ));
143 
144  adr_old = adr;
145  number = 0;
146  sum_phi = 0;
147  }
148 
149  sum_phi += phi;
150 
151  if ( !file.good() ) file.close();
152 
153  }
154 
155  file.close();
156  phi_lut.push_back(tmplut);
157  }
158  return 0;
159 
160 }
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:76
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:74
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:77
std::string fullPath() const
Definition: FileInPath.cc:171
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:34
Definition: DDAxes.h:10
void L1MuDTPhiLut::print ( void  ) const

print phi-assignment look-up tables

Definition at line 166 of file L1MuDTPhiLut.cc.

References abs, gather_cfg::cout, end, i, DTTFBitArray< N >::twoComplement(), and relativeConstraints::value.

166  {
167 
168  cout << endl;
169  cout << "L1 barrel Track Finder Phi-Assignment look-up tables :" << endl;
170  cout << "======================================================" << endl;
171  cout << endl;
172  cout << "Precision : " << endl;
173  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
174  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
175 
176  // loop over all phi-assignment methods
177  for ( int idx = 0; idx < 2; idx++ ) {
178 
179  cout << endl;
180  if ( idx == 0 ) cout << "Phi-Assignment Method : " << "PHI12" << endl;
181  if ( idx == 1 ) cout << "Phi-Assignment Method : " << "PHI42" << endl;
182  cout << "=============================" << endl;
183  cout << endl;
184 
185  cout << " address";
186  for ( int i = 0; i < nbit_phib; i++ ) cout << ' ';
187  cout << " value" << endl;
188  for ( int i = 0; i < nbit_phi + nbit_phib; i++ ) cout << '-';
189  cout << "----------------------" << endl;
190 
191  LUT::const_iterator iter = phi_lut[idx].begin();
192  while ( iter != phi_lut[idx].end() ) {
193  int address = (*iter).first;
194  int value = (*iter).second;
195 
196  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
197  DTTFBitArray<12> b_value(static_cast<unsigned>(abs(value)));
198 
199  if ( address < 0 ) b_address.twoComplement();
200  if ( value < 0 ) b_value.twoComplement();
201 
202  cout.setf(ios::right,ios::adjustfield);
203  cout << " " << setbase(10) << setw(5) << address << " (";
204  for ( int i = nbit_phib-1; i >= 0; i-- ) cout << b_address[i];
205  cout << ") " << setw(5) << value << " (";
206  for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_value[i];
207  cout << ") " << endl;
208 
209  iter++;
210  }
211 
212  }
213 
214  cout << endl;
215 
216 }
int i
Definition: DBlmapReader.cc:9
char * address
Definition: mlp_lapack.h:14
#define abs(x)
Definition: mlp_lapack.h:159
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:76
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:74
#define end
Definition: vmac.h:38
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:77
tuple cout
Definition: gather_cfg.py:121
void L1MuDTPhiLut::reset ( void  )

reset phi-assignment look-up tables

Definition at line 87 of file L1MuDTPhiLut.cc.

Referenced by MatrixReader.MatrixReader::__init__(), and MatrixReader.MatrixReader::showRaw().

87  {
88 
89  phi_lut.clear();
90 
91 }
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:74
void L1MuDTPhiLut::setPrecision ( )
private

set precision for look-up tables

Definition at line 239 of file L1MuDTPhiLut.cc.

239  {
240 
241  nbit_phi = 12;
242  nbit_phib = 10;
243 
244 }
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:76
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:77

Member Data Documentation

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.