#include "TArrayL64.h"
#include "AliHLTLogging.h"
#include "AliHLTDataTypes.h"
+#include "AliHLTReadoutList.h"
+#include <string>
/**
* @class AliHLTCTPData
AliHLTCTPData();
/// standard constructor including initialization from CTP_TRIGGER_CLASS
AliHLTCTPData(const char* parameter);
+ /// copy constructor
+ AliHLTCTPData(const AliHLTCTPData&);
+ ///assignment operator
+ AliHLTCTPData& operator=(const AliHLTCTPData&);
/// destructor
virtual ~AliHLTCTPData();
+ /// Add counters
+ AliHLTCTPData& operator += (const AliHLTCTPData&);
+ /// Add counters
+ AliHLTCTPData operator + (const AliHLTCTPData&) const;
+
+ /// Subtract counters
+ AliHLTCTPData& operator -= (const AliHLTCTPData&);
+ /// Subtract counters
+ AliHLTCTPData operator - (const AliHLTCTPData&) const;
+
/**
* Init the class ids and mapping from the CTP_TRIGGER_CLASS parameter.
* The general format of the parameter is as follows:
*/
int InitCTPTriggerClasses(const char* ctpString);
+ /// etract the active trigger mask from the trigger data
+ static AliHLTTriggerMask_t ActiveTriggers(const AliHLTComponentTriggerData& trigData);
+
+ /**
+ * Evaluate an expression of trigger class ids with respect to the trigger mask.
+ */
+ bool EvaluateCTPTriggerClass(const char* expression, const AliHLTComponentTriggerData& trigData) const;
+
/**
* Evaluate an expression of trigger class ids with respect to the trigger mask.
*/
- bool EvaluateCTPTriggerClass(const char* expression, AliHLTComponentTriggerData& trigData) const;
+ bool EvaluateCTPTriggerClass(const char* expression, AliHLTTriggerMask_t triggerMask) const;
+
+ /**
+ * Evaluate an expression of trigger class ids with respect to the current trigger mask.
+ */
+ bool EvaluateCTPTriggerClass(const char* expression) const {
+ return EvaluateCTPTriggerClass(expression, fTriggers);
+ }
/**
* Reset all counters
*/
int Index(const char* name) const;
+ /**
+ * Check state of a trigger class.
+ * If the class name is not part of the current trigger setup (i.e. ECS parameter
+ * does not contain a trigger definition for this class name) the function
+ * returns -1
+ * @return -1 class name not initialized,
+ * 0 trigger not active
+ * 1 trigger active
+ */
+ int CheckTrigger(const char* name) const;
+
/**
* Increment counter for CTP trigger classes
* @param classIds comma separated list of class ids
/**
* Increment counter for CTP trigger classes
- * @param triggerPattern corresponds to the 50bit trigger mask in the CDH
+ * @param triggerPattern corresponds to the 100bit trigger mask in the CDH
*/
- void Increment(AliHLTUInt64_t triggerPattern);
+ void Increment(AliHLTTriggerMask_t triggerPattern);
/**
* Increment counter for a CTP trigger class
- * @param classIdx index of the class in the 50bit trigger mask
+ * @param classIdx index of the class in the 100bit trigger mask
*/
void Increment(int classIdx);
* Return a readout list for the active trigger classes.
* The list is an 'OR' of the active trugger classes.
*/
- AliHLTEventDDL ReadoutList(const AliHLTComponentTriggerData& trigData) const;
+ AliHLTReadoutList ReadoutList(const AliHLTComponentTriggerData& trigData) const;
+
+ /**
+ * Return a readout list for the active trigger classes.
+ * The list is an 'OR' of the active trugger classes.
+ */
+ AliHLTReadoutList ReadoutList(AliHLTTriggerMask_t triggerMask) const;
+
+ /**
+ * Return a readout list for the active trigger classes.
+ * The list is an 'OR' of the active trugger classes.
+ */
+ AliHLTReadoutList ReadoutList() const {
+ return ReadoutList(fTriggers);
+ }
/**
* Inherited from TObject, this prints the contents of the trigger decision.
*/
virtual void Print(Option_t* option = "") const;
- AliHLTUInt64_t Mask() const { return fMask; }
- const TArrayL64& Counters() const { return fCounters; }
- AliHLTUInt64_t Counter(int index) const;
- AliHLTUInt64_t Counter(const char* classId) const;
- const char* Name(int index) const;
+ AliHLTTriggerMask_t Mask() const { return fMask; }
+ AliHLTTriggerMask_t Triggers() const { return fTriggers; }
+ void SetTriggers(AliHLTTriggerMask_t triggers) { fTriggers=triggers; }
+ void SetTriggers(AliHLTComponentTriggerData trigData) {SetTriggers(ActiveTriggers(trigData));}
+ const TArrayL64& Counters() const { return fCounters; }
+ AliHLTUInt64_t Counter(int index) const;
+ AliHLTUInt64_t Counter(const char* classId) const;
+ const char* Name(int index) const;
protected:
private:
- /// copy constructor prohibited
- AliHLTCTPData(const AliHLTCTPData&);
- ///assignment operator prohibited
- AliHLTCTPData& operator=(const AliHLTCTPData&);
+ /// Helper
+ std::string TriggerMaskToString(AliHLTTriggerMask_t mask) const;
+
+ /**
+ * Add counters.
+ * Base methods for operators.
+ * @param src instance to add
+ * @param factor +1/-1 for addition/subtraction
+ * @skipped target to get the numner of not matching class names
+ */
+ int Add(const AliHLTCTPData& src, int factor, int &skipped);
+
+ /**
+ * Read the map of trigger class indexes
+ * The map is used in the generation of the TFormula from the trigger
+ * expression in order to handle similar class names correctly.
+ * For names like 'base', 'baseA', 'baseB' the class with the longer name
+ * has to be replaced first.
+ */
+ int ReadMap(vector<unsigned> &map) const;
+
+ int ReadMap() {return ReadMap(fMap);}
- AliHLTUInt64_t fMask; /// mask of initialized trigger classes
- TClonesArray fClassIds; /// array of trigger class ids
- TArrayL64 fCounters; /// trigger class counters
+ AliHLTTriggerMask_t fMask; /// mask of initialized trigger classes
+ AliHLTTriggerMask_t fTriggers; /// current trigger
+ TClonesArray fClassIds; /// array of trigger class ids
+ TArrayL64 fCounters; /// trigger class counters
+ vector<unsigned> fMap; //! index map for trigger expression evaluation
- ClassDef(AliHLTCTPData, 0)
+ ClassDef(AliHLTCTPData, 3)
};
#endif