CMS 3D CMS Logo

List of all members | Public Member Functions
SiPixelGainCalibrationForHLTService Class Referencefinal

#include <SiPixelGainCalibrationForHLTService.h>

Inheritance diagram for SiPixelGainCalibrationForHLTService:
SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd > SiPixelGainCalibrationServiceBase

Public Member Functions

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

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)
 
- Protected Member Functions inherited from SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >
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 inherited from SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >
edm::ParameterSet conf_
 
bool ESetupInit_
 
double gainHigh_
 
double gainLow_
 
int numberOfRowsAveragedOver_
 
int old_cols
 
uint32_t old_detID
 
SiPixelGainCalibrationForHLT ::Range old_range
 
int oldAveragedBlockDataGain_
 
int oldAveragedBlockDataPed_
 
int oldColumnIndexGain_
 
int oldColumnIndexPed_
 
float oldColumnValueGain_
 
float oldColumnValuePed_
 
bool oldThisColumnIsDeadGain_
 
bool oldThisColumnIsDeadPed_
 
bool oldThisColumnIsNoisyGain_
 
bool oldThisColumnIsNoisyPed_
 
const SiPixelGainCalibrationForHLTped
 
double pedHigh_
 
double pedLow_
 
const edm::ESGetToken< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcdpedToken_
 

Detailed Description

Definition at line 21 of file SiPixelGainCalibrationForHLTService.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationForHLTService()

SiPixelGainCalibrationForHLTService::SiPixelGainCalibrationForHLTService ( const edm::ParameterSet conf,
edm::ConsumesCollector  iC 
)
inlineexplicit

Member Function Documentation

◆ calibrate()

void SiPixelGainCalibrationForHLTService::calibrate ( uint32_t  detID,
DigiIterator  b,
DigiIterator  e,
float  conversionFactor,
float  offset,
int *  electron 
)
overridevirtual

Reimplemented from SiPixelGainCalibrationServiceBase.

Definition at line 20 of file SiPixelGainCalibrationForHLTService.cc.

References cms::cuda::assert(), b, cuy::col, MillePedeFileConverter_cfg::e, HPSPFTauProducerPuppi_cfi::electron, nano_mu_digi_cff::float, PedestalClient_cfi::gain, SiPixelGainCalibrationForHLT::getPedAndGain(), SiPixelGainCalibrationForHLT::getRangeAndNCols(), mps_fire::i, createfilelist::int, isDeadColumn(), isNoisyColumn(), SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::numberOfRowsAveragedOver_, hltrates_dqm_sourceclient-live_cfg::offset, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::ped, EcalCondDBWriter_cfi::pedestal, and FastTimerService_cff::range.

21  {
23  int cols;
24  std::tie(range, cols) = ped->getRangeAndNCols(detID);
25  float pedestal = 0, gain = 0;
26  int i = 0;
27  bool isDeadColumn = false, isNoisyColumn = false;
28  int oldCol = -1, oldAveragedBlock = -1;
29  for (DigiIterator di = b; di != e; ++di) {
30  int row = di->row();
31  int col = di->column();
32  int averagedBlock = row / numberOfRowsAveragedOver_;
33  if ((col != oldCol) | (averagedBlock != oldAveragedBlock)) {
34  oldCol = col;
35  oldAveragedBlock = averagedBlock;
36  std::tie(pedestal, gain) = ped->getPedAndGain(col, row, range, cols, isDeadColumn, isNoisyColumn);
37  }
39  electron[i++] = 0;
40  else {
41  float vcal = float(di->adc()) * gain - pedestal * gain;
42  electron[i++] = int(vcal * conversionFactor + offset);
43  }
44  }
45  assert(i == (e - b));
46 }
edm::DetSet< PixelDigi >::const_iterator DigiIterator
assert(be >=bs)
std::pair< float, float > getPedAndGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
std::pair< ContainerIterator, ContainerIterator > Range
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
double b
Definition: hdecay.h:120
col
Definition: cuy.py:1009
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override

◆ getGain()

float SiPixelGainCalibrationForHLTService::getGain ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 59 of file SiPixelGainCalibrationForHLTService.cc.

References cuy::col, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getGainByColumn(), isDead(), isNoisy(), and SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::throwExepctionForBadRead().

Referenced by SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase().

