CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends
CTPPSPixelGainCalibration Class Reference

#include <CondFormats/CTPPSRedoutObjects/src/CTPPSPixelGainCalibration.cc>

Classes

struct  DetRegistry
 

Public Member Functions

 CTPPSPixelGainCalibration ()
 
 CTPPSPixelGainCalibration (const uint32_t &detid, const std::vector< float > &peds, const std::vector< float > &gains, float minPed=0., float maxPed=255., float minGain=0., float maxGain=255.)
 
 CTPPSPixelGainCalibration (const uint32_t &detId, const uint32_t &sensorSize, const uint32_t &nCols)
 
 CTPPSPixelGainCalibration (float minPed, float maxPed, float minGain, float maxGain)
 
uint32_t getDetId () const
 
float getGain (const int &col, const int &row) const
 
float getGain (const uint32_t ipix) const
 
double getGainHigh () const
 
double getGainLow () const
 
uint32_t getIBegin () const
 
uint32_t getIEnd () const
 
uint32_t getNCols () const
 
uint32_t getNRows () const
 
float getPed (const int &col, const int &row) const
 
float getPed (const uint32_t ipix) const
 
double getPedHigh () const
 
double getPedLow () const
 
void initialize ()
 
bool isDead (const uint32_t ipix) const
 
bool isNoisy (const uint32_t ipix) const
 
void putData (uint32_t ipix, float ped, float gain)
 
void setDeadPixel (int ipix)
 
void setGainsPeds (const uint32_t &detId, const std::vector< float > &peds, const std::vector< float > &gains)
 
void setNoisyPixel (int ipix)
 
 ~CTPPSPixelGainCalibration ()
 

Private Member Functions

void resetPixData (uint32_t ipix, float ped, float gain)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
void setIndexes (const uint32_t &detId)
 

Private Attributes

DetRegistry indexes
 
float maxGain_
 
float maxPed_
 
float minGain_
 
float minPed_
 
std::vector< float > v_gains
 
std::vector< float > v_pedestals
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 
class CTPPSPixelGainCalibrations
 

Detailed Description

Description: Gain calibration object for the CTPPS 3D Pixels. Store gain/pedestal information at pixel granularity

Implementation: <Notes on="" implementation>="">

Definition at line 27 of file CTPPSPixelGainCalibration.h.

Constructor & Destructor Documentation

◆ CTPPSPixelGainCalibration() [1/4]

CTPPSPixelGainCalibration::CTPPSPixelGainCalibration ( )

Definition at line 9 of file CTPPSPixelGainCalibration.cc.

9  : minPed_(0.), maxPed_(255.), minGain_(0.), maxGain_(255.) {
10  DetRegistry myreg;
11  myreg.detid = 0;
12  myreg.ibegin = 0;
13  myreg.iend = 0;
14  myreg.ncols = 0;
15  myreg.nrows = 0;
16  indexes = myreg;
17  edm::LogInfo("CTPPSPixelGainCalibration") << "Default instance of CTPPSPixelGainCalibration";
18 }

References CTPPSPixelGainCalibration::DetRegistry::detid, CTPPSPixelGainCalibration::DetRegistry::ibegin, CTPPSPixelGainCalibration::DetRegistry::iend, indexes, CTPPSPixelGainCalibration::DetRegistry::ncols, and CTPPSPixelGainCalibration::DetRegistry::nrows.

◆ CTPPSPixelGainCalibration() [2/4]

CTPPSPixelGainCalibration::CTPPSPixelGainCalibration ( const uint32_t &  detId,
const uint32_t &  sensorSize = 24960,
const uint32_t &  nCols = 156 
)

Definition at line 20 of file CTPPSPixelGainCalibration.cc.

23  : minPed_(0.), maxPed_(255.), minGain_(0.), maxGain_(255.) {
24  DetRegistry myreg;
25  myreg.detid = detId;
26  myreg.ibegin = 0;
27  myreg.iend = sensorSize;
28  myreg.ncols = nCols;
29  myreg.nrows = sensorSize / nCols;
30  indexes = myreg;
31  edm::LogInfo("CTPPSPixelGainCalibration")
32  << "Instance of CTPPSPixelGainCalibration setting detId = " << detId << " and npix = " << sensorSize
33  << " and ncols = " << nCols << " and nrows= " << myreg.nrows;
34 }

