28 #include <boost/algorithm/string.hpp> 29 #include <ext/hash_map> 43 : m_algoResult(
false), m_logicalExpression(alg.algoLogicalExpression()), m_rpnVector(alg.algoRpnVector()) {
51 const std::vector<ConditionEvaluationMap>& conditionResultMaps) {
68 std::stack<bool, std::vector<bool> > resultStack;
79 switch (it->operation) {
81 CItEvalMap itCond = (conditionResultMaps.at(chipNumber)).
find(it->operand);
82 if (itCond != (conditionResultMaps[chipNumber]).end()) {
83 if (
nullptr == itCond->second) {
86 <<
"\nCondition " << (it->operand) <<
" NULL pointer found in condition map" << std::endl;
90 bool condResult = (itCond->second)->condLastResult();
92 resultStack.push(condResult);
105 CombinationsInCond const& combInCondition = (itCond->second)->getCombinationsInCond();
111 <<
"\nCondition " << (it->operand) <<
" not found in condition map" << std::endl;
118 b1 = resultStack.top();
120 resultStack.push(!b1);
125 b1 = resultStack.top();
127 b2 = resultStack.top();
129 resultStack.push(b1 || b2);
134 b1 = resultStack.top();
136 b2 = resultStack.top();
138 resultStack.push(b1 && b2);
143 b1 = resultStack.top();
145 b2 = resultStack.top();
147 resultStack.push(b1 ^ b2);
167 myCout <<
" Algorithm result: " <<
m_algoResult << std::endl;
173 myCout <<
" Operand token vector size: " << operandTokenVectorSize;
175 if (operandTokenVectorSize == 0) {
176 myCout <<
" - not properly initialized! " << std::endl;
180 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