]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTReadoutList.cxx
Corrected EINCLUDE
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTReadoutList.cxx
index ddd30da26a774af9e4184a51bf6fcf1a845c20fb..31110373432ae5e2311205af7fba8511c8406cab 100644 (file)
@@ -110,30 +110,6 @@ AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
   TString str(enabledList);
   str.ToUpper();
   Int_t enabledDetectors = 0;
-  if (str.Contains("ITSSPD")) enabledDetectors |= kITSSPD;
-  if (str.Contains("ITSSDD")) enabledDetectors |= kITSSDD;
-  if (str.Contains("ITSSSD")) enabledDetectors |= kITSSSD;
-  if (str.Contains("TPC")) enabledDetectors |= kTPC;
-  if (str.Contains("TRD")) enabledDetectors |= kTRD;
-  if (str.Contains("TOF")) enabledDetectors |= kTOF;
-  if (str.Contains("HMPID")) enabledDetectors |= kHMPID;
-  if (str.Contains("PHOS")) enabledDetectors |= kPHOS;
-  if (str.Contains("CPV")) enabledDetectors |= kCPV;
-  if (str.Contains("PMD")) enabledDetectors |= kPMD;
-  if (str.Contains("MUONTRK")) enabledDetectors |= kMUONTRK;
-  if (str.Contains("MUONTRG")) enabledDetectors |= kMUONTRG;
-  if (str.Contains("FMD")) enabledDetectors |= kFMD;
-  if (str.Contains("T0")) enabledDetectors |= kT0;
-  if (str.Contains("V0")) enabledDetectors |= kV0;
-  if (str.Contains("ZDC")) enabledDetectors |= kZDC;
-  if (str.Contains("ACORDE")) enabledDetectors |= kACORDE;
-  if (str.Contains("TRG")) enabledDetectors |= kTRG;
-  if (str.Contains("EMCAL")) enabledDetectors |= kEMCAL;
-  if (str.Contains("DAQTEST")) enabledDetectors |= kDAQTEST;
-  if (str.Contains("HLT")) enabledDetectors |= kHLT;
-  if (str.Contains("ALL")) enabledDetectors |= kALLDET;
-  Enable(enabledDetectors);
-  
   TObjArray* list = str.Tokenize(" ");
   TIter next(list);
   const TObjString* objstr = NULL;
@@ -141,8 +117,31 @@ AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
   {
     str = objstr->GetString();
     if (str.IsDigit()) EnableDDLBit(str.Atoi());
+    if (str == "ITSSPD") enabledDetectors |= kITSSPD;
+    if (str == "ITSSDD") enabledDetectors |= kITSSDD;
+    if (str == "ITSSSD") enabledDetectors |= kITSSSD;
+    if (str == "TPC") enabledDetectors |= kTPC;
+    if (str == "TRD") enabledDetectors |= kTRD;
+    if (str == "TOF") enabledDetectors |= kTOF;
+    if (str == "HMPID") enabledDetectors |= kHMPID;
+    if (str == "PHOS") enabledDetectors |= kPHOS;
+    if (str == "CPV") enabledDetectors |= kCPV;
+    if (str == "PMD") enabledDetectors |= kPMD;
+    if (str == "MUONTRK") enabledDetectors |= kMUONTRK;
+    if (str == "MUONTRG") enabledDetectors |= kMUONTRG;
+    if (str == "FMD") enabledDetectors |= kFMD;
+    if (str == "T0") enabledDetectors |= kT0;
+    if (str == "V0") enabledDetectors |= kV0;
+    if (str == "ZDC") enabledDetectors |= kZDC;
+    if (str == "ACORDE") enabledDetectors |= kACORDE;
+    if (str == "TRG") enabledDetectors |= kTRG;
+    if (str == "EMCAL") enabledDetectors |= kEMCAL;
+    if (str == "DAQTEST") enabledDetectors |= kDAQTEST;
+    if (str == "HLT") enabledDetectors |= kHLT;
+    if (str == "ALL") enabledDetectors |= kALLDET;
   }
   delete list;
+  Enable(enabledDetectors);
 }
 
 
