Go to the documentation of this file.00001 #ifndef CondCore_ESSources_CondDBESSource_h
00002 #define CondCore_ESSources_CondDBESSource_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <string>
00015 #include <map>
00016 #include <set>
00017
00018 #include "CondCore/DBCommon/interface/DbConnection.h"
00019
00020 #include "FWCore/Framework/interface/DataProxyProvider.h"
00021 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00022 #include "CondCore/DBCommon/interface/TagMetadata.h"
00023 #include "CondCore/DBCommon/interface/Time.h"
00024
00025 namespace edm{
00026 class ParameterSet;
00027 }
00028 namespace cond{
00029 class DbSession;
00030 class BasePayloadProxy;
00031 class DataProxyWrapperBase;
00032 }
00033
00034 class CondDBESSource : public edm::eventsetup::DataProxyProvider,
00035 public edm::EventSetupRecordIntervalFinder{
00036 public:
00037 typedef boost::shared_ptr<cond::DataProxyWrapperBase > ProxyP;
00038 typedef std::multimap< std::string, ProxyP> ProxyMap;
00039
00040 typedef enum { NOREFRESH, REFRESH_ALWAYS, REFRESH_OPEN_IOVS, REFRESH_EACH_RUN, RECONNECT_EACH_RUN } RefreshPolicy;
00041
00042
00043 explicit CondDBESSource( const edm::ParameterSet& );
00044 ~CondDBESSource();
00045
00046 protected:
00047 virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
00048 const edm::IOVSyncValue& ,
00049 edm::ValidityInterval&) ;
00050
00051 virtual void registerProxies(const edm::eventsetup::EventSetupRecordKey& iRecordKey, KeyedProxies& aProxyList) ;
00052
00053 virtual void newInterval(const edm::eventsetup::EventSetupRecordKey& iRecordType, const edm::ValidityInterval& iInterval) ;
00054
00055 private:
00056
00057
00058
00059 cond::DbConnection m_connection;
00060
00061
00062 ProxyMap m_proxies;
00063
00064
00065 typedef std::map< std::string, cond::TagMetadata > TagCollection;
00066
00067 TagCollection m_tagCollection;
00068 std::map<std::string,std::pair<cond::DbSession,std::string> > m_sessionPool;
00069 std::map<std::string,unsigned int> m_lastRecordRuns;
00070
00071 struct Stats {
00072 int nData;
00073 int nSet;
00074 int nRun;
00075 int nLumi;
00076 int nRefresh;
00077 int nActualRefresh;
00078 int nReconnect;
00079 int nActualReconnect;
00080 };
00081
00082 Stats m_stats;
00083
00084 unsigned int m_lastRun;
00085 unsigned int m_lastLumi;
00086 RefreshPolicy m_policy;
00087
00088 bool m_doDump;
00089
00090 private:
00091
00092 void fillTagCollectionFromDB( const std::string & coraldb,
00093 const std::string & prefix,
00094 const std::string & postfix,
00095 const std::string& roottag,
00096 std::map<std::string,cond::TagMetadata>& replacement);
00097 };
00098 #endif