CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 LogMessageMonitor (const edm::ParameterSet &)
 ~LogMessageMonitor ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

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_

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_.

  : dqmStore_( edm::Service<DQMStore>().operator->() )
  , conf_ ( iConfig )
  , pluginsMonName_    ( iConfig.getParameter<std::string>              ("pluginsMonName")  )
  , modules_vector_    ( iConfig.getParameter<std::vector<std::string> >("modules")         )
  , categories_vector_ ( iConfig.getParameter<std::vector<std::string> >("categories")      )
  , doWarningsPlots_   ( iConfig.getParameter<bool>                     ("doWarningsPlots") )
  , doPUmonitoring_    ( iConfig.getParameter<bool>                     ("doPUmonitoring")  ) 
{
   //now do what ever initialization is needed
  lumiDetails_         = new GetLumi( iConfig.getParameter<edm::ParameterSet>("BXlumiSetup") ); 
  genTriggerEventFlag_ = new GenericTriggerEventFlag(iConfig);
}
LogMessageMonitor::~LogMessageMonitor ( )

Definition at line 95 of file LogMessageMonitor.cc.

References genTriggerEventFlag_.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)
  //  if ( lumiDetails_         ) delete lumiDetails_;
  if ( genTriggerEventFlag_ ) delete genTriggerEventFlag_;

}

Member Function Documentation

void LogMessageMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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.

{

  // Filter out events if Trigger Filtering is requested
  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;

  double BXlumi = -1.;
  if ( doPUmonitoring_ )
    lumiDetails_->getValue(iEvent);
  
    // Take the ErrorSummaryEntry container
  edm::Handle<std::vector<edm::ErrorSummaryEntry> >  errors;
  iEvent.getByLabel("logErrorHarvester",errors);
  // Check that errors is valid
  if(!errors.isValid()) return; 
  // Compare severity level of error with ELseveritylevel instance el : "-e" should be the lowest error
  edm::ELseverityLevel el("-e");
  
  // Find the total number of errors in iEvent
  if(errors->size()==0){
    if ( doPUmonitoring_ ) {
      for(size_t i = 0; i < modulesMap.size(); i++) {
        ModulesErrorsVsBXlumi[i] -> Fill(BXlumi,0.);
        if ( doWarningsPlots_ )
          ModulesWarningsVsBXlumi[i] -> Fill(BXlumi,0.);
      }
    }
  } else {

    size_t nCategories = categories_vector_.size();

    for( size_t i = 0, n = errors->size(); i < n ; i++){    
      
      //      std::cout << "LogMessageMonitor::analyze] Severity for error/warning: " << (*errors)[i].severity << " " <<(*errors)[i].module  << std::endl;
      // remove the first part of the module string, what is before ":"
      std::string s = (*errors)[i].module;
      size_t pos = s.find(':');
      std::string s_module = s.substr(pos+1,s.size());
      std::map<std::string,int>::const_iterator it = modulesMap.find(s_module);
      if (it!=modulesMap.end()){
        //      std::cout << "LogMessageMonitor::analyze] it: " << " --> " << s_module << std::endl;

        // IF THIS IS AN ERROR on the ELseverityLevel SCALE, FILL ERROR HISTS
        if((*errors)[i].severity.getLevel() >= edm::ELseverityLevel::ELsev_error) {
          if ( doPUmonitoring_ )
            ModulesErrorsVsBXlumi[it->second]->Fill (BXlumi, (*errors)[i].count);

          // loop over the different categories of errors
          // defined by configuration file
          // if the category is not in the given list
          // it fills the bin "others"
          TString module = it->first;
          TString category = (*errors)[i].category;
          int ibinX = CategoriesVsModules->getTH1()->GetXaxis()->FindBin(module);
          int ibinY = CategoriesVsModules->getTH1()->GetYaxis()->FindBin(category);
          /*
          std::cout << "LogMessageMonitor::analyze] ibinX: " << ibinX << " it->second: " << it->second << " it->first: " << it->first << std::endl;
          std::cout << "LogMessageMonitor::analyze] ibinY: " << ibinY << " (*errors)[i].category: " << (*errors)[i].category << std::endl;
          size_t nbinsX = CategoriesVsModules->getTH1()->GetNbinsX();
          for (size_t bin = 1; bin<=nbinsX; bin++) {
            std::cout << "binX" << bin << ": " << CategoriesVsModules->getTH1()->GetXaxis()->GetBinLabel(bin) << std::endl;
          }
          size_t nbinsY = CategoriesVsModules->getTH1()->GetNbinsY();
          for (size_t bin = 1; bin<=nbinsY; bin++) {
            std::cout << "binY" << bin << ": " << CategoriesVsModules->getTH1()->GetYaxis()->GetBinLabel(bin) << std::endl;
          }
          */
          if ( ibinY>0 ) {
            int ncount = CategoriesVsModules->getTH1()->GetBinContent(ibinX,ibinY)+1;
            CategoriesVsModules->getTH1()->SetBinContent(ibinX,ibinY,ncount);
          } else {
            int ncount = CategoriesVsModules->getTH1()->GetBinContent(ibinX,nCategories)+1;
            CategoriesVsModules->getTH1()->SetBinContent(ibinX,nCategories,ncount);               
          }
        } else {
          // IF ONLY WARNING, FILL WARNING HISTS
          if ( doWarningsPlots_ ) 
            if ( doPUmonitoring_ )
              ModulesWarningsVsBXlumi[it->second]->Fill(BXlumi, (*errors)[i].count);
        }
      }
    }
  }
}
void LogMessageMonitor::beginJob ( void  ) [private, virtual]

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().

