1 #ifndef CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H 2 #define CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H 40 uint32_t detID, DigiIterator
b, DigiIterator
e,
float conversionFactor,
float offset,
int*
electron);
42 virtual float getGain(
const uint32_t& detID,
const int&
col,
const int& row) = 0;
43 virtual float getPedestal(
const uint32_t& detID,
const int& col,
const int& row) = 0;
44 virtual bool isDead(
const uint32_t& detID,
const int& col,
const int& row) = 0;
45 virtual bool isDeadColumn(
const uint32_t& detID,
const int& col,
const int& row) = 0;
46 virtual bool isNoisy(
const uint32_t& detID,
const int& col,
const int& row) = 0;
47 virtual bool isNoisyColumn(
const uint32_t& detID,
const int& col,
const int& row) = 0;
49 virtual std::vector<uint32_t>
getDetIds() = 0;
57 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;
75 thePayloadObject
const&
payload()
const {
return *ped; }
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);
88 float getPedestalByColumn(
90 float getGainByColumn(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadColumn,
bool& isNoisyColumn);
92 void throwExepctionForBadRead(
124 template <
class thePayloadObject,
class theDBRecordType>
127 : conf_(conf), ESetupInit_(
false) {
128 edm::LogInfo(
"SiPixelGainCalibrationServicePayloadGetter")
129 <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
145 template <
class thePayloadObject,
class theDBRecordType>
148 es.
get<theDBRecordType>().
get(
ped);
154 template <
class thePayloadObject,
class theDBRecordType>
156 std::vector<uint32_t> vdetId_;
157 ped->getDetIds(vdetId_);
161 template <
class thePayloadObject,
class theDBRecordType>
167 template <
class thePayloadObject,
class theDBRecordType>
173 template <
class thePayloadObject,
class theDBRecordType>
179 template <
class thePayloadObject,
class theDBRecordType>
185 template <
class thePayloadObject,
class theDBRecordType>
187 const uint32_t& detID,
const int&
col,
const int& row,
bool&
isDead,
bool&
isNoisy) {
194 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
202 throw cms::Exception(
"NullPointer") <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByPixel] " 203 "SiPixelGainCalibrationRcd not initialized ";
206 template <
class thePayloadObject,
class theDBRecordType>
208 const uint32_t& detID,
const int&
col,
const int& row,
bool&
isDead,
bool&
isNoisy) {
215 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
223 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByPixel] SiPixelGainCalibrationRcd not initialized ";
226 template <
class thePayloadObject,
class theDBRecordType>
234 bool inTheSameAveragedDataBlock =
false;
236 inTheSameAveragedDataBlock =
true;
240 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
260 throw cms::Exception(
"NullPointer") <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] " 261 "SiPixelGainCalibrationRcd not initialized ";
264 template <
class thePayloadObject,
class theDBRecordType>
271 bool inTheSameAveragedDataBlock =
false;
273 inTheSameAveragedDataBlock =
true;
277 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
298 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByColumn] SiPixelGainCalibrationRcd not initialized ";
301 template <
class thePayloadObject,
class theDBRecordType>
304 std::cerr <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]" 305 <<
"[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read " 306 "the ped/gain on a pixel that is flagged as dead/noisy. For payload: " 307 << payload <<
" DETID: " << detID <<
" col: " << col <<
" row: " << row
308 <<
". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will " 309 "get corrupt data! value: " 310 << value << std::endl;
315 <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]" 316 <<
"[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read the " 317 "ped/gain on a pixel that is flagged as dead/noisy. For payload: " 318 << payload <<
" DETID: " << detID <<
" col: " << col <<
" row: " << row
319 <<
". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will get " 320 "corrupt data! value: " 321 << value << std::endl;
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override=0
thePayloadObject const & payload() const
bool oldThisColumnIsDeadGain_
float getGainByPixel(const uint32_t &detID, const int &col, const int &row, bool &isDeadPixel, bool &isNoisyPixel)
virtual void setESObjects(const edm::EventSetup &es)=0
int numberOfRowsAveragedOver_
SiPixelGainCalibrationServiceBase()
edm::DetSet< PixelDigi >::const_iterator DigiIterator
float getPedestalByPixel(const uint32_t &detID, const int &col, const int &row, bool &isDeadPixel, bool &isNoisyPixel)
virtual bool isDeadColumn(const uint32_t &detID, const int &col, const int &row)=0
PixelRecoRange< float > Range
virtual std::vector< uint32_t > getDetIds()=0
std::vector< uint32_t > getDetIds() override
thePayloadObject::Range old_range
virtual double getGainHigh()=0
virtual double getGainLow()=0
double getGainLow() override
virtual double getPedLow()=0
float oldColumnValueGain_
virtual double getPedHigh()=0
virtual bool isDead(const uint32_t &detID, const int &col, const int &row)=0
double getGainHigh() override
~SiPixelGainCalibrationServicePayloadGetter() override
float getPedestalByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
float getGainByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
int oldAveragedBlockDataPed_
bool oldThisColumnIsNoisyPed_
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
double getPedLow() override
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override=0
bool oldThisColumnIsDeadPed_
void setESObjects(const edm::EventSetup &es) override
bool isNoisyColumn(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()
virtual float getPedestal(const uint32_t &detID, const int &col, const int &row)=0
edm::ESHandle< thePayloadObject > ped
static void fillPSetDescription(edm::ParameterSetDescription &desc)
double getPedHigh() override
SiPixelGainCalibrationServicePayloadGetter(const edm::ParameterSet &conf)
virtual float getGain(const uint32_t &detID, const int &col, const int &row)=0
virtual bool isNoisy(const uint32_t &detID, const int &col, const int &row)=0
collection_type::const_iterator const_iterator
virtual void calibrate(uint32_t detID, DigiIterator b, DigiIterator e, float conversionFactor, float offset, int *electron)
int oldAveragedBlockDataGain_
bool isDead(const uint32_t &detID, const int &col, const int &row) override=0
bool oldThisColumnIsNoisyGain_