CMS 3D CMS Logo

SiStripLatencyFakeESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiStripESProducers
4 // Class: SiStripLatencyFakeESSource
5 //
14 // system include files
15 #include <memory>
16 
17 // user include files
20 
24 
26 public:
28  ~SiStripLatencyFakeESSource() override;
29 
31 
32  typedef std::shared_ptr<SiStripLatency> ReturnType;
33  ReturnType produce(const SiStripLatencyRcd&);
34 
35 private:
36  uint32_t m_latency;
37  uint32_t m_mode;
39 };
40 
43 
45 {
46  setWhatProduced(this);
47  findingRecord<SiStripLatencyRcd>();
48 
49  m_latency = iConfig.getParameter<uint32_t>("latency");
50  m_mode = iConfig.getParameter<uint32_t>("mode");
51  m_file = iConfig.getParameter<edm::FileInPath>("file");
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<SiStripLatency> latency{new SiStripLatency};
68 
70  const auto& detInfos = reader.getAllData();
71  // Take the last detId. Since the map is sorted it will be the biggest value
72  if ( ! detInfos.empty() ) {
73  // Set the apv number as 6, the highest possible
74  edm::LogInfo("SiStripLatencyGenerator") << "detId = " << detInfos.rbegin()->first << " apv = " << 6
75  << " latency = " << m_latency
76  << " mode = " << m_mode;
77  latency->put(detInfos.rbegin()->first, 6, m_latency, m_mode);
78 
79  // Call this method to collapse all consecutive detIdAndApvs with the same latency and mode to a single entry
80  latency->compress();
81  } else {
82  edm::LogError("SiStripLatencyGenerator") << "Error: detInfo map is empty. Cannot get the last detId.";
83  }
84 
85  return latency;
86 }
87 
88 //define this as a plug-in
T getParameter(std::string const &) const
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::shared_ptr< SiStripLatency > ReturnType
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
static const IOVSyncValue & beginOfTime()
ReturnType produce(const SiStripLatencyRcd &)
SiStripLatencyFakeESSource(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
std::string fullPath() const
Definition: FileInPath.cc:184
latency
hardware algo