CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends
L1MuDTExtLut Class Reference

#include <L1MuDTExtLut.h>

Classes

class  LUT
 helper class for look-up tables More...
 

Public Member Functions

int getHigh (int ext_ind, int address) const
 get high_value for a given address More...
 
int getLow (int ext_ind, int address) const
 get low_value for a given address More...
 
 L1MuDTExtLut ()
 constructor More...
 
int load ()
 load extrapolation look-up tables More...
 
void print () const
 print extrapolation look-up tables More...
 
void reset ()
 reset extrapolation look-up tables More...
 
virtual ~L1MuDTExtLut ()
 destructor More...
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
void setPrecision ()
 set precision for look-up tables More...
 

Private Attributes

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

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Look-up tables for extrapolation

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

N. Neumeister CERN EP

Definition at line 39 of file L1MuDTExtLut.h.

Constructor & Destructor Documentation

◆ L1MuDTExtLut()

L1MuDTExtLut::L1MuDTExtLut ( )

constructor

Definition at line 52 of file L1MuDTExtLut.cc.

52  {
53  ext_lut.reserve(MAX_EXT);
54  setPrecision();
55  // if ( load() != 0 ) {
56  // cout << "Can not open files to load extrapolation look-up tables for DTTrackFinder!" << endl;
57  // }
58 
59  // if ( L1MuDTTFConfig::Debug(6) ) print();
60 }

References MAX_EXT.

◆ ~L1MuDTExtLut()

L1MuDTExtLut::~L1MuDTExtLut ( )
virtual

destructor

Definition at line 66 of file L1MuDTExtLut.cc.

66  {
67  typedef vector<LUT>::iterator LI;
68  for (LI iter = ext_lut.begin(); iter != ext_lut.end(); iter++) {
69  (*iter).low.clear();
70  (*iter).high.clear();
71  }
72 
73  ext_lut.clear();
74 }

Member Function Documentation

◆ getHigh()

int L1MuDTExtLut::getHigh ( int  ext_ind,
int  address 
) const

get high_value for a given address

Definition at line 277 of file L1MuDTExtLut.cc.

