CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/L1Trigger/GlobalTrigger/interface/L1GtAlgorithmEvaluation.h

Go to the documentation of this file.
00001 #ifndef GlobalTrigger_L1GtAlgorithmEvaluation_h
00002 #define GlobalTrigger_L1GtAlgorithmEvaluation_h
00003 
00020 //   for L1GtLogicParser
00021 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
00022 
00023 // system include files
00024 #include <iostream>
00025 
00026 #include <string>
00027 #include <vector>
00028 #include <map>
00029 #include <stack>
00030 #include <queue>
00031 
00032 #include <boost/cstdint.hpp>
00033 
00034 // if hash map is used
00035 
00036 #include <ext/hash_map>
00037 
00038 //   how to hash std::string, using a "template specialization"
00039 namespace __gnu_cxx {
00040 
00045     template<> struct hash<std::string> {
00046         size_t operator()(const std::string& x) const {
00047             return hash<const char*> ()(x.c_str());
00048         }
00049     };
00050 
00051 }
00052 // end hash map
00053 
00054 
00055 // user include files
00056 
00057 //   base class
00058 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
00059 
00060 //
00061 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h"
00062 
00063 // forward declarations
00064 class L1GtAlgorithm;
00065 class L1GtConditionEvaluation;
00066 
00067 // class interface
00068 class L1GtAlgorithmEvaluation {
00069 
00070 public:
00071     typedef L1GtLogicParser::TokenRPN TokenRPN;
00072     typedef std::vector<TokenRPN> RpnVector;
00073     typedef L1GtLogicParser::OperandToken OperandToken;
00074 
00076     //  L1GtAlgorithmEvaluation();
00077 
00079     explicit L1GtAlgorithmEvaluation(const L1GtAlgorithm&);
00080 
00082     // L1GtAlgorithmEvaluation(L1GtAlgorithmEvaluation&);
00083 
00085     // virtual ~L1GtAlgorithmEvaluation();
00086 
00087     //typedef std::map<std::string, L1GtConditionEvaluation*> ConditionEvaluationMap;
00088     typedef __gnu_cxx ::hash_map<std::string, L1GtConditionEvaluation*>
00089             ConditionEvaluationMap;
00090     typedef ConditionEvaluationMap::const_iterator CItEvalMap;
00091     typedef ConditionEvaluationMap::iterator ItEvalMap;
00092 
00093 public:
00094 
00096     inline bool gtAlgoResult() const {
00097         return m_algoResult;
00098     }
00099 
00100     inline void setGtAlgoResult(const bool algoResult) {
00101         m_algoResult = algoResult;
00102     }
00103 
00105     void evaluateAlgorithm(const int chipNumber, const std::vector<
00106             ConditionEvaluationMap>&);
00107 
00110     inline std::vector<CombinationsInCond> & gtAlgoCombinationVector() {
00111         return m_algoCombinationVector;
00112     }
00113 
00114     inline std::vector<L1GtLogicParser::OperandToken>& operandTokenVector() {
00115         return m_operandTokenVector;
00116     }
00117 
00118     void print(std::ostream& myCout) const;
00119 
00120 private:
00121 
00123     bool m_algoResult;
00124 
00125     // input
00126     std::string const & m_logicalExpression;
00127     RpnVector const & m_rpnVector;
00128 
00129     std::vector<OperandToken> m_operandTokenVector;
00130 
00131     std::vector<CombinationsInCond> m_algoCombinationVector;
00132 
00133 };
00134 
00135 #endif