CMS 3D CMS Logo

SiStripConfObjectFakeESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiStripESProducers
4 // Class: SiStripConfObjectFakeESSource
5 //
14 // system include files
15 #include <memory>
16 
17 // user include files
20 
24 
26 public:
29 
31  const edm::IOVSyncValue& iov,
32  edm::ValidityInterval& iValidity) override;
33 
34  typedef std::unique_ptr<SiStripConfObject> ReturnType;
36 
37 private:
38  std::vector<edm::ParameterSet> m_parameters;
39 };
40 
42 
44  setWhatProduced(this);
45  findingRecord<SiStripConfObjectRcd>();
46 
47  m_parameters = iConfig.getParameter<std::vector<edm::ParameterSet>>("Parameters");
48 }
49 
51 
53  const edm::IOVSyncValue& iov,
54  edm::ValidityInterval& iValidity) {
55  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
56 }
57 
58 // ------------ method called to produce the data ------------
60  using namespace edm::es;
61 
62  auto confObject = std::make_unique<SiStripConfObject>();
63 
64  for (const auto& param : m_parameters) {
65  const std::string paramType{param.getParameter<std::string>("ParameterType")};
66  const std::string paramName{param.getParameter<std::string>("ParameterName")};
67  if (paramType == "int") {
68  confObject->put(paramName, param.getParameter<int32_t>("ParameterValue"));
69  } else if (paramType == "double") {
70  confObject->put(paramName, param.getParameter<double>("ParameterValue"));
71  } else if (paramType == "string") {
72  confObject->put(paramName, param.getParameter<std::string>("ParameterValue"));
73  } else if (paramType == "bool") {
74  confObject->put(paramName, param.getParameter<bool>("ParameterValue"));
75  } else if (paramType == "vint32") {
76  confObject->put(paramName, param.getParameter<std::vector<int>>("ParameterValue"));
77  } else if (paramType == "vstring") {
78  confObject->put(paramName, param.getParameter<std::vector<std::string>>("ParameterValue"));
79  }
80  }
81 
82  return confObject;
83 }
84 
85 //define this as a plug-in
MessageLogger.h
SiStripConfObjectFakeESSource
Definition: SiStripConfObjectFakeESSource.cc:25
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ValidityInterval
Definition: ValidityInterval.h:28
ESProducer.h
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
SiStripConfObjectFakeESSource::~SiStripConfObjectFakeESSource
~SiStripConfObjectFakeESSource() override
Definition: SiStripConfObjectFakeESSource.cc:50
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
EventSetupRecordIntervalFinder.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SourceFactory.h
edm::ParameterSet
Definition: ParameterSet.h:36
SiStripCondDataRecords.h
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
SiStripConfObjectFakeESSource::ReturnType
std::unique_ptr< SiStripConfObject > ReturnType
Definition: SiStripConfObjectFakeESSource.cc:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::es
Definition: es_Label.h:33
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
SiStripConfObjectRcd
Definition: SiStripCondDataRecords.h:56
edm::ESProducer
Definition: ESProducer.h:101
SiStripConfObjectFakeESSource::produce
ReturnType produce(const SiStripConfObjectRcd &)
Definition: SiStripConfObjectFakeESSource.cc:59
SiStripConfObjectFakeESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
Definition: SiStripConfObjectFakeESSource.cc:52
SiStripConfObjectFakeESSource::SiStripConfObjectFakeESSource
SiStripConfObjectFakeESSource(const edm::ParameterSet &)
Definition: SiStripConfObjectFakeESSource.cc:43
ParameterSet.h
SiStripConfObjectFakeESSource::m_parameters
std::vector< edm::ParameterSet > m_parameters
Definition: SiStripConfObjectFakeESSource.cc:38
SiStripConfObject.h