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 | Private 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
 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
 

Private 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_
 

Detailed Description

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

Definition at line 48 of file SiPixelGainCalibrationServiceBase.h.

Constructor & Destructor Documentation

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

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

115  :
116  conf_(conf),
117  ESetupInit_(false)
118 {
119 
120  edm::LogInfo("SiPixelGainCalibrationServicePayloadGetter") << "[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]";
121  // Initialize cache variables
122  old_detID = 0;
123  oldColumnIndexGain_ = -1;
124  oldColumnIndexPed_ = -1;
125  oldColumnValueGain_ = 0.;
126  oldColumnValuePed_ = 0.;
127 
130  oldThisColumnIsDeadGain_ = false;
131  oldThisColumnIsDeadPed_ = false;
133  oldThisColumnIsNoisyPed_ = false;
134 
135 }
template<class thePayloadObject, class theDBRecordType>
virtual SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::~SiPixelGainCalibrationServicePayloadGetter ( )
inlinevirtual

Definition at line 52 of file SiPixelGainCalibrationServiceBase.h.

52 {};

Member Function Documentation

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

Implements SiPixelGainCalibrationServiceBase.

Definition at line 147 of file SiPixelGainCalibrationServiceBase.h.

147  {
148 
149  std::vector<uint32_t> vdetId_;
150  ped->getDetIds(vdetId_);
151  return vdetId_;
152 
153 }
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 254 of file SiPixelGainCalibrationServiceBase.h.

References edm::hlt::Exception.

254  {
255  if(ESetupInit_) {
256  //&&&&&&&&&&&&&&&&&&&&
257  //Access from DB
258  //&&&&&&&&&&&&&&&&&&&&
259  bool inTheSameAveragedDataBlock = false;
261  inTheSameAveragedDataBlock = true;
262 
263  if (detID != old_detID){
264  old_detID=detID;
265  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
266  old_range = rangeAndNCols.first;
267  old_cols = rangeAndNCols.second;
268  }
269  else if (col == oldColumnIndexGain_ && inTheSameAveragedDataBlock) // same DetID, same column
270  {
273  return oldColumnValueGain_;
274  }
275 
276  oldColumnIndexGain_ = col;
281 
282  return oldColumnValueGain_;
283 
284  } else throw cms::Exception("NullPointer")
285  << "[SiPixelGainCalibrationServicePayloadGetter::getGainByColumn] SiPixelGainCalibrationRcd not initialized ";
286 }
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
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 199 of file SiPixelGainCalibrationServiceBase.h.

References edm::hlt::Exception.

