]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTTriggerMenuItem.h
Modifications required for handling dots in HLT trigger names.
[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 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  *   _domain_
59  *   _description_
60  *   _item_result_
61  *   _group_result_
62  *   _previous_match_
63  *   _trigger_matched_
64  *   FillFromMenu
65  *   NewEvent
66  *   Add
67  *   CalculateTriggerDecision
68  *   GetCounters
69  *   SetCounters
70  *   CreateNew
71  */
72 class AliHLTTriggerMenuItem : public TObject
73 {
74  public:
75   
76   /**
77    * Default constructor.
78    */
79   AliHLTTriggerMenuItem();
80   
81   /**
82    * Default destructor.
83    */
84   virtual ~AliHLTTriggerMenuItem();
85   
86   /**
87    * Inherited from TObject, this prints the contents of the menu item.
88    * \param option  Can be "compact", which will print in the compact format.
89    */
90   virtual void Print(Option_t* option = "") const;
91   
92   /**
93    * Returns the optional comment string.
94    */
95   const char* Description() const { return fDescription.Data(); }
96   
97   /**
98    * Set the optional comment string.
99    */
100   void Description(const char* value) { fDescription = value; }
101   
102   /**
103    * Returns the trigger condition expression.
104    */
105   const char* TriggerCondition() const { return fConditionExpr.Data(); }
106   
107   /**
108    * Set the trigger condition expression.
109    */
110   void TriggerCondition(const char* value) { fConditionExpr = value; }
111   
112   /**
113    * Returns the trigger domain merging expression.
114    */
115   const char* MergeExpression() const { return fDomainExpr.Data(); }
116   
117   /**
118    * Set the trigger domain merging expression.
119    */
120   void MergeExpression(const char* value) { fDomainExpr = value; }
121   
122   /**
123    * Returns the pre-scalar value.
124    */
125   UInt_t PreScalar() const { return fPrescalar; }
126   
127   /**
128    * Set the pre-scalar value. A value of zero turns off the prescalar.
129    */
130   void PreScalar(UInt_t value) { fPrescalar = value; }
131   
132   /**
133    * Returns the priority value.
134    */
135   UInt_t Priority() const { return fPriority; }
136   
137   /**
138    * Set the priority value. Higher values give a higher priority.
139    */
140   void Priority(UInt_t value) { fPriority = value; }
141
142  private:
143   
144   TString fDescription;  /// Optional description or comment string.
145   TString fConditionExpr;  /// The trigger condition expression.
146   TString fDomainExpr;  /// Trigger domain merging expression.
147   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.
148   UInt_t fPriority;  /// Priority of the trigger menu item. Higher values have higher priority.
149   
150   ClassDef(AliHLTTriggerMenuItem, 3) // Trigger menu item for global HLT trigger.
151 };
152
153 #endif // ALIHLTTRIGGERMENUITEM_H
154