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<boost/cstdint.hpp>
28 
30 
31  public:
32 
34  unsigned int gain :8;
35  unsigned int ped :8;
36  };
37 
38  struct DetRegistry{
39  uint32_t detid;
40  uint32_t ibegin;
41  uint32_t iend;
42  int ncols;
43 
45 };
46 
48  public:
49  bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
50  };
51 
52  typedef std::vector<char>::const_iterator ContainerIterator;
53  typedef std::pair<ContainerIterator, ContainerIterator> Range;
54  typedef std::vector<DetRegistry> Registry;
55  typedef Registry::const_iterator RegistryIterator;
56 
57  // Constructors
59  SiPixelGainCalibrationForHLT(float minPed, float maxPed, float minGain, float maxGain);
61 
62  void initialize();
63 
64  bool put(const uint32_t& detID,Range input, const int& nCols);
65  const Range getRange(const uint32_t& detID) const;
66  void getDetIds(std::vector<uint32_t>& DetIds_) const;
67  const int getNCols(const uint32_t& detID) const;
68  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
69 
71  float getGainLow() const { return minGain_; }
72  float getGainHigh() const { return maxGain_; }
73  float getPedLow() const { return minPed_; }
74  float getPedHigh() const { return maxPed_; }
75 
76  std::vector<char> const & data() const { return v_pedestals;}
77  std::vector<DetRegistry> const & getIndexes() const { return indexes; }
78 
79  // Set and get public methods
80  void setData(float ped, float gain, std::vector<char>& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false);
81  void setDeadColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, true, false); }
82  void setNoisyColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, false, true); }
83 
84 
85  std::pair<float,float> getPedAndGain(const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
86 
87  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
88  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
89 
90 private:
91 
92  float encodeGain(const float& gain);
93  float encodePed (const float& ped);
94  float decodeGain(unsigned int gain) const {return gain*gainPrecision + minGain_;}
95  float decodePed (unsigned int ped) const { return ped*pedPrecision + minPed_;}
96 
97  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
98  std::vector<DetRegistry> indexes;
100 
102 
103  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
105  unsigned int deadFlag_;
106  unsigned int noisyFlag_;
107 
109 };
110 
111 #endif
std::pair< float, float > getPedAndGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
std::vector< DetRegistry > const & getIndexes() const
void setNoisyColumn(const int &nRows, std::vector< char > &vped)
void setData(float ped, float gain, std::vector< char > &vped, bool thisColumnIsDead=false, bool thisColumnIsNoisy=false)
void getDetIds(std::vector< uint32_t > &DetIds_) const
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
std::vector< char > const & data() const
std::pair< ContainerIterator, ContainerIterator > Range
static std::string const input
Definition: EdmProvDump.cc:44
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
unsigned int getNumberOfRowsToAverageOver() const
float decodePed(unsigned int ped) const
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
float decodeGain(unsigned int gain) const
std::vector< char >::const_iterator ContainerIterator
bool put(const uint32_t &detID, Range input, const int &nCols)
Registry::const_iterator RegistryIterator
const Range getRange(const uint32_t &detID) const
void setDeadColumn(const int &nRows, std::vector< char > &vped)
#define COND_SERIALIZABLE
Definition: Serializable.h:38
col
Definition: cuy.py:1009
const int getNCols(const uint32_t &detID) const