CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QTestHandle.cc
Go to the documentation of this file.
1 
14 #include "boost/scoped_ptr.hpp"
15 
16 bool firstTime=true;
17 
19 {
23 
24  testsConfigured = false;
25 
26 }
27 
29 {
30  delete qtParser;
31  delete qtConfigurer;
32  delete qtChecker;
33 }
34 
36 {
37  //In case of UseDB==true the configFile is the content of the xml file itself
38  //In case of UseDB==false (default) configFile is just the name of the file
39  if (testsConfigured)
40  qtParser->getNewDocument(configFile,UseDB);
41  else
42  {
43  qtParser->getDocument(configFile,UseDB);
44  testsConfigured=true;
45  }
46 
48  {
49  std::map<std::string, std::map<std::string, std::string> > testsONList
50  = qtParser->testsList();
51 
52  if (qtConfigurer->enableTests(testsONList,bei))
53  return true;
54  }
55  else
56  return true;
57 
58  return false;
59 }
60 
61 
63 {
64 
65  std::map<std::string, std::vector<std::string> > mapMeToTests
67 
68 
69  for (std::map<std::string, std::vector<std::string> >::iterator itr = mapMeToTests.begin();
70  itr != mapMeToTests.end();
71  ++itr)
72  {
73  const std::string &meName = itr->first;
74  const std::vector<std::string> &tests = itr->second;
75 
76  for (std::vector<std::string>::const_iterator testsItr = tests.begin();
77  testsItr != tests.end(); ++testsItr){
78  int cases = bei->useQTestByMatch(meName, *testsItr);
79  if (firstTime && verboseQT && cases == 0)
80  edm::LogWarning ("QTestHandle::attachTests")
81  << " ==>> Invalid qtest xml: Link '"<< meName
82  <<"', QTest '"<< *testsItr << "' - no matching ME! <<== ";
83  }
84  }
85  firstTime = false;
86 }
87 
88 std::pair<std::string,std::string>
90 {
91  return qtChecker->checkGlobalStatus(bei);
92 }
93 
94 std::map< std::string, std::vector<std::string> >
96 {
97  return qtChecker->checkDetailedStatus(bei);
98 }
dictionary tests
Definition: utils_v2.py:385
QTestHandle()
Creator.
Definition: QTestHandle.cc:18
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
std::map< std::string, std::vector< std::string > > checkDetailedQTStatus(DQMStore *bei) const
Checks alarms for single MonitorElements.
Definition: QTestHandle.cc:95
bool parseQTestsConfiguration()
Methor that parses the xml file configFile, returns false if no errors are encountered.
void attachTests(DQMStore *bei, bool verboseQT=true)
Attaches the quality tests to the MonitorElement.
Definition: QTestHandle.cc:62
~QTestHandle()
Destructor.
Definition: QTestHandle.cc:28
std::pair< std::string, std::string > checkGlobalQTStatus(DQMStore *bei) const
Checks global status of Quality Tests.
Definition: QTestHandle.cc:89
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:36
std::map< std::string, std::map< std::string, std::string > > testsList() const
Returns the Quality Tests list with their parameters obtained from the xml file.
bool firstTime
Definition: QTestHandle.cc:16
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:37
void getNewDocument(std::string configFile, bool UseDB=false)
Parses a new Document.
std::map< std::string, std::vector< std::string > > meToTestsList() const
Returns the map between the MonitoElemnt and the list of tests requested for it.
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:38
bool testsConfigured
Definition: QTestHandle.h:39
int useQTestByMatch(const std::string &pattern, const std::string &qtname)
attach quality test &lt;qc&gt; to monitor elements matching &lt;pattern&gt;.
Definition: DQMStore.cc:3276
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 ...
bool configureTests(const std::string &configFile, DQMStore *bei, bool UseDB=false)
Parses Config File and configures the quality tests.
Definition: QTestHandle.cc:35
std::map< std::string, std::vector< std::string > > checkDetailedStatus(DQMStore *bei)
Check status of quality tests for individual ME&#39;s.
bool enableTests(const std::map< std::string, std::map< std::string, std::string > > &tests, DQMStore *bei)
Creates and defines quality tests.