File indexing completed on 2024-04-06 12:26:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "FWCore/Framework/interface/ESProducer.h"
0017 #include "FWCore/Framework/interface/ModuleFactory.h"
0018
0019 #include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h"
0020 #include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h"
0021
0022 #include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h"
0023
0024 class SiPixelTemplateStoreESProducer : public edm::ESProducer {
0025 public:
0026 SiPixelTemplateStoreESProducer(edm::ParameterSet const&);
0027 static void fillDescriptions(edm::ConfigurationDescriptions&);
0028
0029 std::unique_ptr<std::vector<SiPixelTemplateStore>> produce(const SiPixelTemplateDBObjectESProducerRcd&);
0030
0031 private:
0032 edm::ESGetToken<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd> token_;
0033 };
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 SiPixelTemplateStoreESProducer::SiPixelTemplateStoreESProducer(edm::ParameterSet const& iPSet) {
0047 token_ = setWhatProduced(this).consumes();
0048 }
0049
0050
0051
0052
0053 std::unique_ptr<std::vector<SiPixelTemplateStore>> SiPixelTemplateStoreESProducer::produce(
0054 const SiPixelTemplateDBObjectESProducerRcd& iRecord) {
0055 auto returnValue = std::make_unique<std::vector<SiPixelTemplateStore>>();
0056
0057 if (not SiPixelTemplate::pushfile(iRecord.get(token_), *returnValue)) {
0058 throw cms::Exception("SiPixelTemplateDBObjectFailure")
0059 << "Templates not filled correctly. Check the DB. Using SiPixelTemplateDBObject version "
0060 << iRecord.get(token_).version();
0061 }
0062
0063 return returnValue;
0064 }
0065
0066
0067
0068
0069
0070
0071
0072
0073 void SiPixelTemplateStoreESProducer::fillDescriptions(edm::ConfigurationDescriptions& iDesc) {
0074 edm::ParameterSetDescription iPSet;
0075 iDesc.addDefault(iPSet);
0076 iDesc.add("SiPixelTemplateStoreESProducer", iPSet);
0077 }
0078
0079 DEFINE_FWK_EVENTSETUP_MODULE(SiPixelTemplateStoreESProducer);
0080 ;