CMS 3D CMS Logo

SiPixelGainCalibrationOffline.h
Go to the documentation of this file.
1 #ifndef CondFormats_SiPixelObjects_SiPixelGainCalibrationOffline_h
2 #define CondFormats_SiPixelObjects_SiPixelGainCalibrationOffline_h
3 // -*- C++ -*-
4 //
5 // Package: SiPixelObjects
6 // Class: SiPixelGainCalibrationOffline
7 //
15 //
16 // Original Author: Vincenzo Chiochia
17 // Modified: Evan Friis
18 // Created: Tue 8 12:31:25 CEST 2007
19 // $Id: SiPixelGainCalibrationOffline.h,v 1.5 2009/02/10 17:26:50 rougny Exp $
20 //
21 //
23 
24 #include <vector>
25 #include <map>
26 #include <iostream>
27 #include <cstdint>
28 
30 public:
32  unsigned int datum : 8;
33  };
34 
35  struct DetRegistry {
36  uint32_t detid;
37  uint32_t ibegin;
38  uint32_t iend;
39  int ncols;
40 
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  SiPixelGainCalibrationOffline(float minPed, float maxPed, float minGain, float maxGain);
58 
59  void initialize() {}
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 
67  // Set and get public methods
68  void setDataGain(float gain,
69  const int& nRows,
70  std::vector<char>& vped,
71  bool thisColumnIsDead = false,
72  bool thisColumnIsNoisy = false);
73  void setDataPedestal(float pedestal,
74  std::vector<char>& vped,
75  bool thisPixelIsDead = false,
76  bool thisPixelIsNoisy = false);
77 
79  double getGainLow() const { return minGain_; }
80  double getGainHigh() const { return maxGain_; }
81  double getPedLow() const { return minPed_; }
82  double getPedHigh() const { return maxPed_; }
83 
84  // Set dead pixels
85  void setDeadPixel(std::vector<char>& vped) { setDataPedestal(0 /*dummy value, not used*/, vped, true); }
86  void setDeadColumn(const int& nRows, std::vector<char>& vped) {
87  setDataGain(0 /*dummy value, not used*/, nRows, vped, true);
88  }
89 
90  // Set noisy pixels
91  void setNoisyPixel(std::vector<char>& vped) { setDataPedestal(0 /*dummy value, not used*/, vped, false, true); }
92  void setNoisyColumn(const int& nRows, std::vector<char>& vped) {
93  setDataGain(0 /*dummy value, not used*/, nRows, vped, false, true);
94  }
95 
96  // these methods SHOULD NEVER BE ACESSED BY THE USER - use the services in CondTools/SiPixel!!!!
97  float getPed(const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
98  float getGain(const int& col,
99  const int& row,
100  const Range& range,
101  const int& nCols,
102  bool& isDeadColumn,
103  bool& isNoisyColumn) const;
104 
105 private:
106  float encodeGain(const float& gain);
107  float encodePed(const float& ped);
108  float decodeGain(unsigned int gain) const;
109  float decodePed(unsigned int ped) const;
110 
111  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
112  std::vector<DetRegistry> indexes;
114 
115  //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
117 
119  unsigned int deadFlag_;
120  unsigned int noisyFlag_;
121 
123 };
124 
125 #endif
float decodePed(unsigned int ped) const
void setDataPedestal(float pedestal, std::vector< char > &vped, bool thisPixelIsDead=false, bool thisPixelIsNoisy=false)
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
std::pair< ContainerIterator, ContainerIterator > Range
void setDataGain(float gain, const int &nRows, std::vector< char > &vped, bool thisColumnIsDead=false, bool thisColumnIsNoisy=false)
static std::string const input
Definition: EdmProvDump.cc:47
std::vector< char >::const_iterator ContainerIterator
void setNoisyColumn(const int &nRows, std::vector< char > &vped)
float decodeGain(unsigned int gain) const
void setDeadPixel(std::vector< char > &vped)
void setNoisyPixel(std::vector< char > &vped)
const int getNCols(const uint32_t &detID) const
void getDetIds(std::vector< uint32_t > &DetIds_) const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
float getPed(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
col
Definition: cuy.py:1009
bool operator()(const DetRegistry &p, const uint32_t &i) const
bool put(const uint32_t &detID, Range input, const int &nCols)
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
void setDeadColumn(const int &nRows, std::vector< char > &vped)