File indexing completed on 2024-04-06 12:02:27
0001 #ifndef CondFormats_PPSObjects_CTPPSPixelGainCalibration_h
0002 #define CondFormats_PPSObjects_CTPPSPixelGainCalibration_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include "CondFormats/Serialization/interface/Serializable.h"
0024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0025 #include <vector>
0026
0027 class CTPPSPixelGainCalibration {
0028 friend class CTPPSPixelGainCalibrations;
0029
0030 public:
0031 struct DetRegistry {
0032 uint32_t detid;
0033 uint32_t ibegin;
0034 uint32_t iend;
0035 uint32_t ncols;
0036 uint32_t nrows;
0037 COND_SERIALIZABLE;
0038 };
0039
0040
0041 CTPPSPixelGainCalibration();
0042 CTPPSPixelGainCalibration(const uint32_t& detId, const uint32_t& sensorSize, const uint32_t& nCols);
0043 CTPPSPixelGainCalibration(float minPed, float maxPed, float minGain, float maxGain);
0044 CTPPSPixelGainCalibration(const uint32_t& detid,
0045 const std::vector<float>& peds,
0046 const std::vector<float>& gains,
0047 float minPed = 0.,
0048 float maxPed = 255.,
0049 float minGain = 0.,
0050 float maxGain = 255.);
0051 ~CTPPSPixelGainCalibration() {}
0052
0053 void initialize() {}
0054
0055 void setGainsPeds(const uint32_t& detId, const std::vector<float>& peds, const std::vector<float>& gains);
0056
0057 double getGainLow() const { return minGain_; }
0058 double getGainHigh() const { return maxGain_; }
0059 double getPedLow() const { return minPed_; }
0060 double getPedHigh() const { return maxPed_; }
0061
0062
0063
0064 void setDeadPixel(int ipix) { putData(ipix, -9999., 0.); }
0065 void setNoisyPixel(int ipix) { putData(ipix, 0., -9999.); }
0066
0067 void putData(uint32_t ipix, float ped, float gain);
0068
0069 float getPed(const int& col, const int& row) const;
0070 float getGain(const int& col, const int& row) const;
0071 float getPed(const uint32_t ipix) const { return v_pedestals[ipix]; }
0072 float getGain(const uint32_t ipix) const { return v_gains[ipix]; }
0073 bool isDead(const uint32_t ipix) const { return (v_pedestals[ipix] == -9999.); }
0074 bool isNoisy(const uint32_t ipix) const { return (v_gains[ipix] == -9999.); }
0075
0076 uint32_t getDetId() const { return indexes.detid; }
0077 uint32_t getNCols() const { return indexes.ncols; }
0078 uint32_t getIBegin() const { return indexes.ibegin; }
0079 uint32_t getIEnd() const { return indexes.iend; }
0080 uint32_t getNRows() const { return indexes.nrows; }
0081
0082 private:
0083 void setIndexes(const uint32_t& detId);
0084 void resetPixData(uint32_t ipix, float ped, float gain);
0085
0086 std::vector<float> v_pedestals;
0087 std::vector<float> v_gains;
0088 DetRegistry indexes;
0089
0090 float minPed_, maxPed_, minGain_, maxGain_;
0091
0092 COND_SERIALIZABLE;
0093 };
0094
0095 #endif