]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTReadoutList.cxx
Bug fix for HMPID bits in readout list.
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTReadoutList.cxx
index 33ec0215b923a83138cf3861638c89f8ff6cb265..a975ff663688ec8c92589d928c1d94918563b20f 100644 (file)
@@ -41,7 +41,7 @@ ClassImp(AliHLTReadoutList)
 
 
 AliHLTReadoutList::AliHLTReadoutList() :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Default constructor.
@@ -52,7 +52,7 @@ AliHLTReadoutList::AliHLTReadoutList() :
 
 
 AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Constructor to select which detectors to enable for readout.
@@ -65,7 +65,7 @@ AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
 
 
 AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Constructor to select which detectors and DDLs to enable for readout.
@@ -114,7 +114,7 @@ AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
 
 
 AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Constructor to create readout list from AliHLTEventDDL structure.
@@ -127,7 +127,7 @@ AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
 
 
 AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
-       TObject(list),
+       TNamed(list),
        fReadoutList()
 {
   // Copy constructor performs a deep copy.
@@ -170,42 +170,69 @@ bool AliHLTReadoutList::DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitInd
   Int_t detNum = ddlId >> 8;
   Int_t ddlNum = ddlId & 0xFF;
   
-  if (detNum < 3)
+  switch (detNum)
   {
+  case 0: // SPD
+  case 1: // SDD
+  case 2: // SSD
+    if (ddlNum >= 32) return false; // only have 1 32-bit word.
     // the 3 ITS detectors have one word each
     wordIndex = detNum;
-  }
-  else if (detNum == 3)
-  {
+    break;
+  case 3: // TPC
     // the TPC bitfield has in total 8 words
     wordIndex = detNum + (ddlNum >> 5);
-  }
-  else if (detNum == 4)
-  {
-    // the TRD bitfield starts at position 11 (3 ITS + 8 TPC)
-    wordIndex = detNum + 7;
-  }
-  else if (detNum == 5)
-  {
+    break;
+  case 4: // TRD
+    if (ddlNum >= 32) return false; // only have 1 32-bit word.
+    // the TRD bitfield starts at word 11 (3 words ITS + 8 words TPC)
+    wordIndex = 11;
+    break;
+  case 5: // TOF
+    if (ddlNum >= 3*32) return false; // only have 3 32-bit words.
     // TOF has 72 DDLs, the bitfield is 3 words starting at position 12
-    wordIndex = detNum + 7 + (ddlNum >> 5);
-  }
-  else if (detNum == 30)
-  {
-    // the HLT bitfield is in the last word 
-    wordIndex = 29;
-  }
-  else
-  {
-    // all other detectors fit into one word, the offset is due to
+    wordIndex = 12 + (ddlNum >> 5);
+    break;
+  case 6: // HMPID
+  case 7: // PHOS
+  case 8: // CPV
+  case 9: // PMD
+  case 10: // MUONTRK (MCH)
+  case 11: // MUONTRG (MTR)
+  case 12: // FMD
+  case 13: // T0
+  case 14: // V0
+  case 15: // ZDC
+  case 16: // ACORDE
+  case 17: // TRG
+    if (ddlNum >= 32) return false; // only have 1 32-bit word.
+    // all these detectors fit into one word, the offset is due to
     // TPC and TOF
     wordIndex = detNum + 9;
+    break;
+  case 18: // EMCAL
+    if (ddlNum >= 2*32) return false; // only have 2 32-bit words.
+    // 2 words for EMCAL + DCAL
+    wordIndex = detNum + 7;
+    wordIndex = 27 + (ddlNum >> 5);
+    break;
+  case 19: // DAQTEST
+    if (ddlNum >= 32) return false; // only have 1 32-bit word.
+    wordIndex = 29;
+    break;
+  case 30: // HLT
+    if (ddlNum >= 32) return false; // only have 1 32-bit word.
+    // the HLT bitfield is in the last word
+    wordIndex = 30;
+    break;
+  default:
+    return false;
   }
   
-  if (wordIndex < 0 or gkAliHLTDDLListSize <= wordIndex) return false;
+  if (ddlNum >= AliHLTDAQ::NumberOfDdls(detNum == 30 ? 20 : detNum)) return false;
   
   // The bit index within the word indicated by wordIndex.
-  bitIndex = (ddlId & 0xFF) % 32;
+  bitIndex = ddlNum % 32;
   return true;
 }
 
@@ -264,7 +291,7 @@ void AliHLTReadoutList::Enable(Int_t detector)
     fReadoutList.fList[13] = 0xFFFFFFFF;
     fReadoutList.fList[14] = 0x000000FF;
   }
-  if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x00003FFF;
+  if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x000FFFFF;
   if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x000FFFFF;
   if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x000003FF;
   if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x0000003F;
@@ -276,9 +303,13 @@ void AliHLTReadoutList::Enable(Int_t detector)
   if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000001;
   if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000001;
   if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000001;
-  if ((detector & kEMCAL) != 0) fReadoutList.fList[27] = 0x00FFFFFF;
-  if ((detector & kDAQTEST) != 0) fReadoutList.fList[28] = 0x00000001;
-  if ((detector & kHLT) != 0) fReadoutList.fList[29] = 0x000003FF;
+  if ((detector & kEMCAL) != 0)
+  {
+    fReadoutList.fList[27] = 0xFFFFFFFF;
+    fReadoutList.fList[28] = 0x00003FFF;
+  }
+  if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000001;
+  if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x000003FF;
 }
 
 
