CMS 3D CMS Logo

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

#include <QTestStatusChecker.h>

Public Member Functions

std::map< std::string,
std::vector< std::string > > 
checkDetailedStatus (DQMStore *bei)
 Check status of quality tests for individual ME's. More...
 
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. More...
 
std::vector< std::string > fullPathNames (DQMStore *bei)
 
void processAlarms (const std::vector< std::string > &allPathNames, DQMStore *bei)
 
 QTestStatusChecker ()
 Creator. More...
 
 ~QTestStatusChecker ()
 Destructor. More...
 

Private Attributes

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

Detailed Description

Definition at line 20 of file QTestStatusChecker.h.

Constructor & Destructor Documentation

QTestStatusChecker::QTestStatusChecker ( )

Creator.

Definition at line 14 of file QTestStatusChecker.cc.

14  {
15 
16 }
QTestStatusChecker::~QTestStatusChecker ( )

Destructor.

Definition at line 18 of file QTestStatusChecker.cc.

18  {
19 }

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

45  {
46 
47  std::vector<std::string> allPathNames=this->fullPathNames(bei);
48  detailedWarnings.clear();
49 
50  this->processAlarms(allPathNames,bei);
51  return detailedWarnings;
52 }
std::map< std::string, std::vector< std::string > > detailedWarnings
void processAlarms(const std::vector< std::string > &allPathNames, DQMStore *bei)
std::vector< std::string > fullPathNames(DQMStore *bei)
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().

21  {
22  std::pair<std::string,std::string> statement;
23  int status= bei->getStatus();
24  switch(status){
26  statement.first ="Errors detected in quality tests";
27  statement.second="red";
28  break;
30  statement.first ="Warnings detected in quality tests";
31  statement.second="orange";
32  break;
34  statement.first="Some tests did not run";
35  statement.second="black";
36  break;
37  default:
38  statement.first="No problems detected in quality tests ";
39  statement.second="green";
40  }
41 
42  return statement;
43 }
int getStatus(const std::string &path="") const
Definition: DQMStore.cc:2708
static const int OTHER
static const int WARNING
tuple status
Definition: ntuplemaker.py:245
static const int ERROR
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, DQMStore::getContents(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by checkDetailedStatus().

102  {
103 
104 
105  std::vector<std::string> contents;
106  std::vector<std::string> contentVec;
107  bei->getContents(contentVec);
108  for (std::vector<std::string>::iterator it = contentVec.begin();
109  it != contentVec.end(); it++) {
110 
111  std::string::size_type dirCharNumber = it->find( ":", 0 );
112  std::string dirName=it->substr(0 , dirCharNumber);
113  dirName+= "/";
114  std::string meCollectionName=it->substr(dirCharNumber+1);
115 
116  std::string reminingNames=meCollectionName;
117  bool anotherME=true;
118  while(anotherME){
119  if(reminingNames.find(",") == std::string::npos) anotherME =false;
120  std::string::size_type singleMeNameCharNumber= reminingNames.find( ",", 0 );
121  std::string singleMeName=reminingNames.substr(0 , singleMeNameCharNumber );
122  std::string fullpath=dirName + singleMeName;
123  contents.push_back(fullpath);
124  reminingNames=reminingNames.substr(singleMeNameCharNumber+1);
125  }
126  }
127 
128  return contents;
129 
130 }
uint16_t size_type
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1502
void QTestStatusChecker::processAlarms ( const 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, AlCaHLTBitMon_QueryRunRegistry::string, and runonSM::text.

Referenced by checkDetailedStatus().

55  {
56 
57  for(std::vector<std::string>::const_iterator fullMePath=allPathNames.begin();fullMePath!=allPathNames.end(); ++fullMePath ){
58 
59  MonitorElement * me=0;
60  me= bei->get(*fullMePath);
61 
62  if(me){
63  std::vector<QReport *> report;
64  std::string colour;
65 
66  if (me->hasError()){
67  colour="red";
68  report= me->getQErrors();
69  }
70  if( me->hasWarning()){
71  colour="orange";
72  report= me->getQWarnings();
73  }
74  if(me->hasOtherReport()){
75  colour="black";
76  report= me->getQOthers();
77  }
78  for(std::vector<QReport *>::iterator itr=report.begin(); itr!=report.end();++itr ){
79  std::string text= (*fullMePath) + (*itr)->getMessage();
80  std::vector<std::string> messageList;
81 
82  if( detailedWarnings.find(colour) == detailedWarnings.end()){
83 
84  messageList.push_back(text);
85  detailedWarnings[colour]=messageList;
86 
87  }else{
88 
89  messageList=detailedWarnings[colour];
90  messageList.push_back(text);
91  detailedWarnings[colour]=messageList;
92 
93  }
94  }
95 
96  }
97  }
98 
99 }
bool hasError(void) const
true if at least of one of the quality tests returned an error
std::map< std::string, std::vector< std::string > > detailedWarnings
std::vector< QReport * > getQErrors(void) const
get errors from last set of quality tests
tuple report
Definition: zeeHLT_cff.py:9
bool hasWarning(void) const
true if at least of one of the quality tests returned a warning
tuple text
Definition: runonSM.py:42
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
std::vector< QReport * > getQOthers(void) const
bool hasOtherReport(void) const
true if at least of one of the tests returned some other (non-ok) status
std::vector< QReport * > getQWarnings(void) const
get warnings from last set of quality tests

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