199  {
200  if(ESetupInit_) {
201  //&&&&&&&&&&&&&&&&&&&&
202  //Access from DB
203  //&&&&&&&&&&&&&&&&&&&&
204  if (detID != old_detID){
205  old_detID=detID;
206  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
207  old_range = rangeAndNCols.first;
208  old_cols = rangeAndNCols.second;
209  }
210  return ped->getGain(col, row, old_range, old_cols, isDead, isNoisy);
211  } else throw cms::Exception("NullPointer")
212  << "[SiPixelGainCalibrationServicePayloadGetter::getGainByPixel] SiPixelGainCalibrationRcd not initialized ";
213 }
virtual bool isDead(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
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainHigh ( )
virtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 162 of file SiPixelGainCalibrationServiceBase.h.

162  {
163  double gainHigh_ = ped->getGainHigh();
164  return gainHigh_;
165 }
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainLow ( )
virtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 156 of file SiPixelGainCalibrationServiceBase.h.

156  {
157  double gainLow_ = ped->getGainLow();
158  return gainLow_;
159 }
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 217 of file SiPixelGainCalibrationServiceBase.h.

References edm::hlt::Exception.

217  {
218  if(ESetupInit_) {
219  //&&&&&&&&&&&&&&&&&&&&
220  //Access from DB
221  //&&&&&&&&&&&&&&&&&&&&
222  // see if we are in the same averaged data block
223  bool inTheSameAveragedDataBlock = false;
225  inTheSameAveragedDataBlock = true;
226 
227  if (detID != old_detID){
228  old_detID=detID;
229  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
230  old_range = rangeAndNCols.first;
231  old_cols = rangeAndNCols.second;
232  }
233  else if (col == oldColumnIndexPed_ && inTheSameAveragedDataBlock) // same DetID, same column, same data block
234  {
237  return oldColumnValuePed_;
238  }
239 
240  oldColumnIndexPed_ = col;
245 
246  return oldColumnValuePed_;
247 
248  } else throw cms::Exception("NullPointer")
249  << "[SiPixelGainCalibrationServicePayloadGetter::getPedestalByColumn] SiPixelGainCalibrationRcd not initialized ";
250 }
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
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 180 of file SiPixelGainCalibrationServiceBase.h.

References edm::hlt::Exception.

180  {
181  if(ESetupInit_) {
182  //&&&&&&&&&&&&&&&&&&&&
183  //Access from DB
184  //&&&&&&&&&&&&&&&&&&&&
185  if (detID != old_detID){
186  old_detID=detID;
187  std::pair<const typename thePayloadObject::Range, const int> rangeAndNCols = ped->getRangeAndNCols(detID);
188  old_range = rangeAndNCols.first;
189  old_cols = rangeAndNCols.second;
190  }
191  //std::cout<<" Pedestal "<<ped->getPed(col, row, old_range, old_cols)<<std::endl;
192  return ped->getPed(col, row, old_range, old_cols, isDead, isNoisy);
193  } else throw cms::Exception("NullPointer")
194  << "[SiPixelGainCalibrationServicePayloadGetter::getPedestalByPixel] SiPixelGainCalibrationRcd not initialized ";
195 }
virtual bool isDead(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
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedHigh ( )
virtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 174 of file SiPixelGainCalibrationServiceBase.h.

174  {
175  double pedHigh_ = ped->getPedHigh();
176  return pedHigh_;
177 }
template<class thePayloadObject , class theDBRecordType >
double SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedLow ( )
virtual

Implements SiPixelGainCalibrationServiceBase.

Definition at line 168 of file SiPixelGainCalibrationServiceBase.h.

168  {
169  double pedLow_ = ped->getPedLow();
170  return pedLow_;
171 }
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 138 of file SiPixelGainCalibrationServiceBase.h.

References edm::EventSetup::get().

138  {
139 
140  es.get<theDBRecordType>().get(ped);
141  numberOfRowsAveragedOver_ = ped->getNumberOfRowsToAverageOver();
142  ESetupInit_ = true;
143 
144 }
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 289 of file SiPixelGainCalibrationServiceBase.h.

References dtNoiseDBValidation_cfg::cerr.

290 {
291  std::cerr << "[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]"
292  << "[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: "
293  << 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;
294 
295  // really yell if this occurs
296 
297  edm::LogError("SiPixelGainCalibrationService") << "[SiPixelGainCalibrationServicePayloadGetter::SiPixelGainCalibrationServicePayloadGetter]"
298  << "[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: "
299  << 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;
300 }

Member Data Documentation

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

Definition at line 85 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 86 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 90 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 89 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 88 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 95 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 111 of file SiPixelGainCalibrationServiceBase.h.

template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldAveragedBlockDataGain_
private
template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldAveragedBlockDataPed_
private
template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnIndexGain_
private
template<class thePayloadObject, class theDBRecordType>
int SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnIndexPed_
private
template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValueGain_
private
template<class thePayloadObject, class theDBRecordType>
float SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldColumnValuePed_
private
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsDeadGain_
private
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsDeadPed_
private
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsNoisyGain_
private
template<class thePayloadObject, class theDBRecordType>
bool SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::oldThisColumnIsNoisyPed_
private
template<class thePayloadObject, class theDBRecordType>
edm::ESHandle<thePayloadObject> SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::ped
private

Definition at line 87 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 92 of file SiPixelGainCalibrationServiceBase.h.

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

Definition at line 91 of file SiPixelGainCalibrationServiceBase.h.