CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
sistrip::WarningSummary Class Reference

#include <WarningSummary.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 8 of file WarningSummary.h.

Constructor & Destructor Documentation

◆ WarningSummary()

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

Definition at line 10 of file WarningSummary.h.

Member Function Documentation

◆ add()

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

Definition at line 6 of file WarningSummary.cc.

6  {
7  const auto wIt = m_warnings.find(message);
8  if (wIt == m_warnings.end()) {
9  m_warnings.emplace(message, 1);
10  edm::LogWarning(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  ++(wIt->second);
16  if (m_debug) {
17  edm::LogWarning(m_category) << message << ": " << details;
18  }
19  }
20 }

References m_category, m_debug, and m_warnings.

Referenced by sistrip::RawToDigiUnpacker::createDigis(), sistrip::DigiToRaw::createFedBuffers_(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ printSummary()

void sistrip::WarningSummary::printSummary ( ) const

Definition at line 22 of file WarningSummary.cc.

22  {
23  if (!m_warnings.empty()) {
24  std::stringstream message;
25  message << m_name << " warnings:";
26  for (const auto& warnAndCount : m_warnings) {
27  message << std::endl << warnAndCount.first << " (" << warnAndCount.second << ")";
28  }
29  edm::LogWarning(m_category) << message.str();
30  }
31 }

Member Data Documentation

◆ m_category

std::string sistrip::WarningSummary::m_category
private

Definition at line 18 of file WarningSummary.h.

Referenced by add().

◆ m_debug

bool sistrip::WarningSummary::m_debug
private

Definition at line 17 of file WarningSummary.h.

Referenced by add().

◆ m_name

std::string sistrip::WarningSummary::m_name
private

Definition at line 19 of file WarningSummary.h.

◆ m_warnings

std::map<std::string, std::size_t> sistrip::WarningSummary::m_warnings
private

Definition at line 20 of file WarningSummary.h.

Referenced by add().

sistrip::WarningSummary::m_warnings
std::map< std::string, std::size_t > m_warnings
Definition: WarningSummary.h:20
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:31
sistrip::WarningSummary::m_category
std::string m_category
Definition: WarningSummary.h:18
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
debug
#define debug
Definition: HDRShower.cc:19
details
Definition: helper.h:56
sistrip::WarningSummary::m_debug
bool m_debug
Definition: WarningSummary.h:17
sistrip::WarningSummary::m_name
std::string m_name
Definition: WarningSummary.h:19
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17