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::map< std::string, int > allmodulesMap
edm::ParameterSet conf_
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

Detailed Description

Description: [one line class summary]

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 44 of file LogMessageMonitor.cc.

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

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

Definition at line 56 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 73 of file LogMessageMonitor.cc.

References GenericTriggerEventFlag::accept(), prof2calltree::count, doWarningsPlots_, benchmark_cfg::errors, HcalObjRepresent::Fill(), genTriggerEventFlag_, edm::Event::getByLabel(), edm::ELseverityLevel::getLevel(), 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 = 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){
    for(size_t i = 0; i < modulesMap.size(); i++) {
      ModulesErrorsVsBXlumi[i] -> Fill(BXlumi,0.);
      if ( doWarningsPlots_ )
        ModulesWarningsVsBXlumi[i] -> Fill(BXlumi,0.);
    }
  } else {
    for( size_t i = 0, n = errors->size();
        i < n ; i++){    
      
      //      std::cout << "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;
      //      std::cout << "s: " << s << std::endl;
      size_t pos = s.find(':');
      std::string s_temp = s.substr(pos+1,s.size());
      std::map<std::string,int>::const_iterator it = modulesMap.find(s_temp);
      //      std::cout << "it: " << " --> " << s_temp << std::endl;
      if (it!=modulesMap.end()){
        // IF THIS IS AN ERROR on the ELseverityLevel SCALE, FILL ERROR HISTS
        if((*errors)[i].severity.getLevel() >= el.getLevel()){
          //      if (categoryECount.size()<=40)
          //        categoryECount[(*errors)[i].category]+=(*errors)[i].count;
          //       std::map<std::string,int>::const_iterator it = modulesMap.find((*errors)[i].category);
          //      std::cout << "it->second: " << it->second << std::endl;
          ModulesErrorsVsBXlumi[it->second]->Fill (BXlumi, (*errors)[i].count);
        } else {
          // IF ONLY WARNING, FILL WARNING HISTS
          if ( doWarningsPlots_ ) 
            ModulesWarningsVsBXlumi[it->second]->Fill(BXlumi, (*errors)[i].count);
        }
      }
    }
  }
}
void LogMessageMonitor::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 130 of file LogMessageMonitor.cc.

References DQMStore::bookProfile(), conf_, doWarningsPlots_, dqmStore_, edm::ParameterSet::getParameter(), histname, i, modules_vector_, ModulesErrorsVsBXlumi, modulesMap, ModulesWarningsVsBXlumi, and DQMStore::setCurrentFolder().

{
   // 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) );
   }

   // 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");
//   int    BXlumiBin   = conf_.getParameter<int>("BXlumiBin");
//   double BXlumiMin   = conf_.getParameter<double>("BXlumiMin");
//   double BXlumiMax   = conf_.getParameter<double>("BXlumiMax");
   
   std::string MEFolderName = conf_.getParameter<std::string>("LogFolderName"); 

   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 199 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 173 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 205 of file LogMessageMonitor.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 193 of file LogMessageMonitor.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 211 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::map<std::string,int> LogMessageMonitor::allmodulesMap [private]

Definition at line 73 of file LogMessageMonitor.h.

Definition at line 71 of file LogMessageMonitor.h.

Referenced by beginJob(), and endJob().

Definition at line 86 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 80 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 79 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 83 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

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

Definition at line 74 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().

Definition at line 84 of file LogMessageMonitor.h.

Referenced by analyze(), and beginJob().