CMS 3D CMS Logo

SiPixelGainCalibrationForHLT.h
Go to the documentation of this file.
1 #ifndef CondFormats_SiPixelObjects_SiPixelGainCalibrationForHLT_h
2 #define CondFormats_SiPixelObjects_SiPixelGainCalibrationForHLT_h
3 // -*- C++ -*-
4 //
5 // Package: SiPixelObjects
6 // Class: SiPixelGainCalibrationForHLT
7 //
15 //
16 // Original Author: Vincenzo Chiochia
17 // Created: Tue 8 12:31:25 CEST 2007
18 // Modified: Evan Friis
19 // $Id: SiPixelGainCalibrationForHLT.h,v 1.5 2009/02/10 17:25:58 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  SiPixelGainCalibrationForHLT(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  float getGainLow() const { return minGain_; }
70  float getGainHigh() const { return maxGain_; }
71  float getPedLow() const { return minPed_; }
72  float getPedHigh() const { return maxPed_; }
73 
74  std::vector<char> const& data() const { return v_pedestals; }
75  std::vector<DetRegistry> const& getIndexes() const { return indexes; }
76 
77  // Set and get public methods
78  void setData(
79  float ped, float gain, std::vector<char>& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false);
80  void setDeadColumn(const int& nRows, std::vector<char>& vped) {
81  setData(0, 0 /*dummy values, not used*/, vped, true, false);
82  }
83  void setNoisyColumn(const int& nRows, std::vector<char>& vped) {
84  setData(0, 0 /*dummy values, not used*/, vped, false, true);
85  }
86 
87  std::pair<float, float> getPedAndGain(const int& col,
88  const int& row,
89  const Range& range,
90  const int& nCols,
91  bool& isDeadColumn,
92  bool& isNoisyColumn) const;
93 
94  float getPed(const int& col,
95  const int& row,
96  const Range& range,
97  const int& nCols,
98  bool& isDeadColumn,
99  bool& isNoisyColumn) const;
100  float getGain(const int& col,
101  const int& row,
102  const Range& range,
103  const int& nCols,
104  bool& isDeadColumn,
105  bool& isNoisyColumn) const;
106 
107 private:
108  float encodeGain(const float& gain);
109  float encodePed(const float& ped);
110  float decodeGain(unsigned int gain) const { return float(gain) * gainPrecision + minGain_; }
111  float decodePed(unsigned int ped) const { return float(ped) * pedPrecision + minPed_; }
112 
113  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
114  std::vector<DetRegistry> indexes;
116 
118 
119  //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
121 
123  unsigned int deadFlag_;
124  unsigned int noisyFlag_;
125 
127 };
128 
129 #endif
const int getNCols(const uint32_t &detID) const
bool operator()(const DetRegistry &p, const uint32_t &i) const
void setNoisyColumn(const int &nRows, std::vector< char > &vped)
void getDetIds(std::vector< uint32_t > &DetIds_) const
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
void setData(float ped, float gain, std::vector< char > &vped, bool thisColumnIsDead=false, bool thisColumnIsNoisy=false)
unsigned int getNumberOfRowsToAverageOver() const
std::pair< float, float > getPedAndGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
std::pair< ContainerIterator, ContainerIterator > Range
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
static std::string const input
Definition: EdmProvDump.cc:47
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
std::vector< DetRegistry > const & getIndexes() const
std::vector< char > const & data() const
std::vector< char >::const_iterator ContainerIterator
bool put(const uint32_t &detID, Range input, const int &nCols)
Registry::const_iterator RegistryIterator
void setDeadColumn(const int &nRows, std::vector< char > &vped)
#define COND_SERIALIZABLE
Definition: Serializable.h:39
const Range getRange(const uint32_t &detID) const
float decodeGain(unsigned int gain) const
float decodePed(unsigned int ped) const
col
Definition: cuy.py:1009