]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTGlobalTriggerConfig.cxx
including the CTPData to the input objects of the HLTGlobalTriggerDecision
[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     const char* conditionExpr, const char* domainExpr, UInt_t prescalar,
198     const char* description
199   )
200 {
201   // Adds a new entry to the trigger menu.
202   
203   if (fgMenu == NULL) NewMenu("");
204   
205   AliHLTTriggerMenuItem entry;
206   entry.TriggerCondision(conditionExpr);
207   entry.MergeExpression(domainExpr);
208   entry.PreScalar(prescalar);
209   if (description != NULL) entry.Description(description);
210   fgMenu->AddItem(entry);
211 }
212
213
214 void AliHLTGlobalTriggerConfig::AddItem(
215     const char* conditionExpr, const char* domainExpr, const char* description
216   )
217 {
218   // Adds a new entry to the trigger menu.
219   
220   if (fgMenu == NULL) NewMenu("");
221   
222   AliHLTTriggerMenuItem entry;
223   entry.TriggerCondision(conditionExpr);
224   entry.MergeExpression(domainExpr);
225   if (description != NULL) entry.Description(description);
226   fgMenu->AddItem(entry);
227 }
228
229
230 void AliHLTGlobalTriggerConfig::SetDefaultTriggerDescription(const char* description)
231 {
232   // Sets the default trigger decription.
233   
234   if (fgMenu == NULL) NewMenu("");
235   fgMenu->DefaultDescription(description);
236 }
237
238
239 void AliHLTGlobalTriggerConfig::SetDefaultTriggerDomain(const AliHLTTriggerDomain& domain)
240 {
241   // Sets the default trigger domain.
242   
243   if (fgMenu == NULL) NewMenu("");
244   fgMenu->DefaultTriggerDomain(domain);
245 }
246
247
248 AliHLTTriggerDomain& AliHLTGlobalTriggerConfig::DefaultTriggerDomain()
249 {
250   // Returns the default trigger domain for the current trigger menu.
251   
252   if (fgMenu == NULL) NewMenu("");
253   return fgMenu->DefaultTriggerDomain();
254 }
255
256
257 void AliHLTGlobalTriggerConfig::Print(Option_t* option) const
258 {
259   // Prints the contents of the current trigger menu being manipulated.
260   
261   if (fgMenu != NULL)
262   {
263     fgMenu->Print(option);
264   }
265   else
266   {
267     cout << "No trigger menu currently being configured, it is empty." << endl;
268   }
269 }
270