#include "AliCDBManager.h"
#include "AliCDBStorage.h"
#include "AliCDBEntry.h"
-#include "AliRawDataHeader.h"
#include "TUUID.h"
#include "TROOT.h"
#include "TSystem.h"
if (result != 0) return result;
if (fDeleteCodeFile and !fCodeFileName.IsNull() && gSystem->AccessPathName(fCodeFileName)==0 && !fDebugMode) {
- fCodeFileName.ReplaceAll(".cxx", "*");
- TString command="rm "; command+=fCodeFileName;
+ TString command="rm -f ";
+ command+=fCodeFileName + " " + TString(fCodeFileName).ReplaceAll(".cxx", "_cxx.d");
gSystem->Exec(command);
}
fCodeFileName="";
AliHLTUInt32_t eventType=0;
if (!IsDataEvent(&eventType)) {
- if (eventType==gkAliEventTypeEndOfRun) PrintStatistics(fTrigger, kHLTLogImportant, 0);
if (fDataEventsOnly)
{
+ if (eventType == gkAliEventTypeEndOfRun) PrintStatistics(fTrigger, kHLTLogImportant);
IgnoreEvent(); // dont generate any trigger decision.
return 0;
}
}
fCDH = NULL; // have to reset this in case ExtractTriggerData fails.
- ExtractTriggerData(*GetTriggerData(), NULL, NULL, &fCDH, NULL);
-
+ int triggerSuccess=ExtractTriggerData(*GetTriggerData(), NULL, NULL, &fCDH, NULL, true);
+ if(triggerSuccess<0){
+ HLTError("Couldn't extract CDH from trigger data: %s", strerror(-triggerSuccess));
+ return -EPROTO;
+ }
// Copy the trigger counters in case we need to set them back to their original
// value because the PushBack method fails with ENOSPC.
TArrayL64 originalCounters = fTrigger->GetCounters();
static UInt_t lastTime=0;
TDatime time;
- if (time.Get()-lastTime>60) {
+ if (time.Get()-lastTime>60)
+ {
lastTime=time.Get();
PrintStatistics(fTrigger, kHLTLogImportant);
}
-
+ else if (eventType==gkAliEventTypeEndOfRun)
+ {
+ PrintStatistics(fTrigger, kHLTLogImportant);
+ }
+
// add readout filter to event done data
CreateEventDoneReadoutFilter(decision.TriggerDomain(), 3);
// If we are dealing with a software trigger on the other hand then
// mask with the participating detector list.
// In both cases we must make sure that HLT is part of the readout mask.
+ AliHLTReadoutList readoutlist = decision.ReadoutList();
+ AliHLTReadoutList readoutMask;
if (CTPData() != NULL and CTPData()->Mask() != 0x0)
{
- AliHLTReadoutList readoutlist = decision.ReadoutList();
- AliHLTReadoutList ctpreadout = CTPData()->ReadoutList(*GetTriggerData());
- ctpreadout.Enable(AliHLTReadoutList::kHLT);
- readoutlist.AndEq(ctpreadout);
- decision.ReadoutList(readoutlist); // override the readout list with the masked one.
+ readoutMask = CTPData()->ReadoutList(*GetTriggerData());
+ readoutMask.Enable(AliHLTReadoutList::kHLT);
}
else if (softwareTriggerIsValid)
{
- assert(fCDH != NULL);
- AliHLTReadoutList readoutlist = decision.ReadoutList();
- UInt_t detectors = fCDH->GetSubDetectors();
- AliHLTReadoutList softwareReadout(Int_t(detectors | AliHLTReadoutList::kHLT));
- readoutlist.AndEq(softwareReadout);
- decision.ReadoutList(readoutlist); // override the readout list with the masked one.
+ UInt_t detectors = fCDH.GetSubDetectors();
+ readoutMask = AliHLTReadoutList(Int_t(detectors | AliHLTReadoutList::kHLT));
+ }
+ readoutlist.AndEq(readoutMask);
+ decision.ReadoutList(readoutlist); // override the readout list with the masked one.
+
+ // Also check whether the final readout list equals a full readout of detectors
+ // irrespective of HLT.
+ // Calculate the difference between the input and output list (xor)
+ // and check if any bits are set (ignoring HLT).
+ AliHLTReadoutList::EDetectorId minDetector = ( readoutlist ^ readoutMask ).GetFirstUsedDetector();
+ // Create the readout list specification word:
+ // Bit 0: Original Data Present (bit 15 of CDH status & error bit to be set)
+ // Bit 1-31: Reserved for future use
+ AliHLTUInt32_t spec = 0x0;
+ if ( AliHLTReadoutList::kNoDetector == minDetector || AliHLTReadoutList::kHLT == minDetector ) // Any bits set after XOR?
+ {
+ spec |= (AliHLTUInt32_t) 0x1;
+ }
+ else
+ {
+ spec &= ~((AliHLTUInt32_t) 0x1);
}
+ SetReadoutListSpecBits(spec);
if (TriggerEvent(&decision, kAliHLTDataTypeGlobalTrigger) == -ENOSPC)
{
UnloadTriggerClass(codeFileName);
if (not codeFileName.IsNull() and gSystem->AccessPathName(codeFileName)==0 and not fDebugMode)
{
- codeFileName.ReplaceAll(".cxx", "*");
- TString command="rm "; command+=codeFileName;
+ TString command="rm -f ";
+ command+=codeFileName + " " + TString(codeFileName).ReplaceAll(".cxx", "_cxx.d");
gSystem->Exec(command);
}
return -EIO;
UnloadTriggerClass(fCodeFileName);
if (fDeleteCodeFile and not fCodeFileName.IsNull() and gSystem->AccessPathName(fCodeFileName)==0 and not fDebugMode)
{
- fCodeFileName.ReplaceAll(".cxx", "*");
- TString command="rm "; command+=fCodeFileName;
+ TString command="rm -f ";
+ command+=fCodeFileName + " " + TString(fCodeFileName).ReplaceAll(".cxx", "_cxx.d");
gSystem->Exec(command);
}
fCodeFileName = codeFileName;
// Loads the trigger menu object from the CDB path.
HLTDebug("Trying to load trigger menu from '%s'.", cdbPath);
- if (AliCDBManager::Instance() == NULL)
- {
- HLTError("CDB manager object not found.");
- return -EIO;
- }
- AliCDBStorage* store = AliCDBManager::Instance()->GetDefaultStorage();
- if (store == NULL)
- {
- HLTError("Could not get the the default storage for the CDB.");
- return -EIO;
- }
- Int_t version = store->GetLatestVersion(cdbPath, GetRunNo());
- Int_t subVersion = store->GetLatestSubVersion(cdbPath, GetRunNo(), version);
- AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, GetRunNo(), version, subVersion);
- if (entry == NULL)
- {
- HLTError("Could not get the CDB entry for \"%s\".", cdbPath);
- return -EIO;
- }
- TObject* obj = entry->GetObject();
+ TObject* obj = LoadAndExtractOCDBObject(cdbPath);
if (obj == NULL)
{
HLTError("Configuration object for \"%s\" is missing.", cdbPath);
HLTDebug("Loading HLT trigger class from file '%s'.", filename);
TString compiler = gSystem->GetBuildCompilerVersion();
- if (fRuntimeCompile && (compiler.Contains("gcc") or compiler.Contains("icc")))
+ if (fRuntimeCompile
+ && (compiler.Contains("gcc")
+ || compiler.Contains("icc")
+ || compiler.Contains("clang")
+ || compiler.Contains("c++")
+ ))
{
TString includePath;
#if defined(PKGINCLUDEDIR)
{
// Fills the fSoftwareTrigger structure.
- if (fCDH == NULL) return false;
- UChar_t l1msg = fCDH->GetL1TriggerMessage();
+ UChar_t l1msg = fCDH.GetL1TriggerMessage();
if ((l1msg & 0x1) == 0x0) return false; // skip physics events.
// From here on everything must be a software trigger.
if (((l1msg >> 2) & 0xF) == 0xE)
fSoftwareTrigger.Name("SOFTWARE");
fSoftwareTrigger.Description("Generated internal software trigger.");
}
- UInt_t detectors = fCDH->GetSubDetectors();
+ UInt_t detectors = fCDH.GetSubDetectors();
fSoftwareTrigger.ReadoutList( AliHLTReadoutList(Int_t(detectors)) );
return true;
}
int AliHLTGlobalTriggerComponent::PrintStatistics(const AliHLTGlobalTrigger* pTrigger, AliHLTComponentLogSeverity level, int offset) const
{
// print some statistics
- int totalEvents=GetEventCount()+offset;
+ int totalEvents=fTotalEventCounter+offset;
const TArrayL64& counters = pTrigger->GetCounters();
if (pTrigger->CallFailed()) return -EPROTO;
for (int i = 0; i < counters.GetSize(); i++) {
// add trigger decisions for the valid CTP classes
if (!pCTPData || !pTrigger) return 0;
- AliHLTUInt64_t triggerMask=pCTPData->Mask();
- AliHLTUInt64_t bit0=0x1;
+ AliHLTTriggerMask_t triggerMask=pCTPData->Mask();
+ AliHLTTriggerMask_t bit0(0x1);
if (!fCTPDecisions) {
try
{
}
for (int i=0; i<gkNCTPTriggerClasses; i++) {
const char* name=pCTPData->Name(i);
- if (triggerMask&(bit0<<i) && name) {
+ if ( (triggerMask&(bit0<<i)).any() && name) {
AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(fCTPDecisions->At(i));
assert(pDecision);
if (!pDecision) {
for (int i=0; i<gkNCTPTriggerClasses; i++) {
const char* name=pCTPData->Name(i);
- if ((triggerMask&(bit0<<i))==0 || name==NULL) continue;
+ if ((triggerMask&(bit0<<i)).none() || name==NULL) continue;
AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(fCTPDecisions->At(i));
HLTDebug("updating CTP trigger decision %d %s (%p casted %p)", i, name, fCTPDecisions->At(i), pDecision);
if (!pDecision) return -ENOENT;
bool result=false;
// 13 March 2010 - Optimisation:
// Dont use the EvaluateCTPTriggerClass method, which uses slow TFormula objects.
- AliHLTUInt64_t triggers = 0;
+ AliHLTTriggerMask_t triggers = 0;
if (trigData) triggers = pCTPData->ActiveTriggers(*trigData);
else triggers = pCTPData->Triggers();
- result = (triggers&((AliHLTUInt64_t)0x1<<i)) ? true : false;
+ result = (triggers&(bit0<<i)).any() ? true : false;
//if (trigData) result=pCTPData->EvaluateCTPTriggerClass(name, *trigData);
//else result=pCTPData->EvaluateCTPTriggerClass(name);
pDecision->Result(result);