CMS 3D CMS Logo

GlobalObjectMap.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 #include <algorithm>
24 
25 // user include files
27 
28 // forward declarations
29 
30 // methods
31 
32 // return all the combinations passing the requirements imposed in condition condNameVal
34  for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
35  if ((m_operandTokenVector[i]).tokenName == condNameVal) {
36  return &(m_combinationVector.at((m_operandTokenVector[i]).tokenNumber));
37  }
38  }
39 
40  // return a null address - should not arrive here
41  edm::LogError("GlobalObjectMap") << "\n\n ERROR: The requested condition with tokenName = " << condNameVal
42  << "\n does not exists in the operand token vector."
43  << "\n Returning zero pointer for getCombinationsInCond\n\n"
44  << std::endl;
45 
46  return nullptr;
47 }
48 
50 const CombinationsInCond* GlobalObjectMap::getCombinationsInCond(const int condNumberVal) const {
51  for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
52  if ((m_operandTokenVector[i]).tokenNumber == condNumberVal) {
53  return &(m_combinationVector.at((m_operandTokenVector[i]).tokenNumber));
54  }
55  }
56 
57  // return a null address - should not arrive here
58  edm::LogError("GlobalObjectMap") << "\n\n ERROR: The requested condition with tokenNumber = " << condNumberVal
59  << "\n does not exists in the operand token vector."
60  << "\n Returning zero pointer for getCombinationsInCond\n\n"
61  << std::endl;
62 
63  return nullptr;
64 }
65 // return the result for the condition condNameVal
66 const bool GlobalObjectMap::getConditionResult(const std::string& condNameVal) const {
67  for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
68  if ((m_operandTokenVector[i]).tokenName == condNameVal) {
69  return (m_operandTokenVector[i]).tokenResult;
70  }
71  }
72 
73  // return false - should not arrive here
74  edm::LogError("GlobalObjectMap") << "\n\n ERROR: The requested condition with name = " << condNameVal
75  << "\n does not exists in the operand token vector."
76  << "\n Returning false for getConditionResult\n\n"
77  << std::endl;
78  return false;
79 }
80 
82  // name of the algorithm
83  m_algoName.clear();
84 
85  // bit number for algorithm
86  m_algoBitNumber = -1;
87 
88  // GTL result of the algorithm
89  m_algoGtlResult = false;
90 
91  // vector of operand tokens for an algorithm
92  m_operandTokenVector.clear();
93 
94  // vector of combinations for all conditions in an algorithm
95  m_combinationVector.clear();
96 }
97 
98 void GlobalObjectMap::print(std::ostream& myCout) const {
99  myCout << "GlobalObjectMap: print " << std::endl;
100 
101  myCout << " Algorithm name: " << m_algoName << std::endl;
102  myCout << " Bit number: " << m_algoBitNumber << std::endl;
103  myCout << " GTL result: " << m_algoGtlResult << std::endl;
104 
105  int operandTokenVectorSize = m_operandTokenVector.size();
106 
107  myCout << " Operand token vector size: " << operandTokenVectorSize;
108 
109  if (operandTokenVectorSize == 0) {
110  myCout << " - not properly initialized! " << std::endl;
111  } else {
112  myCout << std::endl;
113 
114  for (int i = 0; i < operandTokenVectorSize; ++i) {
115  myCout << " " << std::setw(5) << (m_operandTokenVector[i]).tokenNumber << "\t" << std::setw(25)
116  << (m_operandTokenVector[i]).tokenName << "\t" << (m_operandTokenVector[i]).tokenResult << std::endl;
117  }
118  }
119 
120  myCout << " CombinationVector size: " << m_combinationVector.size() << std::endl;
121 
122  myCout << " conditions: " << std::endl;
123 
124  std::vector<CombinationsInCond>::const_iterator itVVV;
125  int iCond = 0;
126  for (itVVV = m_combinationVector.begin(); itVVV != m_combinationVector.end(); itVVV++) {
127  std::string condName = (m_operandTokenVector[iCond]).tokenName;
128  bool condResult = (m_operandTokenVector[iCond]).tokenResult;
129 
130  myCout << " Condition " << condName << " evaluated to " << condResult << std::endl;
131 
132  myCout << " List of combinations passing all requirements for this condition:" << std::endl;
133 
134  myCout << " ";
135 
136  if ((*itVVV).empty()) {
137  myCout << "(none)";
138  } else {
139  CombinationsInCond::const_iterator itVV;
140  for (itVV = (*itVVV).begin(); itVV != (*itVVV).end(); itVV++) {
141  myCout << "( ";
142 
143  std::copy((*itVV).begin(), (*itVV).end(), std::ostream_iterator<int>(myCout, " "));
144 
145  myCout << "); ";
146  }
147  }
148  iCond++;
149  myCout << "\n\n";
150  }
151 }
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
GlobalObjectMap::m_algoGtlResult
bool m_algoGtlResult
Definition: GlobalObjectMap.h:114
GlobalObjectMap::m_algoBitNumber
int m_algoBitNumber
Definition: GlobalObjectMap.h:111
CombinationsInCond
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
Definition: L1GlobalTriggerObjectMapFwd.h:32
GlobalObjectMap::reset
void reset()
reset the object map
Definition: GlobalObjectMap.cc:81
GlobalObjectMap::m_operandTokenVector
std::vector< GlobalLogicParser::OperandToken > m_operandTokenVector
Definition: GlobalObjectMap.h:118
GlobalObjectMap::getCombinationsInCond
const CombinationsInCond * getCombinationsInCond(const std::string &condNameVal) const
return all the combinations passing the requirements imposed in condition condNameVal
Definition: GlobalObjectMap.cc:33
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogError
Definition: MessageLogger.h:183
GlobalObjectMap.h
GlobalObjectMap::m_algoName
std::string m_algoName
Definition: GlobalObjectMap.h:108
GlobalObjectMap::print
void print(std::ostream &myCout) const
print the full object map
Definition: GlobalObjectMap.cc:98
GlobalObjectMap::m_combinationVector
std::vector< CombinationsInCond > m_combinationVector
Definition: GlobalObjectMap.h:121
GlobalObjectMap::getConditionResult
const bool getConditionResult(const std::string &condNameVal) const
return the result for the condition condNameVal
Definition: GlobalObjectMap.cc:66