// $Id$
//**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project *
+//* This file is property of and copyright by the *
//* 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 *
//* provided "as is" without express or implied warranty. *
//**************************************************************************
-/** @file AliHLTOUTHomerCollection.cxx
- @author Matthias Richter
- @date
- @brief General HLTOUT data collection.
-*/
+/// @file AliHLTOUTHomerCollection.cxx
+/// @author Matthias Richter
+/// @date
+/// @brief General collection for HLTOUT data in DDL format.
+///
#include "AliHLTOUTHomerCollection.h"
#include "AliHLTHOMERLibManager.h"
#include "AliHLTHOMERReader.h"
-#include "AliRawDataHeader.h"
#include "AliHLTEsdManager.h"
+#include "AliDAQ.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTOUTHomerCollection)
AliHLTOUTHomerCollection::AliHLTOUTHomerCollection(int event, AliHLTEsdManager* pEsdManager)
:
AliHLTOUTHomerBuffer(NULL, 0),
- fpCurrent(NULL),
fEvent(event),
+ fpCurrent(NULL),
fpEsdManager(pEsdManager)
{
+ // constructor
+ //
+ // General collection for HLTOUT data in DDL format
+ //
// 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 AliHLTOUTHomerCollection::fgkIdShift=16;
AliHLTOUTHomerCollection::~AliHLTOUTHomerCollection()
{
- // see header file for class documentation
+ // destructor
if (fpManager) {
if (fpCurrent) fpManager->DeleteReader(fpCurrent);
fpCurrent=NULL;
int AliHLTOUTHomerCollection::GenerateIndex()
{
- // see header file for class documentation
+ // Overloaded from AliHLTOUT
// step through all HLT ddls, create HOMER readers and
// scan data block
int iResult=0;
if (fpManager) {
Reset();
- // there was a bug in AliDAQ returning the wrong equipment id
- // for the HLT links. It has been fixed in the trunk on Feb 5th 2008
- // and from v4-10-Release (Rev-02). For the moment we select directly
- // to support older AliRoot versions
- //Select("HLT");
- SelectEquipment(0,7680, 7689);
+ int firstLink=AliDAQ::DdlIDOffset("HLT");
+ int nofDDLs=AliDAQ::NumberOfDdls("HLT");
+ SelectEquipment(-1,firstLink, firstLink+nofDDLs);
UChar_t* pSrc=NULL;
while (ReadNextData(pSrc) && pSrc!=NULL && iResult>=0) {
AliHLTUInt32_t id=(GetEquipmentId());
int AliHLTOUTHomerCollection::GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer,
AliHLTUInt32_t& size)
{
- // see header file for class documentation
+ // Overloaded from AliHLTOUT: get data buffer at specified index
int iResult=0;
pBuffer=NULL;
size=0;
AliHLTHOMERReader* AliHLTOUTHomerCollection::OpenReader(UChar_t* pSrc, unsigned int size)
{
- // see header file for class documentation
+ // open HOMER reader for buffer
unsigned int offset=sizeof(AliHLTOUTEventHeader);
- const AliRawDataHeader* pCDH=GetDataHeader();
+ AliHLTCDHWrapper pCDH=GetDataHeader();
AliHLTUInt32_t id=(GetEquipmentId());
- AliHLTUInt32_t statusFlags=pCDH->GetStatus();
+ AliHLTUInt32_t statusFlags=pCDH.GetStatus();
AliHLTOUTEventHeader* pHLTHeader=reinterpret_cast<AliHLTOUTEventHeader*>(pSrc);
// consistency check for the block size
- if (pHLTHeader->fLength!=size) {
- HLTWarning("can not treat HLT data block %d: size mismatch, header %d, but buffer is %d", id, pHLTHeader->fLength, size);
+ if (pHLTHeader->fLength>size) {
+ HLTError("can not treat HLT data block %d: size mismatch, header %d, but buffer is %d", id, pHLTHeader->fLength, size);
return NULL;
+ } else if (pHLTHeader->fLength<size-3) {
+ // data payload is aligned to 32bit, so there can be a difference by at most 3 bytes
+ HLTWarning("size mismatch in HLT data block %d: header %d, but buffer is %d", id, pHLTHeader->fLength, size);
}
// determine the offset of the homer block
if (!(statusFlags&(0x1<<kCDHFlagsHLTPayload))) return NULL;
// continue if there is no data left in the buffer
- if (offset>=size) {
+ if (offset>=pHLTHeader->fLength) {
HLTWarning("no HLT payload available, but bit is set, skipping ...");
return NULL;
}
return NULL;
}
- return fpManager->OpenReaderBuffer(pSrc+offset, size-offset);
+ AliHLTUInt64_t eventId=pHLTHeader->fEventIDHigh;
+ eventId = eventId<<32;
+ eventId|=pHLTHeader->fEventIDLow;
+ SetEventId(eventId);
+ return fpManager->OpenReaderBuffer(pSrc+offset, pHLTHeader->fLength-offset);
}
int AliHLTOUTHomerCollection::WriteESD(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size, AliHLTComponentDataType dt, AliESDEvent* tgtesd) const
{
- // see header file for class documentation
+ // write ESD
if (!pBuffer && size<=0) return -EINVAL;
int iResult=0;
if (fpEsdManager) {