Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:59

0001 // @(#)root/tmva $Id$
0002 // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss
0003 
0004 /**********************************************************************************
0005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0006  * Package: TMVA                                                                  *
0007  * Class  : FitterBase                                                            *
0008  *                                             *
0009  *                                                                                *
0010  * Description:                                                                   *
0011  *      Base class for TMVA fitters                                               *
0012  *                                                                                *
0013  * Authors (alphabetical):                                                        *
0014  *      Andreas Hoecker  <Andreas.Hocker@cern.ch> - CERN, Switzerland             *
0015  *      Peter Speckmayer <speckmay@mail.cern.ch>  - CERN, Switzerland             *
0016  *      Joerg Stelzer    <Joerg.Stelzer@cern.ch>  - CERN, Switzerland             *
0017  *      Helge Voss       <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany     *
0018  *                                                                                *
0019  * Copyright (c) 2005:                                                            *
0020  *      CERN, Switzerland                                                         *
0021  *      MPI-K Heidelberg, Germany                                                 *
0022  *                                                                                *
0023  * Redistribution and use in source and binary forms, with or without             *
0024  * modification, are permitted according to the terms listed in LICENSE           *
0025  * (see tmva/doc/LICENSE)                                          *
0026  **********************************************************************************/
0027 
0028 #ifndef ROOT_TMVA_FitterBase
0029 #define ROOT_TMVA_FitterBase
0030 
0031 //////////////////////////////////////////////////////////////////////////
0032 //                                                                      //
0033 // FitterBase                                                           //
0034 //                                                                      //
0035 // Baseclass for TMVA fitters                                           //
0036 //                                                                      //
0037 //////////////////////////////////////////////////////////////////////////
0038 
0039 #include<vector>
0040 #include "TObject.h"
0041 #include "TString.h"
0042 
0043 #include "TMVA/Configurable.h"
0044 
0045 namespace TMVA {
0046 
0047    class Interval;
0048    class IFitterTarget;
0049    class MsgLogger;
0050 
0051    class FitterBase : public Configurable {
0052 
0053    public:
0054 
0055       FitterBase( IFitterTarget& target, const TString& name, const std::vector<TMVA::Interval*> ranges,
0056                   const TString& theOption );
0057 
0058       virtual ~FitterBase() {}
0059 
0060       Double_t Run();
0061       virtual Double_t Run( std::vector<Double_t>& pars ) = 0;
0062 
0063       Double_t       EstimatorFunction( std::vector<Double_t>& parameters );
0064       IFitterTarget& GetFitterTarget() const { return fFitterTarget; }
0065 
0066       // accessor
0067       Int_t GetNpars() const { return fNpars; }
0068 
0069       // remove namespace in name
0070       const char* GetName() const { return fClassName; }
0071 
0072       // setting up variables for JsMVA interactive training
0073       void SetIPythonInteractive(bool* ExitFromTraining, UInt_t *fIPyMaxIter_, UInt_t *fIPyCurrentIter_){
0074         fExitFromTraining = ExitFromTraining;
0075         fIPyMaxIter = fIPyMaxIter_;
0076         fIPyCurrentIter = fIPyCurrentIter_;
0077       }
0078 
0079    protected:
0080 
0081       // need to implement option declaration
0082       virtual void DeclareOptions() = 0;
0083 
0084       IFitterTarget&                      fFitterTarget; // pointer to target of fitting procedure
0085       const std::vector<TMVA::Interval*>  fRanges;       // allowed intervals
0086       Int_t                               fNpars;        // number of parameters
0087 
0088       mutable MsgLogger*                  fLogger;       //! message logger
0089       MsgLogger& Log() const { return *fLogger; }
0090 
0091       TString                             fClassName;    // remove TMVA:: from TObject name
0092 
0093       // variables needed by JsMVA
0094       UInt_t *fIPyCurrentIter = nullptr, *fIPyMaxIter = nullptr;
0095       bool* fExitFromTraining = nullptr;
0096 
0097       ClassDef(FitterBase,0); // Baseclass for fitters
0098    };
0099 
0100 } // namespace TMVA
0101 
0102 #endif