CMS 3D CMS Logo

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
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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 24 of file QualityTester.cc.

References edm::ParameterSet::getUntrackedParameter(), ecalTriggerPrimitiveDigis_cfi::Label, nEvents, and benchmark_cfg::verboseQT.

25 {
26  prescaleFactor = ps.getUntrackedParameter<int>("prescaleFactor", 1);
27  getQualityTestsFromFile = ps.getUntrackedParameter<bool>("getQualityTestsFromFile", true);
28  Label = ps.getUntrackedParameter<string>("label","");
29  reportThreshold = ps.getUntrackedParameter<string>("reportThreshold", "");
30  testInEventloop = ps.getUntrackedParameter<bool>("testInEventloop",false);
31  qtestOnEndRun = ps.getUntrackedParameter<bool>("qtestOnEndRun",true);
32  qtestOnEndJob = ps.getUntrackedParameter<bool>("qtestOnEndJob",false);
33  qtestOnEndLumi = ps.getUntrackedParameter<bool>("qtestOnEndLumi",false);
34  verboseQT = ps.getUntrackedParameter<bool>("verboseQT", true);
35 
37 
39 
40  // if you use this module, it's non-sense not to provide the QualityTests.xml
41  if (getQualityTestsFromFile) {
43  qtHandler->configureTests(FileInPath(qtlist).fullPath(), bei);
44  }
45 
46 
47  nEvents = 0;
48 
49 }
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 74 of file QualityTester.cc.

75 {
76  delete qtHandler;
77 }
QTestHandle * qtHandler
Definition: QualityTester.h:72

Member Function Documentation

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

Analyze.

Definition at line 79 of file QualityTester.cc.

References nEvents.

Referenced by HLTTauRelvalQTester::analyze().

80 {
81  if (testInEventloop) {
82  nEvents++;
84  && prescaleFactor > 0
85  && nEvents % prescaleFactor == 0) {
86  performTests();
87  }
88  }
89 }
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 
)
protected

Definition at line 51 of file QualityTester.cc.

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

51  {
52 
53  // if getQualityTestsFromFile is False, it means that the end-user wants them from the Database
56  if(recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
57  throw cms::Exception ("Record not found") << "Record \"DQMXMLFileRcd"
58  << "\" does not exist!" << std::endl;
59  }
60 // std::cout << "Reading XML from Database" << std::endl ;
62  iSetup.get<DQMXMLFileRcd>().get(Label,xmlfile);
63  std::unique_ptr<std::vector<unsigned char> > vc( (*xmlfile).getUncompressedBlob() );
64  std::string xmlstr="";
65  for(std::vector<unsigned char>::iterator it=vc->begin();it!=vc->end();it++){
66  xmlstr += *it;
67  }
68 
69  qtHandler->configureTests(xmlstr,bei,1);
70 
71  }
72 }
bool getQualityTestsFromFile
Definition: QualityTester.h:61
QTestHandle * qtHandler
Definition: QualityTester.h:72
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:62
xmlfile
Make an XML representation of the misalignment.
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:38
void QualityTester::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Reimplemented in HLTTauRelvalQTester.

Definition at line 106 of file QualityTester.cc.

Referenced by HLTTauRelvalQTester::endJob().

106  {
108 }
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 91 of file QualityTester.cc.

References edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

Referenced by HLTTauRelvalQTester::endLuminosityBlock().

92 {
95  && prescaleFactor > 0
96  && lumiSeg.id().luminosityBlock() % prescaleFactor == 0) {
97  performTests();
98  }
99  }
100 }
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 
)
protected

Definition at line 102 of file QualityTester.cc.

Referenced by HLTTauRelvalQTester::endRun().

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

Definition at line 110 of file QualityTester.cc.

References gather_cfg::cout, genParticles_cff::map, mps_alisetup::msg, AlCaHLTBitMon_QueryRunRegistry::string, and benchmark_cfg::verboseQT.

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

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.

Referenced by looper.Looper::loop().

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.