CMS 3D CMS Logo

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.5 2009/02/10 17:26:50 rougny Exp $
20 //
21 //
23 
24 #include <vector>
25 #include <map>
26 #include <iostream>
27 #include <cstdint>
28 
30 public:
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 
42  };
43 
45  public:
46  bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
47  };
48 
49  typedef std::vector<char>::const_iterator ContainerIterator;
50  typedef std::pair<ContainerIterator, ContainerIterator> Range;
51  typedef std::vector<DetRegistry> Registry;
52  typedef Registry::const_iterator RegistryIterator;
53 
54  // Constructors
56  SiPixelGainCalibrationOffline(float minPed, float maxPed, float minGain, float maxGain);
58 
59  void initialize() {}
60 
61  bool put(const uint32_t& detID, Range input, const int& nCols);
62  const Range getRange(const uint32_t& detID) const;
63  void getDetIds(std::vector<uint32_t>& DetIds_) const;
64  const int getNCols(const uint32_t& detID) const;
65  const std::pair<const Range, const int> getRangeAndNCols(const uint32_t& detID) const;
66 
67  // Set and get public methods
68  void setDataGain(float gain,
69  const int& nRows,
70  std::vector<char>& vped,
71  bool thisColumnIsDead = false,
72  bool thisColumnIsNoisy = false);
73  void setDataPedestal(float pedestal,
74  std::vector<char>& vped,
75  bool thisPixelIsDead = false,
76  bool thisPixelIsNoisy = false);
77 
79  double getGainLow() const { return minGain_; }
80  double getGainHigh() const { return maxGain_; }
81  double getPedLow() const { return minPed_; }
82  double getPedHigh() const { return maxPed_; }
83 
84  // Set dead pixels
85  void setDeadPixel(std::vector<char>& vped) { setDataPedestal(0 /*dummy value, not used*/, vped, true); }
86  void setDeadColumn(const int& nRows, std::vector<char>& vped) {
87  setDataGain(0 /*dummy value, not used*/, nRows, vped, true);
88  }
89 
90  // Set noisy pixels
91  void setNoisyPixel(std::vector<char>& vped) { setDataPedestal(0 /*dummy value, not used*/, vped, false, true); }
92  void setNoisyColumn(const int& nRows, std::vector<char>& vped) {
93  setDataGain(0 /*dummy value, not used*/, nRows, vped, false, true);
94  }
95 
96  // these methods SHOULD NEVER BE ACESSED BY THE USER - use the services in CondTools/SiPixel!!!!
97  float getPed(const int& col, const int& row, const Range& range, const int& nCols, bool& isDead, bool& isNoisy) const;
98  float getGain(const int& col,
99  const int& row,
100  const Range& range,
101  const int& nCols,
102  bool& isDeadColumn,
103  bool& isNoisyColumn) const;
104 
105 private:
106  float encodeGain(const float& gain);
107  float encodePed(const float& ped);
108  float decodeGain(unsigned int gain) const;
109  float decodePed(unsigned int ped) const;
110 
111  std::vector<char> v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with classes
112  std::vector<DetRegistry> indexes;
114 
115  //THIS WILL BE HARDCODED TO 80 (all rows in a ROC) DON'T CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
117 
119  unsigned int deadFlag_;
120  unsigned int noisyFlag_;
121 
123 };
124 
125 #endif
SiPixelGainCalibrationOffline::DetRegistry
Definition: SiPixelGainCalibrationOffline.h:35
SiPixelGainCalibrationOffline::minGain_
float minGain_
Definition: SiPixelGainCalibrationOffline.h:113
SiPixelGainCalibrationOffline::setDeadColumn
void setDeadColumn(const int &nRows, std::vector< char > &vped)
Definition: SiPixelGainCalibrationOffline.h:86
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiPixelGainCalibrationOffline::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: SiPixelGainCalibrationOffline.h:52
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelGainCalibrationOffline::~SiPixelGainCalibrationOffline
~SiPixelGainCalibrationOffline()
Definition: SiPixelGainCalibrationOffline.h:57
input
static const std::string input
Definition: EdmProvDump.cc:48
SiPixelGainCalibrationOffline::decodePed
float decodePed(unsigned int ped) const
Definition: SiPixelGainCalibrationOffline.cc:237
SiPixelGainCalibrationOffline::v_pedestals
std::vector< char > v_pedestals
Definition: SiPixelGainCalibrationOffline.h:111
SiPixelGainCalibrationOffline::getGainHigh
double getGainHigh() const
Definition: SiPixelGainCalibrationOffline.h:80
SiPixelGainCalibrationOffline::getGainLow
double getGainLow() const
Definition: SiPixelGainCalibrationOffline.h:79
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cuy.col
col
Definition: cuy.py:1010
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
SiPixelGainCalibrationOffline::numberOfRowsToAverageOver_
unsigned int numberOfRowsToAverageOver_
Definition: SiPixelGainCalibrationOffline.h:116
SiPixelGainCalibrationOffline::setDataPedestal
void setDataPedestal(float pedestal, std::vector< char > &vped, bool thisPixelIsDead=false, bool thisPixelIsNoisy=false)
Definition: SiPixelGainCalibrationOffline.cc:140
SiPixelGainCalibrationOffline::getPedHigh
double getPedHigh() const
Definition: SiPixelGainCalibrationOffline.h:82
SiPixelGainCalibrationOffline::getNumberOfRowsToAverageOver
unsigned int getNumberOfRowsToAverageOver() const
Definition: SiPixelGainCalibrationOffline.h:78
SiPixelGainCalibrationOffline::StrictWeakOrdering
Definition: SiPixelGainCalibrationOffline.h:44
SiPixelGainCalibrationOffline::getRangeAndNCols
const std::pair< const Range, const int > getRangeAndNCols(const uint32_t &detID) const
Definition: SiPixelGainCalibrationOffline.cc:88
SiPixelGainCalibrationOffline::maxPed_
float maxPed_
Definition: SiPixelGainCalibrationOffline.h:113
SiPixelGainCalibrationOffline::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiPixelGainCalibrationOffline.h:50
SiPixelGainCalibrationOffline::setDataGain
void setDataGain(float gain, const int &nRows, std::vector< char > &vped, bool thisColumnIsDead=false, bool thisColumnIsNoisy=false)
Definition: SiPixelGainCalibrationOffline.cc:108
SiPixelGainCalibrationOffline::DetRegistry::iend
uint32_t iend
Definition: SiPixelGainCalibrationOffline.h:38
SiPixelGainCalibrationOffline::ContainerIterator
std::vector< char >::const_iterator ContainerIterator
Definition: SiPixelGainCalibrationOffline.h:49
SiPixelGainCalibrationOffline::DecodingStructure::datum
unsigned int datum
Definition: SiPixelGainCalibrationOffline.h:32
SiPixelGainCalibrationOffline
Definition: SiPixelGainCalibrationOffline.h:29
SiPixelGainCalibrationOffline::deadFlag_
unsigned int deadFlag_
Definition: SiPixelGainCalibrationOffline.h:119
SiPixelGainCalibrationOffline::SiPixelGainCalibrationOffline
SiPixelGainCalibrationOffline()
Definition: SiPixelGainCalibrationOffline.cc:9
SiPixelGainCalibrationOffline::decodeGain
float decodeGain(unsigned int gain) const
Definition: SiPixelGainCalibrationOffline.cc:243
SiPixelGainCalibrationOffline::encodePed
float encodePed(const float &ped)
Definition: SiPixelGainCalibrationOffline.cc:226
SiPixelGainCalibrationOffline::setNoisyColumn
void setNoisyColumn(const int &nRows, std::vector< char > &vped)
Definition: SiPixelGainCalibrationOffline.h:92
SiPixelGainCalibrationOffline::encodeGain
float encodeGain(const float &gain)
Definition: SiPixelGainCalibrationOffline.cc:215
SiPixelGainCalibrationOffline::setDeadPixel
void setDeadPixel(std::vector< char > &vped)
Definition: SiPixelGainCalibrationOffline.h:85
SiPixelGainCalibrationOffline::initialize
void initialize()
Definition: SiPixelGainCalibrationOffline.h:59
Serializable.h
SiPixelGainCalibrationOffline::StrictWeakOrdering::operator()
bool operator()(const DetRegistry &p, const uint32_t &i) const
Definition: SiPixelGainCalibrationOffline.h:46
SiPixelGainCalibrationOffline::getNCols
const int getNCols(const uint32_t &detID) const
Definition: SiPixelGainCalibrationOffline.cc:67
EcalCondDBWriter_cfi.pedestal
pedestal
Definition: EcalCondDBWriter_cfi.py:49
SiPixelGainCalibrationOffline::setNoisyPixel
void setNoisyPixel(std::vector< char > &vped)
Definition: SiPixelGainCalibrationOffline.h:91
SiPixelGainCalibrationOffline::getPedLow
double getPedLow() const
Definition: SiPixelGainCalibrationOffline.h:81
SiPixelGainCalibrationOffline::Registry
std::vector< DetRegistry > Registry
Definition: SiPixelGainCalibrationOffline.h:51
SiPixelGainCalibrationOffline::noisyFlag_
unsigned int noisyFlag_
Definition: SiPixelGainCalibrationOffline.h:120
SiPixelGainCalibrationOffline::DetRegistry::detid
uint32_t detid
Definition: SiPixelGainCalibrationOffline.h:36
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
SiPixelGainCalibrationOffline::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiPixelGainCalibrationOffline.cc:99
SiPixelGainCalibrationOffline::getRange
const Range getRange(const uint32_t &detID) const
Definition: SiPixelGainCalibrationOffline.cc:77
SiPixelGainCalibrationOffline::getPed
float getPed(const int &col, const int &row, const Range &range, const int &nCols, bool &isDead, bool &isNoisy) const
Definition: SiPixelGainCalibrationOffline.cc:158
SiPixelGainCalibrationOffline::DecodingStructure
Definition: SiPixelGainCalibrationOffline.h:31
SiPixelGainCalibrationOffline::indexes
std::vector< DetRegistry > indexes
Definition: SiPixelGainCalibrationOffline.h:112
SiPixelGainCalibrationOffline::maxGain_
float maxGain_
Definition: SiPixelGainCalibrationOffline.h:113
SiPixelGainCalibrationOffline::DetRegistry::ncols
int ncols
Definition: SiPixelGainCalibrationOffline.h:39
SiPixelGainCalibrationOffline::minPed_
float minPed_
Definition: SiPixelGainCalibrationOffline.h:113
SiPixelGainCalibrationOffline::nBinsToUseForEncoding_
unsigned int nBinsToUseForEncoding_
Definition: SiPixelGainCalibrationOffline.h:118
SiPixelGainCalibrationOffline::getGain
float getGain(const int &col, const int &row, const Range &range, const int &nCols, bool &isDeadColumn, bool &isNoisyColumn) const
Definition: SiPixelGainCalibrationOffline.cc:185
SiPixelGainCalibrationOffline::put
bool put(const uint32_t &detID, Range input, const int &nCols)
Definition: SiPixelGainCalibrationOffline.cc:47
SiPixelGainCalibrationOffline::DetRegistry::ibegin
uint32_t ibegin
Definition: SiPixelGainCalibrationOffline.h:37