• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

BATCalculator.h

Go to the documentation of this file.
00001 //
00002 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke, Stefan A. Schmitz
00003 
00004 #ifndef ROOSTATS_BATCalculator
00005 #define ROOSTATS_BATCalculator
00006 
00007 #include <TNamed.h>
00008 #include <TH1D.h>
00009 
00010 #include <RooStats/IntervalCalculator.h>
00011 #include <RooStats/SimpleInterval.h>
00012 #include <RooStats/ModelConfig.h>
00013 
00014 #include <RooArgSet.h>
00015 #include <RooAbsData.h>
00016 #include <RooAbsPdf.h>
00017 #include <RooPlot.h>
00018 #include <RooAbsReal.h>
00019 
00020 #include <BCRooInterface.h>
00021 
00022 #include <map>
00023 #include <vector>
00024 
00025 
00026 namespace RooStats
00027 {
00028 
00029    class BATCalculator : public IntervalCalculator, public TNamed
00030    {
00031 
00032    public:
00033 
00034       // constructor
00035       BATCalculator( );
00036 
00037       BATCalculator( RooAbsData & data,
00038                      RooAbsPdf  & pdf,
00039                      RooArgSet  & POI,
00040                      RooAbsPdf  & prior,
00041                      RooArgSet  * params = 0 );
00042 
00043 
00044       BATCalculator( RooAbsData  & data,
00045                      ModelConfig & model );
00046 
00047       // destructor
00048       virtual ~BATCalculator();
00049 
00050       RooPlot * GetPosteriorPlot1D() const;
00051 
00052       // return posterior pdf (object is managed by the BayesianCalculator class)
00053       RooAbsPdf * GetPosteriorPdf1D() const;
00054       RooAbsPdf * GetPosteriorPdf1D(const char * POIname) const;
00055 
00056       virtual SimpleInterval * GetInterval() const;
00057       virtual SimpleInterval * GetInterval(const char * POIname) const;
00058 
00059       SimpleInterval * GetShortestInterval1D() const;
00060       SimpleInterval * GetShortestInterval1D(const char * POIname, bool & checkConnected) const;
00061 
00062       // just a temporary solution
00063       Double_t GetOneSidedUperLim();
00064 
00065       virtual void SetData( RooAbsData & data )
00066          { fData = &data; ClearAll(); }
00067 
00068       virtual void SetModel( const ModelConfig & model );
00069 
00070       // set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
00071       virtual void SetTestSize( Double_t size )
00072          { fSize = size; fValidInterval = false; }
00073 
00074       // set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
00075       virtual void SetConfidenceLevel( Double_t cl )
00076          { SetTestSize(1.-cl); }
00077 
00078       // Get the size of the test (eg. rate of Type I error)
00079       virtual Double_t Size() const
00080          { return fSize; }
00081 
00082       // Get the Confidence level for the test
00083       virtual Double_t ConfidenceLevel() const
00084          { return 1.-fSize; }
00085 
00086       void SetBrfPrecision( double precision )
00087          { fBrfPrecision = precision; }
00088 
00089       double GetBrfPrecision()
00090          { return fBrfPrecision; }
00091 
00092       void SetnMCMC(int nMCMC)
00093          { _nMCMC = nMCMC; }
00094 
00095       int  GetnMCMC()
00096          { return _nMCMC; }
00097 
00098       //returns if last calculated shortest interval is connected
00099       bool GetConnected()
00100          { return fConnectedInterval; }
00101 
00102       vector<double> GetIntervalBorders1D()
00103          { return _intervalBorders1D; }
00104 
00105       //returns interval borders od the last calculated shortest interval
00106 
00107       //interface to SetNbins method in BAT (allows customized precision for histograms)
00108       void SetNbins(const char * parname, int nbins);
00109 
00110       // would be more complete if we had this -> ask BAT developers to implement this functionality (not high priority)
00111       //int GetNbins(const char * parname);
00112 
00113       void CleanCalculatorForNewData()
00114          { ClearAll(); }
00115 
00116    protected:
00117 
00118       void ClearAll() const;
00119 
00120    private:
00121 
00122       // compute the most probable value: move to public once implemented
00123       // returns a RooArgSet
00124       RooArgSet * GetMode( RooArgSet * parameters ) const;
00125       // plan to replace the above: return a SimpleInterval integrating
00126       // over all other parameters except the one specified as argument
00127       //virtual SimpleInterval* GetInterval( RooRealVar* parameter  ) const { return 0; }
00128 
00129       RooAbsData * fData;
00130       RooAbsPdf * fPdf;
00131       const RooArgSet fPOI;
00132       RooAbsPdf * fPrior;
00133       const RooArgSet * fparams;
00134       BCRooInterface * _myRooInterface;
00135       mutable TH1D * _posteriorTH1D;
00136 
00137 
00138       mutable RooAbsPdf * fProductPdf;
00139       mutable RooAbsReal * fLogLike;
00140       mutable RooAbsReal * fLikelihood;
00141       mutable RooAbsReal * fIntegratedLikelihood;
00142       mutable RooAbsPdf * fPosteriorPdf;
00143       mutable Double_t fLower;
00144       mutable Double_t fUpper;
00145       double fBrfPrecision;
00146       mutable Bool_t fValidInterval;
00147       mutable bool fConnectedInterval;
00148 
00149       int _nMCMC; // number of chain elements per Markov Chain
00150       double fSize;  // size used for getting the interval
00151       mutable vector<double> _intervalBorders1D;
00152 
00153    protected:
00154 
00155       ClassDef(BATCalculator,1)  // BATCalculator class
00156 
00157    };
00158 
00159    bool sortbyposterior(pair< Int_t,Double_t > pair1, pair< Int_t,Double_t > pair2);
00160 }
00161 
00162 #endif

Generated on Mon Aug 30 2010 22:14:54 for Bayesian Analysis Toolkit by  doxygen 1.7.1