CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  // Set and get public methods
77  void setData(float ped, float gain, std::vector<char>& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false);
78  void setDeadColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, true, false); }
79  void setNoisyColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, false, true); }
80 
81 
82  std::pair<float,float> getPedAndGain(const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
83 
84  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
85  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
86 
87  private:
88 
89  float encodeGain(const float& gain);
90  float encodePed (const float& ped);
91  float decodeGain(unsigned int gain) const {return gain*gainPrecision + minGain_;}
92  float decodePed (unsigned int ped) const { return ped*pedPrecision + minPed_;}
93 
94  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
95  std::vector<DetRegistry> indexes;
97 
99 
100  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
102  unsigned int deadFlag_;
103  unsigned int noisyFlag_;
104 
106 };
107 
108 #endif
std::pair< float, float > getPedAndGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
int i
Definition: DBlmapReader.cc:9
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
bool operator()(const DetRegistry &p, const uint32_t &i) 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:30
const int getNCols(const uint32_t &detID) const
int col
Definition: cuy.py:1008