CMS 3D CMS Logo

SiPixelVCal.cc
Go to the documentation of this file.
3 
4 bool SiPixelVCal::putSlopeAndOffset(const uint32_t& pixid, float& slopeValue, float& offsetValue) {
5  std::map<unsigned int, VCal>::const_iterator id = m_vcal.find(pixid);
6  if (id != m_vcal.end()) {
7  edm::LogError("SiPixelVCal") << "SiPixelVCal for pixid " << pixid << " is already stored. Skippig this put"
8  << std::endl;
9  return false;
10  } else {
11  m_vcal[pixid] = {slopeValue, offsetValue};
12  }
13  return true;
14 }
15 
16 SiPixelVCal::VCal SiPixelVCal::getSlopeAndOffset(const uint32_t& pixid) const {
17  std::map<unsigned int, VCal>::const_iterator id = m_vcal.find(pixid);
18  if (id != m_vcal.end())
19  return id->second;
20  else
21  edm::LogError("SiPixelVCal") << "SiPixelVCal for pixid " << pixid << " is not stored" << std::endl;
22  VCal vcal_default;
23  return vcal_default;
24 }
25 
26 float SiPixelVCal::getSlope(const uint32_t& pixid) const {
27  std::map<unsigned int, VCal>::const_iterator id = m_vcal.find(pixid);
28  if (id != m_vcal.end())
29  return id->second.slope;
30  else
31  edm::LogError("SiPixelVCal") << "SiPixelVCal slope for pixid " << pixid << " is not stored" << std::endl;
32  return 47.;
33 }
34 
35 float SiPixelVCal::getOffset(const uint32_t& pixid) const {
36  std::map<unsigned int, VCal>::const_iterator id = m_vcal.find(pixid);
37  if (id != m_vcal.end())
38  return id->second.offset;
39  else
40  edm::LogError("SiPixelVCal") << "SiPixelVCal offset for pixid " << pixid << " is not stored" << std::endl;
41  return -60.;
42 }
43 
45  std::map<uint32_t, float> slopes;
46  std::transform(m_vcal.begin(),
47  m_vcal.end(),
48  std::inserter(slopes, slopes.end()),
49  [](std::pair<uint32_t, SiPixelVCal::VCal> vcalentry) -> std::pair<uint32_t, float> {
50  return std::make_pair(vcalentry.first, vcalentry.second.slope);
51  });
52  return slopes;
53 }
54 
56  std::map<uint32_t, float> offsets;
57  std::transform(m_vcal.begin(),
58  m_vcal.end(),
59  std::inserter(offsets, offsets.end()),
60  [](std::pair<uint32_t, SiPixelVCal::VCal> vcalentry) -> std::pair<uint32_t, float> {
61  return std::make_pair(vcalentry.first, vcalentry.second.offset);
62  });
63  return offsets;
64 }
SiPixelVCal::putSlopeAndOffset
void putSlopeAndOffset(std::map< unsigned int, VCal > &vcal)
Definition: SiPixelVCal.h:22
MessageLogger.h
SiPixelVCal.h
SiPixelVCal::getSlope
float getSlope(const uint32_t &) const
Definition: SiPixelVCal.cc:26
SiPixelVCal::getAllOffsets
mapToDetId getAllOffsets() const
Definition: SiPixelVCal.cc:55
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
SiPixelVCal::getAllSlopes
mapToDetId getAllSlopes() const
Definition: SiPixelVCal.cc:44
SiPixelVCal::m_vcal
std::map< unsigned int, VCal > m_vcal
Definition: SiPixelVCal.h:39
SiPixelVCal::VCal
Definition: SiPixelVCal.h:16
SiPixelVCal::getSlopeAndOffset
const std::map< unsigned int, VCal > & getSlopeAndOffset() const
Definition: SiPixelVCal.h:23
SiPixelVCal::getOffset
float getOffset(const uint32_t &) const
Definition: SiPixelVCal.cc:35
SiPixelVCal::mapToDetId
std::map< uint32_t, float > mapToDetId
Definition: SiPixelVCal.h:14
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
unpackBuffers-CaloStage1.offsets
offsets
Definition: unpackBuffers-CaloStage1.py:127
edm::Log
Definition: MessageLogger.h:70