| Factory.h | | Factory.h | |
|
| // @(#)root/mathcore:$Id$ | | // @(#)root/tmva $Id$ | |
| // 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 /*theComposite*/, | |
| | | TString /*compositeOption = ""*/ ) { 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 | |
|
| HypoTestInverterResult.h | | HypoTestInverterResult.h | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| public: | | public: | |
| | | | |
| // default constructor | | // default constructor | |
| explicit HypoTestInverterResult(const char* name = 0); | | explicit HypoTestInverterResult(const char* name = 0); | |
| | | | |
| // constructor | | // constructor | |
| HypoTestInverterResult( const char* name, | | HypoTestInverterResult( const char* name, | |
| const RooRealVar& scannedVariable, | | const RooRealVar& scannedVariable, | |
| double cl ) ; | | double cl ) ; | |
| | | | |
|
| | | HypoTestInverterResult( const HypoTestInverterResult& other, const char* | |
| | | name ); | |
| | | | |
| // destructor | | // destructor | |
| virtual ~HypoTestInverterResult(); | | virtual ~HypoTestInverterResult(); | |
| | | | |
|
| | | // operator = | |
| | | HypoTestInverterResult& operator = (const HypoTestInverterResult& other) | |
| | | ; | |
| | | | |
| | | // remove points that appear to have failed. | |
| | | void ExclusionCleanup(); | |
| | | | |
| // merge with the content of another HypoTestInverterResult object | | // merge with the content of another HypoTestInverterResult object | |
| bool Add( const HypoTestInverterResult& otherResult ); | | bool Add( const HypoTestInverterResult& otherResult ); | |
| | | | |
| //add the result of a single point (an HypoTestRsult) | | //add the result of a single point (an HypoTestRsult) | |
| bool Add( Double_t x, const HypoTestResult & result ); | | bool Add( Double_t x, const HypoTestResult & result ); | |
| | | | |
| // function to return the value of the parameter of interest for the i^t
h entry in the results | | // function to return the value of the parameter of interest for the i^t
h entry in the results | |
| double GetXValue( int index ) const ; | | double GetXValue( int index ) const ; | |
| | | | |
| // function to return the value of the confidence level for the i^th ent
ry in the results | | // function to return the value of the confidence level for the i^th ent
ry in the results | |
| | | | |
| skipping to change at line 96 | | skipping to change at line 104 | |
| int ArraySize() const { return fXValues.size(); }; | | int ArraySize() const { return fXValues.size(); }; | |
| | | | |
| int FindIndex(double xvalue) const; | | int FindIndex(double xvalue) const; | |
| | | | |
| // set the size of the test (rate of Type I error) (eg. 0.05 for a 95% C
onfidence Interval) | | // set the size of the test (rate of Type I error) (eg. 0.05 for a 95% C
onfidence Interval) | |
| virtual void SetTestSize( Double_t size ) { fConfidenceLevel = 1.-size;
} | | virtual void SetTestSize( Double_t size ) { fConfidenceLevel = 1.-size;
} | |
| | | | |
| // set the confidence level for the interval (eg. 0.95 for a 95% Confide
nce Interval) | | // set the confidence level for the interval (eg. 0.95 for a 95% Confide
nce Interval) | |
| virtual void SetConfidenceLevel( Double_t cl ) { fConfidenceLevel = cl;
} | | virtual void SetConfidenceLevel( Double_t cl ) { fConfidenceLevel = cl;
} | |
| | | | |
|
| | | // set CLs threshold for exclusion cleanup function | |
| | | inline void SetCLsCleanupThreshold( Double_t th ) { fCLsCleanupThreshold | |
| | | = th; } | |
| | | | |
| // flag to switch between using CLsb (default) or CLs as confidence leve
l | | // flag to switch between using CLsb (default) or CLs as confidence leve
l | |
| void UseCLs( bool on = true ) { fUseCLs = on; } | | void UseCLs( bool on = true ) { fUseCLs = on; } | |
| | | | |
| // query if one sided result | | // query if one sided result | |
| bool IsOneSided() const { return !fIsTwoSided; } | | bool IsOneSided() const { return !fIsTwoSided; } | |
| // query if two sided result | | // query if two sided result | |
| bool IsTwoSided() const { return fIsTwoSided; } | | bool IsTwoSided() const { return fIsTwoSided; } | |
| | | | |
| // lower and upper bound of the confidence interval (to get upper/lower
limits, multiply the size( = 1-confidence level ) by 2 | | // lower and upper bound of the confidence interval (to get upper/lower
limits, multiply the size( = 1-confidence level ) by 2 | |
| Double_t LowerLimit(); | | Double_t LowerLimit(); | |
| | | | |
| skipping to change at line 186 | | skipping to change at line 197 | |
| bool fIsTwoSided; // two sided scan (look for lower/upp
er limit) | | bool fIsTwoSided; // two sided scan (look for lower/upp
er limit) | |
| bool fInterpolateLowerLimit; | | bool fInterpolateLowerLimit; | |
| bool fInterpolateUpperLimit; | | bool fInterpolateUpperLimit; | |
| bool fFittedLowerLimit; | | bool fFittedLowerLimit; | |
| bool fFittedUpperLimit; | | bool fFittedUpperLimit; | |
| InterpolOption_t fInterpolOption; // interpolatation option (linear or
spline) | | InterpolOption_t fInterpolOption; // interpolatation option (linear or
spline) | |
| | | | |
| double fLowerLimitError; | | double fLowerLimitError; | |
| double fUpperLimitError; | | double fUpperLimitError; | |
| | | | |
|
| | | double fCLsCleanupThreshold; | |
| | | | |
| static double fgAsymptoticMaxSigma; // max sigma value used to scan asy
mptotic expected p values | | static double fgAsymptoticMaxSigma; // max sigma value used to scan asy
mptotic expected p values | |
| | | | |
| std::vector<double> fXValues; | | std::vector<double> fXValues; | |
| | | | |
| TList fYObjects; // list of HypoTestResult for each point | | TList fYObjects; // list of HypoTestResult for each point | |
| TList fExpPValues; // list of expected sampling distribution for eac
h point | | TList fExpPValues; // list of expected sampling distribution for eac
h point | |
| | | | |
| friend class HypoTestInverter; | | friend class HypoTestInverter; | |
| friend class HypoTestInverterPlot; | | friend class HypoTestInverterPlot; | |
| friend class HypoTestInverterOriginal; | | friend class HypoTestInverterOriginal; | |
| | | | |
End of changes. 4 change blocks. |
| 0 lines changed or deleted | | 16 lines changed or added | |
|
| QuasiRandom.h | | QuasiRandom.h | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| #include <string> | | #include <string> | |
| | | | |
| /** | | /** | |
| @defgroup QuasiRandom QuasiRandom number generators and distributions | | @defgroup QuasiRandom QuasiRandom number generators and distributions | |
| */ | | */ | |
| | | | |
| namespace ROOT { | | namespace ROOT { | |
| namespace Math { | | namespace Math { | |
| | | | |
| //_________________________________________________________________________
____________ | | //_________________________________________________________________________
____________ | |
|
| /** | | /** | |
| User class for MathMore random numbers template on the Engine type. | | User class for MathMore random numbers template on the Engine type. | |
| The API of this class followed that of the class ROOT::Math::Random | | The API of this class followed that of the class ROOT::Math::Random | |
| It must be implemented using as Engine one of the derived classes of | | It must be implemented using as Engine one of the derived classes of | |
| ROOT::Math::GSLQuasiRandomEngine, like ROOT::Math::GSLQrngSobol | | ROOT::Math::GSLQuasiRandomEngine, like ROOT::Math::GSLQrngSobol | |
| | | | |
| @ingroup Random | | @ingroup Random | |
| | | | |
| */ | | */ | |
| template < class Engine> | | template < class Engine> | |
| class QuasiRandom { | | class QuasiRandom { | |
| | | | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| Create a QuasiRandom generator. Use default engine constructor. | | Create a QuasiRandom generator. Use default engine constructor. | |
| Engine will be initialized via Initialize() function in order to | | Engine will be initialized via Initialize() function in order to | |
| allocate resources | | allocate resources | |
| */ | | */ | |
| QuasiRandom(unsigned int dimension = 1) { | | QuasiRandom(unsigned int dimension = 1) { | |
| fEngine.Initialize(dimension); | | fEngine.Initialize(dimension); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Create a QuasiRandom generator based on a provided generic engine. | | Create a QuasiRandom generator based on a provided generic engine. | |
| Engine will be initialized via Initialize() function in order to | | Engine will be initialized via Initialize() function in order to | |
| allocate resources | | allocate resources | |
| */ | | */ | |
| explicit QuasiRandom(const Engine & e, unsigned int dimension = 1) : f | | explicit QuasiRandom(const Engine & e, unsigned int dimension = 1) : fEn | |
| Engine(e) { | | gine(e) { | |
| fEngine.Initialize(dimension); | | fEngine.Initialize(dimension); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Destructor: call Terminate() function of engine to free any | | Destructor: call Terminate() function of engine to free any | |
| allocated resource | | allocated resource | |
| */ | | */ | |
| ~QuasiRandom() { | | ~QuasiRandom() { | |
| fEngine.Terminate(); | | fEngine.Terminate(); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Generate next quasi random numbers points | | Generate next quasi random numbers points | |
| */ | | */ | |
| bool Next(double * x) { | | bool Next(double * x) { | |
| return fEngine(x); | | return fEngine(x); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Generate next quasi random numbers point (1 - dimension) | | Generate next quasi random numbers point (1 - dimension) | |
| */ | | */ | |
| double Next() { | | double Next() { | |
| return fEngine(); | | return fEngine(); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Generate quasi random numbers between ]0,1[ | | Generate quasi random numbers between ]0,1[ | |
| 0 and 1 are excluded | | 0 and 1 are excluded | |
| Function to be compatible with ROOT TRandom compatibility | | Function to be compatible with ROOT TRandom compatibility | |
|
| */ | | */ | |
| double Rndm() { | | double Rndm() { | |
| return fEngine(); | | return fEngine(); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| | | skip the next n number and jumb directly to the current state + n | |
| | | */ | |
| | | bool Skip(unsigned int n) { | |
| | | return fEngine.Skip(n); | |
| | | } | |
| | | /** | |
| Generate an array of random numbers between ]0,1[ | | Generate an array of random numbers between ]0,1[ | |
| Function to preserve ROOT Trandom compatibility | | Function to preserve ROOT Trandom compatibility | |
| The array will be filled as x1,y1,z1,....x2,y2,z2,... | | The array will be filled as x1,y1,z1,....x2,y2,z2,... | |
|
| */ | | */ | |
| bool RndmArray(int n, double * array) { | | bool RndmArray(int n, double * array) { | |
| return fEngine.GenerateArray(array, array+n*NDim()); | | return fEngine.GenerateArray(array, array+n*NDim()); | |
| } | | } | |
| | | | |
| /** | | /** | |
| Return the type (name) of the used generator | | Return the type (name) of the used generator | |
| */ | | */ | |
| std::string Type() const { | | std::string Type() const { | |
| return fEngine.Name(); | | return fEngine.Name(); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Return the size of the generator state | | Return the size of the generator state | |
| */ | | */ | |
| unsigned int EngineSize() const { | | unsigned int EngineSize() const { | |
| return fEngine.Size(); | | return fEngine.Size(); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Return the dimension of the generator | | Return the dimension of the generator | |
| */ | | */ | |
| unsigned int NDim() const { | | unsigned int NDim() const { | |
| return fEngine.NDim(); | | return fEngine.NDim(); | |
|
| } | | } | |
| | | | |
|
| /** | | /** | |
| Return the name of the generator | | Return the name of the generator | |
| */ | | */ | |
| std::string Name() const { | | std::string Name() const { | |
| return fEngine.Name(); | | return fEngine.Name(); | |
| } | | } | |
| | | | |
|
| private: | | private: | |
| | | | |
|
| Engine fEngine; | | Engine fEngine; | |
| | | | |
|
| }; | | }; | |
| | | | |
| } // namespace Math | | } // namespace Math | |
| } // namespace ROOT | | } // namespace ROOT | |
| | | | |
| #ifndef ROOT_Math_GSLQuasiRandom | | #ifndef ROOT_Math_GSLQuasiRandom | |
| #include "Math/GSLQuasiRandom.h" | | #include "Math/GSLQuasiRandom.h" | |
| #endif | | #endif | |
| | | | |
| namespace ROOT { | | namespace ROOT { | |
| namespace Math { | | namespace Math { | |
| | | | |
End of changes. 24 change blocks. |
| 78 lines changed or deleted | | 84 lines changed or added | |
|
| RooGlobalFunc.h | | RooGlobalFunc.h | |
| | | | |
| skipping to change at line 226 | | skipping to change at line 226 | |
| RooCmdArg AllBinned() ; | | RooCmdArg AllBinned() ; | |
| RooCmdArg ExpectedData(Bool_t flag=kTRUE) ; | | RooCmdArg ExpectedData(Bool_t flag=kTRUE) ; | |
| RooCmdArg Asimov(Bool_t flag=kTRUE) ; | | RooCmdArg Asimov(Bool_t flag=kTRUE) ; | |
| | | | |
| // RooAbsRealLValue::createHistogram arguments | | // RooAbsRealLValue::createHistogram arguments | |
| RooCmdArg YVar(const RooAbsRealLValue& var, const RooCmdArg& arg=RooCmdArg:
:none()) ; | | RooCmdArg YVar(const RooAbsRealLValue& var, const RooCmdArg& arg=RooCmdArg:
:none()) ; | |
| RooCmdArg ZVar(const RooAbsRealLValue& var, const RooCmdArg& arg=RooCmdArg:
:none()) ; | | RooCmdArg ZVar(const RooAbsRealLValue& var, const RooCmdArg& arg=RooCmdArg:
:none()) ; | |
| RooCmdArg AxisLabel(const char* name) ; | | RooCmdArg AxisLabel(const char* name) ; | |
| RooCmdArg Scaling(Bool_t flag) ; | | RooCmdArg Scaling(Bool_t flag) ; | |
| | | | |
|
| | | // RooAbsReal::createHistogram arguments | |
| | | RooCmdArg IntrinsicBinning(Bool_t flag=kTRUE) ; | |
| | | | |
| // RooAbsReal::createIntegral arguments | | // RooAbsReal::createIntegral arguments | |
| RooCmdArg NormSet(const RooArgSet& nset) ; | | RooCmdArg NormSet(const RooArgSet& nset) ; | |
| RooCmdArg NumIntConfig(const RooNumIntConfig& cfg) ; | | RooCmdArg NumIntConfig(const RooNumIntConfig& cfg) ; | |
| | | | |
| // RooMCStudy::ctor arguments | | // RooMCStudy::ctor arguments | |
| RooCmdArg Silence(Bool_t flag=kTRUE) ; | | RooCmdArg Silence(Bool_t flag=kTRUE) ; | |
| RooCmdArg FitModel(RooAbsPdf& pdf) ; | | RooCmdArg FitModel(RooAbsPdf& pdf) ; | |
| RooCmdArg FitOptions(const RooCmdArg& arg1 ,const RooCmdArg&
arg2=RooCmdArg::none(), | | RooCmdArg FitOptions(const RooCmdArg& arg1 ,const RooCmdArg&
arg2=RooCmdArg::none(), | |
| const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdAr
g& arg4=RooCmdArg::none(), | | const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdAr
g& arg4=RooCmdArg::none(), | |
| const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdAr
g& arg6=RooCmdArg::none()) ; | | const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdAr
g& arg6=RooCmdArg::none()) ; | |
| | | | |
| skipping to change at line 265 | | skipping to change at line 268 | |
| RooCmdArg Topic(Int_t topic) ; | | RooCmdArg Topic(Int_t topic) ; | |
| RooCmdArg ObjectName(const char* name) ; | | RooCmdArg ObjectName(const char* name) ; | |
| RooCmdArg ClassName(const char* name) ; | | RooCmdArg ClassName(const char* name) ; | |
| RooCmdArg BaseClassName(const char* name) ; | | RooCmdArg BaseClassName(const char* name) ; | |
| RooCmdArg TagName(const char* name) ; | | RooCmdArg TagName(const char* name) ; | |
| RooCmdArg OutputStream(std::ostream& os) ; | | RooCmdArg OutputStream(std::ostream& os) ; | |
| RooCmdArg Prefix(Bool_t flag) ; | | RooCmdArg Prefix(Bool_t flag) ; | |
| RooCmdArg Color(Color_t color) ; | | RooCmdArg Color(Color_t color) ; | |
| | | | |
| // RooWorkspace::import() arguments | | // RooWorkspace::import() arguments | |
|
| RooCmdArg RenameConflictNodes(const char* suffix) ; | | RooCmdArg RenameConflictNodes(const char* suffix, Bool_t renameOrigNodes=kF
ALSE) ; | |
| RooCmdArg RenameAllNodes(const char* suffix) ; | | RooCmdArg RenameAllNodes(const char* suffix) ; | |
| RooCmdArg RenameAllVariables(const char* suffix) ; | | RooCmdArg RenameAllVariables(const char* suffix) ; | |
| RooCmdArg RenameAllVariablesExcept(const char* suffix,const char* exception
List) ; | | RooCmdArg RenameAllVariablesExcept(const char* suffix,const char* exception
List) ; | |
| RooCmdArg RenameVariable(const char* inputName, const char* outputName) ; | | RooCmdArg RenameVariable(const char* inputName, const char* outputName) ; | |
| RooCmdArg Rename(const char* suffix) ; | | RooCmdArg Rename(const char* suffix) ; | |
| RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE) ; | | RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE) ; | |
| RooCmdArg Embedded(Bool_t flag=kTRUE) ; | | RooCmdArg Embedded(Bool_t flag=kTRUE) ; | |
|
| | | RooCmdArg NoRecursion(Bool_t flag=kTRUE) ; | |
| | | | |
| // RooSimCloneTool::build() arguments | | // RooSimCloneTool::build() arguments | |
| RooCmdArg SplitParam(const char* varname, const char* catname) ; | | RooCmdArg SplitParam(const char* varname, const char* catname) ; | |
| RooCmdArg SplitParam(const RooRealVar& var, const RooAbsCategory& cat) ; | | RooCmdArg SplitParam(const RooRealVar& var, const RooAbsCategory& cat) ; | |
| RooCmdArg SplitParamConstrained(const char* varname, const char* catname, c
onst char* rsname) ; | | RooCmdArg SplitParamConstrained(const char* varname, const char* catname, c
onst char* rsname) ; | |
| RooCmdArg SplitParamConstrained(const RooRealVar& var, const RooAbsCategory
& cat, const char* rsname) ; | | RooCmdArg SplitParamConstrained(const RooRealVar& var, const RooAbsCategory
& cat, const char* rsname) ; | |
| RooCmdArg Restrict(const char* catName, const char* stateNameList) ; | | RooCmdArg Restrict(const char* catName, const char* stateNameList) ; | |
| | | | |
| // RooAbsPdf::createCdf() arguments | | // RooAbsPdf::createCdf() arguments | |
| RooCmdArg SupNormSet(const RooArgSet& nset) ; | | RooCmdArg SupNormSet(const RooArgSet& nset) ; | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 5 lines changed or added | |
|
| RootFinder.h | | RootFinder.h | |
|
| // @(#)root/mathmore:$Id$ | | // @(#)root/tmva $Id$ | |
| // Authors: L. Moneta, A. Zsenei 08/2005 | | // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss | |
| | | | |
|
| /********************************************************************** | | /************************************************************************** | |
| * * | | ******** | |
| * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT * | | * Project: TMVA - a Root-integrated toolkit for multivariate data analysis | |
| * * | | * | |
| * This library is free software; you can redistribute it and/or * | | * Package: TMVA | |
| * modify it under the terms of the GNU General Public License * | | * | |
| * as published by the Free Software Foundation; either version 2 * | | * Class : RootFinder | |
| * of the License, or (at your option) any later version. * | | * | |
| * * | | * Web : http://tmva.sourceforge.net | |
| * This library is distributed in the hope that it will be useful, * | | * | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of * | | * | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | | * | |
| * General Public License for more details. * | | * Description: | |
| * * | | * | |
| * You should have received a copy of the GNU General Public License * | | * Root finding using Brents algorithm | |
| * along with this library (see file COPYING); if not, write * | | * | |
| * to the Free Software Foundation, Inc., 59 Temple Place, Suite * | | * (translated from CERNLIB function RZERO) | |
| * 330, Boston, MA 02111-1307 USA, or contact the author. * | | * | |
| * * | | * | |
| **********************************************************************/ | | * | |
| | | * Authors (alphabetical): | |
| // Header file for class RootFinder | | * | |
| // | | * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland | |
| // Created by: moneta at Sun Nov 14 16:59:55 2004 | | * | |
| // | | * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, German | |
| // Last update: Sun Nov 14 16:59:55 2004 | | y * | |
| // | | * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada | |
| #ifndef ROOT_Math_RootFinder | | * | |
| #define ROOT_Math_RootFinder | | * | |
| | | * | |
| | | * Copyright (c) 2005: | |
| | | * | |
| | | * CERN, Switzerland | |
| | | * | |
| | | * U. of Victoria, Canada | |
| | | * | |
| | | * MPI-K Heidelberg, 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_RootFinder | |
| | | #define ROOT_TMVA_RootFinder | |
| | | | |
| | | ////////////////////////////////////////////////////////////////////////// | |
| | | // // | |
| | | // RootFinder // | |
| | | // // | |
| | | // Root finding using Brents algorithm // | |
| | | // (translated from CERNLIB function RZERO) // | |
| | | // // | |
| | | ////////////////////////////////////////////////////////////////////////// | |
| | | | |
|
| #ifndef ROOT_Math_IFunctionfwd | | #ifndef ROOT_TObject | |
| #include "Math/IFunctionfwd.h" | | #include "TObject.h" | |
| #endif | | #endif | |
| | | | |
|
| #ifndef ROOT_Math_IRootFinderMethod | | namespace TMVA { | |
| #include "Math/IRootFinderMethod.h" | | | |
| #endif | | | |
| | | | |
|
| /** | | class MsgLogger; | |
| @defgroup RootFinders One-dimensional Root-Finding algorithms | | | |
| Various implementation esists in MathCore and MathMore | | | |
| The user interacts with a proxy class ROOT::Math::RootFinder which creat | | | |
| es behing | | | |
| the chosen algorithms which are implemented using the ROOT::Math::IRootF | | | |
| inderMethod interface | | | |
| | | | |
| @ingroup NumAlgo | | | |
| */ | | | |
| | | | |
| namespace ROOT { | | | |
| namespace Math { | | | |
| | | | |
| //_________________________________________________________________________ | | | |
| ____________ | | | |
| /** | | | |
| User Class to find the Root of one dimensional functions. | | | |
| The GSL Methods are implemented in MathMore and they are loaded au | | | |
| tomatically | | | |
| via the plug-in manager | | | |
| | | | |
| The possible types of Root-finding algorithms are: | | | |
| <ul> | | | |
| <li>Root Bracketing Algorithms which do not require function deriv | | | |
| atives | | | |
| <ol> | | | |
| <li>RootFinder::kBRENT (default method implemented in MathCore) | | | |
| <li>RootFinder::kGSL_BISECTION | | | |
| <li>RootFinder::kGSL_FALSE_POS | | | |
| <li>RootFinder::kGSL_BRENT | | | |
| </ol> | | | |
| <li>Root Finding Algorithms using Derivatives | | | |
| <ol> | | | |
| <li>RootFinder::kGSL_NEWTON | | | |
| <li>RootFinder::kGSL_SECANT | | | |
| <li>RootFinder::kGSL_STEFFENSON | | | |
| </ol> | | | |
| </ul> | | | |
| | | | |
| This class does not cupport copying | | | |
| | | | |
| @ingroup RootFinders | | | |
| | | | |
| */ | | | |
| | | | |
| class RootFinder { | | | |
| | | | |
| public: | | | |
| | | | |
| enum EType { kBRENT, // Methods | | | |
| from MathCore | | | |
| kGSL_BISECTION, kGSL_FALSE_POS, kGSL_BRENT, // GSL Nor | | | |
| mal | | | |
| kGSL_NEWTON, kGSL_SECANT, kGSL_STEFFENSON // GSL Der | | | |
| ivatives | | | |
| }; | | | |
| | | | |
| /** | | | |
| Construct a Root-Finder algorithm | | | |
| */ | | | |
| RootFinder(RootFinder::EType type = RootFinder::kBRENT); | | | |
| virtual ~RootFinder(); | | | |
| | | | |
| private: | | | |
| // usually copying is non trivial, so we make this unaccessible | | | |
| RootFinder(const RootFinder & ) {} | | | |
| RootFinder & operator = (const RootFinder & rhs) | | | |
| { | | | |
| if (this == &rhs) return *this; // time saving self-test | | | |
| return *this; | | | |
| } | | | |
| | | | |
| public: | | | |
| | | | |
| bool SetMethod(RootFinder::EType type = RootFinder::kBRENT); | | | |
| | | | |
| /** | | | |
| Provide to the solver the function and the initial search inter | | | |
| val [xlow, xup] | | | |
| for algorithms not using derivatives (bracketing algorithms) | | | |
| The templated function f must be of a type implementing the \a | | | |
| operator() method, | | | |
| <em> double operator() ( double x ) </em> | | | |
| Returns non zero if interval is not valid (i.e. does not contai | | | |
| ns a root) | | | |
| */ | | | |
| | | | |
| bool SetFunction( const IGenFunction & f, double xlow, double xup) | | | |
| { | | | |
| return fSolver->SetFunction( f, xlow, xup); | | | |
| } | | | |
| | | | |
| /** | | | |
| Provide to the solver the function and an initial estimate of t | | | |
| he root, | | | |
| for algorithms using derivatives. | | | |
| The templated function f must be of a type implementing the \a | | | |
| operator() | | | |
| and the \a Gradient() methods. | | | |
| <em> double operator() ( double x ) </em> | | | |
| Returns non zero if starting point is not valid | | | |
| */ | | | |
| | | | |
| bool SetFunction( const IGradFunction & f, double xstart) { | | | |
| return fSolver->SetFunction( f, xstart); | | | |
| } | | | |
| | | | |
| template<class Function, class Derivative> | | | |
| bool Solve(Function &f, Derivative &d, double start, | | | |
| int maxIter = 100, double absTol = 1E-8, double relTol = | | | |
| 1E-10); | | | |
| | | | |
| template<class Function> | | | |
| bool Solve(Function &f, double min, double max, | | | |
| int maxIter = 100, double absTol = 1E-8, double relTol = | | | |
| 1E-10); | | | |
| | | | |
| /** | | | |
| Compute the roots iterating until the estimate of the Root is | | | |
| within the required tolerance returning | | | |
| the iteration Status | | | |
| */ | | | |
| bool Solve( int maxIter = 100, double absTol = 1E-8, double relTol | | | |
| = 1E-10) { | | | |
| return fSolver->Solve( maxIter, absTol, relTol ); | | | |
| } | | | |
| | | | |
| /** | | | |
| Return the number of iteration performed to find the Root. | | | |
| */ | | | |
| int Iterations() const { | | | |
| return fSolver->Iterations(); | | | |
| } | | | |
| | | | |
| /** | | | |
| Perform a single iteration and return the Status | | | |
| */ | | | |
| int Iterate() { | | | |
| return fSolver->Iterate(); | | | |
| } | | | |
| | | | |
| /** | | | |
| Return the current and latest estimate of the Root | | | |
| */ | | | |
| double Root() const { | | | |
| return fSolver->Root(); | | | |
| } | | | |
| | | | |
| /** | | | |
| Return the status of the last estimate of the Root | | | |
| = 0 OK, not zero failure | | | |
| */ | | | |
| int Status() const { | | | |
| return fSolver->Status(); | | | |
| } | | | |
| | | | |
| /** | | | |
| Return the current and latest estimate of the lower value of th | | | |
| e Root-finding interval (for bracketing algorithms) | | | |
| */ | | | |
| /* double XLower() const { */ | | | |
| /* return fSolver->XLower(); */ | | | |
| /* } */ | | | |
| | | | |
| /** | | | |
| Return the current and latest estimate of the upper value of th | | | |
| e Root-finding interval (for bracketing algorithms) | | | |
| */ | | | |
| /* double XUpper() const { */ | | | |
| /* return fSolver->XUpper(); */ | | | |
| /* } */ | | | |
| | | | |
| /** | | | |
| Get Name of the Root-finding solver algorithm | | | |
| */ | | | |
| const char * Name() const { | | | |
| return fSolver->Name(); | | | |
| } | | | |
| | | | |
| protected: | | | |
| | | | |
| private: | | | |
| | | | |
| IRootFinderMethod* fSolver; // type of algorithm to be used | | | |
| | | | |
|
| }; | | class RootFinder : public TObject { | |
| | | | |
|
| } // namespace Math | | public: | |
| } // namespace ROOT | | | |
| | | | |
|
| #ifndef ROOT_Math_WrappedFunction | | RootFinder( Double_t (*rootVal)( Double_t ), | |
| #include "Math/WrappedFunction.h" | | Double_t rootMin, Double_t rootMax, | |
| #endif | | Int_t maxIterations = 100, | |
| | | Double_t absTolerance = 0.0 ); | |
| | | virtual ~RootFinder( void ); | |
| | | | |
|
| #ifndef ROOT_Math_Functor | | // returns the root of the function | |
| #include "Math/Functor.h" | | Double_t Root( Double_t refValue ); | |
| #endif | | | |
| | | private: | |
| | | | |
| | | Double_t fRootMin; // minimum root value | |
| | | Double_t fRootMax; // maximum root value | |
| | | Int_t fMaxIter; // maximum number of iterations | |
| | | Double_t fAbsTol; // absolute tolerance deviation | |
| | | | |
|
| template<class Function, class Derivative> | | // function pointer | |
| bool ROOT::Math::RootFinder::Solve(Function &f, Derivative &d, double start | | Double_t (*fGetRootVal)( Double_t ); | |
| , | | | |
| int maxIter, double absTol, double relTol | | | |
| ) | | | |
| { | | | |
| if (!fSolver) return false; | | | |
| ROOT::Math::GradFunctor1D wf(f, d); | | | |
| bool ret = fSolver->SetFunction(wf, start); | | | |
| if (!ret) return false; | | | |
| return Solve(maxIter, absTol, relTol); | | | |
| } | | | |
| | | | |
| template<class Function> | | | |
| bool ROOT::Math::RootFinder::Solve(Function &f, double min, double max, | | | |
| int maxIter, double absTol, double relTol | | | |
| ) | | | |
| { | | | |
| if (!fSolver) return false; | | | |
| ROOT::Math::WrappedFunction<Function &> wf(f); | | | |
| bool ret = fSolver->SetFunction(wf, min, max); | | | |
| if (!ret) return false; | | | |
| return Solve(maxIter, absTol, relTol); | | | |
| } | | | |
| | | | |
|
| #endif /* ROOT_Math_RootFinder */ | | mutable MsgLogger* fLogger; //! message logger | |
| | | MsgLogger& Log() const { return *fLogger; } | |
| | | | |
| | | ClassDef(RootFinder,0) // Root finding using Brents algorithm | |
| | | }; | |
| | | | |
| | | } // namespace TMVA | |
| | | | |
| | | #endif | |
| | | | |
End of changes. 11 change blocks. |
| 254 lines changed or deleted | | 84 lines changed or added | |
|
| TBufferFile.h | | TBufferFile.h | |
|
| // @(#)root/io:$Id$ | | // @(#)root/io:$Id: 697641b2b52ed3d97bb5bde0fb5d2ff4a2f6c24f $ | |
| // Author: Rene Brun 17/01/2007 | | // Author: Rene Brun 17/01/2007 | |
| | | | |
| /************************************************************************* | | /************************************************************************* | |
| * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * | | * Copyright (C) 1995-2007, 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 113 | | skipping to change at line 113 | |
| Bool_t CheckObject(const TObject *obj); | | Bool_t CheckObject(const TObject *obj); | |
| Bool_t CheckObject(const void *obj, const TClass *ptrClass); | | Bool_t CheckObject(const void *obj, const TClass *ptrClass); | |
| | | | |
| virtual Int_t GetVersionOwner() const; | | virtual Int_t GetVersionOwner() const; | |
| virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TC
lass *clss); | | virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TC
lass *clss); | |
| virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const ch
ar *classname); | | virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const ch
ar *classname); | |
| virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kF
ALSE); | | virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kF
ALSE); | |
| | | | |
| virtual void SkipVersion(const TClass *cl = 0); | | virtual void SkipVersion(const TClass *cl = 0); | |
| virtual Version_t ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0, cons
t TClass *cl = 0); | | virtual Version_t ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0, cons
t TClass *cl = 0); | |
|
| | | virtual Version_t ReadVersionNoCheckSum(UInt_t *start = 0, UInt_t *bcnt
= 0); | |
| virtual Version_t ReadVersionForMemberWise(const TClass *cl = 0); | | virtual Version_t ReadVersionForMemberWise(const TClass *cl = 0); | |
| virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALS
E); | | virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALS
E); | |
| virtual UInt_t WriteVersionMemberWise(const TClass *cl, Bool_t useBc
nt = kFALSE); | | virtual UInt_t WriteVersionMemberWise(const TClass *cl, Bool_t useBc
nt = kFALSE); | |
| | | | |
| virtual void *ReadObjectAny(const TClass* cast); | | virtual void *ReadObjectAny(const TClass* cast); | |
| virtual void SkipObjectAny(); | | virtual void SkipObjectAny(); | |
| | | | |
| virtual void TagStreamerInfo(TVirtualStreamerInfo* info); | | virtual void TagStreamerInfo(TVirtualStreamerInfo* info); | |
| virtual void IncrementLevel(TVirtualStreamerInfo* info); | | virtual void IncrementLevel(TVirtualStreamerInfo* info); | |
| virtual void SetStreamerElementNumber(Int_t) {} | | virtual void SetStreamerElementNumber(Int_t) {} | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 2 lines changed or added | |
|
| TGaxis.h | | TGaxis.h | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 61 | |
| Int_t fLabelFont; //Font for labels | | Int_t fLabelFont; //Font for labels | |
| TString fChopt; //Axis options | | TString fChopt; //Axis options | |
| TString fName; //axis name | | TString fName; //axis name | |
| TString fTitle; //axis title | | TString fTitle; //axis title | |
| TString fTimeFormat; //Time format, ex: 09/12/99 12:34:00 | | TString fTimeFormat; //Time format, ex: 09/12/99 12:34:00 | |
| TString fFunctionName; //name of mapping function pointed by f
Function | | TString fFunctionName; //name of mapping function pointed by f
Function | |
| TF1 *fFunction; //!Pointer to function computing axis v
alues | | TF1 *fFunction; //!Pointer to function computing axis v
alues | |
| TAxis *fAxis; //!pointer to original TAxis axis (if a
ny) | | TAxis *fAxis; //!pointer to original TAxis axis (if a
ny) | |
| | | | |
| static Int_t fgMaxDigits; //!Number of digits above which the 10>
N notation is used | | static Int_t fgMaxDigits; //!Number of digits above which the 10>
N notation is used | |
|
| | | static Float_t fXAxisExpXOffset; //!Exponent X offset for the X axis | |
| | | static Float_t fXAxisExpYOffset; //!Exponent Y offset for the X axis | |
| | | static Float_t fYAxisExpXOffset; //!Exponent X offset for the Y axis | |
| | | static Float_t fYAxisExpYOffset; //!Exponent Y offset for the Y axis | |
| | | | |
| TGaxis(const TGaxis&); | | TGaxis(const TGaxis&); | |
| TGaxis& operator=(const TGaxis&); | | TGaxis& operator=(const TGaxis&); | |
| | | | |
| public: | | public: | |
| | | | |
| TGaxis(); | | TGaxis(); | |
| TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax, | | TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax, | |
| Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="", | | Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="", | |
| Double_t gridlength = 0); | | Double_t gridlength = 0); | |
| | | | |
| skipping to change at line 131 | | skipping to change at line 135 | |
| void SetGridLength(Float_t gridlength) {fGridLength = gri
dlength;} | | void SetGridLength(Float_t gridlength) {fGridLength = gri
dlength;} | |
| void SetTimeFormat(const char *tformat); | | void SetTimeFormat(const char *tformat); | |
| void SetTimeOffset(Double_t toffset, Option_t *option="lo
cal"); | | void SetTimeOffset(Double_t toffset, Option_t *option="lo
cal"); | |
| virtual void SetTitle(const char *title=""); // *MENU* | | virtual void SetTitle(const char *title=""); // *MENU* | |
| void SetTitleOffset(Float_t titleoffset=1) {fTitleOffset
= titleoffset;} // *MENU* | | void SetTitleOffset(Float_t titleoffset=1) {fTitleOffset
= titleoffset;} // *MENU* | |
| void SetTitleSize(Float_t titlesize) {fTitleSize = titles
ize;} // *MENU* | | void SetTitleSize(Float_t titlesize) {fTitleSize = titles
ize;} // *MENU* | |
| void SetTitleFont(Int_t titlefont) {SetTextFont(titlefont
);} // *MENU* | | void SetTitleFont(Int_t titlefont) {SetTextFont(titlefont
);} // *MENU* | |
| void SetTitleColor(Int_t titlecolor) {SetTextColor(titlec
olor);} // *MENU* | | void SetTitleColor(Int_t titlecolor) {SetTextColor(titlec
olor);} // *MENU* | |
| void SetWmin(Double_t wmin) {fWmin = wmin;} | | void SetWmin(Double_t wmin) {fWmin = wmin;} | |
| void SetWmax(Double_t wmax) {fWmax = wmax;} | | void SetWmax(Double_t wmax) {fWmax = wmax;} | |
|
| | | static void SetExponentOffset(Float_t xoff=0., Float_t yoff=0.,
Option_t *axis="xy"); | |
| | | | |
| ClassDef(TGaxis,5) //Graphics axis | | ClassDef(TGaxis,5) //Graphics axis | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 5 lines changed or added | |
|
| TProofBench.h | | TProofBench.h | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 83 | |
| TNamed *fDescription; // Strings describing the cluster for this
test (saved in the output file) | | TNamed *fDescription; // Strings describing the cluster for this
test (saved in the output file) | |
| | | | |
| static TGraphErrors *GetGraph(TDirectory *d, const char *pfn, | | static TGraphErrors *GetGraph(TDirectory *d, const char *pfn, | |
| Int_t &nb, Double_t &xmi, Double_t &xmx, | | Int_t &nb, Double_t &xmi, Double_t &xmx, | |
| Double_t &ymi, Double_t &ymx, Int_t &kmx,
TProfile *&pf); | | Double_t &ymi, Double_t &ymx, Int_t &kmx,
TProfile *&pf); | |
| | | | |
| static TF1 *fgFp1; // Simple 1st degree polynomial | | static TF1 *fgFp1; // Simple 1st degree polynomial | |
| static TF1 *fgFp1n; // Normalized 1st degree | | static TF1 *fgFp1n; // Normalized 1st degree | |
| static TF1 *fgFp2; // Simple 2nd degree polynomial | | static TF1 *fgFp2; // Simple 2nd degree polynomial | |
| static TF1 *fgFp2n; // Normalized 2nd degree | | static TF1 *fgFp2n; // Normalized 2nd degree | |
|
| | | static TF1 *fgFp3; // Function with varying Rcpu | |
| | | static TF1 *fgFp3n; // Normalized Function with varying R | |
| | | cpu | |
| | | | |
| | | static TF1 *fgFio; // Function used for I/O rate fits | |
| | | static TF1 *fgFioV; // Function used for I/O rate fits wi | |
| | | th non-constant Rcpu | |
| | | | |
| static TList *fgGraphs; // List of TGraphErrors created by Draw a
ctions | | static TList *fgGraphs; // List of TGraphErrors created by Draw a
ctions | |
| | | | |
| static void AssertFittingFun(Double_t mi, Double_t mx); | | static void AssertFittingFun(Double_t mi, Double_t mx); | |
| | | | |
| public: | | public: | |
| | | | |
| TProofBench(const char *url, const char *outfile = "<default>", const ch
ar *proofopt = 0); | | TProofBench(const char *url, const char *outfile = "<default>", const ch
ar *proofopt = 0); | |
| | | | |
| virtual ~TProofBench(); | | virtual ~TProofBench(); | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 135 | |
| void SetDataPar(const char *par) { fDataPar = par; } | | void SetDataPar(const char *par) { fDataPar = par; } | |
| void SetDataGenSel(const char *sel) { fDataGenSel = sel; } | | void SetDataGenSel(const char *sel) { fDataGenSel = sel; } | |
| void SetDataGenPar(const char *par) { fDataGenPar = par; } | | void SetDataGenPar(const char *par) { fDataGenPar = par; } | |
| | | | |
| void SetProofDS(TProof *p); | | void SetProofDS(TProof *p); | |
| | | | |
| void SetDebug(Bool_t debug = kTRUE) { fDebug = debug; } | | void SetDebug(Bool_t debug = kTRUE) { fDebug = debug; } | |
| | | | |
| Bool_t GetDebug() { return fDebug; } | | Bool_t GetDebug() { return fDebug; } | |
| | | | |
|
| static void DrawCPU(const char *outfile, const char *opt = "std:", Bool_ | | static void DrawCPU(const char *outfile, const char *opt = "std:", Bool_ | |
| t verbose = kFALSE, Int_t dofit = 0); | | t verbose = kFALSE, | |
| static void DrawDataSet(const char *outfile, const char *opt = "std:", c | | Int_t dofit = 0, Int_t n0 = -1, Int_t n1 = -1); | |
| onst char *type = "mbs", Bool_t verbose = kFALSE); | | static void DrawDataSet(const char *outfile, const char *opt = "std:", c | |
| | | onst char *type = "mbs", Bool_t verbose = kFALSE, | |
| | | Int_t dofit = 0, Int_t n0 = -1, Int_t n1 = -1); | |
| static void GetPerfSpecs(const char *path = ".", Int_t degfit = 1); | | static void GetPerfSpecs(const char *path = ".", Int_t degfit = 1); | |
| static void DrawEfficiency(const char *outfile, const char *opt = "", Bo
ol_t verbose = kFALSE); | | static void DrawEfficiency(const char *outfile, const char *opt = "", Bo
ol_t verbose = kFALSE); | |
| | | | |
| static TList *GetGraphs() { return fgGraphs; } | | static TList *GetGraphs() { return fgGraphs; } | |
| | | | |
| ClassDef(TProofBench, 0) // Steering class for PROOF benchmarks | | ClassDef(TProofBench, 0) // Steering class for PROOF benchmarks | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 4 lines changed or deleted | | 13 lines changed or added | |
|
| TSelectorList.h | | TSelectorList.h | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| * For the list of contributors see $ROOTSYS/README/CREDITS. * | | * For the list of contributors see $ROOTSYS/README/CREDITS. * | |
| *************************************************************************/ | | *************************************************************************/ | |
| | | | |
| #ifndef ROOT_TSelectorList | | #ifndef ROOT_TSelectorList | |
| #define ROOT_TSelectorList | | #define ROOT_TSelectorList | |
| | | | |
| ////////////////////////////////////////////////////////////////////////// | | ////////////////////////////////////////////////////////////////////////// | |
| // // | | // // | |
| // TSelectorList // | | // TSelectorList // | |
| // // | | // // | |
|
| // A TList derived class that makes sure that objects added to it // | | // A THashList derived class that makes sure that objects added to it // | |
| // are not linked to the currently open file (like histograms, // | | // are not linked to the currently open file (like histograms, // | |
| // eventlists and trees). Also it makes sure the name of the added // | | // eventlists and trees). Also it makes sure the name of the added // | |
| // object is unique. This class is used in the TSelector for the // | | // object is unique. This class is used in the TSelector for the // | |
| // output list. // | | // output list. // | |
| // // | | // // | |
| ////////////////////////////////////////////////////////////////////////// | | ////////////////////////////////////////////////////////////////////////// | |
| | | | |
|
| #ifndef ROOT_TList | | #ifndef ROOT_THashList | |
| #include "TList.h" | | #include "THashList.h" | |
| #endif | | #endif | |
| | | | |
|
| class TSelectorList : public TList { | | class TSelectorList : public THashList { | |
| | | | |
| private: | | private: | |
| Bool_t UnsetDirectory(TObject *obj); | | Bool_t UnsetDirectory(TObject *obj); | |
| Bool_t CheckDuplicateName(TObject *obj); | | Bool_t CheckDuplicateName(TObject *obj); | |
| | | | |
| public: | | public: | |
|
| TSelectorList() : TList() { SetOwner(); } | | TSelectorList() : THashList() { SetOwner(); } | |
| | | | |
| void AddFirst(TObject *obj); | | void AddFirst(TObject *obj); | |
| void AddFirst(TObject *obj, Option_t *opt); | | void AddFirst(TObject *obj, Option_t *opt); | |
| void AddLast(TObject *obj); | | void AddLast(TObject *obj); | |
| void AddLast(TObject *obj, Option_t *opt); | | void AddLast(TObject *obj, Option_t *opt); | |
| void AddAt(TObject *obj, Int_t idx); | | void AddAt(TObject *obj, Int_t idx); | |
| void AddAfter(const TObject *after, TObject *obj); | | void AddAfter(const TObject *after, TObject *obj); | |
| void AddAfter(TObjLink *after, TObject *obj); | | void AddAfter(TObjLink *after, TObject *obj); | |
| void AddBefore(const TObject *before, TObject *obj); | | void AddBefore(const TObject *before, TObject *obj); | |
| void AddBefore(TObjLink *before, TObject *obj); | | void AddBefore(TObjLink *before, TObject *obj); | |
| | | | |
End of changes. 4 change blocks. |
| 5 lines changed or deleted | | 5 lines changed or added | |
|