@@ -320,9 +351,13 @@ void AliHLTReadoutList::Disable(Int_t detector)
   if ((detector & kZDC) != 0) fReadoutList.fList[24] = 0x00000000;
   if ((detector & kACORDE) != 0) fReadoutList.fList[25] = 0x00000000;
   if ((detector & kTRG) != 0) fReadoutList.fList[26] = 0x00000000;
-  if ((detector & kEMCAL) != 0) fReadoutList.fList[27] = 0x00000000;
-  if ((detector & kDAQTEST) != 0) fReadoutList.fList[28] = 0x00000000;
-  if ((detector & kHLT) != 0) fReadoutList.fList[29] = 0x00000000;
+  if ((detector & kEMCAL) != 0)
+  {
+    fReadoutList.fList[27] = 0x00000000;
+    fReadoutList.fList[28] = 0x00000000;
+  }
+  if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000000;
+  if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x00000000;
 }
 
 
@@ -352,7 +387,7 @@ bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
     result &= fReadoutList.fList[13] == 0xFFFFFFFF;
     result &= fReadoutList.fList[14] == 0x000000FF;
   }
-  if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x00003FFF;
+  if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x000FFFFF;
   if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x000FFFFF;
   if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x000003FF;
   if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x0000003F;
@@ -364,9 +399,13 @@ 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) result &= fReadoutList.fList[27] == 0x00FFFFFF;
-  if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000001;
-  if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x000003FF;
+  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] == 0x000003FF;
   
   return result;
 }
@@ -414,6 +453,14 @@ AliHLTReadoutList& AliHLTReadoutList::operator |= (const AliHLTReadoutList& list
 {
   // This operator performs a bitwise inclusive or operation on all DDL bits.
   // See header file for more details.
+  this->OrEq(list);
+  return *this;
+}
+
+AliHLTReadoutList& AliHLTReadoutList::OrEq(const AliHLTReadoutList& list)
+{
+  // a bitwise inclusive or operation on all DDL bits.
+  // See header file for more details.
   
   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
@@ -428,6 +475,15 @@ AliHLTReadoutList& AliHLTReadoutList::operator ^= (const AliHLTReadoutList& list
 {
   // This operator performs a bitwise exclusive or (xor) operation on all DDL bits.
   // See header file for more details.
+
+  this->XorEq(list);
+  return *this;
+}
+
+AliHLTReadoutList& AliHLTReadoutList::XorEq(const AliHLTReadoutList& list)
+{
+  // bitwise exclusive or (xor) operation on all DDL bits.
+  // See header file for more details.
   
   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
@@ -442,7 +498,16 @@ AliHLTReadoutList& AliHLTReadoutList::operator &= (const AliHLTReadoutList& list
 {
   // This operator performs a bitwise and operation on all DDL bits.
   // See header file for more details.
-  
+
+  this->AndEq(list);
+  return *this;
+}
+
+AliHLTReadoutList& AliHLTReadoutList::AndEq(const AliHLTReadoutList& list)
+{
+  // bitwise and operation on all DDL bits.
+  // See header file for more details.
+
   assert( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSize );
   for (Int_t i = 0; i < gkAliHLTDDLListSize; i++)
   {
@@ -451,7 +516,6 @@ AliHLTReadoutList& AliHLTReadoutList::operator &= (const AliHLTReadoutList& list
   return *this;
 }
 
-
 AliHLTReadoutList& AliHLTReadoutList::operator -= (const AliHLTReadoutList& list)
 {
   // This operator removes all the DDLs specified in list from this readout list.
@@ -490,7 +554,7 @@ AliHLTReadoutList AliHLTReadoutList::operator ~ () const
   readoutlist.fReadoutList.fList[12] = 0xFFFFFFFF & (~fReadoutList.fList[12]);
   readoutlist.fReadoutList.fList[13] = 0xFFFFFFFF & (~fReadoutList.fList[13]);
   readoutlist.fReadoutList.fList[14] = 0x000000FF & (~fReadoutList.fList[14]);
-  readoutlist.fReadoutList.fList[15] = 0x00003FFF & (~fReadoutList.fList[15]);
+  readoutlist.fReadoutList.fList[15] = 0x000FFFFF & (~fReadoutList.fList[15]);
   readoutlist.fReadoutList.fList[16] = 0x000FFFFF & (~fReadoutList.fList[16]);
   readoutlist.fReadoutList.fList[17] = 0x000003FF & (~fReadoutList.fList[17]);
   readoutlist.fReadoutList.fList[18] = 0x0000003F & (~fReadoutList.fList[18]);
@@ -502,9 +566,10 @@ 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] = 0x00FFFFFF & (~fReadoutList.fList[27]);
-  readoutlist.fReadoutList.fList[28] = 0x00000001 & (~fReadoutList.fList[28]);
-  readoutlist.fReadoutList.fList[29] = 0x000003FF & (~fReadoutList.fList[29]);
+  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]);
   return readoutlist;
 }