-// $Id:$
+// $Id$
/**************************************************************************
* This file is property of and copyright by the ALICE HLT Project *
* ALICE Experiment at CERN, All rights reserved. *
#include "Riostream.h"
#include "TString.h"
#include <cstring>
+#include <cerrno>
ClassImp(AliHLTDomainEntry)
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;
+}
//-*- Mode: C++ -*-
-// $Id:$
+// $Id$
#ifndef ALIHLTDOMAINENTRY_H
#define ALIHLTDOMAINENTRY_H
/* This file is property of and copyright by the ALICE HLT Project *
* \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.
RemoveMarkedEntries();
}
+const AliHLTDomainEntry& AliHLTTriggerDomain::operator[](int index) const
+{
+ // Access individual entry of the domain
+ return dynamic_cast<AliHLTDomainEntry&>(*fEntries[index]);
+}
//-*- Mode: C++ -*-
-// $Id:$
+// $Id$
#ifndef ALIHLTTRIGGERDOMAIN_H
#define ALIHLTTRIGGERDOMAIN_H
/* This file is property of and copyright by the ALICE HLT Project *
* 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:
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.
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.
}
obj = GetNextInputObject();
}
-
+
+ CreateEventDoneReadoutFilter(decision.TriggerDomain(), 3);
+ CreateEventDoneReadoutFilter(decision.TriggerDomain(), 4);
TriggerEvent(&decision);
return 0;
}
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;
+}
* \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.
+// $Id$
/**************************************************************************
* This file is property of and copyright by the ALICE HLT Project *
* ALICE Experiment at CERN, All rights reserved. *
#include "AliHLTTrigger.h"
#include "AliHLTTriggerDecision.h"
#include "AliHLTReadoutList.h"
+#include "AliHLTTriggerDomain.h"
+#include "AliHLTDomainEntry.h"
ClassImp(AliHLTTrigger)
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;
+}
+//-*- Mode: C++ -*-
+// $Id$
#ifndef ALIHLTTRIGGER_H
#define ALIHLTTRIGGER_H
/* This file is property of and copyright by the ALICE HLT Project *
*/
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:
/**