]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTGlobalTriggerConfig.cxx
Update of the SSD on-line clusterfinder:
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTriggerConfig.cxx
1 // $Id$
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        *
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  *                                                                        *
6  * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
7  *                  for The ALICE HLT Project.                            *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 /// @file   AliHLTGlobalTriggerConfig.cxx
19 /// @author Artur Szostak <artursz@iafrica.com>
20 /// @date   28 Dec 2008
21 /// @brief  Implementation of the AliHLTGlobalTriggerConfig class.
22 ///
23 /// The AliHLTGlobalTriggerConfigComponent class is an interface class used to create
24 /// global HLT trigger menu configurations.
25
26 #include "AliHLTGlobalTriggerConfig.h"
27 #include "AliHLTTriggerMenu.h"
28 #include "Riostream.h"
29
30 ClassImp(AliHLTGlobalTriggerConfig)
31
32 AliHLTTriggerMenu* AliHLTGlobalTriggerConfig::fgMenu = NULL;
33
34
35 AliHLTGlobalTriggerConfig::AliHLTGlobalTriggerConfig(const char* name)
36 {
37   // Default constructor.
38   
39   NewMenu(name);
40 }
41
42
43 AliHLTGlobalTriggerConfig::~AliHLTGlobalTriggerConfig()
44 {
45   // Default destructor.
46 }
47
48
49 void AliHLTGlobalTriggerConfig::NewMenu(const char* name)
50 {
51   // Creates a new trigger menu.
52   
53   if (fgMenu != NULL)
54   {
55     delete fgMenu;
56     fgMenu = NULL;
57   }
58   fgMenu = new AliHLTTriggerMenu;
59   fgMenu->Name(name);
60 }
61
62
63 void AliHLTGlobalTriggerConfig::Clear()
64 {
65   // Deletes the current trigger menu.
66   
67   if (fgMenu != NULL)
68   {
69     delete fgMenu;
70     fgMenu = NULL;
71   }
72 }
73
74
75 void AliHLTGlobalTriggerConfig::AddSymbol(
76     const char* name, const char* type, const char* defaultExpr
77   )
78 {
79   // Adds a new constant symbol to the trigger menu.
80   
81   if (fgMenu == NULL) NewMenu("");
82   
83   AliHLTTriggerMenuSymbol entry;
84   entry.Name(name);
85   entry.Type(type);
86   entry.ObjectClass("");
87   entry.AssignExpression("");
88   entry.DefaultValue(defaultExpr);
89   fgMenu->AddSymbol(entry);
90 }
91
92
93 void AliHLTGlobalTriggerConfig::AddSymbol(
94     const char* name, const char* type, const char* assignExpr,
95     const char* defaultExpr, const char* className
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   fgMenu->AddSymbol(entry);
109 }
110
111
112 void AliHLTGlobalTriggerConfig::AddSymbol(
113     const char* name, const char* type, const char* assignExpr,
114     const char* defaultExpr, const char* className,
115     const AliHLTComponentDataType& blockType
116   )
117 {
118   // Adds a new symbol to the trigger menu.
119   
120   if (fgMenu == NULL) NewMenu("");
121   
122   AliHLTTriggerMenuSymbol entry;
123   entry.Name(name);
124   entry.Type(type);
125   entry.ObjectClass(className);
126   entry.AssignExpression(assignExpr);
127   entry.DefaultValue(defaultExpr);
128   entry.BlockType(blockType);
129   fgMenu->AddSymbol(entry);
130 }
131
132
133 void AliHLTGlobalTriggerConfig::AddSymbol(
134     const char* name, const char* type, const char* assignExpr,
135     const char* defaultExpr, const char* className,
136     const AliHLTComponentDataType& blockType, UInt_t spec
137   )
138 {
139   // Adds a new symbol to the trigger menu.
140   
141   if (fgMenu == NULL) NewMenu("");
142   
143   AliHLTTriggerMenuSymbol entry;
144   entry.Name(name);
145   entry.Type(type);
146   entry.ObjectClass(className);
147   entry.AssignExpression(assignExpr);
148   entry.DefaultValue(defaultExpr);
149   entry.BlockType(blockType, spec);
150   fgMenu->AddSymbol(entry);
151 }
152
153
154 void AliHLTGlobalTriggerConfig::AddSymbol(
155     const char* name, const char* type, const char* assignExpr,
156     const char* defaultExpr, const char* className,
157     const char* blockType, const char* origin
158   )
159 {
160   // Adds a new symbol to the trigger menu.
161   
162   if (fgMenu == NULL) NewMenu("");
163   
164   AliHLTTriggerMenuSymbol entry;
165   entry.Name(name);
166   entry.Type(type);
167   entry.ObjectClass(className);
168   entry.AssignExpression(assignExpr);
169   entry.DefaultValue(defaultExpr);
170   entry.BlockType(blockType, origin);
171   fgMenu->AddSymbol(entry);
172 }
173
174
175 void AliHLTGlobalTriggerConfig::AddSymbol(
176     const char* name, const char* type, const char* assignExpr,
177     const char* defaultExpr, const char* className,
178     const char* blockType, const char* origin, UInt_t spec
179   )
180 {
181   // Adds a new symbol to the trigger menu.
182   
183   if (fgMenu == NULL) NewMenu("");
184   
185   AliHLTTriggerMenuSymbol entry;
186   entry.Name(name);
187   entry.Type(type);
188   entry.ObjectClass(className);
189   entry.AssignExpression(assignExpr);
190   entry.DefaultValue(defaultExpr);
191   entry.BlockType(blockType, origin, spec);
192   fgMenu->AddSymbol(entry);
193 }
194
195
196 void AliHLTGlobalTriggerConfig::AddItem(
197     UInt_t priority, const char* conditionExpr, const char* domainExpr,
198     UInt_t prescalar, const char* description
199   )
200 {
201   // Adds a new entry to the trigger menu with a particular priority.
202   
203   if (fgMenu == NULL) NewMenu("");
204   
205   AliHLTTriggerMenuItem entry;
206   entry.TriggerCondition(conditionExpr);
207   entry.MergeExpression(domainExpr);
208   entry.PreScalar(prescalar);
209   entry.Priority(priority);
210   if (description != NULL) entry.Description(description);
211   fgMenu->AddItem(entry);
212 }
213
214
215 void AliHLTGlobalTriggerConfig::AddItem(
216     const char* conditionExpr, const char* domainExpr, UInt_t prescalar,
217     const char* description
218   )
219 {
220   // Adds a new entry to the trigger menu.
221   
222   if (fgMenu == NULL) NewMenu("");
223   
224   AliHLTTriggerMenuItem entry;
225   entry.TriggerCondition(conditionExpr);
226   entry.MergeExpression(domainExpr);
227   entry.PreScalar(prescalar);
228   if (description != NULL) entry.Description(description);
229   fgMenu->AddItem(entry);
230 }
231
232
233 void AliHLTGlobalTriggerConfig::AddItem(
234     UInt_t priority, const char* conditionExpr, const char* domainExpr,
235     const char* description
236   )
237 {
238   // Adds a new entry to the trigger menu with a particular priority.
239   
240   if (fgMenu == NULL) NewMenu("");
241   
242   AliHLTTriggerMenuItem entry;
243   entry.TriggerCondition(conditionExpr);
244   entry.MergeExpression(domainExpr);
245   entry.Priority(priority);
246   if (description != NULL) entry.Description(description);
247   fgMenu->AddItem(entry);
248 }
249
250
251 void AliHLTGlobalTriggerConfig::AddItem(
252     const char* conditionExpr, const char* domainExpr, const char* description
253   )
254 {
255   // Adds a new entry to the trigger menu.
256   
257   if (fgMenu == NULL) NewMenu("");
258   
259   AliHLTTriggerMenuItem entry;
260   entry.TriggerCondition(conditionExpr);
261   entry.MergeExpression(domainExpr);
262   if (description != NULL) entry.Description(description);
263   fgMenu->AddItem(entry);
264 }
265
266
267 void AliHLTGlobalTriggerConfig::SetDefaultTriggerDescription(const char* description)
268 {
269   // Sets the default trigger decription.
270   
271   if (fgMenu == NULL) NewMenu("");
272   fgMenu->DefaultDescription(description);
273 }
274
275
276 void AliHLTGlobalTriggerConfig::SetDefaultTriggerDomain(const AliHLTTriggerDomain& domain)
277 {
278   // Sets the default trigger domain.
279   
280   if (fgMenu == NULL) NewMenu("");
281   fgMenu->DefaultTriggerDomain(domain);
282 }
283
284
285 AliHLTTriggerDomain& AliHLTGlobalTriggerConfig::DefaultTriggerDomain()
286 {
287   // Returns the default trigger domain for the current trigger menu.
288   
289   if (fgMenu == NULL) NewMenu("");
290   return fgMenu->DefaultTriggerDomain();
291 }
292
293
294 void AliHLTGlobalTriggerConfig::SetDefaultConditionOperator(const char* op)
295 {
296   // Sets the default operator for trigger condition merging.
297   
298   if (fgMenu == NULL) NewMenu("");
299   fgMenu->DefaultConditionOperator(op);
300 }
301
302
303 void AliHLTGlobalTriggerConfig::SetDefaultDomainOperator(const char* op)
304 {
305   // Sets the default operator for trigger domain merging.
306   
307   if (fgMenu == NULL) NewMenu("");
308   fgMenu->DefaultDomainOperator(op);
309 }
310
311
312 void AliHLTGlobalTriggerConfig::Print(Option_t* option) const
313 {
314   // Prints the contents of the current trigger menu being manipulated.
315   
316   if (fgMenu != NULL)
317   {
318     fgMenu->Print(option);
319   }
320   else
321   {
322     cout << "No trigger menu currently being configured, it is empty." << endl;
323   }
324 }
325