00001 // @(#)root/tmva $Id: FitterBase.cxx 33928 2010-06-15 16:19:31Z stelzer $ 00002 // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss 00003 00004 /********************************************************************************** 00005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00006 * Package: TMVA * 00007 * Class : FitterBase * 00008 * Web : http://tmva.sourceforge.net * 00009 * * 00010 * Description: * 00011 * Implementation * 00012 * * 00013 * Authors (alphabetical): * 00014 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland * 00015 * Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland * 00016 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland * 00017 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 00018 * * 00019 * Copyright (c) 2005: * 00020 * CERN, Switzerland * 00021 * MPI-K Heidelberg, Germany * 00022 * * 00023 * Redistribution and use in source and binary forms, with or without * 00024 * modification, are permitted according to the terms listed in LICENSE * 00025 * (http://tmva.sourceforge.net/LICENSE) * 00026 **********************************************************************************/ 00027 00028 //______________________________________________________________________ 00029 /* 00030 FitterBase 00031 00032 Baseclass for TMVA fitters. Also defines generalised fitting interface 00033 */ 00034 //_______________________________________________________________________ 00035 00036 #include "TMVA/FitterBase.h" 00037 #ifndef ROOT_TMVA_Interval 00038 #include "TMVA/Interval.h" 00039 #endif 00040 #ifndef ROOT_TMVA_IFitterTarget 00041 #include "TMVA/IFitterTarget.h" 00042 #endif 00043 00044 ClassImp(TMVA::FitterBase) 00045 00046 #ifdef _WIN32 00047 /*Disable warning C4355: 'this' : used in base member initializer list*/ 00048 #pragma warning ( disable : 4355 ) 00049 #endif 00050 00051 //_______________________________________________________________________ 00052 TMVA::FitterBase::FitterBase( IFitterTarget& target, 00053 const TString& name, 00054 const std::vector<Interval*> ranges, 00055 const TString& theOption ) 00056 : Configurable( theOption ), 00057 fFitterTarget( target ), 00058 fRanges( ranges ), 00059 fNpars( ranges.size() ), 00060 fLogger( new MsgLogger("FitterBase", kINFO) ), 00061 fClassName( name ) 00062 { 00063 // constructor 00064 SetConfigName( GetName() ); 00065 SetConfigDescription( "Configuration options for setup and tuning of specific fitter" ); 00066 } 00067 00068 //_______________________________________________________________________ 00069 Double_t TMVA::FitterBase::Run() 00070 { 00071 // estimator function interface for fitting 00072 std::vector<Double_t> pars; 00073 for (std::vector<Interval*>::const_iterator parIt = fRanges.begin(); parIt != fRanges.end(); parIt++) { 00074 pars.push_back( (*parIt)->GetMean() ); 00075 } 00076 00077 // delete fLogger; 00078 return this->Run( pars ); 00079 } 00080 00081 //_______________________________________________________________________ 00082 Double_t TMVA::FitterBase::EstimatorFunction( std::vector<Double_t>& parameters ) 00083 { 00084 // estimator function interface for fitting 00085 return GetFitterTarget().EstimatorFunction( parameters ); 00086 } 00087