Changeset 8698 for trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.cc
- Timestamp:
- 08/23/07 11:26:38 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.cc
r8643 r8698 43 43 #include "MJTrainRanForest.h" 44 44 45 #include <TFile.h>46 47 #include "MLog.h"48 #include "MLogManip.h"49 50 #include "MFDataPhrase.h"51 #include "MParameterCalc.h"52 53 #include "MStatusDisplay.h"54 55 45 ClassImp(MJTrainRanForest); 56 46 57 47 using namespace std; 58 /*59 //------------------------------------------------------------------------60 //61 // Add a cut which is used to fill the matrix, eg "MMcEvt.fPartId<1.5"62 // (The rule is applied, not inverted: The matrix is filled with63 // the events fullfilling the condition)64 //65 void MJTrainRanForest::AddCut(TList &l, const char *rule)66 {67 MFilter *f = new MFDataPhrase(rule);68 f->SetBit(kCanDelete); //FIXME!!!! Why does not any other list delete it???69 Add(l, f);70 }71 72 //------------------------------------------------------------------------73 //74 // Add an additional parameter (MParameterCalc), eg "0.5", "MWeight"75 // The default container name is "MWeight"76 //77 void MJTrainRanForest::AddPar(TList &l, const char *rule, const char *pname)78 {79 TString tname(pname);80 tname += "Calc";81 82 MParameterCalc *par = new MParameterCalc(rule, tname);83 par->SetNameParameter(pname);84 // par->SetBit(kCanDelete); //FIXME!!!! MTaskList is deleting it85 Add(l, par);86 }87 88 //------------------------------------------------------------------------89 //90 // Add a task/cut which is used to fill the matrix. If kCanDelete is set91 // MJOptimize takes the ownership.92 //93 void MJTrainRanForest::Add(TList &l, MTask *f)94 {95 l.Add(f);96 }97 98 //------------------------------------------------------------------------99 //100 // Add a parameter used in your filters (see AddFilter) The parameter101 // index is returned,102 //103 // Int_t idx = AddParameter("log10(MHillas.fSize)");104 //105 // The indices are starting with 0 always.106 //107 Int_t MJTrainRanForest::AddParameter(const char *rule)108 {109 fRules.Add(new TNamed(rule, ""));110 return fRules.GetSize()-1;111 }112 113 Bool_t MJTrainRanForest::WriteDisplay(const char *fname) const114 {115 TFile file(fname, "UPDATE");116 if (!file.IsOpen())117 {118 *fLog << err << "ERROR - Couldn't open file " << fname << " for writing." << endl;119 return kFALSE;120 }121 122 *fLog << inf << "Wrinting to " << fname << ":" << endl;123 *fLog << " - MStatusDisplay..." << flush;124 if (fDisplay && fDisplay->Write()<=0)125 {126 *fLog << err << "Unable to write MStatusDisplay to " << fname << endl;127 return kFALSE;128 }129 *fLog << inf << "ok." << endl;130 131 return kTRUE;132 }133 */
Note:
See TracChangeset
for help on using the changeset viewer.