3 #ifndef ALIHLTGLOBALTRIGGERCOMPONENT_H
4 #define ALIHLTGLOBALTRIGGERCOMPONENT_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 */
9 /// @file AliHLTGlobalTriggerComponent.h
10 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @brief Declaration of the AliHLTGlobalTriggerComponent component class.
14 #include "AliHLTTrigger.h"
16 class AliHLTTriggerMenu;
17 class AliHLTGlobalTrigger;
21 * \class AliHLTGlobalTriggerComponent
22 * This class applies the global HLT trigger to all trigger information produced
23 * by components deriving from AliHLTTrigger.
24 * Any information delivered by other components in data blocks that contain
25 * TObjects can also be used for the trigger algorithm. In such cases a symbol
26 * needs to be defined in the global trigger menu which can then be used inside
27 * the trigger condition expressions.
29 * <h2>General properties:</h2>
31 * Component ID: \b HLTGlobalTrigger <br>
32 * Library: \b libAliHLTTrigger.so <br>
33 * Input Data Types: ::kAliHLTAnyDataType <br>
34 * Output Data Types: kAliHLTDataTypeTObject|kAliHLTDataOriginOut <br>
36 * <h2>Mandatory arguments:</h2>
38 * <h2>Optional arguments:</h2>
39 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
40 * \li -config <i>filename</i> <br>
41 * Indicates the configuration macro file to use for the global HLT trigger menu.
42 * \li -includepath <i>path</i> <br>
43 * Indicates the include path to use if the automatically generated code that
44 * implements the global HLT trigger requires non-standard includes.
45 * \li -include <i>filename</i> <br>
46 * Indicates a file name that should be included in the automatically generated
47 * trigger implementation code.
49 * If specified the automatically generated class will contain extra debugging
50 * code and the ACLiC system will have debugging compilation turned on.
51 * \li -usecode <i>filename</i> <i>classname</i> <br>
52 * Used to force the component to use an existing class for the global HLT trigger
53 * class implementation, with the name of <i>classname</i> and found in the file
56 * <h2>Configuration:</h2>
57 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
58 * Configuration by component arguments.
60 * <h2>Default CDB entries:</h2>
61 * HLT/ConfigHLT/HLTGlobalTrigger - Contains the global trigger menu.
63 * <h2>Performance:</h2>
64 * This is a linear function of the number of input triggers (AliHLTTrigger) that
65 * need to be processed.
66 * For a modest trigger menu configurations the processing time per event should
67 * be on the order of a few milliseconds.
69 * <h2>Memory consumption:</h2>
70 * Memory consumption is minimal. It should be on the order of 2 or 3 MBytes.
72 * <h2>Output size:</h2>
73 * This will depend almost linearly on the number of intput triggers and summary
74 * data objects used. Thus, for every trigger (AliHLTTrigger object) specified
75 * in the trigger menu the output size will require about 1 kBytes.
76 * Then for every summary data object (i.e. TObject symbol defined in the trigger
77 * menu configuration) one will need an extra few kBytes, depending on the size
78 * of the summary objects.
79 * In total one would expect no more than a MByte output size for a large trigger
80 * configuration and typically only a few kBytes for a small or optimised one.
82 * \ingroup alihlt_trigger_components
84 class AliHLTGlobalTriggerComponent : public AliHLTTrigger
88 AliHLTGlobalTriggerComponent();
89 virtual ~AliHLTGlobalTriggerComponent();
92 * Inherited from AliHLTTrigger.
93 * @return string containing the global trigger name.
95 virtual const char* GetTriggerName() const { return "HLTGlobalTrigger"; };
98 * Get a ratio by how much the data volume is shrunk or enhanced.
99 * The method returns a size proportional to the trigger name string length
100 * for constBase, and 1 for inputMultiplier.
101 * @param constBase <i>[out]</i>: additive part, independent of the
103 * @param inputMultiplier <i>[out]</i>: multiplication ratio
105 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
108 * Initialise the component.
109 * \param argc The number of arguments in argv.
110 * \param argv Array of component argument strings.
111 * \returns Zero on success and negative number on failure.
113 virtual Int_t DoInit(int argc, const char** argv);
116 * Cleanup the component.
117 * \returns Zero on success and negative number on failure.
119 virtual Int_t DoDeinit();
122 * Spawn function creates a new object.
123 * @return new class instance.
125 virtual AliHLTComponent* Spawn();
130 * Applies the global HLT trigger.
131 * @return Zero is returned on success and a negative error code on failure.
133 virtual int DoTrigger();
137 /// Not implemented. Do not allow copying of this object.
138 AliHLTGlobalTriggerComponent(const AliHLTGlobalTriggerComponent& obj);
139 /// Not implemented. Do not allow copying of this object.
140 AliHLTGlobalTriggerComponent& operator = (const AliHLTGlobalTriggerComponent& obj);
143 * Generates the code for the global trigger to apply the given trigger menu.
144 * The code will then be compiled on the fly and loaded. The name of the new
145 * class is returned so that a new instance of the class can be created via:
147 * AliHLTGlobalTrigger::CreateNew(name)
149 * where name is the name of the generated class as returned by this method.
150 * \param menu <i>in</i> The trigger menu to create the global trigger class from.
151 * \param name <i>out</i> The name of the generated class.
152 * \param includePaths <i>in</i> The list of include path strings.
153 * \param includeFiles <i>in</i> The list of include file strings.
154 * \returns The error code suitable to return in DoInit. Zero on success.
157 const AliHLTTriggerMenu* menu, TString& name,
158 const TClonesArray& includePaths, const TClonesArray& includeFiles
162 * Loads the code for the generated HLT global trigger class. The code is compiled
163 * on the fly if possible, otherwise the CINT interpreter is used to interpret
165 * \param filename The name of the file containing the code for the global trigger class.
166 * \param includePaths <i>in</i> The list of include path strings.
167 * \returns The error code suitable to return in DoInit. Zero on success.
169 int LoadTriggerClass(const char* filename, const TClonesArray& includePaths);
172 * Searches for the specified symbol name in the given list.
173 * \param name The name of the symbol to find.
174 * \param list The list to search for the symbol in.
175 * \returns The position (index) of the symbol found or -1 if it was not found.
177 int FindSymbol(const char* name, const TClonesArray& list);
180 * Builds the list of symbols to use in the custom global trigger menu
181 * implementation class.
182 * \param menu The trigger menu to create the global trigger class from.
183 * \param list The list to fill with symbols.
184 * \returns The error code suitable to return in DoInit. Zero on success.
186 int BuildSymbolList(const AliHLTTriggerMenu* menu, TClonesArray& list);
188 AliHLTGlobalTrigger* fTrigger; //! Trigger object which implements the global trigger menu.
189 bool fDebugMode; //! Indicates if the generated global trigger class should be in debug mode.
190 TString fCodeFileName; //! base file name of the generated code for the global trigger
192 static const char* fgkTriggerMenuCDBPath; //! The path string to read the trigger menu from the CDB.
194 ClassDef(AliHLTGlobalTriggerComponent, 0) // Global HLT trigger component class which produces the final trigger decision and readout list.
197 #endif // ALIHLTGLOBALTRIGGERCOMPONENT_H