CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

QTestConfigure Class Reference

#include <QTestConfigure.h>

List of all members.

Public Member Functions

void disableTests (std::vector< std::string > testsOFFList, DQMStore *bei)
 Disables the Quality Tests in the string list.
bool enableTests (std::map< std::string, std::map< std::string, std::string > > tests, DQMStore *bei)
 Creates and defines quality tests.
 QTestConfigure ()
 Constructor.
std::vector< std::string > testsReady ()
 Returns the vector containing the names of the quality tests that have been created.
 ~QTestConfigure ()
 Destructor.

Private Member Functions

void EnableComp2RefChi2Test (std::string testName, std::map< std::string, std::string >params, DQMStore *bei)
 Creates Comp2RefChi2 test.
void EnableComp2RefEqualHTest (std::string testName, std::map< std::string, std::string >params, DQMStore *bei)
 Creates Comp2RefEqualH test.
void EnableComp2RefKolmogorovTest (std::string testName, std::map< std::string, std::string >params, DQMStore *bei)
 Creates EnableComp2RefKolmogorov test.
void EnableCompareToMedianTest (std::string testName, std::map< std::string, std::string > params, DQMStore *bei)
 Creates ContentsWithinRangeROOT test.
void EnableContentsWithinExpectedTest (std::string testName, std::map< std::string, std::string > params, DQMStore *bei)
 Creates ContentsWithinRangeROOT test.
void EnableDeadChannelTest (std::string testName, std::map< std::string, std::string > params, DQMStore *bei)
 Creates ContentsYRangeASROOT test.
void EnableMeanWithinExpectedTest (std::string testName, std::map< std::string, std::string > params, DQMStore *bei)
 Creates MeanWithinExpectedROOT test.
void EnableNoisyChannelTest (std::string testName, std::map< std::string, std::string > params, DQMStore *bei)
 Creates NoisyChannelROOT test.
void EnableXRangeTest (std::string testName, std::map< std::string, std::string >params, DQMStore *bei)
 Creates ContentsXRangeROOT test.
void EnableYRangeTest (std::string testName, std::map< std::string, std::string >params, DQMStore *bei)
 Creates ContentsXRangeASROOT test.

Private Attributes

std::vector< std::string > testsConfigured

Detailed Description

* Class that creates and defined quality tests based on the xml configuration file parsed by QTestConfigurationParser.

Date:
2010/03/14 13:07:53
Revision:
1.11
Author:
Ilaria Segoni

Definition at line 22 of file QTestConfigure.h.


Constructor & Destructor Documentation

QTestConfigure::QTestConfigure ( ) [inline]

Constructor.

Definition at line 27 of file QTestConfigure.h.

{}
QTestConfigure::~QTestConfigure ( ) [inline]

Destructor.

Definition at line 29 of file QTestConfigure.h.

{}

Member Function Documentation

void QTestConfigure::disableTests ( std::vector< std::string >  testsOFFList,
DQMStore bei 
)

Disables the Quality Tests in the string list.

void QTestConfigure::EnableComp2RefChi2Test ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates Comp2RefChi2 test.

Definition at line 74 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, Comp2RefChi2::getAlgoName(), DQMStore::getQCriterion(), QCriterion::setErrorProb(), QCriterion::setWarningProb(), testsConfigured, and warning.

Referenced by enableTests().

                                                                                                                 {
        QCriterion * qc1;       
        if(! bei->getQCriterion(testName) ){
                testsConfigured.push_back(testName);
                qc1 = bei->createQTest(Comp2RefChi2::getAlgoName(),testName);
        }else{
                qc1 = bei->getQCriterion(testName);
                
        }       
        Comp2RefChi2 * me_qc1 = (Comp2RefChi2 *) qc1;
        
        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);
}
void QTestConfigure::EnableComp2RefEqualHTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates Comp2RefEqualH test.

Definition at line 55 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, Comp2RefEqualH::getAlgoName(), DQMStore::getQCriterion(), QCriterion::setErrorProb(), QCriterion::setWarningProb(), testsConfigured, and warning.

