Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:59

0001 #ifndef GlobalTrigger_L1GtAlgorithmEvaluation_h
0002 #define GlobalTrigger_L1GtAlgorithmEvaluation_h
0003 
0004 /**
0005  * \class L1GtAlgorithmEvaluation
0006  *
0007  *
0008  * Description: Evaluation of a L1 Global Trigger algorithm.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *
0013  * \author: Vasile Mihai Ghete   - HEPHY Vienna
0014  *
0015  *
0016  */
0017 
0018 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h"
0019 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
0020 
0021 #include <iostream>
0022 #include <map>
0023 #include <queue>
0024 #include <stack>
0025 #include <string>
0026 #include <unordered_map>
0027 #include <vector>
0028 
0029 // forward declarations
0030 class L1GtAlgorithm;
0031 class L1GtConditionEvaluation;
0032 
0033 // class interface
0034 class L1GtAlgorithmEvaluation {
0035 public:
0036   typedef L1GtLogicParser::TokenRPN TokenRPN;
0037   typedef std::vector<TokenRPN> RpnVector;
0038   typedef L1GtLogicParser::OperandToken OperandToken;
0039 
0040   /// constructor
0041   //  L1GtAlgorithmEvaluation();
0042 
0043   /// constructor from an algorithm from event setup
0044   explicit L1GtAlgorithmEvaluation(const L1GtAlgorithm &);
0045 
0046   /// copy constructor
0047   // L1GtAlgorithmEvaluation(L1GtAlgorithmEvaluation&);
0048 
0049   /// destructor
0050   // virtual ~L1GtAlgorithmEvaluation();
0051 
0052   // typedef std::map<std::string, L1GtConditionEvaluation*>
0053   // ConditionEvaluationMap;
0054   typedef std ::unordered_map<std::string, L1GtConditionEvaluation *> ConditionEvaluationMap;
0055   typedef ConditionEvaluationMap::const_iterator CItEvalMap;
0056   typedef ConditionEvaluationMap::iterator ItEvalMap;
0057 
0058 public:
0059   /// get / set the result of the algorithm
0060   inline bool gtAlgoResult() const { return m_algoResult; }
0061 
0062   inline void setGtAlgoResult(const bool algoResult) { m_algoResult = algoResult; }
0063 
0064   /// evaluate an algorithm
0065   void evaluateAlgorithm(const int chipNumber, const std::vector<ConditionEvaluationMap> &);
0066 
0067   /// get all the object combinations evaluated to true in the conditions
0068   /// from the algorithm
0069   inline std::vector<CombinationsInCond> &gtAlgoCombinationVector() { return m_algoCombinationVector; }
0070 
0071   inline std::vector<L1GtLogicParser::OperandToken> &operandTokenVector() { return m_operandTokenVector; }
0072 
0073   void print(std::ostream &myCout) const;
0074 
0075 private:
0076   /// algorithm result
0077   bool m_algoResult;
0078 
0079   // input
0080   std::string const &m_logicalExpression;
0081   RpnVector const &m_rpnVector;
0082 
0083   std::vector<OperandToken> m_operandTokenVector;
0084 
0085   std::vector<CombinationsInCond> m_algoCombinationVector;
0086 };
0087 
0088 #endif