14 numberOfRowsToAverageOver_(1),
15 nBinsToUseForEncoding_(253),
20 throw cms::Exception(
"GainCalibration Payload configuration error")
21 <<
"[SiPixelGainCalibration::SiPixelGainCalibration] Dead flag was set to " <<
deadFlag_ <<
", and it must be set less than or equal to 255";
35 throw cms::Exception(
"GainCalibration Payload configuration error")
36 <<
"[SiPixelGainCalibration::SiPixelGainCalibration] Dead flag was set to " <<
deadFlag_ <<
", and it must be set less than or equal to 255";
43 if (p!=
indexes.end() && p->detid==DetId)
46 size_t sd= input.second-input.first;
48 detregistry.
detid=DetId;
49 detregistry.
ncols=nCols;
61 if (p==
indexes.end()|| p->detid!=DetId)
71 if (p==
indexes.end()|| p->detid!=DetId)
77 const std::pair<const SiPixelGainCalibration::Range, const int>
80 if (p==
indexes.end()|| p->detid!=DetId)
92 DetIds_.push_back(
p->detid);
98 float theEncodedGain=0;
99 float theEncodedPed=0;
100 if(!isDeadPixel && !isNoisyPixel){
105 unsigned int ped_ = (
static_cast<unsigned int>(theEncodedPed)) & 0xFF;
106 unsigned int gain_ = (
static_cast<unsigned int>(theEncodedGain)) & 0xFF;
118 unsigned int data = (ped_ << 8) | gain_ ;
119 vped.resize(vped.size()+2);
121 ::memcpy((
void*)(&vped[vped.size()-2]),(
void*)(&
data),2);
126 int nRows = (range.second-range.first)/2 / nCols;
128 if (col >= nCols || row >= nRows){
130 <<
"[SiPixelGainCalibration::getPed] Pixel out of range: col " << col <<
" row " << row;
141 int nRows = (range.second-range.first)/2 / nCols;
143 if (col >= nCols || row >= nRows){
145 <<
"[SiPixelGainCalibration::getPed] Pixel out of range: col " << col <<
" row " << row;
156 if(gain < minGain_ || gain >
maxGain_ ) {
158 <<
"[SiPixelGainCalibration::encodeGain] Trying to encode gain (" << gain <<
") out of range [" <<
minGain_ <<
"," << maxGain_ <<
"]\n";
169 if(ped < minPed_ || ped >
maxPed_ ) {
171 <<
"[SiPixelGainCalibration::encodePed] Trying to encode pedestal (" << ped <<
") out of range [" <<
minPed_ <<
"," << maxPed_ <<
"]\n";
float decodeGain(unsigned int gain) const
std::vector< char > v_pedestals
unsigned int nBinsToUseForEncoding_
void getDetIds(std::vector< uint32_t > &DetIds_) const
std::vector< DetRegistry > indexes
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
bool put(const uint32_t &detID, Range input, const int &nCols)
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
static std::string const input
unsigned int numberOfRowsToAverageOver_
float encodePed(const float &ped)
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
const Range getRange(const uint32_t &detID) const
Registry::const_iterator RegistryIterator
std::pair< ContainerIterator, ContainerIterator > Range
char data[epos_bytes_allocation]
const int getNCols(const uint32_t &detID) const
void setData(float ped, float gain, std::vector< char > &vped, bool thisPixelIsDead=false, bool thisPixelIsNoisy=false)
float encodeGain(const float &gain)
float decodePed(unsigned int ped) const