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.8 2009/02/10 17:25:42 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  void initialize() const{}
60 
61  bool put(const uint32_t& detID,Range input, const int& nCols);
62  const Range getRange(const uint32_t& detID) const;
63  void getDetIds(std::vector<uint32_t>& DetIds_) const;
64  const int getNCols(const uint32_t& detID) const;
65  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
66 
68  double getGainLow() const { return minGain_; }
69  double getGainHigh() const { return maxGain_; }
70  double getPedLow() const { return minPed_; }
71  double getPedHigh() const { return maxPed_; }
72 
73  // Set and get public methods
74  void setData(float ped, float gain, std::vector<char>& vped, bool thisPixelIsDead = false, bool thisPixelIsNoisy = false);
75 
76  void setDeadPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, true , false ); }
77  void setNoisyPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, false , true ); }
78 
79  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
80  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
81 
82  private:
83 
84  float encodeGain(const float& gain);
85  float encodePed (const float& ped);
86  float decodeGain(unsigned int gain) const;
87  float decodePed (unsigned int ped) const;
88 
89  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
90  std::vector<DetRegistry> indexes;
92 
93  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 1 (no averaging) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
94  unsigned int nBinsToUseForEncoding_;
95  unsigned int deadFlag_;
96  unsigned int noisyFlag_;
97 
98 };
99 
100 #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
static std::string const input
Definition: EdmProvDump.cc:44
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