2 /**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
6 * Primary Authors: Artur Szostak <artursz@iafrica.com> *
7 * for The ALICE HLT Project. *
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 **************************************************************************/
18 /// @file AliHLTReadoutList.cxx
19 /// @author Artur Szostak <artursz@iafrica.com>
21 /// @brief Implementation of the AliHLTReadoutList class.
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.
32 #include "AliHLTReadoutList.h"
33 #include "AliHLTDAQ.h"
34 #include "Riostream.h"
36 #include "TObjString.h"
37 #include "TObjArray.h"
40 ClassImp(AliHLTReadoutList)
43 const char* AliHLTReadoutList::DetectorIdToString(EDetectorId id)
45 // Converts a detector ID to a user readable string.
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!";
76 AliHLTReadoutList::AliHLTReadoutList() :
77 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
80 // Default constructor.
82 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
83 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
87 AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
88 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
91 // Constructor to select which detectors to enable for readout.
92 // See header file for more details.
94 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
95 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
96 Enable(enabledDetectors);
100 AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
101 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
104 // Constructor to select which detectors and DDLs to enable for readout.
105 // See header file for more details.
107 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
108 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
110 TString str(enabledList);
112 Int_t enabledDetectors = 0;
113 TObjArray* list = str.Tokenize(" ");
115 const TObjString* objstr = NULL;
116 while ((objstr = dynamic_cast<const TObjString*>(next())) != NULL)
118 str = objstr->GetString();
119 if (str.IsDigit()) EnableDDLBit(str.Atoi());
120 if (str == "ITSSPD") enabledDetectors |= kITSSPD;
121 if (str == "ITSSDD") enabledDetectors |= kITSSDD;
122 if (str == "ITSSSD") enabledDetectors |= kITSSSD;
123 if (str == "TPC") enabledDetectors |= kTPC;
124 if (str == "TRD") enabledDetectors |= kTRD;
125 if (str == "TOF") enabledDetectors |= kTOF;
126 if (str == "HMPID") enabledDetectors |= kHMPID;
127 if (str == "PHOS") enabledDetectors |= kPHOS;
128 if (str == "CPV") enabledDetectors |= kCPV;
129 if (str == "PMD") enabledDetectors |= kPMD;
130 if (str == "MUONTRK") enabledDetectors |= kMUONTRK;
131 if (str == "MUONTRG") enabledDetectors |= kMUONTRG;
132 if (str == "FMD") enabledDetectors |= kFMD;
133 if (str == "T0") enabledDetectors |= kT0;
134 if (str == "V0") enabledDetectors |= kV0;
135 if (str == "ZDC") enabledDetectors |= kZDC;
136 if (str == "ACORDE") enabledDetectors |= kACORDE;
137 if (str == "TRG") enabledDetectors |= kTRG;
138 if (str == "EMCAL") enabledDetectors |= kEMCAL;
139 if (str == "DAQTEST") enabledDetectors |= kDAQTEST;
140 if (str == "HLT") enabledDetectors |= kHLT;
141 if (str == "ALL") enabledDetectors |= kALLDET;
144 Enable(enabledDetectors);
148 AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
149 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
152 // Constructor to create readout list from AliHLTEventDDL structure.
153 // See header file for more details.
158 AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
162 // Copy constructor performs a deep copy.
164 if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
166 memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
175 void AliHLTReadoutList::FillStruct(const AliHLTEventDDL& list)
177 // Fills internal DDL bits structure.
179 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
180 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
181 // Handle lists of different sizes. If the size is for a known version
182 // of AliHLTEventDDL then handle appropriately, otherwise just copy only
183 // the overlapping part of the list.
184 if (list.fCount == (unsigned)gkAliHLTDDLListSizeV0)
186 memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*28);
187 memcpy(&fReadoutList.fList[29], &list.fList[28], sizeof(AliHLTUInt32_t)*2);
189 else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV1)
191 memcpy(&fReadoutList, &list, sizeof(AliHLTEventDDL));
195 memcpy(&fReadoutList.fList, &list.fList, (fReadoutList.fCount<list.fCount?fReadoutList.fCount:list.fCount)*sizeof(AliHLTUInt32_t));
200 AliHLTReadoutList::~AliHLTReadoutList()
202 // Default destructor.
206 bool AliHLTReadoutList::Empty() const
208 // Returns true if the readout list has no DDLs enabled.
210 for (size_t i = 0; i < sizeof(fReadoutList.fList) / sizeof(fReadoutList.fList[0]); i++)
212 if (fReadoutList.fList[i] != 0x0) return false;
218 void AliHLTReadoutList::Clear(Option_t* /*option*/)
220 // Resets all the DDL readout bits.
221 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
223 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
224 // Check if we need to convert to new format and do so.
225 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
227 fReadoutList.fCount = gkAliHLTDDLListSize;
233 bool AliHLTReadoutList::DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex)
235 // Decodes the word index and bit index within that word for the readout list structure.
236 // See header file for more details.
238 // The detector number is bits 15..8 of ddlId and DDL number is bits 7..0.
239 Int_t detNum = ddlId >> 8;
240 Int_t ddlNum = ddlId & 0xFF;
247 if (ddlNum >= 32) return false; // only have 1 32-bit word.
248 // the 3 ITS detectors have one word each
252 // the TPC bitfield has in total 8 words
253 wordIndex = detNum + (ddlNum >> 5);
256 if (ddlNum >= 32) return false; // only have 1 32-bit word.
257 // the TRD bitfield starts at word 11 (3 words ITS + 8 words TPC)
261 if (ddlNum >= 3*32) return false; // only have 3 32-bit words.
262 // TOF has 72 DDLs, the bitfield is 3 words starting at position 12
263 wordIndex = 12 + (ddlNum >> 5);
269 case 10: // MUONTRK (MCH)
270 case 11: // MUONTRG (MTR)
277 if (ddlNum >= 32) return false; // only have 1 32-bit word.
278 // all these detectors fit into one word, the offset is due to
280 wordIndex = detNum + 9;
283 if (ddlNum >= 2*32) return false; // only have 2 32-bit words.
284 // 2 words for EMCAL + DCAL
285 wordIndex = detNum + 7;
286 wordIndex = 27 + (ddlNum >> 5);
289 if (ddlNum >= 32) return false; // only have 1 32-bit word.
293 if (ddlNum >= 32) return false; // only have 1 32-bit word.
294 // the HLT bitfield is in the last word
301 if (ddlNum >= AliHLTDAQ::NumberOfDdls(detNum == 30 ? 20 : detNum)) return false;
303 // The bit index within the word indicated by wordIndex.
304 bitIndex = ddlNum % 32;
309 Bool_t AliHLTReadoutList::GetDDLBit(Int_t ddlId) const
311 // Fetches the bit value for a particular DDL in the readout list.
312 // See header file for more details.
314 Int_t wordIndex, bitIndex;
315 if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return kFALSE;
317 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
318 // Check if we need to convert to new format and do so.
319 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
323 if (bitIndex >= 24) return kFALSE;
325 else if (wordIndex == 28)
329 else if (wordIndex > 28)
336 return ((fReadoutList.fList[wordIndex] >> bitIndex) & 0x1) == 0x1;
340 void AliHLTReadoutList::SetDDLBit(Int_t ddlId, Bool_t state)
342 // Sets the bit value for a particular DDL in the readout list.
343 // See header file for more details.
345 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
346 // Check if we need to convert to new format and do so.
347 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
349 AliHLTEventDDL copy = fReadoutList;
353 assert(fReadoutList.fCount == gkAliHLTDDLListSize);
355 Int_t wordIndex, bitIndex;
356 if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return;
358 // To set, 'OR' word with bit mask
360 fReadoutList.fList[wordIndex] |= (0x00000001 << bitIndex);
361 // To unset, 'AND' word with bit mask
363 fReadoutList.fList[wordIndex] &= (0xFFFFFFFF ^ (0x00000001 << bitIndex));
367 void AliHLTReadoutList::Enable(Int_t detector)
369 // Enables all DDLs for a particular detector or detectors.
370 // See header file for more details.
372 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
373 // Check if we need to convert to new format and do so.
374 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
376 AliHLTEventDDL copy = fReadoutList;
380 assert(fReadoutList.fCount == gkAliHLTDDLListSize);
382 if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x000FFFFF;
383 if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00FFFFFF;
384 if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x0000FFFF;
385 if ((detector & kTPC) != 0)
387 fReadoutList.fList[3] = 0xFFFFFFFF;
388 fReadoutList.fList[4] = 0xFFFFFFFF;
389 fReadoutList.fList[5] = 0xFFFFFFFF;
390 fReadoutList.fList[6] = 0xFFFFFFFF;
391 fReadoutList.fList[7] = 0xFFFFFFFF;
392 fReadoutList.fList[8] = 0xFFFFFFFF;
393 fReadoutList.fList[9] = 0x00FFFFFF;
394 fReadoutList.fList[10] = 0x00000000;
396 if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x0003FFFF;
397 if ((detector & kTOF) != 0)
399 fReadoutList.fList[12] = 0xFFFFFFFF;
400 fReadoutList.fList[13] = 0xFFFFFFFF;
401 fReadoutList.fList[14] = 0x000000FF;
403 if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x000FFFFF;
404 if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x000FFFFF;
405 if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x000003FF;
406 if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x0000003F;
407 if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x000FFFFF;
408 if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000003;
409 if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000007;
410 if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000001;
411 if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000001;
412 if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000001;
413 if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000001;
414 if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000001;
415 if ((detector & kEMCAL) != 0)
417 fReadoutList.fList[27] = 0xFFFFFFFF;
418 fReadoutList.fList[28] = 0x00003FFF;
420 if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000001;
421 if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x0FFFFFFF;
425 void AliHLTReadoutList::Disable(Int_t detector)
427 // Disables all DDLs for a particular detector or detectors.
428 // See header file for more details.
430 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
431 // Check if we need to convert to new format and do so.
432 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
434 AliHLTEventDDL copy = fReadoutList;
438 assert(fReadoutList.fCount == gkAliHLTDDLListSize);
440 if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x00000000;
441 if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00000000;
442 if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x00000000;
443 if ((detector & kTPC) != 0)
445 fReadoutList.fList[3] = 0x00000000;
446 fReadoutList.fList[4] = 0x00000000;
447 fReadoutList.fList[5] = 0x00000000;
448 fReadoutList.fList[6] = 0x00000000;
449 fReadoutList.fList[7] = 0x00000000;
450 fReadoutList.fList[8] = 0x00000000;
451 fReadoutList.fList[9] = 0x00000000;
452 fReadoutList.fList[10] = 0x00000000;
454 if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x00000000;
455 if ((detector & kTOF) != 0)
457 fReadoutList.fList[12] = 0x00000000;
458 fReadoutList.fList[13] = 0x00000000;
459 fReadoutList.fList[14] = 0x00000000;
461 if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x00000000;
462 if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x00000000;
463 if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x00000000;
464 if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x00000000;
465 if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x00000000;
466 if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000000;
467 if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000000;
468 if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000000;
469 if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000000;
470 if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000000;
471 if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000000;
472 if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000000;
473 if ((detector & kEMCAL) != 0)
475 fReadoutList.fList[27] = 0x00000000;
476 fReadoutList.fList[28] = 0x00000000;
478 if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000000;
479 if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x00000000;
483 bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
485 // Checks if a particular detector's DDLs are enabled.
486 // See header file for more details.
489 if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x000FFFFF;
490 if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00FFFFFF;
491 if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x0000FFFF;
492 if ((detector & kTPC) != 0)
494 result &= fReadoutList.fList[3] == 0xFFFFFFFF;
495 result &= fReadoutList.fList[4] == 0xFFFFFFFF;
496 result &= fReadoutList.fList[5] == 0xFFFFFFFF;
497 result &= fReadoutList.fList[6] == 0xFFFFFFFF;
498 result &= fReadoutList.fList[7] == 0xFFFFFFFF;
499 result &= fReadoutList.fList[8] == 0xFFFFFFFF;
500 result &= fReadoutList.fList[9] == 0x00FFFFFF;
502 if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x0003FFFF;
503 if ((detector & kTOF) != 0)
505 result &= fReadoutList.fList[12] == 0xFFFFFFFF;
506 result &= fReadoutList.fList[13] == 0xFFFFFFFF;
507 result &= fReadoutList.fList[14] == 0x000000FF;
509 if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x000FFFFF;
510 if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x000FFFFF;
511 if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x000003FF;
512 if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x0000003F;
513 if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x000FFFFF;
514 if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000003;
515 if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000007;
516 if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000001;
517 if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000001;
518 if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000001;
519 if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000001;
520 if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000001;
521 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
522 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
524 if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00FFFFFF;
525 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000001;
526 if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x000003FF;
531 if ((detector & kEMCAL) != 0)
533 result &= fReadoutList.fList[27] == 0xFFFFFFFF;
534 result &= fReadoutList.fList[28] == 0x00003FFF;
536 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000001;
537 if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x0FFFFFFF;
544 bool AliHLTReadoutList::DetectorDisabled(Int_t detector) const
546 // Checks if a particular detector's DDLs are disabled.
547 // See header file for more details.
550 if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x00000000;
551 if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00000000;
552 if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x00000000;
553 if ((detector & kTPC) != 0)
555 result &= fReadoutList.fList[3] == 0x00000000;
556 result &= fReadoutList.fList[4] == 0x00000000;
557 result &= fReadoutList.fList[5] == 0x00000000;
558 result &= fReadoutList.fList[6] == 0x00000000;
559 result &= fReadoutList.fList[7] == 0x00000000;
560 result &= fReadoutList.fList[8] == 0x00000000;
561 result &= fReadoutList.fList[9] == 0x00000000;
563 if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x00000000;
564 if ((detector & kTOF) != 0)
566 result &= fReadoutList.fList[12] == 0x00000000;
567 result &= fReadoutList.fList[13] == 0x00000000;
568 result &= fReadoutList.fList[14] == 0x00000000;
570 if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x00000000;
571 if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x00000000;
572 if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x00000000;
573 if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x00000000;
574 if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x00000000;
575 if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000000;
576 if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000000;
577 if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000000;
578 if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000000;
579 if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000000;
580 if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000000;
581 if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000000;
582 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
583 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
585 if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00000000;
586 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000000;
587 if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x00000000;
592 if ((detector & kEMCAL) != 0)
594 result &= fReadoutList.fList[27] == 0x00000000;
595 result &= fReadoutList.fList[28] == 0x00000000;
597 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
598 if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x00000000;
605 Int_t AliHLTReadoutList::GetFirstWord(EDetectorId detector)
607 // See header file for more details.
610 case kITSSPD: return 0;
611 case kITSSDD: return 1;
612 case kITSSSD: return 2;
614 case kTRD: return 11;
615 case kTOF: return 12;
616 case kHMPID: return 15;
617 case kPHOS: return 16;
618 case kCPV: return 17;
619 case kPMD: return 18;
620 case kMUONTRK: return 19;
621 case kMUONTRG: return 20;
622 case kFMD: return 21;
625 case kZDC: return 24;
626 case kACORDE: return 25;
627 case kTRG: return 26;
628 case kEMCAL: return 27;
629 case kDAQTEST: return 29;
630 case kHLT: return 30;
636 Int_t AliHLTReadoutList::GetWordCount(EDetectorId detector)
638 // See header file for more details.
641 case kITSSPD: return 1;
642 case kITSSDD: return 1;
643 case kITSSSD: return 1;
647 case kHMPID: return 1;
648 case kPHOS: return 1;
651 case kMUONTRK: return 1;
652 case kMUONTRG: return 1;
657 case kACORDE: return 1;
659 case kEMCAL: return 2;
660 case kDAQTEST: return 1;
667 AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetDetectorFromWord(Int_t wordindex)
669 // See header file for more details.
672 case 0: return kITSSPD;
673 case 1: return kITSSDD;
674 case 2: return kITSSSD;
682 case 10: return kTPC;
683 case 11: return kTRD;
684 case 12: return kTOF;
685 case 13: return kTOF;
686 case 14: return kTOF;
687 case 15: return kHMPID;
688 case 16: return kPHOS;
689 case 17: return kCPV;
690 case 18: return kPMD;
691 case 19: return kMUONTRK;
692 case 20: return kMUONTRG;
693 case 21: return kFMD;
696 case 24: return kZDC;
697 case 25: return kACORDE;
698 case 26: return kTRG;
699 case 27: return kEMCAL;
700 case 28: return kEMCAL;
701 case 29: return kDAQTEST;
702 case 30: return kHLT;
703 default: return kNoDetector;
708 AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetFirstUsedDetector(EDetectorId startAfter) const
710 // See header file for more details.
712 if (startAfter < kITSSPD and fReadoutList.fList[0] != 0x00000000) return kITSSPD;
713 if (startAfter < kITSSDD and fReadoutList.fList[1] != 0x00000000) return kITSSDD;
714 if (startAfter < kITSSSD and fReadoutList.fList[2] != 0x00000000) return kITSSSD;
715 if (startAfter < kTPC and fReadoutList.fList[3] != 0x00000000) return kTPC;
716 if (startAfter < kTPC and fReadoutList.fList[4] != 0x00000000) return kTPC;
717 if (startAfter < kTPC and fReadoutList.fList[5] != 0x00000000) return kTPC;
718 if (startAfter < kTPC and fReadoutList.fList[6] != 0x00000000) return kTPC;
719 if (startAfter < kTPC and fReadoutList.fList[7] != 0x00000000) return kTPC;
720 if (startAfter < kTPC and fReadoutList.fList[8] != 0x00000000) return kTPC;
721 if (startAfter < kTPC and fReadoutList.fList[9] != 0x00000000) return kTPC;
722 if (startAfter < kTPC and fReadoutList.fList[10] != 0x00000000) return kTPC;
723 if (startAfter < kTRD and fReadoutList.fList[11] != 0x00000000) return kTRD;
724 if (startAfter < kTOF and fReadoutList.fList[12] != 0x00000000) return kTOF;
725 if (startAfter < kTOF and fReadoutList.fList[13] != 0x00000000) return kTOF;
726 if (startAfter < kTOF and fReadoutList.fList[14] != 0x00000000) return kTOF;
727 if (startAfter < kHMPID and fReadoutList.fList[15] != 0x00000000) return kHMPID;
728 if (startAfter < kPHOS and fReadoutList.fList[16] != 0x00000000) return kPHOS;
729 if (startAfter < kCPV and fReadoutList.fList[17] != 0x00000000) return kCPV;
730 if (startAfter < kPMD and fReadoutList.fList[18] != 0x00000000) return kPMD;
731 if (startAfter < kMUONTRK and fReadoutList.fList[19] != 0x00000000) return kMUONTRK;
732 if (startAfter < kMUONTRG and fReadoutList.fList[20] != 0x00000000) return kMUONTRG;
733 if (startAfter < kFMD and fReadoutList.fList[21] != 0x00000000) return kFMD;
734 if (startAfter < kT0 and fReadoutList.fList[22] != 0x00000000) return kT0;
735 if (startAfter < kV0 and fReadoutList.fList[23] != 0x00000000) return kV0;
736 if (startAfter < kZDC and fReadoutList.fList[24] != 0x00000000) return kZDC;
737 if (startAfter < kACORDE and fReadoutList.fList[25] != 0x00000000) return kACORDE;
738 if (startAfter < kTRG and fReadoutList.fList[26] != 0x00000000) return kTRG;
739 if (startAfter < kEMCAL and fReadoutList.fList[27] != 0x00000000) return kEMCAL;
740 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
741 // Check if we need to convert to new format and do so.
742 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
744 if (startAfter < kDAQTEST and fReadoutList.fList[28] != 0x00000000) return kDAQTEST;
745 if (startAfter < kHLT and fReadoutList.fList[29] != 0x00000000) return kHLT;
750 if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
751 if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
752 if (startAfter < kHLT and fReadoutList.fList[30] != 0x00000000) return kHLT;
758 void AliHLTReadoutList::Print(Option_t* /*option*/) const
760 // Prints the DDLs that will be readout according to this readout list.
762 cout << "Readout enabled for DDLs:" << endl;
763 for (Int_t i = 0; i < AliHLTDAQ::NumberOfDetectors(); i++)
765 Int_t maxddls = AliHLTDAQ::NumberOfDdls(i);
766 cout << AliHLTDAQ::DetectorName(i) << ":";
767 bool nonefound = true;
768 for (Int_t j = 0; j < maxddls; j++)
770 Int_t ddlId = ( ((i == AliHLTDAQ::NumberOfDetectors()-1) ? 30 : i) << 8 ) + j;
771 if (GetDDLBit(ddlId))
773 cout << " " << ddlId;
777 if (nonefound) cout << " none";
783 AliHLTReadoutList& AliHLTReadoutList::operator = (const AliHLTReadoutList& list)
785 // Assignment operator performs a deep copy.
787 TObject::operator = (list);
790 if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
792 memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
803 AliHLTReadoutList& AliHLTReadoutList::operator |= (const AliHLTReadoutList& list)
805 // This operator performs a bitwise inclusive or operation on all DDL bits.
806 // See header file for more details.
811 AliHLTReadoutList& AliHLTReadoutList::OrEq(const AliHLTReadoutList& list)
813 // a bitwise inclusive or operation on all DDL bits.
814 // See header file for more details.
816 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
817 assert( fReadoutList.fCount == list.fReadoutList.fCount );
818 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
820 fReadoutList.fList[i] |= list.fReadoutList.fList[i];
826 AliHLTReadoutList& AliHLTReadoutList::operator ^= (const AliHLTReadoutList& list)
828 // This operator performs a bitwise exclusive or (xor) operation on all DDL bits.
829 // See header file for more details.
835 AliHLTReadoutList& AliHLTReadoutList::XorEq(const AliHLTReadoutList& list)
837 // bitwise exclusive or (xor) operation on all DDL bits.
838 // See header file for more details.
840 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
841 assert( fReadoutList.fCount == list.fReadoutList.fCount );
842 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
844 fReadoutList.fList[i] ^= list.fReadoutList.fList[i];
850 AliHLTReadoutList& AliHLTReadoutList::operator &= (const AliHLTReadoutList& list)
852 // This operator performs a bitwise and operation on all DDL bits.
853 // See header file for more details.
859 AliHLTReadoutList& AliHLTReadoutList::AndEq(const AliHLTReadoutList& list)
861 // bitwise and operation on all DDL bits.
862 // See header file for more details.
864 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
865 assert( fReadoutList.fCount == list.fReadoutList.fCount );
866 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
868 fReadoutList.fList[i] &= list.fReadoutList.fList[i];
873 AliHLTReadoutList& AliHLTReadoutList::operator -= (const AliHLTReadoutList& list)
875 // This operator removes all the DDLs specified in list from this readout list.
876 // See header file for more details.
878 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
879 assert( fReadoutList.fCount == list.fReadoutList.fCount );
880 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
882 // Effectively apply: this = this & (~ (this & list))
883 // i.e. this = this & (this ^ list)
884 fReadoutList.fList[i] &= fReadoutList.fList[i] ^ list.fReadoutList.fList[i];
890 AliHLTReadoutList AliHLTReadoutList::operator ~ () const
892 // This operator performs a bitwise ones compliment on all DDL bits.
893 // See header file for more details.
895 AliHLTReadoutList readoutlist;
896 readoutlist.fReadoutList.fCount = gkAliHLTDDLListSize;
897 readoutlist.fReadoutList.fList[0] = 0x000FFFFF & (~fReadoutList.fList[0]);
898 readoutlist.fReadoutList.fList[1] = 0x00FFFFFF & (~fReadoutList.fList[1]);
899 readoutlist.fReadoutList.fList[2] = 0x0000FFFF & (~fReadoutList.fList[2]);
900 readoutlist.fReadoutList.fList[3] = 0xFFFFFFFF & (~fReadoutList.fList[3]);
901 readoutlist.fReadoutList.fList[4] = 0xFFFFFFFF & (~fReadoutList.fList[4]);
902 readoutlist.fReadoutList.fList[5] = 0xFFFFFFFF & (~fReadoutList.fList[5]);
903 readoutlist.fReadoutList.fList[6] = 0xFFFFFFFF & (~fReadoutList.fList[6]);
904 readoutlist.fReadoutList.fList[7] = 0xFFFFFFFF & (~fReadoutList.fList[7]);
905 readoutlist.fReadoutList.fList[8] = 0xFFFFFFFF & (~fReadoutList.fList[8]);
906 readoutlist.fReadoutList.fList[9] = 0x00FFFFFF & (~fReadoutList.fList[9]);
907 readoutlist.fReadoutList.fList[10] = 0x00000000;// & (~fReadoutList.fList[10]); // Commented out the end part to suppress coverty warning.
908 readoutlist.fReadoutList.fList[11] = 0x0003FFFF & (~fReadoutList.fList[11]);
909 readoutlist.fReadoutList.fList[12] = 0xFFFFFFFF & (~fReadoutList.fList[12]);
910 readoutlist.fReadoutList.fList[13] = 0xFFFFFFFF & (~fReadoutList.fList[13]);
911 readoutlist.fReadoutList.fList[14] = 0x000000FF & (~fReadoutList.fList[14]);
912 readoutlist.fReadoutList.fList[15] = 0x000FFFFF & (~fReadoutList.fList[15]);
913 readoutlist.fReadoutList.fList[16] = 0x000FFFFF & (~fReadoutList.fList[16]);
914 readoutlist.fReadoutList.fList[17] = 0x000003FF & (~fReadoutList.fList[17]);
915 readoutlist.fReadoutList.fList[18] = 0x0000003F & (~fReadoutList.fList[18]);
916 readoutlist.fReadoutList.fList[19] = 0x000FFFFF & (~fReadoutList.fList[19]);
917 readoutlist.fReadoutList.fList[20] = 0x00000003 & (~fReadoutList.fList[20]);
918 readoutlist.fReadoutList.fList[21] = 0x00000007 & (~fReadoutList.fList[21]);
919 readoutlist.fReadoutList.fList[22] = 0x00000001 & (~fReadoutList.fList[22]);
920 readoutlist.fReadoutList.fList[23] = 0x00000001 & (~fReadoutList.fList[23]);
921 readoutlist.fReadoutList.fList[24] = 0x00000001 & (~fReadoutList.fList[24]);
922 readoutlist.fReadoutList.fList[25] = 0x00000001 & (~fReadoutList.fList[25]);
923 readoutlist.fReadoutList.fList[26] = 0x00000001 & (~fReadoutList.fList[26]);
924 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
925 // Check if we need to convert to new format and do so.
926 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
928 readoutlist.fReadoutList.fList[27] = 0x00FFFFFF & (~fReadoutList.fList[27]);
929 readoutlist.fReadoutList.fList[28] = 0x00000000;
930 readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[28]);
931 readoutlist.fReadoutList.fList[30] = 0x000003FF & (~fReadoutList.fList[29]);
936 readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
937 readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
938 readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[29]);
939 readoutlist.fReadoutList.fList[30] = 0x0FFFFFFF & (~fReadoutList.fList[30]);
944 #if ROOT_VERSION_CODE < ROOT_VERSION(5,26,0)
945 void AliHLTReadoutList::Streamer(TBuffer &R__b)
947 // Stream an object of class AliHLTReadoutList.
949 if (R__b.IsReading()) {
950 R__b.ReadClassBuffer(AliHLTReadoutList::Class(),this);
951 // Convert old structure to new version if necessary.
952 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
954 fReadoutList.fList[30] = fReadoutList.fList[29];
955 fReadoutList.fList[29] = fReadoutList.fList[28];
956 fReadoutList.fList[28] = 0x0;
957 fReadoutList.fCount = gkAliHLTDDLListSizeV1;
960 R__b.WriteClassBuffer(AliHLTReadoutList::Class(),this);
963 #endif // ROOT version check.