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
L1MuDTPtaLut Class Reference

#include <L1MuDTPtaLut.h>

Public Member Functions

int getPt (int pta_ind, int address) const
 get pt-value for a given address More...
 
int getPtLutThreshold (int pta_ind) const
 get pt-assignment LUT threshold More...
 
 L1MuDTPtaLut ()
 constructor More...
 
int load ()
 load pt-assignment look-up tables More...
 
void print () const
 print pt-assignment look-up tables More...
 
void reset ()
 reset pt-assignment look-up tables More...
 
virtual ~L1MuDTPtaLut ()
 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
 
std::vector< LUTpta_lut
 
std::vector< int > pta_threshold
 

Detailed Description

Look-up tables for pt-assignment

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

N. Neumeister CERN EP

Definition at line 40 of file L1MuDTPtaLut.h.

Member Typedef Documentation

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

Definition at line 72 of file L1MuDTPtaLut.h.

Constructor & Destructor Documentation

L1MuDTPtaLut::L1MuDTPtaLut ( )

constructor

Definition at line 52 of file L1MuDTPtaLut.cc.

References MAX_PTASSMETH, pta_lut, pta_threshold, and setPrecision().

52  :
53  pta_lut(0),
55 
56  pta_lut.reserve(MAX_PTASSMETH);
57  pta_threshold.reserve(MAX_PTASSMETH/2);
58  setPrecision();
59 
60  // if ( load() != 0 ) {
61  // cout << "Can not open files to load pt-assignment look-up tables for DTTrackFinder!" << endl;
62  // }
63 
64  // if ( L1MuDTTFConfig::Debug(6) ) print();
65 
66 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:74
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:75
void setPrecision()
set precision for look-up tables
const int MAX_PTASSMETH
L1MuDTPtaLut::~L1MuDTPtaLut ( )
virtual

destructor

Definition at line 73 of file L1MuDTPtaLut.cc.

References pta_lut, and pta_threshold.

