File indexing completed on 2024-04-06 12:26:35
0001 #ifndef RecoLuminosity_LumiProducer_DIPLumiProducer_h
0002 #define RecoLuminosity_LumiProducer_DIPLumiProducer_h
0003
0004 #include "FWCore/Framework/interface/ESProducer.h"
0005 #include "FWCore/Framework/interface/ModuleFactory.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
0009 #include <memory>
0010 namespace edm {
0011 class IOVSyncValue;
0012 }
0013 namespace coral {
0014 class ISchema;
0015 }
0016 class DIPLuminosityRcd;
0017 class DIPLumiSummary;
0018 class DIPLumiDetail;
0019
0020
0021
0022 class DIPLumiProducer : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0023 public:
0024 DIPLumiProducer(const edm::ParameterSet&);
0025 typedef std::shared_ptr<const DIPLumiSummary> ReturnSummaryType;
0026 ReturnSummaryType produceSummary(const DIPLuminosityRcd&);
0027 typedef std::shared_ptr<const DIPLumiDetail> ReturnDetailType;
0028 ReturnDetailType produceDetail(const DIPLuminosityRcd&);
0029 ~DIPLumiProducer() override;
0030
0031 protected:
0032 void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0033 const edm::IOVSyncValue&,
0034 edm::ValidityInterval&) override;
0035
0036 private:
0037 unsigned int maxavailableLSforRun(coral::ISchema& schema, const std::string& tablename, unsigned int runnumber);
0038
0039 private:
0040 std::string m_connectStr;
0041 std::map<unsigned int, std::shared_ptr<const DIPLumiSummary> > m_summarycache;
0042 std::map<unsigned int, std::shared_ptr<const DIPLumiDetail> > m_detailcache;
0043 bool m_isNullRun;
0044 unsigned int m_summarycachedrun;
0045 unsigned int m_detailcachedrun;
0046 unsigned int m_cachesize;
0047 std::shared_ptr<const DIPLumiSummary> m_summaryresult;
0048 std::shared_ptr<const DIPLumiDetail> m_detailresult;
0049 const edm::IOVSyncValue* m_pcurrentTime;
0050
0051 private:
0052 void fillsummarycache(unsigned int runnumber, unsigned int startlsnum);
0053 void filldetailcache(unsigned int runnumber, unsigned int startlsnum);
0054 };
0055 #endif