CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
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

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
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
 

Friends

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

Detailed Description

Look-up tables for pt-assignment

Date
2007/03/30 07:48:02
Revision
1.1

N. Neumeister CERN EP

Definition at line 39 of file L1MuDTPtaLut.h.

Member Typedef Documentation

◆ LUT

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

Definition at line 67 of file L1MuDTPtaLut.h.

Constructor & Destructor Documentation

◆ L1MuDTPtaLut()

L1MuDTPtaLut::L1MuDTPtaLut ( )

constructor

Definition at line 52 of file L1MuDTPtaLut.cc.

53  pta_lut.reserve(MAX_PTASSMETH);
54  pta_threshold.reserve(MAX_PTASSMETH / 2);
55  setPrecision();
56 
57  // if ( load() != 0 ) {
58  // cout << "Can not open files to load pt-assignment look-up tables for DTTrackFinder!" << endl;
59  // }
60 
61  // if ( L1MuDTTFConfig::Debug(6) ) print();
62 }

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

◆ ~L1MuDTPtaLut()

L1MuDTPtaLut::~L1MuDTPtaLut ( )
virtual

destructor

Definition at line 68 of file L1MuDTPtaLut.cc.

68  {
69  vector<LUT>::iterator iter;
70  for (iter = pta_lut.begin(); iter != pta_lut.end(); iter++) {
71  (*iter).clear();
72  }
73 
74  pta_lut.clear();
75  pta_threshold.clear();
76 }

References pta_lut, and pta_threshold.

Member Function Documentation

◆ getPt()

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

get pt-value for a given address

Definition at line 334 of file L1MuDTPtaLut.cc.

334  {
335  LUT::const_iterator iter = pta_lut[pta_ind].find(address);
336  if (iter != pta_lut[pta_ind].end()) {
337  return (*iter).second;
338  } else {
339  cerr << "PtaLut::getPt : can not find address " << address << endl;
340  return 0;
341  }
342 }

References beam_dqm_sourceclient-live_cfg::cerr, end, and pta_lut.

Referenced by L1MuDTAssignmentUnit::PtAU().

◆ getPtLutThreshold()

int L1MuDTPtaLut::getPtLutThreshold ( int  pta_ind) const

get pt-assignment LUT threshold

Definition at line 347 of file L1MuDTPtaLut.cc.

347  {
348  if (pta_ind >= 0 && pta_ind < MAX_PTASSMETH / 2) {
349  return pta_threshold[pta_ind];
350  } else {
351  cerr << "PtaLut::getPtLutThreshold : can not find threshold " << pta_ind << endl;
352  return 0;
353  }
354 }

References beam_dqm_sourceclient-live_cfg::cerr, MAX_PTASSMETH, and pta_threshold.

Referenced by L1MuDTAssignmentUnit::getPtMethod(), and print().

◆ load()

int L1MuDTPtaLut::load ( )

load pt-assignment look-up tables

Definition at line 93 of file L1MuDTPtaLut.cc.

