CMS 3D CMS Logo

ConcurrentIOVESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Integration
4 // Class: ConcurrentIOVESProducer
5 //
11 // Original Author: W. David Dagenhart
12 // Created: 22 March 2019
13 
25 
26 #include <memory>
27 
28 namespace edmtest {
29 
31  public:
33 
34  std::unique_ptr<IOVTestInfo> produce(ESTestRecordI const&);
35 
37 
38  private:
40  };
41 
43  //auto collector = setWhatProduced(this);
44  auto collector = setWhatProduced(this, "fromESProducer");
45  token_ = collector.consumes<IOVTestInfo>(edm::ESInputTag{"", ""});
46  }
47 
48  std::unique_ptr<IOVTestInfo> ConcurrentIOVESProducer::produce(ESTestRecordI const& record) {
49  edm::ESHandle<IOVTestInfo> iovTestInfo = record.getHandle(token_);
50 
51  edm::ValidityInterval iov = record.validityInterval();
52  if (iovTestInfo->iovStartLumi_ != iov.first().luminosityBlockNumber() ||
53  iovTestInfo->iovEndLumi_ != iov.last().luminosityBlockNumber() || iovTestInfo->iovIndex_ != record.iovIndex() ||
54  iovTestInfo->cacheIdentifier_ != record.cacheIdentifier()) {
55  throw cms::Exception("TestFailure") << "ConcurrentIOVESProducer::ConcurrentIOVESProducer"
56  << "read values do not agree with record";
57  }
58 
59  auto data = std::make_unique<IOVTestInfo>();
60  *data = *iovTestInfo;
61  return data;
62  }
63 
66  descriptions.add("concurrentIOVESProducer", desc);
67  }
68 } // namespace edmtest
69 using namespace edmtest;
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
const IOVSyncValue & last() const
LuminosityBlockNumber_t luminosityBlockNumber() const
Definition: IOVSyncValue.h:41
const IOVSyncValue & first() const
unsigned int iovEndLumi_
Definition: IOVTestInfo.h:24
unsigned int iovIndex_
Definition: IOVTestInfo.h:25
unsigned int iovStartLumi_
Definition: IOVTestInfo.h:22
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
std::unique_ptr< IOVTestInfo > produce(ESTestRecordI const &)
ConcurrentIOVESProducer(edm::ParameterSet const &)
unsigned long long cacheIdentifier_
Definition: IOVTestInfo.h:26
edm::ESGetToken< IOVTestInfo, ESTestRecordI > token_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
static void fillDescriptions(edm::ConfigurationDescriptions &)