CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CTPPSPixelErrorSummary Class Reference

#include <CTPPSPixelErrorSummary.h>

Public Member Functions

void add (const std::string &message, const std::string &details="")
 
 CTPPSPixelErrorSummary (const std::string &category, const std::string &name, bool debug=false)
 
void printSummary () const
 

Private Attributes

std::string m_category
 
bool m_debug
 
std::map< std::string, std::size_t > m_errors
 
std::string m_name
 

Detailed Description

Definition at line 7 of file CTPPSPixelErrorSummary.h.

Constructor & Destructor Documentation

◆ CTPPSPixelErrorSummary()

CTPPSPixelErrorSummary::CTPPSPixelErrorSummary ( const std::string &  category,
const std::string &  name,
bool  debug = false 
)
inline

Member Function Documentation

◆ add()

void CTPPSPixelErrorSummary::add ( const std::string &  message,
const std::string &  details = "" 
)

Definition at line 6 of file CTPPSPixelErrorSummary.cc.

References m_category, m_debug, and m_errors.

Referenced by CTPPSPixelDataFormatter::interpretRawData(), counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

6  {
7  const auto eIt = m_errors.find(message);
8  if (eIt == m_errors.end()) {
9  m_errors.emplace(message, 1);
10  edm::LogError(m_category) << message << ": " << details
11  << (m_debug ? ""
12  : "\nNote: further warnings of this type will be suppressed (this can be "
13  "changed by enabling debugging printout)");
14  } else {
15  ++(eIt->second);
16  if (m_debug) {
17  edm::LogError(m_category) << message << ": " << details;
18  }
19  }
20 }
std::map< std::string, std::size_t > m_errors
Log< level::Error, false > LogError
Definition: helper.h:56

◆ printSummary()

void CTPPSPixelErrorSummary::printSummary ( ) const

Definition at line 22 of file CTPPSPixelErrorSummary.cc.

References m_category, m_errors, and m_name.

Referenced by CTPPSPixelRawToDigi::endStream(), and CTPPSPixelDataFormatter::printErrorSummary().

22  {
23  if (!m_errors.empty()) {
24  std::stringstream message;
25  message << m_name << " errors:";
26  for (const auto& warnAndCount : m_errors) {
27  message << std::endl << warnAndCount.first << " (" << warnAndCount.second << ")";
28  }
29  edm::LogError(m_category) << message.str();
30  }
31 }
std::map< std::string, std::size_t > m_errors
Log< level::Error, false > LogError

Member Data Documentation

◆ m_category

std::string CTPPSPixelErrorSummary::m_category
private

Definition at line 17 of file CTPPSPixelErrorSummary.h.

Referenced by add(), and printSummary().

◆ m_debug

bool CTPPSPixelErrorSummary::m_debug
private

Definition at line 16 of file CTPPSPixelErrorSummary.h.

Referenced by add().

◆ m_errors

std::map<std::string, std::size_t> CTPPSPixelErrorSummary::m_errors
private

Definition at line 19 of file CTPPSPixelErrorSummary.h.

Referenced by add(), and printSummary().

◆ m_name

std::string CTPPSPixelErrorSummary::m_name
private

Definition at line 18 of file CTPPSPixelErrorSummary.h.

Referenced by printSummary().