14 numberOfRowsToAverageOver_(80),
15 nBinsToUseForEncoding_(253),
21 throw cms::Exception(
"GainCalibration Payload configuration error")
22 <<
"[SiPixelGainCalibrationHLT::SiPixelGainCalibrationHLT] Dead flag was set to " <<
deadFlag_ <<
", and it must be set less than or equal to 255";
30 numberOfRowsToAverageOver_(80),
31 nBinsToUseForEncoding_(253),
37 throw cms::Exception(
"GainCalibration Payload configuration error")
38 <<
"[SiPixelGainCalibrationHLT::SiPixelGainCalibrationHLT] Dead flag was set to " <<
deadFlag_ <<
", and it must be set less than or equal to 255";
52 if (p!=
indexes.end() && p->detid==DetId)
55 size_t sd= input.second-input.first;
57 detregistry.
detid=DetId;
60 detregistry.
ncols=nCols;
70 if (p==
indexes.end()|| p->detid!=DetId)
82 if (p==
indexes.end()|| p->detid!=DetId)
88 const std::pair<const SiPixelGainCalibrationForHLT::Range, const int>
91 if (p==
indexes.end()|| p->detid!=DetId)
102 DetIds_.push_back(
p->detid);
108 float theEncodedGain=0;
109 float theEncodedPed=0;
110 if(!thisColumnIsDead && !thisColumnIsNoisy){
115 unsigned int ped_ = (
static_cast<unsigned int>(theEncodedPed)) & 0xFF;
116 unsigned int gain_ = (
static_cast<unsigned int>(theEncodedGain)) & 0xFF;
118 if (thisColumnIsDead)
123 else if (thisColumnIsNoisy)
129 unsigned int data = (ped_ << 8) | gain_ ;
130 vped.resize(vped.size()+2);
132 ::memcpy((
void*)(&vped[vped.size()-2]),(
void*)(&
data),2);
138 unsigned int lengthOfColumnData = (range.second-range.first)/nCols;
139 unsigned int lengthOfAveragedDataInEachColumn = 2;
165 unsigned int lengthOfColumnData = (range.second-range.first)/nCols;
166 unsigned int lengthOfAveragedDataInEachColumn = 2;
174 isNoisyColumn =
true;
177 if (col >= nCols || row > maxRow){
179 <<
"[SiPixelGainCalibrationForHLT::getPed] Pixel out of range: col " << col <<
" row: " << row;
187 unsigned int lengthOfColumnData = (range.second-range.first)/nCols;
188 unsigned int lengthOfAveragedDataInEachColumn = 2;
196 isNoisyColumn =
true;
199 if (col >= nCols || row > maxRow){
201 <<
"[SiPixelGainCalibrationForHLT::getGain] Pixel out of range: col " << col <<
" row: " << row;
209 if(gain < minGain_ || gain >
maxGain_ ) {
211 <<
"[SiPixelGainCalibrationForHLT::encodeGain] Trying to encode gain (" << gain <<
") out of range [" <<
minGain_ <<
"," << maxGain_ <<
"]\n";
214 float encodedGain = (float)((gain-
minGain_)/precision);
222 if(ped < minPed_ || ped >
maxPed_ ) {
224 <<
"[SiPixelGainCalibrationForHLT::encodePed] Trying to encode pedestal (" << ped <<
") out of range [" <<
minPed_ <<
"," << maxPed_ <<
"]\n";
227 float encodedPed = (float)((ped-
minPed_)/precision);
std::pair< float, float > getPedAndGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
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
static std::string const input
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
const int getNCols(const uint32_t &detID) const
std::vector< char > v_pedestals