CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
LogMessageMonitor Class Reference

#include <DQM/LogMonitor/src/LogMessageMonitor.cc>

Inheritance diagram for LogMessageMonitor:
edm::EDAnalyzer

Public Member Functions

 LogMessageMonitor (const edm::ParameterSet &)
 
 ~LogMessageMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 

Private Attributes

std::vector< std::string > categories_vector_
 
MonitorElementCategoriesVsModules
 
edm::ParameterSet conf_
 
bool doPUmonitoring_
 
bool doWarningsPlots_
 
DQMStoredqmStore_
 
GenericTriggerEventFlaggenTriggerEventFlag_
 
std::string histname
 
GetLumilumiDetails_
 
std::vector< std::string > modules_vector_
 
std::vector< MonitorElement * > ModulesErrorsVsBXlumi
 
std::map< std::string, int > modulesMap
 
std::vector< MonitorElement * > ModulesWarningsVsBXlumi
 
std::string pluginsMonName_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Description: [one line class summary] from https://twiki.cern.ch/twiki/bin/view/CMS/TrackingPOGFilters#Filters Events with (partly) aborted track reconstruction The track reconstruction code is protected against events with too large occupancy which can cause an excessive use of CPU time and memory. Each iteration of the track reconstruction can be aborted if:

ELSeverityLevel

http://cmssdt.cern.ch/SDT/lxr/source/FWCore/MessageLogger/interface/ELseverityLevel.h?v=CMSSW_5_3_4 108 enum ELsev_ { 109 ELsev_noValueAssigned = 0 // default returned by map when not found 110 , ELsev_zeroSeverity // threshold use only 111 , ELsev_incidental // flash this on a screen 112 , ELsev_success // report reaching a milestone 113 , ELsev_info // information 114 , ELsev_warning // warning 115 , ELsev_warning2 // more serious warning 116 , ELsev_error // error detected 117 , ELsev_error2 // more serious error 118 , ELsev_next // advise to skip to next event 119 , ELsev_unspecified // severity was not specified 120 , ELsev_severe // future results are suspect 121 , ELsev_severe2 // more severe 122 , ELsev_abort // suggest aborting 123 , ELsev_fatal // strongly suggest aborting! 124 , ELsev_highestSeverity // threshold use only 125 // --— 126 , nLevels // how many levels? 127 }; // ELsev_

Implementation: [Notes on implementation]

Definition at line 49 of file LogMessageMonitor.h.

Constructor & Destructor Documentation

LogMessageMonitor::LogMessageMonitor ( const edm::ParameterSet iConfig)
explicit

Definition at line 80 of file LogMessageMonitor.cc.

References genTriggerEventFlag_, edm::ParameterSet::getParameter(), and lumiDetails_.

82  , conf_ ( iConfig )
83  , pluginsMonName_ ( iConfig.getParameter<std::string> ("pluginsMonName") )
84  , modules_vector_ ( iConfig.getParameter<std::vector<std::string> >("modules") )
85  , categories_vector_ ( iConfig.getParameter<std::vector<std::string> >("categories") )
86  , doWarningsPlots_ ( iConfig.getParameter<bool> ("doWarningsPlots") )
87  , doPUmonitoring_ ( iConfig.getParameter<bool> ("doPUmonitoring") )
88 {
89  //now do what ever initialization is needed
90  lumiDetails_ = new GetLumi( iConfig.getParameter<edm::ParameterSet>("BXlumiSetup") );
92 }
T getParameter(std::string const &) const
std::vector< std::string > categories_vector_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
edm::ParameterSet conf_
GenericTriggerEventFlag * genTriggerEventFlag_
std::vector< std::string > modules_vector_
std::string pluginsMonName_
LogMessageMonitor::~LogMessageMonitor ( )

Definition at line 95 of file LogMessageMonitor.cc.

References genTriggerEventFlag_.

96 {
97 
98  // do anything here that needs to be done at desctruction time
99  // (e.g. close files, deallocate resources etc.)
100  // if ( lumiDetails_ ) delete lumiDetails_;
102 
103 }
GenericTriggerEventFlag * genTriggerEventFlag_

Member Function Documentation

void LogMessageMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 112 of file LogMessageMonitor.cc.

