Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:52

0001 #include <array>
0002 #include <iostream>
0003 #include <tuple>
0004 #include <utility>
0005 
0006 #include "FWCore/Framework/interface/ESProducer.h"
0007 #include "FWCore/Framework/interface/ESProductHost.h"
0008 #include "FWCore/Framework/interface/ESTransientHandle.h"
0009 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
0010 #include "FWCore/Framework/interface/MakerMacros.h"
0011 #include "FWCore/Framework/interface/ModuleFactory.h"
0012 #include "FWCore/Framework/interface/SourceFactory.h"
0013 #include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "FWCore/Utilities/interface/ReusableObjectHolder.h"
0016 #include "FWCore/Utilities/interface/typelookup.h"
0017 #include "HeterogeneousCore/CUDACore/interface/JobConfigurationGPURecord.h"
0018 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalMahiPulseOffsetsGPU.h"
0019 
0020 class HcalMahiPulseOffsetsGPUESProducer : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0021 public:
0022   HcalMahiPulseOffsetsGPUESProducer(edm::ParameterSet const&);
0023   ~HcalMahiPulseOffsetsGPUESProducer() override = default;
0024 
0025   static void fillDescriptions(edm::ConfigurationDescriptions&);
0026   std::unique_ptr<HcalMahiPulseOffsetsGPU> produce(JobConfigurationGPURecord const&);
0027 
0028 protected:
0029   void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0030                       const edm::IOVSyncValue&,
0031                       edm::ValidityInterval&) override;
0032 
0033 private:
0034   std::vector<int> pulseOffsets_;
0035 };
0036 
0037 HcalMahiPulseOffsetsGPUESProducer::HcalMahiPulseOffsetsGPUESProducer(edm::ParameterSet const& pset)
0038     : pulseOffsets_(pset.getParameter<std::vector<int>>("pulseOffsets")) {
0039   setWhatProduced(this);
0040   findingRecord<JobConfigurationGPURecord>();
0041 }
0042 
0043 void HcalMahiPulseOffsetsGPUESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& iKey,
0044                                                        const edm::IOVSyncValue& iTime,
0045                                                        edm::ValidityInterval& oInterval) {
0046   oInterval = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
0047 }
0048 
0049 void HcalMahiPulseOffsetsGPUESProducer::fillDescriptions(edm::ConfigurationDescriptions& desc) {
0050   edm::ParameterSetDescription d;
0051   d.add<std::vector<int>>("pulseOffsets", {-3, -2, -1, 0, 1, 2, 3, 4});
0052   desc.addWithDefaultLabel(d);
0053 }
0054 
0055 std::unique_ptr<HcalMahiPulseOffsetsGPU> HcalMahiPulseOffsetsGPUESProducer::produce(JobConfigurationGPURecord const&) {
0056   return std::make_unique<HcalMahiPulseOffsetsGPU>(pulseOffsets_);
0057 }
0058 
0059 DEFINE_FWK_EVENTSETUP_SOURCE(HcalMahiPulseOffsetsGPUESProducer);