00001 // @(#)root/tmva $Id: RootFinder.h 29195 2009-06-24 10:39:49Z brun $ 00002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss 00003 00004 /********************************************************************************** 00005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00006 * Package: TMVA * 00007 * Class : RootFinder * 00008 * Web : http://tmva.sourceforge.net * 00009 * * 00010 * Description: * 00011 * Root finding using Brents algorithm * 00012 * (translated from CERNLIB function RZERO) * 00013 * * 00014 * Authors (alphabetical): * 00015 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland * 00016 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 00017 * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada * 00018 * * 00019 * Copyright (c) 2005: * 00020 * CERN, Switzerland * 00021 * U. of Victoria, Canada * 00022 * MPI-K Heidelberg, Germany * 00023 * * 00024 * Redistribution and use in source and binary forms, with or without * 00025 * modification, are permitted according to the terms listed in LICENSE * 00026 * (http://tmva.sourceforge.net/LICENSE) * 00027 **********************************************************************************/ 00028 00029 #ifndef ROOT_TMVA_RootFinder 00030 #define ROOT_TMVA_RootFinder 00031 00032 ////////////////////////////////////////////////////////////////////////// 00033 // // 00034 // RootFinder // 00035 // // 00036 // Root finding using Brents algorithm // 00037 // (translated from CERNLIB function RZERO) // 00038 // // 00039 ////////////////////////////////////////////////////////////////////////// 00040 00041 #ifndef ROOT_TObject 00042 #include "TObject.h" 00043 #endif 00044 00045 namespace TMVA { 00046 00047 class MsgLogger; 00048 00049 class RootFinder : public TObject { 00050 00051 public: 00052 00053 RootFinder( Double_t (*rootVal)( Double_t ), 00054 Double_t rootMin, Double_t rootMax, 00055 Int_t maxIterations = 100, 00056 Double_t absTolerance = 0.0 ); 00057 virtual ~RootFinder( void ); 00058 00059 // returns the root of the function 00060 Double_t Root( Double_t refValue ); 00061 00062 private: 00063 00064 Double_t fRootMin; // minimum root value 00065 Double_t fRootMax; // maximum root value 00066 Int_t fMaxIter; // maximum number of iterations 00067 Double_t fAbsTol; // absolute tolerance deviation 00068 00069 // function pointer 00070 Double_t (*fGetRootVal)( Double_t ); 00071 00072 mutable MsgLogger* fLogger; //! message logger 00073 MsgLogger& Log() const { return *fLogger; } 00074 00075 ClassDef(RootFinder,0) // Root finding using Brents algorithm 00076 }; 00077 00078 } // namespace TMVA 00079 00080 #endif