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 //
22 #include<vector>
23 #include<map>
24 #include<iostream>
25 #include<boost/cstdint.hpp>
26 
28 
29  public:
30 
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  };
42 
44  public:
45  bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
46  };
47 
48  typedef std::vector<char>::const_iterator ContainerIterator;
49  typedef std::pair<ContainerIterator, ContainerIterator> Range;
50  typedef std::vector<DetRegistry> Registry;
51  typedef Registry::const_iterator RegistryIterator;
52 
53  // Constructors
55  SiPixelGainCalibrationForHLT(float minPed, float maxPed, float minGain, float maxGain);
57 
58  void initialize() const;
59 
60  bool put(const uint32_t& detID,Range input, const int& nCols);
61  const Range getRange(const uint32_t& detID) const;
62  void getDetIds(std::vector<uint32_t>& DetIds_) const;
63  const int getNCols(const uint32_t& detID) const;
64  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
65 
67  float getGainLow() const { return minGain_; }
68  float getGainHigh() const { return maxGain_; }
69  float getPedLow() const { return minPed_; }
70  float getPedHigh() const { return maxPed_; }
71 
72  // Set and get public methods
73  void setData(float ped, float gain, std::vector<char>& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false);
74  void setDeadColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, true, false); }
75  void setNoisyColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, false, true); }
76 
77 
78  std::pair<float,float> getPedAndGain(const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
79 
80  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
81  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
82 
83  private:
84 
85  float encodeGain(const float& gain);
86  float encodePed (const float& ped);
87  float decodeGain(unsigned int gain) const {return gain*gainPrecision + minGain_;}
88  float decodePed (unsigned int ped) const { return ped*pedPrecision + minPed_;}
89 
90  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
91  std::vector<DetRegistry> indexes;
93 
94  mutable float pedPrecision, gainPrecision;
95 
96  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
97  unsigned int nBinsToUseForEncoding_;
98  unsigned int deadFlag_;
99  unsigned int noisyFlag_;
100 };
101 
102 #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)
const int getNCols(const uint32_t &detID) const
int col
Definition: cuy.py:1008