]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
generating the EventDoneData information from the HLT trigger domain
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 16 Aug 2009 04:37:01 +0000 (04:37 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 16 Aug 2009 04:37:01 +0000 (04:37 +0000)
HLT/BASE/AliHLTDomainEntry.cxx
HLT/BASE/AliHLTDomainEntry.h
HLT/BASE/AliHLTTriggerDomain.cxx
HLT/BASE/AliHLTTriggerDomain.h
HLT/trigger/AliHLTGlobalTriggerComponent.cxx
HLT/trigger/AliHLTGlobalTriggerComponent.h
HLT/trigger/AliHLTTrigger.cxx
HLT/trigger/AliHLTTrigger.h

index 7bfda707fb357f69dad4e4f03bb00c03e23469e8..98b56d925690b1835114917ab1204c0d2cf0e435 100644 (file)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
 /**************************************************************************
  * This file is property of and copyright by the ALICE HLT Project        *
  * ALICE Experiment at CERN, All rights reserved.                         *
@@ -35,6 +35,7 @@
 #include "Riostream.h"
 #include "TString.h"
 #include <cstring>
+#include <cerrno>
 
 ClassImp(AliHLTDomainEntry)
 
@@ -348,3 +349,37 @@ TString AliHLTDomainEntry::AsString() const
   return str;
 }
 
+int AliHLTDomainEntry::AsBinary(AliHLTUInt32_t buffer[4]) const
+{
+  // convert the data type and specification to a 32 byte buffer
+  if (!buffer) return -EINVAL;
+
+  AliHLTUInt32_t* tgt=buffer; 
+  unsigned ii=0;
+
+  // lower part of the data type id
+  *tgt=0;
+  for ( ii=0; ii<4; ii++ ) {
+    *tgt |= ((AliHLTUInt32_t)(fType.fID[8-1-ii])) << (ii*8);
+  }
+  tgt++;
+         
+  // upper part of the data type id
+  *tgt=0;
+  for ( ii=0; ii<4; ii++ ) {
+    *tgt |= ((AliHLTUInt32_t)(fType.fID[8-5-ii])) << (ii*8);
+  }
+  tgt++;
+  
+  // data type origin
+  *tgt=0;
+  for ( ii=0; ii<4; ii++ ) {
+    *tgt |= ((AliHLTUInt32_t)(fType.fOrigin[4-1-ii])) << (ii*8);
+  }
+  tgt++;
+  
+  // specification
+  *tgt = fSpecification;
+
+  return 0;
+}
index 1ded44a272d2ac5ff15238e945466346c8bc5c9a..54daddff66736775dff8e54dfc11f276b3899060 100644 (file)
@@ -1,5 +1,5 @@
 //-*- Mode: C++ -*-
-// $Id:$
+// $Id$
 #ifndef ALIHLTDOMAINENTRY_H
 #define ALIHLTDOMAINENTRY_H
 /* This file is property of and copyright by the ALICE HLT Project        *
@@ -324,7 +324,14 @@ class AliHLTDomainEntry : public TObject
    * \returns  A string in the format \<type\>:\<origin\>:\<specification\>
    */
   TString AsString() const;
-  
+
+  /**
+   * Converts the three parameters into a 32 byte buffer
+   * As the PubSub expects the data type id and origin in reverse byte order
+   * those two are swapped. 
+   */
+  int AsBinary(AliHLTUInt32_t buffer[4]) const;
+
  private:
   
   Bool_t fExclude;  /// Indicates if the domain entry is exclusive, indicating data blocks that should not be readout.
index e89c05f2f200240d0cb8201bde56b3b2a5838608..a13ae61feb84946f1bf1f9f5c933a04d824a4715 100644 (file)
@@ -1006,3 +1006,8 @@ void AliHLTTriggerDomain::Optimise()
   RemoveMarkedEntries();
 }
 
+const AliHLTDomainEntry& AliHLTTriggerDomain::operator[](int index) const
+{
+  // Access individual entry of the domain
+  return dynamic_cast<AliHLTDomainEntry&>(*fEntries[index]);
+}
index e4a81cb6d04d83e6a7c1025d4bb0836879a6bd88..f03a8fa8595f73321c48c946edc464d993300068 100644 (file)
@@ -1,5 +1,5 @@
 //-*- Mode: C++ -*-
-// $Id:$
+// $Id$
 #ifndef ALIHLTTRIGGERDOMAIN_H
 #define ALIHLTTRIGGERDOMAIN_H
 /* This file is property of and copyright by the ALICE HLT Project        *
@@ -378,6 +378,14 @@ class AliHLTTriggerDomain : public TObject
    * Typecase operator to create a DDL readout list object from the trigger domain.
    */
   operator AliHLTReadoutList () const;
+
+  /**
+   * access of the individual entries
+   */
+  const AliHLTDomainEntry& operator[](int index) const;
+
+  /** get number of entries in the domain */
+  int GetNofEntries()const  {return fEntries.GetEntriesFast();}
   
  private:
   
