| 1 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 2 | // //
|
|---|
| 3 | // MTask //
|
|---|
| 4 | // //
|
|---|
| 5 | // Base class for all tasks which can perfomed in a tasklist //
|
|---|
| 6 | // For each event processed in the eventloop all the different //
|
|---|
| 7 | // tasks in the tasklist will be processed. //
|
|---|
| 8 | // //
|
|---|
| 9 | // So all tasks must inherit from this baseclass. //
|
|---|
| 10 | // //
|
|---|
| 11 | // The inheritance from MInputStreamID is used to indicate the //
|
|---|
| 12 | // type of event that this task is for. If it is "All" it is executed //
|
|---|
| 13 | // independantly of the actual ID of the task list. //
|
|---|
| 14 | // //
|
|---|
| 15 | // Inside this abstract class, there are three fundamental function: //
|
|---|
| 16 | // //
|
|---|
| 17 | // - PreProcess(): executed before the eventloop starts. Here you //
|
|---|
| 18 | // can initiate different things, open files, etc. //
|
|---|
| 19 | // As an argument this function gets a pointer to the //
|
|---|
| 20 | // parameter list. You can stop the execution by //
|
|---|
| 21 | // kFALSE instread of kTRUE. //
|
|---|
| 22 | // //
|
|---|
| 23 | // - Process(): executed for each event in the eventloop. Do in //
|
|---|
| 24 | // one task after the other (as the occur in the //
|
|---|
| 25 | // tasklist) the action of one task. Only the tasks //
|
|---|
| 26 | // with a Stream ID which matches the actual ID of the //
|
|---|
| 27 | // task list are executed. A task can return kFALSE //
|
|---|
| 28 | // to stop the execuition of the pending taks in a //
|
|---|
| 29 | // list or kCONTINUE to skip the pending tasks. //
|
|---|
| 30 | // //
|
|---|
| 31 | // - PostProcess(): executed after the eventloop. Here you can close //
|
|---|
| 32 | // output files, start display of the run parameter, //
|
|---|
| 33 | // etc. //
|
|---|
| 34 | // //
|
|---|
| 35 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 36 |
|
|---|
| 37 | #include "MTask.h"
|
|---|
| 38 |
|
|---|
| 39 | #include <string.h>
|
|---|
| 40 | #include <iostream.h>
|
|---|
| 41 |
|
|---|
| 42 | ClassImp(MTask)
|
|---|
| 43 |
|
|---|
| 44 | Bool_t MTask::PreProcess( MParList *pList )
|
|---|
| 45 | {
|
|---|
| 46 | //
|
|---|
| 47 | // This is processed before the eventloop starts
|
|---|
| 48 | //
|
|---|
| 49 | // It is the job of the PreProcess to connect the tasks
|
|---|
| 50 | // with the right container in the parameter list.
|
|---|
| 51 | //
|
|---|
| 52 | // the virtual implementation returns kTRUE
|
|---|
| 53 | //
|
|---|
| 54 | return kTRUE;
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | Bool_t MTask::Process()
|
|---|
| 59 | {
|
|---|
| 60 | //
|
|---|
| 61 | // This is processed for every event in the eventloop
|
|---|
| 62 | //
|
|---|
| 63 | // the virtual implementation returns kTRUE
|
|---|
| 64 | //
|
|---|
| 65 | return kTRUE;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | Bool_t MTask::PostProcess()
|
|---|
| 69 | {
|
|---|
| 70 | //
|
|---|
| 71 | // This is processed after the eventloop starts
|
|---|
| 72 | //
|
|---|
| 73 | // the virtual implementation returns kTRUE
|
|---|
| 74 | //
|
|---|
| 75 | return kTRUE;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|