LCOV - code coverage report
Current view: top level - HLT/BASE - AliHLTReadoutList.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 597 0.2 %
Date: 2016-06-14 17:26:59 Functions: 1 39 2.6 %

          Line data    Source code
       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 "AliDAQ.h"
      35             : #include "Riostream.h"
      36             : #include "TString.h"
      37             : #include "TObjString.h"
      38             : #include "TObjArray.h"
      39             : #include <cassert>
      40             : 
      41         126 : ClassImp(AliHLTReadoutList)
      42             : 
      43             : 
      44             : const char* AliHLTReadoutList::DetectorIdToString(EDetectorId id)
      45             : {
      46             :   // Converts a detector ID to a user readable string.
      47           0 :   switch (id)
      48             :   {
      49           0 :   case kNoDetector: return "kNoDetector";
      50           0 :   case kITSSPD:  return "kITSSPD";
      51           0 :   case kITSSDD:  return "kITSSDD";
      52           0 :   case kITSSSD:  return "kITSSSD";
      53           0 :   case kTPC:     return "kTPC";
      54           0 :   case kTRD:     return "kTRD";
      55           0 :   case kTOF:     return "kTOF";
      56           0 :   case kHMPID:   return "kHMPID";
      57           0 :   case kPHOS:    return "kPHOS";
      58           0 :   case kCPV:     return "kCPV";
      59           0 :   case kPMD:     return "kPMD";
      60           0 :   case kMUONTRK: return "kMUONTRK";
      61           0 :   case kMUONTRG: return "kMUONTRG";
      62           0 :   case kFMD:     return "kFMD";
      63           0 :   case kT0:      return "kT0";
      64           0 :   case kV0:      return "kV0";
      65           0 :   case kZDC:     return "kZDC";
      66           0 :   case kACORDE:  return "kACORDE";
      67           0 :   case kTRG:     return "kTRG";
      68           0 :   case kEMCAL:   return "kEMCAL";
      69           0 :   case kDAQTEST: return "kDAQTEST";
      70           0 :   case kAD:      return "kAD";
      71           0 :   case kHLT:     return "kHLT";
      72           0 :   case kALLDET:  return "kALLDET";
      73           0 :   default:       return "UNKNOWN!";
      74             :   }
      75           0 : }
      76             : 
      77             : 
      78             : AliHLTReadoutList::AliHLTReadoutList() :
      79           0 :         TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
      80           0 :         fReadoutList()
      81           0 : {
      82             :   // Default constructor.
      83             :   
      84           0 :   fReadoutList.fCount = gkAliHLTDDLListSize;  // Required by ALICE-INT-2007-015
      85           0 :   memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
      86           0 : }
      87             : 
      88             : 
      89             : AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
      90           0 :         TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
      91           0 :         fReadoutList()
      92           0 : {
      93             :   // Constructor to select which detectors to enable for readout.
      94             :   // See header file for more details.
      95             :   
      96           0 :   fReadoutList.fCount = gkAliHLTDDLListSize;  // Required by ALICE-INT-2007-015
      97           0 :   memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
      98           0 :   Enable(enabledDetectors);
      99           0 : }
     100             : 
     101             : 
     102             : AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
     103           0 :         TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
     104           0 :         fReadoutList()
     105           0 : {
     106             :   // Constructor to select which detectors and DDLs to enable for readout.
     107             :   // See header file for more details.
     108             :   
     109           0 :   fReadoutList.fCount = gkAliHLTDDLListSize;  // Required by ALICE-INT-2007-015
     110           0 :   memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
     111             :   
     112           0 :   TString str(enabledList);
     113           0 :   str.ToUpper();
     114             :   Int_t enabledDetectors = 0;
     115           0 :   TObjArray* list = str.Tokenize(" ");
     116           0 :   TIter next(list);
     117             :   const TObjString* objstr = NULL;
     118           0 :   while ((objstr = dynamic_cast<const TObjString*>(next())) != NULL)
     119             :   {
     120           0 :     str = objstr->GetString();
     121           0 :     if (str.IsDigit()) EnableDDLBit(str.Atoi());
     122           0 :     if (str == "ITSSPD") enabledDetectors |= kITSSPD;
     123           0 :     if (str == "ITSSDD") enabledDetectors |= kITSSDD;
     124           0 :     if (str == "ITSSSD") enabledDetectors |= kITSSSD;
     125           0 :     if (str == "TPC") enabledDetectors |= kTPC;
     126           0 :     if (str == "TRD") enabledDetectors |= kTRD;
     127           0 :     if (str == "TOF") enabledDetectors |= kTOF;
     128           0 :     if (str == "HMPID") enabledDetectors |= kHMPID;
     129           0 :     if (str == "PHOS") enabledDetectors |= kPHOS;
     130           0 :     if (str == "CPV") enabledDetectors |= kCPV;
     131           0 :     if (str == "PMD") enabledDetectors |= kPMD;
     132           0 :     if (str == "MUONTRK") enabledDetectors |= kMUONTRK;
     133           0 :     if (str == "MUONTRG") enabledDetectors |= kMUONTRG;
     134           0 :     if (str == "FMD") enabledDetectors |= kFMD;
     135           0 :     if (str == "T0") enabledDetectors |= kT0;
     136           0 :     if (str == "V0") enabledDetectors |= kV0;
     137           0 :     if (str == "ZDC") enabledDetectors |= kZDC;
     138           0 :     if (str == "ACORDE") enabledDetectors |= kACORDE;
     139           0 :     if (str == "TRG") enabledDetectors |= kTRG;
     140           0 :     if (str == "EMCAL") enabledDetectors |= kEMCAL;
     141           0 :     if (str == "DAQTEST") enabledDetectors |= kDAQTEST;
     142           0 :     if (str == "AD") enabledDetectors |= kAD;
     143           0 :     if (str == "HLT") enabledDetectors |= kHLT;
     144           0 :     if (str == "ALL") enabledDetectors |= kALLDET;
     145             :   }
     146           0 :   delete list;
     147           0 :   Enable(enabledDetectors);
     148           0 : }
     149             : 
     150             : 
     151             : AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
     152           0 :         TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
     153           0 :         fReadoutList()
     154           0 : {
     155             :   // Constructor to create readout list from AliHLTEventDDL structure.
     156             :   // See header file for more details.
     157           0 :   FillStruct(list);
     158           0 : }
     159             : 
     160             : 
     161             : AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
     162           0 :         TNamed(list),
     163           0 :         fReadoutList()
     164           0 : {
     165             :   // Copy constructor performs a deep copy.
     166             :   
     167           0 :   if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
     168             :   {
     169           0 :     memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
     170           0 :   }
     171             :   else
     172             :   {
     173           0 :     FillStruct(list);
     174             :   }
     175           0 : }
     176             : 
     177             : 
     178             : void AliHLTReadoutList::FillStruct(const AliHLTEventDDL& list)
     179             : {
     180             :   // Fills internal DDL bits structure.
     181             : 
     182           0 :   fReadoutList.fCount = gkAliHLTDDLListSize;  // Required by ALICE-INT-2007-015
     183           0 :   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           0 :   if (list.fCount == (unsigned)gkAliHLTDDLListSizeV0)
     188             :   {
     189           0 :     memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*28); //up to EMCAL
     190             :     //fReadoutList.fList[28] = 0x0; //by construction
     191           0 :     fReadoutList.fList[29] = list.fList[28]; //DAQTEST
     192           0 :     fReadoutList.fList[30] = 0x0; //AD
     193           0 :     fReadoutList.fList[31] = list.fList[29]; //HLT
     194           0 :   }
     195           0 :   else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV1)
     196             :   {
     197           0 :     memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*30); //up to DAQTEST
     198           0 :     fReadoutList.fList[31] = list.fList[30]; //HLT
     199           0 :     fReadoutList.fList[30] = 0x0; //AD
     200           0 :   }
     201           0 :   else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV2)
     202             :   {
     203           0 :     memcpy(&fReadoutList, &list, sizeof(AliHLTEventDDL));
     204           0 :   }
     205             :   else
     206             :   {
     207           0 :     memcpy(&fReadoutList.fList, &list.fList, (fReadoutList.fCount<list.fCount?fReadoutList.fCount:list.fCount)*sizeof(AliHLTUInt32_t));
     208             :   }
     209           0 : }
     210             : 
     211             : 
     212             : AliHLTReadoutList::~AliHLTReadoutList()
     213           0 : {
     214             :   // Default destructor.
     215           0 : }
     216             : 
     217             : 
     218             : bool AliHLTReadoutList::Empty() const
     219             : {
     220             :   // Returns true if the readout list has no DDLs enabled.
     221             : 
     222           0 :   for (size_t i = 0; i < sizeof(fReadoutList.fList) / sizeof(fReadoutList.fList[0]); i++)
     223             :   {
     224           0 :     if (fReadoutList.fList[i] != 0x0) return false;
     225             :   }
     226           0 :   return true;
     227           0 : }
     228             : 
     229             : 
     230             : void AliHLTReadoutList::Clear(Option_t* /*option*/)
     231             : {
     232             :   // Resets all the DDL readout bits.
     233           0 :   memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
     234             : 
     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           0 :   if (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
     238             :   {
     239           0 :     fReadoutList.fCount = gkAliHLTDDLListSize;
     240           0 :   }
     241             : #endif
     242           0 : }
     243             : 
     244             : 
     245             : bool AliHLTReadoutList::DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex)
     246             : {
     247             :   // Decodes the word index and bit index within that word for the readout list structure.
     248             :   // See header file for more details.
     249             :   
     250             :   // The detector number is bits 15..8 of ddlId and DDL number is bits 7..0.
     251           0 :   Int_t detNum = ddlId >> 8;
     252           0 :   Int_t ddlNum = ddlId & 0xFF;
     253             :   
     254           0 :   switch (detNum)
     255             :   {
     256             :   case 0: // SPD
     257             :   case 1: // SDD
     258             :   case 2: // SSD
     259           0 :     if (ddlNum >= 32) return false; // only have 1 32-bit word.
     260             :     // the 3 ITS detectors have one word each
     261           0 :     wordIndex = detNum;
     262           0 :     break;
     263             :   case 3: // TPC
     264             :     // the TPC bitfield has in total 8 words
     265           0 :     wordIndex = detNum + (ddlNum >> 5);
     266           0 :     break;
     267             :   case 4: // TRD
     268           0 :     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)
     270           0 :     wordIndex = 11;
     271           0 :     break;
     272             :   case 5: // TOF
     273           0 :     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           0 :     wordIndex = 12 + (ddlNum >> 5);
     276           0 :     break;
     277             :   case 6: // HMPID
     278             :   case 7: // PHOS
     279             :   case 8: // CPV
     280             :   case 9: // PMD
     281             :   case 10: // MUONTRK (MCH)
     282             :   case 11: // MUONTRG (MTR)
     283             :   case 12: // FMD
     284             :   case 13: // T0
     285             :   case 14: // V0
     286             :   case 15: // ZDC
     287             :   case 16: // ACORDE
     288             :   case 17: // TRG
     289           0 :     if (ddlNum >= 32) return false; // only have 1 32-bit word.
     290             :     // all these detectors fit into one word, the offset is due to
     291             :     // TPC and TOF
     292           0 :     wordIndex = detNum + 9;
     293           0 :     break;
     294             :   case 18: // EMCAL
     295           0 :     if (ddlNum >= 2*32) return false; // only have 2 32-bit words.
     296             :     // 2 words for EMCAL + DCAL
     297           0 :     wordIndex = detNum + 7;
     298           0 :     wordIndex = 27 + (ddlNum >> 5);
     299           0 :     break;
     300             :   case 19: // DAQTEST
     301           0 :     if (ddlNum >= 32) return false; // only have 1 32-bit word.
     302           0 :     wordIndex = 29;
     303           0 :     break;
     304             :   case 21: // AD
     305           0 :     if (ddlNum >= 32) return false; // only have 1 32-bit word.
     306             :     // 1 word for AD, 1 DDL
     307           0 :     wordIndex = 30;
     308           0 :     break;
     309             :   case 30: // HLT
     310           0 :     if (ddlNum >= 32) return false; // only have 1 32-bit word.
     311             :     // the HLT bitfield is in the last word
     312           0 :     wordIndex = 31;
     313           0 :     break;
     314             :   default:
     315           0 :     return false;
     316             :   }
     317             :   
     318           0 :   if (ddlNum >= AliHLTDAQ::NumberOfDdls(detNum == AliDAQ::kHLTId ? AliDAQ::kNDetectors-1 : detNum)) return false;
     319             :   
     320             :   // The bit index within the word indicated by wordIndex.
     321           0 :   bitIndex = ddlNum % 32;
     322           0 :   return true;
     323           0 : }
     324             : 
     325             : 
     326             : Bool_t AliHLTReadoutList::GetDDLBit(Int_t ddlId) const
     327             : {
     328             :   // Fetches the bit value for a particular DDL in the readout list.
     329             :   // See header file for more details.
     330             :   
     331           0 :   Int_t wordIndex, bitIndex;
     332           0 :   if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return kFALSE;
     333             : 
     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           0 :   if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
     337             :   {
     338           0 :     if (wordIndex == 27)
     339             :     {
     340           0 :       if (bitIndex >= 24) return kFALSE;
     341             :     }
     342           0 :     else if (wordIndex == 28)
     343             :     {
     344           0 :       return kFALSE;
     345             :     }
     346           0 :     else if (wordIndex > 28)
     347             :     {
     348           0 :       --wordIndex;
     349           0 :     }
     350             :   }
     351           0 :   else if ( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1 )
     352             :   {
     353           0 :     if (wordIndex == 30) { return kFALSE; }  //there is no AD in V1
     354           0 :     if (wordIndex == 31) { wordIndex = 30; } //HLT is at word 30 in V1
     355             :   }
     356             : #endif
     357             : 
     358           0 :   return ((fReadoutList.fList[wordIndex] >> bitIndex) & 0x1) == 0x1;
     359           0 : }
     360             : 
     361             : 
     362             : void AliHLTReadoutList::SetDDLBit(Int_t ddlId, Bool_t state)
     363             : {
     364             :   // Sets the bit value for a particular DDL in the readout list.
     365             :   // See header file for more details.
     366             : 
     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           0 :   if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
     370             :   {
     371           0 :     AliHLTEventDDL copy = fReadoutList;
     372           0 :     FillStruct(copy);
     373           0 :   }
     374             : #endif
     375           0 :   assert(fReadoutList.fCount == gkAliHLTDDLListSize);
     376             :   
     377           0 :   Int_t wordIndex, bitIndex;
     378           0 :   if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return;
     379             : 
     380             :   // To set, 'OR' word with bit mask
     381           0 :   if ( state )
     382           0 :     fReadoutList.fList[wordIndex] |= (0x00000001 << bitIndex);
     383             :   // To unset, 'AND' word with bit mask
     384             :   else
     385           0 :     fReadoutList.fList[wordIndex] &= (0xFFFFFFFF ^ (0x00000001 << bitIndex));
     386           0 : }
     387             : 
     388             : 
     389             : void AliHLTReadoutList::Enable(Int_t detector)
     390             : {
     391             :   // Enables all DDLs for a particular detector or detectors.
     392             :   // See header file for more details.
     393             : 
     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           0 :   if (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
     397             :   {
     398           0 :     AliHLTEventDDL copy = fReadoutList;
     399           0 :     FillStruct(copy);
     400           0 :   }
     401             : #endif
     402           0 :   assert(fReadoutList.fCount == gkAliHLTDDLListSize);
     403             :   
     404           0 :   if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x000FFFFF;
     405           0 :   if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00FFFFFF;
     406           0 :   if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x0000FFFF;
     407           0 :   if ((detector & kTPC) != 0)
     408             :   {
     409           0 :     fReadoutList.fList[3] = 0xFFFFFFFF;
     410           0 :     fReadoutList.fList[4] = 0xFFFFFFFF;
     411           0 :     fReadoutList.fList[5] = 0xFFFFFFFF;
     412           0 :     fReadoutList.fList[6] = 0xFFFFFFFF;
     413           0 :     fReadoutList.fList[7] = 0xFFFFFFFF;
     414           0 :     fReadoutList.fList[8] = 0xFFFFFFFF;
     415           0 :     fReadoutList.fList[9] = 0x00FFFFFF;
     416           0 :     fReadoutList.fList[10] = 0x00000000;
     417           0 :   }
     418           0 :   if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x0003FFFF;
     419           0 :   if ((detector & kTOF) != 0)
     420             :   {
     421           0 :     fReadoutList.fList[12] = 0xFFFFFFFF;
     422           0 :     fReadoutList.fList[13] = 0xFFFFFFFF;
     423           0 :     fReadoutList.fList[14] = 0x000000FF;
     424           0 :   }
     425           0 :   if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x00003FFF;
     426           0 :   if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x001FFFFF;
     427           0 :   if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x000003FF;
     428           0 :   if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x0000003F;
     429           0 :   if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x000FFFFF;
     430           0 :   if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000003;
     431           0 :   if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000007;
     432           0 :   if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000001;
     433           0 :   if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000001;
     434           0 :   if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000001;
     435           0 :   if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000001;
     436           0 :   if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000001;
     437           0 :   if ((detector & kEMCAL) != 0)
     438             :   {
     439           0 :     fReadoutList.fList[27] = 0xFFFFFFFF;
     440           0 :     fReadoutList.fList[28] = 0x00003FFF;
     441           0 :   }
     442           0 :   if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0xFFFFFFFF;
     443           0 :   if ((detector & kAD) != 0) fReadoutList.fList[30] = 0x00000001;
     444           0 :   if ((detector & kHLT) != 0) fReadoutList.fList[31] = 0x0FFFFFFF;
     445           0 : }
     446             : 
     447             : 
     448             : void AliHLTReadoutList::Disable(Int_t detector)
     449             : {
     450             :   // Disables all DDLs for a particular detector or detectors.
     451             :   // See header file for more details.
     452             : 
     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           0 :   if (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
     456             :   {
     457           0 :     AliHLTEventDDL copy = fReadoutList;
     458           0 :     FillStruct(copy);
     459           0 :   }
     460             : #endif
     461           0 :   assert(fReadoutList.fCount == gkAliHLTDDLListSize);
     462             :   
     463           0 :   if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x00000000;
     464           0 :   if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00000000;
     465           0 :   if ((detector & kITSSSD) != 0) fReadoutList.fList[2] = 0x00000000;
     466           0 :   if ((detector & kTPC) != 0)
     467             :   {
     468           0 :     fReadoutList.fList[3] = 0x00000000;
     469           0 :     fReadoutList.fList[4] = 0x00000000;
     470           0 :     fReadoutList.fList[5] = 0x00000000;
     471           0 :     fReadoutList.fList[6] = 0x00000000;
     472           0 :     fReadoutList.fList[7] = 0x00000000;
     473           0 :     fReadoutList.fList[8] = 0x00000000;
     474           0 :     fReadoutList.fList[9] = 0x00000000;
     475           0 :     fReadoutList.fList[10] = 0x00000000;
     476           0 :   }
     477           0 :   if ((detector & kTRD) != 0) fReadoutList.fList[11] = 0x00000000;
     478           0 :   if ((detector & kTOF) != 0)
     479             :   {
     480           0 :     fReadoutList.fList[12] = 0x00000000;
     481           0 :     fReadoutList.fList[13] = 0x00000000;
     482           0 :     fReadoutList.fList[14] = 0x00000000;
     483           0 :   }
     484           0 :   if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x00000000;
     485           0 :   if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x00000000;
     486           0 :   if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x00000000;
     487           0 :   if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x00000000;
     488           0 :   if ((detector & kMUONTRK) != 0) fReadoutList.fList[19] = 0x00000000;
     489           0 :   if ((detector & kMUONTRG) != 0) fReadoutList.fList[20] = 0x00000000;
     490           0 :   if ((detector & kFMD) != 0) fReadoutList.fList[21] = 0x00000000;
     491           0 :   if ((detector & kT0) != 0) fReadoutList.fList[22] = 0x00000000;
     492           0 :   if ((detector & kV0) != 0) fReadoutList.fList[23] = 0x00000000;
     493           0 :   if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000000;
     494           0 :   if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000000;
     495           0 :   if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000000;
     496           0 :   if ((detector & kEMCAL) != 0)
     497             :   {
     498           0 :     fReadoutList.fList[27] = 0x00000000;
     499           0 :     fReadoutList.fList[28] = 0x00000000;
     500           0 :   }
     501           0 :   if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000000;
     502           0 :   if ((detector & kAD) != 0) fReadoutList.fList[30] = 0x00000000;
     503           0 :   if ((detector & kHLT) != 0) fReadoutList.fList[31] = 0x00000000;
     504           0 : }
     505             : 
     506             : 
     507             : bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
     508             : {
     509             :   // Checks if a particular detector's DDLs are enabled.
     510             :   // See header file for more details.
     511             :   
     512             :   bool result = true;
     513           0 :   if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x000FFFFF;
     514           0 :   if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00FFFFFF;
     515           0 :   if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x0000FFFF;
     516           0 :   if ((detector & kTPC) != 0)
     517             :   {
     518           0 :     result &= fReadoutList.fList[3] == 0xFFFFFFFF;
     519           0 :     result &= fReadoutList.fList[4] == 0xFFFFFFFF;
     520           0 :     result &= fReadoutList.fList[5] == 0xFFFFFFFF;
     521           0 :     result &= fReadoutList.fList[6] == 0xFFFFFFFF;
     522           0 :     result &= fReadoutList.fList[7] == 0xFFFFFFFF;
     523           0 :     result &= fReadoutList.fList[8] == 0xFFFFFFFF;
     524           0 :     result &= fReadoutList.fList[9] == 0x00FFFFFF;
     525           0 :   }
     526           0 :   if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x0003FFFF;
     527           0 :   if ((detector & kTOF) != 0)
     528             :   {
     529           0 :     result &= fReadoutList.fList[12] == 0xFFFFFFFF;
     530           0 :     result &= fReadoutList.fList[13] == 0xFFFFFFFF;
     531           0 :     result &= fReadoutList.fList[14] == 0x000000FF;
     532           0 :   }
     533           0 :   if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x00003FFF;
     534           0 :   if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x001FFFFF;
     535           0 :   if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x000003FF;
     536           0 :   if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x0000003F;
     537           0 :   if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x000FFFFF;
     538           0 :   if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000003;
     539           0 :   if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000007;
     540           0 :   if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000001;
     541           0 :   if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000001;
     542           0 :   if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000001;
     543           0 :   if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000001;
     544           0 :   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           0 :   if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
     547             :   {
     548           0 :     if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00FFFFFF;
     549           0 :     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0xFFFFFFFF;
     550           0 :     if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x000003FF;
     551             :   }
     552           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
     553             :   {
     554           0 :     if ((detector & kEMCAL) != 0)
     555             :     {
     556           0 :       result &= fReadoutList.fList[27] == 0xFFFFFFFF;
     557           0 :       result &= fReadoutList.fList[28] == 0x00003FFF;
     558           0 :     }
     559           0 :     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0xFFFFFFFF;
     560           0 :     if ((detector & kHLT) != 0)     result &= fReadoutList.fList[30] == 0x0FFFFFFF;
     561             :   }
     562           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
     563             : #endif
     564             :   {
     565           0 :     if ((detector & kEMCAL) != 0)
     566             :     {
     567           0 :       result &= fReadoutList.fList[27] == 0xFFFFFFFF;
     568           0 :       result &= fReadoutList.fList[28] == 0x00003FFF;
     569           0 :     }
     570           0 :     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0xFFFFFFFF;
     571           0 :     if ((detector & kAD) != 0)      result &= fReadoutList.fList[30] == 0x00000001;
     572           0 :     if ((detector & kHLT) != 0)     result &= fReadoutList.fList[31] == 0x0FFFFFFF;
     573             :   }
     574             :   
     575           0 :   return result;
     576             : }
     577             : 
     578             : 
     579             : bool AliHLTReadoutList::DetectorDisabled(Int_t detector) const
     580             : {
     581             :   // Checks if a particular detector's DDLs are disabled.
     582             :   // See header file for more details.
     583             :   
     584             :   bool result = true;
     585           0 :   if ((detector & kITSSPD) != 0) result &= fReadoutList.fList[0] == 0x00000000;
     586           0 :   if ((detector & kITSSDD) != 0) result &= fReadoutList.fList[1] == 0x00000000;
     587           0 :   if ((detector & kITSSSD) != 0) result &= fReadoutList.fList[2] == 0x00000000;
     588           0 :   if ((detector & kTPC) != 0)
     589             :   {
     590           0 :     result &= fReadoutList.fList[3] == 0x00000000;
     591           0 :     result &= fReadoutList.fList[4] == 0x00000000;
     592           0 :     result &= fReadoutList.fList[5] == 0x00000000;
     593           0 :     result &= fReadoutList.fList[6] == 0x00000000;
     594           0 :     result &= fReadoutList.fList[7] == 0x00000000;
     595           0 :     result &= fReadoutList.fList[8] == 0x00000000;
     596           0 :     result &= fReadoutList.fList[9] == 0x00000000;
     597           0 :   }
     598           0 :   if ((detector & kTRD) != 0) result &= fReadoutList.fList[11] == 0x00000000;
     599           0 :   if ((detector & kTOF) != 0)
     600             :   {
     601           0 :     result &= fReadoutList.fList[12] == 0x00000000;
     602           0 :     result &= fReadoutList.fList[13] == 0x00000000;
     603           0 :     result &= fReadoutList.fList[14] == 0x00000000;
     604           0 :   }
     605           0 :   if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x00000000;
     606           0 :   if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x00000000;
     607           0 :   if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x00000000;
     608           0 :   if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x00000000;
     609           0 :   if ((detector & kMUONTRK) != 0) result &= fReadoutList.fList[19] == 0x00000000;
     610           0 :   if ((detector & kMUONTRG) != 0) result &= fReadoutList.fList[20] == 0x00000000;
     611           0 :   if ((detector & kFMD) != 0) result &= fReadoutList.fList[21] == 0x00000000;
     612           0 :   if ((detector & kT0) != 0) result &= fReadoutList.fList[22] == 0x00000000;
     613           0 :   if ((detector & kV0) != 0) result &= fReadoutList.fList[23] == 0x00000000;
     614           0 :   if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000000;
     615           0 :   if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000000;
     616           0 :   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           0 :   if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
     619             :   {
     620           0 :     if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00000000;
     621           0 :     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000000;
     622           0 :     if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x00000000;
     623             :   }
     624           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
     625             :   {
     626           0 :     if ((detector & kEMCAL) != 0)
     627             :     {
     628           0 :       result &= fReadoutList.fList[27] == 0x00000000;
     629           0 :       result &= fReadoutList.fList[28] == 0x00000000;
     630           0 :     }
     631           0 :     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
     632           0 :     if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x00000000;
     633             :   }
     634           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
     635             : #endif
     636             :   {
     637           0 :     if ((detector & kEMCAL) != 0)
     638             :     {
     639           0 :       result &= fReadoutList.fList[27] == 0x00000000;
     640           0 :       result &= fReadoutList.fList[28] == 0x00000000;
     641           0 :     }
     642           0 :     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
     643           0 :     if ((detector & kAD) != 0)      result &= fReadoutList.fList[30] == 0x00000000;
     644           0 :     if ((detector & kHLT) != 0) result &= fReadoutList.fList[31] == 0x00000000;
     645             :   }
     646             :   
     647           0 :   return result;
     648             : }
     649             : 
     650             : 
     651             : Int_t AliHLTReadoutList::GetFirstWord(EDetectorId detector)
     652             : {
     653             :   // See header file for more details.
     654           0 :   switch (detector)
     655             :   {
     656           0 :   case kITSSPD:  return 0;
     657           0 :   case kITSSDD:  return 1;
     658           0 :   case kITSSSD:  return 2;
     659           0 :   case kTPC:     return 3;
     660           0 :   case kTRD:     return 11;
     661           0 :   case kTOF:     return 12;
     662           0 :   case kHMPID:   return 15;
     663           0 :   case kPHOS:    return 16;
     664           0 :   case kCPV:     return 17;
     665           0 :   case kPMD:     return 18;
     666           0 :   case kMUONTRK: return 19;
     667           0 :   case kMUONTRG: return 20;
     668           0 :   case kFMD:     return 21;
     669           0 :   case kT0:      return 22;
     670           0 :   case kV0:      return 23;
     671           0 :   case kZDC:     return 24;
     672           0 :   case kACORDE:  return 25;
     673           0 :   case kTRG:     return 26;
     674           0 :   case kEMCAL:   return 27; 
     675           0 :   case kDAQTEST: return 29; //V0:28
     676           0 :   case kAD:      return 30; 
     677           0 :   case kHLT:     return 31; //V0:29 V1:30
     678           0 :   default:       return -1;
     679             :   }
     680           0 : }
     681             : 
     682             : 
     683             : Int_t AliHLTReadoutList::GetWordCount(EDetectorId detector)
     684             : {
     685             :   // See header file for more details.
     686           0 :   switch (detector)
     687             :   {
     688           0 :   case kITSSPD:  return 1;
     689           0 :   case kITSSDD:  return 1;
     690           0 :   case kITSSSD:  return 1;
     691           0 :   case kTPC:     return 8;
     692           0 :   case kTRD:     return 1;
     693           0 :   case kTOF:     return 3;
     694           0 :   case kHMPID:   return 1;
     695           0 :   case kPHOS:    return 1;
     696           0 :   case kCPV:     return 1;
     697           0 :   case kPMD:     return 1;
     698           0 :   case kMUONTRK: return 1;
     699           0 :   case kMUONTRG: return 1;
     700           0 :   case kFMD:     return 1;
     701           0 :   case kT0:      return 1;
     702           0 :   case kV0:      return 1;
     703           0 :   case kZDC:     return 1;
     704           0 :   case kACORDE:  return 1;
     705           0 :   case kTRG:     return 1;
     706           0 :   case kEMCAL:   return 2;
     707           0 :   case kDAQTEST: return 1;
     708           0 :   case kAD:      return 1;
     709           0 :   case kHLT:     return 1;
     710           0 :   default:       return 0;
     711             :   }
     712           0 : }
     713             : 
     714             : 
     715             : AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetDetectorFromWord(Int_t wordindex)
     716             : {
     717             :   // See header file for more details.
     718           0 :   switch (wordindex)
     719             :   {
     720           0 :   case 0: return kITSSPD;
     721           0 :   case 1: return kITSSDD;
     722           0 :   case 2: return kITSSSD;
     723           0 :   case 3: return kTPC;
     724           0 :   case 4: return kTPC;
     725           0 :   case 5: return kTPC;
     726           0 :   case 6: return kTPC;
     727           0 :   case 7: return kTPC;
     728           0 :   case 8: return kTPC;
     729           0 :   case 9: return kTPC;
     730           0 :   case 10: return kTPC;
     731           0 :   case 11: return kTRD;
     732           0 :   case 12: return kTOF;
     733           0 :   case 13: return kTOF;
     734           0 :   case 14: return kTOF;
     735           0 :   case 15: return kHMPID;
     736           0 :   case 16: return kPHOS;
     737           0 :   case 17: return kCPV;
     738           0 :   case 18: return kPMD;
     739           0 :   case 19: return kMUONTRK;
     740           0 :   case 20: return kMUONTRG;
     741           0 :   case 21: return kFMD;
     742           0 :   case 22: return kT0;
     743           0 :   case 23: return kV0;
     744           0 :   case 24: return kZDC;
     745           0 :   case 25: return kACORDE;
     746           0 :   case 26: return kTRG;
     747           0 :   case 27: return kEMCAL;
     748           0 :   case 28: return kEMCAL;
     749           0 :   case 29: return kDAQTEST;
     750           0 :   case 30: return kAD;
     751           0 :   case 31: return kHLT;
     752           0 :   default: return kNoDetector;
     753             :   }
     754           0 : }
     755             : 
     756             : 
     757             : AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetFirstUsedDetector(EDetectorId startAfter) const
     758             : {
     759             :   // See header file for more details.
     760             : 
     761           0 :   if (startAfter < kITSSPD and fReadoutList.fList[0] != 0x00000000) return kITSSPD;
     762           0 :   if (startAfter < kITSSDD and fReadoutList.fList[1] != 0x00000000) return kITSSDD;
     763           0 :   if (startAfter < kITSSSD and fReadoutList.fList[2] != 0x00000000) return kITSSSD;
     764           0 :   if (startAfter < kTPC and fReadoutList.fList[3] != 0x00000000) return kTPC;
     765           0 :   if (startAfter < kTPC and fReadoutList.fList[4] != 0x00000000) return kTPC;
     766           0 :   if (startAfter < kTPC and fReadoutList.fList[5] != 0x00000000) return kTPC;
     767           0 :   if (startAfter < kTPC and fReadoutList.fList[6] != 0x00000000) return kTPC;
     768           0 :   if (startAfter < kTPC and fReadoutList.fList[7] != 0x00000000) return kTPC;
     769           0 :   if (startAfter < kTPC and fReadoutList.fList[8] != 0x00000000) return kTPC;
     770           0 :   if (startAfter < kTPC and fReadoutList.fList[9] != 0x00000000) return kTPC;
     771           0 :   if (startAfter < kTPC and fReadoutList.fList[10] != 0x00000000) return kTPC;
     772           0 :   if (startAfter < kTRD and fReadoutList.fList[11] != 0x00000000) return kTRD;
     773           0 :   if (startAfter < kTOF and fReadoutList.fList[12] != 0x00000000) return kTOF;
     774           0 :   if (startAfter < kTOF and fReadoutList.fList[13] != 0x00000000) return kTOF;
     775           0 :   if (startAfter < kTOF and fReadoutList.fList[14] != 0x00000000) return kTOF;
     776           0 :   if (startAfter < kHMPID and fReadoutList.fList[15] != 0x00000000) return kHMPID;
     777           0 :   if (startAfter < kPHOS and fReadoutList.fList[16] != 0x00000000) return kPHOS;
     778           0 :   if (startAfter < kCPV and fReadoutList.fList[17] != 0x00000000) return kCPV;
     779           0 :   if (startAfter < kPMD and fReadoutList.fList[18] != 0x00000000) return kPMD;
     780           0 :   if (startAfter < kMUONTRK and fReadoutList.fList[19] != 0x00000000) return kMUONTRK;
     781           0 :   if (startAfter < kMUONTRG and fReadoutList.fList[20] != 0x00000000) return kMUONTRG;
     782           0 :   if (startAfter < kFMD and fReadoutList.fList[21] != 0x00000000) return kFMD;
     783           0 :   if (startAfter < kT0 and fReadoutList.fList[22] != 0x00000000) return kT0;
     784           0 :   if (startAfter < kV0 and fReadoutList.fList[23] != 0x00000000) return kV0;
     785           0 :   if (startAfter < kZDC and fReadoutList.fList[24] != 0x00000000) return kZDC;
     786           0 :   if (startAfter < kACORDE and fReadoutList.fList[25] != 0x00000000) return kACORDE;
     787           0 :   if (startAfter < kTRG and fReadoutList.fList[26] != 0x00000000) return kTRG;
     788           0 :   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           0 :   if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
     792             :   {
     793           0 :     if (startAfter < kDAQTEST and fReadoutList.fList[28] != 0x00000000) return kDAQTEST;
     794           0 :     if (startAfter < kHLT and fReadoutList.fList[29] != 0x00000000) return kHLT;
     795             :   }
     796           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
     797             :   {
     798           0 :     if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
     799           0 :     if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
     800           0 :     if (startAfter < kHLT and fReadoutList.fList[30] != 0x00000000) return kHLT;
     801             :   }
     802           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
     803             : #endif
     804             :   {
     805           0 :     if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
     806           0 :     if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
     807           0 :     if (startAfter < kAD and fReadoutList.fList[30] != 0x00000000) return kAD;
     808           0 :     if (startAfter < kHLT and fReadoutList.fList[31] != 0x00000000) return kHLT;
     809             :   }
     810           0 :   return kNoDetector;
     811           0 : }
     812             : 
     813             : 
     814             : void AliHLTReadoutList::Print(Option_t* /*option*/) const
     815             : {
     816             :   // Prints the DDLs that will be readout according to this readout list.
     817             :   
     818           0 :   cout << "Readout enabled for DDLs:" << endl;
     819           0 :   for (Int_t i = 0; i < AliHLTDAQ::NumberOfDetectors(); i++)
     820             :   {
     821           0 :     Int_t maxddls = AliHLTDAQ::NumberOfDdls(i);
     822           0 :     cout << AliHLTDAQ::DetectorName(i) << ":";
     823             :     bool nonefound = true;
     824           0 :     for (Int_t j = 0; j < maxddls; j++)
     825             :     {
     826           0 :       Int_t ddlId = ( ((i == AliHLTDAQ::NumberOfDetectors()-1) ? 30 : i) << 8 ) + j;
     827           0 :       if (GetDDLBit(ddlId))
     828             :       {
     829           0 :         cout << " " << ddlId;
     830             :         nonefound = false;
     831           0 :       }
     832             :     }
     833           0 :     if (nonefound) cout << " none";
     834           0 :     cout << endl;
     835             :   }
     836           0 :   printf("readout list in hex:");
     837           0 :   for (unsigned int i=0; i<fReadoutList.fCount; i++)
     838             :   {
     839           0 :     printf(" %x", fReadoutList.fList[i]);
     840             :   }
     841           0 :   printf("\n");
     842           0 : }
     843             : 
     844             : 
     845             : AliHLTReadoutList& AliHLTReadoutList::operator = (const AliHLTReadoutList& list)
     846             : {
     847             :   // Assignment operator performs a deep copy.
     848             :   
     849           0 :   TObject::operator = (list);
     850           0 :   if (&list != this)
     851             :   {
     852           0 :     if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
     853             :     {
     854           0 :       memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
     855           0 :     }
     856             :     else
     857             :     {
     858           0 :       FillStruct(list);
     859             :     }
     860             :   }
     861           0 :   return *this;
     862             : }
     863             : 
     864             : 
     865             : AliHLTReadoutList& AliHLTReadoutList::operator |= (const AliHLTReadoutList& list)
     866             : {
     867             :   // This operator performs a bitwise inclusive or operation on all DDL bits.
     868             :   // See header file for more details.
     869           0 :   this->OrEq(list);
     870           0 :   return *this;
     871             : }
     872             : 
     873             : AliHLTReadoutList& AliHLTReadoutList::OrEq(const AliHLTReadoutList& list)
     874             : {
     875             :   // a bitwise inclusive or operation on all DDL bits.
     876             :   // See header file for more details.
     877             :   
     878           0 :   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
     879           0 :   assert( fReadoutList.fCount == list.fReadoutList.fCount );
     880           0 :   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
     881             :   {
     882           0 :     fReadoutList.fList[i] |= list.fReadoutList.fList[i];
     883             :   }
     884           0 :   return *this;
     885             : }
     886             : 
     887             : 
     888             : AliHLTReadoutList& AliHLTReadoutList::operator ^= (const AliHLTReadoutList& list)
     889             : {
     890             :   // This operator performs a bitwise exclusive or (xor) operation on all DDL bits.
     891             :   // See header file for more details.
     892             : 
     893           0 :   this->XorEq(list);
     894           0 :   return *this;
     895             : }
     896             : 
     897             : AliHLTReadoutList& AliHLTReadoutList::XorEq(const AliHLTReadoutList& list)
     898             : {
     899             :   // bitwise exclusive or (xor) operation on all DDL bits.
     900             :   // See header file for more details.
     901             :   
     902           0 :   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
     903           0 :   assert( fReadoutList.fCount == list.fReadoutList.fCount );
     904           0 :   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
     905             :   {
     906           0 :     fReadoutList.fList[i] ^= list.fReadoutList.fList[i];
     907             :   }
     908           0 :   return *this;
     909             : }
     910             : 
     911             : 
     912             : AliHLTReadoutList& AliHLTReadoutList::operator &= (const AliHLTReadoutList& list)
     913             : {
     914             :   // This operator performs a bitwise and operation on all DDL bits.
     915             :   // See header file for more details.
     916             : 
     917           0 :   this->AndEq(list);
     918           0 :   return *this;
     919             : }
     920             : 
     921             : AliHLTReadoutList& AliHLTReadoutList::AndEq(const AliHLTReadoutList& list)
     922             : {
     923             :   // bitwise and operation on all DDL bits.
     924             :   // See header file for more details.
     925             : 
     926           0 :   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
     927           0 :   assert( fReadoutList.fCount == list.fReadoutList.fCount );
     928           0 :   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
     929             :   {
     930           0 :     fReadoutList.fList[i] &= list.fReadoutList.fList[i];
     931             :   }
     932           0 :   return *this;
     933             : }
     934             : 
     935             : AliHLTReadoutList& AliHLTReadoutList::operator -= (const AliHLTReadoutList& list)
     936             : {
     937             :   // This operator removes all the DDLs specified in list from this readout list.
     938             :   // See header file for more details.
     939             :   
     940           0 :   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
     941           0 :   assert( fReadoutList.fCount == list.fReadoutList.fCount );
     942           0 :   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
     943             :   {
     944             :     // Effectively apply: this = this & (~ (this & list))
     945             :     // i.e. this = this & (this ^ list)
     946           0 :     fReadoutList.fList[i] &= fReadoutList.fList[i] ^ list.fReadoutList.fList[i];
     947             :   }
     948           0 :   return *this;
     949             : }
     950             : 
     951             : 
     952             : AliHLTReadoutList AliHLTReadoutList::operator ~ () const
     953             : {
     954             :   // This operator performs a bitwise ones compliment on all DDL bits.
     955             :   // See header file for more details.
     956             :   
     957           0 :   AliHLTReadoutList readoutlist;
     958           0 :   readoutlist.fReadoutList.fCount = gkAliHLTDDLListSize;
     959           0 :   readoutlist.fReadoutList.fList[0] = 0x000FFFFF & (~fReadoutList.fList[0]);
     960           0 :   readoutlist.fReadoutList.fList[1] = 0x00FFFFFF & (~fReadoutList.fList[1]);
     961           0 :   readoutlist.fReadoutList.fList[2] = 0x0000FFFF & (~fReadoutList.fList[2]);
     962           0 :   readoutlist.fReadoutList.fList[3] = 0xFFFFFFFF & (~fReadoutList.fList[3]);
     963           0 :   readoutlist.fReadoutList.fList[4] = 0xFFFFFFFF & (~fReadoutList.fList[4]);
     964           0 :   readoutlist.fReadoutList.fList[5] = 0xFFFFFFFF & (~fReadoutList.fList[5]);
     965           0 :   readoutlist.fReadoutList.fList[6] = 0xFFFFFFFF & (~fReadoutList.fList[6]);
     966           0 :   readoutlist.fReadoutList.fList[7] = 0xFFFFFFFF & (~fReadoutList.fList[7]);
     967           0 :   readoutlist.fReadoutList.fList[8] = 0xFFFFFFFF & (~fReadoutList.fList[8]);
     968           0 :   readoutlist.fReadoutList.fList[9] = 0x00FFFFFF & (~fReadoutList.fList[9]);
     969           0 :   readoutlist.fReadoutList.fList[10] = 0x00000000;// & (~fReadoutList.fList[10]); // Commented out the end part to suppress coverty warning.
     970           0 :   readoutlist.fReadoutList.fList[11] = 0x0003FFFF & (~fReadoutList.fList[11]);
     971           0 :   readoutlist.fReadoutList.fList[12] = 0xFFFFFFFF & (~fReadoutList.fList[12]);
     972           0 :   readoutlist.fReadoutList.fList[13] = 0xFFFFFFFF & (~fReadoutList.fList[13]);
     973           0 :   readoutlist.fReadoutList.fList[14] = 0x000000FF & (~fReadoutList.fList[14]);
     974           0 :   readoutlist.fReadoutList.fList[15] = 0x00003FFF & (~fReadoutList.fList[15]);
     975           0 :   readoutlist.fReadoutList.fList[16] = 0x001FFFFF & (~fReadoutList.fList[16]);
     976           0 :   readoutlist.fReadoutList.fList[17] = 0x000003FF & (~fReadoutList.fList[17]);
     977           0 :   readoutlist.fReadoutList.fList[18] = 0x0000003F & (~fReadoutList.fList[18]);
     978           0 :   readoutlist.fReadoutList.fList[19] = 0x000FFFFF & (~fReadoutList.fList[19]);
     979           0 :   readoutlist.fReadoutList.fList[20] = 0x00000003 & (~fReadoutList.fList[20]);
     980           0 :   readoutlist.fReadoutList.fList[21] = 0x00000007 & (~fReadoutList.fList[21]);
     981           0 :   readoutlist.fReadoutList.fList[22] = 0x00000001 & (~fReadoutList.fList[22]);
     982           0 :   readoutlist.fReadoutList.fList[23] = 0x00000001 & (~fReadoutList.fList[23]);
     983           0 :   readoutlist.fReadoutList.fList[24] = 0x00000001 & (~fReadoutList.fList[24]);
     984           0 :   readoutlist.fReadoutList.fList[25] = 0x00000001 & (~fReadoutList.fList[25]);
     985           0 :   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           0 :   if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
     989             :   {
     990           0 :     readoutlist.fReadoutList.fList[27] = 0x00FFFFFF & (~fReadoutList.fList[27]);
     991           0 :     readoutlist.fReadoutList.fList[28] = 0x00000000;
     992           0 :     readoutlist.fReadoutList.fList[29] = 0xFFFFFFFF & (~fReadoutList.fList[28]);
     993           0 :     readoutlist.fReadoutList.fList[30] = 0x00000000;
     994           0 :     readoutlist.fReadoutList.fList[31] = 0x000003FF & (~fReadoutList.fList[29]);
     995           0 :   }
     996           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
     997             : #endif
     998             :   {
     999           0 :     readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
    1000           0 :     readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
    1001           0 :     readoutlist.fReadoutList.fList[29] = 0xFFFFFFFF & (~fReadoutList.fList[29]);
    1002           0 :     readoutlist.fReadoutList.fList[30] = 0x00000000;
    1003           0 :     readoutlist.fReadoutList.fList[30] = 0x0FFFFFFF & (~fReadoutList.fList[30]);
    1004           0 :   }
    1005           0 :   else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
    1006             :   {
    1007           0 :     readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
    1008           0 :     readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
    1009           0 :     readoutlist.fReadoutList.fList[29] = 0xFFFFFFFF & (~fReadoutList.fList[29]);
    1010           0 :     readoutlist.fReadoutList.fList[30] = 0x00000001 & (~fReadoutList.fList[30]);
    1011           0 :     readoutlist.fReadoutList.fList[31] = 0x0FFFFFFF & (~fReadoutList.fList[31]);
    1012           0 :   }
    1013             :   return readoutlist;
    1014           0 : }
    1015             : 
    1016             : #if ROOT_VERSION_CODE < ROOT_VERSION(5,26,0)
    1017             : void AliHLTReadoutList::Streamer(TBuffer &R__b)
    1018             : {
    1019             :    // Stream an object of class AliHLTReadoutList.
    1020             : 
    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)
    1025             :       {
    1026             :         fReadoutList.fList[31] = fReadoutList.fList[29];
    1027             :         fReadoutList.fList[29] = fReadoutList.fList[28];
    1028             :         fReadoutList.fList[30] = 0x0;
    1029             :         fReadoutList.fCount = gkAliHLTDDLListSizeV2;
    1030             :       }
    1031             :       else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
    1032             :       {
    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;
    1036             :       }
    1037             :    } else {
    1038             :       R__b.WriteClassBuffer(AliHLTReadoutList::Class(),this);
    1039             :    }
    1040             : }
    1041             : #endif // ROOT version check.

Generated by: LCOV version 1.11