Referenced by enableTests().

                                                                                                                   {
        QCriterion * qc1;       
        if(! bei->getQCriterion(testName) ){
                testsConfigured.push_back(testName);
                qc1 = bei->createQTest(Comp2RefEqualH::getAlgoName(),testName);
        }else{
                qc1 = bei->getQCriterion(testName);
                
        }       
        Comp2RefEqualH * me_qc1 = (Comp2RefEqualH *) qc1;
        
        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);
}
void QTestConfigure::EnableComp2RefKolmogorovTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates EnableComp2RefKolmogorov test.

Definition at line 92 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, Comp2RefKolmogorov::getAlgoName(), DQMStore::getQCriterion(), QCriterion::setErrorProb(), QCriterion::setWarningProb(), testsConfigured, and warning.

Referenced by enableTests().

                                                                                                                       {
        QCriterion * qc1;       
        if(! bei->getQCriterion(testName) ){
                testsConfigured.push_back(testName);
                qc1 = bei->createQTest(Comp2RefKolmogorov::getAlgoName(),testName);
        }else{
                qc1 = bei->getQCriterion(testName);
                
        }       
        Comp2RefKolmogorov * me_qc1 = (Comp2RefKolmogorov *) qc1;
        
        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);
}
void QTestConfigure::EnableCompareToMedianTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates ContentsWithinRangeROOT test.

Creates CompareToMedian test

Definition at line 249 of file QTestConfigure.cc.

References DQMStore::createQTest(), CompareToMedian::getAlgoName(), DQMStore::getQCriterion(), CompareToMedian::setEmptyBins(), QCriterion::setErrorProb(), CompareToMedian::setMax(), CompareToMedian::setMaxMedian(), CompareToMedian::setMin(), CompareToMedian::setMinMedian(), CompareToMedian::setStatCut(), QCriterion::setWarningProb(), and testsConfigured.

Referenced by enableTests().

{
  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(params["MinRel"].c_str()));
  vtm->setMax((double)atof(params["MaxRel"].c_str()));
  vtm->setEmptyBins((int)atoi(params["UseEmptyBins"].c_str()));
  vtm->setMinMedian((double)atof(params["MinAbs"].c_str()));
  vtm->setMaxMedian((double)atof(params["MaxAbs"].c_str()));
  vtm->setWarningProb((double)atof(params["warning"].c_str()));
  vtm->setErrorProb((double)atof(params["error"].c_str()));
  vtm->setStatCut((double)atof(params["StatCut"].c_str()));
}
void QTestConfigure::EnableContentsWithinExpectedTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates ContentsWithinRangeROOT test.

Definition at line 299 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, ContentsWithinExpected::getAlgoName(), DQMStore::getQCriterion(), QCriterion::setErrorProb(), ContentsWithinExpected::setMeanRange(), ContentsWithinExpected::setMeanTolerance(), SimpleTest::setMinimumEntries(), ContentsWithinExpected::setRMSRange(), ContentsWithinExpected::setUseEmptyBins(), QCriterion::setWarningProb(), testsConfigured, and warning.

Referenced by enableTests().

                                                                                                                           {

        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;


        //do a Normal test or AS ?
        unsigned int useEmptyBins=(unsigned int)atof(params["useEmptyBins"].c_str());   
        me_qc1->setUseEmptyBins(useEmptyBins);

        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);

        double minMean=atof(params["minMean"].c_str());
        double maxMean=atof(params["maxMean"].c_str());
        if ( minMean != 0 || maxMean != 0 ) me_qc1->setMeanRange(minMean, maxMean);

        double minRMS=atof(params["minRMS"].c_str());
        double maxRMS=atof(params["maxRMS"].c_str());
        if ( minRMS != 0 || maxRMS != 0 ) me_qc1->setRMSRange(minRMS, maxRMS);

        double toleranceMean=atof(params["toleranceMean"].c_str());
        if ( toleranceMean != 0 ) me_qc1->setMeanTolerance(toleranceMean);

        int minEntries=atoi(params["minEntries"].c_str());
        if ( minEntries != 0 ) me_qc1->setMinimumEntries(minEntries);
}
void QTestConfigure::EnableDeadChannelTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates ContentsYRangeASROOT test.

