30 #include <boost/algorithm/string.hpp>
31 #include <ext/hash_map>
93 const std::vector<ConditionEvaluationMap>& conditionResultMaps) {
101 <<
"\nEmpty RPN vector for the logical expression = "
114 std::stack<bool> resultStack;
126 switch (it->operation) {
130 CItEvalMap itCond = (conditionResultMaps.at(chipNumber)).
find(it->operand);
131 if (itCond != (conditionResultMaps[chipNumber]).end()) {
134 bool condResult = (itCond->second)->condLastResult();
136 resultStack.push(condResult);
157 <<
"\nCondition " << (it->operand) <<
" not found in condition map"
166 b1 = resultStack.top();
168 resultStack.push(!b1);
173 b1 = resultStack.top();
175 b2 = resultStack.top();
177 resultStack.push(b1 || b2);
182 b1 = resultStack.top();
184 b2 = resultStack.top();
186 resultStack.push(b1 && b2);
211 myCout <<
" Algorithm result: " <<
m_algoResult << std::endl;
217 myCout <<
" Operand token vector size: " << operandTokenVectorSize;
219 if (operandTokenVectorSize == 0) {
220 myCout <<
" - not properly initialized! " << std::endl;
225 for (
int i = 0;
i < operandTokenVectorSize; ++
i) {
std::string logicalExpression() const
return the logical expression
virtual ~L1GtAlgorithmEvaluation()
destructor
bool m_algoResult
algorithm result
L1GtAlgorithmEvaluation()
constructor
RpnVector rpnVector() const
return the RPN vector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const std::vector< L1GtLogicParser::TokenRPN > & algoRpnVector() const
return the RPN vector
std::vector< OperandToken > m_operandTokenVector
vector of operand tokens
const std::vector< CombinationsInCond > * gtAlgoCombinationVector() const
std::string const & algoLogicalExpression() const
get / set the logical expression for the algorithm
std::vector< CombinationsInCond > m_algoCombinationVector
std::string m_logicalExpression
logical expression to be parsed
const bool & gtAlgoResult() const
get / set the result of the algorithm
RpnVector m_rpnVector
RPN vector - equivalent to the logical expression.
void print(std::ostream &myCout) const
std::vector< TokenRPN > RpnVector
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
ConditionEvaluationMap::const_iterator CItEvalMap
void evaluateAlgorithm(const int chipNumber, const std::vector< ConditionEvaluationMap > &)
evaluate an algorithm