CMS 3D CMS Logo

SiStripThresholdFakeESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiStripESProducers
4 // Class: SiStripThresholdFakeESSource
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<SiStripThreshold> ReturnType;
39 
40 private:
41  float m_lTh;
42  float m_hTh;
43  float m_cTh;
45 };
46 
48  setWhatProduced(this);
49  findingRecord<SiStripThresholdRcd>();
50 
51  m_lTh = iConfig.getParameter<double>("LowTh");
52  m_hTh = iConfig.getParameter<double>("HighTh");
53  m_cTh = iConfig.getParameter<double>("ClusTh");
55 }
56 
58 
60  const edm::IOVSyncValue& iov,
61  edm::ValidityInterval& iValidity) {
62  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
63 }
64 
65 // ------------ method called to produce the data ------------
67  using namespace edm::es;
68 
69  auto threshold = std::make_unique<SiStripThreshold>();
70 
71  for (const auto& elm : m_detInfo.getAllData()) {
72  //Generate Thresholds for det detid
73  SiStripThreshold::Container theSiStripVector;
74  uint16_t strip = 0;
75 
76  threshold->setData(strip, m_lTh, m_hTh, m_cTh, theSiStripVector);
77  LogDebug("SiStripThresholdFakeESSource::produce")
78  << "detid: " << elm.first << " \t"
79  << "firstStrip: " << strip << " \t" << theSiStripVector.back().getFirstStrip() << " \t"
80  << "lTh: " << m_lTh << " \t" << theSiStripVector.back().getLth() << " \t"
81  << "hTh: " << m_hTh << " \t" << theSiStripVector.back().getHth() << " \t"
82  << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \t";
83 
84  if (!threshold->put(elm.first, theSiStripVector)) {
85  edm::LogError("SiStripThresholdFakeESSource::produce ") << " detid already exists";
86  }
87  }
88 
89  return threshold;
90 }
91 
92 //define this as a plug-in
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string fullPath() const
Definition: FileInPath.cc:161
ReturnType produce(const SiStripThresholdRcd &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
Log< level::Error, false > LogError
std::vector< Data > Container
std::unique_ptr< SiStripThreshold > ReturnType
SiStripThresholdFakeESSource(const edm::ParameterSet &)
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
SiStripDetInfo read(std::string filePath)
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
const std::map< uint32_t, DetInfo > & getAllData() const noexcept
#define LogDebug(id)