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);
62 AliHLTTrigger(const AliHLTTrigger& obj);
64 AliHLTTrigger& operator = (const AliHLTTrigger& obj);
67 * This method needs to be implemented by child classes to implement the actual
68 * trigger algorithm. A possitive trigger decision is made by calling the TriggerEvent
69 * method with TriggerEvent(true), or TriggerEvent(false) for a negative result
71 * If the AliHLTComponentEventData structure is needed for the current event being
72 * processed then the GetEventData method can be used to fetch it.
73 * Similarly, the AliHLTComponentTriggerData structure can be fetched with a call
75 * @return Zero should be returned on success and a negative error code, which is
76 * compatible with the AliHLTSystem framework, on failure.
78 virtual int DoTrigger() = 0;
81 * Fills the output with the trigger decision. This should be called in the DoTrigger
82 * method when a trigger decision has been made.
83 * @param value The trigger decision value. True for positive trigger and false
84 * for a negative result. (true by default)
86 void TriggerEvent(bool value = true);
89 * Returns the event data structure for the current event.
90 * NULL is returned if this method is not called inside the DoTrigger method.
92 const AliHLTComponentEventData* GetEventData() const { return fEventData; }
95 * Returns the trigger data structure for the current event.
96 * NULL is returned if this method is not called inside the DoTrigger method.
98 AliHLTComponentTriggerData* GetTriggerData() const { return fTriggerData; }
101 * Set a bit to 1 in the readout list which will enable that DDL for readout
102 * @param ddlId Equipment ID of DDL to readout, in decimal.
104 void EnableDDLBit(Int_t ddlId)
106 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kTRUE);
110 * Set a bit to 0 in the readout list which will exclude that DDL from the readout.
111 * @param ddlId Equipment ID of DDL not to readout, in decimal.
113 void DisableDDLBit(Int_t ddlId)
115 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kFALSE);
119 * Set or unset bit in the readout list.
120 * @param ddlId Equipment ID of DDL to set, in decimal.
121 * @param state kTRUE will enable readout of that DDL, kFALSE will disable readout.
123 void SetDDLBit(Int_t ddlId, Bool_t state)
125 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, state);
129 * Returns the DDL readout list for modification by hand.
131 const AliHLTEventDDL& GetReadoutList() const { return fReadoutList; }
134 * Returns the DDL readout list.
136 AliHLTEventDDL& GetReadoutList() { return fReadoutList; }
141 * Inherited from AliHLTComponent. This method will clear the fDecisionMade flag,
142 * remember the evtData and trigData pointers, then call DoTrigger to invoke the
143 * actual trigger algorithm.
145 virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
147 using AliHLTProcessor::DoEvent;
150 * Inherited from AliHLTComponent. This method is deprecated so hide it.
151 * @return kAliHLTMultipleDataType is returned.
153 virtual AliHLTComponentDataType GetOutputDataType() { return kAliHLTMultipleDataType; };
156 * Inherited from AliHLTComponent. This method is replaced with one that is
157 * symmetric to GetInputDataTypes that returns void, so we make this method
159 * @param list list to receive the output data types.
160 * @return the number of elements in the list.
162 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list)
164 GetOutputDataTypes(list);
168 const AliHLTComponentEventData* fEventData; ///! Event data for the current event. Only valid inside DoTrigger.
169 AliHLTComponentTriggerData* fTriggerData; ///! Trigger data for the current event. Only valid inside DoTrigger.
170 bool fDecisionMade; ///! Flag indicating if the trigger decision has been made for this trigger yet.
171 int fTriggerEventResult; ///! Result returned by PushBack method in the TriggerEvent method.
172 AliHLTEventDDL fReadoutList; ///! The readout DDL list.
174 ClassDef(AliHLTTrigger, 0) // Base class for HLT triggers.
178 #endif // ALIHLTTRIGGER_H