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::unique_ptr<SiStripPedestals> ReturnType;
33  ReturnType produce(const SiStripPedestalsRcd&);
34 
35 private:
36  uint32_t m_pedestalValue;
37  uint32_t m_printDebug;
38 };
39 
42 
44 {
45  setWhatProduced(this);
46  findingRecord<SiStripPedestalsRcd>();
47 
48  m_pedestalValue = iConfig.getParameter<uint32_t>("PedestalValue");
49  m_printDebug = iConfig.getUntrackedParameter<uint32_t>("printDebug", 5);
50 }
51 
53 
55 {
56  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
57 }
58 
59 // ------------ method called to produce the data ------------
62 {
63  using namespace edm::es;
64 
65  auto pedestals = std::make_unique<SiStripPedestals>();
66 
68  uint32_t count{0};
69  for ( const auto& elm : reader->getAllData() ) {
70  //Generate Noises for det detid
71  SiStripPedestals::InputVector theSiStripVector;
72  for ( unsigned short j{0}; j < 128*elm.second.nApvs; ++j ) {
73  if ( count < m_printDebug ) {
74  edm::LogInfo("SiStripPedestalsFakeESSource::makePedestals(): ") << "detid: " << elm.first << " strip: " << j << " ped: " << m_pedestalValue;
75  }
76  pedestals->setData(m_pedestalValue, theSiStripVector);
77  }
78  ++count;
79  if ( ! pedestals->put(elm.first, theSiStripVector) ) {
80  edm::LogError("SiStripPedestalsFakeESSource::produce ") << " detid already exists";
81  }
82  }
83 
84  return pedestals;
85 }
86 
87 //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
static const IOVSyncValue & beginOfTime()
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
SiStripPedestalsFakeESSource(const edm::ParameterSet &)
std::unique_ptr< SiStripPedestals > ReturnType