Logo ROOT   6.14/05
Reference Guide
FitterBase.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : FitterBase *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Implementation *
12  * *
13  * Authors (alphabetical): *
14  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15  * Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland *
16  * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
17  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
18  * *
19  * Copyright (c) 2005: *
20  * CERN, Switzerland *
21  * MPI-K Heidelberg, Germany *
22  * *
23  * Redistribution and use in source and binary forms, with or without *
24  * modification, are permitted according to the terms listed in LICENSE *
25  * (http://tmva.sourceforge.net/LICENSE) *
26  **********************************************************************************/
27 
28 /*! \class TMVA::FitterBase
29 \ingroup TMVA
30 
31 Base class for TMVA fitters. Also defines generalised fitting interface
32 
33 */
34 
35 #include "TMVA/FitterBase.h"
36 #include "TMVA/Interval.h"
37 #include "TMVA/IFitterTarget.h"
38 
39 #include "TMVA/Configurable.h"
40 #include "TMVA/MsgLogger.h"
41 #include "TMVA/Types.h"
42 
43 #include "Rtypes.h"
44 #include "TString.h"
45 
47 
48 #ifdef _WIN32
49 /*Disable warning C4355: 'this' : used in base member initializer list*/
50 #pragma warning ( disable : 4355 )
51 #endif
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// constructor
55 
57  const TString& name,
58  const std::vector<Interval*> ranges,
59  const TString& theOption )
60 : Configurable( theOption ),
61  fFitterTarget( target ),
62  fRanges( ranges ),
63  fNpars( ranges.size() ),
64  fLogger( new MsgLogger("FitterBase", kINFO) ),
65  fClassName( name )
66 {
68  SetConfigDescription( "Configuration options for setup and tuning of specific fitter" );
69 }
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// estimator function interface for fitting
73 
75 {
76  std::vector<Double_t> pars;
77  for (std::vector<Interval*>::const_iterator parIt = fRanges.begin(); parIt != fRanges.end(); ++parIt) {
78  pars.push_back( (*parIt)->GetMean() );
79  }
80 
81  // delete fLogger;
82  return this->Run( pars );
83 }
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// estimator function interface for fitting
87 
88 Double_t TMVA::FitterBase::EstimatorFunction( std::vector<Double_t>& parameters )
89 {
90  return GetFitterTarget().EstimatorFunction( parameters );
91 }
92 
const std::vector< TMVA::Interval * > fRanges
Definition: FitterBase.h:85
virtual Double_t EstimatorFunction(std::vector< Double_t > &parameters)=0
Base class for TMVA fitters.
Definition: FitterBase.h:51
Basic string class.
Definition: TString.h:131
IFitterTarget & GetFitterTarget() const
Definition: FitterBase.h:64
Double_t Run()
estimator function interface for fitting
Definition: FitterBase.cxx:74
FitterBase(IFitterTarget &target, const TString &name, const std::vector< TMVA::Interval *> ranges, const TString &theOption)
constructor
Definition: FitterBase.cxx:56
Double_t EstimatorFunction(std::vector< Double_t > &parameters)
estimator function interface for fitting
Definition: FitterBase.cxx:88
#define ClassImp(name)
Definition: Rtypes.h:359
double Double_t
Definition: RtypesCore.h:55
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
void SetConfigName(const char *n)
Definition: Configurable.h:63
const char * GetName() const
Returns name of object.
Definition: FitterBase.h:70
Interface for a fitter &#39;target&#39;.
Definition: IFitterTarget.h:44
char name[80]
Definition: TGX11.cxx:109
void SetConfigDescription(const char *d)
Definition: Configurable.h:64