CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
QualityTester Class Reference

#include <QualityTester.h>

Inheritance diagram for QualityTester:
edm::EDAnalyzer edm::EDConsumerBase HLTTauRelvalQTester

Public Member Functions

 QualityTester (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~QualityTester ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
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 More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 33 of file QualityTester.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 22 of file QualityTester.cc.

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

23 {
24  prescaleFactor = ps.getUntrackedParameter<int>("prescaleFactor", 1);
25  getQualityTestsFromFile = ps.getUntrackedParameter<bool>("getQualityTestsFromFile", true);
26  Label = ps.getUntrackedParameter<string>("label","");
27  reportThreshold = ps.getUntrackedParameter<string>("reportThreshold", "");
28  testInEventloop = ps.getUntrackedParameter<bool>("testInEventloop",false);
29  qtestOnEndRun = ps.getUntrackedParameter<bool>("qtestOnEndRun",true);
30  qtestOnEndJob = ps.getUntrackedParameter<bool>("qtestOnEndJob",false);
31  qtestOnEndLumi = ps.getUntrackedParameter<bool>("qtestOnEndLumi",false);
32  verboseQT = ps.getUntrackedParameter<bool>("verboseQT", true);
33 
35 
37 
38  // if you use this module, it's non-sense not to provide the QualityTests.xml
39  if (getQualityTestsFromFile) {
41  qtHandler->configureTests(FileInPath(qtlist).fullPath(), bei);
42  }
43 
44 
45  nEvents = 0;
46 
47 }
T getUntrackedParameter(std::string const &, T const &) const
bool testInEventloop
Definition: QualityTester.h:63
bool getQualityTestsFromFile
Definition: QualityTester.h:61
QTestHandle * qtHandler
Definition: QualityTester.h:72
std::string Label
Definition: QualityTester.h:62
DQMStore * bei
Definition: QualityTester.h:70
std::string reportThreshold
Definition: QualityTester.h:67
QualityTester::~QualityTester ( )
virtual

Destructor.

Definition at line 72 of file QualityTester.cc.

73 {
74  delete qtHandler;
75 }
QTestHandle * qtHandler
Definition: QualityTester.h:72

Member Function Documentation

void QualityTester::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 77 of file QualityTester.cc.

References hcal_dqm_sourceclient-playback_cfg::getQualityTestsFromFile, nEvents, and dtDQMClient_cfg::prescaleFactor.

Referenced by HLTTauRelvalQTester::analyze().

78 {
79  if (testInEventloop) {
80  nEvents++;
82  && prescaleFactor > 0
83  && nEvents % prescaleFactor == 0) {
84  performTests();
85  }
86  }
87 }
bool testInEventloop
Definition: QualityTester.h:63
bool getQualityTestsFromFile
Definition: QualityTester.h:61
void performTests(void)
void QualityTester::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file QualityTester.cc.

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

49  {
50 
51  // if getQualityTestsFromFile is False, it means that the end-user wants them from the Database
54  if(recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
55  throw cms::Exception ("Record not found") << "Record \"DQMXMLFileRcd"
56  << "\" does not exist!" << std::endl;
57  }
58 // std::cout << "Reading XML from Database" << std::endl ;
60  iSetup.get<DQMXMLFileRcd>().get(Label,xmlfile);
61  boost::scoped_ptr<std::vector<unsigned char> > vc( (*xmlfile).getUncompressedBlob() );
62  std::string xmlstr="";
63  for(std::vector<unsigned char>::iterator it=vc->begin();it!=vc->end();it++){
64  xmlstr += *it;
65  }
66 
67  qtHandler->configureTests(xmlstr,bei,1);
68 
69  }
70 }
bool getQualityTestsFromFile
Definition: QualityTester.h:61
QTestHandle * qtHandler
Definition: QualityTester.h:72
tuple xmlfile
Make an XML representation of the misalignment.
std::string Label
Definition: QualityTester.h:62
const T & get() const
Definition: EventSetup.h:55
heterocontainer::HCTypeTag TypeTag
DQMStore * bei
Definition: QualityTester.h:70
bool configureTests(const std::string &configFile, DQMStore *bei, bool UseDB=false)
Parses Config File and configures the quality tests.
Definition: QTestHandle.cc:35
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:125
void QualityTester::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 104 of file QualityTester.cc.

