]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add the AD detector in AliHLTReadoutList
authormkrzewic <mikolaj.krzewicki@cern.ch>
Tue, 18 Nov 2014 23:35:39 +0000 (00:35 +0100)
committertbreitne <timo.gunther.breitner@cern.ch>
Thu, 29 Jan 2015 14:58:58 +0000 (15:58 +0100)
be backwards compatible with older formats

Conflicts:
HLT/CMakelibHLTbase.pkg

HLT/BASE/AliHLTDataTypes.h
HLT/BASE/AliHLTReadoutList.cxx
HLT/BASE/AliHLTReadoutList.h
HLT/BASE/HLTbaseLinkDef.h

index d5e7e32bac4e3066a319a911715292634b4559a7..ee85363fea6f035e500a6f60af1a75b235bc9a2a 100644 (file)
@@ -71,8 +71,9 @@
  *           TCPDumpSubscriber for the Common Data Header (CDH) and readout
  *           list information.
  *  17       New CDH v3 (10 32bit words, 100 trigger classes, etc.)
+ *  18       Added AD detector in AliHLTEventDDLV2
  */
-#define ALIHLT_DATA_TYPES_VERSION 17
+#define ALIHLT_DATA_TYPES_VERSION 18
 
 //////////////////////////////////////////////////////////////////////////
 //
@@ -858,8 +859,11 @@ extern "C" {
   /** size of the DDL list after DCAL added to EMCAL */
   const int gkAliHLTDDLListSizeV1 = 31;
 
+  /** size of the DDL list with AD */
+  const int gkAliHLTDDLListSizeV2 =32;
+
   /** size of the DDL list */
-  const int gkAliHLTDDLListSize = gkAliHLTDDLListSizeV1;
+  const int gkAliHLTDDLListSize = gkAliHLTDDLListSizeV2;
 
   /** Number of Trigger Classes of CTP in CDH */
   const int gkNCTPTriggerClassesV2 = 50;
@@ -893,11 +897,21 @@ extern "C" {
     AliHLTUInt32_t fList[gkAliHLTDDLListSizeV1];   /// The list of DDL enable/disable bits.
   };
   
+  /**
+   * @struct AliHLTEventDDLV2
+   * DDL list event structure with extra word for AD bits.
+   */
+  struct AliHLTEventDDLV2
+  {
+    AliHLTUInt32_t fCount;                       /// Indicates the number of words in fList.
+    AliHLTUInt32_t fList[gkAliHLTDDLListSizeV2];   /// The list of DDL enable/disable bits.
+  };
+  
   /**
    * @typedef AliHLTEventDDL
    * Current used default version of the AliHLTEventDDL structure.
    */
-  typedef AliHLTEventDDLV1 AliHLTEventDDL;
+  typedef AliHLTEventDDLV2 AliHLTEventDDL;
 
   /**
    * @struct AliHLTEventTriggerData
@@ -913,6 +927,7 @@ extern "C" {
       AliHLTEventDDL fReadoutList;   /// The default readout list structure.
       AliHLTEventDDLV0 fReadoutListV0;   /// Access to the old version of the readout list structure.
       AliHLTEventDDLV1 fReadoutListV1;   /// Access to the readout list structure with DCAL included.
+      AliHLTEventDDLV2 fReadoutListV2;   /// Access to the readout list structure with AD included.
     };
   };
 
index 31110373432ae5e2311205af7fba8511c8406cab..b15ba5a571907315b29b60f1160d574763ccfe22 100644 (file)
@@ -66,6 +66,7 @@ const char* AliHLTReadoutList::DetectorIdToString(EDetectorId id)
   case kTRG:     return "kTRG";
   case kEMCAL:   return "kEMCAL";
   case kDAQTEST: return "kDAQTEST";
+  case kAD:      return "kAD";
   case kHLT:     return "kHLT";
   case kALLDET:  return "kALLDET";
   default:       return "UNKNOWN!";
@@ -137,6 +138,7 @@ AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
     if (str == "TRG") enabledDetectors |= kTRG;
     if (str == "EMCAL") enabledDetectors |= kEMCAL;
     if (str == "DAQTEST") enabledDetectors |= kDAQTEST;
+    if (str == "AD") enabledDetectors |= kAD;
     if (str == "HLT") enabledDetectors |= kHLT;
     if (str == "ALL") enabledDetectors |= kALLDET;
   }
@@ -183,10 +185,19 @@ void AliHLTReadoutList::FillStruct(const AliHLTEventDDL& list)
   // the overlapping part of the list.
   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);
+    memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*28); //up to EMCAL
+    //fReadoutList.fList[28] = 0x0; //by construction
+    fReadoutList.fList[29] = list.fList[28]; //DAQTEST
+    fReadoutList.fList[30] = 0x0; //AD
+    fReadoutList.fList[31] = list.fList[29]; //HLT
   }
   else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV1)
+  {
+    memcpy(&fReadoutList.fList[0], &list.fList[0], sizeof(AliHLTUInt32_t)*30); //up to DAQTEST
+    fReadoutList.fList[31] = list.fList[30]; //HLT
+    fReadoutList.fList[30] = 0x0; //AD
+  }
+  else if (list.fCount == (unsigned)gkAliHLTDDLListSizeV2)
   {
     memcpy(&fReadoutList, &list, sizeof(AliHLTEventDDL));
   }
@@ -222,7 +233,7 @@ void AliHLTReadoutList::Clear(Option_t* /*option*/)
 
 #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 (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
   {
     fReadoutList.fCount = gkAliHLTDDLListSize;
   }
