CMS 3D CMS Logo

CTPPSPixelGainCalibrations.cc
Go to the documentation of this file.
4 
6  if (detid != PixGains.getDetId()) { // if no detid set in the pixgains
7  CTPPSPixelGainCalibration newPixGains = PixGains; //maybe the copy works?
8  newPixGains.setIndexes(detid); //private accessor, only friend class can use it
9  edm::LogInfo("CTPPSPixelGainCalibrations")
10  << "newPixGains detId = " << newPixGains.getDetId() << " ; iBegin = " << newPixGains.getIBegin()
11  << " ; iEnd = " << newPixGains.getIEnd() << " ; nCols = " << newPixGains.getNCols()
12  << " ; nRows =" << newPixGains.getNRows();
13 
14  int npix = newPixGains.getIEnd();
15  //bool dead,noisy;
16  if (npix != 0)
17  edm::LogInfo("CTPPSPixelGainCalibrations")
18  << "newPixGains Ped[0] = " << newPixGains.getPed(0) << " ; Gain[0] = " << newPixGains.getGain(0)
19  << " ; dead = " << newPixGains.isDead(0) << " ; noisy = " << newPixGains.isNoisy(0);
20  else
21  edm::LogError("CTPPSPixelGainCalibrations")
22  << "looks like setting gain calibrations did not work, npix is " << npix;
23 
24  m_calibrations[detid] = newPixGains;
25  }
26 
27  else
28  m_calibrations[detid] = PixGains;
29 }
30 
32  const std::vector<float>& peds,
33  const std::vector<float>& gains) {
35 }
36 
38  m_calibrations = PixGainsCalibs;
39 }
40 
41 void CTPPSPixelGainCalibrations::setGainCalibrations(const std::vector<uint32_t>& detidlist,
42  const std::vector<std::vector<float>>& peds,
43  const std::vector<std::vector<float>>& gains) {
44  int nids = detidlist.size();
45  for (int detid = 0; detid < nids; ++detid) {
46  const std::vector<float>& pedsvec = peds[detid];
47  const std::vector<float>& gainsvec = gains[detid];
48  m_calibrations[detid] = CTPPSPixelGainCalibration(detid, pedsvec, gainsvec);
49  }
50 }
51 
53  const uint32_t& detid) const { // returns the object does not change the map
54  CalibMap::const_iterator it = m_calibrations.find(detid);
55  if (it == m_calibrations.end())
56  throw cms::Exception("CTPPSPixelGainCalibrations: ") << " No gain calibrations defined for detid ";
57 
58  return it->second;
59 }
float getPed(const int &col, const int &row) const
void setGainCalibrations(const CalibMap &PixGainsCalibs)
Log< level::Error, false > LogError
bool isNoisy(const uint32_t ipix) const
float getGain(const int &col, const int &row) const
void setGainCalibration(const uint32_t &DetId, const CTPPSPixelGainCalibration &PixGains)
std::map< uint32_t, CTPPSPixelGainCalibration > CalibMap
constexpr float gains[NGAINS]
Definition: EcalConstants.h:20
Log< level::Info, false > LogInfo
bool isDead(const uint32_t ipix) const
const CTPPSPixelGainCalibration & getGainCalibration(const uint32_t &detid) const
void setIndexes(const uint32_t &detId)