14 numberOfRowsToAverageOver_(1),
15 nBinsToUseForEncoding_(253),
19 throw cms::Exception(
"GainCalibration Payload configuration error")
20 <<
"[SiPixelGainCalibration::SiPixelGainCalibration] Dead flag was set to " <<
deadFlag_ 21 <<
", and it must be set less than or equal to 255";
29 numberOfRowsToAverageOver_(1),
30 nBinsToUseForEncoding_(253),
34 throw cms::Exception(
"GainCalibration Payload configuration error")
35 <<
"[SiPixelGainCalibration::SiPixelGainCalibration] Dead flag was set to " <<
deadFlag_ 36 <<
", and it must be set less than or equal to 255";
42 Registry::iterator
p =
50 detregistry.
ncols = nCols;
81 const uint32_t&
DetId)
const {
96 DetIds_.push_back(
p->detid);
101 float ped,
float gain, std::vector<char>& vped,
bool isDeadPixel,
bool isNoisyPixel) {
102 float theEncodedGain = 0;
103 float theEncodedPed = 0;
104 if (!isDeadPixel && !isNoisyPixel) {
109 unsigned int ped_ = (
static_cast<unsigned int>(theEncodedPed)) & 0xFF;
110 unsigned int gain_ = (
static_cast<unsigned int>(theEncodedGain)) & 0xFF;
121 vped.resize(vped.size() + 2);
123 ::memcpy((
void*)(&vped[vped.size() - 2]), (
void*)(&
data), 2);
127 const int&
col,
const int& row,
const Range&
range,
const int& nCols,
bool& isDead,
bool& isNoisy)
const {
128 int nRows = (
range.second -
range.first) / 2 / nCols;
129 const unsigned int ped = *(
range.first + 1 + (
col * nRows + row) * 2) & 0xFF;
130 if (
col >= nCols || row >= nRows) {
132 <<
"[SiPixelGainCalibration::getPed] Pixel out of range: col " <<
col <<
" row " << row;
142 const int&
col,
const int& row,
const Range&
range,
const int& nCols,
bool& isDead,
bool& isNoisy)
const {
143 int nRows = (
range.second -
range.first) / 2 / nCols;
144 const unsigned int gain = *(
range.first + (
col * nRows + row) * 2) & 0xFF;
145 if (
col >= nCols || row >= nRows) {
147 <<
"[SiPixelGainCalibration::getPed] Pixel out of range: col " <<
col <<
" row " << row;
157 if (gain < minGain_ || gain >
maxGain_) {
158 throw cms::Exception(
"InsertFailure") <<
"[SiPixelGainCalibration::encodeGain] Trying to encode gain (" <<
gain 168 if (ped < minPed_ || ped >
maxPed_) {
169 throw cms::Exception(
"InsertFailure") <<
"[SiPixelGainCalibration::encodePed] Trying to encode pedestal (" <<
ped std::vector< char > v_pedestals
unsigned int nBinsToUseForEncoding_
std::vector< DetRegistry > indexes
bool put(const uint32_t &detID, Range input, const int &nCols)
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
static std::string const input
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
float encodePed(const float &ped)
float decodePed(unsigned int ped) const
Registry::const_iterator RegistryIterator
const Range getRange(const uint32_t &detID) const
const int getNCols(const uint32_t &detID) const
std::pair< ContainerIterator, ContainerIterator > Range
void getDetIds(std::vector< uint32_t > &DetIds_) const
char data[epos_bytes_allocation]
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
void setData(float ped, float gain, std::vector< char > &vped, bool thisPixelIsDead=false, bool thisPixelIsNoisy=false)
float decodeGain(unsigned int gain) const
float encodeGain(const float &gain)