CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
QualityTester Class Reference
Inheritance diagram for QualityTester:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 QualityTester (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~QualityTester () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, const edm::Event &e, const edm::EventSetup &c) override
 perform the actual quality tests More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c) override
 
void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, const edm::Run &r, const edm::EventSetup &c) override
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Private Member Functions

void configureTests (std::string const &file)
 
std::unique_ptr< QCriterionmakeQCriterion (boost::property_tree::ptree const &config)
 
void performTests (DQMStore::IGetter &igetter)
 

Private Attributes

bool getQualityTestsFromFile
 
std::string Label
 
int nEvents
 
int prescaleFactor
 
std::vector< std::unique_ptr< QCriterion > > qtestobjects
 
bool qtestOnEndJob
 
bool qtestOnEndLumi
 
bool qtestOnEndRun
 
std::vector< std::pair< std::string, QCriterion * > > qtestpatterns
 
std::string reportThreshold
 
bool testInEventloop
 
bool verboseQT
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 35 of file QualityTester.cc.

Constructor & Destructor Documentation

◆ QualityTester()

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

Constructor.

Definition at line 79 of file QualityTester.cc.

79  : DQMEDHarvester(ps) {
80  prescaleFactor = ps.getUntrackedParameter<int>("prescaleFactor", 1);
81  getQualityTestsFromFile = ps.getUntrackedParameter<bool>("getQualityTestsFromFile", true);
82  Label = ps.getUntrackedParameter<std::string>("label", "");
83  reportThreshold = ps.getUntrackedParameter<std::string>("reportThreshold", "");
84  testInEventloop = ps.getUntrackedParameter<bool>("testInEventloop", false);
85  qtestOnEndRun = ps.getUntrackedParameter<bool>("qtestOnEndRun", true);
86  qtestOnEndJob = ps.getUntrackedParameter<bool>("qtestOnEndJob", false);
87  qtestOnEndLumi = ps.getUntrackedParameter<bool>("qtestOnEndLumi", false);
88  verboseQT = ps.getUntrackedParameter<bool>("verboseQT", true);
89 
92  configureTests(qtlist.fullPath());
93  } else {
94  assert(!"Reading from DB no longer supported.");
95  }
96 
97  nEvents = 0;
98 }

References cms::cuda::assert(), configureTests(), edm::FileInPath::fullPath(), getQualityTestsFromFile, edm::ParameterSet::getUntrackedParameter(), Label, nEvents, prescaleFactor, qtestOnEndJob, qtestOnEndLumi, qtestOnEndRun, reportThreshold, AlCaHLTBitMon_QueryRunRegistry::string, testInEventloop, and verboseQT.

◆ ~QualityTester()

QualityTester::~QualityTester ( )
override

Destructor.

Definition at line 100 of file QualityTester.cc.

100 {}

Member Function Documentation

◆ configureTests()

void QualityTester::configureTests ( std::string const &  file)
private

Definition at line 356 of file QualityTester.cc.