index 147921e905f177a536a31c8b166d5f286dc02388..82d11f8c2497f93c51b6178f4117ef2b7847e4fa 100644 (file)
@@ -289,7 +289,13 @@ int AliHLTGlobalTriggerComponent::DoTrigger()
     HLTFatal("Global trigger implementation object is NULL!");
     return -EIO;
   }
-  
+
+  AliHLTUInt32_t eventType=0;
+  if (!IsDataEvent(&eventType)) {
+    if (eventType==gkAliEventTypeEndOfRun) PrintStatistics(fTrigger, kHLTLogImportant, 0);
+    return 0;
+  }
+
   fTrigger->NewEvent();
   
   // Fill in the input data.
@@ -318,11 +324,7 @@ int AliHLTGlobalTriggerComponent::DoTrigger()
   TDatime time;
   if (time.Get()-lastTime>5) {
     lastTime=time.Get();
-    ULong64_t count=0;
-    for (int i=0; i<fTrigger->Counters().GetSize(); i++) {
-      count+=fTrigger->Counters()[i];
-    }
-    HLTInfo("total events: %d - triggered events: %lu", GetEventCount()+1, count);
+    PrintStatistics(fTrigger);
   }
   
   // Add the input objects used to the global decision.
@@ -339,7 +341,9 @@ int AliHLTGlobalTriggerComponent::DoTrigger()
     }
     obj = GetNextInputObject();
   }
-  
+
+  CreateEventDoneReadoutFilter(decision.TriggerDomain(), 3);
+  CreateEventDoneReadoutFilter(decision.TriggerDomain(), 4);
   TriggerEvent(&decision);
   return 0;
 }
@@ -808,3 +812,16 @@ int AliHLTGlobalTriggerComponent::BuildSymbolList(const AliHLTTriggerMenu* menu,
   return 0;
 }
 
+int AliHLTGlobalTriggerComponent::PrintStatistics(const AliHLTGlobalTrigger* pTrigger, AliHLTComponentLogSeverity level, int offset) const
+{
+  // print some statistics
+  ULong64_t count=0;
+  for (int i=0; i<pTrigger->Counters().GetSize(); i++) {
+    count+=pTrigger->Counters()[i];
+  }
+  int totalEvents=GetEventCount()+offset;
+  float ratio=0;
+  if (totalEvents>0) ratio=100*(float)count/totalEvents;
+  HLTLog(level, "total events: %d - triggered events: %llu (%.1f%%)", totalEvents, count, ratio);
+  return 0;
+}
index df9de84a2fbc347b75c3f80db465fba99e6e3389..95b86463809348f0c799c40c90fa0da32385124b 100644 (file)
@@ -184,6 +184,11 @@ class AliHLTGlobalTriggerComponent : public AliHLTTrigger
    * \returns  The error code suitable to return in DoInit. Zero on success.
    */
   int BuildSymbolList(const AliHLTTriggerMenu* menu, TClonesArray& list);
+
+  /**
+   * Print some statistics based on the trigger counters
+   */
+  int PrintStatistics(const AliHLTGlobalTrigger* pTrigger, AliHLTComponentLogSeverity level=kHLTLogInfo, int offset=1) const;
   
   AliHLTGlobalTrigger* fTrigger;  //! Trigger object which implements the global trigger menu.
   bool fDebugMode;  //! Indicates if the generated global trigger class should be in debug mode.
index 0f103a632a776431ee2803140d5097f0a9df6144..5ea977fe27ebd04bbde1e6c02843b6dd4c9e8895 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,8 @@
 #include "AliHLTTrigger.h"
 #include "AliHLTTriggerDecision.h"
 #include "AliHLTReadoutList.h"
+#include "AliHLTTriggerDomain.h"
+#include "AliHLTDomainEntry.h"
 
 ClassImp(AliHLTTrigger)
 
@@ -152,3 +155,40 @@ 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 entries=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((entries*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;
+  eddbuffer[0]=entries;
+  if ((iResult=PushEventDoneData(eddbuffer[0]))<0) return iResult;
+
+  for (unsigned block=0; block<entries; 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;
+    }
+    domain[block].AsBinary(eddbuffer);
+    for (int n=0; n<4; n++)
+      if ((iResult=PushEventDoneData(eddbuffer[n]))<0) return iResult;
+  }
+  return iResult;
+}
index c6d362e08b2ee708b139cfda90588786606006f7..4c8938fbc8b2b0938a443af2cb82860fbf0e8fa7 100644 (file)
@@ -1,3 +1,5 @@
+//-*- Mode: C++ -*-
+// $Id$
 #ifndef ALIHLTTRIGGER_H
 #define ALIHLTTRIGGER_H
 /* This file is property of and copyright by the ALICE HLT Project        *
@@ -265,6 +267,15 @@ class AliHLTTrigger : public AliHLTProcessor
    */
   void ClearInfoForNewEvent(bool value = true) { fClearInfo = value; }
 
+  /**
+   * Create the EventDoneData and add the specified readout list
+   * from a Trigger domain object.
+   * @param domain   the domain as calculated by the (Global)trigger
+   * @param type     type of the readout list, defined by PubSub
+   *                  4 monitoring filter
+   */
+  int CreateEventDoneReadoutFilter(const AliHLTTriggerDomain& domain, unsigned type);
+
  private:
  
   /**