@@ -152,19 +151,44 @@ AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
 {
   // Constructor to create readout list from AliHLTEventDDL structure.
   // See header file for more details.
+  FillStruct(list);
+}
+
+
+AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
+       TNamed(list),
+       fReadoutList()
+{
+  // Copy constructor performs a deep copy.
+  
+  if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
+  {
+    memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
+  }
+  else
+  {
+    FillStruct(list);
+  }
+}
+
+
+void AliHLTReadoutList::FillStruct(const AliHLTEventDDL& list)
+{
+  // Fills internal DDL bits structure.
+
   fReadoutList.fCount = gkAliHLTDDLListSize;  // Required by ALICE-INT-2007-015
   memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
   // Handle lists of different sizes. If the size is for a known version
   // of AliHLTEventDDL then handle appropriately, otherwise just copy only
   // the overlapping part of the list.
-  if (list.fCount == gkAliHLTDDLListSizeV0)
+  if (list.fCount == (unsigned)gkAliHLTDDLListSizeV0)
   {
     memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*28);
     memcpy(&fReadoutList.fList[29], &list.fList[28], sizeof(AliHLTUInt32_t)*2);
   }
-  else if (list.fCount == gkAliHLTDDLListSizeV1)
+  else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV1)
   {
-    memcpy(&fReadoutList.fList, &list.fList, sizeof(AliHLTEventDDL));
+    memcpy(&fReadoutList, &list, sizeof(AliHLTEventDDL));
   }
   else
   {
@@ -173,16 +197,6 @@ AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
 }
 
 
-AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
-       TNamed(list),
-       fReadoutList()
-{
-  // Copy constructor performs a deep copy.
-  
-  memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
-}
-
-
 AliHLTReadoutList::~AliHLTReadoutList()
 {
   // Default destructor.
@@ -205,6 +219,14 @@ void AliHLTReadoutList::Clear(Option_t* /*option*/)
 {
   // Resets all the DDL readout bits.
   memset(fReadoutList.fList, 0x0, sizeof(fReadoutList.fList));
+
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  // Check if we need to convert to new format and do so.
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+  {
+    fReadoutList.fCount = gkAliHLTDDLListSize;
+  }
+#endif
 }
 
 
@@ -291,6 +313,26 @@ Bool_t AliHLTReadoutList::GetDDLBit(Int_t ddlId) const
   
   Int_t wordIndex, bitIndex;
   if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return kFALSE;
+
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  // Check if we need to convert to new format and do so.
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+  {
+    if (wordIndex == 27)
+    {
+      if (bitIndex >= 24) return kFALSE;
+    }
+    else if (wordIndex == 28)
+    {
+      return kFALSE;
+    }
+    else if (wordIndex > 28)
+    {
+      --wordIndex;
+    }
+  }
+#endif
+
   return ((fReadoutList.fList[wordIndex] >> bitIndex) & 0x1) == 0x1;
 }
 
@@ -299,6 +341,16 @@ void AliHLTReadoutList::SetDDLBit(Int_t ddlId, Bool_t state)
 {
   // Sets the bit value for a particular DDL in the readout list.
   // See header file for more details.
+
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  // Check if we need to convert to new format and do so.
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+  {
+    AliHLTEventDDL copy = fReadoutList;
+    FillStruct(copy);
+  }
+#endif
+  assert(fReadoutList.fCount == gkAliHLTDDLListSize);
   
   Int_t wordIndex, bitIndex;
   if (! DecodeDDLID(ddlId, wordIndex, bitIndex)) return;
@@ -316,6 +368,16 @@ void AliHLTReadoutList::Enable(Int_t detector)
 {
   // Enables all DDLs for a particular detector or detectors.
   // See header file for more details.
+
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  // Check if we need to convert to new format and do so.
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+  {
+    AliHLTEventDDL copy = fReadoutList;
+    FillStruct(copy);
+  }
+#endif
+  assert(fReadoutList.fCount == gkAliHLTDDLListSize);
   
   if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x000FFFFF;
   if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00FFFFFF;
@@ -356,7 +418,7 @@ void AliHLTReadoutList::Enable(Int_t detector)
     fReadoutList.fList[28] = 0x00003FFF;
   }
   if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000001;
-  if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x000003FF;
+  if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x0FFFFFFF;
 }
 
 
@@ -364,6 +426,16 @@ void AliHLTReadoutList::Disable(Int_t detector)
 {
   // Disables all DDLs for a particular detector or detectors.
   // See header file for more details.
+
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  // Check if we need to convert to new format and do so.
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+  {
+    AliHLTEventDDL copy = fReadoutList;
+    FillStruct(copy);
+  }
+#endif
+  assert(fReadoutList.fCount == gkAliHLTDDLListSize);
   
   if ((detector & kITSSPD) != 0) fReadoutList.fList[0] = 0x00000000;
   if ((detector & kITSSDD) != 0) fReadoutList.fList[1] = 0x00000000;
@@ -446,13 +518,24 @@ bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
   if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000001;
   if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000001;
   if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000001;
-  if ((detector & kEMCAL) != 0)
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
   {
-    result &= fReadoutList.fList[27] == 0xFFFFFFFF;
-    result &= fReadoutList.fList[28] == 0x00003FFF;
+    if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00FFFFFF;
+    if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000001;
+    if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x000003FF;
+  }
+  else
+#endif
+  {
+    if ((detector & kEMCAL) != 0)
+    {
+      result &= fReadoutList.fList[27] == 0xFFFFFFFF;
+      result &= fReadoutList.fList[28] == 0x00003FFF;
+    }
+    if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000001;
+    if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x0FFFFFFF;
   }
-  if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000001;
-  if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x000003FF;
   
   return result;
 }
