]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added HLTOUT treatment for HLTReconstruction
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Oct 2007 19:01:06 +0000 (19:01 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Oct 2007 19:01:06 +0000 (19:01 +0000)
HLT/libHLTrec.pkg
HLT/rec/AliHLTOUTRawReader.cxx [new file with mode: 0644]
HLT/rec/AliHLTOUTRawReader.h [new file with mode: 0644]

index f760310833ddcd71e1f2e7fdb0ab9e4754b4cfbe..7f0f66759217c3621fa81ba6bf8a6a4583c8131e 100644 (file)
@@ -5,7 +5,8 @@ include $(MODDIR)/hlt.conf
 
 LIBHLTREC_VERSION := 0
 
-CLASS_HDRS:=   AliHLTReconstructor.h
+CLASS_HDRS:=   AliHLTReconstructor.h \
+               AliHLTOUTRawReader.h
 
 MODULE_SRCS:=  AliHLTDynamicAliLog.cxx \
                $(CLASS_HDRS:.h=.cxx)
@@ -25,4 +26,4 @@ PACKCXXFLAGS := ${HLTCXXFLAGS} -DLIBHLTREC_VERSION=$(LIBHLTREC_VERSION)
 PACKCFLAGS   := ${HLTCLFAGS}
 PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
 
-EINCLUDE := HLT/rec HLT/BASE STEER
+EINCLUDE := HLT/rec HLT/BASE HLT/BASE/HOMER STEER RAW
diff --git a/HLT/rec/AliHLTOUTRawReader.cxx b/HLT/rec/AliHLTOUTRawReader.cxx
new file mode 100644 (file)
index 0000000..7dbfb46
--- /dev/null
@@ -0,0 +1,126 @@
+// $Id$
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTOUTRawReader.cxx
+    @author Matthias Richter
+    @date   
+    @brief  HLTOUT data wrapper for AliRawReader.                         */
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTOUTRawReader.h"
+#include "AliHLTHOMERLibManager.h"
+#include "AliRawReader.h"
+#include "AliHLTHOMERReader.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTOUTRawReader)
+
+AliHLTOUTRawReader::AliHLTOUTRawReader(AliRawReader* pRawreader)
+  :
+  AliHLTOUTHomerBuffer(NULL, 0),
+  fpRawreader(pRawreader),
+  fpCurrent(NULL)
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+const int AliHLTOUTRawReader::fgkIdShift=16;
+
+AliHLTOUTRawReader::~AliHLTOUTRawReader()
+{
+  // see header file for class documentation
+  if (fpManager) {
+    if (fpCurrent) fpManager->DeleteReader(fpCurrent);
+    fpCurrent=NULL;
+  }
+}
+
+int AliHLTOUTRawReader::GenerateIndex()
+{
+  // see header file for class documentation
+  // step through all HLT ddls, create HOMER reader and
+  // scan data block
+  int iResult=0;
+  if (fpRawreader && fpManager) {
+    fpRawreader->Reset();
+    fpRawreader->Select("HLT");
+    UChar_t* pSrc=NULL;
+    while (fpRawreader->ReadNextData(pSrc) && pSrc!=NULL && iResult>=0) {
+      AliHLTUInt32_t id=(fpRawreader->GetEquipmentId())<<fgkIdShift;
+      int size=fpRawreader->GetDataSize();
+      AliHLTHOMERReader* pReader=fpManager->OpenReader(pSrc, size);
+      if (pReader) {
+       iResult=ScanReader(pReader, id);
+       fpManager->DeleteReader(pReader);
+      }
+    }
+  } else {
+    iResult=-ENODEV;
+  }
+  return iResult;
+}
+
+int AliHLTOUTRawReader::GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer, 
+                                       AliHLTUInt32_t& size)
+{
+  // see header file for class documentation
+  int iResult=0;
+  if (fpManager) {
+    AliHLTUInt32_t id=index>>fgkIdShift;
+    AliHLTUInt32_t blockNo=index&((0x1<<fgkIdShift)-1);
+
+    // block from the same ddl requested?
+    if (fpCurrent && fpRawreader->GetEquipmentId()!=id) {
+      fpManager->DeleteReader(fpCurrent);
+      fpCurrent=NULL;
+    }
+
+    // open ddl for equipment id and create HOMER reader
+    if (!fpCurrent) {
+      fpRawreader->Reset();
+      fpRawreader->SelectEquipment(-1, id, id);
+      UChar_t* pSrc=NULL;
+      if (fpRawreader->ReadNextData(pSrc) && pSrc!=NULL) {
+       fpCurrent=fpManager->OpenReader(pSrc, size);
+      } else {
+       iResult=-ENOSYS;
+      }
+    }
+
+    // get data
+    if (fpCurrent) {
+      if ((pBuffer=static_cast<const AliHLTUInt8_t*>(fpCurrent->GetBlockData(blockNo)))!=NULL) {
+       size=fpCurrent->GetBlockDataLength(blockNo);
+      } else {
+       iResult=-ENOENT;
+      }
+    }
+  } else {
+    iResult=-ENODEV;
+  }
+  return iResult;
+}
diff --git a/HLT/rec/AliHLTOUTRawReader.h b/HLT/rec/AliHLTOUTRawReader.h
new file mode 100644 (file)
index 0000000..7c508a0
--- /dev/null
@@ -0,0 +1,74 @@
+//-*- Mode: C++ -*-
+// @(#) $Id$
+
+#ifndef ALIHLTOUTRAWREADER_H
+#define ALIHLTOUTRAWREADER_H
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTOUTRawReader.h
+    @author Matthias Richter
+    @date   
+    @brief  HLTOUT data wrapper for AliRawReader.
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+                                                                          */
+#include "AliHLTOUTHomerBuffer.h"
+
+class AliRawReader;
+class AliHLTHOMERReader;
+
+/**
+ * @class AliHLTOUTRawReader
+ * Handler of HLTOUT data for AliRawReader input.
+ */
+class AliHLTOUTRawReader : public AliHLTOUTHomerBuffer {
+ public:
+  /** constructor */
+  AliHLTOUTRawReader(AliRawReader* pRawReader);
+  /** destructor */
+  virtual ~AliHLTOUTRawReader();
+
+ protected:
+
+ private:
+  /** standard constructor prohibited */
+  AliHLTOUTRawReader();
+  /** copy constructor prohibited */
+  AliHLTOUTRawReader(const AliHLTOUTRawReader&);
+  /** assignment operator prohibited */
+  AliHLTOUTRawReader& operator=(const AliHLTOUTRawReader&);
+
+  /**
+   * Generate the index of the HLTOUT data from the data buffer.
+   */
+  int GenerateIndex();
+
+  /**
+   * Get the data buffer
+   * @param index   [in]  index of the block
+   * @param pBuffer [out] buffer of the selected data block
+   * @param size    [out] size of the selected data block
+   */
+  int GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer, 
+                   AliHLTUInt32_t& size);
+
+  /** the rawreader */
+  AliRawReader* fpRawreader; //!transient
+
+  /** current instance of the HOMER reader */
+  AliHLTHOMERReader* fpCurrent;  //!transient
+
+  /** DDL id offset shift for index
+   *  bit 16-31: DDL id, bit 0-15 block no
+   */
+  static const int fgkIdShift; //!transient
+  
+  ClassDef(AliHLTOUTRawReader, 0)
+};
+#endif