CMS 3D CMS Logo

CTPPSPixelGainCalibration.h
Go to the documentation of this file.
1 #ifndef CondFormats_PPSObjects_CTPPSPixelGainCalibration_h
2 #define CondFormats_PPSObjects_CTPPSPixelGainCalibration_h
3 // -*- C++ -*-
4 //
5 // Package: PPSObjects
6 // Class: CTPPSPixelGainCalibration
7 //
15 // Loosely based on SiPixelObjects/SiPixelGainCalibration
16 // Original Author: Vincenzo Chiochia
17 // Created: Tue 8 12:31:25 CEST 2007
18 // Modified: Evan Friis
19 // $Id: CTPPSPixelGainCalibration.h,v 1.8 2009/02/10 17:25:42 rougny Exp $
20 // Adapted for CTPPS : Clemencia Mora Herrera November 2016
21 //
22 
25 #include <vector>
26 
29 
30 public:
31  struct DetRegistry { //to index the channels in each sensor
32  uint32_t detid;
33  uint32_t ibegin;
34  uint32_t iend;
35  uint32_t ncols;
36  uint32_t nrows;
38  };
39 
40  // Constructors
42  CTPPSPixelGainCalibration(const uint32_t& detId, const uint32_t& sensorSize, const uint32_t& nCols);
43  CTPPSPixelGainCalibration(float minPed, float maxPed, float minGain, float maxGain);
44  CTPPSPixelGainCalibration(const uint32_t& detid,
45  const std::vector<float>& peds,
46  const std::vector<float>& gains,
47  float minPed = 0.,
48  float maxPed = 255.,
49  float minGain = 0.,
50  float maxGain = 255.);
52 
53  void initialize() {}
54 
55  void setGainsPeds(const uint32_t& detId, const std::vector<float>& peds, const std::vector<float>& gains);
56 
57  double getGainLow() const { return minGain_; }
58  double getGainHigh() const { return maxGain_; }
59  double getPedLow() const { return minPed_; }
60  double getPedHigh() const { return maxPed_; }
61 
62  // Set and get public methods
63 
64  void setDeadPixel(int ipix) { putData(ipix, -9999., 0.); } // dead flag is pedestal = -9999.
65  void setNoisyPixel(int ipix) { putData(ipix, 0., -9999.); } // noisy flat is gain= -9999.
66 
67  void putData(uint32_t ipix, float ped, float gain);
68 
69  float getPed(const int& col, const int& row) const;
70  float getGain(const int& col, const int& row) const;
71  float getPed(const uint32_t ipix) const { return v_pedestals[ipix]; }
72  float getGain(const uint32_t ipix) const { return v_gains[ipix]; }
73  bool isDead(const uint32_t ipix) const { return (v_pedestals[ipix] == -9999.); }
74  bool isNoisy(const uint32_t ipix) const { return (v_gains[ipix] == -9999.); }
75  //get information related to indexes
76  uint32_t getDetId() const { return indexes.detid; }
77  uint32_t getNCols() const { return indexes.ncols; }
78  uint32_t getIBegin() const { return indexes.ibegin; }
79  uint32_t getIEnd() const { return indexes.iend; }
80  uint32_t getNRows() const { return indexes.nrows; }
81 
82 private:
83  void setIndexes(const uint32_t& detId);
84  void resetPixData(uint32_t ipix, float ped, float gain);
85 
86  std::vector<float> v_pedestals;
87  std::vector<float> v_gains;
89  // a single detRegistry w/ detID and collection of indices
90  float minPed_, maxPed_, minGain_, maxGain_; //not really used yet
91 
93 };
94 
95 #endif
float getPed(const int &col, const int &row) const
float getPed(const uint32_t ipix) const
void resetPixData(uint32_t ipix, float ped, float gain)
bool isNoisy(const uint32_t ipix) const
float getGain(const int &col, const int &row) const
float getGain(const uint32_t ipix) const
void setGainsPeds(const uint32_t &detId, const std::vector< float > &peds, const std::vector< float > &gains)
constexpr float gains[NGAINS]
Definition: EcalConstants.h:11
bool isDead(const uint32_t ipix) const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
col
Definition: cuy.py:1009
void setIndexes(const uint32_t &detId)
void putData(uint32_t ipix, float ped, float gain)