]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
introducing a new Setup method, handles by now the definition of transient OCDB objec...
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Jun 2009 12:59:30 +0000 (12:59 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Jun 2009 12:59:30 +0000 (12:59 +0000)
HLT/sim/AliHLTSimulation.cxx
HLT/sim/AliHLTSimulation.h
HLT/sim/Makefile.am

index 66e5d8aa04ea254ca8b9372ca4d51e15994ee624..01b1c7a90fb11d3681cc7e62edca581e4226c8ef 100644 (file)
@@ -26,6 +26,7 @@
 #include "TObjArray.h"
 #include "TObjString.h"
 #include "AliHLTSimulation.h"
+#include "AliSimulation.h"
 #include "AliLog.h"
 #include "AliRun.h"
 #include "AliRunLoader.h"
@@ -336,7 +337,7 @@ int AliHLTSimulationGetLibraryVersion()
   return LIBHLTSIM_VERSION;
 }
 
-int AliHLTSimulationInitOCDB(AliHLTSimulation* /*pSim*/)
+int AliHLTSimulationSetup(AliHLTSimulation* /*pHLTSim*/, AliSimulation* pSim, const char* specificObjects)
 {
   // see header file for function documentation
 
@@ -345,20 +346,36 @@ int AliHLTSimulationInitOCDB(AliHLTSimulation* /*pSim*/)
   // all the jobs want to put entries into the OCDB. The solution is to
   // make them temporary, since they are only used to propagate information
   // from the simulation to the reconstruction.
-  AliCDBManager* man = AliCDBManager::Instance();
-  if (man && man->IsDefaultStorageSet())
-  {
-    man->SetSpecificStorage("HLT/ConfigHLT/SolenoidBz", Form("local://%s",gSystem->pwd()));
-    man->SetSpecificStorage("HLT/ConfigHLT/esdLayout", Form("local://%s",gSystem->pwd()));
+
+  if (!pSim) return -EINVAL;
+  const char* entries[]={
+    "HLT/ConfigHLT/SolenoidBz",
+    "HLT/ConfigHLT/esdLayout",
+    NULL
+  };
+
+  TString specificStorage; 
+  specificStorage.Form("local://%s",gSystem->pwd());
+  for (const char** pEntry=entries; *pEntry!=NULL; pEntry++) {
+    const char* pObject=specificObjects?strstr(specificObjects, *pEntry):NULL;
+    if (pObject) {
+      // skip this entry if it is found in the list and either
+      // last one or separated by a blank
+      pObject+=strlen(*pEntry);
+      if (*pObject==0 || *pObject==' ') continue;
+    }
+    pSim->SetSpecificStorage(*pEntry, specificStorage.Data());
   }
 
   return 0;
 }
 
-extern "C" void AliHLTSimulationCompileInfo(const char*& date, const char*& time)
+#ifndef HAVE_COMPILEINFO
+extern "C" void CompileInfo(const char*& date, const char*& time)
 {
   // the fall back compile info of the HLTsim library
   // this is not up-to-date if other files have been changed and recompiled
   date=__DATE__; time=__TIME__;
   return;
 }
+#endif
index cb7a8be04443079fed68ae4465ef190701d365a0..d15f01c02058c30cd7c173fe60829a93d4f1a463 100644 (file)
@@ -62,6 +62,7 @@
 class AliRunLoader;
 class AliHLTPluginBase;
 class AliRawReader;
+class AliSimulation;
 
 /**
  * @class AliHLTSimulation
@@ -129,6 +130,7 @@ class AliHLTSimulation : public TObject {
 #define ALIHLTSIMULATION_LIBRARY_VERSION     0
 #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"
@@ -138,6 +140,7 @@ 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)();
@@ -152,7 +155,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);
   /**
@@ -163,10 +174,6 @@ extern "C" {
    * Get version no of the library/class interface
    */
   int AliHLTSimulationGetLibraryVersion();
-  /**
-   * Init the OCDB for HLT simulation
-   */
-  int AliHLTSimulationInitOCDB(AliHLTSimulation* pSim);
 #ifdef __cplusplus
 }
 #endif
index 613167dc4973e5be2bd1d25781e91779da77bd92..a7d0a5fbc4b9d27f9a3022824c10e071ff053f58 100644 (file)
@@ -22,6 +22,7 @@ include $(top_srcdir)/libHLTsim.pkg
 
 # compiler flags
 AM_CPPFLAGS                    = -DMODULE=$(MODULE) \
+                                 -DHAVE_COMPILEINFO \
                                  $(PACKCXXFLAGS) \
                                  $(foreach i, $(EINCLUDE),  \
                                        $(shell echo $(i) | sed -e "/HLT\//!d" -e "s|HLT/|-I$(top_srcdir)/|")) \