]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/sim/AliHLTOUTComponent.cxx
Adding definitions for the fields of the lookup tables used in the dHLT analysis...
[u/mrichter/AliRoot.git] / HLT / sim / AliHLTOUTComponent.cxx
index 965b8852023a0b64b667c0084671ab0e197bd712..dabafe584726bdff53bf5190835395fc4a138a72 100644 (file)
@@ -51,9 +51,7 @@ AliHLTOUTComponent::AliHLTOUTComponent()
   AliHLTOfflineDataSink(),
   fWriters(),
   fNofDDLs(10),
-  fIdFirstDDL(4864), // 0x13<<8
-  fWriteDigits(kTRUE),
-  fWriteRaw(kTRUE),
+  fIdFirstDDL(7680), // 0x1e<<8
   fBuffer(),
   fpLibManager(NULL)
 {
@@ -66,10 +64,15 @@ AliHLTOUTComponent::AliHLTOUTComponent()
   // 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
@@ -177,16 +180,25 @@ int AliHLTOUTComponent::DumpEvent( const AliHLTComponentEventData& evtData,
 {
   // 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<const homer_uint64*>(blocks[n].fDataType.fID)));
-      homerDescriptor.SetSubType1(*(reinterpret_cast<const homer_uint32*>(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<(int)fWriters.size());
@@ -229,8 +241,8 @@ int AliHLTOUTComponent::FillESD(int eventNo, AliRunLoader* runLoader, AliESDEven
     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++;
@@ -296,7 +308,7 @@ int AliHLTOUTComponent::FillOutputBuffer(int eventNo, AliHLTMonitoringWriter* pW
     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);
@@ -306,8 +318,11 @@ int AliHLTOUTComponent::FillOutputBuffer(int eventNo, AliHLTMonitoringWriter* pW
     }
     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;
@@ -353,3 +368,15 @@ int AliHLTOUTComponent::WriteRawFile(int eventNo, AliRunLoader* /*runLoader*/, i
   }
   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;
+}