277  {
278  LUT::LUTmap::const_iterator iter = ext_lut[ext_ind].high.find(address);
279  if (iter != ext_lut[ext_ind].high.end()) {
280  return (*iter).second;
281  } else {
282  cerr << "ExtLut::getHigh : can not find address " << address << endl;
283  return 99999;
284  }
285 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and LaserClient_cfi::high.

Referenced by L1MuDTEUX::run().

◆ getLow()

int L1MuDTExtLut::getLow ( int  ext_ind,
int  address 
) const

get low_value for a given address

Definition at line 264 of file L1MuDTExtLut.cc.

264  {
265  LUT::LUTmap::const_iterator iter = ext_lut[ext_ind].low.find(address);
266  if (iter != ext_lut[ext_ind].low.end()) {
267  return (*iter).second;
268  } else {
269  cerr << "ExtLut::getLow : can not find address " << address << endl;
270  return 99999;
271  }
272 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and LaserClient_cfi::low.

Referenced by L1MuDTEUX::run().

◆ load()

int L1MuDTExtLut::load ( )

load extrapolation look-up tables

Definition at line 88 of file L1MuDTExtLut.cc.

88  {
89  // get directory name
90  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
91  string ext_dir = "L1TriggerData/DTTrackFinder/Ext/";
92  string ext_str = "";
93 
94  // precision : in the look-up tables the following precision is used :
95  // phi ...12 bits (low, high), phib ...10 bits (address)
96  // now convert phi and phib to the required precision
97 
98  int sh_phi = 12 - nbit_phi;
99  int sh_phib = 10 - nbit_phib;
100 
101  // loop over all extrapolations
102  for (int ext = 0; ext < MAX_EXT; ext++) {
103  switch (ext) {
104  case EX12:
105  ext_str = "ext12";
106  break;
107  case EX13:
108  ext_str = "ext13";
109  break;
110  case EX14:
111  ext_str = "ext14";
112  break;
113  case EX21:
114  ext_str = "ext21";
115  break;
116  case EX23:
117  ext_str = "ext23";
118  break;
119  case EX24:
120  ext_str = "ext24";
121  break;
122  case EX34:
123  ext_str = "ext34";
124  break;
125  case EX15:
126  ext_str = "ext15";
127  break;
128  case EX16:
129  ext_str = "ext16";
130  break;
131  case EX25:
132  ext_str = "ext25";
133  break;
134  case EX26:
135  ext_str = "ext26";
136  break;
137  case EX56:
138  ext_str = "ext56";
139  break;
140  }
141 
142  // assemble file name
143  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + ext_dir + ext_str + ".lut"));
144  string ext_file = lut_f.fullPath();
145 
146  // open file
147  L1TriggerLutFile file(ext_file);
148  if (file.open() != 0)
149  return -1;
150  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
151  // << file.getName() << endl;
152 
153  LUT tmplut;
154 
155  int number = -1;
156  int adr_old = -512 >> sh_phib;
157  int sum_low = 0;
158  int sum_high = 0;
159 
160  // read values and shift to correct precision
161  while (file.good()) {
162  int adr = (file.readInteger()) >> sh_phib; // address (phib)
163  int low = (file.readInteger()); // low value (phi)
164  int high = (file.readInteger()); // high value (phi)
165 
166  number++;
167 
168  if (adr != adr_old) {
169  tmplut.low[adr_old] = sum_low >> sh_phi;
170  tmplut.high[adr_old] = sum_high >> sh_phi;
171 
172  adr_old = adr;
173  number = 0;
174  sum_low = 0;
175  sum_high = 0;
176  }
177 
178  if (number == 0)
179  sum_low = low;
180  if (number == 0)
181  sum_high = high;
182 
183  if (!file.good())
184  file.close();
185  }
186 
187  file.close();
188  ext_lut.push_back(tmplut);
189  }
190  return 0;
191 }

References EX12, EX13, EX14, EX15, EX16, EX21, EX23, EX24, EX25, EX26, EX34, EX56, geometryDiff::file, edm::FileInPath::fullPath(), L1MuDTExtLut::LUT::high, LaserClient_cfi::high, L1MuDTExtLut::LUT::low, LaserClient_cfi::low, MAX_EXT, and contentValuesFiles::number.

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

◆ print()

void L1MuDTExtLut::print ( void  ) const

print extrapolation look-up tables

Definition at line 196 of file L1MuDTExtLut.cc.

196  {
197  cout << endl;
198  cout << "L1 barrel Track Finder Extrapolation look-up tables :" << endl;
199  cout << "=====================================================" << endl;
200  cout << endl;
201  cout << "Precision : " << endl;
202  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
203  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
204 
205  // loop over all extrapolations
206  for (int ext = 0; ext < MAX_EXT; ext++) {
207  cout << endl;
208  cout << "Extrapolation : " << static_cast<Extrapolation>(ext) << endl;
209  cout << "====================" << endl;
210  cout << endl;
211 
212  cout << " address";
213  for (int i = 0; i < nbit_phib; i++)
214  cout << ' ';
215  cout << " low-value";
216  for (int i = 0; i < nbit_phi; i++)
217  cout << ' ';
218  cout << " high-value " << endl;
219  for (int i = 0; i < 2 * nbit_phi + nbit_phib; i++)
220  cout << '-';
221  cout << "---------------------------------" << endl;
222 
223  LUT::LUTmap::const_iterator iter = ext_lut[ext].low.begin();
224  LUT::LUTmap::const_iterator iter1;
225  while (iter != ext_lut[ext].low.end()) {
226  int address = (*iter).first;
227  int low = (*iter).second;
228  iter1 = ext_lut[ext].high.find(address);
229  int high = (*iter1).second;
230 
231  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
232  DTTFBitArray<12> b_low(static_cast<unsigned>(abs(low)));
233  DTTFBitArray<12> b_high(static_cast<unsigned>(abs(high)));
234 
235  if (address < 0)
236  b_address.twoComplement();
237  if (low < 0)
238  b_low.twoComplement();
239  if (high < 0)
240  b_high.twoComplement();
241 
242  cout.setf(ios::right, ios::adjustfield);
243  cout << " " << setbase(10) << setw(5) << address << " (";
244  for (int i = nbit_phib - 1; i >= 0; i--)
245  cout << b_address[i];
246  cout << ") " << setw(5) << low << " (";
247  for (int i = nbit_phi - 1; i >= 0; i--)
248  cout << b_low[i];
249  cout << ") " << setw(5) << high << " (";
250  for (int i = nbit_phi - 1; i >= 0; i--)
251  cout << b_high[i];
252  cout << ") " << endl;
253 
254  iter++;
255  }
256  }
257 
258  cout << endl;
259 }

