]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTReadoutList.h
HLTcalo module
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTReadoutList.h
index 3686f77db1fd752072f96ee82ef9df0598e759b9..339c0d03cd7c95901e0183d9b1e3b7c2c36f1628 100644 (file)
@@ -41,6 +41,7 @@ class AliHLTReadoutList : public TNamed
    */
   enum EDetectorId
   {
+    kNoDetector = 0,       /// No detector value
     kITSSPD = 0x1 << 0,    /// ID for SPD detector
     kITSSDD = 0x1 << 1,    /// ID for SDD detector
     kITSSSD = 0x1 << 2,    /// ID for SSD detector
@@ -68,6 +69,9 @@ class AliHLTReadoutList : public TNamed
                | kACORDE | kTRG | kEMCAL | kHLT)
   };
   
+  /// Converts a detector ID to a user readable string.
+  static const char* DetectorIdToString(EDetectorId id);
+  
   /**
    * Default constructor.
    */
@@ -186,12 +190,53 @@ class AliHLTReadoutList : public TNamed
   void Disable(Int_t detector);
   
   /**
-   * Checks if a particular detector's DDLs are enabled for readout.
+   * Checks if a particular detector's DDLs are all enabled for readout.
    * \param detector  A bitmap of detectors to check. Should be any values from
    *    EDetectorId that can be or'ed together for multiple detector selection.
    * \return true if all DDLs for the specified detectors are enabled for readout.
    */
-  bool DetectorEnabled(Int_t ddlId) const;
+  bool DetectorEnabled(Int_t detector) const;
+  
+  /**
+   * Checks if a particular detector's DDLs are all disabled for readout.
+   * \param detector  A bitmap of detectors to check. Should be any values from
+   *    EDetectorId that can be or'ed together for multiple detector selection.
+   * \return true if all DDLs for the specified detectors are disabled for readout.
+   * \note If both DetectorEnabled(x) and DetectorDisabled(x) return false then
+   *    it means that only part of the detectors DDLs are enabled.
+   */
+  bool DetectorDisabled(Int_t detector) const;
+  
+  /**
+   * Returns the first word of DDL bits for a given detector in the internal structure.
+   * \param detector  The detector code for which to return the starting word.
+   * \returns the first word of DDL bits for the detector or -1 if an invalid code is given.
+   */
+  static Int_t GetFirstWord(EDetectorId detector);
+  
+  /**
+   * Returns the first word of DDL bits for a given detector in the internal structure.
+   * \param detector  The detector code for which to return the starting word.
+   * \returns the first word of DDL bits for the detector or -1 if an invalid code is given.
+   */
+  static Int_t GetWordCount(EDetectorId detector);
+  
+  /**
+   * Returns the corresponding detector ID code for the given word index into the
+   * internal data structure.
+   * \param  wordindex   The position of the word from the start of the DDL readout bit list.
+   * \returns the code of the corresponding detector or kNoDetector if invalid.
+   */
+  static EDetectorId GetDetectorFromWord(Int_t wordindex);
+  
+  /**
+   * Returns the first detector with non-zero DDL bits.
+   * \param  startAfter  The detector code after which to start looking from.
+   *     If kTOF is used for example then only detectors after kTOF will be checked,
+   *     not including kTOF, in the order of precedence indicated by EDetectorId.
+   * \returns the code of the first used detector.
+   */
+  EDetectorId GetFirstUsedDetector(EDetectorId startAfter = kNoDetector) const;
   
   /**
    * Inherited from TObject. Prints the DDLs that will be readout according to
@@ -203,9 +248,9 @@ class AliHLTReadoutList : public TNamed
   /**
    * This typecast operator converts the readout list to the AliHLTEventDDL
    * structure format.
-   * \return  Copy of the AliHLTEventDDL raw structure.
+   * \return  Constant reference to the AliHLTEventDDL raw structure.
    */
-  operator AliHLTEventDDL () const { return fReadoutList; }
+  operator const AliHLTEventDDL& () const { return fReadoutList; }
   
   /**
    * This typecast operator converts the readout list to the AliHLTEventDDL
@@ -220,11 +265,17 @@ class AliHLTReadoutList : public TNamed
    */
   AliHLTEventDDL* Buffer() { return &fReadoutList; }
 
+  /**
+   * Access method to the binary buffer.
+   * \return const pointer to the binary buffer.
+   */
+  const AliHLTEventDDL* Buffer() const { return &fReadoutList; }
+
   /**
    * Access to the size of the binary buffer.
    * \return size of the binary buffer
    */
-  unsigned BufferSize() { return sizeof(fReadoutList); }
+  unsigned BufferSize() const { return sizeof(fReadoutList); }
   
   /**
    * Assignment operator performs a deep copy.
@@ -330,14 +381,11 @@ class AliHLTReadoutList : public TNamed
     return result.operator -= (list);
   }
   
- private:
-  
   /**
    * Decodes the word index and bit index within that word for the readout list structure.
-   * \param ddlId <i>[in]</i>  The ID number of the DDL to decode.
-   * \param wordIndex <i>[out]</i>  the word index of the word to modify or check
-   *    within fReadoutList.fList
-   * \param bitIndex <i>[out]</i>   the bit index of the bit to modify or check
+   * \param [in] ddlId   The ID number of the DDL to decode.
+   * \param [out] wordIndex  the word index of the word to modify or check within fReadoutList.fList
+   * \param [out] bitIndex   the bit index of the bit to modify or check
    *    within the word pointed to by <i>wordIndex</i>.
    * \return  true if the ddlId was decoded and false if it was invalid.
    * \note We do not check extensively if the ddlId is invalid. Just simple checks
@@ -345,9 +393,18 @@ class AliHLTReadoutList : public TNamed
    */
   static bool DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex);
   
+ private:
+  
+  /**
+   * This method fills the internal bit field structure taking care of converting
+   * from the old format to the new one.
+   * \param list  The raw DDL readout list bits.
+   */
+  void FillStruct(const AliHLTEventDDL& list);
+  
   AliHLTEventDDL fReadoutList; /// The DDL readout list structure.
   
-  ClassDef(AliHLTReadoutList, 2) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
+  ClassDef(AliHLTReadoutList, 3) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
 
 };