Changeset 5690 for trunk/MagicSoft/Mars/mranforest
- Timestamp:
- 12/27/04 13:13:32 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mranforest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mranforest/MRanForestCalc.cc
r3238 r5690 72 72 // 73 73 MRanForestCalc::MRanForestCalc(const char *name, const char *title) 74 : fNum(100), fHadronnessName("MHadronness"), fData(NULL) 74 : fNum(100), fHadronnessName("MHadronness"), fData(NULL), fRanForest(0), fRanTree(0) 75 75 { 76 76 // … … 87 87 MRanForestCalc::~MRanForestCalc() 88 88 { 89 // delete fData; 89 if (!IsOwner()) 90 return; 91 92 delete fRanForest; 93 delete fRanTree; 90 94 } 91 95 … … 103 107 Int_t MRanForestCalc::PreProcess(MParList *plist) 104 108 { 105 fRanForest = (MRanForest*)plist->FindObject("MRanForest");106 109 if (!fRanForest) 107 110 { 108 *fLog << err << dbginf << "MRanForest not found... aborting." << endl; 109 return kFALSE; 110 } 111 112 fRanTree = (MRanTree*)plist->FindObject("MRanTree"); 111 fRanForest = (MRanForest*)plist->FindObject("MRanForest"); 112 if (!fRanForest) 113 { 114 *fLog << err << dbginf << "MRanForest not found... aborting." << endl; 115 return kFALSE; 116 } 117 } 118 113 119 if (!fRanTree) 114 120 { 115 *fLog << err << dbginf << "MRanTree not found... aborting." << endl; 116 return kFALSE; 117 } 118 119 /*if(!fRanForest->GetCurTree()) 120 { 121 *fLog << err << dbginf << "MRanForest does not contain trees... aborting." << endl; 122 return kFALSE; 123 }*/ 121 fRanTree = (MRanTree*)plist->FindObject("MRanTree"); 122 if (!fRanTree) 123 { 124 *fLog << err << dbginf << "MRanTree not found... aborting." << endl; 125 return kFALSE; 126 } 127 } 124 128 125 129 fData = fRanTree->GetRules(); … … 253 257 return kTRUE; 254 258 } 259 260 Int_t MRanForestCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 261 { 262 if (!IsEnvDefined(env, prefix, "File", print)) 263 return kFALSE; 264 265 TString fname = GetEnvValue(env, prefix, "File", "RF.root"); 266 TString tname = GetEnvValue(env, prefix, "Tree", "Tree"); 267 const Int_t num = GetEnvValue(env, prefix, "NumTrees", 100); 268 const Bool_t debug = GetEnvValue(env, prefix, "Debug", kFALSE); 269 270 fname.ReplaceAll("\015", ""); 271 tname.ReplaceAll("\015", ""); 272 273 *fLog << dbginf << "Reading " << num << " trees " << tname << " from file " << fname << endl; 274 275 gLog.SetNullOutput(!debug); 276 MEvtLoop evtloop; 277 MParList plist; 278 evtloop.SetParList(&plist); 279 MLog l; 280 l.SetNullOutput(!debug); 281 evtloop.SetLogStream(&l); 282 gLog.SetNullOutput(debug); 283 284 if (IsOwner()) 285 { 286 delete fRanForest; 287 delete fRanTree; 288 } 289 fRanForest = new MRanForest; 290 fRanTree = new MRanTree; 291 SetOwner(); 292 293 plist.AddToList(fRanForest); 294 plist.AddToList(fRanTree); 295 296 MTaskList tlist; 297 plist.AddToList(&tlist); 298 299 MReadTree read(tname, fname); 300 read.DisableAutoScheme(); 301 302 MRanForestFill rffill; 303 rffill.SetNumTrees(num); 304 305 tlist.AddToList(&read); 306 tlist.AddToList(&rffill); 307 308 if (!evtloop.Eventloop()) 309 { 310 *fLog << err << "ERROR - Reading " << tname << " from file " << fname << endl; 311 return kERROR; 312 } 313 314 return kTRUE; 315 } -
trunk/MagicSoft/Mars/mranforest/MRanForestCalc.h
r2862 r5690 31 31 Int_t Process(); 32 32 33 enum { kIsOwner = BIT(14) }; 34 35 Bool_t IsOwner() const { return TestBit(kIsOwner); } 36 void SetOwner() { SetBit(kIsOwner); } 37 33 38 public: 34 39 MRanForestCalc(const char *name=NULL, const char *title=NULL); 35 40 ~MRanForestCalc(); 41 42 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 36 43 37 44 void SetHadronnessName(const TString name) { fHadronnessName = name; }
Note:
See TracChangeset
for help on using the changeset viewer.