CMS 3D CMS Logo

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 18 of file QTestStatusChecker.h.

Constructor & Destructor Documentation

QTestStatusChecker::QTestStatusChecker ( )

Creator.

Definition at line 12 of file QTestStatusChecker.cc.

12  {
13 
14 }
QTestStatusChecker::~QTestStatusChecker ( )

Destructor.

Definition at line 16 of file QTestStatusChecker.cc.

16  {
17 }

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 43 of file QTestStatusChecker.cc.

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

Referenced by QTestHandle::checkDetailedQTStatus().

43  {
44 
45  std::vector<std::string> allPathNames=this->fullPathNames(bei);
46  detailedWarnings.clear();
47 
48  this->processAlarms(allPathNames,bei);
49  return detailedWarnings;
50 }
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 19 of file QTestStatusChecker.cc.

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

Referenced by QTestHandle::checkGlobalQTStatus().

19  {
20  std::pair<std::string,std::string> statement;
21  int status= bei->getStatus();
22  switch(status){
24  statement.first ="Errors detected in quality tests";
25  statement.second="red";
26  break;
28  statement.first ="Warnings detected in quality tests";
29  statement.second="orange";
30  break;
32  statement.first="Some tests did not run";
33  statement.second="black";
34  break;
35  default:
36  statement.first="No problems detected in quality tests ";
37  statement.second="green";
38  }
39 
40  return statement;
41 }
int getStatus(const std::string &path="") const
Definition: DQMStore.cc:3386
static const int OTHER
static const int WARNING
static const int ERROR
std::vector< std::string > QTestStatusChecker::fullPathNames ( DQMStore bei)

Definition at line 100 of file QTestStatusChecker.cc.

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

Referenced by checkDetailedStatus().

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

Definition at line 53 of file QTestStatusChecker.cc.

References detailedWarnings, DQMStore::get(), MonitorElement::getQErrors(), MonitorElement::getQOthers(), MonitorElement::getQWarnings(), MonitorElement::hasError(), MonitorElement::hasOtherReport(), MonitorElement::hasWarning(), edmIntegrityCheck::report, AlCaHLTBitMon_QueryRunRegistry::string, and RecoTauValidation_cfi::text.

Referenced by checkDetailedStatus().

53  {
54 
55  for(std::vector<std::string>::const_iterator fullMePath=allPathNames.begin();fullMePath!=allPathNames.end(); ++fullMePath ){
56 
57  MonitorElement * me=0;
58  me= bei->get(*fullMePath);
59 
60  if(me){
61  std::vector<QReport *> report;
62  std::string colour;
63 
64  if (me->hasError()){
65  colour="red";
66  report= me->getQErrors();
67  }
68  if( me->hasWarning()){
69  colour="orange";
70  report= me->getQWarnings();
71  }
72  if(me->hasOtherReport()){
73  colour="black";
74  report= me->getQOthers();
75  }
76  for(std::vector<QReport *>::iterator itr=report.begin(); itr!=report.end();++itr ){
77  std::string text= (*fullMePath) + (*itr)->getMessage();
78  std::vector<std::string> messageList;
79 
80  if( detailedWarnings.find(colour) == detailedWarnings.end()){
81 
82  messageList.push_back(text);
83  detailedWarnings[colour]=messageList;
84 
85  }else{
86 
87  messageList=detailedWarnings[colour];
88  messageList.push_back(text);
89  detailedWarnings[colour]=messageList;
90 
91  }
92  }
93 
94  }
95  }
96 
97 }
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
bool hasWarning(void) const
true if at least of one of the quality tests returned a warning
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1788
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 35 of file QTestStatusChecker.h.

Referenced by checkDetailedStatus(), and processAlarms().