CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QTestStatusChecker.cc
Go to the documentation of this file.
1 
12 #include <iostream>
13 
15 
16 }
17 
19 }
20 
21 std::pair<std::string,std::string> QTestStatusChecker::checkGlobalStatus(DQMStore * bei){
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 }
44 
45 std::map< std::string, std::vector<std::string> > QTestStatusChecker::checkDetailedStatus(DQMStore * bei){
46 
47  std::vector<std::string> allPathNames=this->fullPathNames(bei);
48  detailedWarnings.clear();
49 
50  this->processAlarms(allPathNames,bei);
51  return detailedWarnings;
52 }
53 
54 
55 void QTestStatusChecker::processAlarms(const std::vector<std::string>& allPathNames, DQMStore * bei){
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 }
100 
101 
102 std::vector<std::string> QTestStatusChecker::fullPathNames(DQMStore * bei){
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 }
int getStatus(const std::string &path="") const
Definition: DQMStore.cc:2708
static const int OTHER
~QTestStatusChecker()
Destructor.
bool hasError(void) const
true if at least of one of the quality tests returned an error
static const int WARNING
std::map< std::string, std::vector< std::string > > detailedWarnings
uint16_t size_type
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
void processAlarms(const std::vector< std::string > &allPathNames, DQMStore *bei)
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< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1502
std::vector< QReport * > getQOthers(void) const
std::vector< std::string > fullPathNames(DQMStore *bei)
bool hasOtherReport(void) const
true if at least of one of the tests returned some other (non-ok) status
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 ...
std::map< std::string, std::vector< std::string > > checkDetailedStatus(DQMStore *bei)
Check status of quality tests for individual ME&#39;s.
std::vector< QReport * > getQWarnings(void) const
get warnings from last set of quality tests
tuple status
Definition: ntuplemaker.py:245
static const int ERROR