Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:54:51

0001 // @(#)root/roostats:$Id$
0002 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
0003 /*************************************************************************
0004  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOSTATS_ProfileLikelihoodCalculator
0012 #define ROOSTATS_ProfileLikelihoodCalculator
0013 
0014 #include "RooStats/CombinedCalculator.h"
0015 
0016 #include "RooStats/LikelihoodInterval.h"
0017 
0018 namespace RooStats {
0019 
0020    class LikelihoodInterval;
0021 
0022  class ProfileLikelihoodCalculator : public CombinedCalculator {
0023 
0024    public:
0025 
0026       /// Default constructor (needed for I/O)
0027       ProfileLikelihoodCalculator();
0028 
0029       /// Constructor from data, from a full model pdf describing both parameter of interest and nuisance parameters
0030       /// and from the set specifying the parameter of interest (POI).
0031       /// There is no need to specify the nuisance parameters since they are all other parameters of the model.
0032       /// When using the calculator for performing an hypothesis test one needs to provide also a snapshot (a copy)
0033       /// defining the null parameters and their value. There is no need to pass the alternate parameters. These
0034       /// will be obtained by the value maximizing the likelihood function
0035       ProfileLikelihoodCalculator(RooAbsData& data, RooAbsPdf& pdf, const RooArgSet& paramsOfInterest,
0036                                   double size = 0.05, const RooArgSet* nullParams = nullptr );
0037 
0038 
0039       /// Constructor from data and a model configuration
0040       /// If the ModelConfig defines a prior pdf for any of the parameters those will be included as constrained terms in the
0041       /// likelihood function
0042       ProfileLikelihoodCalculator(RooAbsData& data, ModelConfig & model, double size = 0.05);
0043 
0044 
0045       ~ProfileLikelihoodCalculator() override;
0046 
0047       /// Return a likelihood interval. A global fit to the likelihood is performed and
0048       /// the interval is constructed using the profile likelihood ratio function of the POI.
0049       LikelihoodInterval* GetInterval() const override ;
0050 
0051       /// Return the hypothesis test result obtained from the likelihood ratio of the
0052       /// maximum likelihood value with the null parameters fixed to their values, with respect to keeping all parameters
0053       /// floating (global maximum likelihood value).
0054       HypoTestResult* GetHypoTest() const override;
0055 
0056 
0057 
0058    protected:
0059 
0060     /// clear internal fit result
0061     void DoReset() const;
0062 
0063     /// perform a global fit
0064     RooFit::OwningPtr<RooAbsReal> DoGlobalFit() const;
0065 
0066     /// minimize likelihood
0067     static RooFit::OwningPtr<RooFitResult> DoMinimizeNLL(RooAbsReal * nll);
0068 
0069 
0070     mutable std::unique_ptr<RooFitResult> fFitResult;  //// internal  result of global fit
0071     mutable bool fGlobalFitDone;        ///< flag to control if a global fit has been done
0072 
0073 
0074     ClassDefOverride(ProfileLikelihoodCalculator,3) // A concrete implementation of CombinedCalculator that uses the ProfileLikelihood ratio.
0075 
0076    };
0077 }
0078 #endif