CMS 3D CMS Logo

CondDBESSource.h
Go to the documentation of this file.
1 #ifndef CondCore_ESSources_CondDBESSource_h
2 #define CondCore_ESSources_CondDBESSource_h
3 //
4 // Package: CondCore/ESSources
5 // Class: CondDBESSource
6 //
7 /*
8  Description: EventSetup source module for serving data from offline database
9 */
10 //
11 // Author: Zhen Xie
12 //
13 // system include files
14 #include <string>
15 #include <map>
16 #include <memory>
17 #include <set>
18 // user include files
20 
23 //#include "CondCore/DBCommon/interface/Time.h"
24 
25 namespace edm{
26  class ParameterSet;
27 }
28 
29 namespace cond{
30  class DataProxyWrapperBase;
31 }
32 
35  public:
36  typedef std::shared_ptr<cond::DataProxyWrapperBase > ProxyP;
37  typedef std::multimap< std::string, ProxyP> ProxyMap;
38 
39  typedef enum { NOREFRESH, REFRESH_ALWAYS, REFRESH_OPEN_IOVS, REFRESH_EACH_RUN, RECONNECT_EACH_RUN } RefreshPolicy;
40 
41 
42  explicit CondDBESSource( const edm::ParameterSet& );
43  ~CondDBESSource() override;
44 
45  protected:
46  void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
47  const edm::IOVSyncValue& ,
48  edm::ValidityInterval&) override ;
49 
50  void registerProxies(const edm::eventsetup::EventSetupRecordKey& iRecordKey, KeyedProxies& aProxyList) override ;
51 
52  void newInterval(const edm::eventsetup::EventSetupRecordKey& iRecordType, const edm::ValidityInterval& iInterval) override ;
53 
54  private:
55 
56  // ----------member data ---------------------------
57 
60 
61  // Container of DataProxy, implemented as multi-map keyed by records
62  ProxyMap m_proxies;
63 
64 
65  typedef std::map< std::string, cond::GTEntry_t > TagCollection;
66  // the collections of tag, record/label used in this ESSource
67  TagCollection m_tagCollection;
68  std::map<std::string,std::pair<cond::persistency::Session,std::string> > m_sessionPool;
69  std::map<std::string,unsigned int> m_lastRecordRuns;
70 
71  struct Stats {
72  int nData;
73  int nSet;
74  int nRun;
75  int nLumi;
76  int nRefresh;
80  };
81 
83 
84  unsigned int m_lastRun;
85  unsigned int m_lastLumi;
86  RefreshPolicy m_policy;
87 
88  bool m_doDump;
89 
90  private:
91 
92  void fillList(const std::string & pfn, std::vector<std::string> & pfnList, const unsigned int listSize, const std::string & type);
93 
94  void fillTagCollectionFromGT(const std::string & connectionString,
95  const std::string & prefix,
96  const std::string & postfix,
97  const std::string & roottag,
98  std::set< cond::GTEntry_t > & tagcoll,
99  cond::GTMetadata_t& gtMetadata);
100 
101  void fillTagCollectionFromDB( const std::vector<std::string> & connectionStringList,
102  const std::vector<std::string> & prefixList,
103  const std::vector<std::string> & postfixList,
104  const std::vector<std::string> & roottagList,
105  std::map<std::string,cond::GTEntry_t>& replacement,
106  cond::GTMetadata_t& gtMetadata);
107 };
108 #endif
type
Definition: HCALResponse.h:21
RefreshPolicy m_policy
std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
std::map< std::string, unsigned int > m_lastRecordRuns
cond::persistency::ConnectionPool m_connection
std::map< std::string, cond::GTEntry_t > TagCollection
std::map< std::string, std::pair< cond::persistency::Session, std::string > > m_sessionPool
std::shared_ptr< cond::DataProxyWrapperBase > ProxyP
std::multimap< std::string, ProxyP > ProxyMap
TagCollection m_tagCollection
std::string m_connectionString
ProxyMap m_proxies
Definition: plugin.cc:24
HLT enums.
unsigned int m_lastRun
unsigned int m_lastLumi