test
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 //
23 
24 #include<vector>
25 #include<map>
26 #include<iostream>
27 #include<boost/cstdint.hpp>
28 
30 
31  public:
32 
34  unsigned int gain :8;
35  unsigned int ped :8;
36  // unsigned int ped :10;
37  };
38 
39  struct DetRegistry{
40  uint32_t detid;
41  uint32_t ibegin;
42  uint32_t iend;
43  int ncols;
44 
46 };
47 
49  public:
50  bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
51  };
52 
53  typedef std::vector<char>::const_iterator ContainerIterator;
54  typedef std::pair<ContainerIterator, ContainerIterator> Range;
55  typedef std::vector<DetRegistry> Registry;
56  typedef Registry::const_iterator RegistryIterator;
57 
58  // Constructors
60  SiPixelGainCalibration(float minPed, float maxPed, float minGain, float maxGain);
62 
63  void initialize(){}
64 
65  bool put(const uint32_t& detID,Range input, const int& nCols);
66  const Range getRange(const uint32_t& detID) const;
67  void getDetIds(std::vector<uint32_t>& DetIds_) const;
68  const int getNCols(const uint32_t& detID) const;
69  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
70 
72  double getGainLow() const { return minGain_; }
73  double getGainHigh() const { return maxGain_; }
74  double getPedLow() const { return minPed_; }
75  double getPedHigh() const { return maxPed_; }
76 
77  // Set and get public methods
78  void setData(float ped, float gain, std::vector<char>& vped, bool thisPixelIsDead = false, bool thisPixelIsNoisy = false);
79 
80  void setDeadPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, true , false ); }
81  void setNoisyPixel(std::vector<char>& vped) { setData(0, 0, /*dummy values, not used*/ vped, false , true ); }
82 
83  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
84  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
85 
86  private:
87 
88  float encodeGain(const float& gain);
89  float encodePed (const float& ped);
90  float decodeGain(unsigned int gain) const;
91  float decodePed (unsigned int ped) const;
92 
93  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
94  std::vector<DetRegistry> indexes;
96 
97  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 1 (no averaging) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
98  unsigned int nBinsToUseForEncoding_;
99  unsigned int deadFlag_;
100  unsigned int noisyFlag_;
101 
102 
104 };
105 
106 #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
#define COND_SERIALIZABLE
Definition: Serializable.h:37
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