CMS 3D CMS Logo

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

#include <DQMMessageLogger.h>

Inheritance diagram for DQMMessageLogger:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 Get the analysis. More...
 
 DQMMessageLogger (const edm::ParameterSet &)
 Constructor. More...
 
 ~DQMMessageLogger () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Attributes

MonitorElementcategories_errors
 
std::vector< std::string > categories_vector
 
MonitorElementcategories_warnings
 
std::map< std::string, int > categoryECount
 
std::map< std::string, int > categoryMap
 
std::map< std::string, int > categoryWCount
 
std::string directoryName
 
edm::EDGetTokenT< std::vector< edm::ErrorSummaryEntry > > errorSummary_
 
std::string metname
 
std::map< std::string, int > moduleMap
 
MonitorElementmodules_errors
 
MonitorElementmodules_warnings
 
MonitorElementtotal_errors
 
MonitorElementtotal_warnings
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 17 of file DQMMessageLogger.h.

Constructor & Destructor Documentation

DQMMessageLogger::DQMMessageLogger ( const edm::ParameterSet parameters)

Constructor.

Definition at line 31 of file DQMMessageLogger.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

31  {
32  categories_errors = nullptr;
33  categories_warnings = nullptr;
34  modules_errors = nullptr;
35  modules_warnings = nullptr;
36  total_errors = nullptr;
37  total_warnings = nullptr;
38 
39  //Get from cfg file
40  categories_vector = parameters.getParameter<vector<string> >("Categories");
41  directoryName = parameters.getParameter<string>("Directory");
42  errorSummary_ = consumes<std::vector<edm::ErrorSummaryEntry> >(
43  parameters.getUntrackedParameter<std::string>("errorSummary", "logErrorHarvester"));
44 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * total_warnings
edm::EDGetTokenT< std::vector< edm::ErrorSummaryEntry > > errorSummary_
MonitorElement * total_errors
MonitorElement * modules_warnings
MonitorElement * categories_errors
std::string directoryName
std::vector< std::string > categories_vector
MonitorElement * modules_errors
MonitorElement * categories_warnings
DQMMessageLogger::~DQMMessageLogger ( )
override

Destructor.

Definition at line 46 of file DQMMessageLogger.cc.

46  {
47  // Should the pointers be deleted?
48 }

Member Function Documentation

void DQMMessageLogger::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Get the analysis.

Definition at line 121 of file DQMMessageLogger.cc.

References taus_updatedMVAIds_cff::category, MillePedeFileConverter_cfg::e, MessageLogger_cfi::errors, edm::Event::getByToken(), edm::ELseverityLevel::getLevel(), mps_fire::i, edm::HandleBase::isValid(), LogTrace, metname, dqmiodumpmetadata::n, alignCSCRings::s, and w.

121  {
122  LogTrace(metname) << "[DQMMessageLogger] Analysis of event # ";
123 
124  // Take the ErrorSummaryEntry container
126  iEvent.getByToken(errorSummary_, errors);
127  // Check that errors is valid
128  if (!errors.isValid()) {
129  return;
130  }
131  // Compare severity level of error with ELseveritylevel instance el : "-e" should be the lowest error
132  ELseverityLevel el("-e");
133 
134  // Find the total number of errors in iEvent
135  if (errors->empty()) {
136  if (total_errors != nullptr) {
137  total_errors->Fill(0);
138  }
139  if (total_warnings != nullptr) {
140  total_warnings->Fill(0);
141  }
142  } else {
143  int e = 0;
144  int w = 0;
145  for (int i = 0, n = errors->size(); i < n; i++) {
146  if ((*errors)[i].severity.getLevel() < el.getLevel()) {
147  w += (*errors)[i].count;
148  } else {
149  e += (*errors)[i].count;
150  }
151  }
152  if (total_errors != nullptr) {
153  total_errors->Fill(e);
154  }
155  if (total_warnings != nullptr) {
156  total_warnings->Fill(w);
157  }
158  }
159 
160  for (int i = 0, n = errors->size(); i < n; i++) {
161  //cout << "Severity for error/warning: " << (*errors)[i].severity << " " <<(*errors)[i].module << endl;
162 
163  if (!errors->empty()) {
164  // IF THIS IS AN ERROR on the ELseverityLevel SCALE, FILL ERROR HISTS
165  if ((*errors)[i].severity.getLevel() >= el.getLevel()) {
166  if (categories_errors != nullptr) {
167  auto it = categoryMap.find((*errors)[i].category);
168  if (it != categoryMap.end()) {
169  // FILL THE RIGHT BIN
170  categories_errors->Fill((*it).second - 1, (*errors)[i].count);
171  }
172  }
173  // if (categoryECount.size()<=40)
174  // categoryECount[(*errors)[i].category]+=(*errors)[i].count;
175 
176  if (modules_errors != nullptr) {
177  // remove the first part of the module string, what is before ":"
178  string s = (*errors)[i].module;
179  size_t pos = s.find(':');
180  string s_temp = s.substr(pos + 1, s.size());
181  auto it = moduleMap.find(s_temp);
182  if (it != moduleMap.end()) {
183  // FILL THE RIGHT BIN
184  modules_errors->Fill((*it).second - 1, (*errors)[i].count);
185  }
186  }
187  // IF ONLY WARNING, FILL WARNING HISTS
188  } else {
189  if (categories_warnings != nullptr) {
190  auto it = categoryMap.find((*errors)[i].category);
191  if (it != categoryMap.end()) {
192  // FILL THE RIGHT BIN
193  categories_warnings->Fill((*it).second - 1, (*errors)[i].count);
194  }
195  }
196 
197  // if (categoryWCount.size()<=40)
198  // categoryWCount[(*errors)[i].category]+=(*errors)[i].count;
199 
200  if (modules_warnings != nullptr) {
201  // remove the first part of the module string, what is before ":"
202  string s = (*errors)[i].module;
203  size_t pos = s.find(':');
204  string s_temp = s.substr(pos + 1, s.size());
205  auto it = moduleMap.find(s_temp);
206  if (it != moduleMap.end()) {
207  // FILL THE RIGHT BIN
208  modules_warnings->Fill((*it).second - 1, (*errors)[i].count);
209  }
210  }
211  }
212  }
213  }
214 }
std::map< std::string, int > categoryMap
std::string metname
MonitorElement * total_warnings
const double w
Definition: UKUtility.cc:23
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< std::vector< edm::ErrorSummaryEntry > > errorSummary_
MonitorElement * total_errors
MonitorElement * modules_warnings
MonitorElement * categories_errors
void Fill(long long x)
std::map< std::string, int > moduleMap
bool isValid() const
Definition: HandleBase.h:70
#define LogTrace(id)
MonitorElement * modules_errors
MonitorElement * categories_warnings
void DQMMessageLogger::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 50 of file DQMMessageLogger.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), mps_fire::i, dqmdumpme::k, LogTrace, metname, LaserClient_cfi::nbins, MillePedeFileConverter_cfg::out, alignCSCRings::s, dqm::impl::MonitorElement::setBinLabel(), dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), and nano_cff::strings.