73  {
74 
75  vector<LUT>::iterator iter;
76  for ( iter = pta_lut.begin(); iter != pta_lut.end(); iter++ ) {
77  (*iter).clear();
78  }
79 
80  pta_lut.clear();
81  pta_threshold.clear();
82 
83 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:74
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:75

Member Function Documentation

int L1MuDTPtaLut::getPt ( int  pta_ind,
int  address 
) const

get pt-value for a given address

Definition at line 264 of file L1MuDTPtaLut.cc.

References dtNoiseDBValidation_cfg::cerr, end, and pta_lut.

264  {
265 
266  LUT::const_iterator iter = pta_lut[pta_ind].find(address);
267  if ( iter != pta_lut[pta_ind].end() ) {
268  return (*iter).second;
269  }
270  else {
271  cerr << "PtaLut::getPt : can not find address " << address << endl;
272  return 0;
273  }
274 
275 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:74
char * address
Definition: mlp_lapack.h:14
#define end
Definition: vmac.h:38
int L1MuDTPtaLut::getPtLutThreshold ( int  pta_ind) const

get pt-assignment LUT threshold

Definition at line 281 of file L1MuDTPtaLut.cc.

References dtNoiseDBValidation_cfg::cerr, MAX_PTASSMETH, and pta_threshold.

Referenced by print().

281  {
282 
283  if ( pta_ind >= 0 && pta_ind < MAX_PTASSMETH/2 ) {
284  return pta_threshold[pta_ind];
285  }
286  else {
287  cerr << "PtaLut::getPtLutThreshold : can not find threshold " << pta_ind << endl;
288  return 0;
289  }
290 
291 }
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:75
const int MAX_PTASSMETH
int L1MuDTPtaLut::load ( )

load pt-assignment look-up tables

Definition at line 104 of file L1MuDTPtaLut.cc.

References L1TriggerLutFile::close(), mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), MAX_PTASSMETH, nbit_phi, L1TriggerLutFile::open(), PT12H, PT12HO, PT12L, PT12LO, PT13H, PT13HO, PT13L, PT13LO, PT14H, PT14HO, PT14L, PT14LO, PT15HO, PT15LO, PT23H, PT23HO, PT23L, PT23LO, PT24H, PT24HO, PT24L, PT24LO, PT25HO, PT25LO, PT34H, PT34HO, PT34L, PT34LO, pta_lut, pta_threshold, L1TriggerLutFile::readInteger(), edm::shift, and dtDQMClient_cfg::threshold.

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

104  {
105 
106  // get directory name
107  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
108  string pta_dir = "L1TriggerData/DTTrackFinder/Ass/";
109  string pta_str = "";
110 
111  // precision : in the look-up tables the following precision is used :
112  // phi ...12 bits (address) and pt ...5 bits
113  // now convert phi and phib to the required precision
114 
115  int sh_phi = 12 - nbit_phi;
116 
117  // loop over all pt-assignment methods
118  for ( int pam = 0; pam < MAX_PTASSMETH; pam++ ) {
119  switch ( pam ) {
120  case PT12L : { pta_str = "pta12l"; break; }
121  case PT12H : { pta_str = "pta12h"; break; }
122  case PT13L : { pta_str = "pta13l"; break; }
123  case PT13H : { pta_str = "pta13h"; break; }
124  case PT14L : { pta_str = "pta14l"; break; }
125  case PT14H : { pta_str = "pta14h"; break; }
126  case PT23L : { pta_str = "pta23l"; break; }
127  case PT23H : { pta_str = "pta23h"; break; }
128  case PT24L : { pta_str = "pta24l"; break; }
129  case PT24H : { pta_str = "pta24h"; break; }
130  case PT34L : { pta_str = "pta34l"; break; }
131  case PT34H : { pta_str = "pta34h"; break; }
132  case PT12LO : { pta_str = "pta12l_ovl"; break; }
133  case PT12HO : { pta_str = "pta12h_ovl"; break; }
134  case PT13LO : { pta_str = "pta13l_ovl"; break; }
135  case PT13HO : { pta_str = "pta13h_ovl"; break; }
136  case PT14LO : { pta_str = "pta14l_ovl"; break; }
137  case PT14HO : { pta_str = "pta14h_ovl"; break; }
138  case PT23LO : { pta_str = "pta23l_ovl"; break; }
139  case PT23HO : { pta_str = "pta23h_ovl"; break; }
140  case PT24LO : { pta_str = "pta24l_ovl"; break; }
141  case PT24HO : { pta_str = "pta24h_ovl"; break; }
142  case PT34LO : { pta_str = "pta34l_ovl"; break; }
143  case PT34HO : { pta_str = "pta34h_ovl"; break; }
144  case PT15LO : { pta_str = "pta15l_ovl"; break; }
145  case PT15HO : { pta_str = "pta15h_ovl"; break; }
146  case PT25LO : { pta_str = "pta25l_ovl"; break; }
147  case PT25HO : { pta_str = "pta25h_ovl"; break; }
148  }
149 
150  // assemble file name
151  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + pta_dir + pta_str + ".lut"));
152  string pta_file = lut_f.fullPath();
153 
154  // open file
155  L1TriggerLutFile file(pta_file);
156  if ( file.open() != 0 ) return -1;
157  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
158  // << file.getName() << endl;
159 
160  // get the right shift factor
161  int shift = sh_phi;
162  int adr_old = -2048 >> shift;
163 
164  LUT tmplut;
165 
166  int number = -1;
167  int sum_pt = 0;
168 
169  if ( file.good() ) {
170  int threshold = file.readInteger();
171  pta_threshold[pam/2] = threshold;
172  }
173 
174  // read values and shift to correct precision
175  while ( file.good() ) {
176 
177  int adr = (file.readInteger()) >> shift;
178  int pt = file.readInteger();
179 
180  number++;
181 
182  if ( adr != adr_old ) {
183  tmplut.insert(make_pair( adr_old, (sum_pt/number) ));
184 
185  adr_old = adr;
186  number = 0;
187  sum_pt = 0;
188  }
189 
190  sum_pt += pt;
191 
192  if ( !file.good() ) file.close();
193 
194  }
195 
196  file.close();
197  pta_lut.push_back(tmplut);
198  }
199  return 0;
200 
201 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:74
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:75
unsigned short int nbit_phi
Definition: L1MuDTPtaLut.h:77
static unsigned int const shift
std::string fullPath() const
Definition: FileInPath.cc:171
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:34
const int MAX_PTASSMETH
void L1MuDTPtaLut::print ( void  ) const

