4 #ifndef ALIHLTMODULEAGENT_H
5 #define ALIHLTMODULEAGENT_H
6 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
9 /** @file AliHLTModuleAgent.h
10 @author Matthias Richter
12 @brief Agent helper class for component libraries.
13 @note The class is used in Offline (AliRoot) context
16 // see below for class documentation
18 // refer to README to build package
20 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
24 #include "AliHLTLogging.h"
25 #include "AliHLTConfiguration.h"
26 #include "AliHLTConfigurationHandler.h"
31 * @class AliHLTModuleAgent
32 * @brief Agent helper class for HLT sub modules, e.g. PHOS, TPC, Trigger
34 * This class implements the agent base class for the HLT sub modules.
35 * The agent of a library gives information on the features of the library/
36 * components, like the configurations to run and other component libraries
38 * @note There must not be more than one agent per module/library.
40 * All HLT component libraries are loaded on demand through the HLT steering
41 * instance (@ref AliHLTSystem). A library can implement an agent derived
42 * from this base class, and has to define one global object of this agent
43 * in the code. The agent will be registered automatically, and the features
44 * can be queried when required.
46 * This is usually done during running the AliRoot reconstruction (see AliRoot
47 * documentation on <tt> AliReconstruction</tt>). The HLT implemets the @ref
48 * AliHLTReconstructor which holds the HLT steering object. Several flags can
49 * be specified as options via the <tt>SetOption</tt> method of
50 * <tt>AliReconstruction</tt>, including the component libraries to be loaded.
52 * @section alihltmoduleagent_interface Agent interface
53 * The child can implement the following functions:
54 * - @ref CreateConfigurations <br>
55 * create HLT configuration forming an HLT analysis chain.
57 * - @ref GetLocalRecConfigurations <br>
58 * configurations run during local event reconstruction.
59 * @note Local event reconstruction is the first step of the
60 * reconstruction chain. All events are processed at once.
62 * - @ref GetEventRecConfigurations <br>
63 * configurations run during event reconstruction.
64 * @note This is the reconstruction on event by event basis.
66 * - @ref GetRequiredComponentLibraries <br>
67 * can indicate further libraries which are required for running the
68 * chains (e.g. if components of another library are used).
70 * - @ref RegisterComponents <br>
71 * register componens, this can be used to avoid the component
72 * registration via global objects
73 * @see @ref alihltcomponent-handling
75 * @section alihltmoduleagent_references References
76 * @see @ref AliHLTReconstructor interface to the AliRoot reconstruction
77 * @see @ref AliHLTAgentSample agent for the libAliHLTSample library
79 * @ingroup alihlt_system
81 class AliHLTModuleAgent : public TObject, public AliHLTLogging {
84 * standard constructor. The agent is automatically registered in the
85 * global agent manager
88 /** not a valid copy constructor, defined according to effective C++ style */
89 AliHLTModuleAgent(const AliHLTModuleAgent&);
90 /** not a valid assignment op, but defined according to effective C++ style */
91 AliHLTModuleAgent& operator=(const AliHLTModuleAgent&);
93 virtual ~AliHLTModuleAgent();
97 * Short summary on registered agents. This function acts globally on the
98 * list of agents if no specific agent is specified.
100 static void PrintStatus(const char* agent=NULL);
103 * Get the first agent in the list
104 * @return pointer to first agent in the list, NULL if empty
106 static AliHLTModuleAgent* GetFirstAgent();
109 * Get the next agent in the list
110 * @return pointer to next agent in the list, NULL if end of list
112 static AliHLTModuleAgent* GetNextAgent();
115 * Register all configurations belonging to this module with the
116 * AliHLTConfigurationHandler. The agent can adapt the configurations
117 * to be registered to the current AliRoot setup by checking the
119 * @param handler [in] the configuration handler
120 * @param runloader [in] AliRoot runloader
121 * @return neg. error code if failed
123 virtual int CreateConfigurations(AliHLTConfigurationHandler* handler,
124 AliRunLoader* runloader=NULL) const;
127 * Get the top configurations for local event reconstruction.
128 * A top configuration describes a processing chain. It can simply be
129 * described by the last configuration(s) in the chain.
130 * The agent can adapt the configurations to be registered to the current
131 * AliRoot setup by checking the runloader.
132 * @param runloader [in] AliRoot runloader
133 * @return string containing the top configurations separated by blanks
135 virtual const char* GetLocalRecConfigurations(AliRunLoader* runloader=NULL) const;
138 * Get the top configurations for event reconstruction.
139 * The same as for @ref GetLocalRecConfigurations, but for the reconstruction on
140 * event by event basis.
141 * @param runloader [in] AliRoot runloader
142 * @return string containing the top configurations separated by blanks
144 virtual const char* GetEventRecConfigurations(AliRunLoader* runloader=NULL) const;
147 * Component libraries which the configurations of this agent depend on.
148 * @return list of component libraries as a blank-separated string.
150 virtual const char* GetRequiredComponentLibraries() const;
153 * Register componets.
154 * This method can be used to register components for the module instead
155 * of the 'static object approach'. Registration is don by passing a
156 * sample object to @ref AliHLTComponentHandler::RegisterComponent<br>
157 * \em Note: The sample object is owned by the agent, make sure to delete
160 virtual int RegisterComponents(AliRunLoader* runloader=NULL) const;
163 * Old method kept for backward compatibility, redirected to @ref
164 * GetLocalRecConfigurations.
166 const char* GetTopConfigurations(AliRunLoader* runloader=NULL) const {
167 return GetLocalRecConfigurations(runloader);
174 * Register agent in the global list.
175 * @return neg. error code if failed
177 static int Register(AliHLTModuleAgent* pAgent);
180 * Unregister agent in the global list.
181 * @return neg. error code if failed
183 static int Unregister(AliHLTModuleAgent* pAgent);
185 /** the list of active agents */
186 static TList fgAgentList;
188 /** the current object link (list position) */
189 static TObjLink* fgCurrentLnk;
191 ClassDef(AliHLTModuleAgent, 0);