93  {
94  // get directory name
95  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
96  string pta_dir = "L1TriggerData/DTTrackFinder/Ass/";
97  string pta_str = "";
98 
99  // precision : in the look-up tables the following precision is used :
100  // phi ...12 bits (address) and pt ...5 bits
101  // now convert phi and phib to the required precision
102 
103  int sh_phi = 12 - nbit_phi;
104 
105  // loop over all pt-assignment methods
106  for (int pam = 0; pam < MAX_PTASSMETH; pam++) {
107  switch (pam) {
108  case PT12L: {
109  pta_str = "pta12l";
110  break;
111  }
112  case PT12H: {
113  pta_str = "pta12h";
114  break;
115  }
116  case PT13L: {
117  pta_str = "pta13l";
118  break;
119  }
120  case PT13H: {
121  pta_str = "pta13h";
122  break;
123  }
124  case PT14L: {
125  pta_str = "pta14l";
126  break;
127  }
128  case PT14H: {
129  pta_str = "pta14h";
130  break;
131  }
132  case PT23L: {
133  pta_str = "pta23l";
134  break;
135  }
136  case PT23H: {
137  pta_str = "pta23h";
138  break;
139  }
140  case PT24L: {
141  pta_str = "pta24l";
142  break;
143  }
144  case PT24H: {
145  pta_str = "pta24h";
146  break;
147  }
148  case PT34L: {
149  pta_str = "pta34l";
150  break;
151  }
152  case PT34H: {
153  pta_str = "pta34h";
154  break;
155  }
156  case PT12LO: {
157  pta_str = "pta12l_ovl";
158  break;
159  }
160  case PT12HO: {
161  pta_str = "pta12h_ovl";
162  break;
163  }
164  case PT13LO: {
165  pta_str = "pta13l_ovl";
166  break;
167  }
168  case PT13HO: {
169  pta_str = "pta13h_ovl";
170  break;
171  }
172  case PT14LO: {
173  pta_str = "pta14l_ovl";
174  break;
175  }
176  case PT14HO: {
177  pta_str = "pta14h_ovl";
178  break;
179  }
180  case PT23LO: {
181  pta_str = "pta23l_ovl";
182  break;
183  }
184  case PT23HO: {
185  pta_str = "pta23h_ovl";
186  break;
187  }
188  case PT24LO: {
189  pta_str = "pta24l_ovl";
190  break;
191  }
192  case PT24HO: {
193  pta_str = "pta24h_ovl";
194  break;
195  }
196  case PT34LO: {
197  pta_str = "pta34l_ovl";
198  break;
199  }
200  case PT34HO: {
201  pta_str = "pta34h_ovl";
202  break;
203  }
204  case PT15LO: {
205  pta_str = "pta15l_ovl";
206  break;
207  }
208  case PT15HO: {
209  pta_str = "pta15h_ovl";
210  break;
211  }
212  case PT25LO: {
213  pta_str = "pta25l_ovl";
214  break;
215  }
216  case PT25HO: {
217  pta_str = "pta25h_ovl";
218  break;
219  }
220  }
221 
222  // assemble file name
223  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + pta_dir + pta_str + ".lut"));
224  string pta_file = lut_f.fullPath();
225 
226  // open file
227  L1TriggerLutFile file(pta_file);
228  if (file.open() != 0)
229  return -1;
230  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
231  // << file.getName() << endl;
232 
233  // get the right shift factor
234  int shift = sh_phi;
235  int adr_old = -2048 >> shift;
236 
237  LUT tmplut;
238 
239  int number = -1;
240  int sum_pt = 0;
241 
242  if (file.good()) {
243  int threshold = file.readInteger();
244  pta_threshold[pam / 2] = threshold;
245  }
246 
247  // read values and shift to correct precision
248  while (file.good()) {
249  int adr = (file.readInteger()) >> shift;
250  int pt = file.readInteger();
251 
252  number++;
253 
254  if (adr != adr_old) {
255  assert(number);
256  tmplut.insert(make_pair(adr_old, (sum_pt / number)));
257 
258  adr_old = adr;
259  number = 0;
260  sum_pt = 0;
261  }
262 
263  sum_pt += pt;
264 
265  if (!file.good())
266  file.close();
267  }
268 
269  file.close();
270  pta_lut.push_back(tmplut);
271  }
272  return 0;
273 }

References cms::cuda::assert(), FrontierConditions_GlobalTag_cff::file, edm::FileInPath::fullPath(), MAX_PTASSMETH, nbit_phi, contentValuesFiles::number, DiDispStaMuonMonitor_cfi::pt, 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, edm::shift, and remoteMonitoring_LED_IterMethod_cfg::threshold.

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

◆ print()

void L1MuDTPtaLut::print ( void  ) const

print pt-assignment look-up tables

Definition at line 278 of file L1MuDTPtaLut.cc.

278  {
279  cout << endl;
280  cout << "L1 barrel Track Finder Pt-Assignment look-up tables :" << endl;
281  cout << "=====================================================" << endl;
282  cout << endl;
283  cout << "Precision : " << endl;
284  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
285 
286  // loop over all pt-assignment methods
287  for (int pam = 0; pam < MAX_PTASSMETH; pam++) {
288  cout << endl;
289  cout << "Pt-Assignment Method : " << static_cast<PtAssMethod>(pam) << endl;
290  cout << "============================" << endl;
291  cout << endl;
292 
293  cout << "\t Threshold : " << getPtLutThreshold(pam / 2) << endl << endl;
294 
295  int maxbits = nbit_phi;
296 
297  cout << " address";
298  for (int i = 0; i < maxbits; i++)
299  cout << ' ';
300  cout << " value" << endl;
301  for (int i = 0; i < maxbits; i++)
302  cout << '-';
303  cout << "-------------------------" << endl;
304 
305  LUT::const_iterator iter = pta_lut[pam].begin();
306  while (iter != pta_lut[pam].end()) {
307  int address = (*iter).first;
308  int value = (*iter).second;
309 
310  DTTFBitArray<12> b_address(static_cast<unsigned>(abs(address)));
311  DTTFBitArray<5> b_value(static_cast<unsigned>(abs(value)));
312 
313  if (address < 0)
314  b_address.twoComplement();
315 
316  cout.setf(ios::right, ios::adjustfield);
317  cout << " " << setbase(10) << setw(5) << address << " (";
318  for (int i = maxbits - 1; i >= 0; i--)
319  cout << b_address[i];
320  cout << ") " << setw(3) << value << " (";
321  b_value.print();
322  cout << ")" << endl;
323 
324  iter++;
325  }
326  }
327 
328  cout << endl;
329 }

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

