#ifndef ALIHLTTRIGGER_H #define ALIHLTTRIGGER_H /* This file is property of and copyright by the ALICE HLT Project * * ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ #include "AliHLTProcessor.h" class AliHLTTrigger : public AliHLTProcessor { public: AliHLTTrigger(); virtual ~AliHLTTrigger(); /** * Returns the name of the trigger. This must be unique across the system. * This method is pure virtual and must be implemented by child classes. * @return string containing the trigger name. */ virtual const char* GetTriggerName() const = 0; /** * Inherited from AliHLTComponent. Returns the name of the trigger by default. * @return string containing the trigger name as the component ID. */ virtual const char* GetComponentID() { return GetTriggerName(); }; /** * Get the input data types of the component. * This method returns kAliHLTAnyDataType by default. * @param list [out]: The list of data types to be filled. */ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list) const { list.push_back(kAliHLTAnyDataType); } /** * Returns extra output data types this trigger generates. * This returns an empty list by default. * @param list [out]: The list of data types to be filled. */ virtual void GetOutputDataTypes(AliHLTComponentDataTypeList& list) const { list.push_back(kAliHLTDataTypeTObject); } /** * Get a ratio by how much the data volume is shrinked or enhanced. * The method returns a size proporional to the trigger name string length * for constBase, and 1 for inputMultiplier. * @param constBase [out]: additive part, independent of the * input data volume * @param inputMultiplier [out]: multiplication ratio */ virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); protected: /// Not implemented. AliHLTTrigger(const AliHLTTrigger& obj); /// Not implemented. AliHLTTrigger& operator = (const AliHLTTrigger& obj); /** * This method needs to be implemented by child classes to implement the actual * trigger algorithm. A possitive trigger decision is made by calling the TriggerEvent * method with TriggerEvent(true), or TriggerEvent(false) for a negative result * (no trigger). * If the AliHLTComponentEventData structure is needed for the current event being * processed then the GetEventData method can be used to fetch it. * Similarly, the AliHLTComponentTriggerData structure can be fetched with a call * to GetTriggerData. * @return Zero should be returned on success and a negative error code, which is * compatible with the AliHLTSystem framework, on failure. */ virtual int DoTrigger() = 0; /** * Fills the output with the trigger decision. This should be called in the DoTrigger * method when a trigger decision has been made. * @param value The trigger decision value. True for positive trigger and false * for a negative result. (true by default) */ void TriggerEvent(bool value = true); /** * Returns the event data structure for the current event. * NULL is returned if this method is not called inside the DoTrigger method. */ const AliHLTComponentEventData* GetEventData() const { return fEventData; } /** * Returns the trigger data structure for the current event. * NULL is returned if this method is not called inside the DoTrigger method. */ AliHLTComponentTriggerData* GetTriggerData() const { return fTriggerData; } /** * Set a bit to 1 in the readout list which will enable that DDL for readout * @param ddlId Equipment ID of DDL to readout, in decimal. */ void EnableDDLBit(Int_t ddlId) { AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kTRUE); } /** * Set a bit to 0 in the readout list which will exclude that DDL from the readout. * @param ddlId Equipment ID of DDL not to readout, in decimal. */ void DisableDDLBit(Int_t ddlId) { AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kFALSE); } /** * Set or unset bit in the readout list. * @param ddlId Equipment ID of DDL to set, in decimal. * @param state kTRUE will enable readout of that DDL, kFALSE will disable readout. */ void SetDDLBit(Int_t ddlId, Bool_t state) { AliHLTComponent::SetDDLBit(fReadoutList, ddlId, state); } /** * Returns the DDL readout list for modification by hand. */ const AliHLTEventDDL& GetReadoutList() const { return fReadoutList; } /** * Returns the DDL readout list. */ AliHLTEventDDL& GetReadoutList() { return fReadoutList; } private: /** * Inherited from AliHLTComponent. This method will clear the fDecisionMade flag, * remember the evtData and trigData pointers, then call DoTrigger to invoke the * actual trigger algorithm. */ virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); using AliHLTProcessor::DoEvent; /** * Inherited from AliHLTComponent. This method is deprecated so hide it. * @return kAliHLTMultipleDataType is returned. */ virtual AliHLTComponentDataType GetOutputDataType() { return kAliHLTMultipleDataType; }; /** * Inherited from AliHLTComponent. This method is replaced with one that is * symmetric to GetInputDataTypes that returns void, so we make this method * private. * @param list list to receive the output data types. * @return the number of elements in the list. */ virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list) { GetOutputDataTypes(list); return list.size(); } const AliHLTComponentEventData* fEventData; ///! Event data for the current event. Only valid inside DoTrigger. AliHLTComponentTriggerData* fTriggerData; ///! Trigger data for the current event. Only valid inside DoTrigger. bool fDecisionMade; ///! Flag indicating if the trigger decision has been made for this trigger yet. int fTriggerEventResult; ///! Result returned by PushBack method in the TriggerEvent method. AliHLTEventDDL fReadoutList; ///! The readout DDL list. ClassDef(AliHLTTrigger, 0) // Base class for HLT triggers. }; #endif // ALIHLTTRIGGER_H