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 
16 #include "boost/scoped_ptr.hpp"
17 
18 bool firstTime=true;
19 
21 {
25 
26  testsConfigured = false;
27 
28 }
29 
31 {
32  delete qtParser;
33  delete qtConfigurer;
34  delete qtChecker;
35 }
36 
38 {
39  //In case of UseDB==true the configFile is the content of the xml file itself
40  //In case of UseDB==false (default) configFile is just the name of the file
41  if (testsConfigured)
42  qtParser->getNewDocument(configFile,UseDB);
43  else
44  {
45  qtParser->getDocument(configFile,UseDB);
46  testsConfigured=true;
47  }
48 
50  {
51  std::map<std::string, std::map<std::string, std::string> > testsONList
52  = qtParser->testsList();
53 
54  if (qtConfigurer->enableTests(testsONList,bei))
55  return true;
56  }
57  else
58  return true;
59 
60  return false;
61 }
62 
63 
65 {
66 
67  std::map<std::string, std::vector<std::string> > mapMeToTests
69 
70 
71  for (std::map<std::string, std::vector<std::string> >::iterator itr = mapMeToTests.begin();
72  itr != mapMeToTests.end();
73  ++itr)
74  {
75  const std::string &meName = itr->first;
76  const std::vector<std::string> &tests = itr->second;
77 
78  for (std::vector<std::string>::const_iterator testsItr = tests.begin();
79  testsItr != tests.end(); ++testsItr){
80  int cases = bei->useQTestByMatch(meName, *testsItr);
81  if (firstTime && verboseQT && cases == 0)
82  edm::LogWarning ("QTestHandle::attachTests")
83  << " ==>> Invalid qtest xml: Link '"<< meName
84  <<"', QTest '"<< *testsItr << "' - no matching ME! <<== ";
85  }
86  }
87  firstTime = false;
88 }
89 
90 std::pair<std::string,std::string>
92 {
93  return qtChecker->checkGlobalStatus(bei);
94 }
95 
96 std::map< std::string, std::vector<std::string> >
98 {
99  return qtChecker->checkDetailedStatus(bei);
100 }
dictionary tests
Definition: utils_v2.py:385
QTestHandle()
Creator.
Definition: QTestHandle.cc:20
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:97
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:64
~QTestHandle()
Destructor.
Definition: QTestHandle.cc:30
std::pair< std::string, std::string > checkGlobalQTStatus(DQMStore *bei) const
Checks global status of Quality Tests.
Definition: QTestHandle.cc:91
dictionary map
Definition: Association.py:205
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:38
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:18
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:39
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:40
bool testsConfigured
Definition: QTestHandle.h:41
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:2652
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:37
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.