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 
32  typedef std::shared_ptr<SiStripConfObject> ReturnType;
33  ReturnType produce(const SiStripConfObjectRcd&);
34 
35 private:
36  std::vector<edm::ParameterSet> m_parameters;
38 };
39 
41 
43 {
44  setWhatProduced(this);
45  findingRecord<SiStripConfObjectRcd>();
46 
47  m_parameters = iConfig.getParameter<std::vector<edm::ParameterSet>>("Parameters");
48  m_file = iConfig.getParameter<edm::FileInPath>("file");
49 }
50 
52 
54 {
55  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
56 }
57 
58 // ------------ method called to produce the data ------------
61 {
62  using namespace edm::es;
63 
64  std::shared_ptr<SiStripConfObject> confObject{new SiStripConfObject};
65 
66  for ( const auto& param : m_parameters ) {
67  const std::string paramType{param.getParameter<std::string>("ParameterType")};
68  const std::string paramName{param.getParameter<std::string>("ParameterName")};
69  if( paramType == "int" ) {
70  confObject->put(paramName, param.getParameter<int32_t>("ParameterValue"));
71  }
72  else if( paramType == "double" ) {
73  confObject->put(paramName, param.getParameter<double>("ParameterValue"));
74  }
75  else if( paramType == "string" ) {
76  confObject->put(paramName, param.getParameter<std::string>("ParameterValue"));
77  }
78  else if( paramType == "bool" ) {
79  confObject->put(paramName, param.getParameter<bool>("ParameterValue"));
80  }
81  else if( paramType == "vint32" ) {
82  confObject->put(paramName, param.getParameter<std::vector<int> >("ParameterValue"));
83  }
84  else if( paramType == "vstring" ) {
85  confObject->put(paramName, param.getParameter<std::vector<std::string> >("ParameterValue"));
86  }
87  }
88 
89  return confObject;
90 }
91 
92 //define this as a plug-in
T getParameter(std::string const &) const
std::shared_ptr< SiStripConfObject > ReturnType
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
static const IOVSyncValue & beginOfTime()
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
SiStripConfObjectFakeESSource(const edm::ParameterSet &)
std::vector< edm::ParameterSet > m_parameters
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity)
ReturnType produce(const SiStripConfObjectRcd &)