CMS 3D CMS Logo

SiPixelFakeGainForHLTESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelFakeGainForHLTESSource
4 // Class: SiPixelFakeGainForHLTESSource
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("SiPixelFakeGainForHLTESSource::SiPixelFakeGainForHLTESSource");
32  //the following line is needed to tell the framework what
33  // data is being produced
34  setWhatProduced(this);
35  findingRecord<SiPixelGainCalibrationForHLTRcd>();
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<SiPixelGainCalibrationForHLT> SiPixelFakeGainForHLTESSource::produce(
45  using namespace edm::es;
46  unsigned int nmodules = 0;
47  uint32_t nchannels = 0;
50  const std::vector<uint32_t>& DetIds = reader.getAllDetIds();
51 
52  // Loop over detectors
53  for (std::vector<uint32_t>::const_iterator detit = DetIds.begin(); detit != DetIds.end(); detit++) {
54  nmodules++;
55  std::vector<char> theSiPixelGainCalibration;
56  const std::pair<int, int>& detUnitDimensions = reader.getDetUnitDimensions(*detit);
57 
58  // Loop over columns and rows
59 
60  for (int i = 0; i < detUnitDimensions.first; i++) {
61  float totalGain = 0.0;
62  float totalPed = 0.0;
63  float totalEntries = 0.0;
64  for (int j = 0; j < detUnitDimensions.second; j++) {
65  nchannels++;
66  totalGain += 2.8;
67  totalPed += 28.2;
68  totalEntries++;
69  if ((j + 1) % 80 == 0) {
70  float gain = totalGain / totalEntries;
71  float ped = totalPed / totalEntries;
72 
73  obj->setData(ped, gain, theSiPixelGainCalibration);
74  totalGain = 0.;
75  totalPed = 0.;
76  totalEntries = 0.;
77  }
78  }
79  }
80 
81  //std::cout << "detid " << (*detit) << std::endl;
82 
83  SiPixelGainCalibrationForHLT::Range range(theSiPixelGainCalibration.begin(), theSiPixelGainCalibration.end());
84  int nCols = detUnitDimensions.first;
85  if (!obj->put(*detit, range, nCols))
86  edm::LogError("SiPixelFakeGainForHLTESSource")
87  << "[SiPixelFakeGainForHLTESSource::produce] detid already exists" << std::endl;
88  }
89 
90  //std::cout << "Modules = " << nmodules << " Channels " << nchannels << std::endl;
91 
92  //
93  return std::unique_ptr<SiPixelGainCalibrationForHLT>(obj);
94 }
95 
97  const edm::IOVSyncValue& iosv,
98  edm::ValidityInterval& oValidity) {
100  oValidity = infinity;
101 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
SiPixelGainCalibrationForHLTRcd
Definition: SiPixelGainCalibrationForHLTRcd.h:24
TrackerGeometry.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ValidityInterval
Definition: ValidityInterval.h:28
SiPixelGainCalibrationForHLT::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiPixelGainCalibrationForHLT.h:51
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
SiPixelFakeGainForHLTESSource.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
SiPixelDetInfoFileReader
Definition: SiPixelDetInfoFileReader.h:28
SiPixelGainCalibrationForHLT
Definition: SiPixelGainCalibrationForHLT.h:29
DQM.reader
reader
Definition: DQM.py:105
SiPixelFakeGainForHLTESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: SiPixelFakeGainForHLTESSource.cc:96
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
SiPixelDetInfoFileReader.h
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
SiPixelFakeGainForHLTESSource::produce
virtual std::unique_ptr< SiPixelGainCalibrationForHLT > produce(const SiPixelGainCalibrationForHLTRcd &)
Definition: SiPixelFakeGainForHLTESSource.cc:43
edm::es
Definition: es_Label.h:33
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
SiPixelFakeGainForHLTESSource::~SiPixelFakeGainForHLTESSource
~SiPixelFakeGainForHLTESSource() override
Definition: SiPixelFakeGainForHLTESSource.cc:38
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Log
Definition: MessageLogger.h:70
SiPixelFakeGainForHLTESSource::fp_
edm::FileInPath fp_
Definition: SiPixelFakeGainForHLTESSource.h:49
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
SiPixelFakeGainForHLTESSource::SiPixelFakeGainForHLTESSource
SiPixelFakeGainForHLTESSource(const edm::ParameterSet &)
Definition: SiPixelFakeGainForHLTESSource.cc:29