]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTTriggerMenu.h
Major update required to handle old and new AliHLTEventDDL structures within HLT...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTriggerMenu.h
CommitLineData
c580e182 1//-*- Mode: C++ -*-
81d62bb4 2// $Id$
e2bb8ddd 3#ifndef ALIHLTTRIGGERMENU_H
4#define ALIHLTTRIGGERMENU_H
5/* This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
8
9/// @file AliHLTTriggerMenu.h
10/// @author Artur Szostak <artursz@iafrica.com>
11/// @date 19 Dec 2008
12/// @brief Declaration of the AliHLTTriggerMenu base class.
13
14#include "TObject.h"
15#include "TString.h"
16#include "TClonesArray.h"
52f67e50 17#include "AliHLTTriggerMenuSymbol.h"
e2bb8ddd 18#include "AliHLTTriggerMenuItem.h"
acc7214e 19#include "AliHLTTriggerDomain.h"
e2bb8ddd 20
21/**
22 * \class AliHLTTriggerMenu
81d62bb4 23 * The trigger menu specifies the HLT global trigger component configuration.
24 * The global trigger has a list of individual input trigger components deriving
25 * from AliHLTTrigger. Each one of these triggers is named. Thus, the trigger menu
26 * is a list of trigger condition expressions, where the variables inside the
27 * expressions are the names of the input triggers. In this way the global trigger
28 * can be configured in a powerful manner using C++ expressions.
29 * Attached to each trigger condition expression is a trigger domain merging
30 * expression, which indicates how the final global trigger domain should be
31 * calculated from the fragments coming from each individual trigger component.
32 * Each entry in the trigger menu has a priority. These are set explicitly and
33 * set to zero by default. The higher the priority number for a menu item the
34 * higher its priority. Multiple items can have the same priority values.
35 *
36 * An important concept is the trigger priority group. This is a number of menu
37 * items that all have the same priority. If all trigger menu items have the
38 * same priority value then there is only one priority group with all the items
39 * being members of the same group. Otherwise there can be any number of priority
40 * groups with any number of one or more trigger menu items in a group.
41 * A trigger menu item belongs to priority group N if it has a priority number equal
42 * to N. The trigger menu is then evaluated by the global trigger component, such
43 * that the highest priority trigger groups (largest N) are evaluated first.
44 * Trigger items within a priority group are then evaluated in the order they
45 * were added to the trigger menu. Thus, the first item added to the menu in group
46 * N is evaluated first, and the last added to group N is evaluated last.
47 * Inside a priority group all trigger menu items have their trigger condition
48 * expressions evaluated. This is equivalent to evaluating the group's trigger
49 * condition expression, where the group's expression is a concatenation of the
50 * individual trigger condition expressions of the items in priority group N.
51 * This means that the trigger conditions expressions (indeed, also the trigger
52 * domain merging expressions) are allowed to have a dangling trailing operator.
53 * The trailing operator will then make sense in the full concatenated expression.
54 * If no such trailing operator is found then the default trigger conditions operator
325e5e42 55 * is used implicitly for the concatenation, as defined in the trigger menu.
81d62bb4 56 * If the full concatenated condition expression evaluates to true then the priority
57 * group's result is also true and the output trigger domain can be calculated.
58 * This is done by taking all the merging expressions from only those trigger menu
59 * items whose trigger condition expression fragments were true, and concatenating
60 * those merging expression fragments together to arrive at the full merging expression.
61 * The final trigger domain is calculated by evaluating the merging expression.
325e5e42 62 * Note that the concatenation of the merging expression fragments works in the
81d62bb4 63 * same manner as the trigger condition expressions. So a trailing operator is
64 * allowed in each trigger menu item's merging expression, and is implicitly removed
325e5e42 65 * if not needed, but used to concatenate with the next triggered expression.
81d62bb4 66 * The default domain merging operator is used if no trailing operator is present
67 * but a concatenation is required.
68 * The evaluation of trigger menu items stops at the first priority group whose
69 * trigger condition expression evaluated to true. This is important to force
70 * mutually exclusive precedence of a higher priority trigger or triggers.
71 * The two extremes of this model are:
72 * - All trigger menu entries have the same priority so they are all part of the
73 * same priority group, and thus every trigger menu item is evaluated.
74 * - Every trigger menu entry has a different priority, so each forms its own priority
75 * group, and the trigger evaluation stops at the first highest priority item
76 * that matches the trigger condition.
77 * Another way to look at the model is that priority groups are mutually exclusive.
78 * Trigger menu items from two different priority groups cannot be active at the same
79 * time. While more than one trigger menu item can be active at the same time if they
80 * are from the same priority group.
81 * Yet another view at the model is that a priority group forms an explicit trigger
82 * condition and trigger domain merging expression, while trigger menu items specify
83 * the expression fragments that are concatenated together implicitly. If there is
84 * just one trigger menu item in a priority group then the groups expressions are
85 * explicit. On the other hand, for multiple items in a group they form implicit
86 * expression fragments.
e2bb8ddd 87 */
88class AliHLTTriggerMenu : public TObject
89{
90 public:
91
92 /**
93 * Default constructor.
94 */
95 AliHLTTriggerMenu();
96
97 /**
98 * Default destructor.
99 */
100 virtual ~AliHLTTriggerMenu();
101
102 /**
103 * Inherited from TObject, this prints the contents of the trigger menu.
104 * \param option Can be "short" which will print the short format.
105 */
106 virtual void Print(Option_t* option = "") const;
acc7214e 107
108 /**
109 * This method removes all items and symbols from the trigger menu.
110 * \note The name and default values are not changed. Only the items and symbol
111 * lists are cleared.
112 * \param option This is passed onto the internal fSymbols and fItems TClonesArrays.
113 * The method is inherited from TObject.
114 */
115 virtual void Clear(Option_t* option = "");
e2bb8ddd 116
117 /**
118 * Copy constructor performs a deep copy of the object.
119 * \param obj Object to copy from.
120 */
121 AliHLTTriggerMenu(const AliHLTTriggerMenu& obj);
122
123 /**
124 * Assignment operator performs a deep copy of the object.
125 * \param obj Object to copy from.
126 * \return This object is returned after being replaced by a copy of <i>obj</i>.
127 */
128 AliHLTTriggerMenu& operator = (const AliHLTTriggerMenu& obj);
129
130 /**
131 * Inherited from TObject. Returns the name of the trigger menu.
132 */
133 virtual const char* GetName() const { return fName.Data(); }
134
135 /**
136 * Returns the name of the trigger menu.
137 */
138 const char* Name() const { return fName.Data(); }
139
140 /**
141 * Sets the name of the trigger menu.
142 */
143 void Name(const char* name) { fName = name; }
144
52f67e50 145 /**
146 * Returns the number of symbols in the trigger menu.
147 */
148 UInt_t NumberOfSymbols() const { return UInt_t(fSymbols.GetEntriesFast()); }
149
150 /**
151 * Fetches the i'th trigger menu symbol.
152 */
153 const AliHLTTriggerMenuSymbol* Symbol(UInt_t i) const
154 {
155 if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL;
156 return static_cast<const AliHLTTriggerMenuSymbol*>( fSymbols.UncheckedAt(Int_t(i)) );
157 }
158
159 /**
160 * Fetches the i'th trigger menu symbol for editing.
161 */
162 AliHLTTriggerMenuSymbol* Symbol(UInt_t i)
163 {
164 if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL;
165 return static_cast<AliHLTTriggerMenuSymbol*>( fSymbols.UncheckedAt(Int_t(i)) );
166 }
167
168 /**
81d62bb4 169 * Adds a new symbol to the trigger menu. If the symbol being added already
170 * exists in the trigger menu then the new symbol will not be added.
171 * \param entry The new trigger menu symbol being added.
52f67e50 172 */
81d62bb4 173 void AddSymbol(const AliHLTTriggerMenuSymbol& entry);
52f67e50 174
175 /**
176 * Returns the array of symbols.
177 */
178 const TClonesArray& SymbolArray() const { return fSymbols; }
179
e2bb8ddd 180 /**
181 * Returns the number of items in the trigger menu.
182 */
183 UInt_t NumberOfItems() const { return UInt_t(fItems.GetEntriesFast()); }
184
185 /**
186 * Fetches the i'th trigger menu item.
187 */
188 const AliHLTTriggerMenuItem* Item(UInt_t i) const
189 {
190 if (i >= UInt_t(fItems.GetEntriesFast())) return NULL;
191 return static_cast<const AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) );
192 }
193
194 /**
195 * Fetches the i'th trigger menu item for editing.
196 */
197 AliHLTTriggerMenuItem* Item(UInt_t i)
198 {
199 if (i >= UInt_t(fItems.GetEntriesFast())) return NULL;
200 return static_cast<AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) );
201 }
202
203 /**
204 * Adds a new entry to the trigger menu.
205 */
206 void AddItem(const AliHLTTriggerMenuItem& entry)
207 {
208 new (fItems[fItems.GetEntriesFast()]) AliHLTTriggerMenuItem(entry);
209 }
210
52f67e50 211 /**
212 * Returns the array of menu items.
213 */
214 const TClonesArray& ItemsArray() const { return fItems; }
215
acc7214e 216 /**
217 * Sets the default trigger description to use if the global trigger does not
218 * fire and returns a negative result.
219 */
220 void DefaultDescription(const char* value) { fDefaultDescription = value; }
221
222 /**
223 * Returns the default trigger description to use if the global trigger does not
224 * fire and returns a negative result.
225 */
226 const char* DefaultDescription() const { return fDefaultDescription.Data(); }
227
228 /**
229 * Sets the default trigger domain to use if the global trigger does not
230 * fire and returns a negative result.
231 */
232 void DefaultTriggerDomain(const AliHLTTriggerDomain& value) { fDefaultDomain = value; }
233
234 /**
235 * Returns the default trigger domain to use if the global trigger does not
236 * fire and returns a negative result.
237 */
238 const AliHLTTriggerDomain& DefaultTriggerDomain() const { return fDefaultDomain; }
239
240 /**
241 * Returns the default trigger domain for modification.
242 */
243 AliHLTTriggerDomain& DefaultTriggerDomain() { return fDefaultDomain; }
244
81d62bb4 245 /**
246 * Sets the default operator used to merge trigger conditions that are matched from
247 * the same trigger menu priority group.
248 */
249 void DefaultConditionOperator(const char* value) { fDefaultConditionOperator = value; }
250
251 /**
252 * Returns the default operator used to merge trigger conditions that are matched from
253 * the same trigger menu priority group.
254 */
255 const char* DefaultConditionOperator() const { return fDefaultConditionOperator.Data(); }
256
257 /**
258 * Sets the default operator used to merge trigger domains that are matched from
259 * the same trigger menu priority group.
260 */
261 void DefaultDomainOperator(const char* value) { fDefaultDomainOperator = value; }
262
263 /**
264 * Returns the default operator used to merge trigger domains that are matched from
265 * the same trigger menu priority group.
266 */
267 const char* DefaultDomainOperator() const { return fDefaultDomainOperator.Data(); }
268
e2bb8ddd 269 private:
270
271 TString fName; /// Name of the trigger menu.
52f67e50 272 TClonesArray fSymbols; /// List of symbols used in trigger expressions.
e2bb8ddd 273 TClonesArray fItems; /// List of trigger menu items.
acc7214e 274 TString fDefaultDescription; /// The default trigger description to use for negative global triggers.
275 AliHLTTriggerDomain fDefaultDomain; /// The default trigger domain to use for negative global triggers.
81d62bb4 276 TString fDefaultConditionOperator; /// The default operator to use to merge trigger conditions from the same priority group.
277 TString fDefaultDomainOperator; /// The default operator to use to merge trigger domains from the same priority group.
e2bb8ddd 278
03c6767b 279 ClassDef(AliHLTTriggerMenu, 3) // Trigger menu for the global HLT trigger.
e2bb8ddd 280};
281
282#endif // ALIHLTTRIGGERMENU_H
283