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;
38  ReturnType produce(const SiStripThresholdRcd&);
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  SiStripDetInfoFileReader{iConfig.getParameter<edm::FileInPath>("SiStripDetInfoFile").fullPath()};
56 }
57 
59 
61  const edm::IOVSyncValue& iov,
62  edm::ValidityInterval& iValidity) {
63  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
64 }
65 
66 // ------------ method called to produce the data ------------
68  using namespace edm::es;
69 
70  auto threshold = std::make_unique<SiStripThreshold>();
71 
72  for (const auto& elm : m_detInfoFileReader.getAllData()) {
73  //Generate Thresholds for det detid
74  SiStripThreshold::Container theSiStripVector;
75  uint16_t strip = 0;
76 
77  threshold->setData(strip, m_lTh, m_hTh, m_cTh, theSiStripVector);
78  LogDebug("SiStripThresholdFakeESSource::produce")
79  << "detid: " << elm.first << " \t"
80  << "firstStrip: " << strip << " \t" << theSiStripVector.back().getFirstStrip() << " \t"
81  << "lTh: " << m_lTh << " \t" << theSiStripVector.back().getLth() << " \t"
82  << "hTh: " << m_hTh << " \t" << theSiStripVector.back().getHth() << " \t"
83  << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \t";
84 
85  if (!threshold->put(elm.first, theSiStripVector)) {
86  edm::LogError("SiStripThresholdFakeESSource::produce ") << " detid already exists";
87  }
88  }
89 
90  return threshold;
91 }
92 
93 //define this as a plug-in
#define LogDebug(id)
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ReturnType produce(const SiStripThresholdRcd &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::vector< Data > Container
std::unique_ptr< SiStripThreshold > ReturnType
SiStripThresholdFakeESSource(const edm::ParameterSet &)
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
SiStripDetInfoFileReader m_detInfoFileReader
const std::map< uint32_t, DetInfo > & getAllData() const
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91