CMS 3D CMS Logo

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

◆ SiPixelGainCalibrationServicePayloadGetter()

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.

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

◆ getDetIds()

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 }

◆ getGain()

template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGain ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual

◆ getGainByColumn()

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.

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
col
Definition: cuy.py:1009

◆ getGainByPixel()

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.

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
col
Definition: cuy.py:1009
bool isDead(const uint32_t &detID, const int &col, const int &row) override=0

◆ getGainHigh()

template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainHigh ( )
overridevirtual

◆ getGainLow()

template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainLow ( )
overridevirtual

◆ getPedestal()

template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedestal ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual

◆ getPedestalByColumn()

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.

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
col
Definition: cuy.py:1009

◆ getPedestalByPixel()

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.

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
col
Definition: cuy.py:1009
bool isDead(const uint32_t &detID, const int &col, const int &row) override=0

◆ getPedHigh()

template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedHigh ( )
overridevirtual

◆ getPedLow()

template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedLow ( )
overridevirtual

◆ isDead()

template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isDead ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual

◆ isDeadColumn()

template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isDeadColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual

◆ isNoisy()

template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isNoisy ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual

◆ isNoisyColumn()

template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isNoisyColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridepure virtual

◆ payload()

template<class thePayloadObject, class theDBRecordType>
thePayloadObject const& SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::payload ( ) const
inline

Definition at line 75 of file SiPixelGainCalibrationServiceBase.h.

75 { return *ped; }

◆ setESObjects()

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.

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 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< thePayloadObject, theDBRecordType > pedToken_

◆ throwExepctionForBadRead()

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.

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
Definition: value.py:1
col
Definition: cuy.py:1009

Member Data Documentation

◆ conf_

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

Definition at line 95 of file SiPixelGainCalibrationServiceBase.h.

◆ ESetupInit_

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

Definition at line 96 of file SiPixelGainCalibrationServiceBase.h.

◆ gainHigh_

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

Definition at line 101 of file SiPixelGainCalibrationServiceBase.h.

◆ gainLow_

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

Definition at line 100 of file SiPixelGainCalibrationServiceBase.h.

◆ numberOfRowsAveragedOver_

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

Definition at line 99 of file SiPixelGainCalibrationServiceBase.h.

◆ old_cols

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

Definition at line 106 of file SiPixelGainCalibrationServiceBase.h.

◆ old_detID

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

◆ old_range

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

Definition at line 122 of file SiPixelGainCalibrationServiceBase.h.

◆ oldAveragedBlockDataGain_

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

◆ oldAveragedBlockDataPed_

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

◆ oldColumnIndexGain_

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

◆ oldColumnIndexPed_

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

◆ oldColumnValueGain_

template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValueGain_
protected

◆ oldColumnValuePed_

template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValuePed_
protected

◆ oldThisColumnIsDeadGain_

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

◆ oldThisColumnIsDeadPed_

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

◆ oldThisColumnIsNoisyGain_

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

◆ oldThisColumnIsNoisyPed_

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

◆ ped

template<class thePayloadObject, class theDBRecordType>
const thePayloadObject* SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::ped = nullptr
protected

◆ pedHigh_

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

Definition at line 103 of file SiPixelGainCalibrationServiceBase.h.

◆ pedLow_

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

Definition at line 102 of file SiPixelGainCalibrationServiceBase.h.

◆ pedToken_

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

Definition at line 97 of file SiPixelGainCalibrationServiceBase.h.