ROOT logo
// @(#)root/tmva $Id: RootFinder.h 29195 2009-06-24 10:39:49Z brun $    
// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss 

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : RootFinder                                                            *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Root finding using Brents algorithm                                       *
 *      (translated from CERNLIB function RZERO)                                  *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
 *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
 *      Kai Voss        <Kai.Voss@cern.ch>       - U. of Victoria, Canada         *
 *                                                                                *
 * 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_TObject
#include "TObject.h"
#endif

namespace TMVA {

   class MsgLogger;

   class RootFinder : public TObject {

   public:

      RootFinder( Double_t (*rootVal)( Double_t ),
                  Double_t rootMin, Double_t rootMax,
                  Int_t    maxIterations = 100, 
                  Double_t absTolerance  = 0.0 );
      virtual ~RootFinder( void );
      
      // returns the root of the function
      Double_t Root( Double_t refValue );

   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

      // function pointer
      Double_t (*fGetRootVal)( Double_t );

      mutable MsgLogger* fLogger;   //! message logger
      MsgLogger& Log() const { return *fLogger; }                       

      ClassDef(RootFinder,0) // Root finding using Brents algorithm
   };

} // namespace TMVA

#endif
 RootFinder.h:1
 RootFinder.h:2
 RootFinder.h:3
 RootFinder.h:4
 RootFinder.h:5
 RootFinder.h:6
 RootFinder.h:7
 RootFinder.h:8
 RootFinder.h:9
 RootFinder.h:10
 RootFinder.h:11
 RootFinder.h:12
 RootFinder.h:13
 RootFinder.h:14
 RootFinder.h:15
 RootFinder.h:16
 RootFinder.h:17
 RootFinder.h:18
 RootFinder.h:19
 RootFinder.h:20
 RootFinder.h:21
 RootFinder.h:22
 RootFinder.h:23
 RootFinder.h:24
 RootFinder.h:25
 RootFinder.h:26
 RootFinder.h:27
 RootFinder.h:28
 RootFinder.h:29
 RootFinder.h:30
 RootFinder.h:31
 RootFinder.h:32
 RootFinder.h:33
 RootFinder.h:34
 RootFinder.h:35
 RootFinder.h:36
 RootFinder.h:37
 RootFinder.h:38
 RootFinder.h:39
 RootFinder.h:40
 RootFinder.h:41
 RootFinder.h:42
 RootFinder.h:43
 RootFinder.h:44
 RootFinder.h:45
 RootFinder.h:46
 RootFinder.h:47
 RootFinder.h:48
 RootFinder.h:49
 RootFinder.h:50
 RootFinder.h:51
 RootFinder.h:52
 RootFinder.h:53
 RootFinder.h:54
 RootFinder.h:55
 RootFinder.h:56
 RootFinder.h:57
 RootFinder.h:58
 RootFinder.h:59
 RootFinder.h:60
 RootFinder.h:61
 RootFinder.h:62
 RootFinder.h:63
 RootFinder.h:64
 RootFinder.h:65
 RootFinder.h:66
 RootFinder.h:67
 RootFinder.h:68
 RootFinder.h:69
 RootFinder.h:70
 RootFinder.h:71
 RootFinder.h:72
 RootFinder.h:73
 RootFinder.h:74
 RootFinder.h:75
 RootFinder.h:76
 RootFinder.h:77
 RootFinder.h:78
 RootFinder.h:79
 RootFinder.h:80