CMS 3D CMS Logo

SiPixelGainCalibration.h
Go to the documentation of this file.
1 #ifndef CondFormats_SiPixelObjects_SiPixelGainCalibration_h
2 #define CondFormats_SiPixelObjects_SiPixelGainCalibration_h
3 // -*- C++ -*-
4 //
5 // Package: SiPixelObjects
6 // Class: SiPixelGainCalibration
7 //
15 //
16 // Original Author: Vincenzo Chiochia
17 // Created: Tue 8 12:31:25 CEST 2007
18 // Modified: Evan Friis
19 // $Id: SiPixelGainCalibration.h,v 1.8 2009/02/10 17:25:42 rougny Exp $
20 //
21 //
23 
24 #include <vector>
25 #include <map>
26 #include <iostream>
27 #include <cstdint>
28 
30 public:
32  unsigned int gain : 8;
33  unsigned int ped : 8;
34  };
35 
36  struct DetRegistry {
37  uint32_t detid;
38  uint32_t ibegin;
39  uint32_t iend;
40  int ncols;
41 
43  };
44 
46  public:
47  bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
48  };
49 
50  typedef std::vector<char>::const_iterator ContainerIterator;
51  typedef std::pair<ContainerIterator, ContainerIterator> Range;
52  typedef std::vector<DetRegistry> Registry;
53  typedef Registry::const_iterator RegistryIterator;
54 
55  // Constructors
57  SiPixelGainCalibration(float minPed, float maxPed, float minGain, float maxGain);
59 
60  void initialize() {}
61 
62  bool put(const uint32_t& detID, Range input, const int& nCols);
63  const Range getRange(const uint32_t& detID) const;
64  void getDetIds(std::vector<uint32_t>& DetIds_) const;
65  const int getNCols(const uint32_t& detID) const;
66  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
67 
69  double getGainLow() const { return minGain_; }
70  double getGainHigh() const { return maxGain_; }
71  double getPedLow() const { return minPed_; }
72  double getPedHigh() const { return maxPed_; }
73 
74  // Set and get public methods
75  void setData(
76  float ped, float gain, std::vector<char>& vped, bool thisPixelIsDead = false, bool thisPixelIsNoisy = false);
77 
78  void setDeadPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, true, false); }
79  void setNoisyPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, false, true); }
80 
81  float getPed(const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
82  float getGain(const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
83 
84 private:
85  float encodeGain(const float& gain);
86  float encodePed(const float& ped);
87  float decodeGain(unsigned int gain) const;
88  float decodePed(unsigned int ped) const;
89 
90  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
91  std::vector<DetRegistry> indexes;
93 
94  //THIS WILL BE HARDCODED TO 1 (no averaging) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
96 
97  unsigned int nBinsToUseForEncoding_;
98  unsigned int deadFlag_;
99  unsigned int noisyFlag_;
100 
102 };
103 
104 #endif
std::vector< char > v_pedestals
std::vector< DetRegistry > indexes
std::vector< char >::const_iterator ContainerIterator
bool put(const uint32_t &detID, Range input, const int &nCols)
void setDeadPixel(std::vector< char > &vped)
std::vector< DetRegistry > Registry
void setNoisyPixel(std::vector< char > &vped)
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
static std::string const input
Definition: EdmProvDump.cc:50
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
float encodePed(const float &ped)
float decodePed(unsigned int ped) const
unsigned int getNumberOfRowsToAverageOver() const
Registry::const_iterator RegistryIterator
const Range getRange(const uint32_t &detID) const
const int getNCols(const uint32_t &detID) const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
std::pair< ContainerIterator, ContainerIterator > Range
void getDetIds(std::vector< uint32_t > &DetIds_) const
col
Definition: cuy.py:1009
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
void setData(float ped, float gain, std::vector< char > &vped, bool thisPixelIsDead=false, bool thisPixelIsNoisy=false)
float decodeGain(unsigned int gain) const
bool operator()(const DetRegistry &p, const uint32_t &i) const
float encodeGain(const float &gain)