Ignore:
Timestamp:
05/05/06 10:53:03 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjtrain
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.cc

    r7421 r7697  
    3535#include "MLogManip.h"
    3636
     37#include "MF.h"
     38#include "MParameterCalc.h"
     39
    3740#include "MStatusDisplay.h"
    38 
    39 #include "MF.h"
    4041
    4142ClassImp(MJTrainRanForest);
     
    4546//------------------------------------------------------------------------
    4647//
    47 // Add a cut which is used to fill the matrix, eg "MMcEvt.fOartId<1.5"
    48 // (The rule is applied, nit inverted: The matrix is filled with
     48// Add a cut which is used to fill the matrix, eg "MMcEvt.fPartId<1.5"
     49// (The rule is applied, not inverted: The matrix is filled with
    4950// the events fullfilling the condition)
    5051//
     
    5253{
    5354    MFilter *f = new MF(rule);
    54     f->SetBit(kCanDelete);
    55     AddCut(l, f);
     55    f->SetBit(kCanDelete); //FIXME!!!! Why does not any other list delete it???
     56    Add(l, f);
    5657}
    5758
    5859//------------------------------------------------------------------------
    5960//
    60 // Add a cut which is used to fill the matrix. If kCanDelete is set
     61// Add an additional parameter (MParameterCalc), eg "0.5", "MWeight"
     62// The default container name is "MWeight"
     63//
     64void MJTrainRanForest::AddPar(TList &l, const char *rule, const char *pname)
     65{
     66    TString tname(pname);
     67    tname += "Calc";
     68
     69    MParameterCalc *par = new MParameterCalc(rule, tname);
     70    par->SetNameParameter(pname);
     71//    par->SetBit(kCanDelete);  //FIXME!!!! MTaskList is deleting it
     72    Add(l, par);
     73}
     74
     75//------------------------------------------------------------------------
     76//
     77// Add a task/cut which is used to fill the matrix. If kCanDelete is set
    6178// MJOptimize takes the ownership.
    6279//
    63 void MJTrainRanForest::AddCut(TList &l, MFilter *f)
     80void MJTrainRanForest::Add(TList &l, MTask *f)
    6481{
    6582    l.Add(f);
  • trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.h

    r7552 r7697  
    66#endif
    77
     8class MTask;
    89class MFilter;
    910
     
    1213protected:
    1314    Bool_t fDebug;
     15    Bool_t fEnableWeights;
    1416
    1517    TList fRules;
     
    1820    TList fTrainCuts;
    1921    TList fTestCuts;
     22    TList fPreTasks;
     23    TList fPostTasks;
    2024
    2125    UShort_t fNumTrees;
     
    2630
    2731    void AddCut(TList &l, const char *rule);
    28     void AddCut(TList &l, MFilter *f);
     32    void AddPar(TList &l, const char *rule, const char *name);
     33    void Add(TList &l, MTask *f);
    2934
    3035public:
    31     MJTrainRanForest() : fDebug(kFALSE)
     36    MJTrainRanForest() : fDebug(kFALSE), fEnableWeights(kFALSE)
    3237    {
    3338        fNumTrees = 100; //100
     
    3641    }
    3742
    38     void SetDebug(Bool_t b=kTRUE) { fDebug = b; }
     43    void AddPreTask(MTask *t)                    { Add(fPreTasks,  t); }
     44    void AddPreTask(const char *rule,
     45                    const char *name="MWeight")  { AddPar(fPreTasks, rule, name); }
     46
     47    void AddPostTask(MTask *t)                   { Add(fPostTasks, t); }
     48    void AddPostTask(const char *rule,
     49                     const char *name="MWeight") { AddPar(fPostTasks, rule, name); }
     50
     51    void SetDebug(Bool_t b=kTRUE)      { fDebug = b; }
     52
     53    void SetWeights(const char *rule)  { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(rule); }
     54    void SetWeights(MTask *t)          { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(t);    }
    3955
    4056    void AddPreCut(const char *rule)   { AddCut(fPreCuts, rule); }
    41     void AddPreCut(MFilter *f)         { AddCut(fPreCuts, f); }
     57    void AddPreCut(MFilter *f)         { Add(fPreCuts, (MTask*)(f)); }
    4258
    4359    void AddTrainCut(const char *rule) { AddCut(fTrainCuts, rule); }
    44     void AddTrainCut(MFilter *f)       { AddCut(fTrainCuts, f); }
     60    void AddTrainCut(MFilter *f)       { Add(fTrainCuts, (MTask*)(f)); }
    4561
    4662    void AddTestCut(const char *rule)  { AddCut(fTestCuts, rule); }
    47     void AddTestCut(MFilter *f)        { AddCut(fTestCuts, f); }
     63    void AddTestCut(MFilter *f)        { Add(fTestCuts, (MTask*)(f)); }
    4864
    49     void SetNumTrees(UShort_t n=100) { fNumTrees = n; }
    50     void SetNdSize(UShort_t n=5)     { fNdSize   = n; }
    51     void SetNumTry(UShort_t n=0)     { fNumTry   = n; }
     65    void SetNumTrees(UShort_t n=100)   { fNumTrees = n; }
     66    void SetNdSize(UShort_t n=5)       { fNdSize   = n; }
     67    void SetNumTry(UShort_t n=0)       { fNumTry   = n; }
    5268
    5369    Int_t AddParameter(const char *rule);
Note: See TracChangeset for help on using the changeset viewer.