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 /// @file AliHLTTrigger.cxx
8 /// @author Artur Szostak <artursz@iafrica.com>
10 /// @brief Declaration of the AliHLTTrigger base component class.
12 #include "AliHLTProcessor.h"
13 #include "AliHLTReadoutList.h"
14 #include "AliHLTTriggerDomain.h"
17 * \class AliHLTTrigger
18 * This is the base class from which all HLT trigger components should inherit.
20 class AliHLTTrigger : public AliHLTProcessor
25 virtual ~AliHLTTrigger();
28 * Returns the name of the trigger. This must be unique across the system.
29 * This method is pure virtual and must be implemented by child classes.
30 * @return string containing the trigger name.
32 virtual const char* GetTriggerName() const = 0;
35 * Inherited from AliHLTComponent. Returns the name of the trigger by default.
36 * @return string containing the trigger name as the component ID.
38 virtual const char* GetComponentID() { return GetTriggerName(); };
41 * Get the input data types of the component.
42 * This method returns kAliHLTAnyDataType by default.
43 * @param list <i>[out]</i>: The list of data types to be filled.
45 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list) const
47 list.push_back(kAliHLTAnyDataType);
51 * Returns extra output data types this trigger generates.
52 * This returns an empty list by default.
53 * @param list <i>[out]</i>: The list of data types to be filled.
54 * \note The underlying non const version of GetOutputDataTypes adds the value
55 * kAliHLTDataTypeTObject to the list.
57 virtual void GetOutputDataTypes(AliHLTComponentDataTypeList& /*list*/) const {}
60 * Get a ratio by how much the data volume is shrunk or enhanced.
61 * The method returns a size proportional to the trigger name string length
62 * for constBase, and 1 for inputMultiplier.
63 * @param constBase <i>[out]</i>: additive part, independent of the
65 * @param inputMultiplier <i>[out]</i>: multiplication ratio
67 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
72 AliHLTTrigger(const AliHLTTrigger& obj);
74 AliHLTTrigger& operator = (const AliHLTTrigger& obj);
77 * This method needs to be implemented by child classes to implement the actual
78 * trigger algorithm. A positive trigger decision is made by calling the TriggerEvent
79 * method with TriggerEvent(true), or TriggerEvent(false) for a negative result
81 * If the AliHLTComponentEventData structure is needed for the current event being
82 * processed then the GetEventData method can be used to fetch it.
83 * Similarly, the AliHLTComponentTriggerData structure can be fetched with a call
85 * @return Zero should be returned on success and a negative error code, which is
86 * compatible with the AliHLTSystem framework, on failure.
88 virtual int DoTrigger() = 0;
91 * Fills the output with the trigger decision. This should be called in the DoTrigger
92 * method when a trigger decision has been made.
93 * @param value The trigger decision value. True for positive trigger and false
94 * for a negative result. (true by default)
96 void TriggerEvent(bool value = true);
99 * Returns the event data structure for the current event.
100 * NULL is returned if this method is not called inside the DoTrigger method.
102 const AliHLTComponentEventData* GetEventData() const { return fEventData; }
105 * Returns the trigger data structure for the current event.
106 * NULL is returned if this method is not called inside the DoTrigger method.
108 AliHLTComponentTriggerData* GetTriggerData() const { return fTriggerData; }
111 * Set a bit to 1 in the readout list which will enable that DDL for readout
112 * @param ddlId Equipment ID of DDL to readout, in decimal.
114 void EnableDDLBit(Int_t ddlId)
116 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kTRUE);
120 * Set a bit to 0 in the readout list which will exclude that DDL from the readout.
121 * @param ddlId Equipment ID of DDL not to readout, in decimal.
123 void DisableDDLBit(Int_t ddlId)
125 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kFALSE);
129 * Set or unset bit in the readout list.
130 * @param ddlId Equipment ID of DDL to set, in decimal.
131 * @param state kTRUE will enable readout of that DDL, kFALSE will disable readout.
133 void SetDDLBit(Int_t ddlId, Bool_t state)
135 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, state);
139 * Returns the DDL readout list.
141 const AliHLTReadoutList& GetReadoutList() const { return fReadoutList; }
144 * Returns the DDL readout list for modification by hand.
146 AliHLTReadoutList& GetReadoutList() { return fReadoutList; }
149 * Sets the readout list object.
150 * \param value The new value to use for the readout list.
152 void SetReadoutList(const AliHLTReadoutList& value) { fReadoutList = value; }
155 * Returns the trigger domain object.
157 const AliHLTTriggerDomain& GetTriggerDomain() const { return fTriggerDomain; }
160 * Returns the trigger domain object for modification.
162 AliHLTTriggerDomain& GetTriggerDomain() { return fTriggerDomain; }
165 * Sets the trigger domain object.
166 * \param value The new value to use for the trigger domain.
168 void SetTriggerDomain(const AliHLTTriggerDomain& value) { fTriggerDomain = value; }
171 * Returns the trigger description string.
173 const char* GetDescription() const { return fDescription.Data(); }
176 * Sets the trigger description string.
177 * \param value The new value to use for the description string.
179 void SetDescription(const char* value) { fDescription = value; }
184 * Inherited from AliHLTComponent. This method will clear the fDecisionMade flag,
185 * remember the evtData and trigData pointers, then call DoTrigger to invoke the
186 * actual trigger algorithm.
188 virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
190 using AliHLTProcessor::DoEvent;
193 * Inherited from AliHLTComponent. This method is deprecated so hide it.
194 * @return kAliHLTMultipleDataType is returned.
196 virtual AliHLTComponentDataType GetOutputDataType() { return kAliHLTMultipleDataType; };
199 * Inherited from AliHLTComponent. This method is replaced with one that is
200 * symmetric to GetInputDataTypes that returns void, so we make this method
201 * private. The list will always contain kAliHLTDataTypeTObject, including whatever
202 * values were added by the const version of GetOutputDataTypes.
203 * @param list list to receive the output data types.
204 * @return the number of elements in the list.
206 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list)
208 const AliHLTTrigger* t = this; t->GetOutputDataTypes(list);
209 list.push_back(kAliHLTDataTypeTObject);
213 const AliHLTComponentEventData* fEventData; //! Event data for the current event. Only valid inside DoTrigger.
214 AliHLTComponentTriggerData* fTriggerData; //! Trigger data for the current event. Only valid inside DoTrigger.
215 bool fDecisionMade; //! Flag indicating if the trigger decision has been made for this trigger yet.
216 int fTriggerEventResult; //! Result returned by PushBack method in the TriggerEvent method.
217 TString fDescription; //! The description to use for the trigger decision.
218 AliHLTReadoutList fReadoutList; //! The DDL readout list object for the current event being processed.
219 AliHLTTriggerDomain fTriggerDomain; //! The trigger domain object for the current event being processed.
221 ClassDef(AliHLTTrigger, 0) // Base class for HLT triggers.
225 #endif // ALIHLTTRIGGER_H