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 uint32_t &sensorSize, const uint32_t &nCols)
 
 CTPPSPixelGainCalibration (float minPed, float maxPed, float minGain, float maxGain)
 
 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.)
 
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::CTPPSPixelGainCalibration ( )

Definition at line 9 of file CTPPSPixelGainCalibration.cc.

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

9  :
10  minPed_(0.),
11  maxPed_(255.),
12  minGain_(0.),
13  maxGain_(255.)
14 {
15  DetRegistry myreg;
16  myreg.detid =0;
17  myreg.ibegin=0;
18  myreg.iend =0;
19  myreg.ncols =0;
20  myreg.nrows =0;
21  indexes = myreg;
22  edm::LogInfo("CTPPSPixelGainCalibration")<< "Default instance of CTPPSPixelGainCalibration" ;
23 }
CTPPSPixelGainCalibration::CTPPSPixelGainCalibration ( const uint32_t &  detId,
const uint32_t &  sensorSize = 24960,
const uint32_t &  nCols = 156 
)

Definition at line 25 of file CTPPSPixelGainCalibration.cc.

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

25  :
26  minPed_(0.),
27  maxPed_(255.),
28  minGain_(0.),
29  maxGain_(255.)
30 {
31  DetRegistry myreg;
32  myreg.detid = detId;
33  myreg.ibegin= 0;
34  myreg.iend = sensorSize;
35  myreg.ncols = nCols;
36  myreg.nrows = sensorSize/nCols;
37  indexes = myreg;
38  edm::LogInfo("CTPPSPixelGainCalibration") << "Instance of CTPPSPixelGainCalibration setting detId = " << detId << " and npix = " << sensorSize << " and ncols = " << nCols << " and nrows= " << myreg.nrows;
39 
40 }
CTPPSPixelGainCalibration::CTPPSPixelGainCalibration ( float  minPed,
float  maxPed,
float  minGain,
float  maxGain 
)

Definition at line 44 of file CTPPSPixelGainCalibration.cc.

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

44  :
45  minPed_(minPed),
46  maxPed_(maxPed),
47  minGain_(minGain),
48  maxGain_(maxGain)
49 {
50  DetRegistry myreg;
51  myreg.detid=0;
52  myreg.ibegin=0;
53  myreg.iend=0;
54  myreg.ncols=0;
55  myreg.nrows=0;
56  indexes = myreg;
57  edm::LogInfo("CTPPSPixelGainCalibration")<<"Instance of CTPPSPixelGainCalibration setting mininums and maximums";
58 }
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 61 of file CTPPSPixelGainCalibration.cc.

References setGainsPeds().

61  :
62  minPed_(minPed),
63  maxPed_(maxPed),
64  minGain_(minGain),
65  maxGain_(maxGain)
66 {
67  setGainsPeds(detid,peds,gains);
68  edm::LogInfo("CTPPSPixelGainCalibration")<<"Instance of CTPPSPixelGainCalibration setting detId = "<< detid <<"and vectors of peds and gains";
69 
70 }
void setGainsPeds(const uint32_t &detId, const std::vector< float > &peds, const std::vector< float > &gains)
CTPPSPixelGainCalibration::~CTPPSPixelGainCalibration ( )
inline

Definition at line 48 of file CTPPSPixelGainCalibration.h.

48 {}

Member Function Documentation

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

Definition at line 143 of file CTPPSPixelGainCalibration.cc.

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

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

143  {
144  int nCols=indexes.ncols;
145  int nRows=indexes.nrows;
146  if (col >= nCols || row >= nRows){
147  throw cms::Exception("CorruptedData")
148  << "[CTPPSPixelGainCalibration::getGain] Pixel out of range: col " << col << " row " << row;
149  }
150 
151  int ipix = col + row * nCols;
152  float tmpgain = getGain(ipix);
153 
154  return tmpgain;
155 }
col
Definition: cuy.py:1010
float getGain(const int &col, const int &row) const
float CTPPSPixelGainCalibration::getGain ( const uint32_t  ipix) const
inline

