CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
virtual float getGain (const uint32_t &detID, const int &col, const int &row)=0
 
double getGainHigh ()
 
double getGainLow ()
 
virtual float getPedestal (const uint32_t &detID, const int &col, const int &row)=0
 
double getPedHigh ()
 
double getPedLow ()
 
virtual bool isDead (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 bool isNoisy (const uint32_t &detID, const int &col, const int &row)=0
 
virtual bool isNoisyColumn (const uint32_t &detID, const int &col, const int &row)=0
 
void setESObjects (const edm::EventSetup &es)
 
 SiPixelGainCalibrationServicePayloadGetter (const edm::ParameterSet &conf)
 
virtual ~SiPixelGainCalibrationServicePayloadGetter ()
 
- 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_
 
edm::ESHandle< thePayloadObject > ped
 
double pedHigh_
 
double pedLow_
 

Additional Inherited Members

- Public Types inherited from SiPixelGainCalibrationServiceBase
typedef edm::DetSet< PixelDigi >
::const_iterator 
DigiIterator
 

Detailed Description

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

Definition at line 58 of file SiPixelGainCalibrationServiceBase.h.

Constructor & Destructor Documentation

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

Definition at line 124 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_.

124  :
125  conf_(conf),
126  ESetupInit_(false)
127 {
128 
129  edm::LogInfo("SiPixelGainCalibrationServicePayloadGetter") << "[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
130  // Initialize cache variables
131  old_detID = 0;
132  oldColumnIndexGain_ = -1;
133  oldColumnIndexPed_ = -1;
134  oldColumnValueGain_ = 0.;
135  oldColumnValuePed_ = 0.;
136 
139  oldThisColumnIsDeadGain_ = false;
140  oldThisColumnIsDeadPed_ = false;
142  oldThisColumnIsNoisyPed_ = false;
143 
144 }
template<class thePayloadObject, class theDBRecordType>
virtual SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::~SiPixelGainCalibrationServicePayloadGetter ( )
inlinevirtual

Definition at line 62 of file SiPixelGainCalibrationServiceBase.h.

62 {};

Member Function Documentation

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

Implements SiPixelGainCalibrationServiceBase.

Definition at line 157 of file SiPixelGainCalibrationServiceBase.h.

157  {
158 
159  std::vector<uint32_t> vdetId_;
160  ped->getDetIds(vdetId_);
161  return vdetId_;
162 
163 }
template<class thePayloadObject, class theDBRecordType>
virtual float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGain ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
pure 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 267 of file SiPixelGainCalibrationServiceBase.h.

References cuy::col, and edm::hlt::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  }
283  else if (col == oldColumnIndexGain_ && inTheSameAveragedDataBlock) // same DetID, same column
284  {
287  return oldColumnValueGain_;
288  }
289 
295 
296  return oldColumnValueGain_;
297 
298  } else throw cms::Exception("NullPointer")
299  << "[SiPixelGainCalibrationServicePayloadGetter::getGainByColumn] SiPixelGainCalibrationRcd not initialized ";
300 }
virtual bool isNoisyColumn(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
int col
Definition: cuy.py:1008
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 210 of file SiPixelGainCalibrationServiceBase.h.

References edm::hlt::Exception.

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

Implements SiPixelGainCalibrationServiceBase.

Definition at line 172 of file SiPixelGainCalibrationServiceBase.h.

172  {
173  double gainHigh_ = ped->getGainHigh();
174  return gainHigh_;
175 }
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainLow ( )
virtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 166 of file SiPixelGainCalibrationServiceBase.h.

166  {
167  double gainLow_ = ped->getGainLow();
168  return gainLow_;
169 }
template<class thePayloadObject, class theDBRecordType>
virtual float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedestal ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
pure 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 229 of file SiPixelGainCalibrationServiceBase.h.

References cuy::col, and edm::hlt::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  }
246  else if (col == oldColumnIndexPed_ && inTheSameAveragedDataBlock) // same DetID, same column, same data block
247  {
250  return oldColumnValuePed_;
251  }
252 
258 
259  return oldColumnValuePed_;
260 
261  } else throw cms::Exception("NullPointer")
262  << "[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] SiPixelGainCalibrationRcd not initialized ";
263 }
virtual bool isNoisyColumn(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
int col
Definition: cuy.py:1008
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 190 of file SiPixelGainCalibrationServiceBase.h.

References edm::hlt::Exception.

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

Implements SiPixelGainCalibrationServiceBase.

Definition at line 184 of file SiPixelGainCalibrationServiceBase.h.

184  {
185  double pedHigh_ = ped->getPedHigh();
186  return pedHigh_;
187 }
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedLow ( )
virtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 178 of file SiPixelGainCalibrationServiceBase.h.

178  {
179  double pedLow_ = ped->getPedLow();
180  return pedLow_;
181 }
template<class thePayloadObject, class theDBRecordType>
virtual bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isDead ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
pure virtual
template<class thePayloadObject, class theDBRecordType>
virtual bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isDeadColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
pure virtual
template<class thePayloadObject, class theDBRecordType>
virtual bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isNoisy ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
pure virtual
template<class thePayloadObject, class theDBRecordType>
virtual bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::isNoisyColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
pure virtual
template<class thePayloadObject , class theDBRecordType >
void SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::setESObjects ( const edm::EventSetup es)
virtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 147 of file SiPixelGainCalibrationServiceBase.h.

References edm::EventSetup::get().

147  {
148 
149  es.get<theDBRecordType>().get(ped);
150  ped->initialize();
151  numberOfRowsAveragedOver_ = ped->getNumberOfRowsToAverageOver();
152  ESetupInit_ = true;
153 
154 }
const T & get() const
Definition: EventSetup.h:55
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 dtNoiseDBValidation_cfg::cerr.

304 {
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;
308 
309  // really yell if this occurs
310 
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;
314 }
int col
Definition: cuy.py:1008

Member Data Documentation

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

Definition at line 94 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 95 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 99 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 98 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 97 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 104 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 120 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>
edm::ESHandle<thePayloadObject> SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::ped
protected

Definition at line 96 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 101 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 100 of file SiPixelGainCalibrationServiceBase.h.