References CTPPSPixelGainCalibration::DetRegistry::detid, CTPPSPixelGainCalibration::DetRegistry::ibegin, CTPPSPixelGainCalibration::DetRegistry::iend, indexes, CTPPSPixelGainCalibration::DetRegistry::ncols, and CTPPSPixelGainCalibration::DetRegistry::nrows.

◆ CTPPSPixelGainCalibration() [3/4]

CTPPSPixelGainCalibration::CTPPSPixelGainCalibration ( float  minPed,
float  maxPed,
float  minGain,
float  maxGain 
)

Definition at line 37 of file CTPPSPixelGainCalibration.cc.

38  : minPed_(minPed), maxPed_(maxPed), minGain_(minGain), maxGain_(maxGain) {
39  DetRegistry myreg;
40  myreg.detid = 0;
41  myreg.ibegin = 0;
42  myreg.iend = 0;
43  myreg.ncols = 0;
44  myreg.nrows = 0;
45  indexes = myreg;
46  edm::LogInfo("CTPPSPixelGainCalibration") << "Instance of CTPPSPixelGainCalibration setting mininums and maximums";
47 }

References CTPPSPixelGainCalibration::DetRegistry::detid, CTPPSPixelGainCalibration::DetRegistry::ibegin, CTPPSPixelGainCalibration::DetRegistry::iend, indexes, CTPPSPixelGainCalibration::DetRegistry::ncols, and CTPPSPixelGainCalibration::DetRegistry::nrows.

◆ CTPPSPixelGainCalibration() [4/4]

CTPPSPixelGainCalibration::CTPPSPixelGainCalibration ( const uint32_t &  detid,
const std::vector< float > &  peds,
const std::vector< float > &  gains,
float  minPed = 0.,
float  maxPed = 255.,
float  minGain = 0.,
float  maxGain = 255. 
)

Definition at line 49 of file CTPPSPixelGainCalibration.cc.

56  : minPed_(minPed), maxPed_(maxPed), minGain_(minGain), maxGain_(maxGain) {
57  setGainsPeds(detid, peds, gains);
58  edm::LogInfo("CTPPSPixelGainCalibration")
59  << "Instance of CTPPSPixelGainCalibration setting detId = " << detid << "and vectors of peds and gains";
60 }

References setGainsPeds().

◆ ~CTPPSPixelGainCalibration()

CTPPSPixelGainCalibration::~CTPPSPixelGainCalibration ( )
inline

Definition at line 51 of file CTPPSPixelGainCalibration.h.

51 {}

Member Function Documentation

◆ getDetId()

uint32_t CTPPSPixelGainCalibration::getDetId ( ) const
inline

◆ getGain() [1/2]

float CTPPSPixelGainCalibration::getGain ( const int &  col,
const int &  row 
) const

Definition at line 136 of file CTPPSPixelGainCalibration.cc.

136  {
137  int nCols = indexes.ncols;
138  int nRows = indexes.nrows;
139  if (col >= nCols || row >= nRows) {
140  throw cms::Exception("CorruptedData")
141  << "[CTPPSPixelGainCalibration::getGain] Pixel out of range: col " << col << " row " << row;
142  }
143 
144  int ipix = col + row * nCols;
145  float tmpgain = getGain(ipix);
146 
147  return tmpgain;
148 }

References cuy::col, Exception, indexes, CTPPSPixelGainCalibration::DetRegistry::ncols, and CTPPSPixelGainCalibration::DetRegistry::nrows.

Referenced by CTPPSPixGainCalibsESAnalyzer::analyze(), RPixDetClusterizer::calibrate(), RPixDummyROCSimulator::ConvertChargeToHits(), and CTPPSPixelGainCalibrations::setGainCalibration().

◆ getGain() [2/2]

float CTPPSPixelGainCalibration::getGain ( const uint32_t  ipix) const
inline

Definition at line 72 of file CTPPSPixelGainCalibration.h.

72 { return v_gains[ipix]; }

References v_gains.

◆ getGainHigh()

double CTPPSPixelGainCalibration::getGainHigh ( ) const
inline

Definition at line 58 of file CTPPSPixelGainCalibration.h.