Creates DeadChannelROOT test

Definition at line 156 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, DeadChannel::getAlgoName(), DQMStore::getQCriterion(), QCriterion::setErrorProb(), DeadChannel::setThreshold(), QCriterion::setWarningProb(), testsConfigured, dtDQMClient_cfg::threshold, and warning.

Referenced by enableTests().

                                                                                                                {
        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(params["threshold"].c_str());
        me_qc1->setThreshold(threshold);
      
        // Include/Exclude empty bins ?
        //unsigned int useEmptyBins=(unsigned int)atof(params["useEmptyBins"].c_str());
        //me_qc1->setUseEmptyBins(useEmptyBins);
        
        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);
}
void QTestConfigure::EnableMeanWithinExpectedTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates MeanWithinExpectedROOT test.

Definition at line 202 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, MeanWithinExpected::getAlgoName(), DQMStore::getQCriterion(), timingPdfMaker::mean, QCriterion::setErrorProb(), MeanWithinExpected::setExpectedMean(), SimpleTest::setMinimumEntries(), QCriterion::setWarningProb(), testsConfigured, MeanWithinExpected::useRange(), MeanWithinExpected::useRMS(), MeanWithinExpected::useSigma(), and warning.

Referenced by enableTests().

                                                                                                                       {
        
        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(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);

        double mean=atof(params["mean"].c_str());
        me_qc1->setExpectedMean(mean);
        
        int minEntries=atoi(params["minEntries"].c_str());
        if ( minEntries != 0 ) me_qc1->setMinimumEntries(minEntries);

        double useRMSVal=atof(params["useRMS"].c_str()); 
        double useSigmaVal=atof(params["useSigma"].c_str()); 
        double useRangeVal=atof(params["useRange"].c_str());
        if( useRMSVal&&useSigmaVal&&useRangeVal){
                return;
        }
        
        if(useRMSVal) {
                me_qc1->useRMS();
                return;
        }
        if(useSigmaVal) {
                me_qc1->useSigma(useSigmaVal);
                return;
        }       
        if(useRangeVal) {
                float xmin=atof(params["xmin"].c_str());
                float xmax=atof(params["xmax"].c_str());
                me_qc1->useRange(xmin,xmax);
                return;
        }       
        
        
}
void QTestConfigure::EnableNoisyChannelTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates NoisyChannelROOT test.

Definition at line 180 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, NoisyChannel::getAlgoName(), DQMStore::getQCriterion(), QCriterion::setErrorProb(), NoisyChannel::setNumNeighbors(), NoisyChannel::setTolerance(), QCriterion::setWarningProb(), testsConfigured, and warning.

Referenced by enableTests().

                                                                                                                 {

        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(params["neighbours"].c_str());
        double tolerance=atof(params["tolerance"].c_str());
        me_qc1->setNumNeighbors (neighbors);
        me_qc1->setTolerance (tolerance);
        
        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);
}
bool QTestConfigure::enableTests ( std::map< std::string, std::map< std::string, std::string > >  tests,
DQMStore bei 
)

Creates and defines quality tests.

Definition at line 15 of file QTestConfigure.cc.

References EnableComp2RefChi2Test(), EnableComp2RefEqualHTest(), EnableComp2RefKolmogorovTest(), EnableCompareToMedianTest(), EnableContentsWithinExpectedTest(), EnableDeadChannelTest(), EnableMeanWithinExpectedTest(), EnableNoisyChannelTest(), EnableXRangeTest(), EnableYRangeTest(), Comp2RefEqualH::getAlgoName(), CompareToMedian::getAlgoName(), DeadChannel::getAlgoName(), MeanWithinExpected::getAlgoName(), Comp2RefKolmogorov::getAlgoName(), Comp2RefChi2::getAlgoName(), ContentsYRange::getAlgoName(), NoisyChannel::getAlgoName(), ContentsXRange::getAlgoName(), ContentsWithinExpected::getAlgoName(), and testsConfigured.

