CMS 3D CMS Logo

SiStripBackPlaneCorrectionFakeESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiStripESProducers
4 // Class: SiStripBackPlaneCorrectionFakeESSource
5 //
14 // system include files
15 #include <memory>
16 
17 // user include files
20 
24 
26 public:
29 
31 
32  typedef std::unique_ptr<SiStripBackPlaneCorrection> ReturnType;
33  ReturnType produce(const SiStripBackPlaneCorrectionRcd&);
34 
35 private:
36  std::vector<double> m_valuePerModuleGeometry;
37 };
38 
43 
45 {
46  setWhatProduced(this);
47  findingRecord<SiStripBackPlaneCorrectionRcd>();
48 
49  m_valuePerModuleGeometry = iConfig.getParameter<std::vector<double>>("BackPlaneCorrection_PerModuleGeometry");
50 }
51 
53 
55 {
56  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
57 }
58 
59 // ------------ method called to produce the data ------------
62 {
63  using namespace edm::es;
64 
66  iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);
67 
68  auto backPlaneCorrection = std::make_unique<SiStripBackPlaneCorrection>();
69 
71  for ( const auto& detId : reader->getAllDetIds() ) {
72  unsigned int moduleGeometry = tTopo->moduleGeometry(DetId(detId))-1;
73  if ( moduleGeometry > m_valuePerModuleGeometry.size() ) {
74  edm::LogError("SiStripBackPlaneCorrectionGenerator") << " BackPlaneCorrection_PerModuleGeometry only contains " << m_valuePerModuleGeometry.size() << "elements and module is out of range";
75  }
76  float value = m_valuePerModuleGeometry[moduleGeometry];
77  if ( ! backPlaneCorrection->putBackPlaneCorrection(detId, value) ) {
78  edm::LogError("SiStripBackPlaneCorrectionGenerator")<<" detid already exists";
79  }
80  }
81 
82  return backPlaneCorrection;
83 }
84 
85 //define this as a plug-in
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
ReturnType produce(const SiStripBackPlaneCorrectionRcd &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
SiStripDetId::ModuleGeometry moduleGeometry(const DetId &id) const
std::unique_ptr< SiStripBackPlaneCorrection > ReturnType
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
Definition: value.py:1
Definition: DetId.h:18
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91