14 numberOfRowsToAverageOver_(80),
15 nBinsToUseForEncoding_(253),
20 throw cms::Exception(
"GainCalibration Payload configuration error")
21 <<
"[SiPixelGainCalibrationHLT::SiPixelGainCalibrationHLT] Dead flag was set to " <<
deadFlag_ <<
", and it must be set less than or equal to 255";
29 numberOfRowsToAverageOver_(80),
30 nBinsToUseForEncoding_(253),
35 throw cms::Exception(
"GainCalibration Payload configuration error")
36 <<
"[SiPixelGainCalibrationHLT::SiPixelGainCalibrationHLT] 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;
51 detregistry.
ncols=nCols;
61 if (p==
indexes.end()|| p->detid!=DetId)
73 if (p==
indexes.end()|| p->detid!=DetId)
79 const std::pair<const SiPixelGainCalibrationForHLT::Range, const int>
82 if (p==
indexes.end()|| p->detid!=DetId)
93 DetIds_.push_back(
p->detid);
99 float theEncodedGain=0;
100 float theEncodedPed=0;
101 if(!thisColumnIsDead && !thisColumnIsNoisy){
106 unsigned int ped_ = (
static_cast<unsigned int>(theEncodedPed)) & 0xFF;
107 unsigned int gain_ = (
static_cast<unsigned int>(theEncodedGain)) & 0xFF;
109 if (thisColumnIsDead)
114 else if (thisColumnIsNoisy)
120 unsigned int data = (ped_ << 8) | gain_ ;
121 vped.resize(vped.size()+2);
123 ::memcpy((
void*)(&vped[vped.size()-2]),(
void*)(&
data),2);
130 unsigned int lengthOfColumnData = (range.second-range.first)/nCols;
131 unsigned int lengthOfAveragedDataInEachColumn = 2;
139 isNoisyColumn =
true;
142 if (col >= nCols || row > maxRow){
144 <<
"[SiPixelGainCalibrationForHLT::getPed] Pixel out of range: col " << col <<
" row: " << row;
152 unsigned int lengthOfColumnData = (range.second-range.first)/nCols;
153 unsigned int lengthOfAveragedDataInEachColumn = 2;
161 isNoisyColumn =
true;
164 if (col >= nCols || row > maxRow){
166 <<
"[SiPixelGainCalibrationForHLT::getGain] Pixel out of range: col " << col <<
" row: " << row;
174 if(gain < minGain_ || gain >
maxGain_ ) {
176 <<
"[SiPixelGainCalibrationForHLT::encodeGain] Trying to encode gain (" << gain <<
") out of range [" <<
minGain_ <<
"," << maxGain_ <<
"]\n";
179 float encodedGain = (float)((gain-
minGain_)/precision);
187 if(ped < minPed_ || ped >
maxPed_ ) {
189 <<
"[SiPixelGainCalibrationForHLT::encodePed] Trying to encode pedestal (" << ped <<
") out of range [" <<
minPed_ <<
"," << maxPed_ <<
"]\n";
192 float encodedPed = (float)((ped-
minPed_)/precision);
201 float decodedPed = (float)(ped*precision +
minPed_);
209 float decodedGain = (float)(gain*precision +
minGain_);
SiPixelGainCalibrationForHLT()
void setData(float ped, float gain, std::vector< char > &vped, bool thisColumnIsDead=false, bool thisColumnIsNoisy=false)
float encodePed(const float &ped)
void getDetIds(std::vector< uint32_t > &DetIds_) const
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
std::vector< DetRegistry > indexes
std::pair< ContainerIterator, ContainerIterator > Range
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
unsigned int numberOfRowsToAverageOver_
float decodePed(unsigned int ped) const
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
float decodeGain(unsigned int gain) const
float encodeGain(const float &gain)
bool put(const uint32_t &detID, Range input, const int &nCols)
Registry::const_iterator RegistryIterator
unsigned int nBinsToUseForEncoding_
const Range getRange(const uint32_t &detID) const
char data[epos_bytes_allocation]
const int getNCols(const uint32_t &detID) const
std::vector< char > v_pedestals