3 #ifndef ALIHLTTRIGGERMENUITEM_H
4 #define ALIHLTTRIGGERMENUITEM_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 */
9 /// @file AliHLTTriggerMenuItem.h
10 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @brief Declaration of the AliHLTTriggerMenuItem class.
19 * \class AliHLTTriggerMenuItem
20 * A trigger menu item is used to store the information for a single entry in the
21 * HLT global trigger menu AliHLTTriggerMenu.
22 * It stores information about the trigger condition, trigger domain merging
23 * expression, trigger priority, trigger scale-down and the prescalar to apply.
24 * The trigger condition is an expression which indicates what must be true
25 * for the trigger menu entry to be fired. A fired item will then use the trigger
26 * domain merging expression for the computation of the final global trigger domain.
27 * All expressions must be valid C++.
29 * The symbols used in the trigger condition expressions are assumed to be AliHLTTrigger
30 * names, unless they are predefined in the trigger menu symbols table. All symbols
31 * should be valid C++ symbol names. However, the '-' and '.' characters are allowed
32 * as a special extention. Neither the '-', nor '.' characters can be the first
33 * character of the symbol and there cannot be any spaces between it and the
34 * alphanumeric characters. If there are any spaces then the '-' or '.' character is
35 * treated as the normal C++ minus or dereferencing operator respectively.
36 * For example, "abc-xyz" is a single whole symbol, while "abc - xyz" are two symbols,
37 * abc and xyz, separated by a minus operator.
39 * Merging expressions can use all the symbols defined in the trigger menu symbols table
40 * including all the implicit symbols used in the trigger conditions which are assumed
41 * to be AliHLTTrigger names. If a AliHLTTrigger name is not used in a trigger condition
42 * expression, but one wants to use the trigger domain in a merging expression, then a
43 * predefined symbol must be added to the trigger menu symbol table. As an example, in
44 * the following manner:
46 * AliHLTGlobalTriggerConfig config("test config");
47 * config.AddSymbol("myTriggerName", "bool", "this->Result()", "0", "AliHLTTriggerDecision");
49 * The trigger name "myTriggerName" should be replaced with the actual name of the
50 * AliHLTTrigger from which one wants to use the trigger domain result.
51 * Symbols with the '-' sign are be handled automatically and will be replaced
52 * by their appropriate versions with the minus signs replaced by underscores.
53 * This means that a minus sign in any other location is always treated as an operator.
54 * If uncertain then just put spaces around the minus operator.
56 * \note The following symbol names are reserved and should not be used in either
57 * the trigger condition or merging expressions:
68 * CalculateTriggerDecision
73 class AliHLTTriggerMenuItem : public TObject
78 * Default constructor.
80 AliHLTTriggerMenuItem();
85 virtual ~AliHLTTriggerMenuItem();
88 * Inherited from TObject, this prints the contents of the menu item.
89 * \param option Can be "compact", which will print in the compact format.
91 virtual void Print(Option_t* option = "") const;
94 * Returns the optional comment string.
96 const char* Description() const { return fDescription.Data(); }
99 * Set the optional comment string.
101 void Description(const char* value) { fDescription = value; }
104 * Returns the trigger condition expression.
106 const char* TriggerCondition() const { return fConditionExpr.Data(); }
109 * Set the trigger condition expression.
111 void TriggerCondition(const char* value) { fConditionExpr = value; }
114 * Returns the trigger domain merging expression.
116 const char* MergeExpression() const { return fDomainExpr.Data(); }
119 * Set the trigger domain merging expression.
121 void MergeExpression(const char* value) { fDomainExpr = value; }
124 * Returns the pre-scalar value.
126 UInt_t PreScalar() const { return fPrescalar; }
129 * Set the pre-scalar value. A value of zero turns off the prescalar.
130 * \param value Indicates that only every n'th trigger should be passed.
131 * HLT triggers will be scaled down by the amount 1/value.
132 * \note If both the prescalar and the scale-down factors are set then the
133 * trigger rate reduction r will be higher and can be calculated by:
135 * where n is the prescalar value (an integer) and s is the scale down
136 * factor, which is a floating point number in the range [0..1].
138 void PreScalar(UInt_t value) { fPrescalar = value; }
141 * Returns the priority value.
143 UInt_t Priority() const { return fPriority; }
146 * Set the priority value. Higher values give a higher priority.
148 void Priority(UInt_t value) { fPriority = value; }
151 * Returns the scale down factor in the range [0..1].
153 Double_t ScaleDown() const { return fScaleDown; }
156 * Set the scale down factor.
157 * \param value The scale down to set. Valid values are in the range [0..1].
158 * If <i>value</i> is outside the valid range it will be truncated the
159 * nearest valid value in the range.
160 * \note A scale-down of 0 indicates no triggers are passes through, 1 indicates
161 * all triggers are passed through and all values between this range will
162 * cause the triggers to be vetoed randomally so as to reproduce:
163 * triggers passed / triggers dropped = scale-down
165 void ScaleDown(Double_t value) { fScaleDown = (value < 0 ? 0 : (value > 1 ? 1 : value)); }
168 * Returns the default result for the global trigger if this item is matched.
170 bool DefaultResult() const { return TestBit(BIT(15)) == 1; }
173 * Set the default result for the global trigger if this item is matched.
175 void DefaultResult(bool value) { SetBit(BIT(15), value); }
179 TString fDescription; /// Optional description or comment string.
180 TString fConditionExpr; /// The trigger condition expression.
181 TString fDomainExpr; /// Trigger domain merging expression.
182 UInt_t fPrescalar; /// Pre-scalar value used to optionally reduce the trigger rate. Every modulus n'th event is triggered, where n equals the pre-scalar value.
183 UInt_t fPriority; /// Priority of the trigger menu item. Higher values have higher priority.
184 Double_t fScaleDown; /// Trigger scale-down factor to apply to this item. Valid values are in the range [0..1].
186 ClassDef(AliHLTTriggerMenuItem, 4) // Trigger menu item for global HLT trigger.
189 #endif // ALIHLTTRIGGERMENUITEM_H