FeldmanCousins.h

Go to the documentation of this file.
00001 // @(#)root/roostats:$Id: FeldmanCousins.h 38105 2011-02-16 21:00:08Z cranmer $
00002 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
00003 /*************************************************************************
00004  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00009  *************************************************************************/
00010 
00011 #ifndef ROOSTATS_FeldmanCousins
00012 #define ROOSTATS_FeldmanCousins
00013 
00014 
00015 #ifndef ROOT_Rtypes
00016 #include "Rtypes.h"
00017 #endif
00018 
00019 #ifndef ROOSTATS_IntervalCalculator
00020 #include "RooStats/IntervalCalculator.h"
00021 #endif
00022 
00023 #include "RooStats/ToyMCSampler.h"
00024 #include "RooStats/ConfidenceBelt.h"
00025 #include "RooStats/PointSetInterval.h"
00026 
00027 #include "RooAbsData.h"
00028 #include "RooAbsPdf.h"
00029 #include "RooArgSet.h"
00030 #include "TList.h"
00031 
00032 class RooAbsData; 
00033 
00034 namespace RooStats {
00035 
00036    class ConfInterval; 
00037 
00038    class FeldmanCousins : public IntervalCalculator {
00039 
00040    public:
00041 
00042      //     FeldmanCousins();
00043 
00044      // Common constructor
00045      FeldmanCousins(RooAbsData& data, ModelConfig& model);
00046 
00047      virtual ~FeldmanCousins();
00048     
00049       // Main interface to get a ConfInterval (will be a PointSetInterval)
00050       virtual PointSetInterval* GetInterval() const;
00051 
00052       // Get the size of the test (eg. rate of Type I error)
00053       virtual Double_t Size() const {return fSize;}
00054       // Get the Confidence level for the test
00055       virtual Double_t ConfidenceLevel()  const {return 1.-fSize;}  
00056       // Set the DataSet
00057       virtual void SetData(RooAbsData& /*data*/) {  
00058         cout << "DEPRECATED, set data in constructor" << endl;
00059       }    
00060       // Set the Pdf
00061       virtual void SetPdf(RooAbsPdf& /*pdf*/) { 
00062         cout << "DEPRECATED, use ModelConfig" << endl;
00063       } 
00064 
00065       // specify the parameters of interest in the interval
00066       virtual void SetParameters(const RooArgSet& /*set*/) { 
00067         cout << "DEPRECATED, use ModelConfig" << endl;
00068       }
00069 
00070       // specify the nuisance parameters (eg. the rest of the parameters)
00071       virtual void SetNuisanceParameters(const RooArgSet& /*set*/) {
00072         cout << "DEPRECATED, use ModelConfig" << endl;
00073       }
00074 
00075       // User-defined set of points to test
00076       void SetParameterPointsToTest(RooAbsData& pointsToTest) {
00077         fPointsToTest = &pointsToTest;
00078       }
00079 
00080       // User-defined set of points to test
00081       void SetPOIPointsToTest(RooAbsData& poiToTest) {
00082         fPOIToTest = &poiToTest;
00083       }
00084 
00085       // set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
00086       virtual void SetTestSize(Double_t size) {fSize = size;}
00087       // set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
00088       virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
00089 
00090       virtual void SetModel(const ModelConfig &); 
00091 
00092       RooAbsData* GetPointsToScan() {
00093         if(!fPointsToTest) CreateParameterPoints();       
00094         return fPointsToTest;
00095       }
00096 
00097       ConfidenceBelt* GetConfidenceBelt() {return fConfBelt;}
00098 
00099       void UseAdaptiveSampling(bool flag=true){fAdaptiveSampling=flag;}
00100 
00101       void AdditionalNToysFactor(double fact){fAdditionalNToysFactor = fact;}
00102 
00103       void SetNBins(Int_t bins) {fNbins = bins;}
00104 
00105       void FluctuateNumDataEntries(bool flag=true){fFluctuateData = flag;}
00106 
00107       void SaveBeltToFile(bool flag=true){
00108         fSaveBeltToFile = flag;
00109         if(flag) fCreateBelt = true;
00110       }
00111       void CreateConfBelt(bool flag=true){fCreateBelt = flag;}
00112 
00113       // Returns instance of TestStatSampler. Use to change properties of
00114       // TestStatSampler, e.g. GetTestStatSampler.SetTestSize(Double_t size);
00115       TestStatSampler* GetTestStatSampler() const;
00116 
00117       
00118    private:
00119 
00120       // initializes fPointsToTest data member (mutable)
00121       void CreateParameterPoints() const;
00122 
00123       // initializes fTestStatSampler data member (mutable)
00124       void CreateTestStatSampler() const;
00125 
00126       Double_t fSize; // size of the test (eg. specified rate of Type I error)
00127       ModelConfig &fModel;
00128       RooAbsData & fData; // data set 
00129 
00130       /*
00131       RooAbsPdf * fPdf; // common PDF
00132       RooArgSet fPOI; // RooArgSet specifying  parameters of interest for interval
00133       RooArgSet fNuisParams;// RooArgSet specifying  nuisance parameters for interval
00134       RooArgSet fObservables;// RooArgSet specifying  nuisance parameters for interval
00135       */
00136 
00137       mutable ToyMCSampler* fTestStatSampler; // the test statistic sampler
00138       mutable RooAbsData* fPointsToTest; // points to perform the construction
00139       mutable RooAbsData* fPOIToTest; // value of POI points to perform the construction
00140       mutable ConfidenceBelt* fConfBelt;
00141       Bool_t fAdaptiveSampling; // controls use of adaptive sampling algorithm
00142       Double_t fAdditionalNToysFactor; // give user ability to ask for more toys
00143       Int_t fNbins; // number of samples per variable
00144       Bool_t fFluctuateData;  // tell ToyMCSampler to fluctuate number of entries in dataset
00145       Bool_t fDoProfileConstruction; // instead of full construction over nuisance parametrs, do profile
00146       Bool_t fSaveBeltToFile; // controls use if ConfidenceBelt should be saved to a TFile
00147       Bool_t fCreateBelt; // controls use if ConfidenceBelt should be saved to a TFile
00148 
00149    protected:
00150       ClassDef(FeldmanCousins,2)   // Interface for tools setting limits (producing confidence intervals)
00151    };
00152 }
00153 
00154 
00155 #endif

Generated on Tue Jul 5 14:26:22 2011 for ROOT_528-00b_version by  doxygen 1.5.1