]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/trigger/AliHLTTrigger.cxx
Added fit macro from M. Putis
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTrigger.cxx
index cd6d818441321b62da8786e947b139bdbe94b295..57f80a8912901e6ac2ee7c402adddad36e9f9bfa 100644 (file)
@@ -28,6 +28,7 @@
 #include "AliHLTReadoutList.h"
 #include "AliHLTTriggerDomain.h"
 #include "AliHLTDomainEntry.h"
+#include "AliHLTCTPData.h"
 
 ClassImp(AliHLTTrigger)
 
@@ -123,7 +124,7 @@ int AliHLTTrigger::TriggerEvent(bool value)
   AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fTriggerDomain, fDescription);
   // Append the readout list if it contains anything.
   triggerResult.TriggerDomain().Add(fReadoutList);
-  return TriggerEvent(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
+  return TriggerEvent(&triggerResult, kAliHLTDataTypeTriggerDecision);
 }
 
 
@@ -136,9 +137,12 @@ int AliHLTTrigger::TriggerEvent(
   // See header file for more details.
   
   if (fTriggerEventResult != 0) return fTriggerEventResult;  // Do not do anything if a previous call failed.
+  
+  AliHLTReadoutList readoutlist = result->ReadoutList();
+  
   fTriggerEventResult = PushBack(result, type, spec);
   if (fTriggerEventResult == 0) {
-    fTriggerEventResult = PushBack(result->ReadoutList().Buffer(), result->ReadoutList().BufferSize(), kAliHLTDataTypeReadoutList);
+    fTriggerEventResult = PushBack(readoutlist.Buffer(), readoutlist.BufferSize(), kAliHLTDataTypeReadoutList);
   }
   
   if (fTriggerEventResult == 0) fDecisionMade = true;
@@ -173,21 +177,30 @@ int AliHLTTrigger::CreateEventDoneReadoutFilter(const AliHLTTriggerDomain& domai
 {
   // add a readout filter to the EventDoneData
   int iResult=0;
-  unsigned nofEntries=domain.GetNofEntries();
+  unsigned nofEntries=0;
+  switch (type) {
+  /* readout filter */
+  case 3:
+  /* monitoring filter */
+  case 4:
+    nofEntries=domain.GetNofEntries();
+    break;
+  /* monitoring event command */
+  case 5:
+    break;
+  default:
+    HLTError("unknown event done data command code 0x%08x", type);
+    return -EINVAL;
+  }
+
   // we need:
-  //   1 word eventually for the monitor event command
-  //   1 word for the readout filter command
+  //   1 word for the filter command: readout filter, monitoring filter, monitoring event
   //   1 word for the readout filter size
   // 4*n words for the filter list
-  if ((iResult=ReserveEventDoneData((nofEntries*4 + 3) * sizeof(AliHLTUInt32_t)))<0) return iResult;
+  if ((iResult=ReserveEventDoneData((nofEntries*4 + 2) * sizeof(AliHLTUInt32_t)))<0) return iResult;
   AliHLTUInt32_t eddbuffer[4];
-  if (type==4) {
-    // in the case of the monitoring filter we also add the monitor event command
-    eddbuffer[0]=5;
-    if ((iResult=PushEventDoneData(eddbuffer[0]))<0) return iResult;
-  }
 
-  // now the readout list command and the block count
+  // add the specific command
   eddbuffer[0]=type;
   if ((iResult=PushEventDoneData(eddbuffer[0]))<0) return iResult;
 
@@ -211,8 +224,12 @@ int AliHLTTrigger::CreateEventDoneReadoutFilter(const AliHLTTriggerDomain& domai
     }
     entries.push_back(&(domain[block]));
   }
-  eddbuffer[0]=entries.size();
-  if ((iResult=PushEventDoneData(eddbuffer[0]))<0) return iResult;
+
+  // add the number of blocks if not monitoring event command
+  if (type!=5) {
+    eddbuffer[0]=entries.size();
+    if ((iResult=PushEventDoneData(eddbuffer[0]))<0) return iResult;
+  }
 
   for (vector<const AliHLTDomainEntry*>::iterator entry=entries.begin();
        entry!=entries.end(); entry++) {