CMS 3D CMS Logo

L1TriggerKey.h

Go to the documentation of this file.
00001 #ifndef CondFormats_L1TObjects_L1TriggerKey_h
00002 #define CondFormats_L1TObjects_L1TriggerKey_h
00003 
00004 #include <string>
00005 #include <map>
00006 
00007 /* L1 key used to load all other configuration data from offline db.
00008  * This class is just a proxy to the real data. It will contain mapping from data and record
00009  * pair to the payload token that could be used to read data. So the use case could be as follows:
00010  *   1. User read L1TriggerKey for given Tag and IOV pair.
00011  *   2. For each record and type that user whant to load, it ask method get for the payload.
00012  *   3. Reads the data with payloads extracted from step 2.
00013  *
00014  * It is not adviced for user to use this class and direct Pool DB manipulation. One should use
00015  * DataReader and DataWriter classes.
00016  *
00017  * The good point to note is that IOV of all L1 trigger condfiguration is controled bay IOV of L1TriggeKey.
00018  * If new configuration has to be created - new L1TriggerKey has to be saved/loaded. More then one key can use
00019  * the same paylaod token. This would just mean that data pointed by this payload token has not changed.
00020  */
00021 class L1TriggerKey
00022 {
00023 public:
00024     typedef std::map<std::string, std::string> RecordToKey;
00025 
00026     // Constructors
00027     L1TriggerKey () {}
00028 
00029     /* Adds new record and type mapping to payload. If such exists, nothing happens */
00030     void add (const std::string & record, const std::string & type, const std::string & key)
00031     { m_recordToKey.insert (std::make_pair (record + "@" + type, key)); }
00032 
00033     void setTSCKey( const std::string& tscKey )
00034     { m_tscKey = tscKey ; }
00035 
00036     /* Gets payload key for record and type. If no such paylaod exists, emtpy string
00037      * is returned.
00038      */
00039     std::string get (const std::string & record, const std::string & type) const
00040     {
00041         RecordToKey::const_iterator it = m_recordToKey.find (record + "@" + type);
00042         if (it == m_recordToKey.end ())
00043             return std::string ();
00044         else
00045             return it->second;
00046     }
00047 
00048     std::string getTSCKey() const
00049       { return m_tscKey ; }
00050 
00051     const RecordToKey& recordToKeyMap() const
00052       { return m_recordToKey ; }
00053 
00054 protected:
00055     /* Mapping from records and types to tokens.
00056      * I as unvable to make type std::map<std::pair<std::string, std::string>, std::string> persistent
00057      * so record and type are concatanated with @ sign and resulting string is used as a key.
00058      */
00059 
00060   // wsun 03/2008: instead of tokens, store the configuration keys instead.
00061 /*     typedef std::map<std::string, std::string> RecordsToToken; */
00062 /*     RecordsToToken recordsToToken; */
00063     RecordToKey m_recordToKey;
00064 
00065 
00066     // wsun 03/2008: add data member for TSC key
00067     std::string m_tscKey ;
00068 };
00069 
00070 #endif
00071 

Generated on Tue Jun 9 17:26:38 2009 for CMSSW by  doxygen 1.5.4