1 #ifndef CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H 2 #define CalibTracker_SiPixelESProducers_SiPixelGainCalibrationServiceBase_H 41 virtual void calibrate(uint32_t detID, DigiIterator
b, DigiIterator
e,
float conversionFactor,
float offset,
int *
electron);
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;
60 template<
class thePayloadObject,
class theDBRecordType>
68 float getGain(
const uint32_t& detID,
const int&
col,
const int& row)
override =0;
69 float getPedestal(
const uint32_t& detID,
const int& col,
const int& row)
override =0;
71 bool isDead (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
72 bool isDeadColumn (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
74 bool isNoisy (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
75 bool isNoisyColumn (
const uint32_t& detID,
const int& col,
const int& row )
override =0;
79 thePayloadObject
const &
payload()
const {
return *ped; }
81 std::vector<uint32_t>
getDetIds()
override;
89 float getPedestalByPixel(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadPixel,
bool& isNoisyPixel) ;
90 float getGainByPixel(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadPixel,
bool& isNoisyPixel) ;
93 float getPedestalByColumn(
const uint32_t& detID,
const int& col,
const int& row,
bool&
isDeadColumn,
bool&
isNoisyColumn) ;
94 float getGainByColumn(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadColumn,
bool& isNoisyColumn) ;
96 void throwExepctionForBadRead(
std::string payload,
const uint32_t& detID,
const int& col,
const int& row,
double value = -1)
const;
128 template<
class thePayloadObject,
class theDBRecordType>
134 edm::LogInfo(
"SiPixelGainCalibrationServicePayloadGetter") <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
151 template<
class thePayloadObject,
class theDBRecordType>
154 es.
get<theDBRecordType>().
get(
ped);
161 template<
class thePayloadObject,
class theDBRecordType>
164 std::vector<uint32_t> vdetId_;
165 ped->getDetIds(vdetId_);
170 template<
class thePayloadObject,
class theDBRecordType>
176 template<
class thePayloadObject,
class theDBRecordType>
182 template<
class thePayloadObject,
class theDBRecordType>
188 template<
class thePayloadObject,
class theDBRecordType>
194 template<
class thePayloadObject,
class theDBRecordType>
202 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
210 <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByPixel] SiPixelGainCalibrationRcd not initialized ";
214 template<
class thePayloadObject,
class theDBRecordType>
222 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
229 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByPixel] SiPixelGainCalibrationRcd not initialized ";
233 template<
class thePayloadObject,
class theDBRecordType>
240 bool inTheSameAveragedDataBlock =
false;
242 inTheSameAveragedDataBlock =
true;
246 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
267 <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] SiPixelGainCalibrationRcd not initialized ";
271 template<
class thePayloadObject,
class theDBRecordType>
277 bool inTheSameAveragedDataBlock =
false;
279 inTheSameAveragedDataBlock =
true;
283 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
304 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByColumn] SiPixelGainCalibrationRcd not initialized ";
307 template<
class thePayloadObject,
class theDBRecordType>
310 std::cerr <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]" 311 <<
"[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: " 312 << 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;
316 edm::LogError(
"SiPixelGainCalibrationService") <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]" 317 <<
"[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: " 318 << 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
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_