CMS 3D CMS Logo

List of all members | Public Types | 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 Types

typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 QualityTester (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~QualityTester () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c) override
 perform the actual quality tests More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 ()
 

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

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 32 of file QualityTester.h.

Member Typedef Documentation

Definition at line 34 of file QualityTester.h.

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 contentValuesFiles::fullPath, dtDQMOfflineClients_cff::getQualityTestsFromFile, edm::ParameterSet::getUntrackedParameter(), DataMixerDataOnData_cff::Label, nEvents, Skims_PDWG_cff::prescaleFactor, HcalQualityTests::qtestOnEndJob, HcalQualityTests::qtestOnEndLumi, HcalQualityTests::qtestOnEndRun, HcalQualityTests::reportThreshold, HcalQualityTests::testInEventloop, and HcalQualityTests::verboseQT.

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

Destructor.

Definition at line 70 of file QualityTester.cc.

70 { delete qtHandler; }
QTestHandle * qtHandler
Definition: QualityTester.h:69

Member Function Documentation

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

Analyze.

Definition at line 72 of file QualityTester.cc.

References dtDQMOfflineClients_cff::getQualityTestsFromFile, nEvents, Skims_PDWG_cff::prescaleFactor, and HcalQualityTests::testInEventloop.

Referenced by HLTTauRelvalQTester::analyze().

72  {
73  if (testInEventloop) {
74  nEvents++;
76  performTests();
77  }
78  }
79 }
bool testInEventloop
Definition: QualityTester.h:60
bool getQualityTestsFromFile
Definition: QualityTester.h:58
void performTests()
void QualityTester::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 48 of file QualityTester.cc.

References Exception, edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), dtDQMOfflineClients_cff::getQualityTestsFromFile, DataMixerDataOnData_cff::Label, AlCaHLTBitMon_QueryRunRegistry::string, edm::eventsetup::EventSetupRecordKey::type(), and makeMuonMisalignmentScenario::xmlfile.

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

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 94 of file QualityTester.cc.

References HcalQualityTests::qtestOnEndJob.

Referenced by HLTTauRelvalQTester::endJob().

94  {
95  if (qtestOnEndJob)
96  performTests();
97 }
void performTests()
void QualityTester::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

perform the actual quality tests

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 81 of file QualityTester.cc.

References dtDQMOfflineClients_cff::getQualityTestsFromFile, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), Skims_PDWG_cff::prescaleFactor, HcalQualityTests::qtestOnEndLumi, and HcalQualityTests::testInEventloop.

Referenced by HLTTauRelvalQTester::endLuminosityBlock().

81  {
83  if (getQualityTestsFromFile && prescaleFactor > 0 && lumiSeg.id().luminosityBlock() % prescaleFactor == 0) {
84  performTests();
85  }
86  }
87 }
bool testInEventloop
Definition: QualityTester.h:60
bool getQualityTestsFromFile
Definition: QualityTester.h:58
void performTests()
void QualityTester::endRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 89 of file QualityTester.cc.

References HcalQualityTests::qtestOnEndRun.

Referenced by HLTTauRelvalQTester::endRun().

89  {
90  if (qtestOnEndRun)
91  performTests();
92 }
void performTests()
void QualityTester::performTests ( )
private

Definition at line 99 of file QualityTester.cc.

References gather_cfg::cout, mps_check::msg, HcalQualityTests::reportThreshold, AlCaHLTBitMon_QueryRunRegistry::string, and HcalQualityTests::verboseQT.

99  {
100  // done here because new ME can appear while processing data
102 
103  edm::LogVerbatim("QualityTester") << "Running the Quality Test";
104 
105  bei->runQTests();
106 
107  if (!reportThreshold.empty()) {
108  std::map<std::string, std::vector<std::string> > theAlarms = qtHandler->checkDetailedQTStatus(bei);
109 
110  for (auto& theAlarm : theAlarms) {
111  const std::string& alarmType = theAlarm.first;
112  const std::vector<std::string>& msgs = theAlarm.second;
113  if ((reportThreshold == "black") ||
114  (reportThreshold == "orange" && (alarmType == "orange" || alarmType == "red")) ||
115  (reportThreshold == "red" && alarmType == "red")) {
116  std::cout << std::endl;
117  std::cout << "Error Type: " << alarmType << std::endl;
118  for (auto const& msg : msgs)
119  std::cout << msg << std::endl;
120  }
121  }
122  std::cout << std::endl;
123  }
124 }
QTestHandle * qtHandler
Definition: QualityTester.h:69
std::map< std::string, std::vector< std::string > > checkDetailedQTStatus(DQMStore *bei) const
Checks alarms for single MonitorElements.
Definition: QTestHandle.cc:80
void attachTests(DQMStore *bei, bool verboseQT=true)
Attaches the quality tests to the MonitorElement.
Definition: QTestHandle.cc:55
tuple msg
Definition: mps_check.py:285
DQMStore * bei
Definition: QualityTester.h:67
std::string reportThreshold
Definition: QualityTester.h:64

Member Data Documentation

DQMStore* QualityTester::bei
private

Definition at line 67 of file QualityTester.h.

bool QualityTester::getQualityTestsFromFile
private

Definition at line 58 of file QualityTester.h.

std::string QualityTester::Label
private

Definition at line 59 of file QualityTester.h.

int QualityTester::nEvents
private

Definition at line 56 of file QualityTester.h.

Referenced by looper.Looper::loop().

int QualityTester::prescaleFactor
private

Definition at line 57 of file QualityTester.h.

bool QualityTester::qtestOnEndJob
private

Definition at line 62 of file QualityTester.h.

bool QualityTester::qtestOnEndLumi
private

Definition at line 63 of file QualityTester.h.

bool QualityTester::qtestOnEndRun
private

Definition at line 61 of file QualityTester.h.

QTestHandle* QualityTester::qtHandler
private

Definition at line 69 of file QualityTester.h.

std::string QualityTester::reportThreshold
private

Definition at line 64 of file QualityTester.h.

bool QualityTester::testInEventloop
private

Definition at line 60 of file QualityTester.h.

bool QualityTester::verboseQT
private

Definition at line 65 of file QualityTester.h.