1 #ifndef CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H 2 #define CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H 38 virtual void calibrate(uint32_t detID, DigiIterator
b, DigiIterator
e,
float conversionFactor,
float offset,
int *
electron);
40 virtual float getGain (
const uint32_t& detID ,
const int&
col ,
const int& row)=0;
41 virtual float getPedestal (
const uint32_t& detID ,
const int& col ,
const int& row)=0;
42 virtual bool isDead (
const uint32_t& detID ,
const int& col ,
const int& row)=0;
43 virtual bool isDeadColumn (
const uint32_t& detID ,
const int& col ,
const int& row)=0;
44 virtual bool isNoisy (
const uint32_t& detID ,
const int& col ,
const int& row)=0;
45 virtual bool isNoisyColumn (
const uint32_t& detID ,
const int& col ,
const int& row)=0;
47 virtual std::vector<uint32_t>
getDetIds()=0;
57 template<
class thePayloadObject,
class theDBRecordType>
65 float getGain(
const uint32_t& detID,
const int&
col,
const int& row)
override =0;
66 float getPedestal(
const uint32_t& detID,
const int& col,
const int& row)
override =0;
68 bool isDead (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
69 bool isDeadColumn (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
71 bool isNoisy (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
72 bool isNoisyColumn (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
76 thePayloadObject
const &
payload()
const {
return *ped; }
78 std::vector<uint32_t>
getDetIds()
override;
86 float getPedestalByPixel(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadPixel,
bool& isNoisyPixel) ;
87 float getGainByPixel(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadPixel,
bool& isNoisyPixel) ;
90 float getPedestalByColumn(
const uint32_t& detID,
const int& col,
const int& row,
bool&
isDeadColumn,
bool&
isNoisyColumn) ;
91 float getGainByColumn(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadColumn,
bool& isNoisyColumn) ;
93 void throwExepctionForBadRead(
std::string payload,
const uint32_t& detID,
const int& col,
const int& row,
double value = -1)
const;
125 template<
class thePayloadObject,
class theDBRecordType>
131 edm::LogInfo(
"SiPixelGainCalibrationServicePayloadGetter") <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
148 template<
class thePayloadObject,
class theDBRecordType>
151 es.
get<theDBRecordType>().
get(
ped);
158 template<
class thePayloadObject,
class theDBRecordType>
161 std::vector<uint32_t> vdetId_;
162 ped->getDetIds(vdetId_);
167 template<
class thePayloadObject,
class theDBRecordType>
173 template<
class thePayloadObject,
class theDBRecordType>
179 template<
class thePayloadObject,
class theDBRecordType>
185 template<
class thePayloadObject,
class theDBRecordType>
191 template<
class thePayloadObject,
class theDBRecordType>
199 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
207 <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByPixel] SiPixelGainCalibrationRcd not initialized ";
211 template<
class thePayloadObject,
class theDBRecordType>
219 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
226 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByPixel] SiPixelGainCalibrationRcd not initialized ";
230 template<
class thePayloadObject,
class theDBRecordType>
237 bool inTheSameAveragedDataBlock =
false;
239 inTheSameAveragedDataBlock =
true;
243 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
264 <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] SiPixelGainCalibrationRcd not initialized ";
268 template<
class thePayloadObject,
class theDBRecordType>
274 bool inTheSameAveragedDataBlock =
false;
276 inTheSameAveragedDataBlock =
true;
280 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
301 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByColumn] SiPixelGainCalibrationRcd not initialized ";
304 template<
class thePayloadObject,
class theDBRecordType>
307 std::cerr <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]" 308 <<
"[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read the ped/gain on a pixel that is flagged as dead/noisy. For payload: " << payload <<
" DETID: " 309 << detID <<
" col: " << col <<
" row: " << row <<
". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will get corrupt data! value: " << value << std::endl;
313 edm::LogError(
"SiPixelGainCalibrationService") <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]" 314 <<
"[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read the ped/gain on a pixel that is flagged as dead/noisy. For payload: " << payload <<
" DETID: " 315 << detID <<
" col: " << col <<
" row: " << row <<
". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will get corrupt data! value: " << 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
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_