CMS 3D CMS Logo

ConvertingESProducerT.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_CUDACore_interface_ConvertingESProducerT_h
2 #define HeterogeneousCore_CUDACore_interface_ConvertingESProducerT_h
3 
11 
12 /* class template: ConvertingESProducerT
13  *
14  * This class template can be used to simplify the implementation of any ESProducer that reads
15  * conditions data from a record and pushes derived conditions data to the same record.
16  * The current use case is to convert and copy the calibrations from the CPU to the GPUs.
17  */
18 
19 template <typename Record, typename Target, typename Source>
21 public:
23  auto const& label = ps.getParameter<std::string>("label");
24  auto const& name = ps.getParameter<std::string>("ComponentName");
25  auto cc = setWhatProduced(this, name);
26  token_ = cc.consumes(edm::ESInputTag{"", label});
27  }
28 
29  std::unique_ptr<Target> produce(Record const& record) {
30  // retrieve conditions in the old format and build a product in the new format
31  return std::make_unique<Target>(record.get(token_));
32  }
33 
36 
37  desc.add<std::string>("ComponentName", "");
38  desc.add<std::string>("label", "")->setComment("ESProduct label");
39  confDesc.addWithDefaultLabel(desc);
40  }
41 
42 private:
44 };
45 
46 #endif // HeterogeneousCore_CUDACore_interface_ConvertingESProducerT_h
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
char const * label
ConvertingESProducerT(edm::ParameterSet const &ps)
edm::ESGetToken< Source, Record > token_
std::unique_ptr< Target > produce(Record const &record)
static void fillDescriptions(edm::ConfigurationDescriptions &confDesc)