CMS 3D CMS Logo

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

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::vector< std::pair< std::string, std::size_t > > m_warnings
 

Detailed Description

Definition at line 152 of file SiStripRawToDigiUnpacker.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Definition at line 69 of file SiStripRawToDigiUnpacker.cc.

References begin, end, and python.rootplot.argparse::message.

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

70  {
71  const auto wIt = std::find_if(std::begin(m_warnings), std::end(m_warnings),
72  [&message] ( const std::pair<std::string,std::size_t>& item ) { return item.first == message; } );
73  if ( std::end(m_warnings) == wIt ) {
74  m_warnings.emplace_back(message, 1);
75  edm::LogWarning(m_category) << message << ": " << details << (m_debug?"":"\nNote: further warnings of this type will be suppressed (this can be changed by enabling debugging printout)");
76  } else {
77  ++(wIt->second);
78  if ( m_debug ) {
80  }
81  }
82  }
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
std::vector< std::pair< std::string, std::size_t > > m_warnings
void sistrip::RawToDigiUnpacker::WarningSummary::printSummary ( ) const

Definition at line 84 of file SiStripRawToDigiUnpacker.cc.

References python.rootplot.argparse::message.

85  {
86  if ( ! m_warnings.empty() ) {
87  std::stringstream message;
88  message << m_name << " warnings:";
89  for ( const auto& warnAndCount : m_warnings ) {
90  message << std::endl << warnAndCount.first << " (" << warnAndCount.second << ")";
91  }
92  edm::LogWarning(m_category) << message.str();
93  }
94  }
std::vector< std::pair< std::string, std::size_t > > m_warnings

Member Data Documentation

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

Definition at line 165 of file SiStripRawToDigiUnpacker.h.

bool sistrip::RawToDigiUnpacker::WarningSummary::m_debug
private

Definition at line 164 of file SiStripRawToDigiUnpacker.h.

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

Definition at line 166 of file SiStripRawToDigiUnpacker.h.

std::vector<std::pair<std::string,std::size_t> > sistrip::RawToDigiUnpacker::WarningSummary::m_warnings
private

Definition at line 167 of file SiStripRawToDigiUnpacker.h.