50  {
51  metname = "errorAnalyzer";
52 
53  // MAKE CATEGORYMAP USING INPUT FROM CFG FILE
54  for (unsigned int i = 0; i < categories_vector.size(); i++) {
55  categoryMap.insert(pair<string, int>(categories_vector[i], i + 1));
56  }
57 
58  // MAKE MODULEMAP
60  using stringvec = vector<std::string>;
61  TNS tns;
62  stringvec const& trigpaths = tns->getTrigPaths();
63 
64  for (auto const& trigpath : trigpaths) {
65  stringvec strings = tns->getTrigPathModules(trigpath);
66 
67  for (auto& k : strings) {
68  moduleMap.insert(pair<string, int>(k, moduleMap.size() + 1));
69  }
70  }
71 
72  // BOOK THE HISTOGRAMS
73  LogTrace(metname) << "[DQMMessageLogger] Parameters initialization";
74 
75  if (!moduleMap.empty()) {
76  ibooker.setCurrentFolder(directoryName + "/Errors");
77  modules_errors = ibooker.book1D("modules_errors", "Errors per module", moduleMap.size(), 0, moduleMap.size());
78  ibooker.setCurrentFolder(directoryName + "/Warnings");
79 
80  modules_warnings = ibooker.book1D("modules_warnings", "Warnings per module", moduleMap.size(), 0, moduleMap.size());
81 
82  for (auto it = moduleMap.begin(); it != moduleMap.end(); ++it) {
83  modules_errors->setBinLabel((*it).second, (*it).first);
84  modules_warnings->setBinLabel((*it).second, (*it).first);
85  }
86  modules_errors->getTH1()->GetXaxis()->LabelsOption("v");
87  modules_warnings->getTH1()->GetXaxis()->LabelsOption("v");
88  }
89 
90  if (!categoryMap.empty()) {
91  ibooker.setCurrentFolder(directoryName + "/Errors");
93  ibooker.book1D("categories_errors", "Errors per category", categoryMap.size(), 0, categoryMap.size());
94  ibooker.setCurrentFolder(directoryName + "/Warnings");
96  ibooker.book1D("categories_warnings", "Warnings per category", categoryMap.size(), 0, categoryMap.size());
97 
98  for (auto it = categoryMap.begin(); it != categoryMap.end(); ++it) {
99  categories_errors->setBinLabel((*it).second, (*it).first);
100  categories_warnings->setBinLabel((*it).second, (*it).first);
101  }
102  categories_warnings->getTH1()->GetXaxis()->LabelsOption("v");
103  categories_errors->getTH1()->GetXaxis()->LabelsOption("v");
104  }
105 
106  // HOW MANY BINS SHOULD THE ERROR HIST HAVE?
107  int nbins = 11;
108  total_warnings = ibooker.book1D("total_warnings", "Total warnings per event", nbins, -0.5, nbins + 0.5);
109  ibooker.setCurrentFolder(directoryName + "/Errors");
110  total_errors = ibooker.book1D("total_errors", "Total errors per event", nbins, -0.5, nbins + 0.5);
111 
112  for (int i = 0; i < nbins; ++i) {
113  stringstream out;
114  out << i;
115  string s = out.str();
116  total_errors->setBinLabel(i + 1, s);
117  total_warnings->setBinLabel(i + 1, s);
118  }
119 }
std::map< std::string, int > categoryMap
std::string metname
MonitorElement * total_warnings
MonitorElement * total_errors
MonitorElement * modules_warnings
MonitorElement * categories_errors
std::string directoryName
std::map< std::string, int > moduleMap
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
#define LogTrace(id)
std::vector< std::string > categories_vector
MonitorElement * modules_errors
MonitorElement * categories_warnings