Referenced by HLTTauRelvalQTester::endJob().

104  {
106 }
void performTests(void)
void QualityTester::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

perform the actual quality tests

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 89 of file QualityTester.cc.

References hcal_dqm_sourceclient-playback_cfg::getQualityTestsFromFile, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and dtDQMClient_cfg::prescaleFactor.

Referenced by HLTTauRelvalQTester::endLuminosityBlock().

90 {
93  && prescaleFactor > 0
94  && lumiSeg.id().luminosityBlock() % prescaleFactor == 0) {
95  performTests();
96  }
97  }
98 }
bool testInEventloop
Definition: QualityTester.h:63
bool getQualityTestsFromFile
Definition: QualityTester.h:61
void performTests(void)
void QualityTester::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 100 of file QualityTester.cc.

Referenced by HLTTauRelvalQTester::endRun().

100  {
102 }
void performTests(void)
void QualityTester::performTests ( void  )
private

Definition at line 108 of file QualityTester.cc.

References gather_cfg::cout, python.multivaluedict::map(), lumiQueryAPI::msg, dtNoiseDBValidation_cfg::reportThreshold, AlCaHLTBitMon_QueryRunRegistry::string, and benchmark_cfg::verboseQT.

109 {
110  // done here because new ME can appear while processing data
112 
113  edm::LogVerbatim ("QualityTester") << "Running the Quality Test";
114 
115  bei->runQTests();
116 
117  if (reportThreshold.size() != 0)
118  {
119  std::map< std::string, std::vector<std::string> > theAlarms
121 
122  for (std::map<std::string,std::vector<std::string> >::iterator itr = theAlarms.begin();
123  itr != theAlarms.end(); ++itr)
124  {
125  const std::string &alarmType = itr->first;
126  const std::vector<std::string> &msgs = itr->second;
127  if ((reportThreshold == "black")
128  || (reportThreshold == "orange" && (alarmType == "orange" || alarmType == "red"))
129  || (reportThreshold == "red" && alarmType == "red"))
130  {
131  std::cout << std::endl;
132  std::cout << "Error Type: " << alarmType << std::endl;
133  for (std::vector<std::string>::const_iterator msg = msgs.begin();
134  msg != msgs.end(); ++msg)
135  std::cout << *msg << std::endl;
136  }
137  }
138  std::cout << std::endl;
139  }
140 }
QTestHandle * qtHandler
Definition: QualityTester.h:72
std::map< std::string, std::vector< std::string > > checkDetailedQTStatus(DQMStore *bei) const
Checks alarms for single MonitorElements.
Definition: QTestHandle.cc:95
void attachTests(DQMStore *bei, bool verboseQT=true)
Attaches the quality tests to the MonitorElement.
Definition: QTestHandle.cc:62
void runQTests(void)
Definition: DQMStore.cc:2883
DQMStore * bei
Definition: QualityTester.h:70
std::string reportThreshold
Definition: QualityTester.h:67
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

DQMStore* QualityTester::bei
private

Definition at line 70 of file QualityTester.h.

bool QualityTester::getQualityTestsFromFile
private

Definition at line 61 of file QualityTester.h.

std::string QualityTester::Label
private

Definition at line 62 of file QualityTester.h.

int QualityTester::nEvents
private

Definition at line 59 of file QualityTester.h.

int QualityTester::prescaleFactor
private

Definition at line 60 of file QualityTester.h.

bool QualityTester::qtestOnEndJob
private

Definition at line 65 of file QualityTester.h.

bool QualityTester::qtestOnEndLumi
private

Definition at line 66 of file QualityTester.h.

bool QualityTester::qtestOnEndRun
private

Definition at line 64 of file QualityTester.h.

QTestHandle* QualityTester::qtHandler
private

Definition at line 72 of file QualityTester.h.

std::string QualityTester::reportThreshold
private

Definition at line 67 of file QualityTester.h.

bool QualityTester::testInEventloop
private

Definition at line 63 of file QualityTester.h.

bool QualityTester::verboseQT
private

Definition at line 68 of file QualityTester.h.