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"
35 #include "Riostream.h"
37 #include "TObjString.h"
38 #include "TObjArray.h"
41 ClassImp(AliHLTReadoutList)
44 const char* AliHLTReadoutList::DetectorIdToString(EDetectorId id)
46 // Converts a detector ID to a user readable string.
49 case kNoDetector: return "kNoDetector";
50 case kITSSPD: return "kITSSPD";
51 case kITSSDD: return "kITSSDD";
52 case kITSSSD: return "kITSSSD";
53 case kTPC: return "kTPC";
54 case kTRD: return "kTRD";
55 case kTOF: return "kTOF";
56 case kHMPID: return "kHMPID";
57 case kPHOS: return "kPHOS";
58 case kCPV: return "kCPV";
59 case kPMD: return "kPMD";
60 case kMUONTRK: return "kMUONTRK";
61 case kMUONTRG: return "kMUONTRG";
62 case kFMD: return "kFMD";
63 case kT0: return "kT0";
64 case kV0: return "kV0";
65 case kZDC: return "kZDC";
66 case kACORDE: return "kACORDE";
67 case kTRG: return "kTRG";
68 case kEMCAL: return "kEMCAL";
69 case kDAQTEST: return "kDAQTEST";
70 case kAD: return "kAD";
71 case kHLT: return "kHLT";
72 case kALLDET: return "kALLDET";
73 default: return "UNKNOWN!";
78 AliHLTReadoutList::AliHLTReadoutList() :
79 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
82 // Default constructor.
84 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
85 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
89 AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
90 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
93 // Constructor to select which detectors to enable for readout.
94 // See header file for more details.
96 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
97 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
98 Enable(enabledDetectors);
102 AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
103 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
106 // Constructor to select which detectors and DDLs to enable for readout.
107 // See header file for more details.
109 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
110 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
112 TString str(enabledList);
114 Int_t enabledDetectors = 0;
115 TObjArray* list = str.Tokenize(" ");
117 const TObjString* objstr = NULL;
118 while ((objstr = dynamic_cast<const TObjString*>(next())) != NULL)
120 str = objstr->GetString();
121 if (str.IsDigit()) EnableDDLBit(str.Atoi());
122 if (str == "ITSSPD") enabledDetectors |= kITSSPD;
123 if (str == "ITSSDD") enabledDetectors |= kITSSDD;
124 if (str == "ITSSSD") enabledDetectors |= kITSSSD;
125 if (str == "TPC") enabledDetectors |= kTPC;
126 if (str == "TRD") enabledDetectors |= kTRD;
127 if (str == "TOF") enabledDetectors |= kTOF;
128 if (str == "HMPID") enabledDetectors |= kHMPID;
129 if (str == "PHOS") enabledDetectors |= kPHOS;
130 if (str == "CPV") enabledDetectors |= kCPV;
131 if (str == "PMD") enabledDetectors |= kPMD;
132 if (str == "MUONTRK") enabledDetectors |= kMUONTRK;
133 if (str == "MUONTRG") enabledDetectors |= kMUONTRG;
134 if (str == "FMD") enabledDetectors |= kFMD;
135 if (str == "T0") enabledDetectors |= kT0;
136 if (str == "V0") enabledDetectors |= kV0;
137 if (str == "ZDC") enabledDetectors |= kZDC;
138 if (str == "ACORDE") enabledDetectors |= kACORDE;
139 if (str == "TRG") enabledDetectors |= kTRG;
140 if (str == "EMCAL") enabledDetectors |= kEMCAL;
141 if (str == "DAQTEST") enabledDetectors |= kDAQTEST;
142 if (str == "AD") enabledDetectors |= kAD;
143 if (str == "HLT") enabledDetectors |= kHLT;
144 if (str == "ALL") enabledDetectors |= kALLDET;
147 Enable(enabledDetectors);
151 AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
152 TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
155 // Constructor to create readout list from AliHLTEventDDL structure.
156 // See header file for more details.
161 AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
165 // Copy constructor performs a deep copy.
167 if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
169 memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
178 void AliHLTReadoutList::FillStruct(const AliHLTEventDDL& list)
180 // Fills internal DDL bits structure.
182 fReadoutList.fCount = gkAliHLTDDLListSize; // Required by ALICE-INT-2007-015
183 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
184 // Handle lists of different sizes. If the size is for a known version
185 // of AliHLTEventDDL then handle appropriately, otherwise just copy only
186 // the overlapping part of the list.
187 if (list.fCount == (unsigned)gkAliHLTDDLListSizeV0)
189 memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*28); //up to EMCAL
190 //fReadoutList.fList[28] = 0x0; //by construction
191 fReadoutList.fList[29] = list.fList[28]; //DAQTEST
192 fReadoutList.fList[30] = 0x0; //AD
193 fReadoutList.fList[31] = list.fList[29]; //HLT
195 else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV1)
197 memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*30); //up to DAQTEST
198 fReadoutList.fList[31] = list.fList[30]; //HLT
199 fReadoutList.fList[30] = 0x0; //AD
201 else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV2)
203 memcpy(&fReadoutList, &list, sizeof(AliHLTEventDDL));
207 memcpy(&fReadoutList.fList, &list.fList, (fReadoutList.fCount<list.fCount?fReadoutList.fCount:list.fCount)*sizeof(AliHLTUInt32_t));
212 AliHLTReadoutList::~AliHLTReadoutList()
214 // Default destructor.
218 bool AliHLTReadoutList::Empty() const
220 // Returns true if the readout list has no DDLs enabled.
222 for (size_t i = 0; i < sizeof(fReadoutList.fList) / sizeof(fReadoutList.fList[0]); i++)
224 if (fReadoutList.fList[i] != 0x0) return false;
230 void AliHLTReadoutList::Clear(Option_t* /*option*/)
232 // Resets all the DDL readout bits.
233 memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
235 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
236 // Check if we need to convert to new format and do so.
237 if (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
239 fReadoutList.fCount = gkAliHLTDDLListSize;
245 bool AliHLTReadoutList::DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex)
247 // Decodes the word index and bit index within that word for the readout list structure.
248 // See header file for more details.
250 // The detector number is bits 15..8 of ddlId and DDL number is bits 7..0.
251 Int_t detNum = ddlId >> 8;
252 Int_t ddlNum = ddlId & 0xFF;
259 if (ddlNum >= 32) return false; // only have 1 32-bit word.
260 // the 3 ITS detectors have one word each
264 // the TPC bitfield has in total 8 words
265 wordIndex = detNum + (ddlNum >> 5);
268 if (ddlNum >= 32) return false; // only have 1 32-bit word.
269 // the TRD bitfield starts at word 11 (3 words ITS + 8 words TPC)
273 if (ddlNum >= 3*32) return false; // only have 3 32-bit words.
274 // TOF has 72 DDLs, the bitfield is 3 words starting at position 12
275 wordIndex = 12 + (ddlNum >> 5);
281 case 10: // MUONTRK (MCH)
282 case 11: // MUONTRG (MTR)
289 if (ddlNum >= 32) return false; // only have 1 32-bit word.
290 // all these detectors fit into one word, the offset is due to
292 wordIndex = detNum + 9;
295 if (ddlNum >= 2*32) return false; // only have 2 32-bit words.
296 // 2 words for EMCAL + DCAL
297 wordIndex = detNum + 7;
298 wordIndex = 27 + (ddlNum >> 5);
301 if (ddlNum >= 32) return false; // only have 1 32-bit word.
305 if (ddlNum >= 32) return false; // only have 1 32-bit word.
306 // 1 word for AD, 1 DDL
310 if (ddlNum >= 32) return false; // only have 1 32-bit word.
311 // the HLT bitfield is in the last word
318 if (ddlNum >= AliHLTDAQ::NumberOfDdls(detNum == AliDAQ::kHLTId ? AliDAQ::kNDetectors-1 : detNum)) return false;
320 // The bit index within the word indicated by wordIndex.
321 bitIndex = ddlNum % 32;
326 Bool_t AliHLTReadoutList::GetDDLBit(Int_t ddlId) const
328 // Fetches the bit value for a particular DDL in the readout list.
329 // See header file for more details.
331 Int_t wordIndex, bitIndex;
332 if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return kFALSE;
334 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
335 // Check if we need to convert to new format and do so.
336 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
340 if (bitIndex >= 24) return kFALSE;
342 else if (wordIndex == 28)
346 else if (wordIndex > 28)
351 else if ( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1 )
353 if (wordIndex == 30) { return kFALSE; } //there is no AD in V1
354 if (wordIndex == 31) { wordIndex = 30; } //HLT is at word 30 in V1
358 return ((fReadoutList.fList[wordIndex] >> bitIndex) & 0x1) == 0x1;
362 void AliHLTReadoutList::SetDDLBit(Int_t ddlId, Bool_t state)
364 // Sets the bit value for a particular DDL in the readout list.
365 // See header file for more details.
367 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
368 // Check if we need to convert to new format and do so.
369 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
371 AliHLTEventDDL copy = fReadoutList;
375 assert(fReadoutList.fCount == gkAliHLTDDLListSize);
377 Int_t wordIndex, bitIndex;
378 if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return;
380 // To set, 'OR' word with bit mask
382 fReadoutList.fList[wordIndex] |= (0x00000001 << bitIndex);
383 // To unset, 'AND' word with bit mask
385 fReadoutList.fList[wordIndex] &= (0xFFFFFFFF ^ (0x00000001 << bitIndex));
389 void AliHLTReadoutList::Enable(Int_t detector)
391 // Enables all DDLs for a particular detector or detectors.
392 // See header file for more details.
394 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
395 // Check if we need to convert to new format and do so.
396 if (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
398 AliHLTEventDDL copy = fReadoutList;
402 assert(fReadoutList.fCount == gkAliHLTDDLListSize);
404 if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x000FFFFF;
405 if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00FFFFFF;
406 if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x0000FFFF;
407 if ((detector & kTPC) != 0)
409 fReadoutList.fList[3] = 0xFFFFFFFF;
410 fReadoutList.fList[4] = 0xFFFFFFFF;
411 fReadoutList.fList[5] = 0xFFFFFFFF;
412 fReadoutList.fList[6] = 0xFFFFFFFF;
413 fReadoutList.fList[7] = 0xFFFFFFFF;
414 fReadoutList.fList[8] = 0xFFFFFFFF;
415 fReadoutList.fList[9] = 0x00FFFFFF;
416 fReadoutList.fList[10] = 0x00000000;
418 if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x0003FFFF;
419 if ((detector & kTOF) != 0)
421 fReadoutList.fList[12] = 0xFFFFFFFF;
422 fReadoutList.fList[13] = 0xFFFFFFFF;
423 fReadoutList.fList[14] = 0x000000FF;
425 if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x000FFFFF;
426 if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x000FFFFF;
427 if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x000003FF;
428 if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x0000003F;
429 if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x000FFFFF;
430 if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000003;
431 if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000007;
432 if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000001;
433 if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000001;
434 if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000001;
435 if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000001;
436 if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000001;
437 if ((detector & kEMCAL) != 0)
439 fReadoutList.fList[27] = 0xFFFFFFFF;
440 fReadoutList.fList[28] = 0x00003FFF;
442 if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000001;
443 if ((detector & kAD) != 0) fReadoutList.fList[30] = 0x00000001;
444 if ((detector & kHLT) != 0) fReadoutList.fList[31] = 0x0FFFFFFF;
448 void AliHLTReadoutList::Disable(Int_t detector)
450 // Disables all DDLs for a particular detector or detectors.
451 // See header file for more details.
453 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
454 // Check if we need to convert to new format and do so.
455 if (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
457 AliHLTEventDDL copy = fReadoutList;
461 assert(fReadoutList.fCount == gkAliHLTDDLListSize);
463 if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x00000000;
464 if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00000000;
465 if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x00000000;
466 if ((detector & kTPC) != 0)
468 fReadoutList.fList[3] = 0x00000000;
469 fReadoutList.fList[4] = 0x00000000;
470 fReadoutList.fList[5] = 0x00000000;
471 fReadoutList.fList[6] = 0x00000000;
472 fReadoutList.fList[7] = 0x00000000;
473 fReadoutList.fList[8] = 0x00000000;
474 fReadoutList.fList[9] = 0x00000000;
475 fReadoutList.fList[10] = 0x00000000;
477 if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x00000000;
478 if ((detector & kTOF) != 0)
480 fReadoutList.fList[12] = 0x00000000;
481 fReadoutList.fList[13] = 0x00000000;
482 fReadoutList.fList[14] = 0x00000000;
484 if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x00000000;
485 if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x00000000;
486 if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x00000000;
487 if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x00000000;
488 if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x00000000;
489 if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000000;
490 if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000000;
491 if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000000;
492 if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000000;
493 if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000000;
494 if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000000;
495 if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000000;
496 if ((detector & kEMCAL) != 0)
498 fReadoutList.fList[27] = 0x00000000;
499 fReadoutList.fList[28] = 0x00000000;
501 if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000000;
502 if ((detector & kAD) != 0) fReadoutList.fList[30] = 0x00000000;
503 if ((detector & kHLT) != 0) fReadoutList.fList[31] = 0x00000000;
507 bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
509 // Checks if a particular detector's DDLs are enabled.
510 // See header file for more details.
513 if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x000FFFFF;
514 if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00FFFFFF;
515 if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x0000FFFF;
516 if ((detector & kTPC) != 0)
518 result &= fReadoutList.fList[3] == 0xFFFFFFFF;
519 result &= fReadoutList.fList[4] == 0xFFFFFFFF;
520 result &= fReadoutList.fList[5] == 0xFFFFFFFF;
521 result &= fReadoutList.fList[6] == 0xFFFFFFFF;
522 result &= fReadoutList.fList[7] == 0xFFFFFFFF;
523 result &= fReadoutList.fList[8] == 0xFFFFFFFF;
524 result &= fReadoutList.fList[9] == 0x00FFFFFF;
526 if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x0003FFFF;
527 if ((detector & kTOF) != 0)
529 result &= fReadoutList.fList[12] == 0xFFFFFFFF;
530 result &= fReadoutList.fList[13] == 0xFFFFFFFF;
531 result &= fReadoutList.fList[14] == 0x000000FF;
533 if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x000FFFFF;
534 if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x000FFFFF;
535 if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x000003FF;
536 if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x0000003F;
537 if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x000FFFFF;
538 if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000003;
539 if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000007;
540 if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000001;
541 if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000001;
542 if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000001;
543 if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000001;
544 if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000001;
545 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
546 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
548 if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00FFFFFF;
549 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000001;
550 if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x000003FF;
552 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
554 if ((detector & kEMCAL) != 0)
556 result &= fReadoutList.fList[27] == 0xFFFFFFFF;
557 result &= fReadoutList.fList[28] == 0x00003FFF;
559 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000001;
560 if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x0FFFFFFF;
562 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
565 if ((detector & kEMCAL) != 0)
567 result &= fReadoutList.fList[27] == 0xFFFFFFFF;
568 result &= fReadoutList.fList[28] == 0x00003FFF;
570 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000001;
571 if ((detector & kAD) != 0) result &= fReadoutList.fList[30] == 0x00000001;
572 if ((detector & kHLT) != 0) result &= fReadoutList.fList[31] == 0x0FFFFFFF;
579 bool AliHLTReadoutList::DetectorDisabled(Int_t detector) const
581 // Checks if a particular detector's DDLs are disabled.
582 // See header file for more details.
585 if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x00000000;
586 if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00000000;
587 if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x00000000;
588 if ((detector & kTPC) != 0)
590 result &= fReadoutList.fList[3] == 0x00000000;
591 result &= fReadoutList.fList[4] == 0x00000000;
592 result &= fReadoutList.fList[5] == 0x00000000;
593 result &= fReadoutList.fList[6] == 0x00000000;
594 result &= fReadoutList.fList[7] == 0x00000000;
595 result &= fReadoutList.fList[8] == 0x00000000;
596 result &= fReadoutList.fList[9] == 0x00000000;
598 if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x00000000;
599 if ((detector & kTOF) != 0)
601 result &= fReadoutList.fList[12] == 0x00000000;
602 result &= fReadoutList.fList[13] == 0x00000000;
603 result &= fReadoutList.fList[14] == 0x00000000;
605 if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x00000000;
606 if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x00000000;
607 if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x00000000;
608 if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x00000000;
609 if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x00000000;
610 if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000000;
611 if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000000;
612 if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000000;
613 if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000000;
614 if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000000;
615 if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000000;
616 if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000000;
617 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
618 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
620 if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00000000;
621 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000000;
622 if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x00000000;
624 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
626 if ((detector & kEMCAL) != 0)
628 result &= fReadoutList.fList[27] == 0x00000000;
629 result &= fReadoutList.fList[28] == 0x00000000;
631 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
632 if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x00000000;
634 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
637 if ((detector & kEMCAL) != 0)
639 result &= fReadoutList.fList[27] == 0x00000000;
640 result &= fReadoutList.fList[28] == 0x00000000;
642 if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
643 if ((detector & kAD) != 0) result &= fReadoutList.fList[30] == 0x00000000;
644 if ((detector & kHLT) != 0) result &= fReadoutList.fList[31] == 0x00000000;
651 Int_t AliHLTReadoutList::GetFirstWord(EDetectorId detector)
653 // See header file for more details.
656 case kITSSPD: return 0;
657 case kITSSDD: return 1;
658 case kITSSSD: return 2;
660 case kTRD: return 11;
661 case kTOF: return 12;
662 case kHMPID: return 15;
663 case kPHOS: return 16;
664 case kCPV: return 17;
665 case kPMD: return 18;
666 case kMUONTRK: return 19;
667 case kMUONTRG: return 20;
668 case kFMD: return 21;
671 case kZDC: return 24;
672 case kACORDE: return 25;
673 case kTRG: return 26;
674 case kEMCAL: return 27;
675 case kDAQTEST: return 29; //V0:28
677 case kHLT: return 31; //V0:29 V1:30
683 Int_t AliHLTReadoutList::GetWordCount(EDetectorId detector)
685 // See header file for more details.
688 case kITSSPD: return 1;
689 case kITSSDD: return 1;
690 case kITSSSD: return 1;
694 case kHMPID: return 1;
695 case kPHOS: return 1;
698 case kMUONTRK: return 1;
699 case kMUONTRG: return 1;
704 case kACORDE: return 1;
706 case kEMCAL: return 2;
707 case kDAQTEST: return 1;
715 AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetDetectorFromWord(Int_t wordindex)
717 // See header file for more details.
720 case 0: return kITSSPD;
721 case 1: return kITSSDD;
722 case 2: return kITSSSD;
730 case 10: return kTPC;
731 case 11: return kTRD;
732 case 12: return kTOF;
733 case 13: return kTOF;
734 case 14: return kTOF;
735 case 15: return kHMPID;
736 case 16: return kPHOS;
737 case 17: return kCPV;
738 case 18: return kPMD;
739 case 19: return kMUONTRK;
740 case 20: return kMUONTRG;
741 case 21: return kFMD;
744 case 24: return kZDC;
745 case 25: return kACORDE;
746 case 26: return kTRG;
747 case 27: return kEMCAL;
748 case 28: return kEMCAL;
749 case 29: return kDAQTEST;
751 case 31: return kHLT;
752 default: return kNoDetector;
757 AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetFirstUsedDetector(EDetectorId startAfter) const
759 // See header file for more details.
761 if (startAfter < kITSSPD and fReadoutList.fList[0] != 0x00000000) return kITSSPD;
762 if (startAfter < kITSSDD and fReadoutList.fList[1] != 0x00000000) return kITSSDD;
763 if (startAfter < kITSSSD and fReadoutList.fList[2] != 0x00000000) return kITSSSD;
764 if (startAfter < kTPC and fReadoutList.fList[3] != 0x00000000) return kTPC;
765 if (startAfter < kTPC and fReadoutList.fList[4] != 0x00000000) return kTPC;
766 if (startAfter < kTPC and fReadoutList.fList[5] != 0x00000000) return kTPC;
767 if (startAfter < kTPC and fReadoutList.fList[6] != 0x00000000) return kTPC;
768 if (startAfter < kTPC and fReadoutList.fList[7] != 0x00000000) return kTPC;
769 if (startAfter < kTPC and fReadoutList.fList[8] != 0x00000000) return kTPC;
770 if (startAfter < kTPC and fReadoutList.fList[9] != 0x00000000) return kTPC;
771 if (startAfter < kTPC and fReadoutList.fList[10] != 0x00000000) return kTPC;
772 if (startAfter < kTRD and fReadoutList.fList[11] != 0x00000000) return kTRD;
773 if (startAfter < kTOF and fReadoutList.fList[12] != 0x00000000) return kTOF;
774 if (startAfter < kTOF and fReadoutList.fList[13] != 0x00000000) return kTOF;
775 if (startAfter < kTOF and fReadoutList.fList[14] != 0x00000000) return kTOF;
776 if (startAfter < kHMPID and fReadoutList.fList[15] != 0x00000000) return kHMPID;
777 if (startAfter < kPHOS and fReadoutList.fList[16] != 0x00000000) return kPHOS;
778 if (startAfter < kCPV and fReadoutList.fList[17] != 0x00000000) return kCPV;
779 if (startAfter < kPMD and fReadoutList.fList[18] != 0x00000000) return kPMD;
780 if (startAfter < kMUONTRK and fReadoutList.fList[19] != 0x00000000) return kMUONTRK;
781 if (startAfter < kMUONTRG and fReadoutList.fList[20] != 0x00000000) return kMUONTRG;
782 if (startAfter < kFMD and fReadoutList.fList[21] != 0x00000000) return kFMD;
783 if (startAfter < kT0 and fReadoutList.fList[22] != 0x00000000) return kT0;
784 if (startAfter < kV0 and fReadoutList.fList[23] != 0x00000000) return kV0;
785 if (startAfter < kZDC and fReadoutList.fList[24] != 0x00000000) return kZDC;
786 if (startAfter < kACORDE and fReadoutList.fList[25] != 0x00000000) return kACORDE;
787 if (startAfter < kTRG and fReadoutList.fList[26] != 0x00000000) return kTRG;
788 if (startAfter < kEMCAL and fReadoutList.fList[27] != 0x00000000) return kEMCAL;
789 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
790 // Check if we need to convert to new format and do so.
791 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
793 if (startAfter < kDAQTEST and fReadoutList.fList[28] != 0x00000000) return kDAQTEST;
794 if (startAfter < kHLT and fReadoutList.fList[29] != 0x00000000) return kHLT;
796 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
798 if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
799 if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
800 if (startAfter < kHLT and fReadoutList.fList[30] != 0x00000000) return kHLT;
802 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
805 if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
806 if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
807 if (startAfter < kAD and fReadoutList.fList[30] != 0x00000000) return kAD;
808 if (startAfter < kHLT and fReadoutList.fList[31] != 0x00000000) return kHLT;
814 void AliHLTReadoutList::Print(Option_t* /*option*/) const
816 // Prints the DDLs that will be readout according to this readout list.
818 cout << "Readout enabled for DDLs:" << endl;
819 for (Int_t i = 0; i < AliHLTDAQ::NumberOfDetectors(); i++)
821 Int_t maxddls = AliHLTDAQ::NumberOfDdls(i);
822 cout << AliHLTDAQ::DetectorName(i) << ":";
823 bool nonefound = true;
824 for (Int_t j = 0; j < maxddls; j++)
826 Int_t ddlId = ( ((i == AliHLTDAQ::NumberOfDetectors()-1) ? 30 : i) << 8 ) + j;
827 if (GetDDLBit(ddlId))
829 cout << " " << ddlId;
833 if (nonefound) cout << " none";
836 printf("readout list in hex:");
837 for (unsigned int i=0; i<fReadoutList.fCount; i++)
839 printf(" %x", fReadoutList.fList[i]);
845 AliHLTReadoutList& AliHLTReadoutList::operator = (const AliHLTReadoutList& list)
847 // Assignment operator performs a deep copy.
849 TObject::operator = (list);
852 if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
854 memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
865 AliHLTReadoutList& AliHLTReadoutList::operator |= (const AliHLTReadoutList& list)
867 // This operator performs a bitwise inclusive or operation on all DDL bits.
868 // See header file for more details.
873 AliHLTReadoutList& AliHLTReadoutList::OrEq(const AliHLTReadoutList& list)
875 // a bitwise inclusive or operation on all DDL bits.
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 fReadoutList.fList[i] |= list.fReadoutList.fList[i];
888 AliHLTReadoutList& AliHLTReadoutList::operator ^= (const AliHLTReadoutList& list)
890 // This operator performs a bitwise exclusive or (xor) operation on all DDL bits.
891 // See header file for more details.
897 AliHLTReadoutList& AliHLTReadoutList::XorEq(const AliHLTReadoutList& list)
899 // bitwise exclusive or (xor) operation on all DDL bits.
900 // See header file for more details.
902 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
903 assert( fReadoutList.fCount == list.fReadoutList.fCount );
904 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
906 fReadoutList.fList[i] ^= list.fReadoutList.fList[i];
912 AliHLTReadoutList& AliHLTReadoutList::operator &= (const AliHLTReadoutList& list)
914 // This operator performs a bitwise and operation on all DDL bits.
915 // See header file for more details.
921 AliHLTReadoutList& AliHLTReadoutList::AndEq(const AliHLTReadoutList& list)
923 // bitwise and operation on all DDL bits.
924 // See header file for more details.
926 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
927 assert( fReadoutList.fCount == list.fReadoutList.fCount );
928 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
930 fReadoutList.fList[i] &= list.fReadoutList.fList[i];
935 AliHLTReadoutList& AliHLTReadoutList::operator -= (const AliHLTReadoutList& list)
937 // This operator removes all the DDLs specified in list from this readout list.
938 // See header file for more details.
940 assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
941 assert( fReadoutList.fCount == list.fReadoutList.fCount );
942 for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
944 // Effectively apply: this = this & (~ (this & list))
945 // i.e. this = this & (this ^ list)
946 fReadoutList.fList[i] &= fReadoutList.fList[i] ^ list.fReadoutList.fList[i];
952 AliHLTReadoutList AliHLTReadoutList::operator ~ () const
954 // This operator performs a bitwise ones compliment on all DDL bits.
955 // See header file for more details.
957 AliHLTReadoutList readoutlist;
958 readoutlist.fReadoutList.fCount = gkAliHLTDDLListSize;
959 readoutlist.fReadoutList.fList[0] = 0x000FFFFF & (~fReadoutList.fList[0]);
960 readoutlist.fReadoutList.fList[1] = 0x00FFFFFF & (~fReadoutList.fList[1]);
961 readoutlist.fReadoutList.fList[2] = 0x0000FFFF & (~fReadoutList.fList[2]);
962 readoutlist.fReadoutList.fList[3] = 0xFFFFFFFF & (~fReadoutList.fList[3]);
963 readoutlist.fReadoutList.fList[4] = 0xFFFFFFFF & (~fReadoutList.fList[4]);
964 readoutlist.fReadoutList.fList[5] = 0xFFFFFFFF & (~fReadoutList.fList[5]);
965 readoutlist.fReadoutList.fList[6] = 0xFFFFFFFF & (~fReadoutList.fList[6]);
966 readoutlist.fReadoutList.fList[7] = 0xFFFFFFFF & (~fReadoutList.fList[7]);
967 readoutlist.fReadoutList.fList[8] = 0xFFFFFFFF & (~fReadoutList.fList[8]);
968 readoutlist.fReadoutList.fList[9] = 0x00FFFFFF & (~fReadoutList.fList[9]);
969 readoutlist.fReadoutList.fList[10] = 0x00000000;// & (~fReadoutList.fList[10]); // Commented out the end part to suppress coverty warning.
970 readoutlist.fReadoutList.fList[11] = 0x0003FFFF & (~fReadoutList.fList[11]);
971 readoutlist.fReadoutList.fList[12] = 0xFFFFFFFF & (~fReadoutList.fList[12]);
972 readoutlist.fReadoutList.fList[13] = 0xFFFFFFFF & (~fReadoutList.fList[13]);
973 readoutlist.fReadoutList.fList[14] = 0x000000FF & (~fReadoutList.fList[14]);
974 readoutlist.fReadoutList.fList[15] = 0x000FFFFF & (~fReadoutList.fList[15]);
975 readoutlist.fReadoutList.fList[16] = 0x000FFFFF & (~fReadoutList.fList[16]);
976 readoutlist.fReadoutList.fList[17] = 0x000003FF & (~fReadoutList.fList[17]);
977 readoutlist.fReadoutList.fList[18] = 0x0000003F & (~fReadoutList.fList[18]);
978 readoutlist.fReadoutList.fList[19] = 0x000FFFFF & (~fReadoutList.fList[19]);
979 readoutlist.fReadoutList.fList[20] = 0x00000003 & (~fReadoutList.fList[20]);
980 readoutlist.fReadoutList.fList[21] = 0x00000007 & (~fReadoutList.fList[21]);
981 readoutlist.fReadoutList.fList[22] = 0x00000001 & (~fReadoutList.fList[22]);
982 readoutlist.fReadoutList.fList[23] = 0x00000001 & (~fReadoutList.fList[23]);
983 readoutlist.fReadoutList.fList[24] = 0x00000001 & (~fReadoutList.fList[24]);
984 readoutlist.fReadoutList.fList[25] = 0x00000001 & (~fReadoutList.fList[25]);
985 readoutlist.fReadoutList.fList[26] = 0x00000001 & (~fReadoutList.fList[26]);
986 #if 1 // ROOT_SVN_REVISION < 9999 //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
987 // Check if we need to convert to new format and do so.
988 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
990 readoutlist.fReadoutList.fList[27] = 0x00FFFFFF & (~fReadoutList.fList[27]);
991 readoutlist.fReadoutList.fList[28] = 0x00000000;
992 readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[28]);
993 readoutlist.fReadoutList.fList[30] = 0x00000000;
994 readoutlist.fReadoutList.fList[31] = 0x000003FF & (~fReadoutList.fList[29]);
996 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
999 readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
1000 readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
1001 readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[29]);
1002 readoutlist.fReadoutList.fList[30] = 0x00000000;
1003 readoutlist.fReadoutList.fList[30] = 0x0FFFFFFF & (~fReadoutList.fList[30]);
1005 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
1007 readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
1008 readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
1009 readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[29]);
1010 readoutlist.fReadoutList.fList[30] = 0x00000001 & (~fReadoutList.fList[30]);
1011 readoutlist.fReadoutList.fList[31] = 0x0FFFFFFF & (~fReadoutList.fList[31]);
1016 #if ROOT_VERSION_CODE < ROOT_VERSION(5,26,0)
1017 void AliHLTReadoutList::Streamer(TBuffer &R__b)
1019 // Stream an object of class AliHLTReadoutList.
1021 if (R__b.IsReading()) {
1022 R__b.ReadClassBuffer(AliHLTReadoutList::Class(),this);
1023 // Convert old structure to new version if necessary.
1024 if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
1026 fReadoutList.fList[31] = fReadoutList.fList[29];
1027 fReadoutList.fList[29] = fReadoutList.fList[28];
1028 fReadoutList.fList[30] = 0x0;
1029 fReadoutList.fCount = gkAliHLTDDLListSizeV2;
1031 else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
1033 fReadoutList.fList[31] = fReadoutList.fList[30]; //move HLT from 30 to 31
1034 fReadoutList.fList[30] = 0x0; //set AD to 0
1035 fReadoutList.fCount = gkAliHLTDDLListSizeV2;
1038 R__b.WriteClassBuffer(AliHLTReadoutList::Class(),this);
1041 #endif // ROOT version check.