CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelGainCalibrationOffline.h
Go to the documentation of this file.
1 #ifndef CondFormats_SiPixelObjects_SiPixelGainCalibrationOffline_h
2 #define CondFormats_SiPixelObjects_SiPixelGainCalibrationOffline_h
3 // -*- C++ -*-
4 //
5 // Package: SiPixelObjects
6 // Class: SiPixelGainCalibrationOffline
7 //
15 //
16 // Original Author: Vincenzo Chiochia
17 // Modified: Evan Friis
18 // Created: Tue 8 12:31:25 CEST 2007
19 // $Id: SiPixelGainCalibrationOffline.h,v 1.6 2009/02/17 19:04:13 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 datum :8;
33  };
34 
35  struct DetRegistry{
36  uint32_t detid;
37  uint32_t ibegin;
38  uint32_t iend;
39  int ncols;
40  };
41 
43  public:
44  bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
45  };
46 
47  typedef std::vector<char>::const_iterator ContainerIterator;
48  typedef std::pair<ContainerIterator, ContainerIterator> Range;
49  typedef std::vector<DetRegistry> Registry;
50  typedef Registry::const_iterator RegistryIterator;
51 
52  // Constructors
54  SiPixelGainCalibrationOffline(float minPed, float maxPed, float minGain, float maxGain);
56 
57  bool put(const uint32_t& detID,Range input, const int& nCols);
58  const Range getRange(const uint32_t& detID) const;
59  void getDetIds(std::vector<uint32_t>& DetIds_) const;
60  const int getNCols(const uint32_t& detID) const;
61  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
62 
63  // Set and get public methods
64  void setDataGain ( float gain, const int& nRows, std::vector<char>& vped , bool thisColumnIsDead = false , bool thisColumnIsNoisy = false);
65  void setDataPedestal ( float pedestal, std::vector<char>& vped , bool thisPixelIsDead = false , bool thisPixelIsNoisy = false);
66 
68  double getGainLow() const { return minGain_; }
69  double getGainHigh() const { return maxGain_; }
70  double getPedLow() const { return minPed_; }
71  double getPedHigh() const { return maxPed_; }
72 
73  // Set dead pixels
74  void setDeadPixel(std::vector<char>& vped) { setDataPedestal(0 /*dummy value, not used*/, vped, true ); }
75  void setDeadColumn(const int& nRows, std::vector<char>& vped) { setDataGain(0 /*dummy value, not used*/, nRows, vped, true ); }
76 
77  // Set noisy pixels
78  void setNoisyPixel(std::vector<char>& vped) { setDataPedestal(0 /*dummy value, not used*/, vped, false, true ); }
79  void setNoisyColumn(const int& nRows, std::vector<char>& vped) { setDataGain(0 /*dummy value, not used*/, nRows, vped, false, true ); }
80 
81  // these methods SHOULD NEVER BE ACESSED BY THE USER - use the services in CondTools/SiPixel!!!!
82  float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
83  float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn) const;
84 
85 
86  private:
87 
88  float encodeGain(const float& gain);
89  float encodePed (const float& ped);
90  float decodeGain(unsigned int gain) const;
91  float decodePed (unsigned int ped) const;
92 
93  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
94  std::vector<DetRegistry> indexes;
96 
97  unsigned int numberOfRowsToAverageOver_; //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
98  unsigned int nBinsToUseForEncoding_;
99  unsigned int deadFlag_;
100  unsigned int noisyFlag_;
101 
102 };
103 
104 #endif
int i
Definition: DBlmapReader.cc:9
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
bool operator()(const DetRegistry &p, const uint32_t &i) const
void setDataPedestal(float pedestal, std::vector< char > &vped, bool thisPixelIsDead=false, bool thisPixelIsNoisy=false)
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
std::pair< ContainerIterator, ContainerIterator > Range
const int getNCols(const uint32_t &detID) const
void setDataGain(float gain, const int &nRows, std::vector< char > &vped, bool thisColumnIsDead=false, bool thisColumnIsNoisy=false)
std::vector< char >::const_iterator ContainerIterator
void setNoisyColumn(const int &nRows, std::vector< char > &vped)
void setDeadPixel(std::vector< char > &vped)
void setNoisyPixel(std::vector< char > &vped)
const Range getRange(const uint32_t &detID) const
float decodeGain(unsigned int gain) const
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
void getDetIds(std::vector< uint32_t > &DetIds_) const
bool put(const uint32_t &detID, Range input, const int &nCols)
float decodePed(unsigned int ped) const
unsigned int getNumberOfRowsToAverageOver() const
void setDeadColumn(const int &nRows, std::vector< char > &vped)