CMS 3D CMS Logo

PoolDBESSource.h

Go to the documentation of this file.
00001 #ifndef CondCore_ESSources_PoolDBESSource_h
00002 #define CondCore_ESSources_PoolDBESSource_h
00003 //
00004 // Package:    CondCore/ESSources
00005 // Class:      PoolDBESSource
00006 //
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 "FWCore/Framework/interface/DataProxyProvider.h"
00019 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00020 #include "CondCore/DBCommon/interface/TagMetadata.h"
00021 #include "CondCore/DBCommon/interface/Time.h"
00022 #include <boost/functional/hash.hpp>
00023 namespace edm{
00024   class ParameterSet;
00025 }
00026 namespace cond{
00027   class DBSession;
00028   class IOVService;
00029   class CoralTransaction;
00030   class Connection;
00031   struct IOVInfo{
00032     std::string tag; 
00033     std::string token;
00034     std::string label;
00035     std::string pfn;
00036     cond::TimeType timetype;
00037     std::size_t hashvalue()const{
00038       boost::hash<std::string> hasher;
00039       std::size_t result=hasher(token+label+pfn);
00040       return result;
00041     }
00042     bool  operator == (const IOVInfo& toCompare ) const {
00043       if(this->hashvalue()==toCompare.hashvalue()&&this->timetype==toCompare.timetype) return true;
00044      return false;
00045     }
00046     bool operator != (const IOVInfo& toCompare ) const {
00047       return !(*this==toCompare);
00048     }
00049     bool operator<(const IOVInfo& toCompare ) const {
00050       return this->hashvalue()<toCompare.hashvalue();
00051     }
00052   };
00053 
00054 }
00055 class PoolDBESSource : public edm::eventsetup::DataProxyProvider,
00056                        public edm::EventSetupRecordIntervalFinder{
00057  public:
00058   PoolDBESSource( const edm::ParameterSet& );
00059   ~PoolDBESSource();
00060   
00061  protected:
00062   virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
00063                               const edm::IOVSyncValue& , 
00064                               edm::ValidityInterval&) ;
00065   virtual void registerProxies(const edm::eventsetup::EventSetupRecordKey& iRecordKey, KeyedProxies& aProxyList) ;
00066   virtual void newInterval(const edm::eventsetup::EventSetupRecordKey& iRecordType, const edm::ValidityInterval& iInterval) ;    
00067  private:
00068   // ----------member data ---------------------------
00069   typedef std::multimap< std::string, std::string > RecordToTypes;
00070   RecordToTypes m_recordToTypes; 
00071   typedef std::map< std::string, std::set<cond::IOVInfo> > ProxyToIOVInfo;
00072   ProxyToIOVInfo m_proxyToIOVInfo;
00073   typedef std::set< cond::TagMetadata > TagCollection;
00074   TagCollection m_tagCollection;
00075   typedef std::map<std::string, std::string > DatumToToken;
00076   DatumToToken m_datumToToken;
00077   cond::DBSession* m_session;
00078   std::map<std::string,cond::IOVService*> m_serviceReg;
00079  private:
00080   void fillRecordToIOVInfo();
00081   void fillTagCollectionFromDB( cond::CoralTransaction& coraldb,
00082                                 const std::string& roottag );
00083    void fillTagCollectionFromDB( cond::CoralTransaction& coraldb,
00084                                 const std::string& roottag,
00085                                 std::map<std::string,cond::TagMetadata>& 
00086                                  replacement);
00087   //std::string setupFrontier(const std::string& frontierconnect);
00088   //unsigned int countslash(const std::string& input)const;
00089 };
00090 #endif

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