Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-14 23:16:58

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 <memory>
0026 #include <queue>
0027 #include <stack>
0028 #include <string>
0029 #include <unordered_map>
0030 #include <vector>
0031 
0032 // forward declarations
0033 class GlobalAlgorithm;
0034 
0035 namespace l1t {
0036 
0037   class ConditionEvaluation;
0038 
0039   // class interface
0040   class AlgorithmEvaluation {
0041   public:
0042     typedef GlobalLogicParser::TokenRPN TokenRPN;
0043     typedef std::vector<TokenRPN> RpnVector;
0044     typedef GlobalLogicParser::OperandToken OperandToken;
0045 
0046     /// constructor
0047     //  AlgorithmEvaluation();
0048 
0049     /// constructor from an algorithm from event setup
0050     explicit AlgorithmEvaluation(const GlobalAlgorithm&);
0051 
0052     /// copy constructor
0053     // AlgorithmEvaluation(AlgorithmEvaluation&);
0054 
0055     /// destructor
0056     // virtual ~AlgorithmEvaluation();
0057 
0058     //typedef std::map<std::string, ConditionEvaluation*> ConditionEvaluationMap;
0059     typedef std::unordered_map<std::string, std::unique_ptr<ConditionEvaluation>> ConditionEvaluationMap;
0060 
0061   public:
0062     /// get / set the result of the algorithm
0063     inline bool gtAlgoResult() const { return m_algoResult; }
0064 
0065     inline void setGtAlgoResult(const bool algoResult) { m_algoResult = algoResult; }
0066 
0067     /// evaluate an algorithm
0068     void evaluateAlgorithm(const int chipNumber, const std::vector<ConditionEvaluationMap>&);
0069 
0070     /// get all the object combinations evaluated to true in the conditions from the algorithm
0071     inline std::vector<CombinationsWithBxInCond>& gtAlgoCombinationVector() { return m_algoCombinationVector; }
0072 
0073     inline std::vector<GlobalLogicParser::OperandToken>& operandTokenVector() { return m_operandTokenVector; }
0074 
0075     void print(std::ostream& myCout) const;
0076 
0077   private:
0078     /// algorithm result
0079     bool m_algoResult;
0080 
0081     // input
0082     std::string const& m_logicalExpression;
0083     RpnVector const& m_rpnVector;
0084 
0085     std::vector<OperandToken> m_operandTokenVector;
0086 
0087     std::vector<CombinationsWithBxInCond> m_algoCombinationVector;
0088   };
0089 
0090 }  // namespace l1t
0091 #endif