CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondCore/ESSources/plugins/CondDBESSource.h

Go to the documentation of this file.
00001 #ifndef CondCore_ESSources_CondDBESSource_h
00002 #define CondCore_ESSources_CondDBESSource_h
00003 //
00004 // Package:    CondCore/ESSources
00005 // Class:      CondDBESSource
00006 //
00007 /*
00008  Description: EventSetup source module for serving data from offline database
00009 */
00010 //
00011 // Author:      Zhen Xie
00012 //
00013 // system include files
00014 #include <string>
00015 #include <map>
00016 #include <set>
00017 // user include files
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 
00041   explicit CondDBESSource( const edm::ParameterSet& );
00042   ~CondDBESSource();
00043   
00044  protected:
00045   virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
00046                               const edm::IOVSyncValue& , 
00047                               edm::ValidityInterval&) ;
00048 
00049   virtual void registerProxies(const edm::eventsetup::EventSetupRecordKey& iRecordKey, KeyedProxies& aProxyList) ;
00050 
00051   virtual void newInterval(const edm::eventsetup::EventSetupRecordKey& iRecordType, const edm::ValidityInterval& iInterval) ;
00052 
00053  private:
00054 
00055   // ----------member data ---------------------------
00056 
00057   cond::DbConnection m_connection;
00058 
00059   // Container of DataProxy, implemented as multi-map keyed by records
00060   ProxyMap m_proxies;
00061 
00062 
00063   typedef std::set< cond::TagMetadata > TagCollection;
00064   // the collections of tag, record/label used in this ESSource
00065   TagCollection m_tagCollection;
00066 
00067   struct Stats {
00068     int nData;
00069     int nSet;
00070     int nRun;
00071     int nRefresh;
00072     int nActualRefresh;
00073   };
00074 
00075   Stats stats;
00076 
00077   unsigned int lastRun;
00078   bool doRefresh;
00079 
00080   bool doDump;
00081 
00082  private:
00083 
00084    void fillTagCollectionFromDB( const std::string & coraldb,
00085                                  const std::string & prefix,
00086                                  const std::string & postfix,
00087                                  const std::string& roottag,
00088                                  std::map<std::string,cond::TagMetadata>& replacement);
00089 };
00090 #endif