3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 /** @file AliHLTOUTRawReader.cxx
20 @author Matthias Richter
22 @brief HLTOUT data wrapper for AliRawReader. */
24 // see header file for class documentation
26 // refer to README to build package
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
30 #include "AliHLTOUTRawReader.h"
31 #include "AliHLTHOMERLibManager.h"
32 #include "AliRawReader.h"
33 #include "AliHLTHOMERReader.h"
35 /** ROOT macro for the implementation of ROOT specific class methods */
36 ClassImp(AliHLTOUTRawReader)
38 AliHLTOUTRawReader::AliHLTOUTRawReader(AliRawReader* pRawreader)
40 AliHLTOUTHomerBuffer(NULL, 0),
41 fpRawreader(pRawreader),
44 // see header file for class documentation
46 // refer to README to build package
48 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
51 const int AliHLTOUTRawReader::fgkIdShift=16;
53 AliHLTOUTRawReader::~AliHLTOUTRawReader()
55 // see header file for class documentation
57 if (fpCurrent) fpManager->DeleteReader(fpCurrent);
62 int AliHLTOUTRawReader::GenerateIndex()
64 // see header file for class documentation
65 // step through all HLT ddls, create HOMER reader and
68 if (fpRawreader && fpManager) {
70 fpRawreader->Select("HLT");
72 while (fpRawreader->ReadNextData(pSrc) && pSrc!=NULL && iResult>=0) {
73 AliHLTUInt32_t id=(fpRawreader->GetEquipmentId())<<fgkIdShift;
74 int size=fpRawreader->GetDataSize();
75 int offset=sizeof(AliHLTOUT::AliHLTOUTEventHeader);
76 AliHLTHOMERReader* pReader=fpManager->OpenReaderBuffer(pSrc+offset, size-offset);
78 iResult=ScanReader(pReader, id);
79 fpManager->DeleteReader(pReader);
88 int AliHLTOUTRawReader::GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer,
91 // see header file for class documentation
96 Int_t id = Int_t(index>>fgkIdShift);
97 AliHLTUInt32_t blockNo=index&((0x1<<fgkIdShift)-1);
99 // block from the same ddl requested?
100 if (fpCurrent && fpRawreader->GetEquipmentId()!=id) {
101 fpManager->DeleteReader(fpCurrent);
105 // open ddl for equipment id and create HOMER reader
107 fpRawreader->Reset();
108 fpRawreader->SelectEquipment(-1, id, id);
110 if (fpRawreader->ReadNextData(pSrc) && pSrc!=NULL) {
111 int srcSize=fpRawreader->GetDataSize();
112 int offset=sizeof(AliHLTOUT::AliHLTOUTEventHeader);
113 fpCurrent=fpManager->OpenReaderBuffer(pSrc+offset, srcSize-offset);
114 if (fpCurrent && fpCurrent->ReadNextEvent()!=0) {
124 AliHLTMonitoringReader* pReader=fpCurrent;
125 if ((pBuffer=static_cast<const AliHLTUInt8_t*>(pReader->GetBlockData(blockNo)))!=NULL) {
126 size=pReader->GetBlockDataLength(blockNo);