CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
QTestHandle Class Reference

#include <QTestHandle.h>

Public Member Functions

void attachTests (DQMStore *bei, bool verboseQT=true)
 Attaches the quality tests to the MonitorElement. More...
 
std::map< std::string, std::vector< std::string > > checkDetailedQTStatus (DQMStore *bei) const
 Checks alarms for single MonitorElements. More...
 
std::pair< std::string, std::string > checkGlobalQTStatus (DQMStore *bei) const
 Checks global status of Quality Tests. More...
 
bool configureTests (const std::string &configFile, DQMStore *bei, bool UseDB=false)
 Parses Config File and configures the quality tests. More...
 
 QTestHandle ()
 Creator. More...
 
 ~QTestHandle ()
 Destructor. More...
 

Private Attributes

QTestStatusCheckerqtChecker
 
QTestConfigureqtConfigurer
 
QTestConfigurationParserqtParser
 
bool testsConfigured
 

Detailed Description

Definition at line 20 of file QTestHandle.h.

Constructor & Destructor Documentation

QTestHandle::QTestHandle ( )

Creator.

Definition at line 21 of file QTestHandle.cc.

References qtChecker, qtConfigurer, qtParser, and testsConfigured.

22 {
26 
27  testsConfigured = false;
28 
29 }
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:36
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:37
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:38
bool testsConfigured
Definition: QTestHandle.h:39
QTestHandle::~QTestHandle ( )

Destructor.

Definition at line 31 of file QTestHandle.cc.

References qtChecker, qtConfigurer, and qtParser.

32 {
33  delete qtParser;
34  delete qtConfigurer;
35  delete qtChecker;
36 }
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:36
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:37
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:38

Member Function Documentation

void QTestHandle::attachTests ( DQMStore bei,
bool  verboseQT = true 
)

Attaches the quality tests to the MonitorElement.

Definition at line 65 of file QTestHandle.cc.

References genParticles_cff::map, QTestConfigurationParser::meToTestsList(), qtParser, AlCaHLTBitMon_QueryRunRegistry::string, utils_v2::tests, and DQMStore::useQTestByMatch().

66 {
67 
68  std::map<std::string, std::vector<std::string> > mapMeToTests
70 
71  //If firstTime is true, then firstCaller will be true
72  bool expected = true;
73  const bool firstCaller = firstTime.compare_exchange_strong(expected,false);
74 
75  for (std::map<std::string, std::vector<std::string> >::iterator itr = mapMeToTests.begin();
76  itr != mapMeToTests.end();
77  ++itr)
78  {
79  const std::string &meName = itr->first;
80  const std::vector<std::string> &tests = itr->second;
81 
82  for (std::vector<std::string>::const_iterator testsItr = tests.begin();
83  testsItr != tests.end(); ++testsItr){
84  int cases = bei->useQTestByMatch(meName, *testsItr);
85  if (firstCaller && verboseQT && cases == 0)
86  edm::LogWarning ("QTestHandle::attachTests")
87  << " ==>> Invalid qtest xml: Link '"<< meName
88  <<"', QTest '"<< *testsItr << "' - no matching ME! <<== ";
89  }
90  }
91 }
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:36
std::map< std::string, std::vector< std::string > > meToTestsList() const
Returns the map between the MonitoElemnt and the list of tests requested for it.
int useQTestByMatch(const std::string &pattern, const std::string &qtname)
attach quality test <qc> to monitor elements matching <pattern>.
Definition: DQMStore.cc:3259
std::map< std::string, std::vector< std::string > > QTestHandle::checkDetailedQTStatus ( DQMStore bei) const

Checks alarms for single MonitorElements.

Definition at line 100 of file QTestHandle.cc.

References QTestStatusChecker::checkDetailedStatus(), and qtChecker.

101 {
102  return qtChecker->checkDetailedStatus(bei);
103 }
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:38
std::map< std::string, std::vector< std::string > > checkDetailedStatus(DQMStore *bei)
Check status of quality tests for individual ME&#39;s.
std::pair< std::string, std::string > QTestHandle::checkGlobalQTStatus ( DQMStore bei) const

Checks global status of Quality Tests.

Definition at line 94 of file QTestHandle.cc.

References QTestStatusChecker::checkGlobalStatus(), and qtChecker.

95 {
96  return qtChecker->checkGlobalStatus(bei);
97 }
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:38
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 QTestHandle::configureTests ( const std::string &  configFile,
DQMStore bei,
bool  UseDB = false 
)

Parses Config File and configures the quality tests.

Definition at line 38 of file QTestHandle.cc.

References QTestConfigure::enableTests(), DQMParserBase::getDocument(), DQMParserBase::getNewDocument(), QTestConfigurationParser::parseQTestsConfiguration(), qtConfigurer, qtParser, testsConfigured, and QTestConfigurationParser::testsList().

39 {
40  //In case of UseDB==true the configFile is the content of the xml file itself
41  //In case of UseDB==false (default) configFile is just the name of the file
42  if (testsConfigured)
43  qtParser->getNewDocument(configFile,UseDB);
44  else
45  {
46  qtParser->getDocument(configFile,UseDB);
47  testsConfigured=true;
48  }
49 
51  {
52  std::map<std::string, std::map<std::string, std::string> > testsONList
53  = qtParser->testsList();
54 
55  if (qtConfigurer->enableTests(testsONList,bei))
56  return true;
57  }
58  else
59  return true;
60 
61  return false;
62 }
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
bool parseQTestsConfiguration()
Methor that parses the xml file configFile, returns false if no errors are encountered.
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.
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:37
void getNewDocument(std::string configFile, bool UseDB=false)
Parses a new Document.
bool testsConfigured
Definition: QTestHandle.h:39
bool enableTests(const std::map< std::string, std::map< std::string, std::string > > &tests, DQMStore *bei)
Creates and defines quality tests.

Member Data Documentation

QTestStatusChecker* QTestHandle::qtChecker
private
QTestConfigure* QTestHandle::qtConfigurer
private

Definition at line 37 of file QTestHandle.h.

Referenced by configureTests(), QTestHandle(), and ~QTestHandle().

QTestConfigurationParser* QTestHandle::qtParser
private

Definition at line 36 of file QTestHandle.h.

Referenced by attachTests(), configureTests(), QTestHandle(), and ~QTestHandle().

bool QTestHandle::testsConfigured
private

Definition at line 39 of file QTestHandle.h.

Referenced by configureTests(), and QTestHandle().