]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/trigger/AliHLTReadoutList.h
Finished code for global HLT trigger and the trigger menu implementation.
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTReadoutList.h
CommitLineData
dce3e5ce 1#ifndef ALIHLTREADOUTLIST_H
2#define ALIHLTREADOUTLIST_H
3/* This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/// @file AliHLTReadoutList.h
8/// @author Artur Szostak <artursz@iafrica.com>
9/// @date 19 Nov 2008
10/// @brief Declaration of the AliHLTReadoutList class used to handle AliHLTEventDDL structures.
11
12#include "TObject.h"
13#include "AliHLTDataTypes.h"
14
1b9a175e 15/**
16 * \class AliHLTReadoutList
17 * This class is used as an interface or wrapper to the AliHLTEventDDL structure.
18 * It makes it easy to manipulate the bits in this structure, which define what DDLs
19 * should be readout by DAQ.
20 * Several operators are also overloaded which are meant to be used in the trigger
21 * menu specification for the AliHLTGlobalTrigger. It allows one to construct
22 * expressions for the readout lists, which is necessary to be able to evaluate
23 * or compose the final readout list, given multiple input readout lists received
24 * from individual components that derive from AliHLTTrigger.
25 * The operators implemented are:
26 * | applies a bitwise or on the DDL bits.
27 * & applies a bitwise and on the DDL bits.
28 * ^ applies a bitwise xor on the DDL bits.
29 * ~ applies a bitwise not on the DDL bits.
30 * + synonym for the '|' operator.
31 * - unsets the bits in readout list A that are set in readout list B.
32 * This effectively applies A & (A ^ B).
33 */
dce3e5ce 34class AliHLTReadoutList : public TObject
35{
36 public:
37
38 /**
39 * Identifiers for different detectors used by methods in AliHLTReadoutList.
40 */
41 enum EDetectorId
42 {
43 kITSSPD = 0x1 << 0, /// ID for SPD detector
44 kITSSDD = 0x1 << 1, /// ID for SDD detector
45 kITSSSD = 0x1 << 2, /// ID for SSD detector
46 kTPC = 0x1 << 3, /// ID for TPC detector
47 kTRD = 0x1 << 4, /// ID for TRD detector
48 kTOF = 0x1 << 5, /// ID for TOF detector
49 kHMPID = 0x1 << 6, /// ID for HMPID detector
50 kPHOS = 0x1 << 7, /// ID for PHOS detector
51 kCPV = 0x1 << 8, /// ID for CPV detector
52 kPMD = 0x1 << 9, /// ID for PMD detector
53 kMUONTRK = 0x1 << 10, /// ID for MUON tracking chambers
54 kMUONTRG = 0x1 << 11, /// ID for MUON trigger detector
55 kFMD = 0x1 << 12, /// ID for FMD detector
56 kT0 = 0x1 << 13, /// ID for T0 detector
57 kV0 = 0x1 << 14, /// ID for V0 detector
58 kZDC = 0x1 << 15, /// ID for ZDC detector
59 kACORDE = 0x1 << 16, /// ID for ACORDE detector
60 kTRG = 0x1 << 17, /// ID for TRG detector
61 kEMCAL = 0x1 << 18, /// ID for EMCAL detector
62 kDAQTEST = 0x1 << 19, /// ID for DAQ_TEST detector
63 kHLT = 0x1 << 30, /// ID for HLT detector
64 // kALLDET sets readout for all detectors except DAQ_TEST
65 kALLDET = (kITSSPD | kITSSDD | kITSSSD | kTPC | kTRD | kTOF | kHMPID | kPHOS
66 | kCPV | kPMD | kMUONTRK | kMUONTRG | kFMD | kT0 | kV0 | kZDC
67 | kACORDE | kTRG | kEMCAL | kHLT)
68 };
69
70 /**
71 * Default constructor.
72 */
73 AliHLTReadoutList();
74
75 /**
76 * Constructor to select which detectors to enable for readout.
77 * \param enabledDetectors Detector bit field. Can be any values for
78 * EDetectorId or'ed together.
79 */
80 AliHLTReadoutList(Int_t enabledDetectors);
81
82 /**
83 * Constructor to select which detectors and DDLs to enable for readout.
84 * \param enabledList The string format is a space separated list where
85 * each item is either a detector acronym name or DDL number.
86 * Invalid sub-strings are simply ignored. The special ALL string is
87 * equivalent to kALLDET for AliHLTReadoutList(Int_t enabledDetectors).
88 */
89 AliHLTReadoutList(const char* enabledList);
90
91 /**
92 * Constructor to create readout list from AliHLTEventDDL structure.
93 * \param list The AliHLTEventDDL structure from which to create this object.
94 */
95 AliHLTReadoutList(const AliHLTEventDDL& list);
96
97 /**
98 * The copy constructor performs a deep copy.
99 * \param list The readout list to copy from.
100 */
101 AliHLTReadoutList(const AliHLTReadoutList& list);
102
103 /**
104 * Default destructor.
105 */
106 virtual ~AliHLTReadoutList();
107
108 /**
109 * Enables a specific DDL bit in the readout list.
110 * \param ddlId The ID number of the DDL to enable.
111 */
112 void EnableDDLBit(Int_t ddlId)
113 {
114 SetDDLBit(ddlId, kTRUE);
115 }
116
117 /**
118 * Disables a specific DDL bit in the readout list.
119 * \param ddlId The ID number of the DDL to disable.
120 */
121 void DisableDDLBit(Int_t ddlId)
122 {
123 SetDDLBit(ddlId, kFALSE);
124 }
125
126 /**
127 * Fetches the bit value for a particular DDL in the readout list.
128 * \param ddlId The ID number of the DDL to fetch.
129 * \return the bit value for the specified DDL.
130 */
131 Bool_t GetDDLBit(Int_t ddlId) const;
132
133 /**
134 * Sets the bit value for a particular DDL in the readout list.
135 * \param ddlId The ID number of the DDL to set.
136 * \param state The value to set the bit to.
137 */
138 void SetDDLBit(Int_t ddlId, Bool_t state);
139
140 /**
141 * Checks if a particular DDL is enabled for readout.
142 * \param ddlId The ID number of the DDL to check.
143 * \return the if the DDL is enabled for readout.
144 */
145 bool IsDDLEnabled(Int_t ddlId) const
146 {
147 return GetDDLBit(ddlId) == kTRUE;
148 }
149
150 /**
151 * Checks if a particular DDL is disabled for readout.
152 * \param ddlId The ID number of the DDL to check.
153 * \return the if the DDL is disabled for readout.
154 */
155 bool IsDDLDisabled(Int_t ddlId) const
156 {
157 return GetDDLBit(ddlId) == kFALSE;
158 }
159
160 /**
161 * Enables all DDLs for a particular detector or detectors.
162 * \param detector A bitmap of detectors to enable. Should be any values from
163 * EDetectorId that can be or'ed together for multiple detector selection.
164 */
165 void Enable(Int_t detector);
166
167 /**
168 * Disables all DDLs for a particular detector or detectors.
169 * \param detector A bitmap of detectors to disable. Should be any values from
170 * EDetectorId that can be or'ed together for multiple detector selection.
171 */
172 void Disable(Int_t detector);
173
52f67e50 174 /**
175 * Checks if a particular detector's DDLs are enabled for readout.
176 * \param detector A bitmap of detectors to check. Should be any values from
177 * EDetectorId that can be or'ed together for multiple detector selection.
178 * \return true if all DDLs for the specified detectors are enabled for readout.
179 */
180 bool DetectorEnabled(Int_t ddlId) const;
181
dce3e5ce 182 /**
183 * Inherited from TObject. Prints the DDLs that will be readout according to
184 * this readout list.
185 * \param option This is not used by this method.
186 */
187 virtual void Print(Option_t* option = "") const;
188
189 /**
190 * This typecast operator converts the readout list to the AliHLTEventDDL
191 * structure format.
192 * \return Copy of the AliHLTEventDDL raw structure.
193 */
194 operator AliHLTEventDDL () const { return fReadoutList; }
195
196 /**
197 * This typecast operator converts the readout list to the AliHLTEventDDL
198 * structure format.
199 * \return Reference to the AliHLTEventDDL raw structure.
200 */
201 operator AliHLTEventDDL& () { return fReadoutList; }
202
203 /**
204 * Assignment operator performs a deep copy.
205 * \param list The readout list to copy from.
206 * \return A reference to this object.
207 */
208 AliHLTReadoutList& operator = (const AliHLTReadoutList& list);
209
210 /**
211 * This operator performs a bitwise inclusive or operation on all DDL bits
212 * between this readout and <i>list</i>.
213 * \param list The right hand side readout list to operate on.
214 * \return A reference to this object.
215 */
216 AliHLTReadoutList& operator |= (const AliHLTReadoutList& list);
217
218 /**
219 * This operator performs a bitwise exclusive or (xor) operation on all DDL
220 * bits between this readout and <i>list</i>.
221 * \param list The right hand side readout list to operate on.
222 * \return A reference to this object.
223 */
224 AliHLTReadoutList& operator ^= (const AliHLTReadoutList& list);
225
226 /**
227 * This operator performs a bitwise and operation on all DDL bits between
228 * this readout and <i>list</i>.
229 * \param list The right hand side readout list to operate on.
230 * \return A reference to this object.
231 */
232 AliHLTReadoutList& operator &= (const AliHLTReadoutList& list);
233
234 /**
235 * This operator performs the same operation as '|='.
236 * \param list The right hand side readout list to operate on.
237 * \return A reference to this object.
238 */
239 AliHLTReadoutList& operator += (const AliHLTReadoutList& list)
240 {
241 return operator |= (list);
242 }
243
244 /**
245 * This operator performs the effective operation of "this and (this xor list)".
246 * It removes all the DDLs specified in list from this readout list.
247 * \param list The right hand side readout list to operate on.
248 * \return A reference to this object.
249 */
250 AliHLTReadoutList& operator -= (const AliHLTReadoutList& list);
251
252 /**
253 * This operator performs a bitwise ones compliment on all DDL bits of this
254 * readout list.
255 * \return The result of the unary operator.
256 */
257 AliHLTReadoutList operator ~ () const;
258
259 /**
260 * This operator performs a bitwise inclusive or operation on all DDL bits
261 * between this readout and <i>list</i>.
262 * \param list The right hand side readout list to operate on.
263 * \return The result of the binary operator.
264 */
265 AliHLTReadoutList operator | (const AliHLTReadoutList& list) const
266 {
267 AliHLTReadoutList result = *this;
268 return result.operator |= (list);
269 }
270
271 /**
272 * This operator performs a bitwise exclusive or (xor) operation on all DDL
273 * bits between this readout and <i>list</i>.
274 * \param list The right hand side readout list to operate on.
275 * \return The result of the binary operator.
276 */
277 AliHLTReadoutList operator ^ (const AliHLTReadoutList& list) const
278 {
279 AliHLTReadoutList result = *this;
280 return result.operator ^= (list);
281 }
282
283 /**
284 * This operator performs a bitwise and operation on all DDL bits between
285 * this readout and <i>list</i>.
286 * \param list The right hand side readout list to operate on.
287 * \return The result of the binary operator.
288 */
289 AliHLTReadoutList operator & (const AliHLTReadoutList& list) const
290 {
291 AliHLTReadoutList result = *this;
292 return result.operator &= (list);
293 }
294
295 /**
296 * This operator performs the same operation as '|'.
297 * \param list The right hand side readout list to operate on.
298 * \return The result of the binary operator.
299 */
300 AliHLTReadoutList operator + (const AliHLTReadoutList& list) const
301 {
302 AliHLTReadoutList result = *this;
303 return result.operator += (list);
304 }
305
306 /**
307 * This operator performs the effective operation of "this and (this xor list)".
308 * It removes all the DDLs specified in list from this readout list.
309 * \param list The right hand side readout list to operate on.
310 * \return The result of the binary operator.
311 */
312 AliHLTReadoutList operator - (const AliHLTReadoutList& list) const
313 {
314 AliHLTReadoutList result = *this;
315 return result.operator -= (list);
316 }
317
318 private:
319
320 /**
321 * Decodes the word index and bit index within that word for the readout list structure.
322 * \param ddlId <i>[in]</i> The ID number of the DDL to decode.
323 * \param wordIndex <i>[out]</i> the word index of the word to modify or check
324 * within fReadoutList.fList
325 * \param bitIndex <i>[out]</i> the bit index of the bit to modify or check
326 * within the word pointed to by <i>wordIndex</i>.
327 * \return true if the ddlId was decoded and false if it was invalid.
328 * \note We do not check extensively if the ddlId is invalid. Just simple checks
329 * are performed to see that we do not overflow the buffer fReadoutList.fList.
330 */
331 static bool DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex);
332
333 AliHLTEventDDL fReadoutList; /// The DDL readout list structure.
334
335 ClassDef(AliHLTReadoutList, 1) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
336
337};
338
339#endif // ALIHLTREADOUTLIST_H
340