14 numberOfRowsToAverageOver_(80),
15 nBinsToUseForEncoding_(253),
20 throw cms::Exception(
"GainCalibration Payload configuration error")
21 <<
"[SiPixelGainCalibrationHLT::SiPixelGainCalibrationHLT] Dead flag was set to " <<
deadFlag_ 22 <<
", and it must be set less than or equal to 255";
30 numberOfRowsToAverageOver_(80),
31 nBinsToUseForEncoding_(253),
36 throw cms::Exception(
"GainCalibration Payload configuration error")
37 <<
"[SiPixelGainCalibrationHLT::SiPixelGainCalibrationHLT] Dead flag was set to " <<
deadFlag_ 38 <<
", and it must be set less than or equal to 255";
49 Registry::iterator
p =
59 detregistry.
ncols = nCols;
89 const uint32_t&
DetId)
const {
95 return std::make_pair(
104 DetIds_.push_back(
p->detid);
109 float ped,
float gain, std::vector<char>& vped,
bool thisColumnIsDead,
bool thisColumnIsNoisy) {
110 float theEncodedGain = 0;
111 float theEncodedPed = 0;
112 if (!thisColumnIsDead && !thisColumnIsNoisy) {
117 unsigned int ped_ = (
static_cast<unsigned int>(theEncodedPed)) & 0xFF;
118 unsigned int gain_ = (
static_cast<unsigned int>(theEncodedGain)) & 0xFF;
120 if (thisColumnIsDead) {
123 }
else if (thisColumnIsNoisy) {
129 vped.resize(vped.size() + 2);
131 ::memcpy((
void*)(&vped[vped.size() - 2]), (
void*)(&
data), 2);
139 bool& isNoisyColumn)
const {
141 unsigned int lengthOfColumnData = (
range.second -
range.first) / nCols;
142 unsigned int lengthOfAveragedDataInEachColumn = 2;
144 const unsigned int pos =
col * lengthOfColumnData + lengthOfAveragedDataInEachColumn * numberOfDataBlocksToSkip;
146 const unsigned int ped = *(
range.first +
pos + 1) & 0xFF;
167 bool& isNoisyColumn)
const {
171 unsigned int lengthOfColumnData = (
range.second -
range.first) / nCols;
172 unsigned int lengthOfAveragedDataInEachColumn = 2;
174 const unsigned int ped =
175 *(
range.first + 1 +
col * lengthOfColumnData + lengthOfAveragedDataInEachColumn * numberOfDataBlocksToSkip) &
181 isNoisyColumn =
true;
184 if (
col >= nCols || row > maxRow) {
186 <<
"[SiPixelGainCalibrationForHLT::getPed] Pixel out of range: col " <<
col <<
" row: " << row;
196 bool& isNoisyColumn)
const {
198 unsigned int lengthOfColumnData = (
range.second -
range.first) / nCols;
199 unsigned int lengthOfAveragedDataInEachColumn = 2;
201 const unsigned int gain =
202 *(
range.first +
col * lengthOfColumnData + lengthOfAveragedDataInEachColumn * numberOfDataBlocksToSkip) & 0xFF;
207 isNoisyColumn =
true;
210 if (
col >= nCols || row > maxRow) {
212 <<
"[SiPixelGainCalibrationForHLT::getGain] Pixel out of range: col " <<
col <<
" row: " << row;
218 if (gain < minGain_ || gain >
maxGain_) {
219 throw cms::Exception(
"InsertFailure") <<
"[SiPixelGainCalibrationForHLT::encodeGain] Trying to encode gain (" 229 if (ped < minPed_ || ped >
maxPed_) {
230 throw cms::Exception(
"InsertFailure") <<
"[SiPixelGainCalibrationForHLT::encodePed] Trying to encode pedestal (" 231 << ped <<
") out of range [" <<
minPed_ <<
"," <<
maxPed_ <<
"]\n";
const int getNCols(const uint32_t &detID) const
SiPixelGainCalibrationForHLT()
void getDetIds(std::vector< uint32_t > &DetIds_) const
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
void setData(float ped, float gain, std::vector< char > &vped, bool thisColumnIsDead=false, bool thisColumnIsNoisy=false)
float encodePed(const float &ped)
std::vector< DetRegistry > indexes
std::pair< float, float > getPedAndGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
std::pair< ContainerIterator, ContainerIterator > Range
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 &isDeadColumn, bool &isNoisyColumn) const
unsigned int numberOfRowsToAverageOver_
std::vector< char > const & data() 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
float decodeGain(unsigned int gain) const
float decodePed(unsigned int ped) const
std::vector< char > v_pedestals