CMS 3D CMS Logo

GlobalScales.cc
Go to the documentation of this file.
13 
14 #include <iostream>
15 #include <fstream>
16 #include <iomanip>
17 
20 
21 // constructor
23 
24 // destructor
26 
27 std::string l1t::GlobalScales::getScalesName() const { return m_ScaleSetName; }
28 
29 void l1t::GlobalScales::setLUT_CalMuEta(const std::string& lutName, std::vector<long long> lut) {
30  if (m_lut_CalMuEta.count(lutName) != 0) {
31  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
32  << std::endl;
33  return;
34  }
35 
36  // Insert this LUT into the Table
37  m_lut_CalMuEta.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
38 
39  return;
40 }
41 
42 void l1t::GlobalScales::setLUT_CalMuPhi(const std::string& lutName, std::vector<long long> lut) {
43  if (m_lut_CalMuPhi.count(lutName) != 0) {
44  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
45  << std::endl;
46  return;
47  }
48 
49  // Insert this LUT into the Table
50  m_lut_CalMuPhi.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
51 
52  return;
53 }
54 
56  std::vector<long long> lut,
57  unsigned int precision) {
58  if (m_lut_DeltaEta.count(lutName) != 0) {
59  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
60  << std::endl;
61  return;
62  }
63 
64  // Insert this LUT into the Table
65  m_lut_DeltaEta.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
66  m_Prec_DeltaEta.insert(std::map<std::string, unsigned int>::value_type(lutName, precision));
67 
68  return;
69 }
70 
72  std::vector<long long> lut,
73  unsigned int precision) {
74  if (m_lut_DeltaPhi.count(lutName) != 0) {
75  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
76  << std::endl;
77  return;
78  }
79 
80  // Insert this LUT into the Table
81  m_lut_DeltaPhi.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
82  m_Prec_DeltaPhi.insert(std::map<std::string, unsigned int>::value_type(lutName, precision));
83 
84  return;
85 }
86 
87 void l1t::GlobalScales::setLUT_Pt(const std::string& lutName, std::vector<long long> lut, unsigned int precision) {
88  if (m_lut_Pt.count(lutName) != 0) {
89  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
90  << std::endl;
91  return;
92  }
93 
94  // Insert this LUT into the Table
95  m_lut_Pt.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
97 
98  return;
99 }
100 
101 // Added for displaced muons
102 void l1t::GlobalScales::setLUT_Upt(const std::string& lutName, std::vector<long long> lut, unsigned int precision) {
103  if (m_lut_Upt.count(lutName) != 0) {
104  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
105  << std::endl;
106  return;
107  }
108 
109  // Insert this LUT into the Table
110  m_lut_Upt.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
111  m_Prec_Upt.insert(std::map<std::string, unsigned int>::value_type(lutName, precision));
112 
113  return;
114 }
115 
116 void l1t::GlobalScales::setLUT_Cosh(const std::string& lutName, std::vector<long long> lut, unsigned int precision) {
117  if (m_lut_Cosh.count(lutName) != 0) {
118  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
119  << std::endl;
120  return;
121  }
122 
123  // Insert this LUT into the Table
124  m_lut_Cosh.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
125  m_Prec_Cosh.insert(std::map<std::string, unsigned int>::value_type(lutName, precision));
126 
127  return;
128 }
129 
130 void l1t::GlobalScales::setLUT_Cos(const std::string& lutName, std::vector<long long> lut, unsigned int precision) {
131  if (m_lut_Cos.count(lutName) != 0) {
132  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
133  << std::endl;
134  return;
135  }
136 
137  // Insert this LUT into the Table
138  m_lut_Cos.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
139  m_Prec_Cos.insert(std::map<std::string, unsigned int>::value_type(lutName, precision));
140 
141  return;
142 }
143 
144 void l1t::GlobalScales::setLUT_Sin(const std::string& lutName, std::vector<long long> lut, unsigned int precision) {
145  if (m_lut_Sin.count(lutName) != 0) {
146  LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!"
147  << std::endl;
148  return;
149  }
150 
151  // Insert this LUT into the Table
152  m_lut_Sin.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut));
153  m_Prec_Sin.insert(std::map<std::string, unsigned int>::value_type(lutName, precision));
154 
155  return;
156 }
157 
158 long long l1t::GlobalScales::getLUT_CalMuEta(const std::string& lutName, int element) const {
159  long long value = 0;
160 
161  if (element < 0) {
162  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for CalMuEta LUT ( "
163  << lutName << ")" << std::endl;
164  } else if (element >= (int)m_lut_CalMuEta.find(lutName)->second.size()) {
165  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for CalMuEta LUT ("
166  << lutName << ") size = " << m_lut_CalMuEta.find(lutName)->second.size() << std::endl;
167  } else {
168  value = m_lut_CalMuEta.find(lutName)->second.at(element);
169  }
170  return value;
171 }
172 
173 long long l1t::GlobalScales::getLUT_CalMuPhi(const std::string& lutName, int element) const {
174  long long value = 0;
175 
176  if (element < 0) {
177  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for CalMuPhi LUT ( "
178  << lutName << ")" << std::endl;
179  } else if (element >= (int)m_lut_CalMuPhi.find(lutName)->second.size()) {
180  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for CalMuPhi LUT ("
181  << lutName << ") size = " << m_lut_CalMuPhi.find(lutName)->second.size() << std::endl;
182  } else {
183  value = m_lut_CalMuPhi.find(lutName)->second.at(element);
184  }
185  return value;
186 }
187 
188 long long l1t::GlobalScales::getLUT_DeltaEta(std::string lutName, int element) const {
189  long long value = 0;
190 
191  //first check whether this LUT exists
192  if (m_lut_DeltaEta.find(lutName) == m_lut_DeltaEta.end()) {
193  //does not exist. Check for oppoisite ordering
194  std::size_t pos = lutName.find('-');
195  std::string name = lutName.substr(pos + 1);
196  name += "-";
197  name += lutName.substr(0, pos);
198 
199  //check again
200  if (m_lut_DeltaEta.find(name) == m_lut_DeltaEta.end()) {
201  edm::LogError("GlobalScales") << "Warning: No LUT by name " << lutName << " or " << name << " exists! "
202  << std::endl;
203  return value;
204  } else {
205  lutName = name;
206  }
207  }
208 
209  if (element < 0) {
210  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for DeltaEta LUT ( "
211  << lutName << ")" << std::endl;
212  } else if (element >= (int)m_lut_DeltaEta.find(lutName)->second.size()) {
213  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for DeltaEta LUT ("
214  << lutName << ") size = " << m_lut_DeltaEta.find(lutName)->second.size() << std::endl;
215  } else {
216  value = m_lut_DeltaEta.find(lutName)->second.at(element);
217  }
218  return value;
219 }
220 unsigned int l1t::GlobalScales::getPrec_DeltaEta(const std::string& lutName) const {
221  unsigned int value = 0;
222 
223  if (m_Prec_DeltaEta.find(lutName) != m_Prec_DeltaEta.end()) {
224  value = m_Prec_DeltaEta.find(lutName)->second;
225  } else {
226  //does not exist. Check for oppoisite ordering
227  std::size_t pos = lutName.find('-');
228  std::string name = lutName.substr(pos + 1);
229  name += "-";
230  name += lutName.substr(0, pos);
231 
232  //check again
233  if (m_Prec_DeltaEta.find(name) != m_Prec_DeltaEta.end()) {
234  value = m_Prec_DeltaEta.find(name)->second;
235  } else {
236  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for DeltaEta not found" << std::endl;
237  }
238  }
239  return value;
240 }
241 
242 long long l1t::GlobalScales::getLUT_DeltaPhi(std::string lutName, int element) const {
243  long long value = 0;
244 
245  //first check whether this LUT exists
246  if (m_lut_DeltaPhi.find(lutName) == m_lut_DeltaPhi.end()) {
247  //does not exist. Check for oppoisite ordering
248  std::size_t pos = lutName.find('-');
249  std::string name = lutName.substr(pos + 1);
250  name += "-";
251  name += lutName.substr(0, pos);
252 
253  //check again
254  if (m_lut_DeltaPhi.find(name) == m_lut_DeltaPhi.end()) {
255  edm::LogError("GlobalScales") << "Warning: No LUT by name " << lutName << " or " << name << " exists! "
256  << std::endl;
257  return value;
258  } else {
259  lutName = name;
260  }
261  }
262 
263  if (element < 0) {
264  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for DeltaPhi LUT ( "
265  << lutName << ")" << std::endl;
266  } else if (element >= (int)m_lut_DeltaPhi.find(lutName)->second.size()) {
267  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for DeltaPhi LUT ("
268  << lutName << ") size = " << m_lut_DeltaPhi.find(lutName)->second.size() << std::endl;
269  } else {
270  value = m_lut_DeltaPhi.find(lutName)->second.at(element);
271  }
272  return value;
273 }
274 unsigned int l1t::GlobalScales::getPrec_DeltaPhi(const std::string& lutName) const {
275  unsigned int value = 0;
276 
277  if (m_Prec_DeltaPhi.find(lutName) != m_Prec_DeltaPhi.end()) {
278  value = m_Prec_DeltaPhi.find(lutName)->second;
279  } else {
280  //does not exist. Check for oppoisite ordering
281  std::size_t pos = lutName.find('-');
282  std::string name = lutName.substr(pos + 1);
283  name += "-";
284  name += lutName.substr(0, pos);
285 
286  //check again
287  if (m_Prec_DeltaPhi.find(name) != m_Prec_DeltaPhi.end()) {
288  value = m_Prec_DeltaPhi.find(name)->second;
289  } else {
290  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for DeltaPhi not found" << std::endl;
291  }
292  }
293  return value;
294 }
295 
296 long long l1t::GlobalScales::getLUT_Pt(const std::string& lutName, int element) const {
297  long long value = 0;
298 
299  if (element < 0) {
300  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Pt LUT ( " << lutName
301  << ")" << std::endl;
302  } else if (element >= (int)m_lut_Pt.find(lutName)->second.size()) {
303  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Pt LUT (" << lutName
304  << ") size = " << m_lut_Pt.find(lutName)->second.size() << std::endl;
305  } else {
306  value = m_lut_Pt.find(lutName)->second.at(element);
307  }
308  return value;
309 }
310 unsigned int l1t::GlobalScales::getPrec_Pt(const std::string& lutName) const {
311  unsigned int value = 0;
312 
313  if (m_Prec_Pt.find(lutName) != m_Prec_Pt.end()) {
314  value = m_Prec_Pt.find(lutName)->second;
315  } else {
316  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Pt not found" << std::endl;
317  }
318  return value;
319 }
320 
321 // Added for displaced muons
322 long long l1t::GlobalScales::getLUT_Upt(const std::string& lutName, int element) const {
323  long long value = 0;
324 
325  if (element < 0) {
326  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Upt LUT ( " << lutName
327  << ")" << std::endl;
328  } else if (element >= (int)m_lut_Upt.find(lutName)->second.size()) {
329  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Upt LUT (" << lutName
330  << ") size = " << m_lut_Upt.find(lutName)->second.size() << std::endl;
331  } else {
332  value = m_lut_Upt.find(lutName)->second.at(element);
333  }
334  return value;
335 }
336 // Added for displaced muons
337 unsigned int l1t::GlobalScales::getPrec_Upt(const std::string& lutName) const {
338  unsigned int value = 0;
339 
340  if (m_Prec_Upt.find(lutName) != m_Prec_Upt.end()) {
341  value = m_Prec_Upt.find(lutName)->second;
342  } else {
343  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Upt not found" << std::endl;
344  }
345  return value;
346 }
347 
348 long long l1t::GlobalScales::getLUT_DeltaEta_Cosh(std::string lutName, int element) const {
349  long long value = 0;
350 
351  //first check whether this LUT exists
352  if (m_lut_Cosh.find(lutName) == m_lut_Cosh.end()) {
353  //does not exist. Check for oppoisite ordering
354  std::size_t pos = lutName.find('-');
355  std::string name = lutName.substr(pos + 1);
356  name += "-";
357  name += lutName.substr(0, pos);
358 
359  //check again
360  if (m_lut_Cosh.find(name) == m_lut_Cosh.end()) {
361  edm::LogError("GlobalScales") << "Warning: No LUT by name " << lutName << " or " << name << " exists! "
362  << std::endl;
363  return value;
364  } else {
365  lutName = name;
366  }
367  }
368 
369  if (element < 0) {
370  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Cosh LUT ( " << lutName
371  << ")" << std::endl;
372  } else if (element >= (int)m_lut_Cosh.find(lutName)->second.size()) {
373  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Cosh LUT (" << lutName
374  << ") size = " << m_lut_Cosh.find(lutName)->second.size() << std::endl;
375  } else {
376  value = m_lut_Cosh.find(lutName)->second.at(element);
377  }
378  return value;
379 }
380 unsigned int l1t::GlobalScales::getPrec_DeltaEta_Cosh(const std::string& lutName) const {
381  unsigned int value = 0;
382 
383  if (m_Prec_Cosh.find(lutName) != m_Prec_Cosh.end()) {
384  value = m_Prec_Cosh.find(lutName)->second;
385  } else {
386  //does not exist. Check for oppoisite ordering
387  std::size_t pos = lutName.find('-');
388  std::string name = lutName.substr(pos + 1);
389  name += "-";
390  name += lutName.substr(0, pos);
391 
392  //check again
393  if (m_Prec_Cosh.find(name) != m_Prec_Cosh.end()) {
394  value = m_Prec_Cosh.find(name)->second;
395  } else {
396  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Cosh not found" << std::endl;
397  }
398  }
399  return value;
400 }
401 
402 long long l1t::GlobalScales::getLUT_DeltaPhi_Cos(std::string lutName, int element) const {
403  long long value = 0;
404 
405  //first check whether this LUT exists
406  if (m_lut_Cos.find(lutName) == m_lut_Cos.end()) {
407  //does not exist. Check for oppoisite ordering
408  std::size_t pos = lutName.find('-');
409  std::string name = lutName.substr(pos + 1);
410  name += "-";
411  name += lutName.substr(0, pos);
412 
413  //check again
414  if (m_lut_Cos.find(name) == m_lut_Cos.end()) {
415  edm::LogError("GlobalScales") << "Warning: No LUT by name " << lutName << " or " << name << " exists! "
416  << std::endl;
417  return value;
418  } else {
419  lutName = name;
420  }
421  }
422 
423  if (element < 0) {
424  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Cos LUT ( " << lutName
425  << ")" << std::endl;
426  } else if (element >= (int)m_lut_DeltaPhi.find(lutName)->second.size()) {
427  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Cos LUT (" << lutName
428  << ") size = " << m_lut_Cos.find(lutName)->second.size() << std::endl;
429  } else {
430  value = m_lut_Cos.find(lutName)->second.at(element);
431  }
432  return value;
433 }
434 
435 long long l1t::GlobalScales::getLUT_Cos(const std::string& lutName, int element) const {
436  long long value = 0;
437 
438  //first check whether this LUT exists
439  if (m_lut_Cos.find(lutName) == m_lut_Cos.end()) {
440  edm::LogError("GlobalScales") << "Warning: No LUT by name " << lutName << " exists! " << std::endl;
441  return value;
442  }
443 
444  if (element < 0) {
445  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Cos LUT ( " << lutName
446  << ")" << std::endl;
447  } else if (element >= (int)m_lut_Cos.find(lutName)->second.size()) {
448  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Cos LUT (" << lutName
449  << ") size = " << m_lut_Cos.find(lutName)->second.size() << std::endl;
450  } else {
451  value = m_lut_Cos.find(lutName)->second.at(element);
452  }
453  return value;
454 }
455 
456 long long l1t::GlobalScales::getLUT_Sin(const std::string& lutName, int element) const {
457  long long value = 0;
458 
459  //first check whether this LUT exists
460  if (m_lut_Sin.find(lutName) == m_lut_Sin.end()) {
461  edm::LogError("GlobalScales") << "Warning: No LUT by name " << lutName << " exists! " << std::endl;
462  return value;
463  }
464 
465  if (element < 0) {
466  edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Sin LUT ( " << lutName
467  << ")" << std::endl;
468  } else if (element >= (int)m_lut_Sin.find(lutName)->second.size()) {
469  edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Sin LUT (" << lutName
470  << ") size = " << m_lut_Sin.find(lutName)->second.size() << std::endl;
471  } else {
472  value = m_lut_Sin.find(lutName)->second.at(element);
473  }
474  return value;
475 }
476 
477 unsigned int l1t::GlobalScales::getPrec_DeltaPhi_Cos(const std::string& lutName) const {
478  unsigned int value = 0;
479 
480  if (m_Prec_Cos.find(lutName) != m_Prec_Cos.end()) {
481  value = m_Prec_Cos.find(lutName)->second;
482  } else {
483  //does not exist. Check for oppoisite ordering
484  std::size_t pos = lutName.find('-');
485  std::string name = lutName.substr(pos + 1);
486  name += "-";
487  name += lutName.substr(0, pos);
488 
489  //check again
490  if (m_Prec_Cos.find(name) != m_Prec_Cos.end()) {
491  value = m_Prec_Cos.find(name)->second;
492  } else {
493  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Cos not found" << std::endl;
494  }
495  }
496  return value;
497 }
498 
499 unsigned int l1t::GlobalScales::getPrec_Cos(const std::string& lutName) const {
500  unsigned int value = 0;
501 
502  if (m_Prec_Sin.find(lutName) != m_Prec_Sin.end()) {
503  value = m_Prec_Sin.find(lutName)->second;
504  } else {
505  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Sin not found" << std::endl;
506  }
507  return value;
508 }
509 
510 unsigned int l1t::GlobalScales::getPrec_Sin(const std::string& lutName) const {
511  unsigned int value = 0;
512 
513  if (m_Prec_Sin.find(lutName) != m_Prec_Sin.end()) {
514  value = m_Prec_Sin.find(lutName)->second;
515  } else {
516  edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Sin not found" << std::endl;
517  }
518  return value;
519 }
520 
521 void l1t::GlobalScales::dumpAllLUTs(std::ostream& myCout) const {
522  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_CalMuEta.begin();
523  itr != m_lut_CalMuEta.end();
524  itr++) {
525  dumpLUT(myCout, 1, itr->first);
526  }
527 
528  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_CalMuPhi.begin();
529  itr != m_lut_CalMuPhi.end();
530  itr++) {
531  dumpLUT(myCout, 2, itr->first);
532  }
533 
534  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_DeltaEta.begin();
535  itr != m_lut_DeltaEta.end();
536  itr++) {
537  dumpLUT(myCout, 3, itr->first);
538  }
539 
540  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_DeltaPhi.begin();
541  itr != m_lut_DeltaPhi.end();
542  itr++) {
543  dumpLUT(myCout, 4, itr->first);
544  }
545 
546  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Cosh.begin(); itr != m_lut_Cosh.end();
547  itr++) {
548  dumpLUT(myCout, 5, itr->first);
549  }
550 
551  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Cos.begin(); itr != m_lut_Cos.end();
552  itr++) {
553  dumpLUT(myCout, 6, itr->first);
554  }
555 
556  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Sin.begin(); itr != m_lut_Sin.end();
557  itr++) {
558  dumpLUT(myCout, 7, itr->first);
559  }
560 
561  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Pt.begin(); itr != m_lut_Pt.end();
562  itr++) {
563  dumpLUT(myCout, 8, itr->first);
564  }
565  // Added for displaced muons
566  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Upt.begin(); itr != m_lut_Upt.end();
567  itr++) {
568  dumpLUT(myCout, 8, itr->first);
569  }
570 }
571 
572 void l1t::GlobalScales::dumpLUT(std::ostream& myCout, int LUTtype, std::string name) const {
573  std::vector<long long> dumpV;
574  unsigned int prec = 0;
575  std::string type = "Null";
576  switch (LUTtype) {
577  case 1: {
578  dumpV = m_lut_CalMuEta.find(name)->second;
579  type = "Cal-Mu Eta";
580  break;
581  }
582  case 2: {
583  dumpV = m_lut_CalMuPhi.find(name)->second;
584  type = "Cal-Mu Phi";
585  break;
586  }
587  case 3: {
588  dumpV = m_lut_DeltaEta.find(name)->second;
589  prec = m_Prec_DeltaEta.find(name)->second;
590  type = "Delta Eta";
591  break;
592  }
593  case 4: {
594  dumpV = m_lut_DeltaPhi.find(name)->second;
595  prec = m_Prec_DeltaPhi.find(name)->second;
596  type = "Delta Phi";
597  break;
598  }
599  case 5: {
600  dumpV = m_lut_Cosh.find(name)->second;
601  prec = m_Prec_Cosh.find(name)->second;
602  type = "Cosh";
603  break;
604  }
605  case 6: {
606  dumpV = m_lut_Cos.find(name)->second;
607  prec = m_Prec_Cos.find(name)->second;
608  type = "Cos";
609  break;
610  }
611  case 7: {
612  dumpV = m_lut_Sin.find(name)->second;
613  prec = m_Prec_Sin.find(name)->second;
614  type = "Sin";
615  break;
616  }
617  case 8: {
618  dumpV = m_lut_Pt.find(name)->second;
619  prec = m_Prec_Pt.find(name)->second;
620  type = "Pt";
621  break;
622  }
623  case 9: { // Added for displaced muons
624  dumpV = m_lut_Upt.find(name)->second;
625  prec = m_Prec_Upt.find(name)->second;
626  type = "Upt";
627  break;
628  }
629  }
630 
631  myCout << "=========================================" << std::endl;
632  myCout << " LUT: " << type << " Table: " << name << " Size = " << dumpV.size() << " Precision " << prec
633  << std::endl;
634  myCout << "=========================================" << std::endl;
635  for (int i = 0; i < (int)dumpV.size(); i++) {
636  myCout << " Element " << i << " " << dumpV.at(i) << std::endl;
637  }
638 }
639 
640 void l1t::GlobalScales::print(std::ostream& myCout) const {
641  myCout << "\n ************* L1T Global Scales ************" << std::endl;
642 
643  myCout << " Muon Scales: " << std::endl;
644  printScale(m_muScales, myCout);
645 
646  myCout << " EG Scales: " << std::endl;
647  printScale(m_egScales, myCout);
648 
649  myCout << " Tau Scales: " << std::endl;
650  printScale(m_tauScales, myCout);
651 
652  myCout << " Jet Scales: " << std::endl;
653  printScale(m_jetScales, myCout);
654 
655  myCout << " HTT Scales: " << std::endl;
656  printScale(m_httScales, myCout);
657 
658  myCout << " ETT Scales: " << std::endl;
659  printScale(m_ettScales, myCout);
660 
661  myCout << " HTM Scales: " << std::endl;
662  printScale(m_htmScales, myCout);
663 
664  myCout << " ETM Scales: " << std::endl;
665  printScale(m_etmScales, myCout);
666 
667  myCout << std::endl;
668  myCout << " LUTs Stored: " << std::endl;
669  myCout << " CalMuEta:";
670  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_CalMuEta.begin();
671  itr != m_lut_CalMuEta.end();
672  itr++) {
673  myCout << " " << itr->first;
674  }
675  myCout << std::endl;
676 
677  myCout << " CalMuPhi:";
678  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_CalMuPhi.begin();
679  itr != m_lut_CalMuPhi.end();
680  itr++) {
681  myCout << " " << itr->first;
682  }
683  myCout << std::endl;
684 
685  myCout << " DeltaEta:";
686  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_DeltaEta.begin();
687  itr != m_lut_DeltaEta.end();
688  itr++) {
689  myCout << " " << itr->first;
690  }
691  myCout << std::endl;
692 
693  myCout << " DeltaPhi:";
694  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_DeltaPhi.begin();
695  itr != m_lut_DeltaPhi.end();
696  itr++) {
697  myCout << " " << itr->first;
698  }
699  myCout << std::endl;
700 
701  myCout << " Cos: ";
702  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Cos.begin(); itr != m_lut_Cos.end();
703  itr++) {
704  myCout << " " << itr->first;
705  }
706  myCout << std::endl;
707 
708  myCout << " Sin: ";
709  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Sin.begin(); itr != m_lut_Sin.end();
710  itr++) {
711  myCout << " " << itr->first;
712  }
713  myCout << std::endl;
714 
715  myCout << " Cosh: ";
716  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Cosh.begin(); itr != m_lut_Cosh.end();
717  itr++) {
718  myCout << " " << itr->first;
719  }
720  myCout << std::endl;
721 
722  myCout << " Pt: ";
723  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Pt.begin(); itr != m_lut_Pt.end();
724  itr++) {
725  myCout << " " << itr->first;
726  }
727  myCout << std::endl;
728 
729  // Added for displaced muons
730  myCout << " Upt: ";
731  for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Upt.begin(); itr != m_lut_Upt.end();
732  itr++) {
733  myCout << " " << itr->first;
734  }
735  myCout << std::endl;
736 }
737 void l1t::GlobalScales::printScale(ScaleParameters scale, std::ostream& myCout) const {
738  myCout << " Pt Min = " << std::setw(10) << scale.etMin << " Pt Max = " << std::setw(10) << scale.etMax
739  << " Pt Step = " << std::setw(10) << scale.etStep << " Number = " << std::setw(10)
740  << scale.etBins.size() << std::endl;
741  myCout << "\n";
742  for (int i = 0; i < int(scale.etBins.size()); i++) {
743  std::pair<double, double> binEdges = scale.etBins.at(i);
744  myCout << " etBins[" << i << "]\trange:\t" << binEdges.first << " - " << binEdges.second << std::endl;
745  }
746 
747  myCout << "\n Phi Min = " << std::setw(10) << scale.phiMin << " Phi Max = " << std::setw(10) << scale.phiMax
748  << " Phi Step = " << std::setw(10) << scale.phiStep << " Number = " << std::setw(10)
749  << scale.phiBins.size() << std::endl;
750  myCout << "\n";
751  for (int i = 0; i < int(scale.phiBins.size()); i++) {
752  std::pair<double, double> binEdges = scale.phiBins.at(i);
753  myCout << " phiBins[" << i << "]\trange:\t" << binEdges.first << " - " << binEdges.second << std::endl;
754  }
755 
756  myCout << "\n Eta Min = " << std::setw(10) << scale.etaMin << " Eta Max = " << std::setw(10) << scale.etaMax
757  << " Eta Step = " << std::setw(10) << scale.etaStep << " Number = " << std::setw(10)
758  << scale.etaBins.size() << std::endl;
759  myCout << "\n";
760  for (int i = 0; i < int(scale.etaBins.size()); i++) {
761  std::pair<double, double> binEdges = scale.etaBins.at(i);
762  myCout << " etaBins[" << i << "]\trange:\t" << binEdges.first << " - " << binEdges.second << std::endl;
763  }
764 }
long long getLUT_CalMuPhi(const std::string &lutName, int element) const
long long getLUT_DeltaPhi(std::string lutName, int element) const
unsigned int getPrec_Sin(const std::string &lutName) const
unsigned int getPrec_DeltaPhi(const std::string &lutName) const
virtual ~GlobalScales()
Definition: GlobalScales.cc:25
long long getLUT_DeltaEta_Cosh(std::string lutName, int element) const
virtual void printScale(ScaleParameters scale, std::ostream &myCout) const
unsigned int getPrec_DeltaPhi_Cos(const std::string &lutName) const
long long getLUT_Upt(const std::string &lutName, int element) const
virtual std::string getScalesName() const
Definition: GlobalScales.cc:27
virtual void setLUT_CalMuPhi(const std::string &lutName, std::vector< long long > lut)
Definition: GlobalScales.cc:42
virtual void setLUT_Upt(const std::string &lutName, std::vector< long long > lut, unsigned int precision)
virtual void setLUT_DeltaEta(const std::string &lutName, std::vector< long long > lut, unsigned int precision)
Definition: GlobalScales.cc:55
long long getLUT_Cos(const std::string &lutName, int element) const
Log< level::Error, false > LogError
#define LogTrace(id)
unsigned int getPrec_Pt(const std::string &lutName) const
long long getLUT_Pt(const std::string &lutName, int element) const
virtual void setLUT_Cos(const std::string &lutName, std::vector< long long > lut, unsigned int precision)
unsigned int getPrec_Cos(const std::string &lutName) const
Definition: value.py:1
virtual void dumpLUT(std::ostream &myCout, int LUTtype, std::string name) const
virtual void setLUT_Cosh(const std::string &lutName, std::vector< long long > lut, unsigned int precision)
long long getLUT_CalMuEta(const std::string &lutName, int element) const
virtual void setLUT_DeltaPhi(const std::string &lutName, std::vector< long long > lut, unsigned int precision)
Definition: GlobalScales.cc:71
unsigned int getPrec_DeltaEta(const std::string &lutName) const
long long getLUT_DeltaEta(std::string lutName, int element) const
long long getLUT_DeltaPhi_Cos(std::string lutName, int element) const
virtual void setLUT_Pt(const std::string &lutName, std::vector< long long > lut, unsigned int precision)
Definition: GlobalScales.cc:87
unsigned int getPrec_Upt(const std::string &lutName) const
typedef for a single object template
Definition: GlobalScales.h:35
unsigned int getPrec_DeltaEta_Cosh(const std::string &lutName) const
long long getLUT_Sin(const std::string &lutName, int element) const
virtual void print(std::ostream &myCout) const
virtual void setLUT_CalMuEta(const std::string &lutName, std::vector< long long > lut)
Definition: GlobalScales.cc:29
virtual void setLUT_Sin(const std::string &lutName, std::vector< long long > lut, unsigned int precision)
virtual void dumpAllLUTs(std::ostream &myCout) const