30 #include <boost/algorithm/string.hpp>
31 #include <ext/hash_map>
49 m_logicalExpression(alg.algoLogicalExpression()),
50 m_rpnVector(alg.algoRpnVector()){
61 const std::vector<ConditionEvaluationMap>& conditionResultMaps) {
69 <<
"\nEmpty RPN vector for the logical expression = "
83 static std::stack<bool, std::vector<bool> > resultStack;
95 switch (it->operation) {
99 CItEvalMap itCond = (conditionResultMaps.at(chipNumber)).
find(it->operand);
100 if (itCond != (conditionResultMaps[chipNumber]).end()) {
102 if (0 == itCond->second) {
106 <<
" NULL pointer found in condition map"
111 bool condResult = (itCond->second)->condLastResult();
113 resultStack.push(condResult);
126 CombinationsInCond const & combInCondition = (itCond->second)->getCombinationsInCond();
134 <<
"\nCondition " << (it->operand) <<
" not found in condition map"
143 b1 = resultStack.top();
145 resultStack.push(!b1);
150 b1 = resultStack.top();
152 b2 = resultStack.top();
154 resultStack.push(b1 || b2);
159 b1 = resultStack.top();
161 b2 = resultStack.top();
163 resultStack.push(b1 && b2);
181 while(!resultStack.empty()) resultStack.pop();
190 myCout <<
" Algorithm result: " <<
m_algoResult << std::endl;
196 myCout <<
" Operand token vector size: " << operandTokenVectorSize;
198 if (operandTokenVectorSize == 0) {
199 myCout <<
" - not properly initialized! " << std::endl;
204 for (
int i = 0;
i < operandTokenVectorSize; ++
i) {
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