| Chi2FCN.h | | Chi2FCN.h | |
|
| // @(#)root/mathcore:$Id: Chi2FCN.h 37232 2010-12-03 18:09:43Z moneta $ | | // @(#)root/mathcore:$Id: Chi2FCN.h 40626 2011-08-18 08:34:03Z moneta $ | |
| // Author: L. Moneta Tue Sep 5 09:13:32 2006 | | // Author: L. Moneta Tue Sep 5 09:13:32 2006 | |
| | | | |
| /********************************************************************** | | /********************************************************************** | |
| * * | | * * | |
| * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT * | | * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT * | |
| * * | | * * | |
| * * | | * * | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| // Header file for class Chi2FCN | | // Header file for class Chi2FCN | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| @defgroup FitMethodFunc Fit Method Classes | | @defgroup FitMethodFunc Fit Method Classes | |
| | | | |
| Classes describing Fit Method functions | | Classes describing Fit Method functions | |
| @ingroup Fit | | @ingroup Fit | |
| */ | | */ | |
| | | | |
| namespace ROOT { | | namespace ROOT { | |
| | | | |
| namespace Fit { | | namespace Fit { | |
| | | | |
|
| template<class FunType> | | | |
| struct ModelFunctionTrait { | | | |
| typedef ::ROOT::Math::IParamMultiFunction ModelFunc; | | | |
| }; | | | |
| template<> | | | |
| struct ModelFunctionTrait<ROOT::Math::IMultiGradFunction> { | | | |
| typedef ::ROOT::Math::IParamMultiGradFunction ModelFunc; | | | |
| }; | | | |
| | | | |
| //_________________________________________________________________________
__________ | | //_________________________________________________________________________
__________ | |
| /** | | /** | |
| Chi2FCN class for binnned fits using the least square methods | | Chi2FCN class for binnned fits using the least square methods | |
| | | | |
| @ingroup FitMethodFunc | | @ingroup FitMethodFunc | |
| */ | | */ | |
| template<class FunType> | | template<class FunType> | |
| class Chi2FCN : public ::ROOT::Math::BasicFitMethodFunction<FunType> { | | class Chi2FCN : public ::ROOT::Math::BasicFitMethodFunction<FunType> { | |
| | | | |
| public: | | public: | |
| | | | |
| typedef ::ROOT::Math::BasicFitMethodFunction<FunType> BaseObjFunction; | | typedef ::ROOT::Math::BasicFitMethodFunction<FunType> BaseObjFunction; | |
| typedef typename BaseObjFunction::BaseFunction BaseFunction; | | typedef typename BaseObjFunction::BaseFunction BaseFunction; | |
| | | | |
|
| typedef typename ModelFunctionTrait<FunType>::ModelFunc IModelFunction; | | //typedef typename ::ROOT::Math::ParamFunctionTrait<FunType>::PFType IM | |
| | | odelFunction; | |
| | | typedef ::ROOT::Math::IParamMultiFunction IModelFunction; | |
| typedef typename BaseObjFunction::Type_t Type_t; | | typedef typename BaseObjFunction::Type_t Type_t; | |
| | | | |
| /** | | /** | |
| Constructor from data set (binned ) and model function | | Constructor from data set (binned ) and model function | |
| */ | | */ | |
| Chi2FCN (const BinData & data, const IModelFunction & func) : | | Chi2FCN (const BinData & data, const IModelFunction & func) : | |
| BaseObjFunction(func.NPar(), data.Size() ), | | BaseObjFunction(func.NPar(), data.Size() ), | |
| fData(data), | | fData(data), | |
| fFunc(func), | | fFunc(func), | |
| fNEffPoints(0), | | fNEffPoints(0), | |
| | | | |
| skipping to change at line 128 | | skipping to change at line 120 | |
| | | | |
| // effective points used in the fit (exclude the rejected one) | | // effective points used in the fit (exclude the rejected one) | |
| virtual unsigned int NFitPoints() const { return fNEffPoints; } | | virtual unsigned int NFitPoints() const { return fNEffPoints; } | |
| | | | |
| /// i-th chi-square residual | | /// i-th chi-square residual | |
| virtual double DataElement(const double * x, unsigned int i, double * g)
const { | | virtual double DataElement(const double * x, unsigned int i, double * g)
const { | |
| if (i==0) this->UpdateNCalls(); | | if (i==0) this->UpdateNCalls(); | |
| return FitUtil::EvaluateChi2Residual(fFunc, fData, x, i, g); | | return FitUtil::EvaluateChi2Residual(fFunc, fData, x, i, g); | |
| } | | } | |
| | | | |
|
| // need to be virtual to be instantited | | // need to be virtual to be instantiated | |
| virtual void Gradient(const double *x, double *g) const { | | virtual void Gradient(const double *x, double *g) const { | |
| // evaluate the chi2 gradient | | // evaluate the chi2 gradient | |
| FitUtil::EvaluateChi2Gradient(fFunc, fData, x, g, fNEffPoints); | | FitUtil::EvaluateChi2Gradient(fFunc, fData, x, g, fNEffPoints); | |
| } | | } | |
| | | | |
| /// get type of fit method function | | /// get type of fit method function | |
| virtual typename BaseObjFunction::Type_t Type() const { return BaseObjF
unction::kLeastSquare; } | | virtual typename BaseObjFunction::Type_t Type() const { return BaseObjF
unction::kLeastSquare; } | |
| | | | |
| /// access to const reference to the data | | /// access to const reference to the data | |
| virtual const BinData & Data() const { return fData; } | | virtual const BinData & Data() const { return fData; } | |
| | | | |
End of changes. 4 change blocks. |
| 12 lines changed or deleted | | 5 lines changed or added | |
|
| Factory.h | | Factory.h | |
|
| // @(#)root/mathcore:$Id: Factory.h 37448 2010-12-09 20:20:56Z moneta $ | | // @(#)root/tmva $Id: Factory.h 40012 2011-06-27 16:03:11Z stelzer $ | |
| // Author: L. Moneta Fri Dec 22 14:43:33 2006 | | // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss, Ka | |
| | | i Voss, Eckhard von Toerne, Jan Therhaag | |
| | | | |
|
| /********************************************************************** | | /************************************************************************** | |
| * * | | ******** | |
| * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT * | | * Project: TMVA - a Root-integrated toolkit for multivariate data analysis | |
| * * | | * | |
| * * | | * Package: TMVA | |
| **********************************************************************/ | | * | |
| | | * Class : Factory | |
| // Header file for class Factory | | * | |
| | | * Web : http://tmva.sourceforge.net | |
| #ifndef ROOT_Math_Factory | | * | |
| #define ROOT_Math_Factory | | * | |
| | | * | |
| | | * Description: | |
| | | * | |
| | | * This is the main MVA steering class: it creates (books) all MVA met | |
| | | hods, * | |
| | | * and guides them through the training, testing and evaluation phases | |
| | | . * | |
| | | * | |
| | | * | |
| | | * Authors (alphabetical): | |
| | | * | |
| | | * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland | |
| | | * | |
| | | * Joerg Stelzer <stelzer@cern.ch> - DESY, Germany | |
| | | * | |
| | | * Peter Speckmayer <peter.speckmayer@cern.ch> - CERN, Switzerland | |
| | | * | |
| | | * Jan Therhaag <Jan.Therhaag@cern.ch> - U of Bonn, Germany | |
| | | * | |
| | | * Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany | |
| | | * | |
| | | * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, German | |
| | | y * | |
| | | * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada | |
| | | * | |
| | | * | |
| | | * | |
| | | * Copyright (c) 2005-2011: | |
| | | * | |
| | | * CERN, Switzerland | |
| | | * | |
| | | * U. of Victoria, Canada | |
| | | * | |
| | | * MPI-K Heidelberg, Germany | |
| | | * | |
| | | * U. of Bonn, Germany | |
| | | * | |
| | | * | |
| | | * | |
| | | * Redistribution and use in source and binary forms, with or without | |
| | | * | |
| | | * modification, are permitted according to the terms listed in LICENSE | |
| | | * | |
| | | * (http://tmva.sourceforge.net/LICENSE) | |
| | | * | |
| | | ************************************************************************** | |
| | | ********/ | |
| | | | |
| | | #ifndef ROOT_TMVA_Factory | |
| | | #define ROOT_TMVA_Factory | |
| | | | |
| | | ////////////////////////////////////////////////////////////////////////// | |
| | | // // | |
| | | // Factory // | |
| | | // // | |
| | | // This is the main MVA steering class: it creates all MVA methods, // | |
| | | // and guides them through the training, testing and evaluation // | |
| | | // phases // | |
| | | // // | |
| | | ////////////////////////////////////////////////////////////////////////// | |
| | | | |
| #include <string> | | #include <string> | |
|
| | | #include <vector> | |
| | | #include <map> | |
| | | #ifndef ROOT_TCut | |
| | | #include "TCut.h" | |
| | | #endif | |
| | | | |
| | | #ifndef ROOT_TMVA_Configurable | |
| | | #include "TMVA/Configurable.h" | |
| | | #endif | |
| | | #ifndef ROOT_TMVA_Types | |
| | | #include "TMVA/Types.h" | |
| | | #endif | |
| | | #ifndef ROOT_TMVA_DataSet | |
| | | #include "TMVA/DataSet.h" | |
| | | #endif | |
| | | | |
| | | class TFile; | |
| | | class TTree; | |
| | | class TDirectory; | |
| | | | |
| | | namespace TMVA { | |
| | | | |
| | | class IMethod; | |
| | | class MethodBase; | |
| | | class DataInputHandler; | |
| | | class DataSetInfo; | |
| | | class DataSetManager; | |
| | | class VariableTransformBase; | |
| | | | |
| | | class Factory : public Configurable { | |
| | | public: | |
| | | | |
| | | typedef std::vector<IMethod*> MVector; | |
| | | | |
| | | // no default constructor | |
| | | Factory( TString theJobName, TFile* theTargetFile, TString theOption | |
| | | = "" ); | |
| | | | |
| | | // default destructor | |
| | | virtual ~Factory(); | |
| | | | |
| | | virtual const char* GetName() const { return "Factory"; } | |
| | | | |
| | | // add events to training and testing trees | |
| | | void AddSignalTrainingEvent ( const std::vector<Double_t>& event, | |
| | | Double_t weight = 1.0 ); | |
| | | void AddBackgroundTrainingEvent( const std::vector<Double_t>& event, | |
| | | Double_t weight = 1.0 ); | |
| | | void AddSignalTestEvent ( const std::vector<Double_t>& event, | |
| | | Double_t weight = 1.0 ); | |
| | | void AddBackgroundTestEvent ( const std::vector<Double_t>& event, | |
| | | Double_t weight = 1.0 ); | |
| | | void AddTrainingEvent( const TString& className, const std::vector<Do | |
| | | uble_t>& event, Double_t weight ); | |
| | | void AddTestEvent ( const TString& className, const std::vector<Do | |
| | | uble_t>& event, Double_t weight ); | |
| | | void AddEvent ( const TString& className, Types::ETreeType tt, | |
| | | const std::vector<Double_t>& event, Double_t weight ); | |
| | | Bool_t UserAssignEvents(UInt_t clIndex); | |
| | | TTree* CreateEventAssignTrees( const TString& name ); | |
| | | | |
| | | DataSetInfo& AddDataSet( DataSetInfo& ); | |
| | | DataSetInfo& AddDataSet( const TString& ); | |
| | | | |
| | | // special case: signal/background | |
| | | | |
| | | // Data input related | |
| | | void SetInputTrees( const TString& signalFileName, const TString& bac | |
| | | kgroundFileName, | |
| | | Double_t signalWeight=1.0, Double_t backgroundWei | |
| | | ght=1.0 ); | |
| | | void SetInputTrees( TTree* inputTree, const TCut& SigCut, const TCut& | |
| | | BgCut ); | |
| | | // Set input trees at once | |
| | | void SetInputTrees( TTree* signal, TTree* background, | |
| | | Double_t signalWeight=1.0, Double_t backgroundWei | |
| | | ght=1.0) ; | |
| | | | |
| | | void AddSignalTree( TTree* signal, Double_t weight=1.0, Types::ETr | |
| | | eeType treetype = Types::kMaxTreeType ); | |
| | | void AddSignalTree( TString datFileS, Double_t weight=1.0, Types::ETr | |
| | | eeType treetype = Types::kMaxTreeType ); | |
| | | void AddSignalTree( TTree* signal, Double_t weight, const TString& tr | |
| | | eetype ); | |
| | | | |
| | | // ... depreciated, kept for backwards compatibility | |
| | | void SetSignalTree( TTree* signal, Double_t weight=1.0); | |
| | | | |
| | | void AddBackgroundTree( TTree* background, Double_t weight=1.0, Types | |
| | | ::ETreeType treetype = Types::kMaxTreeType ); | |
| | | void AddBackgroundTree( TString datFileB, Double_t weight=1.0, Types | |
| | | ::ETreeType treetype = Types::kMaxTreeType ); | |
| | | void AddBackgroundTree( TTree* background, Double_t weight, const TSt | |
| | | ring & treetype ); | |
| | | | |
| | | // ... depreciated, kept for backwards compatibility | |
| | | void SetBackgroundTree( TTree* background, Double_t weight=1.0 ); | |
| | | | |
| | | void SetSignalWeightExpression( const TString& variable ); | |
| | | void SetBackgroundWeightExpression( const TString& variable ); | |
| | | | |
| | | // special case: regression | |
| | | void AddRegressionTree( TTree* tree, Double_t weight = 1.0, | |
| | | Types::ETreeType treetype = Types::kMaxTreeTy | |
| | | pe ) { | |
| | | AddTree( tree, "Regression", weight, "", treetype ); | |
| | | } | |
| | | | |
| | | // general | |
| | | | |
| | | // Data input related | |
| | | void SetTree( TTree* tree, const TString& className, Double_t weight | |
| | | ); // depreciated | |
| | | void AddTree( TTree* tree, const TString& className, Double_t weight= | |
| | | 1.0, | |
| | | const TCut& cut = "", | |
| | | Types::ETreeType tt = Types::kMaxTreeType ); | |
| | | void AddTree( TTree* tree, const TString& className, Double_t weight, | |
| | | const TCut& cut, const TString& treeType ); | |
| | | | |
| | | // set input variable | |
| | | void SetInputVariables ( std::vector<TString>* theVariables ); // de | |
| | | preciated | |
| | | void AddVariable ( const TString& expression, const TString& t | |
| | | itle, const TString& unit, | |
| | | char type='F', Double_t min = 0, Double_t m | |
| | | ax = 0 ); | |
| | | void AddVariable ( const TString& expression, char type='F', | |
| | | Double_t min = 0, Double_t max = 0 ); | |
| | | void AddTarget ( const TString& expression, const TString& t | |
| | | itle = "", const TString& unit = "", | |
| | | Double_t min = 0, Double_t max = 0 ); | |
| | | void AddRegressionTarget( const TString& expression, const TString& t | |
| | | itle = "", const TString& unit = "", | |
| | | Double_t min = 0, Double_t max = 0 ) | |
| | | { | |
| | | AddTarget( expression, title, unit, min, max ); | |
| | | } | |
| | | void AddSpectator ( const TString& expression, const TString& | |
| | | title = "", const TString& unit = "", | |
| | | Double_t min = 0, Double_t max = 0 ); | |
| | | | |
| | | // set weight for class | |
| | | void SetWeightExpression( const TString& variable, const TString& cla | |
| | | ssName = "" ); | |
| | | | |
| | | // set cut for class | |
| | | void SetCut( const TString& cut, const TString& className = "" ); | |
| | | void SetCut( const TCut& cut, const TString& className = "" ); | |
| | | void AddCut( const TString& cut, const TString& className = "" ); | |
| | | void AddCut( const TCut& cut, const TString& className = "" ); | |
| | | | |
| | | // prepare input tree for training | |
| | | void PrepareTrainingAndTestTree( const TCut& cut, const TString& spli | |
| | | tOpt ); | |
| | | void PrepareTrainingAndTestTree( TCut sigcut, TCut bkgcut, const TStr | |
| | | ing& splitOpt ); | |
| | | | |
| | | // ... deprecated, kept for backwards compatibility | |
| | | void PrepareTrainingAndTestTree( const TCut& cut, Int_t Ntrain, Int_t | |
| | | Ntest = -1 ); | |
| | | | |
| | | void PrepareTrainingAndTestTree( const TCut& cut, Int_t NsigTrain, In | |
| | | t_t NbkgTrain, Int_t NsigTest, Int_t NbkgTest, | |
| | | const TString& otherOpt="SplitMode=R | |
| | | andom:!V" ); | |
| | | | |
| | | MethodBase* BookMethod( TString theMethodName, TString methodTitle, T | |
| | | String theOption = "" ); | |
| | | MethodBase* BookMethod( Types::EMVA theMethod, TString methodTitle, | |
| | | TString theOption = "" ); | |
| | | MethodBase* BookMethod( TMVA::Types::EMVA /*theMethod*/, | |
| | | TString /*methodTitle*/, | |
| | | TString /*methodOption*/, | |
| | | TMVA::Types::EMVA /*theCommittee*/, | |
| | | TString /*committeeOption = ""*/ ) { return 0 | |
| | | ; } | |
| | | | |
| | | // optimize all booked methods (well, if desired by the method) | |
| | | void OptimizeAllMethods (TString fomType="ROCIntegral | |
| | | ", TString fitType="FitGA"); | |
| | | void OptimizeAllMethodsForClassification(TString fomType="ROCIntegral | |
| | | ", TString fitType="FitGA") { OptimizeAllMethods(fomType,fitType); } | |
| | | void OptimizeAllMethodsForRegression (TString fomType="ROCIntegral | |
| | | ", TString fitType="FitGA") { OptimizeAllMethods(fomType,fitType); } | |
| | | | |
| | | // training for all booked methods | |
| | | void TrainAllMethods (); | |
| | | void TrainAllMethodsForClassification( void ) { TrainAllMethods(); } | |
| | | void TrainAllMethodsForRegression ( void ) { TrainAllMethods(); } | |
| | | | |
| | | // testing | |
| | | void TestAllMethods(); | |
| | | | |
| | | // performance evaluation | |
| | | void EvaluateAllMethods( void ); | |
| | | void EvaluateAllVariables( TString options = "" ); | |
| | | | |
| | | // delete all methods and reset the method vector | |
| | | void DeleteAllMethods( void ); | |
| | | | |
| | | // accessors | |
| | | IMethod* GetMethod( const TString& title ) const; | |
| | | | |
| | | Bool_t Verbose( void ) const { return fVerbose; } | |
| | | void SetVerbose( Bool_t v=kTRUE ); | |
| | | | |
| | | // make ROOT-independent C++ class for classifier response | |
| | | // (classifier-specific implementation) | |
| | | // If no classifier name is given, help messages for all booked | |
| | | // classifiers are printed | |
| | | virtual void MakeClass( const TString& methodTitle = "" ) const; | |
| | | | |
| | | // prints classifier-specific hepl messages, dedicated to | |
| | | // help with the optimisation and configuration options tuning. | |
| | | // If no classifier name is given, help messages for all booked | |
| | | // classifiers are printed | |
| | | void PrintHelpMessage( const TString& methodTitle = "" ) const; | |
| | | | |
| | | static TDirectory* RootBaseDir() { return (TDirectory*)fgTargetFile; | |
| | | } | |
| | | | |
| | | private: | |
| | | | |
| | | // the beautiful greeting message | |
| | | void Greetings(); | |
| | | | |
| | | void WriteDataInformation(); | |
| | | | |
| | | DataInputHandler& DataInput() { return *fDataInputHandler; } | |
| | | DataSetInfo& DefaultDataSetInfo(); | |
| | | void SetInputTreesFromEventAssignTrees(); | |
| | | | |
| | | private: | |
| | | | |
| | | // data members | |
| | | | |
| | | DataSetManager* fDataSetManager; // DSMTEST | |
| | | | |
| | | static TFile* fgTargetFile; //! ROOT | |
| | | output file | |
| | | | |
| | | DataInputHandler* fDataInputHandler; | |
| | | | |
| | | std::vector<TMVA::VariableTransformBase*> fDefaultTrfs; //! list | |
| | | of transformations on default DataSet | |
| | | | |
| | | // cd to local directory | |
| | | TString fOptions; //! optio | |
| | | n string given by construction (presently only "V") | |
| | | TString fTransformations; //! List | |
| | | of transformations to test | |
| | | Bool_t fVerbose; //! verbo | |
| | | se mode | |
| | | | |
| | | MVector fMethods; //! all M | |
| | | VA methods | |
| | | TString fJobName; //! jobna | |
| | | me, used as extension in weight file names | |
| | | | |
| | | // flag determining the way training and test data are assigned to Fa | |
| | | ctory | |
| | | enum DataAssignType { kUndefined = 0, | |
| | | kAssignTrees, | |
| | | kAssignEvents }; | |
| | | DataAssignType fDataAssignType; //! flags | |
| | | for data assigning | |
| | | std::vector<TTree*> fTrainAssignTree; //! for e | |
| | | ach class: tmp tree if user wants to assign the events directly | |
| | | std::vector<TTree*> fTestAssignTree; //! for e | |
| | | ach class: tmp tree if user wants to assign the events directly | |
| | | | |
| | | Int_t fATreeType; // typ | |
| | | e of event (=classIndex) | |
| | | Float_t fATreeWeight; // wei | |
| | | ght of the event | |
| | | Float_t* fATreeEvent; // eve | |
| | | nt variables | |
| | | | |
| | | Types::EAnalysisType fAnalysisType; //! the t | |
| | | raining type | |
| | | | |
|
| namespace ROOT { | | protected: | |
| | | | |
| namespace Math { | | | |
| | | | |
| class Minimizer; | | | |
| class DistSampler; | | | |
| | | | |
| //_________________________________________________________________________ | | | |
| __ | | | |
| /** | | | |
| Factory class holding static functions to create the interfaces like RO | | | |
| OT::Math::Minimizer | | | |
| via the Plugin Manager | | | |
| */ | | | |
| class Factory { | | | |
| public: | | | |
| | | | |
| /** | | | |
| static method to create the corrisponding Minimizer given the string | | | |
| Supported Minimizers types are: | | | |
| Minuit (TMinuit), Minuit2, GSLMultiMin, GSLMultiFit, GSLSimAn, Linear | | | |
| , Fumili, Genetic | | | |
| If no name is given use default values defined in MinimizerOptions | | | |
| */ | | | |
| static ROOT::Math::Minimizer * CreateMinimizer(const std::string & minim | | | |
| izerType = "", const std::string & algoType = ""); | | | |
| | | | |
| /** | | | |
| static method to create the distribution sampler class given a string | | | |
| specifying the type | | | |
| Supported sampler types are: | | | |
| Unuran, Foam | | | |
| If no name is given use default values defined in DistSamplerOptions | | | |
| */ | | | |
| static ROOT::Math::DistSampler * CreateDistSampler(const std::string & s | | | |
| amplerType =""); | | | |
| | | | |
| }; | | | |
| | | | |
|
| } // end namespace Fit | | ClassDef(Factory,0) // The factory creates all MVA methods, and perf | |
| | | orms their training and testing | |
| | | }; | |
| | | | |
|
| } // end namespace ROOT | | } // namespace TMVA | |
| | | | |
|
| #endif /* ROOT_Fit_MinimizerFactory */ | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 53 lines changed or deleted | | 360 lines changed or added | |
|
| ProfileLikelihoodTestStat.h | | ProfileLikelihoodTestStat.h | |
|
| // @(#)root/roostats:$Id: ProfileLikelihoodTestStat.h 40023 2011-06-27 16:5
8:44Z moneta $ | | // @(#)root/roostats:$Id: ProfileLikelihoodTestStat.h 40567 2011-08-11 16:3
1:47Z moneta $ | |
| // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke | | // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke | |
|
| | | // Additional Contributions: Giovanni Petrucciani | |
| /************************************************************************* | | /************************************************************************* | |
| * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * | | * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * | |
| * All rights reserved. * | | * All rights reserved. * | |
| * * | | * * | |
| * For the licensing terms see $ROOTSYS/LICENSE. * | | * For the licensing terms see $ROOTSYS/LICENSE. * | |
| * For the list of contributors see $ROOTSYS/README/CREDITS. * | | * For the list of contributors see $ROOTSYS/README/CREDITS. * | |
| *************************************************************************/ | | *************************************************************************/ | |
| | | | |
| #ifndef ROOSTATS_ProfileLikelihoodTestStat | | #ifndef ROOSTATS_ProfileLikelihoodTestStat | |
| #define ROOSTATS_ProfileLikelihoodTestStat | | #define ROOSTATS_ProfileLikelihoodTestStat | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 51 | |
| #include "RooStats/SamplingDistribution.h" | | #include "RooStats/SamplingDistribution.h" | |
| #include "RooStats/TestStatistic.h" | | #include "RooStats/TestStatistic.h" | |
| | | | |
| #include "RooStats/RooStatsUtils.h" | | #include "RooStats/RooStatsUtils.h" | |
| | | | |
| #include "RooRealVar.h" | | #include "RooRealVar.h" | |
| #include "RooProfileLL.h" | | #include "RooProfileLL.h" | |
| #include "RooNLLVar.h" | | #include "RooNLLVar.h" | |
| | | | |
| #include "RooMinuit.h" | | #include "RooMinuit.h" | |
|
| | | #include "RooMinimizer.h" | |
| | | #include "Math/MinimizerOptions.h" | |
| | | | |
| namespace RooStats { | | namespace RooStats { | |
| | | | |
| class ProfileLikelihoodTestStat : public TestStatistic{ | | class ProfileLikelihoodTestStat : public TestStatistic{ | |
| | | | |
| public: | | public: | |
| ProfileLikelihoodTestStat() { | | ProfileLikelihoodTestStat() { | |
| // Proof constructor. Do not use. | | // Proof constructor. Do not use. | |
| fPdf = 0; | | fPdf = 0; | |
| fProfile = 0; | | fProfile = 0; | |
| fNll = 0; | | fNll = 0; | |
| fCachedBestFitParams = 0; | | fCachedBestFitParams = 0; | |
| fLastData = 0; | | fLastData = 0; | |
| fOneSided = false; | | fOneSided = false; | |
| fReuseNll = false; | | fReuseNll = false; | |
|
| | | fMinimizer=ROOT::Math::MinimizerOptions::DefaultMinimizerType().c_st | |
| | | r(); | |
| | | fStrategy=ROOT::Math::MinimizerOptions::DefaultStrategy(); | |
| | | fPrintLevel=ROOT::Math::MinimizerOptions::DefaultPrintLevel(); | |
| | | | |
| } | | } | |
| ProfileLikelihoodTestStat(RooAbsPdf& pdf) { | | ProfileLikelihoodTestStat(RooAbsPdf& pdf) { | |
| fPdf = &pdf; | | fPdf = &pdf; | |
| fProfile = 0; | | fProfile = 0; | |
| fNll = 0; | | fNll = 0; | |
| fCachedBestFitParams = 0; | | fCachedBestFitParams = 0; | |
| fLastData = 0; | | fLastData = 0; | |
| fOneSided = false; | | fOneSided = false; | |
| fReuseNll = false; | | fReuseNll = false; | |
|
| | | fMinimizer=ROOT::Math::MinimizerOptions::DefaultMinimizerType(); | |
| | | fStrategy=ROOT::Math::MinimizerOptions::DefaultStrategy(); | |
| | | fPrintLevel=ROOT::Math::MinimizerOptions::DefaultPrintLevel(); | |
| } | | } | |
| virtual ~ProfileLikelihoodTestStat() { | | virtual ~ProfileLikelihoodTestStat() { | |
| // delete fRand; | | // delete fRand; | |
| // delete fTestStatistic; | | // delete fTestStatistic; | |
| if(fProfile) delete fProfile; | | if(fProfile) delete fProfile; | |
| if(fNll) delete fNll; | | if(fNll) delete fNll; | |
| if(fCachedBestFitParams) delete fCachedBestFitParams; | | if(fCachedBestFitParams) delete fCachedBestFitParams; | |
| } | | } | |
| void SetOneSided(Bool_t flag=true) {fOneSided = flag;} | | void SetOneSided(Bool_t flag=true) {fOneSided = flag;} | |
| | | | |
| static void SetAlwaysReuseNLL(Bool_t flag) { fgAlwaysReuseNll = flag ;
} | | static void SetAlwaysReuseNLL(Bool_t flag) { fgAlwaysReuseNll = flag ;
} | |
| void SetReuseNLL(Bool_t flag) { fReuseNll = flag ; } | | void SetReuseNLL(Bool_t flag) { fReuseNll = flag ; } | |
| | | | |
|
| | | void SetMinimizer(const char* minimizer){ fMinimizer=minimizer;} | |
| | | void SetStrategy(Int_t strategy){fStrategy=strategy;} | |
| | | void SetPrintLevel(Int_t printlevel){fPrintLevel=printlevel;} | |
| | | | |
| // Main interface to evaluate the test statistic on a dataset | | // Main interface to evaluate the test statistic on a dataset | |
| virtual Double_t Evaluate(RooAbsData& data, RooArgSet& paramsOfInteres
t) { | | virtual Double_t Evaluate(RooAbsData& data, RooArgSet& paramsOfInteres
t) { | |
| if (!&data) { | | if (!&data) { | |
| cout << "problem with data" << endl; | | cout << "problem with data" << endl; | |
| return 0 ; | | return 0 ; | |
| } | | } | |
| | | | |
| RooRealVar* firstPOI = (RooRealVar*) paramsOfInterest.first(); | | RooRealVar* firstPOI = (RooRealVar*) paramsOfInterest.first(); | |
| double initial_mu_value = firstPOI->getVal(); | | double initial_mu_value = firstPOI->getVal(); | |
| //paramsOfInterest.getRealValue(firstPOI->GetName()); | | //paramsOfInterest.getRealValue(firstPOI->GetName()); | |
| | | | |
| RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelo
w(); | | RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelo
w(); | |
| RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); | | RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); | |
| | | | |
| // simple | | // simple | |
| Bool_t reuse=(fReuseNll || fgAlwaysReuseNll) ; | | Bool_t reuse=(fReuseNll || fgAlwaysReuseNll) ; | |
| | | | |
| Bool_t created(kFALSE) ; | | Bool_t created(kFALSE) ; | |
| if (!reuse || fNll==0) { | | if (!reuse || fNll==0) { | |
|
| fNll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData(kFALSE) | | RooArgSet* allParams = fPdf->getParameters(data); | |
| ); | | RooStats::RemoveConstantParameters(allParams); | |
| fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInterest); | | | |
| | | // need to call constrain for RooSimultaneous until stripDisconnect | |
| | | ed problem fixed | |
| | | fNll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData(kFALSE) | |
| | | ,RooFit::Constrain(*allParams)); | |
| | | | |
| | | // fNll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData | |
| | | (kFALSE)); | |
| | | // fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInte | |
| | | rest); | |
| created = kTRUE ; | | created = kTRUE ; | |
| //cout << "creating profile LL " << fNll << " " << fProfile << " da
ta = " << &data << endl ; | | //cout << "creating profile LL " << fNll << " " << fProfile << " da
ta = " << &data << endl ; | |
| } | | } | |
| if (reuse && !created) { | | if (reuse && !created) { | |
| //cout << "reusing profile LL " << fNll << " new data = " << &data
<< endl ; | | //cout << "reusing profile LL " << fNll << " new data = " << &data
<< endl ; | |
| fNll->setData(data,kFALSE) ; | | fNll->setData(data,kFALSE) ; | |
|
| if (fProfile) delete fProfile ; | | // if (fProfile) delete fProfile ; | |
| fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInterest) ; | | // fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInte | |
| | | rest) ; | |
| //fProfile->clearAbsMin() ; | | //fProfile->clearAbsMin() ; | |
| } | | } | |
| | | | |
| // make sure we set the variables attached to this nll | | // make sure we set the variables attached to this nll | |
| RooArgSet* attachedSet = fNll->getVariables(); | | RooArgSet* attachedSet = fNll->getVariables(); | |
| | | | |
| *attachedSet = paramsOfInterest; | | *attachedSet = paramsOfInterest; | |
|
| | | RooArgSet* origAttachedSet = (RooArgSet*) attachedSet->snapshot(); | |
| | | | |
|
| | | //////////////////////////////////////////////////////////////////// | |
| | | /// | |
| | | // Main profiling version as of 5.30 | |
| // fPdf->setEvalErrorLoggingMode(RooAbsReal::CountErrors); | | // fPdf->setEvalErrorLoggingMode(RooAbsReal::CountErrors); | |
| // profile->setEvalErrorLoggingMode(RooAbsReal::CountErrors); | | // profile->setEvalErrorLoggingMode(RooAbsReal::CountErrors); | |
| // ((RooProfileLL*)profile)->nll().setEvalErrorLoggingMode(Roo
AbsReal::CountErrors); | | // ((RooProfileLL*)profile)->nll().setEvalErrorLoggingMode(Roo
AbsReal::CountErrors); | |
| // nll->setEvalErrorLoggingMode(RooAbsReal::CountErrors); | | // nll->setEvalErrorLoggingMode(RooAbsReal::CountErrors); | |
| //cout << "evaluating profile LL" << endl ; | | //cout << "evaluating profile LL" << endl ; | |
|
| double ret = fProfile->getVal(); | | | |
| | | // double ret = fProfile->getVal(); // previous main evaluatio | |
| | | n | |
| | | | |
| // cout << "profile value = " << ret << endl ; | | // cout << "profile value = " << ret << endl ; | |
| // cout <<"eval errors pdf = "<<fPdf->numEvalErrors() << endl; | | // cout <<"eval errors pdf = "<<fPdf->numEvalErrors() << endl; | |
| // cout <<"eval errors profile = "<<profile->numEvalErrors() <
< endl; | | // cout <<"eval errors profile = "<<profile->numEvalErrors() <
< endl; | |
| // cout <<"eval errors profile->nll = "<<((RooProfileLL*)profi
le)->nll().numEvalErrors() << endl; | | // cout <<"eval errors profile->nll = "<<((RooProfileLL*)profi
le)->nll().numEvalErrors() << endl; | |
| // cout <<"eval errors nll = "<<nll->numEvalErrors() << endl; | | // cout <<"eval errors nll = "<<nll->numEvalErrors() << endl; | |
| // if(profile->numEvalErrors()>0) | | // if(profile->numEvalErrors()>0) | |
| // cout <<"eval errors = "<<profile->numEvalErrors() <
< endl; | | // cout <<"eval errors = "<<profile->numEvalErrors() <
< endl; | |
| // paramsOfInterest.Print("v"); | | // paramsOfInterest.Print("v"); | |
| // cout << "ret = " << ret << endl; | | // cout << "ret = " << ret << endl; | |
|
| | | //////////////////////////////////////////////////////////////////// | |
| | | /// | |
| | | | |
| | | //////////////////////////////////////////////////////////////////// | |
| | | /// | |
| | | // New profiling based on RooMinimizer (allows for Minuit2) | |
| | | // based on major speed increases seen by CMS for complex problems | |
| | | | |
| | | /* | |
| | | // set the parameters of interest to be fixed for the conditional ML | |
| | | E | |
| | | TIterator* it = paramsOfInterest.createIterator(); | |
| | | RooRealVar* tmpPar = NULL, *tmpParA=NULL; | |
| | | while((tmpPar = (RooRealVar*)it->Next())){ | |
| | | tmpParA = ((RooRealVar*)attachedSet->find(tmpPar->GetName())); | |
| | | tmpParA->setConstant(); | |
| | | } | |
| | | | |
| | | // cout <<"using Minimizer: "<< fMinimizer<< " with strategy = | |
| | | " << fStrategy << endl; | |
| | | | |
| | | // get the numerator | |
| | | int statusN; | |
| | | double condML = GetMinNLL(statusN); | |
| | | | |
| | | // set the parameters of interest back to floating | |
| | | it->Reset(); | |
| | | while((tmpPar = (RooRealVar*)it->Next())){ | |
| | | tmpParA = ((RooRealVar*)attachedSet->find(tmpPar->GetName())); | |
| | | tmpParA->setConstant(false); | |
| | | } | |
| | | delete it; | |
| | | | |
| | | // get the denominator | |
| | | int statusD; | |
| | | double uncondML = GetMinNLL(statusD); | |
| | | */ | |
| | | | |
| | | // other order | |
| | | // get the numerator | |
| | | RooArgSet* snap = (RooArgSet*)paramsOfInterest.snapshot(); | |
| | | // get the denominator | |
| | | int statusD; | |
| | | double uncondML = GetMinNLL(statusD); | |
| | | | |
| | | // cout <<" reestablish snapshot"<<endl; | |
| | | *attachedSet = *snap; | |
| | | | |
| | | TIterator* it = paramsOfInterest.createIterator(); | |
| | | RooRealVar* tmpPar = NULL, *tmpParA=NULL; | |
| | | while((tmpPar = (RooRealVar*)it->Next())){ | |
| | | tmpParA = ((RooRealVar*)attachedSet->find(tmpPar->GetName())); | |
| | | tmpParA->setConstant(); | |
| | | } | |
| | | int statusN; | |
| | | double condML = GetMinNLL(statusN); | |
| | | | |
| | | *attachedSet = *origAttachedSet; | |
| | | | |
| | | double ret=condML-uncondML;; | |
| | | | |
| if(fOneSided){ | | if(fOneSided){ | |
|
| double fit_favored_mu = ((RooProfileLL*) fProfile)->bestFitObs().ge | | // double fit_favored_mu = ((RooProfileLL*) fProfile)->bestFit | |
| tRealValue(firstPOI->GetName()) ; | | Obs().getRealValue(firstPOI->GetName()) ; | |
| | | double fit_favored_mu = attachedSet->getRealValue(firstPOI->GetName | |
| | | ()) ; | |
| | | | |
| if( fit_favored_mu > initial_mu_value) | | if( fit_favored_mu > initial_mu_value) | |
|
| // cout <<"fit-favored_mu, initial value" << fit_favored_mu << "
" << initial_mu_value<<endl; | | | |
| ret = 0 ; | | ret = 0 ; | |
| } | | } | |
| delete attachedSet; | | delete attachedSet; | |
|
| | | delete origAttachedSet; | |
| | | delete snap; | |
| | | delete it; | |
| | | | |
| if (!reuse) { | | if (!reuse) { | |
|
| //cout << "deleting ProfileLL " << fNll << " " << fProfile << endl
; | | | |
| delete fNll; | | delete fNll; | |
| fNll = 0; | | fNll = 0; | |
|
| delete fProfile; | | // delete fProfile; | |
| fProfile = 0 ; | | fProfile = 0 ; | |
| } | | } | |
| | | | |
| RooMsgService::instance().setGlobalKillBelow(msglevel); | | RooMsgService::instance().setGlobalKillBelow(msglevel); | |
| | | | |
|
| ////////////////////////////////////////////////////// | | if(statusN!=0 || statusD!=0) | |
| // return here and forget about the following code | | ret= -1; // indicate failed fit | |
| return ret; | | | |
| | | | |
|
| ////////////////////////////////////////////////////////// | | return ret; | |
| // OLD version with some handling for local minima | | | |
| // (not used right now) | | | |
| ///////////////////////////////////////////////////////// | | | |
| | | | |
| bool needToRebuild = true; // try to avoid rebuilding if possible | | | |
| | | | |
| if (fLastData == &data) // simple pointer comparison for now (note | | | |
| NLL makes COPY of data) | | | |
| needToRebuild = false; | | | |
| else fLastData = &data; // keep a copy of pointer to original data | | | |
| | | | |
| // pointer comparison causing problems. See multiple datasets wit | | | |
| h same value of pointer | | | |
| // but actually a new dataset | | | |
| needToRebuild = true; | | | |
| | | | |
| // check mem leak in NLL or Profile. Should remove. | | | |
| // if(fProfile) needToRebuild = false; | | | |
| | | | |
| if (needToRebuild) { | | | |
| if (fProfile) delete fProfile; | | | |
| if (fNll) delete fNll; | | | |
| | | | |
| /* | | | |
| RooNLLVar* nll = new RooNLLVar("nll","",*fPdf,data, RooFit::Ex | | | |
| tended()); | | | |
| fNll = nll; | | | |
| fProfile = new RooProfileLL("pll","",*nll, paramsOfInterest); | | | |
| */ | | | |
| RooArgSet* constrainedParams = fPdf->getParameters(data); | | | |
| RemoveConstantParameters(constrainedParams); | | | |
| //cout << "cons: " << endl; | | | |
| //constrainedParams->Print("v"); | | | |
| | | | |
| RooNLLVar * nll2 = (RooNLLVar*) fPdf->createNLL( | | | |
| data, RooFit::CloneData(kFALSE), RooFit::Constrain(*constrai | | | |
| nedParams) | | | |
| ); | | | |
| fNll = nll2; | | | |
| fProfile = (RooProfileLL*) nll2->createProfile(paramsOfInterest | | | |
| ); | | | |
| delete constrainedParams; | | | |
| | | | |
| // paramsOfInterest.Print("v"); | | | |
| | | | |
| // set parameters to previous best fit params, to speed converg | | | |
| ence | | | |
| // and to avoid local minima | | | |
| if (fCachedBestFitParams) { | | | |
| // store original values, since minimization will change the | | | |
| m. | | | |
| RooArgSet* origParamVals = (RooArgSet*) paramsOfInterest.sna | | | |
| pshot(); | | | |
| | | | |
| // these parameters are not guaranteed to be the best for th | | | |
| is data | | | |
| SetParameters(fCachedBestFitParams, fProfile->getParameters( | | | |
| data)); | | | |
| // now evaluate to force this profile to evaluate and store | | | |
| // best fit parameters for this data | | | |
| fProfile->getVal(); | | | |
| | | | |
| // possibly store last MLE for reference | | | |
| // Double mle = fNll->getVal(); | | | |
| | | | |
| // restore parameters | | | |
| SetParameters(origParamVals, ¶msOfInterest); | | | |
| | | | |
| // cleanup | | | |
| delete origParamVals; | | | |
| | | | |
| } else { | | | |
| | | | |
| // store best fit parameters | | | |
| // RooProfileLL::bestFitParams returns best fit of nuisance | | | |
| parameters only | | | |
| // fCachedBestFitParams = (RooArgSet*) (fProfile->be | | | |
| stFitParams().clone("lastBestFit")); | | | |
| // ProfileLL::getParameters returns current value of the par | | | |
| ameters | | | |
| // fCachedBestFitParams = (RooArgSet*) (fProfile->ge | | | |
| tParameters(data)->clone("lastBestFit")); | | | |
| //cout << "making fCachedBestFitParams: " << fCachedBestFitP | | | |
| arams << fCachedBestFitParams->getSize() << endl; | | | |
| | | | |
| // store original values, since minimization will change the | | | |
| m. | | | |
| RooArgSet* origParamVals = (RooArgSet*) paramsOfInterest.sna | | | |
| pshot(); | | | |
| | | | |
| // find minimum | | | |
| RooMinuit minuit(*fNll); | | | |
| minuit.setPrintLevel(-999); | | | |
| minuit.setNoWarn(); | | | |
| minuit.migrad(); | | | |
| | | | |
| // store the best fit values for future use | | | |
| fCachedBestFitParams = (RooArgSet*) (fNll->getParameters(dat | | | |
| a)->snapshot()); | | | |
| | | | |
| // restore parameters | | | |
| SetParameters(origParamVals, ¶msOfInterest); | | | |
| | | | |
| // evaluate to force this profile to evaluate and store | | | |
| // best fit parameters for this data | | | |
| fProfile->getVal(); | | | |
| | | | |
| // cleanup | | | |
| delete origParamVals; | | | |
| | | | |
| } | | | |
| | | | |
| } | | | |
| // issue warning if problems | | | |
| if (!fProfile) { | | | |
| cout << "problem making profile" << endl; | | | |
| } | | | |
| | | | |
| // set parameters to point being requested | | | |
| SetParameters(¶msOfInterest, fProfile->getParameters(data)); | | | |
| | | | |
| Double_t value = fProfile->getVal(); | | | |
| | | | |
| /* | | | |
| // for debugging caching | | | |
| cout << "current value of input params: " << endl; | | | |
| paramsOfInterest.Print("verbose"); | | | |
| | | | |
| cout << "current value of params in profile: " << endl; | | | |
| fProfile->getParameters(data)->Print("verbose"); | | | |
| | | | |
| cout << "cached last best fit: " << endl; | | | |
| fCachedBestFitParams->Print("verbose"); | | | |
| */ | | | |
| | | | |
| // catch false minimum | | | |
| if (value < 0) { | | | |
| // cout << "ProfileLikelihoodTestStat: problem that profileLL | | | |
| = " << value | | | |
| // << " < 0, indicates false min. Try again."<<endl; | | | |
| delete fNll; | | | |
| delete fProfile; | | | |
| /* | | | |
| RooNLLVar* nll = new RooNLLVar("nll","",*fPdf,data, RooFit::Ex | | | |
| tended()); | | | |
| fNll = nll; | | | |
| fProfile = new RooProfileLL("pll","",*nll, paramsOfInterest); | | | |
| */ | | | |
| | | | |
| RooArgSet* constrainedParams = fPdf->getParameters(data); | | | |
| RemoveConstantParameters(constrainedParams); | | | |
| | | | |
| RooNLLVar * nll2 = (RooNLLVar*) fPdf->createNLL(data, RooFit::C | | | |
| loneData(kFALSE), RooFit::Constrain( | | | |
| *constrainedParams)); | | | |
| fNll = nll2; | | | |
| fProfile = (RooProfileLL*) nll2->createProfile(paramsOfInterest | | | |
| ); | | | |
| delete constrainedParams; | | | |
| | | | |
| // set parameters to point being requested | | | |
| SetParameters(¶msOfInterest, fProfile->getParameters(data)) | | | |
| ; | | | |
| | | | |
| value = fProfile->getVal(); | | | |
| //cout << "now profileLL = " << value << endl; | | | |
| } | | | |
| // cout << "now profileLL = " << value << endl; | | | |
| RooMsgService::instance().setGlobalKillBelow(RooFit::DEBUG); | | | |
| return value; | | | |
| | | | |
|
| } | | } | |
| | | | |
| virtual const TString GetVarName() const {return "Profile Likelihood
Ratio";} | | virtual const TString GetVarName() const {return "Profile Likelihood
Ratio";} | |
| | | | |
| // const bool PValueIsRightTail(void) { return false; } // overw
rites default | | // const bool PValueIsRightTail(void) { return false; } // overw
rites default | |
| | | | |
|
| | | private: | |
| | | double GetMinNLL(int& status) { | |
| | | | |
| | | RooMinimizer minim(*fNll); | |
| | | minim.setStrategy(fStrategy); | |
| | | //LM: RooMinimizer.setPrintLevel has +1 offset - so subtruct here | |
| | | -1 | |
| | | minim.setPrintLevel(fPrintLevel-1); | |
| | | // minim.optimizeConst(true); | |
| | | for (int tries = 0, maxtries = 4; tries <= maxtries; ++tries) { | |
| | | // status = minim.minimize(fMinimizer, ROOT::Math::MinimizerOp | |
| | | tions::DefaultMinimizerAlgo().c_str()); | |
| | | status = minim.minimize(fMinimizer, "Minimize"); | |
| | | if (status == 0) { | |
| | | break; | |
| | | } else { | |
| | | if (tries > 1) { | |
| | | printf(" ----> Doing a re-scan first\n"); | |
| | | minim.minimize(fMinimizer,"Scan"); | |
| | | } | |
| | | if (tries > 2) { | |
| | | printf(" ----> trying with strategy = 1\n"); | |
| | | minim.setStrategy(1); | |
| | | } | |
| | | } | |
| | | } | |
| | | // cout <<"fNll = " << fNll->getVal()<<endl; | |
| | | return fNll->getVal(); | |
| | | } | |
| | | | |
| private: | | private: | |
| RooProfileLL* fProfile; //! | | RooProfileLL* fProfile; //! | |
| RooAbsPdf* fPdf; | | RooAbsPdf* fPdf; | |
| RooNLLVar* fNll; //! | | RooNLLVar* fNll; //! | |
| const RooArgSet* fCachedBestFitParams; | | const RooArgSet* fCachedBestFitParams; | |
| RooAbsData* fLastData; | | RooAbsData* fLastData; | |
| // Double_t fLastMLE; | | // Double_t fLastMLE; | |
| Bool_t fOneSided; | | Bool_t fOneSided; | |
| | | | |
| static Bool_t fgAlwaysReuseNll ; | | static Bool_t fgAlwaysReuseNll ; | |
| Bool_t fReuseNll ; | | Bool_t fReuseNll ; | |
|
| | | TString fMinimizer; | |
| | | Int_t fStrategy; | |
| | | Int_t fPrintLevel; | |
| | | | |
| protected: | | protected: | |
|
| ClassDef(ProfileLikelihoodTestStat,4) // implements the profile lik
elihood ratio as a test statistic to be used with several tools | | ClassDef(ProfileLikelihoodTestStat,5) // implements the profile lik
elihood ratio as a test statistic to be used with several tools | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 23 change blocks. |
| 188 lines changed or deleted | | 145 lines changed or added | |
|
| TProofPlayer.h | | TProofPlayer.h | |
|
| // @(#)root/proofplayer:$Id: TProofPlayer.h 39442 2011-05-27 09:13:25Z gani
s $ | | // @(#)root/proofplayer:$Id: TProofPlayer.h 40188 2011-07-11 13:13:11Z gani
s $ | |
| // Author: Maarten Ballintijn 07/01/02 | | // Author: Maarten Ballintijn 07/01/02 | |
| | | | |
| /************************************************************************* | | /************************************************************************* | |
| * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. * | | * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. * | |
| * All rights reserved. * | | * All rights reserved. * | |
| * * | | * * | |
| * For the licensing terms see $ROOTSYS/LICENSE. * | | * For the licensing terms see $ROOTSYS/LICENSE. * | |
| * For the list of contributors see $ROOTSYS/README/CREDITS. * | | * For the list of contributors see $ROOTSYS/README/CREDITS. * | |
| *************************************************************************/ | | *************************************************************************/ | |
| | | | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 300 | |
| virtual Long64_t Finalize(TQueryResult *qr); | | virtual Long64_t Finalize(TQueryResult *qr); | |
| Long64_t DrawSelect(TDSet *set, const char *varexp, | | Long64_t DrawSelect(TDSet *set, const char *varexp, | |
| const char *selection, Option_t *option = "", | | const char *selection, Option_t *option = "", | |
| Long64_t nentries = -1, Long64_t firstentry =
0); | | Long64_t nentries = -1, Long64_t firstentry =
0); | |
| | | | |
| void RedirectOutput(Bool_t on = kTRUE); | | void RedirectOutput(Bool_t on = kTRUE); | |
| void StopProcess(Bool_t abort, Int_t timeout = -1); | | void StopProcess(Bool_t abort, Int_t timeout = -1); | |
| void StoreOutput(TList *out); // Adopts the list | | void StoreOutput(TList *out); // Adopts the list | |
| virtual void StoreFeedback(TObject *slave, TList *out); // Adopts the
list | | virtual void StoreFeedback(TObject *slave, TList *out); // Adopts the
list | |
| Int_t Incorporate(TObject *obj, TList *out, Bool_t &merged); | | Int_t Incorporate(TObject *obj, TList *out, Bool_t &merged); | |
|
| TObject *HandleHistogram(TObject *obj); | | TObject *HandleHistogram(TObject *obj, Bool_t &merged); | |
| Bool_t HistoSameAxis(TH1 *h0, TH1 *h1); | | Bool_t HistoSameAxis(TH1 *h0, TH1 *h1); | |
| Int_t AddOutputObject(TObject *obj); | | Int_t AddOutputObject(TObject *obj); | |
| void AddOutput(TList *out); // Incorporate a list | | void AddOutput(TList *out); // Incorporate a list | |
| virtual void MergeOutput(); | | virtual void MergeOutput(); | |
| void Progress(Long64_t total, Long64_t processed); // *SIGNAL* | | void Progress(Long64_t total, Long64_t processed); // *SIGNAL* | |
| void Progress(TSlave*, Long64_t total, Long64_t processed) | | void Progress(TSlave*, Long64_t total, Long64_t processed) | |
| { Progress(total, processed); } | | { Progress(total, processed); } | |
| void Progress(Long64_t total, Long64_t processed, Long64_t byt
esread, | | void Progress(Long64_t total, Long64_t processed, Long64_t byt
esread, | |
| Float_t initTime, Float_t procTime, | | Float_t initTime, Float_t procTime, | |
| Float_t evtrti, Float_t mbrti); // *SIGNAL* | | Float_t evtrti, Float_t mbrti); // *SIGNAL* | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|