58 { return maxGain_; }

References maxGain_.

◆ getGainLow()

double CTPPSPixelGainCalibration::getGainLow ( ) const
inline

Definition at line 57 of file CTPPSPixelGainCalibration.h.

57 { return minGain_; }

References minGain_.

◆ getIBegin()

uint32_t CTPPSPixelGainCalibration::getIBegin ( ) const
inline

◆ getIEnd()

uint32_t CTPPSPixelGainCalibration::getIEnd ( ) const
inline

◆ getNCols()

uint32_t CTPPSPixelGainCalibration::getNCols ( ) const
inline

◆ getNRows()

uint32_t CTPPSPixelGainCalibration::getNRows ( ) const
inline

◆ getPed() [1/2]

float CTPPSPixelGainCalibration::getPed ( const int &  col,
const int &  row 
) const

Definition at line 122 of file CTPPSPixelGainCalibration.cc.

122  {
123  int nCols = indexes.ncols;
124  int nRows = indexes.nrows;
125  if (col >= nCols || row >= nRows) {
126  throw cms::Exception("CorruptedData")
127  << "[CTPPSPixelGainCalibration::getPed] Pixel out of range: col " << col << " row " << row;
128  }
129 
130  int ipix = col + row * nCols;
131  float tmpped = getPed(ipix /*,isDead,isNoisy*/);
132 
133  return tmpped;
134 }

References cuy::col, Exception, indexes, CTPPSPixelGainCalibration::DetRegistry::ncols, and CTPPSPixelGainCalibration::DetRegistry::nrows.

Referenced by CTPPSPixGainCalibsESAnalyzer::analyze(), RPixDetClusterizer::calibrate(), RPixDummyROCSimulator::ConvertChargeToHits(), and CTPPSPixelGainCalibrations::setGainCalibration().

◆ getPed() [2/2]

float CTPPSPixelGainCalibration::getPed ( const uint32_t  ipix) const
inline

Definition at line 71 of file CTPPSPixelGainCalibration.h.

71 { return v_pedestals[ipix]; }

References v_pedestals.

◆ getPedHigh()

double CTPPSPixelGainCalibration::getPedHigh ( ) const
inline

Definition at line 60 of file CTPPSPixelGainCalibration.h.

60 { return maxPed_; }

References maxPed_.

◆ getPedLow()

double CTPPSPixelGainCalibration::getPedLow ( ) const
inline

Definition at line 59 of file CTPPSPixelGainCalibration.h.

59 { return minPed_; }

References minPed_.

◆ initialize()

void CTPPSPixelGainCalibration::initialize ( )
inline

Definition at line 53 of file CTPPSPixelGainCalibration.h.

53 {}

◆ isDead()

bool CTPPSPixelGainCalibration::isDead ( const uint32_t  ipix) const
inline

Definition at line 73 of file CTPPSPixelGainCalibration.h.

73 { return (v_pedestals[ipix] == -9999.); }

References v_pedestals.

Referenced by CTPPSPixGainCalibsESAnalyzer::analyze(), and CTPPSPixelGainCalibrations::setGainCalibration().

◆ isNoisy()

bool CTPPSPixelGainCalibration::isNoisy ( const uint32_t  ipix) const
inline

Definition at line 74 of file CTPPSPixelGainCalibration.h.

74 { return (v_gains[ipix] == -9999.); }

References v_gains.

Referenced by CTPPSPixGainCalibsESAnalyzer::analyze(), and CTPPSPixelGainCalibrations::setGainCalibration().

◆ putData()

void CTPPSPixelGainCalibration::putData ( uint32_t  ipix,
float  ped,
float  gain 
)

Definition at line 84 of file CTPPSPixelGainCalibration.cc.

