Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-05 02:29:28

0001 #include <array>
0002 #include <tuple>
0003 #include <utility>
0004 
0005 #include "CondFormats/EcalObjects/interface/EcalMultifitParametersGPU.h"
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 
0019 class EcalMultifitParametersGPUESProducer : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0020 public:
0021   EcalMultifitParametersGPUESProducer(edm::ParameterSet const&);
0022   ~EcalMultifitParametersGPUESProducer() override = default;
0023 
0024   static void fillDescriptions(edm::ConfigurationDescriptions&);
0025   std::unique_ptr<EcalMultifitParametersGPU> produce(JobConfigurationGPURecord const&);
0026 
0027 protected:
0028   void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0029                       const edm::IOVSyncValue&,
0030                       edm::ValidityInterval&) override;
0031 
0032 private:
0033   edm::ParameterSet const pset_;
0034 };
0035 
0036 EcalMultifitParametersGPUESProducer::EcalMultifitParametersGPUESProducer(edm::ParameterSet const& pset) : pset_{pset} {
0037   setWhatProduced(this);
0038   findingRecord<JobConfigurationGPURecord>();
0039 }
0040 
0041 void EcalMultifitParametersGPUESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& iKey,
0042                                                          const edm::IOVSyncValue& iTime,
0043                                                          edm::ValidityInterval& oInterval) {
0044   oInterval = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
0045 }
0046 
0047 void EcalMultifitParametersGPUESProducer::fillDescriptions(edm::ConfigurationDescriptions& desc) {
0048   edm::ParameterSetDescription d;
0049   d.add<std::vector<int>>("pulseOffsets", {-3, -2, -1, 0, 1, 2, 3, 4});
0050   d.add<std::vector<double>>("EBtimeFitParameters",
0051                              {-2.015452e+00,
0052                               3.130702e+00,
0053                               -1.234730e+01,
0054                               4.188921e+01,
0055                               -8.283944e+01,
0056                               9.101147e+01,
0057                               -5.035761e+01,
0058                               1.105621e+01});
0059   d.add<std::vector<double>>("EEtimeFitParameters",
0060                              {-2.390548e+00,
0061                               3.553628e+00,
0062                               -1.762341e+01,
0063                               6.767538e+01,
0064                               -1.332130e+02,
0065                               1.407432e+02,
0066                               -7.541106e+01,
0067                               1.620277e+01});
0068   d.add<std::vector<double>>("EBamplitudeFitParameters", {1.138, 1.652});
0069   d.add<std::vector<double>>("EEamplitudeFitParameters", {1.890, 1.400});
0070   desc.addWithDefaultLabel(d);
0071 }
0072 
0073 std::unique_ptr<EcalMultifitParametersGPU> EcalMultifitParametersGPUESProducer::produce(
0074     JobConfigurationGPURecord const&) {
0075   return std::make_unique<EcalMultifitParametersGPU>(
0076       pset_.getParameter<std::vector<double>>("EBamplitudeFitParameters"),
0077       pset_.getParameter<std::vector<double>>("EEamplitudeFitParameters"),
0078       pset_.getParameter<std::vector<double>>("EBtimeFitParameters"),
0079       pset_.getParameter<std::vector<double>>("EEtimeFitParameters"));
0080 }
0081 
0082 DEFINE_FWK_EVENTSETUP_SOURCE(EcalMultifitParametersGPUESProducer);