]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/trigger/AliHLTTrigger.cxx
adding missing argument in printf statement
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTrigger.cxx
index 0f103a632a776431ee2803140d5097f0a9df6144..e0e09d4f14f00ed6cccae31142a23d4a7c01cc98 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.                         *
@@ -25,6 +26,9 @@
 #include "AliHLTTrigger.h"
 #include "AliHLTTriggerDecision.h"
 #include "AliHLTReadoutList.h"
+#include "AliHLTTriggerDomain.h"
+#include "AliHLTDomainEntry.h"
+#include "AliHLTCTPData.h"
 
 ClassImp(AliHLTTrigger)
 
@@ -50,6 +54,20 @@ AliHLTTrigger::~AliHLTTrigger()
 }
 
 
+void AliHLTTrigger::GetInputDataTypes(AliHLTComponentDataTypeList& list) const
+{
+  // Returns the kAliHLTAnyDataType type as input.
+  list.push_back(kAliHLTAnyDataType);
+}
+
+
+void AliHLTTrigger::GetOutputDataTypes(AliHLTComponentDataTypeList& list) const
+{
+  // Returns the kAliHLTDataTypeTriggerDecision type as output.
+  list.push_back(kAliHLTDataTypeTriggerDecision);
+}
+
+
 void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
 {
   // Returns output data size estimate.
@@ -119,9 +137,20 @@ 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();
+  // mask the readout list according to the CTP trigger
+  // if the classes have been initialized (mask non-zero)
+  if (CTPData() != NULL and CTPData()->Mask() != 0x0) {
+    AliHLTReadoutList ctpreadout = CTPData()->ReadoutList(*GetTriggerData());
+    ctpreadout.Enable(AliHLTReadoutList::kHLT);
+    readoutlist.AndEq(ctpreadout);
+    result->ReadoutList(readoutlist); // override the readout list with the masked one.
+  }
+  
   fTriggerEventResult = PushBack(result, type, spec);
   if (fTriggerEventResult == 0) {
-    fTriggerEventResult = PushBack(result->ReadoutList().Buffer(), result->ReadoutList().BufferSize(), "HLTRDLST", "HLT "/*kAliHLTDataTypeDAQRDOUT|kAliHLTDataOriginOut*/);
+    fTriggerEventResult = PushBack(readoutlist.Buffer(), readoutlist.BufferSize(), kAliHLTDataTypeReadoutList);
   }
   
   if (fTriggerEventResult == 0) fDecisionMade = true;
@@ -148,7 +177,73 @@ int AliHLTTrigger::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
   // of the GetOutputDataTypes method.
   const AliHLTTrigger* t = this;
   t->GetOutputDataTypes(list);
-  list.push_back(kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
+  list.push_back(kAliHLTDataTypeReadoutList);
   return list.size();
 }
 
+int AliHLTTrigger::CreateEventDoneReadoutFilter(const AliHLTTriggerDomain& domain, unsigned type)
+{
+  // add a readout filter to the EventDoneData
+  int iResult=0;
+  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 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 + 2) * sizeof(AliHLTUInt32_t)))<0) return iResult;
+  AliHLTUInt32_t eddbuffer[4];
+
+  // add the specific command
+  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
+    // 2009-12-03: this turned out to cause a bug, since all blocks with data type
+    // id 'any' will also match this condition. In fact, it is not necessary to
+    // filter the entries, disable this condition. Code can be cleaned up later
+    // if this schema has been established and tested
+    // https://savannah.cern.ch/bugs/index.php?60082
+    //if (domain[block]==AliHLTDomainEntry(kAliHLTDataTypeDAQRDOUT)) continue;
+    if (domain[block].Exclusive()) {
+      // 2009-12-03 comment out that warning for the moment
+      // there are suddenly exclusive entries in the list
+      // https://savannah.cern.ch/bugs/index.php?60083
+      //HLTWarning("exclusive trigger domain entries are currently not handled, skipping entry %s", domain[block].AsString().Data());
+      continue;
+    }
+    entries.push_back(&(domain[block]));
+  }
+
+  // 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++) {
+    (*entry)->AsBinary(eddbuffer);
+    for (int n=0; n<4; n++)
+      if ((iResult=PushEventDoneData(eddbuffer[n]))<0) return iResult;
+  }
+  return iResult;
+}