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 
25 
27 
29 public:
31  ~SiStripLatencyFakeESSource() override;
32 
34  const edm::IOVSyncValue& iov,
35  edm::ValidityInterval& iValidity) override;
36 
37  typedef std::unique_ptr<SiStripLatency> ReturnType;
39 
40 private:
41  uint32_t m_latency;
42  uint32_t m_mode;
44 };
45 
47  setWhatProduced(this);
48  findingRecord<SiStripLatencyRcd>();
49 
50  m_latency = iConfig.getParameter<uint32_t>("latency");
51  m_mode = iConfig.getParameter<uint32_t>("mode");
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 latency = std::make_unique<SiStripLatency>();
68 
69  const auto& detInfos = m_detInfo.getAllData();
70  // Take the last detId. Since the map is sorted it will be the biggest value
71  if (!detInfos.empty()) {
72  // Set the apv number as 6, the highest possible
73  edm::LogInfo("SiStripLatencyGenerator") << "detId = " << detInfos.rbegin()->first << " apv = " << 6
74  << " latency = " << m_latency << " mode = " << m_mode;
75  latency->put(detInfos.rbegin()->first, 6, m_latency, m_mode);
76 
77  // Call this method to collapse all consecutive detIdAndApvs with the same latency and mode to a single entry
78  latency->compress();
79  } else {
80  edm::LogError("SiStripLatencyGenerator") << "Error: detInfo map is empty. Cannot get the last detId.";
81  }
82 
83  return latency;
84 }
85 
86 //define this as a plug-in
MessageLogger.h
config_102169_raw_cff.latency
latency
Definition: config_102169_raw_cff.py:29
SiStripLatencyFakeESSource::m_mode
uint32_t m_mode
Definition: SiStripLatencyFakeESSource.cc:42
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ValidityInterval
Definition: ValidityInterval.h:28
ESProducer.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
SiStripLatencyFakeESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
Definition: SiStripLatencyFakeESSource.cc:57
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
SiStripDetInfoFileReader::read
SiStripDetInfo read(std::string filePath)
Definition: SiStripDetInfoFileReader.cc:11
edm::FileInPath
Definition: FileInPath.h:61
SiStripLatencyFakeESSource::produce
ReturnType produce(const SiStripLatencyRcd &)
Definition: SiStripLatencyFakeESSource.cc:64
SiStripLatencyFakeESSource::ReturnType
std::unique_ptr< SiStripLatency > ReturnType
Definition: SiStripLatencyFakeESSource.cc:37
SiStripLatencyFakeESSource
Definition: SiStripLatencyFakeESSource.cc:28
SiStripDetInfo::getAllData
const std::map< uint32_t, DetInfo > & getAllData() const noexcept
Definition: SiStripDetInfo.h:59
SiStripDetInfoFileReader.h
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
EventSetupRecordIntervalFinder.h
SourceFactory.h
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripCondDataRecords.h
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
SiStripLatencyFakeESSource::~SiStripLatencyFakeESSource
~SiStripLatencyFakeESSource() override
Definition: SiStripLatencyFakeESSource.cc:55
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiStripLatencyFakeESSource::SiStripLatencyFakeESSource
SiStripLatencyFakeESSource(const edm::ParameterSet &)
Definition: SiStripLatencyFakeESSource.cc:46
edm::es
Definition: es_Label.h:33
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripLatencyFakeESSource::m_latency
uint32_t m_latency
Definition: SiStripLatencyFakeESSource.cc:41
SiStripLatencyRcd
Definition: SiStripCondDataRecords.h:36
edm::ESProducer
Definition: ESProducer.h:104
SiStripDetInfo
Definition: SiStripDetInfo.h:29
SiStripLatency.h
ParameterSet.h
SiStripLatencyFakeESSource::m_detInfo
SiStripDetInfo m_detInfo
Definition: SiStripLatencyFakeESSource.cc:43
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161