Ignore:
Timestamp:
08/24/07 09:37:31 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mranforest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mranforest/MRanForestCalc.cc

    r8698 r8704  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MRanForestCalc.cc,v 1.28 2007-08-23 10:25:08 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MRanForestCalc.cc,v 1.29 2007-08-24 08:33:48 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    6363const TString MRanForestCalc::gsDefTitle   = "RF for energy estimation";
    6464
    65 const TString MRanForestCalc::gsNameOutput = "RanForestOut";
     65const TString MRanForestCalc::gsNameOutput   = "RanForestOut";
     66const TString MRanForestCalc::gsNameEvalFunc = "EvalFunction";
    6667
    6768MRanForestCalc::MRanForestCalc(const char *name, const char *title)
    68     : fData(0), fRFOut(0), fTestMatrix(0), fFunc("Function", "x"),
     69    : fData(0), fRFOut(0), fTestMatrix(0), fFunc("x"),
    6970    fNumTrees(-1), fNumTry(-1), fNdSize(-1), fNumObsoleteVariables(1),
    7071    fLastDataColumnHasWeights(kFALSE),
     
    7374    fName  = name  ? name  : gsDefName.Data();
    7475    fTitle = title ? title : gsDefTitle.Data();
    75 
    76     gROOT->GetListOfFunctions()->Remove(&fFunc);
    7776
    7877    // FIXME:
     
    9392Bool_t MRanForestCalc::SetFunction(const char *func)
    9493{
    95     return !fFunc.Compile(func);
     94    return !fFunc.SetRule(func);
    9695}
    9796
     
    267266    usedrules.Write("rules");
    268267
     268    fFunc.Write(gsNameEvalFunc);
     269
    269270    return kTRUE;
    270271}
     
    302303    }
    303304
    304     if (fileRF.GetListOfKeys()->FindObject("Function"))
    305         fFunc.Read("Function");
     305    if (fileRF.GetListOfKeys()->FindObject(gsNameEvalFunc))
     306    {
     307        if (fFunc.Read(gsNameEvalFunc)<=0)
     308        {
     309            *fLog << err << "ERROR - Reading '" << gsNameEvalFunc << "' from file " << fFileName << endl;
     310            return kFALSE;
     311        }
     312
     313        *fLog << inf << "Evaluation function found in file: " << fFunc.GetRule() << endl;
     314    }
    306315
    307316    return kTRUE;
     
    325334
    326335    *fLog << inf << "RF read from " << fFileName << endl;
     336
     337    if (!fFunc.PreProcess(plist))
     338    {
     339        *fLog << err << "PreProcessing of evaluation function failed... aborting." << endl;
     340        return kFALSE;
     341    }
    327342
    328343    if (fTestMatrix)
  • trunk/MagicSoft/Mars/mranforest/MRanForestCalc.h

    r8698 r8704  
    1414#endif
    1515
    16 #ifndef ROOT_TF1
    17 #include <TF1.h>
     16#ifndef ROOT_MDataPhrase
     17#include "MDataPhrase.h"
    1818#endif
    1919
     
    3333
    3434private:
    35     static const TString gsDefName;     //! Default Name
    36     static const TString gsDefTitle;    //! Default Title
    37     static const TString gsNameOutput;  //! Default Output name
     35    static const TString gsDefName;      //! Default Name
     36    static const TString gsDefTitle;     //! Default Title
     37    static const TString gsNameOutput;   //! Default Output name
     38    static const TString gsNameEvalFunc; //! Evaluation function name
    3839
    3940    MDataArray  *fData;                 //! Used to store the MDataChains to get the event values
    4041    MParameterD *fRFOut;                //! Used to store result
    4142    MHMatrix    *fTestMatrix;           //! Test Matrix used in Process (together with MMatrixLoop)
    42     TF1          fFunc;                 //! Function to apply to the result
     43    MDataPhrase  fFunc;                 //! Function to apply to the result
    4344
    4445    TObjArray    fEForests;             //! List of forests read or to be written
Note: See TracChangeset for help on using the changeset viewer.