Definition at line 70 of file CTPPSPixelGainCalibration.h.

References v_gains.

70 {return v_gains[ipix];}
double CTPPSPixelGainCalibration::getGainHigh ( ) const
inline

Definition at line 55 of file CTPPSPixelGainCalibration.h.

References maxGain_.

double CTPPSPixelGainCalibration::getGainLow ( ) const
inline

Definition at line 54 of file CTPPSPixelGainCalibration.h.

References minGain_.

uint32_t CTPPSPixelGainCalibration::getIBegin ( ) const
inline
uint32_t CTPPSPixelGainCalibration::getIEnd ( ) const
inline
uint32_t CTPPSPixelGainCalibration::getNCols ( ) const
inline
uint32_t CTPPSPixelGainCalibration::getNRows ( ) const
inline
float CTPPSPixelGainCalibration::getPed ( const int &  col,
const int &  row 
) const

Definition at line 128 of file CTPPSPixelGainCalibration.cc.

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

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

128  {
129  int nCols=indexes.ncols;
130  int nRows=indexes.nrows;
131  if (col >= nCols || row >= nRows){
132  throw cms::Exception("CorruptedData")
133  << "[CTPPSPixelGainCalibration::getPed] Pixel out of range: col " << col << " row " << row;
134  }
135 
136  int ipix = col + row * nCols;
137  float tmpped = getPed(ipix/*,isDead,isNoisy*/);
138 
139  return tmpped;
140 }
float getPed(const int &col, const int &row) const
col
Definition: cuy.py:1010
float CTPPSPixelGainCalibration::getPed ( const uint32_t  ipix) const
inline

Definition at line 69 of file CTPPSPixelGainCalibration.h.

References v_pedestals.

69 {return v_pedestals[ipix];}
double CTPPSPixelGainCalibration::getPedHigh ( ) const
inline

Definition at line 57 of file CTPPSPixelGainCalibration.h.

References maxPed_.

double CTPPSPixelGainCalibration::getPedLow ( ) const
inline

Definition at line 56 of file CTPPSPixelGainCalibration.h.

References minPed_.

void CTPPSPixelGainCalibration::initialize ( )
inline

Definition at line 50 of file CTPPSPixelGainCalibration.h.

References setGainsPeds().

50 {}
bool CTPPSPixelGainCalibration::isDead ( const uint32_t  ipix) const
inline

Definition at line 71 of file CTPPSPixelGainCalibration.h.

References v_pedestals.

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

71 {return (v_pedestals[ipix]==-9999.);}
bool CTPPSPixelGainCalibration::isNoisy ( const uint32_t  ipix) const
inline

Definition at line 72 of file CTPPSPixelGainCalibration.h.

References v_gains.

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

72 {return (v_gains[ipix]==-9999.);}
void CTPPSPixelGainCalibration::putData ( uint32_t  ipix,
float  ped,
float  gain 
)

Definition at line 90 of file CTPPSPixelGainCalibration.cc.

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

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

90  {
91  if (v_pedestals.size()>ipix) //if the vector is too big, this pixel has already been set
92  {
93  if (ped>=0 && gain>=0)
94  throw cms::Exception("CTPPSPixelGainCalibration fill error")
95  << "[CTPPSPixelGainCalibration::putData] attempting to fill the vectors that are already filled detid = " << indexes.detid << " ipix " << ipix;
96  else // in case it is for setting the noisy or dead flag of already filled pixel you are allowed to reset it
97  {
98  edm::LogInfo("CTPPSPixelGainCalibration")<<"resetting pixel calibration for noisy or dead flag";
99  resetPixData(ipix,ped,gain);
100  }
101  }
102  else if (v_pedestals.size()<ipix)
103  throw cms::Exception("CTPPSPixelGainCalibration fill error")
104  << "[CTPPSPixelGainCalibration::putData] the order got scrambled detid = "<< indexes.detid << " ipix " << ipix;
105  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
106  v_pedestals.push_back(ped);
107  v_gains.push_back(gain);
108  }
109 }
void resetPixData(uint32_t ipix, float ped, float gain)
void CTPPSPixelGainCalibration::resetPixData ( uint32_t  ipix,
float  ped,
float  gain 
)
private

