- the TClonesArray of trigger decision objects designated for the CTP triggers is now owned by the trigger component
- proper fix for the header include problem (https://savannah.cern.ch/bugs/?56302): in case of HLT build system, include files are taken from the include directory of the installation
- minor bugfix AliHLTGlobalTriggerComponent command arg parsing: -debug skipped next argument
- bugfix AliHLTGlobalTriggerComponent: the -skipctp option is now only applied on the level of adding CTP info to the output trigger decision object. The CTPData object is needed in any case to perform the masking of the readout
list according to the detectors of the CTP trigger class
- added option '-cint' to switch to CINT interpretation of the generated trigger code instead of runtime compilation, some fixes regarding this, but did not get it working so far
#include "AliHLTGlobalTrigger.h"
#include "AliHLTGlobalTriggerDecision.h"
-#include "AliHLTCTPData.h"
-#include "TArrayL64.h"
-#include "TClonesArray.h"
#include <cstring>
-#include <cassert>
ClassImp(AliHLTGlobalTrigger)
AliHLTGlobalTrigger::AliHLTGlobalTrigger() :
- AliHLTLogging()
- , fCTPDecisions(NULL)
- , fCounters(NULL)
+ AliHLTLogging(),
+ fCounters()
{
// Default constructor.
}
AliHLTGlobalTrigger::~AliHLTGlobalTrigger()
{
// Default destructor.
- if (fCounters) {
- delete fCounters;
- }
- if (fCTPDecisions) {
- fCTPDecisions->Delete();
- delete fCTPDecisions;
- }
}
{
// Resets the trigger counters.
- if (!fCounters) fCounters = new TArrayL64(number);
- if (!fCounters) return;
-
- fCounters->Set(number);
+ fCounters.Set(number);
for (UInt_t i = 0; i < number; i++)
{
- (*fCounters)[i] = 0;
- }
-}
-
-void AliHLTGlobalTrigger::IncrementCounter(UInt_t i)
-{
- // increment a specific counter
- if (fCounters && i<(unsigned)fCounters->GetSize()) ++(*fCounters)[i];
-}
-
-Long64_t AliHLTGlobalTrigger::GetCounter(UInt_t i) const
-{
- if (fCounters && i<(unsigned)fCounters->GetSize()) return (*fCounters)[i];
- return 0;
-}
-
-int AliHLTGlobalTrigger::AddCTPDecisions(const AliHLTCTPData* pCTPData, const AliHLTComponentTriggerData* trigData)
-{
- // add trigger decisions for the valid CTP classes
- if (!pCTPData) return 0;
-
- AliHLTUInt64_t triggerMask=pCTPData->Mask();
- AliHLTUInt64_t bit0=0x1;
- if (!fCTPDecisions) {
- fCTPDecisions=new TClonesArray(AliHLTTriggerDecision::Class(), gkNCTPTriggerClasses);
- if (!fCTPDecisions) return -ENOMEM;
-
- fCTPDecisions->ExpandCreate(gkNCTPTriggerClasses);
- for (int i=0; i<gkNCTPTriggerClasses; i++) {
- const char* name=pCTPData->Name(i);
- if (triggerMask&(bit0<<i) && name) {
- AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(fCTPDecisions->At(i));
- assert(pDecision);
- if (!pDecision) return -ENOENT;
- pDecision->Name(name);
- }
- }
- }
-
- for (int i=0; i<gkNCTPTriggerClasses; i++) {
- const char* name=pCTPData->Name(i);
- if ((triggerMask&(bit0<<i))==0 || 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;
- if (trigData) result=pCTPData->EvaluateCTPTriggerClass(name, *trigData);
- else result=pCTPData->EvaluateCTPTriggerClass(name);
- pDecision->Result(result);
- pDecision->TriggerDomain().Clear();
- pDecision->TriggerDomain().Add(pCTPData->ReadoutList(*trigData));
-
- Add(fCTPDecisions->At(i), kAliHLTDataTypeTriggerDecision, kAliHLTVoidDataSpec);
+ fCounters[i] = 0;
}
-
- return 0;
}
/// @brief Declaration of the AliHLTGlobalTrigger base class.
#include "TObject.h"
+#include "TArrayL64.h"
#include "AliHLTDataTypes.h"
#include "AliHLTLogging.h"
class AliHLTTriggerDecision;
class AliHLTGlobalTriggerDecision;
class AliHLTTriggerMenu;
-class AliHLTCTPData;
class TClonesArray;
-class TArrayL64;
/**
* \class AliHLTGlobalTrigger
* internal buffers should be cleared or reset.
*/
virtual void NewEvent() = 0;
-
- /**
- * Add trigger decisions according to the active CTP trigger classes
- */
- int AddCTPDecisions(const AliHLTCTPData* pCTPData, const AliHLTComponentTriggerData* trigData=NULL);
-
+
/**
* Abstract method which should fill in the internal attributes from the given
* object.
/**
* Returns the array of trigger counters.
*/
- const TArrayL64* Counters() const { return fCounters; }
+ const TArrayL64& Counters() const { return fCounters; }
- TClonesArray* GetCTPDecisions() const {return fCTPDecisions; }
-
protected:
/**
static Factory* fFactory[kMaxFactories];
};
+ /// Not implemented. Do not allow copying of this object.
+ AliHLTGlobalTrigger(const AliHLTGlobalTrigger& obj);
+ /// Not implemented. Do not allow copying of this object.
+ AliHLTGlobalTrigger& operator = (const AliHLTGlobalTrigger& obj);
+
/**
* Increments a trigger counter by one.
* \param i The counter to increment.
*/
- void IncrementCounter(UInt_t i);
+ void IncrementCounter(UInt_t i) { ++fCounters[i]; };
/**
* Returns a trigger counter's value.
* \param i The counter number to return.
*/
- Long64_t GetCounter(UInt_t i) const;
+ Long64_t GetCounter(UInt_t i) const { return fCounters[i]; };
private:
- /// Not implemented. Do not allow copying of this object.
- AliHLTGlobalTrigger(const AliHLTGlobalTrigger& obj);
- /// Not implemented. Do not allow copying of this object.
- AliHLTGlobalTrigger& operator = (const AliHLTGlobalTrigger& obj);
-
- TClonesArray* fCTPDecisions; //! AliHLTTriggerDecision objects for the CTP classes
- TArrayL64* fCounters; //! Event trigger counters. One counter for each trigger class.
+
+ TArrayL64 fCounters; //! Event trigger counters. One counter for each trigger class.
ClassDef(AliHLTGlobalTrigger, 0) // Global HLT trigger base class which implements logic for a particular trigger menu.
};
#include "TDatime.h"
#include <fstream>
#include <cerrno>
+#include <cassert>
ClassImp(AliHLTGlobalTriggerComponent)
AliHLTTrigger(),
fTrigger(NULL),
fDebugMode(false),
- fCodeFileName()
+ fRuntimeCompile(true),
+ fSkipCTPCounters(false),
+ fCodeFileName(),
+ fCTPDecisions(NULL)
{
// Default constructor.
// Default destructor.
if (fTrigger != NULL) delete fTrigger;
+
+ if (fCTPDecisions) {
+ fCTPDecisions->Delete();
+ delete fCTPDecisions;
+ }
}
// Initialises the global trigger component.
fDebugMode = false;
- bool bSkipCTPCounters=false;
const char* configFileName = NULL;
const char* codeFileName = NULL;
TString classname;
HLTWarning("The debug flag was already specified. Ignoring this instance.");
}
fDebugMode = true;
- i++;
+ continue;
+ }
+
+ if (strcmp(argv[i], "-cint") == 0)
+ {
+ fRuntimeCompile = false;
continue;
}
if (strcmp(argv[i], "-skipctp") == 0)
{
HLTInfo("Skipping CTP counters in trigger decision");
- bSkipCTPCounters=true;
+ fSkipCTPCounters=true;
continue;
}
fTrigger->ResetCounters(menu->NumberOfItems());
// setup the CTP accounting in AliHLTComponent
- if (!bSkipCTPCounters) SetupCTPData();
+ SetupCTPData();
// Set the default values from the trigger menu.
SetDescription(menu->DefaultDescription());
}
fCodeFileName="";
+ if (fCTPDecisions) {
+ fCTPDecisions->Delete();
+ delete fCTPDecisions;
+ }
+ fCTPDecisions=NULL;
+
return 0;
}
// add trigger decisions for every CTP class
const AliHLTCTPData* pCTPData=CTPData();
if (pCTPData) {
- fTrigger->AddCTPDecisions(pCTPData, GetTriggerData());
+ AddCTPDecisions(fTrigger, pCTPData, GetTriggerData());
}
// Calculate the global trigger result and trigger domain, then create and push
decision.ReadoutList(maskedList);
}
- const TArrayL64* counters=fTrigger->Counters();
- if (counters) {
- decision.SetCounters(*counters, GetEventCount()+1);
- }
+ decision.SetCounters(fTrigger->Counters(), GetEventCount()+1);
static UInt_t lastTime=0;
TDatime time;
if (time.Get()-lastTime>5) {
obj = GetNextInputObject();
}
- if (CTPData()) decision.AddInputObject(CTPData());
+ if (!fSkipCTPCounters && CTPData()) decision.AddInputObject(CTPData());
CreateEventDoneReadoutFilter(decision.TriggerDomain(), 3);
CreateEventDoneReadoutFilter(decision.TriggerDomain(), 4);
int result = BuildSymbolList(menu, symbols);
if (result != 0) return result;
+ //code << "#ifndef __CINT__" << endl;
code << "#include <cstring>" << endl;
code << "#include \"TString.h\"" << endl;
code << "#include \"TClonesArray.h\"" << endl;
code << "#include \"AliHLTTriggerMenu.h\"" << endl;
code << "#include \"AliHLTTriggerMenuItem.h\"" << endl;
code << "#include \"AliHLTTriggerMenuSymbol.h\"" << endl;
+ //code << "#endif //__CINT__" << endl;
// Add any include files that were specified on the command line.
for (Int_t i = 0; i < includeFiles.GetEntriesFast(); i++)
// Loads the code for a custom global trigger class implementation on the fly.
TString compiler = gSystem->GetBuildCompilerVersion();
- if (compiler.Contains("gcc") or compiler.Contains("icc"))
- {
- TString includePath = "-I${ALIHLT_TOPDIR}/BASE -I${ALIHLT_TOPDIR}/trigger -I${ALICE_ROOT}/include -I${ALICE_ROOT}/HLT/BASE -I${ALICE_ROOT}/HLT/trigger";
+ if (fRuntimeCompile && (compiler.Contains("gcc") or compiler.Contains("icc")))
+ {
+ TString includePath;
+#if defined(PKGINCLUDEDIR)
+ // this is especially for the HLT build system where the package is installed
+ // in a specific directory including proper treatment of include files
+ includePath.Form("-I%s", PKGINCLUDEDIR);
+#else
+ // the default AliRoot behavior, all include files can be found in the
+ // $ALICE_ROOT subfolders
+ includePath = "-I${ALICE_ROOT}/include -I${ALICE_ROOT}/HLT/BASE -I${ALICE_ROOT}/HLT/trigger";
+#endif
+ HLTDebug("using include settings: %s", includePath.Data());
// Add any include paths that were specified on the command line.
for (Int_t i = 0; i < includePaths.GetEntriesFast(); i++)
{
else
{
// If we do not support the compiler then try interpret the class instead.
- TString cmd = ".L ";
+ TString cmd = ".x ";
cmd += filename;
Int_t errorcode = TInterpreter::kNoError;
gROOT->ProcessLine(cmd, &errorcode);
{
// print some statistics
ULong64_t count=0;
- const TArrayL64* counters=pTrigger->Counters();
- for (int i=0; counters!=NULL && i<counters->GetSize(); i++) {
- count+=(*counters)[i];
+ for (int i=0; i<pTrigger->Counters().GetSize(); i++) {
+ count+=pTrigger->Counters()[i];
}
int totalEvents=GetEventCount()+offset;
float ratio=0;
HLTLog(level, "total events: %d - triggered events: %llu (%.1f%%)", totalEvents, count, ratio);
return 0;
}
+
+int AliHLTGlobalTriggerComponent::AddCTPDecisions(AliHLTGlobalTrigger* pTrigger, const AliHLTCTPData* pCTPData, const AliHLTComponentTriggerData* trigData)
+{
+ // add trigger decisions for the valid CTP classes
+ if (!pCTPData || !pTrigger) return 0;
+
+ AliHLTUInt64_t triggerMask=pCTPData->Mask();
+ AliHLTUInt64_t bit0=0x1;
+ if (!fCTPDecisions) {
+ fCTPDecisions=new TClonesArray(AliHLTTriggerDecision::Class(), gkNCTPTriggerClasses);
+ if (!fCTPDecisions) return -ENOMEM;
+
+ fCTPDecisions->ExpandCreate(gkNCTPTriggerClasses);
+ for (int i=0; i<gkNCTPTriggerClasses; i++) {
+ const char* name=pCTPData->Name(i);
+ if (triggerMask&(bit0<<i) && name) {
+ AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(fCTPDecisions->At(i));
+ assert(pDecision);
+ if (!pDecision) {
+ delete fCTPDecisions;
+ fCTPDecisions=NULL;
+ return -ENOENT;
+ }
+ pDecision->Name(name);
+ }
+ }
+ }
+
+ for (int i=0; i<gkNCTPTriggerClasses; i++) {
+ const char* name=pCTPData->Name(i);
+ if ((triggerMask&(bit0<<i))==0 || 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;
+ if (trigData) result=pCTPData->EvaluateCTPTriggerClass(name, *trigData);
+ else result=pCTPData->EvaluateCTPTriggerClass(name);
+ pDecision->Result(result);
+ pDecision->TriggerDomain().Clear();
+ if (trigData) pDecision->TriggerDomain().Add(pCTPData->ReadoutList(*trigData));
+ else pDecision->TriggerDomain().Add(pCTPData->ReadoutList());
+
+ pTrigger->Add(fCTPDecisions->At(i), kAliHLTDataTypeTriggerDecision, kAliHLTVoidDataSpec);
+ }
+
+ return 0;
+}
* \li -debug <br>
* If specified the automatically generated class will contain extra debugging
* code and the ACLiC system will have debugging compilation turned on.
+ * \li -cint <br>
+ * Use CINT to interprete the generated global trigger instead of compiling it.
+ * This will also be the case if no compiler is available.
* \li -usecode <i>filename</i> <i>classname</i> <br>
* Used to force the component to use an existing class for the global HLT trigger
* class implementation, with the name of <i>classname</i> and found in the file
*/
int BuildSymbolList(const AliHLTTriggerMenu* menu, TClonesArray& list);
+ /**
+ * Add trigger decisions according to the active CTP trigger classes
+ * An internal TclonesArray holds the trigger decisions to be added. The trigger
+ * decisions are updated according to the active CTP trigger mask.
+ * \param pTrigger The instance of the global trigger
+ * \param pCTPData Instance of the CTP data
+ * \param trigData Current trigger data, if NULL, the active trigger data from the CTP data is used
+ */
+ int AddCTPDecisions(AliHLTGlobalTrigger* pTrigger, const AliHLTCTPData* pCTPData, const AliHLTComponentTriggerData* trigData);
+
/**
* Print some statistics based on the trigger counters
*/
AliHLTGlobalTrigger* fTrigger; //! Trigger object which implements the global trigger menu.
bool fDebugMode; //! Indicates if the generated global trigger class should be in debug mode.
+ bool fRuntimeCompile; //! Indicates if the generated global trigger class should be compiled
+ bool fSkipCTPCounters; //! Indicates whether to ship CTP info with the trigger decision
TString fCodeFileName; //! base file name of the generated code for the global trigger
-
+ TClonesArray* fCTPDecisions; //! AliHLTTriggerDecision objects for the CTP classes
+
static const char* fgkTriggerMenuCDBPath; //! The path string to read the trigger menu from the CDB.
ClassDef(AliHLTGlobalTriggerComponent, 0) // Global HLT trigger component class which produces the final trigger decision and readout list.