]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/rec/AliRawReaderHLT.h
Corrected list of libraries and additional files to resolve all symbols
[u/mrichter/AliRoot.git] / HLT / rec / AliRawReaderHLT.h
index c9e0b664ec5ad43b6e0cbf5dab8e73563ba699a2..90179e7dd0cc56c00cbdfff49e5ce8f7e37738c2 100644 (file)
 //* 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
- * Handler of HLTOUT data for AliRawReader input.
+ * A specific AliRawReader for detector input replacement by HLTOUT data blocks.
+ *
+ * HLT components can produce output data in the detector ddl raw format.
+ * Data blocks of this format can be fed into the normal detector reconstruction
+ * without changes in the actual reconstruction code by means of the
+ * AliRawReaderHLT implementation of the AliRawReader.
+ *
+ * @section sec_alirawreaderhlt_concept Conceptual design
+ * The AliRawReader provides an abstract interface to the ddl raw data. All
+ * reconstruction code uses this interface to access the data.
+ * HLT components can send their data in the original ddl raw format. The only
+ * difference of such data blocks is the location since they are shipped as
+ * 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.
+ * <pre>
+ *    AliReconstruction rec;
+ *    rec.SetUseHLTData("TPC TRD");
+ * </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 
+ * type @ref AliHLTModuleAgent::AliHLTOUTHandlerType ::kRawReader.
+ * The handler must implement the method
+ * <pre>
+ *  // AliHLTOUTHandlerEquId::ProcessData(AliHLTOUT*)
+ *  virtual int ProcessData(AliHLTOUT* pData);
+ * </pre>
+ * which returns the equipment id and eventually decodes data to be retrieved
+ * 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,
+ * the the following interface methods return handler description and handler. 
+ * <pre>
+ *   int AliHLTModuleAgent::GetHandlerDescription(AliHLTComponentDataType dt,
+ *                                                AliHLTUInt32_t spec,
+ *                                                AliHLTOUTHandlerDesc& desc) const;
+ *
+ *   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);
@@ -51,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;
@@ -130,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
 
@@ -145,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 */
@@ -169,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"