CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType > Class Template Referenceabstract

#include <SiPixelGainCalibrationServiceBase.h>

Inheritance diagram for SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >:
SiPixelGainCalibrationServiceBase

Public Member Functions

std::vector< uint32_t > getDetIds () override
 
float getGain (const uint32_t &detID, const int &col, const int &row) override=0
 
double getGainHigh () override
 
double getGainLow () override
 
float getPedestal (const uint32_t &detID, const int &col, const int &row) override=0
 
double getPedHigh () override
 
double getPedLow () override
 
bool isDead (const uint32_t &detID, const int &col, const int &row) override=0
 
bool isDeadColumn (const uint32_t &detID, const int &col, const int &row) override=0
 
bool isNoisy (const uint32_t &detID, const int &col, const int &row) override=0
 
bool isNoisyColumn (const uint32_t &detID, const int &col, const int &row) override=0
 
thePayloadObject const & payload () const
 
void setESObjects (const edm::EventSetup &es) override
 
 SiPixelGainCalibrationServicePayloadGetter (const edm::ParameterSet &conf, edm::ConsumesCollector iC)
 
- Public Member Functions inherited from SiPixelGainCalibrationServiceBase
virtual void calibrate (uint32_t detID, DigiIterator b, DigiIterator e, float conversionFactor, float offset, int *electron)
 
 SiPixelGainCalibrationServiceBase ()
 
virtual ~SiPixelGainCalibrationServiceBase ()
 

Protected Member Functions

