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 AliHLTHOMERReader* pReader=fpManager->OpenReader(pSrc, size);
77 iResult=ScanReader(pReader, id);
78 fpManager->DeleteReader(pReader);
87 int AliHLTOUTRawReader::GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer,
90 // see header file for class documentation
93 AliHLTUInt32_t id=index>>fgkIdShift;
94 AliHLTUInt32_t blockNo=index&((0x1<<fgkIdShift)-1);
96 // block from the same ddl requested?
97 if (fpCurrent && fpRawreader->GetEquipmentId()!=id) {
98 fpManager->DeleteReader(fpCurrent);
102 // open ddl for equipment id and create HOMER reader
104 fpRawreader->Reset();
105 fpRawreader->SelectEquipment(-1, id, id);
107 if (fpRawreader->ReadNextData(pSrc) && pSrc!=NULL) {
108 fpCurrent=fpManager->OpenReader(pSrc, size);
116 AliHLTMonitoringReader* pReader=fpCurrent;
117 if ((pBuffer=static_cast<const AliHLTUInt8_t*>(pReader->GetBlockData(blockNo)))!=NULL) {
118 size=pReader->GetBlockDataLength(blockNo);