(Haavard)
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModuleAgent.h
CommitLineData
30338a30 1//-*- Mode: C++ -*-
242bb794 2// @(#) $Id$
3
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 */
8
9/** @file AliHLTModuleAgent.h
10 @author Matthias Richter
11 @date
12 @brief Agent helper class for component libraries.
13 @note The class is used in Offline (AliRoot) context
14*/
15
30338a30 16// see below for class documentation
17// or
18// refer to README to build package
19// or
20// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
21
242bb794 22#include <TObject.h>
23#include <TList.h>
24#include "AliHLTLogging.h"
25#include "AliHLTConfiguration.h"
26#include "AliHLTConfigurationHandler.h"
27
28class AliRunLoader;
29
30/**
31 * @class AliHLTModuleAgent
32 * @brief Agent helper class for HLT sub modules, e.g. PHOS, TPC, Trigger
33 *
c215072c 34 * This class implements the agent base class for the HLT sub modules.
90ebac25 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
37 * it depends on.
38 * @note There must not be more than one agent per module/library.
39 *
c215072c 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.
45 *
90ebac25 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.
51 *
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.
56 *
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.
61 * <br>
62 * - @ref GetEventRecConfigurations <br>
63 * configurations run during event reconstruction.
64 * @note This is the reconstruction on event by event basis.
65 * <br>
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).
242bb794 69 *
90ebac25 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
74 * <br>
75 * @section alihltmoduleagent_references References
76 * @see @ref AliHLTReconstructor interface to the AliRoot reconstruction
77 * @see @ref AliHLTAgentSample agent for the libAliHLTSample library
242bb794 78 *
79 * @ingroup alihlt_system
80 */
81class AliHLTModuleAgent : public TObject, public AliHLTLogging {
82 public:
83 /**
84 * standard constructor. The agent is automatically registered in the
85 * global agent manager
86 */
87 AliHLTModuleAgent();
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&);
92 /** destructor */
93 virtual ~AliHLTModuleAgent();
94
95 /**
96 * Print status info.
90ebac25 97 * Short summary on registered agents. This function acts globally on the
98 * list of agents if no specific agent is specified.
242bb794 99 */
100 static void PrintStatus(const char* agent=NULL);
101
102 /**
103 * Get the first agent in the list
104 * @return pointer to first agent in the list, NULL if empty
105 */
106 static AliHLTModuleAgent* GetFirstAgent();
107
108 /**
109 * Get the next agent in the list
110 * @return pointer to next agent in the list, NULL if end of list
111 */
112 static AliHLTModuleAgent* GetNextAgent();
113
114 /**
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
118 * runloader.
96bda103 119 * @param handler [in] the configuration handler
120 * @param runloader [in] AliRoot runloader
242bb794 121 * @return neg. error code if failed
122 */
123 virtual int CreateConfigurations(AliHLTConfigurationHandler* handler,
124 AliRunLoader* runloader=NULL) const;
125
126 /**
90ebac25 127 * Get the top configurations for local event reconstruction.
242bb794 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.
96bda103 132 * @param runloader [in] AliRoot runloader
242bb794 133 * @return string containing the top configurations separated by blanks
134 */
90ebac25 135 virtual const char* GetLocalRecConfigurations(AliRunLoader* runloader=NULL) const;
136
137 /**
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
143 */
144 virtual const char* GetEventRecConfigurations(AliRunLoader* runloader=NULL) const;
242bb794 145
146 /**
147 * Component libraries which the configurations of this agent depend on.
148 * @return list of component libraries as a blank-separated string.
149 */
150 virtual const char* GetRequiredComponentLibraries() const;
151
152 /**
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
158 * it.
159 */
160 virtual int RegisterComponents(AliRunLoader* runloader=NULL) const;
161
90ebac25 162 /**
163 * Old method kept for backward compatibility, redirected to @ref
164 * GetLocalRecConfigurations.
165 */
166 const char* GetTopConfigurations(AliRunLoader* runloader=NULL) const {
167 return GetLocalRecConfigurations(runloader);
168 }
169
242bb794 170 protected:
171
172 private:
173 /**
174 * Register agent in the global list.
175 * @return neg. error code if failed
176 */
177 static int Register(AliHLTModuleAgent* pAgent);
178
179 /**
180 * Unregister agent in the global list.
181 * @return neg. error code if failed
182 */
183 static int Unregister(AliHLTModuleAgent* pAgent);
184
185 /** the list of active agents */
186 static TList fgAgentList;
187
188 /** the current object link (list position) */
189 static TObjLink* fgCurrentLnk;
190
191 ClassDef(AliHLTModuleAgent, 0);
192};
193
194#endif