References GenericTriggerEventFlag::accept(), categories_vector_, CategoriesVsModules, python.rootplot.argparse::category, prof2calltree::count, doPUmonitoring_, doWarningsPlots_, edm::ELseverityLevel::ELsev_error, benchmark_cfg::errors, HcalObjRepresent::Fill(), genTriggerEventFlag_, edm::Event::getByLabel(), MonitorElement::getTH1(), GetLumi::getValue(), i, edm::HandleBase::isValid(), lumiDetails_, ModulesErrorsVsBXlumi, modulesMap, ModulesWarningsVsBXlumi, n, GenericTriggerEventFlag::on(), pos, and alignCSCRings::s.

113 {
114 
115  // Filter out events if Trigger Filtering is requested
116  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;
117 
118  double BXlumi = -1.;
119  if ( doPUmonitoring_ )
120  lumiDetails_->getValue(iEvent);
121 
122  // Take the ErrorSummaryEntry container
124  iEvent.getByLabel("logErrorHarvester",errors);
125  // Check that errors is valid
126  if(!errors.isValid()) return;
127  // Compare severity level of error with ELseveritylevel instance el : "-e" should be the lowest error
128  edm::ELseverityLevel el("-e");
129 
130  // Find the total number of errors in iEvent
131  if(errors->size()==0){
132  if ( doPUmonitoring_ ) {
133  for(size_t i = 0; i < modulesMap.size(); i++) {
134  ModulesErrorsVsBXlumi[i] -> Fill(BXlumi,0.);
135  if ( doWarningsPlots_ )
136  ModulesWarningsVsBXlumi[i] -> Fill(BXlumi,0.);
137  }
138  }
139  } else {
140 
141  size_t nCategories = categories_vector_.size();
142 
143  for( size_t i = 0, n = errors->size(); i < n ; i++){
144 
145  // std::cout << "LogMessageMonitor::analyze] Severity for error/warning: " << (*errors)[i].severity << " " <<(*errors)[i].module << std::endl;
146  // remove the first part of the module string, what is before ":"
147  std::string s = (*errors)[i].module;
148  size_t pos = s.find(':');
149  std::string s_module = s.substr(pos+1,s.size());
150  std::map<std::string,int>::const_iterator it = modulesMap.find(s_module);
151  if (it!=modulesMap.end()){
152  // std::cout << "LogMessageMonitor::analyze] it: " << " --> " << s_module << std::endl;
153 
154  // IF THIS IS AN ERROR on the ELseverityLevel SCALE, FILL ERROR HISTS
155  if((*errors)[i].severity.getLevel() >= edm::ELseverityLevel::ELsev_error) {
156  if ( doPUmonitoring_ )
157  ModulesErrorsVsBXlumi[it->second]->Fill (BXlumi, (*errors)[i].count);
158 
159  // loop over the different categories of errors
160  // defined by configuration file
161  // if the category is not in the given list
162  // it fills the bin "others"
163  TString module = it->first;
164  TString category = (*errors)[i].category;
165  int ibinX = CategoriesVsModules->getTH1()->GetXaxis()->FindBin(module);
166  int ibinY = CategoriesVsModules->getTH1()->GetYaxis()->FindBin(category);
167  /*
168  std::cout << "LogMessageMonitor::analyze] ibinX: " << ibinX << " it->second: " << it->second << " it->first: " << it->first << std::endl;
169  std::cout << "LogMessageMonitor::analyze] ibinY: " << ibinY << " (*errors)[i].category: " << (*errors)[i].category << std::endl;
170  size_t nbinsX = CategoriesVsModules->getTH1()->GetNbinsX();
171  for (size_t bin = 1; bin<=nbinsX; bin++) {
172  std::cout << "binX" << bin << ": " << CategoriesVsModules->getTH1()->GetXaxis()->GetBinLabel(bin) << std::endl;
173  }
174  size_t nbinsY = CategoriesVsModules->getTH1()->GetNbinsY();
175  for (size_t bin = 1; bin<=nbinsY; bin++) {
176  std::cout << "binY" << bin << ": " << CategoriesVsModules->getTH1()->GetYaxis()->GetBinLabel(bin) << std::endl;
177  }
178  */
179  if ( ibinY>0 ) {
180  int ncount = CategoriesVsModules->getTH1()->GetBinContent(ibinX,ibinY)+1;
181  CategoriesVsModules->getTH1()->SetBinContent(ibinX,ibinY,ncount);
182  } else {
183  int ncount = CategoriesVsModules->getTH1()->GetBinContent(ibinX,nCategories)+1;
184  CategoriesVsModules->getTH1()->SetBinContent(ibinX,nCategories,ncount);
185  }
186  } else {
187  // IF ONLY WARNING, FILL WARNING HISTS
188  if ( doWarningsPlots_ )
189  if ( doPUmonitoring_ )
190  ModulesWarningsVsBXlumi[it->second]->Fill(BXlumi, (*errors)[i].count);
191  }
192  }
193  }
194  }
195 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * CategoriesVsModules
std::vector< std::string > categories_vector_
std::vector< MonitorElement * > ModulesWarningsVsBXlumi
std::map< std::string, int > modulesMap
std::vector< MonitorElement * > ModulesErrorsVsBXlumi
double getValue(const edm::Event &)
Definition: GetLumi.cc:52
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
TH1 * getTH1(void) const
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: vlib.h:209
void LogMessageMonitor::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 200 of file LogMessageMonitor.cc.

References DQMStore::book2D(), DQMStore::bookProfile(), categories_vector_, CategoriesVsModules, conf_, doPUmonitoring_, doWarningsPlots_, dqmStore_, edm::ParameterSet::getParameter(), histname, i, modules_vector_, ModulesErrorsVsBXlumi, modulesMap, ModulesWarningsVsBXlumi, pluginsMonName_, MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), and DQMStore::setCurrentFolder().

