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.6 2009/02/17 19:04:02 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  bool put(const uint32_t& detID,Range input, const int& nCols);
59  const Range getRange(const uint32_t& detID) const;
60  void getDetIds(std::vector<uint32_t>& DetIds_) const;
61  const int getNCols(const uint32_t& detID) const;
62  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
63 
65  double getGainLow() const { return minGain_; }
66  double getGainHigh() const { return maxGain_; }
67  double getPedLow() const { return minPed_; }
68  double getPedHigh() const { return maxPed_; }
69 
70  // Set and get public methods
71  void setData(float ped, float gain, std::vector<char>& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false);
72  void setDeadColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, true, false); }
73  void setNoisyColumn(const int& nRows, std::vector<char>& vped) { setData(0, 0 /*dummy values, not used*/, vped, false, true); }
74 
75  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
76  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const;
77 
78  private:
79 
80  float encodeGain(const float& gain);
81  float encodePed (const float& ped);
82  float decodeGain(unsigned int gain) const;
83  float decodePed (unsigned int ped) const;
84 
85  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
86  std::vector<DetRegistry> indexes;
88 
89  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
90  unsigned int nBinsToUseForEncoding_;
91  unsigned int deadFlag_;
92  unsigned int noisyFlag_;
93 };
94 
95 #endif
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
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