Changeset 9867 for trunk/Mars/mjoptim
- Timestamp:
- 08/16/10 09:07:43 (14 years ago)
- Location:
- trunk/Mars/mjoptim
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mjoptim/MJOptimizeBase.cc
r8643 r9867 18 18 ! Author(s): Thomas Bretz 11/2005 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2005-20 0720 ! Copyright: MAGIC Software Development, 2005-2010 21 21 ! 22 22 ! … … 30 30 // 31 31 // The order when reading a file is: 32 // 1) Execution of PreTasks (set by user)33 // 2) Execution of PreCuts (set by user)32 // 1) Execution of PreTasks 33 // 2) Execution of PreCuts, TestCuts, TrainCuts 34 34 // 3) Selector (calculated from number of requested events) 35 35 // 4) Splitter (if sample is split automatically in test/train) … … 39 39 // you calculate a vlue which is not needed for your PreCuts, you can 40 40 // calculate it afterwards, which will speed up execution. 41 // 42 // void AddPreTask(MTask *t) 43 // Add a task which is executed just after reading the events from the file 44 // this can be any kind of task or even a task list. You can use dedicated 45 // tasks performing some analysis, but also cuts (e.g. MContinue) or a 46 // general task to evaluate new parameters (e.g. MParameterCalc) 47 // 48 // void AddPreTask(const char *rule, const char *name="MWeight") 49 // This is a short cut to AddPreTask(MTask*) which will add a 50 // MParameterCalc to the list evaluating the given rule and storing the 51 // result in a MParameterD with the given name. For the default "MWeight", 52 // for example, the value can later be accessed by MWeight.fVal. 53 // 54 // The same functions are available as 55 // void AddPostTask(MTask *t) 56 // void AddPostTask(const char *rule, const char *name="MWeight") 57 // 58 // It is advicable to use these function if the task is not needed for your 59 // event selection. The event selection (by number and by PreCuts) is done 60 // in between PreTasks and PostTasks, i.e. a task which is not needed for the 61 // event selection but needed later is only executed as often as necessary. 62 // 63 // The event selection (apart from the number of target events) can be setup 64 // by the user. Therefore two functions are available 65 // void AddPreCut(const char *rule) 66 // void AddPreCut(MFilter *f) 67 // Both add cuts which are executed after the PreTasks but before the 68 // PostTasks. They are executed in both training and testing. To execute cuts 69 // only in training or testing use 70 // void AddTrainCut(const char *rule) 71 // void AddTrainCut(MFilter *f) 72 // or 73 // void AddTestCut(const char *rule) 74 // void AddTestCut(MFilter *f) 75 // 76 // To weight the events of your train- and test sample the following functions 77 // can be used 78 // void SetWeights(const char *rule) 79 // void SetWeights(MTask *t) 80 // This either adds a MParameterCalc to the list of post tasks or a MTask, 81 // which is supposed to fill a MParameterD named "MWeight". 82 // 83 // Last but not least a function if available to add additional tasks to the 84 // end of the task list for testing. This can for example be used to add 85 // the filling and display of an addition histogram (e.g. add a MFillH) 86 // or to do some calculation and write out the result. Basically everything 87 // can be done in this way. 88 // void AddTestTask(MTask *t) 89 // void AddTestTask(const char *rule, const char *name="MWeight") 90 // 91 // 92 // REMARK: Note that the actual behavior might still vary a bit 93 // depeding of the implementation in the derived class. 41 94 // 42 95 ///////////////////////////////////////////////////////////////////////////// … … 98 151 //------------------------------------------------------------------------ 99 152 // 100 // Add a parameter used in your filters (see AddFilter) The parameter101 // index is returned,153 // Add a parameter to the list of parameters. The index in the list is 154 // returned. 102 155 // 103 156 // Int_t idx = AddParameter("log10(MHillas.fSize)"); 104 157 // 105 // The indices are starting with 0 always.158 // Indices are starting with 0. 106 159 // 107 160 Int_t MJOptimizeBase::AddParameter(const char *rule) -
trunk/Mars/mjoptim/MJOptimizeBase.h
r8698 r9867 23 23 TList fPreTasks; // Tasks executed before cut execution 24 24 TList fPostTasks; // Tasks executed after cut execution 25 TList fTestTasks; // Tasks executed a fter cut execution for testing25 TList fTestTasks; // Tasks executed at the end of the testing tasklist 26 26 27 27 void AddCut(TList &l, const char *rule); … … 34 34 } 35 35 36 // MJOptimizeBase 37 void SetDebug(Bool_t b=kTRUE) { fDebug = b; } 38 39 // Add a parameter to the list of parameters 40 Int_t AddParameter(const char *rule); 41 42 // Tasks which are executed after reading (training and testing if available) 36 43 void AddPreTask(MTask *t) { Add(fPreTasks, t); } 37 44 void AddPreTask(const char *rule, 38 45 const char *name="MWeight") { AddPar(fPreTasks, rule, name); } 39 46 47 // Cuts which are executed after the pre-tasks (training and testing if available) 48 void AddPreCut(const char *rule) { AddCut(fPreCuts, rule); } 49 void AddPreCut(MFilter *f) { Add(fPreCuts, (MTask*)(f)); } 50 51 // Same as pre-cuts but only executed in taining or testing 52 void AddTrainCut(const char *rule) { AddCut(fTrainCuts, rule); } 53 void AddTrainCut(MFilter *f) { Add(fTrainCuts, (MTask*)(f)); } 54 55 void AddTestCut(const char *rule) { AddCut(fTestCuts, rule); } 56 void AddTestCut(MFilter *f) { Add(fTestCuts, (MTask*)(f)); } 57 58 // Tasks which are excuted after event selection (training and testing if available) 40 59 void AddPostTask(MTask *t) { Add(fPostTasks, t); } 41 60 void AddPostTask(const char *rule, 42 61 const char *name="MWeight") { AddPar(fPostTasks, rule, name); } 43 62 63 // Tasks executed at the end of the testing tasklist 44 64 void AddTestTask(MTask *t) { Add(fTestTasks, t); } 45 65 void AddTestTask(const char *rule, 46 66 const char *name="MWeight") { AddPar(fTestTasks, rule, name); } 47 67 48 void SetDebug(Bool_t b=kTRUE) { fDebug = b; } 49 68 // Add calculation of weights to list of post tasks. Set fEnableWeights 50 69 void SetWeights(const char *rule) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(rule); } 51 70 void SetWeights(MTask *t) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(t); } 52 53 void AddPreCut(const char *rule) { AddCut(fPreCuts, rule); }54 void AddPreCut(MFilter *f) { Add(fPreCuts, (MTask*)(f)); }55 56 void AddTrainCut(const char *rule) { AddCut(fTrainCuts, rule); }57 void AddTrainCut(MFilter *f) { Add(fTrainCuts, (MTask*)(f)); }58 59 void AddTestCut(const char *rule) { AddCut(fTestCuts, rule); }60 void AddTestCut(MFilter *f) { Add(fTestCuts, (MTask*)(f)); }61 62 Int_t AddParameter(const char *rule);63 71 64 72 ClassDef(MJOptimizeBase, 0)//Base class for all optimizations and trainings
Note:
See TracChangeset
for help on using the changeset viewer.