3 #ifndef ALIHLTMODULEAGENT_H
4 #define ALIHLTMODULEAGENT_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
8 /** @file AliHLTModuleAgent.h
9 @author Matthias Richter
11 @brief Agent helper class for component libraries.
12 @note The class is used in Offline (AliRoot) context
17 #include "AliHLTLogging.h"
18 #include "AliHLTConfiguration.h"
19 #include "AliHLTConfigurationHandler.h"
24 * @class AliHLTModuleAgent
25 * @brief Agent helper class for HLT sub modules, e.g. PHOS, TPC, Trigger
27 * This class implements the agent base class for the HLT sub modules.
28 * The agent of a library gives information on the features of the library/
29 * components, like the configurations to run and other component libraries
31 * @note There must not be more than one agent per module/library.
33 * All HLT component libraries are loaded on demand through the HLT steering
34 * instance (@ref AliHLTSystem). A library can implement an agent derived
35 * from this base class, and has to define one global object of this agent
36 * in the code. The agent will be registered automatically, and the features
37 * can be queried when required.
39 * This is usually done during running the AliRoot reconstruction (see AliRoot
40 * documentation on <tt> AliReconstruction</tt>). The HLT implemets the @ref
41 * AliHLTReconstructor which holds the HLT steering object. Several flags can
42 * be specified as options via the <tt>SetOption</tt> method of
43 * <tt>AliReconstruction</tt>, including the component libraries to be loaded.
45 * @section alihltmoduleagent_interface Agent interface
46 * The child can implement the following functions:
47 * - @ref CreateConfigurations <br>
48 * create HLT configuration forming an HLT analysis chain.
50 * - @ref GetLocalRecConfigurations <br>
51 * configurations run during local event reconstruction.
52 * @note Local event reconstruction is the first step of the
53 * reconstruction chain. All events are processed at once.
55 * - @ref GetEventRecConfigurations <br>
56 * configurations run during event reconstruction.
57 * @note This is the reconstruction on event by event basis.
59 * - @ref GetRequiredComponentLibraries <br>
60 * can indicate further libraries which are required for running the
61 * chains (e.g. if components of another library are used).
63 * - @ref RegisterComponents <br>
64 * register componens, this can be used to avoid the component
65 * registration via global objects
66 * @see @ref alihltcomponent-handling
68 * @section alihltmoduleagent_references References
69 * @see @ref AliHLTReconstructor interface to the AliRoot reconstruction
70 * @see @ref AliHLTAgentSample agent for the libAliHLTSample library
72 * @ingroup alihlt_system
74 class AliHLTModuleAgent : public TObject, public AliHLTLogging {
77 * standard constructor. The agent is automatically registered in the
78 * global agent manager
81 /** not a valid copy constructor, defined according to effective C++ style */
82 AliHLTModuleAgent(const AliHLTModuleAgent&);
83 /** not a valid assignment op, but defined according to effective C++ style */
84 AliHLTModuleAgent& operator=(const AliHLTModuleAgent&);
86 virtual ~AliHLTModuleAgent();
90 * Short summary on registered agents. This function acts globally on the
91 * list of agents if no specific agent is specified.
93 static void PrintStatus(const char* agent=NULL);
96 * Get the first agent in the list
97 * @return pointer to first agent in the list, NULL if empty
99 static AliHLTModuleAgent* GetFirstAgent();
102 * Get the next agent in the list
103 * @return pointer to next agent in the list, NULL if end of list
105 static AliHLTModuleAgent* GetNextAgent();
108 * Register all configurations belonging to this module with the
109 * AliHLTConfigurationHandler. The agent can adapt the configurations
110 * to be registered to the current AliRoot setup by checking the
112 * @param handler [in] the configuration handler
113 * @param runloader [in] AliRoot runloader
114 * @return neg. error code if failed
116 virtual int CreateConfigurations(AliHLTConfigurationHandler* handler,
117 AliRunLoader* runloader=NULL) const;
120 * Get the top configurations for local event reconstruction.
121 * A top configuration describes a processing chain. It can simply be
122 * described by the last configuration(s) in the chain.
123 * The agent can adapt the configurations to be registered to the current
124 * AliRoot setup by checking the runloader.
125 * @param runloader [in] AliRoot runloader
126 * @return string containing the top configurations separated by blanks
128 virtual const char* GetLocalRecConfigurations(AliRunLoader* runloader=NULL) const;
131 * Get the top configurations for event reconstruction.
132 * The same as for @ref GetLocalRecConfigurations, but for the reconstruction on
133 * event by event basis.
134 * @param runloader [in] AliRoot runloader
135 * @return string containing the top configurations separated by blanks
137 virtual const char* GetEventRecConfigurations(AliRunLoader* runloader=NULL) const;
140 * Component libraries which the configurations of this agent depend on.
141 * @return list of component libraries as a blank-separated string.
143 virtual const char* GetRequiredComponentLibraries() const;
146 * Register componets.
147 * This method can be used to register components for the module instead
148 * of the 'static object approach'. Registration is don by passing a
149 * sample object to @ref AliHLTComponentHandler::RegisterComponent<br>
150 * \em Note: The sample object is owned by the agent, make sure to delete
153 virtual int RegisterComponents(AliRunLoader* runloader=NULL) const;
156 * Old method kept for backward compatibility, redirected to @ref
157 * GetLocalRecConfigurations.
159 const char* GetTopConfigurations(AliRunLoader* runloader=NULL) const {
160 return GetLocalRecConfigurations(runloader);
167 * Register agent in the global list.
168 * @return neg. error code if failed
170 static int Register(AliHLTModuleAgent* pAgent);
173 * Unregister agent in the global list.
174 * @return neg. error code if failed
176 static int Unregister(AliHLTModuleAgent* pAgent);
178 /** the list of active agents */
179 static TList fgAgentList;
181 /** the current object link (list position) */
182 static TObjLink* fgCurrentLnk;
184 ClassDef(AliHLTModuleAgent, 0);