]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/rec/AliRawReaderHLT.h
changes by Astrid commited
[u/mrichter/AliRoot.git] / HLT / rec / AliRawReaderHLT.h
index 9d85a2fe27691fb8ce5791df1e45b99f6c212dc3..90179e7dd0cc56c00cbdfff49e5ce8f7e37738c2 100644 (file)
@@ -7,26 +7,20 @@
 //* ALICE Experiment at CERN, All rights reserved.                         *
 //* See cxx source for full Copyright notice                               *
 
-/** @file   AliRawReaderHLT.h
-    @author Matthias Richter
-    @date   
-    @brief  AliRawReader implementation which replaces original input of
-            detectors with the appropriate HLT output.                    */
-
-// see below for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+/// @file   AliRawReaderHLT.h
+/// @author Matthias Richter
+/// @date   
+/// @brief  AliRawReader implementation which replaces original input of
+///         detectors with the appropriate HLT output.
 
 #include "AliHLTDataTypes.h"
 #include "AliRawReader.h"      // RAW, base class
-#include "AliHLTReconstructorBase.h"
 #include "TString.h"
 #include <vector>
 
 class AliHLTOUT;
 class AliHLTOUTHandler;
+class AliHLTPluginBase;
 
 /**
  * @class AliRawReaderHLT
@@ -45,6 +39,14 @@ class AliHLTOUTHandler;
  * part of the HLTOUT data stream. The AliRawReaderHLT provides redirection of
  * those data blocks.
  *
+ * The AliRawReaderHLT needs the original AliRawReader in order to get the
+ * data. Furthermore, a string containing the detector specification defines
+ * which data should be read from the HLT stream and which from the original
+ * reader.
+ *
+ * @note An HLTOUT handler must be available for the HLTOUT data blocks to
+ * be redirected. Please read @ref sec_alirawreaderhlt_module carefully.
+ *
  * @section sec_alirawreaderhlt_usage   Selection of the HLTOUT data stream
  * The input data of a detector can be replaced by the corresponding HLT
  * data by calling the <tt>AliReconstruction::SetUseHLTData("...")</tt>, e.g.
@@ -54,6 +56,31 @@ class AliHLTOUTHandler;
  * </pre>
  * will replace the input of TPC and TRD.
  *
+ * The reader can be used directly. In order to avoid library dependencies
+ * downwards, the methed AliRawHLTManager::CreateRawReaderHLT is available
+ * in the RAW package.
+ * <pre>
+ * {
+ *   AliRawReader* orgReader=AliRawReader::Create("raw.root");
+ *   AliRawReader* rawreader=AliRawHLTManager::CreateRawReaderHLT(orgReader, "ITSSDD");
+ *   rawreader->Select("ITSSDD");
+ *   int count=0;
+ *   while (rawreader->NextEvent()) {
+ *     cout << "scanning event " << count++ << endl;
+ *     UChar_t* pSrc=NULL;
+ *     while (rawreader->ReadNextData(pSrc)) {
+ *       cout << "  equipment: " << rawreader->GetEquipmentId() << endl;
+ *     }
+ *   }
+ * }
+ * </pre>
+ *
+ * @section sec_alirawreaderhlt_detectorids  Detector selection
+ * The constructor gets a detector selection string as parameter and initializes
+ * the redirection according to that. Detector Ids are according to AliDAQ.
+ * Please note the special strings for for ITS and MUON sub-detectors, ITSSPD,
+ * ITSSDD, ITSSSD, and MUONTRK and MUONTRG respectively.
+ *
  * @section sec_alirawreaderhlt_module  Module implementation
  * In order to determine the equipment id for the data block, the HLT module
  * must implement an HLTOUT handler of class AliHLTOUTHandlerEquId which is of 
@@ -64,7 +91,9 @@ class AliHLTOUTHandler;
  *  virtual int ProcessData(AliHLTOUT* pData);
  * </pre>
  * which returns the equipment id and eventually decodes data to be retrieved
- * by calling AliHLTOUTHandler::GetProcessedData().
+ * by calling AliHLTOUTHandler::GetProcessedData(). If the equipment id of the
+ * DDL has been sent as data specification of the block, the AliHLTOUTHandlerEquId
+ * can be used directly.
  *
  * Secondly, the AliHLTModuleAgent implementation of the module has to create
  * the handler for the data blocks. Depending on the data type and specification,
@@ -77,10 +106,11 @@ class AliHLTOUTHandler;
  *   AliHLTOUTHandler* AliHLTModuleAgent::GetOutputHandler(AliHLTComponentDataType dt, 
  *                                                         AliHLTUInt32_t spec);
  * </pre>
+ * See section @ref tut_alirawreaderhlt for sample implementation.
  *
  * @ingroup alihlt_aliroot_reconstruction
  */
-class AliRawReaderHLT : public AliRawReader, public AliHLTReconstructorBase {
+class AliRawReaderHLT : public AliRawReader {
  public:
   /** constructor */
   AliRawReaderHLT(AliRawReader* pParentReader, const char* options=NULL);
@@ -99,7 +129,7 @@ class AliRawReaderHLT : public AliRawReader, public AliHLTReconstructorBase {
                           Int_t minEquipmentId = -1, 
                           Int_t maxEquipmentId = -1);
   void     SkipInvalid(Bool_t skip = kTRUE);
-  void     SelectEvents(Int_t type);
+  //  void     SelectEvents(Int_t type);
 
   UInt_t   GetType() const;
   UInt_t   GetRunNumber() const;
@@ -178,6 +208,16 @@ class AliRawReaderHLT : public AliRawReader, public AliHLTReconstructorBase {
    */
   int ReleaseHLTData(bool bReleaseHLTOUT=true);
 
+  /**
+   * Backbone of all Read functions.
+   * Reads the next data into the internal buffer and switches to next
+   * block if enabled.
+   *
+   * @param data             target to receive pointer
+   * @param readHeader       kTRUE: switch to next block if no more data
+   */
+  Bool_t   ReadNextData(UChar_t*& data, Bool_t readHeader);
+
   /** the rawreader */
   AliRawReader* fpParentReader; //!transient
 
@@ -193,10 +233,10 @@ class AliRawReaderHLT : public AliRawReader, public AliHLTReconstructorBase {
   /** size of the current data set */
   int fDataSize; // !transient
 
-  /** current stream offset in the data set */
+  /** current stream offset for reading from input stream */
   int fOffset; // !transient
 
-  /** current stream position for the ReadNextData function */
+  /** current stream position for block input ReadNextData function */
   int fPosition; // !transient
 
   /** equipment id of the current data set, >0 indicates data set from HLT stream */
@@ -217,7 +257,10 @@ class AliRawReaderHLT : public AliRawReader, public AliHLTReconstructorBase {
   /** instance of the data handler providing the current data buffer */
   AliHLTOUTHandler* fpDataHandler; // !transient
 
-  ClassDef(AliRawReaderHLT, 4)
+  /** base class for AliRoot HLT plugins */
+  AliHLTPluginBase* fpPluginBase;                                     //!transient
+
+  ClassDef(AliRawReaderHLT, 0)
 };
 
 #define ALIHLTREC_LIBRARY                   "libHLTrec.so"