84  {
85  if (v_pedestals.size() > ipix) //if the vector is too big, this pixel has already been set
86  {
87  if (ped >= 0 && gain >= 0)
88  throw cms::Exception("CTPPSPixelGainCalibration fill error")
89  << "[CTPPSPixelGainCalibration::putData] attempting to fill the vectors that are already filled detid = "
90  << indexes.detid << " ipix " << ipix;
91  else // in case it is for setting the noisy or dead flag of already filled pixel you are allowed to reset it
92  {
93  edm::LogInfo("CTPPSPixelGainCalibration") << "resetting pixel calibration for noisy or dead flag";
94  resetPixData(ipix, ped, gain);
95  }
96  } else if (v_pedestals.size() < ipix)
97  throw cms::Exception("CTPPSPixelGainCalibration fill error")
98  << "[CTPPSPixelGainCalibration::putData] the order got scrambled detid = " << indexes.detid << " ipix " << ipix;
99  else { //the size has to match exactly the index, the index - 0 pixel starts the vector, the one with index 1 should be pushed back in a vector of size== 1 (to become size==2) so on and o forth
100  v_pedestals.push_back(ped);
101  v_gains.push_back(gain);
102  }
103 }

References CTPPSPixelGainCalibration::DetRegistry::detid, Exception, PedestalClient_cfi::gain, indexes, resetPixData(), v_gains, and v_pedestals.

Referenced by WriteCTPPSPixGainCalibrations::fillDB(), setDeadPixel(), setGainsPeds(), and setNoisyPixel().

◆ resetPixData()

void CTPPSPixelGainCalibration::resetPixData ( uint32_t  ipix,
float  ped,
float  gain 
)
private

Definition at line 113 of file CTPPSPixelGainCalibration.cc.

113  {
114  if (v_pedestals.size() <= ipix) {
115  edm::LogError("CTPPSPixelGainCalibration") << "this element ipix = " << ipix << " has not been set yet";
116  return;
117  }
118  v_pedestals[ipix] = ped; //modify value to already exisiting element
119  v_gains[ipix] = gain;
120 }

References PedestalClient_cfi::gain, v_gains, and v_pedestals.

Referenced by putData().

◆ serialize()

template<class Archive >
void CTPPSPixelGainCalibration::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setDeadPixel()

void CTPPSPixelGainCalibration::setDeadPixel ( int  ipix)
inline

Definition at line 64 of file CTPPSPixelGainCalibration.h.

64 { putData(ipix, -9999., 0.); } // dead flag is pedestal = -9999.

References putData().

◆ setGainsPeds()

void CTPPSPixelGainCalibration::setGainsPeds ( const uint32_t &  detId,
const std::vector< float > &  peds,
const std::vector< float > &  gains 
)

Definition at line 62 of file CTPPSPixelGainCalibration.cc.

64  {
65  int sensorSize = peds.size();
66  int gainsSize = gains.size();
67  if (gainsSize != sensorSize)
68  throw cms::Exception("CTPPSPixelGainCalibration payload configuration error")
69  << "[CTPPSPixelGainCalibration::CTPPSPixelGainCalibration] peds and gains vector sizes don't match for detid "
70  << detid << " size peds = " << sensorSize << " size gains = " << gainsSize;
71  DetRegistry myreg;
72  myreg.detid = detid;
73  myreg.ibegin = 0;
74  myreg.iend = sensorSize;
75  myreg.ncols =
76  sensorSize /
77  160; // each ROC is made of 80 rows and 52 columns, each sensor is made of 160 rows and either 104 or 156 columns (2x2 or 2x3 ROCs)
78  myreg.nrows = 160; // for now this is hardwired.
79  indexes = myreg;
80  for (int i = 0; i < sensorSize; ++i)
81  putData(i, peds[i], gains[i]);
82 }

References CTPPSPixelGainCalibration::DetRegistry::detid, Exception, mps_fire::i, CTPPSPixelGainCalibration::DetRegistry::ibegin, CTPPSPixelGainCalibration::DetRegistry::iend, indexes, CTPPSPixelGainCalibration::DetRegistry::ncols, CTPPSPixelGainCalibration::DetRegistry::nrows, and putData().

Referenced by CTPPSPixelGainCalibration().

◆ setIndexes()

void CTPPSPixelGainCalibration::setIndexes ( const uint32_t &  detId)
private

◆ setNoisyPixel()

void CTPPSPixelGainCalibration::setNoisyPixel ( int  ipix)
inline

Definition at line 65 of file CTPPSPixelGainCalibration.h.

65 { putData(ipix, 0., -9999.); } // noisy flat is gain= -9999.

References putData().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 92 of file CTPPSPixelGainCalibration.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 92 of file CTPPSPixelGainCalibration.h.