356  {
357  // We read QTests from the config file into this structure, before
358  // transforming into the final [(pattern, *qtest), ...] structure.
359  struct TestItem {
360  std::unique_ptr<QCriterion> qtest;
361  std::vector<std::string> pathpatterns;
362  };
363  std::map<std::string, TestItem> qtestmap;
364 
365  // read XML using property tree. Should throw on error.
366  boost::property_tree::ptree xml;
367  boost::property_tree::read_xml(file, xml);
368 
369  auto it = xml.find("TESTSCONFIGURATION");
370  if (it == xml.not_found()) {
371  throw cms::Exception("QualityTester") << "QTest XML needs to have a TESTSCONFIGURATION node.";
372  }
373  auto& testconfig = it->second;
374  for (auto& kv : testconfig) {
375  // QTEST describes a QTest object (actually QCriterion) with its parameters
376  if (kv.first == "QTEST") {
377  auto& qtestconfig = kv.second;
378  auto name = qtestconfig.get<std::string>("<xmlattr>.name");
379  auto value = makeQCriterion(qtestconfig);
380  // LINK and QTEST can be in any order, so this element may or may not exist
381  qtestmap[name].qtest = std::move(value);
382  } // else
383  // LINK associates one ore more QTest referenced by name to a ME path pattern.
384  if (kv.first == "LINK") {
385  auto& linkconfig = kv.second;
386  auto pathpattern = linkconfig.get<std::string>("<xmlattr>.name");
387  for (auto& subkv : linkconfig) {
388  if (subkv.first == "TestName") {
389  std::string testname = subkv.second.data();
390  bool enabled = subkv.second.get<bool>("<xmlattr>.activate");
391  if (enabled) {
392  // LINK and QTEST can be in any order, so this element may or may not exist
393  qtestmap[testname].pathpatterns.push_back(pathpattern);
394  }
395  }
396  }
397  }
398  // else: unknown tag, but that is fine, its XML
399  }
400 
401  // now that we have all the objects created and references resolved, flatten
402  // the structure into something more useful for evaluating tests.
403  this->qtestobjects.clear();
404  this->qtestpatterns.clear();
405  for (auto& kv : qtestmap) {
406  QCriterion* bareptr = kv.second.qtest.get();
407  for (auto& p : kv.second.pathpatterns) {
408  this->qtestpatterns.push_back(std::make_pair(p, bareptr));
409  }
410  this->qtestobjects.push_back(std::move(kv.second.qtest));
411  }
412  // we could sort the patterns here to allow more performant matching
413  // (using a suffix-array to handle the "*" in the beginning)
414 }

References pixel_dqm_sourceclient-live_cfg::enabled, Exception, FrontierConditions_GlobalTag_cff::file, makeQCriterion(), eostools::move(), Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, qtestobjects, qtestpatterns, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by QualityTester().

◆ dqmAnalyze()

