/** @file AliHLTOUTComponent.cxx
@author Matthias Richter
@date
- @brief The HLTOUT data sink component similar to HLTOUT nodes */
+ @brief The HLTOUT data sink component similar to HLTOUT nodes
+*/
// see header file for class documentation
// or
#endif
#include <cassert>
-#include <iostream>
+//#include <iostream>
#include "AliHLTOUTComponent.h"
#include "AliHLTOUT.h"
#include "AliHLTHOMERLibManager.h"
AliHLTOfflineDataSink(),
fWriters(),
fNofDDLs(10),
- fIdFirstDDL(4864), // 0x13<<8
- fWriteDigits(kTRUE),
- fWriteRaw(kTRUE),
+ fIdFirstDDL(7680), // 0x1e<<8
fBuffer(),
fpLibManager(NULL)
{
// I guess DDL definitions should never change any more
assert(fNofDDLs==AliDAQ::NumberOfDdls("HLT"));
fNofDDLs=AliDAQ::NumberOfDdls("HLT");
+
+ /* AliDAQ::DdlIDOffset returns wrong offset for HLT links
assert(fIdFirstDDL==AliDAQ::DdlIDOffset("HLT"));
fIdFirstDDL=AliDAQ::DdlIDOffset("HLT");
+ */
}
+int AliHLTOUTComponent::fgOptions=kWriteRawFiles|kWriteDigits;
+
AliHLTOUTComponent::~AliHLTOUTComponent()
{
// see header file for class documentation
{
// see header file for class documentation
int iResult=0;
- HLTInfo("write %d output blocks", evtData.fBlockCnt);
+ HLTInfo("write %d output block(s)", evtData.fBlockCnt);
if (iResult>=0) {
homer_uint64 homerHeader[kCount_64b_Words];
HOMERBlockDescriptor homerDescriptor(homerHeader);
for (int n=0; n<(int)evtData.fBlockCnt; n++ ) {
memset( homerHeader, 0, sizeof(homer_uint64)*kCount_64b_Words );
homerDescriptor.Initialize();
- homerDescriptor.SetType(reinterpret_cast<homer_uint64>(blocks[n].fDataType.fID));
- homerDescriptor.SetSubType1(reinterpret_cast<homer_uint64>(blocks[n].fDataType.fOrigin));
- homerDescriptor.SetSubType2(static_cast<homer_uint64>(blocks[n].fSpecification));
+ // for some traditional reason the TCPDumpSubscriber swaps the bytes
+ // of the data type id and data type origin. Actually I do not understand
+ // the corresponding code line
+ // homerBlock.SetType( blocks[n].fDataType.fID );
+ // this compiles in the PubSub framework and in addition does a byte swap
+ homer_uint64 id=0;
+ homer_uint64 origin=0;
+ memcpy(&id, blocks[n].fDataType.fID, sizeof(homer_uint64));
+ memcpy(((AliHLTUInt8_t*)&origin)+sizeof(homer_uint32), blocks[n].fDataType.fOrigin, sizeof(homer_uint32));
+ homerDescriptor.SetType(AliHLTOUT::ByteSwap64(id));
+ homerDescriptor.SetSubType1(AliHLTOUT::ByteSwap32(origin));
+ homerDescriptor.SetSubType2(blocks[n].fSpecification);
homerDescriptor.SetBlockSize(blocks[n].fSize);
int writerNo=ShuffleWriters(fWriters, blocks[n].fSize);
- assert(writerNo>=0 && writerNo<fWriters.size());
+ assert(writerNo>=0 && writerNo<(int)fWriters.size());
// I'm puzzled by the different headers, buffers etc. used in the
// HOMER writer/data. In additional, there is no type check as there
// are void pointers used and names mixed.
int bufferSize=0;
if ((bufferSize=FillOutputBuffer(eventNo, fWriters[*ddlno], pBuffer))>0) {
- if (fWriteDigits) WriteDigits(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
- if (fWriteRaw) WriteRawFile(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
+ if (fgOptions&kWriteDigits) WriteDigits(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
+ if (fgOptions&kWriteRawFiles) WriteRawFile(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
}
fWriters[*ddlno]->Clear();
ddlno++;
AliHLTOUT::AliHLTOUTEventHeader* pHLTH=reinterpret_cast<AliHLTOUT::AliHLTOUTEventHeader*>(&fBuffer[sizeof(AliRawDataHeader)]);
memset(pCDH, 0, sizeof(AliRawDataHeader));
memset(pHLTH, 0, sizeof(AliHLTOUT::AliHLTOUTEventHeader));
- pHLTH->fVersion=1;
+
if (pWriter) {
// copy payload
pWriter->Copy(&fBuffer[sizeof(AliRawDataHeader)+sizeof(AliHLTOUT::AliHLTOUTEventHeader)], 0, 0, 0, 0);
pHLTH->fLength=pWriter->GetTotalMemorySize();
// set status bit to indicate HLT payload
- pCDH->fStatusMiniEventID|=0x1<<(AliHLTOUT::fgkCDHStatusFlagsOffset+AliHLTOUT::fgkCDHFlagsHLTPayload);
+ pCDH->fStatusMiniEventID|=0x1<<(AliHLTOUT::kCDHStatusFlagsOffset+AliHLTOUT::kCDHFlagsHLTPayload);
}
pHLTH->fLength+=sizeof(AliHLTOUT::AliHLTOUTEventHeader);
pHLTH->fEventID=eventNo;
+ // version does not really matter since we do not add decision data
+ pHLTH->fVersion=AliHLTOUT::kVersion1;
pCDH->fSize=sizeof(AliRawDataHeader)+pHLTH->fLength;
+ pCDH->fStatusMiniEventID|=0x1<<(AliHLTOUT::kCDHStatusFlagsOffset + AliHLTOUT::kCDHFlagsHLTPayload);
pBuffer=&fBuffer[0];
iResult=(int)bufferSize;
}
return iResult;
}
+
+void AliHLTOUTComponent::SetGlobalOption(unsigned int options)
+{
+ // see header file for class documentation
+ fgOptions|=options;
+}
+
+void AliHLTOUTComponent::ClearGlobalOption(unsigned int options)
+{
+ // see header file for class documentation
+ fgOptions&=~options;
+}