@@ -289,16 +300,21 @@ bool AliHLTReadoutList::DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitInd
     if (ddlNum >= 32) return false; // only have 1 32-bit word.
     wordIndex = 29;
     break;
-  case 30: // HLT
+  case 20: // AD
     if (ddlNum >= 32) return false; // only have 1 32-bit word.
-    // the HLT bitfield is in the last word
+    // 1 word for AD, 1 DDL
     wordIndex = 30;
     break;
+  case 31: // HLT
+    if (ddlNum >= 32) return false; // only have 1 32-bit word.
+    // the HLT bitfield is in the last word
+    wordIndex = 31;
+    break;
   default:
     return false;
   }
   
-  if (ddlNum >= AliHLTDAQ::NumberOfDdls(detNum == 30 ? 20 : detNum)) return false;
+  if (ddlNum >= AliHLTDAQ::NumberOfDdls(detNum == 31 ? 20 : detNum)) return false;
   
   // The bit index within the word indicated by wordIndex.
   bitIndex = ddlNum % 32;
@@ -331,6 +347,11 @@ Bool_t AliHLTReadoutList::GetDDLBit(Int_t ddlId) const
       --wordIndex;
     }
   }
+  else if ( fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1 )
+  {
+    if (wordIndex == 30) { return kFALSE; }  //there is no AD in V1
+    if (wordIndex == 31) { wordIndex = 30; } //HLT is at word 30 in V1
+  }
 #endif
 
   return ((fReadoutList.fList[wordIndex] >> bitIndex) & 0x1) == 0x1;
@@ -371,7 +392,7 @@ void AliHLTReadoutList::Enable(Int_t detector)
 
 #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 (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
   {
     AliHLTEventDDL copy = fReadoutList;
     FillStruct(copy);
@@ -418,7 +439,8 @@ 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] = 0x0FFFFFFF;
+  if ((detector & kAD) != 0) fReadoutList.fList[30] = 0x00000001;
+  if ((detector & kHLT) != 0) fReadoutList.fList[31] = 0x0FFFFFFF;
 }
 
 
@@ -429,7 +451,7 @@ void AliHLTReadoutList::Disable(Int_t detector)
 
 #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 (fReadoutList.fCount != (unsigned)gkAliHLTDDLListSize)
   {
     AliHLTEventDDL copy = fReadoutList;
     FillStruct(copy);
@@ -476,7 +498,8 @@ void AliHLTReadoutList::Disable(Int_t detector)
     fReadoutList.fList[28] = 0x00000000;
   }
   if ((detector & kDAQTEST) != 0) fReadoutList.fList[29] = 0x00000000;
-  if ((detector & kHLT) != 0) fReadoutList.fList[30] = 0x00000000;
+  if ((detector & kAD) != 0) fReadoutList.fList[30] = 0x00000000;
+  if ((detector & kHLT) != 0) fReadoutList.fList[31] = 0x00000000;
 }
 
 
@@ -525,7 +548,17 @@ bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000001;
     if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x000003FF;
   }
-  else
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
+  {
+    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;
+  }
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
 #endif
   {
     if ((detector & kEMCAL) != 0)
@@ -534,7 +567,8 @@ bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
       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 & kAD) != 0)      result &= fReadoutList.fList[30] == 0x00000001;
+    if ((detector & kHLT) != 0)     result &= fReadoutList.fList[31] == 0x0FFFFFFF;
   }
   
   return result;
@@ -586,8 +620,7 @@ bool AliHLTReadoutList::DetectorDisabled(Int_t detector) const
     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[28] == 0x00000000;
     if ((detector & kHLT) != 0) result &= fReadoutList.fList[29] == 0x00000000;
   }
-  else
-#endif
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
   {
     if ((detector & kEMCAL) != 0)
     {
@@ -597,6 +630,18 @@ bool AliHLTReadoutList::DetectorDisabled(Int_t detector) const
     if ((detector & kDAQTEST) != 0) result &= fReadoutList.fList[29] == 0x00000000;
     if ((detector & kHLT) != 0) result &= fReadoutList.fList[30] == 0x00000000;
   }
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
+#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 & kAD) != 0)      result &= fReadoutList.fList[30] == 0x00000000;
+    if ((detector & kHLT) != 0) result &= fReadoutList.fList[31] == 0x00000000;
+  }
   
   return result;
 }