{
   std::string MEFolderName = conf_.getParameter<std::string>("LogFolderName"); 

   dqmStore_->setCurrentFolder(MEFolderName);

   categories_vector_.push_back("others");
   size_t nModules    = modules_vector_.size();
   size_t nCategories = categories_vector_.size();

   histname = pluginsMonName_+"ErrorsVsModules";
   CategoriesVsModules = dqmStore_->book2D(histname, histname, nModules, 0., double(nModules), nCategories, 0., double(nCategories) );
   CategoriesVsModules->setAxisTitle("modules",1);
   for (size_t imodule = 0; imodule < nModules; imodule++)
     CategoriesVsModules->setBinLabel(imodule+1,modules_vector_[imodule],1);
   CategoriesVsModules->setAxisTitle("categories",2);
   //   CategoriesVsModules->getTH1()->GetXaxis()->LabelsOption("v");
   for (size_t icategories = 0; icategories < nCategories; icategories++)
     CategoriesVsModules->setBinLabel(icategories+1,categories_vector_[icategories],2);
   
   // MAKE MODULEMAP USING INPUT FROM CFG FILE
   for (size_t i = 0; i < modules_vector_.size(); i++){
     modulesMap.insert( std::pair<std::string,int>(modules_vector_[i],i) );
   }

   if ( doPUmonitoring_ ) {
     // BOOK THE HISTOGRAMS
     // get binning from the configuration
     edm::ParameterSet BXlumiParameters = conf_.getParameter<edm::ParameterSet>("BXlumiSetup");
     int    BXlumiBin   = BXlumiParameters.getParameter<int>("BXlumiBin");
     double BXlumiMin   = BXlumiParameters.getParameter<double>("BXlumiMin");
     double BXlumiMax   = BXlumiParameters.getParameter<double>("BXlumiMax");
   
     size_t i = 0;
     for(std::map<std::string,int>::const_iterator it = modulesMap.begin();
         it != modulesMap.end(); ++it, i++){ 
       
       dqmStore_->setCurrentFolder(MEFolderName + "/PUmonitoring/Errors");      
       
       histname = "errorsVsBXlumi_" + it->first;
       ModulesErrorsVsBXlumi.push_back( dynamic_cast<MonitorElement*>(dqmStore_->bookProfile( histname, histname, BXlumiBin, BXlumiMin, BXlumiMax, 0.,100, "")) );
       ModulesErrorsVsBXlumi[i] -> setAxisTitle("BXlumi [10^{30} Hz cm^{-2}]", 1);
       ModulesErrorsVsBXlumi[i] -> setAxisTitle("Mean number of errors", 2);
       
       if ( doWarningsPlots_ ) {
         dqmStore_->setCurrentFolder(MEFolderName + "/PUmonitoring/Warnings");      
         
         histname = "warningVsBXlumi_" + it->first;
         ModulesWarningsVsBXlumi.push_back( dynamic_cast<MonitorElement*>(dqmStore_->bookProfile( histname, histname, BXlumiBin, BXlumiMin, BXlumiMax, 0.,100, "")) );
         ModulesWarningsVsBXlumi[i] -> setAxisTitle("BXlumi [10^{30} Hz cm^{-2}]", 1);
         ModulesWarningsVsBXlumi[i] -> setAxisTitle("Mean number of warnings", 2);
       }
     }   
   }

}
void LogMessageMonitor::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 285 of file LogMessageMonitor.cc.

{
}
void LogMessageMonitor::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
) [private, virtual]
void LogMessageMonitor::endJob ( void  ) [private, virtual]

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().

{
    bool outputMEsInRootFile   = conf_.getParameter<bool>("OutputMEsInRootFile");
    std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
    if(outputMEsInRootFile)
    {
        dqmStore_->showDirStructure();
        dqmStore_->save(outputFileName);
    }
}
void LogMessageMonitor::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 291 of file LogMessageMonitor.cc.

{
}
void LogMessageMonitor::endRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 279 of file LogMessageMonitor.cc.

{
}
void LogMessageMonitor::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 297 of file LogMessageMonitor.cc.

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

                                                                              {
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown();
  descriptions.addDefault(desc);
}

Member Data Documentation

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

Definition at line 78 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

Definition at line 87 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

Definition at line 71 of file LogMessageMonitor.h.

Referenced by beginJob(), and endJob().

Definition at line 90 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

Definition at line 89 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

Definition at line 70 of file LogMessageMonitor.h.

Referenced by beginJob(), and endJob().

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().

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().

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().

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().