Member Data Documentation

MonitorElement* DQMMessageLogger::categories_errors
private

Definition at line 47 of file DQMMessageLogger.h.

std::vector<std::string> DQMMessageLogger::categories_vector
private

Definition at line 42 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::categories_warnings
private

Definition at line 48 of file DQMMessageLogger.h.

std::map<std::string, int> DQMMessageLogger::categoryECount
private

Definition at line 40 of file DQMMessageLogger.h.

std::map<std::string, int> DQMMessageLogger::categoryMap
private

Definition at line 38 of file DQMMessageLogger.h.

std::map<std::string, int> DQMMessageLogger::categoryWCount
private

Definition at line 39 of file DQMMessageLogger.h.

std::string DQMMessageLogger::directoryName
private

Definition at line 43 of file DQMMessageLogger.h.

edm::EDGetTokenT<std::vector<edm::ErrorSummaryEntry> > DQMMessageLogger::errorSummary_
private

Definition at line 44 of file DQMMessageLogger.h.

std::string DQMMessageLogger::metname
private

Definition at line 35 of file DQMMessageLogger.h.

std::map<std::string, int> DQMMessageLogger::moduleMap
private

Definition at line 37 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::modules_errors
private

Definition at line 49 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::modules_warnings
private

Definition at line 50 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::total_errors
private

Definition at line 51 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::total_warnings
private

Definition at line 52 of file DQMMessageLogger.h.