]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HLT/BASE/AliHLTReadoutList.cxx
Major update required to handle old and new AliHLTEventDDL structures within HLT...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTReadoutList.cxx
... / ...
CommitLineData
1// $Id$
2/**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Primary Authors: Artur Szostak <artursz@iafrica.com> *
7 * for The ALICE HLT Project. *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
18/// @file AliHLTReadoutList.cxx
19/// @author Artur Szostak <artursz@iafrica.com>
20/// @date 19 Nov 2008
21/// @brief Implementation of the AliHLTReadoutList class.
22///
23/// The AliHLTReadoutList class is used as an interface to the AliHLTEventDDL
24/// structure. It makes it easy to manipulate the bits in this structure, which
25/// define what DDLs should be readout by DAQ.
26/// Several operators are also overloaded which are meant to be used in the trigger
27/// menu specification for the AliHLTGlobalTrigger. It allows one to construct
28/// expressions for the readout lists, which is necessary to be able to evaluate
29/// or compose the final readout list, given multiple input readout lists received
30/// from individual components that derive from AliHLTTrigger.
31
32#include "AliHLTReadoutList.h"
33#include "AliHLTDAQ.h"
34#include "Riostream.h"
35#include "TString.h"
36#include "TObjString.h"
37#include "TObjArray.h"
38#include <cassert>
39
40ClassImp(AliHLTReadoutList)
41
42
43const char* AliHLTReadoutList::DetectorIdToString(EDetectorId id)
44{
45 // Converts a detector ID to a user readable string.
46 switch (id)
47 {
48 case kNoDetector: return "kNoDetector";
49 case kITSSPD: return "kITSSPD";
50 case kITSSDD: return "kITSSDD";
51 case kITSSSD: return "kITSSSD";
52 case kTPC: return "kTPC";
53 case kTRD: return "kTRD";
54 case kTOF: return "kTOF";
55 case kHMPID: return "kHMPID";
56 case kPHOS: return "kPHOS";
57 case kCPV: return "kCPV";
58 case kPMD: return "kPMD";
59 case kMUONTRK: return "kMUONTRK";
60 case kMUONTRG: return "kMUONTRG";
61 case kFMD: return "kFMD";
62 case kT0: return "kT0";
63 case kV0: return "kV0";
64 case kZDC: return "kZDC";
65 case kACORDE: return "kACORDE";
66 case kTRG: return "kTRG";
67 case kEMCAL: return "kEMCAL";
68 case kDAQTEST: return "kDAQTEST";
69 case kHLT: return "kHLT";
70 case kALLDET: return "kALLDET";
71 default: return "UNKNOWN!";
72 }
73}
74
75
76AliHLTReadoutList::AliHLTReadoutList() :
77 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
78 fReadoutList()
79{
80 // Default constructor.
81
82 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
83 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
84}
85
86
87AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
88 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
89 fReadoutList()
90{
91 // Constructor to select which detectors to enable for readout.
92 // See header file for more details.
93
94 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
95 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
96 Enable(enabledDetectors);
97}
98
99
100AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
101 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
102 fReadoutList()
103{
104 // Constructor to select which detectors and DDLs to enable for readout.
105 // See header file for more details.
106
107 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
108 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
109
110 TString str(enabledList);
111 str.ToUpper();
112 Int_t enabledDetectors = 0;
113 if (str.Contains("ITSSPD")) enabledDetectors |= kITSSPD;
114 if (str.Contains("ITSSDD")) enabledDetectors |= kITSSDD;
115 if (str.Contains("ITSSSD")) enabledDetectors |= kITSSSD;
116 if (str.Contains("TPC")) enabledDetectors |= kTPC;
117 if (str.Contains("TRD")) enabledDetectors |= kTRD;
118 if (str.Contains("TOF")) enabledDetectors |= kTOF;
119 if (str.Contains("HMPID")) enabledDetectors |= kHMPID;
120 if (str.Contains("PHOS")) enabledDetectors |= kPHOS;
121 if (str.Contains("CPV")) enabledDetectors |= kCPV;
122 if (str.Contains("PMD")) enabledDetectors |= kPMD;
123 if (str.Contains("MUONTRK")) enabledDetectors |= kMUONTRK;
124 if (str.Contains("MUONTRG")) enabledDetectors |= kMUONTRG;
125 if (str.Contains("FMD")) enabledDetectors |= kFMD;
126 if (str.Contains("T0")) enabledDetectors |= kT0;
127 if (str.Contains("V0")) enabledDetectors |= kV0;
128 if (str.Contains("ZDC")) enabledDetectors |= kZDC;
129 if (str.Contains("ACORDE")) enabledDetectors |= kACORDE;
130 if (str.Contains("TRG")) enabledDetectors |= kTRG;
131 if (str.Contains("EMCAL")) enabledDetectors |= kEMCAL;
132 if (str.Contains("DAQTEST")) enabledDetectors |= kDAQTEST;
133 if (str.Contains("HLT")) enabledDetectors |= kHLT;
134 if (str.Contains("ALL")) enabledDetectors |= kALLDET;
135 Enable(enabledDetectors);
136
137 TObjArray* list = str.Tokenize(" ");
138 TIter next(list);
139 const TObjString* objstr = NULL;
140 while ((objstr = dynamic_cast<const TObjString*>(next())) != NULL)
141 {
142 str = objstr->GetString();
143 if (str.IsDigit()) EnableDDLBit(str.Atoi());
144 }
145 delete list;
146}
147
148
149AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
150 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
151 fReadoutList()
152{
153 // Constructor to create readout list from AliHLTEventDDL structure.
154 // See header file for more details.
155 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
156 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
157 // Handle lists of different sizes. If the size is for a known version
158 // of AliHLTEventDDL then handle appropriately, otherwise just copy only
159 // the overlapping part of the list.
160 if (list.fCount == gkAliHLTDDLListSizeV0)
161 {
162 memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*28);
163 memcpy(&fReadoutList.fList[29], &list.fList[28], sizeof(AliHLTUInt32_t)*2);
164 }
165 else if (list.fCount == gkAliHLTDDLListSizeV1)
166 {
167 memcpy(&fReadoutList.fList, &list.fList, sizeof(AliHLTEventDDL));
168 }
169 else
170 {
171 memcpy(&fReadoutList.fList, &list.fList, (fReadoutList.fCount<list.fCount?fReadoutList.fCount:list.fCount)*sizeof(AliHLTUInt32_t));
172 }
173}
174
175
176AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
177 TNamed(list),
178 fReadoutList()
179{
180 // Copy constructor performs a deep copy.
181
182 memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
183}
184
185
186AliHLTReadoutList::~AliHLTReadoutList()
187{
188 // Default destructor.
189}
190
191
192bool AliHLTReadoutList::Empty() const
193{
194 // Returns true if the readout list has no DDLs enabled.
195
196 for (size_t i = 0; i < sizeof(fReadoutList.fList) / sizeof(fReadoutList.fList[0]); i++)
197 {
198 if (fReadoutList.fList[i] != 0x0) return false;
199 }
200 return true;
201}
202
203
204void AliHLTReadoutList::Clear(Option_t* /*option*/)
205{
206 // Resets all the DDL readout bits.
207 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
208}
209
210
211bool AliHLTReadoutList::DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex)
212{
213 // Decodes the word index and bit index within that word for the readout list structure.
214 // See header file for more details.
215
216 // The detector number is bits 15..8 of ddlId and DDL number is bits 7..0.
217 Int_t detNum = ddlId >> 8;
218 Int_t ddlNum = ddlId & 0xFF;
219
220 switch (detNum)
221 {
222 case 0: // SPD
223 case 1: // SDD
224 case 2: // SSD
225 if (ddlNum >= 32) return false; // only have 1 32-bit word.
226 // the 3 ITS detectors have one word each
227 wordIndex = detNum;
228 break;
229 case 3: // TPC
230 // the TPC bitfield has in total 8 words
231 wordIndex = detNum + (ddlNum >> 5);
232 break;
233 case 4: // TRD
234 if (ddlNum >= 32) return false; // only have 1 32-bit word.
235 // the TRD bitfield starts at word 11 (3 words ITS + 8 words TPC)
236 wordIndex = 11;
237 break;
238 case 5: // TOF
239 if (ddlNum >= 3*32) return false; // only have 3 32-bit words.
240 // TOF has 72 DDLs, the bitfield is 3 words starting at position 12
241 wordIndex = 12 + (ddlNum >> 5);
242 break;
243 case 6: // HMPID
244 case 7: // PHOS
245 case 8: // CPV
246 case 9: // PMD
247 case 10: // MUONTRK (MCH)
248 case 11: // MUONTRG (MTR)
249 case 12: // FMD
250 case 13: // T0
251 case 14: // V0
252 case 15: // ZDC
253 case 16: // ACORDE
254 case 17: // TRG
255 if (ddlNum >= 32) return false; // only have 1 32-bit word.
256 // all these detectors fit into one word, the offset is due to
257 // TPC and TOF
258 wordIndex = detNum + 9;
259 break;
260 case 18: // EMCAL
261 if (ddlNum >= 2*32) return false; // only have 2 32-bit words.
262 // 2 words for EMCAL + DCAL
263 wordIndex = detNum + 7;
264 wordIndex = 27 + (ddlNum >> 5);
265 break;
266 case 19: // DAQTEST
267 if (ddlNum >= 32) return false; // only have 1 32-bit word.
268 wordIndex = 29;
269 break;
270 case 30: // HLT
271 if (ddlNum >= 32) return false; // only have 1 32-bit word.
272 // the HLT bitfield is in the last word
273 wordIndex = 30;
274 break;
275 default:
276 return false;
277 }
278
279 if (ddlNum >= AliHLTDAQ::NumberOfDdls(detNum == 30 ? 20 : detNum)) return false;
280
281 // The bit index within the word indicated by wordIndex.
282 bitIndex = ddlNum % 32;
283 return true;
284}
285
286
287Bool_t AliHLTReadoutList::GetDDLBit(Int_t ddlId) const
288{
289 // Fetches the bit value for a particular DDL in the readout list.
290 // See header file for more details.
291
292 Int_t wordIndex, bitIndex;
293 if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return kFALSE;
294 return ((fReadoutList.fList[wordIndex] >> bitIndex) & 0x1) == 0x1;
295}
296
297
298void AliHLTReadoutList::SetDDLBit(Int_t ddlId, Bool_t state)
299{
300 // Sets the bit value for a particular DDL in the readout list.
301 // See header file for more details.
302
303 Int_t wordIndex, bitIndex;
304 if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return;
305
306 // To set, 'OR' word with bit mask
307 if ( state )
308 fReadoutList.fList[wordIndex] |= (0x00000001 << bitIndex);
309 // To unset, 'AND' word with bit mask
310 else
311 fReadoutList.fList[wordIndex] &= (0xFFFFFFFF ^ (0x00000001 << bitIndex));
312}
313
314
315void AliHLTReadoutList::Enable(Int_t detector)
316{
317 // Enables all DDLs for a particular detector or detectors.
318 // See header file for more details.
319
320 if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x000FFFFF;
321 if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00FFFFFF;
322 if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x0000FFFF;
323 if ((detector & kTPC) != 0)
324 {
325 fReadoutList.fList[3] = 0xFFFFFFFF;
326 fReadoutList.fList[4] = 0xFFFFFFFF;
327 fReadoutList.fList[5] = 0xFFFFFFFF;
328 fReadoutList.fList[6] = 0xFFFFFFFF;
329 fReadoutList.fList[7] = 0xFFFFFFFF;
330 fReadoutList.fList[8] = 0xFFFFFFFF;
331 fReadoutList.fList[9] = 0x00FFFFFF;
332 fReadoutList.fList[10] = 0x00000000;
333 }
334 if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x0003FFFF;
335 if ((detector & kTOF) != 0)
336 {
337 fReadoutList.fList[12] = 0xFFFFFFFF;
338 fReadoutList.fList[13] = 0xFFFFFFFF;
339 fReadoutList.fList[14] = 0x000000FF;
340 }
341 if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x000FFFFF;
342 if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x000FFFFF;
343 if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x000003FF;
344 if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x0000003F;
345 if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x000FFFFF;
346 if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000003;
347 if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000007;
348 if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000001;
349 if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000001;
350 if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000001;
351 if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000001;
352 if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000001;
353 if ((detector & kEMCAL) != 0)
354 {
355 fReadoutList.fList[27] = 0xFFFFFFFF;
356 fReadoutList.fList[28] = 0x00003FFF;
357 }
358 if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000001;
359 if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x000003FF;
360}
361
362
363void AliHLTReadoutList::Disable(Int_t detector)
364{
365 // Disables all DDLs for a particular detector or detectors.
366 // See header file for more details.
367
368 if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x00000000;
369 if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00000000;
370 if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x00000000;
371 if ((detector & kTPC) != 0)
372 {
373 fReadoutList.fList[3] = 0x00000000;
374 fReadoutList.fList[4] = 0x00000000;
375 fReadoutList.fList[5] = 0x00000000;
376 fReadoutList.fList[6] = 0x00000000;
377 fReadoutList.fList[7] = 0x00000000;
378 fReadoutList.fList[8] = 0x00000000;
379 fReadoutList.fList[9] = 0x00000000;
380 fReadoutList.fList[10] = 0x00000000;
381 }
382 if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x00000000;
383 if ((detector & kTOF) != 0)
384 {
385 fReadoutList.fList[12] = 0x00000000;
386 fReadoutList.fList[13] = 0x00000000;
387 fReadoutList.fList[14] = 0x00000000;
388 }
389 if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x00000000;
390 if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x00000000;
391 if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x00000000;
392 if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x00000000;
393 if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x00000000;
394 if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000000;
395 if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000000;
396 if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000000;
397 if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000000;
398 if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000000;
399 if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000000;
400 if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000000;
401 if ((detector & kEMCAL) != 0)
402 {
403 fReadoutList.fList[27] = 0x00000000;
404 fReadoutList.fList[28] = 0x00000000;
405 }
406 if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000000;
407 if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x00000000;
408}
409
410
411bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
412{
413 // Checks if a particular detector's DDLs are enabled.
414 // See header file for more details.
415
416 bool result = true;
417 if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x000FFFFF;
418 if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00FFFFFF;
419 if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x0000FFFF;
420 if ((detector & kTPC) != 0)
421 {
422 result &= fReadoutList.fList[3] == 0xFFFFFFFF;
423 result &= fReadoutList.fList[4] == 0xFFFFFFFF;
424 result &= fReadoutList.fList[5] == 0xFFFFFFFF;
425 result &= fReadoutList.fList[6] == 0xFFFFFFFF;
426 result &= fReadoutList.fList[7] == 0xFFFFFFFF;
427 result &= fReadoutList.fList[8] == 0xFFFFFFFF;
428 result &= fReadoutList.fList[9] == 0x00FFFFFF;
429 }
430 if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x0003FFFF;
431 if ((detector & kTOF) != 0)
432 {
433 result &= fReadoutList.fList[12] == 0xFFFFFFFF;
434 result &= fReadoutList.fList[13] == 0xFFFFFFFF;
435 result &= fReadoutList.fList[14] == 0x000000FF;
436 }
437 if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x000FFFFF;
438 if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x000FFFFF;
439 if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x000003FF;
440 if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x0000003F;
441 if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x000FFFFF;
442 if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000003;
443 if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000007;
444 if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000001;
445 if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000001;
446 if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000001;
447 if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000001;
448 if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000001;
449 if ((detector & kEMCAL) != 0)
450 {
451 result &= fReadoutList.fList[27] == 0xFFFFFFFF;
452 result &= fReadoutList.fList[28] == 0x00003FFF;
453 }
454 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000001;
455 if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x000003FF;
456
457 return result;
458}
459
460
461bool AliHLTReadoutList::DetectorDisabled(Int_t detector) const
462{
463 // Checks if a particular detector's DDLs are disabled.
464 // See header file for more details.
465
466 bool result = true;
467 if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x00000000;
468 if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00000000;
469 if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x00000000;
470 if ((detector & kTPC) != 0)
471 {
472 result &= fReadoutList.fList[3] == 0x00000000;
473 result &= fReadoutList.fList[4] == 0x00000000;
474 result &= fReadoutList.fList[5] == 0x00000000;
475 result &= fReadoutList.fList[6] == 0x00000000;
476 result &= fReadoutList.fList[7] == 0x00000000;
477 result &= fReadoutList.fList[8] == 0x00000000;
478 result &= fReadoutList.fList[9] == 0x00000000;
479 }
480 if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x00000000;
481 if ((detector & kTOF) != 0)
482 {
483 result &= fReadoutList.fList[12] == 0x00000000;
484 result &= fReadoutList.fList[13] == 0x00000000;
485 result &= fReadoutList.fList[14] == 0x00000000;
486 }
487 if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x00000000;
488 if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x00000000;
489 if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x00000000;
490 if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x00000000;
491 if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x00000000;
492 if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000000;
493 if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000000;
494 if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000000;
495 if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000000;
496 if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000000;
497 if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000000;
498 if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000000;
499 if ((detector & kEMCAL) != 0)
500 {
501 result &= fReadoutList.fList[27] == 0x00000000;
502 result &= fReadoutList.fList[28] == 0x00000000;
503 }
504 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
505 if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x00000000;
506
507 return result;
508}
509
510
511Int_t AliHLTReadoutList::GetFirstWord(EDetectorId detector)
512{
513 // See header file for more details.
514 switch (detector)
515 {
516 case kITSSPD: return 0;
517 case kITSSDD: return 1;
518 case kITSSSD: return 2;
519 case kTPC: return 3;
520 case kTRD: return 11;
521 case kTOF: return 12;
522 case kHMPID: return 15;
523 case kPHOS: return 16;
524 case kCPV: return 17;
525 case kPMD: return 18;
526 case kMUONTRK: return 19;
527 case kMUONTRG: return 20;
528 case kFMD: return 21;
529 case kT0: return 22;
530 case kV0: return 23;
531 case kZDC: return 24;
532 case kACORDE: return 25;
533 case kTRG: return 26;
534 case kEMCAL: return 27;
535 case kDAQTEST: return 29;
536 case kHLT: return 30;
537 default: return -1;
538 }
539}
540
541
542Int_t AliHLTReadoutList::GetWordCount(EDetectorId detector)
543{
544 // See header file for more details.
545 switch (detector)
546 {
547 case kITSSPD: return 1;
548 case kITSSDD: return 1;
549 case kITSSSD: return 1;
550 case kTPC: return 8;
551 case kTRD: return 1;
552 case kTOF: return 3;
553 case kHMPID: return 1;
554 case kPHOS: return 1;
555 case kCPV: return 1;
556 case kPMD: return 1;
557 case kMUONTRK: return 1;
558 case kMUONTRG: return 1;
559 case kFMD: return 1;
560 case kT0: return 1;
561 case kV0: return 1;
562 case kZDC: return 1;
563 case kACORDE: return 1;
564 case kTRG: return 1;
565 case kEMCAL: return 2;
566 case kDAQTEST: return 1;
567 case kHLT: return 1;
568 default: return 0;
569 }
570}
571
572
573AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetFirstUsedDetector(EDetectorId startAfter) const
574{
575 // See header file for more details.
576 if (startAfter < kITSSPD and fReadoutList.fList[0] != 0x00000000) return kITSSPD;
577 if (startAfter < kITSSDD and fReadoutList.fList[1] != 0x00000000) return kITSSDD;
578 if (startAfter < kITSSSD and fReadoutList.fList[2] != 0x00000000) return kITSSSD;
579 if (startAfter < kTPC and fReadoutList.fList[3] != 0x00000000) return kTPC;
580 if (startAfter < kTPC and fReadoutList.fList[4] != 0x00000000) return kTPC;
581 if (startAfter < kTPC and fReadoutList.fList[5] != 0x00000000) return kTPC;
582 if (startAfter < kTPC and fReadoutList.fList[6] != 0x00000000) return kTPC;
583 if (startAfter < kTPC and fReadoutList.fList[7] != 0x00000000) return kTPC;
584 if (startAfter < kTPC and fReadoutList.fList[8] != 0x00000000) return kTPC;
585 if (startAfter < kTPC and fReadoutList.fList[9] != 0x00000000) return kTPC;
586 if (startAfter < kTPC and fReadoutList.fList[10] != 0x00000000) return kTPC;
587 if (startAfter < kTRD and fReadoutList.fList[11] != 0x00000000) return kTRD;
588 if (startAfter < kTOF and fReadoutList.fList[12] != 0x00000000) return kTOF;
589 if (startAfter < kTOF and fReadoutList.fList[13] != 0x00000000) return kTOF;
590 if (startAfter < kTOF and fReadoutList.fList[14] != 0x00000000) return kTOF;
591 if (startAfter < kHMPID and fReadoutList.fList[15] != 0x00000000) return kHMPID;
592 if (startAfter < kPHOS and fReadoutList.fList[16] != 0x00000000) return kPHOS;
593 if (startAfter < kCPV and fReadoutList.fList[17] != 0x00000000) return kCPV;
594 if (startAfter < kPMD and fReadoutList.fList[18] != 0x00000000) return kPMD;
595 if (startAfter < kMUONTRK and fReadoutList.fList[19] != 0x00000000) return kMUONTRK;
596 if (startAfter < kMUONTRG and fReadoutList.fList[20] != 0x00000000) return kMUONTRG;
597 if (startAfter < kFMD and fReadoutList.fList[21] != 0x00000000) return kFMD;
598 if (startAfter < kT0 and fReadoutList.fList[22] != 0x00000000) return kT0;
599 if (startAfter < kV0 and fReadoutList.fList[23] != 0x00000000) return kV0;
600 if (startAfter < kZDC and fReadoutList.fList[24] != 0x00000000) return kZDC;
601 if (startAfter < kACORDE and fReadoutList.fList[25] != 0x00000000) return kACORDE;
602 if (startAfter < kTRG and fReadoutList.fList[26] != 0x00000000) return kTRG;
603 if (startAfter < kEMCAL and fReadoutList.fList[27] != 0x00000000) return kEMCAL;
604 if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
605 if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
606 if (startAfter < kHLT and fReadoutList.fList[30] != 0x00000000) return kHLT;
607 return kNoDetector;
608}
609
610
611void AliHLTReadoutList::Print(Option_t* /*option*/) const
612{
613 // Prints the DDLs that will be readout according to this readout list.
614
615 cout << "Readout enabled for DDLs:" << endl;
616 for (Int_t i = 0; i < AliHLTDAQ::NumberOfDetectors(); i++)
617 {
618 Int_t maxddls = AliHLTDAQ::NumberOfDdls(i);
619 cout << AliHLTDAQ::DetectorName(i) << ":";
620 bool nonefound = true;
621 for (Int_t j = 0; j < maxddls; j++)
622 {
623 Int_t ddlId = ( ((i == AliHLTDAQ::NumberOfDetectors()-1) ? 30 : i) << 8 ) + j;
624 if (GetDDLBit(ddlId))
625 {
626 cout << " " << ddlId;
627 nonefound = false;
628 }
629 }
630 if (nonefound) cout << " none";
631 cout << endl;
632 }
633}
634
635
636AliHLTReadoutList& AliHLTReadoutList::operator = (const AliHLTReadoutList& list)
637{
638 // Assignment operator performs a deep copy.
639
640 TObject::operator = (list);
641 if (&list != this)
642 {
643 memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
644 }
645 return *this;
646}
647
648
649AliHLTReadoutList& AliHLTReadoutList::operator |= (const AliHLTReadoutList& list)
650{
651 // This operator performs a bitwise inclusive or operation on all DDL bits.
652 // See header file for more details.
653 this->OrEq(list);
654 return *this;
655}
656
657AliHLTReadoutList& AliHLTReadoutList::OrEq(const AliHLTReadoutList& list)
658{
659 // a bitwise inclusive or operation on all DDL bits.
660 // See header file for more details.
661
662 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
663 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
664 {
665 fReadoutList.fList[i] |= list.fReadoutList.fList[i];
666 }
667 return *this;
668}
669
670
671AliHLTReadoutList& AliHLTReadoutList::operator ^= (const AliHLTReadoutList& list)
672{
673 // This operator performs a bitwise exclusive or (xor) operation on all DDL bits.
674 // See header file for more details.
675
676 this->XorEq(list);
677 return *this;
678}
679
680AliHLTReadoutList& AliHLTReadoutList::XorEq(const AliHLTReadoutList& list)
681{
682 // bitwise exclusive or (xor) operation on all DDL bits.
683 // See header file for more details.
684
685 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
686 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
687 {
688 fReadoutList.fList[i] ^= list.fReadoutList.fList[i];
689 }
690 return *this;
691}
692
693
694AliHLTReadoutList& AliHLTReadoutList::operator &= (const AliHLTReadoutList& list)
695{
696 // This operator performs a bitwise and operation on all DDL bits.
697 // See header file for more details.
698
699 this->AndEq(list);
700 return *this;
701}
702
703AliHLTReadoutList& AliHLTReadoutList::AndEq(const AliHLTReadoutList& list)
704{
705 // bitwise and operation on all DDL bits.
706 // See header file for more details.
707
708 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
709 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
710 {
711 fReadoutList.fList[i] &= list.fReadoutList.fList[i];
712 }
713 return *this;
714}
715
716AliHLTReadoutList& AliHLTReadoutList::operator -= (const AliHLTReadoutList& list)
717{
718 // This operator removes all the DDLs specified in list from this readout list.
719 // See header file for more details.
720
721 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
722 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
723 {
724 // Effectively apply: this = this & (~ (this & list))
725 // i.e. this = this & (this ^ list)
726 fReadoutList.fList[i] &= fReadoutList.fList[i] ^ list.fReadoutList.fList[i];
727 }
728 return *this;
729}
730
731
732AliHLTReadoutList AliHLTReadoutList::operator ~ () const
733{
734 // This operator performs a bitwise ones compliment on all DDL bits.
735 // See header file for more details.
736
737 AliHLTReadoutList readoutlist;
738 readoutlist.fReadoutList.fCount = fReadoutList.fCount;
739 readoutlist.fReadoutList.fList[0] = 0x000FFFFF & (~fReadoutList.fList[0]);
740 readoutlist.fReadoutList.fList[1] = 0x00FFFFFF & (~fReadoutList.fList[1]);
741 readoutlist.fReadoutList.fList[2] = 0x0000FFFF & (~fReadoutList.fList[2]);
742 readoutlist.fReadoutList.fList[3] = 0xFFFFFFFF & (~fReadoutList.fList[3]);
743 readoutlist.fReadoutList.fList[4] = 0xFFFFFFFF & (~fReadoutList.fList[4]);
744 readoutlist.fReadoutList.fList[5] = 0xFFFFFFFF & (~fReadoutList.fList[5]);
745 readoutlist.fReadoutList.fList[6] = 0xFFFFFFFF & (~fReadoutList.fList[6]);
746 readoutlist.fReadoutList.fList[7] = 0xFFFFFFFF & (~fReadoutList.fList[7]);
747 readoutlist.fReadoutList.fList[8] = 0xFFFFFFFF & (~fReadoutList.fList[8]);
748 readoutlist.fReadoutList.fList[9] = 0x00FFFFFF & (~fReadoutList.fList[9]);
749 readoutlist.fReadoutList.fList[10] = 0x00000000 & (~fReadoutList.fList[10]);
750 readoutlist.fReadoutList.fList[11] = 0x0003FFFF & (~fReadoutList.fList[11]);
751 readoutlist.fReadoutList.fList[12] = 0xFFFFFFFF & (~fReadoutList.fList[12]);
752 readoutlist.fReadoutList.fList[13] = 0xFFFFFFFF & (~fReadoutList.fList[13]);
753 readoutlist.fReadoutList.fList[14] = 0x000000FF & (~fReadoutList.fList[14]);
754 readoutlist.fReadoutList.fList[15] = 0x000FFFFF & (~fReadoutList.fList[15]);
755 readoutlist.fReadoutList.fList[16] = 0x000FFFFF & (~fReadoutList.fList[16]);
756 readoutlist.fReadoutList.fList[17] = 0x000003FF & (~fReadoutList.fList[17]);
757 readoutlist.fReadoutList.fList[18] = 0x0000003F & (~fReadoutList.fList[18]);
758 readoutlist.fReadoutList.fList[19] = 0x000FFFFF & (~fReadoutList.fList[19]);
759 readoutlist.fReadoutList.fList[20] = 0x00000003 & (~fReadoutList.fList[20]);
760 readoutlist.fReadoutList.fList[21] = 0x00000007 & (~fReadoutList.fList[21]);
761 readoutlist.fReadoutList.fList[22] = 0x00000001 & (~fReadoutList.fList[22]);
762 readoutlist.fReadoutList.fList[23] = 0x00000001 & (~fReadoutList.fList[23]);
763 readoutlist.fReadoutList.fList[24] = 0x00000001 & (~fReadoutList.fList[24]);
764 readoutlist.fReadoutList.fList[25] = 0x00000001 & (~fReadoutList.fList[25]);
765 readoutlist.fReadoutList.fList[26] = 0x00000001 & (~fReadoutList.fList[26]);
766 readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
767 readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
768 readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[29]);
769 readoutlist.fReadoutList.fList[30] = 0x000003FF & (~fReadoutList.fList[30]);
770 return readoutlist;
771}
772