]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/sim/AliHLTSimulation.h
The description of changes:
[u/mrichter/AliRoot.git] / HLT / sim / AliHLTSimulation.h
1 //-*- Mode: C++ -*-
2 // @(#) $Id$
3
4 #ifndef ALIHLTSIMULATION_H
5 #define ALIHLTSIMULATION_H
6 /* This file is property of and copyright by the ALICE HLT Project        * 
7  * ALICE Experiment at CERN, All rights reserved.                         *
8  * See cxx source for full Copyright notice                               */
9
10 /** @file   AliHLTSimulation.h
11     @author Matthias Richter
12     @date   
13     @brief  Binding class for HLT simulation in AliRoot
14
15 // see below for class documentation
16 // or
17 // refer to README to build package
18 // or
19 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
20                                                                           */
21 /**
22  * @defgroup alihlt_aliroot_simulation HLT simulation in AliRoot
23  * This section describes the the simulation of the HLT in AliRoot.
24  *
25  * @section alihlt_aliroot_simulation_intro General Remarks
26  * HLT has a special role in the normal data flow  of simulation and
27  * reconstruction. Since the HLT reconstruction and analysis runs on-line
28  * on the HLT farm, the raw data produced by HLT as a detector contains
29  * already reconstructed events. Consequently, the HLT response has to be
30  * simulated as well as the data of all other detectors. Since the detector
31  * data is needed, the HLT simulation is run at the end of AliSimulation.
32  * As a matter of fact, HLT always reconstructs data, <em><b>HLT simulation
33  * </b></em> means <em><b>HLT reconstruction embedded into AliRoot</b></em>.
34  *
35  * @section alihlt_aliroot_simulation_steering Steering
36  * The AliHLTSimulation class is the steering class called from AliSimulation.
37  * An instance of AliHLTSystem is used to run the chains defined by the
38  * available libraries or a AliHLTConfiguration configuration macro.
39  *
40  * The libraries to be loaded can be specified as an option to AliSimulation.
41  * <pre>
42  * AliSimulation sim;
43  * sim.SetRunHLT("libAliHLTSample.so");
44  * </pre>
45  * @see AliHLTSimulation for further details
46  *
47  * @section alihlt_aliroot_simulation_running Running
48  * The actual chains to be run depend on the HLT library modules which 
49  * are loaded to the system. There is a default collection of libraries 
50  * defined in AliHLTSystem::fgkHLTDefaultLibs. The default libraries are 
51  * loaded if nothing else is specified. The libraries implement \em agents 
52  * (AliHLTModuleAgent childs) describing the properties of a module.
53  *
54  * @section alihlt_aliroot_simulation_examples Examples
55  * - @ref tut_simulation 
56  *
57  * @ingroup alihlt_system
58  */
59
60 #include "TObject.h"
61 #include "TString.h"
62 class AliRunLoader;
63 class AliHLTPluginBase;
64 class AliRawReader;
65 class AliSimulation;
66
67 /**
68  * @class AliHLTSimulation
69  * Plugin for HLT reconstruction embedded into <tt>AliSimulation</tt>.
70  *
71  * The libraries to be loaded can be specified as an option to AliSimulation.
72  * <pre>
73  * AliSimulation sim;
74  * sim.SetRunHLT("libAliHLTSample.so");
75  * </pre>
76  * will only load <tt>libAliHLTSample.so</tt>
77  *
78  * Other available options:
79  * \li loglevel=<i>level</i>                                            <br>
80  *     logging level for this processing, default level is 0x79 filtering
81  *     out everything below level 'warning'. 0x7c allows info messages as
82  *     well, 0x3f is the highest loglevel.
83  * \li alilog=off                                                       <br>
84  *     disable redirection of log messages to AliLog class
85  * \li config=<i>macro</i>                                              <br>
86  *     configuration macro: normal ROOT macro defining HLT component
87  *     configurations by means of AliHLTConfiguration.
88  * \li chains=<i>configuration</i>                                      <br>
89  *     comma separated list of configurations to be run during simulation
90  *
91  *  @ingroup alihlt_aliroot_simulation
92  */
93 class AliHLTSimulation : public TObject {
94  public:
95   /** create an instance of the class */
96   static AliHLTSimulation* CreateInstance();
97
98   /** delete an instance */
99   static int DeleteInstance(AliHLTSimulation* pSim);
100
101   /** init simulation */
102   int Init(AliRunLoader* pRunLoader, const char* options);
103
104   /** run simulation with an instance of the run loader */
105   int Run(AliRunLoader* pRunLoader);
106
107  private:
108   /** standard constructor */
109   AliHLTSimulation();
110   /** copy constructor prohibited */
111   AliHLTSimulation(const AliHLTSimulation&);
112   /** assignment operator prohibited */
113   AliHLTSimulation& operator=(const AliHLTSimulation&);
114   /** standard destructor */
115   ~AliHLTSimulation();
116
117   /* current options */
118   TString fOptions;                                                   //!transient
119
120   /** base class for AliRoot HLT plugins */
121   AliHLTPluginBase* fpPluginBase;                                     //!transient
122
123   /** RAW reader instance for chains which need RAW data as input */
124   AliRawReader* fpRawReader;                                          //!transient
125
126   ClassDef(AliHLTSimulation, 2)
127 };
128
129 #define ALIHLTSIMULATION_LIBRARY             "libHLTsim.so"
130 #define ALIHLTSIMULATION_LIBRARY_VERSION     1
131 #define ALIHLTSIMULATION_CREATE_INSTANCE     "AliHLTSimulationCreateInstance"
132 #define ALIHLTSIMULATION_DELETE_INSTANCE     "AliHLTSimulationDeleteInstance"
133 #define ALIHLTSIMULATION_SETUP               "AliHLTSimulationSetup"
134 #define ALIHLTSIMULATION_INIT                "AliHLTSimulationInit"
135 #define ALIHLTSIMULATION_RUN                 "AliHLTSimulationRun"
136 #define ALIHLTSIMULATION_GET_LIBRARY_VERSION "AliHLTSimulationGetLibraryVersion"
137
138 #ifdef __cplusplus
139 extern "C" {
140 #endif
141   typedef AliHLTSimulation* (*AliHLTSimulationCreateInstance_t)();
142   typedef int (*AliHLTSimulationDeleteInstance_t)(AliHLTSimulation* pSim);
143   typedef int (*AliHLTSimulationSetup_t)(AliHLTSimulation* pHLTSim, AliSimulation* pSim, const char* options);
144   typedef int (*AliHLTSimulationInit_t)(AliHLTSimulation* pSim, AliRunLoader* pRunLoader, const char* options);
145   typedef int (*AliHLTSimulationRun_t)(AliHLTSimulation* pSim, AliRunLoader* pRunLoader);
146   typedef int (*AliHLTSimulationGetLibraryVersion_t)();
147   typedef int (*AliHLTSimulationInitOCDB_t)(AliHLTSimulation* pSim);
148
149   /**
150    * Create an instance of the AliHLTSimulation class
151    */
152   AliHLTSimulation* AliHLTSimulationCreateInstance();
153   /**
154    * Delete an instance of the AliHLTSimulation class
155    */
156   int AliHLTSimulationDeleteInstance(AliHLTSimulation* pSim);
157   /**
158    * Setup the HLT simulation.
159    * Setup is done right after the creation. To be called before
160    * the actual AliSimulation starts when the OCDB is not yet locked.
161    */
162   int AliHLTSimulationSetup(AliHLTSimulation* pHLTSim, AliSimulation* pSim, const char* options);
163   /**
164    * Set options for an instance.
165    * Init is invoked right before running HLT simulation, i.e. after all
166    * the other AliSimulation was done
167    */
168   int AliHLTSimulationInit(AliHLTSimulation* pSim, AliRunLoader* pRunLoader, const char* options);
169   /**
170    * Run simulation for an instance and run loader
171    */
172   int AliHLTSimulationRun(AliHLTSimulation* pSim, AliRunLoader* pRunLoader);
173   /**
174    * Get version no of the library/class interface
175    */
176   int AliHLTSimulationGetLibraryVersion();
177 #ifdef __cplusplus
178 }
179 #endif
180
181 #endif