◆ reset()

void L1MuDTPtaLut::reset ( void  )

reset pt-assignment look-up tables

Definition at line 85 of file L1MuDTPtaLut.cc.

85  {
86  pta_lut.clear();
87  pta_threshold.clear();
88 }

References pta_lut, and pta_threshold.

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

◆ serialize()

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

◆ setPrecision()

void L1MuDTPtaLut::setPrecision ( )
private

set precision for look-up tables

Definition at line 359 of file L1MuDTPtaLut.cc.

359 { nbit_phi = 12; }

References nbit_phi.

Referenced by L1MuDTPtaLut().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 74 of file L1MuDTPtaLut.h.

◆ cond::serialization::access

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

Definition at line 74 of file L1MuDTPtaLut.h.

Member Data Documentation

◆ nbit_phi

unsigned short int L1MuDTPtaLut::nbit_phi
private

Definition at line 72 of file L1MuDTPtaLut.h.

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

◆ pta_lut

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

Definition at line 69 of file L1MuDTPtaLut.h.

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

◆ pta_threshold

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

Definition at line 70 of file L1MuDTPtaLut.h.

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

PT12HO
Definition: L1MuDTAssParam.h:37
mps_fire.i
i
Definition: mps_fire.py:355
PT14HO
Definition: L1MuDTAssParam.h:41
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
DTTFBitArray
Definition: DTTFBitArray.h:28
PT24HO
Definition: L1MuDTAssParam.h:45
L1MuDTPtaLut::pta_threshold
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:70
L1TriggerLutFile
Definition: L1TriggerLutFile.h:37
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PT14H
Definition: L1MuDTAssParam.h:29
cms::cuda::assert
assert(be >=bs)
end
#define end
Definition: vmac.h:39
PT34LO
Definition: L1MuDTAssParam.h:46
PT15HO
Definition: L1MuDTAssParam.h:49
edm::FileInPath
Definition: FileInPath.h:64
PT24L
Definition: L1MuDTAssParam.h:32
PT23LO
Definition: L1MuDTAssParam.h:42
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
PT23H
Definition: L1MuDTAssParam.h:31
L1MuDTPtaLut::getPtLutThreshold
int getPtLutThreshold(int pta_ind) const
get pt-assignment LUT threshold
Definition: L1MuDTPtaLut.cc:347
PT23HO
Definition: L1MuDTAssParam.h:43
L1MuDTPtaLut::pta_lut
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:69
PT12L
Definition: L1MuDTAssParam.h:24
PT12LO
Definition: L1MuDTAssParam.h:36
PT13LO
Definition: L1MuDTAssParam.h:38
PT24LO
Definition: L1MuDTAssParam.h:44
PT34L
Definition: L1MuDTAssParam.h:34
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
PT13HO
Definition: L1MuDTAssParam.h:39
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
value
Definition: value.py:1
PT34HO
Definition: L1MuDTAssParam.h:47
PT13H
Definition: L1MuDTAssParam.h:27
PT13L
Definition: L1MuDTAssParam.h:26
L1MuDTPtaLut::nbit_phi
unsigned short int nbit_phi
Definition: L1MuDTPtaLut.h:72
PT23L
Definition: L1MuDTAssParam.h:30
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
LUT
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31
L1MuDTPtaLut::setPrecision
void setPrecision()
set precision for look-up tables
Definition: L1MuDTPtaLut.cc:359
PT12H
Definition: L1MuDTAssParam.h:25
PT34H
Definition: L1MuDTAssParam.h:35
MAX_PTASSMETH
const int MAX_PTASSMETH
Definition: L1MuDTAssParam.h:20
PT25LO
Definition: L1MuDTAssParam.h:50
PT15LO
Definition: L1MuDTAssParam.h:48
PT25HO
Definition: L1MuDTAssParam.h:51
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PT24H
Definition: L1MuDTAssParam.h:33
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
PT14L
Definition: L1MuDTAssParam.h:28
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
PT14LO
Definition: L1MuDTAssParam.h:40