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 
25 
27 
29 public:
32 
34  const edm::IOVSyncValue& iov,
35  edm::ValidityInterval& iValidity) override;
36 
37  typedef std::unique_ptr<SiStripPedestals> ReturnType;
39 
40 private:
41  uint32_t m_pedestalValue;
42  uint32_t m_printDebug;
44 };
45 
47  setWhatProduced(this);
48  findingRecord<SiStripPedestalsRcd>();
49 
50  m_pedestalValue = iConfig.getParameter<uint32_t>("PedestalValue");
51  m_printDebug = iConfig.getUntrackedParameter<uint32_t>("printDebug", 5);
53 }
54 
56 
58  const edm::IOVSyncValue& iov,
59  edm::ValidityInterval& iValidity) {
60  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
61 }
62 
63 // ------------ method called to produce the data ------------
65  using namespace edm::es;
66 
67  auto pedestals = std::make_unique<SiStripPedestals>();
68 
69  uint32_t count{0};
70  for (const auto& elm : m_detInfo.getAllData()) {
71  //Generate Noises for det detid
72  SiStripPedestals::InputVector theSiStripVector;
73  for (unsigned short j{0}; j < 128 * elm.second.nApvs; ++j) {
74  if (count < m_printDebug) {
75  edm::LogInfo("SiStripPedestalsFakeESSource::makePedestals(): ")
76  << "detid: " << elm.first << " strip: " << j << " ped: " << m_pedestalValue;
77  }
78  pedestals->setData(m_pedestalValue, theSiStripVector);
79  }
80  ++count;
81  if (!pedestals->put(elm.first, theSiStripVector)) {
82  edm::LogError("SiStripPedestalsFakeESSource::produce ") << " detid already exists";
83  }
84  }
85 
86  return pedestals;
87 }
88 
89 //define this as a plug-in
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string fullPath() const
Definition: FileInPath.cc:161
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
Log< level::Error, false > LogError
ReturnType produce(const SiStripPedestalsRcd &)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< uint16_t > InputVector
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
SiStripDetInfo read(std::string filePath)
Log< level::Info, false > LogInfo
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
SiStripPedestalsFakeESSource(const edm::ParameterSet &)
const std::map< uint32_t, DetInfo > & getAllData() const noexcept
std::unique_ptr< SiStripPedestals > ReturnType