CMS 3D CMS Logo

QTest.h
Go to the documentation of this file.
1 #ifndef DQMSERVICES_CORE_Q_CRITERION_H
2 # define DQMSERVICES_CORE_Q_CRITERION_H
3 
5 # include "TProfile2D.h"
6 # include "TProfile.h"
7 # include "TH2F.h"
8 # include "TH1F.h"
9 # include <sstream>
10 # include <string>
11 # include <map>
12 #include <utility>
13 
14 //#include "DQMServices/Core/interface/DQMStore.h"
15 
27 //class AllContentWithinFixedRange; typedef AllContentWithinFixedRange RuleAllContentWithinFixedRange; typedef AllContentWithinFixedRange AllContentWithinFixedRangeROOT;
28 //class AllContentWithinFloatingRange; typedef AllContentWithinFloatingRange RuleAllContentWithinFloatingRange; typedef AllContentWithinFloatingRange AllContentWithinFloatingRangeROOT;
29 class FlatOccupancy1d; using RuleFlatOccupancy1d = FlatOccupancy1d; using FlatOccupancy1dROOT = FlatOccupancy1d;
31 class CSC01; using RuleCSC01 = CSC01; using CSC01ROOT = CSC01;
32 class AllContentAlongDiagonal; using RuleAllContentAlongDiagonal = AllContentAlongDiagonal; using AllContentAlongDiagonalROOT = AllContentAlongDiagonal;
36 
50 {
52 
53 public:
54 
56  int getStatus() const { return status_; }
58  std::string getMessage() const { return message_; }
60  std::string getName() const { return qtname_; }
62  std::string algoName() const { return algoName_; }
64  void setWarningProb(float prob) { warningProb_ = prob; }
65  void setErrorProb(float prob) { errorProb_ = prob; }
68  virtual std::vector<DQMChannel> getBadChannels() const
69  { return std::vector<DQMChannel>(); }
70 
71 protected:
72  QCriterion(std::string qtname) { qtname_ = std::move(qtname); init(); }
74  void init();
75 
76  virtual ~QCriterion() = default;
77 
78  virtual float runTest(const MonitorElement *me);
81 
82  float runTest(const MonitorElement *me, QReport &qr, DQMNet::QValue &qv) {
83  assert(qr.qcriterion_ == this);
84  assert(qv.qtname == qtname_);
85 
86  prob_ = runTest(me); // this runTest goes to SimpleTest derivates
87 
91 
92  setMessage(); // this goes to SimpleTest derivates
93 
94  if (verbose_==2) std::cout << " Message = " << message_ << std::endl;
95  if (verbose_==2) std::cout << " Name = " << qtname_ <<
96  " / Algorithm = " << algoName_ <<
97  " / Status = " << status_ <<
98  " / Prob = " << prob_ << std::endl;
99 
100  qv.code = status_;
101  qv.message = message_;
102  qv.qtname = qtname_;
103  qv.algorithm = algoName_;
104  qv.qtresult = prob_;
106 
107  return prob_;
108  }
109 
111  virtual void setMessage() = 0;
112 
115  float prob_;
116  int status_;
120  int verbose_;
121 
122 private:
124  static const float WARNING_PROB_THRESHOLD;
125  static const float ERROR_PROB_THRESHOLD;
126 
128  friend class DQMStore;
130  friend class MonitorElement;
131 };
132 
136 
137 class SimpleTest : public QCriterion
138 {
139 public:
140  SimpleTest(const std::string &name, bool keepBadChannels = false) : QCriterion(name),
141  minEntries_ (0),
142  keepBadChannels_ (keepBadChannels)
143  {}
144 
146  void setMinimumEntries(unsigned n) { minEntries_ = n; }
148  std::vector<DQMChannel> getBadChannels() const override
149  {
150  return keepBadChannels_ ? badChannels_ : QCriterion::getBadChannels();
151  }
152 
153 protected:
154 
156  void setMessage() override
157  {
158  message_.clear();
159  }
160 
161  unsigned minEntries_; //< minimum # of entries needed
162  std::vector<DQMChannel> badChannels_;
164  };
165 
166 
167 //===============================================================//
168 //========= Classes for particular QUALITY TESTS ================//
169 //===============================================================//
170 
171 //===================== Comp2RefEqualH ===================//
172 //== Algorithm for comparing equality of histograms ==//
174 {
175 public:
177  {
178  setAlgoName( getAlgoName() );
179  }
180  static std::string getAlgoName() { return "Comp2RefEqualH"; }
181  float runTest(const MonitorElement*me) override;
182 };
183 
184 //===================== Comp2RefChi2 ===================//
185 // comparison to reference using the chi^2 algorithm
186 class Comp2RefChi2 : public SimpleTest
187 {
188 public:
190  {
191  setAlgoName(getAlgoName());
192  }
193  static std::string getAlgoName() { return "Comp2RefChi2"; }
194  float runTest(const MonitorElement*me) override;
195 
196 protected:
197 
198  void setMessage() override
199  {
200  std::ostringstream message;
201  message << "chi2/Ndof = " << chi2_ << "/" << Ndof_
202  << ", minimum needed statistics = " << minEntries_
203  << " warning threshold = " << this->warningProb_
204  << " error threshold = " << this->errorProb_;
205  message_ = message.str();
206  }
207 
208  // # of degrees of freedom and chi^2 for test
209  int Ndof_; double chi2_;
210 };
211 
212 //===================== Comp2Ref2DChi2 =================//
213 // comparison to reference using the 2D chi^2 algorithm
215 {
216 public:
218  {
219  setAlgoName(getAlgoName());
220  }
221  static std::string getAlgoName() { return "Comp2Ref2DChi2"; }
222  float runTest(const MonitorElement*me) override;
223 
224 protected:
225 
226  void setMessage() override
227  {
228  std::ostringstream message;
229  message << "chi2/Ndof = " << chi2_ << "/" << Ndof_
230  << ", minimum needed statistics = " << minEntries_
231  << " warning threshold = " << this->warningProb_
232  << " error threshold = " << this->errorProb_;
233  message_ = message.str();
234  }
235 
236  // # of degrees of freedom and chi^2 for test
237  int Ndof_; double chi2_;
238 };
239 
240 //===================== Comp2RefKolmogorov ===================//
243 {
244 public:
246  {
247  setAlgoName(getAlgoName());
248  }
249  static std::string getAlgoName() { return "Comp2RefKolmogorov"; }
250 
251  float runTest(const MonitorElement *me) override;
252 };
253 
254 //==================== ContentsXRange =========================//
255 //== Check that histogram contents are between [Xmin, Xmax] ==//
257 {
258 public:
260  {
261  rangeInitialized_ = false;
262  setAlgoName(getAlgoName());
263  }
264  static std::string getAlgoName() { return "ContentsXRange"; }
265  float runTest(const MonitorElement *me) override ;
266 
268  virtual void setAllowedXRange(double xmin, double xmax)
269  {
270  xmin_ = xmin; xmax_ = xmax;
271  rangeInitialized_ = true;
272  }
273 
274 protected:
275  double xmin_;double xmax_;
277 };
278 
279 //==================== ContentsYRange =========================//
280 //== Check that histogram contents are between [Ymin, Ymax] ==//
282 {
283 public:
285  {
286  rangeInitialized_ = false;
287  setAlgoName(getAlgoName());
288  }
289  static std::string getAlgoName() { return "ContentsYRange"; }
290  float runTest(const MonitorElement *me) override;
291 
292  void setUseEmptyBins(unsigned int useEmptyBins) { useEmptyBins_ = useEmptyBins; }
293  virtual void setAllowedYRange(double ymin, double ymax)
294  {
295  ymin_ = ymin; ymax_ = ymax;
296  rangeInitialized_ = true;
297  }
298 
299 protected:
300  double ymin_; double ymax_;
302  unsigned int useEmptyBins_;
303 
304 };
305 
306 //============================== DeadChannel =================================//
308 class DeadChannel : public SimpleTest
309 {
310 public:
312  {
313  rangeInitialized_ = false;
314  setAlgoName(getAlgoName());
315  }
316  static std::string getAlgoName() { return "DeadChannel"; }
317  float runTest(const MonitorElement *me) override;
318 
320  void setThreshold(double ymin)
321  {
322  ymin_ = ymin;
323  rangeInitialized_ = true;
324  }
325 
326 protected:
327  double ymin_;
329 };
330 
331 
332 //==================== NoisyChannel =========================//
334 class NoisyChannel : public SimpleTest
335 {
336 public:
338  {
339  rangeInitialized_ = false;
340  numNeighbors_ = 1;
341  setAlgoName(getAlgoName());
342  }
343  static std::string getAlgoName() { return "NoisyChannel"; }
344  float runTest(const MonitorElement*me) override;
345 
353  void setNumNeighbors(unsigned n) { if (n > 0) numNeighbors_ = n; }
354 
359  void setTolerance(float percentage)
360  {
361  if (percentage >=0)
362  {
363  tolerance_ = percentage;
364  rangeInitialized_ = true;
365  }
366  }
367 
368 protected:
371  double getAverage(int bin, const TH1 *h) const;
372  double getAverage2D(int binX, int binY, const TH2 *h) const;
373 
374  float tolerance_; /*< tolerance for considering a channel noisy */
375  unsigned numNeighbors_; /*< # of neighboring channels for calculating average to be used
376  for comparison with channel under consideration */
377  bool rangeInitialized_; /*< init-flag for tolerance */
378 };
379 
380 //===============ContentSigma (Emma Yeager and Chad Freer)=====================//
382 class ContentSigma : public SimpleTest
383 {
384 public:
386  {
387  rangeInitialized_ = false;
388  numXblocks_ = 1;
389  numYblocks_ = 1;
390  numNeighborsX_ = 1;
391  numNeighborsY_ = 1;
392  setAlgoName(getAlgoName());
393  }
394  static std::string getAlgoName() { return "ContentSigma"; }
395 
396  float runTest(const MonitorElement*me) override;
404  void setNumXblocks(unsigned ncx) { if (ncx > 0) numXblocks_ = ncx; }
405  void setNumYblocks(unsigned ncy) { if (ncy > 0) numYblocks_ = ncy; }
406  void setNumNeighborsX(unsigned ncx) { if (ncx > 0) numNeighborsX_ = ncx; }
407  void setNumNeighborsY(unsigned ncy) { if (ncy > 0) numNeighborsY_ = ncy; }
408 
412  void setToleranceNoisy(float factorNoisy)
413  {
414  if (factorNoisy >=0)
415  {
416  toleranceNoisy_ = factorNoisy;
417  rangeInitialized_ = true;
418  }
419  }
420  void setToleranceDead(float factorDead)
421  {
422  if (factorDead >=0)
423  {
424  toleranceDead_ = factorDead;
425  rangeInitialized_ = true;
426  }
427  }
428  void setNoisy(bool noisy) {
429  noisy_ = noisy;
430  }
431  void setDead(bool dead) {
432  dead_ = dead;
433  }
434 
435  void setXMin(unsigned xMin) {
436  xMin_ = xMin;
437  }
438  void setXMax(unsigned xMax) {
439  xMax_ = xMax;
440  }
441  void setYMin(unsigned yMin) {
442  yMin_ = yMin;
443  }
444  void setYMax(unsigned yMax) {
445  yMax_ = yMax;
446  }
447 
448 protected:
450  // double getNeighborSum(int binX, int binY, unsigned Xblocks, unsigned Yblocks, unsigned neighborsX, unsigned neighborsY, const TH1 *h) const;
451  double getNeighborSum(unsigned groupx, unsigned groupy, unsigned Xblocks, unsigned Yblocks, unsigned neighborsX, unsigned neighborsY, const TH1 *h) const;
452  double getNeighborSigma(double average, unsigned groupx, unsigned groupy, unsigned Xblocks, unsigned Yblocks, unsigned neighborsX, unsigned neighborsY, const TH1 *h) const;
453 
454  bool noisy_; bool dead_; /*< declare if test will be checking for noisy channels, dead channels, or both */
455  float toleranceNoisy_; /*< factor by which sigma is compared for noisy channels */
456  float toleranceDead_; /*< factor by which sigma is compared for dead channels*/
457  unsigned numXblocks_;
458  unsigned numYblocks_;
459  unsigned numNeighborsX_; /*< # of neighboring channels along x-axis for calculating average to be used
460  for comparison with channel under consideration */
461  unsigned numNeighborsY_; /*< # of neighboring channels along y-axis for calculating average to be used
462  for comparison with channel under consideration */
463  bool rangeInitialized_; /*< init-flag for tolerance */
464  unsigned xMin_;
465  unsigned xMax_;
466  unsigned yMin_;
467  unsigned yMax_;
468 };
469 
470 
471 //==================== ContentsWithinExpected =========================//
472 // Check that every TH2 channel has mean, RMS within allowed range.
474 {
475 public:
477  {
478  checkMean_ = checkRMS_ = false;
479  minMean_ = maxMean_ = minRMS_ = maxRMS_ = 0.0;
480  checkMeanTolerance_ = false;
481  toleranceMean_ = -1.0;
482  setAlgoName(getAlgoName());
483  }
484  static std::string getAlgoName() { return "ContentsWithinExpected"; }
485  float runTest(const MonitorElement *me) override;
486 
487  void setUseEmptyBins(unsigned int useEmptyBins) {
488  useEmptyBins_ = useEmptyBins;
489  }
490  void setMeanRange(double xmin, double xmax);
491  void setRMSRange(double xmin, double xmax);
492 
494  void setMeanTolerance(float fracTolerance)
495  {
496  if (fracTolerance >= 0.0)
497  {
498  toleranceMean_ = fracTolerance;
499  checkMeanTolerance_ = true;
500  }
501  }
502 
503 protected:
504  bool checkMean_; //< if true, check the mean value
505  bool checkRMS_; //< if true, check the RMS value
506  bool checkMeanTolerance_; //< if true, check mean tolerance
507  float toleranceMean_; //< fractional tolerance on mean (use only if checkMeanTolerance_ = true)
508  float minMean_, maxMean_; //< allowed range for mean (use only if checkMean_ = true)
509  float minRMS_, maxRMS_; //< allowed range for mean (use only if checkRMS_ = true)
510  unsigned int useEmptyBins_;
511 
512 };
513 
514 //==================== MeanWithinExpected =========================//
517 {
518 public:
520  {
521  setAlgoName(getAlgoName());
522  }
523  static std::string getAlgoName() { return "MeanWithinExpected"; }
524  float runTest(const MonitorElement*me) override;
525 
526  void setExpectedMean(double mean) { expMean_ = mean; }
527  void useRange(double xmin, double xmax);
528  void useSigma(double expectedSigma);
529  void useRMS() ;
530 
531 protected:
532  bool useRMS_; //< if true, will use RMS of distribution
533  bool useSigma_; //< if true, will use expected_sigma
534  bool useRange_; //< if true, will use allowed range
535  double sigma_; //< sigma to be used in probability calculation (use only if useSigma_ = true)
536  double expMean_; //< expected mean value (used only if useSigma_ = true or useRMS_ = true)
537  double xmin_, xmax_; //< allowed range for mean (use only if useRange_ = true)
538 
539 };
540 
541 //==================== AllContentWithinFixedRange =========================//
542 /*class AllContentWithinFixedRange : public SimpleTest
543 {
544 public:
545  AllContentWithinFixedRange(const std::string &name) : SimpleTest(name)
546  {
547  setAlgoName(getAlgoName());
548  }
549  static std::string getAlgoName(void) { return "RuleAllContentWithinFixedRange"; }
550  float runTest(const MonitorElement *me);
551 
552  void set_x_min(double x) { x_min = x; }
553  void set_x_max(double x) { x_max = x; }
554  void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
555  void set_S_fail(double S) { S_fail = S; }
556  void set_S_pass(double S) { S_pass = S; }
557  double get_epsilon_obs(void) { return epsilon_obs; }
558  double get_S_fail_obs(void) { return S_fail_obs; }
559  double get_S_pass_obs(void) { return S_pass_obs; }
560  int get_result(void) { return result; }
561 
562 protected:
563  TH1F *histogram ; //define Test histo
564  double x_min, x_max;
565  double epsilon_max;
566  double S_fail, S_pass;
567  double epsilon_obs;
568  double S_fail_obs, S_pass_obs;
569  int result;
570 };
571 */
572 //==================== AllContentWithinFloatingRange =========================//
573 /*class AllContentWithinFloatingRange : public SimpleTest
574 {
575 public:
576  AllContentWithinFloatingRange(const std::string &name) : SimpleTest(name)
577  {
578  setAlgoName(getAlgoName());
579  }
580  static std::string getAlgoName(void) { return "RuleAllContentWithinFloatingRange"; }
581 
582  void set_Nrange(int N) { Nrange = N; }
583  void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
584  void set_S_fail(double S) { S_fail = S; }
585  void set_S_pass(double S) { S_pass = S; }
586  double get_epsilon_obs(void) { return epsilon_obs; }
587  double get_S_fail_obs(void) { return S_fail_obs; }
588  double get_S_pass_obs(void) { return S_pass_obs; }
589  int get_result(void) { return result; }
590 
591  float runTest(const MonitorElement *me );
592 
593 protected:
594  TH1F *histogram ; //define Test histo
595  int Nrange;
596  double epsilon_max;
597  double S_fail, S_pass;
598  double epsilon_obs;
599  double S_fail_obs, S_pass_obs;
600  int result;
601 };*/
602 
603 //==================== FlatOccupancy1d =========================//
604 #if 0 // FIXME: need to know what parameters to set before runTest!
605 class FlatOccupancy1d : public SimpleTest
606 {
607 public:
608  FlatOccupancy1d(const std::string &name) : SimpleTest(name)
609  {
610  Nbins = 0;
611  FailedBins[0] = 0;
612  FailedBins[1] = 0;
613  setAlgoName(getAlgoName());
614  }
615 
616  ~FlatOccupancy1d(void)
617  {
618  delete [] FailedBins[0];
619  delete [] FailedBins[1];
620  }
621 
622  static std::string getAlgoName(void) { return "RuleFlatOccupancy1d"; }
623 
624  void set_ExclusionMask(double *mask) { ExclusionMask = mask; }
625  void set_epsilon_min(double epsilon) { epsilon_min = epsilon; }
626  void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
627  void set_S_fail(double S) { S_fail = S; }
628  void set_S_pass(double S) { S_pass = S; }
629  double get_FailedBins(void) { return *FailedBins[1]; } // FIXME: WRONG! OFF BY ONE!?
630  int get_result() { return result; }
631 
632  float runTest(const MonitorElement*me);
633 
634 protected:
635  double *ExclusionMask;
636  double epsilon_min, epsilon_max;
637  double S_fail, S_pass;
638  double *FailedBins[2];
639  int Nbins;
640  int result;
641 };
642 #endif
643 
644 //==================== FixedFlatOccupancy1d =========================//
646 {
647 public:
649  {
650  Nbins = 0;
651  FailedBins[0] = nullptr;
652  FailedBins[1] = nullptr;
653  setAlgoName(getAlgoName());
654  }
655 
657  {
658  if( Nbins > 0 )
659  {
660  delete [] FailedBins[0];
661  delete [] FailedBins[1];
662  }
663  }
664 
665  static std::string getAlgoName() { return "RuleFixedFlatOccupancy1d"; }
666 
667  void set_Occupancy(double level) { b = level; }
668  void set_ExclusionMask(double *mask) { ExclusionMask = mask; }
669  void set_epsilon_min(double epsilon) { epsilon_min = epsilon; }
670  void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
671  void set_S_fail(double S) { S_fail = S; }
672  void set_S_pass(double S) { S_pass = S; }
673  double get_FailedBins() { return *FailedBins[1]; } // FIXME: WRONG! OFF BY ONE!?
674  int get_result() { return result; }
675 
676  float runTest(const MonitorElement*me) override;
677 
678 protected:
679  double b;
680  double *ExclusionMask;
681  double epsilon_min, epsilon_max;
682  double S_fail, S_pass;
683  double *FailedBins[2];
684  int Nbins;
685  int result;
686 };
687 
688 //==================== CSC01 =========================//
689 class CSC01 : public SimpleTest
690 {
691 public:
693  {
694  setAlgoName(getAlgoName());
695  }
696  static std::string getAlgoName() { return "RuleCSC01"; }
697 
698  void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
699  void set_S_fail(double S) { S_fail = S; }
700  void set_S_pass(double S) { S_pass = S; }
701  double get_epsilon_obs() { return epsilon_obs; }
702  double get_S_fail_obs() { return S_fail_obs; }
703  double get_S_pass_obs() { return S_pass_obs; }
704  int get_result() { return result; }
705 
706  float runTest(const MonitorElement*me) override;
707 
708 protected:
709  double epsilon_max;
710  double S_fail, S_pass;
711  double epsilon_obs;
712  double S_fail_obs, S_pass_obs;
713  int result;
714 };
715 
716 //======================== CompareToMedian ====================//
718 {
719 public:
720  //Initialize for TProfile, colRings
722  this->_min = 0.2;
723  this->_max = 3.0;
724  this->_emptyBins = 0;
725  this->_maxMed = 10;
726  this->_minMed = 0;
727  this->nBins = 0;
728  this->_statCut = 0;
729  reset();
730  setAlgoName( getAlgoName() );
731  };
732 
733  ~CompareToMedian() override= default;;
734 
735  static std::string getAlgoName() { return "CompareToMedian"; }
736 
737  float runTest(const MonitorElement *me) override;
738  void setMin(float min){_min = min;};
739  void setMax(float max){_max = max;};
740  void setEmptyBins(int eB){eB > 0 ? _emptyBins = 1 : _emptyBins = 0;};
741  void setMaxMedian(float max){_maxMed = max;};
742  void setMinMedian(float min){_minMed = min;};
743  void setStatCut(float cut){_statCut = (cut > 0) ? cut : 0;};
744 
745 protected :
746  void setMessage() override{
747  std::ostringstream message;
748  message << "Test " << qtname_ << " (" << algoName_
749  << "): Entry fraction within range = " << prob_;
750  message_ = message.str();
751  }
752 
753 private :
754  float _min, _max; //Test values
755  int _emptyBins; //use empty bins
756  float _maxMed,_minMed; //Global max for median&mean
757  float _statCut; //Minimal number of non zero entries needed for the quality test
758 
759  int nBinsX, nBinsY; //Dimensions of hystogram
760 
761  int nBins; //Number of (non empty) bins
762 
763  //Vector contain bin values
764  std::vector<float> binValues;
765 
766  void reset(){binValues.clear();};
767 
768 };
769 //======================== CompareLastFilledBin ====================//
771 {
772 public:
773  //Initialize for TProfile, colRings
775  this->_min = 0.0;
776  this->_max = 1.0;
777  this->_average = 0.0;
778  setAlgoName( getAlgoName() );
779  };
780 
781  ~CompareLastFilledBin() override= default;;
782 
783  static std::string getAlgoName() { return "CompareLastFilledBin"; }
784 
785  float runTest(const MonitorElement *me) override;
786  void setAverage(float average){_average = average;};
787  void setMin(float min){_min = min;};
788  void setMax(float max){_max = max;};
789 
790 
791 protected :
792  void setMessage() override{
793  std::ostringstream message;
794  message << "Test " << qtname_ << " (" << algoName_
795  << "): Last Bin filled with desired value = " << prob_;
796  message_ = message.str();
797  }
798 
799 private :
800  float _min, _max; //Test values
801  float _average;
802 };
803 
804 //==================== AllContentAlongDiagonal =========================//
805 #if 0 // FIXME: need to know what parameters to set before runTest!
806 class AllContentAlongDiagonal : public SimpleTest
807 
808 public:
809  AllContentAlongDiagonal(const std::string &name) : SimpleTest(name)
810  {
811  setAlgoName(getAlgoName());
812  }
813  static std::string getAlgoName(void) { return "RuleAllContentAlongDiagonal"; }
814 
815  void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
816  void set_S_fail(double S) { S_fail = S; }
817  void set_S_pass(double S) { S_pass = S; }
818  double get_epsilon_obs() { return epsilon_obs; }
819  double get_S_fail_obs() { return S_fail_obs; }
820  double get_S_pass_obs() { return S_pass_obs; }
821  int get_result() { return result; }
822 
823  //public:
824  //using SimpleTest::runTest;
825  float runTest(const MonitorElement*me);
826 
827 protected:
828  double epsilon_max;
829  double S_fail, S_pass;
830  double epsilon_obs;
831  double S_fail_obs, S_pass_obs;
832  int result;
833 };
834 #endif
835 //==================== CheckVariance =========================//
836 //== Check the variance of a TProfile//
837 class CheckVariance : public SimpleTest
838 {
839  public:
841  {
842  setAlgoName(getAlgoName());
843  }
845  static std::string getAlgoName() { return "CheckVariance"; }
846  float runTest(const MonitorElement *me) override ;
847 };
848 #endif // DQMSERVICES_CORE_Q_CRITERION_H
void setErrorProb(float prob)
Definition: QTest.h:65
static std::string getAlgoName()
Definition: QTest.h:193
void set_epsilon_min(double epsilon)
Definition: QTest.h:669
QCriterion * qcriterion_
Definition: QReport.h:51
void setStatCut(float cut)
Definition: QTest.h:743
FlatOccupancy1d RuleFlatOccupancy1d
Definition: QTest.h:29
double get_S_pass_obs()
Definition: QTest.h:703
void setDead(bool dead)
Definition: QTest.h:431
double xmin_
Definition: QTest.h:537
unsigned numYblocks_
Definition: QTest.h:458
Comp2RefEqualH(const std::string &name)
Definition: QTest.h:176
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:80
test that histogram contents are above Ymin
Definition: QTest.h:308
double ymin_
ymin - threshold
Definition: QTest.h:327
double epsilon_max
Definition: QTest.h:709
CSC01(const std::string &name)
Definition: QTest.h:692
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:140
std::string algorithm
Definition: DQMNet.h:94
FlatOccupancy1d FlatOccupancy1dROOT
Definition: QTest.h:29
bool verbose
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void set_ExclusionMask(double *mask)
Definition: QTest.h:668
void setUseEmptyBins(unsigned int useEmptyBins)
Definition: QTest.h:292
void setMin(float min)
Definition: QTest.h:738
double epsilon_obs
Definition: QTest.h:711
double get_FailedBins()
Definition: QTest.h:673
int verbose_
Definition: QTest.h:120
void setXMax(unsigned xMax)
Definition: QTest.h:438
float _statCut
Definition: QTest.h:757
int status_
Definition: QTest.h:116
virtual void setAllowedXRange(double xmin, double xmax)
set allowed range in X-axis (default values: histogram&#39;s X-range)
Definition: QTest.h:268
AllContentAlongDiagonal AllContentAlongDiagonalROOT
Definition: QTest.h:32
void setMessage() override
set status & message after test has run
Definition: QTest.h:156
std::vector< DQMChannel > getBadChannels() const override
get vector of channels that failed test (not always relevant!)
Definition: QTest.h:148
float runTest(const MonitorElement *me, QReport &qr, DQMNet::QValue &qv)
Definition: QTest.h:82
double * ExclusionMask
Definition: QTest.h:680
unsigned yMax_
Definition: QTest.h:467
std::string algoName_
name of quality test
Definition: QTest.h:114
static const int WARNING
int get_result()
Definition: QTest.h:704
double S_pass
Definition: QTest.h:710
virtual ~QCriterion()=default
int _emptyBins
Definition: QTest.h:755
double S_pass_obs
Definition: QTest.h:712
void setMax(float max)
Definition: QTest.h:739
void setMin(float min)
Definition: QTest.h:787
virtual std::vector< DQMChannel > getBadChannels() const
Definition: QTest.h:68
static std::string getAlgoName()
Definition: QTest.h:249
std::string qtname_
Definition: QTest.h:113
void setNumNeighbors(unsigned n)
Definition: QTest.h:353
std::string getMessage() const
get message attached to test
Definition: QTest.h:58
void init()
initialize values
Definition: QTest.cc:18
Algorithm for testing if histogram&#39;s mean value is near expected value.
Definition: QTest.h:516
CheckVariance(const std::string &name)
Definition: QTest.h:840
DeadChannel(const std::string &name)
Definition: QTest.h:311
ContentsXRange(const std::string &name)
Definition: QTest.h:259
Check if any channels are noisy compared to neighboring ones.
Definition: QTest.h:334
ContentSigma(const std::string &name)
Definition: QTest.h:385
static std::string getAlgoName()
Definition: QTest.h:221
double epsilon_min
Definition: QTest.h:681
static std::string getAlgoName()
Definition: QTest.h:735
int Ndof_
Definition: QTest.h:209
bool rangeInitialized_
Definition: QTest.h:276
float errorProb_
Definition: QTest.h:118
void setYMax(unsigned yMax)
Definition: QTest.h:444
double get_S_fail_obs()
Definition: QTest.h:702
static std::string getAlgoName()
Definition: QTest.h:523
float _minMed
Definition: QTest.h:756
void setMessage() override
set status & message after test has run
Definition: QTest.h:226
FixedFlatOccupancy1d(const std::string &name)
Definition: QTest.h:648
void setYMin(unsigned yMin)
Definition: QTest.h:441
void setEmptyBins(int eB)
Definition: QTest.h:740
void set_Occupancy(double level)
Definition: QTest.h:667
void set_epsilon_max(double epsilon)
Definition: QTest.h:698
float prob_
name of algorithm
Definition: QTest.h:115
static std::string getAlgoName()
Definition: QTest.h:264
unsigned numXblocks_
Definition: QTest.h:457
CompareLastFilledBin(const std::string &name)
Definition: QTest.h:774
static const float ERROR_PROB_THRESHOLD
Definition: QTest.h:125
void setTolerance(float percentage)
Definition: QTest.h:359
void setMessage() override
set status & message after test has run
Definition: QTest.h:792
unsigned int useEmptyBins_
Definition: QTest.h:510
T min(T a, T b)
Definition: MathUtil.h:58
void setMinimumEntries(unsigned n)
set minimum # of entries needed
Definition: QTest.h:146
float toleranceNoisy_
Definition: QTest.h:455
int getStatus() const
(class should be created by DQMStore class)
Definition: QTest.h:56
void reset()
Definition: QTest.h:766
bool checkMeanTolerance_
Definition: QTest.h:506
ContentsWithinExpected(const std::string &name)
Definition: QTest.h:476
void setExpectedMean(double mean)
Definition: QTest.h:526
bool keepBadChannels_
Definition: QTest.h:163
double xmin_
Definition: QTest.h:275
bool rangeInitialized_
Definition: QTest.h:463
std::string qtname
Definition: DQMNet.h:93
void setUseEmptyBins(unsigned int useEmptyBins)
Definition: QTest.h:487
double sigma_
Definition: QTest.h:535
void setMaxMedian(float max)
Definition: QTest.h:741
std::string message_
quality test status
Definition: QTest.h:117
bin
set the eta bin as selection string.
int result
Definition: QTest.h:713
unsigned numNeighborsY_
Definition: QTest.h:461
void set_epsilon_max(double epsilon)
Definition: QTest.h:670
void setNumNeighborsX(unsigned ncx)
Definition: QTest.h:406
std::vector< float > binValues
Definition: QTest.h:764
void setMessage() override
set status & message after test has run
Definition: QTest.h:198
void setToleranceNoisy(float factorNoisy)
Definition: QTest.h:412
Check the sigma of each bin against the rest of the chamber by a factor of tolerance/.
Definition: QTest.h:382
void setMessage() override
set status & message after test has run
Definition: QTest.h:746
float toleranceDead_
Definition: QTest.h:456
static std::string getAlgoName()
Definition: QTest.h:484
unsigned numNeighborsX_
Definition: QTest.h:459
NoisyChannel(const std::string &name)
Definition: QTest.h:337
CompareToMedian(const std::string &name)
Definition: QTest.h:721
virtual void setMessage()=0
set message after test has run
AllContentAlongDiagonal RuleAllContentAlongDiagonal
Definition: QTest.h:32
unsigned yMin_
Definition: QTest.h:466
~FixedFlatOccupancy1d() override
Definition: QTest.h:656
virtual float runTest(const MonitorElement *me)
Definition: QTest.cc:28
double ymin_
Definition: QTest.h:300
void set_S_pass(double S)
Definition: QTest.h:672
std::string algoName() const
get algorithm name
Definition: QTest.h:62
std::vector< DQMChannel > badChannels_
Definition: QTest.h:162
double b
Definition: hdecay.h:120
void setNumYblocks(unsigned ncy)
Definition: QTest.h:405
void setWarningProb(float prob)
set probability limit for warning and error (default: 90% and 50%)
Definition: QTest.h:64
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
static std::string getAlgoName()
Definition: QTest.h:316
MeanWithinExpected(const std::string &name)
Definition: QTest.h:519
double get_epsilon_obs()
Definition: QTest.h:701
Comparison to reference using the Kolmogorov algorithm.
Definition: QTest.h:242
float tolerance_
Definition: QTest.h:374
void setVerbose(int verbose)
probability limits for warnings, errors
Definition: QTest.h:119
unsigned xMin_
Definition: QTest.h:464
void setMax(float max)
Definition: QTest.h:788
static std::string getAlgoName()
Definition: QTest.h:665
static std::string getAlgoName()
get algorithm name
Definition: QTest.h:845
void set_S_fail(double S)
Definition: QTest.h:671
bool rangeInitialized_
Definition: QTest.h:301
double expMean_
Definition: QTest.h:536
void setNoisy(bool noisy)
Definition: QTest.h:428
QCriterion(std::string qtname)
Definition: QTest.h:72
void setNumNeighborsY(unsigned ncy)
Definition: QTest.h:407
std::vector< DQMChannel > badChannels_
Definition: QReport.h:52
std::string message
Definition: DQMNet.h:92
std::string getName() const
get name of quality test
Definition: QTest.h:60
static const int STATUS_OK
ContentsYRange(const std::string &name)
Definition: QTest.h:284
unsigned minEntries_
Definition: QTest.h:161
void setXMin(unsigned xMin)
Definition: QTest.h:435
static std::string getAlgoName()
Definition: QTest.h:394
void setMeanTolerance(float fracTolerance)
set (fractional) tolerance for mean
Definition: QTest.h:494
Comp2RefChi2(const std::string &name)
Definition: QTest.h:189
static std::string getAlgoName()
Definition: QTest.h:180
void setThreshold(double ymin)
set Ymin (inclusive) threshold for "dead" channel (default: 0)
Definition: QTest.h:320
void set_S_fail(double S)
Definition: QTest.h:699
void setNumXblocks(unsigned ncx)
Definition: QTest.h:404
bool rangeInitialized_
Definition: QTest.h:328
void setAverage(float average)
Definition: QTest.h:786
void setToleranceDead(float factorDead)
Definition: QTest.h:420
virtual void setAllowedYRange(double ymin, double ymax)
Definition: QTest.h:293
float qtresult
Definition: DQMNet.h:91
static std::string getAlgoName()
Definition: QTest.h:696
void reset(double vett[256])
Definition: TPedValues.cc:11
unsigned xMax_
Definition: QTest.h:465
void set_S_pass(double S)
Definition: QTest.h:700
bool noisy_
Definition: QTest.h:454
unsigned int useEmptyBins_
Definition: QTest.h:302
float warningProb_
message attached to test
Definition: QTest.h:118
bool rangeInitialized_
Definition: QTest.h:377
Definition: QTest.h:689
def move(src, dest)
Definition: eostools.py:510
Comp2Ref2DChi2(const std::string &name)
Definition: QTest.h:217
float _min
Definition: QTest.h:754
static const int ERROR
static std::string getAlgoName()
Definition: QTest.h:343
void setMinMedian(float min)
Definition: QTest.h:742
static const float WARNING_PROB_THRESHOLD
default "probability" values for setting warnings & errors when running tests
Definition: QTest.h:124
unsigned numNeighbors_
Definition: QTest.h:375
Comp2RefKolmogorov(const std::string &name)
Definition: QTest.h:245
static std::string getAlgoName()
Definition: QTest.h:289
static std::string getAlgoName()
Definition: QTest.h:783