30 #include <boost/property_tree/xml_parser.hpp>
31 #include <boost/property_tree/ptree.hpp>
94 assert(!
"Reading from DB no longer supported.");
143 for (
auto me : mes) {
149 if (
match == FNM_NOMATCH)
153 <<
"Something went wrong with fnmatch: pattern = '" <<
pattern <<
"' and string = '" <<
name <<
"'";
159 me->getQReport(
true, qtest->
getName(), qr, qv);
165 me->syncCoreObject();
171 std::map<std::string, std::vector<std::string>> theAlarms;
173 for (
auto me : mes) {
177 std::vector<QReport*>
report;
179 if (
me->hasError()) {
183 if (
me->hasWarning()) {
187 if (
me->hasOtherReport()) {
192 theAlarms[colour].push_back(
r->getMessage());
197 for (
auto& theAlarm : theAlarms) {
199 const std::vector<std::string>& msgs = theAlarm.second;
201 (
reportThreshold ==
"orange" && (alarmType ==
"orange" || alarmType ==
"red")) ||
204 std::cout <<
"Error Type: " << alarmType << std::endl;
205 for (
auto const&
msg : msgs)
216 #define get template get
220 std::function<std::unique_ptr<QCriterion>(boost::property_tree::ptree
const&,
std::string&
name)>>
223 auto test = std::make_unique<CheckVariance>(
name);
230 auto test = std::make_unique<CompareLastFilledBin>(
name);
240 auto test = std::make_unique<CompareToMedian>(
name);
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));
253 auto test = std::make_unique<ContentSigma>(
name);
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"));
272 auto test = std::make_unique<ContentsWithinExpected>(
name);
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"));
286 auto test = std::make_unique<ContentsXRange>(
name);
289 test->setAllowedXRange(
config.get<
double>(
"xmin"),
config.get<
double>(
"xmax"));
294 auto test = std::make_unique<ContentsYRange>(
name);
297 test->setAllowedYRange(
config.get<
double>(
"ymin"),
config.get<
double>(
"ymax"));
298 test->setUseEmptyBins(
config.get<
bool>(
"useEmptyBins"));
303 auto test = std::make_unique<DeadChannel>(
name);
306 test->setThreshold(
config.get<
float>(
"threshold"));
311 auto test = std::make_unique<MeanWithinExpected>(
name);
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))
320 if (
config.get<
int>(
"useRange", 0))
325 auto test = std::make_unique<NoisyChannel>(
name);
328 test->setTolerance(
config.get<
double>(
"tolerance"));
329 test->setNumNeighbors(
config.get<
double>(
"neighbours"));
336 if (maker == qtestmakers.end())
344 boost::property_tree::ptree reordered;
347 if (kv.first ==
"PARAM") {
348 reordered.put(kv.second.get<
std::string>(
"<xmlattr>.name"), kv.second.data());
353 return maker->second(reordered,
name);
360 std::unique_ptr<QCriterion> qtest;
361 std::vector<std::string> pathpatterns;
363 std::map<std::string, TestItem> qtestmap;
366 boost::property_tree::ptree xml;
367 boost::property_tree::read_xml(
file, xml);
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.";
373 auto& testconfig = it->second;
374 for (
auto& kv : testconfig) {
376 if (kv.first ==
"QTEST") {
377 auto& qtestconfig = kv.second;
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") {
390 bool enabled = subkv.second.get<
bool>(
"<xmlattr>.activate");
393 qtestmap[testname].pathpatterns.push_back(pathpattern);
405 for (
auto& kv : qtestmap) {
407 for (
auto&
p : kv.second.pathpatterns) {