1 #ifndef ALIHLTTRIGGER_H
2 #define ALIHLTTRIGGER_H
3 /* This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 #include "AliHLTProcessor.h"
9 class AliHLTTrigger : public AliHLTProcessor
14 virtual ~AliHLTTrigger();
17 * Returns the name of the trigger. This must be unique across the system.
18 * This method is pure virtual and must be implemented by child classes.
19 * @return string containing the trigger name.
21 virtual const char* GetTriggerName() const = 0;
24 * Inherited from AliHLTComponent. Returns the name of the trigger by default.
25 * @return string containing the trigger name as the component ID.
27 virtual const char* GetComponentID() { return GetTriggerName(); };
30 * Get the input data types of the component.
31 * This method returns kAliHLTAnyDataType by default.
32 * @param list <i>[out]</i>: The list of data types to be filled.
34 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list) const
36 list.push_back(kAliHLTAnyDataType);
40 * Returns extra output data types this trigger generates.
41 * This returns an empty list by default.
42 * @param list <i>[out]</i>: The list of data types to be filled.
44 virtual void GetOutputDataTypes(AliHLTComponentDataTypeList& list) const
46 list.push_back(kAliHLTDataTypeTObject);
50 * Get a ratio by how much the data volume is shrinked or enhanced.
51 * The method returns a size proporional to the trigger name string length
52 * for constBase, and 1 for inputMultiplier.
53 * @param constBase <i>[out]</i>: additive part, independent of the
55 * @param inputMultiplier <i>[out]</i>: multiplication ratio
57 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
59 constBase = strlen(GetTriggerName()) + sizeof(TObjString) + 1;
66 * This method needs to be implemented by child classes to implement the actual
67 * trigger algorithm. A possitive trigger decision is made by calling the TriggerEvent
68 * method with TriggerEvent(true), or TriggerEvent(false) for a negative result
70 * If the AliHLTComponentEventData structure is needed for the current event being
71 * processed then the GetEventData method can be used to fetch it.
72 * Similarly, the AliHLTComponentTriggerData structure can be fetched with a call
74 * @return Zero should be returned on success and a negative error code, which is
75 * compatible with the AliHLTSystem framework, on failure.
77 virtual int DoTrigger() = 0;
80 * Fills the output with the trigger decision. This should be called in the DoTrigger
81 * method when a trigger decision has been made.
82 * @param value The trigger decision value. True for positive trigger and false
83 * for a negative result. (true by default)
85 void TriggerEvent(bool value = true);
88 * Returns the event data structure for the current event.
89 * NULL is returned if this method is not called inside the DoTrigger method.
91 const AliHLTComponentEventData* GetEventData() const { return fEventData; }
94 * Returns the trigger data structure for the current event.
95 * NULL is returned if this method is not called inside the DoTrigger method.
97 AliHLTComponentTriggerData* GetTriggerData() const { return fTriggerData; }
102 * Inherited from AliHLTComponent. This method will clear the fDecisionMade flag,
103 * remember the evtData and trigData pointers, then call DoTrigger to invoke the
104 * actual trigger algorithm.
106 virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
108 using AliHLTProcessor::DoEvent;
111 * Inherited from AliHLTComponent. This method is deprecated so hide it.
112 * @return kAliHLTMultipleDataType is returned.
114 virtual AliHLTComponentDataType GetOutputDataType() { return kAliHLTMultipleDataType; };
117 * Inherited from AliHLTComponent. This method is replaced with one that is
118 * symmetric to GetInputDataTypes that returns void, so we make this method
120 * @param list list to receive the output data types.
121 * @return the number of elements in the list.
123 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list)
125 GetOutputDataTypes(list);
129 const AliHLTComponentEventData* fEventData; ///! Event data for the current event. Only valid inside DoTrigger.
130 AliHLTComponentTriggerData* fTriggerData; ///! Trigger data for the current event. Only valid inside DoTrigger.
131 bool fDecisionMade; ///! Flag indicating if the trigger decision has been made for this trigger yet.
132 int fTriggerEventResult; ///! Result returned by PushBack method in the TriggerEvent method.
134 ClassDef(AliHLTTrigger, 0) // Base class for HLT triggers.
138 #endif // ALIHLTTRIGGER_H