]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/trigger/AliHLTGlobalTriggerComponent.h
- code cleanup and starting component documentation
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTriggerComponent.h
CommitLineData
c580e182 1//-*- Mode: C++ -*-
2// $Id:$
1b9a175e 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 */
8
9/// @file AliHLTGlobalTriggerComponent.h
10/// @author Artur Szostak <artursz@iafrica.com>
11/// @date 26 Nov 2008
12/// @brief Declaration of the AliHLTGlobalTriggerComponent component class.
13
14#include "AliHLTTrigger.h"
15
e2bb8ddd 16class AliHLTTriggerMenu;
17class AliHLTGlobalTrigger;
52f67e50 18class TClonesArray;
e2bb8ddd 19
1b9a175e 20/**
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
52f67e50 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.
28 *
29 * <h2>General properties:</h2>
30 *
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>
35 *
36 * <h2>Mandatory arguments:</h2>
37 *
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.
48 * \li -debug <br>
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
54 * <i>filename</i>.
55 *
56 * <h2>Configuration:</h2>
57 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
58 * Configuration by component arguments.
59 *
60 * <h2>Default CDB entries:</h2>
61 * TODO
62 *
63 * <h2>Performance:</h2>
64 * TODO
65 *
66 * <h2>Memory consumption:</h2>
67 * TODO
68 *
69 * <h2>Output size:</h2>
70 * TODO
71 *
72 * \ingroup alihlt_trigger_components
1b9a175e 73 */
74class AliHLTGlobalTriggerComponent : public AliHLTTrigger
75{
76 public:
77
78 AliHLTGlobalTriggerComponent();
79 virtual ~AliHLTGlobalTriggerComponent();
80
81 /**
82 * Inherited from AliHLTTrigger.
83 * @return string containing the global trigger name.
84 */
85 virtual const char* GetTriggerName() const { return "HLTGlobalTrigger"; };
e2bb8ddd 86
1b9a175e 87 /**
88 * Get a ratio by how much the data volume is shrunk or enhanced.
89 * The method returns a size proportional to the trigger name string length
90 * for constBase, and 1 for inputMultiplier.
91 * @param constBase <i>[out]</i>: additive part, independent of the
92 * input data volume
93 * @param inputMultiplier <i>[out]</i>: multiplication ratio
94 */
95 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
4f1d6b68 96
e2bb8ddd 97 /**
98 * Initialise the component.
99 * \param argc The number of arguments in argv.
100 * \param argv Array of component argument strings.
101 * \returns Zero on success and negative number on failure.
102 */
103 virtual Int_t DoInit(int argc, const char** argv);
104
105 /**
106 * Cleanup the component.
107 * \returns Zero on success and negative number on failure.
108 */
109 virtual Int_t DoDeinit();
110
4f1d6b68 111 /**
112 * Spawn function creates a new object.
113 * @return new class instance.
114 */
115 virtual AliHLTComponent* Spawn();
1b9a175e 116
117 protected:
118
1b9a175e 119 /**
120 * Applies the global HLT trigger.
121 * @return Zero is returned on success and a negative error code on failure.
122 */
123 virtual int DoTrigger();
124
125 private:
52f67e50 126
127 /// Not implemented. Do not allow copying of this object.
128 AliHLTGlobalTriggerComponent(const AliHLTGlobalTriggerComponent& obj);
129 /// Not implemented. Do not allow copying of this object.
130 AliHLTGlobalTriggerComponent& operator = (const AliHLTGlobalTriggerComponent& obj);
1b9a175e 131
e2bb8ddd 132 /**
133 * Generates the code for the global trigger to apply the given trigger menu.
134 * The code will then be compiled on the fly and loaded. The name of the new
135 * class is returned so that a new instance of the class can be created via:
136 * \code
137 * AliHLTGlobalTrigger::CreateNew(name)
138 * \endcode
139 * where name is the name of the generated class as returned by this method.
52f67e50 140 * \param menu <i>in</i> The trigger menu to create the global trigger class from.
141 * \param name <i>out</i> The name of the generated class.
142 * \param includePaths <i>in</i> The list of include path strings.
143 * \param includeFiles <i>in</i> The list of include file strings.
144 * \returns The error code suitable to return in DoInit. Zero on success.
145 */
146 int GenerateTrigger(
147 const AliHLTTriggerMenu* menu, TString& name,
148 const TClonesArray& includePaths, const TClonesArray& includeFiles
149 );
150
151 /**
152 * Loads the code for the generated HLT global trigger class. The code is compiled
153 * on the fly if possible, otherwise the CINT interpreter is used to interpret
154 * the class.
155 * \param filename The name of the file containing the code for the global trigger class.
156 * \param includePaths <i>in</i> The list of include path strings.
157 * \returns The error code suitable to return in DoInit. Zero on success.
158 */
159 int LoadTriggerClass(const char* filename, const TClonesArray& includePaths);
160
161 /**
162 * Searches for the specified symbol name in the given list.
163 * \param name The name of the symbol to find.
164 * \param list The list to search for the symbol in.
165 * \returns The position (index) of the symbol found or -1 if it was not found.
166 */
167 int FindSymbol(const char* name, const TClonesArray& list);
168
169 /**
170 * Builds the list of symbols to use in the custom global trigger menu
171 * implementation class.
e2bb8ddd 172 * \param menu The trigger menu to create the global trigger class from.
52f67e50 173 * \param list The list to fill with symbols.
e2bb8ddd 174 * \returns The error code suitable to return in DoInit. Zero on success.
175 */
52f67e50 176 int BuildSymbolList(const AliHLTTriggerMenu* menu, TClonesArray& list);
e2bb8ddd 177
178 AliHLTGlobalTrigger* fTrigger; //! Trigger object which implements the global trigger menu.
52f67e50 179 bool fDebugMode; //! Indicates if the generated global trigger class should be in debug mode.
e2bb8ddd 180
1b9a175e 181 ClassDef(AliHLTGlobalTriggerComponent, 0) // Global HLT trigger component class which produces the final trigger decision and readout list.
182};
183
184#endif // ALIHLTGLOBALTRIGGERCOMPONENT_H
185