]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/trigger/AliHLTTrigger.cxx
including the CTPData to the input objects of the HLTGlobalTriggerDecision
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTrigger.cxx
index f4fdfdbbc3eef555e58a1ad1a789f0d342e7cbe9..e911c62a30a3666a83bb385b5ff24e4adad0d4ac 100644 (file)
@@ -1,3 +1,4 @@
+// $Id$
 /**************************************************************************
  * This file is property of and copyright by the ALICE HLT Project        *
  * ALICE Experiment at CERN, All rights reserved.                         *
@@ -24,6 +25,9 @@
 
 #include "AliHLTTrigger.h"
 #include "AliHLTTriggerDecision.h"
+#include "AliHLTReadoutList.h"
+#include "AliHLTTriggerDomain.h"
+#include "AliHLTDomainEntry.h"
 
 ClassImp(AliHLTTrigger)
 
@@ -54,7 +58,10 @@ void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMul
   // Returns output data size estimate.
   // See header file for more details.
 
-  constBase = sizeof(AliHLTTriggerDecision);
+  // Matthias 2009-07-03 this is presumably to small as the streamed object might be
+  // bigger. This is actually the case in root v5-24-00
+  // Just take 2x the size of the object
+  constBase = 2*sizeof(AliHLTTriggerDecision);
   inputMultiplier = 1;
 }
 
@@ -102,9 +109,7 @@ int AliHLTTrigger::TriggerEvent(bool value)
   AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fTriggerDomain, fDescription);
   // Append the readout list if it contains anything.
   triggerResult.TriggerDomain().Add(fReadoutList);
-  fTriggerEventResult = PushBack(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
-  if (fTriggerEventResult == 0) fDecisionMade = true;
-  return fTriggerEventResult;
+  return TriggerEvent(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
 }
 
 
@@ -118,6 +123,10 @@ int AliHLTTrigger::TriggerEvent(
   
   if (fTriggerEventResult != 0) return fTriggerEventResult;  // Do not do anything if a previous call failed.
   fTriggerEventResult = PushBack(result, type, spec);
+  if (fTriggerEventResult == 0) {
+    fTriggerEventResult = PushBack(result->ReadoutList().Buffer(), result->ReadoutList().BufferSize(), "HLTRDLST", "HLT "/*kAliHLTDataTypeDAQRDOUT|kAliHLTDataOriginOut*/);
+  }
+  
   if (fTriggerEventResult == 0) fDecisionMade = true;
   return fTriggerEventResult;
 }
@@ -146,3 +155,48 @@ int AliHLTTrigger::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
   return list.size();
 }
 
+int AliHLTTrigger::CreateEventDoneReadoutFilter(const AliHLTTriggerDomain& domain, unsigned type)
+{
+  // add a readout filter to the EventDoneData
+  int iResult=0;
+  unsigned nofEntries=domain.GetNofEntries();
+  // we need:
+  //   1 word eventually for the monitor event command
+  //   1 word for the readout filter command
+  //   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;
+  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
+  eddbuffer[0]=type;
+  if ((iResult=PushEventDoneData(eddbuffer[0]))<0) return iResult;
+
+  // find the valid entries
+  unsigned block=0;
+  vector<const AliHLTDomainEntry*> entries;
+  for (block=0; block<nofEntries; block++) {
+    // skip all DAQ readout entries as they are handled by the readout list
+    if (domain[block]==AliHLTDomainEntry(kAliHLTDataTypeDAQRDOUT)) continue;
+    if (domain[block].Exclusive()) {
+      HLTWarning("exclusive trigger domain entries are currently not handled, skipping entry %s", domain[block].AsString().Data());
+      continue;
+    }
+    entries.push_back(&(domain[block]));
+  }
+  eddbuffer[0]=entries.size();
+  if ((iResult=PushEventDoneData(eddbuffer[0]))<0) return iResult;
+
+  for (vector<const AliHLTDomainEntry*>::iterator entry=entries.begin();
+       entry!=entries.end(); entry++) {
+    (*entry)->AsBinary(eddbuffer);
+    for (int n=0; n<4; n++)
+      if ((iResult=PushEventDoneData(eddbuffer[n]))<0) return iResult;
+  }
+  return iResult;
+}