201 {
202  std::string MEFolderName = conf_.getParameter<std::string>("LogFolderName");
203 
204  dqmStore_->setCurrentFolder(MEFolderName);
205 
206  categories_vector_.push_back("others");
207  size_t nModules = modules_vector_.size();
208  size_t nCategories = categories_vector_.size();
209 
210  histname = pluginsMonName_+"ErrorsVsModules";
211  CategoriesVsModules = dqmStore_->book2D(histname, histname, nModules, 0., double(nModules), nCategories, 0., double(nCategories) );
212  CategoriesVsModules->setAxisTitle("modules",1);
213  for (size_t imodule = 0; imodule < nModules; imodule++)
214  CategoriesVsModules->setBinLabel(imodule+1,modules_vector_[imodule],1);
215  CategoriesVsModules->setAxisTitle("categories",2);
216  // CategoriesVsModules->getTH1()->GetXaxis()->LabelsOption("v");
217  for (size_t icategories = 0; icategories < nCategories; icategories++)
218  CategoriesVsModules->setBinLabel(icategories+1,categories_vector_[icategories],2);
219 
220  // MAKE MODULEMAP USING INPUT FROM CFG FILE
221  for (size_t i = 0; i < modules_vector_.size(); i++){
222  modulesMap.insert( std::pair<std::string,int>(modules_vector_[i],i) );
223  }
224 
225  if ( doPUmonitoring_ ) {
226  // BOOK THE HISTOGRAMS
227  // get binning from the configuration
228  edm::ParameterSet BXlumiParameters = conf_.getParameter<edm::ParameterSet>("BXlumiSetup");
229  int BXlumiBin = BXlumiParameters.getParameter<int>("BXlumiBin");
230  double BXlumiMin = BXlumiParameters.getParameter<double>("BXlumiMin");
231  double BXlumiMax = BXlumiParameters.getParameter<double>("BXlumiMax");
232 
233  size_t i = 0;
234  for(std::map<std::string,int>::const_iterator it = modulesMap.begin();
235  it != modulesMap.end(); ++it, i++){
236 
237  dqmStore_->setCurrentFolder(MEFolderName + "/PUmonitoring/Errors");
238 
239  histname = "errorsVsBXlumi_" + it->first;
240  ModulesErrorsVsBXlumi.push_back( dynamic_cast<MonitorElement*>(dqmStore_->bookProfile( histname, histname, BXlumiBin, BXlumiMin, BXlumiMax, 0.,100, "")) );
241  ModulesErrorsVsBXlumi[i] -> setAxisTitle("BXlumi [10^{30} Hz cm^{-2}]", 1);
242  ModulesErrorsVsBXlumi[i] -> setAxisTitle("Mean number of errors", 2);
243 
244  if ( doWarningsPlots_ ) {
245  dqmStore_->setCurrentFolder(MEFolderName + "/PUmonitoring/Warnings");
246 
247  histname = "warningVsBXlumi_" + it->first;
248  ModulesWarningsVsBXlumi.push_back( dynamic_cast<MonitorElement*>(dqmStore_->bookProfile( histname, histname, BXlumiBin, BXlumiMin, BXlumiMax, 0.,100, "")) );
249  ModulesWarningsVsBXlumi[i] -> setAxisTitle("BXlumi [10^{30} Hz cm^{-2}]", 1);
250  ModulesWarningsVsBXlumi[i] -> setAxisTitle("Mean number of warnings", 2);
251  }
252  }
253  }
254 
255 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * CategoriesVsModules
std::vector< std::string > categories_vector_
std::vector< MonitorElement * > ModulesWarningsVsBXlumi
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)
std::map< std::string, int > modulesMap
std::vector< MonitorElement * > ModulesErrorsVsBXlumi
edm::ParameterSet conf_
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
std::vector< std::string > modules_vector_
std::string pluginsMonName_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void LogMessageMonitor::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 285 of file LogMessageMonitor.cc.

