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 
24 
26 public:
29 
31 
32  typedef std::unique_ptr<SiStripThreshold> ReturnType;
33  ReturnType produce(const SiStripThresholdRcd&);
34 
35 private:
36  float m_lTh;
37  float m_hTh;
38  float m_cTh;
39 };
40 
43 
45 {
46  setWhatProduced(this);
47  findingRecord<SiStripThresholdRcd>();
48 
49  m_lTh = iConfig.getParameter<double>("LowTh");
50  m_hTh = iConfig.getParameter<double>("HighTh");
51  m_cTh = iConfig.getParameter<double>("ClusTh");
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  auto threshold = std::make_unique<SiStripThreshold>();
68 
70  for ( const auto& elm : reader->getAllData() ) {
71  //Generate Thresholds for det detid
72  SiStripThreshold::Container theSiStripVector;
73  uint16_t strip=0;
74 
75  threshold->setData(strip, m_lTh, m_hTh, m_cTh, theSiStripVector);
76  LogDebug("SiStripThresholdFakeESSource::produce") << "detid: " << elm.first << " \t"
77  << "firstStrip: " << strip << " \t" << theSiStripVector.back().getFirstStrip() << " \t"
78  << "lTh: " << m_lTh << " \t" << theSiStripVector.back().getLth() << " \t"
79  << "hTh: " << m_hTh << " \t" << theSiStripVector.back().getHth() << " \t"
80  << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \t";
81 
82  if ( ! threshold->put(elm.first, theSiStripVector) ) {
83  edm::LogError("SiStripThresholdFakeESSource::produce ") << " detid already exists";
84  }
85  }
86 
87  return threshold;
88 }
89 
90 //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:124
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
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91