CMS 3D CMS Logo

SiPixelQualityProbabilities.cc
Go to the documentation of this file.
4 #include <iostream>
5 #include <iomanip> // std::setw
6 
7 //****************************************************************************//
8 void SiPixelQualityProbabilities::setProbabilities(const unsigned int puBin, const probabilityVec &theProbabilities) {
9  if (m_probabilities.find(puBin) != m_probabilities.end()) {
10  edm::LogWarning("SiPixelQualityProbabilities") << "PU bin: " << puBin << " is already in the map!" << std::endl;
11  return;
12  } else {
13  m_probabilities.emplace(puBin, theProbabilities);
14  }
15 }
16 
17 //****************************************************************************//
19  const unsigned int puBin) const {
20  probabilityMap::const_iterator it = m_probabilities.find(puBin);
21 
22  if (it != m_probabilities.end()) {
23  return it->second;
24  } else {
25  throw cms::Exception("SiPixelQualityProbabilities") << "No Probabilities are defined for PU bin " << puBin << "\n";
26  }
27 }
28 
29 //****************************************************************************//
31  const unsigned int puBin) {
32  probabilityMap::const_iterator it = m_probabilities.find(puBin);
33 
34  if (it != m_probabilities.end()) {
35  return it->second;
36  } else {
37  throw cms::Exception("SiPixelQualityProbabilities") << "No Probabilities are defined for PU bin " << puBin << "\n";
38  }
39 }
40 
41 //****************************************************************************//
43  edm::LogVerbatim("SiPixelQualityProbabilities") << "SiPixelQualityProbabilities::printAll()";
44  edm::LogVerbatim("SiPixelQualityProbabilities") << " ================================================================"
45  "===================================================";
46  for (auto it = m_probabilities.begin(); it != m_probabilities.end(); ++it) {
47  edm::LogVerbatim("SiPixelQualityProbabilities") << "PU :" << it->first << " \n ";
48  for (const auto &entry : it->second) {
49  edm::LogVerbatim("SiPixelQualityProbabilities")
50  << "SiPixelQuality snapshot: " << entry.first << " |probability: " << entry.second << std::endl;
51  }
52  }
53 }
54 
55 //****************************************************************************//
56 void SiPixelQualityProbabilities::print(std::ostream &os) const {
57  for (auto it = m_probabilities.begin(); it != m_probabilities.end(); ++it) {
58  os << "PU :" << it->first << " \n ";
59  for (const auto &entry : it->second) {
60  os << "SiPixelQuality snapshot: " << entry.first << " |probability: " << entry.second << std::endl;
61  }
62  }
63 }
64 
65 //****************************************************************************//
66 std::vector<unsigned int> SiPixelQualityProbabilities::getPileUpBins() const {
67  std::vector<unsigned int> bins;
68  bins.reserve(m_probabilities.size());
69 
70  for (auto it = m_probabilities.begin(); it != m_probabilities.end(); ++it) {
71  bins.push_back(it->first);
72  }
73  return bins;
74 }
75 
76 //****************************************************************************//
77 std::ostream &operator<<(std::ostream &os, SiPixelQualityProbabilities theProbabilities) {
78  std::stringstream ss;
79  theProbabilities.print(ss);
80  os << ss.str();
81  return os;
82 }
MessageLogger.h
SiPixelQualityProbabilities::getPileUpBins
std::vector< unsigned int > getPileUpBins() const
Definition: SiPixelQualityProbabilities.cc:66
mps_splice.entry
entry
Definition: mps_splice.py:68
SiPixelQualityProbabilities::getProbabilities
probabilityVec getProbabilities(const unsigned int puBin) const
Definition: SiPixelQualityProbabilities.cc:18
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiPixelQualityProbabilities::printAll
void printAll() const
Definition: SiPixelQualityProbabilities.cc:42
edm::LogWarning
Definition: MessageLogger.h:141
SiPixelQualityProbabilities::setProbabilities
void setProbabilities(const unsigned int puBin, const probabilityVec &theProbabilities)
Definition: SiPixelQualityProbabilities.cc:8
SiPixelQualityProbabilities.h
edm::LogVerbatim
Definition: MessageLogger.h:297
SiPixelQualityProbabilities::m_probabilities
probabilityMap m_probabilities
Definition: SiPixelQualityProbabilities.h:36
SiPixelQualityProbabilities
Definition: SiPixelQualityProbabilities.h:10
SiPixelQualityProbabilities::probabilityVec
std::vector< std::pair< std::string, float > > probabilityVec
Definition: SiPixelQualityProbabilities.h:12
operator<<
std::ostream & operator<<(std::ostream &os, SiPixelQualityProbabilities theProbabilities)
Definition: SiPixelQualityProbabilities.cc:77
SiPixelQualityProbabilities::print
void print(std::ostream &os) const
Definition: SiPixelQualityProbabilities.cc:56
Exception
Definition: hltDiff.cc:246
Exception.h
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20