CMS 3D CMS Logo

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

#include <QTestHandle.h>

Public Types

typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 

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.

Member Typedef Documentation

Definition at line 22 of file QTestHandle.h.

Definition at line 23 of file QTestHandle.h.

Constructor & Destructor Documentation

QTestHandle::QTestHandle ( )

Creator.

Definition at line 20 of file QTestHandle.cc.

References qtChecker, qtConfigurer, qtParser, and testsConfigured.

20  {
24 
25  testsConfigured = false;
26 }
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:38
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:39
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:40
bool testsConfigured
Definition: QTestHandle.h:41
QTestHandle::~QTestHandle ( )

Destructor.

Definition at line 28 of file QTestHandle.cc.

References qtChecker, qtConfigurer, and qtParser.

28  {
29  delete qtParser;
30  delete qtConfigurer;
31  delete qtChecker;
32 }
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:38
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:39
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:40

Member Function Documentation

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

Attaches the quality tests to the MonitorElement.

Definition at line 55 of file QTestHandle.cc.

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

55  {
56  std::map<std::string, std::vector<std::string> > mapMeToTests = qtParser->meToTestsList();
57 
58  //If firstTime is true, then firstCaller will be true
59  bool expected = true;
60  const bool firstCaller = firstTime.compare_exchange_strong(expected, false);
61 
62  for (std::map<std::string, std::vector<std::string> >::iterator itr = mapMeToTests.begin(); itr != mapMeToTests.end();
63  ++itr) {
64  const std::string &meName = itr->first;
65  const std::vector<std::string> &tests = itr->second;
66 
67  for (std::vector<std::string>::const_iterator testsItr = tests.begin(); testsItr != tests.end(); ++testsItr) {
68  int cases = bei->useQTestByMatch(meName, *testsItr);
69  if (firstCaller && verboseQT && cases == 0)
70  edm::LogWarning("QTestHandle::attachTests")
71  << " ==>> Invalid qtest xml: Link '" << meName << "', QTest '" << *testsItr << "' - no matching ME! <<== ";
72  }
73  }
74 }
QTestConfigurationParser * qtParser
Definition: QTestHandle.h:38
std::map< std::string, std::vector< std::string > > meToTestsList() const
Returns the map between the MonitoElemnt and the list of tests requested for it.
std::map< std::string, std::vector< std::string > > QTestHandle::checkDetailedQTStatus ( DQMStore bei) const

Checks alarms for single MonitorElements.

Definition at line 80 of file QTestHandle.cc.

References QTestStatusChecker::checkDetailedStatus(), and qtChecker.

80  {
81  return qtChecker->checkDetailedStatus(bei);
82 }
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:40
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 76 of file QTestHandle.cc.

References QTestStatusChecker::checkGlobalStatus(), and qtChecker.

76  {
77  return qtChecker->checkGlobalStatus(bei);
78 }
QTestStatusChecker * qtChecker
Definition: QTestHandle.h:40
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 34 of file QTestHandle.cc.

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

34  {
35  //In case of UseDB==true the configFile is the content of the xml file itself
36  //In case of UseDB==false (default) configFile is just the name of the file
37  if (testsConfigured)
38  qtParser->getNewDocument(configFile, UseDB);
39  else {
40  qtParser->getDocument(configFile, UseDB);
41  testsConfigured = true;
42  }
43 
45  std::map<std::string, std::map<std::string, std::string> > testsONList = qtParser->testsList();
46 
47  if (qtConfigurer->enableTests(testsONList, bei))
48  return true;
49  } else
50  return true;
51 
52  return false;
53 }
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: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.
QTestConfigure * qtConfigurer
Definition: QTestHandle.h:39
void getNewDocument(std::string configFile, bool UseDB=false)
Parses a new Document.
bool testsConfigured
Definition: QTestHandle.h:41
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 39 of file QTestHandle.h.

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

QTestConfigurationParser* QTestHandle::qtParser
private

Definition at line 38 of file QTestHandle.h.

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

bool QTestHandle::testsConfigured
private

Definition at line 41 of file QTestHandle.h.

Referenced by configureTests(), and QTestHandle().