void QualityTester::dqmAnalyze ( DQMStore::IBooker ,
DQMStore::IGetter igetter,
const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

perform the actual quality tests

Reimplemented from DQMEDHarvester.

Definition at line 102 of file QualityTester.cc.

105  {
106  if (testInEventloop) {
107  nEvents++;
108  if (prescaleFactor > 0 && nEvents % prescaleFactor == 0) {
109  performTests(igetter);
110  }
111  }
112 }

References nEvents, performTests(), prescaleFactor, and testInEventloop.

◆ dqmEndJob()

void QualityTester::dqmEndJob ( DQMStore::IBooker ,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 133 of file QualityTester.cc.

133  {
134  if (qtestOnEndJob)
135  performTests(igetter);
136 }

References performTests(), and qtestOnEndJob.

◆ dqmEndLuminosityBlock()

void QualityTester::dqmEndLuminosityBlock ( DQMStore::IBooker ,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 114 of file QualityTester.cc.

117  {
119  if (prescaleFactor > 0 && lumiSeg.id().luminosityBlock() % prescaleFactor == 0) {
120  performTests(igetter);
121  }
122  }
123 }

References edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), performTests(), prescaleFactor, qtestOnEndLumi, and testInEventloop.

◆ dqmEndRun()

void QualityTester::dqmEndRun ( DQMStore::IBooker ,
DQMStore::IGetter igetter,
const edm::Run r,
const edm::EventSetup c 
)
overrideprotectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 125 of file QualityTester.cc.

128  {
129  if (qtestOnEndRun)
130  performTests(igetter);
131 }

References performTests(), and qtestOnEndRun.

◆ makeQCriterion()

std::unique_ptr< QCriterion > QualityTester::makeQCriterion ( boost::property_tree::ptree const &  config)
private

Definition at line 213 of file QualityTester.cc.

213  {
214  // For whatever reasons the compiler needs the "template" keyword on ptree::get.
215  // To save some noise in the code we have the preprocessor add it everywhere.
216 #define get template get
217  // TODO: make the parameter names more consistent.
218  // TODO: add defaults where it makes sense.
220  std::function<std::unique_ptr<QCriterion>(boost::property_tree::ptree const&, std::string& name)>>
221  qtestmakers = {{CheckVariance::getAlgoName(),
222  [](auto const& config, std::string& name) {
223  auto test = std::make_unique<CheckVariance>(name);
224  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
225  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
226  return test;
227  }},
229  [](auto const& config, std::string& name) {
230  auto test = std::make_unique<CompareLastFilledBin>(name);
231  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
232  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
233  test->setAverage(config.get<float>("AvVal"));
234  test->setMin(config.get<float>("MinVal"));
235  test->setMax(config.get<float>("MaxVal"));
236  return test;
237  }},
239  [](auto const& config, std::string& name) {
240  auto test = std::make_unique<CompareToMedian>(name);
241  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
242  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
243  test->setMin(config.get<float>("MinRel"));
244  test->setMax(config.get<float>("MaxRel"));
245  test->setMinMedian(config.get<float>("MinAbs"));
246  test->setMaxMedian(config.get<float>("MaxAbs"));
247  test->setEmptyBins(config.get<int>("UseEmptyBins"));
248  test->setStatCut(config.get<float>("StatCut", 0));
249  return test;
250  }},
252  [](auto const& config, std::string& name) {
253  auto test = std::make_unique<ContentSigma>(name);
254  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
255  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
256  test->setNumXblocks(config.get<int>("Xblocks"));
257  test->setNumYblocks(config.get<int>("Yblocks"));
258  test->setNumNeighborsX(config.get<int>("neighboursX"));
259  test->setNumNeighborsY(config.get<int>("neighboursY"));
260  test->setToleranceNoisy(config.get<double>("toleranceNoisy"));
261  test->setToleranceDead(config.get<double>("toleranceDead"));
262  test->setNoisy(config.get<double>("noisy"));
263  test->setDead(config.get<double>("dead"));
264  test->setXMin(config.get<int>("xMin"));
265  test->setXMax(config.get<int>("xMax"));
266  test->setYMin(config.get<int>("yMin"));
267  test->setYMax(config.get<int>("yMax"));
268  return test;
269  }},
271  [](auto const& config, std::string& name) {
272  auto test = std::make_unique<ContentsWithinExpected>(name);
273  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
274  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
275  test->setUseEmptyBins(config.get<bool>("useEmptyBins"));
276  test->setMinimumEntries(config.get<int>("minEntries"));
277  test->setMeanTolerance(config.get<float>("toleranceMean"));
278  if (config.get<double>("minMean", 0) || config.get<double>("maxMean", 0))
279  test->setMeanRange(config.get<double>("minMean"), config.get<double>("maxMean"));
280  if (config.get<double>("minRMS", 0) || config.get<double>("maxRMS", 0))
281  test->setRMSRange(config.get<double>("minRMS"), config.get<double>("maxRMS"));
282  return test;
283  }},
285  [](auto const& config, std::string& name) {
286  auto test = std::make_unique<ContentsXRange>(name);
287  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
288  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
289  test->setAllowedXRange(config.get<double>("xmin"), config.get<double>("xmax"));
290  return test;
291  }},
293  [](auto const& config, std::string& name) {
294  auto test = std::make_unique<ContentsYRange>(name);
295  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
296  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
297  test->setAllowedYRange(config.get<double>("ymin"), config.get<double>("ymax"));
298  test->setUseEmptyBins(config.get<bool>("useEmptyBins"));
299  return test;
300  }},
302  [](auto const& config, std::string& name) {
303  auto test = std::make_unique<DeadChannel>(name);
304  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
305  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
306  test->setThreshold(config.get<float>("threshold"));
307  return test;
308  }},
310  [](auto const& config, std::string& name) {
311  auto test = std::make_unique<MeanWithinExpected>(name);
312  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
313  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
314  test->setMinimumEntries(config.get<int>("minEntries", 0));
315  test->setExpectedMean(config.get<double>("mean"));
316  if (config.get<double>("useSigma", 0))
317  test->useSigma(config.get<double>("useSigma"));
318  if (config.get<int>("useRMS", 0))
319  test->useRMS();
320  if (config.get<int>("useRange", 0))
321  test->useRange(config.get<float>("xmin"), config.get<float>("xmax"));
322  return test;
323  }},
324  {NoisyChannel::getAlgoName(), [](auto const& config, std::string& name) {
325  auto test = std::make_unique<NoisyChannel>(name);
326  test->setWarningProb(config.get<float>("warning", QCriterion::WARNING_PROB_THRESHOLD));
327  test->setErrorProb(config.get<float>("error", QCriterion::ERROR_PROB_THRESHOLD));
328  test->setTolerance(config.get<double>("tolerance"));
329  test->setNumNeighbors(config.get<double>("neighbours"));
330  return test;
331  }}};
332 #undef get
333 
334  auto maker = qtestmakers.find(config.get<std::string>("TYPE"));
335  // Check if the type is known, error out otherwise.
336  if (maker == qtestmakers.end())
337  return nullptr;
338 
339  // The QTest XML format has structure
340  // <QTEST><TYPE>QTestClass</TYPE><PARAM name="thing">value</PARAM>...</QTEST>
341  // but that is a pain to read with property_tree. So we reorder the structure
342  // and add a child "thing" with data "value" for each param to a new tree.
343  // Then the qtestmakers can just config.get<type>("thing").
344  boost::property_tree::ptree reordered;
345  for (auto kv : config) {
346  // TODO: case sensitive?
347  if (kv.first == "PARAM") {
348  reordered.put(kv.second.get<std::string>("<xmlattr>.name"), kv.second.data());
349  }
350  }
351 
352  auto name = config.get<std::string>("<xmlattr>.name");
353  return maker->second(reordered, name);
354 }

