00001 #ifndef RecoLuminosity_LumiProducer_DIPLumiProducer_h 00002 #define RecoLuminosity_LumiProducer_DIPLumiProducer_h 00003 00004 #include "FWCore/Framework/interface/ESProducer.h" 00005 #include "FWCore/Framework/interface/ModuleFactory.h" 00006 #include "FWCore/Framework/interface/ESHandle.h" 00007 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00008 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" 00009 #include "boost/shared_ptr.hpp" 00010 namespace edm{ 00011 class IOVSyncValue; 00012 } 00013 namespace coral{ 00014 class ISchema; 00015 } 00016 class DIPLuminosityRcd; 00017 class DIPLumiSummary; 00018 class DIPLumiDetail; 00022 class DIPLumiProducer: public edm::ESProducer , public edm::EventSetupRecordIntervalFinder{ 00023 public: 00024 DIPLumiProducer(const edm::ParameterSet&); 00025 typedef boost::shared_ptr<DIPLumiSummary> ReturnSummaryType; 00026 ReturnSummaryType produceSummary(const DIPLuminosityRcd&); 00027 typedef boost::shared_ptr<DIPLumiDetail> ReturnDetailType; 00028 ReturnDetailType produceDetail(const DIPLuminosityRcd&); 00029 ~DIPLumiProducer(); 00030 00031 protected: 00032 virtual void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, 00033 const edm::IOVSyncValue&, 00034 edm::ValidityInterval& ); 00035 private: 00036 unsigned int maxavailableLSforRun(coral::ISchema& schema,const std::string&tablename,unsigned int runnumber); 00037 private: 00038 std::string m_connectStr; 00039 std::map< unsigned int,boost::shared_ptr<DIPLumiSummary> > m_summarycache; 00040 std::map< unsigned int,boost::shared_ptr<DIPLumiDetail> > m_detailcache; 00041 bool m_isNullRun; //if lumi data exist for this run 00042 unsigned int m_summarycachedrun; 00043 unsigned int m_detailcachedrun; 00044 unsigned int m_cachesize; 00045 boost::shared_ptr<DIPLumiSummary> m_summaryresult; 00046 boost::shared_ptr<DIPLumiDetail> m_detailresult; 00047 const edm::IOVSyncValue* m_pcurrentTime; 00048 private: 00049 void fillsummarycache(unsigned int runnumber,unsigned int startlsnum); 00050 void filldetailcache(unsigned int runnumber,unsigned int startlsnum); 00051 }; 00052 #endif