CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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.9 2009/02/17 19:03:38 rougny Exp $
20 //
21 //
22 #include<vector>
23 #include<map>
24 #include<iostream>
25 #include<boost/cstdint.hpp>
26 
28 
29  public:
30 
32  unsigned int gain :8;
33  unsigned int ped :8;
34  // unsigned int ped :10;
35  };
36 
37  struct DetRegistry{
38  uint32_t detid;
39  uint32_t ibegin;
40  uint32_t iend;
41  int ncols;
42  };
43 
45  public:
46  bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
47  };
48 
49  typedef std::vector<char>::const_iterator ContainerIterator;
50  typedef std::pair<ContainerIterator, ContainerIterator> Range;
51  typedef std::vector<DetRegistry> Registry;
52  typedef Registry::const_iterator RegistryIterator;
53 
54  // Constructors
56  SiPixelGainCalibration(float minPed, float maxPed, float minGain, float maxGain);
58 
59  bool put(const uint32_t& detID,Range input, const int& nCols);
60  const Range getRange(const uint32_t& detID) const;
61  void getDetIds(std::vector<uint32_t>& DetIds_) const;
62  const int getNCols(const uint32_t& detID) const;
63  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
64 
66  double getGainLow() const { return minGain_; }
67  double getGainHigh() const { return maxGain_; }
68  double getPedLow() const { return minPed_; }
69  double getPedHigh() const { return maxPed_; }
70 
71  // Set and get public methods
72  void setData(float ped, float gain, std::vector<char>& vped, bool thisPixelIsDead = false, bool thisPixelIsNoisy = false);
73 
74  void setDeadPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, true , false ); }
75  void setNoisyPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, false , true ); }
76 
77  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
78  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
79 
80  private:
81 
82  float encodeGain(const float& gain);
83  float encodePed (const float& ped);
84  float decodeGain(unsigned int gain) const;
85  float decodePed (unsigned int ped) const;
86 
87  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
88  std::vector<DetRegistry> indexes;
90 
91  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 1 (no averaging) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
92  unsigned int nBinsToUseForEncoding_;
93  unsigned int deadFlag_;
94  unsigned int noisyFlag_;
95 
96 };
97 
98 #endif
float decodeGain(unsigned int gain) const
std::vector< char > v_pedestals
void getDetIds(std::vector< uint32_t > &DetIds_) const
int i
Definition: DBlmapReader.cc:9
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
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
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:1008
float encodeGain(const float &gain)
float decodePed(unsigned int ped) const