linked loaders at clusters level
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTrigger.h
CommitLineData
a9670afe 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 */
4aa41877 6
a9670afe 7#include "AliHLTProcessor.h"
4aa41877 8
a9670afe 9class AliHLTTrigger : public AliHLTProcessor
10{
4aa41877 11 public:
a9670afe 12
4aa41877 13 AliHLTTrigger();
14 virtual ~AliHLTTrigger();
a9670afe 15
16 /**
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.
20 */
21 virtual const char* GetTriggerName() const = 0;
4aa41877 22
a9670afe 23 /**
24 * Inherited from AliHLTComponent. Returns the name of the trigger by default.
25 * @return string containing the trigger name as the component ID.
26 */
27 virtual const char* GetComponentID() { return GetTriggerName(); };
28
29 /**
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.
33 */
34 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list) const
35 {
36 list.push_back(kAliHLTAnyDataType);
37 }
38
39 /**
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.
43 */
44 virtual void GetOutputDataTypes(AliHLTComponentDataTypeList& list) const
45 {
46 list.push_back(kAliHLTDataTypeTObject);
47 }
48
49 /**
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
54 * input data volume
55 * @param inputMultiplier <i>[out]</i>: multiplication ratio
56 */
4adf50d6 57 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
a9670afe 58
59 protected:
60
4adf50d6 61 /// Not implemented.
62 AliHLTTrigger(const AliHLTTrigger& obj);
63 /// Not implemented.
64 AliHLTTrigger& operator = (const AliHLTTrigger& obj);
65
a9670afe 66 /**
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
70 * (no trigger).
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
74 * to GetTriggerData.
75 * @return Zero should be returned on success and a negative error code, which is
76 * compatible with the AliHLTSystem framework, on failure.
77 */
78 virtual int DoTrigger() = 0;
79
80 /**
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)
85 */
86 void TriggerEvent(bool value = true);
87
88 /**
89 * Returns the event data structure for the current event.
90 * NULL is returned if this method is not called inside the DoTrigger method.
91 */
92 const AliHLTComponentEventData* GetEventData() const { return fEventData; }
93
94 /**
95 * Returns the trigger data structure for the current event.
96 * NULL is returned if this method is not called inside the DoTrigger method.
97 */
98 AliHLTComponentTriggerData* GetTriggerData() const { return fTriggerData; }
99
4adf50d6 100 /**
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.
103 */
104 void EnableDDLBit(Int_t ddlId)
105 {
106 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kTRUE);
107 }
108
109 /**
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.
112 */
113 void DisableDDLBit(Int_t ddlId)
114 {
115 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, kFALSE);
116 }
117
118 /**
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.
122 */
123 void SetDDLBit(Int_t ddlId, Bool_t state)
124 {
125 AliHLTComponent::SetDDLBit(fReadoutList, ddlId, state);
126 }
127
128 /**
129 * Returns the DDL readout list for modification by hand.
130 */
131 const AliHLTEventDDL& GetReadoutList() const { return fReadoutList; }
132
133 /**
134 * Returns the DDL readout list.
135 */
136 AliHLTEventDDL& GetReadoutList() { return fReadoutList; }
137
a9670afe 138 private:
139
140 /**
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.
144 */
145 virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
146
147 using AliHLTProcessor::DoEvent;
148
149 /**
150 * Inherited from AliHLTComponent. This method is deprecated so hide it.
151 * @return kAliHLTMultipleDataType is returned.
152 */
153 virtual AliHLTComponentDataType GetOutputDataType() { return kAliHLTMultipleDataType; };
154
155 /**
156 * Inherited from AliHLTComponent. This method is replaced with one that is
157 * symmetric to GetInputDataTypes that returns void, so we make this method
158 * private.
159 * @param list list to receive the output data types.
160 * @return the number of elements in the list.
161 */
162 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list)
163 {
164 GetOutputDataTypes(list);
165 return list.size();
166 }
4aa41877 167
a9670afe 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.
4adf50d6 172 AliHLTEventDDL fReadoutList; ///! The readout DDL list.
4aa41877 173
a9670afe 174 ClassDef(AliHLTTrigger, 0) // Base class for HLT triggers.
4aa41877 175
176};
177
a9670afe 178#endif // ALIHLTTRIGGER_H
4aa41877 179