@@ -625,9 +670,10 @@ Int_t AliHLTReadoutList::GetFirstWord(EDetectorId detector)
   case kZDC:     return 24;
   case kACORDE:  return 25;
   case kTRG:     return 26;
-  case kEMCAL:   return 27;
-  case kDAQTEST: return 29;
-  case kHLT:     return 30;
+  case kEMCAL:   return 27; 
+  case kDAQTEST: return 29; //V0:28
+  case kAD:      return 30; 
+  case kHLT:     return 31; //V0:29 V1:30
   default:       return -1;
   }
 }
@@ -658,6 +704,7 @@ Int_t AliHLTReadoutList::GetWordCount(EDetectorId detector)
   case kTRG:     return 1;
   case kEMCAL:   return 2;
   case kDAQTEST: return 1;
+  case kAD:      return 1;
   case kHLT:     return 1;
   default:       return 0;
   }
@@ -699,7 +746,8 @@ AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetDetectorFromWord(Int_t word
   case 27: return kEMCAL;
   case 28: return kEMCAL;
   case 29: return kDAQTEST;
-  case 30: return kHLT;
+  case 30: return kAD;
+  case 31: return kHLT;
   default: return kNoDetector;
   }
 }
@@ -744,13 +792,20 @@ AliHLTReadoutList::EDetectorId AliHLTReadoutList::GetFirstUsedDetector(EDetector
     if (startAfter < kDAQTEST and fReadoutList.fList[28] != 0x00000000) return kDAQTEST;
     if (startAfter < kHLT and fReadoutList.fList[29] != 0x00000000) return kHLT;
   }
-  else
-#endif
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
   {
     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;
   }
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
+#endif
+  {
+    if (startAfter < kEMCAL and fReadoutList.fList[28] != 0x00000000) return kEMCAL;
+    if (startAfter < kDAQTEST and fReadoutList.fList[29] != 0x00000000) return kDAQTEST;
+    if (startAfter < kAD and fReadoutList.fList[30] != 0x00000000) return kAD;
+    if (startAfter < kHLT and fReadoutList.fList[31] != 0x00000000) return kHLT;
+  }
   return kNoDetector;
 }
 
@@ -777,6 +832,12 @@ void AliHLTReadoutList::Print(Option_t* /*option*/) const
     if (nonefound) cout << " none";
     cout << endl;
   }
+  printf("readout list in hex:");
+  for (unsigned int i=0; i<fReadoutList.fCount; i++)
+  {
+    printf(" %x", fReadoutList.fList[i]);
+  }
+  printf("\n");
 }
 
 
@@ -928,16 +989,26 @@ AliHLTReadoutList AliHLTReadoutList::operator ~ () const
     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]);
+    readoutlist.fReadoutList.fList[30] = 0x00000000;
+    readoutlist.fReadoutList.fList[31] = 0x000003FF & (~fReadoutList.fList[29]);
   }
-  else
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
 #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] = 0x00000000;
     readoutlist.fReadoutList.fList[30] = 0x0FFFFFFF & (~fReadoutList.fList[30]);
   }
+  else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV2)
+  {
+    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] = 0x00000001 & (~fReadoutList.fList[30]);
+    readoutlist.fReadoutList.fList[31] = 0x0FFFFFFF & (~fReadoutList.fList[31]);
+  }
   return readoutlist;
 }
 
