Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:30

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "EventFilter/CTPPSRawToDigi/interface/CTPPSRawToDigiErrorSummary.h"
0003 #include <iostream>
0004 #include <algorithm>
0005 
0006 void CTPPSRawToDigiErrorSummary::add(const std::string& message, const std::string& details) {
0007   const auto eIt = m_errors.find(message);
0008   if (eIt == m_errors.end()) {
0009     m_errors.emplace(message, 1);
0010     edm::LogError(m_category) << message << ": " << details
0011                               << (m_debug ? ""
0012                                           : "\nNote: further warnings of this type will be suppressed (this can be "
0013                                             "changed by enabling debugging printout)");
0014   } else {
0015     ++(eIt->second);
0016     if (m_debug) {
0017       edm::LogError(m_category) << message << ": " << details;
0018     }
0019   }
0020 }
0021 
0022 void CTPPSRawToDigiErrorSummary::printSummary() const {
0023   if (!m_errors.empty()) {
0024     std::stringstream message;
0025     message << m_name << " errors:";
0026     for (const auto& warnAndCount : m_errors) {
0027       message << std::endl << warnAndCount.first << " (" << warnAndCount.second << ")";
0028     }
0029     edm::LogError(m_category) << message.str();
0030   }
0031 }