Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:29

0001 #ifndef L1Trigger_L1TGlobal_GtAlgorithm_h
0002 #define L1Trigger_L1TGlobal_GtAlgorithm_h
0003 
0004 /**
0005  * \class GlobalAlgorithm
0006  *
0007  *
0008  * Description: L1 GT algorithm.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *
0013  * \author: Vasile Mihai Ghete - HEPHY Vienna
0014  *
0015  * $Date$
0016  * $Revision$
0017  *
0018  */
0019 
0020 // system include files
0021 #include "CondFormats/Serialization/interface/Serializable.h"
0022 
0023 #include <vector>
0024 #include <iosfwd>
0025 
0026 // user include files
0027 #include "DataFormats/L1TGlobal/interface/GlobalLogicParser.h"
0028 
0029 // forward declarations
0030 
0031 // class declaration
0032 class GlobalAlgorithm {
0033 public:
0034   /// constructor(s)
0035   ///   empty
0036   GlobalAlgorithm();
0037 
0038   ///   name only
0039   GlobalAlgorithm(const std::string& algoNameValue);
0040 
0041   ///   name and logical expression
0042   GlobalAlgorithm(const std::string&, const std::string&);
0043 
0044   ///   name, logical expression and bit number
0045   GlobalAlgorithm(const std::string&, const std::string&, const int);
0046 
0047   /// destructor
0048   virtual ~GlobalAlgorithm();
0049 
0050 public:
0051   /// get / set algorithm name
0052   inline const std::string algoName() const { return m_algoName; }
0053 
0054   inline void setAlgoName(const std::string& algoNameValue) { m_algoName = algoNameValue; }
0055 
0056   /// get / set algorithm alias
0057   inline std::string const& algoAlias() const { return m_algoAlias; }
0058 
0059   inline void setAlgoAlias(const std::string& algoAliasValue) { m_algoAlias = algoAliasValue; }
0060 
0061   /// get / set the logical expression for the algorithm
0062   inline std::string const& algoLogicalExpression() const { return m_algoLogicalExpression; }
0063 
0064   inline void setAlgoLogicalExpresssion(const std::string& logicalExpression) {
0065     m_algoLogicalExpression = logicalExpression;
0066   }
0067 
0068   /// return the RPN vector
0069   inline const std::vector<GlobalLogicParser::TokenRPN>& algoRpnVector() const { return m_algoRpnVector; }
0070 
0071   /// get / set algorithm bit number
0072   inline int algoBitNumber() const { return m_algoBitNumber; }
0073 
0074   inline void setAlgoBitNumber(const int algoBitNumberValue) { m_algoBitNumber = algoBitNumberValue; }
0075 
0076   /// get / set algorithm bit number
0077   inline const int algoChipNumber() const { return m_algoChipNumber; }
0078 
0079   inline void setAlgoChipNumber(const int algoChipNumberValue) { m_algoChipNumber = algoChipNumberValue; }
0080 
0081 public:
0082   /// get the condition chip number the algorithm is located on
0083   const int algoChipNumber(const int numberConditionChips,
0084                            const int pinsOnConditionChip,
0085                            const std::vector<int>& orderConditionChip) const;
0086 
0087   /// get the output pin on the condition chip for the algorithm
0088   const int algoOutputPin(const int numberConditionChips,
0089                           const int pinsOnConditionChip,
0090                           const std::vector<int>& orderConditionChip) const;
0091 
0092   /// print condition
0093   virtual void print(std::ostream& myCout) const;
0094 
0095   /// output stream operator
0096   friend std::ostream& operator<<(std::ostream&, const GlobalAlgorithm&);
0097 
0098 private:
0099   /// algorithm name
0100   std::string m_algoName;
0101 
0102   /// algorithm alias
0103   std::string m_algoAlias;
0104 
0105   /// algorithm logical expression
0106   std::string m_algoLogicalExpression;
0107 
0108   /// algorithm RPN vector
0109   std::vector<GlobalLogicParser::TokenRPN> m_algoRpnVector;
0110 
0111   /// bit number (determined by output pin, chip number, chip order)
0112   /// the result for the algorithm is found at m_algoBitNumber position in
0113   /// the decision word vector<bool>
0114   int m_algoBitNumber;
0115 
0116   /// chip number (redundant with bit number)
0117   int m_algoChipNumber;
0118 
0119   COND_SERIALIZABLE;
0120 };
0121 
0122 #endif /*L1Trigger_L1TGlobal_GtAlgorithm_h*/