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::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > 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 &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 () 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
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- 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 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 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 19 of file DQMMessageLogger.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 34 of file DQMMessageLogger.cc.

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

34  {
35 
36  categories_errors = nullptr;
37  categories_warnings = nullptr;
38  modules_errors = nullptr;
39  modules_warnings = nullptr;
40  total_errors = nullptr;
41  total_warnings = nullptr;
42 
43  //Get from cfg file
44  categories_vector = parameters.getParameter< vector<string> >("Categories");
45  directoryName = parameters.getParameter<string>("Directory");
46  errorSummary_ = consumes<std::vector<edm::ErrorSummaryEntry> >(parameters.getUntrackedParameter<std::string>("errorSummary","logErrorHarvester"));
47 
48 
49 }
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 51 of file DQMMessageLogger.cc.

51  {
52  // Should the pointers be deleted?
53 }

Member Function Documentation

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

Get the analysis.

Definition at line 132 of file DQMMessageLogger.cc.

References python.rootplot.argparse::category, MillePedeFileConverter_cfg::e, benchmark_cfg::errors, edm::Event::getByToken(), edm::ELseverityLevel::getLevel(), mps_fire::i, edm::HandleBase::isValid(), LogTrace, metname, gen::n, alignCSCRings::s, and w.

132  {
133 
134  LogTrace(metname)<<"[DQMMessageLogger] Analysis of event # ";
135 
136 
137  // Take the ErrorSummaryEntry container
139  iEvent.getByToken(errorSummary_,errors);
140  // Check that errors is valid
141  if(!errors.isValid()){ return; }
142  // Compare severity level of error with ELseveritylevel instance el : "-e" should be the lowest error
143  ELseverityLevel el("-e");
144 
145 
146 
147  // Find the total number of errors in iEvent
148  if(errors->empty()){
149  if(total_errors!=nullptr){
150  total_errors->Fill(0);
151  }
152  if(total_warnings!=nullptr){
153  total_warnings->Fill(0);
154  }
155  }else{
156 
157  int e = 0;
158  int w = 0;
159  for (int i=0, n=errors->size(); i<n; i++){
160  if((*errors)[i].severity.getLevel() < el.getLevel()){
161  w+= (*errors)[i].count;
162  }else{
163  e+= (*errors)[i].count;
164  }
165  }
166  if(total_errors!=nullptr){
167  total_errors->Fill(e);
168  }
169  if(total_warnings!=nullptr){
170  total_warnings->Fill(w);
171  }
172  }
173 
174 
175 
176 
177  for(int i=0, n=errors->size(); i< n ; i++){
178 
179  //cout << "Severity for error/warning: " << (*errors)[i].severity << " " <<(*errors)[i].module << endl;
180 
181  if(!errors->empty()){
182  // IF THIS IS AN ERROR on the ELseverityLevel SCALE, FILL ERROR HISTS
183  if((*errors)[i].severity.getLevel() >= el.getLevel()){
184  if(categories_errors!=nullptr){
185  auto it = categoryMap.find((*errors)[i].category);
186  if (it!=categoryMap.end()){
187  // FILL THE RIGHT BIN
188  categories_errors->Fill((*it).second - 1, (*errors)[i].count);
189  }
190  }
191  // if (categoryECount.size()<=40)
192  // categoryECount[(*errors)[i].category]+=(*errors)[i].count;
193 
194  if(modules_errors!=nullptr){
195  // remove the first part of the module string, what is before ":"
196  string s = (*errors)[i].module;
197  size_t pos = s.find(':');
198  string s_temp = s.substr(pos+1,s.size());
199  auto it = moduleMap.find(s_temp);
200  if(it!=moduleMap.end()){
201  // FILL THE RIGHT BIN
202  modules_errors->Fill((*it).second - 1, (*errors)[i].count);
203  }
204  }
205  // IF ONLY WARNING, FILL WARNING HISTS
206  }else{
207  if(categories_warnings!=nullptr){
208  auto it = categoryMap.find((*errors)[i].category);
209  if (it!=categoryMap.end()){
210  // FILL THE RIGHT BIN
211  categories_warnings->Fill((*it).second - 1, (*errors)[i].count);
212  }
213  }
214 
215  // if (categoryWCount.size()<=40)
216  // categoryWCount[(*errors)[i].category]+=(*errors)[i].count;
217 
218  if(modules_warnings!=nullptr){
219  // remove the first part of the module string, what is before ":"
220  string s = (*errors)[i].module;
221  size_t pos = s.find(':');
222  string s_temp = s.substr(pos+1,s.size());
223  auto it = moduleMap.find(s_temp);
224  if(it!=moduleMap.end()){
225  // FILL THE RIGHT BIN
226  modules_warnings->Fill((*it).second - 1, (*errors)[i].count);
227  }
228  }
229  }
230  }
231  }
232 }
std::string metname
MonitorElement * total_warnings
const double w
Definition: UKUtility.cc:23
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
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
std::map< std::string, int > categoryMap
bool isValid() const
Definition: HandleBase.h:74
#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 56 of file DQMMessageLogger.cc.

