File indexing completed on 2023-03-17 11:15:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
0017 #include "FWCore/Framework/interface/ESProducer.h"
0018 #include "FWCore/Framework/interface/SourceFactory.h"
0019
0020 #include "PhysicsTools/CondLiteIO/test/IntProductRecord.h"
0021 #include "DataFormats/TestObjects/interface/ToyProducts.h"
0022
0023 namespace edmtest {
0024 class IntProductESSource : public edm::EventSetupRecordIntervalFinder, public edm::ESProducer {
0025 public:
0026 IntProductESSource(const edm::ParameterSet&);
0027
0028 std::unique_ptr<edmtest::IntProduct> produce(const IntProductRecord&);
0029
0030 protected:
0031 virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0032 const edm::IOVSyncValue& iTime,
0033 edm::ValidityInterval& iInterval);
0034
0035 private:
0036 IntProductESSource(const IntProductESSource&);
0037
0038 const IntProductESSource& operator=(const IntProductESSource&);
0039
0040
0041 unsigned int nCalls_;
0042 };
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 IntProductESSource::IntProductESSource(const edm::ParameterSet&) : nCalls_(0) {
0056 this->findingRecord<IntProductRecord>();
0057 setWhatProduced(this);
0058 }
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068 std::unique_ptr<edmtest::IntProduct> IntProductESSource::produce(const IntProductRecord&) {
0069 auto data = std::make_unique<edmtest::IntProduct>();
0070 data->value = nCalls_;
0071 ++nCalls_;
0072 return data;
0073 }
0074
0075 void IntProductESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0076 const edm::IOVSyncValue& iTime,
0077 edm::ValidityInterval& iInterval) {
0078
0079 edm::EventID newTime = edm::EventID(1, 0, 0);
0080 edm::EventID endTime = edm::EventID(4, 0, 0);
0081 iInterval = edm::ValidityInterval(edm::IOVSyncValue(newTime), edm::IOVSyncValue(endTime));
0082 }
0083
0084
0085
0086
0087
0088
0089
0090
0091 }
0092 using namespace edmtest;
0093
0094 DEFINE_FWK_EVENTSETUP_SOURCE(IntProductESSource);