◆ CTPPSPixelGainCalibrations

friend class CTPPSPixelGainCalibrations
friend

Definition at line 28 of file CTPPSPixelGainCalibration.h.

Member Data Documentation

◆ indexes

DetRegistry CTPPSPixelGainCalibration::indexes
private

◆ maxGain_

float CTPPSPixelGainCalibration::maxGain_
private

Definition at line 90 of file CTPPSPixelGainCalibration.h.

Referenced by getGainHigh().

◆ maxPed_

float CTPPSPixelGainCalibration::maxPed_
private

Definition at line 90 of file CTPPSPixelGainCalibration.h.

Referenced by getPedHigh().

◆ minGain_

float CTPPSPixelGainCalibration::minGain_
private

Definition at line 90 of file CTPPSPixelGainCalibration.h.

Referenced by getGainLow().

◆ minPed_

float CTPPSPixelGainCalibration::minPed_
private

Definition at line 90 of file CTPPSPixelGainCalibration.h.

Referenced by getPedLow().

◆ v_gains

std::vector<float> CTPPSPixelGainCalibration::v_gains
private

Definition at line 87 of file CTPPSPixelGainCalibration.h.

Referenced by getGain(), isNoisy(), putData(), and resetPixData().

◆ v_pedestals

std::vector<float> CTPPSPixelGainCalibration::v_pedestals
private

Definition at line 86 of file CTPPSPixelGainCalibration.h.

Referenced by getPed(), isDead(), putData(), resetPixData(), and setIndexes().

mps_fire.i
i
Definition: mps_fire.py:428
CTPPSPixelGainCalibration::v_pedestals
std::vector< float > v_pedestals
Definition: CTPPSPixelGainCalibration.h:86
CTPPSPixelGainCalibration::DetRegistry::iend
uint32_t iend
Definition: CTPPSPixelGainCalibration.h:34
cuy.col
col
Definition: cuy.py:1010
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CTPPSPixelGainCalibration::minPed_
float minPed_
Definition: CTPPSPixelGainCalibration.h:90
CTPPSPixelGainCalibration::getGain
float getGain(const int &col, const int &row) const
Definition: CTPPSPixelGainCalibration.cc:136
CTPPSPixelGainCalibration::maxGain_
float maxGain_
Definition: CTPPSPixelGainCalibration.h:90
CTPPSPixelGainCalibration::v_gains
std::vector< float > v_gains
Definition: CTPPSPixelGainCalibration.h:87
CTPPSPixelGainCalibration::indexes
DetRegistry indexes
Definition: CTPPSPixelGainCalibration.h:88
CTPPSPixelGainCalibration::maxPed_
float maxPed_
Definition: CTPPSPixelGainCalibration.h:90
CTPPSPixelGainCalibration::getPed
float getPed(const int &col, const int &row) const
Definition: CTPPSPixelGainCalibration.cc:122
CTPPSPixelGainCalibration::minGain_
float minGain_
Definition: CTPPSPixelGainCalibration.h:90
CTPPSPixelGainCalibration::DetRegistry::ibegin
uint32_t ibegin
Definition: CTPPSPixelGainCalibration.h:33
CTPPSPixelGainCalibration::setGainsPeds
void setGainsPeds(const uint32_t &detId, const std::vector< float > &peds, const std::vector< float > &gains)
Definition: CTPPSPixelGainCalibration.cc:62
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
CTPPSPixelGainCalibration::resetPixData
void resetPixData(uint32_t ipix, float ped, float gain)
Definition: CTPPSPixelGainCalibration.cc:113
CTPPSPixelGainCalibration::DetRegistry::ncols
uint32_t ncols
Definition: CTPPSPixelGainCalibration.h:35
Exception
Definition: hltDiff.cc:246
cms::Exception
Definition: Exception.h:70
CTPPSPixelGainCalibration::DetRegistry::nrows
uint32_t nrows
Definition: CTPPSPixelGainCalibration.h:36
CTPPSPixelGainCalibration::DetRegistry::detid
uint32_t detid
Definition: CTPPSPixelGainCalibration.h:32
CTPPSPixelGainCalibration::putData
void putData(uint32_t ipix, float ped, float gain)
Definition: CTPPSPixelGainCalibration.cc:84