References DQMStore::IBooker::book1D(), mps_fire::i, gen::k, LogTrace, metname, pileupCalc::nbins, MillePedeFileConverter_cfg::out, alignCSCRings::s, MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), and nano_cff::strings.

56  {
57 
58  metname = "errorAnalyzer";
59 
60 
61 
62  // MAKE CATEGORYMAP USING INPUT FROM CFG FILE
63  for(unsigned int i=0; i<categories_vector.size(); i++){
64  categoryMap.insert(pair<string,int>(categories_vector[i],i+1));
65  }
66 
67 
68  // MAKE MODULEMAP
70  using stringvec = vector<std::string>;
71  TNS tns;
72  stringvec const& trigpaths = tns->getTrigPaths();
73 
74 
75  for (auto const & trigpath : trigpaths){
76  stringvec strings = tns->getTrigPathModules(trigpath);
77 
78  for(auto & k : strings){
79  moduleMap.insert(pair<string,int>(k,moduleMap.size()+1));
80  }
81  }
82 
83  // BOOK THE HISTOGRAMS
84  LogTrace(metname)<<"[DQMMessageLogger] Parameters initialization";
85 
86  if(!moduleMap.empty()){
87  ibooker.setCurrentFolder(directoryName + "/Errors");
88  modules_errors = ibooker.book1D("modules_errors", "Errors per module", moduleMap.size(), 0, moduleMap.size());
89  ibooker.setCurrentFolder(directoryName + "/Warnings");
90 
91  modules_warnings = ibooker.book1D("modules_warnings","Warnings per module",moduleMap.size(),0,moduleMap.size());
92 
93  for(auto it = moduleMap.begin(); it!=moduleMap.end();++it){
94  modules_errors->setBinLabel((*it).second,(*it).first);
95  modules_warnings->setBinLabel((*it).second,(*it).first);
96  }
97  modules_errors->getTH1()->GetXaxis()->LabelsOption("v");
98  modules_warnings->getTH1()->GetXaxis()->LabelsOption("v");
99 
100  }
101 
102  if(!categoryMap.empty()){
103  ibooker.setCurrentFolder(directoryName + "/Errors");
104  categories_errors = ibooker.book1D("categories_errors", "Errors per category", categoryMap.size(), 0, categoryMap.size());
105  ibooker.setCurrentFolder(directoryName +"/Warnings");
106  categories_warnings = ibooker.book1D("categories_warnings", "Warnings per category", categoryMap.size(), 0, categoryMap.size());
107 
108  for(auto it = categoryMap.begin(); it!=categoryMap.end();++it){
109  categories_errors->setBinLabel((*it).second,(*it).first);
110  categories_warnings->setBinLabel((*it).second,(*it).first);
111  }
112  categories_warnings->getTH1()->GetXaxis()->LabelsOption("v");
113  categories_errors->getTH1()->GetXaxis()->LabelsOption("v");
114  }
115 
116  // HOW MANY BINS SHOULD THE ERROR HIST HAVE?
117  int nbins = 11;
118  total_warnings = ibooker.book1D("total_warnings","Total warnings per event",nbins,-0.5,nbins+0.5);
119  ibooker.setCurrentFolder(directoryName + "/Errors");
120  total_errors = ibooker.book1D("total_errors", "Total errors per event", nbins, -0.5, nbins+0.5);
121 
122  for(int i=0; i<nbins; ++i){
123  stringstream out;
124  out<< i;
125  string s = out.str();
126  total_errors->setBinLabel(i+1,s);
127  total_warnings->setBinLabel(i+1,s);
128  }
129 }
std::string metname
MonitorElement * total_warnings
TH1 * getTH1() const
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)
MonitorElement * total_errors
MonitorElement * modules_warnings
MonitorElement * categories_errors
std::map< std::string, int > moduleMap
std::map< std::string, int > categoryMap
std::string directoryName
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
#define LogTrace(id)
std::vector< std::string > categories_vector
int k[5][pyjets_maxn]
MonitorElement * modules_errors
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
MonitorElement * categories_warnings

Member Data Documentation

MonitorElement* DQMMessageLogger::categories_errors
private

Definition at line 53 of file DQMMessageLogger.h.

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

Definition at line 48 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::categories_warnings
private

Definition at line 54 of file DQMMessageLogger.h.

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

Definition at line 46 of file DQMMessageLogger.h.

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

Definition at line 44 of file DQMMessageLogger.h.

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

Definition at line 45 of file DQMMessageLogger.h.

std::string DQMMessageLogger::directoryName
private

Definition at line 49 of file DQMMessageLogger.h.

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

Definition at line 50 of file DQMMessageLogger.h.

std::string DQMMessageLogger::metname
private

Definition at line 41 of file DQMMessageLogger.h.

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

Definition at line 43 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::modules_errors
private

Definition at line 55 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::modules_warnings
private

Definition at line 56 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::total_errors
private

Definition at line 57 of file DQMMessageLogger.h.

MonitorElement* DQMMessageLogger::total_warnings
private

Definition at line 58 of file DQMMessageLogger.h.