CMS 3D CMS Logo

L1GtPatternLine.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <sstream>
20 #include <iostream>
21 
22 // user include files
24 
26  std::string colName = nextName(prefix);
27  // add three values for each column - the full 32bit value,
28  // one for the lower 16 bits and one for the higher 16 bits.
29  m_columns[colName] = value;
30  m_columns[colName + "_h"] = value >> 16;
31  m_columns[colName + "_l"] = value & 0xFFFF;
32 }
33 
34 void L1GtPatternLine::set(const std::string& name, uint32_t value) {
35  ColumnMap::iterator it = m_columns.find(name);
36  if (it == m_columns.end()) {
37  throw cms::Exception(__func__) << "Can't set field " << name << " to " << std::hex << value << ": not found";
38  }
39 
40  it->second = value;
41  m_columns[name + "_h"] = value >> 16;
42  m_columns[name + "_l"] = value & 0xFFFF;
43 }
44 
45 void L1GtPatternLine::print(std::ostream& out) const {
46  out << "BEGIN Columns: " << std::endl;
47  for (L1GtPatternLine::ColumnMap::const_iterator it = m_columns.begin(); it != m_columns.end(); ++it) {
48  out << it->first << ": " << std::hex << it->second << std::endl;
49  }
50  out << "END Columns." << std::endl;
51 }
52 
53 bool L1GtPatternLine::has(const std::string& colname) const { return m_columns.find(colname) != m_columns.end(); }
54 
56  int i = 1;
58  do {
59  result = name(prefix, i++);
60  } while (has(result));
61 
62  return result;
63 }
64 
65 std::string L1GtPatternLine::name(const std::string& prefix, unsigned int i) const {
66  std::ostringstream ss;
67  ss << prefix << i;
68  return ss.str();
69 }
70 
71 uint32_t L1GtPatternLine::get(const std::string& name) const {
72  ColumnMap::const_iterator it = m_columns.find(name);
73  if (it != m_columns.end()) {
74  return it->second;
75  }
76  return 0;
77 }
mps_fire.i
i
Definition: mps_fire.py:355
L1GtPatternLine.h
L1GtPatternLine::push
void push(const std::string &prefix, uint32_t value)
Definition: L1GtPatternLine.cc:25
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
L1GtPatternLine::has
bool has(const std::string &colname) const
Definition: L1GtPatternLine.cc:53
L1GtPatternLine::nextName
std::string nextName(const std::string &prefix)
Definition: L1GtPatternLine.cc:55
L1GtPatternLine::print
void print(std::ostream &out) const
Definition: L1GtPatternLine.cc:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GtPatternLine::m_columns
ColumnMap m_columns
Definition: L1GtPatternLine.h:63
L1GtPatternLine::name
std::string name(const std::string &prefix, unsigned int i) const
Definition: L1GtPatternLine.cc:65
value
Definition: value.py:1
L1GtPatternLine::set
void set(const std::string &name, uint32_t value)
Definition: L1GtPatternLine.cc:34
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Exception.h
L1GtPatternLine::get
uint32_t get(const std::string &name) const
Definition: L1GtPatternLine.cc:71
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:303
ZMuMuAnalysisNtupler_cff.prefix
prefix
Definition: ZMuMuAnalysisNtupler_cff.py:14