CMS 3D CMS Logo

SiPixelFakeGainESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelFakeGainESSource
4 // Class: SiPixelFakeGainESSource
5 //
13 //
14 // Original Author: Vincenzo Chiochia
15 // Created: Fri Apr 27 12:31:25 CEST 2007
16 //
17 //
18 
19 // user include files
20 
26 //
27 // constructors and destructor
28 //
30  : fp_(conf_.getParameter<edm::FileInPath>("file")) {
31  edm::LogInfo("SiPixelFakeGainESSource::SiPixelFakeGainESSource");
32  //the following line is needed to tell the framework what
33  // data is being produced
34  setWhatProduced(this);
35  findingRecord<SiPixelGainCalibrationRcd>();
36 }
37 
39  // do anything here that needs to be done at desctruction time
40  // (e.g. close files, deallocate resources etc.)
41 }
42 
43 std::unique_ptr<SiPixelGainCalibration> SiPixelFakeGainESSource::produce(const SiPixelGainCalibrationRcd&) {
44  using namespace edm::es;
45  SiPixelGainCalibration* obj = new SiPixelGainCalibration(25., 30., 2., 3.);
47  const std::vector<uint32_t>& DetIds = reader.getAllDetIds();
48 
49  // Loop over detectors
50  for (std::vector<uint32_t>::const_iterator detit = DetIds.begin(); detit != DetIds.end(); detit++) {
51  std::vector<char> theSiPixelGainCalibration;
52  const std::pair<int, int>& detUnitDimensions = reader.getDetUnitDimensions(*detit);
53 
54  // Loop over columns and rows
55  for (int i = 0; i < detUnitDimensions.first; i++) {
56  for (int j = 0; j < detUnitDimensions.second; j++) {
57  float gain = 2.8;
58  float ped = 28.2;
59  obj->setData(ped, gain, theSiPixelGainCalibration);
60  }
61  }
62 
63  //std::cout << "detid " << (*detit) << std::endl;
64 
65  SiPixelGainCalibration::Range range(theSiPixelGainCalibration.begin(), theSiPixelGainCalibration.end());
66  if (!obj->put(*detit, range, detUnitDimensions.first))
67  edm::LogError("SiPixelFakeGainESSource")
68  << "[SiPixelFakeGainESSource::produce] detid already exists" << std::endl;
69  }
70 
71  //
72  return std::unique_ptr<SiPixelGainCalibration>(obj);
73 }
74 
76  const edm::IOVSyncValue& iosv,
77  edm::ValidityInterval& oValidity) {
79  oValidity = infinity;
80 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
std::string fullPath() const
Definition: FileInPath.cc:161
SiPixelFakeGainESSource(const edm::ParameterSet &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
reader
Definition: DQM.py:105
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
std::pair< ContainerIterator, ContainerIterator > Range
HLT enums.
virtual std::unique_ptr< SiPixelGainCalibration > produce(const SiPixelGainCalibrationRcd &)