]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTGlobalTriggerConfig.cxx
Finished code for global HLT trigger and the trigger menu implementation.
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTriggerConfig.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * ALICE Experiment at CERN, All rights reserved.                         *
4  *                                                                        *
5  * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
6  *                  for The ALICE HLT Project.                            *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /// @file   AliHLTGlobalTriggerConfig.cxx
18 /// @author Artur Szostak <artursz@iafrica.com>
19 /// @date   28 Dec 2008
20 /// @brief  Implementation of the AliHLTGlobalTriggerConfig class.
21 ///
22 /// The AliHLTGlobalTriggerConfigComponent class is an interface class used to create
23 /// global HLT trigger menu configurations.
24
25 #include "AliHLTGlobalTriggerConfig.h"
26 #include "AliHLTTriggerMenu.h"
27
28 ClassImp(AliHLTGlobalTriggerConfig)
29
30 AliHLTTriggerMenu* AliHLTGlobalTriggerConfig::fgMenu = NULL;
31
32
33 AliHLTGlobalTriggerConfig::AliHLTGlobalTriggerConfig(const char* name)
34 {
35   // Default constructor.
36   
37   NewMenu(name);
38 }
39
40
41 AliHLTGlobalTriggerConfig::~AliHLTGlobalTriggerConfig()
42 {
43   // Default destructor.
44 }
45
46
47 void AliHLTGlobalTriggerConfig::NewMenu(const char* name)
48 {
49   // Creates a new trigger menu.
50   
51   if (fgMenu != NULL)
52   {
53     delete fgMenu;
54     fgMenu = NULL;
55   }
56   fgMenu = new AliHLTTriggerMenu;
57   fgMenu->Name(name);
58 }
59
60
61 void AliHLTGlobalTriggerConfig::Clear()
62 {
63   // Deletes the current trigger menu.
64   
65   if (fgMenu != NULL)
66   {
67     delete fgMenu;
68     fgMenu = NULL;
69   }
70 }
71
72
73 void AliHLTGlobalTriggerConfig::AddSymbol(
74     const char* name, const char* type, const char* assignExpr,
75     const char* defaultExpr, const char* className
76   )
77 {
78   // Adds a new symbol to the trigger menu.
79   
80   if (fgMenu == NULL) NewMenu("");
81   
82   AliHLTTriggerMenuSymbol entry;
83   entry.Name(name);
84   entry.Type(type);
85   entry.ObjectClass(className);
86   entry.AssignExpression(assignExpr);
87   entry.DefaultValue(defaultExpr);
88   fgMenu->AddSymbol(entry);
89 }
90
91
92 void AliHLTGlobalTriggerConfig::AddSymbol(
93     const char* name, const char* type, const char* assignExpr,
94     const char* defaultExpr, const char* className,
95     const AliHLTComponentDataType& blockType
96   )
97 {
98   // Adds a new symbol to the trigger menu.
99   
100   if (fgMenu == NULL) NewMenu("");
101   
102   AliHLTTriggerMenuSymbol entry;
103   entry.Name(name);
104   entry.Type(type);
105   entry.ObjectClass(className);
106   entry.AssignExpression(assignExpr);
107   entry.DefaultValue(defaultExpr);
108   entry.BlockType(blockType);
109   fgMenu->AddSymbol(entry);
110 }
111
112
113 void AliHLTGlobalTriggerConfig::AddSymbol(
114     const char* name, const char* type, const char* assignExpr,
115     const char* defaultExpr, const char* className,
116     const AliHLTComponentDataType& blockType, UInt_t spec
117   )
118 {
119   // Adds a new symbol to the trigger menu.
120   
121   if (fgMenu == NULL) NewMenu("");
122   
123   AliHLTTriggerMenuSymbol entry;
124   entry.Name(name);
125   entry.Type(type);
126   entry.ObjectClass(className);
127   entry.AssignExpression(assignExpr);
128   entry.DefaultValue(defaultExpr);
129   entry.BlockType(blockType, spec);
130   fgMenu->AddSymbol(entry);
131 }
132
133
134 void AliHLTGlobalTriggerConfig::AddSymbol(
135     const char* name, const char* type, const char* assignExpr,
136     const char* defaultExpr, const char* className,
137     const char* blockType, const char* origin
138   )
139 {
140   // Adds a new symbol to the trigger menu.
141   
142   if (fgMenu == NULL) NewMenu("");
143   
144   AliHLTTriggerMenuSymbol entry;
145   entry.Name(name);
146   entry.Type(type);
147   entry.ObjectClass(className);
148   entry.AssignExpression(assignExpr);
149   entry.DefaultValue(defaultExpr);
150   entry.BlockType(blockType, origin);
151   fgMenu->AddSymbol(entry);
152 }
153
154
155 void AliHLTGlobalTriggerConfig::AddSymbol(
156     const char* name, const char* type, const char* assignExpr,
157     const char* defaultExpr, const char* className,
158     const char* blockType, const char* origin, UInt_t spec
159   )
160 {
161   // Adds a new symbol to the trigger menu.
162   
163   if (fgMenu == NULL) NewMenu("");
164   
165   AliHLTTriggerMenuSymbol entry;
166   entry.Name(name);
167   entry.Type(type);
168   entry.ObjectClass(className);
169   entry.AssignExpression(assignExpr);
170   entry.DefaultValue(defaultExpr);
171   entry.BlockType(blockType, origin, spec);
172   fgMenu->AddSymbol(entry);
173 }
174
175
176 void AliHLTGlobalTriggerConfig::AddItem(
177     const char* conditionExpr, const char* domainExpr, UInt_t prescalar,
178     const char* description
179   )
180 {
181   // Adds a new entry to the trigger menu.
182   
183   if (fgMenu == NULL) NewMenu("");
184   
185   AliHLTTriggerMenuItem entry;
186   entry.TriggerCondision(conditionExpr);
187   entry.MergeExpression(domainExpr);
188   entry.PreScalar(prescalar);
189   if (description != NULL) entry.Description(description);
190   fgMenu->AddItem(entry);
191 }
192
193
194 void AliHLTGlobalTriggerConfig::AddItem(
195     const char* conditionExpr, const char* domainExpr, const char* description
196   )
197 {
198   // Adds a new entry to the trigger menu.
199   
200   if (fgMenu == NULL) NewMenu("");
201   
202   AliHLTTriggerMenuItem entry;
203   entry.TriggerCondision(conditionExpr);
204   entry.MergeExpression(domainExpr);
205   if (description != NULL) entry.Description(description);
206   fgMenu->AddItem(entry);
207 }
208