Definition at line 119 of file CTPPSPixelGainCalibration.cc.

References muonCSCDigis_cfi::gain, v_gains, and v_pedestals.

Referenced by getNRows(), and putData().

119  {
120  if (v_pedestals.size()<=ipix){
121  edm::LogError("CTPPSPixelGainCalibration")<<"this element ipix = " << ipix << " has not been set yet";
122  return;
123  }
124  v_pedestals[ipix]=ped; //modify value to already exisiting element
125  v_gains[ipix]=gain;
126 }
template<class Archive >
void CTPPSPixelGainCalibration::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void CTPPSPixelGainCalibration::setDeadPixel ( int  ipix)
inline

Definition at line 61 of file CTPPSPixelGainCalibration.h.

References putData().

61 { putData(ipix, -9999., 0. ); } // dead flag is pedestal = -9999.
void putData(uint32_t ipix, float ped, float gain)
void CTPPSPixelGainCalibration::setGainsPeds ( const uint32_t &  detId,
const std::vector< float > &  peds,
const std::vector< float > &  gains 
)

Definition at line 72 of file CTPPSPixelGainCalibration.cc.

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(), and initialize().

72  {
73  int sensorSize=peds.size();
74  int gainsSize=gains.size();
75  if(gainsSize!=sensorSize)
76  throw cms::Exception("CTPPSPixelGainCalibration payload configuration error")
77  << "[CTPPSPixelGainCalibration::CTPPSPixelGainCalibration] peds and gains vector sizes don't match for detid "
78  << detid << " size peds = " << sensorSize << " size gains = " << gainsSize;
79  DetRegistry myreg;
80  myreg.detid=detid;
81  myreg.ibegin=0;
82  myreg.iend=sensorSize;
83  myreg.ncols=sensorSize/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)
84  myreg.nrows=160; // for now this is hardwired.
85  indexes = myreg;
86  for(int i = 0 ; i<sensorSize ; ++i)
87  putData(i,peds[i],gains[i]);
88 }
void putData(uint32_t ipix, float ped, float gain)
void CTPPSPixelGainCalibration::setIndexes ( const uint32_t &  detId)
private
void CTPPSPixelGainCalibration::setNoisyPixel ( int  ipix)
inline

Definition at line 62 of file CTPPSPixelGainCalibration.h.

References cuy::col, muonCSCDigis_cfi::gain, getGain(), getPed(), and putData().

62 { putData(ipix, 0., -9999. ); } // noisy flat is gain= -9999.
void putData(uint32_t ipix, float ped, float gain)

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 90 of file CTPPSPixelGainCalibration.h.

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

Definition at line 90 of file CTPPSPixelGainCalibration.h.

friend class CTPPSPixelGainCalibrations
friend

Definition at line 28 of file CTPPSPixelGainCalibration.h.

Member Data Documentation

DetRegistry CTPPSPixelGainCalibration::indexes
private
float CTPPSPixelGainCalibration::maxGain_
private

Definition at line 88 of file CTPPSPixelGainCalibration.h.

Referenced by getGainHigh().

float CTPPSPixelGainCalibration::maxPed_
private

Definition at line 88 of file CTPPSPixelGainCalibration.h.

Referenced by getPedHigh().

float CTPPSPixelGainCalibration::minGain_
private

Definition at line 88 of file CTPPSPixelGainCalibration.h.

Referenced by getGainLow().

float CTPPSPixelGainCalibration::minPed_
private

Definition at line 88 of file CTPPSPixelGainCalibration.h.

Referenced by getPedLow().

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

Definition at line 85 of file CTPPSPixelGainCalibration.h.

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

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

Definition at line 84 of file CTPPSPixelGainCalibration.h.

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