diff --git a/DQMServices/ClientConfig/interface/QTestConfigurationParser.h b/DQMServices/ClientConfig/interface/QTestConfigurationParser.h deleted file mode 100644 index 47ded7ed6c349..0000000000000 --- a/DQMServices/ClientConfig/interface/QTestConfigurationParser.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef QTestConfigurationParser_H -#define QTestConfigurationParser_H - -/** \class QTestConfigurationParser - * * - * Parses the xml file with the configuration of quality tests - * and the map between quality tests and MonitorElement - * - * \author Ilaria Segoni - */ - -#include "DQMServices/ClientConfig/interface/DQMParserBase.h" - -#include -#include -#include -#include - -class QTestParameterNames; - -class QTestConfigurationParser : public DQMParserBase { -public: - ///Creator - QTestConfigurationParser(); - ///Destructor - ~QTestConfigurationParser() override; - ///Methor that parses the xml file configFile, returns false if no errors are encountered - bool parseQTestsConfiguration(); - /// Returns the Quality Tests list with their parameters obtained from the xml file - std::map > testsList() const { return testsRequested; } - /// Returns the map between the MonitoElemnt and the list of tests requested for it - std::map > meToTestsList() const { return mapMonitorElementTests; } - -private: - bool qtestsConfig(); - bool monitorElementTestsMap(); - std::map getParams(xercesc::DOMElement* qtestElement, std::string test); - int instances() { return s_numberOfInstances; } - bool checkParameters(std::string qtestName, std::string qtestType); - -private: - static int s_numberOfInstances; - - std::map > testsRequested; - std::map > mapMonitorElementTests; - std::vector testsToDisable; - - QTestParameterNames* qtestParamNames; -}; - -#endif diff --git a/DQMServices/ClientConfig/interface/QTestConfigure.h b/DQMServices/ClientConfig/interface/QTestConfigure.h deleted file mode 100644 index dbbfbf5be40dc..0000000000000 --- a/DQMServices/ClientConfig/interface/QTestConfigure.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef QTestConfigure_H -#define QTestConfigure_H - -/** \class QTestConfigure - * * - * Class that creates and defined quality tests based on - * the xml configuration file parsed by QTestConfigurationParser. - * - * - * \author Ilaria Segoni - */ - -#include "DQMServices/Core/interface/DQMStore.h" - -#include -#include -#include - -class QTestConfigure { -public: - typedef dqm::harvesting::DQMStore DQMStore; - typedef dqm::harvesting::MonitorElement MonitorElement; - - ///Constructor - QTestConfigure() {} - ///Destructor - ~QTestConfigure() {} - ///Creates and defines quality tests - bool enableTests(const std::map >& tests, DQMStore* bei); - ///Disables the Quality Tests in the string list - void disableTests(const std::vector& testsOFFList, DQMStore* bei); - ///Returns the vector containing the names of the quality tests that have been created - std::vector testsReady() { return testsConfigured; } - -private: - ///Creates ContentsXRangeROOT test - void EnableXRangeTest(std::string testName, const std::map& params, DQMStore* bei); - ///Creates ContentsXRangeASROOT test - // void EnableXRangeASTest(std::string testName, - // std::mapparams,DQMStore * bei); - ///Creates ContentsYRangeROOT test - void EnableYRangeTest(std::string testName, const std::map& params, DQMStore* bei); - ///Creates ContentsYRangeASROOT test - // void EnableYRangeASTest(std::string testName, - // std::mapparams,DQMStore * bei); - ///Creates DeadChannelROOT test - void EnableDeadChannelTest(std::string testName, const std::map& params, DQMStore* bei); - ///Creates NoisyChannelROOT test - void EnableNoisyChannelTest(std::string testName, const std::map& params, DQMStore* bei); - ///Creates ContentSigmaROOT test - void EnableContentSigmaTest(std::string testName, const std::map& params, DQMStore* bei); - ///Creates MeanWithinExpectedROOT test - void EnableMeanWithinExpectedTest(std::string testName, - const std::map& params, - DQMStore* bei); - - //===================== new quality tests in the parser =============================// - /// Creates ContentsWithinRangeROOT test - void EnableContentsWithinExpectedTest(std::string testName, - const std::map& params, - DQMStore* bei); - - /// Creates ContentsWithinRangeROOT test - // void EnableContentsWithinExpectedASTest(std::string testName, - // std::map params,DQMStore * bei); - - ///Creates CompareToMedian test - void EnableCompareToMedianTest(std::string testName, const std::map& params, DQMStore* bei); - - ///Creates EnableCompareLastFilledBinTest test - void EnableCompareLastFilledBinTest(std::string testName, - const std::map& params, - DQMStore* bei); - - ///Creates CheckVariance test - void EnableCheckVarianceTest(std::string testName, const std::map& params, DQMStore* bei); - - const char* findOrDefault(const std::map&, const char*, const char*) const; - -private: - std::vector testsConfigured; -}; - -#endif diff --git a/DQMServices/ClientConfig/interface/QTestHandle.h b/DQMServices/ClientConfig/interface/QTestHandle.h deleted file mode 100644 index 003e3bebc7ac0..0000000000000 --- a/DQMServices/ClientConfig/interface/QTestHandle.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef QTestHandle_H -#define QTestHandle_H - -/** \class QTestHandle - * * - * Handles quality tests (configuring, attaching to ME's, - * - * \author Ilaria Segoni - */ - -#include "DQMServices/Core/interface/DQMStore.h" -#include -#include -#include - -class QTestConfigurationParser; -class QTestConfigure; -class QTestStatusChecker; - -class QTestHandle { -public: - typedef dqm::harvesting::DQMStore DQMStore; - typedef dqm::harvesting::MonitorElement MonitorElement; - ///Creator - QTestHandle(); - ///Destructor - ~QTestHandle(); - ///Parses Config File and configures the quality tests - bool configureTests(const std::string &configFile, DQMStore *bei, bool UseDB = false); - ///Attaches the quality tests to the MonitorElement - void attachTests(DQMStore *bei, bool verboseQT = true); - ///Checks global status of Quality Tests - std::pair checkGlobalQTStatus(DQMStore *bei) const; - ///Checks alarms for single MonitorElements - std::map > checkDetailedQTStatus(DQMStore *bei) const; - -private: - QTestConfigurationParser *qtParser; - QTestConfigure *qtConfigurer; - QTestStatusChecker *qtChecker; - bool testsConfigured; -}; - -#endif diff --git a/DQMServices/ClientConfig/interface/QTestParameterNames.h b/DQMServices/ClientConfig/interface/QTestParameterNames.h deleted file mode 100644 index d4d2f20adc539..0000000000000 --- a/DQMServices/ClientConfig/interface/QTestParameterNames.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef QTestParameterNames_H -#define QTestParameterNames_H - -/** \class QTestParameterNames - * * - * Defines name and number of parameters that must be specified in the - * xml configuration file for each quality test besides error and warning thresholds. - * It's used by QTestConfigurationPerser - * to check that all necessary parameters are defined. - * - * \author Ilaria Segoni - */ - -#include -#include -#include - -class QTestParameterNames { -public: - ///Constructor - QTestParameterNames(); - ///Destructor - ~QTestParameterNames() {} - ///returns the list of parameters used by the test of a given type (the string theTestType - ///must be one of the names defined in DQMServices/ClientConfig/interface/DQMQualityTestsConfiguration.h - std::vector getTestParamNames(std::string theTestType); - -private: - void constructMap(std::string testType, - std::string param1 = "undefined", - std::string param2 = "undefined", - std::string param3 = "undefined", - std::string param4 = "undefined", - std::string param5 = "undefined", - std::string param6 = "undefined", - std::string param7 = "undefined", - std::string param8 = "undefined"); - -private: - std::map > configurationMap; -}; - -#endif diff --git a/DQMServices/ClientConfig/interface/QTestStatusChecker.h b/DQMServices/ClientConfig/interface/QTestStatusChecker.h deleted file mode 100644 index aee052dbc3be8..0000000000000 --- a/DQMServices/ClientConfig/interface/QTestStatusChecker.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef QTestStatusChecker_H -#define QTestStatusChecker_H - -/** \class QTestStatusChecker - * * - * Class that checks the staus of Quality tests (takes a pointer to the - * DQMStore) and fills string maps containing the alarms - * - * - * \author Ilaria Segoni - */ - -#include "DQMServices/Core/interface/DQMStore.h" -#include -#include -#include - -class QTestStatusChecker { - typedef dqm::harvesting::DQMStore DQMStore; - typedef dqm::harvesting::MonitorElement MonitorElement; - -public: - ///Creator - QTestStatusChecker(); - ///Destructor - ~QTestStatusChecker(); - /// Check global status of Quality tests, returns a pair of string: message and color relative to global status - std::pair checkGlobalStatus(DQMStore* bei); - /// Check status of quality tests for individual ME's - std::map > checkDetailedStatus(DQMStore* bei); - - std::vector fullPathNames(DQMStore* bei); - void processAlarms(const std::vector& allPathNames, DQMStore* bei); - -private: - std::map > detailedWarnings; -}; - -#endif diff --git a/DQMServices/ClientConfig/src/QTestConfigurationParser.cc b/DQMServices/ClientConfig/src/QTestConfigurationParser.cc deleted file mode 100644 index 7c9c953892bcc..0000000000000 --- a/DQMServices/ClientConfig/src/QTestConfigurationParser.cc +++ /dev/null @@ -1,189 +0,0 @@ -#include "DQMServices/ClientConfig/interface/QTestConfigurationParser.h" -#include "DQMServices/ClientConfig/interface/QTestParameterNames.h" -#include "DQMServices/ClientConfig/interface/ParserFunctions.h" -#include -#include -/** \file - * - * Implementation of QTestConfigurationParser - * - * \author Ilaria Segoni - */ -using namespace xercesc; - -int QTestConfigurationParser::s_numberOfInstances = 0; - -QTestConfigurationParser::QTestConfigurationParser() { - qtestParamNames = new QTestParameterNames(); - - try { - if (s_numberOfInstances == 0) - cms::concurrency::xercesInitialize(); - } catch (const XMLException &e) { - throw(std::runtime_error("Standard pool exception : Fatal Error on pool::TrivialFileCatalog")); - } - - ++s_numberOfInstances; -} - -QTestConfigurationParser::~QTestConfigurationParser() { - delete qtestParamNames; - qtestParamNames = nullptr; -} - -bool QTestConfigurationParser::parseQTestsConfiguration() { - testsToDisable.clear(); - testsRequested.clear(); - mapMonitorElementTests.clear(); - bool qtErrors = this->qtestsConfig(); - bool meErrors = this->monitorElementTestsMap(); - return (qtErrors || meErrors); -} - -bool QTestConfigurationParser::qtestsConfig() { - std::string testActivationOFF = "false"; - - unsigned int qtestTagsNum = doc()->getElementsByTagName(qtxml::_toDOMS("QTEST"))->getLength(); - - for (unsigned int i = 0; i < qtestTagsNum; ++i) { - /// Get Node - DOMNode *qtestNode = doc()->getElementsByTagName(qtxml::_toDOMS("QTEST"))->item(i); - - ///Get QTEST name - if (!qtestNode) { - return true; - } - DOMElement *qtestElement = static_cast(qtestNode); - if (!qtestElement) { - return true; - } - std::string qtestName = qtxml::_toString(qtestElement->getAttribute(qtxml::_toDOMS("name"))); - std::string activate = qtxml::_toString(qtestElement->getAttribute(qtxml::_toDOMS("activate"))); - if (!std::strcmp(activate.c_str(), testActivationOFF.c_str())) { - testsToDisable.push_back(qtestName); - } else { - ///Get Qtest TYPE - DOMNodeList *typeNodePrefix = qtestElement->getElementsByTagName(qtxml::_toDOMS("TYPE")); - - if (typeNodePrefix->getLength() != 1) - return true; - - DOMElement *prefixNode = dynamic_cast(typeNodePrefix->item(0)); - if (!prefixNode) - return true; - - DOMText *prefixText = dynamic_cast(prefixNode->getFirstChild()); - if (!prefixText) - return true; - - std::string qtestType = qtxml::_toString(prefixText->getData()); - - testsRequested[qtestName] = this->getParams(qtestElement, qtestType); - - if (this->checkParameters(qtestName, qtestType)) - return true; - } - - } //loop on qtestTagsNum - - return false; -} - -std::map QTestConfigurationParser::getParams(DOMElement *qtestElement, - std::string qtestType) { - std::map paramNamesValues; - paramNamesValues["type"] = qtestType; - - DOMNodeList *arguments = qtestElement->getElementsByTagName(qtxml::_toDOMS("PARAM")); - - for (unsigned int i = 0; i < arguments->getLength(); ++i) { - DOMElement *argNode = dynamic_cast(arguments->item(i)); - std::string regExp = qtxml::_toString(argNode->getAttribute(qtxml::_toDOMS("name"))); - DOMText *argText = dynamic_cast(argNode->getFirstChild()); - if (!argText) { - break; - } - - std::string regExpValue = qtxml::_toString(argText->getData()); - paramNamesValues[regExp] = regExpValue; - } - - return paramNamesValues; -} - -bool QTestConfigurationParser::checkParameters(std::string qtestName, std::string qtestType) { - std::vector paramNames = qtestParamNames->getTestParamNames(qtestType); - // commenting out as does not seem to be logical SDutta 22/3/2013 - /*if(paramNames.size() == 0) { - - return true; - }*/ - - paramNames.push_back("error"); - paramNames.push_back("warning"); - - std::map namesMap = testsRequested[qtestName]; - - for (std::vector::iterator namesItr = paramNames.begin(); namesItr != paramNames.end(); ++namesItr) { - if (namesMap.find(*namesItr) == namesMap.end()) { - return true; - } - } - - return false; -} - -bool QTestConfigurationParser::monitorElementTestsMap() { - std::string testON = "true"; - std::string testOFF = "false"; - - unsigned int linkTagsNum = doc()->getElementsByTagName(qtxml::_toDOMS("LINK"))->getLength(); - - for (unsigned int i = 0; i < linkTagsNum; ++i) { - DOMNode *linkNode = doc()->getElementsByTagName(qtxml::_toDOMS("LINK"))->item(i); - ///Get ME name - if (!linkNode) { - return true; - } - DOMElement *linkElement = static_cast(linkNode); - if (!linkElement) { - return true; - } - std::string linkName = qtxml::_toString(linkElement->getAttribute(qtxml::_toDOMS("name"))); - - DOMNodeList *testList = linkElement->getElementsByTagName(qtxml::_toDOMS("TestName")); - unsigned int numberOfTests = testList->getLength(); - - std::vector qualityTestList; - for (unsigned int tt = 0; tt < numberOfTests; ++tt) { - DOMElement *testElement = dynamic_cast(testList->item(tt)); - if (!testElement) { - return true; - } - - std::string activate = qtxml::_toString(testElement->getAttribute(qtxml::_toDOMS("activate"))); - - DOMText *argText = dynamic_cast(testElement->getFirstChild()); - - if (!std::strcmp(activate.c_str(), testON.c_str())) { - if (!argText) { - return true; - } else { - std::string regExpValue = qtxml::_toString(argText->getData()); - qualityTestList.push_back(regExpValue); - } - } - if (!std::strcmp(activate.c_str(), testOFF.c_str())) { - if (argText) { - std::string regExpValue = qtxml::_toString(argText->getData()); - // Create List of QTests to unattach from current ME - } - } - } - - if (!qualityTestList.empty()) - mapMonitorElementTests[linkName] = qualityTestList; - } ///Loop on linkTagsNum - - return false; -} diff --git a/DQMServices/ClientConfig/src/QTestConfigure.cc b/DQMServices/ClientConfig/src/QTestConfigure.cc deleted file mode 100644 index 1028abbd0cea2..0000000000000 --- a/DQMServices/ClientConfig/src/QTestConfigure.cc +++ /dev/null @@ -1,382 +0,0 @@ -/** \file - * - * Implementation of QTestConfigure - * - * \author Ilaria Segoni - */ -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DQMServices/ClientConfig/interface/QTestConfigure.h" -#include "DQMServices/Core/interface/QTest.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include -#include - -const char *QTestConfigure::findOrDefault(const std::map &m, - const char *item, - const char *default_value) const { - std::map::const_iterator iter; - if ((iter = m.find(std::string(item))) != m.end()) { - return (*iter).second.c_str(); - } - LogDebug("QTestConfigure") << "Warning, using default value for parameter " << item - << " with default_value: " << default_value << std::endl; - return default_value; -} - -bool QTestConfigure::enableTests(const std::map > &tests, - DQMStore *bei) { - testsConfigured.clear(); - std::map >::const_iterator itr; - for (itr = tests.begin(); itr != tests.end(); ++itr) { - const std::map ¶ms = itr->second; - - std::string testName = itr->first; - std::string testType = params.at("type"); - - if (!std::strcmp(testType.c_str(), ContentsXRange::getAlgoName().c_str())) - this->EnableXRangeTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), ContentsYRange::getAlgoName().c_str())) - this->EnableYRangeTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), DeadChannel::getAlgoName().c_str())) - this->EnableDeadChannelTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), NoisyChannel::getAlgoName().c_str())) - this->EnableNoisyChannelTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), ContentSigma::getAlgoName().c_str())) - this->EnableContentSigmaTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), MeanWithinExpected::getAlgoName().c_str())) - this->EnableMeanWithinExpectedTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), ContentsWithinExpected::getAlgoName().c_str())) - this->EnableContentsWithinExpectedTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), CompareToMedian::getAlgoName().c_str())) - this->EnableCompareToMedianTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), CompareLastFilledBin::getAlgoName().c_str())) - this->EnableCompareLastFilledBinTest(testName, params, bei); - if (!std::strcmp(testType.c_str(), CheckVariance::getAlgoName().c_str())) - this->EnableCheckVarianceTest(testName, params, bei); - } - return false; -} - -void QTestConfigure::EnableXRangeTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(ContentsXRange::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - ContentsXRange *me_qc1 = (ContentsXRange *)qc1; - double xmin = atof(findOrDefault(params, "xmin", "0")); - double xmax = atof(findOrDefault(params, "xmax", "0")); - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - me_qc1->setAllowedXRange(xmin, xmax); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); -} - -void QTestConfigure::EnableYRangeTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(ContentsYRange::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - ContentsYRange *me_qc1 = (ContentsYRange *)qc1; - double ymin = atof(findOrDefault(params, "ymin", "0")); - double ymax = atof(findOrDefault(params, "ymax", "0")); - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - unsigned int useEmptyBins = (unsigned int)atof(findOrDefault(params, "useEmptyBins", "0")); - me_qc1->setAllowedYRange(ymin, ymax); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); - me_qc1->setUseEmptyBins(useEmptyBins); -} - -void QTestConfigure::EnableDeadChannelTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(DeadChannel::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - DeadChannel *me_qc1 = (DeadChannel *)qc1; - unsigned int threshold = (unsigned int)atof(findOrDefault(params, "threshold", "0")); - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - me_qc1->setThreshold(threshold); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); -} - -void QTestConfigure::EnableNoisyChannelTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(NoisyChannel::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - NoisyChannel *me_qc1 = (NoisyChannel *)qc1; - unsigned int neighbors = (unsigned int)atof(findOrDefault(params, "neighbours", "0")); - double tolerance = atof(findOrDefault(params, "tolerance", "0")); - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - me_qc1->setNumNeighbors(neighbors); - me_qc1->setTolerance(tolerance); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); -} - -//================ContentSigma (Emma Yeager and Chad Freer)=====================// -void QTestConfigure::EnableContentSigmaTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(ContentSigma::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - ContentSigma *me_qc1 = (ContentSigma *)qc1; - unsigned int Xblocks = (unsigned int)atof(findOrDefault(params, "Xblocks", "0")); - unsigned int Yblocks = (unsigned int)atof(findOrDefault(params, "Yblocks", "0")); - unsigned int neighborsX = (unsigned int)atof(findOrDefault(params, "neighboursX", "0")); - unsigned int neighborsY = (unsigned int)atof(findOrDefault(params, "neighboursY", "0")); - double toleranceNoisy = atof(findOrDefault(params, "toleranceNoisy", "0")); - double toleranceDead = atof(findOrDefault(params, "toleranceDead", "0")); - int noisy = atoi(findOrDefault(params, "noisy", "0")); - int dead = atoi(findOrDefault(params, "dead", "0")); - unsigned int xMin = (unsigned int)atof(findOrDefault(params, "xMin", "1")); - unsigned int xMax = (unsigned int)atof(findOrDefault(params, "xMax", "500")); - unsigned int yMin = (unsigned int)atof(findOrDefault(params, "yMin", "1")); - unsigned int yMax = (unsigned int)atof(findOrDefault(params, "yMax", "500")); - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - me_qc1->setNumXblocks(Xblocks); - me_qc1->setNumYblocks(Yblocks); - me_qc1->setNumNeighborsX(neighborsX); - me_qc1->setNumNeighborsY(neighborsY); - me_qc1->setToleranceNoisy(toleranceNoisy); - me_qc1->setToleranceDead(toleranceDead); - me_qc1->setNoisy(noisy); - me_qc1->setDead(dead); - me_qc1->setXMin(xMin); - me_qc1->setXMax(xMax); - me_qc1->setYMin(yMin); - me_qc1->setYMax(yMax); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); -} - -//==========================================================================// - -void QTestConfigure::EnableMeanWithinExpectedTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(MeanWithinExpected::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - MeanWithinExpected *me_qc1 = (MeanWithinExpected *)qc1; - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - double mean = atof(findOrDefault(params, "mean", "0")); - int minEntries = atoi(findOrDefault(params, "minEntries", "0")); - double useRMSVal = atof(findOrDefault(params, "useRMS", "0")); - double useSigmaVal = atof(findOrDefault(params, "useSigma", "0")); - double useRangeVal = atof(findOrDefault(params, "useRange", "0")); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); - me_qc1->setExpectedMean(mean); - - if (minEntries != 0) - me_qc1->setMinimumEntries(minEntries); - - if (useRMSVal && useSigmaVal && useRangeVal) - return; - - if (useRMSVal) { - me_qc1->useRMS(); - return; - } - - if (useSigmaVal) { - me_qc1->useSigma(useSigmaVal); - return; - } - - if (useRangeVal) { - float xmin = atof(findOrDefault(params, "xmin", "0")); - float xmax = atof(findOrDefault(params, "xmax", "0")); - me_qc1->useRange(xmin, xmax); - return; - } -} - -void QTestConfigure::EnableCompareToMedianTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(CompareToMedian::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - CompareToMedian *vtm = (CompareToMedian *)qc1; - vtm->setMin((double)atof(findOrDefault(params, "MinRel", "0"))); - vtm->setMax((double)atof(findOrDefault(params, "MaxRel", "0"))); - vtm->setEmptyBins((int)atoi(findOrDefault(params, "UseEmptyBins", "0"))); - vtm->setMinMedian((double)atof(findOrDefault(params, "MinAbs", "0"))); - vtm->setMaxMedian((double)atof(findOrDefault(params, "MaxAbs", "0"))); - vtm->setWarningProb((double)atof(findOrDefault(params, "warning", "0"))); - vtm->setErrorProb((double)atof(findOrDefault(params, "error", "0"))); - vtm->setStatCut((double)atof(findOrDefault(params, "StatCut", "0"))); -} - -/* - void QTestConfigure::EnableMostProbableLandauTest( - const std::string &roTEST_NAME, - std::map &roMParams, - DQMStore *bei) { - - // Create QTest or Get already assigned one - MostProbableLandau *poQTest = 0; - if( QCriterion *poQCriteration = bei->getQCriterion( roTEST_NAME)) { - // Current already assigned to given ME. - poQTest = dynamic_cast( poQCriteration); - } else { - // Test does not exist: create one - testsConfigured.push_back( roTEST_NAME); - poQCriteration = bei->createQTest( MostProbableLandau::getAlgoName(), - roTEST_NAME); - - poQTest = dynamic_cast( poQCriteration); - } - - // Set probabilities thresholds. - poQTest->setErrorProb ( atof( roMfindOrDefault(params, "error", "0") ); - poQTest->setWarningProb ( atof( roMfindOrDefault(params, "warning", "0") ); - poQTest->setXMin ( atof( roMfindOrDefault(params, "xmin", "0") ); - poQTest->setXMax ( atof( roMfindOrDefault(params, "xmax", "0") ); - poQTest->setNormalization( atof( roMfindOrDefault(params, "normalization", "0") ); - poQTest->setMostProbable ( atof( roMfindOrDefault(params, "mostprobable", "0") ); - poQTest->setSigma ( atof( roMfindOrDefault(params, "sigma", "0") ); - } -*/ -void QTestConfigure::EnableContentsWithinExpectedTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(ContentsWithinExpected::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - ContentsWithinExpected *me_qc1 = (ContentsWithinExpected *)qc1; - unsigned int useEmptyBins = (unsigned int)atof(findOrDefault(params, "useEmptyBins", "0")); - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - double minMean = atof(findOrDefault(params, "minMean", "0")); - double maxMean = atof(findOrDefault(params, "maxMean", "0")); - double minRMS = atof(findOrDefault(params, "minRMS", "0")); - double maxRMS = atof(findOrDefault(params, "maxRMS", "0")); - double toleranceMean = atof(findOrDefault(params, "toleranceMean", "0")); - int minEntries = atoi(findOrDefault(params, "minEntries", "0")); - me_qc1->setUseEmptyBins(useEmptyBins); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); - - if (minMean != 0 || maxMean != 0) - me_qc1->setMeanRange(minMean, maxMean); - - if (minRMS != 0 || maxRMS != 0) - me_qc1->setRMSRange(minRMS, maxRMS); - - if (toleranceMean != 0) - me_qc1->setMeanTolerance(toleranceMean); - - if (minEntries != 0) - me_qc1->setMinimumEntries(minEntries); -} - -void QTestConfigure::EnableCompareLastFilledBinTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(CompareLastFilledBin::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - CompareLastFilledBin *me_qc1 = (CompareLastFilledBin *)qc1; - - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - double avVal = atof(findOrDefault(params, "AvVal", "0")); - double minVal = atof(findOrDefault(params, "MinVal", "0")); - double maxVal = atof(findOrDefault(params, "MaxVal", "0")); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); - me_qc1->setAverage(avVal); - me_qc1->setMin(minVal); - me_qc1->setMax(maxVal); -} -void QTestConfigure::EnableCheckVarianceTest(std::string testName, - const std::map ¶ms, - DQMStore *bei) { - QCriterion *qc1; - if (!bei->getQCriterion(testName)) { - testsConfigured.push_back(testName); - qc1 = bei->createQTest(CheckVariance::getAlgoName(), testName); - } else { - qc1 = bei->getQCriterion(testName); - } - CheckVariance *me_qc1 = (CheckVariance *)qc1; - - double warning = atof(findOrDefault(params, "warning", "0")); - double error = atof(findOrDefault(params, "error", "0")); - me_qc1->setWarningProb(warning); - me_qc1->setErrorProb(error); -} - -/* void QTestConfigure::EnableContentsWithinExpectedASTest(std::string testName, std::map params, DQMStore *bei){ - -QCriterion * qc1; -if(! bei->getQCriterion(testName) ){ -testsConfigured.push_back(testName); -qc1 = bei->createQTest(ContentsWithinExpectedAS::getAlgoName(),testName); -}else{ -qc1 = bei->getQCriterion(testName); -} -ContentsWithinExpectedAS * me_qc1 = (ContentsWithinExpectedAS *) qc1; - -double warning=atof(findOrDefault(params, "warning", "0"); -double error=atof(findOrDefault(params, "error", "0"); -me_qc1->setWarningProb(warning); -me_qc1->setErrorProb(error); - -double minCont=atof(findOrDefault(params, "minCont", "0"); -double maxCont=atof(findOrDefault(params, "maxCont", "0"); -if ( minCont != 0 || maxCont != 0 ) me_qc1->setContentsRange(minCont, maxCont); - - -} */ diff --git a/DQMServices/ClientConfig/src/QTestHandle.cc b/DQMServices/ClientConfig/src/QTestHandle.cc deleted file mode 100644 index 9eda976d9bf0a..0000000000000 --- a/DQMServices/ClientConfig/src/QTestHandle.cc +++ /dev/null @@ -1,82 +0,0 @@ -/** \file - * - * Implementation of QTestHandle - * - * \author Ilaria Segoni - */ - -#include "DQMServices/ClientConfig/interface/QTestHandle.h" -#include "DQMServices/ClientConfig/interface/QTestConfigurationParser.h" -#include "DQMServices/ClientConfig/interface/QTestConfigure.h" -#include "DQMServices/ClientConfig/interface/QTestStatusChecker.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "boost/scoped_ptr.hpp" -#include - -namespace { - std::atomic firstTime{true}; -} - -QTestHandle::QTestHandle() { - qtParser = new QTestConfigurationParser; - qtConfigurer = new QTestConfigure; - qtChecker = new QTestStatusChecker; - - testsConfigured = false; -} - -QTestHandle::~QTestHandle() { - delete qtParser; - delete qtConfigurer; - delete qtChecker; -} - -bool QTestHandle::configureTests(const std::string &configFile, DQMStore *bei, bool UseDB) { - //In case of UseDB==true the configFile is the content of the xml file itself - //In case of UseDB==false (default) configFile is just the name of the file - if (testsConfigured) - qtParser->getNewDocument(configFile, UseDB); - else { - qtParser->getDocument(configFile, UseDB); - testsConfigured = true; - } - - if (!qtParser->parseQTestsConfiguration()) { - std::map > testsONList = qtParser->testsList(); - - if (qtConfigurer->enableTests(testsONList, bei)) - return true; - } else - return true; - - return false; -} - -void QTestHandle::attachTests(DQMStore *bei, bool verboseQT) { - std::map > mapMeToTests = qtParser->meToTestsList(); - - //If firstTime is true, then firstCaller will be true - bool expected = true; - const bool firstCaller = firstTime.compare_exchange_strong(expected, false); - - for (std::map >::iterator itr = mapMeToTests.begin(); itr != mapMeToTests.end(); - ++itr) { - const std::string &meName = itr->first; - const std::vector &tests = itr->second; - - for (std::vector::const_iterator testsItr = tests.begin(); testsItr != tests.end(); ++testsItr) { - int cases = bei->useQTestByMatch(meName, *testsItr); - if (firstCaller && verboseQT && cases == 0) - edm::LogWarning("QTestHandle::attachTests") - << " ==>> Invalid qtest xml: Link '" << meName << "', QTest '" << *testsItr << "' - no matching ME! <<== "; - } - } -} - -std::pair QTestHandle::checkGlobalQTStatus(DQMStore *bei) const { - return qtChecker->checkGlobalStatus(bei); -} - -std::map > QTestHandle::checkDetailedQTStatus(DQMStore *bei) const { - return qtChecker->checkDetailedStatus(bei); -} diff --git a/DQMServices/ClientConfig/src/QTestParameterNames.cc b/DQMServices/ClientConfig/src/QTestParameterNames.cc deleted file mode 100644 index 1ebad1e8c3b03..0000000000000 --- a/DQMServices/ClientConfig/src/QTestParameterNames.cc +++ /dev/null @@ -1,73 +0,0 @@ -/** \file - * - * Implementation of QTestParameterNames - * - * \author Ilaria Segoni - */ - -#include -#include -#include "DQMServices/ClientConfig/interface/QTestParameterNames.h" -#include "DQMServices/Core/interface/QTest.h" - -QTestParameterNames::QTestParameterNames() { - this->constructMap(ContentsXRangeROOT::getAlgoName(), "xmin", "xmax"); - this->constructMap(ContentsYRangeROOT::getAlgoName(), "ymin", "ymax", "useEmptyBins"); - this->constructMap(DeadChannelROOT::getAlgoName(), "threshold"); - this->constructMap(NoisyChannelROOT::getAlgoName(), "tolerance", "neighbours"); - this->constructMap(MeanWithinExpectedROOT::getAlgoName(), "mean", "useRMS", "useSigma", "useRange", "xmin", "xmax"); - - // this->constructMap(MostProbableLandauROOT::getAlgoName(), "xmin", "xmax","normalization", "mostprobable", "sigma"); - this->constructMap(ContentsWithinExpectedROOT::getAlgoName(), - "minMean", - "maxMean", - "minRMS", - "maxRMS", - "toleranceMean", - "minEntries", - "useEmptyBins"); - //this->constructMap(ContentsWithinExpectedASROOT::getAlgoName(), "minCont", "maxCont"); - - this->constructMap(CompareToMedianROOT::getAlgoName(), "MinRel", "MaxRel", "UseEmptyBins", "MinAbs", "MaxAbs"); - this->constructMap(CompareLastFilledBinROOT::getAlgoName(), "AvVal", "MinVal", "MaxVal"); - this->constructMap(CheckVarianceROOT::getAlgoName()); -} - -void QTestParameterNames::constructMap(std::string testType, - std::string param1, - std::string param2, - std::string param3, - std::string param4, - std::string param5, - std::string param6, - std::string param7, - std::string param8) { - std::vector paramNames; - if (std::strcmp(param1.c_str(), "undefined")) - paramNames.push_back(param1); - if (std::strcmp(param2.c_str(), "undefined")) - paramNames.push_back(param2); - if (std::strcmp(param3.c_str(), "undefined")) - paramNames.push_back(param3); - if (std::strcmp(param4.c_str(), "undefined")) - paramNames.push_back(param4); - if (std::strcmp(param5.c_str(), "undefined")) - paramNames.push_back(param5); - if (std::strcmp(param6.c_str(), "undefined")) - paramNames.push_back(param6); - if (std::strcmp(param7.c_str(), "undefined")) - paramNames.push_back(param7); - if (std::strcmp(param8.c_str(), "undefined")) - paramNames.push_back(param8); - - configurationMap[testType] = paramNames; -} - -std::vector QTestParameterNames::getTestParamNames(std::string theTestType) { - if (configurationMap.find(theTestType) != configurationMap.end()) { - return configurationMap[theTestType]; - } else { - std::vector empty; - return empty; - } -} diff --git a/DQMServices/ClientConfig/src/QTestStatusChecker.cc b/DQMServices/ClientConfig/src/QTestStatusChecker.cc deleted file mode 100644 index 9ef7d3c2ffad2..0000000000000 --- a/DQMServices/ClientConfig/src/QTestStatusChecker.cc +++ /dev/null @@ -1,112 +0,0 @@ -/** \file - * - * Implementation of QTestStatusChecker - * - * \author Ilaria Segoni - */ - -#include "DQMServices/ClientConfig/interface/QTestStatusChecker.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include - -QTestStatusChecker::QTestStatusChecker() {} - -QTestStatusChecker::~QTestStatusChecker() {} - -std::pair QTestStatusChecker::checkGlobalStatus(DQMStore *bei) { - std::pair statement; - int status = bei->getStatus(); - switch (status) { - case dqm::qstatus::ERROR: - statement.first = "Errors detected in quality tests"; - statement.second = "red"; - break; - case dqm::qstatus::WARNING: - statement.first = "Warnings detected in quality tests"; - statement.second = "orange"; - break; - case dqm::qstatus::OTHER: - statement.first = "Some tests did not run"; - statement.second = "black"; - break; - default: - statement.first = "No problems detected in quality tests "; - statement.second = "green"; - } - - return statement; -} - -std::map > QTestStatusChecker::checkDetailedStatus(DQMStore *bei) { - std::vector allPathNames = this->fullPathNames(bei); - detailedWarnings.clear(); - - this->processAlarms(allPathNames, bei); - return detailedWarnings; -} - -void QTestStatusChecker::processAlarms(const std::vector &allPathNames, DQMStore *bei) { - for (std::vector::const_iterator fullMePath = allPathNames.begin(); fullMePath != allPathNames.end(); - ++fullMePath) { - MonitorElement *me = nullptr; - me = bei->get(*fullMePath); - - if (me) { - std::vector report; - std::string colour; - - if (me->hasError()) { - colour = "red"; - report = me->getQErrors(); - } - if (me->hasWarning()) { - colour = "orange"; - report = me->getQWarnings(); - } - if (me->hasOtherReport()) { - colour = "black"; - report = me->getQOthers(); - } - for (std::vector::iterator itr = report.begin(); itr != report.end(); ++itr) { - std::string text = (*fullMePath) + (*itr)->getMessage(); - std::vector messageList; - - if (detailedWarnings.find(colour) == detailedWarnings.end()) { - messageList.push_back(text); - detailedWarnings[colour] = messageList; - - } else { - messageList = detailedWarnings[colour]; - messageList.push_back(text); - detailedWarnings[colour] = messageList; - } - } - } - } -} - -std::vector QTestStatusChecker::fullPathNames(DQMStore *bei) { - std::vector contents; - std::vector contentVec; - bei->getContents(contentVec); - for (std::vector::iterator it = contentVec.begin(); it != contentVec.end(); it++) { - std::string::size_type dirCharNumber = it->find(":", 0); - std::string dirName = it->substr(0, dirCharNumber); - dirName += "/"; - std::string meCollectionName = it->substr(dirCharNumber + 1); - - std::string reminingNames = meCollectionName; - bool anotherME = true; - while (anotherME) { - if (reminingNames.find(",") == std::string::npos) - anotherME = false; - std::string::size_type singleMeNameCharNumber = reminingNames.find(",", 0); - std::string singleMeName = reminingNames.substr(0, singleMeNameCharNumber); - std::string fullpath = dirName + singleMeName; - contents.push_back(fullpath); - reminingNames = reminingNames.substr(singleMeNameCharNumber + 1); - } - } - - return contents; -}