@@ -951,10 +1022,16 @@ void AliHLTReadoutList::Streamer(TBuffer &R__b)
       // Convert old structure to new version if necessary.
       if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV0)
       {
-        fReadoutList.fList[30] = fReadoutList.fList[29];
+        fReadoutList.fList[31] = fReadoutList.fList[29];
         fReadoutList.fList[29] = fReadoutList.fList[28];
-        fReadoutList.fList[28] = 0x0;
-        fReadoutList.fCount = gkAliHLTDDLListSizeV1;
+        fReadoutList.fList[30] = 0x0;
+        fReadoutList.fCount = gkAliHLTDDLListSizeV2;
+      }
+      else if (fReadoutList.fCount == (unsigned)gkAliHLTDDLListSizeV1)
+      {
+        fReadoutList.fList[31] = fReadoutList.fList[30]; //move HLT from 30 to 31
+        fReadoutList.fList[30] = 0x0; //set AD to 0
+        fReadoutList.fCount = gkAliHLTDDLListSizeV2;
       }
    } else {
       R__b.WriteClassBuffer(AliHLTReadoutList::Class(),this);
index 339c0d03cd7c95901e0183d9b1e3b7c2c36f1628..e69b1ea8b1e9287ac76ef02e6eeca4e2a200464b 100644 (file)
@@ -62,11 +62,12 @@ class AliHLTReadoutList : public TNamed
     kTRG = 0x1 << 17,      /// ID for TRG detector
     kEMCAL = 0x1 << 18,    /// ID for EMCAL detector
     kDAQTEST = 0x1 << 19,  /// ID for DAQ_TEST detector
-    kHLT = 0x1 << 30,      /// ID for HLT detector
+    kAD = 0x1 << 20,       /// ID for AD detector
+    kHLT = 0x1 << 31,      /// ID for HLT detector
     // kALLDET sets readout for all detectors except DAQ_TEST
     kALLDET = (kITSSPD | kITSSDD | kITSSSD | kTPC | kTRD | kTOF | kHMPID | kPHOS
                | kCPV | kPMD | kMUONTRK | kMUONTRG | kFMD | kT0 | kV0 | kZDC
-               | kACORDE | kTRG | kEMCAL | kHLT)
+               | kACORDE | kTRG | kEMCAL | kAD | kHLT)
   };
   
   /// Converts a detector ID to a user readable string.
@@ -393,6 +394,7 @@ class AliHLTReadoutList : public TNamed
    */
   static bool DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex);
   
+
  private:
   
   /**
@@ -404,7 +406,7 @@ class AliHLTReadoutList : public TNamed
   
   AliHLTEventDDL fReadoutList; /// The DDL readout list structure.
   
-  ClassDef(AliHLTReadoutList, 3) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
+  ClassDef(AliHLTReadoutList, 4) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
 
 };
 
index 9aaa539cacfd5112d3215393bdaf2eb19f6ac494..e1b8605716ffb51522750c3b32f05fa7208c6d94 100644 (file)
 #pragma link C++ class AliHLTReadoutList+;
 
 // Do nothing special with schema evolution for new versions of the readout list.
-#pragma read sourceClass="AliHLTReadoutList" version="[3-]" targetClass="AliHLTReadoutList"
+#pragma read sourceClass="AliHLTReadoutList" version="[4-]" targetClass="AliHLTReadoutList"
 
 // For old versions we need to convert the format of the readout list into the new one.
+#pragma read sourceClass="AliHLTReadoutList" version="[3]" targetClass="AliHLTReadoutList"\
+                            source="AliHLTEventDDL fReadoutList" target="fReadoutList"\
+  code="{\
+          fReadoutList.fCount = gkAliHLTDDLListSize;\
+          for (int i = 0; i<30; ++i) fReadoutList.fList[i] = onfile.fReadoutList.fList[i];\
+          fReadoutList.fList[30] = 0x0;\
+          fReadoutList.fList[31] = onfile.fReadoutList.fList[30];\
+  }"
 #pragma read sourceClass="AliHLTReadoutList" version="[1-2]" targetClass="AliHLTReadoutList"\
   source="AliHLTEventDDL fReadoutList" target="fReadoutList"\
   code="{\
-    fReadoutList.fCount = gkAliHLTDDLListSize;\
-    for (int i = 0; i < 28; ++i) fReadoutList.fList[i] = onfile.fReadoutList.fList[i];\
-    fReadoutList.fList[28] = 0x0;\
-    for (int i = 29; i < gkAliHLTDDLListSize; ++i) fReadoutList.fList[i] = onfile.fReadoutList.fList[i-1];\
+          fReadoutList.fCount = gkAliHLTDDLListSize;\
+          for (int i = 0; i < 28; ++i) fReadoutList.fList[i] = onfile.fReadoutList.fList[i];\
+          fReadoutList.fList[28] = 0x0;\
+          fReadoutList.fList[29] = onfile.fReadoutList.fList[28];\
+          fReadoutList.fList[30] = 0x0;\
+          fReadoutList.fList[31] = onfile.fReadoutList.fList[29];\
   }"
 
 #endif // ROOT version check
 #pragma link C++ struct AliHLTComponentEventData+;
 #pragma link C++ struct AliHLTComponentBlockData+;
 #pragma link C++ struct AliHLTComponentDataType+;
+#pragma link C++ struct AliHLTEventDDLV0+; // Only added to have proper dictionary generation and ROOT I/O for AliHLTReadoutList class.
 #pragma link C++ struct AliHLTEventDDLV1+; // Only added to have proper dictionary generation and ROOT I/O for AliHLTReadoutList class.
+#pragma link C++ struct AliHLTEventDDLV2+; // Only added to have proper dictionary generation and ROOT I/O for AliHLTReadoutList class.
 #pragma link C++ struct AliHLTRunDesc+;
 #pragma link C++ struct AliHLTComponentStatistics+;
 #pragma link C++ struct AliHLTComponentTableEntry;