print pt-assignment look-up tables

Definition at line 207 of file L1MuDTPtaLut.cc.

References abs, gather_cfg::cout, end, getPtLutThreshold(), i, MAX_PTASSMETH, nbit_phi, DTTFBitArray< N >::print(), pta_lut, DTTFBitArray< N >::twoComplement(), and relativeConstraints::value.

207  {
208 
209  cout << endl;
210  cout << "L1 barrel Track Finder Pt-Assignment look-up tables :" << endl;
211  cout << "=====================================================" << endl;
212  cout << endl;
213  cout << "Precision : " << endl;
214  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
215 
216  // loop over all pt-assignment methods
217  for ( int pam = 0; pam < MAX_PTASSMETH; pam++ ) {
218 
219  cout << endl;
220  cout << "Pt-Assignment Method : " << static_cast<PtAssMethod>(pam) << endl;
221  cout << "============================" << endl;
222  cout << endl;
223 
224  cout << "\t Threshold : " << getPtLutThreshold(pam/2) << endl << endl;
225 
226  int maxbits = nbit_phi;
227 
228  cout << " address";
229  for ( int i = 0; i < maxbits; i++ ) cout << ' ';
230  cout << " value" << endl;
231  for ( int i = 0; i < maxbits; i++ ) cout << '-';
232  cout << "-------------------------" << endl;
233 
234  LUT::const_iterator iter = pta_lut[pam].begin();
235  while ( iter != pta_lut[pam].end() ) {
236  int address = (*iter).first;
237  int value = (*iter).second;
238 
239  DTTFBitArray<12> b_address(static_cast<unsigned>(abs(address)));
240  DTTFBitArray<5> b_value(static_cast<unsigned>(abs(value)));
241 
242  if ( address < 0 ) b_address.twoComplement();
243 
244  cout.setf(ios::right,ios::adjustfield);
245  cout << " " << setbase(10) << setw(5) << address << " (";
246  for ( int i = maxbits-1; i >= 0; i-- ) cout << b_address[i];
247  cout << ") " << setw(3) << value << " (";
248  b_value.print();
249  cout << ")" << endl;
250 
251  iter++;
252  }
253 
254  }
255 
256  cout << endl;
257 
258 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:74
int i
Definition: DBlmapReader.cc:9
char * address
Definition: mlp_lapack.h:14
#define abs(x)
Definition: mlp_lapack.h:159
#define end
Definition: vmac.h:38
unsigned short int nbit_phi
Definition: L1MuDTPtaLut.h:77
tuple cout
Definition: gather_cfg.py:121
int getPtLutThreshold(int pta_ind) const
get pt-assignment LUT threshold
const int MAX_PTASSMETH
PtAssMethod
void L1MuDTPtaLut::reset ( void  )

reset pt-assignment look-up tables

Definition at line 93 of file L1MuDTPtaLut.cc.

References pta_lut, and pta_threshold.

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

93  {
94 
95  pta_lut.clear();
96  pta_threshold.clear();
97 
98 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:74
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:75
void L1MuDTPtaLut::setPrecision ( )
private

set precision for look-up tables

Definition at line 297 of file L1MuDTPtaLut.cc.

References nbit_phi.

Referenced by L1MuDTPtaLut().

297  {
298 
299  nbit_phi = 12;
300 
301 }
unsigned short int nbit_phi
Definition: L1MuDTPtaLut.h:77

Member Data Documentation

unsigned short int L1MuDTPtaLut::nbit_phi
private

Definition at line 77 of file L1MuDTPtaLut.h.

Referenced by load(), print(), and setPrecision().

std::vector<LUT> L1MuDTPtaLut::pta_lut
private

Definition at line 74 of file L1MuDTPtaLut.h.

Referenced by getPt(), L1MuDTPtaLut(), load(), print(), reset(), and ~L1MuDTPtaLut().

std::vector<int> L1MuDTPtaLut::pta_threshold
private

Definition at line 75 of file L1MuDTPtaLut.h.

Referenced by getPtLutThreshold(), L1MuDTPtaLut(), load(), reset(), and ~L1MuDTPtaLut().