References funct::abs(), gather_cfg::cout, LaserClient_cfi::high, mps_fire::i, LaserClient_cfi::low, MAX_EXT, and DTTFBitArray< N >::twoComplement().

◆ reset()

void L1MuDTExtLut::reset ( void  )

reset extrapolation look-up tables

Definition at line 83 of file L1MuDTExtLut.cc.

83 { ext_lut.clear(); }

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

◆ serialize()

template<class Archive >
void L1MuDTExtLut::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setPrecision()

void L1MuDTExtLut::setPrecision ( )
private

set precision for look-up tables

Definition at line 290 of file L1MuDTExtLut.cc.

290  {
291  nbit_phi = 12;
292  nbit_phib = 10;
293 }

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 83 of file L1MuDTExtLut.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 83 of file L1MuDTExtLut.h.

Member Data Documentation

◆ ext_lut

std::vector<LUT> L1MuDTExtLut::ext_lut
private

Definition at line 78 of file L1MuDTExtLut.h.

◆ nbit_phi

unsigned short int L1MuDTExtLut::nbit_phi
private

Definition at line 80 of file L1MuDTExtLut.h.

◆ nbit_phib

unsigned short int L1MuDTExtLut::nbit_phib
private

Definition at line 81 of file L1MuDTExtLut.h.

ext
Definition: memstream.h:15
L1MuDTExtLut::setPrecision
void setPrecision()
set precision for look-up tables
Definition: L1MuDTExtLut.cc:290
mps_fire.i
i
Definition: mps_fire.py:428
MAX_EXT
const int MAX_EXT
Definition: L1MuDTExtParam.h:19
EX13
Definition: L1MuDTExtParam.h:22
DTTFBitArray
Definition: DTTFBitArray.h:28
L1TriggerLutFile
Definition: L1TriggerLutFile.h:37
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EX34
Definition: L1MuDTExtParam.h:22
EX15
Definition: L1MuDTExtParam.h:22
edm::FileInPath
Definition: FileInPath.h:61
EX26
Definition: L1MuDTExtParam.h:22
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
EX56
Definition: L1MuDTExtParam.h:22
L1MuDTExtLut::nbit_phi
unsigned short int nbit_phi
Definition: L1MuDTExtLut.h:80
EX21
Definition: L1MuDTExtParam.h:22
geometryDiff.file
file
Definition: geometryDiff.py:13
EX23
Definition: L1MuDTExtParam.h:22
EX12
Definition: L1MuDTExtParam.h:22
EX25
Definition: L1MuDTExtParam.h:22
EX24
Definition: L1MuDTExtParam.h:22
EX16
Definition: L1MuDTExtParam.h:22
LaserClient_cfi.high
high
Definition: LaserClient_cfi.py:50
LUT
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31
EX14
Definition: L1MuDTExtParam.h:22
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuDTExtLut::ext_lut
std::vector< LUT > ext_lut
Definition: L1MuDTExtLut.h:78
L1MuDTExtLut::nbit_phib
unsigned short int nbit_phib
Definition: L1MuDTExtLut.h:81
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161