]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/src/Decision/DecisionMaker.hpp
Renaming file to fall inline with coding conventions.
[u/mrichter/AliRoot.git] / HLT / MUON / src / Decision / DecisionMaker.hpp
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Author: Artur Szostak
4 // Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
5 //
6 ////////////////////////////////////////////////////////////////////////////////
7
8 #ifndef dHLT_DECISION_DECISION_MAKER_HPP
9 #define dHLT_DECISION_DECISION_MAKER_HPP
10
11 #include "BasicTypes.hpp"
12 #include "Track.hpp"
13 #include "DecisionRecord.hpp"
14 #include "Utils.hpp"
15
16
17 namespace dHLT
18 {
19 namespace Decision
20 {
21
22
23 class DecisionMaker;
24
25
26 class DecisionMakerCallback
27 {
28 public:
29
30         virtual ~DecisionMakerCallback() {};
31
32         /* Called when the decision maker has finished processing.
33            At this point and tracks passed to the decision maker are no longer is use
34            by the decision maker and the tracks can be released.
35            'decisionsize' indicates the number of bytes required to store the decision.
36            If decisionsize == 0 then no memory is allocated and FillDecisionData should
37            never be called.
38          */
39         virtual void MadeDecision(DecisionMaker* decisionmaker, const UInt decisionsize) = 0;
40
41 };
42
43
44 class DecisionMaker
45 {
46 public:
47
48         DecisionMaker()
49         {
50                 callback = NULL;
51         };
52
53         virtual ~DecisionMaker() {};
54
55         /* This is the starting point of the decision algorithm. Any initialisation
56            processing should be performed here.
57          */
58         virtual void StartDecision() = 0;
59         
60         /* For every track avaiable for a particular event or sub-event this method
61            is called with the relevant track. Most of the actual decision algorithm 
62            will go into this method on a per track basis.
63          */
64         virtual void AddTrack(const AliHLTMUONCoreTrack& track) = 0;
65         
66         /* When no more tracks are available for the decision then this method is called.
67            Final processing of the decision algorithm should go in to this method.
68            When the decision is made by the algorithm then the MadeDecision should be
69            called.
70          */
71         virtual void EndOfTracks() = 0;
72         
73         /* After a call to MadeDecision this method will be called to retreive the
74            decision. The 'decision' pointer should point to a memory block of at least
75            the number of bytes specified in the call to MadeDecision, with the 
76            decisionsize parameter. The decision algorithm should not write more data
77            than requested.
78          */
79         virtual void FillDecisionData(DecisionRecord* decision) = 0;
80
81         /* This is called when the decision maker should be reset to an initial state.
82            All extra internal memory allocated during processing should be released.
83          */
84         virtual void Reset() = 0;
85
86         /* Sets the DecisionMakerCallback callback interface.
87          */
88         inline void SetCallback(DecisionMakerCallback* callback)
89         {
90                 this->callback = callback;
91         };
92
93 protected:
94
95         /* When the decision algorithm is finished processing and a decision is made,
96            then this method should be called. At this point all the track blocks
97            should be considered released and the track memory MUST NOT be accessed.
98            The number of bytes required to store the decision should be indecated by
99            'decisionsize'.
100          */
101         inline void MadeDecision(const UInt decisionsize)
102         {
103                 Assert( callback != NULL );
104                 callback->MadeDecision(this, decisionsize);
105         };
106
107 private:
108
109         DecisionMakerCallback* callback;
110 };
111
112
113 } // Decision
114 } // dHLT
115
116 #endif // dHLT_DECISION_DECISION_MAKER_HPP