]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTTriggerMenuItem.h
Updates in D-meson PID class:
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTriggerMenuItem.h
CommitLineData
c580e182 1//-*- Mode: C++ -*-
81d62bb4 2// $Id$
e2bb8ddd 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 */
8
9/// @file AliHLTTriggerMenuItem.h
10/// @author Artur Szostak <artursz@iafrica.com>
11/// @date 19 Dec 2008
12/// @brief Declaration of the AliHLTTriggerMenuItem class.
13
14#include "TObject.h"
15#include "TString.h"
16#include "TArrayL.h"
17
18/**
19 * \class AliHLTTriggerMenuItem
81d62bb4 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
f925a066 23 * expression, trigger priority, trigger scale-down and the prescalar to apply.
025443e0 24 * The trigger condition is an expression which indicates what must be true
81d62bb4 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.
025443e0 27 * All expressions must be valid C++.
28 *
29 * The symbols used in the trigger condition expressions are assumed to be AliHLTTrigger
1788d826 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.
025443e0 38 *
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:
45 * \code
46 * AliHLTGlobalTriggerConfig config("test config");
47 * config.AddSymbol("myTriggerName", "bool", "this->Result()", "0", "AliHLTTriggerDecision");
48 * \endcode
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.
81d62bb4 55 *
56 * \note The following symbol names are reserved and should not be used in either
57 * the trigger condition or merging expressions:
f925a066 58 * _trigger_result_
81d62bb4 59 * _domain_
60 * _description_
61 * _item_result_
62 * _group_result_
63 * _previous_match_
64 * _trigger_matched_
65 * FillFromMenu
66 * NewEvent
67 * Add
68 * CalculateTriggerDecision
69 * GetCounters
70 * SetCounters
71 * CreateNew
e2bb8ddd 72 */
73class AliHLTTriggerMenuItem : public TObject
74{
75 public:
76
77 /**
78 * Default constructor.
79 */
80 AliHLTTriggerMenuItem();
81
82 /**
83 * Default destructor.
84 */
85 virtual ~AliHLTTriggerMenuItem();
86
87 /**
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.
90 */
91 virtual void Print(Option_t* option = "") const;
92
52f67e50 93 /**
94 * Returns the optional comment string.
95 */
96 const char* Description() const { return fDescription.Data(); }
97
98 /**
99 * Set the optional comment string.
100 */
101 void Description(const char* value) { fDescription = value; }
102
e2bb8ddd 103 /**
104 * Returns the trigger condition expression.
105 */
81d62bb4 106 const char* TriggerCondition() const { return fConditionExpr.Data(); }
e2bb8ddd 107
108 /**
109 * Set the trigger condition expression.
110 */
81d62bb4 111 void TriggerCondition(const char* value) { fConditionExpr = value; }
e2bb8ddd 112
113 /**
114 * Returns the trigger domain merging expression.
115 */
116 const char* MergeExpression() const { return fDomainExpr.Data(); }
117
118 /**
119 * Set the trigger domain merging expression.
120 */
121 void MergeExpression(const char* value) { fDomainExpr = value; }
122
123 /**
124 * Returns the pre-scalar value.
125 */
126 UInt_t PreScalar() const { return fPrescalar; }
127
128 /**
129 * Set the pre-scalar value. A value of zero turns off the prescalar.
f925a066 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:
134 * r = 1/n * s
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].
e2bb8ddd 137 */
138 void PreScalar(UInt_t value) { fPrescalar = value; }
81d62bb4 139
140 /**
141 * Returns the priority value.
142 */
143 UInt_t Priority() const { return fPriority; }
144
145 /**
146 * Set the priority value. Higher values give a higher priority.
147 */
148 void Priority(UInt_t value) { fPriority = value; }
f925a066 149
150 /**
151 * Returns the scale down factor in the range [0..1].
152 */
153 Double_t ScaleDown() const { return fScaleDown; }
154
155 /**
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
164 */
165 void ScaleDown(Double_t value) { fScaleDown = (value < 0 ? 0 : (value > 1 ? 1 : value)); }
166
167 /**
168 * Returns the default result for the global trigger if this item is matched.
169 */
170 bool DefaultResult() const { return TestBit(BIT(15)) == 1; }
171
172 /**
173 * Set the default result for the global trigger if this item is matched.
174 */
175 void DefaultResult(bool value) { SetBit(BIT(15), value); }
e2bb8ddd 176
177 private:
178
52f67e50 179 TString fDescription; /// Optional description or comment string.
e2bb8ddd 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.
81d62bb4 183 UInt_t fPriority; /// Priority of the trigger menu item. Higher values have higher priority.
f925a066 184 Double_t fScaleDown; /// Trigger scale-down factor to apply to this item. Valid values are in the range [0..1].
e2bb8ddd 185
f925a066 186 ClassDef(AliHLTTriggerMenuItem, 4) // Trigger menu item for global HLT trigger.
e2bb8ddd 187};
188
189#endif // ALIHLTTRIGGERMENUITEM_H
190