CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
float decodeGain(unsigned int gain) const
std::vector< char > v_pedestals
void getDetIds(std::vector< uint32_t > &DetIds_) const
std::vector< DetRegistry > indexes
std::vector< char >::const_iterator ContainerIterator
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
bool put(const uint32_t &detID, Range input, const int &nCols)
void setDeadPixel(std::vector< char > &vped)
unsigned int getNumberOfRowsToAverageOver() const
std::vector< DetRegistry > Registry
void setNoisyPixel(std::vector< char > &vped)
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
bool operator()(const DetRegistry &p, const uint32_t &i) const
static std::string const input
Definition: EdmProvDump.cc:47
const uint16_t range(const Frame &aFrame)
float encodePed(const float &ped)
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
const Range getRange(const uint32_t &detID) const
Registry::const_iterator RegistryIterator
#define COND_SERIALIZABLE
Definition: Serializable.h:39
std::pair< ContainerIterator, ContainerIterator > Range
const int getNCols(const uint32_t &detID) const
void setData(float ped, float gain, std::vector< char > &vped, bool thisPixelIsDead=false, bool thisPixelIsNoisy=false)
int col
Definition: cuy.py:1009
float encodeGain(const float &gain)
float decodePed(unsigned int ped) const