CMS 3D CMS Logo

Public Member Functions | Private Attributes

QTestStatusChecker Class Reference

#include <QTestStatusChecker.h>

List of all members.

Public Member Functions

std::map< std::string,
std::vector< std::string > > 
checkDetailedStatus (DQMStore *bei)
 Check status of quality tests for individual ME's.
std::pair< std::string,
std::string > 
checkGlobalStatus (DQMStore *bei)
 Check global status of Quality tests, returns a pair of string: message and color relative to global status.
std::vector< std::string > fullPathNames (DQMStore *bei)
void processAlarms (std::vector< std::string > allPathNames, DQMStore *bei)
 QTestStatusChecker ()
 Creator.
 ~QTestStatusChecker ()
 Destructor.

Private Attributes

std::map< std::string,
std::vector< std::string > > 
detailedWarnings

Detailed Description

* Class that checks the staus of Quality tests (takes a pointer to the DQMStore) and fills string maps containing the alarms

Date:
2009/11/12 11:24:34
Revision:
1.7
Author:
Ilaria Segoni

Definition at line 20 of file QTestStatusChecker.h.


Constructor & Destructor Documentation

QTestStatusChecker::QTestStatusChecker ( )

Creator.

Definition at line 14 of file QTestStatusChecker.cc.

                                      {

}
QTestStatusChecker::~QTestStatusChecker ( )

Destructor.

Definition at line 18 of file QTestStatusChecker.cc.

                                       {
}

Member Function Documentation

std::map< std::string, std::vector< std::string > > QTestStatusChecker::checkDetailedStatus ( DQMStore bei)

Check status of quality tests for individual ME's.

Definition at line 45 of file QTestStatusChecker.cc.

References detailedWarnings, fullPathNames(), and processAlarms().

Referenced by QTestHandle::checkDetailedQTStatus().

                                                                                               { 
        
        std::vector<std::string> allPathNames=this->fullPathNames(bei); 
        detailedWarnings.clear();

        this->processAlarms(allPathNames,bei);  
        return detailedWarnings;
} 
std::pair< std::string, std::string > QTestStatusChecker::checkGlobalStatus ( DQMStore bei)

Check global status of Quality tests, returns a pair of string: message and color relative to global status.

Definition at line 21 of file QTestStatusChecker.cc.

References dqm::qstatus::ERROR, DQMStore::getStatus(), dqm::qstatus::OTHER, ntuplemaker::status, and dqm::qstatus::WARNING.

Referenced by QTestHandle::checkGlobalQTStatus().

                                                                                {
        std::pair<std::string,std::string> statement;
        int status= bei->getStatus();
        switch(status){
                case dqm::qstatus::ERROR:
                        statement.first ="Errors detected in quality tests";
                        statement.second="red";
                        break;
                case dqm::qstatus::WARNING:
                        statement.first ="Warnings detected in quality tests";
                        statement.second="orange";
                        break;
                case dqm::qstatus::OTHER:
                        statement.first="Some tests did not run";
                        statement.second="black";
                        break; 
                default:
                        statement.first="No problems detected in quality tests ";
                        statement.second="green";
        }

        return statement;
}
std::vector< std::string > QTestStatusChecker::fullPathNames ( DQMStore bei)

Definition at line 102 of file QTestStatusChecker.cc.

References relmon_rootfiles_spy::contents, TrackerOfflineValidation_Dqm_cff::dirName, and DQMStore::getContents().

Referenced by checkDetailedStatus().

                                                                    {


  std::vector<std::string> contents;
  std::vector<std::string> contentVec;
  bei->getContents(contentVec);
  for (std::vector<std::string>::iterator it = contentVec.begin();
       it != contentVec.end(); it++) {
        
        std::string::size_type dirCharNumber = it->find( ":", 0 );
        std::string dirName=it->substr(0 , dirCharNumber);
        dirName+= "/"; 
        std::string meCollectionName=it->substr(dirCharNumber+1);
    
        std::string reminingNames=meCollectionName;
        bool anotherME=true;
        while(anotherME){
                if(reminingNames.find(",") == std::string::npos) anotherME =false;
                std::string::size_type singleMeNameCharNumber= reminingNames.find( ",", 0 );
                std::string singleMeName=reminingNames.substr(0 , singleMeNameCharNumber );
                std::string fullpath=dirName + singleMeName;
                contents.push_back(fullpath);        
                reminingNames=reminingNames.substr(singleMeNameCharNumber+1);    
        }
  }
        
  return contents;      

}
void QTestStatusChecker::processAlarms ( std::vector< std::string >  allPathNames,
DQMStore bei 
)

Definition at line 55 of file QTestStatusChecker.cc.

References detailedWarnings, DQMStore::get(), MonitorElement::getQErrors(), MonitorElement::getQOthers(), MonitorElement::getQWarnings(), MonitorElement::hasError(), MonitorElement::hasOtherReport(), MonitorElement::hasWarning(), zeeHLT_cff::report, and runonSM::text.

Referenced by checkDetailedStatus().

                                                                                       {        
  
 for(std::vector<std::string>::iterator fullMePath=allPathNames.begin();fullMePath!=allPathNames.end(); ++fullMePath ){         
        
        MonitorElement * me=0;  
        me= bei->get(*fullMePath);

        if(me){
                std::vector<QReport *> report;
                std::string colour;

                if (me->hasError()){
                        colour="red";
                        report= me->getQErrors();
                 } 
                 if( me->hasWarning()){ 
                         colour="orange";
                         report= me->getQWarnings();
                 }
                 if(me->hasOtherReport()){
                         colour="black";
                         report= me->getQOthers();
                 }
                 for(std::vector<QReport *>::iterator itr=report.begin(); itr!=report.end();++itr ){
                         std::string text= (*fullMePath) + (*itr)->getMessage();
                         std::vector<std::string> messageList;

                         if( detailedWarnings.find(colour) == detailedWarnings.end()){

                                 messageList.push_back(text);
                                 detailedWarnings[colour]=messageList;

                         }else{

                                 messageList=detailedWarnings[colour];
                                 messageList.push_back(text);
                                 detailedWarnings[colour]=messageList;

                         }      
                 }
                         
         }
 }

}

Member Data Documentation

std::map< std::string, std::vector<std::string> > QTestStatusChecker::detailedWarnings [private]

Definition at line 37 of file QTestStatusChecker.h.

Referenced by checkDetailedStatus(), and processAlarms().