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