CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

QualityTester Class Reference

#include <QualityTester.h>

Inheritance diagram for QualityTester:
edm::EDAnalyzer HLTTauRelvalQTester

List of all members.

Public Member Functions

 QualityTester (const edm::ParameterSet &ps)
 Constructor.
virtual ~QualityTester ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginRun (const edm::Run &, const edm::EventSetup &)
void endJob ()
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 perform the actual quality tests
void endRun (const edm::Run &r, const edm::EventSetup &c)

Private Member Functions

void performTests (void)

Private Attributes

DQMStorebei
bool getQualityTestsFromFile
std::string Label
int nEvents
int prescaleFactor
bool qtestOnEndJob
bool qtestOnEndLumi
bool qtestOnEndRun
QTestHandleqtHandler
std::string reportThreshold
bool testInEventloop
bool verboseQT

Detailed Description

Definition at line 35 of file QualityTester.h.


Constructor & Destructor Documentation

QualityTester::QualityTester ( const edm::ParameterSet ps)

Constructor.

Definition at line 24 of file QualityTester.cc.

References hcal_dqm_sourceclient-playback_cfg::getQualityTestsFromFile, edm::ParameterSet::getUntrackedParameter(), SiStripGain_Fake_cff::Label, nEvents, ExpressReco_HICollisions_FallBack::prescaleFactor, and benchmark_cfg::verboseQT.

{
  prescaleFactor          = ps.getUntrackedParameter<int>("prescaleFactor", 1);
  getQualityTestsFromFile = ps.getUntrackedParameter<bool>("getQualityTestsFromFile", true);
  Label                   = ps.getUntrackedParameter<string>("label","");
  reportThreshold = ps.getUntrackedParameter<string>("reportThreshold", "");
  testInEventloop = ps.getUntrackedParameter<bool>("testInEventloop",false);
  qtestOnEndRun   = ps.getUntrackedParameter<bool>("qtestOnEndRun",true);
  qtestOnEndJob   = ps.getUntrackedParameter<bool>("qtestOnEndJob",false);
  qtestOnEndLumi  = ps.getUntrackedParameter<bool>("qtestOnEndLumi",false);
  verboseQT       = ps.getUntrackedParameter<bool>("verboseQT", true);

  bei = &*edm::Service<DQMStore>();

  qtHandler=new QTestHandle;

  // if you use this module, it's non-sense not to provide the QualityTests.xml
  if (getQualityTestsFromFile) {
    edm::FileInPath qtlist = ps.getUntrackedParameter<edm::FileInPath>("qtList");
    qtHandler->configureTests(FileInPath(qtlist).fullPath(), bei);
  }


  nEvents = 0;

}
QualityTester::~QualityTester ( ) [virtual]

Destructor.

Definition at line 74 of file QualityTester.cc.

{
  delete qtHandler;
}

Member Function Documentation

void QualityTester::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]
void QualityTester::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file QualityTester.cc.

References Exception, edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), hcal_dqm_sourceclient-playback_cfg::getQualityTestsFromFile, SiStripGain_Fake_cff::Label, and edm::eventsetup::EventSetupRecordKey::type().

                                                                           {

  // if getQualityTestsFromFile is False, it means that the end-user wants them from the Database
  if (!getQualityTestsFromFile) {
    edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DQMXMLFileRcd"));
    if(recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
      throw cms::Exception ("Record not found") << "Record \"DQMXMLFileRcd" 
                                                << "\" does not exist!" << std::endl;
    }
//     std::cout << "Reading XML from Database" << std::endl ;
    edm::ESHandle<FileBlob> xmlfile;
    iSetup.get<DQMXMLFileRcd>().get(Label,xmlfile);
    boost::scoped_ptr<std::vector<unsigned char> > vc( (*xmlfile).getUncompressedBlob() );
    std::string xmlstr="";
    for(std::vector<unsigned char>::iterator it=vc->begin();it!=vc->end();it++){
      xmlstr += *it;
    }

    qtHandler->configureTests(xmlstr,bei,1);

  }
}
void QualityTester::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 106 of file QualityTester.cc.

void QualityTester::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [protected, virtual]
void QualityTester::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 102 of file QualityTester.cc.

void QualityTester::performTests ( void  ) [private]

Definition at line 110 of file QualityTester.cc.

References gather_cfg::cout, Association::map, runTheMatrix::msg, and benchmark_cfg::verboseQT.

{
    // done here because new ME can appear while processing data
    qtHandler->attachTests(bei,verboseQT);

    edm::LogVerbatim ("QualityTester") << "Running the Quality Test";

    bei->runQTests();

    if (reportThreshold.size() != 0)
    {
      std::map< std::string, std::vector<std::string> > theAlarms
        = qtHandler->checkDetailedQTStatus(bei);

      for (std::map<std::string,std::vector<std::string> >::iterator itr = theAlarms.begin();
           itr != theAlarms.end(); ++itr)
      {
        const std::string &alarmType = itr->first;
        const std::vector<std::string> &msgs = itr->second;
        if ((reportThreshold == "black")
            || (reportThreshold == "orange" && (alarmType == "orange" || alarmType == "red"))
            || (reportThreshold == "red" && alarmType == "red"))
        {
          std::cout << std::endl;
          std::cout << "Error Type: " << alarmType << std::endl;
          for (std::vector<std::string>::const_iterator msg = msgs.begin();
               msg != msgs.end(); ++msg)
            std::cout << *msg << std::endl;
        }
      }
      std::cout << std::endl;
    }
}

Member Data Documentation

Definition at line 72 of file QualityTester.h.

Definition at line 63 of file QualityTester.h.

std::string QualityTester::Label [private]

Definition at line 64 of file QualityTester.h.

int QualityTester::nEvents [private]

Definition at line 61 of file QualityTester.h.

Definition at line 62 of file QualityTester.h.

Definition at line 67 of file QualityTester.h.

Definition at line 68 of file QualityTester.h.

Definition at line 66 of file QualityTester.h.

Definition at line 74 of file QualityTester.h.

std::string QualityTester::reportThreshold [private]

Definition at line 69 of file QualityTester.h.

Definition at line 65 of file QualityTester.h.

bool QualityTester::verboseQT [private]

Definition at line 70 of file QualityTester.h.