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)
 
 ~SiPixelGainCalibrationForHLTService () override
 
- 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)
 
 ~SiPixelGainCalibrationServicePayloadGetter () override
 
- 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_
 
edm::ESHandle< SiPixelGainCalibrationForHLTped
 
double pedHigh_
 
double pedLow_
 

Detailed Description

Definition at line 21 of file SiPixelGainCalibrationForHLTService.h.

Constructor & Destructor Documentation

SiPixelGainCalibrationForHLTService::SiPixelGainCalibrationForHLTService ( const edm::ParameterSet conf)
inlineexplicit
SiPixelGainCalibrationForHLTService::~SiPixelGainCalibrationForHLTService ( )
inlineoverride

Member Function Documentation

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 cuy::col, MillePedeFileConverter_cfg::e, muonCSCDigis_cfi::gain, SiPixelGainCalibrationForHLT::getPedAndGain(), SiPixelGainCalibrationForHLT::getRangeAndNCols(), mps_fire::i, createfilelist::int, isDeadColumn(), isNoisyColumn(), SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::numberOfRowsAveragedOver_, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::ped, and muonCSCDigis_cfi::pedestal.

Referenced by ~SiPixelGainCalibrationForHLTService().

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

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 62 of file SiPixelGainCalibrationForHLTService.cc.

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

Referenced by ~SiPixelGainCalibrationForHLTService().

63 {
64  bool isDead = false;
65  bool isNoisy = false;
66  float gainValue = this->getGainByColumn(detID, col, row, isDead, isNoisy);
67  if (isDead || isNoisy)
68  {
69  this->throwExepctionForBadRead("HLT getGain()", detID, col, row, gainValue);
70  return 0.0;
71  }
72  return gainValue;
73 }
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)
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
bool isDead(const uint32_t &detID, const int &col, const int &row) override
col
Definition: cuy.py:1010
float SiPixelGainCalibrationForHLTService::getPedestal ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 49 of file SiPixelGainCalibrationForHLTService.cc.

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

Referenced by ~SiPixelGainCalibrationForHLTService().

50 {
51  bool isDead = false;
52  bool isNoisy = false;
53  float pedestalValue = this->getPedestalByColumn(detID, col, row, isDead, isNoisy);
54  if (isDead || isNoisy)
55  {
56  this->throwExepctionForBadRead("HLT getPedestal()", detID, col, row, pedestalValue);
57  return 0.0;
58  }
59  return pedestalValue;
60 }
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)
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
bool isDead(const uint32_t &detID, const int &col, const int &row) override
col
Definition: cuy.py:1010
bool SiPixelGainCalibrationForHLTService::isDead ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 75 of file SiPixelGainCalibrationForHLTService.cc.

References MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getPedestalByColumn(), isNoisy(), and cms::Exception::what().

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

76 {
77  bool isDead = false;
78  bool isNoisy = false;
79  try
80  {
81  this->getPedestalByColumn(detID, col, row, isDead, isNoisy); //pedestal stores dead column value as well
82  }
83  catch (cms::Exception& e)
84  {
85  // Do not stop processing if you check if a nonexistant pixel is dead
86  edm::LogInfo("SiPixelGainCalibrationForHLTService") << "Attempting to check if nonexistant pixel is dead. Exception message: " << e.what();
87  isDead = false;
88  }
89  return isDead;
90 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
char const * what() const override
Definition: Exception.cc:103
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
col
Definition: cuy.py:1010
bool SiPixelGainCalibrationForHLTService::isDeadColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 109 of file SiPixelGainCalibrationForHLTService.cc.

References MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getGainByColumn(), isDead(), isNoisy(), and cms::Exception::what().

Referenced by calibrate(), and ~SiPixelGainCalibrationForHLTService().

110 {
111  bool isDead = false;
112  bool isNoisy = false;
113  try
114  {
115  this->getGainByColumn(detID, col, row, isDead, isNoisy);
116  }
117  catch (cms::Exception& e)
118  {
119  // Do not stop processing if you check if a nonexistant pixel is dead
120  edm::LogInfo("SiPixelGainCalibrationForHLTService") << "Attempting to check if nonexistant pixel is dead. Exception message: " << e.what();
121  isDead = false;
122  }
123  return isDead;
124 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
char const * what() const override
Definition: Exception.cc:103
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
col
Definition: cuy.py:1010
bool SiPixelGainCalibrationForHLTService::isNoisy ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 92 of file SiPixelGainCalibrationForHLTService.cc.

References MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getPedestalByColumn(), isDead(), and cms::Exception::what().

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

93 {
94  bool isDead = false;
95  bool isNoisy = false;
96  try
97  {
98  this->getPedestalByColumn(detID, col, row, isDead, isNoisy); //pedestal stores noisy column value as well
99  }
100  catch (cms::Exception& e)
101  {
102  // Do not stop processing if you check if a nonexistant pixel is noisy
103  edm::LogInfo("SiPixelGainCalibrationForHLTService") << "Attempting to check if nonexistant pixel is noisy. Exception message: " << e.what();
104  isNoisy = false;
105  }
106  return isNoisy;
107 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
char const * what() const override
Definition: Exception.cc:103
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
col
Definition: cuy.py:1010
bool SiPixelGainCalibrationForHLTService::isNoisyColumn ( const uint32_t &  detID,
const int &  col,
const int &  row 
)
overridevirtual

Implements SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >.

Definition at line 126 of file SiPixelGainCalibrationForHLTService.cc.

References MillePedeFileConverter_cfg::e, SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd >::getGainByColumn(), isDead(), isNoisy(), and cms::Exception::what().

Referenced by calibrate(), and ~SiPixelGainCalibrationForHLTService().

127 {
128  bool isDead = false;
129  bool isNoisy = false;
130  try
131  {
132  this->getGainByColumn(detID, col, row, isDead, isNoisy);
133  }
134  catch (cms::Exception& e)
135  {
136  // Do not stop processing if you check if a nonexistant pixel is noisy
137  edm::LogInfo("SiPixelGainCalibrationForHLTService") << "Attempting to check if nonexistant pixel is noisy. Exception message: " << e.what();
138  isNoisy = false;
139  }
140  return isNoisy;
141 }
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
char const * what() const override
Definition: Exception.cc:103
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
col
Definition: cuy.py:1010