CMS 3D CMS Logo

SiStripPedestalsFakeESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiStripESProducers
4 // Class: SiStripPedestalsFakeESSource
5 //
14 // system include files
15 #include <memory>
16 
17 // user include files
20 
24 
26 public:
29 
31 
32  typedef std::shared_ptr<SiStripPedestals> ReturnType;
33  ReturnType produce(const SiStripPedestalsRcd&);
34 
35 private:
36  uint32_t m_pedestalValue;
38  uint32_t m_printDebug;
39 };
40 
43 
45 {
46  setWhatProduced(this);
47  findingRecord<SiStripPedestalsRcd>();
48 
49  m_pedestalValue = iConfig.getParameter<uint32_t>("PedestalValue");
50  m_file = iConfig.getParameter<edm::FileInPath>("file");
51  m_printDebug = iConfig.getUntrackedParameter<uint32_t>("printDebug", 5);
52 }
53 
55 
57 {
58  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
59 }
60 
61 // ------------ method called to produce the data ------------
64 {
65  using namespace edm::es;
66 
67  std::shared_ptr<SiStripPedestals> pedestals{new SiStripPedestals};
68 
70 
71  uint32_t count{0};
72  for ( const auto& elm : reader.getAllData() ) {
73  //Generate Noises for det detid
74  SiStripPedestals::InputVector theSiStripVector;
75  for ( unsigned short j{0}; j < 128*elm.second.nApvs; ++j ) {
76  if ( count < m_printDebug ) {
77  edm::LogInfo("SiStripPedestalsFakeESSource::makePedestals(): ") << "detid: " << elm.first << " strip: " << j << " ped: " << m_pedestalValue;
78  }
79  pedestals->setData(m_pedestalValue, theSiStripVector);
80  }
81  ++count;
82  if ( ! pedestals->put(elm.first, theSiStripVector) ) {
83  edm::LogError("SiStripPedestalsFakeESSource::produce ") << " detid already exists";
84  }
85  }
86 
87  return pedestals;
88 }
89 
90 //define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
ReturnType produce(const SiStripPedestalsRcd &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::vector< uint16_t > InputVector
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity)
static const IOVSyncValue & beginOfTime()
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
std::shared_ptr< SiStripPedestals > ReturnType
SiStripPedestalsFakeESSource(const edm::ParameterSet &)
std::string fullPath() const
Definition: FileInPath.cc:184