test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::shared_ptr<SiStripThreshold> ReturnType;
34 
35 private:
36  float m_lTh;
37  float m_hTh;
38  float m_cTh;
40 };
41 
44 
46 {
47  setWhatProduced(this);
48  findingRecord<SiStripThresholdRcd>();
49 
50  m_lTh = iConfig.getParameter<double>("LowTh");
51  m_hTh = iConfig.getParameter<double>("HighTh");
52  m_cTh = iConfig.getParameter<double>("ClusTh");
53  m_file = iConfig.getParameter<edm::FileInPath>("file");
54 }
55 
57 
59 {
60  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
61 }
62 
63 // ------------ method called to produce the data ------------
66 {
67  using namespace edm::es;
68 
69  std::shared_ptr<SiStripThreshold> threshold{new SiStripThreshold};
70 
72 
73  for ( const auto& elm : reader.getAllData() ) {
74  //Generate Thresholds for det detid
75  SiStripThreshold::Container theSiStripVector;
76  uint16_t strip=0;
77 
78  threshold->setData(strip, m_lTh, m_hTh, m_cTh, theSiStripVector);
79  LogDebug("SiStripThresholdFakeESSource::produce") << "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
ReturnType produce(const SiStripThresholdRcd &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::vector< Data > Container
SiStripThresholdFakeESSource(const edm::ParameterSet &)
tuple iov
Definition: o2o.py:307
static const IOVSyncValue & beginOfTime()
std::shared_ptr< SiStripThreshold > ReturnType
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
std::string fullPath() const
Definition: FileInPath.cc:184