File indexing completed on 2024-04-06 12:15:42
0001 #include "FWCore/Framework/interface/ESProducer.h"
0002 #include "FWCore/Framework/interface/ModuleFactory.h"
0003 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0006 #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestRecords.h"
0007 #include "HeterogeneousCore/AlpakaTest/interface/ESTestData.h"
0008
0009 namespace cms::alpakatest {
0010 template <typename TProduct, typename TRecord>
0011 class TestESProducerT : public edm::ESProducer {
0012 public:
0013 TestESProducerT(edm::ParameterSet const& iConfig) : value_(iConfig.getParameter<int>("value")) {
0014 setWhatProduced(this);
0015 }
0016
0017 std::optional<TProduct> produce(TRecord const& iRecord) { return TProduct(value_); }
0018
0019 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0020 edm::ParameterSetDescription desc;
0021 desc.add<int>("value");
0022 descriptions.addWithDefaultLabel(desc);
0023 }
0024
0025 private:
0026 int const value_;
0027 };
0028
0029 using TestESProducerA = TestESProducerT<cms::alpakatest::ESTestDataA, AlpakaESTestRecordA>;
0030 using TestESProducerB = TestESProducerT<cms::alpakatest::ESTestDataB, AlpakaESTestRecordB>;
0031 using TestESProducerC = TestESProducerT<cms::alpakatest::ESTestDataC, AlpakaESTestRecordC>;
0032 }
0033
0034 DEFINE_FWK_EVENTSETUP_MODULE(cms::alpakatest::TestESProducerA);
0035 DEFINE_FWK_EVENTSETUP_MODULE(cms::alpakatest::TestESProducerB);
0036 DEFINE_FWK_EVENTSETUP_MODULE(cms::alpakatest::TestESProducerC);