CMS 3D CMS Logo

SiPixelGainCalibrationService.cc
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: SiPixelGainCalibrationServic.cc
5  *
6  * Description:
7  *
8  * Version: 1.0 (some functionality moved from ../interface/SiPixelGainCalibrationService.h)
9  * Created: 04/16/2008 10:35:35 AM
10  *
11  * Author: Evan Friis (evan.klose.friis@cern.ch)
12  * University of California, Davis
13  *
14  * =====================================================================================
15  */
16 
18 
20  uint32_t detID, DigiIterator b, DigiIterator e, float conversionFactor, float offset, int* electron) {
21  int i = 0;
22  for (DigiIterator di = b; di != e; ++di) {
23  int row = di->row();
24  int col = di->column();
25 
26  if (isDead(detID, col, row) || isNoisy(detID, col, row))
27  electron[i++] = 0;
28  else {
29  float DBgain = getGain(detID, col, row);
30  float DBpedestal = getPedestal(detID, col, row) * DBgain;
31  float vcal = di->adc() * DBgain - DBpedestal;
32  // float vcal = (di->adc() - DBpedestal) * DBgain;
33  electron[i++] = int(vcal * conversionFactor + offset);
34  }
35  }
36  assert(i == (e - b));
37 }
38 
39 float SiPixelGainCalibrationService::getPedestal(const uint32_t& detID, const int& col, const int& row) {
40  bool isDead = false;
41  bool isNoisy = false;
42  float pedestalValue = this->getPedestalByPixel(detID, col, row, isDead, isNoisy);
43  if (isDead || isNoisy) {
44  this->throwExepctionForBadRead("FullCalibration getPedestal()", detID, col, row, pedestalValue);
45  return 0.0;
46  }
47  return pedestalValue;
48 }
49 
50 float SiPixelGainCalibrationService::getGain(const uint32_t& detID, const int& col, const int& row) {
51  bool isDead = false;
52  bool isNoisy = false;
53  float gainValue = this->getGainByColumn(detID, col, row, isDead, isNoisy);
54  if (isDead || isNoisy) {
55  this->throwExepctionForBadRead("FullCalibration getGain()", detID, col, row, gainValue);
56  return 0.0;
57  }
58  return gainValue;
59 }
60 
61 bool SiPixelGainCalibrationService::isDead(const uint32_t& detID, const int& col, const int& row) {
62  bool isDead = false;
63  bool isNoisy = false;
64  try {
65  this->getPedestalByPixel(detID, col, row, isDead, isNoisy);
66  } catch (cms::Exception& e) {
67  // Do not stop processing if you check if a nonexistant pixel is dead
68  edm::LogInfo("SiPixelGainCalibrationService")
69  << "Attempting to check if nonexistant pixel is dead. Exception message: " << e.what();
70  isDead = false;
71  }
72  return isDead;
73 }
74 
75 bool SiPixelGainCalibrationService::isNoisy(const uint32_t& detID, const int& col, const int& row) {
76  bool isDead = false;
77  bool isNoisy = false;
78  try {
79  this->getPedestalByPixel(detID, col, row, isDead, isNoisy);
80  } catch (cms::Exception& e) {
81  // Do not stop processing if you check if a nonexistant pixel is noisy
82  edm::LogInfo("SiPixelGainCalibrationService")
83  << "Attempting to check if nonexistant pixel is noisy. Exception message: " << e.what();
84  isNoisy = false;
85  }
86  return isNoisy;
87 }
88 
89 bool SiPixelGainCalibrationService::isDeadColumn(const uint32_t& detID, const int& col, const int& row) {
90  edm::LogError("SiPixelGainCalibrationService")
91  << "You attempted to check if an entire column was dead with a payload that stores information at pixel "
92  "granularity. Please check by pixel. THANKS!";
93  return false;
94 }
95 
96 bool SiPixelGainCalibrationService::isNoisyColumn(const uint32_t& detID, const int& col, const int& row) {
97  edm::LogError("SiPixelGainCalibrationService")
98  << "You attempted to check if an entire column was noisy with a payload that stores information at pixel "
99  "granularity. Please check by pixel. THANKS!";
100  return false;
101 }
SiPixelGainCalibrationService::isNoisy
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
Definition: SiPixelGainCalibrationService.cc:75
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelGainCalibrationServiceBase::DigiIterator
edm::DetSet< PixelDigi >::const_iterator DigiIterator
Definition: SiPixelGainCalibrationServiceBase.h:31
SiPixelGainCalibrationServiceBase::isDead
virtual bool isDead(const uint32_t &detID, const int &col, const int &row)=0
SiPixelGainCalibrationServiceBase::getGain
virtual float getGain(const uint32_t &detID, const int &col, const int &row)=0
cuy.col
col
Definition: cuy.py:1010
SiPixelGainCalibrationService::isNoisyColumn
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override
Definition: SiPixelGainCalibrationService.cc:96
cms::cuda::assert
assert(be >=bs)
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibration, SiPixelGainCalibrationRcd >::getGainByColumn
float getGainByColumn(const uint32_t &detID, const int &col, const int &row, bool &isDeadColumn, bool &isNoisyColumn)
Definition: SiPixelGainCalibrationServiceBase.h:265
SiPixelGainCalibrationService.h
metsig::electron
Definition: SignAlgoResolutions.h:48
SiPixelGainCalibrationService::getGain
float getGain(const uint32_t &detID, const int &col, const int &row) override
Definition: SiPixelGainCalibrationService.cc:50
b
double b
Definition: hdecay.h:118
createfilelist.int
int
Definition: createfilelist.py:10
SiPixelGainCalibrationService::isDeadColumn
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override
Definition: SiPixelGainCalibrationService.cc:89
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cms::Exception
Definition: Exception.h:70
SiPixelGainCalibrationService::getPedestal
float getPedestal(const uint32_t &detID, const int &col, const int &row) override
Definition: SiPixelGainCalibrationService.cc:39
SiPixelGainCalibrationServiceBase::getPedestal
virtual float getPedestal(const uint32_t &detID, const int &col, const int &row)=0
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
SiPixelGainCalibrationService::isDead
bool isDead(const uint32_t &detID, const int &col, const int &row) override
Definition: SiPixelGainCalibrationService.cc:61
SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibration, SiPixelGainCalibrationRcd >::throwExepctionForBadRead
void throwExepctionForBadRead(std::string payload, const uint32_t &detID, const int &col, const int &row, double value=-1) const
Definition: SiPixelGainCalibrationServiceBase.h:302
SiPixelGainCalibrationServiceBase::calibrate
virtual void calibrate(uint32_t detID, DigiIterator b, DigiIterator e, float conversionFactor, float offset, int *electron)
Definition: SiPixelGainCalibrationService.cc:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
SiPixelGainCalibrationServicePayloadGetter< SiPixelGainCalibration, SiPixelGainCalibrationRcd >::getPedestalByPixel
float getPedestalByPixel(const uint32_t &detID, const int &col, const int &row, bool &isDeadPixel, bool &isNoisyPixel)
Definition: SiPixelGainCalibrationServiceBase.h:186
SiPixelGainCalibrationServiceBase::isNoisy
virtual bool isNoisy(const uint32_t &detID, const int &col, const int &row)=0