|
|
Go to the documentation of this file. 1 #ifndef CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H
2 #define CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H
43 virtual float getGain(
const uint32_t& detID,
const int&
col,
const int& row) = 0;
44 virtual float getPedestal(
const uint32_t& detID,
const int&
col,
const int& row) = 0;
45 virtual bool isDead(
const uint32_t& detID,
const int&
col,
const int& row) = 0;
46 virtual bool isDeadColumn(
const uint32_t& detID,
const int&
col,
const int& row) = 0;
47 virtual bool isNoisy(
const uint32_t& detID,
const int&
col,
const int& row) = 0;
48 virtual bool isNoisyColumn(
const uint32_t& detID,
const int&
col,
const int& row) = 0;
50 virtual std::vector<uint32_t>
getDetIds() = 0;
58 template <
class thePayloadObject,
class theDBRecordType>
64 float getGain(
const uint32_t& detID,
const int&
col,
const int& row)
override = 0;
65 float getPedestal(
const uint32_t& detID,
const int&
col,
const int& row)
override = 0;
67 bool isDead(
const uint32_t& detID,
const int&
col,
const int& row)
override = 0;
68 bool isDeadColumn(
const uint32_t& detID,
const int&
col,
const int& row)
override = 0;
70 bool isNoisy(
const uint32_t& detID,
const int&
col,
const int& row)
override = 0;
71 bool isNoisyColumn(
const uint32_t& detID,
const int&
col,
const int& row)
override = 0;
77 std::vector<uint32_t>
getDetIds()
override;
84 float getPedestalByPixel(
const uint32_t& detID,
const int&
col,
const int& row,
bool& isDeadPixel,
bool& isNoisyPixel);
85 float getGainByPixel(
const uint32_t& detID,
const int&
col,
const int& row,
bool& isDeadPixel,
bool& isNoisyPixel);
98 const thePayloadObject*
ped =
nullptr;
125 template <
class thePayloadObject,
class theDBRecordType>
129 edm::LogInfo(
"SiPixelGainCalibrationServicePayloadGetter")
130 <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
146 template <
class thePayloadObject,
class theDBRecordType>
151 numberOfRowsAveragedOver_ = ped->getNumberOfRowsToAverageOver();
155 template <
class thePayloadObject,
class theDBRecordType>
157 std::vector<uint32_t> vdetId_;
158 ped->getDetIds(vdetId_);
162 template <
class thePayloadObject,
class theDBRecordType>
164 double gainLow_ = ped->getGainLow();
168 template <
class thePayloadObject,
class theDBRecordType>
170 double gainHigh_ = ped->getGainHigh();
174 template <
class thePayloadObject,
class theDBRecordType>
176 double pedLow_ = ped->getPedLow();
180 template <
class thePayloadObject,
class theDBRecordType>
182 double pedHigh_ = ped->getPedHigh();
186 template <
class thePayloadObject,
class theDBRecordType>
188 const uint32_t& detID,
const int&
col,
const int& row,
bool& isDead,
bool& isNoisy) {
193 if (detID != old_detID) {
195 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
196 old_range = rangeAndNCols.first;
197 old_cols = rangeAndNCols.second;
198 oldColumnIndexGain_ = -1;
201 return ped->getPed(
col, row, old_range, old_cols, isDead, isNoisy);
203 throw cms::Exception(
"NullPointer") <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByPixel] "
204 "SiPixelGainCalibrationRcd not initialized ";
207 template <
class thePayloadObject,
class theDBRecordType>
209 const uint32_t& detID,
const int&
col,
const int& row,
bool& isDead,
bool& isNoisy) {
214 if (detID != old_detID) {
216 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
217 old_range = rangeAndNCols.first;
218 old_cols = rangeAndNCols.second;
219 return oldColumnValuePed_;
221 return ped->getGain(
col, row, old_range, old_cols, isDead, isNoisy);
224 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByPixel] SiPixelGainCalibrationRcd not initialized ";
227 template <
class thePayloadObject,
class theDBRecordType>
229 const uint32_t& detID,
const int&
col,
const int& row,
bool& isDeadColumn,
bool& isNoisyColumn) {
235 bool inTheSameAveragedDataBlock =
false;
236 if (row / numberOfRowsAveragedOver_ == oldAveragedBlockDataPed_)
237 inTheSameAveragedDataBlock =
true;
239 if (detID != old_detID) {
241 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
242 old_range = rangeAndNCols.first;
243 old_cols = rangeAndNCols.second;
244 oldColumnIndexGain_ = -1;
245 }
else if (
col == oldColumnIndexPed_ && inTheSameAveragedDataBlock)
247 isDeadColumn = oldThisColumnIsDeadPed_;
248 isNoisyColumn = oldThisColumnIsNoisyPed_;
249 return oldColumnValuePed_;
252 oldColumnIndexPed_ =
col;
253 oldAveragedBlockDataPed_ = row / numberOfRowsAveragedOver_;
254 oldColumnValuePed_ = ped->getPed(
col, row, old_range, old_cols, isDeadColumn, isNoisyColumn);
255 oldThisColumnIsDeadPed_ = isDeadColumn;
256 oldThisColumnIsNoisyPed_ = isNoisyColumn;
258 return oldColumnValuePed_;
261 throw cms::Exception(
"NullPointer") <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] "
262 "SiPixelGainCalibrationRcd not initialized ";
265 template <
class thePayloadObject,
class theDBRecordType>
267 const uint32_t& detID,
const int&
col,
const int& row,
bool& isDeadColumn,
bool& isNoisyColumn) {
272 bool inTheSameAveragedDataBlock =
false;
273 if (row / numberOfRowsAveragedOver_ == oldAveragedBlockDataGain_)
274 inTheSameAveragedDataBlock =
true;
276 if (detID != old_detID) {
278 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
279 old_range = rangeAndNCols.first;
280 old_cols = rangeAndNCols.second;
281 oldColumnIndexPed_ = -1;
282 }
else if (
col == oldColumnIndexGain_ && inTheSameAveragedDataBlock)
284 isDeadColumn = oldThisColumnIsDeadGain_;
285 isDeadColumn = oldThisColumnIsNoisyGain_;
286 return oldColumnValueGain_;
289 oldColumnIndexGain_ =
col;
290 oldAveragedBlockDataGain_ = row / numberOfRowsAveragedOver_;
291 oldColumnValueGain_ = ped->getGain(
col, row, old_range, old_cols, isDeadColumn, isNoisyColumn);
292 oldThisColumnIsDeadGain_ = isDeadColumn;
293 oldThisColumnIsNoisyGain_ = isNoisyColumn;
295 return oldColumnValueGain_;
299 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByColumn] SiPixelGainCalibrationRcd not initialized ";
302 template <
class thePayloadObject,
class theDBRecordType>
305 std::cerr <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]"
306 <<
"[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read "
307 "the ped/gain on a pixel that is flagged as dead/noisy. For payload: "
308 <<
payload <<
" DETID: " << detID <<
" col: " <<
col <<
" row: " << row
309 <<
". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will "
310 "get corrupt data! value: "
311 <<
value << std::endl;
316 <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]"
317 <<
"[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read the "
318 "ped/gain on a pixel that is flagged as dead/noisy. For payload: "
319 <<
payload <<
" DETID: " << detID <<
" col: " <<
col <<
" row: " << row
320 <<
". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will get "
321 "corrupt data! value: "
322 <<
value << std::endl;
const edm::ESGetToken< thePayloadObject, theDBRecordType > pedToken_
virtual bool isDeadColumn(const uint32_t &detID, const int &col, const int &row)=0
thePayloadObject const & payload() const
PixelRecoRange< float > Range
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override=0
virtual double getGainHigh()=0
edm::DetSet< PixelDigi >::const_iterator DigiIterator
virtual bool isDead(const uint32_t &detID, const int &col, const int &row)=0
virtual float getGain(const uint32_t &detID, const int &col, const int &row)=0
float getPedestalByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override=0
Log< level::Info, false > LogInfo
int numberOfRowsAveragedOver_
float getGainByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
virtual double getGainLow()=0
void setESObjects(const edm::EventSetup &es) override
float getGainByPixel(const uint32_t &detID, const int &col, const int &row, bool &isDeadPixel, bool &isNoisyPixel)
std::vector< uint32_t > getDetIds() override
float getGain(const uint32_t &detID, const int &col, const int &row) override=0
SiPixelGainCalibrationServicePayloadGetter(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override=0
float getPedestal(const uint32_t &detID, const int &col, const int &row) override=0
virtual bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row)=0
virtual ~SiPixelGainCalibrationServiceBase()
const thePayloadObject * ped
float oldColumnValueGain_
int oldAveragedBlockDataPed_
double getGainHigh() override
SiPixelGainCalibrationServiceBase()
virtual double getPedHigh()=0
bool oldThisColumnIsNoisyPed_
Log< level::Error, false > LogError
virtual std::vector< uint32_t > getDetIds()=0
int oldAveragedBlockDataGain_
bool isDead(const uint32_t &detID, const int &col, const int &row) override=0
double getPedLow() override
bool getData(T &iHolder) const
static void fillPSetDescription(edm::ParameterSetDescription &desc)
virtual double getPedLow()=0
virtual void setESObjects(const edm::EventSetup &es)=0
bool oldThisColumnIsDeadPed_
double getPedHigh() override
bool oldThisColumnIsDeadGain_
bool oldThisColumnIsNoisyGain_
virtual float getPedestal(const uint32_t &detID, const int &col, const int &row)=0
double getGainLow() override
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
virtual void calibrate(uint32_t detID, DigiIterator b, DigiIterator e, float conversionFactor, float offset, int *electron)
thePayloadObject::Range old_range
float getPedestalByPixel(const uint32_t &detID, const int &col, const int &row, bool &isDeadPixel, bool &isNoisyPixel)
virtual bool isNoisy(const uint32_t &detID, const int &col, const int &row)=0
collection_type::const_iterator const_iterator