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 data member fID is used to indicate the type of events
|
---|
12 | // that are process by this task. There are the following different
|
---|
13 | // event types:
|
---|
14 | //
|
---|
15 | // This is the type of task for which this task should be processed
|
---|
16 | // taskType-bits: 7 6 5 4 3 2 1 0
|
---|
17 | // 0 DATA_EVT
|
---|
18 | // 1 CALIBRATION_EVT
|
---|
19 | // ? etc. etc.
|
---|
20 | //
|
---|
21 | // Inside this abstract class, there are three fundamental function:
|
---|
22 | //
|
---|
23 | // - PreProcess() : executed before the eventloop starts. Here you
|
---|
24 | // can initiate different things, open files, etc.
|
---|
25 | //
|
---|
26 | // - Process() : executed for each event in the eventloop. Do in
|
---|
27 | // one task after the other (as the occur in the
|
---|
28 | // tasklist) the action of one task.
|
---|
29 | //
|
---|
30 | // - PostProcess(): executed after the eventloop. Here you can close
|
---|
31 | // output files, start display of the run parameter,
|
---|
32 | // etc.
|
---|
33 | //
|
---|
34 | //
|
---|
35 | ///////////////////////////////////////////////////////////////////////
|
---|
36 |
|
---|
37 | #include "MTask.h"
|
---|
38 |
|
---|
39 | #include <string.h>
|
---|
40 | #include <iostream.h>
|
---|
41 |
|
---|
42 | ClassImp(MTask)
|
---|
43 |
|
---|
44 | void MTask::SetEventType(const char *evt)
|
---|
45 | {
|
---|
46 | if (fID)
|
---|
47 | delete fID;
|
---|
48 | fID = new char[strlen(evt)+1];
|
---|
49 | strcpy(fID, evt);
|
---|
50 | }
|
---|
51 |
|
---|
52 | Bool_t MTask::PreProcess( MParList *pList )
|
---|
53 | {
|
---|
54 | //
|
---|
55 | // This is processed before the eventloop starts
|
---|
56 | //
|
---|
57 | // It is the job of the PreProcess to connect the tasks
|
---|
58 | // with the right container in the parameter list.
|
---|
59 | //
|
---|
60 | // the virtual implementation returns kTRUE
|
---|
61 | //
|
---|
62 | return kTRUE;
|
---|
63 | }
|
---|
64 |
|
---|
65 |
|
---|
66 | Bool_t MTask::Process()
|
---|
67 | {
|
---|
68 | //
|
---|
69 | // This is processed for every event in the eventloop
|
---|
70 | //
|
---|
71 | // the virtual implementation returns kTRUE
|
---|
72 | //
|
---|
73 | return kTRUE;
|
---|
74 | }
|
---|
75 |
|
---|
76 | Bool_t MTask::PostProcess()
|
---|
77 | {
|
---|
78 | //
|
---|
79 | // This is processed after the eventloop starts
|
---|
80 | //
|
---|
81 | // the virtual implementation returns kTRUE
|
---|
82 | //
|
---|
83 | return kTRUE;
|
---|
84 | }
|
---|
85 |
|
---|
86 |
|
---|