CMS 3D CMS Logo

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