Referenced by QTestHandle::configureTests().

                                                                                                    {
        
        testsConfigured.clear();
        
        std::map<std::string, std::map<std::string, std::string> >::iterator itr;
        for(itr= tests.begin(); itr!= tests.end();++itr){
 
                std::map<std::string, std::string> params= itr->second;
                
                std::string testName = itr->first; 
                std::string testType = params["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(),MeanWithinExpected::getAlgoName().c_str()))  this->EnableMeanWithinExpectedTest(testName, params,bei);     

                //================================== new qtests in the parser =============================================================//
                if(!std::strcmp(testType.c_str(),Comp2RefEqualH::getAlgoName().c_str())) this->EnableComp2RefEqualHTest(testName, params,bei);
                if(!std::strcmp(testType.c_str(),  Comp2RefChi2::getAlgoName().c_str())) this->EnableComp2RefChi2Test(testName, params,bei); 
                if(!std::strcmp(testType.c_str(),Comp2RefKolmogorov::getAlgoName().c_str())) this->EnableComp2RefKolmogorovTest(testName, params,bei);

  
/*
                if(!std::strcmp(testType.c_str(),MostProbableLandau::getAlgoName().c_str()))  this->EnableMostProbableLandauTest(testName, params, bei);
*/

                if(!std::strcmp(testType.c_str(),ContentsWithinExpected::getAlgoName().c_str())) this->EnableContentsWithinExpectedTest(testName, params, bei);
//              if(!std::strcmp(testType.c_str(),ContentsWithinExpectedAS::getAlgoName().c_str())) this->EnableContentsWithinExpectedASTest(testName, params, bei);

                if(!std::strcmp(testType.c_str(),CompareToMedian::getAlgoName().c_str())) this->EnableCompareToMedianTest(testName, params, bei);

        }
        
        return false;   
}
void QTestConfigure::EnableXRangeTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates ContentsXRangeROOT test.

Definition at line 109 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, ContentsXRange::getAlgoName(), DQMStore::getQCriterion(), ContentsXRange::setAllowedXRange(), QCriterion::setErrorProb(), QCriterion::setWarningProb(), testsConfigured, and warning.

Referenced by enableTests().

                                                                                                           {
        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(params["xmin"].c_str());
        double xmax=atof(params["xmax"].c_str());
        
        me_qc1->setAllowedXRange(xmin,xmax);
        
        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);
}
void QTestConfigure::EnableYRangeTest ( std::string  testName,
std::map< std::string, std::string >  params,
DQMStore bei 
) [private]

Creates ContentsXRangeASROOT test.

Creates ContentsYRangeROOT test

Definition at line 132 of file QTestConfigure.cc.

References DQMStore::createQTest(), error, ContentsYRange::getAlgoName(), DQMStore::getQCriterion(), ContentsYRange::setAllowedYRange(), QCriterion::setErrorProb(), ContentsYRange::setUseEmptyBins(), QCriterion::setWarningProb(), testsConfigured, and warning.

Referenced by enableTests().

                                                                                                           {
        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(params["ymin"].c_str());
        double ymax=atof(params["ymax"].c_str());
        me_qc1->setAllowedYRange(ymin,ymax);

        //do a Normal test or AS ?
        unsigned int useEmptyBins=(unsigned int)atof(params["useEmptyBins"].c_str());   
        me_qc1->setUseEmptyBins(useEmptyBins);

        double warning=atof(params["warning"].c_str());
        double error=atof(params["error"].c_str());
        me_qc1->setWarningProb(warning);
        me_qc1->setErrorProb(error);
}
std::vector<std::string> QTestConfigure::testsReady ( ) [inline]

Returns the vector containing the names of the quality tests that have been created.

Definition at line 35 of file QTestConfigure.h.

References testsConfigured.

{return testsConfigured;}

Member Data Documentation

std::vector<std::string> QTestConfigure::testsConfigured [private]