1 ////////////////////////////////////////////////////////////////////////////////
3 // Author: Artur Szostak
4 // Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
6 ////////////////////////////////////////////////////////////////////////////////
8 #ifndef dHLT_FRAMEWORK_GLOBAL_HPP
9 #define dHLT_FRAMEWORK_GLOBAL_HPP
11 #include "BasicTypes.hpp"
12 #include "Buffers/List.hpp"
13 #include "DDL/TriggerInputInterface.hpp"
14 #include "DDL/ADCInputInterface.hpp"
15 #include "Clustering/IOInterface.hpp"
16 #include "Tracking/IOInterface.hpp"
17 #include "Decision/IOInterface.hpp"
18 #include "DDL/TrackOutputInterface.hpp"
19 #include "DDL/DecisionOutputInterface.hpp"
20 #include "Framework/ClusterLookupTable.hpp"
28 using namespace dHLT::Buffers;
41 // clusterfinderlist, trackerlist and decisionlist free their memory implicitly.
42 // Note the objects to which these lists point to are not deleted because they
43 // are not owned by this object.
46 DDL::TriggerInputCallback* AddTriggerInput();
47 bool RemoveTriggerInput(DDL::TriggerInputCallback* interface);
49 DDL::ADCInputCallback* AddADCInput();
50 bool RemoveADCInput(DDL::ADCInputCallback* interface);
52 Clustering::IOCallback* AddClusterFinder(Clustering::IOInterface* interface);
53 Clustering::IOCallback* AddClusterFinder(Clustering::IOInterface* interface, const ROI region);
54 Clustering::IOCallback* AddClusterFinder(Clustering::IOInterface* interface, const ROI* region, const UInt count);
55 bool RemoveClusterFinder(Clustering::IOInterface* interface);
57 Tracking::IOCallback* AddTracker(Tracking::IOInterface* interface);
58 bool RemoveTracker(Tracking::IOInterface* interface);
60 Decision::IOCallback* AddDecision(Decision::IOInterface* interface);
61 bool RemoveDecision(Decision::IOInterface* interface);
63 DDL::TrackOutputCallback* AddTrackOutput(DDL::TrackOutputInterface* interface);
64 bool RemoveTrackOutput(DDL::TrackOutputInterface* interface);
66 DDL::DecisionOutputCallback* AddDecisionOutput(DDL::DecisionOutputInterface* interface);
67 bool RemoveDecisionOutput(DDL::DecisionOutputInterface* interface);
78 class FrameworkCallback
86 friend std::ostream& operator << (std::ostream& os, const FrameworkCallback& fc)
88 os << (void*) fc.framework;
95 class TriggerInput : public DDL::TriggerInputCallback, public FrameworkCallback
98 virtual TriggerRecord* AllocateTriggerBlock(const UInt size);
99 virtual void ReturnTriggers(const EventID event, TriggerRecord* triggers, const UInt count);
100 virtual void EndOfTriggers(const EventID event);
103 class ADCInput : public DDL::ADCInputCallback, public FrameworkCallback
106 virtual ADCStream* AllocateADCStream(const UInt size);
107 virtual void ReturnADCStream(const EventID event, ADCStream* adcstream);
108 virtual void EndOfADCStreams(const EventID event);
111 class ClusterFinder : public Clustering::IOCallback, public FrameworkCallback
114 virtual ClusterPoint* AllocateClusterBlock(const UInt size);
115 virtual void ReturnClusters(const EventID event, const ROI region, ClusterPoint* clusters, const UInt count);
116 virtual void EndOfClusters(const EventID event);
117 virtual void ReleaseADCStream(const ADCStream* stream);
119 ClusterFinder() : Clustering::IOCallback(), FrameworkCallback() { region = INVALID_ROI; };
120 ROI region; // The region this cluster finder covers.
121 Clustering::IOInterface* interface;
124 class Tracker : public Tracking::IOCallback, public FrameworkCallback
127 virtual void RequestClusters(const EventID event, const ROI region);
128 virtual void EndOfClusterRequests(const EventID event);
129 virtual Track* AllocateTrackBlock(const UInt size);
130 virtual void ReturnTracks(const EventID event, Track* newtracks, const UInt count);
131 virtual void EndOfTracks(const EventID event);
132 virtual void ReleaseTriggers(const TriggerRecord* triggers);
133 virtual void ReleaseClusters(const ClusterPoint* clusters);
135 Tracking::IOInterface* interface;
138 class DecisionMaker : public Decision::IOCallback, public FrameworkCallback
141 virtual DecisionRecord* AllocateDecisionBlock(const UInt size);
142 virtual void ReturnDecision(const EventID event, DecisionRecord* decision);
143 virtual void EndOfDecisions(const EventID event);
144 virtual void ReleaseTracks(const Track* tracks);
146 Decision::IOInterface* interface;
149 class TrackOutput : public DDL::TrackOutputCallback, public FrameworkCallback
152 virtual void ReleaseTracks(const Track* tracks);
154 DDL::TrackOutputInterface* interface;
157 class DecisionOutput : public DDL::DecisionOutputCallback, public FrameworkCallback
160 virtual void ReleaseDecision(const DecisionRecord* decision);
162 DDL::DecisionOutputInterface* interface;
168 //==================== DDL::TriggerInputCallback =========================
169 void ReturnTriggers(const TriggerInput* sender, const EventID event, TriggerRecord* triggers, const UInt count);
170 void EndOfTriggers(const TriggerInput* sender, const EventID event);
172 //====================== DDL::ADCInputCallback ===========================
173 void ReturnADCStream(const ADCInput* sender, const EventID event, ADCStream* adcstream);
174 void EndOfADCStreams(const ADCInput* sender, const EventID event);
176 //===================== Clustering::IOCallback ===========================
177 void ReturnClusters(const ClusterFinder* sender, const EventID event, const ROI region, ClusterPoint* clusters, const UInt count);
178 void EndOfClusters(const ClusterFinder* sender, const EventID event);
179 void ReleaseADCStream(const ClusterFinder* sender, const ADCStream* stream);
181 //====================== Tracking::IOCallback ============================
182 void RequestClusters(const Tracker* sender, const EventID event, const ROI region);
183 void EndOfClusterRequests(const Tracker* sender, const EventID event);
184 void ReturnTracks(const Tracker* sender, const EventID event, Track* newtracks, const UInt count);
185 void EndOfTracks(const Tracker* sender, const EventID event);
186 void ReleaseTriggers(const Tracker* sender, const TriggerRecord* triggers);
187 void ReleaseClusters(const Tracker* sender, const ClusterPoint* clusters);
189 //====================== Decision::IOCallback ============================
190 void ReturnDecision(const DecisionMaker* sender, const EventID event, DecisionRecord* decision);
191 void EndOfDecisions(const DecisionMaker* sender, const EventID event);
192 void ReleaseTracks(const DecisionMaker* sender, const Track* tracks);
194 //==================== DDL::TrackOutputCallback ==========================
195 void ReleaseTracks(const TrackOutput* sender, const Track* tracks);
197 //=================== DDL::DecisionOutputCallback ========================
198 void ReleaseDecision(const DecisionOutput* sender, const DecisionRecord* decision);
201 typedef List<TriggerInput> TriggerInputList;
202 typedef List<ADCInput> ADCInputList;
203 typedef List<ClusterFinder> ClusterFinderList;
204 typedef List<Tracker> TrackerList;
205 typedef List<DecisionMaker> DecisionMakerList;
206 typedef List<TrackOutput> TrackOutputList;
207 typedef List<DecisionOutput> DecisionOutputList;
209 TriggerInputList triggerinputlist; // List of trigger record input sources.
210 ADCInputList adcinputlist; // List of ADC stream input sources.
211 ClusterFinderList clusterfinderlist; // List of cluster finders.
213 TrackerList::Iterator currenttracker; // Pointer to the current tracker to receive triggers.
214 TrackerList trackerlist; // List of traker objects.
216 DecisionMakerList decisionmakerlist; // List of decision making objects.
218 TrackOutputList trackoutputlist; // List of track block output sinks.
219 DecisionOutputList decisionoutputlist; // List of decision block output sinks.
221 ClusterLookupTable clustertable;
228 #endif // dHLT_FRAMEWORK_GLOBAL_HPP