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 = std::find_if(
8  std::begin(m_warnings), std::end(m_warnings), [&message](const std::pair<std::string, std::size_t>& item) {
9  return item.first == message;
10  });
11  if (std::end(m_warnings) == wIt) {
12  m_warnings.emplace(message, 1);
13  edm::LogWarning(m_category) << message << ": " << details
14  << (m_debug ? ""
15  : "\nNote: further warnings of this type will be suppressed (this can be "
16  "changed by enabling debugging printout)");
17  } else {
18  ++(wIt->second);
19  if (m_debug) {
20  edm::LogWarning(m_category) << message << ": " << details;
21  }
22  }
23 }

References mps_fire::end, B2GTnPMonitor_cfi::item, 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 25 of file WarningSummary.cc.

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

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
mps_fire.end
end
Definition: mps_fire.py:242
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
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17