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 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(
const uint32_t& detID,
const int& col,
const int& row,
bool&
isDeadColumn,
bool&
isNoisyColumn) ;
89 float getGainByColumn(
const uint32_t& detID,
const int& col,
const int& row,
bool& isDeadColumn,
bool& isNoisyColumn) ;
91 void throwExepctionForBadRead(
std::string payload,
const uint32_t& detID,
const int& col,
const int& row,
double value = -1)
const;
123 template<
class thePayloadObject,
class theDBRecordType>
129 edm::LogInfo(
"SiPixelGainCalibrationServicePayloadGetter") <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
146 template<
class thePayloadObject,
class theDBRecordType>
149 es.
get<theDBRecordType>().
get(
ped);
156 template<
class thePayloadObject,
class theDBRecordType>
159 std::vector<uint32_t> vdetId_;
160 ped->getDetIds(vdetId_);
165 template<
class thePayloadObject,
class theDBRecordType>
171 template<
class thePayloadObject,
class theDBRecordType>
177 template<
class thePayloadObject,
class theDBRecordType>
183 template<
class thePayloadObject,
class theDBRecordType>
189 template<
class thePayloadObject,
class theDBRecordType>
197 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
205 <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByPixel] SiPixelGainCalibrationRcd not initialized ";
209 template<
class thePayloadObject,
class theDBRecordType>
217 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
224 <<
"[SiPixelGainCalibrationServicePayloadGetter::getGainByPixel] SiPixelGainCalibrationRcd not initialized ";
228 template<
class thePayloadObject,
class theDBRecordType>
235 bool inTheSameAveragedDataBlock =
false;
237 inTheSameAveragedDataBlock =
true;
241 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
262 <<
"[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] SiPixelGainCalibrationRcd not initialized ";
266 template<
class thePayloadObject,
class theDBRecordType>
272 bool inTheSameAveragedDataBlock =
false;
274 inTheSameAveragedDataBlock =
true;
278 std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols =
ped->getRangeAndNCols(detID);
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 the ped/gain on a pixel that is flagged as dead/noisy. For payload: " << payload <<
" DETID: " 307 << 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;
311 edm::LogError(
"SiPixelGainCalibrationService") <<
"[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]" 312 <<
"[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: " 313 << 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
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_