test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GlobalTriggerObjectMap.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iostream>
20 #include <iomanip>
21 #include <iterator>
22 
23 
24 #include <algorithm>
25 
26 // user include files
29 
30 // forward declarations
31 
32 
33 
34 
35 // methods
36 
37 // return all the combinations passing the requirements imposed in condition condNameVal
39  const std::string& condNameVal) const {
40 
41  for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
42 
43  if ((m_operandTokenVector[i]).tokenName == condNameVal) {
44  return &(m_combinationVector.at((m_operandTokenVector[i]).tokenNumber));
45  }
46 
47  }
48 
49  // return a null address - should not arrive here
50  edm::LogError("L1GlobalTriggerObjectMap")
51  << "\n\n ERROR: The requested condition with tokenName = " << condNameVal
52  << "\n does not exists in the operand token vector."
53  << "\n Returning zero pointer for getCombinationsInCond\n\n" << std::endl;
54 
55  return 0;
56 
57 }
58 
61 
62  for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
63 
64  if ((m_operandTokenVector[i]).tokenNumber == condNumberVal) {
65  return &(m_combinationVector.at((m_operandTokenVector[i]).tokenNumber));
66  }
67 
68  }
69 
70  // return a null address - should not arrive here
71  edm::LogError("L1GlobalTriggerObjectMap")
72  << "\n\n ERROR: The requested condition with tokenNumber = " << condNumberVal
73  << "\n does not exists in the operand token vector."
74  << "\n Returning zero pointer for getCombinationsInCond\n\n" << std::endl;
75 
76  return 0;
77 
78 }
79 // return the result for the condition condNameVal
80 const bool L1GlobalTriggerObjectMap::getConditionResult(const std::string& condNameVal) const {
81 
82  for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
83 
84  if ((m_operandTokenVector[i]).tokenName == condNameVal) {
85  return (m_operandTokenVector[i]).tokenResult;
86  }
87  }
88 
89  // return false - should not arrive here
90  edm::LogError("L1GlobalTriggerObjectMap")
91  << "\n\n ERROR: The requested condition with name = " << condNameVal
92  << "\n does not exists in the operand token vector."
93  << "\n Returning false for getConditionResult\n\n" << std::endl;
94  return false;
95 
96 }
97 
98 
100 {
101 
102  // name of the algorithm
103  m_algoName.clear();
104 
105  // bit number for algorithm
106  m_algoBitNumber = -1;
107 
108  // GTL result of the algorithm
109  m_algoGtlResult = false;
110 
111  // vector of operand tokens for an algorithm
112  m_operandTokenVector.clear();
113 
114  // vector of combinations for all conditions in an algorithm
115  m_combinationVector.clear();
116 
117 }
118 
119 void L1GlobalTriggerObjectMap::print(std::ostream& myCout) const
120 {
121 
122  myCout << "L1GlobalTriggerObjectMap: print " << std::endl;
123 
124  myCout << " Algorithm name: " << m_algoName << std::endl;
125  myCout << " Bit number: " << m_algoBitNumber << std::endl;
126  myCout << " GTL result: " << m_algoGtlResult << std::endl;
127 
128  int operandTokenVectorSize = m_operandTokenVector.size();
129 
130  myCout << " Operand token vector size: " << operandTokenVectorSize;
131 
132  if (operandTokenVectorSize == 0) {
133  myCout << " - not properly initialized! " << std::endl;
134  }
135  else {
136  myCout << std::endl;
137 
138  for (int i = 0; i < operandTokenVectorSize; ++i) {
139 
140  myCout << " " << std::setw(5) << (m_operandTokenVector[i]).tokenNumber << "\t"
141  << std::setw(25) << (m_operandTokenVector[i]).tokenName << "\t"
142  << (m_operandTokenVector[i]).tokenResult
143  << std::endl;
144  }
145 
146  }
147 
148  myCout << " CombinationVector size: " << m_combinationVector.size() << std::endl;
149 
150  myCout << " conditions: " << std::endl;
151 
152  std::vector<CombinationsInCond>::const_iterator itVVV;
153  int iCond = 0;
154  for(itVVV = m_combinationVector.begin();
155  itVVV != m_combinationVector.end(); itVVV++) {
156 
157  std::string condName = (m_operandTokenVector[iCond]).tokenName;
158  bool condResult = (m_operandTokenVector[iCond]).tokenResult;
159 
160  myCout << " Condition " << condName << " evaluated to " << condResult
161  << std::endl;
162 
163  myCout << " List of combinations passing all requirements for this condition:"
164  << std::endl;
165 
166  myCout << " ";
167 
168  if ((*itVVV).size() == 0) {
169  myCout << "(none)";
170  } else {
171 
172  CombinationsInCond::const_iterator itVV;
173  for(itVV = (*itVVV).begin(); itVV != (*itVVV).end(); itVV++) {
174 
175  myCout << "( ";
176 
177  std::copy((*itVV).begin(), (*itVV).end(),
178  std::ostream_iterator<int> (myCout, " "));
179 
180  myCout << "); ";
181 
182  }
183 
184  }
185  iCond++;
186  myCout << "\n\n";
187  }
188 }
189 
int i
Definition: DBlmapReader.cc:9
std::vector< L1GtLogicParser::OperandToken > m_operandTokenVector
const CombinationsInCond * getCombinationsInCond(const std::string &condNameVal) const
return all the combinations passing the requirements imposed in condition condNameVal ...
void print(std::ostream &myCout) const
print the full object map
std::vector< CombinationsInCond > m_combinationVector
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
void reset()
reset the object map
const bool getConditionResult(const std::string &condNameVal) const
return the result for the condition condNameVal