CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DQMMessageLoggerClient Class Reference

#include <DQMMessageLoggerClient.h>

Inheritance diagram for DQMMessageLoggerClient:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DQMMessageLoggerClient (const edm::ParameterSet &)
virtual ~DQMMessageLoggerClient ()

Protected Member Functions

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

Private Member Functions

void fillHistograms ()

Private Attributes

std::vector< Double_t > binContent
std::vector< std::string > binLabel
MonitorElementcategoriesErrorsFound
MonitorElementcategoriesWarningsFound
std::string directoryName
MonitorElementmodulesErrorsFound
MonitorElementmodulesWarningsFound
int nBinsErrors
int nBinsWarnings
edm::ParameterSet parameters
DQMStoretheDbe

Detailed Description

Definition at line 14 of file DQMMessageLoggerClient.h.


Constructor & Destructor Documentation

DQMMessageLoggerClient::DQMMessageLoggerClient ( const edm::ParameterSet ps)
DQMMessageLoggerClient::~DQMMessageLoggerClient ( ) [virtual]

Definition at line 28 of file DQMMessageLoggerClient.cc.

                                                {

}

Member Function Documentation

void DQMMessageLoggerClient::analyze ( const edm::Event e,
const edm::EventSetup context 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 50 of file DQMMessageLoggerClient.cc.

                                                                                     {
}
void DQMMessageLoggerClient::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file DQMMessageLoggerClient.cc.

References NULL, and cppFunctionSkipper::operator.

                                      {

  //LogTrace(metname)<<"[DQMMessageLoggerClient] Parameters initialization";
  theDbe = Service<DQMStore>().operator->();

  if(theDbe!=NULL){   
    theDbe->setCurrentFolder(directoryName);
  }

}
void DQMMessageLoggerClient::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup es 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file DQMMessageLoggerClient.cc.

                                                                                                          {
}
void DQMMessageLoggerClient::beginRun ( const edm::Run r,
const edm::EventSetup es 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file DQMMessageLoggerClient.cc.

                                                                             {
}
void DQMMessageLoggerClient::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file DQMMessageLoggerClient.cc.

                                    {
  
  //LogTrace(metname)<<"[DQMMessageLoggerClient] EndJob";
}
void DQMMessageLoggerClient::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file DQMMessageLoggerClient.cc.

                                                                                                                  {
}
void DQMMessageLoggerClient::endRun ( const edm::Run r,
const edm::EventSetup es 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 201 of file DQMMessageLoggerClient.cc.

References RPCNoise_example::fillHistograms.

void DQMMessageLoggerClient::fillHistograms ( void  ) [private]

Definition at line 59 of file DQMMessageLoggerClient.cc.

References newFWLiteAna::bin, python::tagInventory::entries, MonitorElement::getNbinsX(), MonitorElement::getTH1(), i, and NULL.

                                           {


  // directoryName should be the same as for DQMMessageLogger
  //theDbe->setCurrentFolder(directoryName);
  /*
  cout << theDbe->pwd() << endl;
  vector<string> vec = theDbe->getSubdirs();
  for(int i=0; i<vec.size(); i++){
    cout << vec[i] << endl;
  }
  */
  theDbe->goUp();



  vector<string> entries;
  entries.push_back(directoryName + "/Warnings/modules_warnings");
  entries.push_back(directoryName + "/Errors/modules_errors");
  entries.push_back(directoryName + "/Warnings/categories_warnings");
  entries.push_back(directoryName + "/Errors/categories_errors");
  
  
  int mel = 0;
  
  for(vector<string>::const_iterator ent = entries.begin();
                                      ent != entries.end(); ++ent) {
    mel++;
    //RESET VECTORS
    binContent.clear();
    binLabel.clear();
    

    // RETURN ME
    
   
   MonitorElement *me = theDbe->get(*ent);
    // GET TH1F
   if(theDbe->get(*ent)){
    if (TH1 *rootHisto = me->getTH1()) {
      int nonzeros  = 0;
      int Nbins = me->getNbinsX();
      
      
      // LOOP OVER TH1F
      for(int bin = 1; bin <= Nbins ; ++bin) {
        if( rootHisto->GetBinContent(bin)>0){ 
          nonzeros++;
          binContent.push_back(rootHisto->GetBinContent(bin));
          binLabel.push_back(rootHisto->GetXaxis()->GetBinLabel(bin));
        }
        
      }
      
      switch(mel){
      case 1:
        theDbe->setCurrentFolder(directoryName + "/Warnings");
        modulesWarningsFound = theDbe->get(directoryName + "/Warnings/modulesWarningsFound");
        if (modulesWarningsFound) theDbe->removeElement(modulesWarningsFound->getName());
        if(nonzeros>0){
          modulesWarningsFound = theDbe->book1D("modulesWarningsFound", "Warnings per module", binContent.size(), 0, binContent.size());
        }else{
          modulesWarningsFound = theDbe->book1D("modulesWarningsFound", "Warnings per module", 1, 0, 1);
          modulesWarningsFound->setBinLabel(1,"Module name");
        }
        for (int i=0; i<nonzeros; ++i){
          if(modulesWarningsFound!=NULL){
            //gPad->SetBottomMargin(2);
            //cout << binContent[i] <<" "<<binLabel[i] << endl;
            modulesWarningsFound->setBinContent(i+1,binContent[i]);
            modulesWarningsFound->setBinLabel(i+1,binLabel[i]);
          }
        }
        if(nonzeros>4) modulesWarningsFound->getTH1()->GetXaxis()->LabelsOption("v");
        break;
      case 2:
        theDbe->setCurrentFolder(directoryName + "/Errors");
        modulesErrorsFound = theDbe->get(directoryName + "/Errors/modulesErrorsFound");
        if (modulesErrorsFound) theDbe->removeElement(modulesErrorsFound->getName());
        if(nonzeros>0){
          modulesErrorsFound = theDbe->book1D("modulesErrorsFound", "Errors per module",binContent.size(), 0, binContent.size() );
        }else{
          modulesErrorsFound = theDbe->book1D("modulesErrorsFound", "Errors per module",1, 0, 1 );
          modulesErrorsFound->setBinLabel(1,"Module name");
        }
        for (int i=0; i<nonzeros; ++i){
          if(modulesErrorsFound!=NULL){
            //gPad->SetBottomMargin(2);
            modulesErrorsFound->setBinContent(i+1,binContent[i]);
            modulesErrorsFound->setBinLabel(i+1,binLabel[i]);
          }
        }
        if(nonzeros>4) modulesErrorsFound->getTH1()->GetXaxis()->LabelsOption("v");
        break;
      case 3:
        theDbe->setCurrentFolder(directoryName + "/Warnings");
        categoriesWarningsFound = theDbe->get(directoryName + "/Warnings/categoriesWarningsFound");
        if (categoriesWarningsFound) theDbe->removeElement(categoriesWarningsFound->getName());
        if(nonzeros>0){
          categoriesWarningsFound = theDbe->book1D("categoriesWarningsFound", "Warnings per category", binContent.size(),0,binContent.size());
        } else{
          categoriesWarningsFound = theDbe->book1D("categoriesWarningsFound", "Warnings per category", 1,0,1);
          categoriesWarningsFound->setBinLabel(1,"Category name");
        }
        for (int i=0; i<nonzeros; ++i){
          if(categoriesWarningsFound!=NULL){
            //gPad->SetBottomMargin(2);
            //cout << binContent[i] <<" " <<binLabel[i] << endl;
            categoriesWarningsFound->setBinContent(i+1,binContent[i]);
            categoriesWarningsFound->setBinLabel(i+1,binLabel[i]);
          }
        }
        if(nonzeros>4) categoriesWarningsFound->getTH1()->GetXaxis()->LabelsOption("v");
        break;
      case 4:
        theDbe->setCurrentFolder(directoryName + "/Errors");
        categoriesErrorsFound = theDbe->get(directoryName + "/Errors/categoriesErrorsFound");
        if (categoriesErrorsFound) theDbe->removeElement(categoriesErrorsFound->getName());
        if(nonzeros>0){
          categoriesErrorsFound = theDbe->book1D("categoriesErrorsFound", "Errors per category", binContent.size(),0,binContent.size());
        }else{
          categoriesErrorsFound = theDbe->book1D("categoriesErrorsFound", "Errors per category", 1,0,1);
          categoriesErrorsFound->setBinLabel(1,"Category name");
        }
        for (int i=0; i<nonzeros; ++i){
          if(categoriesErrorsFound!=NULL){
            //gPad->SetBottomMargin(2);
            categoriesErrorsFound->setBinContent(i+1,binContent[i]);
            categoriesErrorsFound->setBinLabel(i+1,binLabel[i]);
          }
        }
        if(nonzeros>4) categoriesErrorsFound->getTH1()->GetXaxis()->LabelsOption("v");
        break;
      }
      
    }
   }
  }
}

Member Data Documentation

std::vector<Double_t> DQMMessageLoggerClient::binContent [private]

Definition at line 50 of file DQMMessageLoggerClient.h.

std::vector<std::string> DQMMessageLoggerClient::binLabel [private]

Definition at line 49 of file DQMMessageLoggerClient.h.

Definition at line 57 of file DQMMessageLoggerClient.h.

Definition at line 58 of file DQMMessageLoggerClient.h.

Definition at line 47 of file DQMMessageLoggerClient.h.

Definition at line 55 of file DQMMessageLoggerClient.h.

Definition at line 56 of file DQMMessageLoggerClient.h.

Definition at line 52 of file DQMMessageLoggerClient.h.

Definition at line 53 of file DQMMessageLoggerClient.h.

Definition at line 46 of file DQMMessageLoggerClient.h.

Definition at line 45 of file DQMMessageLoggerClient.h.