References submitPVResolutionJobs::config, QCriterion::ERROR_PROB_THRESHOLD, ContentsXRange::getAlgoName(), ContentsYRange::getAlgoName(), DeadChannel::getAlgoName(), NoisyChannel::getAlgoName(), ContentSigma::getAlgoName(), ContentsWithinExpected::getAlgoName(), MeanWithinExpected::getAlgoName(), CompareToMedian::getAlgoName(), CompareLastFilledBin::getAlgoName(), CheckVariance::getAlgoName(), genParticles_cff::map, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, ctpps_dqm_sourceclient-live_cfg::test, and QCriterion::WARNING_PROB_THRESHOLD.

Referenced by configureTests().

◆ performTests()

void QualityTester::performTests ( DQMStore::IGetter igetter)
private

Definition at line 138 of file QualityTester.cc.

138  {
139  edm::LogVerbatim("QualityTester") << "Running the Quality Test";
140 
141  auto mes = igetter.getAllContents("");
142 
143  for (auto me : mes) {
144  std::string name = me->getFullname();
145  for (auto& kv : this->qtestpatterns) {
146  std::string& pattern = kv.first;
147  QCriterion* qtest = kv.second;
148  int match = fnmatch(pattern.c_str(), name.c_str(), 0);
149  if (match == FNM_NOMATCH)
150  continue;
151  if (match != 0)
152  throw cms::Exception("QualityTester")
153  << "Something went wrong with fnmatch: pattern = '" << pattern << "' and string = '" << name << "'";
154 
155  // name matched, apply test.
156  // Using the classic ME API for now.
157  QReport* qr;
158  DQMNet::QValue* qv;
159  me->getQReport(/* create */ true, qtest->getName(), qr, qv);
160  assert(qtest); // null might be valid, maybe replace with if
161  assert(qr);
162  assert(qv);
163  qtest->runTest(me, *qr, *qv);
164  // this propagates the result into the DQMNet object flags
165  me->syncCoreObject();
166  }
167  }
168 
169  if (!reportThreshold.empty()) {
170  // map {red, orange, black} -> [QReport message, ...]
171  std::map<std::string, std::vector<std::string>> theAlarms;
172  // populate from MEs hasError, hasWarning, hasOther
173  for (auto me : mes) {
174  // TODO: This logic is rather broken and suppresses errors when there
175  // are warnings (or suppresses both when there are others. But this is
176  // how it always was, and we keep it for now for compatibility.
177  std::vector<QReport*> report;
178  std::string colour;
179  if (me->hasError()) {
180  colour = "red";
181  report = me->getQErrors();
182  }
183  if (me->hasWarning()) {
184  colour = "orange";
185  report = me->getQWarnings();
186  }
187  if (me->hasOtherReport()) {
188  colour = "black";
189  report = me->getQOthers();
190  }
191  for (auto r : report) {
192  theAlarms[colour].push_back(r->getMessage());
193  }
194  }
195 
196  // writes to stdout, because it alyways wrote to stdout.
197  for (auto& theAlarm : theAlarms) {
198  const std::string& alarmType = theAlarm.first;
199  const std::vector<std::string>& msgs = theAlarm.second;
200  if ((reportThreshold == "black") ||
201  (reportThreshold == "orange" && (alarmType == "orange" || alarmType == "red")) ||
202  (reportThreshold == "red" && alarmType == "red")) {
203  std::cout << std::endl;
204  std::cout << "Error Type: " << alarmType << std::endl;
205  for (auto const& msg : msgs)
206  std::cout << msg << std::endl;
207  }
208  }
209  std::cout << std::endl;
210  }
211 }

