]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTTriggerMenuItem.h
calculating entropy for parameter histograms
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTriggerMenuItem.h
1 //-*- Mode: C++ -*-
2 // $Id$
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
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++.
28  *
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.
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.
55  *
56  * \note The following symbol names are reserved and should not be used in either
57  * the trigger condition or merging expressions:
58  *   _trigger_result_
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
72  */
73 class 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   
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   
103   /**
104    * Returns the trigger condition expression.
105    */
106   const char* TriggerCondition() const { return fConditionExpr.Data(); }
107   
108   /**
109    * Set the trigger condition expression.
110    */
111   void TriggerCondition(const char* value) { fConditionExpr = value; }
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.
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].
137    */
138   void PreScalar(UInt_t value) { fPrescalar = value; }
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; }
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); }
176
177  private:
178   
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].
185   
186   ClassDef(AliHLTTriggerMenuItem, 4) // Trigger menu item for global HLT trigger.
187 };
188
189 #endif // ALIHLTTRIGGERMENUITEM_H
190