File indexing completed on 2024-04-06 11:59:33
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeGainESSource.h"
0022 #include "CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileReader.h"
0023 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0024 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0026
0027
0028
0029 SiPixelFakeGainESSource::SiPixelFakeGainESSource(const edm::ParameterSet& conf_)
0030 : fp_(conf_.getParameter<edm::FileInPath>("file")) {
0031 edm::LogInfo("SiPixelFakeGainESSource::SiPixelFakeGainESSource");
0032
0033
0034 setWhatProduced(this);
0035 findingRecord<SiPixelGainCalibrationRcd>();
0036 }
0037
0038 SiPixelFakeGainESSource::~SiPixelFakeGainESSource() {
0039
0040
0041 }
0042
0043 std::unique_ptr<SiPixelGainCalibration> SiPixelFakeGainESSource::produce(const SiPixelGainCalibrationRcd&) {
0044 using namespace edm::es;
0045 SiPixelGainCalibration* obj = new SiPixelGainCalibration(25., 30., 2., 3.);
0046 SiPixelDetInfoFileReader reader(fp_.fullPath());
0047 const std::vector<uint32_t>& DetIds = reader.getAllDetIds();
0048
0049
0050 for (std::vector<uint32_t>::const_iterator detit = DetIds.begin(); detit != DetIds.end(); detit++) {
0051 std::vector<char> theSiPixelGainCalibration;
0052 const std::pair<int, int>& detUnitDimensions = reader.getDetUnitDimensions(*detit);
0053
0054
0055 for (int i = 0; i < detUnitDimensions.first; i++) {
0056 for (int j = 0; j < detUnitDimensions.second; j++) {
0057 float gain = 2.8;
0058 float ped = 28.2;
0059 obj->setData(ped, gain, theSiPixelGainCalibration);
0060 }
0061 }
0062
0063
0064
0065 SiPixelGainCalibration::Range range(theSiPixelGainCalibration.begin(), theSiPixelGainCalibration.end());
0066 if (!obj->put(*detit, range, detUnitDimensions.first))
0067 edm::LogError("SiPixelFakeGainESSource")
0068 << "[SiPixelFakeGainESSource::produce] detid already exists" << std::endl;
0069 }
0070
0071
0072 return std::unique_ptr<SiPixelGainCalibration>(obj);
0073 }
0074
0075 void SiPixelFakeGainESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0076 const edm::IOVSyncValue& iosv,
0077 edm::ValidityInterval& oValidity) {
0078 edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime());
0079 oValidity = infinity;
0080 }