]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/sim/AliHLTSimulation.h
activating individual HLT simulations from digits and raw data
[u/mrichter/AliRoot.git] / HLT / sim / AliHLTSimulation.h
index eead445c82596a5940b77b21e618622cf132d05d..c3c517451d28e17825ea054671829ee6a91e72dd 100644 (file)
@@ -1,5 +1,5 @@
 //-*- Mode: C++ -*-
-// @(#) $Id$
+// $Id$
 
 #ifndef ALIHLTSIMULATION_H
 #define ALIHLTSIMULATION_H
@@ -7,31 +7,84 @@
  * ALICE Experiment at CERN, All rights reserved.                         *
  * See cxx source for full Copyright notice                               */
 
-/** @file   AliHLTSimulation.h
-    @author Matthias Richter
-    @date   
-    @brief  Binding class for HLT simulation in AliRoot
-
-// see below for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-                                                                          */
+/// @file   AliHLTSimulation.h
+/// @author Matthias Richter
+/// @date   
+/// @brief  Binding class for HLT simulation in AliRoot
+///
+
 /**
- * @defgroup alihlt_simulation HLT simulation in AliRoot
+ * @defgroup alihlt_aliroot_simulation HLT simulation in AliRoot
  * This section describes the the simulation of the HLT in AliRoot.
+ *
+ * @section alihlt_aliroot_simulation_intro General Remarks
+ * HLT has a special role in the normal data flow  of simulation and
+ * reconstruction. Since the HLT reconstruction and analysis runs on-line
+ * on the HLT farm, the raw data produced by HLT as a detector contains
+ * already reconstructed events. Consequently, the HLT response has to be
+ * simulated as well as the data of all other detectors. Since the detector
+ * data is needed, the HLT simulation is run at the end of AliSimulation.
+ * As a matter of fact, HLT always reconstructs data, <em><b>HLT simulation
+ * </b></em> means <em><b>HLT reconstruction embedded into AliRoot</b></em>.
+ *
+ * @section alihlt_aliroot_simulation_steering Steering
+ * The AliHLTSimulation class is the steering class called from AliSimulation.
+ * An instance of AliHLTSystem is used to run the chains defined by the
+ * available libraries or a AliHLTConfiguration configuration macro.
+ *
+ * The libraries to be loaded can be specified as an option to AliSimulation.
+ * <pre>
+ * AliSimulation sim;
+ * sim.SetRunHLT("libAliHLTSample.so");
+ * </pre>
+ * @see AliHLTSimulation for further details
+ *
+ * @section alihlt_aliroot_simulation_running Running
+ * The actual chains to be run depend on the HLT library modules which 
+ * are loaded to the system. There is a default collection of libraries 
+ * defined in AliHLTSystem::fgkHLTDefaultLibs. The default libraries are 
+ * loaded if nothing else is specified. The libraries implement \em agents 
+ * (AliHLTModuleAgent childs) describing the properties of a module.
+ *
+ * @section alihlt_aliroot_simulation_examples Examples
+ * - @ref tut_simulation 
+ *
+ * @ingroup alihlt_system
  */
 
 #include "TObject.h"
 #include "TString.h"
 class AliRunLoader;
-class AliHLTSystem;
+class AliHLTPluginBase;
 class AliRawReader;
