A new class AliPHOSModuleMisalignment is added to read survey data
[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
1b9a175e 16/**
17 * \class AliHLTTrigger
18 * This is the base class from which all HLT trigger components should inherit.
19 */
a9670afe 20class AliHLTTrigger : public AliHLTProcessor
21{
4aa41877 22 public:
a9670afe 23
4aa41877 24 AliHLTTrigger();
25 virtual ~AliHLTTrigger();
a9670afe 26
27 /**
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.
31 */
32 virtual const char* GetTriggerName() const = 0;
4aa41877 33
a9670afe 34 /**
35 * Inherited from AliHLTComponent. Returns the name of the trigger by default.
36 * @return string containing the trigger name as the component ID.
37 */
38 virtual const char* GetComponentID() { return GetTriggerName(); };
39
40 /**
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.
44 */
45 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list) const
46 {
47 list.push_back(kAliHLTAnyDataType);
48 }
49
50 /**
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.
1b9a175e 54 * \note The underlying non const version of GetOutputDataTypes adds the value
55 * kAliHLTDataTypeTObject to the list.
a9670afe 56 */
1b9a175e 57 virtual void GetOutputDataTypes(AliHLTComponentDataTypeList& /*list*/) const {}
a9670afe 58
59 /**
1b9a175e 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
a9670afe 62 * for constBase, and 1 for inputMultiplier.
63 * @param constBase <i>[out]</i>: additive part, independent of the
64 * input data volume
65 * @param inputMultiplier <i>[out]</i>: multiplication ratio
66 */
4adf50d6 67 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
a9670afe 68
69 protected:
70
4adf50d6 71 /// Not implemented.
72 AliHLTTrigger(const AliHLTTrigger& obj);
73 /// Not implemented.
74 AliHLTTrigger& operator = (const AliHLTTrigger& obj);
75
a9670afe 76 /**
77 * This method needs to be implemented by child classes to implement the actual
1b9a175e 78 * trigger algorithm. A positive trigger decision is made by calling the TriggerEvent
a9670afe 79 * method with TriggerEvent(true), or TriggerEvent(false) for a negative result
80 * (no trigger).
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
84 * to GetTriggerData.
85 * @return Zero should be returned on success and a negative error code, which is
86 * compatible with the AliHLTSystem framework, on failure.
87 */
88 virtual int DoTrigger() = 0;
89
90 /**
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)
95 */
96 void TriggerEvent(bool value = true);
97
98 /**
99 * Returns the event data structure for the current event.
100 * NULL is returned if this method is not called inside the DoTrigger method.
101 */
102 const AliHLTComponentEventData* GetEventData() const { return fEventData; }
103
104 /**
105 * Returns the trigger data structure for the current event.
106 * NULL is returned if this method is not called inside the DoTrigger method.
107 */
108 AliHLTComponentTriggerData* GetTriggerData() const { return fTriggerData; }
109
4adf50d6 110 /**
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.
113 */
114 void EnableDDLBit(Int_t ddlId)
115 {
116 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kTRUE);
117 }
118
119 /**
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.
122 */
123 void DisableDDLBit(Int_t ddlId)
124 {
125 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kFALSE);
126 }
127
128 /**
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.
132 */
133 void SetDDLBit(Int_t ddlId, Bool_t state)
134 {
135 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, state);
136 }
137
1b9a175e 138 /**
139 * Returns the DDL readout list.
140 */
141 const AliHLTReadoutList& GetReadoutList() const { return fReadoutList; }
142
4adf50d6 143 /**
144 * Returns the DDL readout list for modification by hand.
145 */
1b9a175e 146 AliHLTReadoutList& GetReadoutList() { return fReadoutList; }
4adf50d6 147
148 /**
1b9a175e 149 * Sets the readout list object.
150 * \param value The new value to use for the readout list.
151 */
152 void SetReadoutList(const AliHLTReadoutList& value) { fReadoutList = value; }
153
154 /**
155 * Returns the trigger domain object.
4adf50d6 156 */
1b9a175e 157 const AliHLTTriggerDomain& GetTriggerDomain() const { return fTriggerDomain; }
158
159 /**
160 * Returns the trigger domain object for modification.
161 */
162 AliHLTTriggerDomain& GetTriggerDomain() { return fTriggerDomain; }
163
164 /**
165 * Sets the trigger domain object.
166 * \param value The new value to use for the trigger domain.
167 */
168 void SetTriggerDomain(const AliHLTTriggerDomain& value) { fTriggerDomain = value; }
169
170 /**
171 * Returns the trigger description string.
172 */
173 const char* GetDescription() const { return fDescription.Data(); }
174
175 /**
176 * Sets the trigger description string.
177 * \param value The new value to use for the description string.
178 */
179 void SetDescription(const char* value) { fDescription = value; }
4adf50d6 180
a9670afe 181 private:
182
183 /**
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.
187 */
188 virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
189
190 using AliHLTProcessor::DoEvent;
191
192 /**
193 * Inherited from AliHLTComponent. This method is deprecated so hide it.
194 * @return kAliHLTMultipleDataType is returned.
195 */
196 virtual AliHLTComponentDataType GetOutputDataType() { return kAliHLTMultipleDataType; };
197
198 /**
199 * Inherited from AliHLTComponent. This method is replaced with one that is
200 * symmetric to GetInputDataTypes that returns void, so we make this method
1b9a175e 201 * private. The list will always contain kAliHLTDataTypeTObject, including whatever
202 * values were added by the const version of GetOutputDataTypes.
a9670afe 203 * @param list list to receive the output data types.
204 * @return the number of elements in the list.
205 */
206 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list)
207 {
1b9a175e 208 const AliHLTTrigger* t = this; t->GetOutputDataTypes(list);
209 list.push_back(kAliHLTDataTypeTObject);
a9670afe 210 return list.size();
211 }
4aa41877 212
1b9a175e 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.
4aa41877 220
a9670afe 221 ClassDef(AliHLTTrigger, 0) // Base class for HLT triggers.
4aa41877 222
223};
224
a9670afe 225#endif // ALIHLTTRIGGER_H
4aa41877 226