CMS 3D CMS Logo

QTest.h

Go to the documentation of this file.
00001 #ifndef DQMSERVICES_CORE_Q_CRITERION_H
00002 # define DQMSERVICES_CORE_Q_CRITERION_H
00003 
00004 # include "DQMServices/Core/interface/MonitorElement.h"
00005 # include "TProfile2D.h"
00006 # include "TProfile.h"
00007 # include "TH2F.h"
00008 # include "TH1F.h"
00009 # include <sstream>
00010 # include <string>
00011 # include <map>
00012 
00013 #include "DQMServices/Core/interface/DQMStore.h"
00014 
00015 
00016 using namespace std;
00017 //class MonitorElement;
00018 class Comp2RefChi2;                     typedef Comp2RefChi2 Comp2RefChi2ROOT;
00019 class Comp2RefKolmogorov;               typedef Comp2RefKolmogorov Comp2RefKolmogorovROOT;
00020 
00021 class Comp2RefEqualH;                   typedef Comp2RefEqualH Comp2RefEqualHROOT;
00022 //class Comp2RefEqualString;            typedef Comp2RefEqualString Comp2RefEqualStringROOT;
00023 //class Comp2RefEqualInt;                       typedef Comp2RefEqualInt Comp2RefEqualIntROOT;
00024 //class Comp2RefEqualFloat;             typedef Comp2RefEqualFloat Comp2RefEqualFloatROOT;
00025 
00026 class ContentsXRange;                   typedef ContentsXRange ContentsXRangeROOT;
00027 class ContentsYRange;                   typedef ContentsYRange ContentsYRangeROOT;
00028 class NoisyChannel;                     typedef NoisyChannel NoisyChannelROOT;
00029 class DeadChannel;                      typedef DeadChannel DeadChannelROOT;
00030 
00031 class ContentsWithinExpected;           typedef ContentsWithinExpected ContentsWithinExpectedROOT;
00032 //class ContentsWithinExpected;         typedef ContentsWithinExpected ContentsWithinExpectedROOT;
00033 //class ContentsProfWithinRange;                typedef ContentsProfWithinRange ContentsProfWithinRangeROOT;
00034 //class ContentsProf2DWithinRange;      typedef ContentsProf2DWithinRange ContentsProf2DWithinRangeROOT;
00035 
00036 class MeanWithinExpected;               typedef MeanWithinExpected MeanWithinExpectedROOT;
00037 //class MostProbableLandau;             typedef MostProbableLandau MostProbableLandauROOT;
00038 
00039 class AllContentWithinFixedRange;       typedef AllContentWithinFixedRange RuleAllContentWithinFixedRange; typedef AllContentWithinFixedRange AllContentWithinFixedRangeROOT;
00040 class AllContentWithinFloatingRange;    typedef AllContentWithinFloatingRange RuleAllContentWithinFloatingRange;        typedef AllContentWithinFloatingRange AllContentWithinFloatingRangeROOT;
00041 
00042 class FlatOccupancy1d;                  typedef FlatOccupancy1d RuleFlatOccupancy1d; typedef FlatOccupancy1d FlatOccupancy1dROOT;
00043 class FixedFlatOccupancy1d;             typedef FixedFlatOccupancy1d RuleFixedFlatOccupancy1d; typedef FixedFlatOccupancy1d FixedFlatOccupancy1dROOT;
00044 class CSC01;                            typedef CSC01 RuleCSC01; typedef CSC01 CSC01ROOT;
00045 
00046 class AllContentAlongDiagonal;          typedef AllContentAlongDiagonal RuleAllContentAlongDiagonal; typedef AllContentAlongDiagonal AllContentAlongDiagonalROOT;
00047 
00060 class QCriterion
00061 {
00063 
00064 public:
00065 
00067   bool wasModified(void) const          { return wasModified_; }
00069   int getStatus(void) const             { return status_; }
00071   std::string getMessage(void) const    { return message_; }
00073   std::string getName(void) const       { return qtname_; }
00075   std::string algoName(void) const      { return algoName_; }
00077   void setWarningProb(float prob)       { if (validProb(prob)) warningProb_ = prob; }
00079   void setErrorProb(float prob)         { if (validProb(prob)) errorProb_ = prob; }
00082   virtual std::vector<DQMChannel> getBadChannels(void) const
00083                                         { return std::vector<DQMChannel>(); }
00084 
00085 protected:
00086   QCriterion(std::string qtname)        { qtname_ = qtname; init(); }
00088   void init(void);
00089 
00090   virtual ~QCriterion(void)             {}
00091 
00092   virtual float runTest(const MonitorElement *me);
00094   void setAlgoName(std::string name)    { algoName_ = name; }
00095 
00096   float runTest(const MonitorElement *me, QReport &qr, DQMNet::QValue &qv)   {
00097       assert(qr.qcriterion_ == this);
00098       assert(qv.qtname == qtname_);
00099       //this runTest goes to SimpleTest
00100       prob_ = runTest(me);
00101       if (! validProb(prob_)) setInvalid();
00102       else if (prob_ < errorProb_) status_ = dqm::qstatus::ERROR;
00103       else if (prob_ < warningProb_) status_ = dqm::qstatus::WARNING;
00104       else status_ = dqm::qstatus::STATUS_OK;
00105       setMessage();
00106      
00107 /* // debug output
00108       cout << " Message:    " << message_ << endl;
00109       cout << " Name = " << qtname_ << 
00110               " Algorithm = " << algoName_ << 
00111               "  Prob = " << prob_ << 
00112               "  Status = " << status_ << endl;
00113 */
00114 
00115       qv.code = status_;
00116       qv.message = message_;
00117       qv.qtname = qtname_;
00118       qv.algorithm = algoName_;
00119       qv.qtresult = prob_;
00120       qr.badChannels_ = getBadChannels();
00121 
00122       return prob_;
00123     }
00124 
00126   void update(void)                 { wasModified_ = true; }
00128   bool validProb(float prob) const  { return prob >= 0 && prob <= 1; }
00130   void setDisabled(void);
00132   void setInvalid(void);
00134   virtual void setMessage(void) = 0;
00135 
00136   bool enabled_;  
00137   int status_;  
00138   std::string message_;  
00139   std::string qtname_;  
00140   bool wasModified_;  
00141   std::string algoName_;  
00142   float warningProb_, errorProb_;  
00143 
00144 
00145 
00146 
00147 
00148   float prob_;
00149 
00150 private:
00152   static const float WARNING_PROB_THRESHOLD;
00153   static const float ERROR_PROB_THRESHOLD;
00154 
00156   friend class DQMStore;
00158   friend class MonitorElement;
00159 };
00160 
00164 
00165 class SimpleTest : public QCriterion
00166 {
00167  public:
00168   SimpleTest(const std::string &name, bool keepBadChannels = false) : QCriterion(name),
00169   minEntries_ (0),
00170   keepBadChannels_ (keepBadChannels)
00171   {}
00172 
00174   void setMinimumEntries(unsigned n)
00175   { minEntries_ = n; this->update(); }
00176 
00178   virtual std::vector<DQMChannel> getBadChannels(void) const
00179   { return keepBadChannels_ ? badChannels_ : QCriterion::getBadChannels(); }
00180 
00181 
00182  protected:
00183 
00185 
00186   virtual void setMessage(void) {
00187       std::ostringstream message;
00188       message << " Test " << this->qtname_ << " (" << this->algoName_
00189               << "): prob = " << this->prob_;
00190       this->message_ = message.str();
00191     }
00192 
00193   unsigned minEntries_;  //< minimum # of entries needed
00194   std::vector<DQMChannel> badChannels_;
00195   bool keepBadChannels_;
00196  };
00197 
00198 
00199 //===============================================================//
00200 //========= Classes for particular QUALITY TESTS ================//
00201 //===============================================================//
00202 
00203 //===================== Comp2RefEqualH ===================//
00204 //== Algorithm for comparing equality of histograms ==//
00205 class Comp2RefEqualH : public SimpleTest
00206 {
00207 public:
00208   Comp2RefEqualH(const std::string &name) : SimpleTest(name)
00209   { setAlgoName( getAlgoName() ); }
00210 
00211   static std::string getAlgoName(void)
00212   { return "Comp2RefEqualH"; }
00213 
00214 public:
00215 
00216   float runTest(const MonitorElement*me);
00217 
00218 protected:
00219     TH1*h    ; //define test histogram
00220     TH1*ref_ ; // define ref histogram
00222   Int_t ncx1; Int_t ncx2;
00223 };
00224 
00225 //===================== Comp2RefChi2 ===================//
00226 // comparison to reference using the  chi^2 algorithm
00227 class Comp2RefChi2 : public SimpleTest
00228 {
00229 public:
00230    Comp2RefChi2(const std::string &name) :SimpleTest(name)
00231    { setAlgoName(getAlgoName()); }
00232 
00233    float runTest(const MonitorElement*me);
00234    static std::string getAlgoName(void)
00235    { return "Comp2RefChi2"; }
00236   
00237 protected:
00238 
00239   void setMessage(void) {
00240       std::ostringstream message;
00241       message << " Test " << qtname_ << " (" << algoName_
00242               << "): chi2/Ndof = " << chi2_ << "/" << Ndof_
00243               << " prob = " << prob_
00244               << ", minimum needed statistics = " << minEntries_
00245               << " warning threshold = " << this->warningProb_
00246               << " error threshold = " << this->errorProb_;
00247       message_ = message.str();
00248     }
00249 
00250   TH1*h    ; //define test histogram
00251   TH1*ref_ ; // define ref histogram
00252 
00253   // # of degrees of freedom and chi^2 for test
00254   int Ndof_; float chi2_;
00255   // # of bins for test & reference histogram
00256   Int_t ncx1; Int_t ncx2;
00257 };
00258 
00259 //===================== Comp2RefKolmogorov ===================//
00261 class Comp2RefKolmogorov : public SimpleTest
00262 {
00263 public:
00264   Comp2RefKolmogorov(const std::string &name) : SimpleTest(name)
00265   { setAlgoName(getAlgoName()); }
00266 
00267   float runTest(const MonitorElement *me);
00268 
00269   static std::string getAlgoName(void)
00270   { return "Comp2RefKolmogorov"; }
00271 
00272 protected:
00273   
00274    TH1*h    ; //define test histogram
00275    TH1*ref_ ; // define ref histogram
00276 
00278   Int_t ncx1; Int_t ncx2;
00279   static const Double_t difprec;
00280 };
00281 
00282 
00283 
00284 
00285 
00286 //==================== ContentsXRange =========================//
00287 //== Check that histogram contents are between [Xmin, Xmax] ==//
00288 class ContentsXRange : public SimpleTest
00289 {
00290 public:
00291   ContentsXRange(const std::string &name) : SimpleTest(name)
00292   {
00293       rangeInitialized_ = false;
00294       setAlgoName(getAlgoName());
00295   }
00296 
00298   virtual void setAllowedXRange(float xmin, float xmax)
00299   { xmin_ = xmin; xmax_ = xmax; rangeInitialized_ = true; }
00300 
00301   float runTest(const MonitorElement *me) ;
00302 
00303   static std::string getAlgoName(void)
00304   { return "ContentsXRange"; }
00305 
00306 protected: 
00307   void setMessage(void) {
00308     std::ostringstream message;
00309     message << " Test " << qtname_ << " (" << algoName_
00310             << "): Entry fraction within X range = " << prob_;
00311     message_ = message.str();
00312     }
00313 
00315   float xmin_;float xmax_;
00317   bool rangeInitialized_;
00318 };
00319 
00320 //==================== ContentsYRange =========================//
00321 //== Check that histogram contents are between [Ymin, Ymax] ==//
00322 class ContentsYRange : public SimpleTest
00323 {
00324 public:
00325   ContentsYRange(const std::string &name) : SimpleTest(name,true)
00326   {
00327    rangeInitialized_ = false;
00328    setAlgoName(getAlgoName());
00329   }
00330 
00331   float runTest(const MonitorElement *me);
00332 
00333   void setUseEmptyBins(unsigned int useEmptyBins) { useEmptyBins_ = useEmptyBins; }
00334 
00335   static std::string getAlgoName(void)
00336   { return "ContentsYRange"; }
00337 
00339   virtual void setAllowedYRange(float ymin, float ymax)
00340   { ymin_ = ymin; ymax_ = ymax; rangeInitialized_ = true; }
00341 
00342 
00343 protected:
00344 
00345   void setMessage(void) {
00346       std::ostringstream message;
00347       message << " Test " << qtname_ << " (" << algoName_
00348               << "): Bin fraction within Y range = " << prob_;
00349       message_ = message.str();
00350     }
00351 
00353   float ymin_; float ymax_;
00355   bool rangeInitialized_;
00356   //do a Normal test or AS ?
00357   unsigned int useEmptyBins_;
00358 
00359 };
00360 
00361 //============================== DeadChannel =================================//
00363 class DeadChannel : public SimpleTest
00364 {
00365  public:
00366   DeadChannel(const std::string &name) : SimpleTest(name,true)
00367   {
00368    rangeInitialized_ = false;
00369    setAlgoName(getAlgoName());
00370   }
00371 
00372   float runTest(const MonitorElement *me);
00373 
00374   static std::string getAlgoName(void)
00375   { return "DeadChannel"; }
00376 
00378   void setThreshold(float ymin)
00379   { ymin_ = ymin;  rangeInitialized_ = true; } 
00380 
00381 
00382 protected:
00383   void setMessage(void) {
00384       std::ostringstream message;
00385       message << " Test " << qtname_ << " (" << algoName_
00386               << "): Alive channel fraction = " << prob_;
00387       message_ = message.str();
00388     }
00389   TH1*h1;
00390   TH2*h2;
00391   float ymin_;
00392   bool rangeInitialized_;
00393 };
00394 
00395 
00396 //==================== NoisyChannel =========================//
00398 class NoisyChannel : public SimpleTest
00399 {
00400 public:
00401   NoisyChannel(const std::string &name) : SimpleTest(name,true)
00402   {
00403    rangeInitialized_ = false;
00404    numNeighbors_ = 1;
00405    setAlgoName(getAlgoName());
00406   }
00407 
00409   float runTest(const MonitorElement*me);
00410 
00411   static std::string getAlgoName(void)
00412   { return "NoisyChannel"; }
00413 
00421   void setNumNeighbors(unsigned n) { if (n > 0) numNeighbors_ = n; }
00422 
00427   void setTolerance(float percentage)
00428     {
00429       if (percentage >=0)
00430       {
00431         tolerance_ = percentage;
00432         rangeInitialized_ = true;
00433       }
00434     }
00435 
00436 
00437 protected:
00438  
00439    void setMessage(void) {
00440       std::ostringstream message;
00441       message << " Test " << qtname_ << " (" << algoName_
00442               << "): Fraction of non-noisy channels = " << prob_;
00443       message_ = message.str();
00444     }
00445 
00446     TH1*h    ; //define test histogram
00447 
00450   Double_t getAverage(int bin, const TH1 *h) const;
00451 
00452   float tolerance_;        /*< tolerance for considering a channel noisy */
00453   unsigned numNeighbors_;  /*< # of neighboring channels for calculating average to be used
00454                              for comparison with channel under consideration */
00455   bool rangeInitialized_;  /*< init-flag for tolerance */
00456 };
00457 
00458 
00459 
00460 
00461 //==================== ContentsWithinExpected  =========================//
00462 // Check that every TH2 channel has mean, RMS within allowed range.
00463 class ContentsWithinExpected : public SimpleTest
00464 {
00465 public:
00466   ContentsWithinExpected(const std::string &name) : SimpleTest(name,true)
00467     {
00468       checkMean_ = checkRMS_ = validMethod_ = false;
00469       minMean_ = maxMean_ = minRMS_ = maxRMS_ = 0.0;
00470       checkMeanTolerance_ = false;
00471       toleranceMean_ = -1.0;
00472       setAlgoName(getAlgoName());
00473     }
00474 
00475   float runTest(const MonitorElement *me);
00476 
00477   void setUseEmptyBins(unsigned int useEmptyBins) { useEmptyBins_ = useEmptyBins; }
00478 
00479 
00480   static std::string getAlgoName(void)
00481   { return "ContentsWithinExpected"; }
00482 
00484   void setMeanRange(float xmin, float xmax)
00485     {
00486       checkRange(xmin, xmax);
00487       minMean_ = xmin;
00488       maxMean_ = xmax;
00489       checkMean_ = true;
00490     }
00491 
00493   void setRMSRange(float xmin, float xmax)
00494     {
00495       checkRange(xmin, xmax);
00496       minRMS_ = xmin;
00497       maxRMS_ = xmax;
00498       checkRMS_ = true;
00499     }
00500 
00502   void setMeanTolerance(float fracTolerance)
00503     {
00504       if (fracTolerance >= 0.0)
00505       {
00506         toleranceMean_ = fracTolerance;
00507         checkMeanTolerance_ = true;
00508       }
00509     }
00510 
00511 
00512 
00513 protected:
00514 
00515 
00516   TH1*h    ; //define test histogram
00517 
00518   void setMessage(void) {
00519       std::ostringstream message;
00520       message << " Test " << qtname_ << " (" << algoName_
00521               << "): Entry fraction within range = " << prob_;
00522       message_ = message.str();
00523     }
00524 
00526   void checkRange(const float xmin, const float xmax);
00527 
00528   bool checkMean_;          //< if true, check the mean value
00529   bool checkRMS_;           //< if true, check the RMS value
00530   bool checkMeanTolerance_; //< if true, check mean tolerance
00531   float toleranceMean_;     //< fractional tolerance on mean (use only if checkMeanTolerance_ = true)
00532   float minMean_, maxMean_; //< allowed range for mean (use only if checkMean_ = true)
00533   float minRMS_, maxRMS_;   //< allowed range for mean (use only if checkRMS_ = true)
00534   bool validMethod_;        //< true if method has been chosen
00535   //do a Normal test or AS ?
00536   unsigned int useEmptyBins_;
00537 
00538 };
00539 
00540 //==================== MeanWithinExpected  =========================//
00542 class MeanWithinExpected : public SimpleTest
00543 {
00544 public:
00545   MeanWithinExpected(const std::string &name) : SimpleTest(name)
00546     {
00547       validMethod_ = validExpMean_ = false;
00548       setAlgoName(getAlgoName());
00549     }
00550 
00551   static std::string getAlgoName(void)
00552   { return "MeanWithinExpected"; }
00553 
00555   void setExpectedMean(float expMean)
00556   {
00557    expMean_ = expMean;
00558    validExpMean_ = true;
00559   }
00560 
00561   void useRMS(void)
00562   {
00563    useRMS_ = true;
00564    useSigma_ = useRange_ = false;
00565    validMethod_ = true;
00566   }
00567 
00568   void useSigma(float expectedSigma)
00569   {
00570    useSigma_ = true;
00571    useRMS_ = useRange_ = false;
00572    sigma_ = expectedSigma;
00573    checkSigma();
00574   }
00575 
00576   void useRange(float xmin, float xmax)
00577   {
00578     useRange_ = true;
00579     useSigma_ = useRMS_ = false;
00580     xmin_ = xmin; xmax_ = xmax;
00581     checkRange();
00582    }
00583 
00584 
00585   
00598   float runTest(const MonitorElement*me);
00599 
00600 protected:
00601   bool isInvalid(void);
00602 
00603   void setMessage(void) {
00604       std::ostringstream message;
00605       message << " Test " << qtname_ << " (" << algoName_ << "): ";
00606       if(useRange_)
00607       {
00608         message << "Mean within allowed range? ";
00609         if(prob_)
00610           message << "Yes";
00611         else
00612           message << "No";
00613       }
00614       else
00615         message << "prob = " << prob_;
00616 
00617       message_ = message.str();
00618     }
00619 
00621   void checkSigma(void);
00622 
00624   void checkRange(void);
00625 
00627   float doRangeTest(const TH1 *h);
00628 
00630   float doGaussTest(const TH1 *h, float sigma);
00631 
00632 
00633   TH1F*h;              //define Test histo
00634   bool useRMS_;       //< if true, will use RMS of distribution
00635   bool useSigma_;     //< if true, will use expected_sigma
00636   bool useRange_;     //< if true, will use allowed range
00637   float sigma_;       //< sigma to be used in probability calculation (use only if useSigma_ = true)
00638   float expMean_;     //< expected mean value (used only if useSigma_ = true or useRMS_ = true)
00639   float xmin_, xmax_; //< allowed range for mean (use only if useRange_ = true)
00640   bool validMethod_;  //< true if method has been chosen
00641   bool validExpMean_; //< true if expected mean has been chosen
00642 
00643 };
00644 
00645 
00646 // //==================== MostProbableBase   =========================//
00647 // // QTest that should test Most Probable value for some Expected number
00648 // 
00649 // namespace edm {
00650 //   namespace qtests {
00651 //     namespace fits {
00652 //       // Convert Significance into Probability value.
00653 //       double erfc( const double &rdX);
00654 //     }
00655 //   }
00656 // }
00657 // 
00658 // 
00659 // /**
00660 //  * @brief
00661 //  *   Base for all MostProbables Children classes. Thus each child
00662 //  *   implementation will concentrate on fit itself.
00663 //  */
00664 // class MostProbableBase : public SimpleTest
00665 // {
00666 // public:
00667 //   MostProbableBase(const std::string &name);
00668 // 
00669 //   // Set/Get local variables methods
00670 //   inline void   setMostProbable(double rdMP) { dMostProbable_ = rdMP;}
00671 //   inline double getMostProbable(void) const  { return dMostProbable_;}
00672 // 
00673 //   inline void   setSigma(double rdSIGMA)     { dSigma_ = rdSIGMA; }
00674 //   inline double getSigma(void) const         { return dSigma_; }
00675 // 
00676 //   inline void   setXMin(double rdMIN)        { dXMin_ = rdMIN; }
00677 //   inline double getXMin(void) const          { return dXMin_;  }
00678 // 
00679 //   inline void   setXMax(double rdMAX)        { dXMax_ = rdMAX; }
00680 //   inline double getXMax(void) const          { return dXMax_;  }
00681 // 
00682 //   /**
00683 //    * @brief
00684 //    *   Actual Run Test method. Should return: [0, 1] or <0 for failure.
00685 //    *   [Note: See SimpleTest<class T> template for details]
00686 //    *
00687 //    * @param poPLOT  Plot for Which QTest to be run
00688 //    *
00689 //    * @return
00690 //    *   -1      On Error
00691 //    *   [0, 1]  Measurement of how Fit value is close to Expected one
00692 //    */
00693 //   float runTest(const MonitorElement*me);
00694 // 
00695 // protected:
00696 //   /**
00697 //    * @brief
00698 //    *   Each Child should implement fit method which responsibility is to
00699 //    *   perform actual fit and compare mean value with some additional
00700 //    *   Cuts if any needed. The reason this task is put into separate method
00701 //    *   is that a priory it is unknown what distribution QTest is dealing with.
00702 //    *   It might be simple Gauss, Landau or something more sophisticated.
00703 //    *   Each Plot needs special treatment (fitting) and extraction of
00704 //    *   parameters. Children know about that but not Parent class.
00705 //    *
00706 //    * @param poPLOT  Plot to be fitted
00707 //    *
00708 //    * @return
00709 //    *   -1     On Error
00710 //    *   [0,1]  Measurement of how close Fit Value is to Expected one
00711 //    */
00712 // 
00713 //   TH1F *poPLOT; //dine Test histo
00714 //   virtual float fit(TH1F *poPLOT) = 0;
00715 // 
00716 //   /**
00717 //    * @brief
00718 //    *   Child should check test if it is valid and return corresponding value
00719 //    *   Next common tests are performed here:
00720 //    *     1. min < max
00721 //    *     2. MostProbable is in (min, max)
00722 //    *     3. Sigma > 0
00723 //    *
00724 //    * @return
00725 //    *   True   Invalid QTest
00726 //    *   False  Otherwise
00727 //    */
00728 //   bool isInvalid(void);
00729 // 
00730 //   /**
00731 //    * @brief
00732 //    *   General function that compares MostProbable value gotten from Fit and
00733 //    *   Expected one.
00734 //    *
00735 //    * @param rdMP_FIT     MostProbable value gotten from Fit
00736 //    * @param rdSIGMA_FIT  Sigma value gotten from Fit
00737 //    *
00738 //    * @return
00739 //    *   Probability of found Value that measures how close is gotten one to
00740 //    *   expected
00741 //    */
00742 //   double compareMostProbables(const double &rdMP_FIT, const double &rdSIGMA_FIT) const;
00743 // 
00744 //   void setMessage(void) {
00745 //       std::ostringstream message;
00746 //       message << " Test " << qtname_ << " (" << algoName_
00747 //            << "): Fraction of Most Probable value match = " << prob_;
00748 //       message_ = message.str();
00749 //     }
00750 // 
00751 // private:
00752 //   // Most common Fit values
00753 //   double dMostProbable_;
00754 //   double dSigma_;
00755 //   double dXMin_;
00756 //   double dXMax_;
00757 // };
00758 // 
00759 // /** MostProbable QTest for Landau distributions */
00760 // class MostProbableLandau : public MostProbableBase
00761 // {
00762 // public:
00763 //   MostProbableLandau(const std::string &name);
00764 // 
00765 //   static std::string getAlgoName()
00766 //   { return "MostProbableLandau"; }
00767 // 
00768 //   // Set/Get local variables methods
00769 //   void setNormalization(const double &rdNORMALIZATION)
00770 //   { dNormalization_ = rdNORMALIZATION; }
00771 // 
00772 //   double getNormalization(void) const
00773 //    { return dNormalization_; }
00774 // 
00775 // protected:
00776 //   //
00777 //   // @brief
00778 //   //   Perform Actual Fit
00779 //   //
00780 //   // @param poPLOT  Plot to be fitted
00781 //   //
00782 //   // @return
00783 //   //   -1     On Error
00784 //   //   [0,1]  Measurement of how close Fit Value is to Expected one
00785 //   //
00786 //   virtual float fit(TH1F *poPLOT);
00787 // 
00788 // private:
00789 //   double dNormalization_;
00790 // };
00791 // 
00792 // 
00793 
00794 
00795 //==================== AllContentWithinFixedRange   =========================//
00796 class AllContentWithinFixedRange : public SimpleTest
00797 {
00798 public:
00799   AllContentWithinFixedRange(const std::string &name) : SimpleTest(name)
00800  { setAlgoName(getAlgoName()); }
00801 
00802   static std::string getAlgoName(void)
00803   { return "RuleAllContentWithinFixedRange"; }
00804 
00805   void set_x_min(double x)             { x_min  = x; }
00806   void set_x_max(double x)             { x_max  = x; }
00807   void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
00808   void set_S_fail(double S)            { S_fail = S; }
00809   void set_S_pass(double S)            { S_pass = S; }
00810   double get_epsilon_obs(void)         { return epsilon_obs; }
00811   double get_S_fail_obs(void)          { return S_fail_obs;  }
00812   double get_S_pass_obs(void)          { return S_pass_obs;  }
00813   int get_result(void)                 { return result; }
00814 
00815   float runTest(const MonitorElement *me);
00816 
00817 protected:
00818   TH1F *histogram ; //define Test histo
00819   double x_min, x_max;
00820   double epsilon_max;
00821   double S_fail, S_pass;
00822   double epsilon_obs;
00823   double S_fail_obs, S_pass_obs;
00824   int result;
00825 };
00826 
00827 
00828 //==================== AllContentWithinFloatingRange  =========================//
00829 class AllContentWithinFloatingRange : public SimpleTest
00830 {
00831 public:
00832   AllContentWithinFloatingRange(const std::string &name) : SimpleTest(name)
00833     { setAlgoName(getAlgoName()); }
00834 
00835   static std::string getAlgoName(void)
00836     { return "RuleAllContentWithinFloatingRange"; }
00837 
00838   void set_Nrange(int N)               { Nrange = N; }
00839   void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
00840   void set_S_fail(double S)            { S_fail = S; }
00841   void set_S_pass(double S)            { S_pass = S; }
00842   double get_epsilon_obs(void)         { return epsilon_obs; }
00843   double get_S_fail_obs(void)          { return S_fail_obs;  }
00844   double get_S_pass_obs(void)          { return S_pass_obs;  }
00845   int get_result(void)                 { return result; }
00846 
00847   float runTest(const MonitorElement *me );
00848 
00849 protected:
00850   TH1F *histogram ; //define Test histo
00851   int Nrange;
00852   double epsilon_max;
00853   double S_fail, S_pass;
00854   double epsilon_obs;
00855   double S_fail_obs, S_pass_obs;
00856   int result;
00857 };
00858 
00859 
00860 
00861 
00862 //==================== FlatOccupancy1d   =========================//
00863 #if 0 // FIXME: need to know what parameters to set before runTest!
00864 class FlatOccupancy1d : public SimpleTest
00865 {
00866 public:
00867   FlatOccupancy1d(const std::string &name) : SimpleTest(name)
00868     {
00869       Nbins = 0;
00870       FailedBins[0] = 0;
00871       FailedBins[1] = 0;
00872       setAlgoName(getAlgoName());
00873     }
00874 
00875   ~FlatOccupancy1d(void)
00876     {
00877       delete [] FailedBins[0];
00878       delete [] FailedBins[1];
00879     }
00880 
00881   static std::string getAlgoName(void)
00882     { return "RuleFlatOccupancy1d"; }
00883 
00884   void set_ExclusionMask(double *mask) { ExclusionMask = mask; }
00885   void set_epsilon_min(double epsilon) { epsilon_min = epsilon; }
00886   void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
00887   void set_S_fail(double S)            { S_fail = S; }
00888   void set_S_pass(double S)            { S_pass = S; }
00889   double get_FailedBins(void)          { return *FailedBins[2]; } // FIXME: WRONG! OFF BY ONE!?
00890   int get_result()                     { return result; }
00891 
00892   float runTest(const MonitorElement*me);
00893 
00894 protected:
00895   TH1F *histogram; //define Test histogram
00896   double *ExclusionMask;
00897   double epsilon_min, epsilon_max;
00898   double S_fail, S_pass;
00899   double *FailedBins[2];
00900   int    Nbins;
00901   int    result;
00902 };
00903 #endif
00904 
00905 //==================== FixedFlatOccupancy1d   =========================//
00906 class FixedFlatOccupancy1d : public SimpleTest
00907 {
00908 public:
00909   FixedFlatOccupancy1d(const std::string &name) : SimpleTest(name)
00910     {
00911       Nbins = 0;
00912       FailedBins[0] = 0;
00913       FailedBins[1] = 0;
00914       setAlgoName(getAlgoName());
00915     }
00916 
00917   ~FixedFlatOccupancy1d(void)
00918     {
00919       if( Nbins > 0 )
00920       {
00921         delete [] FailedBins[0];
00922         delete [] FailedBins[1];
00923       }
00924     }
00925 
00926   static std::string getAlgoName(void)
00927     { return "RuleFixedFlatOccupancy1d"; }
00928 
00929   void set_Occupancy(double level)     { b = level; }
00930   void set_ExclusionMask(double *mask) { ExclusionMask = mask; }
00931   void set_epsilon_min(double epsilon) { epsilon_min = epsilon; }
00932   void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
00933   void set_S_fail(double S)            { S_fail = S; }
00934   void set_S_pass(double S)            { S_pass = S; }
00935   double get_FailedBins(void)          { return *FailedBins[2]; } // FIXME: WRONG! OFF BY ONE!?
00936   int get_result()                     { return result; }
00937 
00938   float runTest(const MonitorElement*me);
00939 
00940 protected:
00941   TH1F *histogram;
00942   double b;
00943   double *ExclusionMask;
00944   double epsilon_min, epsilon_max;
00945   double S_fail, S_pass;
00946   double *FailedBins[2];
00947   int    Nbins;
00948   int    result;
00949 };
00950 
00951 //==================== CSC01   =========================//
00952 class CSC01 : public SimpleTest
00953 {
00954 public:
00955   CSC01(const std::string &name) : SimpleTest(name)
00956    { setAlgoName(getAlgoName()); }
00957 
00958   static std::string getAlgoName(void)
00959    { return "RuleCSC01"; }
00960 
00961   void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
00962   void set_S_fail(double S)            { S_fail = S; }
00963   void set_S_pass(double S)            { S_pass = S; }
00964   double get_epsilon_obs()             { return epsilon_obs; }
00965   double get_S_fail_obs()              { return S_fail_obs;  }
00966   double get_S_pass_obs()              { return S_pass_obs;  }
00967   int get_result()                     { return result; }
00968 
00969   float runTest(const MonitorElement*me);
00970 
00971 protected:
00972   TH1F *histogram;
00973   double epsilon_max;
00974   double S_fail, S_pass;
00975   double epsilon_obs;
00976   double S_fail_obs, S_pass_obs;
00977   int result;
00978 };
00979 
00980 //==================== AllContentAlongDiagonal   =========================//
00981 #if 0 // FIXME: need to know what parameters to set before runTest!
00982 class AllContentAlongDiagonal : public SimpleTest
00983 
00984 public:
00985   AllContentAlongDiagonal(const std::string &name) : SimpleTest(name)
00986   { setAlgoName(getAlgoName()); }
00987 
00988   static std::string getAlgoName(void)
00989   { return "RuleAllContentAlongDiagonal"; }
00990 
00991   void set_epsilon_max(double epsilon) { epsilon_max = epsilon; }
00992   void set_S_fail(double S)            { S_fail = S; }
00993   void set_S_pass(double S)            { S_pass = S; } 
00994   double get_epsilon_obs()             { return epsilon_obs; }
00995   double get_S_fail_obs()              { return S_fail_obs;  }
00996   double get_S_pass_obs()              { return S_pass_obs;  }
00997   int get_result()                     { return result; }
00998 
00999   //public:
01000   //using SimpleTest::runTest;
01001   float runTest(const MonitorElement*me); 
01002 
01003 protected:
01004   TH2F *histogram;
01005   double epsilon_max;
01006   double S_fail, S_pass;
01007   double epsilon_obs;
01008   double S_fail_obs, S_pass_obs;
01009   int result;
01010 };
01011 #endif
01012 
01013 
01014 
01015 #endif // DQMSERVICES_CORE_Q_CRITERION_H

Generated on Tue Jun 9 17:34:12 2009 for CMSSW by  doxygen 1.5.4