float getGainByColumn (const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
 
float getGainByPixel (const uint32_t &detID, const int &col, const int &row, bool &isDeadPixel, bool &isNoisyPixel)
 
float getPedestalByColumn (const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
 
float getPedestalByPixel (const uint32_t &detID, const int &col, const int &row, bool &isDeadPixel, bool &isNoisyPixel)
 
void throwExepctionForBadRead (std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
 

Protected Attributes

edm::ParameterSet conf_
 
bool ESetupInit_
 
double gainHigh_
 
double gainLow_
 
int numberOfRowsAveragedOver_
 
int old_cols
 
uint32_t old_detID
 
thePayloadObject::Range old_range
 
int oldAveragedBlockDataGain_
 
int oldAveragedBlockDataPed_
 
int oldColumnIndexGain_
 
int oldColumnIndexPed_
 
float oldColumnValueGain_
 
float oldColumnValuePed_
 
bool oldThisColumnIsDeadGain_
 
bool oldThisColumnIsDeadPed_
 
bool oldThisColumnIsNoisyGain_
 
bool oldThisColumnIsNoisyPed_
 
const thePayloadObject * ped = nullptr
 
double pedHigh_
 
double pedLow_
 
const edm::ESGetToken
< thePayloadObject,
theDBRecordType > 
pedToken_
 

Additional Inherited Members

- Public Types inherited from SiPixelGainCalibrationServiceBase
typedef edm::DetSet< PixelDigi >
::const_iterator 
DigiIterator
 
- Static Public Member Functions inherited from SiPixelGainCalibrationServiceBase
static void fillPSetDescription (edm::ParameterSetDescription &desc)
 

Detailed Description

template<class thePayloadObject, class theDBRecordType>
class SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >

Definition at line 59 of file SiPixelGainCalibrationServiceBase.h.

Constructor & Destructor Documentation

template<class thePayloadObject , class theDBRecordType >
SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::SiPixelGainCalibrationServicePayloadGetter ( const edm::ParameterSet conf,
edm::ConsumesCollector  iC 
)
explicit

Definition at line 126 of file SiPixelGainCalibrationServiceBase.h.

References SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::old_detID, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldAveragedBlockDataGain_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldAveragedBlockDataPed_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnIndexGain_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnIndexPed_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValueGain_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValuePed_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsDeadGain_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsDeadPed_, SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsNoisyGain_, and SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsNoisyPed_.

128  : conf_(conf), ESetupInit_(false), pedToken_(iC.esConsumes()) {
129  edm::LogInfo("SiPixelGainCalibrationServicePayloadGetter")
130  << "[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
131  // Initialize cache variables
132  old_detID = 0;
133  oldColumnIndexGain_ = -1;
134  oldColumnIndexPed_ = -1;
135  oldColumnValueGain_ = 0.;
136  oldColumnValuePed_ = 0.;
137 
140  oldThisColumnIsDeadGain_ = false;
141  oldThisColumnIsDeadPed_ = false;
143  oldThisColumnIsNoisyPed_ = false;
144 }
Log< level::Info, false > LogInfo
const edm::ESGetToken< thePayloadObject, theDBRecordType > pedToken_

Member Function Documentation

template<class thePayloadObject , class theDBRecordType >
std::vector< uint32_t > SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getDetIds ( )
overridevirtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 156 of file SiPixelGainCalibrationServiceBase.h.

Referenced by cms::SiPixelCondObjReader::analyze().

156  {
157  std::vector<uint32_t> vdetId_;
158  ped->getDetIds(vdetId_);
159  return vdetId_;
160 }
template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGain ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual
template<class thePayloadObject , class theDBRecordType >
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainByColumn ( const uint32_t &  detID,
const int &  col,
const int &  row,
bool &  isDeadColumn,
bool &  isNoisyColumn 
)
protected

Definition at line 266 of file SiPixelGainCalibrationServiceBase.h.

References cuy::col, and Exception.

267  {
268  if (ESetupInit_) {
269  //&&&&&&&&&&&&&&&&&&&&
270  //Access from DB
271  //&&&&&&&&&&&&&&&&&&&&
272  bool inTheSameAveragedDataBlock = false;
274  inTheSameAveragedDataBlock = true;
275 
276  if (detID != old_detID) {
277  old_detID = detID;
278  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
279  old_range = rangeAndNCols.first;
280  old_cols = rangeAndNCols.second;
281  oldColumnIndexPed_ = -1;
282  } else if (col == oldColumnIndexGain_ && inTheSameAveragedDataBlock) // same DetID, same column
283  {
286  return oldColumnValueGain_;
287  }
288 
294 
295  return oldColumnValueGain_;
296 
297  } else
298  throw cms::Exception("NullPointer")
299  << "[SiPixelGainCalibrationServicePayloadGetter::getGainByColumn] SiPixelGainCalibrationRcd not initialized ";
300 }
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override=0
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override=0
int col
Definition: cuy.py:1009
template<class thePayloadObject , class theDBRecordType >
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainByPixel ( const uint32_t &  detID,
const int &  col,
const int &  row,
bool &  isDeadPixel,
bool &  isNoisyPixel 
)
protected

Definition at line 208 of file SiPixelGainCalibrationServiceBase.h.

References Exception.

209  {
210  if (ESetupInit_) {
211  //&&&&&&&&&&&&&&&&&&&&
212  //Access from DB
213  //&&&&&&&&&&&&&&&&&&&&
214  if (detID != old_detID) {
215  old_detID = detID;
216  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
217  old_range = rangeAndNCols.first;
218  old_cols = rangeAndNCols.second;
219  return oldColumnValuePed_;
220  }
221  return ped->getGain(col, row, old_range, old_cols, isDead, isNoisy);
222  } else
223  throw cms::Exception("NullPointer")
224  << "[SiPixelGainCalibrationServicePayloadGetter::getGainByPixel] SiPixelGainCalibrationRcd not initialized ";
225 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override=0
int col
Definition: cuy.py:1009
bool isDead(const uint32_t &detID, const int &col, const int &row) override=0
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainHigh ( )
overridevirtual
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainLow ( )
overridevirtual
template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedestal ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual
template<class thePayloadObject , class theDBRecordType >
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedestalByColumn ( const uint32_t &  detID,
const int &  col,
const int &  row,
bool &  isDeadColumn,
bool &  isNoisyColumn 
)
protected

Definition at line 228 of file SiPixelGainCalibrationServiceBase.h.

References cuy::col, and Exception.

229  {
230  if (ESetupInit_) {
231  //&&&&&&&&&&&&&&&&&&&&
232  //Access from DB
233  //&&&&&&&&&&&&&&&&&&&&
234  // see if we are in the same averaged data block
235  bool inTheSameAveragedDataBlock = false;
237  inTheSameAveragedDataBlock = true;
238 
239  if (detID != old_detID) {
240  old_detID = detID;
241  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
242  old_range = rangeAndNCols.first;
243  old_cols = rangeAndNCols.second;
244  oldColumnIndexGain_ = -1;
245  } else if (col == oldColumnIndexPed_ && inTheSameAveragedDataBlock) // same DetID, same column, same data block
246  {
249  return oldColumnValuePed_;
250  }
251 
257 
258  return oldColumnValuePed_;
259 
260  } else
261  throw cms::Exception("NullPointer") << "[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] "
262  "SiPixelGainCalibrationRcd not initialized ";
263 }
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override=0
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override=0
int col
Definition: cuy.py:1009
template<class thePayloadObject , class theDBRecordType >
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedestalByPixel ( const uint32_t &  detID,
const int &  col,
const int &  row,
bool &  isDeadPixel,
bool &  isNoisyPixel 
)
protected

Definition at line 187 of file SiPixelGainCalibrationServiceBase.h.

References Exception.

188  {
189  if (ESetupInit_) {
190  //&&&&&&&&&&&&&&&&&&&&
191  //Access from DB
192  //&&&&&&&&&&&&&&&&&&&&
193  if (detID != old_detID) {
194  old_detID = detID;
195  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
196  old_range = rangeAndNCols.first;
197  old_cols = rangeAndNCols.second;
198  oldColumnIndexGain_ = -1;
199  }
200  //std::cout<<" Pedestal "<<ped->getPed(col, row, old_range, old_cols)<<std::endl;
201  return ped->getPed(col, row, old_range, old_cols, isDead, isNoisy);
202  } else
203  throw cms::Exception("NullPointer") << "[SiPixelGainCalibrationServicePayloadGetter::getPedestalByPixel] "
204  "SiPixelGainCalibrationRcd not initialized ";
205 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override=0
int col
Definition: cuy.py:1009
bool isDead(const uint32_t &detID, const int &col, const int &row) override=0
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedHigh ( )
overridevirtual
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedLow ( )
overridevirtual
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isDead ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isDeadColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isNoisy ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isNoisyColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual
template<class thePayloadObject, class theDBRecordType>
thePayloadObject const& SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::payload ( ) const
inline

Definition at line 75 of file SiPixelGainCalibrationServiceBase.h.

75 { return *ped; }
template<class thePayloadObject , class theDBRecordType >
void SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::setESObjects ( const edm::EventSetup es)
overridevirtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 147 of file SiPixelGainCalibrationServiceBase.h.

References edm::EventSetup::getData().

Referenced by cms::SiPixelCondObjReader::analyze(), and SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase().

148  {
149  ped = &es.getData(pedToken_);
150  // ped->initialize(); moved to cond infrastructure
151  numberOfRowsAveragedOver_ = ped->getNumberOfRowsToAverageOver();
152  ESetupInit_ = true;
153 }
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::ESGetToken< thePayloadObject, theDBRecordType > pedToken_
template<class thePayloadObject , class theDBRecordType >
void SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::throwExepctionForBadRead ( std::string  payload,
const uint32_t &  detID,
const int &  col,
const int &  row,
double  value = -1 
) const
protected

Definition at line 303 of file SiPixelGainCalibrationServiceBase.h.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr.

304  {
305  std::cerr << "[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]"
306  << "[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read "
307  "the ped/gain on a pixel that is flagged as dead/noisy. For payload: "
308  << payload << " DETID: " << detID << " col: " << col << " row: " << row
309  << ". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will "
310  "get corrupt data! value: "
311  << value << std::endl;
312 
313  // really yell if this occurs
314 
315  edm::LogError("SiPixelGainCalibrationService")
316  << "[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]"
317  << "[SiPixelGainCalibrationServicePayloadGetter] ERROR - Slow down, speed racer! You have tried to read the "
318  "ped/gain on a pixel that is flagged as dead/noisy. For payload: "
319  << payload << " DETID: " << detID << " col: " << col << " row: " << row
320  << ". You must check if the pixel is dead/noisy before asking for the ped/gain value, otherwise you will get "
321  "corrupt data! value: "
322  << value << std::endl;
323 }
Log< level::Error, false > LogError
int col
Definition: cuy.py:1009

Member Data Documentation

template<class thePayloadObject, class theDBRecordType>
edm::ParameterSet SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::conf_
protected

Definition at line 95 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::ESetupInit_
protected

Definition at line 96 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::gainHigh_
protected

Definition at line 101 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::gainLow_
protected

Definition at line 100 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::numberOfRowsAveragedOver_
protected

Definition at line 99 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::old_cols
protected

Definition at line 106 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
uint32_t SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::old_detID
protected
template<class thePayloadObject, class theDBRecordType>
thePayloadObject::Range SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::old_range
protected

Definition at line 122 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldAveragedBlockDataGain_
protected
template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldAveragedBlockDataPed_
protected
template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnIndexGain_
protected
template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnIndexPed_
protected
template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValueGain_
protected
template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValuePed_
protected
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsDeadGain_
protected
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsDeadPed_
protected
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsNoisyGain_
protected
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsNoisyPed_
protected
template<class thePayloadObject, class theDBRecordType>
const thePayloadObject* SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::ped = nullptr
protected
template<class thePayloadObject, class theDBRecordType>
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::pedHigh_
protected

Definition at line 103 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::pedLow_
protected

Definition at line 102 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
const edm::ESGetToken<thePayloadObject, theDBRecordType> SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::pedToken_
protected

Definition at line 97 of file SiPixelGainCalibrationServiceBase.h.