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 virtual float getGain(
const uint32_t& detID,
const int&
col,
const int& row)=0;
66 virtual float getPedestal(
const uint32_t& detID,
const int& col,
const int& row)=0;
68 virtual bool isDead (
const uint32_t& detID,
const int& col,
const int& row )=0;
69 virtual bool isDeadColumn (
const uint32_t& detID,
const int& col,
const int& row )=0;
71 virtual bool isNoisy (
const uint32_t& detID,
const int& col,
const int& row )=0;
72 virtual bool isNoisyColumn (
const uint32_t& detID,
const int& col,
const int& row )=0;
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;
virtual ~SiPixelGainCalibrationServicePayloadGetter()
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
virtual bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row)=0
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
virtual bool isDeadColumn(const uint32_t &detID, const int &col, const int &row)=0
virtual std::vector< uint32_t > getDetIds()=0
thePayloadObject::Range old_range
virtual double getGainHigh()=0
virtual double getGainLow()=0
virtual double getPedLow()=0
float oldColumnValueGain_
virtual double getPedHigh()=0
virtual bool isDead(const uint32_t &detID, const int &col, const int &row)=0
virtual bool isDead(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)
float getGainByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
payload
payload postfix for testing
int oldAveragedBlockDataPed_
bool oldThisColumnIsNoisyPed_
PixelRecoRange< float > Range
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
bool oldThisColumnIsDeadPed_
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
void setESObjects(const edm::EventSetup &es)
SiPixelGainCalibrationServicePayloadGetter(const edm::ParameterSet &conf)
virtual float getGain(const uint32_t &detID, const int &col, const int &row)=0
std::vector< uint32_t > getDetIds()
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)
virtual bool isNoisy(const uint32_t &detID, const int &col, const int &row)=0
int oldAveragedBlockDataGain_
bool oldThisColumnIsNoisyGain_