References cms::cuda::assert(), gather_cfg::cout, Exception, dqm::implementation::IGetter::getAllContents(), QCriterion::getName(), match(), hlt_dqm_clientPB-live_cfg::me, mps_check::msg, Skims_PA_cff::name, topSingleLeptonDQM_PU_cfi::pattern, qtestpatterns, alignCSCRings::r, edmIntegrityCheck::report, reportThreshold, QCriterion::runTest(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqmAnalyze(), dqmEndJob(), dqmEndLuminosityBlock(), and dqmEndRun().

Member Data Documentation

◆ getQualityTestsFromFile

bool QualityTester::getQualityTestsFromFile
private

Definition at line 58 of file QualityTester.cc.

Referenced by QualityTester().

◆ Label

std::string QualityTester::Label
private

Definition at line 59 of file QualityTester.cc.

Referenced by QualityTester().

◆ nEvents

int QualityTester::nEvents
private

Definition at line 56 of file QualityTester.cc.

Referenced by dqmAnalyze(), looper.Looper::loop(), and QualityTester().

◆ prescaleFactor

int QualityTester::prescaleFactor
private

Definition at line 57 of file QualityTester.cc.

Referenced by dqmAnalyze(), dqmEndLuminosityBlock(), and QualityTester().

◆ qtestobjects

std::vector<std::unique_ptr<QCriterion> > QualityTester::qtestobjects
private

Definition at line 68 of file QualityTester.cc.

Referenced by configureTests().

◆ qtestOnEndJob

bool QualityTester::qtestOnEndJob
private

Definition at line 62 of file QualityTester.cc.

Referenced by dqmEndJob(), and QualityTester().

◆ qtestOnEndLumi

bool QualityTester::qtestOnEndLumi
private

Definition at line 63 of file QualityTester.cc.

Referenced by dqmEndLuminosityBlock(), and QualityTester().

◆ qtestOnEndRun

bool QualityTester::qtestOnEndRun
private

Definition at line 61 of file QualityTester.cc.

Referenced by dqmEndRun(), and QualityTester().

◆ qtestpatterns

std::vector<std::pair<std::string, QCriterion*> > QualityTester::qtestpatterns
private

Definition at line 73 of file QualityTester.cc.

Referenced by configureTests(), and performTests().

◆ reportThreshold

std::string QualityTester::reportThreshold
private

Definition at line 64 of file QualityTester.cc.

Referenced by performTests(), and QualityTester().

◆ testInEventloop

bool QualityTester::testInEventloop
private

Definition at line 60 of file QualityTester.cc.

Referenced by dqmAnalyze(), dqmEndLuminosityBlock(), and QualityTester().

◆ verboseQT

bool QualityTester::verboseQT
private

Definition at line 65 of file QualityTester.cc.

Referenced by QualityTester().

ContentSigma::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:277
QualityTester::reportThreshold
std::string reportThreshold
Definition: QualityTester.cc:64
QualityTester::makeQCriterion
std::unique_ptr< QCriterion > makeQCriterion(boost::property_tree::ptree const &config)
Definition: QualityTester.cc:213
QualityTester::testInEventloop
bool testInEventloop
Definition: QualityTester.cc:60
CompareLastFilledBin::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:653
NoisyChannel::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:227
QualityTester::qtestOnEndJob
bool qtestOnEndJob
Definition: QualityTester.cc:62
QualityTester::qtestpatterns
std::vector< std::pair< std::string, QCriterion * > > qtestpatterns
Definition: QualityTester.cc:73
QualityTester::nEvents
int nEvents
Definition: QualityTester.cc:56
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
QualityTester::configureTests
void configureTests(std::string const &file)
Definition: QualityTester.cc:356
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
ContentsWithinExpected::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:374
mps_check.msg
tuple msg
Definition: mps_check.py:285
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MonitorElementData::QReport::QValue
Definition: MonitorElementCollection.h:57
QualityTester::getQualityTestsFromFile
bool getQualityTestsFromFile
Definition: QualityTester.cc:58
dqm::implementation::IGetter::getAllContents
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:609
MeanWithinExpected::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:404
config
Definition: config.py:1
edm::FileInPath
Definition: FileInPath.h:64
test
Definition: SmallWORMDict.h:13
ctpps_dqm_sourceclient-live_cfg.test
test
Definition: ctpps_dqm_sourceclient-live_cfg.py:7
ContentsYRange::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:179
submitPVResolutionJobs.config
config
parse the configuration file
Definition: submitPVResolutionJobs.py:281
QualityTester::verboseQT
bool verboseQT
Definition: QualityTester.cc:65
CheckVariance::getAlgoName
static std::string getAlgoName()
get algorithm name
Definition: QTest.h:709
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
QCriterion::runTest
float runTest(const MonitorElement *me, QReport &qr, DQMNet::QValue &qv)
Definition: QTest.h:64
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
DQMEDHarvester::DQMEDHarvester
DQMEDHarvester()
Definition: DQMEDHarvester.h:98
ContentsXRange::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:155
MonitorElementData::QReport
Definition: MonitorElementCollection.h:55
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
value
Definition: value.py:1
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
edmIntegrityCheck.report
report
Definition: edmIntegrityCheck.py:349
DeadChannel::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:204
alignCSCRings.r
r
Definition: alignCSCRings.py:93
QCriterion::WARNING_PROB_THRESHOLD
static const float WARNING_PROB_THRESHOLD
default "probability" values for setting warnings & errors when running tests
Definition: QTest.h:61
QCriterion::getName
std::string getName() const
get name of quality test
Definition: QTest.h:41
eostools.move
def move(src, dest)
Definition: eostools.py:511
QCriterion
Definition: QTest.h:31
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
QualityTester::prescaleFactor
int prescaleFactor
Definition: QualityTester.cc:57
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
QualityTester::qtestOnEndRun
bool qtestOnEndRun
Definition: QualityTester.cc:61
QualityTester::Label
std::string Label
Definition: QualityTester.cc:59
QualityTester::qtestobjects
std::vector< std::unique_ptr< QCriterion > > qtestobjects
Definition: QualityTester.cc:68
QualityTester::qtestOnEndLumi
bool qtestOnEndLumi
Definition: QualityTester.cc:63
genParticles_cff.map
map
Definition: genParticles_cff.py:11
CompareToMedian::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:607
QCriterion::ERROR_PROB_THRESHOLD
static const float ERROR_PROB_THRESHOLD
Definition: QTest.h:62
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
QualityTester::performTests
void performTests(DQMStore::IGetter &igetter)
Definition: QualityTester.cc:138
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
pixel_dqm_sourceclient-live_cfg.enabled
enabled
Definition: pixel_dqm_sourceclient-live_cfg.py:136