This commit was generated by cvs2svn to compensate for changes in r11742,
[u/mrichter/AliRoot.git] / HLT / MUON / src / AliRoot / Tracker.hpp
CommitLineData
8356cc1d 1////////////////////////////////////////////////////////////////////////////////
2//
3// Author: Artur Szostak
4// Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
5//
6////////////////////////////////////////////////////////////////////////////////
7
8#ifndef dHLT_ALIROOT_TRACKER_HPP
9#define dHLT_ALIROOT_TRACKER_HPP
10
11#ifndef __CINT__
12#include "AliRoot/Point.hpp"
13#include "AliRoot/TriggerRecord.hpp"
14#include "AliRoot/Track.hpp"
15#include "AliRoot/TrackerCallback.hpp"
16#endif // __CINT__
17
18
19namespace AliMUONHLT
20{
21
22
23class Tracker
24{
25public:
26
27 Tracker() : fInterface(this)
28 {
29 fCallback = NULL;
30 };
31
32 /* Methods required to be implemented by the tracker.
33 These correspond to the dHLT::Tracker specification, refer to that
34 class for more information.
35 */
36 virtual void FindTrack(const TriggerRecord& trigger) = 0;
37 virtual void ReturnClusters(void* tag, const Point* clusters, const UInt_t count) = 0;
38 virtual void EndOfClusters(void* tag) = 0;
39 virtual void FillTrackData(Track& track) = 0;
40 virtual void Reset() = 0;
41
42 /* Set the callback for the tracker, so that the tracker can communicate
43 with the framework.
44 */
45 void SetCallback(TrackerCallback* callback)
46 {
47 fCallback = callback;
48 };
49
50 /* Returns the TrackerInterface object to this tracker.
51 This is required by the MicrodHLT object.
52 */
53 TrackerInterface* Interface() const
54 {
55 return &fInterface;
56 };
57
58
59protected:
60
61 void RequestClusters(
62 const Float_t left, const Float_t right, const Float_t bottom, const Float_t top,
63 const Int_t chamber, const void* tag
64 )
65 {
66 if (left > right)
67 Error("RequestClusters", "The parameter left (%f) is larger than right (%f).",
68 left, right
69 );
70 else if (bottom > top)
71 Error("RequestClusters", "The parameter bottom (%f) is larger than top (%f).",
72 bottom, top
73 );
74 else if (chamber < 0 or 9 < chamber)
75 Error("RequestClusters", "The chamber parameter is out of range. Got: %d, expected a value in [0..9]",
76 chamber
77 );
78 else if (fCallback != NULL)
79 fCallback->RequestClusters(left, right, bottom, top, chamber, tag);
80 else
81 Error("RequestClusters", "Callback not set.");
82 };
83
84
85 void EndOfClusterRequests()
86 {
87 if (fCallback != NULL)
88 fCallback->EndOfClusterRequests();
89 else
90 Error("EndOfClusterRequests", "Callback not set.");
91 };
92
93
94 void FoundTrack()
95 {
96 if (fCallback != NULL)
97 fCallback->FoundTrack();
98 else
99 Error("FoundTrack", "Callback not set.");
100 };
101
102
103 void NoTrackFound()
104 {
105 if (fCallback != NULL)
106 fCallback->NoTrackFound();
107 else
108 Error("NoTrackFound", "Callback not set.");
109 };
110
111
112private:
113
114 TrackerInterface fInterface; // The interface via which compiled code communicates with this object.
115 TrackerCallback* fCallback; // Callback interface to framework.
116};
117
118
119// Implementation of the TrackerInterface:
120// This must come here so that it gets interpreted together with the rest
121// of the AliMUONHLT::Tracker.
122
123void TrackerInterface::FindTrack(const TriggerRecord& trigger)
124{
125 fTracker->FindTrack(trigger);
126};
127
128void TrackerInterface::ReturnClusters(void* tag, const Point* clusters, const UInt_t count)
129{
130 fTracker->ReturnClusters(tag, clusters, count);
131};
132
133void TrackerInterface::EndOfClusters(void* tag)
134{
135 fTracker->EndOfClusters(tag);
136};
137
138void TrackerInterface::FillTrackData(Track& track)
139{
140 fTracker->FillTrackData(track);
141};
142
143void TrackerInterface::Reset()
144{
145 fTracker->Reset();
146};
147
148void TrackerInterface::SetCallback(TrackerCallback* callback)
149{
150 fTracker->SetCallback(callback);
151};
152
153
154// Implementation of the SetTracker method which is undefined in MicrodHLT.
155void MicrodHLT::SetTracker(Tracker* tracker)
156{
157 SetTracker(tracker->Interface());
158};
159
160
161}; // AliMUONHLT
162
163#endif // dHLT_ALIROOT_TRACKER_HPP