+class AliSimulation;
+class AliHLTSystem;
 
 /**
  * @class AliHLTSimulation
- * Base class of HLT data processing simulations.
+ * Plugin for HLT reconstruction embedded into <tt>AliSimulation</tt>.
+ *
+ * The libraries to be loaded can be specified as an option to AliSimulation.
+ * <pre>
+ * AliSimulation sim;
+ * sim.SetRunHLT("libAliHLTSample.so");
+ * </pre>
+ * will only load <tt>libAliHLTSample.so</tt>
+ *
+ * Other available options:
+ * \li loglevel=<i>level</i>                                            <br>
+ *     logging level for this processing, default level is 0x79 filtering
+ *     out everything below level 'warning'. 0x7c allows info messages as
+ *     well, 0x3f is the highest loglevel.
+ * \li alilog=off                                                       <br>
+ *     disable redirection of log messages to AliLog class
+ * \li config=<i>macro</i>                                              <br>
+ *     configuration macro: normal ROOT macro defining HLT component
+ *     configurations by means of AliHLTConfiguration.
+ * \li chains=<i>configuration</i>                                      <br>
+ *     comma separated list of configurations to be run during simulation
+ *
+ *  @ingroup alihlt_aliroot_simulation
  */
 class AliHLTSimulation : public TObject {
  public:
@@ -44,9 +97,19 @@ class AliHLTSimulation : public TObject {
   /** init simulation */
   int Init(AliRunLoader* pRunLoader, const char* options);
 
+  int ConfigureHLTSystem(AliHLTSystem* pSystem, const char* options, AliRunLoader* pRunLoader, AliRawReader* pRawReader) const;
+
   /** run simulation with an instance of the run loader */
   int Run(AliRunLoader* pRunLoader);
 
+  /// run reconstruction cycle for AliHLTSystem
+  int RunHLTSystem(AliHLTSystem* pSystem, AliRunLoader* pRunLoader, AliRawReader* pRawReader) const;
+
+  enum EOptions {
+    // indicate that only one chain should be run, behavior before Dec 2010
+    kOneChain = BIT(15)
+  };
+
  private:
   /** standard constructor */
   AliHLTSimulation();
@@ -60,19 +123,20 @@ class AliHLTSimulation : public TObject {
   /* current options */
   TString fOptions;                                                   //!transient
 
-  /* HLT steering object */
-  AliHLTSystem* fpSystem;                                             //!transient
+  /** base class for AliRoot HLT plugins */
+  AliHLTPluginBase* fpPluginBase;                                     //!transient
 
-  /* RAW reader instance for chains which need RAW data as input */
-  AliRawReader* fpRawReader;                                            //!transient
+  /** RAW reader instance for chains which need RAW data as input */
+  AliRawReader* fpRawReader;                                          //!transient
 
-  ClassDef(AliHLTSimulation, 1)
+  ClassDef(AliHLTSimulation, 2)
 };
 
 #define ALIHLTSIMULATION_LIBRARY             "libHLTsim.so"
-#define ALIHLTSIMULATION_LIBRARY_VERSION     0
+#define ALIHLTSIMULATION_LIBRARY_VERSION     1
 #define ALIHLTSIMULATION_CREATE_INSTANCE     "AliHLTSimulationCreateInstance"
 #define ALIHLTSIMULATION_DELETE_INSTANCE     "AliHLTSimulationDeleteInstance"
+#define ALIHLTSIMULATION_SETUP               "AliHLTSimulationSetup"
 #define ALIHLTSIMULATION_INIT                "AliHLTSimulationInit"
 #define ALIHLTSIMULATION_RUN                 "AliHLTSimulationRun"
 #define ALIHLTSIMULATION_GET_LIBRARY_VERSION "AliHLTSimulationGetLibraryVersion"
@@ -82,9 +146,11 @@ extern "C" {
 #endif
   typedef AliHLTSimulation* (*AliHLTSimulationCreateInstance_t)();
   typedef int (*AliHLTSimulationDeleteInstance_t)(AliHLTSimulation* pSim);
+  typedef int (*AliHLTSimulationSetup_t)(AliHLTSimulation* pHLTSim, AliSimulation* pSim, const char* options);
   typedef int (*AliHLTSimulationInit_t)(AliHLTSimulation* pSim, AliRunLoader* pRunLoader, const char* options);
   typedef int (*AliHLTSimulationRun_t)(AliHLTSimulation* pSim, AliRunLoader* pRunLoader);
   typedef int (*AliHLTSimulationGetLibraryVersion_t)();
+  typedef int (*AliHLTSimulationInitOCDB_t)(AliHLTSimulation* pSim);
 
   /**
    * Create an instance of the AliHLTSimulation class
@@ -95,7 +161,15 @@ extern "C" {
    */
   int AliHLTSimulationDeleteInstance(AliHLTSimulation* pSim);
   /**
-   * Set options for an instance
+   * Setup the HLT simulation.
+   * Setup is done right after the creation. To be called before
+   * the actual AliSimulation starts when the OCDB is not yet locked.
+   */
+  int AliHLTSimulationSetup(AliHLTSimulation* pHLTSim, AliSimulation* pSim, const char* options);
+  /**
+   * Set options for an instance.
+   * Init is invoked right before running HLT simulation, i.e. after all
+   * the other AliSimulation was done
    */
   int AliHLTSimulationInit(AliHLTSimulation* pSim, AliRunLoader* pRunLoader, const char* options);
   /**