@@ -496,13 +579,24 @@ bool AliHLTReadoutList::DetectorDisabled(Int_t detector) const
   if ((detector & kZDC) != 0) result &= fReadoutList.fList[24] == 0x00000000;
   if ((detector & kACORDE) != 0) result &= fReadoutList.fList[25] == 0x00000000;
   if ((detector & kTRG) != 0) result &= fReadoutList.fList[26] == 0x00000000;
-  if ((detector & kEMCAL) != 0)
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
   {
-    result &= fReadoutList.fList[27] == 0x00000000;
-    result &= fReadoutList.fList[28] == 0x00000000;
+    if ((detector & kEMCAL) != 0) result &= fReadoutList.fList[27] == 0x00000000;
+    if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000000;
+    if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x00000000;
+  }
+  else
+#endif
+  {
+    if ((detector & kEMCAL) != 0)
+    {
+      result &= fReadoutList.fList[27] == 0x00000000;
+      result &= fReadoutList.fList[28] == 0x00000000;
+    }
+    if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
+    if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x00000000;
   }
-  if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
-  if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x00000000;
   
   return result;
 }
@@ -614,6 +708,7 @@ AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetDetectorFromWord(Int_t word
 AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetFirstUsedDetector(EDetectorId startAfter) const
 {
   // See header file for more details.
+
   if (startAfter < kITSSPD and fReadoutList.fList[0] != 0x00000000) return kITSSPD;
   if (startAfter < kITSSDD and fReadoutList.fList[1] != 0x00000000) return kITSSDD;
   if (startAfter < kITSSSD and fReadoutList.fList[2] != 0x00000000) return kITSSSD;
@@ -642,9 +737,20 @@ AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetFirstUsedDetector(EDetector
   if (startAfter < kACORDE and fReadoutList.fList[25] != 0x00000000) return kACORDE;
   if (startAfter < kTRG and fReadoutList.fList[26] != 0x00000000) return kTRG;
   if (startAfter < kEMCAL and fReadoutList.fList[27] != 0x00000000) return kEMCAL;
-  if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
-  if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
-  if (startAfter < kHLT and fReadoutList.fList[30] != 0x00000000) return kHLT;
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  // Check if we need to convert to new format and do so.
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+  {
+    if (startAfter < kDAQTEST and fReadoutList.fList[28] != 0x00000000) return kDAQTEST;
+    if (startAfter < kHLT and fReadoutList.fList[29] != 0x00000000) return kHLT;
+  }
+  else
+#endif
+  {
+    if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
+    if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
+    if (startAfter < kHLT and fReadoutList.fList[30] != 0x00000000) return kHLT;
+  }
   return kNoDetector;
 }
 
@@ -681,7 +787,14 @@ AliHLTReadoutList& AliHLTReadoutList::operator = (const AliHLTReadoutList& list)
   TObject::operator = (list);
   if (&list != this)
   {
-    memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
+    if (list.fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize)
+    {
+      memcpy(&fReadoutList, &list.fReadoutList, sizeof(fReadoutList));
+    }
+    else
+    {
+      FillStruct(list);
+    }
   }
   return *this;
 }
@@ -701,6 +814,7 @@ AliHLTReadoutList& AliHLTReadoutList::OrEq(const AliHLTReadoutList& list)
   // See header file for more details.
   
   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
+  assert( fReadoutList.fCount == list.fReadoutList.fCount );
   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
   {
     fReadoutList.fList[i] |= list.fReadoutList.fList[i];
@@ -724,6 +838,7 @@ AliHLTReadoutList& AliHLTReadoutList::XorEq(const AliHLTReadoutList& list)
   // See header file for more details.
   
   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
+  assert( fReadoutList.fCount == list.fReadoutList.fCount );
   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
   {
     fReadoutList.fList[i] ^= list.fReadoutList.fList[i];
@@ -747,6 +862,7 @@ AliHLTReadoutList& AliHLTReadoutList::AndEq(const AliHLTReadoutList& list)
   // See header file for more details.
 
   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
+  assert( fReadoutList.fCount == list.fReadoutList.fCount );
   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
   {
     fReadoutList.fList[i] &= list.fReadoutList.fList[i];
@@ -760,6 +876,7 @@ AliHLTReadoutList& AliHLTReadoutList::operator -= (const AliHLTReadoutList& list
   // See header file for more details.
   
   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
+  assert( fReadoutList.fCount == list.fReadoutList.fCount );
   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
   {
     // Effectively apply: this = this & (~ (this & list))
@@ -776,7 +893,7 @@ AliHLTReadoutList AliHLTReadoutList::operator ~ () const
   // See header file for more details.
   
   AliHLTReadoutList readoutlist;
-  readoutlist.fReadoutList.fCount = fReadoutList.fCount;
+  readoutlist.fReadoutList.fCount = gkAliHLTDDLListSize;
   readoutlist.fReadoutList.fList[0] = 0x000FFFFF & (~fReadoutList.fList[0]);
   readoutlist.fReadoutList.fList[1] = 0x00FFFFFF & (~fReadoutList.fList[1]);
   readoutlist.fReadoutList.fList[2] = 0x0000FFFF & (~fReadoutList.fList[2]);
@@ -787,7 +904,7 @@ AliHLTReadoutList AliHLTReadoutList::operator ~ () const
   readoutlist.fReadoutList.fList[7] = 0xFFFFFFFF & (~fReadoutList.fList[7]);
   readoutlist.fReadoutList.fList[8] = 0xFFFFFFFF & (~fReadoutList.fList[8]);
   readoutlist.fReadoutList.fList[9] = 0x00FFFFFF & (~fReadoutList.fList[9]);
-  readoutlist.fReadoutList.fList[10] = 0x00000000 & (~fReadoutList.fList[10]);
+  readoutlist.fReadoutList.fList[10] = 0x00000000;// & (~fReadoutList.fList[10]); // Commented out the end part to suppress coverty warning.
   readoutlist.fReadoutList.fList[11] = 0x0003FFFF & (~fReadoutList.fList[11]);
   readoutlist.fReadoutList.fList[12] = 0xFFFFFFFF & (~fReadoutList.fList[12]);
   readoutlist.fReadoutList.fList[13] = 0xFFFFFFFF & (~fReadoutList.fList[13]);
@@ -804,10 +921,43 @@ AliHLTReadoutList AliHLTReadoutList::operator ~ () const
   readoutlist.fReadoutList.fList[24] = 0x00000001 & (~fReadoutList.fList[24]);
   readoutlist.fReadoutList.fList[25] = 0x00000001 & (~fReadoutList.fList[25]);
   readoutlist.fReadoutList.fList[26] = 0x00000001 & (~fReadoutList.fList[26]);
-  readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
-  readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
-  readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[29]);
-  readoutlist.fReadoutList.fList[30] = 0x000003FF & (~fReadoutList.fList[30]);
+#if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
+  // Check if we need to convert to new format and do so.
+  if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+  {
+    readoutlist.fReadoutList.fList[27] = 0x00FFFFFF & (~fReadoutList.fList[27]);
+    readoutlist.fReadoutList.fList[28] = 0x00000000;
+    readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[28]);
+    readoutlist.fReadoutList.fList[30] = 0x000003FF & (~fReadoutList.fList[29]);
+  }
+  else
+#endif
+  {
+    readoutlist.fReadoutList.fList[27] = 0xFFFFFFFF & (~fReadoutList.fList[27]);
+    readoutlist.fReadoutList.fList[28] = 0x00003FFF & (~fReadoutList.fList[28]);
+    readoutlist.fReadoutList.fList[29] = 0x00000001 & (~fReadoutList.fList[29]);
+    readoutlist.fReadoutList.fList[30] = 0x0FFFFFFF & (~fReadoutList.fList[30]);
+  }
   return readoutlist;
 }
 
+#if ROOT_VERSION_CODE < ROOT_VERSION(5,26,0)
+void AliHLTReadoutList::Streamer(TBuffer &R__b)
+{
+   // Stream an object of class AliHLTReadoutList.
+
+   if (R__b.IsReading()) {
+      R__b.ReadClassBuffer(AliHLTReadoutList::Class(),this);
+      // Convert old structure to new version if necessary.
+      if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
+      {
+        fReadoutList.fList[30] = fReadoutList.fList[29];
+        fReadoutList.fList[29] = fReadoutList.fList[28];
+        fReadoutList.fList[28] = 0x0;
+        fReadoutList.fCount = gkAliHLTDDLListSizeV1;
+      }
+   } else {
+      R__b.WriteClassBuffer(AliHLTReadoutList::Class(),this);
+   }
+}
+#endif // ROOT version check.