286 {
287 }
void LogMessageMonitor::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 272 of file LogMessageMonitor.cc.

References genTriggerEventFlag_, GenericTriggerEventFlag::initRun(), and GenericTriggerEventFlag::on().

273 {
274  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
275 }
GenericTriggerEventFlag * genTriggerEventFlag_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
void LogMessageMonitor::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 259 of file LogMessageMonitor.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), dumpDBToFile_GT_ttrig_cfg::outputFileName, DQMStore::save(), and DQMStore::showDirStructure().

260 {
261  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
262  std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
263  if(outputMEsInRootFile)
264  {
266  dqmStore_->save(outputFileName);
267  }
268 }
T getParameter(std::string const &) const
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
edm::ParameterSet conf_
void showDirStructure(void) const
Definition: DQMStore.cc:2761
void LogMessageMonitor::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 291 of file LogMessageMonitor.cc.

292 {
293 }
void LogMessageMonitor::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 279 of file LogMessageMonitor.cc.

280 {
281 }
void LogMessageMonitor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 297 of file LogMessageMonitor.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

297  {
298  //The following says we do not know what parameters are allowed so do no validation
299  // Please change this to state exactly what you do use, even if it is no parameters
301  desc.setUnknown();
302  descriptions.addDefault(desc);
303 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

std::vector<std::string> LogMessageMonitor::categories_vector_
private

Definition at line 78 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* LogMessageMonitor::CategoriesVsModules
private

Definition at line 87 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

edm::ParameterSet LogMessageMonitor::conf_
private

Definition at line 71 of file LogMessageMonitor.h.

Referenced by beginJob(), and endJob().

bool LogMessageMonitor::doPUmonitoring_
private

Definition at line 90 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

bool LogMessageMonitor::doWarningsPlots_
private

Definition at line 89 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

DQMStore* LogMessageMonitor::dqmStore_
private

Definition at line 70 of file LogMessageMonitor.h.

Referenced by beginJob(), and endJob().

GenericTriggerEventFlag* LogMessageMonitor::genTriggerEventFlag_
private

Definition at line 81 of file LogMessageMonitor.h.

Referenced by analyze(), beginRun(), LogMessageMonitor(), and ~LogMessageMonitor().

std::string LogMessageMonitor::histname
private

Definition at line 68 of file LogMessageMonitor.h.

Referenced by beginJob().

GetLumi* LogMessageMonitor::lumiDetails_
private

Definition at line 80 of file LogMessageMonitor.h.

Referenced by analyze(), and LogMessageMonitor().

std::vector<std::string> LogMessageMonitor::modules_vector_
private

Definition at line 77 of file LogMessageMonitor.h.

Referenced by beginJob().

std::vector<MonitorElement*> LogMessageMonitor::ModulesErrorsVsBXlumi
private

Definition at line 84 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

std::map<std::string,int> LogMessageMonitor::modulesMap
private

Definition at line 73 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

std::vector<MonitorElement*> LogMessageMonitor::ModulesWarningsVsBXlumi
private

Definition at line 85 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

std::string LogMessageMonitor::pluginsMonName_
private

Definition at line 76 of file LogMessageMonitor.h.

Referenced by beginJob().