CMS 3D CMS Logo

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

#include <CTPPSRawToDigiErrorSummary.h>

Public Member Functions

void add (const std::string &message, const std::string &details="")
 
 CTPPSRawToDigiErrorSummary (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 CTPPSRawToDigiErrorSummary.h.

Constructor & Destructor Documentation

◆ CTPPSRawToDigiErrorSummary()

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

Member Function Documentation

◆ add()

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

Definition at line 6 of file CTPPSRawToDigiErrorSummary.cc.

References m_category, m_debug, and m_errors.

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

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 }
Log< level::Error, false > LogError
Definition: helper.h:56
std::map< std::string, std::size_t > m_errors

◆ printSummary()

void CTPPSRawToDigiErrorSummary::printSummary ( ) const

Definition at line 22 of file CTPPSRawToDigiErrorSummary.cc.

References m_category, m_errors, and m_name.

Referenced by CTPPSPixelRawToDigi::endStream(), TotemVFATRawToDigi::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 }
Log< level::Error, false > LogError
std::map< std::string, std::size_t > m_errors

Member Data Documentation

◆ m_category

std::string CTPPSRawToDigiErrorSummary::m_category
private

Definition at line 17 of file CTPPSRawToDigiErrorSummary.h.

Referenced by add(), and printSummary().

◆ m_debug

bool CTPPSRawToDigiErrorSummary::m_debug
private

Definition at line 16 of file CTPPSRawToDigiErrorSummary.h.

Referenced by add().

◆ m_errors

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

Definition at line 19 of file CTPPSRawToDigiErrorSummary.h.

Referenced by add(), and printSummary().

◆ m_name

std::string CTPPSRawToDigiErrorSummary::m_name
private

Definition at line 18 of file CTPPSRawToDigiErrorSummary.h.

Referenced by printSummary().