59  {
60  bool isDead = false;
61  bool isNoisy = false;
62  float gainValue = this->getGainByColumn(detID, col, row, isDead, isNoisy);
63  if (isDead || isNoisy) {
64  this->throwExepctionForBadRead("HLT getGain()", detID, col, row, gainValue);
65  return 0.0;
66  }
67  return gainValue;
68 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
float getGainByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
bool isDead(const uint32_t &detID, const int &col, const int &row) override
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
col
Definition: cuy.py:1009

◆ getPedestal()

float SiPixelGainCalibrationForHLTService::getPedestal ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 48 of file SiPixelGainCalibrationForHLTService.cc.

References cuy::col, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getPedestalByColumn(), isDead(), isNoisy(), and SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::throwExepctionForBadRead().

Referenced by SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase().

48  {
49  bool isDead = false;
50  bool isNoisy = false;
51  float pedestalValue = this->getPedestalByColumn(detID, col, row, isDead, isNoisy);
52  if (isDead || isNoisy) {
53  this->throwExepctionForBadRead("HLT getPedestal()", detID, col, row, pedestalValue);
54  return 0.0;
55  }
56  return pedestalValue;
57 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
float getPedestalByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
bool isDead(const uint32_t &detID, const int &col, const int &row) override
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
col
Definition: cuy.py:1009

◆ isDead()

bool SiPixelGainCalibrationForHLTService::isDead ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 70 of file SiPixelGainCalibrationForHLTService.cc.

References cuy::col, MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getPedestalByColumn(), and isNoisy().

Referenced by getGain(), getPedestal(), isDeadColumn(), isNoisy(), and isNoisyColumn().

70  {
71  bool isDead = false;
72  bool isNoisy = false;
73  try {
74  this->getPedestalByColumn(detID, col, row, isDead, isNoisy); //pedestal stores dead column value as well
75  } catch (cms::Exception& e) {
76  // Do not stop processing if you check if a nonexistant pixel is dead
77  edm::LogInfo("SiPixelGainCalibrationForHLTService")
78  << "Attempting to check if nonexistant pixel is dead. Exception message: " << e.what();
79  isDead = false;
80  }
81  return isDead;
82 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
float getPedestalByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
bool isDead(const uint32_t &detID, const int &col, const int &row) override
Log< level::Info, false > LogInfo
col
Definition: cuy.py:1009

◆ isDeadColumn()

bool SiPixelGainCalibrationForHLTService::isDeadColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 98 of file SiPixelGainCalibrationForHLTService.cc.

References cuy::col, MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getGainByColumn(), isDead(), and isNoisy().

Referenced by calibrate(), and SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase().

98  {
99  bool isDead = false;
100  bool isNoisy = false;
101  try {
102  this->getGainByColumn(detID, col, row, isDead, isNoisy);
103  } catch (cms::Exception& e) {
104  // Do not stop processing if you check if a nonexistant pixel is dead
105  edm::LogInfo("SiPixelGainCalibrationForHLTService")
106  << "Attempting to check if nonexistant pixel is dead. Exception message: " << e.what();
107  isDead = false;
108  }
109  return isDead;
110 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
float getGainByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
bool isDead(const uint32_t &detID, const int &col, const int &row) override
Log< level::Info, false > LogInfo
col
Definition: cuy.py:1009

◆ isNoisy()

bool SiPixelGainCalibrationForHLTService::isNoisy ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 84 of file SiPixelGainCalibrationForHLTService.cc.

References cuy::col, MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getPedestalByColumn(), and isDead().

Referenced by getGain(), getPedestal(), isDead(), isDeadColumn(), and isNoisyColumn().

84  {
85  bool isDead = false;
86  bool isNoisy = false;
87  try {
88  this->getPedestalByColumn(detID, col, row, isDead, isNoisy); //pedestal stores noisy column value as well
89  } catch (cms::Exception& e) {
90  // Do not stop processing if you check if a nonexistant pixel is noisy
91  edm::LogInfo("SiPixelGainCalibrationForHLTService")
92  << "Attempting to check if nonexistant pixel is noisy. Exception message: " << e.what();
93  isNoisy = false;
94  }
95  return isNoisy;
96 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
float getPedestalByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
bool isDead(const uint32_t &detID, const int &col, const int &row) override
Log< level::Info, false > LogInfo
col
Definition: cuy.py:1009

◆ isNoisyColumn()

bool SiPixelGainCalibrationForHLTService::isNoisyColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 112 of file SiPixelGainCalibrationForHLTService.cc.

References cuy::col, MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getGainByColumn(), isDead(), and isNoisy().

Referenced by calibrate(), and SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase().

112  {
113  bool isDead = false;
114  bool isNoisy = false;
115  try {
116  this->getGainByColumn(detID, col, row, isDead, isNoisy);
117  } catch (cms::Exception& e) {
118  // Do not stop processing if you check if a nonexistant pixel is noisy
119  edm::LogInfo("SiPixelGainCalibrationForHLTService")
120  << "Attempting to check if nonexistant pixel is noisy. Exception message: " << e.what();
121  isNoisy = false;
122  }
123  return isNoisy;
124 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
float getGainByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
bool isDead(const uint32_t &detID, const int &col, const int &row) override
Log< level::Info, false > LogInfo
col
Definition: cuy.py:1009