CMS 3D CMS Logo

CTPPSPixelGainCalibration.h
Go to the documentation of this file.
1 #ifndef CondFormats_CTPPSReadoutObjects_CTPPSPixelGainCalibration_h
2 #define CondFormats_CTPPSReadoutObjects_CTPPSPixelGainCalibration_h
3 // -*- C++ -*-
4 //
5 // Package: CTPPSReadoutObjects
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 
32  struct DetRegistry{ //to index the channels in each sensor
33  uint32_t detid ;
34  uint32_t ibegin;
35  uint32_t iend ;
36  uint32_t ncols ;
37  uint32_t nrows ;
39  };
40 
41 
42  // Constructors
44  CTPPSPixelGainCalibration(const uint32_t & detId, const uint32_t & sensorSize, const uint32_t & nCols);
45  CTPPSPixelGainCalibration(float minPed, float maxPed, float minGain, float maxGain);
46  CTPPSPixelGainCalibration(const uint32_t& detid, const std::vector<float>& peds, const std::vector<float>& gains,
47  float minPed=0., float maxPed=255., float minGain=0., float maxGain=255.);
49 
50  void initialize(){}
51 
52  void setGainsPeds(const uint32_t& detId, const std::vector<float>& peds, const std::vector<float>& gains);
53 
54  double getGainLow() const { return minGain_; }
55  double getGainHigh() const { return maxGain_; }
56  double getPedLow() const { return minPed_; }
57  double getPedHigh() const { return maxPed_; }
58 
59  // Set and get public methods
60 
61  void setDeadPixel(int ipix) { putData(ipix, -9999., 0. ); } // dead flag is pedestal = -9999.
62  void setNoisyPixel(int ipix) { putData(ipix, 0., -9999. ); } // noisy flat is gain= -9999.
63 
64 
65  void putData(uint32_t ipix, float ped, float gain);
66 
67  /* float getPed (const int& col, const int& row , bool& isDead, bool& isNoisy) const; */
68  /* float getGain (const int& col, const int& row , bool& isDead, bool& isNoisy) const; */
69  /* float getPed (const uint32_t ipix, bool& isDead, bool& isNoisy)const; */
70  /* float getGain (const uint32_t ipix, bool& isDead, bool& isNoisy)const; */
71  float getPed (const int& col, const int& row ) const;
72  float getGain (const int& col, const int& row ) const;
73  float getPed (const uint32_t ipix )const{return v_pedestals[ipix];}
74  float getGain (const uint32_t ipix )const{return v_gains[ipix];}
75  bool isDead (const uint32_t ipix)const{return (v_pedestals[ipix]==-9999.);}
76  bool isNoisy (const uint32_t ipix)const{return (v_gains[ipix]==-9999.);}
77  //get information related to indexes
78  uint32_t getDetId () const {return indexes.detid;}
79  uint32_t getNCols () const {return indexes.ncols;}
80  uint32_t getIBegin() const {return indexes.ibegin;}
81  uint32_t getIEnd () const {return indexes.iend;}
82  uint32_t getNRows () const {return indexes.nrows;}
83 
84  private:
85  void setIndexes(const uint32_t& detId);
86  void resetPixData(uint32_t ipix, float ped, float gain);
87 
88  std::vector<float> v_pedestals;
89  std::vector<float> v_gains;
91  // a single detRegistry w/ detID and collection of indices
92  float minPed_, maxPed_, minGain_, maxGain_; //not really used yet
93 
95 };
96 
97 #endif
float getPed(const uint32_t ipix) const
float getGain(const uint32_t ipix) const
bool isDead(const uint32_t ipix) const
void resetPixData(uint32_t ipix, float ped, float gain)
void setGainsPeds(const uint32_t &detId, const std::vector< float > &peds, const std::vector< float > &gains)
#define COND_SERIALIZABLE
Definition: Serializable.h:38
float getPed(const int &col, const int &row) const
col
Definition: cuy.py:1008
bool isNoisy(const uint32_t ipix) const
void setIndexes(const uint32_t &detId)
void putData(uint32_t ipix, float ped, float gain)
float getGain(const int &col, const int &row) const