Adding custom linkdef file so that dictionaries are correctly generated for AliHLTTri...
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTrigger.h
CommitLineData
a9670afe 1#ifndef ALIHLTTRIGGER_H
2#define ALIHLTTRIGGER_H
1b9a175e 3/* This file is property of and copyright by the ALICE HLT Project *
a9670afe 4 * ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
4aa41877 6
1b9a175e 7/// @file AliHLTTrigger.cxx
8/// @author Artur Szostak <artursz@iafrica.com>
9/// @date 12 Aug 2008
10/// @brief Declaration of the AliHLTTrigger base component class.
11
a9670afe 12#include "AliHLTProcessor.h"
1b9a175e 13#include "AliHLTReadoutList.h"
14#include "AliHLTTriggerDomain.h"
4aa41877 15
5d79eb88 16class AliHLTTriggerDecision;
17
1b9a175e 18/**
19 * \class AliHLTTrigger
20 * This is the base class from which all HLT trigger components should inherit.
21 */
a9670afe 22class AliHLTTrigger : public AliHLTProcessor
23{
4aa41877 24 public:
a9670afe 25
4aa41877 26 AliHLTTrigger();
27 virtual ~AliHLTTrigger();
a9670afe 28
29 /**
30 * Returns the name of the trigger. This must be unique across the system.
31 * This method is pure virtual and must be implemented by child classes.
32 * @return string containing the trigger name.
33 */
34 virtual const char* GetTriggerName() const = 0;
4aa41877 35
a9670afe 36 /**
37 * Inherited from AliHLTComponent. Returns the name of the trigger by default.
38 * @return string containing the trigger name as the component ID.
39 */
40 virtual const char* GetComponentID() { return GetTriggerName(); };
41
42 /**
43 * Get the input data types of the component.
44 * This method returns kAliHLTAnyDataType by default.
45 * @param list <i>[out]</i>: The list of data types to be filled.
46 */
47 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list) const
48 {
49 list.push_back(kAliHLTAnyDataType);
50 }
51
52 /**
53 * Returns extra output data types this trigger generates.
54 * This returns an empty list by default.
55 * @param list <i>[out]</i>: The list of data types to be filled.
1b9a175e 56 * \note The underlying non const version of GetOutputDataTypes adds the value
57 * kAliHLTDataTypeTObject to the list.
a9670afe 58 */
1b9a175e 59 virtual void GetOutputDataTypes(AliHLTComponentDataTypeList& /*list*/) const {}
a9670afe 60
61 /**
1b9a175e 62 * Get a ratio by how much the data volume is shrunk or enhanced.
63 * The method returns a size proportional to the trigger name string length
a9670afe 64 * for constBase, and 1 for inputMultiplier.
65 * @param constBase <i>[out]</i>: additive part, independent of the
66 * input data volume
67 * @param inputMultiplier <i>[out]</i>: multiplication ratio
68 */
4adf50d6 69 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
a9670afe 70
71 protected:
72
4adf50d6 73 /// Not implemented.
74 AliHLTTrigger(const AliHLTTrigger& obj);
75 /// Not implemented.
76 AliHLTTrigger& operator = (const AliHLTTrigger& obj);
77
a9670afe 78 /**
79 * This method needs to be implemented by child classes to implement the actual
1b9a175e 80 * trigger algorithm. A positive trigger decision is made by calling the TriggerEvent
a9670afe 81 * method with TriggerEvent(true), or TriggerEvent(false) for a negative result
82 * (no trigger).
83 * If the AliHLTComponentEventData structure is needed for the current event being
84 * processed then the GetEventData method can be used to fetch it.
85 * Similarly, the AliHLTComponentTriggerData structure can be fetched with a call
86 * to GetTriggerData.
87 * @return Zero should be returned on success and a negative error code, which is
88 * compatible with the AliHLTSystem framework, on failure.
89 */
90 virtual int DoTrigger() = 0;
91
92 /**
93 * Fills the output with the trigger decision. This should be called in the DoTrigger
94 * method when a trigger decision has been made.
95 * @param value The trigger decision value. True for positive trigger and false
96 * for a negative result. (true by default)
97 */
98 void TriggerEvent(bool value = true);
99
100 /**
5d79eb88 101 * Fills the output with the given trigger decision. This should be called in the
102 * DoTrigger method when a custom trigger decision has been constructed.
103 * @param value The custom trigger decision object.
104 * @param datatype The data block type to use (set to
105 * kAliHLTDataTypeTObject|kAliHLTDataOriginOut by default).
106 * @param spec The data block specification to use (set to kAliHLTVoidDataSpec
107 * by default).
108 */
109 void TriggerEvent(
110 AliHLTTriggerDecision* result,
111 const AliHLTComponentDataType& type = kAliHLTDataTypeTObject|kAliHLTDataOriginOut,
112 AliHLTUInt32_t spec = kAliHLTVoidDataSpec
113 );
114
115 /**
a9670afe 116 * Returns the event data structure for the current event.
117 * NULL is returned if this method is not called inside the DoTrigger method.
118 */
119 const AliHLTComponentEventData* GetEventData() const { return fEventData; }
120
121 /**
122 * Returns the trigger data structure for the current event.
123 * NULL is returned if this method is not called inside the DoTrigger method.
124 */
125 AliHLTComponentTriggerData* GetTriggerData() const { return fTriggerData; }
126
4adf50d6 127 /**
128 * Set a bit to 1 in the readout list which will enable that DDL for readout
129 * @param ddlId Equipment ID of DDL to readout, in decimal.
130 */
131 void EnableDDLBit(Int_t ddlId)
132 {
133 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kTRUE);
134 }
135
136 /**
137 * Set a bit to 0 in the readout list which will exclude that DDL from the readout.
138 * @param ddlId Equipment ID of DDL not to readout, in decimal.
139 */
140 void DisableDDLBit(Int_t ddlId)
141 {
142 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kFALSE);
143 }
144
145 /**
146 * Set or unset bit in the readout list.
147 * @param ddlId Equipment ID of DDL to set, in decimal.
148 * @param state kTRUE will enable readout of that DDL, kFALSE will disable readout.
149 */
150 void SetDDLBit(Int_t ddlId, Bool_t state)
151 {
152 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, state);
153 }
154
155 /**
1b9a175e 156 * Returns the DDL readout list.
157 */
158 const AliHLTReadoutList& GetReadoutList() const { return fReadoutList; }
159
160 /**
4adf50d6 161 * Returns the DDL readout list for modification by hand.
162 */
1b9a175e 163 AliHLTReadoutList& GetReadoutList() { return fReadoutList; }
4adf50d6 164
165 /**
1b9a175e 166 * Sets the readout list object.
167 * \param value The new value to use for the readout list.
168 */
169 void SetReadoutList(const AliHLTReadoutList& value) { fReadoutList = value; }
170
171 /**
172 * Returns the trigger domain object.
4adf50d6 173 */
1b9a175e 174 const AliHLTTriggerDomain& GetTriggerDomain() const { return fTriggerDomain; }
175
176 /**
177 * Returns the trigger domain object for modification.
178 */
179 AliHLTTriggerDomain& GetTriggerDomain() { return fTriggerDomain; }
180
181 /**
182 * Sets the trigger domain object.
183 * \param value The new value to use for the trigger domain.
184 */
185 void SetTriggerDomain(const AliHLTTriggerDomain& value) { fTriggerDomain = value; }
186
187 /**
188 * Returns the trigger description string.
189 */
190 const char* GetDescription() const { return fDescription.Data(); }
191
192 /**
193 * Sets the trigger description string.
194 * \param value The new value to use for the description string.
195 */
196 void SetDescription(const char* value) { fDescription = value; }
4adf50d6 197
a9670afe 198 private:
199
200 /**
201 * Inherited from AliHLTComponent. This method will clear the fDecisionMade flag,
202 * remember the evtData and trigData pointers, then call DoTrigger to invoke the
203 * actual trigger algorithm.
204 */
205 virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
206
207 using AliHLTProcessor::DoEvent;
208
209 /**
210 * Inherited from AliHLTComponent. This method is deprecated so hide it.
211 * @return kAliHLTMultipleDataType is returned.
212 */
213 virtual AliHLTComponentDataType GetOutputDataType() { return kAliHLTMultipleDataType; };
5d79eb88 214
215 /**
216 * Inherited from AliHLTComponent. This method is deprecated so we hide it.
217 * Rather use the const version of this method which this method calls anyway.
218 * @param list list to receive the output data types.
219 */
220 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
221
a9670afe 222 /**
223 * Inherited from AliHLTComponent. This method is replaced with one that is
224 * symmetric to GetInputDataTypes that returns void, so we make this method
1b9a175e 225 * private. The list will always contain kAliHLTDataTypeTObject, including whatever
226 * values were added by the const version of GetOutputDataTypes.
a9670afe 227 * @param list list to receive the output data types.
228 * @return the number of elements in the list.
229 */
5d79eb88 230 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list);
4aa41877 231
1b9a175e 232 const AliHLTComponentEventData* fEventData; //! Event data for the current event. Only valid inside DoTrigger.
233 AliHLTComponentTriggerData* fTriggerData; //! Trigger data for the current event. Only valid inside DoTrigger.
234 bool fDecisionMade; //! Flag indicating if the trigger decision has been made for this trigger yet.
235 int fTriggerEventResult; //! Result returned by PushBack method in the TriggerEvent method.
236 TString fDescription; //! The description to use for the trigger decision.
237 AliHLTReadoutList fReadoutList; //! The DDL readout list object for the current event being processed.
238 AliHLTTriggerDomain fTriggerDomain; //! The trigger domain object for the current event being processed.
4aa41877 239
a9670afe 240 ClassDef(AliHLTTrigger, 0) // Base class for HLT triggers.
4aa41877 241
242};
243
a9670afe 244#endif // ALIHLTTRIGGER_H
4aa41877 245