28 #include <boost/algorithm/string.hpp> 29 #include <ext/hash_map> 46 m_logicalExpression(alg.algoLogicalExpression()),
47 m_rpnVector(alg.algoRpnVector()){
58 const std::vector<ConditionEvaluationMap>& conditionResultMaps) {
66 <<
"\nEmpty RPN vector for the logical expression = " 79 std::stack<bool, std::vector<bool> > resultStack;
91 switch (it->operation) {
95 CItEvalMap itCond = (conditionResultMaps.at(chipNumber)).
find(it->operand);
96 if (itCond != (conditionResultMaps[chipNumber]).end()) {
98 if (
nullptr == itCond->second) {
102 <<
" NULL pointer found in condition map" 107 bool condResult = (itCond->second)->condLastResult();
109 resultStack.push(condResult);
122 CombinationsInCond const & combInCondition = (itCond->second)->getCombinationsInCond();
130 <<
"\nCondition " << (it->operand) <<
" not found in condition map" 139 b1 = resultStack.top();
141 resultStack.push(!b1);
146 b1 = resultStack.top();
148 b2 = resultStack.top();
150 resultStack.push(b1 || b2);
155 b1 = resultStack.top();
157 b2 = resultStack.top();
159 resultStack.push(b1 && b2);
181 myCout <<
" Algorithm result: " <<
m_algoResult << std::endl;
187 myCout <<
" Operand token vector size: " << operandTokenVectorSize;
189 if (operandTokenVectorSize == 0) {
190 myCout <<
" - not properly initialized! " << std::endl;
195 for (
int i = 0;
i < operandTokenVectorSize; ++
i) {
ConditionEvaluationMap::const_iterator CItEvalMap
void print(std::ostream &myCout) const
std::vector< CombinationsInCond > m_algoCombinationVector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::string const & m_logicalExpression
AlgorithmEvaluation(const GlobalAlgorithm &)
constructor
void evaluateAlgorithm(const int chipNumber, const std::vector< ConditionEvaluationMap > &)
evaluate an algorithm
RpnVector const & m_rpnVector
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
bool m_algoResult
algorithm result
std::vector< OperandToken > m_operandTokenVector