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