CMS 3D CMS Logo

SiPixelFakeGainESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiPixelESProducers
4 // Class: SiPixelFakeGainESSource
5 //
13 //
14 // Original Author: Vincenzo Chiochia
15 // Created: Tue 8 12:31:25 CEST 2007
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
37 
38 //
39 // class decleration
40 //
41 
43 public:
45  ~SiPixelFakeGainESSource() override = default;
46 
47  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
48 
49  virtual std::unique_ptr<SiPixelGainCalibration> produce(const SiPixelGainCalibrationRcd&);
50 
51 protected:
53  const edm::IOVSyncValue&,
54  edm::ValidityInterval&) override;
55 
56 private:
58 };
59 
60 //
61 // constructors and destructor
62 //
64  : fp_(conf_.getParameter<edm::FileInPath>("file")) {
65  edm::LogInfo("SiPixelFakeGainESSource::SiPixelFakeGainESSource");
66  //the following line is needed to tell the framework what
67  // data is being produced
68  setWhatProduced(this);
69  findingRecord<SiPixelGainCalibrationRcd>();
70 }
71 
72 std::unique_ptr<SiPixelGainCalibration> SiPixelFakeGainESSource::produce(const SiPixelGainCalibrationRcd&) {
73  using namespace edm::es;
74  SiPixelGainCalibration* obj = new SiPixelGainCalibration(25., 30., 2., 3.);
76  const std::vector<uint32_t>& DetIds = reader.getAllDetIds();
77 
78  // Loop over detectors
79  for (std::vector<uint32_t>::const_iterator detit = DetIds.begin(); detit != DetIds.end(); detit++) {
80  std::vector<char> theSiPixelGainCalibration;
81  const std::pair<int, int>& detUnitDimensions = reader.getDetUnitDimensions(*detit);
82 
83  // Loop over columns and rows
84  for (int i = 0; i < detUnitDimensions.first; i++) {
85  for (int j = 0; j < detUnitDimensions.second; j++) {
86  float gain = 2.8;
87  float ped = 28.2;
88  obj->setData(ped, gain, theSiPixelGainCalibration);
89  }
90  }
91 
92  //std::cout << "detid " << (*detit) << std::endl;
93 
94  SiPixelGainCalibration::Range range(theSiPixelGainCalibration.begin(), theSiPixelGainCalibration.end());
95  if (!obj->put(*detit, range, detUnitDimensions.first))
96  edm::LogError("SiPixelFakeGainESSource")
97  << "[SiPixelFakeGainESSource::produce] detid already exists" << std::endl;
98  }
99 
100  //
101  return std::unique_ptr<SiPixelGainCalibration>(obj);
102 }
103 
105  const edm::IOVSyncValue& iosv,
106  edm::ValidityInterval& oValidity) {
108  oValidity = infinity;
109 }
110 
113  desc.add<edm::FileInPath>("file", edm::FileInPath("CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt"));
114  descriptions.addWithDefaultLabel(desc);
115 }
116 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
SiPixelFakeGainESSource(const edm::ParameterSet &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
const double infinity
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Log< level::Info, false > LogInfo
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
std::pair< ContainerIterator, ContainerIterator > Range
HLT enums.
virtual std::unique_ptr< SiPixelGainCalibration > produce(const SiPixelGainCalibrationRcd &)
const std::string & fullPath() const
Definition: FileInPath.cc:144
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~SiPixelFakeGainESSource() override=default