Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:12:05

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