Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GlobalTriggerAnalyzer_L1GtPatternLine_h
0002 #define GlobalTriggerAnalyzer_L1GtPatternLine_h
0003 
0004 /**
0005  * \class L1GtPatternLine
0006  * 
0007  * 
0008  * Description: A representation of a of pattern file line for
0009  *              L1 GT hardware testing.
0010  *
0011  * Implementation:
0012  *    <TODO: enter implementation details>
0013  *   
0014  * \author: Thomas Themel - HEPHY Vienna
0015  * 
0016  *
0017  */
0018 
0019 #include <string>
0020 #include <map>
0021 #include <cstdint>
0022 
0023 /** A class representing the contents of one line in a pattern file. 
0024     The contents are represented as (name, value) pairs. Column ids
0025     are also enumerated so that multiple columns with identical names
0026     end up with consecutive names ("muon" becomes "muon1", "muon2" etc).
0027 */
0028 class L1GtPatternLine {
0029 public:
0030   /** Add a new column with the specified name prefix and value.
0031       @param prefix The name prefix of the new column. The final column name
0032                     consists of prefix + the lowest free number (starting at 1)
0033       @param value  The actual data content of the column.
0034   */
0035   void push(const std::string& prefix, uint32_t value);
0036 
0037   /** Manipulate an existing value. 
0038       @param name  the name (prefix + no) of the column to set. Do not use _h or _l values here!
0039       @param value the new value for the column.
0040   */
0041   void set(const std::string& name, uint32_t value);
0042 
0043   /** Debug dump of contents */
0044   void print(std::ostream& out) const;
0045 
0046   /** Returns true iff a column of the given name exists.
0047       @param colname Column name to look for. 
0048                      Beware: This has to include the number appended by push!
0049   */
0050   bool has(const std::string& colname) const;
0051 
0052   /** Returns the next free column name for a given prefix. */
0053   std::string nextName(const std::string& prefix);
0054 
0055   /** Forms a column name from a prefix and a number. */
0056   std::string name(const std::string& prefix, unsigned int i) const;
0057 
0058   /** Accessor. @see has*/
0059   uint32_t get(const std::string& name) const;
0060 
0061 private:
0062   typedef std::map<std::string, uint32_t> ColumnMap;
0063   ColumnMap m_columns;
0064 };
0065 
0066 #endif /*GlobalTriggerAnalyzer_L1GtPatternLine_h*/