28 #include <boost/algorithm/string.hpp> 29 #include <ext/hash_map> 44 : m_algoResult(
false), m_logicalExpression(alg.algoLogicalExpression()),
45 m_rpnVector(alg.algoRpnVector()) {
55 const std::vector<ConditionEvaluationMap> &conditionResultMaps) {
63 <<
"\nEmpty RPN vector for the logical expression = " 75 std::stack<bool, std::vector<bool>> resultStack;
80 for (RpnVector::const_iterator it =
m_rpnVector.begin();
88 switch (it->operation) {
93 (conditionResultMaps.at(chipNumber)).
find(it->operand);
94 if (itCond != (conditionResultMaps[chipNumber]).end()) {
96 if (
nullptr == itCond->second) {
99 <<
"\nCondition " << (it->operand)
100 <<
" NULL pointer found in condition map" << std::endl;
104 bool condResult = (itCond->second)->condLastResult();
106 resultStack.push(condResult);
120 (itCond->second)->getCombinationsInCond();
127 <<
"\nCondition " << (it->operand) <<
" not found in condition map" 135 b1 = resultStack.top();
137 resultStack.push(!b1);
142 b1 = resultStack.top();
144 b2 = resultStack.top();
146 resultStack.push(b1 || b2);
151 b1 = resultStack.top();
153 b2 = resultStack.top();
155 resultStack.push(b1 && b2);
179 myCout <<
" Algorithm result: " <<
m_algoResult << std::endl;
186 myCout <<
" Operand token vector size: " << operandTokenVectorSize;
188 if (operandTokenVectorSize == 0) {
189 myCout <<
" - not properly initialized! " << std::endl;
193 for (
int i = 0;
i < operandTokenVectorSize; ++
i) {
195 myCout <<
" " << std::setw(5)
RpnVector const & m_rpnVector
bool m_algoResult
algorithm result
std::vector< OperandToken > m_operandTokenVector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< CombinationsInCond > m_algoCombinationVector
void print(std::ostream &myCout) const
L1GtAlgorithmEvaluation(const L1GtAlgorithm &)
constructor
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
std::string const & m_logicalExpression
ConditionEvaluationMap::const_iterator CItEvalMap
void evaluateAlgorithm(const int chipNumber, const std::vector< ConditionEvaluationMap > &)
evaluate an algorithm